@sentry/junior 0.314.0 → 0.316.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{channel-access-BOL29BG3.js → adapter-context-Bref7aPI.js} +42 -3
- package/dist/{admin-BXGAySz0.js → admin-QYiDMnsu.js} +1 -1
- package/dist/agent-runner-Cr5Fhjf-.js +23870 -0
- package/dist/{agent-update-delivery-CZ5M8RDa.js → agent-update-delivery-BY13DPSD.js} +46 -9
- package/dist/api/schema.d.ts +9549 -2
- package/dist/api/schema.js +4 -6
- package/dist/api.d.ts +2 -3
- package/dist/api.js +747 -293
- package/dist/{app-D7tKnw9a.d.ts → app-BhvzRD__.d.ts} +314 -29
- package/dist/app.d.ts +1 -1
- package/dist/app.js +268 -58
- package/dist/change-record-Bqsa5ZXE.d.ts +175 -0
- package/dist/chat-core-engine-3dtlMku3.js +123 -0
- package/dist/cli/chat.d.ts +4 -1
- package/dist/cli/chat.js +39 -21
- package/dist/cli/check.js +4 -4
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +3 -4
- package/dist/cli/run.d.ts +1 -1
- package/dist/cli/run.js +1 -1
- package/dist/cli/snapshot-create.js +2 -5
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +46 -74
- package/dist/{continue-in-slack-fnmD2Ifb.js → continue-in-slack-DbQUFe_F.js} +3 -5
- package/dist/{conversation-feed-DdFQuQDR.js → conversation-feed-B84pMjHo.js} +28 -3
- package/dist/{conversation-turn-DScuDYmN.js → conversation-turn-DzEpTIaf.js} +152 -199
- package/dist/{create-CrNt4Ewu.js → create-DUJBXr6E.js} +4 -4
- package/dist/{credential-sync-CtqsGjj1.js → credential-sync-JH_K9Adg.js} +10 -15
- package/dist/db-BpxcYXfD.d.ts +2 -0
- package/dist/{credentialed-dWRA3-oJ.js → db-DhzvUY23.js} +21830 -9264
- package/dist/deployment-BhvrhQeh.js +51 -0
- package/dist/engine-context-C9Nal48K.js +1814 -0
- package/dist/{html-B8rBt7F4.js → html-B_12WjKT.js} +2 -5
- package/dist/instrumentation.js +2 -2
- package/dist/job-runner-DO8nslyY.js +1139 -0
- package/dist/{lineage-EULJkGO1.js → lineage-D3AZAJVe.js} +1 -1
- package/dist/{list-C5400AlJ.js → list-B0zsb5Cp.js} +307 -146
- package/dist/{markers-DUP8aBOp.js → list-mkB_GU8R.js} +96 -124
- package/dist/local-server-CpnGhYml.js +276 -0
- package/dist/{conversation-privacy-DtZhI91r.js → logging-B8KEJegM.js} +2 -231
- package/dist/{media-FYM-Bl3H.js → media-BebquhET.js} +684 -37
- package/dist/{message-DuDelZFr.js → message-B5fKDYzz.js} +18 -16
- package/dist/{model-input-0osF3pBS.js → model-input-CuMWy37l.js} +3 -3
- package/dist/nitro.d.ts +7 -1
- package/dist/nitro.js +48 -293
- package/dist/{oauth-callback-server-DX2fQ7Nq.js → oauth-callback-server-B3Vvlydo.js} +2 -2
- package/dist/{oauth-relay-PwPMdZJv.js → oauth-relay-6ERrGPbA.js} +1 -1
- package/dist/{package-discovery-DD9vencX.js → package-discovery-BI6T_RkD.js} +50 -1
- package/dist/people-CUtFApfL.js +81 -0
- package/dist/proxy-path-BTmXDjfx.js +203 -0
- package/dist/{resolve-D8CPJcNK.js → resolve-D5JVvv6A.js} +229 -4
- package/dist/{result-D090hxr5.js → result-CS_7mo8a.js} +95 -144
- package/dist/{runner-BU7fgrm-.js → runner-BzAES5W3.js} +7 -7
- package/dist/{sandbox-egress-signals-BUmVrsoG.js → sandbox-egress-signals-Dwhk2Q5F.js} +1 -1
- package/dist/{schema-7gW9vBpJ.js → schema-z5-wA6N4.js} +132 -15
- package/dist/{service-account-plA-uzIB.js → service-account-D6AsAtc1.js} +1 -3
- package/dist/{mailbox-turn-DL3Lvsm0.js → session-stop-DponjDUZ.js} +3259 -3793
- package/dist/{skills-CIosT6bS.js → skills-DgJ9GBPR.js} +4 -4
- package/dist/{slack-conversation-unfurl-CBgZqth6.js → slack-conversation-unfurl-Dq71EkhM.js} +6 -8
- package/dist/{spawn-DRjdzh3R.js → spawn-BJWpdwhQ.js} +4 -5
- package/dist/start-conversation-B-LIqqNi.js +162 -0
- package/dist/system-prompt-table-iIgpmslr.js +1171 -0
- package/dist/{task-runner-C-pXsgHM.js → task-runner-BJae4JwE.js} +83 -17
- package/dist/{thread-context-CDX4dSZd.js → thread-context-fiMNylbg.js} +5 -6
- package/dist/topic-CRYYBYp-.js +7 -0
- package/dist/transcript-CCi7323k.js +410 -0
- package/dist/turn-session-routing-D15orfwy.js +1309 -0
- package/dist/{turn-wake-Bzq1Efrm.js → turn-wake-BjDW7x-5.js} +5 -7
- package/dist/{validation-bTq88sya.js → validation-D5WmmmhX.js} +1 -1
- package/dist/{version-DGUa1dZK.js → version-CBQoanXb.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/virtual-module-BeKA_EII.js +12 -0
- package/dist/{worker-AkZg7Dg1.js → worker-Cyb4kF17.js} +3 -5
- package/migrations/20260711145847_initial/snapshot.json +2103 -0
- package/migrations/20260711145900_conversation_metrics/snapshot.json +135 -0
- package/migrations/20260712153649_conversation_message_search/snapshot.json +50 -0
- package/migrations/20260713040256_peaceful_scalphunter/snapshot.json +42 -0
- package/migrations/20260715174202_useful_magus/snapshot.json +42 -0
- package/migrations/20260715174203_conversation_events/snapshot.json +539 -0
- package/migrations/20260723042835_drop_legacy_conversation_messages/snapshot.json +9 -0
- package/migrations/20260723050612_thick_sugar_man/snapshot.json +120 -0
- package/migrations/20260727223822_sticky_rage/snapshot.json +274 -0
- package/migrations/20260728033158_slippery_harrier/snapshot.json +191 -0
- package/migrations/20260728040836_native_conversation_history/snapshot.json +9 -0
- package/migrations/20260728204900_sour_golden_guardian/snapshot.json +124 -0
- package/migrations/20260730233332_structured_conversation_events/snapshot.json +9 -0
- package/migrations/20260731164038_conversation_session_source/snapshot.json +42 -0
- package/migrations/20260801230336_source_visibility/snapshot.json +9 -0
- package/migrations/20260802023731_magical_ezekiel_stane/snapshot.json +266 -0
- package/migrations/20260804015843_neat_the_anarchist/snapshot.json +714 -0
- package/migrations/20260804165952_drop_paused_scheduled_tasks/snapshot.json +9 -0
- package/migrations/20260804225613_curvy_excalibur/snapshot.json +223 -0
- package/migrations/20260805174033_lowly_valkyrie/snapshot.json +344 -0
- package/migrations/20260805200301_restrict_task_execution_kinds/snapshot.json +36 -0
- package/migrations/20260806030729_first_warhawk/snapshot.json +690 -0
- package/migrations/20260807185200_task_execution_status/snapshot.json +92 -0
- package/migrations/20260808014743_task_title_columns/snapshot.json +68 -0
- package/migrations/20260809220421_misty_typhoid_mary/snapshot.json +191 -0
- package/migrations/20260811193709_mcp_credential_subject/snapshot.json +9 -0
- package/migrations/20260812032924_conversation_event_actor_and_participants/snapshot.json +393 -0
- package/migrations/20260812172418_attachment_storage/snapshot.json +341 -0
- package/migrations/20260813230732_artifacts/snapshot.json +349 -0
- package/migrations/20260814062905_dizzy_barracuda/snapshot.json +342 -0
- package/migrations/20260814231353_drop_workspace_repo_primary/snapshot.json +55 -0
- package/migrations/20260815030100_wild_phantom_reporter/snapshot.json +135 -0
- package/migrations/20260817082233_workspace_snapshots_table/snapshot.json +625 -0
- package/migrations/20260818160339_workspace_snapshot_active_build/snapshot.json +62 -0
- package/migrations/20260821180755_strong_randall/snapshot.json +42 -0
- package/migrations/20260823030308_workspace_snapshot_size_bytes/snapshot.json +62 -0
- package/migrations/20260824190313_complex_rage/snapshot.json +690 -0
- package/migrations/20260827233711_conversation_location/snapshot.json +42 -0
- package/migrations/20260901224306_event_task_status/snapshot.json +100 -0
- package/migrations/20260904153232_attachment_provider/snapshot.json +234 -0
- package/migrations/20260909111415_conversation_briefs/snapshot.json +364 -0
- package/migrations/20260910144928_automation_outcomes_backfill/snapshot.json +9 -0
- package/migrations/20260911184346_conversation_metrics/snapshot.json +226 -0
- package/migrations/20260921140842_scheduled_automation_channel_destinations/snapshot.json +9 -0
- package/migrations/20260922221709_event_automation_channel_destinations/snapshot.json +9 -0
- package/migrations/20261001113455_conversation_forks/snapshot.json +120 -0
- package/migrations/20261005161844_automation_versions/snapshot.json +150 -0
- package/migrations/20261006152043_user_timezone/snapshot.json +37 -0
- package/migrations/20261008200858_user_admin/snapshot.json +37 -0
- package/migrations/20261009145407_event_automation_status_reason/snapshot.json +42 -0
- package/migrations/20261013160816_agent_invocation_parent_mailbox/snapshot.json +93 -0
- package/migrations/20261013215020_agent_invocation_parent_tool_call/snapshot.json +42 -0
- package/migrations/20261014011138_agent_invocation_title/snapshot.json +42 -0
- package/migrations/20261014211942_conversation_stopped_at/snapshot.json +42 -0
- package/migrations/20261015012820_flowery_rage/snapshot.json +42 -0
- package/migrations/20261017000924_automations/snapshot.json +790 -0
- package/migrations/20261017134736_automation_runs/snapshot.json +474 -0
- package/migrations/20261017170250_drop_legacy_automation_tables/snapshot.json +397 -0
- package/migrations/20261018134754_automation_creator_identity/snapshot.json +130 -0
- package/migrations/20261023071954_automation_run_version/snapshot.json +79 -0
- package/migrations/20261025233137_identity_signed_in_at/snapshot.json +42 -0
- package/migrations/20261027234315_workspace_vcpus/snapshot.json +37 -0
- package/migrations/20261028124242_plugin_report_index/snapshot.json +68 -0
- package/migrations/20261028154230_agent_invocation_type/snapshot.json +42 -0
- package/migrations/20261030021803_any_resource_event_triggers/snapshot.json +42 -0
- package/migrations/20261030234309_user_customization/snapshot.json +37 -0
- package/migrations/20261031020656_review_items/snapshot.json +1078 -0
- package/migrations/20261031024151_review_item_dedupe_tenant/snapshot.json +62 -0
- package/migrations/20261031024246_review_item_slack_cards/snapshot.json +159 -0
- package/migrations/20261031155308_system_identity/snapshot.json +9 -0
- package/migrations/20261101193952_review_item_foreign_keys/snapshot.json +108 -0
- package/migrations/20261102172751_review_item_turn/snapshot.json +42 -0
- package/migrations/20261102221411_conversation_read_positions/snapshot.json +190 -0
- package/migrations/20261104085028_conversation_quick_question/snapshot.json +42 -0
- package/migrations/20261104145136_conversation_participant_pins/snapshot.json +42 -0
- package/migrations/20261104164429_conversation_detail_version/snapshot.json +42 -0
- package/migrations/20261104172055_conversation_auto_archive/snapshot.json +206 -0
- package/migrations/20261105005443_drop_agent_invocation_model_profile/snapshot.json +30 -0
- package/migrations/20261105043807_plugin_conversation_index/snapshot.json +76 -0
- package/migrations/20261105051837_conversation_event_author_index/snapshot.json +70 -0
- package/migrations/20261105182854_conversation_event_latest_message_indexes/snapshot.json +136 -0
- package/migrations/20261106011443_conversation_pin_position/snapshot.json +42 -0
- package/migrations/20261106095004_push_notifications/snapshot.json +308 -0
- package/migrations/20261106162740_conversation_kind/snapshot.json +88 -0
- package/migrations/20261107002001_read_position_backfill/snapshot.json +9 -0
- package/migrations/20261107025209_child_archived_at/snapshot.json +42 -0
- package/migrations/20261107035735_shared_archive/snapshot.json +67 -0
- package/migrations/20261107215055_child_location/snapshot.json +9 -0
- package/migrations/20261108191927_conversation_unsubscribe/snapshot.json +42 -0
- package/migrations/20261109021618_conversation_paused_status/snapshot.json +9 -0
- package/migrations/20261109111553_guardian_review_time_index/snapshot.json +54 -0
- package/migrations/20261109173130_conversation_participant_unsubscribed_index/snapshot.json +62 -0
- package/migrations/20261109182006_turn_metric_actor/snapshot.json +128 -0
- package/migrations/20261109202836_participant_root_actor_backfill/snapshot.json +9 -0
- package/migrations/20261109232640_conversation_delivery_paused_at/snapshot.json +42 -0
- package/migrations/20261110120937_web_linked_slack_identity_repair/snapshot.json +9 -0
- package/migrations/20261110175824_automation_task_kind/snapshot.json +145 -0
- package/migrations/20261110210242_conversation_kind_automation/snapshot.json +55 -0
- package/migrations/20261110222632_review_item_plugin_actions/snapshot.json +37 -0
- package/migrations/20261110225157_conversation_last_message_at/snapshot.json +42 -0
- package/migrations/20261111013351_automation_task_kind_repair/snapshot.json +9 -0
- package/migrations/20261111163126_drop_legacy_columns/snapshot.json +9 -0
- package/migrations/20261111170150_code_change_last_activity/snapshot.json +42 -0
- package/migrations/20261111191441_agent_invocation_fork/snapshot.json +42 -0
- package/migrations/20261112142841_code_change_draft/snapshot.json +37 -0
- package/migrations/20261112202901_attachment_uploads/snapshot.json +255 -0
- package/migrations/20261112220407_conversation_agent_config/snapshot.json +42 -0
- package/migrations/20261113081247_attachment_deferred_download/snapshot.json +52 -0
- package/migrations/20261113225551_conversation_embeddings/snapshot.json +203 -0
- package/migrations/20261114213238_user_preferences/snapshot.json +37 -0
- package/migrations/20261114222527_code_change_repository_state_index/snapshot.json +70 -0
- package/migrations/20261115172605_attachment_kinds/snapshot.json +244 -0
- package/migrations/20261115173004_attachment_url_fill/snapshot.json +9 -0
- package/migrations/20261115180216_attachment_url_index/snapshot.json +62 -0
- package/migrations/20261116103700_plan_items/snapshot.json +420 -0
- package/migrations/20261117100100_automation_creator_slack_index/snapshot.json +62 -0
- package/migrations/20261117132522_conversation_event_search/snapshot.json +396 -0
- package/migrations/20261117164007_automation_last_run/snapshot.json +108 -0
- package/migrations/20261117164047_automation_last_run_index/snapshot.json +54 -0
- package/migrations/20261117210444_money_micro_usd/snapshot.json +68 -0
- package/migrations/20261117210505_conversation_cost_micro_usd/snapshot.json +9 -0
- package/migrations/20261118081416_people_list_metric_index/snapshot.json +86 -0
- package/migrations/20261118095216_automation_rollout_repair/snapshot.json +9 -0
- package/migrations/20261118143948_cache_warming_history_reset/snapshot.json +9 -0
- package/migrations/20261119040651_artifact_visibility/snapshot.json +132 -0
- package/migrations/20261119040715_artifact_public_sha_index/snapshot.json +9 -0
- package/migrations/20261119052706_artifact_drop_public/snapshot.json +71 -0
- package/migrations/20261119053831_artifact_path/snapshot.json +114 -0
- package/migrations/20261119053844_artifact_path_index/snapshot.json +9 -0
- package/migrations/20261119091949_review_item_answered_index/snapshot.json +70 -0
- package/migrations/20261119100029_review_item_status_index/snapshot.json +54 -0
- package/migrations/20261119165607_brief_outcome_status/snapshot.json +42 -0
- package/migrations/20261119165622_brief_outcome_status_backfill/snapshot.json +9 -0
- package/migrations/20261119213716_brief_created_at_index/snapshot.json +62 -0
- package/migrations/20261119222456_slack_person_search_index/snapshot.json +50 -0
- package/migrations/20261119225522_code_change_size/snapshot.json +104 -0
- package/migrations/20261119232253_merge_conflict_notice_dismiss/snapshot.json +9 -0
- package/migrations/20261119235649_inbox_snoozes/snapshot.json +605 -0
- package/migrations/20261120093118_code_change_search_index/snapshot.json +89 -0
- package/migrations/20261120093452_review_item_owner/snapshot.json +314 -0
- package/migrations/20261120185654_review_item_owner_index/snapshot.json +62 -0
- package/migrations/20261120185754_memory_core_adoption/snapshot.json +1184 -0
- package/migrations/20261120185854_memory_core_indexes/snapshot.json +70 -0
- package/migrations/20261120235226_todos/snapshot.json +473 -0
- package/migrations/20261121082316_inbox_items/snapshot.json +2026 -0
- package/migrations/20261121175651_todo_changed_by_agent/snapshot.json +42 -0
- package/migrations/20261121183527_inbox_item_subject_title_parts/snapshot.json +42 -0
- package/migrations/20261121194143_inbox_snooze_wake_reason/snapshot.json +42 -0
- package/migrations/20261121222400_authorization_request_index/snapshot.json +62 -0
- package/migrations/20261121225908_conversation_metadata/snapshot.json +184 -0
- package/migrations/20261121225910_conversation_metadata_fill/snapshot.json +9 -0
- package/migrations/20261121225913_conversation_search_index/snapshot.json +50 -0
- package/migrations/20261122022900_inbox_item_legacy_automation_keys/snapshot.json +9 -0
- package/migrations/20261122024454_artifact_expiry/snapshot.json +37 -0
- package/migrations/20261122024455_artifact_permanent_sha_index/snapshot.json +62 -0
- package/migrations/20261122024457_artifact_drop_public_sha_index/snapshot.json +37 -0
- package/migrations/20261122024458_conversation_kind_lead/snapshot.json +55 -0
- package/migrations/20261122024459_conversation_lead_actor_index/snapshot.json +54 -0
- package/migrations/20261122071549_keep_legacy_archive_columns/snapshot.json +49 -0
- package/migrations/20261122191400_conversation_embeddings_fk_validate/snapshot.json +9 -0
- package/migrations/20261122204325_money_micro_usd_repair/snapshot.json +9 -0
- package/migrations/20261122204326_agent_config_backfill/snapshot.json +143 -0
- package/migrations/20261122221456_inbox_item_deliveries/snapshot.json +301 -0
- package/migrations/20261123155735_pg_trgm/snapshot.json +9 -0
- package/migrations/20261123155739_search_indexes/snapshot.json +167 -0
- package/migrations/20261123172647_drop_legacy_archive_columns/snapshot.json +9 -0
- package/migrations/20261123192506_memory_prefix_index/snapshot.json +69 -0
- package/migrations/20261123201740_todo_search_indexes/snapshot.json +89 -0
- package/migrations/20261123211505_todo_inbox_items/snapshot.json +38 -0
- package/migrations/20261123214917_drop_code_urls/snapshot.json +44 -0
- package/migrations/20261123224000_code_change_conversations_index/migration.sql +1 -0
- package/migrations/20261123224000_code_change_conversations_index/snapshot.json +54 -0
- package/migrations/20261124122023_drop_code_change_sizes/migration.sql +4 -0
- package/migrations/20261124122023_drop_code_change_sizes/snapshot.json +82 -0
- package/migrations/20261124142958_conversation_root_lookup_index/migration.sql +1 -0
- package/migrations/20261124142958_conversation_root_lookup_index/snapshot.json +62 -0
- package/migrations/20261124183352_legacy_brief_metadata_fill/migration.sql +26 -0
- package/migrations/20261124183352_legacy_brief_metadata_fill/snapshot.json +114 -0
- package/migrations/20261124202143_drizzle_v1_baseline/migration.sql +5 -0
- package/migrations/20261124202143_drizzle_v1_baseline/snapshot.json +2012 -0
- package/migrations/20261124221751_spaces/migration.sql +22 -0
- package/migrations/20261124221751_spaces/snapshot.json +436 -0
- package/migrations/20261124230319_conversation_metrics_utc_day_stats/migration.sql +11 -0
- package/migrations/20261124230319_conversation_metrics_utc_day_stats/snapshot.json +9 -0
- package/migrations/20261124234024_space_conversations/migration.sql +5 -0
- package/migrations/20261124234024_space_conversations/snapshot.json +103 -0
- package/migrations/20261124234026_space_conversations_index/migration.sql +1 -0
- package/migrations/20261124234026_space_conversations_index/snapshot.json +62 -0
- package/migrations/20261125012448_drop_lead_actor_index/migration.sql +3 -0
- package/migrations/20261125012448_drop_lead_actor_index/snapshot.json +36 -0
- package/migrations/20261125012452_space_lead_index/migration.sql +1 -0
- package/migrations/20261125012452_space_lead_index/snapshot.json +54 -0
- package/migrations/20261125043821_space_configurations/migration.sql +11 -0
- package/migrations/20261125043821_space_configurations/snapshot.json +194 -0
- package/migrations/20261125064854_agent_update_done_status/migration.sql +9 -0
- package/migrations/20261125064854_agent_update_done_status/snapshot.json +9 -0
- package/migrations/20261125073321_turn_engine_tables/migration.sql +75 -0
- package/migrations/20261125073321_turn_engine_tables/snapshot.json +1497 -0
- package/migrations/20261125073339_turn_inbox_one_source/migration.sql +5 -0
- package/migrations/20261125073339_turn_inbox_one_source/snapshot.json +9 -0
- package/migrations/20261125124506_versions_notify/migration.sql +27 -0
- package/migrations/20261125124506_versions_notify/snapshot.json +9 -0
- package/migrations/20261125140339_turn_group_key/migration.sql +14 -0
- package/migrations/20261125140339_turn_group_key/snapshot.json +75 -0
- package/migrations/20261125140343_turn_group_key_not_null/migration.sql +4 -0
- package/migrations/20261125140343_turn_group_key_not_null/snapshot.json +29 -0
- package/migrations/20261125142845_code_change_requesters/migration.sql +1 -0
- package/migrations/20261125142845_code_change_requesters/snapshot.json +42 -0
- package/migrations/20261125142846_code_change_requesters_index/migration.sql +1 -0
- package/migrations/20261125142846_code_change_requesters_index/snapshot.json +54 -0
- package/migrations/20261125143903_space_visibility/migration.sql +1 -0
- package/migrations/20261125143903_space_visibility/snapshot.json +37 -0
- package/migrations/20261125154848_merge_leaves/migration.sql +2 -0
- package/migrations/20261125154848_merge_leaves/snapshot.json +14 -0
- package/migrations/20261125171254_conversation_visibility/migration.sql +4 -0
- package/migrations/20261125171254_conversation_visibility/snapshot.json +67 -0
- package/migrations/20261125171257_conversation_visibility_backfill/migration.sql +25 -0
- package/migrations/20261125171257_conversation_visibility_backfill/snapshot.json +9 -0
- package/migrations/20261125213232_drop_versions_notify/migration.sql +19 -0
- package/migrations/20261125213232_drop_versions_notify/snapshot.json +9 -0
- package/migrations/20261125225138_conversation_kind_root_thread/migration.sql +23 -0
- package/migrations/20261125225138_conversation_kind_root_thread/snapshot.json +55 -0
- package/migrations/20261125225142_conversation_kind_root_thread_backfill/migration.sql +7 -0
- package/migrations/20261125225142_conversation_kind_root_thread_backfill/snapshot.json +9 -0
- package/migrations/20261126000151_conversation_event_message_role_seq_index/migration.sql +1 -0
- package/migrations/20261126000151_conversation_event_message_role_seq_index/snapshot.json +69 -0
- package/migrations/20261126012917_merge_leaves/migration.sql +2 -0
- package/migrations/20261126012917_merge_leaves/snapshot.json +12 -0
- package/package.json +13 -12
- package/skills/design-automation-skill/SKILL.md +1 -1
- package/skills/jr-rpc/SKILL.md +3 -5
- package/dist/adapter-JARQvoLw.js +0 -258
- package/dist/adapter-context-B4BrJZuS.js +0 -43
- package/dist/agent-runner-qZU5TR8i.js +0 -11974
- package/dist/agent-update-cS7Z9mnG.js +0 -26
- package/dist/background-compaction-queue-C_uIBUvS.js +0 -145
- package/dist/callback-C8SdXCwr.js +0 -68
- package/dist/catalog-runtime-BLKtnUL3.js +0 -6
- package/dist/config-BIfHKNXN.js +0 -2336
- package/dist/db-BTmLKZrp.js +0 -5804
- package/dist/db-DcmzbA55.d.ts +0 -274
- package/dist/history-CneKY7_V.js +0 -595
- package/dist/install-OtFboxOM.js +0 -228
- package/dist/proxy-path-BHYoKZdq.js +0 -15
- package/dist/registry-D6kS6xYH.js +0 -3024
- package/dist/rule-DAxQY-1h.js +0 -20
- package/dist/schema-BB6E0wyV.d.ts +0 -9472
- package/dist/start-conversation-a4NXH4X9.js +0 -752
- package/dist/store-BuhF1QDm.js +0 -490
- package/dist/task-queue-CrRjFzOh.js +0 -79
- package/dist/turn-session-routing-CZTRU8IY.js +0 -116
- package/dist/vercel-queue-nL0Hq3hr.js +0 -234
- package/dist/warmup-CCOuIwAS.js +0 -12759
- package/migrations/meta/0000_snapshot.json +0 -946
- package/migrations/meta/0001_snapshot.json +0 -972
- package/migrations/meta/0002_snapshot.json +0 -987
- package/migrations/meta/0003_snapshot.json +0 -1035
- package/migrations/meta/0004_snapshot.json +0 -1041
- package/migrations/meta/0005_snapshot.json +0 -948
- package/migrations/meta/0006_snapshot.json +0 -948
- package/migrations/meta/0007_snapshot.json +0 -1013
- package/migrations/meta/0008_snapshot.json +0 -1076
- package/migrations/meta/0009_snapshot.json +0 -1146
- package/migrations/meta/0010_snapshot.json +0 -1190
- package/migrations/meta/0011_snapshot.json +0 -1195
- package/migrations/meta/0012_snapshot.json +0 -1244
- package/migrations/meta/0013_snapshot.json +0 -1250
- package/migrations/meta/0014_snapshot.json +0 -1201
- package/migrations/meta/0015_snapshot.json +0 -1360
- package/migrations/meta/0016_snapshot.json +0 -1617
- package/migrations/meta/0017_snapshot.json +0 -1666
- package/migrations/meta/0018_snapshot.json +0 -1756
- package/migrations/meta/0019_snapshot.json +0 -1904
- package/migrations/meta/0020_snapshot.json +0 -1848
- package/migrations/meta/0021_snapshot.json +0 -2176
- package/migrations/meta/0022_snapshot.json +0 -2186
- package/migrations/meta/0023_snapshot.json +0 -2198
- package/migrations/meta/0024_snapshot.json +0 -2275
- package/migrations/meta/0025_snapshot.json +0 -2275
- package/migrations/meta/0026_snapshot.json +0 -2424
- package/migrations/meta/0027_snapshot.json +0 -2554
- package/migrations/meta/0028_snapshot.json +0 -2685
- package/migrations/meta/0029_snapshot.json +0 -2709
- package/migrations/meta/0030_snapshot.json +0 -2799
- package/migrations/meta/0031_snapshot.json +0 -2823
- package/migrations/meta/0032_snapshot.json +0 -2892
- package/migrations/meta/0033_snapshot.json +0 -2914
- package/migrations/meta/0034_snapshot.json +0 -3038
- package/migrations/meta/0035_snapshot.json +0 -3048
- package/migrations/meta/0036_snapshot.json +0 -3186
- package/migrations/meta/0037_snapshot.json +0 -3192
- package/migrations/meta/0038_snapshot.json +0 -3323
- package/migrations/meta/0039_snapshot.json +0 -3368
- package/migrations/meta/0040_snapshot.json +0 -3516
- package/migrations/meta/0041_snapshot.json +0 -3516
- package/migrations/meta/0042_snapshot.json +0 -3610
- package/migrations/meta/0043_snapshot.json +0 -3610
- package/migrations/meta/0044_snapshot.json +0 -3473
- package/migrations/meta/0045_snapshot.json +0 -3503
- package/migrations/meta/0046_snapshot.json +0 -3707
- package/migrations/meta/0047_snapshot.json +0 -3713
- package/migrations/meta/0048_snapshot.json +0 -3720
- package/migrations/meta/0049_snapshot.json +0 -3581
- package/migrations/meta/0050_snapshot.json +0 -3753
- package/migrations/meta/0051_snapshot.json +0 -3759
- package/migrations/meta/0052_snapshot.json +0 -3765
- package/migrations/meta/0053_snapshot.json +0 -3771
- package/migrations/meta/0054_snapshot.json +0 -3777
- package/migrations/meta/0055_snapshot.json +0 -3948
- package/migrations/meta/0056_snapshot.json +0 -4280
- package/migrations/meta/0057_snapshot.json +0 -3618
- package/migrations/meta/0058_snapshot.json +0 -3598
- package/migrations/meta/0059_snapshot.json +0 -3619
- package/migrations/meta/0060_snapshot.json +0 -3465
- package/migrations/meta/0061_snapshot.json +0 -3471
- package/migrations/meta/0062_snapshot.json +0 -3499
- package/migrations/meta/0063_snapshot.json +0 -3505
- package/migrations/meta/0064_snapshot.json +0 -3505
- package/migrations/meta/0065_snapshot.json +0 -3511
- package/migrations/meta/0066_snapshot.json +0 -4099
- package/migrations/meta/0067_snapshot.json +0 -3921
- package/migrations/meta/0068_snapshot.json +0 -4176
- package/migrations/meta/0069_snapshot.json +0 -3979
- package/migrations/meta/0070_snapshot.json +0 -3997
- package/migrations/meta/0071_snapshot.json +0 -4003
- package/migrations/meta/0072_snapshot.json +0 -4064
- package/migrations/meta/0073_snapshot.json +0 -4070
- package/migrations/meta/0074_snapshot.json +0 -4076
- package/migrations/meta/0075_snapshot.json +0 -4083
- package/migrations/meta/0076_snapshot.json +0 -4147
- package/migrations/meta/0077_snapshot.json +0 -4141
- package/migrations/meta/0078_snapshot.json +0 -4175
- package/migrations/meta/0079_snapshot.json +0 -4203
- package/migrations/meta/0080_snapshot.json +0 -4265
- package/migrations/meta/0081_snapshot.json +0 -4271
- package/migrations/meta/0082_snapshot.json +0 -4373
- package/migrations/meta/0083_snapshot.json +0 -4388
- package/migrations/meta/0084_snapshot.json +0 -4388
- package/migrations/meta/0085_snapshot.json +0 -4394
- package/migrations/meta/0086_snapshot.json +0 -4366
- package/migrations/meta/0087_snapshot.json +0 -4366
- package/migrations/meta/0088_snapshot.json +0 -4372
- package/migrations/meta/0089_snapshot.json +0 -4372
- package/migrations/meta/0090_snapshot.json +0 -4388
- package/migrations/meta/0091_snapshot.json +0 -4410
- package/migrations/meta/0092_snapshot.json +0 -4446
- package/migrations/meta/0093_snapshot.json +0 -4446
- package/migrations/meta/0094_snapshot.json +0 -4452
- package/migrations/meta/0095_snapshot.json +0 -4452
- package/migrations/meta/0096_snapshot.json +0 -4490
- package/migrations/meta/0097_snapshot.json +0 -4490
- package/migrations/meta/0098_snapshot.json +0 -4490
- package/migrations/meta/0099_snapshot.json +0 -4496
- package/migrations/meta/0100_snapshot.json +0 -4496
- package/migrations/meta/0101_snapshot.json +0 -4496
- package/migrations/meta/0102_snapshot.json +0 -4502
- package/migrations/meta/0103_snapshot.json +0 -4509
- package/migrations/meta/0104_snapshot.json +0 -4516
- package/migrations/meta/0105_snapshot.json +0 -4611
- package/migrations/meta/0106_snapshot.json +0 -4617
- package/migrations/meta/0107_snapshot.json +0 -4617
- package/migrations/meta/0108_snapshot.json +0 -4688
- package/migrations/meta/0109_snapshot.json +0 -4925
- package/migrations/meta/0110_snapshot.json +0 -4952
- package/migrations/meta/0111_snapshot.json +0 -5011
- package/migrations/meta/0112_snapshot.json +0 -5011
- package/migrations/meta/0113_snapshot.json +0 -5033
- package/migrations/meta/0114_snapshot.json +0 -5203
- package/migrations/meta/0115_snapshot.json +0 -5225
- package/migrations/meta/0116_snapshot.json +0 -5388
- package/migrations/meta/0117_snapshot.json +0 -5413
- package/migrations/meta/0118_snapshot.json +0 -5428
- package/migrations/meta/0119_snapshot.json +0 -5441
- package/migrations/meta/0120_snapshot.json +0 -5441
- package/migrations/meta/0121_snapshot.json +0 -5481
- package/migrations/meta/0122_snapshot.json +0 -5481
- package/migrations/meta/0123_snapshot.json +0 -5481
- package/migrations/meta/0124_snapshot.json +0 -5516
- package/migrations/meta/0125_snapshot.json +0 -5516
- package/migrations/meta/0126_snapshot.json +0 -5488
- package/migrations/meta/0127_snapshot.json +0 -5519
- package/migrations/meta/0128_snapshot.json +0 -5519
- package/migrations/meta/0129_snapshot.json +0 -5547
- package/migrations/meta/0130_snapshot.json +0 -5563
- package/migrations/meta/0131_snapshot.json +0 -5569
- package/migrations/meta/0132_snapshot.json +0 -5569
- package/migrations/meta/0133_snapshot.json +0 -5590
- package/migrations/meta/0134_snapshot.json +0 -5606
- package/migrations/meta/0135_snapshot.json +0 -5624
- package/migrations/meta/0136_snapshot.json +0 -5624
- package/migrations/meta/0137_snapshot.json +0 -5864
- package/migrations/meta/0138_snapshot.json +0 -5894
- package/migrations/meta/0139_snapshot.json +0 -5898
- package/migrations/meta/0140_snapshot.json +0 -5919
- package/migrations/meta/0141_snapshot.json +0 -6429
- package/migrations/meta/0142_snapshot.json +0 -6457
- package/migrations/meta/0143_snapshot.json +0 -6434
- package/migrations/meta/0144_snapshot.json +0 -6434
- package/migrations/meta/0145_snapshot.json +0 -6440
- package/migrations/meta/0146_snapshot.json +0 -6446
- package/migrations/meta/0147_snapshot.json +0 -6452
- package/migrations/meta/0148_snapshot.json +0 -6474
- package/migrations/meta/0149_snapshot.json +0 -6490
- package/migrations/meta/0150_snapshot.json +0 -6490
- package/migrations/meta/0151_snapshot.json +0 -6505
- package/migrations/meta/0152_snapshot.json +0 -6505
- package/migrations/meta/0153_snapshot.json +0 -6511
- package/migrations/meta/0154_snapshot.json +0 -6533
- package/migrations/meta/0155_snapshot.json +0 -6511
- package/migrations/meta/0156_snapshot.json +0 -6511
- package/migrations/meta/0157_snapshot.json +0 -6527
- package/migrations/meta/0158_snapshot.json +0 -6515
- package/migrations/meta/0159_snapshot.json +0 -6515
- package/migrations/meta/0160_snapshot.json +0 -6515
- package/migrations/meta/0161_snapshot.json +0 -6278
- package/migrations/meta/0162_snapshot.json +0 -6404
- package/migrations/meta/0163_snapshot.json +0 -6404
- package/migrations/meta/0164_snapshot.json +0 -6466
- package/migrations/meta/0165_snapshot.json +0 -6466
- package/migrations/meta/0166_snapshot.json +0 -6494
- package/migrations/meta/0167_snapshot.json +0 -6525
- package/migrations/meta/0168_snapshot.json +0 -6525
- package/migrations/meta/0169_snapshot.json +0 -6513
- package/migrations/meta/_journal.json +0 -1196
- /package/migrations/{0000_initial.sql → 20260711145847_initial/migration.sql} +0 -0
- /package/migrations/{0001_conversation_metrics.sql → 20260711145900_conversation_metrics/migration.sql} +0 -0
- /package/migrations/{0002_conversation_message_search.sql → 20260712153649_conversation_message_search/migration.sql} +0 -0
- /package/migrations/{0003_peaceful_scalphunter.sql → 20260713040256_peaceful_scalphunter/migration.sql} +0 -0
- /package/migrations/{0004_useful_magus.sql → 20260715174202_useful_magus/migration.sql} +0 -0
- /package/migrations/{0005_conversation_events.sql → 20260715174203_conversation_events/migration.sql} +0 -0
- /package/migrations/{0006_drop_legacy_conversation_messages.sql → 20260723042835_drop_legacy_conversation_messages/migration.sql} +0 -0
- /package/migrations/{0007_thick_sugar_man.sql → 20260723050612_thick_sugar_man/migration.sql} +0 -0
- /package/migrations/{0008_sticky_rage.sql → 20260727223822_sticky_rage/migration.sql} +0 -0
- /package/migrations/{0009_slippery_harrier.sql → 20260728033158_slippery_harrier/migration.sql} +0 -0
- /package/migrations/{0010_native_conversation_history.sql → 20260728040836_native_conversation_history/migration.sql} +0 -0
- /package/migrations/{0011_sour_golden_guardian.sql → 20260728204900_sour_golden_guardian/migration.sql} +0 -0
- /package/migrations/{0012_structured_conversation_events.sql → 20260730233332_structured_conversation_events/migration.sql} +0 -0
- /package/migrations/{0013_conversation_session_source.sql → 20260731164038_conversation_session_source/migration.sql} +0 -0
- /package/migrations/{0014_source_visibility.sql → 20260801230336_source_visibility/migration.sql} +0 -0
- /package/migrations/{0015_magical_ezekiel_stane.sql → 20260802023731_magical_ezekiel_stane/migration.sql} +0 -0
- /package/migrations/{0016_neat_the_anarchist.sql → 20260804015843_neat_the_anarchist/migration.sql} +0 -0
- /package/migrations/{0017_drop_paused_scheduled_tasks.sql → 20260804165952_drop_paused_scheduled_tasks/migration.sql} +0 -0
- /package/migrations/{0018_curvy_excalibur.sql → 20260804225613_curvy_excalibur/migration.sql} +0 -0
- /package/migrations/{0019_lowly_valkyrie.sql → 20260805174033_lowly_valkyrie/migration.sql} +0 -0
- /package/migrations/{0020_restrict_task_execution_kinds.sql → 20260805200301_restrict_task_execution_kinds/migration.sql} +0 -0
- /package/migrations/{0021_first_warhawk.sql → 20260806030729_first_warhawk/migration.sql} +0 -0
- /package/migrations/{0022_task_execution_status.sql → 20260807185200_task_execution_status/migration.sql} +0 -0
- /package/migrations/{0023_task_title_columns.sql → 20260808014743_task_title_columns/migration.sql} +0 -0
- /package/migrations/{0024_misty_typhoid_mary.sql → 20260809220421_misty_typhoid_mary/migration.sql} +0 -0
- /package/migrations/{0025_mcp_credential_subject.sql → 20260811193709_mcp_credential_subject/migration.sql} +0 -0
- /package/migrations/{0026_conversation_event_actor_and_participants.sql → 20260812032924_conversation_event_actor_and_participants/migration.sql} +0 -0
- /package/migrations/{0027_attachment_storage.sql → 20260812172418_attachment_storage/migration.sql} +0 -0
- /package/migrations/{0028_artifacts.sql → 20260813230732_artifacts/migration.sql} +0 -0
- /package/migrations/{0029_dizzy_barracuda.sql → 20260814062905_dizzy_barracuda/migration.sql} +0 -0
- /package/migrations/{0030_drop_workspace_repo_primary.sql → 20260814231353_drop_workspace_repo_primary/migration.sql} +0 -0
- /package/migrations/{0031_wild_phantom_reporter.sql → 20260815030100_wild_phantom_reporter/migration.sql} +0 -0
- /package/migrations/{0032_workspace_snapshots_table.sql → 20260817082233_workspace_snapshots_table/migration.sql} +0 -0
- /package/migrations/{0033_workspace_snapshot_active_build.sql → 20260818160339_workspace_snapshot_active_build/migration.sql} +0 -0
- /package/migrations/{0034_strong_randall.sql → 20260821180755_strong_randall/migration.sql} +0 -0
- /package/migrations/{0035_workspace_snapshot_size_bytes.sql → 20260823030308_workspace_snapshot_size_bytes/migration.sql} +0 -0
- /package/migrations/{0036_complex_rage.sql → 20260824190313_complex_rage/migration.sql} +0 -0
- /package/migrations/{0037_conversation_location.sql → 20260827233711_conversation_location/migration.sql} +0 -0
- /package/migrations/{0038_event_task_status.sql → 20260901224306_event_task_status/migration.sql} +0 -0
- /package/migrations/{0039_attachment_provider.sql → 20260904153232_attachment_provider/migration.sql} +0 -0
- /package/migrations/{0040_conversation_briefs.sql → 20260909111415_conversation_briefs/migration.sql} +0 -0
- /package/migrations/{0041_automation_outcomes_backfill.sql → 20260910144928_automation_outcomes_backfill/migration.sql} +0 -0
- /package/migrations/{0042_conversation_metrics.sql → 20260911184346_conversation_metrics/migration.sql} +0 -0
- /package/migrations/{0043_scheduled_automation_channel_destinations.sql → 20260921140842_scheduled_automation_channel_destinations/migration.sql} +0 -0
- /package/migrations/{0044_event_automation_channel_destinations.sql → 20260922221709_event_automation_channel_destinations/migration.sql} +0 -0
- /package/migrations/{0045_conversation_forks.sql → 20261001113455_conversation_forks/migration.sql} +0 -0
- /package/migrations/{0046_automation_versions.sql → 20261005161844_automation_versions/migration.sql} +0 -0
- /package/migrations/{0047_user_timezone.sql → 20261006152043_user_timezone/migration.sql} +0 -0
- /package/migrations/{0048_user_admin.sql → 20261008200858_user_admin/migration.sql} +0 -0
- /package/migrations/{0049_event_automation_status_reason.sql → 20261009145407_event_automation_status_reason/migration.sql} +0 -0
- /package/migrations/{0050_agent_invocation_parent_mailbox.sql → 20261013160816_agent_invocation_parent_mailbox/migration.sql} +0 -0
- /package/migrations/{0051_agent_invocation_parent_tool_call.sql → 20261013215020_agent_invocation_parent_tool_call/migration.sql} +0 -0
- /package/migrations/{0052_agent_invocation_title.sql → 20261014011138_agent_invocation_title/migration.sql} +0 -0
- /package/migrations/{0053_conversation_stopped_at.sql → 20261014211942_conversation_stopped_at/migration.sql} +0 -0
- /package/migrations/{0054_flowery_rage.sql → 20261015012820_flowery_rage/migration.sql} +0 -0
- /package/migrations/{0055_automations.sql → 20261017000924_automations/migration.sql} +0 -0
- /package/migrations/{0056_automation_runs.sql → 20261017134736_automation_runs/migration.sql} +0 -0
- /package/migrations/{0057_drop_legacy_automation_tables.sql → 20261017170250_drop_legacy_automation_tables/migration.sql} +0 -0
- /package/migrations/{0058_automation_creator_identity.sql → 20261018134754_automation_creator_identity/migration.sql} +0 -0
- /package/migrations/{0059_automation_run_version.sql → 20261023071954_automation_run_version/migration.sql} +0 -0
- /package/migrations/{0060_identity_signed_in_at.sql → 20261025233137_identity_signed_in_at/migration.sql} +0 -0
- /package/migrations/{0061_workspace_vcpus.sql → 20261027234315_workspace_vcpus/migration.sql} +0 -0
- /package/migrations/{0062_plugin_report_index.sql → 20261028124242_plugin_report_index/migration.sql} +0 -0
- /package/migrations/{0063_agent_invocation_type.sql → 20261028154230_agent_invocation_type/migration.sql} +0 -0
- /package/migrations/{0064_any_resource_event_triggers.sql → 20261030021803_any_resource_event_triggers/migration.sql} +0 -0
- /package/migrations/{0065_user_customization.sql → 20261030234309_user_customization/migration.sql} +0 -0
- /package/migrations/{0066_review_items.sql → 20261031020656_review_items/migration.sql} +0 -0
- /package/migrations/{0067_review_item_dedupe_tenant.sql → 20261031024151_review_item_dedupe_tenant/migration.sql} +0 -0
- /package/migrations/{0068_review_item_slack_cards.sql → 20261031024246_review_item_slack_cards/migration.sql} +0 -0
- /package/migrations/{0069_system_identity.sql → 20261031155308_system_identity/migration.sql} +0 -0
- /package/migrations/{0070_review_item_foreign_keys.sql → 20261101193952_review_item_foreign_keys/migration.sql} +0 -0
- /package/migrations/{0071_review_item_turn.sql → 20261102172751_review_item_turn/migration.sql} +0 -0
- /package/migrations/{0072_conversation_read_positions.sql → 20261102221411_conversation_read_positions/migration.sql} +0 -0
- /package/migrations/{0073_conversation_quick_question.sql → 20261104085028_conversation_quick_question/migration.sql} +0 -0
- /package/migrations/{0074_conversation_participant_pins.sql → 20261104145136_conversation_participant_pins/migration.sql} +0 -0
- /package/migrations/{0075_conversation_detail_version.sql → 20261104164429_conversation_detail_version/migration.sql} +0 -0
- /package/migrations/{0076_conversation_auto_archive.sql → 20261104172055_conversation_auto_archive/migration.sql} +0 -0
- /package/migrations/{0077_drop_agent_invocation_model_profile.sql → 20261105005443_drop_agent_invocation_model_profile/migration.sql} +0 -0
- /package/migrations/{0078_plugin_conversation_index.sql → 20261105043807_plugin_conversation_index/migration.sql} +0 -0
- /package/migrations/{0079_conversation_event_author_index.sql → 20261105051837_conversation_event_author_index/migration.sql} +0 -0
- /package/migrations/{0080_conversation_event_latest_message_indexes.sql → 20261105182854_conversation_event_latest_message_indexes/migration.sql} +0 -0
- /package/migrations/{0081_conversation_pin_position.sql → 20261106011443_conversation_pin_position/migration.sql} +0 -0
- /package/migrations/{0082_push_notifications.sql → 20261106095004_push_notifications/migration.sql} +0 -0
- /package/migrations/{0083_conversation_kind.sql → 20261106162740_conversation_kind/migration.sql} +0 -0
- /package/migrations/{0084_read_position_backfill.sql → 20261107002001_read_position_backfill/migration.sql} +0 -0
- /package/migrations/{0085_child_archived_at.sql → 20261107025209_child_archived_at/migration.sql} +0 -0
- /package/migrations/{0086_shared_archive.sql → 20261107035735_shared_archive/migration.sql} +0 -0
- /package/migrations/{0087_child_location.sql → 20261107215055_child_location/migration.sql} +0 -0
- /package/migrations/{0088_conversation_unsubscribe.sql → 20261108191927_conversation_unsubscribe/migration.sql} +0 -0
- /package/migrations/{0089_conversation_paused_status.sql → 20261109021618_conversation_paused_status/migration.sql} +0 -0
- /package/migrations/{0090_guardian_review_time_index.sql → 20261109111553_guardian_review_time_index/migration.sql} +0 -0
- /package/migrations/{0091_conversation_participant_unsubscribed_index.sql → 20261109173130_conversation_participant_unsubscribed_index/migration.sql} +0 -0
- /package/migrations/{0092_turn_metric_actor.sql → 20261109182006_turn_metric_actor/migration.sql} +0 -0
- /package/migrations/{0093_participant_root_actor_backfill.sql → 20261109202836_participant_root_actor_backfill/migration.sql} +0 -0
- /package/migrations/{0094_conversation_delivery_paused_at.sql → 20261109232640_conversation_delivery_paused_at/migration.sql} +0 -0
- /package/migrations/{0095_web_linked_slack_identity_repair.sql → 20261110120937_web_linked_slack_identity_repair/migration.sql} +0 -0
- /package/migrations/{0096_automation_task_kind.sql → 20261110175824_automation_task_kind/migration.sql} +0 -0
- /package/migrations/{0097_conversation_kind_automation.sql → 20261110210242_conversation_kind_automation/migration.sql} +0 -0
- /package/migrations/{0098_review_item_plugin_actions.sql → 20261110222632_review_item_plugin_actions/migration.sql} +0 -0
- /package/migrations/{0099_conversation_last_message_at.sql → 20261110225157_conversation_last_message_at/migration.sql} +0 -0
- /package/migrations/{0100_automation_task_kind_repair.sql → 20261111013351_automation_task_kind_repair/migration.sql} +0 -0
- /package/migrations/{0101_drop_legacy_columns.sql → 20261111163126_drop_legacy_columns/migration.sql} +0 -0
- /package/migrations/{0102_code_change_last_activity.sql → 20261111170150_code_change_last_activity/migration.sql} +0 -0
- /package/migrations/{0103_agent_invocation_fork.sql → 20261111191441_agent_invocation_fork/migration.sql} +0 -0
- /package/migrations/{0104_code_change_draft.sql → 20261112142841_code_change_draft/migration.sql} +0 -0
- /package/migrations/{0105_attachment_uploads.sql → 20261112202901_attachment_uploads/migration.sql} +0 -0
- /package/migrations/{0106_conversation_agent_config.sql → 20261112220407_conversation_agent_config/migration.sql} +0 -0
- /package/migrations/{0107_attachment_deferred_download.sql → 20261113081247_attachment_deferred_download/migration.sql} +0 -0
- /package/migrations/{0108_conversation_embeddings.sql → 20261113225551_conversation_embeddings/migration.sql} +0 -0
- /package/migrations/{0109_user_preferences.sql → 20261114213238_user_preferences/migration.sql} +0 -0
- /package/migrations/{0110_code_change_repository_state_index.sql → 20261114222527_code_change_repository_state_index/migration.sql} +0 -0
- /package/migrations/{0111_attachment_kinds.sql → 20261115172605_attachment_kinds/migration.sql} +0 -0
- /package/migrations/{0112_attachment_url_fill.sql → 20261115173004_attachment_url_fill/migration.sql} +0 -0
- /package/migrations/{0113_attachment_url_index.sql → 20261115180216_attachment_url_index/migration.sql} +0 -0
- /package/migrations/{0114_plan_items.sql → 20261116103700_plan_items/migration.sql} +0 -0
- /package/migrations/{0115_automation_creator_slack_index.sql → 20261117100100_automation_creator_slack_index/migration.sql} +0 -0
- /package/migrations/{0116_conversation_event_search.sql → 20261117132522_conversation_event_search/migration.sql} +0 -0
- /package/migrations/{0117_automation_last_run.sql → 20261117164007_automation_last_run/migration.sql} +0 -0
- /package/migrations/{0118_automation_last_run_index.sql → 20261117164047_automation_last_run_index/migration.sql} +0 -0
- /package/migrations/{0119_money_micro_usd.sql → 20261117210444_money_micro_usd/migration.sql} +0 -0
- /package/migrations/{0120_conversation_cost_micro_usd.sql → 20261117210505_conversation_cost_micro_usd/migration.sql} +0 -0
- /package/migrations/{0121_people_list_metric_index.sql → 20261118081416_people_list_metric_index/migration.sql} +0 -0
- /package/migrations/{0122_automation_rollout_repair.sql → 20261118095216_automation_rollout_repair/migration.sql} +0 -0
- /package/migrations/{0123_cache_warming_history_reset.sql → 20261118143948_cache_warming_history_reset/migration.sql} +0 -0
- /package/migrations/{0124_artifact_visibility.sql → 20261119040651_artifact_visibility/migration.sql} +0 -0
- /package/migrations/{0125_artifact_public_sha_index.sql → 20261119040715_artifact_public_sha_index/migration.sql} +0 -0
- /package/migrations/{0126_artifact_drop_public.sql → 20261119052706_artifact_drop_public/migration.sql} +0 -0
- /package/migrations/{0127_artifact_path.sql → 20261119053831_artifact_path/migration.sql} +0 -0
- /package/migrations/{0128_artifact_path_index.sql → 20261119053844_artifact_path_index/migration.sql} +0 -0
- /package/migrations/{0129_review_item_answered_index.sql → 20261119091949_review_item_answered_index/migration.sql} +0 -0
- /package/migrations/{0130_review_item_status_index.sql → 20261119100029_review_item_status_index/migration.sql} +0 -0
- /package/migrations/{0131_brief_outcome_status.sql → 20261119165607_brief_outcome_status/migration.sql} +0 -0
- /package/migrations/{0132_brief_outcome_status_backfill.sql → 20261119165622_brief_outcome_status_backfill/migration.sql} +0 -0
- /package/migrations/{0133_brief_created_at_index.sql → 20261119213716_brief_created_at_index/migration.sql} +0 -0
- /package/migrations/{0134_slack_person_search_index.sql → 20261119222456_slack_person_search_index/migration.sql} +0 -0
- /package/migrations/{0135_code_change_size.sql → 20261119225522_code_change_size/migration.sql} +0 -0
- /package/migrations/{0136_merge_conflict_notice_dismiss.sql → 20261119232253_merge_conflict_notice_dismiss/migration.sql} +0 -0
- /package/migrations/{0137_inbox_snoozes.sql → 20261119235649_inbox_snoozes/migration.sql} +0 -0
- /package/migrations/{0138_code_change_search_index.sql → 20261120093118_code_change_search_index/migration.sql} +0 -0
- /package/migrations/{0139_review_item_owner.sql → 20261120093452_review_item_owner/migration.sql} +0 -0
- /package/migrations/{0140_review_item_owner_index.sql → 20261120185654_review_item_owner_index/migration.sql} +0 -0
- /package/migrations/{0141_memory_core_adoption.sql → 20261120185754_memory_core_adoption/migration.sql} +0 -0
- /package/migrations/{0142_memory_core_indexes.sql → 20261120185854_memory_core_indexes/migration.sql} +0 -0
- /package/migrations/{0143_todos.sql → 20261120235226_todos/migration.sql} +0 -0
- /package/migrations/{0144_inbox_items.sql → 20261121082316_inbox_items/migration.sql} +0 -0
- /package/migrations/{0145_todo_changed_by_agent.sql → 20261121175651_todo_changed_by_agent/migration.sql} +0 -0
- /package/migrations/{0146_inbox_item_subject_title_parts.sql → 20261121183527_inbox_item_subject_title_parts/migration.sql} +0 -0
- /package/migrations/{0147_inbox_snooze_wake_reason.sql → 20261121194143_inbox_snooze_wake_reason/migration.sql} +0 -0
- /package/migrations/{0148_authorization_request_index.sql → 20261121222400_authorization_request_index/migration.sql} +0 -0
- /package/migrations/{0149_conversation_metadata.sql → 20261121225908_conversation_metadata/migration.sql} +0 -0
- /package/migrations/{0150_conversation_metadata_fill.sql → 20261121225910_conversation_metadata_fill/migration.sql} +0 -0
- /package/migrations/{0151_conversation_search_index.sql → 20261121225913_conversation_search_index/migration.sql} +0 -0
- /package/migrations/{0152_inbox_item_legacy_automation_keys.sql → 20261122022900_inbox_item_legacy_automation_keys/migration.sql} +0 -0
- /package/migrations/{0153_artifact_expiry.sql → 20261122024454_artifact_expiry/migration.sql} +0 -0
- /package/migrations/{0154_artifact_permanent_sha_index.sql → 20261122024455_artifact_permanent_sha_index/migration.sql} +0 -0
- /package/migrations/{0155_artifact_drop_public_sha_index.sql → 20261122024457_artifact_drop_public_sha_index/migration.sql} +0 -0
- /package/migrations/{0156_conversation_kind_lead.sql → 20261122024458_conversation_kind_lead/migration.sql} +0 -0
- /package/migrations/{0157_conversation_lead_actor_index.sql → 20261122024459_conversation_lead_actor_index/migration.sql} +0 -0
- /package/migrations/{0158_keep_legacy_archive_columns.sql → 20261122071549_keep_legacy_archive_columns/migration.sql} +0 -0
- /package/migrations/{0159_conversation_embeddings_fk_validate.sql → 20261122191400_conversation_embeddings_fk_validate/migration.sql} +0 -0
- /package/migrations/{0160_money_micro_usd_repair.sql → 20261122204325_money_micro_usd_repair/migration.sql} +0 -0
- /package/migrations/{0161_agent_config_backfill.sql → 20261122204326_agent_config_backfill/migration.sql} +0 -0
- /package/migrations/{0162_inbox_item_deliveries.sql → 20261122221456_inbox_item_deliveries/migration.sql} +0 -0
- /package/migrations/{0163_pg_trgm.sql → 20261123155735_pg_trgm/migration.sql} +0 -0
- /package/migrations/{0164_search_indexes.sql → 20261123155739_search_indexes/migration.sql} +0 -0
- /package/migrations/{0165_drop_legacy_archive_columns.sql → 20261123172647_drop_legacy_archive_columns/migration.sql} +0 -0
- /package/migrations/{0166_memory_prefix_index.sql → 20261123192506_memory_prefix_index/migration.sql} +0 -0
- /package/migrations/{0167_todo_search_indexes.sql → 20261123201740_todo_search_indexes/migration.sql} +0 -0
- /package/migrations/{0168_todo_inbox_items.sql → 20261123211505_todo_inbox_items/migration.sql} +0 -0
- /package/migrations/{0169_drop_code_urls.sql → 20261123214917_drop_code_urls/migration.sql} +0 -0
package/dist/store-BuhF1QDm.js
DELETED
|
@@ -1,490 +0,0 @@
|
|
|
1
|
-
import { Br as juniorConversations, Rr as juniorAttachments, Yn as conversationDetailTouch, Zn as touchConversationDetail, zr as juniorMessageAttachments } from "./db-BTmLKZrp.js";
|
|
2
|
-
import { _t as bufferBody, gt as mapBounded } from "./config-BIfHKNXN.js";
|
|
3
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
4
|
-
import { and, asc, eq, inArray, isNotNull, isNull, lte, notExists, or } from "drizzle-orm";
|
|
5
|
-
// src/chat/attachments/source.ts
|
|
6
|
-
/** The source deleted the file, or Junior can no longer read it. */
|
|
7
|
-
var AttachmentSourceUnavailableError = class extends Error {
|
|
8
|
-
constructor(message, options) {
|
|
9
|
-
super(message, options);
|
|
10
|
-
this.name = "AttachmentSourceUnavailableError";
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
// src/chat/attachments/store.ts
|
|
14
|
-
const DAY_MS = 864e5;
|
|
15
|
-
const ATTACHMENT_GC_BATCH_LIMIT = 200;
|
|
16
|
-
/** Time that Junior keeps attachment bytes after the file is stored. */
|
|
17
|
-
const ATTACHMENT_RETENTION_MS = 30 * DAY_MS;
|
|
18
|
-
/** Only `file` rows: a `url` row has no storage or file fields. */
|
|
19
|
-
const isFileAttachment = eq(juniorAttachments.kind, "file");
|
|
20
|
-
/**
|
|
21
|
-
* The storage and file fields of a `file` row. Every `file` row has them, so
|
|
22
|
-
* a missing one is a broken row.
|
|
23
|
-
*/
|
|
24
|
-
function fileFields(row) {
|
|
25
|
-
const { bytes, contentType, storageProvider, title } = row;
|
|
26
|
-
if (bytes === null || contentType === null || storageProvider === null || title === null) throw new Error(`Attachment ${row.id} has no file fields`);
|
|
27
|
-
return {
|
|
28
|
-
bytes,
|
|
29
|
-
contentType,
|
|
30
|
-
filename: title,
|
|
31
|
-
storageProvider
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function attachmentIdentity(file) {
|
|
35
|
-
if ("data" in file) return file.source ?? { sha256: createHash("sha256").update(file.data).digest("hex") };
|
|
36
|
-
return file.source;
|
|
37
|
-
}
|
|
38
|
-
/** Stable conversation-owned id for one file and its presentation metadata. */
|
|
39
|
-
function attachmentId(args) {
|
|
40
|
-
const identity = "sha256" in args.identity ? [
|
|
41
|
-
args.conversationId,
|
|
42
|
-
args.storageProvider,
|
|
43
|
-
args.identity.sha256,
|
|
44
|
-
args.filename,
|
|
45
|
-
args.contentType
|
|
46
|
-
] : [
|
|
47
|
-
args.conversationId,
|
|
48
|
-
args.storageProvider,
|
|
49
|
-
args.filename,
|
|
50
|
-
args.contentType,
|
|
51
|
-
args.identity.provider,
|
|
52
|
-
args.identity.id
|
|
53
|
-
];
|
|
54
|
-
return createHash("sha256").update(identity.join("\0")).digest("hex");
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Object key for one write attempt.
|
|
58
|
-
*
|
|
59
|
-
* Attachment ids are content-stable. Object keys are not: each put gets a fresh
|
|
60
|
-
* key so a failed-write cleanup or GC delete cannot remove another writer's
|
|
61
|
-
* durable blob.
|
|
62
|
-
*/
|
|
63
|
-
function attachmentKey(args) {
|
|
64
|
-
return `conversations/${args.conversationId}/attachments/${args.attachmentId}/${args.writeId}/${args.filename}`;
|
|
65
|
-
}
|
|
66
|
-
/** A source whose bytes do not match its declared size. A retry cannot fix it. */
|
|
67
|
-
var AttachmentSizeError = class extends Error {
|
|
68
|
-
constructor(bytes, expected, options) {
|
|
69
|
-
super(`Attachment body does not match its declared ${expected} bytes (read ${bytes})`, options);
|
|
70
|
-
this.name = "AttachmentSizeError";
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
/** Tries for one object write, each with a freshly opened body. */
|
|
74
|
-
const WRITE_ATTEMPTS = 3;
|
|
75
|
-
async function bestEffortDelete(storage, key) {
|
|
76
|
-
if (key === null) return;
|
|
77
|
-
try {
|
|
78
|
-
await storage.delete([key]);
|
|
79
|
-
} catch {}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Stream one file to a fresh key, and return its size and digest.
|
|
83
|
-
*
|
|
84
|
-
* The digest is taken while the bytes stream, so the body is never held
|
|
85
|
-
* whole. A body that does not match its declared size is not kept.
|
|
86
|
-
*/
|
|
87
|
-
async function writeAttachmentObject(args) {
|
|
88
|
-
for (let attempt = 1;; attempt += 1) try {
|
|
89
|
-
return await writeAttachmentObjectOnce(args);
|
|
90
|
-
} catch (error) {
|
|
91
|
-
if (error instanceof AttachmentSizeError || error instanceof AttachmentSourceUnavailableError || attempt >= WRITE_ATTEMPTS) {
|
|
92
|
-
await bestEffortDelete(args.storage, args.key);
|
|
93
|
-
throw error;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
async function writeAttachmentObjectOnce(args) {
|
|
98
|
-
const { file } = args;
|
|
99
|
-
const expected = "data" in file ? file.data.byteLength : file.bytes;
|
|
100
|
-
const source = "data" in file ? bufferBody(file.data) : await file.open();
|
|
101
|
-
const hash = createHash("sha256");
|
|
102
|
-
let bytes = 0;
|
|
103
|
-
const body = source.pipeThrough(new TransformStream({ transform(chunk, controller) {
|
|
104
|
-
bytes += chunk.byteLength;
|
|
105
|
-
if (bytes > expected) throw new AttachmentSizeError(bytes, expected);
|
|
106
|
-
hash.update(chunk);
|
|
107
|
-
controller.enqueue(chunk);
|
|
108
|
-
} }));
|
|
109
|
-
try {
|
|
110
|
-
await args.storage.put({
|
|
111
|
-
body,
|
|
112
|
-
bytes: expected,
|
|
113
|
-
contentType: file.mimeType,
|
|
114
|
-
key: args.key
|
|
115
|
-
});
|
|
116
|
-
} catch (error) {
|
|
117
|
-
if (bytes > expected) throw new AttachmentSizeError(bytes, expected, { cause: error });
|
|
118
|
-
throw error;
|
|
119
|
-
}
|
|
120
|
-
if (bytes !== expected) throw new AttachmentSizeError(bytes, expected);
|
|
121
|
-
return {
|
|
122
|
-
bytes,
|
|
123
|
-
sha256: hash.digest("hex")
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
async function isConversationPurged(db, conversationId) {
|
|
127
|
-
const [row] = await db.db().select({ transcriptPurgedAt: juniorConversations.transcriptPurgedAt }).from(juniorConversations).where(eq(juniorConversations.conversationId, conversationId));
|
|
128
|
-
return row?.transcriptPurgedAt != null;
|
|
129
|
-
}
|
|
130
|
-
function purgedConversationError(conversationId) {
|
|
131
|
-
return /* @__PURE__ */ new Error(`Cannot store attachment for purged conversation ${conversationId}`);
|
|
132
|
-
}
|
|
133
|
-
async function assertConversationNotPurged(db, conversationId) {
|
|
134
|
-
if (await isConversationPurged(db, conversationId)) throw purgedConversationError(conversationId);
|
|
135
|
-
}
|
|
136
|
-
/** Mark a just-written row for deletion and drop its unused object. */
|
|
137
|
-
async function rejectPurgedAttachmentWrite(args) {
|
|
138
|
-
const db = args.db.db();
|
|
139
|
-
await db.with(conversationDetailTouch(db, [args.conversationId])).update(juniorAttachments).set({ deleteRequestedAt: args.now }).where(eq(juniorAttachments.id, args.id));
|
|
140
|
-
await bestEffortDelete(args.storage, args.storageKey);
|
|
141
|
-
throw purgedConversationError(args.conversationId);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Return another writer's live row only when the conversation is still active.
|
|
145
|
-
*
|
|
146
|
-
* The caller already wrote a unique object for this attempt. Delete that unused
|
|
147
|
-
* object either way. If the conversation is purged, do not report success for a
|
|
148
|
-
* row that purge/GC is about to remove.
|
|
149
|
-
*/
|
|
150
|
-
async function reuseLiveAttachment(args) {
|
|
151
|
-
await bestEffortDelete(args.storage, args.storageKey);
|
|
152
|
-
await assertConversationNotPurged(args.db, args.conversationId);
|
|
153
|
-
return { id: args.id };
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Persist one conversation-owned file.
|
|
157
|
-
*
|
|
158
|
-
* Identity is stable under the conversation: it comes from the file's source
|
|
159
|
-
* when it has one, and from its digest otherwise. Object storage is written
|
|
160
|
-
* first under a unique key; the SQL row is created only after that write
|
|
161
|
-
* succeeds. A row means the attachment is durable. Retries reuse an existing
|
|
162
|
-
* live row. A purge-marked row is revived by writing a new object and pointing
|
|
163
|
-
* the row at it, unless the conversation is still purged. If the SQL write
|
|
164
|
-
* fails after object storage accepts the bytes, this path deletes that unique
|
|
165
|
-
* object. A process crash between those steps can leave an unreferenced unique
|
|
166
|
-
* object with no SQL row.
|
|
167
|
-
*/
|
|
168
|
-
async function storeAttachment(args) {
|
|
169
|
-
const now = new Date(args.nowMs ?? Date.now());
|
|
170
|
-
const identity = attachmentIdentity(args.file);
|
|
171
|
-
const source = args.file.source;
|
|
172
|
-
const id = attachmentId({
|
|
173
|
-
conversationId: args.conversationId,
|
|
174
|
-
contentType: args.file.mimeType,
|
|
175
|
-
filename: args.file.filename,
|
|
176
|
-
identity,
|
|
177
|
-
storageProvider: args.storage.provider
|
|
178
|
-
});
|
|
179
|
-
const [existing] = await args.db.db().select({
|
|
180
|
-
contentType: juniorAttachments.contentType,
|
|
181
|
-
conversationId: juniorAttachments.conversationId,
|
|
182
|
-
deleteRequestedAt: juniorAttachments.deleteRequestedAt,
|
|
183
|
-
filename: juniorAttachments.title,
|
|
184
|
-
id: juniorAttachments.id,
|
|
185
|
-
provider: juniorAttachments.provider,
|
|
186
|
-
providerId: juniorAttachments.providerId,
|
|
187
|
-
storageProvider: juniorAttachments.storageProvider,
|
|
188
|
-
sha256: juniorAttachments.sha256,
|
|
189
|
-
storageKey: juniorAttachments.storageKey
|
|
190
|
-
}).from(juniorAttachments).where(eq(juniorAttachments.id, id));
|
|
191
|
-
if (existing) {
|
|
192
|
-
if (existing.contentType !== args.file.mimeType || existing.conversationId !== args.conversationId || existing.filename !== args.file.filename || existing.provider !== (source?.provider ?? null) || existing.providerId !== (source?.id ?? null) || existing.storageProvider !== args.storage.provider || "sha256" in identity && existing.sha256 !== identity.sha256) throw new Error(`Attachment write conflicts with ${existing.id}`);
|
|
193
|
-
if (existing.deleteRequestedAt === null) {
|
|
194
|
-
await assertConversationNotPurged(args.db, args.conversationId);
|
|
195
|
-
return { id: existing.id };
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
await assertConversationNotPurged(args.db, args.conversationId);
|
|
199
|
-
const { file } = args;
|
|
200
|
-
let storageKey = null;
|
|
201
|
-
let written;
|
|
202
|
-
if ("deferred" in file) written = {
|
|
203
|
-
bytes: file.bytes,
|
|
204
|
-
sha256: null
|
|
205
|
-
};
|
|
206
|
-
else {
|
|
207
|
-
storageKey = attachmentKey({
|
|
208
|
-
attachmentId: id,
|
|
209
|
-
conversationId: args.conversationId,
|
|
210
|
-
filename: file.filename,
|
|
211
|
-
writeId: randomUUID()
|
|
212
|
-
});
|
|
213
|
-
written = await writeAttachmentObject({
|
|
214
|
-
file,
|
|
215
|
-
key: storageKey,
|
|
216
|
-
storage: args.storage
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
if (existing?.deleteRequestedAt != null) {
|
|
220
|
-
if (await isConversationPurged(args.db, args.conversationId)) {
|
|
221
|
-
await bestEffortDelete(args.storage, storageKey);
|
|
222
|
-
throw purgedConversationError(args.conversationId);
|
|
223
|
-
}
|
|
224
|
-
const oldStorageKey = existing.storageKey;
|
|
225
|
-
if ((await args.db.db().with(conversationDetailTouch(args.db.db(), [args.conversationId])).update(juniorAttachments).set({
|
|
226
|
-
...written,
|
|
227
|
-
deleteRequestedAt: null,
|
|
228
|
-
storageKey
|
|
229
|
-
}).where(and(eq(juniorAttachments.id, id), isNotNull(juniorAttachments.deleteRequestedAt))).returning({ id: juniorAttachments.id })).length > 0) {
|
|
230
|
-
if (await isConversationPurged(args.db, args.conversationId)) await rejectPurgedAttachmentWrite({
|
|
231
|
-
conversationId: args.conversationId,
|
|
232
|
-
db: args.db,
|
|
233
|
-
id,
|
|
234
|
-
now,
|
|
235
|
-
storage: args.storage,
|
|
236
|
-
storageKey
|
|
237
|
-
});
|
|
238
|
-
if (oldStorageKey !== storageKey) await bestEffortDelete(args.storage, oldStorageKey);
|
|
239
|
-
return { id };
|
|
240
|
-
}
|
|
241
|
-
const [afterRace] = await args.db.db().select({
|
|
242
|
-
deleteRequestedAt: juniorAttachments.deleteRequestedAt,
|
|
243
|
-
id: juniorAttachments.id,
|
|
244
|
-
storageKey: juniorAttachments.storageKey
|
|
245
|
-
}).from(juniorAttachments).where(eq(juniorAttachments.id, id));
|
|
246
|
-
if (afterRace?.deleteRequestedAt === null) return reuseLiveAttachment({
|
|
247
|
-
conversationId: args.conversationId,
|
|
248
|
-
db: args.db,
|
|
249
|
-
id: afterRace.id,
|
|
250
|
-
storage: args.storage,
|
|
251
|
-
storageKey
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
let inserted = [];
|
|
255
|
-
try {
|
|
256
|
-
inserted = await args.db.db().with(conversationDetailTouch(args.db.db(), [args.conversationId])).insert(juniorAttachments).values({
|
|
257
|
-
id,
|
|
258
|
-
conversationId: args.conversationId,
|
|
259
|
-
storageProvider: args.storage.provider,
|
|
260
|
-
storageKey,
|
|
261
|
-
provider: source?.provider,
|
|
262
|
-
providerId: source?.id,
|
|
263
|
-
title: args.file.filename,
|
|
264
|
-
contentType: args.file.mimeType,
|
|
265
|
-
...written,
|
|
266
|
-
createdAt: now
|
|
267
|
-
}).onConflictDoNothing({ target: juniorAttachments.id }).returning({ id: juniorAttachments.id });
|
|
268
|
-
} catch (error) {
|
|
269
|
-
await bestEffortDelete(args.storage, storageKey);
|
|
270
|
-
throw error;
|
|
271
|
-
}
|
|
272
|
-
if (inserted.length > 0) {
|
|
273
|
-
if (await isConversationPurged(args.db, args.conversationId)) await rejectPurgedAttachmentWrite({
|
|
274
|
-
conversationId: args.conversationId,
|
|
275
|
-
db: args.db,
|
|
276
|
-
id,
|
|
277
|
-
now,
|
|
278
|
-
storage: args.storage,
|
|
279
|
-
storageKey
|
|
280
|
-
});
|
|
281
|
-
return { id };
|
|
282
|
-
}
|
|
283
|
-
const [row] = await args.db.db().select({
|
|
284
|
-
deleteRequestedAt: juniorAttachments.deleteRequestedAt,
|
|
285
|
-
id: juniorAttachments.id,
|
|
286
|
-
storageKey: juniorAttachments.storageKey
|
|
287
|
-
}).from(juniorAttachments).where(eq(juniorAttachments.id, id));
|
|
288
|
-
if (!row) {
|
|
289
|
-
await bestEffortDelete(args.storage, storageKey);
|
|
290
|
-
throw new Error(`Attachment row missing after write for ${id}`);
|
|
291
|
-
}
|
|
292
|
-
if (row.deleteRequestedAt === null) return reuseLiveAttachment({
|
|
293
|
-
conversationId: args.conversationId,
|
|
294
|
-
db: args.db,
|
|
295
|
-
id: row.id,
|
|
296
|
-
storage: args.storage,
|
|
297
|
-
storageKey
|
|
298
|
-
});
|
|
299
|
-
if (await isConversationPurged(args.db, args.conversationId)) {
|
|
300
|
-
await bestEffortDelete(args.storage, storageKey);
|
|
301
|
-
throw purgedConversationError(args.conversationId);
|
|
302
|
-
}
|
|
303
|
-
if ((await args.db.db().with(conversationDetailTouch(args.db.db(), [args.conversationId])).update(juniorAttachments).set({
|
|
304
|
-
...written,
|
|
305
|
-
deleteRequestedAt: null,
|
|
306
|
-
storageKey
|
|
307
|
-
}).where(and(eq(juniorAttachments.id, id), isNotNull(juniorAttachments.deleteRequestedAt))).returning({ id: juniorAttachments.id })).length > 0) {
|
|
308
|
-
if (await isConversationPurged(args.db, args.conversationId)) await rejectPurgedAttachmentWrite({
|
|
309
|
-
conversationId: args.conversationId,
|
|
310
|
-
db: args.db,
|
|
311
|
-
id,
|
|
312
|
-
now,
|
|
313
|
-
storage: args.storage,
|
|
314
|
-
storageKey
|
|
315
|
-
});
|
|
316
|
-
if (row.storageKey !== storageKey) await bestEffortDelete(args.storage, row.storageKey);
|
|
317
|
-
return { id };
|
|
318
|
-
}
|
|
319
|
-
const [afterRace] = await args.db.db().select({
|
|
320
|
-
deleteRequestedAt: juniorAttachments.deleteRequestedAt,
|
|
321
|
-
id: juniorAttachments.id
|
|
322
|
-
}).from(juniorAttachments).where(eq(juniorAttachments.id, id));
|
|
323
|
-
if (afterRace?.deleteRequestedAt === null) return reuseLiveAttachment({
|
|
324
|
-
conversationId: args.conversationId,
|
|
325
|
-
db: args.db,
|
|
326
|
-
id: afterRace.id,
|
|
327
|
-
storage: args.storage,
|
|
328
|
-
storageKey
|
|
329
|
-
});
|
|
330
|
-
await bestEffortDelete(args.storage, storageKey);
|
|
331
|
-
throw new Error(`Attachment ${id} disappeared while reviving`);
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Record an object that a browser already wrote, under the upload's id.
|
|
335
|
-
*
|
|
336
|
-
* The row takes over the object key. A retry with the same id keeps the
|
|
337
|
-
* first row. The caller checked the object's size, type, and digest.
|
|
338
|
-
*/
|
|
339
|
-
async function recordUploadedAttachment(args) {
|
|
340
|
-
const { attachment } = args;
|
|
341
|
-
const now = new Date(args.nowMs);
|
|
342
|
-
await assertConversationNotPurged(args.db, attachment.conversationId);
|
|
343
|
-
if ((await args.db.db().with(conversationDetailTouch(args.db.db(), [attachment.conversationId])).insert(juniorAttachments).values({
|
|
344
|
-
bytes: attachment.bytes,
|
|
345
|
-
contentType: attachment.contentType,
|
|
346
|
-
conversationId: attachment.conversationId,
|
|
347
|
-
createdAt: now,
|
|
348
|
-
id: attachment.id,
|
|
349
|
-
sha256: attachment.sha256,
|
|
350
|
-
storageKey: attachment.storageKey,
|
|
351
|
-
storageProvider: args.storage.provider,
|
|
352
|
-
title: attachment.filename
|
|
353
|
-
}).onConflictDoNothing({ target: juniorAttachments.id }).returning({ id: juniorAttachments.id })).length > 0 && await isConversationPurged(args.db, attachment.conversationId)) await rejectPurgedAttachmentWrite({
|
|
354
|
-
conversationId: attachment.conversationId,
|
|
355
|
-
db: args.db,
|
|
356
|
-
id: attachment.id,
|
|
357
|
-
now,
|
|
358
|
-
storage: args.storage,
|
|
359
|
-
storageKey: attachment.storageKey
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* Store a file that Junior recorded without its bytes, on its first read.
|
|
364
|
-
*
|
|
365
|
-
* The bytes stream from the source to a fresh key. The row then takes that
|
|
366
|
-
* key only while it is still unstored, live, and in a conversation that is
|
|
367
|
-
* not purged. Purge marks rows in the transaction that purges the
|
|
368
|
-
* conversation, so this update cannot revive a purged row. When the update
|
|
369
|
-
* misses, the new object is deleted: return the row that another writer
|
|
370
|
-
* stored, or null when the row is no longer live.
|
|
371
|
-
*/
|
|
372
|
-
async function storeDeferredAttachment(args) {
|
|
373
|
-
const { attachment, storage } = args;
|
|
374
|
-
const storageKey = attachmentKey({
|
|
375
|
-
attachmentId: attachment.id,
|
|
376
|
-
conversationId: attachment.conversationId,
|
|
377
|
-
filename: attachment.filename,
|
|
378
|
-
writeId: randomUUID()
|
|
379
|
-
});
|
|
380
|
-
const written = await writeAttachmentObject({
|
|
381
|
-
file: {
|
|
382
|
-
bytes: args.file.bytes,
|
|
383
|
-
filename: attachment.filename,
|
|
384
|
-
mimeType: attachment.contentType,
|
|
385
|
-
open: args.file.open,
|
|
386
|
-
source: attachment.source
|
|
387
|
-
},
|
|
388
|
-
key: storageKey,
|
|
389
|
-
storage
|
|
390
|
-
});
|
|
391
|
-
const db = args.db.db();
|
|
392
|
-
if ((await db.with(conversationDetailTouch(db, [attachment.conversationId])).update(juniorAttachments).set({
|
|
393
|
-
...written,
|
|
394
|
-
storageKey
|
|
395
|
-
}).where(and(eq(juniorAttachments.id, attachment.id), eq(juniorAttachments.conversationId, attachment.conversationId), eq(juniorAttachments.storageProvider, storage.provider), isNull(juniorAttachments.storageKey), isNull(juniorAttachments.deleteRequestedAt), notExists(db.select({ id: juniorConversations.conversationId }).from(juniorConversations).where(and(eq(juniorConversations.conversationId, attachment.conversationId), isNotNull(juniorConversations.transcriptPurgedAt)))))).returning({ id: juniorAttachments.id })).length > 0) return {
|
|
396
|
-
...attachment,
|
|
397
|
-
bytes: written.bytes,
|
|
398
|
-
storageKey
|
|
399
|
-
};
|
|
400
|
-
await bestEffortDelete(storage, storageKey);
|
|
401
|
-
const current = await readLiveAttachment({
|
|
402
|
-
attachmentId: attachment.id,
|
|
403
|
-
conversationId: attachment.conversationId,
|
|
404
|
-
db: args.db
|
|
405
|
-
});
|
|
406
|
-
return current?.storageKey ? {
|
|
407
|
-
...current,
|
|
408
|
-
storageKey: current.storageKey
|
|
409
|
-
} : null;
|
|
410
|
-
}
|
|
411
|
-
/** Load one live attachment owned by a conversation. */
|
|
412
|
-
async function readLiveAttachment(args) {
|
|
413
|
-
const [row] = await args.db.db().select({
|
|
414
|
-
bytes: juniorAttachments.bytes,
|
|
415
|
-
contentType: juniorAttachments.contentType,
|
|
416
|
-
conversationId: juniorAttachments.conversationId,
|
|
417
|
-
deleteRequestedAt: juniorAttachments.deleteRequestedAt,
|
|
418
|
-
id: juniorAttachments.id,
|
|
419
|
-
provider: juniorAttachments.provider,
|
|
420
|
-
providerId: juniorAttachments.providerId,
|
|
421
|
-
storageProvider: juniorAttachments.storageProvider,
|
|
422
|
-
storageKey: juniorAttachments.storageKey,
|
|
423
|
-
title: juniorAttachments.title
|
|
424
|
-
}).from(juniorAttachments).where(and(eq(juniorAttachments.id, args.attachmentId), isFileAttachment, eq(juniorAttachments.conversationId, args.conversationId), isNull(juniorAttachments.deleteRequestedAt)));
|
|
425
|
-
if (!row) return null;
|
|
426
|
-
if (await isConversationPurged(args.db, args.conversationId)) return null;
|
|
427
|
-
return {
|
|
428
|
-
...fileFields(row),
|
|
429
|
-
conversationId: row.conversationId,
|
|
430
|
-
id: row.id,
|
|
431
|
-
source: row.provider && row.providerId ? {
|
|
432
|
-
id: row.providerId,
|
|
433
|
-
provider: row.provider
|
|
434
|
-
} : null,
|
|
435
|
-
storageKey: row.storageKey
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
/** Persist many conversation-owned files. */
|
|
439
|
-
async function storeAttachments(args) {
|
|
440
|
-
return await mapBounded(args.files, (file) => storeAttachment({
|
|
441
|
-
conversationId: args.conversationId,
|
|
442
|
-
db: args.db,
|
|
443
|
-
file: {
|
|
444
|
-
data: file.data,
|
|
445
|
-
filename: file.filename,
|
|
446
|
-
mimeType: file.mimeType
|
|
447
|
-
},
|
|
448
|
-
...args.nowMs !== void 0 ? { nowMs: args.nowMs } : void 0,
|
|
449
|
-
storage: args.storage
|
|
450
|
-
}));
|
|
451
|
-
}
|
|
452
|
-
/** Mark attachments unavailable when their conversation content is purged. */
|
|
453
|
-
async function requestAttachmentDeletion(db, conversationIds, nowMs) {
|
|
454
|
-
if (conversationIds.length === 0) return;
|
|
455
|
-
await db.db().with(conversationDetailTouch(db.db(), conversationIds)).update(juniorAttachments).set({ deleteRequestedAt: new Date(nowMs) }).where(and(inArray(juniorAttachments.conversationId, conversationIds), isNull(juniorAttachments.deleteRequestedAt)));
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Delete purged attachments in one bounded batch.
|
|
459
|
-
*
|
|
460
|
-
* Eligible files are 30 days old, explicitly purge-marked, or owned by a
|
|
461
|
-
* conversation whose transcript is already purged. A `url` row has no bytes,
|
|
462
|
-
* so it lives as long as its message: it is eligible only when purge-marked
|
|
463
|
-
* or purged. Delete object keys first, then remove rows that are still
|
|
464
|
-
* eligible so a failed blob delete remains retryable.
|
|
465
|
-
*/
|
|
466
|
-
async function collectAttachmentGarbage(args) {
|
|
467
|
-
const expiresBefore = /* @__PURE__ */ new Date(args.nowMs - ATTACHMENT_RETENTION_MS);
|
|
468
|
-
const purged = or(isNotNull(juniorAttachments.deleteRequestedAt), isNotNull(juniorConversations.transcriptPurgedAt));
|
|
469
|
-
const eligible = or(lte(juniorAttachments.createdAt, expiresBefore), purged);
|
|
470
|
-
const isUrl = eq(juniorAttachments.kind, "url");
|
|
471
|
-
const rows = await args.db.db().select({
|
|
472
|
-
id: juniorAttachments.id,
|
|
473
|
-
storageKey: juniorAttachments.storageKey
|
|
474
|
-
}).from(juniorAttachments).innerJoin(juniorConversations, eq(juniorAttachments.conversationId, juniorConversations.conversationId)).where(or(and(eq(juniorAttachments.storageProvider, args.storage.provider), eligible), and(isUrl, purged))).orderBy(asc(juniorAttachments.createdAt), asc(juniorAttachments.id)).limit(args.limit ?? ATTACHMENT_GC_BATCH_LIMIT);
|
|
475
|
-
if (rows.length === 0) return { deleted: 0 };
|
|
476
|
-
const keys = rows.flatMap((row) => row.storageKey ? [row.storageKey] : []);
|
|
477
|
-
if (keys.length > 0) await args.storage.delete(keys);
|
|
478
|
-
const stillEligible = await args.db.db().select({ id: juniorAttachments.id }).from(juniorAttachments).innerJoin(juniorConversations, eq(juniorAttachments.conversationId, juniorConversations.conversationId)).where(and(inArray(juniorAttachments.id, rows.map((row) => row.id)), or(and(isFileAttachment, eligible), and(isUrl, purged))));
|
|
479
|
-
if (stillEligible.length === 0) return { deleted: 0 };
|
|
480
|
-
const removed = await args.db.db().delete(juniorAttachments).where(inArray(juniorAttachments.id, stillEligible.map((row) => row.id))).returning({
|
|
481
|
-
conversationId: juniorAttachments.conversationId,
|
|
482
|
-
id: juniorAttachments.id,
|
|
483
|
-
kind: juniorAttachments.kind
|
|
484
|
-
});
|
|
485
|
-
const urls = removed.filter((row) => row.kind === "url");
|
|
486
|
-
if (urls.length > 0) await args.db.db().delete(juniorMessageAttachments).where(and(inArray(juniorMessageAttachments.conversationId, urls.map((row) => row.conversationId)), inArray(juniorMessageAttachments.attachmentId, urls.map((row) => row.id))));
|
|
487
|
-
await touchConversationDetail(args.db.db(), removed.map((row) => row.conversationId));
|
|
488
|
-
return { deleted: removed.length };
|
|
489
|
-
}
|
|
490
|
-
export { recordUploadedAttachment as a, storeAttachments as c, readLiveAttachment as i, storeDeferredAttachment as l, fileFields as n, requestAttachmentDeletion as o, isFileAttachment as r, storeAttachment as s, collectAttachmentGarbage as t, AttachmentSourceUnavailableError as u };
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { w as logWarn } from "./conversation-privacy-DtZhI91r.js";
|
|
2
|
-
import { t as queueCallback } from "./callback-C8SdXCwr.js";
|
|
3
|
-
import { c as QUEUE_SIGNATURE_MAX_AGE_MS, d as getQueueProvider, l as signQueueMessage, u as verifyQueueMessage } from "./vercel-queue-nL0Hq3hr.js";
|
|
4
|
-
import * as z from "zod";
|
|
5
|
-
import { createHash } from "node:crypto";
|
|
6
|
-
// src/chat/plugins/task-queue.ts
|
|
7
|
-
/**
|
|
8
|
-
* Delivery for plugin-registered tasks.
|
|
9
|
-
*
|
|
10
|
-
* Plugins register named tasks. This module owns the shared signed message,
|
|
11
|
-
* send path, and HTTP/local callback. Core keeps one topic and one runner.
|
|
12
|
-
*/
|
|
13
|
-
/** Deploy topic name. Keep stable for Vercel queue wiring. */
|
|
14
|
-
const PLUGIN_TASK_QUEUE_TOPIC = "junior_plugin_tasks";
|
|
15
|
-
const PLUGIN_TASK_MAX_DELIVERIES = 5;
|
|
16
|
-
const PLUGIN_TASK_SIGN_CONTEXT = "junior.plugin_task_queue.v1";
|
|
17
|
-
const PLUGIN_TASK_SIGN_VERSION = "v1";
|
|
18
|
-
const pluginTaskParamsSchema = z.object({
|
|
19
|
-
conversationId: z.string().min(1),
|
|
20
|
-
sessionId: z.string().min(1)
|
|
21
|
-
}).strict();
|
|
22
|
-
const pluginTaskSign = {
|
|
23
|
-
context: PLUGIN_TASK_SIGN_CONTEXT,
|
|
24
|
-
schema: z.object({
|
|
25
|
-
name: z.string().min(1),
|
|
26
|
-
params: pluginTaskParamsSchema,
|
|
27
|
-
plugin: z.string().min(1)
|
|
28
|
-
}).strict(),
|
|
29
|
-
signatureVersion: PLUGIN_TASK_SIGN_VERSION,
|
|
30
|
-
parts: (message) => [
|
|
31
|
-
message.plugin,
|
|
32
|
-
message.name,
|
|
33
|
-
message.params.conversationId,
|
|
34
|
-
message.params.sessionId
|
|
35
|
-
]
|
|
36
|
-
};
|
|
37
|
-
/** Build the stable id used for delivery dedupe and tracing. */
|
|
38
|
-
function pluginTaskId(args) {
|
|
39
|
-
return `plugin-task_${createHash("sha256").update(args.plugin).update("\0").update(args.name).update("\0").update(args.params.conversationId).update("\0").update(args.params.sessionId).digest("hex").slice(0, 32)}`;
|
|
40
|
-
}
|
|
41
|
-
/** Sign a plugin task message for tests and local checks. */
|
|
42
|
-
function signPluginTaskQueueMessage(message, nowMs = Date.now()) {
|
|
43
|
-
return signQueueMessage(pluginTaskSign, message, nowMs);
|
|
44
|
-
}
|
|
45
|
-
function verifyPluginTaskQueueMessage(value, nowMs = Date.now()) {
|
|
46
|
-
return verifyQueueMessage(pluginTaskSign, value, nowMs);
|
|
47
|
-
}
|
|
48
|
-
function logPluginTaskQueueMessageRejected(reason, metadata) {
|
|
49
|
-
logWarn("plugin.task.queue_message.rejected", {
|
|
50
|
-
"app.queue.consumer_group": metadata.consumerGroup,
|
|
51
|
-
"app.queue.delivery_count": metadata.deliveryCount,
|
|
52
|
-
"app.queue.message_id": metadata.messageId,
|
|
53
|
-
"app.queue.reject_reason": reason,
|
|
54
|
-
"app.queue.topic_name": metadata.topicName
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
function pluginTaskCallback() {
|
|
58
|
-
return queueCallback({
|
|
59
|
-
maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
|
|
60
|
-
onRejected: logPluginTaskQueueMessageRejected,
|
|
61
|
-
run: async (message) => {
|
|
62
|
-
const { processPluginTask } = await import("./task-runner-C-pXsgHM.js").then((n) => n.r);
|
|
63
|
-
await processPluginTask(message);
|
|
64
|
-
},
|
|
65
|
-
verify: verifyPluginTaskQueueMessage
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
/** Send one plugin task through the shared signed delivery path. */
|
|
69
|
-
async function sendVercelPluginTask(message) {
|
|
70
|
-
await getQueueProvider().send(PLUGIN_TASK_QUEUE_TOPIC, signPluginTaskQueueMessage(message), {
|
|
71
|
-
idempotencyKey: pluginTaskId(message),
|
|
72
|
-
retentionSeconds: QUEUE_SIGNATURE_MAX_AGE_MS / 1e3
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
/** Create the HTTP callback for plugin tasks. */
|
|
76
|
-
function createVercelPluginTaskCallback() {
|
|
77
|
-
return pluginTaskCallback().create();
|
|
78
|
-
}
|
|
79
|
-
export { sendVercelPluginTask as a, pluginTaskParamsSchema as i, createVercelPluginTaskCallback as n, pluginTaskId as r, PLUGIN_TASK_QUEUE_TOPIC as t };
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
import { Wr as getDispatchConversationId, qr as getDispatchRecord } from "./credentialed-dWRA3-oJ.js";
|
|
2
|
-
// src/chat/task-execution/turn-membership.ts
|
|
3
|
-
/** True when the committed message at `seq` belongs to the Turn. */
|
|
4
|
-
function isTurnMessage(start, seq, message) {
|
|
5
|
-
return seq > start.seq && message.role !== "system";
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* The messages of a saved Turn with their provenance. Without a
|
|
9
|
-
* `turn_started` event, nothing tells this Turn from earlier history, so it
|
|
10
|
-
* has no messages.
|
|
11
|
-
*/
|
|
12
|
-
function savedTurnMessages(record, start) {
|
|
13
|
-
if (!start) return [];
|
|
14
|
-
return record.piMessages.flatMap((message, index) => {
|
|
15
|
-
const seq = record.piMessageSeqs[index];
|
|
16
|
-
return seq !== void 0 && isTurnMessage(start, seq, message) ? [{
|
|
17
|
-
message,
|
|
18
|
-
provenance: record.piMessageProvenance[index] ?? { authority: "context" }
|
|
19
|
-
}] : [];
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
// src/chat/services/turn-session-routing.ts
|
|
23
|
-
async function loadConversationChain(conversationId, conversationStore) {
|
|
24
|
-
const chain = [];
|
|
25
|
-
const seen = /* @__PURE__ */ new Set();
|
|
26
|
-
let cursor = conversationId;
|
|
27
|
-
while (cursor && !seen.has(cursor)) {
|
|
28
|
-
seen.add(cursor);
|
|
29
|
-
const conversation = await conversationStore.get({ conversationId: cursor });
|
|
30
|
-
if (!conversation) break;
|
|
31
|
-
chain.push(conversation);
|
|
32
|
-
cursor = conversation.parentConversationId;
|
|
33
|
-
}
|
|
34
|
-
return chain;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Normalize a stored Slack session source against the conversation destination.
|
|
38
|
-
*
|
|
39
|
-
* Does not create channel or thread values from the conversation id.
|
|
40
|
-
*/
|
|
41
|
-
function slackSourceForDestination(args) {
|
|
42
|
-
if (args.source?.kind !== "slack" || args.source.channelId !== args.destination.channelId) return;
|
|
43
|
-
const threadTs = args.source.threadTs?.trim();
|
|
44
|
-
return {
|
|
45
|
-
kind: "slack",
|
|
46
|
-
visibility: args.source.visibility ?? "public",
|
|
47
|
-
teamId: args.source.teamId?.trim() || args.destination.teamId,
|
|
48
|
-
channelId: args.source.channelId,
|
|
49
|
-
...threadTs ? { threadTs } : void 0
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Resolve the Conversation Location, Destination, and session Source.
|
|
54
|
-
*
|
|
55
|
-
* Reads parent Conversations when this Conversation has no Destination.
|
|
56
|
-
*/
|
|
57
|
-
async function resolveConversationRouting(args) {
|
|
58
|
-
const conversationStore = args.conversationStore ?? (await import("./db-BTmLKZrp.js").then((n) => n.t)).getConversationStore();
|
|
59
|
-
const chain = await loadConversationChain(args.conversationId, conversationStore);
|
|
60
|
-
let destination;
|
|
61
|
-
let source;
|
|
62
|
-
let location;
|
|
63
|
-
for (const conversation of chain) {
|
|
64
|
-
destination ??= conversation.destination;
|
|
65
|
-
source ??= conversation.sessionSource;
|
|
66
|
-
location ??= conversation.location;
|
|
67
|
-
if (destination && source) break;
|
|
68
|
-
}
|
|
69
|
-
if (!destination) return;
|
|
70
|
-
if (destination.platform === "slack") {
|
|
71
|
-
const slackSource = slackSourceForDestination({
|
|
72
|
-
destination,
|
|
73
|
-
source
|
|
74
|
-
});
|
|
75
|
-
return {
|
|
76
|
-
destination,
|
|
77
|
-
...location ? { location } : void 0,
|
|
78
|
-
...slackSource ? { source: slackSource } : void 0
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
return {
|
|
82
|
-
destination,
|
|
83
|
-
...location ? { location } : void 0,
|
|
84
|
-
...source ? { source } : void 0
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
/** Require the Conversation Destination and Source from SQL. */
|
|
88
|
-
async function resolveTurnSessionRouting(args) {
|
|
89
|
-
const routing = await resolveConversationRouting(args);
|
|
90
|
-
if (!routing?.destination || !routing.source) throw new Error(`Conversation ${args.conversationId} is missing durable routing metadata`);
|
|
91
|
-
return {
|
|
92
|
-
destination: routing.destination,
|
|
93
|
-
...routing.location ? { location: routing.location } : void 0,
|
|
94
|
-
source: routing.source
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Require the Destination and Source to resume a Turn.
|
|
99
|
-
*
|
|
100
|
-
* A dispatch Conversation stores the dispatch Source, which has no session
|
|
101
|
-
* Source. Its dispatch record owns the Destination and Source.
|
|
102
|
-
*/
|
|
103
|
-
async function resolveTurnResumeRouting(args) {
|
|
104
|
-
if (!args.dispatchId) return await resolveTurnSessionRouting(args);
|
|
105
|
-
const dispatch = await getDispatchRecord(args.dispatchId);
|
|
106
|
-
if (!dispatch) throw new Error(`Dispatch record is missing for ${args.dispatchId}`);
|
|
107
|
-
const dispatchConversationId = getDispatchConversationId(dispatch);
|
|
108
|
-
if (dispatchConversationId !== args.conversationId) throw new Error(`Dispatch ${dispatch.id} belongs to ${dispatchConversationId}, not ${args.conversationId}`);
|
|
109
|
-
const location = (await resolveConversationRouting(args))?.location;
|
|
110
|
-
return {
|
|
111
|
-
destination: dispatch.destination,
|
|
112
|
-
...location ? { location } : void 0,
|
|
113
|
-
source: dispatch.source
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
export { savedTurnMessages as i, resolveTurnResumeRouting as n, isTurnMessage as r, resolveConversationRouting as t };
|