@sentry/junior 0.314.0 → 0.315.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-BlSGE44V.js} +42 -3
- package/dist/{admin-BXGAySz0.js → admin-5jUYY46p.js} +1 -1
- package/dist/agent-runner-C7GNLRB6.js +23438 -0
- package/dist/agent-update-delivery-BNEYQsAf.js +149 -0
- package/dist/api/schema.d.ts +9500 -2
- package/dist/api/schema.js +4 -6
- package/dist/api.d.ts +2 -3
- package/dist/api.js +850 -283
- package/dist/{app-D7tKnw9a.d.ts → app-D_bAXRDe.d.ts} +310 -29
- package/dist/app.d.ts +1 -1
- package/dist/app.js +260 -50
- package/dist/change-record-Bqsa5ZXE.d.ts +175 -0
- package/dist/chat-core-engine-CxkwRpn9.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 +48 -96
- package/dist/{continue-in-slack-fnmD2Ifb.js → continue-in-slack-BGKjIdFp.js} +3 -5
- package/dist/{conversation-feed-DdFQuQDR.js → conversation-feed-Sl8lKKmR.js} +22 -2
- package/dist/{conversation-turn-DScuDYmN.js → conversation-turn-BoLK9i6g.js} +149 -103
- package/dist/{create-CrNt4Ewu.js → create-BOycVH9h.js} +5 -4
- package/dist/{credential-sync-CtqsGjj1.js → credential-sync-Mn4OdkEh.js} +10 -15
- package/dist/db-BpxcYXfD.d.ts +2 -0
- package/dist/{credentialed-dWRA3-oJ.js → db-DXTOYRzR.js} +21687 -9285
- package/dist/deployment-CG3TchWh.js +51 -0
- package/dist/direct-url-BYgYfuIy.js +22 -0
- package/dist/engine-context-dyWlfNdD.js +1817 -0
- package/dist/{html-B8rBt7F4.js → html-CfXEwl_h.js} +2 -5
- package/dist/instrumentation.js +2 -2
- package/dist/job-runner-CySgpi9v.js +1131 -0
- package/dist/{lineage-EULJkGO1.js → lineage-tRTOcrsL.js} +1 -1
- package/dist/{list-C5400AlJ.js → list-DXBz8SYL.js} +411 -132
- package/dist/local-server-CpnGhYml.js +276 -0
- package/dist/{conversation-privacy-DtZhI91r.js → logging-czs0nqLC.js} +2 -231
- package/dist/{mailbox-turn-DL3Lvsm0.js → mailbox-turn-79Nv1JXv.js} +1922 -2439
- package/dist/markers-CE0HMXWT.js +67 -0
- package/dist/{media-FYM-Bl3H.js → media-Cr9pGkzr.js} +670 -35
- package/dist/{message-DuDelZFr.js → message-BTox2Cmb.js} +18 -16
- package/dist/{model-input-0osF3pBS.js → model-input-IRGa98V7.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-NXK7AlBp.js} +2 -2
- package/dist/{oauth-relay-PwPMdZJv.js → oauth-relay-6NBPSpFE.js} +1 -1
- package/dist/{package-discovery-DD9vencX.js → package-discovery-BI6T_RkD.js} +50 -1
- package/dist/{markers-DUP8aBOp.js → parent-result-Dg6P6roR.js} +71 -71
- package/dist/people-Cegp1Iwq.js +81 -0
- package/dist/proxy-path-Dc-0jXGi.js +203 -0
- package/dist/{resolve-D8CPJcNK.js → resolve-BUFkmxkT.js} +229 -4
- package/dist/{result-D090hxr5.js → result-DfATzX77.js} +79 -144
- package/dist/{runner-BU7fgrm-.js → runner-CmKP3inb.js} +7 -7
- package/dist/{sandbox-egress-signals-BUmVrsoG.js → sandbox-egress-signals-DYo5BsM7.js} +1 -1
- package/dist/{schema-7gW9vBpJ.js → schema-DrBMdPmv.js} +111 -15
- package/dist/{service-account-plA-uzIB.js → service-account-CxTX7nnR.js} +1 -3
- package/dist/{skills-CIosT6bS.js → skills-BlHUDj7k.js} +4 -4
- package/dist/{slack-conversation-unfurl-CBgZqth6.js → slack-conversation-unfurl-Dhe3lB1U.js} +6 -8
- package/dist/{spawn-DRjdzh3R.js → spawn-CfvlFdfz.js} +4 -5
- package/dist/start-conversation-Uh8Sk1EF.js +162 -0
- package/dist/system-prompt-table-CDCYVwqN.js +1169 -0
- package/dist/{task-runner-C-pXsgHM.js → task-runner-DcdQJd9e.js} +71 -17
- package/dist/{thread-context-CDX4dSZd.js → thread-context-DF5uDcWN.js} +5 -6
- package/dist/topic-CRYYBYp-.js +7 -0
- package/dist/transcript-BHhJVY0P.js +410 -0
- package/dist/turn-session-routing-GtetHsdO.js +1309 -0
- package/dist/{turn-wake-Bzq1Efrm.js → turn-wake-um5Ubd4m.js} +5 -7
- package/dist/{validation-bTq88sya.js → validation-CJyuOPD2.js} +1 -1
- package/dist/{version-DGUa1dZK.js → version-Bhe7RPIe.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/virtual-module-BeKA_EII.js +12 -0
- package/dist/{worker-AkZg7Dg1.js → worker-D8PRgUqr.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/package.json +13 -12
- package/skills/design-automation-skill/SKILL.md +1 -1
- 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/agent-update-delivery-CZ5M8RDa.js +0 -85
- 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
|
@@ -1,752 +0,0 @@
|
|
|
1
|
-
import { Co as conversationWatch, Go as SlackActionError, Ri as getDashboardConversationLink, es as readPrivateSlackFile, ns as streamPrivateSlackFile } from "./credentialed-dWRA3-oJ.js";
|
|
2
|
-
import { _t as bufferBody, gt as mapBounded } from "./config-BIfHKNXN.js";
|
|
3
|
-
import { h as getActiveTraceContext } from "./conversation-privacy-DtZhI91r.js";
|
|
4
|
-
import { Br as juniorConversations, Lr as juniorAttachmentUploads, Rr as juniorAttachments, Tn as ToolInputError, Vr as juniorIdentities, Wr as juniorUsers, Yn as conversationDetailTouch, a as getDb, c as isPostgresErrorCode, di as sameDestination, fn as resolveActorIdentityId, ft as conversationKindSql, i as getConversationStore, o as getSqlExecutor, wr as juniorConversationParticipants, z as isTopLevelKind } from "./db-BTmLKZrp.js";
|
|
5
|
-
import { On as buildDeterministicTurnId, Tt as appendAndEnqueueInboundMessage, wt as appendAndEnqueueExclusiveInboundMessage } from "./mailbox-turn-DL3Lvsm0.js";
|
|
6
|
-
import { i as isVisionImageMediaType, r as detectImageMediaType } from "./media-FYM-Bl3H.js";
|
|
7
|
-
import { t as getVercelConversationWorkQueue } from "./vercel-queue-nL0Hq3hr.js";
|
|
8
|
-
import { a as recordUploadedAttachment, i as readLiveAttachment, n as fileFields, u as AttachmentSourceUnavailableError } from "./store-BuhF1QDm.js";
|
|
9
|
-
import { t as webMessageId } from "./web-message-id-C6P83ans.js";
|
|
10
|
-
import * as z from "zod";
|
|
11
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
12
|
-
import { createWebSource, localDestinationSchema, subscribableResourceSchema } from "@sentry/junior-plugin-api";
|
|
13
|
-
import { and, asc, eq, gt, inArray, isNull, lte, sql } from "drizzle-orm";
|
|
14
|
-
import { alias } from "drizzle-orm/pg-core";
|
|
15
|
-
// src/chat/tool-support/structured-result.ts
|
|
16
|
-
const juniorToolContinuationSchema = z.object({
|
|
17
|
-
arguments: z.record(z.string(), z.unknown()),
|
|
18
|
-
reason: z.string().min(1).optional()
|
|
19
|
-
}).strict();
|
|
20
|
-
const juniorToolBoundContinuationSchema = juniorToolContinuationSchema.extend({ tool_name: z.string().min(1) });
|
|
21
|
-
/** Shared optional fields for canonical Junior tool outputs. */
|
|
22
|
-
const juniorToolOutputSchema = z.object({
|
|
23
|
-
target: z.string().min(1).optional(),
|
|
24
|
-
truncated: z.boolean().optional(),
|
|
25
|
-
/** True when this attempt did not finish before its time budget. */
|
|
26
|
-
timed_out: z.boolean().optional(),
|
|
27
|
-
continuation: juniorToolContinuationSchema.optional()
|
|
28
|
-
}).passthrough();
|
|
29
|
-
function sortJsonValue(value) {
|
|
30
|
-
if (Array.isArray(value)) return value.map(sortJsonValue);
|
|
31
|
-
if (!value || typeof value !== "object") return value;
|
|
32
|
-
return Object.fromEntries(Object.entries(value).filter(([, item]) => item !== void 0).sort(([left], [right]) => left.localeCompare(right)).map(([key, item]) => [key, sortJsonValue(item)]));
|
|
33
|
-
}
|
|
34
|
-
const continuationDetailsSchema = z.looseObject({ continuation: z.looseObject({}) });
|
|
35
|
-
/** Bind continuation metadata to the exposed runtime tool name. */
|
|
36
|
-
function injectContinuationToolName(details, toolName) {
|
|
37
|
-
const parsed = continuationDetailsSchema.safeParse(details);
|
|
38
|
-
if (!parsed.success) return details;
|
|
39
|
-
return {
|
|
40
|
-
...parsed.data,
|
|
41
|
-
continuation: juniorToolBoundContinuationSchema.parse({
|
|
42
|
-
...parsed.data.continuation,
|
|
43
|
-
tool_name: toolName
|
|
44
|
-
})
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
function makeStructuredToolOutput(details, options = {}) {
|
|
48
|
-
return {
|
|
49
|
-
content: [{
|
|
50
|
-
type: "text",
|
|
51
|
-
text: JSON.stringify(sortJsonValue(details))
|
|
52
|
-
}, ...options.content ?? []],
|
|
53
|
-
details
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
// src/chat/tool-support/zod-tool.ts
|
|
57
|
-
function isContentOnlyToolResult(value) {
|
|
58
|
-
return value !== null && typeof value === "object" && Array.isArray(value.content) && !("details" in value);
|
|
59
|
-
}
|
|
60
|
-
function isStructuredToolResultEnvelope(value) {
|
|
61
|
-
return value !== null && typeof value === "object" && Array.isArray(value.content) && "details" in value;
|
|
62
|
-
}
|
|
63
|
-
function parseToolContent(content) {
|
|
64
|
-
for (const item of content) if (!item || typeof item !== "object" || (item.type === "text" ? typeof item.text !== "string" : item.type === "image" ? typeof item.data !== "string" || typeof item.mimeType !== "string" : true)) throw new TypeError("zodTool() content must contain valid text or image items.");
|
|
65
|
-
return content;
|
|
66
|
-
}
|
|
67
|
-
function formatZodPath(path) {
|
|
68
|
-
return path.length > 0 ? path.map(String).join(".") : "root";
|
|
69
|
-
}
|
|
70
|
-
function formatToolInputError(error) {
|
|
71
|
-
return `Invalid tool arguments: ${error.issues.slice(0, 5).map((issue) => `${formatZodPath(issue.path)}: ${issue.message}`).join("; ") || "input did not match schema"}`;
|
|
72
|
-
}
|
|
73
|
-
/** Parse tool input with its Zod schema, as a model-repairable error on failure. */
|
|
74
|
-
function parseToolInput(schema, args) {
|
|
75
|
-
const result = schema.safeParse(args);
|
|
76
|
-
if (!result.success) throw new ToolInputError(formatToolInputError(result.error), { cause: result.error });
|
|
77
|
-
return result.data;
|
|
78
|
-
}
|
|
79
|
-
/** Declare the static definition of a Zod tool once, for the registry and its factory. */
|
|
80
|
-
function zodToolDefinition(definition) {
|
|
81
|
-
return definition;
|
|
82
|
-
}
|
|
83
|
-
function zodTool(definition) {
|
|
84
|
-
const { inputSchema, outputSchema, prepareArguments, execute, ...toolDef } = definition;
|
|
85
|
-
let modelInputSchema;
|
|
86
|
-
try {
|
|
87
|
-
modelInputSchema = z.toJSONSchema(inputSchema);
|
|
88
|
-
} catch (error) {
|
|
89
|
-
throw new TypeError("zodTool() inputSchema must be representable as JSON Schema.", { cause: error });
|
|
90
|
-
}
|
|
91
|
-
let modelOutputSchema;
|
|
92
|
-
if (outputSchema) try {
|
|
93
|
-
modelOutputSchema = z.toJSONSchema(outputSchema);
|
|
94
|
-
} catch (error) {
|
|
95
|
-
throw new TypeError("zodTool() outputSchema must be representable as JSON Schema.", { cause: error });
|
|
96
|
-
}
|
|
97
|
-
return {
|
|
98
|
-
...toolDef,
|
|
99
|
-
inputSchema: modelInputSchema,
|
|
100
|
-
...modelOutputSchema ? { outputSchema: modelOutputSchema } : void 0,
|
|
101
|
-
prepareArguments(args) {
|
|
102
|
-
return parseToolInput(inputSchema, prepareArguments ? prepareArguments(args) : args);
|
|
103
|
-
},
|
|
104
|
-
...execute ? { async execute(input, options) {
|
|
105
|
-
const result = await execute(input, options);
|
|
106
|
-
if (!outputSchema) {
|
|
107
|
-
if (isContentOnlyToolResult(result)) return result;
|
|
108
|
-
throw new TypeError("zodTool() content-only tools must return { content } without details.");
|
|
109
|
-
}
|
|
110
|
-
if (isStructuredToolResultEnvelope(result)) return {
|
|
111
|
-
content: parseToolContent(result.content),
|
|
112
|
-
details: outputSchema.parse(result.details)
|
|
113
|
-
};
|
|
114
|
-
return outputSchema.parse(result);
|
|
115
|
-
} } : void 0
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
// src/chat/slack/attachments.ts
|
|
119
|
-
/** Save the vision summary for a stored Slack attachment. */
|
|
120
|
-
async function recordSlackAttachment(args) {
|
|
121
|
-
const db = args.db.db();
|
|
122
|
-
await db.with(conversationDetailTouch(db, [args.conversationId])).update(juniorAttachments).set({ visionSummary: args.visionSummary }).where(and(eq(juniorAttachments.id, args.attachmentId), eq(juniorAttachments.conversationId, args.conversationId), isNull(juniorAttachments.deleteRequestedAt)));
|
|
123
|
-
}
|
|
124
|
-
/** Read a saved vision summary for one live attachment. */
|
|
125
|
-
async function readAttachmentVisionSummary(args) {
|
|
126
|
-
const [row] = await args.db.db().select({ visionSummary: juniorAttachments.visionSummary }).from(juniorAttachments).where(and(eq(juniorAttachments.id, args.attachmentId), eq(juniorAttachments.conversationId, args.conversationId), isNull(juniorAttachments.deleteRequestedAt)));
|
|
127
|
-
return row?.visionSummary;
|
|
128
|
-
}
|
|
129
|
-
/** Match live conversation attachments to Slack file ids. */
|
|
130
|
-
async function matchSlackAttachments(args) {
|
|
131
|
-
if (args.providerIds.length === 0) return [];
|
|
132
|
-
return (await args.db.db().select({
|
|
133
|
-
id: juniorAttachments.id,
|
|
134
|
-
providerId: juniorAttachments.providerId,
|
|
135
|
-
bytes: juniorAttachments.bytes,
|
|
136
|
-
contentType: juniorAttachments.contentType,
|
|
137
|
-
storageKey: juniorAttachments.storageKey,
|
|
138
|
-
storageProvider: juniorAttachments.storageProvider,
|
|
139
|
-
title: juniorAttachments.title
|
|
140
|
-
}).from(juniorAttachments).where(and(eq(juniorAttachments.conversationId, args.conversationId), eq(juniorAttachments.provider, "slack"), inArray(juniorAttachments.providerId, args.providerIds), isNull(juniorAttachments.deleteRequestedAt)))).map((row) => {
|
|
141
|
-
const { bytes, contentType, filename } = fileFields(row);
|
|
142
|
-
const attachment = {
|
|
143
|
-
bytes,
|
|
144
|
-
contentType,
|
|
145
|
-
filename,
|
|
146
|
-
id: row.id,
|
|
147
|
-
providerId: row.providerId
|
|
148
|
-
};
|
|
149
|
-
return row.storageKey === null ? {
|
|
150
|
-
...attachment,
|
|
151
|
-
pending: true
|
|
152
|
-
} : attachment;
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Fingerprint the live Slack attachments that `matchSlackAttachments` can
|
|
157
|
-
* return for a Conversation. It changes when one is recorded, stored, or
|
|
158
|
-
* deleted, so a reader can tell that stored messages may now show other
|
|
159
|
-
* files, or a file that is no longer pending.
|
|
160
|
-
*/
|
|
161
|
-
function slackAttachmentsVersionQuery(db, conversationId) {
|
|
162
|
-
return db.select({ version: sql`coalesce(md5(string_agg(concat(${juniorAttachments.id}, ':', ${juniorAttachments.storageKey} is null), ',' order by ${juniorAttachments.id})), '')` }).from(juniorAttachments).where(and(eq(juniorAttachments.conversationId, conversationId), eq(juniorAttachments.provider, "slack"), isNull(juniorAttachments.deleteRequestedAt)));
|
|
163
|
-
}
|
|
164
|
-
/** Read the Slack file identity retained by the Chat SDK. */
|
|
165
|
-
function getSlackFileId(attachment) {
|
|
166
|
-
const metadataId = attachment.fetchMetadata?.["fileId"];
|
|
167
|
-
if (metadataId) return metadataId;
|
|
168
|
-
return (attachment.url ?? attachment.fetchMetadata?.["url"] ?? "").match(/(?:^|[-/])(F[A-Z0-9]+)(?:[-/]|$)/)?.[1];
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Look up a Slack file that Junior recorded without storing it yet.
|
|
172
|
-
*
|
|
173
|
-
* Uses the installation token that the caller binds: the Slack turn, or the
|
|
174
|
-
* dashboard route for the conversation's Slack team.
|
|
175
|
-
*/
|
|
176
|
-
const readSlackAttachmentSource = async (source) => {
|
|
177
|
-
const unavailable = (cause) => new AttachmentSourceUnavailableError("The Slack file was deleted, or this app can no longer access it.", { cause });
|
|
178
|
-
if (source.provider !== "slack") throw unavailable();
|
|
179
|
-
const file = await readPrivateSlackFile(source.id);
|
|
180
|
-
if (!file) throw unavailable();
|
|
181
|
-
return {
|
|
182
|
-
bytes: file.bytes,
|
|
183
|
-
open: async () => {
|
|
184
|
-
try {
|
|
185
|
-
return await streamPrivateSlackFile(file.url);
|
|
186
|
-
} catch (error) {
|
|
187
|
-
if (error instanceof SlackActionError && (error.code === "not_found" || error.statusCode === 403)) throw unavailable(error);
|
|
188
|
-
throw error;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
};
|
|
192
|
-
};
|
|
193
|
-
// src/chat/attachments/uploads.ts
|
|
194
|
-
const MINUTE_MS = 6e4;
|
|
195
|
-
/** Time that a browser has to write the bytes after it asks to upload. */
|
|
196
|
-
const UPLOAD_TARGET_TTL_MS = 15 * MINUTE_MS;
|
|
197
|
-
/** Time that a written upload can still join a Message. */
|
|
198
|
-
const UPLOAD_SEND_WINDOW_MS = 60 * MINUTE_MS;
|
|
199
|
-
/**
|
|
200
|
-
* Age at which cleanup deletes an upload that no Message used. It is much
|
|
201
|
-
* longer than the send window, so cleanup cannot race a send.
|
|
202
|
-
*/
|
|
203
|
-
const UPLOAD_RETENTION_MS = 1440 * MINUTE_MS;
|
|
204
|
-
const UPLOAD_GC_BATCH_LIMIT = 200;
|
|
205
|
-
/** Leading bytes that image type detection reads. */
|
|
206
|
-
const SIGNATURE_BYTES = 16;
|
|
207
|
-
/** A Message refers to an upload that it cannot use. */
|
|
208
|
-
var AttachmentUploadError = class extends Error {
|
|
209
|
-
constructor(message) {
|
|
210
|
-
super(message);
|
|
211
|
-
this.name = "AttachmentUploadError";
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
/**
|
|
215
|
-
* Reserve one object key for a browser upload.
|
|
216
|
-
*
|
|
217
|
-
* Returns no target when the provider cannot sign browser writes. The caller
|
|
218
|
-
* then takes the bytes with `writeAttachmentUpload`.
|
|
219
|
-
*/
|
|
220
|
-
async function createAttachmentUpload(args) {
|
|
221
|
-
const nowMs = args.nowMs ?? Date.now();
|
|
222
|
-
const id = randomUUID();
|
|
223
|
-
const storageKey = `conversations/${args.scope.conversationId}/uploads/${id}`;
|
|
224
|
-
await args.db.db().insert(juniorAttachmentUploads).values({
|
|
225
|
-
...args.scope,
|
|
226
|
-
bytes: args.file.bytes,
|
|
227
|
-
contentType: args.file.contentType,
|
|
228
|
-
createdAt: new Date(nowMs),
|
|
229
|
-
filename: args.file.filename,
|
|
230
|
-
id,
|
|
231
|
-
storageKey,
|
|
232
|
-
storageProvider: args.storage.provider
|
|
233
|
-
});
|
|
234
|
-
const target = await args.storage.createUploadTarget?.({
|
|
235
|
-
bytes: args.file.bytes,
|
|
236
|
-
contentType: args.file.contentType,
|
|
237
|
-
expiresAtMs: nowMs + UPLOAD_TARGET_TTL_MS,
|
|
238
|
-
key: storageKey
|
|
239
|
-
});
|
|
240
|
-
return target ? {
|
|
241
|
-
id,
|
|
242
|
-
target
|
|
243
|
-
} : { id };
|
|
244
|
-
}
|
|
245
|
-
async function readUploadRows(args) {
|
|
246
|
-
return await args.db.db().select().from(juniorAttachmentUploads).where(and(inArray(juniorAttachmentUploads.id, [...args.uploadIds]), eq(juniorAttachmentUploads.conversationId, args.scope.conversationId), eq(juniorAttachmentUploads.idempotencyKey, args.scope.idempotencyKey), eq(juniorAttachmentUploads.userId, args.scope.userId), eq(juniorAttachmentUploads.storageProvider, args.storageProvider), gt(juniorAttachmentUploads.createdAt, /* @__PURE__ */ new Date(args.nowMs - UPLOAD_SEND_WINDOW_MS))));
|
|
247
|
-
}
|
|
248
|
-
/** Write upload bytes through the API, for providers without browser writes. */
|
|
249
|
-
async function writeAttachmentUpload(args) {
|
|
250
|
-
const nowMs = args.nowMs ?? Date.now();
|
|
251
|
-
const [row] = await args.db.db().select().from(juniorAttachmentUploads).where(and(eq(juniorAttachmentUploads.id, args.uploadId), eq(juniorAttachmentUploads.userId, args.userId), eq(juniorAttachmentUploads.storageProvider, args.storage.provider), gt(juniorAttachmentUploads.createdAt, /* @__PURE__ */ new Date(nowMs - UPLOAD_TARGET_TTL_MS))));
|
|
252
|
-
if (!row) throw new AttachmentUploadError("Upload not found.");
|
|
253
|
-
if (await readLiveAttachment({
|
|
254
|
-
attachmentId: row.id,
|
|
255
|
-
conversationId: row.conversationId,
|
|
256
|
-
db: args.db
|
|
257
|
-
})) throw new AttachmentUploadError("Upload was already sent.");
|
|
258
|
-
if (args.body.byteLength !== row.bytes) throw new AttachmentUploadError("Upload size does not match the file.");
|
|
259
|
-
await args.storage.put({
|
|
260
|
-
body: bufferBody(args.body),
|
|
261
|
-
bytes: row.bytes,
|
|
262
|
-
contentType: row.contentType,
|
|
263
|
-
key: row.storageKey
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
/** Read a whole object once for its size, digest, and leading bytes. */
|
|
267
|
-
async function inspectObject(body, maxBytes) {
|
|
268
|
-
const hash = createHash("sha256");
|
|
269
|
-
const head = [];
|
|
270
|
-
let headBytes = 0;
|
|
271
|
-
let bytes = 0;
|
|
272
|
-
const reader = body.getReader();
|
|
273
|
-
for (;;) {
|
|
274
|
-
const { done, value } = await reader.read();
|
|
275
|
-
if (done) break;
|
|
276
|
-
bytes += value.byteLength;
|
|
277
|
-
if (bytes > maxBytes) {
|
|
278
|
-
await reader.cancel();
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
|
-
hash.update(value);
|
|
282
|
-
if (headBytes < SIGNATURE_BYTES) {
|
|
283
|
-
head.push(Buffer.from(value.subarray(0, SIGNATURE_BYTES - headBytes)));
|
|
284
|
-
headBytes += head.at(-1).byteLength;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
return {
|
|
288
|
-
bytes,
|
|
289
|
-
head: Buffer.concat(head),
|
|
290
|
-
sha256: hash.digest("hex")
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Pick the type to store from the file signature, not only the browser's
|
|
295
|
-
* guess from the file name. Models reject an image whose bytes do not match
|
|
296
|
-
* its type, so a file that only claims to be an image is stored as bytes.
|
|
297
|
-
*/
|
|
298
|
-
function storedContentType(declared, head) {
|
|
299
|
-
const detected = detectImageMediaType(head);
|
|
300
|
-
if (detected) return detected;
|
|
301
|
-
return isVisionImageMediaType(declared) ? "application/octet-stream" : declared;
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Check the uploads of one Message before the Message is accepted.
|
|
305
|
-
*
|
|
306
|
-
* Each upload must belong to the scope and be written in full at its
|
|
307
|
-
* declared size. Throws `AttachmentUploadError` for any upload that the
|
|
308
|
-
* Message cannot use.
|
|
309
|
-
*/
|
|
310
|
-
async function verifyAttachmentUploads(args) {
|
|
311
|
-
if (args.uploadIds.length === 0) return [];
|
|
312
|
-
if (new Set(args.uploadIds).size !== args.uploadIds.length) throw new AttachmentUploadError("Attach each file once.");
|
|
313
|
-
const rows = await readUploadRows({
|
|
314
|
-
db: args.db,
|
|
315
|
-
nowMs: args.nowMs ?? Date.now(),
|
|
316
|
-
scope: args.scope,
|
|
317
|
-
storageProvider: args.storage.provider,
|
|
318
|
-
uploadIds: args.uploadIds
|
|
319
|
-
});
|
|
320
|
-
const byId = new Map(rows.map((row) => [row.id, row]));
|
|
321
|
-
return await Promise.all(args.uploadIds.map(async (uploadId) => {
|
|
322
|
-
const row = byId.get(uploadId);
|
|
323
|
-
if (!row) throw new AttachmentUploadError("Upload expired. Attach the file again.");
|
|
324
|
-
const recorded = await readLiveAttachment({
|
|
325
|
-
attachmentId: row.id,
|
|
326
|
-
conversationId: row.conversationId,
|
|
327
|
-
db: args.db
|
|
328
|
-
});
|
|
329
|
-
if (recorded) return {
|
|
330
|
-
attachment: {
|
|
331
|
-
bytes: recorded.bytes,
|
|
332
|
-
contentType: recorded.contentType,
|
|
333
|
-
filename: recorded.filename,
|
|
334
|
-
id: recorded.id
|
|
335
|
-
},
|
|
336
|
-
recorded: true
|
|
337
|
-
};
|
|
338
|
-
const body = await args.storage.get(row.storageKey);
|
|
339
|
-
const object = body ? await inspectObject(body, row.bytes) : void 0;
|
|
340
|
-
if (!object || object.bytes !== row.bytes) throw new AttachmentUploadError(`Upload of ${row.filename} is not complete. Attach it again.`);
|
|
341
|
-
return {
|
|
342
|
-
attachment: {
|
|
343
|
-
bytes: row.bytes,
|
|
344
|
-
contentType: storedContentType(row.contentType, object.head),
|
|
345
|
-
filename: row.filename,
|
|
346
|
-
id: row.id
|
|
347
|
-
},
|
|
348
|
-
recorded: false,
|
|
349
|
-
sha256: object.sha256,
|
|
350
|
-
storageKey: row.storageKey
|
|
351
|
-
};
|
|
352
|
-
}));
|
|
353
|
-
}
|
|
354
|
-
/** Record checked uploads as attachments of their Conversation. */
|
|
355
|
-
async function recordAttachmentUploads(args) {
|
|
356
|
-
await mapBounded(args.uploads.filter((upload) => !upload.recorded), (upload) => recordUploadedAttachment({
|
|
357
|
-
attachment: {
|
|
358
|
-
...upload.attachment,
|
|
359
|
-
conversationId: args.conversationId,
|
|
360
|
-
sha256: upload.sha256,
|
|
361
|
-
storageKey: upload.storageKey
|
|
362
|
-
},
|
|
363
|
-
db: args.db,
|
|
364
|
-
nowMs: args.nowMs ?? Date.now(),
|
|
365
|
-
storage: args.storage
|
|
366
|
-
}));
|
|
367
|
-
return args.uploads.map((upload) => upload.attachment);
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Delete old upload rows in one bounded batch.
|
|
371
|
-
*
|
|
372
|
-
* An upload that a Message recorded keeps its object: the attachment row owns
|
|
373
|
-
* it now. Other objects are deleted first, so a failed delete stays
|
|
374
|
-
* retryable.
|
|
375
|
-
*/
|
|
376
|
-
async function collectAttachmentUploadGarbage(args) {
|
|
377
|
-
const rows = await args.db.db().select({
|
|
378
|
-
id: juniorAttachmentUploads.id,
|
|
379
|
-
recordedId: juniorAttachments.id,
|
|
380
|
-
storageKey: juniorAttachmentUploads.storageKey
|
|
381
|
-
}).from(juniorAttachmentUploads).leftJoin(juniorAttachments, eq(juniorAttachments.id, juniorAttachmentUploads.id)).where(and(eq(juniorAttachmentUploads.storageProvider, args.storage.provider), lte(juniorAttachmentUploads.createdAt, /* @__PURE__ */ new Date(args.nowMs - UPLOAD_RETENTION_MS)))).orderBy(asc(juniorAttachmentUploads.createdAt)).limit(UPLOAD_GC_BATCH_LIMIT);
|
|
382
|
-
if (rows.length === 0) return { deleted: 0 };
|
|
383
|
-
const unusedKeys = rows.filter((row) => row.recordedId === null).map((row) => row.storageKey);
|
|
384
|
-
await args.storage.delete(unusedKeys);
|
|
385
|
-
return { deleted: (await args.db.db().delete(juniorAttachmentUploads).where(inArray(juniorAttachmentUploads.id, rows.map((row) => row.id))).returning({ id: juniorAttachmentUploads.id })).length };
|
|
386
|
-
}
|
|
387
|
-
// src/chat/conversations/destination.ts
|
|
388
|
-
function requireLocalDestination(conversationId) {
|
|
389
|
-
const parsed = localDestinationSchema.safeParse({
|
|
390
|
-
platform: "local",
|
|
391
|
-
conversationId
|
|
392
|
-
});
|
|
393
|
-
if (!parsed.success) throw new Error(`Invalid local conversation id: ${conversationId}`);
|
|
394
|
-
return parsed.data;
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* Keep a stored Destination, or create the temporary local Destination.
|
|
398
|
-
*
|
|
399
|
-
* TODO(dcramer): Delete this module after Conversation and AgentRun use
|
|
400
|
-
* Location, and web and event Turns no longer need a local
|
|
401
|
-
* Destination.
|
|
402
|
-
*/
|
|
403
|
-
function resolveConversationDestination(args) {
|
|
404
|
-
return args.existing ?? requireLocalDestination(args.conversationId);
|
|
405
|
-
}
|
|
406
|
-
// src/chat/conversations/web-input.ts
|
|
407
|
-
function normalizeEmail(email) {
|
|
408
|
-
return email.trim().toLowerCase();
|
|
409
|
-
}
|
|
410
|
-
function stableHex(...parts) {
|
|
411
|
-
return createHash("sha256").update(parts.join("\0")).digest("hex").slice(0, 24);
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Build a durable Conversation id for one web Actor and create key.
|
|
415
|
-
*
|
|
416
|
-
* Retries with the same key must address the same Conversation before the
|
|
417
|
-
* mailbox Message id is derived.
|
|
418
|
-
*/
|
|
419
|
-
function createConversationId(args) {
|
|
420
|
-
return `local:web:${stableHex(normalizeEmail(args.actorEmail), args.idempotencyKey)}`;
|
|
421
|
-
}
|
|
422
|
-
/** Return the stable Turn id for one mailbox Message. */
|
|
423
|
-
function conversationTurnIdForMessage(messageId) {
|
|
424
|
-
return buildDeterministicTurnId(messageId);
|
|
425
|
-
}
|
|
426
|
-
/**
|
|
427
|
-
* Store the dashboard participant in the current Conversation actor field.
|
|
428
|
-
*
|
|
429
|
-
* TODO(dcramer): Remove this StoredSlackActor conversion after Conversation
|
|
430
|
-
* actor storage accepts web Actors directly.
|
|
431
|
-
*/
|
|
432
|
-
function storedActorFromWeb(actor) {
|
|
433
|
-
return {
|
|
434
|
-
...actor.email ? { email: normalizeEmail(actor.email) } : void 0,
|
|
435
|
-
...actor.fullName ? { fullName: actor.fullName } : void 0
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* Return whether a person can add a web Message to an existing
|
|
440
|
-
* Conversation: a dashboard Conversation, a Slack thread, or a Thread.
|
|
441
|
-
*/
|
|
442
|
-
function acceptsWebMessages(conversation) {
|
|
443
|
-
if (!isTopLevelKind(conversation.kind)) return conversation.kind === "thread";
|
|
444
|
-
const { conversationId, destination } = conversation;
|
|
445
|
-
if (destination?.platform === "slack") return true;
|
|
446
|
-
return destination?.platform === "local" && conversationId.startsWith("local:web:");
|
|
447
|
-
}
|
|
448
|
-
/**
|
|
449
|
-
* Build the web Actor for one signed-in User. Junior is the web provider,
|
|
450
|
-
* so the provider-scoped Actor id is the User id.
|
|
451
|
-
*/
|
|
452
|
-
function webActorFromUser(user, profile) {
|
|
453
|
-
return {
|
|
454
|
-
platform: "web",
|
|
455
|
-
userId: user.id,
|
|
456
|
-
email: normalizeEmail(user.email),
|
|
457
|
-
...user.displayName ? { fullName: user.displayName } : void 0,
|
|
458
|
-
...profile?.userName ? { userName: profile.userName } : void 0
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
/** Build one web mailbox entry. */
|
|
462
|
-
function buildWebInboundMessage(args) {
|
|
463
|
-
const text = args.message.trim();
|
|
464
|
-
if (!text && !args.attachments?.length) throw new Error("Web Message must not be empty");
|
|
465
|
-
if (!args.actor.email) throw new Error("Web Actor requires a verified email");
|
|
466
|
-
const nowMs = args.nowMs ?? Date.now();
|
|
467
|
-
const traceContext = getActiveTraceContext();
|
|
468
|
-
return {
|
|
469
|
-
conversationId: args.conversationId,
|
|
470
|
-
createdAtMs: args.createdAtMs ?? nowMs,
|
|
471
|
-
delivery: args.delivery ?? "defer",
|
|
472
|
-
...args.destination ? { destination: args.destination } : void 0,
|
|
473
|
-
inboundMessageId: args.messageId,
|
|
474
|
-
input: {
|
|
475
|
-
authorId: args.actor.userId,
|
|
476
|
-
...args.authorIdentityId ? { authorIdentityId: args.authorIdentityId } : void 0,
|
|
477
|
-
text,
|
|
478
|
-
...args.attachments?.length ? { attachments: args.attachments } : void 0,
|
|
479
|
-
...args.reviewItemChange ? { reviewItemChange: args.reviewItemChange } : void 0,
|
|
480
|
-
metadata: {
|
|
481
|
-
authorEmail: normalizeEmail(args.actor.email),
|
|
482
|
-
...args.actor.fullName && { authorFullName: args.actor.fullName },
|
|
483
|
-
authorUserId: args.actor.userId,
|
|
484
|
-
...args.actor.userName && { authorUserName: args.actor.userName },
|
|
485
|
-
kind: "api_turn",
|
|
486
|
-
messageId: args.messageId
|
|
487
|
-
}
|
|
488
|
-
},
|
|
489
|
-
receivedAtMs: nowMs,
|
|
490
|
-
source: "web",
|
|
491
|
-
...traceContext ? { traceContext } : void 0
|
|
492
|
-
};
|
|
493
|
-
}
|
|
494
|
-
/**
|
|
495
|
-
* Record web activity and create a Conversation root when needed. Returns the
|
|
496
|
-
* Destination for the Message's work. A child's work keeps none, so its
|
|
497
|
-
* workers read the Conversation.
|
|
498
|
-
*/
|
|
499
|
-
async function recordWebConversationActivity(args) {
|
|
500
|
-
const store = args.conversationStore ?? getConversationStore();
|
|
501
|
-
const existing = await store.get({ conversationId: args.conversationId });
|
|
502
|
-
const destination = resolveConversationDestination({
|
|
503
|
-
conversationId: args.conversationId,
|
|
504
|
-
existing: existing?.destination
|
|
505
|
-
});
|
|
506
|
-
const isNewRoot = !existing;
|
|
507
|
-
const visibility = args.rootVisibility === "private" ? "private" : "public";
|
|
508
|
-
const source = isNewRoot ? createWebSource(args.conversationId, visibility) : void 0;
|
|
509
|
-
await store.recordActivity({
|
|
510
|
-
conversationId: args.conversationId,
|
|
511
|
-
...existing?.destination ? void 0 : { destination },
|
|
512
|
-
nowMs: args.nowMs,
|
|
513
|
-
actor: storedActorFromWeb(args.actor),
|
|
514
|
-
...isNewRoot ? { source: "web" } : void 0,
|
|
515
|
-
...source ? { sessionSource: source } : void 0,
|
|
516
|
-
...isNewRoot && args.rootTitle ? { title: args.rootTitle } : void 0,
|
|
517
|
-
...isNewRoot ? { visibility } : void 0,
|
|
518
|
-
...isNewRoot && args.rootKind ? { kind: args.rootKind } : void 0
|
|
519
|
-
});
|
|
520
|
-
return existing && !isTopLevelKind(existing.kind) ? void 0 : destination;
|
|
521
|
-
}
|
|
522
|
-
/** Create a Conversation from web input and enqueue its first Message. */
|
|
523
|
-
async function createAndEnqueueConversation(input, options) {
|
|
524
|
-
if (!input.actor.email) throw new Error("Web Actor requires a verified email");
|
|
525
|
-
const conversationId = createConversationId({
|
|
526
|
-
actorEmail: input.actor.email,
|
|
527
|
-
idempotencyKey: input.idempotencyKey
|
|
528
|
-
});
|
|
529
|
-
return await appendAndEnqueueWebMessage({
|
|
530
|
-
actor: input.actor,
|
|
531
|
-
conversationId,
|
|
532
|
-
idempotencyKey: input.idempotencyKey,
|
|
533
|
-
message: input.message,
|
|
534
|
-
uploads: input.uploads,
|
|
535
|
-
...input.title ? { rootTitle: input.title } : void 0,
|
|
536
|
-
rootVisibility: input.visibility === "private" ? "private" : "public"
|
|
537
|
-
}, options);
|
|
538
|
-
}
|
|
539
|
-
async function appendAndEnqueueWebMessage(input, options) {
|
|
540
|
-
const text = input.message.trim();
|
|
541
|
-
if (!text && !input.uploads?.length) throw new Error("Web Message must not be empty");
|
|
542
|
-
if (!input.actor.email) throw new Error("Web Actor requires a verified email");
|
|
543
|
-
const nowMs = options.nowMs ?? Date.now();
|
|
544
|
-
const messageId = await webMessageId({
|
|
545
|
-
conversationId: input.conversationId,
|
|
546
|
-
idempotencyKey: input.idempotencyKey
|
|
547
|
-
});
|
|
548
|
-
const destination = await recordWebConversationActivity({
|
|
549
|
-
actor: input.actor,
|
|
550
|
-
conversationId: input.conversationId,
|
|
551
|
-
conversationStore: options.conversationStore,
|
|
552
|
-
nowMs,
|
|
553
|
-
...input.rootTitle && { rootTitle: input.rootTitle },
|
|
554
|
-
...input.rootVisibility && { rootVisibility: input.rootVisibility }
|
|
555
|
-
});
|
|
556
|
-
let attachments = [];
|
|
557
|
-
if (input.uploads?.length) {
|
|
558
|
-
if (!options.attachmentStorage) throw new Error("Attachment storage is unavailable.");
|
|
559
|
-
attachments = await recordAttachmentUploads({
|
|
560
|
-
conversationId: input.conversationId,
|
|
561
|
-
db: getSqlExecutor(),
|
|
562
|
-
nowMs,
|
|
563
|
-
storage: options.attachmentStorage,
|
|
564
|
-
uploads: input.uploads
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
const enqueue = options.exclusive ? appendAndEnqueueExclusiveInboundMessage : appendAndEnqueueInboundMessage;
|
|
568
|
-
const authorIdentityId = await resolveActorIdentityId(getSqlExecutor(), input.actor);
|
|
569
|
-
const enqueueTo = (destination) => enqueue({
|
|
570
|
-
message: buildWebInboundMessage({
|
|
571
|
-
actor: input.actor,
|
|
572
|
-
authorIdentityId,
|
|
573
|
-
conversationId: input.conversationId,
|
|
574
|
-
delivery: input.delivery,
|
|
575
|
-
destination,
|
|
576
|
-
message: text,
|
|
577
|
-
attachments,
|
|
578
|
-
messageId,
|
|
579
|
-
nowMs,
|
|
580
|
-
...input.reviewItemChange && { reviewItemChange: input.reviewItemChange }
|
|
581
|
-
}),
|
|
582
|
-
conversationStore: options.conversationStore,
|
|
583
|
-
nowMs,
|
|
584
|
-
queue: options.queue,
|
|
585
|
-
state: options.state
|
|
586
|
-
});
|
|
587
|
-
let result;
|
|
588
|
-
try {
|
|
589
|
-
result = await enqueueTo(destination);
|
|
590
|
-
} catch (error) {
|
|
591
|
-
if (!destination) throw error;
|
|
592
|
-
const stored = await (options.conversationStore ?? getConversationStore()).get({ conversationId: input.conversationId });
|
|
593
|
-
const current = resolveConversationDestination({
|
|
594
|
-
conversationId: input.conversationId,
|
|
595
|
-
existing: stored?.destination
|
|
596
|
-
});
|
|
597
|
-
if (sameDestination(current, destination)) throw error;
|
|
598
|
-
result = await enqueueTo(current);
|
|
599
|
-
}
|
|
600
|
-
const status = result.status === "appended" ? "accepted" : result.status;
|
|
601
|
-
return {
|
|
602
|
-
conversationId: input.conversationId,
|
|
603
|
-
messageId,
|
|
604
|
-
status
|
|
605
|
-
};
|
|
606
|
-
}
|
|
607
|
-
// src/chat/lead/conversation.ts
|
|
608
|
-
/**
|
|
609
|
-
* The Lead of one person: their private Conversation that finds, starts, and
|
|
610
|
-
* steers their other Conversations. Only web creates a Lead, so its root
|
|
611
|
-
* Actor is the web Identity of its User, and a unique index keeps one Lead
|
|
612
|
-
* for each Identity.
|
|
613
|
-
*/
|
|
614
|
-
const UNIQUE_VIOLATION = "23505";
|
|
615
|
-
const LEAD_TITLE = "Lead";
|
|
616
|
-
async function findLead(identityId) {
|
|
617
|
-
const [row] = await getDb().select({ conversationId: juniorConversations.conversationId }).from(juniorConversations).where(and(eq(juniorConversations.kind, "lead"), eq(juniorConversations.actorIdentityId, identityId))).limit(1);
|
|
618
|
-
return row ? await getConversationStore().get({ conversationId: row.conversationId }) : void 0;
|
|
619
|
-
}
|
|
620
|
-
/** Return the Lead of one User, and create it on first use. */
|
|
621
|
-
async function getLeadConversation(user) {
|
|
622
|
-
const actor = webActorFromUser(user);
|
|
623
|
-
const identityId = await resolveActorIdentityId(getSqlExecutor(), actor);
|
|
624
|
-
if (!identityId) throw new Error("A Lead needs a web Identity");
|
|
625
|
-
const existing = await findLead(identityId);
|
|
626
|
-
if (existing) return existing;
|
|
627
|
-
try {
|
|
628
|
-
await recordWebConversationActivity({
|
|
629
|
-
actor,
|
|
630
|
-
conversationId: `local:web:${randomUUID()}`,
|
|
631
|
-
nowMs: Date.now(),
|
|
632
|
-
rootKind: "lead",
|
|
633
|
-
rootTitle: LEAD_TITLE,
|
|
634
|
-
rootVisibility: "private"
|
|
635
|
-
});
|
|
636
|
-
} catch (error) {
|
|
637
|
-
if (!isPostgresErrorCode(error, UNIQUE_VIOLATION)) throw error;
|
|
638
|
-
}
|
|
639
|
-
const created = await findLead(identityId);
|
|
640
|
-
if (!created) throw new Error("The Lead was not saved");
|
|
641
|
-
return created;
|
|
642
|
-
}
|
|
643
|
-
/**
|
|
644
|
-
* Return the User of a Lead: the person whose Conversations it steers.
|
|
645
|
-
* Returns nothing for a Conversation that is not a Lead.
|
|
646
|
-
*/
|
|
647
|
-
async function readLeadUser(conversationId) {
|
|
648
|
-
const [row] = await getDb().select({
|
|
649
|
-
displayName: juniorUsers.displayName,
|
|
650
|
-
email: juniorUsers.primaryEmail,
|
|
651
|
-
id: juniorUsers.id
|
|
652
|
-
}).from(juniorConversations).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(eq(juniorConversations.conversationId, conversationId), eq(juniorConversations.kind, "lead"))).limit(1);
|
|
653
|
-
return row ? {
|
|
654
|
-
id: row.id,
|
|
655
|
-
email: row.email,
|
|
656
|
-
...row.displayName ? { displayName: row.displayName } : void 0
|
|
657
|
-
} : void 0;
|
|
658
|
-
}
|
|
659
|
-
/**
|
|
660
|
-
* Return whether the person of a Lead is a Participant of one root
|
|
661
|
-
* Conversation. False when the sender is not a Lead, or when the target is
|
|
662
|
-
* not a root, such as an Automation run.
|
|
663
|
-
*/
|
|
664
|
-
async function leadPersonParticipates(args) {
|
|
665
|
-
const target = alias(juniorConversations, "target");
|
|
666
|
-
const [row] = await getDb().select({ one: sql`1` }).from(juniorConversations).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).innerJoin(juniorConversationParticipants, and(eq(juniorConversationParticipants.userId, juniorIdentities.userId), eq(juniorConversationParticipants.rootConversationId, args.rootConversationId))).innerJoin(target, and(eq(target.conversationId, args.rootConversationId), eq(conversationKindSql(target), "root"))).where(and(eq(juniorConversations.conversationId, args.leadConversationId), eq(juniorConversations.kind, "lead"))).limit(1);
|
|
667
|
-
return row !== void 0;
|
|
668
|
-
}
|
|
669
|
-
// src/chat/lead/start-conversation.ts
|
|
670
|
-
/**
|
|
671
|
-
* Start one Conversation from a Lead. The new Conversation is a public web
|
|
672
|
-
* root of the Lead's person and runs as that person, like any root. The
|
|
673
|
-
* Lead's task is its first Message. The start is not reviewed. Action
|
|
674
|
-
* review judges the new root's own tool calls, as it does a child agent's.
|
|
675
|
-
*/
|
|
676
|
-
/**
|
|
677
|
-
* Create the Conversation and enqueue the task as its first Message. Repeat
|
|
678
|
-
* calls with the same `messageKey` are safe.
|
|
679
|
-
*/
|
|
680
|
-
async function startLeadConversation(args) {
|
|
681
|
-
const user = await readLeadUser(args.leadConversationId);
|
|
682
|
-
if (!user) throw new Error("Only a Lead can start a Conversation");
|
|
683
|
-
const idempotencyKey = `lead:${args.leadConversationId}:${args.messageKey}`;
|
|
684
|
-
const conversationId = createConversationId({
|
|
685
|
-
actorEmail: user.email,
|
|
686
|
-
idempotencyKey
|
|
687
|
-
});
|
|
688
|
-
await appendAndEnqueueWebMessage({
|
|
689
|
-
actor: webActorFromUser(user),
|
|
690
|
-
conversationId,
|
|
691
|
-
idempotencyKey,
|
|
692
|
-
message: args.task,
|
|
693
|
-
rootTitle: args.title,
|
|
694
|
-
rootVisibility: "public"
|
|
695
|
-
}, {
|
|
696
|
-
nowMs: Date.now(),
|
|
697
|
-
queue: args.queue
|
|
698
|
-
});
|
|
699
|
-
return { conversationId };
|
|
700
|
-
}
|
|
701
|
-
// src/chat/tools/start-conversation.ts
|
|
702
|
-
/** Static definition of `startConversation`, which only a Lead lists. */
|
|
703
|
-
const startConversationToolDefinition = zodToolDefinition({
|
|
704
|
-
description: [
|
|
705
|
-
"Start a new conversation that does one piece of the person's work. It is a public conversation of the person, and it starts at once.",
|
|
706
|
-
"Your task is its first message, and it runs as the person, so write the task as the person's request.",
|
|
707
|
-
"Use messageAgent instead for work that a conversation already does."
|
|
708
|
-
].join(" "),
|
|
709
|
-
exposure: "modelOnly",
|
|
710
|
-
approvalMode: "auto",
|
|
711
|
-
annotations: {
|
|
712
|
-
destructiveHint: false,
|
|
713
|
-
idempotentHint: true,
|
|
714
|
-
openWorldHint: false,
|
|
715
|
-
readOnlyHint: false
|
|
716
|
-
},
|
|
717
|
-
inputSchema: z.object({
|
|
718
|
-
task: z.string().trim().min(1).describe("Self-contained brief for a peer who has not seen this conversation: the goal, the targets, the facts you know, the constraints, and what done means."),
|
|
719
|
-
title: z.string().trim().min(1).max(60).describe("Short display title of the new conversation.")
|
|
720
|
-
}).strict(),
|
|
721
|
-
outputSchema: juniorToolOutputSchema.extend({
|
|
722
|
-
conversation_id: z.string().min(1).describe("ID of the new conversation. Pass it to messageAgent to steer it."),
|
|
723
|
-
url: z.string().url().optional().describe("Link to the new conversation."),
|
|
724
|
-
subscribable: subscribableResourceSchema.describe("Watch it with watchEvents only when the person asks to hear back.")
|
|
725
|
-
})
|
|
726
|
-
});
|
|
727
|
-
/** Create the tool that starts a Conversation from a Lead Turn. */
|
|
728
|
-
function createStartConversationTool(context) {
|
|
729
|
-
return zodTool({
|
|
730
|
-
...startConversationToolDefinition,
|
|
731
|
-
execute: async (input, options) => {
|
|
732
|
-
if (!options.toolCallId || !context.turnId) throw new ToolInputError("startConversation requires an active Turn and tool call ID. No change to the call can fix this.");
|
|
733
|
-
const { conversationId } = await startLeadConversation({
|
|
734
|
-
leadConversationId: context.conversationId,
|
|
735
|
-
messageKey: `${context.turnId}:${options.toolCallId}`,
|
|
736
|
-
queue: context.conversationWorkQueue ?? getVercelConversationWorkQueue(),
|
|
737
|
-
task: input.task,
|
|
738
|
-
title: input.title
|
|
739
|
-
});
|
|
740
|
-
const url = getDashboardConversationLink(conversationId);
|
|
741
|
-
return {
|
|
742
|
-
conversation_id: conversationId,
|
|
743
|
-
...url ? { url } : void 0,
|
|
744
|
-
subscribable: conversationWatch({
|
|
745
|
-
conversationId,
|
|
746
|
-
title: input.title
|
|
747
|
-
})
|
|
748
|
-
};
|
|
749
|
-
}
|
|
750
|
-
});
|
|
751
|
-
}
|
|
752
|
-
export { makeStructuredToolOutput as A, recordSlackAttachment as C, zodToolDefinition as D, zodTool as E, injectContinuationToolName as O, readSlackAttachmentSource as S, parseToolInput as T, verifyAttachmentUploads as _, readLeadUser as a, matchSlackAttachments as b, conversationTurnIdForMessage as c, recordWebConversationActivity as d, webActorFromUser as f, createAttachmentUpload as g, collectAttachmentUploadGarbage as h, leadPersonParticipates as i, juniorToolOutputSchema as k, createAndEnqueueConversation as l, AttachmentUploadError as m, startConversationToolDefinition as n, acceptsWebMessages as o, resolveConversationDestination as p, getLeadConversation as r, appendAndEnqueueWebMessage as s, createStartConversationTool as t, createConversationId as u, writeAttachmentUpload as v, slackAttachmentsVersionQuery as w, readAttachmentVisionSummary as x, getSlackFileId as y };
|