@sentry/junior 0.313.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-mt7K6dPh.js → adapter-context-BlSGE44V.js} +46 -7
- package/dist/{admin-Cyhb4TwZ.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 +5 -7
- package/dist/api.d.ts +2 -3
- package/dist/api.js +1172 -371
- package/dist/{app-DA8-hCMj.d.ts → app-D_bAXRDe.d.ts} +312 -48
- package/dist/app.d.ts +2 -2
- package/dist/app.js +305 -184
- package/dist/change-record-Bqsa5ZXE.d.ts +175 -0
- package/dist/chat-core-engine-CxkwRpn9.js +123 -0
- package/dist/child-message--2G3Ft26.js +19 -0
- package/dist/cli/chat.d.ts +4 -1
- package/dist/cli/chat.js +40 -25
- package/dist/cli/check.js +4 -4
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +4 -5
- 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 +68 -97
- package/dist/{continue-in-slack-CxyFzdlF.js → continue-in-slack-BGKjIdFp.js} +3 -7
- package/dist/{conversation-feed-BEXLD3Me.js → conversation-feed-Sl8lKKmR.js} +22 -2
- package/dist/{conversation-turn-B35eu0uz.js → conversation-turn-BoLK9i6g.js} +514 -83
- package/dist/create-BOycVH9h.js +213 -0
- package/dist/{credential-sync-DWTOEQrm.js → credential-sync-Mn4OdkEh.js} +10 -18
- package/dist/db-BpxcYXfD.d.ts +2 -0
- package/dist/{credentialed-Dyv8b-lu.js → db-DXTOYRzR.js} +22220 -9334
- 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-DidUcRhI.js → html-CfXEwl_h.js} +2 -7
- package/dist/instrumentation.js +3 -3
- package/dist/job-runner-CySgpi9v.js +1131 -0
- package/dist/{lineage-BXplQAVH.js → lineage-tRTOcrsL.js} +1 -2
- package/dist/{list-DyIyReSV.js → list-DXBz8SYL.js} +610 -173
- package/dist/local-server-CpnGhYml.js +276 -0
- package/dist/{logging-DNt-qOIO.js → logging-czs0nqLC.js} +2 -45
- package/dist/{turn-membership-DTR3SaKD.js → mailbox-turn-79Nv1JXv.js} +4153 -559
- package/dist/markers-CE0HMXWT.js +67 -0
- package/dist/{media-B0pZJ0bG.js → media-Cr9pGkzr.js} +701 -41
- package/dist/{message-Z5YKC-Af.js → message-BTox2Cmb.js} +25 -36
- package/dist/{model-input-BhPJYdSV.js → model-input-IRGa98V7.js} +3 -3
- package/dist/nitro.d.ts +8 -4
- package/dist/nitro.js +106 -24
- package/dist/{oauth-callback-server-ByvDdcdY.js → oauth-callback-server-NXK7AlBp.js} +2 -2
- package/dist/{oauth-relay-D-kK0yoN.js → oauth-relay-6NBPSpFE.js} +1 -1
- package/dist/{package-discovery-DD9vencX.js → package-discovery-BI6T_RkD.js} +50 -1
- package/dist/parent-result-Dg6P6roR.js +323 -0
- package/dist/people-Cegp1Iwq.js +81 -0
- package/dist/{plugins-Bkk0XRo2.js → plugins-BXMdNdyA.js} +1 -1
- package/dist/{conversation-privacy-BrMiDN61.js → proxy-path-Dc-0jXGi.js} +16 -2
- package/dist/{resolve-CWtBNSKP.js → resolve-BUFkmxkT.js} +229 -4
- package/dist/result-DfATzX77.js +337 -0
- package/dist/{runner-CsZ_VRxp.js → runner-CmKP3inb.js} +7 -8
- package/dist/{sandbox-egress-signals-FbCk1FkN.js → sandbox-egress-signals-DYo5BsM7.js} +1 -1
- package/dist/{schema-DojR2uCL.js → schema-DrBMdPmv.js} +197 -20
- package/dist/{service-account-CDYb9hfX.js → service-account-CxTX7nnR.js} +4 -5
- package/dist/{skills-B0jP4whm.js → skills-BlHUDj7k.js} +4 -4
- package/dist/{slack-conversation-unfurl-D26t9kBC.js → slack-conversation-unfurl-Dhe3lB1U.js} +6 -10
- package/dist/{spawn-BjljgExZ.js → spawn-CfvlFdfz.js} +8 -17
- package/dist/start-conversation-Uh8Sk1EF.js +162 -0
- package/dist/system-prompt-table-CDCYVwqN.js +1169 -0
- package/dist/{task-runner--Ke8KSMf.js → task-runner-DcdQJd9e.js} +163 -55
- package/dist/{thread-context-B8exINEe.js → thread-context-DF5uDcWN.js} +7 -9
- 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-um5Ubd4m.js +152 -0
- package/dist/user-customization-B27StpVQ.js +9 -0
- package/dist/{validation-Ce0qbMlT.js → validation-CJyuOPD2.js} +1 -1
- package/dist/{version-DFh4n9nr.js → version-Bhe7RPIe.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/virtual-module-BeKA_EII.js +12 -0
- package/dist/{worker-CDg9Lbpg.js → worker-D8PRgUqr.js} +3 -6
- 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/migration.sql +99 -0
- package/migrations/20261122204325_money_micro_usd_repair/snapshot.json +9 -0
- package/migrations/20261122204326_agent_config_backfill/migration.sql +34 -0
- package/migrations/20261122204326_agent_config_backfill/snapshot.json +143 -0
- package/migrations/20261122221456_inbox_item_deliveries/migration.sql +15 -0
- package/migrations/20261122221456_inbox_item_deliveries/snapshot.json +301 -0
- package/migrations/20261123155735_pg_trgm/migration.sql +2 -0
- package/migrations/20261123155735_pg_trgm/snapshot.json +9 -0
- package/migrations/20261123155739_search_indexes/migration.sql +4 -0
- package/migrations/20261123155739_search_indexes/snapshot.json +167 -0
- package/migrations/20261123172647_drop_legacy_archive_columns/migration.sql +4 -0
- package/migrations/20261123172647_drop_legacy_archive_columns/snapshot.json +9 -0
- package/migrations/20261123192506_memory_prefix_index/migration.sql +1 -0
- package/migrations/20261123192506_memory_prefix_index/snapshot.json +69 -0
- package/migrations/20261123201740_todo_search_indexes/migration.sql +2 -0
- package/migrations/20261123201740_todo_search_indexes/snapshot.json +89 -0
- package/migrations/20261123211505_todo_inbox_items/migration.sql +4 -0
- package/migrations/20261123211505_todo_inbox_items/snapshot.json +38 -0
- package/migrations/20261123214917_drop_code_urls/migration.sql +2 -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 +17 -25
- package/skills/design-automation-skill/SKILL.md +3 -4
- package/dist/actor-BsBdxDXQ.js +0 -208
- package/dist/adapter-CYAvJzZS.js +0 -259
- package/dist/adapter-context-CVsHoVSf.js +0 -43
- package/dist/agent-runner-B5y9MsT-.js +0 -11295
- package/dist/background-compaction-queue-iZXadLV3.js +0 -206
- package/dist/catalog-runtime-kkE3hvCX.js +0 -6
- package/dist/config-CWbwKj0j.js +0 -2331
- package/dist/db-DYGcXYl3.d.ts +0 -274
- package/dist/db-PwSRzWWn.js +0 -3607
- package/dist/executor-CgWyWfYz.js +0 -1858
- package/dist/fan-out-Cod-yEHG.js +0 -10
- package/dist/history-CYstOMKX.js +0 -577
- package/dist/ingest-B0AggUEC.js +0 -7931
- package/dist/install-2urLLXNt.js +0 -228
- package/dist/proxy-path-BHYoKZdq.js +0 -15
- package/dist/registry-POH4bZC4.js +0 -1686
- package/dist/request-deadline-BUiRYQYj.js +0 -24
- package/dist/rule-DAxQY-1h.js +0 -20
- package/dist/schema-DBf18QPS.d.ts +0 -9339
- package/dist/service-account-o15pZWcJ.js +0 -931
- package/dist/start-conversation-DbVujrwO.js +0 -755
- package/dist/state-BTawTCme.js +0 -161
- package/dist/statuses-BKwqCPhj.js +0 -69
- package/dist/store-CjXrp-Up.js +0 -492
- package/dist/task-queue-Cwlatjz3.js +0 -90
- package/dist/vercel-queue-q4z8w5QO.js +0 -349
- package/dist/warmup-D5hzqTcp.js +0 -12257
- 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/_journal.json +0 -1126
- /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
|
@@ -1,46 +1,34 @@
|
|
|
1
|
-
import { Aa as
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { E as withSpan, H as buildSentryConversationUrl, J as normalizeIdentityEmail, S as setTags, T as withLogContext, Y as toOptionalString, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-DNt-qOIO.js";
|
|
1
|
+
import { $ as getPlugins, $d as getStateValues, $i as getVercelConversationWorkQueue, $o as existingConversationId, A as resolveRootConversationId, Aa as createPluginCache, Ac as inboxItemPlugin, Af as botConfig, Ao as parseDashboardPersonLink, Ar as pluginCatalogRuntime, As as treeAwaitsAuthorization, B as normalizeSlackStatusText, Ba as getDispatchTurnId, Bs as dismissOpenInboxItems, Bt as canMoveToSpace, C as locationFromRow, Cd as isDmChannel, Co as getDashboardLinkFilter, Cr as createUserTokenStore, Cs as conversationStatusSql, Cu as juniorSpaces, Dc as inboxItemForUser, Df as parseSlackMessageTs, Dl as readConversationAccessRows, Ds as conversationKindFromRow, Du as juniorUsers, Ec as canUserReadInboxItem, El as readConversationAccessFromSql, Es as executionIsActive, F as SLACK_USER_MENTION_RE, Fa as createOrGetDispatch, Fc as isAutomationAlertItem, Ff as getSlackClientSecret, Fl as rootSpaceReadableBy, Fu as slackChannelMessageReplyThreadTs, G as applyPluginFormatMarkdown, Ga as markDispatchBlocked, Go as automationVersionOf, Gr as PluginMcpClient, Gt as isTopLevel, H as slackMentionedUserIds, Ha as isTerminalDispatchStatus, Hl as juniorTodos, Ho as admitEventAutomationRun, Ia as getDispatchConversationId, Ic as isInboxItemForEveryone, If as getSlackSigningSecret, Il as rootVisibleToViewer, Io as findMatchingEventAutomations, Iu as slackChannelMessageRunsAutomation, Ja as markDispatchRunning, Js as ownerConversationId, Ju as cancelSubscriptions, K as createPluginEventPublisher, Ka as markDispatchCompleted, Kf as normalizeSlackEmojiName, Kt as messagesNeedSpaceMembership, La as getDispatchIdForConversation, Lc as isOnlyAssignee, Ld as eventGuidance, Li as completeDecision, Ll as viewerMarksFromParticipant, M as conversationSlackTenantId, Ma as buildDispatchId, Ml as conversationIsNotUnsubscribedRoot, Mo as blockEventAutomation, Ms as AUTOMATION_ALERT_STEP_FIELD_ID, N as loadConversationSlackTenantIds, Na as claimDispatchMailboxAppend, Nc as inboxItemTodo, Nd as updateTimerIndex, Nf as getSlackBotToken, Nl as conversationPinnedForUser, No as collectEventAutomationMatchKeys, Oc as inboxItemNeedsInput, Od as streamPrivateSlackFile, Ol as readPrivateSpaceMemberships, Oo as isDashboardLink, Os as awaitsAuthorizationFrom, Ou as juniorDestinations, P as parseSessionSource, Pa as confirmDispatchMailboxAppend, Pd as CORE_EVENT_NAMESPACE, Pf as getSlackClientId, Pl as readMemberParticipants, Ps as fallbackShortTitle, Qd as getStateAdapter, Qi as createPluginInboxItems, Qr as getMcpStoredOAuthCredentials, Ra as getDispatchInputMessageId, Rc as isPluginInboxItem, Rs as closeInboxItem, S as withConversationMutationLock, Sc as canActOnInboxItem, Si as createPluginEmbedder, Sl as canAddConversationMessages, Ss as conversationIsActiveSql, Td as normalizeSlackConversationId, Tl as createConversationAccessReader, To as getDashboardPersonLink, Ts as conversationWaitsOnUserSql, U as wrapBareSlackUserIds, Uo as eventAutomationRunLimitReason, Us as inboxItemNeedsUserNow, V as slackMention, Va as getPluginDispatchProjection, Vs as getInboxItem, Vt as deliversFinalText, Wa as markDispatchAwaitingResume, Wi as JUNIOR_NATIVE_EVENT_NAMESPACE, Wr as McpAuthorizationRequiredError, Xa as addReactionToMessage, Xi as createPluginConversationChanges, Xs as takeInboxItem, Xu as collectEventMatchKeys, Ya as notifyAutomationBlocked, Yf as resolveGatewayModel, Yl as juniorInboxItemConversations, Yt as turnBehavior, Zi as PLUGIN_CHOICE_FIELD_ID, Zl as juniorInboxItems, _ as readConversationTrees, _d as SlackActionError, _f as requireSlackDestination, a as getDb, au as juniorConversationParticipants, bd as getHeaderString, bl as readCachedUserByEmail, bn as getTurnRequestDeadline, bo as getDashboardConversationLink, bu as juniorConversations, cd as bindScheduledAutomationCredentialSubject, cf as createSlackResumeActor, cl as userAvatarUrlsFromIdentities, cp as estimateTextTokens, cs as recordAutomationExecution, da as listConversationAnnotationsById, dc as settleInboxSnoozes, dd as verifyScheduledAutomationCredentialSubject, df as parseActorUserId, dl as resolveActorIdentityId, ed as findMatchingWatches, ef as setStateValues, en as indexEndedTurnEvents, ep as createCache, eu as juniorAutomations, f as copyMessageLinks, fd as verifySlackDirectCredentialSubject, fl as saveActorAvatar, fs as agentTurnUsageSchema, fu as juniorConversationAnnotations, ga as lookupSlackUserNames, gc as nextDetailVersion, h as conversationAncestors, ha as lookupSlackUser, hf as createSlackDestination, hu as juniorCodeChanges, i as getConversationStore, ic as SNOOZE_TIMER_EVENT_TYPE, il as identityAvatarUrl, jf as getChatConfig, jl as conversationIsMemberRoot, js as AUTOMATION_ALERT_STEPS, ju as getEventCatalog, kc as inboxItemOwnedByConversation, kd as withSlackRetries, ki as conversationSearchVector, kn as createPluginState, ko as parseDashboardConversationLink, ks as hasUnexpiredAuthorizationRequest, la as createPluginAnnotations, lc as listFiringInboxSnoozeTriggers, ld as bindSlackDirectCredentialSubject, lf as isActorUserId, ll as userAvatarUrlsFromJoinedPhotos, ln as storedMessageJson, lp as textCharsForTokens, m as withConversationEventLock, md as readJuniorSecret, mf as truncateStatusText, ms as conversationCostOf, n as getConversationEventStore, nf as credentialContextForActor, np as acquireActiveLock, nr as resolveBaseUrl, o as getSqlExecutor, of as createActor, pn as createPluginTaskStarter, ps as hasAgentTurnUsage, qa as markDispatchFailed, qs as listReplyActionItems, qt as postsRunNotices, rd as listConversationsWithWatches, ri as webActorUserIds, rl as hasUserPhoto, ro as removeReactionFromMessage, sd as bindEventAutomationCredentialSubject, sf as createSlackActor, ss as readAutomationTitlesByConversationId, tf as actorLogContext, tu as juniorAutomationRuns, ua as listConversationAnnotations, ud as verifyEventAutomationCredentialSubject, uf as isUserActor, us as addAgentTurnUsage, uu as juniorConversationEvents, v as setArchivedAt, vc as PLUGIN_INBOX_ITEM_KEY_PREFIX, vd as downloadPrivateSlackFile, vn as sendVercelPluginTask, vu as juniorAttachments, wa as basePluginContext, wc as canAnswerInboxItem, wd as isSlackRequestTimeout, wl as conversationAccessFromRows, wn as createPluginConversationWatches, ws as conversationTurnFailedSql, wu as juniorIdentities, xc as TODO_INBOX_ITEM_KEY_PREFIX, xd as getSlackClient, xf as parseSlackTeamId, xn as createPluginCodeChanges, xp as isProviderRetryError, y as lastMessageAtSql, yf as parseSlackChannelId, yu as juniorMessageAttachments, za as getDispatchRecord, zi as completeText, zn as isPostgresErrorCode } from "./db-DXTOYRzR.js";
|
|
2
|
+
import { G as mapBounded, I as createPluginLogger, _ as trimTrailingAssistantMessages } from "./transcript-BHhJVY0P.js";
|
|
3
|
+
import { D as buildSentryConversationUrl, E as withSpan, N as normalizeIdentityEmail, P as toOptionalString, S as setTags, T as withLogContext, b as setSpanAttributes, f as logError, h as logWarn, m as logInfo, n as createChatSdkLogger, o as getActiveTraceContext, p as logException, s as getActiveTraceId, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-czs0nqLC.js";
|
|
5
4
|
import { h as startSpan, n as captureMessage } from "./sentry-CPbZjomA.js";
|
|
6
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
7
|
-
import {
|
|
8
|
-
import { $ as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { f as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { i as webActorUserIds } from "./state-BTawTCme.js";
|
|
17
|
-
import { $t as abandonTurnRecord, Ct as recordDeliveredAssistantMessage, Et as upsertConversationMessage, G as buildDeterministicAssistantMessageId, Ht as AuthorizationFlowDisabledError, In as finalizeFailedTurnReplyWithEvent, J as commitMessages, K as buildDeterministicTurnId, Kt as clearPendingAuth, Ln as getAgentTurnDiagnosticsAttributes, Lt as createPluginEgress, M as getConversation, Mn as buildTurnErrorResponse, Mt as isEventConversationMessage, N as getConversationWorkState, Q as loadTurnProjection, Qt as saveTurnCheckpoint, Rn as requireTurnFailureEventId, Rt as PluginCredentialFailureError, St as normalizeConversationText, Tn as loadTurnStart, Tt as turnHasReply, X as loadConversationProjection, Xt as lostWorkerBeforeFirstSave, Yt as loadTurnCheckpoint, Zt as pauseLostWorkerTurn, _ as appendAndEnqueueInboundMessage, _t as estimateConversationMessagesTokens, an as recordTurnSummary, b as cancelHumanFacingPendingMessages, bn as canShareTurn, bt as latestConversationMessageSeq, c as notInheritedByForkChild, d as getPersistedThreadState, dr as persistWithRetry, dt as persistConversationMessageWindow, en as completeTurnRecord, f as persistThreadRuntimeState, fr as configValueSchema, ft as persistConversationMessages, gt as buildConversationContext, i as resolveTurnResumeRouting, in as listTurnSummaries, kt as EVENT_SYSTEM_ACTOR, l as getLocationConfigurationService, m as coerceThreadConversationState, mr as piMessageFromHistoryItem, mt as resolveConversationTitle, n as savedTurnMessages, nt as recordAuthorizationCompleted, p as persistThreadStateById, q as commitAcceptedReply, r as resolveConversationRouting, rn as getTurnRecord, st as recordSubscribedReplyRoute, tn as failTurnRecord, tr as getAssistantReplyText, u as getPersistedSandboxState, ut as hydrateConversationMessages, vt as getConversationMessageSlackTs, wn as getTurnLifecycle, wt as trimConversationMessages, xt as markConversationMessage, yn as canJoinTurn, yt as isHumanConversationMessage } from "./turn-membership-DTR3SaKD.js";
|
|
18
|
-
import { $ as conversationReportStatusSchema, Tt as MAX_ATTACHMENT_BYTES, Zt as answeredChoices, en as isEmptyUserInputAnswer, ft as conversationTreeStateSchema, i as isVisionImageMediaType, kt as readMessageAttachments, ot as activityPreviewText, r as detectImageMediaType, sn as automationTaskText, tn as normalizeUserInputAnswer, tt as conversationSurfaceSchema } from "./media-B0pZJ0bG.js";
|
|
19
|
-
import { f as readJuniorSecret, t as getVercelConversationWorkQueue } from "./vercel-queue-q4z8w5QO.js";
|
|
20
|
-
import { $t as markTurnCompleted, Bt as getTurnUserMessage, D as resolveSlackReplyTarget, E as stopAtAutomatedTurnLimit, Et as eventAuthorText, F as createChildConversationWorker, Fn as conversationSubtree, Gt as CooperativeTurnYieldError, Ht as getTurnUserReplyAttachmentContext, I as createDeliverToParent, In as conversationSubtreeColumns, It as resumeForPersonInput, Jt as getConversationTurnBoundaryError, Kt as TurnInputCommitLostError, M as stopConversation, Nt as resolveBotSlackTeamId, O as sendSlackReply, P as stopChildAgentsOf, Qt as markTurnClosed, R as enqueueAgentInvocationResult, Rn as isExperimentalFeatureEnabled, S as recordFailedDispatchTurn, T as getTurnAuthorization, Ut as getTurnUserSlackMessageTs, V as withAgentInvocationResultActors, Wt as ConversationTurnBoundaryError, Xt as isTurnInputCommitLostError, Yt as isCooperativeTurnYieldError, Zt as isTurnInputDeferredError, _n as renderTaskInput, b as createPausedTurns, c as resolveMailboxTurnWork, d as legacyWebMailboxMetadataSchema, dn as instructionActorFor, en as markTurnFailed, gt as recordFinishedTurnForAutomatedLimit, hn as withoutSavedSteeringMessages, in as getWebAuthorization, it as getChildAgentLabel, jt as resolveEventAuthor, on as loadInboxItemInput, qt as TurnInputDeferredError, sn as savedInputInstruction, t as ingestEvent, tn as startActiveTurn, un as buildSteeringPiMessage, vt as AgentRunError, x as getPausedTurnRequest, y as supersedeTurnForInput, yt as executeTurn } from "./ingest-B0AggUEC.js";
|
|
21
|
-
import { Ar as gapSegment, At as parseSlackMessageReference, Bt as readSlackRawMessageContext, Ct as setConversationSubscription, Er as MINUTE_MS, Et as throwApiError, Fn as readConversationSourceTask, Jn as findAutomationSkill, Kn as AutomationEditError, Mn as takeViewerAutomationAlertStep, Or as NO_REPLY_GAP_MS, Ot as renderAttachmentText, Pn as ViewerTaskNotFoundError, Tt as jsonResponse, Vt as resolveSlackChannelIdFromMessage, Xn as effectiveTaskOutcomes, Yn as missingAutomationSkillReason, br as connectedState, ct as archiveConversation, i as GLOBAL_GAPS_TTL_MS, ir as historyPeriodSavings, kt as renderBlockText, l as isConversationWorkDone, lr as replaceHistorySavings, lt as conversationReadPositionQuery, mt as deliverInboxItemChange, n as CONVERSATION_STATE_TTL_MS, nr as addHistoryWarmupCost, o as segmentGapsKey, r as GLOBAL_GAPS_MAX, rr as firstLiveSavingsDate, st as readLastUserMessageAtByConversation, t as ANSWER_TOOL_ENDINGS, tr as addHistoryPeriod, u as listConversationWork, xr as providerCacheTtlMs, zt as parseSlackThreadId } from "./warmup-D5hzqTcp.js";
|
|
22
|
-
import { C as recordSlackAttachment, _ as verifyAttachmentUploads, d as recordWebConversationActivity, f as webActorFromUser, l as createAndEnqueueConversation, m as AttachmentUploadError, o as acceptsWebMessages, s as appendAndEnqueueWebMessage, u as createConversationId, w as slackAttachmentsVersionQuery, x as readAttachmentVisionSummary, y as getSlackFileId } from "./start-conversation-DbVujrwO.js";
|
|
23
|
-
import { a as isConversationMember, i as getConversationInfo, l as listThreadReplies, o as isPublicSlackChannel, r as getChannelMessage } from "./channel-access-mt7K6dPh.js";
|
|
24
|
-
import { r as isFileAttachment, s as storeAttachment } from "./store-CjXrp-Up.js";
|
|
25
|
-
import { f as OPEN_TODO_STATUSES } from "./statuses-BKwqCPhj.js";
|
|
26
|
-
import { t as getTurnRequestDeadline } from "./request-deadline-BUiRYQYj.js";
|
|
5
|
+
import { t as JUNIOR_VERSION } from "./version-Bhe7RPIe.js";
|
|
6
|
+
import { Cn as isEmptyUserInputAnswer, Fn as automationTaskText, Ht as MAX_ATTACHMENT_BYTES, Kt as readMessageAttachments, Nt as conversationTreeStateSchema, Q as conversationReportStatusSchema, bn as answeredChoices, bt as instructionProvenanceFor, ct as KNOWN_CONVERSATION_EVENT_TYPES, et as conversationSurfaceSchema, i as isVisionImageMediaType, nt as activityPreviewText, r as detectImageMediaType, un as OPEN_TODO_STATUSES, vt as contextProvenance, wn as normalizeUserInputAnswer } from "./media-Cr9pGkzr.js";
|
|
7
|
+
import { $i as persistWithRetry, $r as saveTurnCheckpoint, Cr as latestConversationMessageSeq, D as notInheritedByForkChild, Dr as trimConversationMessages, Ei as loadTurnStart, Er as recordDeliveredAssistantMessage, Ft as renderTaskInput, Gt as pushInboxSnoozeWakes, H as resolveEventAuthor, Ii as finalizeFailedTurnReplyWithEvent, In as isExperimentalFeatureEnabled, L as eventAuthorText, Li as getAgentTurnDiagnosticsAttributes, Mi as buildTurnErrorResponse, Mn as buildDeterministicTurnId, Nn as conversationSubtree, Nr as isEventConversationMessage, Nt as withoutSavedSteeringMessages, Or as turnHasReply, Ot as buildSteeringPiMessage, Pn as conversationSubtreeColumns, Q as getTurnUserMessage, Qn as commitMessages, Qr as pauseLostWorkerTurn, Qt as cancelHumanFacingPendingMessages, Ri as requireTurnFailureEventId, Rr as createPluginEgress, Sr as isHumanConversationMessage, St as getWebAuthorization, Ti as getTurnLifecycle, Tr as normalizeConversationText, Tt as savedInputInstruction, Ur as AuthorizationFlowDisabledError, Ut as setTodoStatusByUser, W as resolveBotSlackTeamId, Xr as loadTurnCheckpoint, Xt as appendAndEnqueueInboundMessage, Zn as commitAcceptedReply, Zr as lostWorkerBeforeFirstSave, _r as resolveConversationTitle, _t as persistThreadRuntimeState, a as resolveMailboxTurnWork, aa as configValueSchema, ai as recordTurnSummary, at as TurnInputDeferredError, bi as canShareTurn, br as estimateConversationMessagesTokens, c as legacyWebMailboxMetadataSchema, ct as isTurnInputCommitLostError, dn as getConversationWorkState, dr as recordSubscribedReplyRoute, dt as markTurnCompleted, ei as abandonTurnRecord, er as loadConversationProjection, et as getTurnUserReplyAttachmentContext, ft as markTurnFailed, gr as persistConversationMessages, gt as getPersistedThreadState, hr as persistConversationMessageWindow, ht as getPersistedSandboxState, ii as listTurnSummaries, it as TurnInputCommitLostError, jn as buildDeterministicAssistantMessageId, jr as EVENT_SYSTEM_ACTOR, kr as upsertConversationMessage, kt as instructionActorFor, lt as isTurnInputDeferredError, mr as hydrateConversationMessages, mt as getLocationConfigurationService, ni as failTurnRecord, nr as loadTurnProjection, nt as ConversationTurnBoundaryError, or as recordAuthorizationCompleted, ot as getConversationTurnBoundaryError, pt as startActiveTurn, q as resumeForPersonInput, qr as clearPendingAuth, ri as getTurnRecord, rt as CooperativeTurnYieldError, st as isCooperativeTurnYieldError, ta as piMessageFromHistoryItem, ti as completeTurnRecord, tt as getTurnUserSlackMessageTs, un as getConversation, ut as markTurnClosed, vt as persistThreadStateById, wr as markConversationMessage, wt as loadInboxItemInput, xr as getConversationMessageSlackTs, yi as canJoinTurn, yr as buildConversationContext, yt as coerceThreadConversationState, zr as PluginCredentialFailureError } from "./mailbox-turn-79Nv1JXv.js";
|
|
8
|
+
import { o as ingestEvent } from "./job-runner-CySgpi9v.js";
|
|
9
|
+
import { $t as addHistoryWarmupCost, At as resolveSlackChannelIdFromMessage, B as ANSWER_TOOL_ENDINGS, C as resolveSlackReplyTarget, Ct as jsonResponse, Dt as parseSlackMessageReference, Et as renderBlockText, Ft as takeViewerAutomationAlertStep, G as isConversationWorkDone, H as GLOBAL_GAPS_MAX, Jt as missingAutomationSkillReason, K as listConversationWork, Kt as AutomationEditError, L as RetryableDeliveryError, Lt as ViewerTaskNotFoundError, O as canPauseConversationDelivery, Ot as parseSlackThreadId, Qt as addHistoryPeriod, Tt as renderAttachmentText, U as GLOBAL_GAPS_TTL_MS, V as CONVERSATION_STATE_TTL_MS, W as segmentGapsKey, Yt as effectiveTaskOutcomes, a as getMcpOAuthCallbackPath, cn as connectedState, dn as MINUTE_MS, dt as archiveConversation, en as firstLiveSavingsDate, ft as conversationReadPositionQuery, hn as resolveConversationConfiguration, ht as deliverInboxItemChange, it as stopChildAgentsOf, kt as readSlackRawMessageContext, l as latestProgressStatus, ln as providerCacheTtlMs, mn as gapSegment, n as executeAgentRun, nn as replaceHistorySavings, o as createClientMetadata, p as createInboxItemShow, pn as NO_REPLY_GAP_MS, pt as markConversationRead, qt as findAutomationSkill, r as buildAuthPauseResponse, s as readMcpClientInformation, t as createAgentRunner, tn as historyPeriodSavings, u as resolveDestinationVisibility, ut as readLastUserMessageAtByConversation, w as sendSlackReply, wt as throwApiError, x as safeLinkUrl, xt as setConversationSubscription, yt as inviteMentionedPeople, z as shouldEmitDevAgentTrace, zt as readConversationSourceTask } from "./agent-runner-C7GNLRB6.js";
|
|
10
|
+
import { p as getAssistantReplyText } from "./system-prompt-table-CDCYVwqN.js";
|
|
11
|
+
import { D as readSpace, P as storeAttachment, _ as AttachmentUploadError, b as verifyAttachmentUploads, f as createAndEnqueueConversation, h as webActorFromUser, i as savedTurnMessages, j as isFileAttachment, l as acceptsWebMessages, m as recordWebConversationActivity, n as resolveTurnResumeRouting, p as createConversationId, t as resolveConversationRouting, u as appendAndEnqueueWebMessage } from "./turn-session-routing-GtetHsdO.js";
|
|
12
|
+
import { a as getChannelMessage, c as isPublicSlackChannel, d as listThreadReplies, o as getConversationInfo, s as isConversationMember, t as runWithSlackInstallation } from "./adapter-context-BlSGE44V.js";
|
|
13
|
+
import { a as readAttachmentVisionSummary, c as slackAttachmentsVersionQuery, r as getSlackFileId, s as recordSlackAttachment } from "./start-conversation-Uh8Sk1EF.js";
|
|
14
|
+
import { i as getChildAgentLabel } from "./parent-result-Dg6P6roR.js";
|
|
27
15
|
import { t as webMessageId } from "./web-message-id-C6P83ans.js";
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import { t as bindMessageAgent } from "./message-
|
|
33
|
-
import { t as readConversationLineage } from "./lineage-
|
|
34
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
35
|
-
import { a as buildDeliveredTurnStatePatch, i as persistAuthPauseTurnState, n as loadThreadContextTrimFloor, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import { r as canContinueInSlack } from "./continue-in-slack-
|
|
16
|
+
import { C as cancelConversationPendingMessagesResponseSchema, E as conversationPendingMessageDeliverySchema, G as personObjectCard, K as webPageObjectCard, M as healthReportSchema, S as cancelConversationPendingMessagesBodySchema, U as conversationObjectCard, W as messageObjectCard, b as archiveDoneConversationsResponseSchema, c as setConversationSpaceBodySchema, f as renameConversationBodySchema, h as pinConversationResponseSchema, l as setConversationSpaceResponseSchema, m as pinConversationBodySchema, o as conversationSubscriptionBodySchema, p as renameConversationResponseSchema, r as stopConversationTurnResponseSchema, s as conversationSubscriptionResponseSchema, v as archiveConversationBodySchema, x as conversationAutoArchiveSchema, y as archiveConversationResponseSchema } from "./conversation-feed-Sl8lKKmR.js";
|
|
17
|
+
import { a as stopConversation, c as executeTurn, d as withTurnSpan, i as stopAtAutomatedTurnLimit, l as getTurnInputSpanAttributes, n as createConversationTurnWorker, o as recordFinishedTurnForAutomatedLimit, r as supersedeTurnForInput, s as AgentRunError, u as turnInputTelemetry } from "./conversation-turn-BoLK9i6g.js";
|
|
18
|
+
import { n as attachmentFactLines, r as buildStoredAttachmentPromptText } from "./model-input-IRGa98V7.js";
|
|
19
|
+
import { s as withAgentInvocationResultActors, t as createChildConversationWorker } from "./result-DfATzX77.js";
|
|
20
|
+
import { t as bindMessageAgent } from "./message-BTox2Cmb.js";
|
|
21
|
+
import { t as readConversationLineage } from "./lineage-tRTOcrsL.js";
|
|
22
|
+
import { t as bindSpawnAgent } from "./spawn-CfvlFdfz.js";
|
|
23
|
+
import { a as buildDeliveredTurnStatePatch, i as persistAuthPauseTurnState, n as loadThreadContextTrimFloor, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-DF5uDcWN.js";
|
|
24
|
+
import { d as readConversationEventPageAround, l as readConversationEventPage, n as scheduleSessionCompletedPluginTasks, u as readConversationEventPageAfter } from "./task-runner-DcdQJd9e.js";
|
|
25
|
+
import { n as getPausedTurnRequest, o as getTurnAuthorization, r as recordFailedDispatchTurn, t as createPausedTurns } from "./turn-wake-um5Ubd4m.js";
|
|
26
|
+
import { r as canContinueInSlack } from "./continue-in-slack-BGKjIdFp.js";
|
|
39
27
|
import * as z from "zod";
|
|
40
28
|
import pLimit from "p-limit";
|
|
41
29
|
import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
|
|
42
30
|
import { EVENT_SUMMARY_MAX_LENGTH, EVENT_TEXT_MAX_LENGTH, conversationSidebarAnnotationSchema, createSlackSource, dispatchOptionsSchema, encodeObjectImageRef, escapeTagText, escapeTagTextAndQuotes, eventMatches, eventSchema, isSlackDestination, objectAnnotationSchema, objectLinkFilterMatches, objectLinkFilterSpecificity, objectTypeSchema, ownedObjectAnnotationSchema, renderEmptyTag, renderTag } from "@sentry/junior-plugin-api";
|
|
43
|
-
import { and, asc, count, desc, eq, exists, gt, gte, inArray, isNotNull, isNull, lt, lte, min, ne, not, or, sql } from "drizzle-orm";
|
|
31
|
+
import { and, asc, count, desc, eq, exists, gt, gte, inArray, isNotNull, isNull, like, lt, lte, min, ne, not, or, sql } from "drizzle-orm";
|
|
44
32
|
import { alias } from "drizzle-orm/pg-core";
|
|
45
33
|
import { Message, ThreadImpl, stringifyMarkdown } from "chat";
|
|
46
34
|
import net from "node:net";
|
|
@@ -554,6 +542,7 @@ function conversationSummaryFromStoredConversation(args) {
|
|
|
554
542
|
...conversation.parentConversationId ? { parentConversationId: conversation.parentConversationId } : void 0,
|
|
555
543
|
isParticipant: args.access?.isParticipant ?? false,
|
|
556
544
|
...visibility ? { visibility } : void 0,
|
|
545
|
+
...args.space !== void 0 ? { space: args.space } : void 0,
|
|
557
546
|
lastProgressAt: new Date(conversation.execution.updatedAtMs ?? conversation.updatedAtMs).toISOString(),
|
|
558
547
|
lastSeenAt: new Date(conversation.lastActivityAtMs).toISOString(),
|
|
559
548
|
startedAt: new Date(conversation.createdAtMs).toISOString(),
|
|
@@ -632,6 +621,7 @@ function conversationFromRecordRow(row) {
|
|
|
632
621
|
...value.executionUpdatedAt ? { updatedAtMs: value.executionUpdatedAt.getTime() } : void 0
|
|
633
622
|
},
|
|
634
623
|
...value.parentConversationId ? { parentConversationId: value.parentConversationId } : void 0,
|
|
624
|
+
...value.spaceId ? { spaceId: value.spaceId } : void 0,
|
|
635
625
|
...value.archivedAt ? { archivedAtMs: value.archivedAt.getTime() } : void 0,
|
|
636
626
|
...actor ? { actor } : void 0,
|
|
637
627
|
...location ? { location } : void 0,
|
|
@@ -1848,6 +1838,7 @@ function createSlackTurnRuntime(deps) {
|
|
|
1848
1838
|
const skippedSteeringMessages = [];
|
|
1849
1839
|
let completed = false;
|
|
1850
1840
|
let acked = false;
|
|
1841
|
+
let failedTurnEnded = false;
|
|
1851
1842
|
const onTurnCompleted = async () => {
|
|
1852
1843
|
completed = true;
|
|
1853
1844
|
await flushSkippedSteeringMessagesBestEffort({
|
|
@@ -1944,6 +1935,7 @@ function createSlackTurnRuntime(deps) {
|
|
|
1944
1935
|
const classifiedFailure = getConversationTurnBoundaryError(error);
|
|
1945
1936
|
const failureCause = classifiedFailure?.cause ?? error;
|
|
1946
1937
|
if (shouldRethrowTurnControlError(failureCause)) throw failureCause;
|
|
1938
|
+
failedTurnEnded = true;
|
|
1947
1939
|
if (failureCause instanceof AuthorizationFlowDisabledError) return;
|
|
1948
1940
|
const failureCode = classifiedFailure?.failureCode ?? "agent_run_failed";
|
|
1949
1941
|
if (failureCause instanceof SlackActionError && failureCause.code === "read_only_channel") {
|
|
@@ -1953,7 +1945,10 @@ function createSlackTurnRuntime(deps) {
|
|
|
1953
1945
|
return;
|
|
1954
1946
|
}
|
|
1955
1947
|
const eventId = classifiedFailure?.eventId ?? withLogContext(failureLogContext, () => logException(failureCause, "mention.handler.failed"));
|
|
1956
|
-
if (!acked && hooks.isFinalAttempt === false)
|
|
1948
|
+
if (!acked && hooks.isFinalAttempt === false) {
|
|
1949
|
+
failedTurnEnded = false;
|
|
1950
|
+
return;
|
|
1951
|
+
}
|
|
1957
1952
|
if (!eventId) throw new Error("Sentry did not return an event ID for mention.handler.failed", { cause: error });
|
|
1958
1953
|
let lifecycleError;
|
|
1959
1954
|
try {
|
|
@@ -1993,6 +1988,10 @@ function createSlackTurnRuntime(deps) {
|
|
|
1993
1988
|
});
|
|
1994
1989
|
await processingReactions.stopAll();
|
|
1995
1990
|
}
|
|
1991
|
+
if (failedTurnEnded) await indexEndedTurnEvents({
|
|
1992
|
+
conversationId,
|
|
1993
|
+
turnId: buildDeterministicTurnId(message.id)
|
|
1994
|
+
});
|
|
1996
1995
|
}
|
|
1997
1996
|
},
|
|
1998
1997
|
async handleSubscribedMessage(thread, message, hooks) {
|
|
@@ -2002,6 +2001,7 @@ function createSlackTurnRuntime(deps) {
|
|
|
2002
2001
|
const skippedSteeringMessages = [];
|
|
2003
2002
|
let completed = false;
|
|
2004
2003
|
let acked = false;
|
|
2004
|
+
let failedTurnEnded = false;
|
|
2005
2005
|
const onTurnCompleted = async () => {
|
|
2006
2006
|
completed = true;
|
|
2007
2007
|
await flushSkippedSteeringMessagesBestEffort({
|
|
@@ -2244,6 +2244,7 @@ function createSlackTurnRuntime(deps) {
|
|
|
2244
2244
|
const classifiedFailure = getConversationTurnBoundaryError(error);
|
|
2245
2245
|
const failureCause = classifiedFailure?.cause ?? error;
|
|
2246
2246
|
if (shouldRethrowTurnControlError(failureCause)) throw failureCause;
|
|
2247
|
+
failedTurnEnded = true;
|
|
2247
2248
|
if (failureCause instanceof AuthorizationFlowDisabledError) return;
|
|
2248
2249
|
const failureCode = classifiedFailure?.failureCode ?? "agent_run_failed";
|
|
2249
2250
|
if (failureCause instanceof SlackActionError && failureCause.code === "read_only_channel") {
|
|
@@ -2253,7 +2254,10 @@ function createSlackTurnRuntime(deps) {
|
|
|
2253
2254
|
return;
|
|
2254
2255
|
}
|
|
2255
2256
|
const eventId = classifiedFailure?.eventId ?? withLogContext(failureLogContext, () => logException(failureCause, "subscribed_message.handler.failed"));
|
|
2256
|
-
if (!acked && hooks.isFinalAttempt === false)
|
|
2257
|
+
if (!acked && hooks.isFinalAttempt === false) {
|
|
2258
|
+
failedTurnEnded = false;
|
|
2259
|
+
return;
|
|
2260
|
+
}
|
|
2257
2261
|
if (!eventId) throw new Error("Sentry did not return an event ID for subscribed_message.handler.failed", { cause: error });
|
|
2258
2262
|
let lifecycleError;
|
|
2259
2263
|
try {
|
|
@@ -2293,6 +2297,10 @@ function createSlackTurnRuntime(deps) {
|
|
|
2293
2297
|
});
|
|
2294
2298
|
await processingReactions.stopAll();
|
|
2295
2299
|
}
|
|
2300
|
+
if (failedTurnEnded) await indexEndedTurnEvents({
|
|
2301
|
+
conversationId,
|
|
2302
|
+
turnId: buildDeterministicTurnId(message.id)
|
|
2303
|
+
});
|
|
2296
2304
|
}
|
|
2297
2305
|
},
|
|
2298
2306
|
async handleAssistantThreadStarted(event) {
|
|
@@ -4211,13 +4219,19 @@ function createSlackTurn(deps) {
|
|
|
4211
4219
|
sessionId: turnId
|
|
4212
4220
|
});
|
|
4213
4221
|
await persistThreadStateById(conversationId, { conversation: preparedState.conversation });
|
|
4214
|
-
if (conversationId)
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4222
|
+
if (conversationId) {
|
|
4223
|
+
await turnLifecycle.fail({
|
|
4224
|
+
conversationId,
|
|
4225
|
+
createdAtMs: Date.now(),
|
|
4226
|
+
...authFailureEventId ? { eventId: authFailureEventId } : void 0,
|
|
4227
|
+
failureCode: "agent_run_failed",
|
|
4228
|
+
turnId
|
|
4229
|
+
});
|
|
4230
|
+
await indexEndedTurnEvents({
|
|
4231
|
+
conversationId,
|
|
4232
|
+
turnId
|
|
4233
|
+
});
|
|
4234
|
+
}
|
|
4221
4235
|
runState = "released";
|
|
4222
4236
|
return;
|
|
4223
4237
|
}
|
|
@@ -4266,6 +4280,10 @@ function createSlackTurn(deps) {
|
|
|
4266
4280
|
} catch (error) {
|
|
4267
4281
|
logException(error, "plugin.session.completed_task_schedule.failed");
|
|
4268
4282
|
}
|
|
4283
|
+
else if (conversationId) await indexEndedTurnEvents({
|
|
4284
|
+
conversationId,
|
|
4285
|
+
turnId
|
|
4286
|
+
});
|
|
4269
4287
|
} catch (error) {
|
|
4270
4288
|
if (runState === "settled") {
|
|
4271
4289
|
logException(error, "slack.reply.post_delivery_commit.failed", messageTs ? { "messaging.message.id": messageTs } : {});
|
|
@@ -4313,6 +4331,10 @@ function createSlackTurn(deps) {
|
|
|
4313
4331
|
outcome: "cancelled",
|
|
4314
4332
|
turnId
|
|
4315
4333
|
});
|
|
4334
|
+
await indexEndedTurnEvents({
|
|
4335
|
+
conversationId,
|
|
4336
|
+
turnId
|
|
4337
|
+
});
|
|
4316
4338
|
return;
|
|
4317
4339
|
}
|
|
4318
4340
|
const classifiedFailure = getConversationTurnBoundaryError(runFailure);
|
|
@@ -4842,11 +4864,19 @@ function createAgentDispatchConversationWorker(options) {
|
|
|
4842
4864
|
const blockingError = getDispatchBlockingError(error);
|
|
4843
4865
|
if (blockingError) {
|
|
4844
4866
|
await persistBlockedDispatchTurn(dispatch, blockingError);
|
|
4867
|
+
await indexEndedTurnEvents({
|
|
4868
|
+
conversationId: context.conversationId,
|
|
4869
|
+
turnId: getDispatchTurnId(dispatch.id)
|
|
4870
|
+
});
|
|
4845
4871
|
await acknowledge();
|
|
4846
4872
|
return { status: "completed" };
|
|
4847
4873
|
}
|
|
4848
4874
|
if (!context.attempt.isFinalAttempt) throw error;
|
|
4849
4875
|
await markDispatchFailed(dispatch.id, error instanceof Error ? error.message : "Dispatch turn failed");
|
|
4876
|
+
await indexEndedTurnEvents({
|
|
4877
|
+
conversationId: context.conversationId,
|
|
4878
|
+
turnId: getDispatchTurnId(dispatch.id)
|
|
4879
|
+
});
|
|
4850
4880
|
await acknowledge();
|
|
4851
4881
|
return { status: "completed" };
|
|
4852
4882
|
}
|
|
@@ -5671,6 +5701,16 @@ function getResumeLogContext(args) {
|
|
|
5671
5701
|
};
|
|
5672
5702
|
}
|
|
5673
5703
|
async function handleResumeFailure(args) {
|
|
5704
|
+
try {
|
|
5705
|
+
await failResumedTurn(args);
|
|
5706
|
+
} finally {
|
|
5707
|
+
await indexEndedTurnEvents({
|
|
5708
|
+
conversationId: args.resume.conversationId,
|
|
5709
|
+
turnId: args.resume.turnId
|
|
5710
|
+
});
|
|
5711
|
+
}
|
|
5712
|
+
}
|
|
5713
|
+
async function failResumedTurn(args) {
|
|
5674
5714
|
const turnLifecycle = getTurnLifecycle();
|
|
5675
5715
|
const capturedEventId = logException(args.error, args.eventName);
|
|
5676
5716
|
const eventId = requireTurnFailureEventId(capturedEventId, args.eventName);
|
|
@@ -5727,6 +5767,10 @@ async function completeStoppedResume(resume) {
|
|
|
5727
5767
|
outcome: "cancelled",
|
|
5728
5768
|
turnId: resume.turnId
|
|
5729
5769
|
});
|
|
5770
|
+
await indexEndedTurnEvents({
|
|
5771
|
+
conversationId: resume.conversationId,
|
|
5772
|
+
turnId: resume.turnId
|
|
5773
|
+
});
|
|
5730
5774
|
}
|
|
5731
5775
|
function buildResumedRun(args, statusSession, delivery) {
|
|
5732
5776
|
const savedRun = args.run;
|
|
@@ -5861,10 +5905,11 @@ async function resumeSlackTurnInContext(args) {
|
|
|
5861
5905
|
failureCode = "delivery_failed";
|
|
5862
5906
|
const cards = await loadPendingMessageCards(conversationId);
|
|
5863
5907
|
const deliveryState = await getDeliveryConversation();
|
|
5864
|
-
const configuration = {
|
|
5865
|
-
|
|
5866
|
-
|
|
5867
|
-
|
|
5908
|
+
const configuration = await resolveConversationConfiguration({
|
|
5909
|
+
configuration: savedRun.environment?.configuration,
|
|
5910
|
+
conversationId,
|
|
5911
|
+
locationConfiguration: savedRun.environment?.locationConfiguration
|
|
5912
|
+
});
|
|
5868
5913
|
const replyTeamId = savedRun.destination.platform === "slack" ? savedRun.destination.teamId : void 0;
|
|
5869
5914
|
let slackMessageTs = [];
|
|
5870
5915
|
try {
|
|
@@ -6051,6 +6096,10 @@ async function resumeSlackTurnInContext(args) {
|
|
|
6051
6096
|
} catch (scheduleError) {
|
|
6052
6097
|
logException(scheduleError, "plugin.session.completed_task_schedule.failed");
|
|
6053
6098
|
}
|
|
6099
|
+
else if (outcome.status === "completed") await indexEndedTurnEvents({
|
|
6100
|
+
conversationId: runArgs.conversationId,
|
|
6101
|
+
turnId: runArgs.turnId
|
|
6102
|
+
});
|
|
6054
6103
|
} catch (error) {
|
|
6055
6104
|
await status.clear();
|
|
6056
6105
|
const runError = error instanceof AgentRunError ? error.cause : error;
|
|
@@ -6085,6 +6134,10 @@ async function resumeSlackTurnInContext(args) {
|
|
|
6085
6134
|
failureCode: "persistence_failed",
|
|
6086
6135
|
...eventId ? { eventId } : void 0
|
|
6087
6136
|
});
|
|
6137
|
+
await indexEndedTurnEvents({
|
|
6138
|
+
conversationId: runArgs.conversationId,
|
|
6139
|
+
turnId: runArgs.turnId
|
|
6140
|
+
});
|
|
6088
6141
|
throw postDeliveryCommitError;
|
|
6089
6142
|
}
|
|
6090
6143
|
if (stopped) {
|
|
@@ -6766,20 +6819,14 @@ function createConversationWork(options) {
|
|
|
6766
6819
|
},
|
|
6767
6820
|
runTurn: runtime.runDispatchTurn
|
|
6768
6821
|
});
|
|
6769
|
-
const enqueueResult = async (invocation) => await enqueueAgentInvocationResult(invocation, {
|
|
6770
|
-
queue: options.queue,
|
|
6771
|
-
state: options.state
|
|
6772
|
-
});
|
|
6773
6822
|
const conversationTurnWorker = createConversationTurnWorker(options.agentRunner, createSlackSystemTurnDelivery({
|
|
6774
6823
|
getSlackAdapter: options.getSlackAdapter,
|
|
6775
6824
|
state: options.state
|
|
6776
|
-
}),
|
|
6825
|
+
}), {
|
|
6777
6826
|
queue: options.queue,
|
|
6778
6827
|
state: options.state
|
|
6779
|
-
})
|
|
6780
|
-
const childWorker = createChildConversationWorker(
|
|
6781
|
-
enqueueResult,
|
|
6782
|
-
queue: options.queue,
|
|
6828
|
+
});
|
|
6829
|
+
const childWorker = createChildConversationWorker({
|
|
6783
6830
|
runTurn: conversationTurnWorker,
|
|
6784
6831
|
state: options.state
|
|
6785
6832
|
});
|
|
@@ -6804,7 +6851,7 @@ function createConversationWork(options) {
|
|
|
6804
6851
|
return await destinationWorker(context);
|
|
6805
6852
|
};
|
|
6806
6853
|
const runByKind = async (context, topLevel) => {
|
|
6807
|
-
|
|
6854
|
+
const worker = topLevel ? runRoot : childWorker;
|
|
6808
6855
|
const readStopSignal = context.stopSignal;
|
|
6809
6856
|
let stopSignal;
|
|
6810
6857
|
const stopLateChildAgents = async () => {
|
|
@@ -6812,7 +6859,7 @@ function createConversationWork(options) {
|
|
|
6812
6859
|
};
|
|
6813
6860
|
let result;
|
|
6814
6861
|
try {
|
|
6815
|
-
result = await
|
|
6862
|
+
result = await worker({
|
|
6816
6863
|
...context,
|
|
6817
6864
|
stopSignal: readStopSignal ? () => stopSignal = readStopSignal() : void 0
|
|
6818
6865
|
});
|
|
@@ -6828,7 +6875,7 @@ function createConversationWork(options) {
|
|
|
6828
6875
|
const run = async (context) => {
|
|
6829
6876
|
await resumeForPersonInput(context.conversationId, context.attempt.messages);
|
|
6830
6877
|
const conversation = await options.conversationStore.get({ conversationId: context.conversationId });
|
|
6831
|
-
const topLevel =
|
|
6878
|
+
const topLevel = !conversation || isTopLevel(conversation);
|
|
6832
6879
|
return await withLogContext({ rootConversationId: conversation?.rootConversationId ?? (topLevel ? context.conversationId : void 0) }, () => runByKind(context, topLevel));
|
|
6833
6880
|
};
|
|
6834
6881
|
return {
|
|
@@ -7673,8 +7720,9 @@ function coreLinkTypes() {
|
|
|
7673
7720
|
}
|
|
7674
7721
|
];
|
|
7675
7722
|
}
|
|
7676
|
-
function objectLinkContext(name, viewer) {
|
|
7723
|
+
function objectLinkContext(name, viewer, prefetched) {
|
|
7677
7724
|
return {
|
|
7725
|
+
...prefetched ? { prefetchOutcome: prefetched } : void 0,
|
|
7678
7726
|
cache: createPluginCache(name),
|
|
7679
7727
|
db: getDb(),
|
|
7680
7728
|
egress: createPluginEgress({
|
|
@@ -7700,12 +7748,14 @@ function objectLinkContext(name, viewer) {
|
|
|
7700
7748
|
function pluginLinkTypes(plugin) {
|
|
7701
7749
|
const name = plugin.manifest.name;
|
|
7702
7750
|
return (plugin.objectLinks ?? []).map((link) => ({
|
|
7703
|
-
|
|
7751
|
+
...link.cacheCards === false ? { cacheCards: false } : void 0,
|
|
7752
|
+
canView: (viewer, url, prefetched) => link.canView(objectLinkContext(name, viewer, prefetched), url),
|
|
7704
7753
|
filters: link.filters,
|
|
7705
7754
|
objectTypes: link.objectTypes,
|
|
7706
7755
|
owner: name,
|
|
7756
|
+
...link.prefetch ? { prefetch: async (viewer, urls) => await link.prefetch?.(objectLinkContext(name, viewer), urls) } : void 0,
|
|
7707
7757
|
readTool: link.readTool,
|
|
7708
|
-
resolve: (viewer, url) => link.resolve(objectLinkContext(name, viewer), url),
|
|
7758
|
+
resolve: (viewer, url, prefetched) => link.resolve(objectLinkContext(name, viewer, prefetched), url),
|
|
7709
7759
|
...link.webPageFallback ? { webPageFallback: true } : void 0
|
|
7710
7760
|
}));
|
|
7711
7761
|
}
|
|
@@ -7730,9 +7780,9 @@ function readLinkObjectType(url, linkTypes = readObjectLinkTypes()) {
|
|
|
7730
7780
|
const objectTypes = findObjectLinkType(linkTypes, new URL(url))?.objectTypes;
|
|
7731
7781
|
return objectTypes?.length === 1 ? objectTypes[0] : void 0;
|
|
7732
7782
|
}
|
|
7733
|
-
async function resolveWithLinkType(linkType, viewer, url) {
|
|
7734
|
-
if (!await linkType.canView(viewer, url)) return linkType.webPageFallback ? await resolveWithLinkType(webPageLinkType(), viewer, url) : null;
|
|
7735
|
-
const resolved = await linkType.resolve(viewer, url);
|
|
7783
|
+
async function resolveWithLinkType(linkType, viewer, url, prefetched) {
|
|
7784
|
+
if (!await linkType.canView(viewer, url, prefetched)) return linkType.webPageFallback ? await resolveWithLinkType(webPageLinkType(), viewer, url) : null;
|
|
7785
|
+
const resolved = await linkType.resolve(viewer, url, prefetched);
|
|
7736
7786
|
if (!resolved) return null;
|
|
7737
7787
|
const object = objectAnnotationSchema.parse(resolved);
|
|
7738
7788
|
if (!linkType.objectTypes.includes(object.objectType)) throw new Error(`Link type "${linkTypeName(linkType)}" returned a ${object.objectType} object.`);
|
|
@@ -7764,6 +7814,20 @@ async function viewerCanViewPluginLink(viewer, url, plugin) {
|
|
|
7764
7814
|
const linkType = findObjectLinkType(readObjectLinkTypes(), url);
|
|
7765
7815
|
return linkType?.owner === plugin && await linkType.canView(viewer, url) && Boolean(await linkType.resolve(viewer, url));
|
|
7766
7816
|
}
|
|
7817
|
+
async function prefetchLinks(viewer, links) {
|
|
7818
|
+
const byType = /* @__PURE__ */ new Map();
|
|
7819
|
+
for (const { linkType, parsed } of links) if (linkType.prefetch) byType.set(linkType, [...byType.get(linkType) ?? [], parsed]);
|
|
7820
|
+
const outcomes = /* @__PURE__ */ new Map();
|
|
7821
|
+
await mapBounded(byType, async ([linkType, typeUrls]) => {
|
|
7822
|
+
try {
|
|
7823
|
+
const typeOutcomes = await linkType.prefetch?.(viewer, typeUrls);
|
|
7824
|
+
if (typeOutcomes) outcomes.set(linkType, typeOutcomes);
|
|
7825
|
+
} catch (error) {
|
|
7826
|
+
logException(error, "object_link.prefetch.failed", { "app.plugin.name": linkType.owner });
|
|
7827
|
+
}
|
|
7828
|
+
});
|
|
7829
|
+
return outcomes;
|
|
7830
|
+
}
|
|
7767
7831
|
/**
|
|
7768
7832
|
* Resolve links to object cards for one viewer. A link without a link type,
|
|
7769
7833
|
* without access, or with a failed read gets no card. Nothing is saved on a
|
|
@@ -7772,12 +7836,19 @@ async function viewerCanViewPluginLink(viewer, url, plugin) {
|
|
|
7772
7836
|
async function resolveObjectLinks(viewer, urls) {
|
|
7773
7837
|
const linkTypes = readObjectLinkTypes();
|
|
7774
7838
|
const cache = createCache(getStateAdapter(), "object-links");
|
|
7775
|
-
|
|
7839
|
+
const links = [...new Set(urls)].flatMap((url) => {
|
|
7776
7840
|
const parsed = URL.canParse(url) ? new URL(url) : void 0;
|
|
7777
7841
|
const linkType = parsed && findObjectLinkType(linkTypes, parsed);
|
|
7778
|
-
|
|
7842
|
+
return parsed && linkType ? [{
|
|
7843
|
+
linkType,
|
|
7844
|
+
parsed,
|
|
7845
|
+
url
|
|
7846
|
+
}] : [];
|
|
7847
|
+
});
|
|
7848
|
+
const prefetched = await prefetchLinks(viewer, links);
|
|
7849
|
+
return (await mapBounded(links, async ({ linkType, parsed, url }) => {
|
|
7779
7850
|
const key = `${viewer.id}:${createHash("sha256").update(url).digest("hex")}`;
|
|
7780
|
-
const resolve = async () => (await resolveWithLinkType(linkType, viewer, parsed))?.object ?? null;
|
|
7851
|
+
const resolve = async () => (await resolveWithLinkType(linkType, viewer, parsed, prefetched.get(linkType)?.get(parsed.href)))?.object ?? null;
|
|
7781
7852
|
try {
|
|
7782
7853
|
const object = linkType.cacheCards === false ? await resolve() : await cache.getOrLoad(key, async () => ({
|
|
7783
7854
|
value: await resolve(),
|
|
@@ -7929,11 +8000,19 @@ async function loadEvents(conversationIds) {
|
|
|
7929
8000
|
}).from(events).innerJoin(juniorConversations, eq(juniorConversations.conversationId, events.conversationId)).where(and(inArray(events.conversationId, conversationIds), or(eq(events.type, "assistant_message"), and(isToolResult, inArray(sql`(${message})->>'toolName'`, Object.keys(ANSWER_TOOL_ENDINGS)), sql`(${message})->>'isError' IS DISTINCT FROM 'true'`), and(isUserMessage, sql`(${events.payload}->'provenance'->>'authority') = 'instruction'`), isWarmupEvent), gte(events.createdAt, juniorConversations.createdAt))).orderBy(events.conversationId, events.seq);
|
|
7930
8001
|
}
|
|
7931
8002
|
async function loadChildAgents(conversationIds) {
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
8003
|
+
const events = juniorConversationEvents;
|
|
8004
|
+
const rows = await getDb().select({
|
|
8005
|
+
conversationId: events.conversationId,
|
|
8006
|
+
createdAt: events.createdAt,
|
|
8007
|
+
markerId: sql`${events.payload}->>'subagentInvocationId'`,
|
|
8008
|
+
type: events.type
|
|
8009
|
+
}).from(events).where(and(inArray(events.conversationId, conversationIds), inArray(events.type, ["subagent_started", "subagent_ended"])));
|
|
8010
|
+
const endedAt = new Map(rows.flatMap((row) => row.type === "subagent_ended" && row.markerId ? [[`${row.conversationId}\0${row.markerId}`, row.createdAt]] : []));
|
|
8011
|
+
return rows.flatMap((row) => row.type === "subagent_started" ? [{
|
|
8012
|
+
conversationId: row.conversationId,
|
|
8013
|
+
createdAt: row.createdAt,
|
|
8014
|
+
terminalAt: endedAt.get(`${row.conversationId}\0${row.markerId}`) ?? null
|
|
8015
|
+
}] : []);
|
|
7937
8016
|
}
|
|
7938
8017
|
/**
|
|
7939
8018
|
* Replay the model calls of one Conversation the way the recorders in
|
|
@@ -8418,12 +8497,30 @@ const INBOX_SNOOZE_TIMER_INDEX = {
|
|
|
8418
8497
|
batchSize: 500,
|
|
8419
8498
|
key: "junior:inbox-snoozes:due"
|
|
8420
8499
|
};
|
|
8500
|
+
/** The To-do of each resolved item that shows one, for its snoozer. */
|
|
8501
|
+
async function resolvedTodos(db, resolved) {
|
|
8502
|
+
if (resolved.length === 0) return [];
|
|
8503
|
+
const items = await db.select({
|
|
8504
|
+
dedupeKey: juniorInboxItems.dedupeKey,
|
|
8505
|
+
id: juniorInboxItems.id
|
|
8506
|
+
}).from(juniorInboxItems).where(and(inArray(juniorInboxItems.id, resolved.map((row) => row.inboxItemId)), like(juniorInboxItems.dedupeKey, `${TODO_INBOX_ITEM_KEY_PREFIX}%`)));
|
|
8507
|
+
const todoOf = new Map(items.map((item) => [item.id, inboxItemTodo(item)]));
|
|
8508
|
+
return resolved.flatMap((row) => {
|
|
8509
|
+
const todo = todoOf.get(row.inboxItemId);
|
|
8510
|
+
return todo ? [{
|
|
8511
|
+
...todo,
|
|
8512
|
+
...row
|
|
8513
|
+
}] : [];
|
|
8514
|
+
});
|
|
8515
|
+
}
|
|
8421
8516
|
/**
|
|
8422
8517
|
* Fire the snooze triggers that one Event matches. A `resolve` trigger
|
|
8423
|
-
*
|
|
8518
|
+
* cancels the snooze and closes the item: it dismisses it, or marks the
|
|
8519
|
+
* To-do of a To-do item done for the person who snoozed it, so the agent
|
|
8520
|
+
* sees the change in its next `<todo-delta>`. A `wake` trigger ends the
|
|
8424
8521
|
* snooze, which records `reason`. When one Event fires both on a snooze,
|
|
8425
|
-
* `resolve` wins. A snooze that already ended ignores the Event.
|
|
8426
|
-
* the number of items woken.
|
|
8522
|
+
* `resolve` wins. A snooze that already ended ignores the Event. Each
|
|
8523
|
+
* woken snooze pushes to its User. Returns the number of items woken.
|
|
8427
8524
|
*/
|
|
8428
8525
|
async function fireTriggers(db, event, reason, nowMs) {
|
|
8429
8526
|
const triggers = (await listFiringInboxSnoozeTriggers(db, {
|
|
@@ -8431,25 +8528,37 @@ async function fireTriggers(db, event, reason, nowMs) {
|
|
|
8431
8528
|
identifiers: event.identifiers,
|
|
8432
8529
|
namespace: event.namespace
|
|
8433
8530
|
})).filter((trigger) => eventMatches(trigger.match ?? void 0, event.data));
|
|
8434
|
-
const resolving = new
|
|
8531
|
+
const resolving = new Map(triggers.filter((trigger) => trigger.outcome === "resolve").map((trigger) => [trigger.snoozeId, trigger]));
|
|
8435
8532
|
const waking = new Set(triggers.filter((trigger) => !resolving.has(trigger.snoozeId)).map((trigger) => trigger.snoozeId));
|
|
8436
8533
|
if (resolving.size === 0 && waking.size === 0) return 0;
|
|
8437
|
-
|
|
8438
|
-
|
|
8439
|
-
|
|
8534
|
+
const todos = await resolvedTodos(db, [...resolving.values()]);
|
|
8535
|
+
await mapBounded(todos, (todo) => setTodoStatusByUser(getSqlExecutor(), {
|
|
8536
|
+
assignedOnly: true,
|
|
8537
|
+
conversationId: todo.conversationId,
|
|
8538
|
+
id: todo.id,
|
|
8539
|
+
nowMs,
|
|
8540
|
+
status: "done",
|
|
8541
|
+
userId: todo.userId
|
|
8542
|
+
}));
|
|
8543
|
+
const todoItemIds = new Set(todos.map((todo) => todo.inboxItemId));
|
|
8544
|
+
const woken = await db.transaction(async (tx) => {
|
|
8545
|
+
const resolved = await settleInboxSnoozes(tx, {
|
|
8546
|
+
snoozeIds: [...resolving.keys()],
|
|
8440
8547
|
state: "cancelled"
|
|
8441
8548
|
});
|
|
8442
8549
|
await dismissOpenInboxItems(tx, {
|
|
8443
|
-
ids:
|
|
8550
|
+
ids: resolved.map((row) => row.inboxItemId).filter((id) => !todoItemIds.has(id)),
|
|
8444
8551
|
nowMs,
|
|
8445
8552
|
reason: "A snooze trigger resolved it."
|
|
8446
8553
|
});
|
|
8447
|
-
return
|
|
8554
|
+
return await settleInboxSnoozes(tx, {
|
|
8448
8555
|
reason,
|
|
8449
8556
|
snoozeIds: [...waking],
|
|
8450
8557
|
state: "woken"
|
|
8451
|
-
})
|
|
8558
|
+
});
|
|
8452
8559
|
});
|
|
8560
|
+
await pushInboxSnoozeWakes(woken);
|
|
8561
|
+
return woken.length;
|
|
8453
8562
|
}
|
|
8454
8563
|
/** Fire the snooze triggers that one published Event matches. */
|
|
8455
8564
|
async function fireInboxSnoozeTriggers(db, event, nowMs = Date.now()) {
|
|
@@ -8631,7 +8740,11 @@ function createHeartbeatContext(args) {
|
|
|
8631
8740
|
plugin: pluginName
|
|
8632
8741
|
}) },
|
|
8633
8742
|
cache: createPluginCache(pluginName),
|
|
8634
|
-
codeChanges:
|
|
8743
|
+
codeChanges: createPluginCodeChanges(pluginName),
|
|
8744
|
+
conversationChanges: createPluginConversationChanges({
|
|
8745
|
+
plugin: pluginName,
|
|
8746
|
+
show: args.showInboxItem ?? (async () => {})
|
|
8747
|
+
}),
|
|
8635
8748
|
nowMs: args.nowMs,
|
|
8636
8749
|
db: getDb(),
|
|
8637
8750
|
embedder: createPluginEmbedder(pluginName),
|
|
@@ -8642,6 +8755,11 @@ function createHeartbeatContext(args) {
|
|
|
8642
8755
|
show: args.showInboxItem ?? (async () => {})
|
|
8643
8756
|
}) },
|
|
8644
8757
|
state: createPluginState(pluginName),
|
|
8758
|
+
tasks: createPluginTaskStarter({
|
|
8759
|
+
plugin: pluginName,
|
|
8760
|
+
send: args.sendPluginTask,
|
|
8761
|
+
tasks: typeof args.plugin === "string" ? void 0 : args.plugin.tasks
|
|
8762
|
+
}),
|
|
8645
8763
|
log: createPluginLogger(pluginName),
|
|
8646
8764
|
agent: {
|
|
8647
8765
|
async dispatch(options) {
|
|
@@ -8786,43 +8904,27 @@ function automationReplyAttribution(title) {
|
|
|
8786
8904
|
} : { label: "Automation" };
|
|
8787
8905
|
}
|
|
8788
8906
|
// src/api/user-settings.ts
|
|
8789
|
-
const userPreferencesSchema = z.object({
|
|
8790
|
-
/** Show the new dashboard UI instead of the current one. */
|
|
8791
|
-
experimentalUi: z.boolean().optional() });
|
|
8792
8907
|
/** Settings of a user who has not changed any. */
|
|
8793
8908
|
const DEFAULT_USER_SETTINGS = {
|
|
8794
8909
|
autoArchiveDefault: false,
|
|
8795
|
-
autoArchiveGraceHours: 24
|
|
8796
|
-
experimentalUi: false
|
|
8910
|
+
autoArchiveGraceHours: 24
|
|
8797
8911
|
};
|
|
8798
8912
|
const userSettingsColumns = {
|
|
8799
8913
|
autoArchiveDefault: juniorUsers.autoArchiveDefault,
|
|
8800
|
-
autoArchiveGraceHours: juniorUsers.autoArchiveGraceHours
|
|
8801
|
-
preferences: juniorUsers.preferences
|
|
8914
|
+
autoArchiveGraceHours: juniorUsers.autoArchiveGraceHours
|
|
8802
8915
|
};
|
|
8803
|
-
function toUserSettings(row) {
|
|
8804
|
-
const { preferences, ...columns } = row;
|
|
8805
|
-
const parsed = userPreferencesSchema.parse(preferences);
|
|
8806
|
-
return {
|
|
8807
|
-
...columns,
|
|
8808
|
-
experimentalUi: parsed.experimentalUi ?? DEFAULT_USER_SETTINGS.experimentalUi
|
|
8809
|
-
};
|
|
8810
|
-
}
|
|
8811
8916
|
/** Read the user's dashboard settings. */
|
|
8812
8917
|
async function readUserSettings(userId) {
|
|
8813
8918
|
const [user] = await getDb().select(userSettingsColumns).from(juniorUsers).where(eq(juniorUsers.id, userId)).limit(1);
|
|
8814
|
-
return user
|
|
8919
|
+
return user;
|
|
8815
8920
|
}
|
|
8816
8921
|
/** Save changed dashboard settings and return the saved settings. */
|
|
8817
8922
|
async function updateUserSettings(userId, settings) {
|
|
8818
|
-
const { experimentalUi, ...columns } = settings;
|
|
8819
|
-
const preferences = experimentalUi === void 0 ? {} : { experimentalUi };
|
|
8820
8923
|
const [user] = await getDb().update(juniorUsers).set({
|
|
8821
|
-
...
|
|
8822
|
-
preferences: sql`${juniorUsers.preferences} || ${JSON.stringify(preferences)}::jsonb`,
|
|
8924
|
+
...settings,
|
|
8823
8925
|
updatedAt: /* @__PURE__ */ new Date()
|
|
8824
8926
|
}).where(eq(juniorUsers.id, userId)).returning(userSettingsColumns);
|
|
8825
|
-
return user
|
|
8927
|
+
return user;
|
|
8826
8928
|
}
|
|
8827
8929
|
// src/api/conversations/auto-archive.ts
|
|
8828
8930
|
const HOUR_MS = 36e5;
|
|
@@ -9257,6 +9359,7 @@ async function answerPluginInboxItem(args) {
|
|
|
9257
9359
|
await hook({
|
|
9258
9360
|
...basePluginContext(plugin),
|
|
9259
9361
|
choice,
|
|
9362
|
+
codeChanges: createPluginCodeChanges(pluginName),
|
|
9260
9363
|
conversationId,
|
|
9261
9364
|
dedupeKey: item.dedupeKey.slice(`${PLUGIN_INBOX_ITEM_KEY_PREFIX}${pluginName}:`.length),
|
|
9262
9365
|
events: createPluginEventPublisher(plugin, events),
|
|
@@ -9359,7 +9462,7 @@ function reviewItemChange(action, user) {
|
|
|
9359
9462
|
kind: "taken",
|
|
9360
9463
|
user
|
|
9361
9464
|
};
|
|
9362
|
-
if (action === "submit") return {
|
|
9465
|
+
if (action === "submit" || action === "done") return {
|
|
9363
9466
|
kind: "submitted",
|
|
9364
9467
|
user
|
|
9365
9468
|
};
|
|
@@ -9403,6 +9506,11 @@ async function actOnInboxItem(args) {
|
|
|
9403
9506
|
const nowMs = args.nowMs ?? Date.now();
|
|
9404
9507
|
const db = getDb();
|
|
9405
9508
|
const item = await readInboxItemForUser(user, args.id);
|
|
9509
|
+
if (inboxItemTodo(item)) {
|
|
9510
|
+
if (action !== "done" && action !== "dismiss") throw new InboxItemActionError("invalid", "A To-do item takes only Done or Dismiss.");
|
|
9511
|
+
return await closeTodoItem(item, user, nowMs, action);
|
|
9512
|
+
}
|
|
9513
|
+
if (action === "done") throw new InboxItemActionError("invalid", "Only a To-do item can be marked done.");
|
|
9406
9514
|
if (action === "take") {
|
|
9407
9515
|
if (item.status !== "open") throw new InboxItemActionError("conflict", "Inbox item is closed.");
|
|
9408
9516
|
if (!canActOnInboxItem(item, user.id)) throw new InboxItemActionError("forbidden", "Only an assignee can take this item.");
|
|
@@ -9424,7 +9532,7 @@ async function actOnInboxItem(args) {
|
|
|
9424
9532
|
let closed = item;
|
|
9425
9533
|
let closedNow = false;
|
|
9426
9534
|
if (item.status === "open") {
|
|
9427
|
-
if (!canActOnInboxItem(item, user.id)) throw new InboxItemActionError("forbidden", "Only an assignee can act on this item.");
|
|
9535
|
+
if (!(action === "submit" ? canAnswerInboxItem(item, user.id) : canActOnInboxItem(item, user.id))) throw new InboxItemActionError("forbidden", "Only an assignee can act on this item.");
|
|
9428
9536
|
const answer = action === "submit" ? submittedAnswer(item, args.answer) : void 0;
|
|
9429
9537
|
closedNow = await closeInboxItem(db, {
|
|
9430
9538
|
closedByUserId: user.id,
|
|
@@ -9461,13 +9569,36 @@ async function actOnInboxItem(args) {
|
|
|
9461
9569
|
return closed;
|
|
9462
9570
|
}
|
|
9463
9571
|
/**
|
|
9572
|
+
* Close a To-do item for its assignee through its To-do: Done marks the
|
|
9573
|
+
* To-do done, and Dismiss drops it. The To-do change closes the item as
|
|
9574
|
+
* done or dismissed (`syncTodoInboxItems`), and the agent sees it in its
|
|
9575
|
+
* next `<todo-delta>`, so it sends no message and starts no Turn. A retry
|
|
9576
|
+
* after the item closed the same way by the same person succeeds.
|
|
9577
|
+
*/
|
|
9578
|
+
async function closeTodoItem(item, user, nowMs, action) {
|
|
9579
|
+
const todo = inboxItemTodo(item);
|
|
9580
|
+
if (item.status === "open") {
|
|
9581
|
+
if (!canActOnInboxItem(item, user.id)) throw new InboxItemActionError("forbidden", "Only an assignee can act on this item.");
|
|
9582
|
+
await setTodoStatusByUser(getSqlExecutor(), {
|
|
9583
|
+
assignedOnly: true,
|
|
9584
|
+
conversationId: todo.conversationId,
|
|
9585
|
+
id: todo.id,
|
|
9586
|
+
nowMs,
|
|
9587
|
+
status: action === "done" ? "done" : "dropped",
|
|
9588
|
+
userId: user.id
|
|
9589
|
+
});
|
|
9590
|
+
}
|
|
9591
|
+
const closed = await readInboxItemForUser(user, item.id);
|
|
9592
|
+
if (closed.status !== closedStatus(action) || closed.closedBy?.userId !== user.id) throw new InboxItemActionError("conflict", "Inbox item is closed.");
|
|
9593
|
+
return closed;
|
|
9594
|
+
}
|
|
9595
|
+
/**
|
|
9464
9596
|
* Return whether a reply from this User answers an open action item, or is
|
|
9465
9597
|
* a retry of the reply from this User that closed it.
|
|
9466
9598
|
*/
|
|
9467
9599
|
function replyAnswers(item, user) {
|
|
9468
9600
|
if (item.status !== "open") return item.closedBy?.userId === user?.id;
|
|
9469
|
-
if (item
|
|
9470
|
-
if (item.assignees.length === 0) return true;
|
|
9601
|
+
if (isInboxItemForEveryone(item)) return false;
|
|
9471
9602
|
return user !== void 0 && item.assignees.some((assignee) => assignee.userId === user.id);
|
|
9472
9603
|
}
|
|
9473
9604
|
/** Return the answer that the text of a person's message gives to an item. */
|
|
@@ -9489,14 +9620,15 @@ function messageAnswer(item, text) {
|
|
|
9489
9620
|
* A reply closes an item only when all of these are true:
|
|
9490
9621
|
* - The item is an open `action` item.
|
|
9491
9622
|
* - The agent added it in this Conversation, its owner.
|
|
9492
|
-
* - The replier is an assigned User
|
|
9493
|
-
*
|
|
9623
|
+
* - The replier is an assigned User. A Slack replier without a Junior User
|
|
9624
|
+
* closes no item.
|
|
9494
9625
|
* - The decision model says that the reply answers this item
|
|
9495
9626
|
* (`matchReplyToInboxItems`). Other open items in the thread stay open.
|
|
9496
9627
|
* When the decision fails, all items stay open.
|
|
9497
9628
|
*
|
|
9498
|
-
* Items
|
|
9499
|
-
*
|
|
9629
|
+
* Items for Everyone (`isInboxItemForEveryone`, also an item with no
|
|
9630
|
+
* assignees), or only for other people, stay open. They need an answer on
|
|
9631
|
+
* the card or the Inbox. Each item closes as `done` with
|
|
9500
9632
|
* `INBOX_ITEM_REPLIED_REASON`, and the replier closes it. The reply itself
|
|
9501
9633
|
* is the answer in this Conversation, so only the other linked
|
|
9502
9634
|
* Conversations get a message. A click that closes the item first wins.
|
|
@@ -9818,7 +9950,7 @@ const mcpConversationSchema = z.object({
|
|
|
9818
9950
|
conversationId: z.string(),
|
|
9819
9951
|
title: z.string(),
|
|
9820
9952
|
summary: z.string().optional().describe("What was asked and what happened, as of the last Turn."),
|
|
9821
|
-
status: conversationReportStatusSchema.describe("`needs_input` while it waits on a person: an Inbox item it added, a sign-in, a failed latest Turn,
|
|
9953
|
+
status: conversationReportStatusSchema.describe("`needs_input` while it waits on a person: an Inbox item it added, a sign-in, a failed latest Turn, or an answer its starter has not read. `working` while a Turn runs or waits to start. `done` otherwise, also after a stop."),
|
|
9822
9954
|
turnActive: z.boolean().describe("True while a Turn runs or waits to start, whatever `status` is. To follow a Conversation, wait until it is false."),
|
|
9823
9955
|
treeState: conversationTreeStateSchema.optional().describe("Your viewer state, over this Conversation and all its child agents. `needs_you` when one of them waits on you or on everyone. `working` while a Turn runs or waits to start in any of them. `done` otherwise. Show this in a list, not `status`."),
|
|
9824
9956
|
watching: z.boolean().optional().describe("True when one of them has an active Watch or a pending Timer. It is not work."),
|
|
@@ -10078,7 +10210,7 @@ async function setPin(db, viewer, conversationId, pinned) {
|
|
|
10078
10210
|
rootConversationId: juniorConversations.rootConversationId
|
|
10079
10211
|
}).from(juniorConversations).where(eq(juniorConversations.conversationId, conversationId)).limit(1).for("no key update");
|
|
10080
10212
|
if (!conversation) throwApiError(404, "Conversation not found.");
|
|
10081
|
-
if (
|
|
10213
|
+
if (conversation.parentConversationId) throwApiError(409, `A child conversation cannot be pinned or unpinned. It uses its root's pin: ${conversation.rootConversationId ?? conversation.parentConversationId}.`);
|
|
10082
10214
|
if (!pinned) {
|
|
10083
10215
|
await db.update(juniorConversationParticipants).set({
|
|
10084
10216
|
pinnedAt: null,
|
|
@@ -10117,6 +10249,178 @@ async function reorderPinnedConversations(viewer, body) {
|
|
|
10117
10249
|
const updatedIds = new Set(updated.map((row) => row.rootConversationId));
|
|
10118
10250
|
return { conversationIds: ids.filter((id) => updatedIds.has(id)) };
|
|
10119
10251
|
}
|
|
10252
|
+
// src/chat/conversations/sql/title.ts
|
|
10253
|
+
/**
|
|
10254
|
+
* Replace one Conversation's title. Returns the stored title, or undefined
|
|
10255
|
+
* when the Conversation does not exist.
|
|
10256
|
+
*
|
|
10257
|
+
* recordActivity reads the title and writes it back under the mutation lock,
|
|
10258
|
+
* so this write takes the same lock. A concurrent Turn cannot restore the old
|
|
10259
|
+
* title.
|
|
10260
|
+
*/
|
|
10261
|
+
async function setConversationTitle(executor, conversationId, title) {
|
|
10262
|
+
return await withConversationMutationLock(executor, conversationId, async () => {
|
|
10263
|
+
const [row] = await executor.db().update(juniorConversations).set({
|
|
10264
|
+
detailVersion: nextDetailVersion,
|
|
10265
|
+
title
|
|
10266
|
+
}).where(eq(juniorConversations.conversationId, conversationId)).returning({ title: juniorConversations.title });
|
|
10267
|
+
return row?.title ?? void 0;
|
|
10268
|
+
});
|
|
10269
|
+
}
|
|
10270
|
+
// src/api/conversations/rename.ts
|
|
10271
|
+
/**
|
|
10272
|
+
* Rename one conversation. The title is shared, so only a participant can
|
|
10273
|
+
* change it, the same as pin and archive. Automatic titles are set once, so a
|
|
10274
|
+
* later Turn keeps this title.
|
|
10275
|
+
*/
|
|
10276
|
+
async function renameConversation(viewer, conversationId, body) {
|
|
10277
|
+
if (!(await readConversationAccessFromSql(getDb(), [conversationId], viewer)).get(conversationId)?.isParticipant) throwApiError(404, "Conversation not found.");
|
|
10278
|
+
const title = await setConversationTitle(getSqlExecutor(), conversationId, body.title);
|
|
10279
|
+
if (!title) throwApiError(404, "Conversation not found.");
|
|
10280
|
+
return { title };
|
|
10281
|
+
}
|
|
10282
|
+
// src/chat/spaces/conversations.ts
|
|
10283
|
+
/**
|
|
10284
|
+
* Conversations in a Space (`design/spaces.md`). Only a root stores its
|
|
10285
|
+
* Space. A child is in the Space of its root, so the two never disagree.
|
|
10286
|
+
*/
|
|
10287
|
+
const spaceRoot$1 = alias(juniorConversations, "space_root");
|
|
10288
|
+
/** Read the id and name of each Space, by id. A missing id has no entry. */
|
|
10289
|
+
async function readSpaceRefs(db, spaceIds) {
|
|
10290
|
+
const ids = [...new Set(spaceIds)];
|
|
10291
|
+
if (ids.length === 0) return /* @__PURE__ */ new Map();
|
|
10292
|
+
const rows = await db.select({
|
|
10293
|
+
id: juniorSpaces.id,
|
|
10294
|
+
name: juniorSpaces.name
|
|
10295
|
+
}).from(juniorSpaces).where(inArray(juniorSpaces.id, ids));
|
|
10296
|
+
return new Map(rows.map((row) => [row.id, row]));
|
|
10297
|
+
}
|
|
10298
|
+
/**
|
|
10299
|
+
* Put one root in a Space, or take it out of every Space with null. The root
|
|
10300
|
+
* gets the Space's visibility on its own Location. The caller checks who may
|
|
10301
|
+
* move it out of `fromSpaceId`, the Space that it read before the move.
|
|
10302
|
+
*/
|
|
10303
|
+
async function setConversationSpace(conversationId, spaceId, fromSpaceId) {
|
|
10304
|
+
const executor = getSqlExecutor();
|
|
10305
|
+
return await executor.transaction(async () => {
|
|
10306
|
+
const db = executor.db();
|
|
10307
|
+
const [root] = await db.select({
|
|
10308
|
+
locationId: juniorConversations.destinationId,
|
|
10309
|
+
provider: juniorDestinations.provider,
|
|
10310
|
+
spaceId: juniorConversations.spaceId
|
|
10311
|
+
}).from(juniorConversations).leftJoin(juniorDestinations, eq(juniorDestinations.id, juniorConversations.destinationId)).where(and(eq(juniorConversations.conversationId, conversationId), isNull(juniorConversations.parentConversationId))).limit(1).for("update", { of: juniorConversations });
|
|
10312
|
+
if (!root) return "not_found";
|
|
10313
|
+
if (root.spaceId !== fromSpaceId) return "moved";
|
|
10314
|
+
const spaceIds = [root.spaceId, spaceId].filter((id) => id !== null);
|
|
10315
|
+
const spaces = spaceIds.length > 0 ? await db.select({
|
|
10316
|
+
id: juniorSpaces.id,
|
|
10317
|
+
visibility: juniorSpaces.visibility
|
|
10318
|
+
}).from(juniorSpaces).where(inArray(juniorSpaces.id, spaceIds)) : [];
|
|
10319
|
+
if (spaces.find((space) => space.id === root.spaceId)?.visibility === "private") return "leaves_private";
|
|
10320
|
+
if (spaces.find((space) => space.id === spaceId)?.visibility === "private") {
|
|
10321
|
+
if (root.provider !== "local" || !root.locationId) return "shared_location";
|
|
10322
|
+
await db.update(juniorDestinations).set({
|
|
10323
|
+
visibility: "private",
|
|
10324
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
10325
|
+
}).where(eq(juniorDestinations.id, root.locationId));
|
|
10326
|
+
}
|
|
10327
|
+
await db.update(juniorConversations).set({
|
|
10328
|
+
spaceId,
|
|
10329
|
+
detailVersion: nextDetailVersion
|
|
10330
|
+
}).where(eq(juniorConversations.conversationId, conversationId));
|
|
10331
|
+
});
|
|
10332
|
+
}
|
|
10333
|
+
/**
|
|
10334
|
+
* Every Conversation in the Space, at any depth. A root from before
|
|
10335
|
+
* `root_conversation_id` was set matches by its own id.
|
|
10336
|
+
*/
|
|
10337
|
+
function inSpaceTrees(db, spaceId) {
|
|
10338
|
+
const roots = db.select({ id: spaceRoot$1.conversationId }).from(spaceRoot$1).where(eq(spaceRoot$1.spaceId, spaceId));
|
|
10339
|
+
return or(inArray(juniorConversations.rootConversationId, roots), inArray(juniorConversations.conversationId, roots));
|
|
10340
|
+
}
|
|
10341
|
+
/**
|
|
10342
|
+
* Archive or restore a Space with its Conversations.
|
|
10343
|
+
*
|
|
10344
|
+
* Archive writes one time to the Space and to each unarchived Conversation
|
|
10345
|
+
* in it, at any depth. Then it stops each root that is not stopped, with the
|
|
10346
|
+
* child agents below it, so no work in the Space keeps running. A retry
|
|
10347
|
+
* stops what an earlier try left running.
|
|
10348
|
+
*
|
|
10349
|
+
* Restore clears the Space and the Conversations that its archive wrote. A
|
|
10350
|
+
* Conversation that was archived on its own stays archived. Restore starts
|
|
10351
|
+
* no work.
|
|
10352
|
+
*/
|
|
10353
|
+
async function setSpaceArchive(args) {
|
|
10354
|
+
const executor = getSqlExecutor();
|
|
10355
|
+
await executor.transaction(async () => {
|
|
10356
|
+
const db = executor.db();
|
|
10357
|
+
const [space] = await db.select({ archivedAt: juniorSpaces.archivedAt }).from(juniorSpaces).where(eq(juniorSpaces.id, args.spaceId)).limit(1).for("update");
|
|
10358
|
+
if (!space) return;
|
|
10359
|
+
const now = /* @__PURE__ */ new Date();
|
|
10360
|
+
if (args.archived) {
|
|
10361
|
+
if (space.archivedAt) return;
|
|
10362
|
+
await db.update(juniorSpaces).set({
|
|
10363
|
+
archivedAt: now,
|
|
10364
|
+
updatedAt: now
|
|
10365
|
+
}).where(eq(juniorSpaces.id, args.spaceId));
|
|
10366
|
+
await setArchivedAt(db, inSpaceTrees(db, args.spaceId), now, isNull(juniorConversations.archivedAt));
|
|
10367
|
+
return;
|
|
10368
|
+
}
|
|
10369
|
+
if (!space.archivedAt) return;
|
|
10370
|
+
await db.update(juniorSpaces).set({
|
|
10371
|
+
archivedAt: null,
|
|
10372
|
+
updatedAt: now
|
|
10373
|
+
}).where(eq(juniorSpaces.id, args.spaceId));
|
|
10374
|
+
await setArchivedAt(db, inSpaceTrees(db, args.spaceId), null, eq(juniorConversations.archivedAt, space.archivedAt));
|
|
10375
|
+
});
|
|
10376
|
+
if (!args.archived) return;
|
|
10377
|
+
const running = await getDb().select({ conversationId: juniorConversations.conversationId }).from(juniorConversations).where(and(eq(juniorConversations.spaceId, args.spaceId), isNull(juniorConversations.stoppedAt)));
|
|
10378
|
+
await mapBounded(running, ({ conversationId }) => stopConversation({
|
|
10379
|
+
conversationId,
|
|
10380
|
+
queue: args.queue
|
|
10381
|
+
}));
|
|
10382
|
+
}
|
|
10383
|
+
// src/api/conversations/space.ts
|
|
10384
|
+
/**
|
|
10385
|
+
* Return the Space that the viewer puts work in. Only a member starts or
|
|
10386
|
+
* moves work into a Space, and an archived Space takes no new work.
|
|
10387
|
+
*/
|
|
10388
|
+
async function requireSpaceForWork(viewer, spaceId) {
|
|
10389
|
+
const space = await readSpace(viewer.id, spaceId);
|
|
10390
|
+
if (!space) throwApiError(404, "Space was not found.");
|
|
10391
|
+
if (space.archivedAt) throwApiError(409, "Restore the Space before you add work to it.");
|
|
10392
|
+
if (!space.viewerIsMember) throwApiError(403, "Join the Space to add work to it.");
|
|
10393
|
+
return space;
|
|
10394
|
+
}
|
|
10395
|
+
/**
|
|
10396
|
+
* Put one root Conversation in a Space, or make it a one-off with null.
|
|
10397
|
+
* Only a participant moves it. They must be a member of the Space that it
|
|
10398
|
+
* leaves and of the Space that it joins. Only a public root joins a Space.
|
|
10399
|
+
* A root in a private Space stays there, so its data stays with the members.
|
|
10400
|
+
*/
|
|
10401
|
+
async function setConversationSpaceForViewer(viewer, conversationId, body) {
|
|
10402
|
+
const [conversation, access] = await Promise.all([getConversationStore().get({ conversationId }), readConversationAccessFromSql(getDb(), [conversationId], viewer).then((byId) => byId.get(conversationId))]);
|
|
10403
|
+
if (!conversation || !access?.isParticipant) throwApiError(404, "Conversation not found.");
|
|
10404
|
+
if (!canMoveToSpace(conversation)) throwApiError(409, "Only a top-level conversation moves. A child is in the Space of its root.");
|
|
10405
|
+
const currentSpaceId = conversation.spaceId ?? null;
|
|
10406
|
+
const target = body.spaceId ? await requireSpaceForWork(viewer, body.spaceId) : void 0;
|
|
10407
|
+
const response = { space: target ? {
|
|
10408
|
+
id: target.id,
|
|
10409
|
+
name: target.name
|
|
10410
|
+
} : null };
|
|
10411
|
+
if (body.spaceId === currentSpaceId) return response;
|
|
10412
|
+
if (currentSpaceId) {
|
|
10413
|
+
const source = await readSpace(viewer.id, currentSpaceId);
|
|
10414
|
+
if (source && !source.viewerIsMember) throwApiError(403, "Join the Space that it is in to move it.");
|
|
10415
|
+
}
|
|
10416
|
+
if (target && access.visibility !== "public") throwApiError(409, "Only a public conversation can join a Space.");
|
|
10417
|
+
const refusal = await setConversationSpace(conversationId, body.spaceId, currentSpaceId);
|
|
10418
|
+
if (refusal === "not_found") throwApiError(404, "Conversation not found.");
|
|
10419
|
+
if (refusal === "moved") throwApiError(409, "It moved to another Space. Reload and try again.");
|
|
10420
|
+
if (refusal === "leaves_private") throwApiError(409, "A conversation in a private Space stays in it.");
|
|
10421
|
+
if (refusal === "shared_location") throwApiError(409, "A Slack conversation can't join a private Space.");
|
|
10422
|
+
return response;
|
|
10423
|
+
}
|
|
10120
10424
|
// src/api/conversations/stop.ts
|
|
10121
10425
|
/**
|
|
10122
10426
|
* Stop one Conversation for a participant: its active Turn, its session, and
|
|
@@ -10211,6 +10515,28 @@ const pinConversationOperation = defineApiOperation({
|
|
|
10211
10515
|
annotations: writeAnnotations,
|
|
10212
10516
|
run: (viewer, { conversationId, ...body }) => pinConversation(viewer, conversationId, body)
|
|
10213
10517
|
});
|
|
10518
|
+
/** Rename one Conversation for everyone in it. */
|
|
10519
|
+
const renameConversationOperation = defineApiOperation({
|
|
10520
|
+
name: "renameConversation",
|
|
10521
|
+
title: "Rename conversation",
|
|
10522
|
+
description: "Rename one of your conversations for everyone in it. Later turns keep the new title. The Slack thread does not change. Returns the stored title.",
|
|
10523
|
+
scope: "conversations:manage",
|
|
10524
|
+
input: renameConversationBodySchema.extend(conversationIdInput),
|
|
10525
|
+
output: renameConversationResponseSchema,
|
|
10526
|
+
annotations: writeAnnotations,
|
|
10527
|
+
run: (viewer, { conversationId, ...body }) => renameConversation(viewer, conversationId, body)
|
|
10528
|
+
});
|
|
10529
|
+
/** Put one root Conversation in a Space, or make it a one-off. */
|
|
10530
|
+
const setConversationSpaceOperation = defineApiOperation({
|
|
10531
|
+
name: "setConversationSpace",
|
|
10532
|
+
title: "Set conversation Space",
|
|
10533
|
+
description: "Put one of your top-level conversations in a Space, or pass null to take it out of its Space. You must be a member of the Space that it joins and of the Space that it leaves. Only a public conversation can join a Space. Its child conversations move with it.",
|
|
10534
|
+
scope: "conversations:manage",
|
|
10535
|
+
input: setConversationSpaceBodySchema.extend(conversationIdInput),
|
|
10536
|
+
output: setConversationSpaceResponseSchema,
|
|
10537
|
+
annotations: writeAnnotations,
|
|
10538
|
+
run: (viewer, { conversationId, ...body }) => setConversationSpaceForViewer(viewer, conversationId, body)
|
|
10539
|
+
});
|
|
10214
10540
|
/** Override the viewer's auto-archive default for one Conversation. */
|
|
10215
10541
|
const setConversationAutoArchiveOperation = defineApiOperation({
|
|
10216
10542
|
name: "setConversationAutoArchive",
|
|
@@ -10267,7 +10593,9 @@ const conversationOperations = [
|
|
|
10267
10593
|
archiveConversationOperation,
|
|
10268
10594
|
archiveDoneConversationsOperation,
|
|
10269
10595
|
pinConversationOperation,
|
|
10596
|
+
renameConversationOperation,
|
|
10270
10597
|
setConversationAutoArchiveOperation,
|
|
10598
|
+
setConversationSpaceOperation,
|
|
10271
10599
|
setConversationSubscriptionOperation,
|
|
10272
10600
|
stopConversationOperation
|
|
10273
10601
|
];
|
|
@@ -10346,6 +10674,7 @@ async function requireWebMessageConversation(viewer, conversationId, idempotency
|
|
|
10346
10674
|
if (!acceptsWebMessages(conversation)) throwApiError(409, "Conversation does not accept web messages.");
|
|
10347
10675
|
const access = await readConversationAccessFromSql(getDb(), [conversationId], viewer);
|
|
10348
10676
|
if (!canAddConversationMessages(access.get(conversationId))) throwApiError(403, "Only participants can add messages to a private conversation.");
|
|
10677
|
+
if (messagesNeedSpaceMembership(conversation.kind) && conversation.spaceId) await requireSpaceForWork(viewer, conversation.spaceId);
|
|
10349
10678
|
return conversationId;
|
|
10350
10679
|
}
|
|
10351
10680
|
function actorFromViewer(viewer) {
|
|
@@ -10354,19 +10683,24 @@ function actorFromViewer(viewer) {
|
|
|
10354
10683
|
}
|
|
10355
10684
|
/** Create a dashboard root conversation and enqueue its first message. */
|
|
10356
10685
|
async function createConversationForViewer(viewer, body, services) {
|
|
10686
|
+
const space = body.spaceId ? await requireSpaceForWork(viewer, body.spaceId) : void 0;
|
|
10687
|
+
if (space && body.visibility && body.visibility !== space.visibility) throwApiError(400, `A conversation in this Space is ${space.visibility}.`);
|
|
10688
|
+
const visibility = space?.visibility ?? body.visibility;
|
|
10357
10689
|
const uploads = await verifyUploads({
|
|
10358
10690
|
conversationId: await requireWebMessageConversation(viewer, void 0, body.idempotencyKey),
|
|
10359
10691
|
idempotencyKey: body.idempotencyKey,
|
|
10360
10692
|
userId: viewer.id
|
|
10361
10693
|
}, body.uploadIds, services.attachmentStorage);
|
|
10694
|
+
let accepted;
|
|
10362
10695
|
try {
|
|
10363
|
-
|
|
10696
|
+
accepted = await createAndEnqueueConversation({
|
|
10364
10697
|
actor: actorFromViewer(viewer),
|
|
10365
10698
|
idempotencyKey: body.idempotencyKey,
|
|
10366
10699
|
message: body.message,
|
|
10367
10700
|
uploads,
|
|
10368
10701
|
...body.title ? { title: body.title } : void 0,
|
|
10369
|
-
...
|
|
10702
|
+
...visibility ? { visibility } : void 0,
|
|
10703
|
+
...space ? { spaceId: space.id } : void 0
|
|
10370
10704
|
}, {
|
|
10371
10705
|
conversationStore: getConversationStore(),
|
|
10372
10706
|
attachmentStorage: services.attachmentStorage,
|
|
@@ -10375,6 +10709,8 @@ async function createConversationForViewer(viewer, body, services) {
|
|
|
10375
10709
|
} catch (error) {
|
|
10376
10710
|
throwApiError(500, "Unable to create conversation.", error);
|
|
10377
10711
|
}
|
|
10712
|
+
await inviteMentionedPeople(viewer, accepted.conversationId, body.message);
|
|
10713
|
+
return accepted;
|
|
10378
10714
|
}
|
|
10379
10715
|
/** Append one viewer message to an existing conversation. */
|
|
10380
10716
|
async function appendConversationMessageForViewer(viewer, conversationId, body, services, delivery) {
|
|
@@ -10397,15 +10733,19 @@ async function appendConversationMessageForViewer(viewer, conversationId, body,
|
|
|
10397
10733
|
attachmentStorage: services.attachmentStorage,
|
|
10398
10734
|
queue: services.queue
|
|
10399
10735
|
});
|
|
10400
|
-
const
|
|
10401
|
-
conversationId,
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
|
|
10736
|
+
const applyAccepted = async () => {
|
|
10737
|
+
await inviteMentionedPeople(viewer, conversationId, body.message);
|
|
10738
|
+
await closeInboxItemsAnsweredByReply({
|
|
10739
|
+
conversationId,
|
|
10740
|
+
delivery: {
|
|
10741
|
+
queue: services.queue,
|
|
10742
|
+
show: createInboxItemShow(getProductionSlackAdapter)
|
|
10743
|
+
},
|
|
10744
|
+
resolveUser: async () => viewer,
|
|
10745
|
+
text: body.message
|
|
10746
|
+
});
|
|
10747
|
+
await markConversationRead(viewer, conversationId, { lastReadSeq: Number.MAX_SAFE_INTEGER });
|
|
10748
|
+
};
|
|
10409
10749
|
try {
|
|
10410
10750
|
let accepted;
|
|
10411
10751
|
try {
|
|
@@ -10420,10 +10760,10 @@ async function appendConversationMessageForViewer(viewer, conversationId, body,
|
|
|
10420
10760
|
conversationId,
|
|
10421
10761
|
state
|
|
10422
10762
|
})]);
|
|
10423
|
-
if (work?.execution.inboundMessageIds.includes(messageId)) await
|
|
10763
|
+
if (work?.execution.inboundMessageIds.includes(messageId)) await applyAccepted();
|
|
10424
10764
|
throw error;
|
|
10425
10765
|
}
|
|
10426
|
-
await
|
|
10766
|
+
await applyAccepted();
|
|
10427
10767
|
return accepted;
|
|
10428
10768
|
} catch (error) {
|
|
10429
10769
|
throwApiError(500, "Unable to append message.", error);
|
|
@@ -11240,11 +11580,11 @@ const detailViewer = alias(juniorUsers, "detail_viewer");
|
|
|
11240
11580
|
const forkSource = alias(juniorConversations, "detail_fork_source");
|
|
11241
11581
|
const fork = alias(juniorConversations, "detail_fork");
|
|
11242
11582
|
const agentTreeRoot = alias(juniorConversations, "detail_agent_tree_root");
|
|
11583
|
+
const spaceRoot = alias(juniorConversations, "detail_space_root");
|
|
11243
11584
|
/**
|
|
11244
11585
|
* Return the root fields that label the agent tree of a child: its title and
|
|
11245
|
-
* channel name. The other labels cannot change once the child exists.
|
|
11246
|
-
*
|
|
11247
|
-
* spawn sets a title. Access to each node comes from the shared root, so the
|
|
11586
|
+
* channel name. The other labels cannot change once the child exists. Only
|
|
11587
|
+
* the spawn sets a child's title and agent name. Access to each node comes from the shared root, so the
|
|
11248
11588
|
* viewer's access covers it. This keeps the recursive lineage read out of
|
|
11249
11589
|
* every poll.
|
|
11250
11590
|
*/
|
|
@@ -11288,6 +11628,16 @@ function viewerStateVersion(db, conversationId, viewerId) {
|
|
|
11288
11628
|
(${slackAttachmentsVersionQuery(db, conversationId)})
|
|
11289
11629
|
))`;
|
|
11290
11630
|
}
|
|
11631
|
+
const versionSpaceConversation = alias(juniorConversations, "version_space_conversation");
|
|
11632
|
+
const versionSpaceRoot = alias(juniorConversations, "version_space_root");
|
|
11633
|
+
/**
|
|
11634
|
+
* Hash the root's Space. A move writes only the root, and a rename writes
|
|
11635
|
+
* only the Space, so a child's token reads both through its root.
|
|
11636
|
+
*/
|
|
11637
|
+
function rootSpaceVersion(db, conversationId) {
|
|
11638
|
+
const space = db.select({ state: sql`md5(concat_ws(':', ${versionSpaceRoot.spaceId}, ${juniorSpaces.name}))` }).from(versionSpaceConversation).innerJoin(versionSpaceRoot, eq(versionSpaceRoot.conversationId, sql`coalesce(${versionSpaceConversation.rootConversationId}, ${versionSpaceConversation.conversationId})`)).leftJoin(juniorSpaces, eq(juniorSpaces.id, versionSpaceRoot.spaceId)).where(eq(versionSpaceConversation.conversationId, conversationId));
|
|
11639
|
+
return sql`coalesce((${space}), '')`;
|
|
11640
|
+
}
|
|
11291
11641
|
/**
|
|
11292
11642
|
* Return a query for the change token of each Conversation and its child
|
|
11293
11643
|
* agents, as the viewer sees it, one row per Conversation found. A missing
|
|
@@ -11301,7 +11651,7 @@ function conversationVersionsQuery(db, conversationIds, viewerId) {
|
|
|
11301
11651
|
const viewerState = viewerId ? viewerStateVersion(db, rowConversationId, viewerId) : sql`null`;
|
|
11302
11652
|
return db.select({
|
|
11303
11653
|
conversationId: subtree.conversationId,
|
|
11304
|
-
version: sql`concat_ws(':', ${subtree.conversations}, ${subtree.version}, ${viewerState})`.as("version")
|
|
11654
|
+
version: sql`concat_ws(':', ${subtree.conversations}, ${subtree.version}, ${rootSpaceVersion(db, rowConversationId)}, ${viewerState})`.as("version")
|
|
11305
11655
|
}).from(subtree);
|
|
11306
11656
|
}
|
|
11307
11657
|
/**
|
|
@@ -11338,9 +11688,11 @@ async function readDetailStateRow(conversationId, viewer) {
|
|
|
11338
11688
|
pinnedAt: juniorConversationParticipants.pinnedAt,
|
|
11339
11689
|
pinPosition: juniorConversationParticipants.pinPosition,
|
|
11340
11690
|
rootConversationId,
|
|
11691
|
+
spaceId: juniorSpaces.id,
|
|
11692
|
+
spaceName: juniorSpaces.name,
|
|
11341
11693
|
unsubscribedAt: juniorConversationParticipants.unsubscribedAt,
|
|
11342
11694
|
version: sql`(${conversationVersionQuery(db, conversationId, viewer?.id)})`
|
|
11343
|
-
}).from(juniorConversations).leftJoin(juniorDestinations, conversationRecordJoins.location).leftJoin(juniorIdentities, conversationRecordJoins.identity).leftJoin(juniorUsers, conversationRecordJoins.user).leftJoin(forkSource, eq(forkSource.conversationId, juniorConversations.forkedFromConversationId)).leftJoin(juniorConversationParticipants, viewerParticipant).leftJoin(detailViewer, viewer ? eq(detailViewer.id, viewer.id) : sql`false`).where(eq(juniorConversations.conversationId, conversationId));
|
|
11695
|
+
}).from(juniorConversations).leftJoin(juniorDestinations, conversationRecordJoins.location).leftJoin(juniorIdentities, conversationRecordJoins.identity).leftJoin(juniorUsers, conversationRecordJoins.user).leftJoin(forkSource, eq(forkSource.conversationId, juniorConversations.forkedFromConversationId)).leftJoin(spaceRoot, eq(spaceRoot.conversationId, rootConversationId)).leftJoin(juniorSpaces, eq(juniorSpaces.id, spaceRoot.spaceId)).leftJoin(juniorConversationParticipants, viewerParticipant).leftJoin(detailViewer, viewer ? eq(detailViewer.id, viewer.id) : sql`false`).where(eq(juniorConversations.conversationId, conversationId));
|
|
11344
11696
|
return row;
|
|
11345
11697
|
}
|
|
11346
11698
|
async function readDetailState(conversationId, viewer, readAccess) {
|
|
@@ -11372,6 +11724,10 @@ async function readDetailState(conversationId, viewer, readAccess) {
|
|
|
11372
11724
|
...viewer ? { autoArchive: row?.autoArchive ?? row?.autoArchiveDefault ?? false } : void 0,
|
|
11373
11725
|
forks,
|
|
11374
11726
|
...row?.lastReadSeq != null ? { readPosition: { lastReadSeq: row.lastReadSeq } } : void 0,
|
|
11727
|
+
space: row?.spaceId && row.spaceName && (!access?.privateSpaceId || access.canViewPrivateContent) ? {
|
|
11728
|
+
id: row.spaceId,
|
|
11729
|
+
name: row.spaceName
|
|
11730
|
+
} : null,
|
|
11375
11731
|
...viewer ? { subscribed: !row?.unsubscribedAt } : void 0,
|
|
11376
11732
|
transcriptVersion,
|
|
11377
11733
|
...viewerMarks ? { viewerMarks } : void 0
|
|
@@ -11415,6 +11771,7 @@ async function readConversationDetailEtag(conversationId, options) {
|
|
|
11415
11771
|
forks: state.forks,
|
|
11416
11772
|
junior: JUNIOR_VERSION,
|
|
11417
11773
|
limit: options.limit ?? null,
|
|
11774
|
+
space: state.space,
|
|
11418
11775
|
subscribed: state.subscribed ?? null,
|
|
11419
11776
|
version,
|
|
11420
11777
|
viewerMarks: state.viewerMarks ?? null
|
|
@@ -11806,6 +12163,7 @@ function projectConversationDetail(args) {
|
|
|
11806
12163
|
durationMs: args.durationMs,
|
|
11807
12164
|
firstHumanMessageText: args.firstHumanMessageText,
|
|
11808
12165
|
...args.locationId ? { locationId: args.locationId } : void 0,
|
|
12166
|
+
space: args.space,
|
|
11809
12167
|
status: args.status,
|
|
11810
12168
|
...args.teamDomainByTeamId ? { teamDomainByTeamId: args.teamDomainByTeamId } : void 0,
|
|
11811
12169
|
usage: args.usage
|
|
@@ -11937,6 +12295,7 @@ async function readConversationDetailFromSql(conversationId, options) {
|
|
|
11937
12295
|
transcript: state.transcriptVersion
|
|
11938
12296
|
}) },
|
|
11939
12297
|
...state.viewerMarks,
|
|
12298
|
+
space: state.space,
|
|
11940
12299
|
automationTitle: automationTitleByConversation.get(conversationId),
|
|
11941
12300
|
annotations,
|
|
11942
12301
|
sidebarAnnotations,
|
|
@@ -11990,8 +12349,8 @@ async function readConversationDetail(conversationId, options = {}) {
|
|
|
11990
12349
|
}
|
|
11991
12350
|
// src/chat/conversations/sql/listed.ts
|
|
11992
12351
|
/**
|
|
11993
|
-
* Match Conversations that are not a Lead.
|
|
11994
|
-
*
|
|
12352
|
+
* Match Conversations that are not a Lead. Its Space's page opens the Lead,
|
|
12353
|
+
* so lists leave it out. Older rows have no kind.
|
|
11995
12354
|
*/
|
|
11996
12355
|
function notLeadConversation() {
|
|
11997
12356
|
return or(isNull(juniorConversations.kind), ne(juniorConversations.kind, "lead"));
|
|
@@ -12090,6 +12449,59 @@ function nestFeedThreads(records, tree, accessByRoot) {
|
|
|
12090
12449
|
}]];
|
|
12091
12450
|
}));
|
|
12092
12451
|
}
|
|
12452
|
+
// src/chat/inbox-items/waiting.ts
|
|
12453
|
+
const waitingRootId = sql`coalesce(${juniorConversations.rootConversationId}, ${juniorInboxItemConversations.conversationId})`.as("waiting_root_id");
|
|
12454
|
+
const waitingTodoRootId = sql`coalesce(${juniorConversations.rootConversationId}, ${juniorInboxItems.ownerId})`.as("waiting_root_id");
|
|
12455
|
+
/** Open items that need the User now, with the root where each one waits. */
|
|
12456
|
+
function waitingItemsQuery(db, userId) {
|
|
12457
|
+
const columns = {
|
|
12458
|
+
createdAt: juniorInboxItems.createdAt,
|
|
12459
|
+
dedupeKey: juniorInboxItems.dedupeKey,
|
|
12460
|
+
itemId: juniorInboxItems.id,
|
|
12461
|
+
title: juniorInboxItems.title
|
|
12462
|
+
};
|
|
12463
|
+
return db.select({
|
|
12464
|
+
conversationId: waitingRootId,
|
|
12465
|
+
...columns
|
|
12466
|
+
}).from(juniorInboxItemConversations).innerJoin(juniorInboxItems, eq(juniorInboxItems.id, juniorInboxItemConversations.itemId)).leftJoin(juniorConversations, eq(juniorConversations.conversationId, juniorInboxItemConversations.conversationId)).where(inboxItemNeedsUserNow(userId)).union(db.select({
|
|
12467
|
+
conversationId: waitingTodoRootId,
|
|
12468
|
+
...columns
|
|
12469
|
+
}).from(juniorInboxItems).leftJoin(juniorConversations, eq(juniorConversations.conversationId, juniorInboxItems.ownerId)).where(and(inboxItemNeedsUserNow(userId), eq(juniorInboxItems.ownerKind, "conversation"), like(juniorInboxItems.dedupeKey, `${TODO_INBOX_ITEM_KEY_PREFIX}%`))));
|
|
12470
|
+
}
|
|
12471
|
+
/**
|
|
12472
|
+
* Return a query for the ids of the root Conversations that wait on a User,
|
|
12473
|
+
* as `listWaitingConversations` lists them, to filter another query by.
|
|
12474
|
+
*/
|
|
12475
|
+
function waitingConversationIdsQuery(db, userId) {
|
|
12476
|
+
const items = waitingItemsQuery(db, userId).as("waiting_items");
|
|
12477
|
+
return db.select({ conversationId: items.conversationId }).from(items);
|
|
12478
|
+
}
|
|
12479
|
+
/**
|
|
12480
|
+
* List the root Conversations that wait on a User: each root or one of its
|
|
12481
|
+
* child conversations is linked to, or owns a To-do's, open item that needs
|
|
12482
|
+
* the User now (`inboxItemNeedsUserNow`), so a snoozed item leaves it out.
|
|
12483
|
+
*/
|
|
12484
|
+
async function listWaitingConversations(db, userId) {
|
|
12485
|
+
const rows = (await waitingItemsQuery(db, userId)).sort((left, right) => right.createdAt.getTime() - left.createdAt.getTime() || right.itemId.localeCompare(left.itemId));
|
|
12486
|
+
const waiting = /* @__PURE__ */ new Map();
|
|
12487
|
+
for (const row of rows) {
|
|
12488
|
+
const plugin = inboxItemPlugin(row.dedupeKey);
|
|
12489
|
+
const item = {
|
|
12490
|
+
title: row.title,
|
|
12491
|
+
...plugin ? { plugin } : void 0
|
|
12492
|
+
};
|
|
12493
|
+
const current = waiting.get(row.conversationId);
|
|
12494
|
+
if (current) {
|
|
12495
|
+
current.items.push(item);
|
|
12496
|
+
current.waitingSince = row.createdAt.toISOString();
|
|
12497
|
+
} else waiting.set(row.conversationId, {
|
|
12498
|
+
conversationId: row.conversationId,
|
|
12499
|
+
items: [item],
|
|
12500
|
+
waitingSince: row.createdAt.toISOString()
|
|
12501
|
+
});
|
|
12502
|
+
}
|
|
12503
|
+
return [...waiting.values()].sort((left, right) => left.conversationId.localeCompare(right.conversationId));
|
|
12504
|
+
}
|
|
12093
12505
|
// src/api/conversations/priority.ts
|
|
12094
12506
|
/** Conversations with no known work leave Priority after this idle window. */
|
|
12095
12507
|
const UNASSIGNED_PRIORITY_WINDOW_MS = 108e5;
|
|
@@ -12296,7 +12708,7 @@ function feedMember(filter) {
|
|
|
12296
12708
|
function conversationFeedMembershipFilter(status, filter) {
|
|
12297
12709
|
if (!filter) return status === "archived" ? sql`false` : void 0;
|
|
12298
12710
|
const member = feedMember(filter);
|
|
12299
|
-
return and(conversationIsMemberRoot(member), status === "archived" ? isNotNull(juniorConversations.archivedAt) : status === "all" ? void 0 : and(isNull(juniorConversations.archivedAt), conversationIsNotUnsubscribedRoot(member)));
|
|
12711
|
+
return and(conversationIsMemberRoot(member), rootSpaceReadableBy(member), status === "archived" ? isNotNull(juniorConversations.archivedAt) : status === "all" ? void 0 : and(isNull(juniorConversations.archivedAt), conversationIsNotUnsubscribedRoot(member)));
|
|
12300
12712
|
}
|
|
12301
12713
|
/**
|
|
12302
12714
|
* Keep root conversations linked to one code repository. A code change can
|
|
@@ -12314,7 +12726,14 @@ function conversationCodeRepositoryFilter(repositoryId, viewerUserId) {
|
|
|
12314
12726
|
)
|
|
12315
12727
|
)`, rootVisibleToViewer(viewerUserId));
|
|
12316
12728
|
}
|
|
12317
|
-
|
|
12729
|
+
/**
|
|
12730
|
+
* Keep the roots of one Space with the status that the viewer may find. A
|
|
12731
|
+
* private Space shows its roots only to its members.
|
|
12732
|
+
*/
|
|
12733
|
+
function conversationSpaceFilter(spaceId, status, viewerUserId) {
|
|
12734
|
+
return and(eq(juniorConversations.spaceId, spaceId), status === "archived" ? isNotNull(juniorConversations.archivedAt) : status === "active" ? isNull(juniorConversations.archivedAt) : void 0, rootVisibleToViewer(viewerUserId));
|
|
12735
|
+
}
|
|
12736
|
+
async function conversationRows(db, { codeRepository, conversationIds, cursor, filter, include = [], includePrivateMatches = false, limit, pinnedForUserId, query, space, status, waitingForUserId }) {
|
|
12318
12737
|
const rows = db.select({
|
|
12319
12738
|
...conversationRecordColumns(),
|
|
12320
12739
|
activityCursor: sql`to_char(${juniorConversations.lastActivityAt} at time zone 'UTC', 'YYYY-MM-DD"T"HH24:MI:SS.US"Z"')`,
|
|
@@ -12324,7 +12743,7 @@ async function conversationRows(db, { codeRepository, conversationIds, cursor, f
|
|
|
12324
12743
|
links: include.includes("links") ? feedLinksSql(db) : sql`null`,
|
|
12325
12744
|
media: include.includes("media") ? feedMediaSql(db) : sql`null`,
|
|
12326
12745
|
viewerAnswer: filter?.kind === "viewer" ? feedViewerAnswerSql(db, filter.userId) : sql`null`
|
|
12327
|
-
}).from(juniorConversations).leftJoin(juniorDestinations, conversationRecordJoins.location).leftJoin(juniorIdentities, conversationRecordJoins.identity).leftJoin(juniorUsers, conversationRecordJoins.user).where(and(listedConversation(), conversationFeedMembershipFilter(status, filter), conversationIds ? inArray(juniorConversations.conversationId, conversationIds) : void 0, waitingForUserId ? inArray(juniorConversations.conversationId, waitingConversationIdsQuery(db, waitingForUserId)) : void 0, pinnedForUserId ? pinnedForUserId.pinned ? conversationPinnedForUser(pinnedForUserId.userId) : not(conversationPinnedForUser(pinnedForUserId.userId)) : void 0, cursor ? sql`(${juniorConversations.lastActivityAt} < ${cursor.at}::timestamptz or (${juniorConversations.lastActivityAt} = ${cursor.at}::timestamptz and ${juniorConversations.conversationId} > ${cursor.conversationId}))` : void 0, codeRepository ? conversationCodeRepositoryFilter(codeRepository.id, codeRepository.viewerUserId) : void 0, query ? or(sql`strpos(lower(coalesce(${juniorConversations.title}, '')), ${query}) > 0`, and(includePrivateMatches ? void 0 : eq(juniorDestinations.visibility, "public"), sql`${conversationSearchVector} @@ websearch_to_tsquery('english', ${query})`), annotationMatch(db, query, includePrivateMatches)) : void 0)).orderBy(desc(juniorConversations.lastActivityAt), asc(juniorConversations.conversationId)).$dynamic();
|
|
12746
|
+
}).from(juniorConversations).leftJoin(juniorDestinations, conversationRecordJoins.location).leftJoin(juniorIdentities, conversationRecordJoins.identity).leftJoin(juniorUsers, conversationRecordJoins.user).where(and(listedConversation(), space ? conversationSpaceFilter(space.id, status, space.viewerUserId) : conversationFeedMembershipFilter(status, filter), conversationIds ? inArray(juniorConversations.conversationId, conversationIds) : void 0, waitingForUserId ? inArray(juniorConversations.conversationId, waitingConversationIdsQuery(db, waitingForUserId)) : void 0, pinnedForUserId ? pinnedForUserId.pinned ? conversationPinnedForUser(pinnedForUserId.userId) : not(conversationPinnedForUser(pinnedForUserId.userId)) : void 0, cursor ? sql`(${juniorConversations.lastActivityAt} < ${cursor.at}::timestamptz or (${juniorConversations.lastActivityAt} = ${cursor.at}::timestamptz and ${juniorConversations.conversationId} > ${cursor.conversationId}))` : void 0, codeRepository ? conversationCodeRepositoryFilter(codeRepository.id, codeRepository.viewerUserId) : void 0, query ? or(sql`strpos(lower(coalesce(${juniorConversations.title}, '')), ${query}) > 0`, and(includePrivateMatches ? void 0 : eq(juniorDestinations.visibility, "public"), sql`${conversationSearchVector} @@ websearch_to_tsquery('english', ${query})`), annotationMatch(db, query, includePrivateMatches)) : void 0)).orderBy(desc(juniorConversations.lastActivityAt), asc(juniorConversations.conversationId)).$dynamic();
|
|
12328
12747
|
return limit === void 0 ? rows : rows.limit(limit);
|
|
12329
12748
|
}
|
|
12330
12749
|
const searchAnnotated = alias(juniorConversations, "search_annotated");
|
|
@@ -12359,36 +12778,47 @@ const feedAnnotated = alias(juniorConversations, "feed_annotated");
|
|
|
12359
12778
|
* for each feed-row input as `name:token`, separated by spaces, so the
|
|
12360
12779
|
* dashboard can record which inputs moved it.
|
|
12361
12780
|
*
|
|
12362
|
-
*
|
|
12363
|
-
*
|
|
12364
|
-
*
|
|
12365
|
-
*
|
|
12366
|
-
*
|
|
12367
|
-
*
|
|
12368
|
-
*
|
|
12369
|
-
*
|
|
12370
|
-
*
|
|
12371
|
-
*
|
|
12781
|
+
* Status and tree state come from stored watermarks, not from the rules
|
|
12782
|
+
* that derive them, so a poll reads no Events or read positions.
|
|
12783
|
+
* Each write that a status or the tree state reads moves `detail_version` on
|
|
12784
|
+
* its Conversation, so the token holds that version for each idle row and
|
|
12785
|
+
* tree member. Every Event of a live Turn moves it too, and a running row
|
|
12786
|
+
* shows its running state, so a running Conversation adds only that it runs
|
|
12787
|
+
* and the open Inbox items that it added. The end of the Turn writes
|
|
12788
|
+
* the row. Watches and Timers live outside SQL. A Turn makes or cancels one,
|
|
12789
|
+
* and the end of that Turn moves the version, so a read after it sees the
|
|
12790
|
+
* change. A Watch that expires on its own moves nothing, so its row shows
|
|
12791
|
+
* `watching` until the feed reads again. An authorization request expires
|
|
12792
|
+
* with no write, so the token counts the live ones.
|
|
12793
|
+
* Idle rows show an age in whole minutes, so the token holds that minute.
|
|
12372
12794
|
* The rows are in feed order, so a move that reorders them moves the token.
|
|
12373
|
-
* The newest Message of each role stands for the preview and participants
|
|
12374
|
-
*
|
|
12375
|
-
* the
|
|
12795
|
+
* The newest Message of each role stands for the preview and participants,
|
|
12796
|
+
* and moves the token during a live Turn. Waiting roots outside the page,
|
|
12797
|
+
* and the viewer's own Inbox items, move the Inbox items token.
|
|
12376
12798
|
*/
|
|
12377
12799
|
function conversationFeedVersionQuery(db, userId) {
|
|
12378
12800
|
const pin = juniorConversationParticipants;
|
|
12379
12801
|
const conversationId = juniorConversations.conversationId;
|
|
12802
|
+
const ownedItemsVersion = (conversation) => sql`(select concat(count(*), '/', max(${juniorInboxItems.updatedAt})) from ${juniorInboxItems} where ${and(inboxItemOwnedByConversation(conversation), inboxItemNeedsInput())})`;
|
|
12803
|
+
const rowState = (row) => sql`case
|
|
12804
|
+
when ${conversationIsActiveSql(row)}
|
|
12805
|
+
then concat('active:', ${ownedItemsVersion(row.conversationId)})
|
|
12806
|
+
else ${row.detailVersion}::text
|
|
12807
|
+
end`;
|
|
12808
|
+
const child = sql`${feedTree.conversationId} <> ${conversationId}`;
|
|
12809
|
+
const active = conversationIsActiveSql(feedTree);
|
|
12380
12810
|
const tree = db.select({ version: sql`concat_ws(':',
|
|
12381
|
-
count(*)
|
|
12382
|
-
|
|
12383
|
-
|
|
12384
|
-
|
|
12385
|
-
|
|
12386
|
-
|
|
12387
|
-
|
|
12388
|
-
|
|
12389
|
-
|
|
12390
|
-
|
|
12391
|
-
)
|
|
12811
|
+
count(*),
|
|
12812
|
+
sum(${feedTree.detailVersion}) filter (where ${child} and not ${active}),
|
|
12813
|
+
count(*) filter (where ${child} and ${active}),
|
|
12814
|
+
md5(string_agg(${ownedItemsVersion(feedTree.conversationId)}, ',' order by ${feedTree.conversationId}) filter (
|
|
12815
|
+
where ${child} and ${active}
|
|
12816
|
+
)),
|
|
12817
|
+
count(*) filter (where ${child} and ${active} and ${feedTree.archivedAt} is not null),
|
|
12818
|
+
md5(string_agg(${feedTree.title}, ',' order by ${feedTree.conversationId}) filter (
|
|
12819
|
+
where ${child} and ${active} and ${feedTree.kind} = 'thread'
|
|
12820
|
+
)),
|
|
12821
|
+
count(*) filter (where ${hasUnexpiredAuthorizationRequest(feedTree.conversationId)})
|
|
12392
12822
|
)` }).from(feedTree).where(or(eq(feedTree.conversationId, conversationId), eq(feedTree.rootConversationId, conversationId)));
|
|
12393
12823
|
const annotations = db.select({ version: sql`concat_ws(':', count(*), max(${juniorConversationAnnotations.updatedAt}))` }).from(juniorConversationAnnotations).innerJoin(feedAnnotated, eq(feedAnnotated.conversationId, juniorConversationAnnotations.conversationId)).where(eq(feedAnnotated.rootConversationId, conversationId));
|
|
12394
12824
|
const page = db.select({
|
|
@@ -12397,8 +12827,7 @@ function conversationFeedVersionQuery(db, userId) {
|
|
|
12397
12827
|
lastActivityAt: juniorConversations.lastActivityAt,
|
|
12398
12828
|
pinnedAt: pin.pinnedAt,
|
|
12399
12829
|
pinPosition: pin.pinPosition,
|
|
12400
|
-
|
|
12401
|
-
waitsOnViewer: conversationWaitsOnUserSql(juniorConversations, userId).as("waits_on_viewer"),
|
|
12830
|
+
state: rowState(juniorConversations).as("state"),
|
|
12402
12831
|
title: juniorConversations.title,
|
|
12403
12832
|
activity: shownActivityMinute(juniorConversations.executionStatus, juniorConversations.lastActivityAt).as("activity"),
|
|
12404
12833
|
assistantSeq: sql`(${latestMessageSeqQuery(db, "assistant", conversationId)})`.as("assistant_seq"),
|
|
@@ -12414,7 +12843,7 @@ function conversationFeedVersionQuery(db, userId) {
|
|
|
12414
12843
|
order: sql`string_agg(${page.conversationId}, ',' order by ${page.pinnedAt} is not null desc, ${page.lastActivityAt} desc, ${page.conversationId})`,
|
|
12415
12844
|
pin: byRow(page.pinnedAt, page.pinPosition),
|
|
12416
12845
|
title: byRow(page.title, page.channelName),
|
|
12417
|
-
status: byRow(page.
|
|
12846
|
+
status: byRow(page.state),
|
|
12418
12847
|
activity: byRow(page.activity),
|
|
12419
12848
|
messages: byRow(page.assistantSeq, page.userSeq),
|
|
12420
12849
|
threads: byRow(page.threads),
|
|
@@ -12449,7 +12878,7 @@ function conversationFeedFilter(options) {
|
|
|
12449
12878
|
async function readConversationFeedFromSql(options = {}) {
|
|
12450
12879
|
const nowMs = Date.now();
|
|
12451
12880
|
const db = getDb();
|
|
12452
|
-
const filter = options.codeRepositoryId ? void 0 : conversationFeedFilter(options);
|
|
12881
|
+
const filter = options.codeRepositoryId || options.spaceId ? void 0 : conversationFeedFilter(options);
|
|
12453
12882
|
const query = options.q?.trim().toLowerCase() || void 0;
|
|
12454
12883
|
const status = query || options.codeRepositoryId ? "all" : options.status ?? "active";
|
|
12455
12884
|
const cursor = options.cursor ? decodeConversationFeedCursor(options.cursor) : void 0;
|
|
@@ -12461,6 +12890,10 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
12461
12890
|
id: options.codeRepositoryId,
|
|
12462
12891
|
...options.viewer ? { viewerUserId: options.viewer.id } : void 0
|
|
12463
12892
|
} } : void 0,
|
|
12893
|
+
...options.spaceId ? { space: {
|
|
12894
|
+
id: options.spaceId,
|
|
12895
|
+
...options.viewer ? { viewerUserId: options.viewer.id } : void 0
|
|
12896
|
+
} } : void 0,
|
|
12464
12897
|
filter,
|
|
12465
12898
|
include,
|
|
12466
12899
|
includePrivateMatches: filter?.kind === "viewer",
|
|
@@ -12513,7 +12946,7 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
12513
12946
|
const conversations = rows.map((row) => conversationFromRecordRow(row));
|
|
12514
12947
|
const conversationIds = conversations.map((conversation) => conversation.conversationId);
|
|
12515
12948
|
const conversationTrees = readConversationTrees(db, conversationIds);
|
|
12516
|
-
const [accessRows, tree, participantsByRoot, annotationsByConversation, auxiliaryCostsByRoot, metricsByRoot, participantsByConversation, teamDomainByTeamId, { work: conversationWork, lastUserMessageAt: lastUserMessageAtByConversation }, activityPreviewByConversation, automationTitleByConversation, firstHumanMessageTextByConversation, treeStateByConversation, threadRecords] = await Promise.all([
|
|
12949
|
+
const [accessRows, tree, participantsByRoot, annotationsByConversation, auxiliaryCostsByRoot, metricsByRoot, participantsByConversation, teamDomainByTeamId, { work: conversationWork, lastUserMessageAt: lastUserMessageAtByConversation }, activityPreviewByConversation, automationTitleByConversation, firstHumanMessageTextByConversation, treeStateByConversation, threadRecords, spaceRefs] = await Promise.all([
|
|
12517
12950
|
readConversationAccessRows(db, conversationIds),
|
|
12518
12951
|
conversationTrees,
|
|
12519
12952
|
readMemberParticipants(db, conversationIds, options.viewer ? { userId: options.viewer.id } : filter ? feedMember(filter) : void 0),
|
|
@@ -12530,11 +12963,14 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
12530
12963
|
readAutomationTitlesByConversationId(conversations),
|
|
12531
12964
|
readFirstHumanMessageTexts(db, conversations),
|
|
12532
12965
|
readConversationTreeStates(db, conversationIds, options.viewer?.id),
|
|
12533
|
-
readFeedThreadRecords(db, conversations.filter((conversation) => conversation.archivedAtMs === void 0).map(({ conversationId }) => conversationId))
|
|
12966
|
+
readFeedThreadRecords(db, conversations.filter((conversation) => conversation.archivedAtMs === void 0).map(({ conversationId }) => conversationId)),
|
|
12967
|
+
readSpaceRefs(db, conversations.flatMap(({ spaceId }) => spaceId ? [spaceId] : []))
|
|
12534
12968
|
]);
|
|
12535
|
-
const
|
|
12969
|
+
const memberSpaceIds = options.viewer ? await readPrivateSpaceMemberships(db, accessRows, options.viewer.id) : /* @__PURE__ */ new Set();
|
|
12970
|
+
const accessByConversation = conversationAccessFromRows(accessRows, options.viewer ? new Set(participantsByRoot.keys()) : /* @__PURE__ */ new Set(), memberSpaceIds);
|
|
12536
12971
|
const tenantByConversation = new Map(rows.flatMap((row) => {
|
|
12537
12972
|
const tenantId = conversationSlackTenantId({
|
|
12973
|
+
provider: row.location?.provider,
|
|
12538
12974
|
providerTenantId: row.location?.providerTenantId,
|
|
12539
12975
|
sessionSource: row.conversation.sessionSource
|
|
12540
12976
|
});
|
|
@@ -12558,6 +12994,7 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
12558
12994
|
automationTitle: automationTitleByConversation.get(conversation.conversationId),
|
|
12559
12995
|
conversation,
|
|
12560
12996
|
access,
|
|
12997
|
+
space: conversation.spaceId && (!access?.privateSpaceId || access.canViewPrivateContent) ? spaceRefs.get(conversation.spaceId) ?? null : null,
|
|
12561
12998
|
auxiliaryCosts: auxiliaryCosts?.total,
|
|
12562
12999
|
...childAgentTotals ? { childAgentTotals } : void 0,
|
|
12563
13000
|
durationMs: metrics?.durationMs ?? row.conversation.durationMs,
|
|
@@ -12621,4 +13058,4 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
12621
13058
|
async function readConversationFeed(options = {}) {
|
|
12622
13059
|
return readConversationFeedFromSql(options);
|
|
12623
13060
|
}
|
|
12624
|
-
export {
|
|
13061
|
+
export { readInboxItemForUser as $, createViewerMcp as $t, setConversationSubscriptionOperation as A, createProductionSlackWebhookServices as At, mcpCursorSchema as B, recordSkippedConversationMessage as Bt, archiveDoneConversationsOperation as C, resolveObjectLinkNow as Ct, renameConversationOperation as D, isPublicAddress as Dt, pinConversationOperation as E, guardedFetch as Et, mcpAcceptedMessageSchema as F, normalizeIncomingSlackThreadId as Ft, mcpPendingMessagesSchema as G, parseContent as Gt, mcpMessageSchema as H, bindMessageAuthorIdentityId as Ht, mcpAuthorizationSchema as I, withNormalizedThreadId as It, requireConversationPendingMessages as J, resolvePersonLink as Jt, readMcpPendingWork as K, SubscribedReplyReason as Kt, mcpConversation as L, AGENT_DISPATCH_MAX_AGE_MS as Lt, setSpaceArchive as M, buildSlackInboundMessage as Mt, reorderPinnedConversations as N, clearSlackPendingReactions as Nt, setConversationAutoArchiveOperation as O, publicAddressLookup as Ot, apiOperationHandler as P, slackInboundMessageId as Pt, closeInboxItemsAnsweredByReply as Q, readFirstHumanMessageTexts as Qt, mcpConversationIdSchema as R, enqueueAgentDispatch as Rt, archiveConversationOperation as S, readObjectLinkTypes as St, conversationOperations as T, viewerCanViewPluginLink as Tt, mcpMessageTextSchema as U, startProcessingReaction as Ut, mcpIdempotencyKeySchema as V, createSlackWebApiStatusSender as Vt, mcpMessages as W, stripLeadingBotMention as Wt, InboxItemActionError as X, readConversationRecordFromSql as Xt, resolveMentions as Y, conversationRecordJoins as Yt, actOnInboxItem as Z, conversationSummaryFromStoredConversation as Zt, appendConversationMessageForViewer as _, backfillCacheWarmingGaps as _t, listWaitingConversations as a, readUserSettings as at, decodeConversationCursor as b, OBJECT_LINK_TTL_MS as bt, readConversationDetail as c, settleEventAutomationRuns as ct, readConversationTreeMetricsFromSql as d, getScheduledAutomationDispatch as dt, IMAGE_WIDTHS as en, reviewItemChange as et, conversationVersionsQuery as f, runInboxSnoozeTimers as ft, readConversationEvents as g, startSavingsRefill as gt, keepQuickQuestionForViewer as h, runSavingsRefillSlice as ht, encodePageCursor as i, DEFAULT_USER_SETTINGS as it, stopConversationOperation as j, getProductionSlackAdapter as jt, setConversationSpaceOperation as k, createProductionConversationWorkOptions as kt, readConversationAuxiliaryCostsFromSql as l, createHeartbeatContext as lt, forkConversationForViewer as m, readSavingsRefill as mt, readConversationFeed as n, ingestEventAutomations as nt, listedConversation as o, updateUserSettings as ot, readConversationDetailEtag as p, scheduleInboxSnoozeTimer as pt, readMcpPendingWorkAfterSend as q, getThreadStopDecision as qt, decodePageCursor as r, runAutoArchiveSweep as rt, notLeadConversation as s, automationReplyAttribution as st, conversationFeedVersionQuery as t, decodeImageId as tn, createEventAppPublisher as tt, childAgentTotalsReport as u, dispatchScheduledAutomation as ut, createConversationForViewer as v, GET as vt, cancelQueuedMessagesOperation as w, resolveObjectLinks as wt, encodeConversationCursor as x, readLinkObjectType as xt, requireWebMessageConversation as y, readHealthReport as yt, mcpConversationSchema as z, failStoppedDispatch as zt };
|