@sentry/junior 0.314.0 → 0.315.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{channel-access-BOL29BG3.js → adapter-context-BlSGE44V.js} +42 -3
- package/dist/{admin-BXGAySz0.js → admin-5jUYY46p.js} +1 -1
- package/dist/agent-runner-C7GNLRB6.js +23438 -0
- package/dist/agent-update-delivery-BNEYQsAf.js +149 -0
- package/dist/api/schema.d.ts +9500 -2
- package/dist/api/schema.js +4 -6
- package/dist/api.d.ts +2 -3
- package/dist/api.js +850 -283
- package/dist/{app-D7tKnw9a.d.ts → app-D_bAXRDe.d.ts} +310 -29
- package/dist/app.d.ts +1 -1
- package/dist/app.js +260 -50
- package/dist/change-record-Bqsa5ZXE.d.ts +175 -0
- package/dist/chat-core-engine-CxkwRpn9.js +123 -0
- package/dist/cli/chat.d.ts +4 -1
- package/dist/cli/chat.js +39 -21
- package/dist/cli/check.js +4 -4
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +3 -4
- package/dist/cli/run.d.ts +1 -1
- package/dist/cli/run.js +1 -1
- package/dist/cli/snapshot-create.js +2 -5
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +48 -96
- package/dist/{continue-in-slack-fnmD2Ifb.js → continue-in-slack-BGKjIdFp.js} +3 -5
- package/dist/{conversation-feed-DdFQuQDR.js → conversation-feed-Sl8lKKmR.js} +22 -2
- package/dist/{conversation-turn-DScuDYmN.js → conversation-turn-BoLK9i6g.js} +149 -103
- package/dist/{create-CrNt4Ewu.js → create-BOycVH9h.js} +5 -4
- package/dist/{credential-sync-CtqsGjj1.js → credential-sync-Mn4OdkEh.js} +10 -15
- package/dist/db-BpxcYXfD.d.ts +2 -0
- package/dist/{credentialed-dWRA3-oJ.js → db-DXTOYRzR.js} +21687 -9285
- package/dist/deployment-CG3TchWh.js +51 -0
- package/dist/direct-url-BYgYfuIy.js +22 -0
- package/dist/engine-context-dyWlfNdD.js +1817 -0
- package/dist/{html-B8rBt7F4.js → html-CfXEwl_h.js} +2 -5
- package/dist/instrumentation.js +2 -2
- package/dist/job-runner-CySgpi9v.js +1131 -0
- package/dist/{lineage-EULJkGO1.js → lineage-tRTOcrsL.js} +1 -1
- package/dist/{list-C5400AlJ.js → list-DXBz8SYL.js} +411 -132
- package/dist/local-server-CpnGhYml.js +276 -0
- package/dist/{conversation-privacy-DtZhI91r.js → logging-czs0nqLC.js} +2 -231
- package/dist/{mailbox-turn-DL3Lvsm0.js → mailbox-turn-79Nv1JXv.js} +1922 -2439
- package/dist/markers-CE0HMXWT.js +67 -0
- package/dist/{media-FYM-Bl3H.js → media-Cr9pGkzr.js} +670 -35
- package/dist/{message-DuDelZFr.js → message-BTox2Cmb.js} +18 -16
- package/dist/{model-input-0osF3pBS.js → model-input-IRGa98V7.js} +3 -3
- package/dist/nitro.d.ts +7 -1
- package/dist/nitro.js +48 -293
- package/dist/{oauth-callback-server-DX2fQ7Nq.js → oauth-callback-server-NXK7AlBp.js} +2 -2
- package/dist/{oauth-relay-PwPMdZJv.js → oauth-relay-6NBPSpFE.js} +1 -1
- package/dist/{package-discovery-DD9vencX.js → package-discovery-BI6T_RkD.js} +50 -1
- package/dist/{markers-DUP8aBOp.js → parent-result-Dg6P6roR.js} +71 -71
- package/dist/people-Cegp1Iwq.js +81 -0
- package/dist/proxy-path-Dc-0jXGi.js +203 -0
- package/dist/{resolve-D8CPJcNK.js → resolve-BUFkmxkT.js} +229 -4
- package/dist/{result-D090hxr5.js → result-DfATzX77.js} +79 -144
- package/dist/{runner-BU7fgrm-.js → runner-CmKP3inb.js} +7 -7
- package/dist/{sandbox-egress-signals-BUmVrsoG.js → sandbox-egress-signals-DYo5BsM7.js} +1 -1
- package/dist/{schema-7gW9vBpJ.js → schema-DrBMdPmv.js} +111 -15
- package/dist/{service-account-plA-uzIB.js → service-account-CxTX7nnR.js} +1 -3
- package/dist/{skills-CIosT6bS.js → skills-BlHUDj7k.js} +4 -4
- package/dist/{slack-conversation-unfurl-CBgZqth6.js → slack-conversation-unfurl-Dhe3lB1U.js} +6 -8
- package/dist/{spawn-DRjdzh3R.js → spawn-CfvlFdfz.js} +4 -5
- package/dist/start-conversation-Uh8Sk1EF.js +162 -0
- package/dist/system-prompt-table-CDCYVwqN.js +1169 -0
- package/dist/{task-runner-C-pXsgHM.js → task-runner-DcdQJd9e.js} +71 -17
- package/dist/{thread-context-CDX4dSZd.js → thread-context-DF5uDcWN.js} +5 -6
- package/dist/topic-CRYYBYp-.js +7 -0
- package/dist/transcript-BHhJVY0P.js +410 -0
- package/dist/turn-session-routing-GtetHsdO.js +1309 -0
- package/dist/{turn-wake-Bzq1Efrm.js → turn-wake-um5Ubd4m.js} +5 -7
- package/dist/{validation-bTq88sya.js → validation-CJyuOPD2.js} +1 -1
- package/dist/{version-DGUa1dZK.js → version-Bhe7RPIe.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/virtual-module-BeKA_EII.js +12 -0
- package/dist/{worker-AkZg7Dg1.js → worker-D8PRgUqr.js} +3 -5
- package/migrations/20260711145847_initial/snapshot.json +2103 -0
- package/migrations/20260711145900_conversation_metrics/snapshot.json +135 -0
- package/migrations/20260712153649_conversation_message_search/snapshot.json +50 -0
- package/migrations/20260713040256_peaceful_scalphunter/snapshot.json +42 -0
- package/migrations/20260715174202_useful_magus/snapshot.json +42 -0
- package/migrations/20260715174203_conversation_events/snapshot.json +539 -0
- package/migrations/20260723042835_drop_legacy_conversation_messages/snapshot.json +9 -0
- package/migrations/20260723050612_thick_sugar_man/snapshot.json +120 -0
- package/migrations/20260727223822_sticky_rage/snapshot.json +274 -0
- package/migrations/20260728033158_slippery_harrier/snapshot.json +191 -0
- package/migrations/20260728040836_native_conversation_history/snapshot.json +9 -0
- package/migrations/20260728204900_sour_golden_guardian/snapshot.json +124 -0
- package/migrations/20260730233332_structured_conversation_events/snapshot.json +9 -0
- package/migrations/20260731164038_conversation_session_source/snapshot.json +42 -0
- package/migrations/20260801230336_source_visibility/snapshot.json +9 -0
- package/migrations/20260802023731_magical_ezekiel_stane/snapshot.json +266 -0
- package/migrations/20260804015843_neat_the_anarchist/snapshot.json +714 -0
- package/migrations/20260804165952_drop_paused_scheduled_tasks/snapshot.json +9 -0
- package/migrations/20260804225613_curvy_excalibur/snapshot.json +223 -0
- package/migrations/20260805174033_lowly_valkyrie/snapshot.json +344 -0
- package/migrations/20260805200301_restrict_task_execution_kinds/snapshot.json +36 -0
- package/migrations/20260806030729_first_warhawk/snapshot.json +690 -0
- package/migrations/20260807185200_task_execution_status/snapshot.json +92 -0
- package/migrations/20260808014743_task_title_columns/snapshot.json +68 -0
- package/migrations/20260809220421_misty_typhoid_mary/snapshot.json +191 -0
- package/migrations/20260811193709_mcp_credential_subject/snapshot.json +9 -0
- package/migrations/20260812032924_conversation_event_actor_and_participants/snapshot.json +393 -0
- package/migrations/20260812172418_attachment_storage/snapshot.json +341 -0
- package/migrations/20260813230732_artifacts/snapshot.json +349 -0
- package/migrations/20260814062905_dizzy_barracuda/snapshot.json +342 -0
- package/migrations/20260814231353_drop_workspace_repo_primary/snapshot.json +55 -0
- package/migrations/20260815030100_wild_phantom_reporter/snapshot.json +135 -0
- package/migrations/20260817082233_workspace_snapshots_table/snapshot.json +625 -0
- package/migrations/20260818160339_workspace_snapshot_active_build/snapshot.json +62 -0
- package/migrations/20260821180755_strong_randall/snapshot.json +42 -0
- package/migrations/20260823030308_workspace_snapshot_size_bytes/snapshot.json +62 -0
- package/migrations/20260824190313_complex_rage/snapshot.json +690 -0
- package/migrations/20260827233711_conversation_location/snapshot.json +42 -0
- package/migrations/20260901224306_event_task_status/snapshot.json +100 -0
- package/migrations/20260904153232_attachment_provider/snapshot.json +234 -0
- package/migrations/20260909111415_conversation_briefs/snapshot.json +364 -0
- package/migrations/20260910144928_automation_outcomes_backfill/snapshot.json +9 -0
- package/migrations/20260911184346_conversation_metrics/snapshot.json +226 -0
- package/migrations/20260921140842_scheduled_automation_channel_destinations/snapshot.json +9 -0
- package/migrations/20260922221709_event_automation_channel_destinations/snapshot.json +9 -0
- package/migrations/20261001113455_conversation_forks/snapshot.json +120 -0
- package/migrations/20261005161844_automation_versions/snapshot.json +150 -0
- package/migrations/20261006152043_user_timezone/snapshot.json +37 -0
- package/migrations/20261008200858_user_admin/snapshot.json +37 -0
- package/migrations/20261009145407_event_automation_status_reason/snapshot.json +42 -0
- package/migrations/20261013160816_agent_invocation_parent_mailbox/snapshot.json +93 -0
- package/migrations/20261013215020_agent_invocation_parent_tool_call/snapshot.json +42 -0
- package/migrations/20261014011138_agent_invocation_title/snapshot.json +42 -0
- package/migrations/20261014211942_conversation_stopped_at/snapshot.json +42 -0
- package/migrations/20261015012820_flowery_rage/snapshot.json +42 -0
- package/migrations/20261017000924_automations/snapshot.json +790 -0
- package/migrations/20261017134736_automation_runs/snapshot.json +474 -0
- package/migrations/20261017170250_drop_legacy_automation_tables/snapshot.json +397 -0
- package/migrations/20261018134754_automation_creator_identity/snapshot.json +130 -0
- package/migrations/20261023071954_automation_run_version/snapshot.json +79 -0
- package/migrations/20261025233137_identity_signed_in_at/snapshot.json +42 -0
- package/migrations/20261027234315_workspace_vcpus/snapshot.json +37 -0
- package/migrations/20261028124242_plugin_report_index/snapshot.json +68 -0
- package/migrations/20261028154230_agent_invocation_type/snapshot.json +42 -0
- package/migrations/20261030021803_any_resource_event_triggers/snapshot.json +42 -0
- package/migrations/20261030234309_user_customization/snapshot.json +37 -0
- package/migrations/20261031020656_review_items/snapshot.json +1078 -0
- package/migrations/20261031024151_review_item_dedupe_tenant/snapshot.json +62 -0
- package/migrations/20261031024246_review_item_slack_cards/snapshot.json +159 -0
- package/migrations/20261031155308_system_identity/snapshot.json +9 -0
- package/migrations/20261101193952_review_item_foreign_keys/snapshot.json +108 -0
- package/migrations/20261102172751_review_item_turn/snapshot.json +42 -0
- package/migrations/20261102221411_conversation_read_positions/snapshot.json +190 -0
- package/migrations/20261104085028_conversation_quick_question/snapshot.json +42 -0
- package/migrations/20261104145136_conversation_participant_pins/snapshot.json +42 -0
- package/migrations/20261104164429_conversation_detail_version/snapshot.json +42 -0
- package/migrations/20261104172055_conversation_auto_archive/snapshot.json +206 -0
- package/migrations/20261105005443_drop_agent_invocation_model_profile/snapshot.json +30 -0
- package/migrations/20261105043807_plugin_conversation_index/snapshot.json +76 -0
- package/migrations/20261105051837_conversation_event_author_index/snapshot.json +70 -0
- package/migrations/20261105182854_conversation_event_latest_message_indexes/snapshot.json +136 -0
- package/migrations/20261106011443_conversation_pin_position/snapshot.json +42 -0
- package/migrations/20261106095004_push_notifications/snapshot.json +308 -0
- package/migrations/20261106162740_conversation_kind/snapshot.json +88 -0
- package/migrations/20261107002001_read_position_backfill/snapshot.json +9 -0
- package/migrations/20261107025209_child_archived_at/snapshot.json +42 -0
- package/migrations/20261107035735_shared_archive/snapshot.json +67 -0
- package/migrations/20261107215055_child_location/snapshot.json +9 -0
- package/migrations/20261108191927_conversation_unsubscribe/snapshot.json +42 -0
- package/migrations/20261109021618_conversation_paused_status/snapshot.json +9 -0
- package/migrations/20261109111553_guardian_review_time_index/snapshot.json +54 -0
- package/migrations/20261109173130_conversation_participant_unsubscribed_index/snapshot.json +62 -0
- package/migrations/20261109182006_turn_metric_actor/snapshot.json +128 -0
- package/migrations/20261109202836_participant_root_actor_backfill/snapshot.json +9 -0
- package/migrations/20261109232640_conversation_delivery_paused_at/snapshot.json +42 -0
- package/migrations/20261110120937_web_linked_slack_identity_repair/snapshot.json +9 -0
- package/migrations/20261110175824_automation_task_kind/snapshot.json +145 -0
- package/migrations/20261110210242_conversation_kind_automation/snapshot.json +55 -0
- package/migrations/20261110222632_review_item_plugin_actions/snapshot.json +37 -0
- package/migrations/20261110225157_conversation_last_message_at/snapshot.json +42 -0
- package/migrations/20261111013351_automation_task_kind_repair/snapshot.json +9 -0
- package/migrations/20261111163126_drop_legacy_columns/snapshot.json +9 -0
- package/migrations/20261111170150_code_change_last_activity/snapshot.json +42 -0
- package/migrations/20261111191441_agent_invocation_fork/snapshot.json +42 -0
- package/migrations/20261112142841_code_change_draft/snapshot.json +37 -0
- package/migrations/20261112202901_attachment_uploads/snapshot.json +255 -0
- package/migrations/20261112220407_conversation_agent_config/snapshot.json +42 -0
- package/migrations/20261113081247_attachment_deferred_download/snapshot.json +52 -0
- package/migrations/20261113225551_conversation_embeddings/snapshot.json +203 -0
- package/migrations/20261114213238_user_preferences/snapshot.json +37 -0
- package/migrations/20261114222527_code_change_repository_state_index/snapshot.json +70 -0
- package/migrations/20261115172605_attachment_kinds/snapshot.json +244 -0
- package/migrations/20261115173004_attachment_url_fill/snapshot.json +9 -0
- package/migrations/20261115180216_attachment_url_index/snapshot.json +62 -0
- package/migrations/20261116103700_plan_items/snapshot.json +420 -0
- package/migrations/20261117100100_automation_creator_slack_index/snapshot.json +62 -0
- package/migrations/20261117132522_conversation_event_search/snapshot.json +396 -0
- package/migrations/20261117164007_automation_last_run/snapshot.json +108 -0
- package/migrations/20261117164047_automation_last_run_index/snapshot.json +54 -0
- package/migrations/20261117210444_money_micro_usd/snapshot.json +68 -0
- package/migrations/20261117210505_conversation_cost_micro_usd/snapshot.json +9 -0
- package/migrations/20261118081416_people_list_metric_index/snapshot.json +86 -0
- package/migrations/20261118095216_automation_rollout_repair/snapshot.json +9 -0
- package/migrations/20261118143948_cache_warming_history_reset/snapshot.json +9 -0
- package/migrations/20261119040651_artifact_visibility/snapshot.json +132 -0
- package/migrations/20261119040715_artifact_public_sha_index/snapshot.json +9 -0
- package/migrations/20261119052706_artifact_drop_public/snapshot.json +71 -0
- package/migrations/20261119053831_artifact_path/snapshot.json +114 -0
- package/migrations/20261119053844_artifact_path_index/snapshot.json +9 -0
- package/migrations/20261119091949_review_item_answered_index/snapshot.json +70 -0
- package/migrations/20261119100029_review_item_status_index/snapshot.json +54 -0
- package/migrations/20261119165607_brief_outcome_status/snapshot.json +42 -0
- package/migrations/20261119165622_brief_outcome_status_backfill/snapshot.json +9 -0
- package/migrations/20261119213716_brief_created_at_index/snapshot.json +62 -0
- package/migrations/20261119222456_slack_person_search_index/snapshot.json +50 -0
- package/migrations/20261119225522_code_change_size/snapshot.json +104 -0
- package/migrations/20261119232253_merge_conflict_notice_dismiss/snapshot.json +9 -0
- package/migrations/20261119235649_inbox_snoozes/snapshot.json +605 -0
- package/migrations/20261120093118_code_change_search_index/snapshot.json +89 -0
- package/migrations/20261120093452_review_item_owner/snapshot.json +314 -0
- package/migrations/20261120185654_review_item_owner_index/snapshot.json +62 -0
- package/migrations/20261120185754_memory_core_adoption/snapshot.json +1184 -0
- package/migrations/20261120185854_memory_core_indexes/snapshot.json +70 -0
- package/migrations/20261120235226_todos/snapshot.json +473 -0
- package/migrations/20261121082316_inbox_items/snapshot.json +2026 -0
- package/migrations/20261121175651_todo_changed_by_agent/snapshot.json +42 -0
- package/migrations/20261121183527_inbox_item_subject_title_parts/snapshot.json +42 -0
- package/migrations/20261121194143_inbox_snooze_wake_reason/snapshot.json +42 -0
- package/migrations/20261121222400_authorization_request_index/snapshot.json +62 -0
- package/migrations/20261121225908_conversation_metadata/snapshot.json +184 -0
- package/migrations/20261121225910_conversation_metadata_fill/snapshot.json +9 -0
- package/migrations/20261121225913_conversation_search_index/snapshot.json +50 -0
- package/migrations/20261122022900_inbox_item_legacy_automation_keys/snapshot.json +9 -0
- package/migrations/20261122024454_artifact_expiry/snapshot.json +37 -0
- package/migrations/20261122024455_artifact_permanent_sha_index/snapshot.json +62 -0
- package/migrations/20261122024457_artifact_drop_public_sha_index/snapshot.json +37 -0
- package/migrations/20261122024458_conversation_kind_lead/snapshot.json +55 -0
- package/migrations/20261122024459_conversation_lead_actor_index/snapshot.json +54 -0
- package/migrations/20261122071549_keep_legacy_archive_columns/snapshot.json +49 -0
- package/migrations/20261122191400_conversation_embeddings_fk_validate/snapshot.json +9 -0
- package/migrations/20261122204325_money_micro_usd_repair/snapshot.json +9 -0
- package/migrations/20261122204326_agent_config_backfill/snapshot.json +143 -0
- package/migrations/20261122221456_inbox_item_deliveries/snapshot.json +301 -0
- package/migrations/20261123155735_pg_trgm/snapshot.json +9 -0
- package/migrations/20261123155739_search_indexes/snapshot.json +167 -0
- package/migrations/20261123172647_drop_legacy_archive_columns/snapshot.json +9 -0
- package/migrations/20261123192506_memory_prefix_index/snapshot.json +69 -0
- package/migrations/20261123201740_todo_search_indexes/snapshot.json +89 -0
- package/migrations/20261123211505_todo_inbox_items/snapshot.json +38 -0
- package/migrations/20261123214917_drop_code_urls/snapshot.json +44 -0
- package/migrations/20261123224000_code_change_conversations_index/migration.sql +1 -0
- package/migrations/20261123224000_code_change_conversations_index/snapshot.json +54 -0
- package/migrations/20261124122023_drop_code_change_sizes/migration.sql +4 -0
- package/migrations/20261124122023_drop_code_change_sizes/snapshot.json +82 -0
- package/migrations/20261124142958_conversation_root_lookup_index/migration.sql +1 -0
- package/migrations/20261124142958_conversation_root_lookup_index/snapshot.json +62 -0
- package/migrations/20261124183352_legacy_brief_metadata_fill/migration.sql +26 -0
- package/migrations/20261124183352_legacy_brief_metadata_fill/snapshot.json +114 -0
- package/migrations/20261124202143_drizzle_v1_baseline/migration.sql +5 -0
- package/migrations/20261124202143_drizzle_v1_baseline/snapshot.json +2012 -0
- package/migrations/20261124221751_spaces/migration.sql +22 -0
- package/migrations/20261124221751_spaces/snapshot.json +436 -0
- package/migrations/20261124230319_conversation_metrics_utc_day_stats/migration.sql +11 -0
- package/migrations/20261124230319_conversation_metrics_utc_day_stats/snapshot.json +9 -0
- package/migrations/20261124234024_space_conversations/migration.sql +5 -0
- package/migrations/20261124234024_space_conversations/snapshot.json +103 -0
- package/migrations/20261124234026_space_conversations_index/migration.sql +1 -0
- package/migrations/20261124234026_space_conversations_index/snapshot.json +62 -0
- package/migrations/20261125012448_drop_lead_actor_index/migration.sql +3 -0
- package/migrations/20261125012448_drop_lead_actor_index/snapshot.json +36 -0
- package/migrations/20261125012452_space_lead_index/migration.sql +1 -0
- package/migrations/20261125012452_space_lead_index/snapshot.json +54 -0
- package/migrations/20261125043821_space_configurations/migration.sql +11 -0
- package/migrations/20261125043821_space_configurations/snapshot.json +194 -0
- package/migrations/20261125064854_agent_update_done_status/migration.sql +9 -0
- package/migrations/20261125064854_agent_update_done_status/snapshot.json +9 -0
- package/migrations/20261125073321_turn_engine_tables/migration.sql +75 -0
- package/migrations/20261125073321_turn_engine_tables/snapshot.json +1497 -0
- package/migrations/20261125073339_turn_inbox_one_source/migration.sql +5 -0
- package/migrations/20261125073339_turn_inbox_one_source/snapshot.json +9 -0
- package/migrations/20261125124506_versions_notify/migration.sql +27 -0
- package/migrations/20261125124506_versions_notify/snapshot.json +9 -0
- package/migrations/20261125140339_turn_group_key/migration.sql +14 -0
- package/migrations/20261125140339_turn_group_key/snapshot.json +75 -0
- package/migrations/20261125140343_turn_group_key_not_null/migration.sql +4 -0
- package/migrations/20261125140343_turn_group_key_not_null/snapshot.json +29 -0
- package/migrations/20261125142845_code_change_requesters/migration.sql +1 -0
- package/migrations/20261125142845_code_change_requesters/snapshot.json +42 -0
- package/migrations/20261125142846_code_change_requesters_index/migration.sql +1 -0
- package/migrations/20261125142846_code_change_requesters_index/snapshot.json +54 -0
- package/migrations/20261125143903_space_visibility/migration.sql +1 -0
- package/migrations/20261125143903_space_visibility/snapshot.json +37 -0
- package/migrations/20261125154848_merge_leaves/migration.sql +2 -0
- package/migrations/20261125154848_merge_leaves/snapshot.json +14 -0
- package/package.json +13 -12
- package/skills/design-automation-skill/SKILL.md +1 -1
- package/dist/adapter-JARQvoLw.js +0 -258
- package/dist/adapter-context-B4BrJZuS.js +0 -43
- package/dist/agent-runner-qZU5TR8i.js +0 -11974
- package/dist/agent-update-cS7Z9mnG.js +0 -26
- package/dist/agent-update-delivery-CZ5M8RDa.js +0 -85
- package/dist/background-compaction-queue-C_uIBUvS.js +0 -145
- package/dist/callback-C8SdXCwr.js +0 -68
- package/dist/catalog-runtime-BLKtnUL3.js +0 -6
- package/dist/config-BIfHKNXN.js +0 -2336
- package/dist/db-BTmLKZrp.js +0 -5804
- package/dist/db-DcmzbA55.d.ts +0 -274
- package/dist/history-CneKY7_V.js +0 -595
- package/dist/install-OtFboxOM.js +0 -228
- package/dist/proxy-path-BHYoKZdq.js +0 -15
- package/dist/registry-D6kS6xYH.js +0 -3024
- package/dist/rule-DAxQY-1h.js +0 -20
- package/dist/schema-BB6E0wyV.d.ts +0 -9472
- package/dist/start-conversation-a4NXH4X9.js +0 -752
- package/dist/store-BuhF1QDm.js +0 -490
- package/dist/task-queue-CrRjFzOh.js +0 -79
- package/dist/turn-session-routing-CZTRU8IY.js +0 -116
- package/dist/vercel-queue-nL0Hq3hr.js +0 -234
- package/dist/warmup-CCOuIwAS.js +0 -12759
- package/migrations/meta/0000_snapshot.json +0 -946
- package/migrations/meta/0001_snapshot.json +0 -972
- package/migrations/meta/0002_snapshot.json +0 -987
- package/migrations/meta/0003_snapshot.json +0 -1035
- package/migrations/meta/0004_snapshot.json +0 -1041
- package/migrations/meta/0005_snapshot.json +0 -948
- package/migrations/meta/0006_snapshot.json +0 -948
- package/migrations/meta/0007_snapshot.json +0 -1013
- package/migrations/meta/0008_snapshot.json +0 -1076
- package/migrations/meta/0009_snapshot.json +0 -1146
- package/migrations/meta/0010_snapshot.json +0 -1190
- package/migrations/meta/0011_snapshot.json +0 -1195
- package/migrations/meta/0012_snapshot.json +0 -1244
- package/migrations/meta/0013_snapshot.json +0 -1250
- package/migrations/meta/0014_snapshot.json +0 -1201
- package/migrations/meta/0015_snapshot.json +0 -1360
- package/migrations/meta/0016_snapshot.json +0 -1617
- package/migrations/meta/0017_snapshot.json +0 -1666
- package/migrations/meta/0018_snapshot.json +0 -1756
- package/migrations/meta/0019_snapshot.json +0 -1904
- package/migrations/meta/0020_snapshot.json +0 -1848
- package/migrations/meta/0021_snapshot.json +0 -2176
- package/migrations/meta/0022_snapshot.json +0 -2186
- package/migrations/meta/0023_snapshot.json +0 -2198
- package/migrations/meta/0024_snapshot.json +0 -2275
- package/migrations/meta/0025_snapshot.json +0 -2275
- package/migrations/meta/0026_snapshot.json +0 -2424
- package/migrations/meta/0027_snapshot.json +0 -2554
- package/migrations/meta/0028_snapshot.json +0 -2685
- package/migrations/meta/0029_snapshot.json +0 -2709
- package/migrations/meta/0030_snapshot.json +0 -2799
- package/migrations/meta/0031_snapshot.json +0 -2823
- package/migrations/meta/0032_snapshot.json +0 -2892
- package/migrations/meta/0033_snapshot.json +0 -2914
- package/migrations/meta/0034_snapshot.json +0 -3038
- package/migrations/meta/0035_snapshot.json +0 -3048
- package/migrations/meta/0036_snapshot.json +0 -3186
- package/migrations/meta/0037_snapshot.json +0 -3192
- package/migrations/meta/0038_snapshot.json +0 -3323
- package/migrations/meta/0039_snapshot.json +0 -3368
- package/migrations/meta/0040_snapshot.json +0 -3516
- package/migrations/meta/0041_snapshot.json +0 -3516
- package/migrations/meta/0042_snapshot.json +0 -3610
- package/migrations/meta/0043_snapshot.json +0 -3610
- package/migrations/meta/0044_snapshot.json +0 -3473
- package/migrations/meta/0045_snapshot.json +0 -3503
- package/migrations/meta/0046_snapshot.json +0 -3707
- package/migrations/meta/0047_snapshot.json +0 -3713
- package/migrations/meta/0048_snapshot.json +0 -3720
- package/migrations/meta/0049_snapshot.json +0 -3581
- package/migrations/meta/0050_snapshot.json +0 -3753
- package/migrations/meta/0051_snapshot.json +0 -3759
- package/migrations/meta/0052_snapshot.json +0 -3765
- package/migrations/meta/0053_snapshot.json +0 -3771
- package/migrations/meta/0054_snapshot.json +0 -3777
- package/migrations/meta/0055_snapshot.json +0 -3948
- package/migrations/meta/0056_snapshot.json +0 -4280
- package/migrations/meta/0057_snapshot.json +0 -3618
- package/migrations/meta/0058_snapshot.json +0 -3598
- package/migrations/meta/0059_snapshot.json +0 -3619
- package/migrations/meta/0060_snapshot.json +0 -3465
- package/migrations/meta/0061_snapshot.json +0 -3471
- package/migrations/meta/0062_snapshot.json +0 -3499
- package/migrations/meta/0063_snapshot.json +0 -3505
- package/migrations/meta/0064_snapshot.json +0 -3505
- package/migrations/meta/0065_snapshot.json +0 -3511
- package/migrations/meta/0066_snapshot.json +0 -4099
- package/migrations/meta/0067_snapshot.json +0 -3921
- package/migrations/meta/0068_snapshot.json +0 -4176
- package/migrations/meta/0069_snapshot.json +0 -3979
- package/migrations/meta/0070_snapshot.json +0 -3997
- package/migrations/meta/0071_snapshot.json +0 -4003
- package/migrations/meta/0072_snapshot.json +0 -4064
- package/migrations/meta/0073_snapshot.json +0 -4070
- package/migrations/meta/0074_snapshot.json +0 -4076
- package/migrations/meta/0075_snapshot.json +0 -4083
- package/migrations/meta/0076_snapshot.json +0 -4147
- package/migrations/meta/0077_snapshot.json +0 -4141
- package/migrations/meta/0078_snapshot.json +0 -4175
- package/migrations/meta/0079_snapshot.json +0 -4203
- package/migrations/meta/0080_snapshot.json +0 -4265
- package/migrations/meta/0081_snapshot.json +0 -4271
- package/migrations/meta/0082_snapshot.json +0 -4373
- package/migrations/meta/0083_snapshot.json +0 -4388
- package/migrations/meta/0084_snapshot.json +0 -4388
- package/migrations/meta/0085_snapshot.json +0 -4394
- package/migrations/meta/0086_snapshot.json +0 -4366
- package/migrations/meta/0087_snapshot.json +0 -4366
- package/migrations/meta/0088_snapshot.json +0 -4372
- package/migrations/meta/0089_snapshot.json +0 -4372
- package/migrations/meta/0090_snapshot.json +0 -4388
- package/migrations/meta/0091_snapshot.json +0 -4410
- package/migrations/meta/0092_snapshot.json +0 -4446
- package/migrations/meta/0093_snapshot.json +0 -4446
- package/migrations/meta/0094_snapshot.json +0 -4452
- package/migrations/meta/0095_snapshot.json +0 -4452
- package/migrations/meta/0096_snapshot.json +0 -4490
- package/migrations/meta/0097_snapshot.json +0 -4490
- package/migrations/meta/0098_snapshot.json +0 -4490
- package/migrations/meta/0099_snapshot.json +0 -4496
- package/migrations/meta/0100_snapshot.json +0 -4496
- package/migrations/meta/0101_snapshot.json +0 -4496
- package/migrations/meta/0102_snapshot.json +0 -4502
- package/migrations/meta/0103_snapshot.json +0 -4509
- package/migrations/meta/0104_snapshot.json +0 -4516
- package/migrations/meta/0105_snapshot.json +0 -4611
- package/migrations/meta/0106_snapshot.json +0 -4617
- package/migrations/meta/0107_snapshot.json +0 -4617
- package/migrations/meta/0108_snapshot.json +0 -4688
- package/migrations/meta/0109_snapshot.json +0 -4925
- package/migrations/meta/0110_snapshot.json +0 -4952
- package/migrations/meta/0111_snapshot.json +0 -5011
- package/migrations/meta/0112_snapshot.json +0 -5011
- package/migrations/meta/0113_snapshot.json +0 -5033
- package/migrations/meta/0114_snapshot.json +0 -5203
- package/migrations/meta/0115_snapshot.json +0 -5225
- package/migrations/meta/0116_snapshot.json +0 -5388
- package/migrations/meta/0117_snapshot.json +0 -5413
- package/migrations/meta/0118_snapshot.json +0 -5428
- package/migrations/meta/0119_snapshot.json +0 -5441
- package/migrations/meta/0120_snapshot.json +0 -5441
- package/migrations/meta/0121_snapshot.json +0 -5481
- package/migrations/meta/0122_snapshot.json +0 -5481
- package/migrations/meta/0123_snapshot.json +0 -5481
- package/migrations/meta/0124_snapshot.json +0 -5516
- package/migrations/meta/0125_snapshot.json +0 -5516
- package/migrations/meta/0126_snapshot.json +0 -5488
- package/migrations/meta/0127_snapshot.json +0 -5519
- package/migrations/meta/0128_snapshot.json +0 -5519
- package/migrations/meta/0129_snapshot.json +0 -5547
- package/migrations/meta/0130_snapshot.json +0 -5563
- package/migrations/meta/0131_snapshot.json +0 -5569
- package/migrations/meta/0132_snapshot.json +0 -5569
- package/migrations/meta/0133_snapshot.json +0 -5590
- package/migrations/meta/0134_snapshot.json +0 -5606
- package/migrations/meta/0135_snapshot.json +0 -5624
- package/migrations/meta/0136_snapshot.json +0 -5624
- package/migrations/meta/0137_snapshot.json +0 -5864
- package/migrations/meta/0138_snapshot.json +0 -5894
- package/migrations/meta/0139_snapshot.json +0 -5898
- package/migrations/meta/0140_snapshot.json +0 -5919
- package/migrations/meta/0141_snapshot.json +0 -6429
- package/migrations/meta/0142_snapshot.json +0 -6457
- package/migrations/meta/0143_snapshot.json +0 -6434
- package/migrations/meta/0144_snapshot.json +0 -6434
- package/migrations/meta/0145_snapshot.json +0 -6440
- package/migrations/meta/0146_snapshot.json +0 -6446
- package/migrations/meta/0147_snapshot.json +0 -6452
- package/migrations/meta/0148_snapshot.json +0 -6474
- package/migrations/meta/0149_snapshot.json +0 -6490
- package/migrations/meta/0150_snapshot.json +0 -6490
- package/migrations/meta/0151_snapshot.json +0 -6505
- package/migrations/meta/0152_snapshot.json +0 -6505
- package/migrations/meta/0153_snapshot.json +0 -6511
- package/migrations/meta/0154_snapshot.json +0 -6533
- package/migrations/meta/0155_snapshot.json +0 -6511
- package/migrations/meta/0156_snapshot.json +0 -6511
- package/migrations/meta/0157_snapshot.json +0 -6527
- package/migrations/meta/0158_snapshot.json +0 -6515
- package/migrations/meta/0159_snapshot.json +0 -6515
- package/migrations/meta/0160_snapshot.json +0 -6515
- package/migrations/meta/0161_snapshot.json +0 -6278
- package/migrations/meta/0162_snapshot.json +0 -6404
- package/migrations/meta/0163_snapshot.json +0 -6404
- package/migrations/meta/0164_snapshot.json +0 -6466
- package/migrations/meta/0165_snapshot.json +0 -6466
- package/migrations/meta/0166_snapshot.json +0 -6494
- package/migrations/meta/0167_snapshot.json +0 -6525
- package/migrations/meta/0168_snapshot.json +0 -6525
- package/migrations/meta/0169_snapshot.json +0 -6513
- package/migrations/meta/_journal.json +0 -1196
- /package/migrations/{0000_initial.sql → 20260711145847_initial/migration.sql} +0 -0
- /package/migrations/{0001_conversation_metrics.sql → 20260711145900_conversation_metrics/migration.sql} +0 -0
- /package/migrations/{0002_conversation_message_search.sql → 20260712153649_conversation_message_search/migration.sql} +0 -0
- /package/migrations/{0003_peaceful_scalphunter.sql → 20260713040256_peaceful_scalphunter/migration.sql} +0 -0
- /package/migrations/{0004_useful_magus.sql → 20260715174202_useful_magus/migration.sql} +0 -0
- /package/migrations/{0005_conversation_events.sql → 20260715174203_conversation_events/migration.sql} +0 -0
- /package/migrations/{0006_drop_legacy_conversation_messages.sql → 20260723042835_drop_legacy_conversation_messages/migration.sql} +0 -0
- /package/migrations/{0007_thick_sugar_man.sql → 20260723050612_thick_sugar_man/migration.sql} +0 -0
- /package/migrations/{0008_sticky_rage.sql → 20260727223822_sticky_rage/migration.sql} +0 -0
- /package/migrations/{0009_slippery_harrier.sql → 20260728033158_slippery_harrier/migration.sql} +0 -0
- /package/migrations/{0010_native_conversation_history.sql → 20260728040836_native_conversation_history/migration.sql} +0 -0
- /package/migrations/{0011_sour_golden_guardian.sql → 20260728204900_sour_golden_guardian/migration.sql} +0 -0
- /package/migrations/{0012_structured_conversation_events.sql → 20260730233332_structured_conversation_events/migration.sql} +0 -0
- /package/migrations/{0013_conversation_session_source.sql → 20260731164038_conversation_session_source/migration.sql} +0 -0
- /package/migrations/{0014_source_visibility.sql → 20260801230336_source_visibility/migration.sql} +0 -0
- /package/migrations/{0015_magical_ezekiel_stane.sql → 20260802023731_magical_ezekiel_stane/migration.sql} +0 -0
- /package/migrations/{0016_neat_the_anarchist.sql → 20260804015843_neat_the_anarchist/migration.sql} +0 -0
- /package/migrations/{0017_drop_paused_scheduled_tasks.sql → 20260804165952_drop_paused_scheduled_tasks/migration.sql} +0 -0
- /package/migrations/{0018_curvy_excalibur.sql → 20260804225613_curvy_excalibur/migration.sql} +0 -0
- /package/migrations/{0019_lowly_valkyrie.sql → 20260805174033_lowly_valkyrie/migration.sql} +0 -0
- /package/migrations/{0020_restrict_task_execution_kinds.sql → 20260805200301_restrict_task_execution_kinds/migration.sql} +0 -0
- /package/migrations/{0021_first_warhawk.sql → 20260806030729_first_warhawk/migration.sql} +0 -0
- /package/migrations/{0022_task_execution_status.sql → 20260807185200_task_execution_status/migration.sql} +0 -0
- /package/migrations/{0023_task_title_columns.sql → 20260808014743_task_title_columns/migration.sql} +0 -0
- /package/migrations/{0024_misty_typhoid_mary.sql → 20260809220421_misty_typhoid_mary/migration.sql} +0 -0
- /package/migrations/{0025_mcp_credential_subject.sql → 20260811193709_mcp_credential_subject/migration.sql} +0 -0
- /package/migrations/{0026_conversation_event_actor_and_participants.sql → 20260812032924_conversation_event_actor_and_participants/migration.sql} +0 -0
- /package/migrations/{0027_attachment_storage.sql → 20260812172418_attachment_storage/migration.sql} +0 -0
- /package/migrations/{0028_artifacts.sql → 20260813230732_artifacts/migration.sql} +0 -0
- /package/migrations/{0029_dizzy_barracuda.sql → 20260814062905_dizzy_barracuda/migration.sql} +0 -0
- /package/migrations/{0030_drop_workspace_repo_primary.sql → 20260814231353_drop_workspace_repo_primary/migration.sql} +0 -0
- /package/migrations/{0031_wild_phantom_reporter.sql → 20260815030100_wild_phantom_reporter/migration.sql} +0 -0
- /package/migrations/{0032_workspace_snapshots_table.sql → 20260817082233_workspace_snapshots_table/migration.sql} +0 -0
- /package/migrations/{0033_workspace_snapshot_active_build.sql → 20260818160339_workspace_snapshot_active_build/migration.sql} +0 -0
- /package/migrations/{0034_strong_randall.sql → 20260821180755_strong_randall/migration.sql} +0 -0
- /package/migrations/{0035_workspace_snapshot_size_bytes.sql → 20260823030308_workspace_snapshot_size_bytes/migration.sql} +0 -0
- /package/migrations/{0036_complex_rage.sql → 20260824190313_complex_rage/migration.sql} +0 -0
- /package/migrations/{0037_conversation_location.sql → 20260827233711_conversation_location/migration.sql} +0 -0
- /package/migrations/{0038_event_task_status.sql → 20260901224306_event_task_status/migration.sql} +0 -0
- /package/migrations/{0039_attachment_provider.sql → 20260904153232_attachment_provider/migration.sql} +0 -0
- /package/migrations/{0040_conversation_briefs.sql → 20260909111415_conversation_briefs/migration.sql} +0 -0
- /package/migrations/{0041_automation_outcomes_backfill.sql → 20260910144928_automation_outcomes_backfill/migration.sql} +0 -0
- /package/migrations/{0042_conversation_metrics.sql → 20260911184346_conversation_metrics/migration.sql} +0 -0
- /package/migrations/{0043_scheduled_automation_channel_destinations.sql → 20260921140842_scheduled_automation_channel_destinations/migration.sql} +0 -0
- /package/migrations/{0044_event_automation_channel_destinations.sql → 20260922221709_event_automation_channel_destinations/migration.sql} +0 -0
- /package/migrations/{0045_conversation_forks.sql → 20261001113455_conversation_forks/migration.sql} +0 -0
- /package/migrations/{0046_automation_versions.sql → 20261005161844_automation_versions/migration.sql} +0 -0
- /package/migrations/{0047_user_timezone.sql → 20261006152043_user_timezone/migration.sql} +0 -0
- /package/migrations/{0048_user_admin.sql → 20261008200858_user_admin/migration.sql} +0 -0
- /package/migrations/{0049_event_automation_status_reason.sql → 20261009145407_event_automation_status_reason/migration.sql} +0 -0
- /package/migrations/{0050_agent_invocation_parent_mailbox.sql → 20261013160816_agent_invocation_parent_mailbox/migration.sql} +0 -0
- /package/migrations/{0051_agent_invocation_parent_tool_call.sql → 20261013215020_agent_invocation_parent_tool_call/migration.sql} +0 -0
- /package/migrations/{0052_agent_invocation_title.sql → 20261014011138_agent_invocation_title/migration.sql} +0 -0
- /package/migrations/{0053_conversation_stopped_at.sql → 20261014211942_conversation_stopped_at/migration.sql} +0 -0
- /package/migrations/{0054_flowery_rage.sql → 20261015012820_flowery_rage/migration.sql} +0 -0
- /package/migrations/{0055_automations.sql → 20261017000924_automations/migration.sql} +0 -0
- /package/migrations/{0056_automation_runs.sql → 20261017134736_automation_runs/migration.sql} +0 -0
- /package/migrations/{0057_drop_legacy_automation_tables.sql → 20261017170250_drop_legacy_automation_tables/migration.sql} +0 -0
- /package/migrations/{0058_automation_creator_identity.sql → 20261018134754_automation_creator_identity/migration.sql} +0 -0
- /package/migrations/{0059_automation_run_version.sql → 20261023071954_automation_run_version/migration.sql} +0 -0
- /package/migrations/{0060_identity_signed_in_at.sql → 20261025233137_identity_signed_in_at/migration.sql} +0 -0
- /package/migrations/{0061_workspace_vcpus.sql → 20261027234315_workspace_vcpus/migration.sql} +0 -0
- /package/migrations/{0062_plugin_report_index.sql → 20261028124242_plugin_report_index/migration.sql} +0 -0
- /package/migrations/{0063_agent_invocation_type.sql → 20261028154230_agent_invocation_type/migration.sql} +0 -0
- /package/migrations/{0064_any_resource_event_triggers.sql → 20261030021803_any_resource_event_triggers/migration.sql} +0 -0
- /package/migrations/{0065_user_customization.sql → 20261030234309_user_customization/migration.sql} +0 -0
- /package/migrations/{0066_review_items.sql → 20261031020656_review_items/migration.sql} +0 -0
- /package/migrations/{0067_review_item_dedupe_tenant.sql → 20261031024151_review_item_dedupe_tenant/migration.sql} +0 -0
- /package/migrations/{0068_review_item_slack_cards.sql → 20261031024246_review_item_slack_cards/migration.sql} +0 -0
- /package/migrations/{0069_system_identity.sql → 20261031155308_system_identity/migration.sql} +0 -0
- /package/migrations/{0070_review_item_foreign_keys.sql → 20261101193952_review_item_foreign_keys/migration.sql} +0 -0
- /package/migrations/{0071_review_item_turn.sql → 20261102172751_review_item_turn/migration.sql} +0 -0
- /package/migrations/{0072_conversation_read_positions.sql → 20261102221411_conversation_read_positions/migration.sql} +0 -0
- /package/migrations/{0073_conversation_quick_question.sql → 20261104085028_conversation_quick_question/migration.sql} +0 -0
- /package/migrations/{0074_conversation_participant_pins.sql → 20261104145136_conversation_participant_pins/migration.sql} +0 -0
- /package/migrations/{0075_conversation_detail_version.sql → 20261104164429_conversation_detail_version/migration.sql} +0 -0
- /package/migrations/{0076_conversation_auto_archive.sql → 20261104172055_conversation_auto_archive/migration.sql} +0 -0
- /package/migrations/{0077_drop_agent_invocation_model_profile.sql → 20261105005443_drop_agent_invocation_model_profile/migration.sql} +0 -0
- /package/migrations/{0078_plugin_conversation_index.sql → 20261105043807_plugin_conversation_index/migration.sql} +0 -0
- /package/migrations/{0079_conversation_event_author_index.sql → 20261105051837_conversation_event_author_index/migration.sql} +0 -0
- /package/migrations/{0080_conversation_event_latest_message_indexes.sql → 20261105182854_conversation_event_latest_message_indexes/migration.sql} +0 -0
- /package/migrations/{0081_conversation_pin_position.sql → 20261106011443_conversation_pin_position/migration.sql} +0 -0
- /package/migrations/{0082_push_notifications.sql → 20261106095004_push_notifications/migration.sql} +0 -0
- /package/migrations/{0083_conversation_kind.sql → 20261106162740_conversation_kind/migration.sql} +0 -0
- /package/migrations/{0084_read_position_backfill.sql → 20261107002001_read_position_backfill/migration.sql} +0 -0
- /package/migrations/{0085_child_archived_at.sql → 20261107025209_child_archived_at/migration.sql} +0 -0
- /package/migrations/{0086_shared_archive.sql → 20261107035735_shared_archive/migration.sql} +0 -0
- /package/migrations/{0087_child_location.sql → 20261107215055_child_location/migration.sql} +0 -0
- /package/migrations/{0088_conversation_unsubscribe.sql → 20261108191927_conversation_unsubscribe/migration.sql} +0 -0
- /package/migrations/{0089_conversation_paused_status.sql → 20261109021618_conversation_paused_status/migration.sql} +0 -0
- /package/migrations/{0090_guardian_review_time_index.sql → 20261109111553_guardian_review_time_index/migration.sql} +0 -0
- /package/migrations/{0091_conversation_participant_unsubscribed_index.sql → 20261109173130_conversation_participant_unsubscribed_index/migration.sql} +0 -0
- /package/migrations/{0092_turn_metric_actor.sql → 20261109182006_turn_metric_actor/migration.sql} +0 -0
- /package/migrations/{0093_participant_root_actor_backfill.sql → 20261109202836_participant_root_actor_backfill/migration.sql} +0 -0
- /package/migrations/{0094_conversation_delivery_paused_at.sql → 20261109232640_conversation_delivery_paused_at/migration.sql} +0 -0
- /package/migrations/{0095_web_linked_slack_identity_repair.sql → 20261110120937_web_linked_slack_identity_repair/migration.sql} +0 -0
- /package/migrations/{0096_automation_task_kind.sql → 20261110175824_automation_task_kind/migration.sql} +0 -0
- /package/migrations/{0097_conversation_kind_automation.sql → 20261110210242_conversation_kind_automation/migration.sql} +0 -0
- /package/migrations/{0098_review_item_plugin_actions.sql → 20261110222632_review_item_plugin_actions/migration.sql} +0 -0
- /package/migrations/{0099_conversation_last_message_at.sql → 20261110225157_conversation_last_message_at/migration.sql} +0 -0
- /package/migrations/{0100_automation_task_kind_repair.sql → 20261111013351_automation_task_kind_repair/migration.sql} +0 -0
- /package/migrations/{0101_drop_legacy_columns.sql → 20261111163126_drop_legacy_columns/migration.sql} +0 -0
- /package/migrations/{0102_code_change_last_activity.sql → 20261111170150_code_change_last_activity/migration.sql} +0 -0
- /package/migrations/{0103_agent_invocation_fork.sql → 20261111191441_agent_invocation_fork/migration.sql} +0 -0
- /package/migrations/{0104_code_change_draft.sql → 20261112142841_code_change_draft/migration.sql} +0 -0
- /package/migrations/{0105_attachment_uploads.sql → 20261112202901_attachment_uploads/migration.sql} +0 -0
- /package/migrations/{0106_conversation_agent_config.sql → 20261112220407_conversation_agent_config/migration.sql} +0 -0
- /package/migrations/{0107_attachment_deferred_download.sql → 20261113081247_attachment_deferred_download/migration.sql} +0 -0
- /package/migrations/{0108_conversation_embeddings.sql → 20261113225551_conversation_embeddings/migration.sql} +0 -0
- /package/migrations/{0109_user_preferences.sql → 20261114213238_user_preferences/migration.sql} +0 -0
- /package/migrations/{0110_code_change_repository_state_index.sql → 20261114222527_code_change_repository_state_index/migration.sql} +0 -0
- /package/migrations/{0111_attachment_kinds.sql → 20261115172605_attachment_kinds/migration.sql} +0 -0
- /package/migrations/{0112_attachment_url_fill.sql → 20261115173004_attachment_url_fill/migration.sql} +0 -0
- /package/migrations/{0113_attachment_url_index.sql → 20261115180216_attachment_url_index/migration.sql} +0 -0
- /package/migrations/{0114_plan_items.sql → 20261116103700_plan_items/migration.sql} +0 -0
- /package/migrations/{0115_automation_creator_slack_index.sql → 20261117100100_automation_creator_slack_index/migration.sql} +0 -0
- /package/migrations/{0116_conversation_event_search.sql → 20261117132522_conversation_event_search/migration.sql} +0 -0
- /package/migrations/{0117_automation_last_run.sql → 20261117164007_automation_last_run/migration.sql} +0 -0
- /package/migrations/{0118_automation_last_run_index.sql → 20261117164047_automation_last_run_index/migration.sql} +0 -0
- /package/migrations/{0119_money_micro_usd.sql → 20261117210444_money_micro_usd/migration.sql} +0 -0
- /package/migrations/{0120_conversation_cost_micro_usd.sql → 20261117210505_conversation_cost_micro_usd/migration.sql} +0 -0
- /package/migrations/{0121_people_list_metric_index.sql → 20261118081416_people_list_metric_index/migration.sql} +0 -0
- /package/migrations/{0122_automation_rollout_repair.sql → 20261118095216_automation_rollout_repair/migration.sql} +0 -0
- /package/migrations/{0123_cache_warming_history_reset.sql → 20261118143948_cache_warming_history_reset/migration.sql} +0 -0
- /package/migrations/{0124_artifact_visibility.sql → 20261119040651_artifact_visibility/migration.sql} +0 -0
- /package/migrations/{0125_artifact_public_sha_index.sql → 20261119040715_artifact_public_sha_index/migration.sql} +0 -0
- /package/migrations/{0126_artifact_drop_public.sql → 20261119052706_artifact_drop_public/migration.sql} +0 -0
- /package/migrations/{0127_artifact_path.sql → 20261119053831_artifact_path/migration.sql} +0 -0
- /package/migrations/{0128_artifact_path_index.sql → 20261119053844_artifact_path_index/migration.sql} +0 -0
- /package/migrations/{0129_review_item_answered_index.sql → 20261119091949_review_item_answered_index/migration.sql} +0 -0
- /package/migrations/{0130_review_item_status_index.sql → 20261119100029_review_item_status_index/migration.sql} +0 -0
- /package/migrations/{0131_brief_outcome_status.sql → 20261119165607_brief_outcome_status/migration.sql} +0 -0
- /package/migrations/{0132_brief_outcome_status_backfill.sql → 20261119165622_brief_outcome_status_backfill/migration.sql} +0 -0
- /package/migrations/{0133_brief_created_at_index.sql → 20261119213716_brief_created_at_index/migration.sql} +0 -0
- /package/migrations/{0134_slack_person_search_index.sql → 20261119222456_slack_person_search_index/migration.sql} +0 -0
- /package/migrations/{0135_code_change_size.sql → 20261119225522_code_change_size/migration.sql} +0 -0
- /package/migrations/{0136_merge_conflict_notice_dismiss.sql → 20261119232253_merge_conflict_notice_dismiss/migration.sql} +0 -0
- /package/migrations/{0137_inbox_snoozes.sql → 20261119235649_inbox_snoozes/migration.sql} +0 -0
- /package/migrations/{0138_code_change_search_index.sql → 20261120093118_code_change_search_index/migration.sql} +0 -0
- /package/migrations/{0139_review_item_owner.sql → 20261120093452_review_item_owner/migration.sql} +0 -0
- /package/migrations/{0140_review_item_owner_index.sql → 20261120185654_review_item_owner_index/migration.sql} +0 -0
- /package/migrations/{0141_memory_core_adoption.sql → 20261120185754_memory_core_adoption/migration.sql} +0 -0
- /package/migrations/{0142_memory_core_indexes.sql → 20261120185854_memory_core_indexes/migration.sql} +0 -0
- /package/migrations/{0143_todos.sql → 20261120235226_todos/migration.sql} +0 -0
- /package/migrations/{0144_inbox_items.sql → 20261121082316_inbox_items/migration.sql} +0 -0
- /package/migrations/{0145_todo_changed_by_agent.sql → 20261121175651_todo_changed_by_agent/migration.sql} +0 -0
- /package/migrations/{0146_inbox_item_subject_title_parts.sql → 20261121183527_inbox_item_subject_title_parts/migration.sql} +0 -0
- /package/migrations/{0147_inbox_snooze_wake_reason.sql → 20261121194143_inbox_snooze_wake_reason/migration.sql} +0 -0
- /package/migrations/{0148_authorization_request_index.sql → 20261121222400_authorization_request_index/migration.sql} +0 -0
- /package/migrations/{0149_conversation_metadata.sql → 20261121225908_conversation_metadata/migration.sql} +0 -0
- /package/migrations/{0150_conversation_metadata_fill.sql → 20261121225910_conversation_metadata_fill/migration.sql} +0 -0
- /package/migrations/{0151_conversation_search_index.sql → 20261121225913_conversation_search_index/migration.sql} +0 -0
- /package/migrations/{0152_inbox_item_legacy_automation_keys.sql → 20261122022900_inbox_item_legacy_automation_keys/migration.sql} +0 -0
- /package/migrations/{0153_artifact_expiry.sql → 20261122024454_artifact_expiry/migration.sql} +0 -0
- /package/migrations/{0154_artifact_permanent_sha_index.sql → 20261122024455_artifact_permanent_sha_index/migration.sql} +0 -0
- /package/migrations/{0155_artifact_drop_public_sha_index.sql → 20261122024457_artifact_drop_public_sha_index/migration.sql} +0 -0
- /package/migrations/{0156_conversation_kind_lead.sql → 20261122024458_conversation_kind_lead/migration.sql} +0 -0
- /package/migrations/{0157_conversation_lead_actor_index.sql → 20261122024459_conversation_lead_actor_index/migration.sql} +0 -0
- /package/migrations/{0158_keep_legacy_archive_columns.sql → 20261122071549_keep_legacy_archive_columns/migration.sql} +0 -0
- /package/migrations/{0159_conversation_embeddings_fk_validate.sql → 20261122191400_conversation_embeddings_fk_validate/migration.sql} +0 -0
- /package/migrations/{0160_money_micro_usd_repair.sql → 20261122204325_money_micro_usd_repair/migration.sql} +0 -0
- /package/migrations/{0161_agent_config_backfill.sql → 20261122204326_agent_config_backfill/migration.sql} +0 -0
- /package/migrations/{0162_inbox_item_deliveries.sql → 20261122221456_inbox_item_deliveries/migration.sql} +0 -0
- /package/migrations/{0163_pg_trgm.sql → 20261123155735_pg_trgm/migration.sql} +0 -0
- /package/migrations/{0164_search_indexes.sql → 20261123155739_search_indexes/migration.sql} +0 -0
- /package/migrations/{0165_drop_legacy_archive_columns.sql → 20261123172647_drop_legacy_archive_columns/migration.sql} +0 -0
- /package/migrations/{0166_memory_prefix_index.sql → 20261123192506_memory_prefix_index/migration.sql} +0 -0
- /package/migrations/{0167_todo_search_indexes.sql → 20261123201740_todo_search_indexes/migration.sql} +0 -0
- /package/migrations/{0168_todo_inbox_items.sql → 20261123211505_todo_inbox_items/migration.sql} +0 -0
- /package/migrations/{0169_drop_code_urls.sql → 20261123214917_drop_code_urls/migration.sql} +0 -0
package/dist/api.js
CHANGED
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { C as
|
|
5
|
-
import {
|
|
6
|
-
import { A as
|
|
7
|
-
import {
|
|
8
|
-
import { C as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { a as listChildAgents } from "./markers-DUP8aBOp.js";
|
|
16
|
-
import { i as continueConversationInSlack, r as canContinueInSlack, t as BUSY } from "./continue-in-slack-fnmD2Ifb.js";
|
|
17
|
-
import { i as readLiveAttachment } from "./store-BuhF1QDm.js";
|
|
1
|
+
import { $ as getPlugins, $c as readViewerAvatarUrl, $f as cacheKeyPrefix, $i as getVercelConversationWorkQueue, $l as automationSearchDocument, Aa as createPluginCache, Af as botConfig, Ar as pluginCatalogRuntime, At as memoryDb, Cr as createUserTokenStore, Cs as conversationStatusSql, Dc as inboxItemForUser, Ds as conversationKindFromRow, Dt as contentVersion, Du as juniorUsers, Ec as canUserReadInboxItem, El as readConversationAccessFromSql, Eo as getDashboardSettingsLink, Et as REVALIDATED_READ_PATHS, Eu as slackPersonSearchDocument, Fd as automationEventCatalog, Fn as listWorkspaces, Ft as prefixMatch, Gn as hash, Hl as juniorTodos, I as escapeSlackMrkdwnText, Ic as isInboxItemForEveryone, Il as rootVisibleToViewer, In as listWorkspacesByRepository, It as prefixRank, Jc as findUserByEmail, Js as ownerConversationId, Kl as inboxItemFuzzyTitle, L as formatSlackLink, Lc as isOnlyAssignee, Ln as updateWorkspace, Lr as serviceAccountPlugins, Lt as rankSearchMatches, Mc as inboxItemReaderForUserInConversation, Mn as deleteWorkspace, Mr as disconnectServiceAccount, Mt as parseTypedQuery, N as loadConversationSlackTenantIds, Nc as inboxItemTodo, Nn as getWorkspace, Nr as finishServiceAccountSignIn, Nt as fuzzyMatch, Ot as contentVersionHeaders, Ou as juniorDestinations, Pc as inboxItemVisibleTo, Pr as getServiceAccountStatus, Pt as fuzzyRank, Qd as getStateAdapter, Qf as saveEnabledProviders, Ql as automationFuzzyTitle, Rn as WorkspaceValidationError, Rr as startServiceAccountSignIn, Rt as scoredSearchMatches, Sc as canActOnInboxItem, Si as createPluginEmbedder, Ss as conversationIsActiveSql, St as isPausedBySlack, Tl as createConversationAccessReader, To as getDashboardPersonLink, Tu as slackPersonPredicate, Ul as todoFuzzyTitle, Vs as getInboxItem, Wl as todoSearchDocument, Wn as create, Ws as inboxItemsNeedingUserVersionQuery, Wu as isAgentResourceType, Xf as readEnabledProviders, Yl as juniorInboxItemConversations, Yo as AutomationConflictError, Ys as searchInboxItems, Yu as cancelWatch, Zf as readServedProviders, Zl as juniorInboxItems, _t as listPushSubscriptions, a as getDb, ac as clearInboxWakeReasons, bi as workspaceRepoCheckoutPath, bl as readCachedUserByEmail, bo as getDashboardConversationLink, bs as conversationRangeColumns, bt as savePushSubscription, bu as juniorConversations, cc as inboxItemSnoozedBy, dc as settleInboxSnoozes, dt as readWebPushConfig, du as juniorApiTokens, el as resolveViewerUser, ep as createCache, et as getRegistrations, eu as juniorAutomations, fc as snoozeInboxItems, ft as sendPushNotificationToUser, gs as microUsdToUsd, gt as deletePushSubscription, gu as juniorCodeRepositories, hs as microUsdSql, ht as resolveNotificationTimezone, hu as juniorCodeChanges, i as getConversationStore, id as listWatches, il as identityAvatarUrl, ip as withLock, jc as inboxItemReaderForUser, jf as getChatConfig, jn as createWorkspace, jt as searchTypedMemories, ju as getEventCatalog, kl as readableSlackTeamId, kt as revalidateContent, la as createPluginAnnotations, lt as apiRoutePrefix, lu as juniorConversationMetrics, mc as unsnoozeInboxRow, mu as codeRepositorySearchDocument, nf as credentialContextForActor, nl as updateViewerDisplayName, no as postSlackMessage, o as getSqlExecutor, ol as readAvatarFetch, pc as snoozeTimerTrigger, pu as codeChangeSearchDocument, ql as inboxItemSearchDocument, ri as webActorUserIds, ru as juniorAgentBindings, sc as inboxItemInRow, sl as readUserAvatarUrls, ss as readAutomationTitlesByConversationId, tu as juniorAutomationRuns, ua as listConversationAnnotations, uc as readViewerInboxSnoozes, uu as juniorConversationEvents, vi as SANDBOX_RUNTIME, vs as usdToMicroUsdUnbiased, vt as readNotificationSchedule, wc as canAnswerInboxItem, wp as getAttachmentStorage, ws as conversationTurnFailedSql, wu as juniorIdentities, xf as parseSlackTeamId, xs as conversationUsageCostExpr, yf as parseSlackChannelId, ys as conversationAggregateColumns, yt as saveNotificationSchedule, zc as itemNeedsUser, zd as eventWatchUnavailable, zi as completeText, zs as countInboxItemsNeedingUserBySubject } from "./db-DXTOYRzR.js";
|
|
2
|
+
import { E as withSpan, N as normalizeIdentityEmail, _ as runBestEffort, h as logWarn, m as logInfo, p as logException, y as setSentryUser } from "./logging-czs0nqLC.js";
|
|
3
|
+
import { A as pauseConversationDelivery, Bt as readViewerAutomationExecutions, Ct as jsonResponse, Ht as readViewerAutomationSummary, It as updateViewerAutomation, Kt as AutomationEditError, Lt as ViewerTaskNotFoundError, M as AttachmentDownloadError, Mt as changeViewerAutomationLifecycle, N as readAttachmentContent, Nt as deleteViewerTask, O as canPauseConversationDelivery, P as previewOriginBelongsTo, Pt as readViewerAutomationEdit, Rt as collectionRowTitle, St as emptyResponse, Ut as readViewerAutomationVersions, Vt as readViewerAutomationRuns, Wt as readViewerAutomations, Xt as viewerAutomationCollection, Zt as SAVINGS_NAMESPACE, an as readStats, bt as inviteToConversation, cn as connectedState, in as addStats, j as resumeConversationDelivery, jt as activateViewerAutomationVersion, mt as reportConversationRead, on as breakerStates, p as createInboxItemShow, rn as savingsTotals, sn as closeBreaker, vt as listOwnedWatches, wt as throwApiError } from "./agent-runner-C7GNLRB6.js";
|
|
4
|
+
import { A as automationVersionActivateSchema, At as spaceSchema, B as conversationAttachmentParamsSchema, C as automationRunListSchema, D as automationSchedulePreviewSchema, Dt as spaceListSchema, E as automationScheduleIntentSchema, Et as spaceListQuerySchema, Fn as automationTaskText, Ht as MAX_ATTACHMENT_BYTES, I as CONVERSATION_DETAIL_VERSION_HEADER, J as conversationParamsSchema, K as conversationEventPageSchema, L as CONVERSATION_VERSION_HEADER, M as automationVersionParamsSchema, Mt as updateSpaceBodySchema, O as automationSummarySchema, Ot as spaceParamsSchema, Pt as conversationReadPositionSchema, S as automationParamsSchema, Tt as createSpaceBodySchema, U as conversationDetailQuerySchema, V as conversationAttachmentQuerySchema, W as conversationDetailReportSchema, _ as automationLifecycleSchema, b as automationListQuerySchema, d as automationEditSchema, en as ScheduleIntentError, f as automationEventCatalogSchema, j as automationVersionListSchema, k as automationUpdateSchema, l as apiErrorSchema, mn as isOpenTodoStatus, n as INPUT_IMAGE_TYPES, p as automationExecutionListSchema, q as conversationEventsQuerySchema, r as detectImageMediaType, s as notificationScheduleSchema, t as INLINE_VIDEO_TYPES, tn as compileScheduleIntent, u as automationEditErrorSchema, wt as archiveSpaceBodySchema, y as automationListPageSchema } from "./media-Cr9pGkzr.js";
|
|
5
|
+
import { A as gatewayProvidersSchema, At as disconnectConnectionResponseSchema, B as disconnectServiceAccountResponseSchema, Bt as codeRepositoryParamsSchema, Ct as notificationSettingsSchema, D as inboxSnoozeSchema, Dt as connectionListSchema, E as inboxSnoozeResourceSchema, Et as testNotificationResponseSchema, F as cacheWarmingBreakerParamsSchema, Ft as codeChangeSearchReportSchema, G as searchQuerySchema, Gt as personCodeQuerySchema, H as serviceAccountParamsSchema, Ht as codeRepositoryReportSchema, I as cacheWarmingSavingsQuerySchema, J as createdPersonalTokenSchema, Jt as todoParamsSchema, K as searchReportSchema, Kt as conversationTodoSchema, L as cacheWarmingSavingsRefillResponseSchema, M as cacheHealthQuerySchema, N as cacheHealthReportSchema, O as inboxSnoozeSubjectSchema, Ot as connectionParamsSchema, P as cacheWarmingBreakerListSchema, Pt as codeChangeSearchQuerySchema, Q as revokePersonalTokenResponseSchema, Qt as watchParamsSchema, R as cacheWarmingSavingsReportSchema, Rt as codeOverviewReportSchema, S as inboxItemWaitingConversationsSchema, Sn as forkConversationResponseSchema, T as inboxSnoozeResourceQuerySchema, Tt as pushSubscriptionDeleteBodySchema, V as serviceAccountListSchema, Vt as codeRepositoryQuerySchema, W as startServiceAccountSignInResponseSchema, Y as personalTokenListSchema, Yt as todoStatusBodySchema, Z as personalTokenParamsSchema, Zt as conversationWatchesReportSchema, _ as inboxItemCountSchema, _n as createAttachmentUploadBodySchema, _t as locationDirectoryReportSchema, a as versionsSchema, an as attachObjectLinkResponseSchema, at as peopleSearchReportSchema, b as inboxItemParamsSchema, bn as createConversationMessageBodySchema, bt as activityHours$2, cn as conversationStatsReportSchema, ct as personalSpendReportSchema, d as workspaceListSchema, dn as conversationDeliveryBodySchema, en as conversationChildAgentsReportSchema, et as actorDirectoryReportSchema, f as workspaceParamsSchema, fn as conversationDeliveryResponseSchema, ft as leadSchema, g as inboxItemCountQuerySchema, gn as attachmentUploadSchema, gt as locationDetailReportSchema, h as inboxItemActionSchema, hn as attachmentUploadParamsSchema, i as versionsQuerySchema, in as attachObjectLinkBodySchema, it as peopleSearchQuerySchema, j as updateGatewayProvidersBodySchema, jt as startConnectionResponseSchema, k as inboxSnoozeWakesClearSchema, l as deleteWorkspaceResponseSchema, lt as addSpaceMemberBodySchema, m as workspaceSchema, mn as conversationCatchUpSchema, mt as spaceConfigurationSchema, n as VERSIONS_STREAM_HEADER, nn as continueConversationInSlackResponseSchema, nt as avatarParamsSchema, on as objectLinksQuerySchema, ot as personCardReportSchema, pn as conversationCatchUpBodySchema, q as createPersonalTokenBodySchema, qt as conversationTodosReportSchema, r as VERSIONS_STREAM_KEEPALIVE_EVENT, s as statsReportSchema, sn as objectLinksReportSchema, st as personParamsSchema, tn as continueConversationInSlackBodySchema, tt as actorProfileReportSchema, u as workspaceBodySchema, un as conversationOutlineSchema, ut as spaceMemberListSchema, v as inboxItemListQuerySchema, vn as acceptedConversationMessageSchema, vt as locationParamsSchema, w as inboxSnoozeCreateSchema, wt as pushSubscriptionBodySchema, x as inboxItemSchema, xn as forkConversationBodySchema, xt as activitySixHours$1, y as inboxItemListSchema, yn as createConversationBodySchema, yt as activityDays$1, z as closeCacheWarmingBreakerResponseSchema, zt as codePersonReportSchema } from "./schema-DrBMdPmv.js";
|
|
6
|
+
import { A as steerConversationPendingMessagesBodySchema, B as skillDetailReportSchema, H as skillReportsSchema, M as healthReportSchema, N as pluginOperationalReportFeedSchema, O as conversationPendingMessagesReportSchema, R as pluginsSchema, _ as reorderPinnedConversationsResponseSchema, a as conversationInviteResponseSchema, g as reorderPinnedConversationsBodySchema, i as conversationInviteBodySchema, j as steerConversationPendingMessagesResponseSchema, k as conversationUnchangedDetailWithMailboxSchema, n as conversationFeedSchema, t as conversationFeedQuerySchema, w as conversationDetailWithMailboxReportSchema, z as runtimeInfoReportSchema } from "./conversation-feed-Sl8lKKmR.js";
|
|
7
|
+
import { Ht as listTodos, In as isExperimentalFeatureEnabled, It as readUserCustomization, Lt as saveUserCustomization, Rr as createPluginEgress, Ut as setTodoStatusByUser, V as parseEmail, Wt as pushConversationInboxItemsNow, bn as steerWebPendingMessages, kn as addConversationNote, z as isAllowedDomain } from "./mailbox-turn-79Nv1JXv.js";
|
|
8
|
+
import { C as joinSpace, D as readSpace, E as listSpaces, M as readLiveAttachment, O as updateSpace, S as createSpace, T as listSpaceMembers, _ as AttachmentUploadError, a as getSpaceLead, h as webActorFromUser, l as acceptsWebMessages, s as readSpaceLead, w as leaveSpace, x as writeAttachmentUpload, y as createAttachmentUpload } from "./turn-session-routing-GtetHsdO.js";
|
|
9
|
+
import { $ as readInboxItemForUser, $t as createViewerMcp, A as setConversationSubscriptionOperation, C as archiveDoneConversationsOperation, Ct as resolveObjectLinkNow, D as renameConversationOperation, E as pinConversationOperation, Et as guardedFetch, J as requireConversationPendingMessages, Jt as resolvePersonLink, M as setSpaceArchive, N as reorderPinnedConversations, O as setConversationAutoArchiveOperation, P as apiOperationHandler, Qt as readFirstHumanMessageTexts, S as archiveConversationOperation, St as readObjectLinkTypes, Tt as viewerCanViewPluginLink, X as InboxItemActionError, Y as resolveMentions, Yt as conversationRecordJoins, Z as actOnInboxItem, Zt as conversationSummaryFromStoredConversation, _ as appendConversationMessageForViewer, a as listWaitingConversations, at as readUserSettings, bt as OBJECT_LINK_TTL_MS, c as readConversationDetail, d as readConversationTreeMetricsFromSql, en as IMAGE_WIDTHS, f as conversationVersionsQuery, g as readConversationEvents, gt as startSavingsRefill, h as keepQuickQuestionForViewer, i as encodePageCursor, it as DEFAULT_USER_SETTINGS, j as stopConversationOperation, jt as getProductionSlackAdapter, k as setConversationSpaceOperation, l as readConversationAuxiliaryCostsFromSql, m as forkConversationForViewer, mt as readSavingsRefill, n as readConversationFeed, o as listedConversation, ot as updateUserSettings, p as readConversationDetailEtag, pt as scheduleInboxSnoozeTimer, r as decodePageCursor, s as notLeadConversation, t as conversationFeedVersionQuery, tn as decodeImageId, u as childAgentTotalsReport, v as createConversationForViewer, w as cancelQueuedMessagesOperation, wt as resolveObjectLinks, xt as readLinkObjectType, y as requireWebMessageConversation, yt as readHealthReport } from "./list-DXBz8SYL.js";
|
|
10
|
+
import { a as transcriptEntriesFromReportEvents, c as linkedCodeProviders, f as readConversationLastEventSeq, l as readConversationEventPage, m as reportParentAgentInput, o as codeChangeUrl, s as codeRepositoryUrl } from "./task-runner-DcdQJd9e.js";
|
|
11
|
+
import { t as runWithSlackInstallation } from "./adapter-context-BlSGE44V.js";
|
|
12
|
+
import { o as listChildAgents } from "./parent-result-Dg6P6roR.js";
|
|
13
|
+
import { i as continueConversationInSlack, r as canContinueInSlack, t as BUSY } from "./continue-in-slack-BGKjIdFp.js";
|
|
14
|
+
import { o as readSlackAttachmentSource } from "./start-conversation-Uh8Sk1EF.js";
|
|
18
15
|
import { u as sentry_exports } from "./sentry-CPbZjomA.js";
|
|
19
|
-
import { K as credentialContextForActor, M as webActorUserIds, a as finishServiceAccountSignIn, i as disconnectServiceAccount, l as serviceAccountPlugins, o as getServiceAccountStatus, u as startServiceAccountSignIn } from "./registry-D6kS6xYH.js";
|
|
20
|
-
import { i as getStateAdapter } from "./adapter-JARQvoLw.js";
|
|
21
16
|
import { a as fillUtcSixHours, c as trailingUtcDayWindow, d as utcHourKey, i as fillUtcHours, l as trailingUtcHourWindow, n as HOUR_MS$3, o as startOfUtcHour, r as fillUtcDays, s as sumUtcHoursIntoSixHours, t as DAY_MS$3, u as trailingUtcSixHourWindow } from "./reporting-window-C4dbzDiR.js";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
17
|
+
import { a as isConnectableProvider, c as startConnection, i as disconnectConnection, o as listConnections, t as escapeHtml, u as htmlCallbackResponse } from "./html-CfXEwl_h.js";
|
|
18
|
+
import { G as mapBounded, I as createPluginLogger } from "./transcript-BHhJVY0P.js";
|
|
19
|
+
import { D as listSpaceConfiguration } from "./job-runner-CySgpi9v.js";
|
|
25
20
|
import { n as userCustomizationSchema } from "./user-customization-B27StpVQ.js";
|
|
26
|
-
import {
|
|
27
|
-
import { t as
|
|
28
|
-
import { t as getVercelConversationWorkQueue } from "./vercel-queue-nL0Hq3hr.js";
|
|
21
|
+
import { s as getSandboxResources, t as getCachedSnapshot } from "./resolve-BUFkmxkT.js";
|
|
22
|
+
import { t as readDirectDatabaseUrl } from "./direct-url-BYgYfuIy.js";
|
|
29
23
|
import { Hono } from "hono";
|
|
30
24
|
import * as z from "zod";
|
|
31
25
|
import path from "node:path";
|
|
@@ -35,6 +29,8 @@ import { and, asc, count as count$1, desc, eq, exists, gt, gte, inArray, isNotNu
|
|
|
35
29
|
import { alias, union } from "drizzle-orm/pg-core";
|
|
36
30
|
import fs from "node:fs/promises";
|
|
37
31
|
import { readFileSync } from "node:fs";
|
|
32
|
+
import { Client } from "@neondatabase/serverless";
|
|
33
|
+
import pg from "pg";
|
|
38
34
|
import { HTTPException } from "hono/http-exception";
|
|
39
35
|
import { bodyLimit } from "hono/body-limit";
|
|
40
36
|
import { waitUntil } from "@vercel/functions";
|
|
@@ -703,13 +699,12 @@ async function steerConversationPendingMessagesForViewer(viewer, conversationId,
|
|
|
703
699
|
}
|
|
704
700
|
// src/api/cached-report.ts
|
|
705
701
|
const CACHE_NAMESPACE = "core";
|
|
706
|
-
const
|
|
707
|
-
const KEEP_MS = 36e5;
|
|
708
|
-
const RELOAD_WAIT_MS = 1e4;
|
|
702
|
+
const RELOAD_WAIT_MS = 3e4;
|
|
709
703
|
/**
|
|
710
704
|
* Create a reader for one report that is the same for every viewer. A cached
|
|
711
|
-
* report is served
|
|
712
|
-
* starts a background refresh.
|
|
705
|
+
* report is served until `keepMs` after its read. After `freshMs`, a request
|
|
706
|
+
* also starts a background refresh. With no cached report, one request reads
|
|
707
|
+
* it and the others wait for that read.
|
|
713
708
|
*/
|
|
714
709
|
function createCachedReport(source) {
|
|
715
710
|
const cachedSchema = z.object({
|
|
@@ -717,9 +712,9 @@ function createCachedReport(source) {
|
|
|
717
712
|
report: source.schema
|
|
718
713
|
}).strict();
|
|
719
714
|
const load = async () => ({
|
|
720
|
-
ttlMs:
|
|
715
|
+
ttlMs: source.keepMs,
|
|
721
716
|
value: {
|
|
722
|
-
refreshAtMs: Date.now() +
|
|
717
|
+
refreshAtMs: Date.now() + source.freshMs,
|
|
723
718
|
report: source.schema.parse(await source.read())
|
|
724
719
|
}
|
|
725
720
|
});
|
|
@@ -744,16 +739,11 @@ function createCachedReport(source) {
|
|
|
744
739
|
}, { "cache.key": [source.key] });
|
|
745
740
|
return ({ waitUntil }) => withSpan(source.key, "cache.get", {}, async (setSpanAttributes) => {
|
|
746
741
|
const state = getStateAdapter();
|
|
747
|
-
|
|
748
|
-
const
|
|
749
|
-
hit = false;
|
|
750
|
-
return load();
|
|
751
|
-
};
|
|
752
|
-
const parsed = cachedSchema.safeParse(await createCache(state, CACHE_NAMESPACE).getOrLoad(source.key, loadOnMiss));
|
|
742
|
+
const parsed = cachedSchema.safeParse(await createCache(state, CACHE_NAMESPACE).get(source.key));
|
|
743
|
+
const hit = parsed.success;
|
|
753
744
|
let cached;
|
|
754
745
|
if (parsed.success) cached = parsed.data;
|
|
755
746
|
else {
|
|
756
|
-
hit = false;
|
|
757
747
|
const reloaded = await reload(state, () => true, RELOAD_WAIT_MS);
|
|
758
748
|
cached = reloaded.acquired ? reloaded.value : (await load()).value;
|
|
759
749
|
}
|
|
@@ -763,7 +753,7 @@ function createCachedReport(source) {
|
|
|
763
753
|
"cache.hit": hit,
|
|
764
754
|
"cache.item_size": Buffer.byteLength(JSON.stringify(cached)),
|
|
765
755
|
"app.cache.stale": stale,
|
|
766
|
-
"app.cache.age_ms": now - (cached.refreshAtMs -
|
|
756
|
+
"app.cache.age_ms": now - (cached.refreshAtMs - source.freshMs)
|
|
767
757
|
});
|
|
768
758
|
if (stale) waitUntil(() => refresh(state));
|
|
769
759
|
return cached.report;
|
|
@@ -840,6 +830,235 @@ async function readConversationMetricBuckets(db, options) {
|
|
|
840
830
|
value: sql`sum(${juniorConversationMetrics.value})::double precision`
|
|
841
831
|
}).from(juniorConversationMetrics).where(and(gte(juniorConversationMetrics.occurredAt, options.start), lte(juniorConversationMetrics.occurredAt, options.end))).groupBy(date, juniorConversationMetrics.metric).orderBy(asc(date), asc(juniorConversationMetrics.metric));
|
|
842
832
|
}
|
|
833
|
+
const metrics$2 = juniorConversationMetrics;
|
|
834
|
+
/** Sum the values of one metric among grouped metric rows. */
|
|
835
|
+
function metricSum(metric) {
|
|
836
|
+
return sql`sum(${metrics$2.value}) FILTER (WHERE ${metrics$2.metric} = ${metric})`;
|
|
837
|
+
}
|
|
838
|
+
/** Sum the spend of Turn metric rows read straight from their table. */
|
|
839
|
+
const turnMetricColumns = { costMicroUsd: microUsdSql(metricSum("cost_micro_usd")) };
|
|
840
|
+
/** Root Conversation of a person's Turn, for status, location, and surface. */
|
|
841
|
+
const turnRoot = alias(juniorConversations, "person_turn_root");
|
|
842
|
+
/** Root of a Conversation row: itself when it has no root. */
|
|
843
|
+
const conversationRootId = sql`coalesce(
|
|
844
|
+
${juniorConversations.rootConversationId},
|
|
845
|
+
${juniorConversations.conversationId}
|
|
846
|
+
)`;
|
|
847
|
+
/**
|
|
848
|
+
* Read one row per verified person and root Conversation where they ran a
|
|
849
|
+
* Turn, over all time: the Turn range and the duration and token totals.
|
|
850
|
+
*
|
|
851
|
+
* The person and metric filters apply to the metric rows, and the rows are
|
|
852
|
+
* grouped before any join. Every Run writes a `duration_ms` row, so these
|
|
853
|
+
* two metrics mark every Turn.
|
|
854
|
+
*/
|
|
855
|
+
function personRoots(email) {
|
|
856
|
+
const verifiedIdentities = getDb().select({ id: juniorIdentities.id }).from(juniorIdentities).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(verifiedActorWhere(email));
|
|
857
|
+
const conversations = getDb().select({
|
|
858
|
+
identityId: sql`${metrics$2.actorIdentityId}`.as("turn_identity_id"),
|
|
859
|
+
conversationId: sql`${metrics$2.conversationId}`.as("turn_conversation_id"),
|
|
860
|
+
firstAt: sql`min(${metrics$2.occurredAt})`.as("turn_first_at"),
|
|
861
|
+
lastAt: sql`max(${metrics$2.occurredAt})`.as("turn_last_at"),
|
|
862
|
+
durationMs: metricSum("duration_ms").as("turn_duration_ms"),
|
|
863
|
+
tokens: metricSum("total_tokens").as("turn_tokens")
|
|
864
|
+
}).from(metrics$2).where(and(inArray(metrics$2.actorIdentityId, verifiedIdentities), inArray(metrics$2.metric, ["duration_ms", "total_tokens"]))).groupBy(metrics$2.actorIdentityId, metrics$2.conversationId).as("person_conversation_turns");
|
|
865
|
+
return getDb().select({
|
|
866
|
+
userId: sql`${juniorIdentities.userId}`.as("root_user_id"),
|
|
867
|
+
rootConversationId: conversationRootId.as("person_root_id"),
|
|
868
|
+
firstAt: sql`min(${conversations.firstAt})`.as("root_first_at"),
|
|
869
|
+
lastAt: sql`max(${conversations.lastAt})`.as("root_last_at"),
|
|
870
|
+
durationMs: sql`sum(${conversations.durationMs})`.as("root_duration_ms"),
|
|
871
|
+
tokens: sql`sum(${conversations.tokens})`.as("root_tokens"),
|
|
872
|
+
slackUserId: sql`max(CASE WHEN ${juniorIdentities.provider} = 'slack' THEN ${juniorIdentities.providerSubjectId} END)`.as("root_slack_user_id"),
|
|
873
|
+
slackUserName: sql`max(CASE WHEN ${juniorIdentities.provider} = 'slack' THEN ${juniorIdentities.handle} END)`.as("root_slack_user_name")
|
|
874
|
+
}).from(conversations).innerJoin(juniorIdentities, eq(juniorIdentities.id, conversations.identityId)).innerJoin(juniorConversations, eq(juniorConversations.conversationId, conversations.conversationId)).groupBy(juniorIdentities.userId, conversationRootId).as("person_roots");
|
|
875
|
+
}
|
|
876
|
+
/** Join a person's roots to the root Conversation rows. */
|
|
877
|
+
function personRootJoin(roots) {
|
|
878
|
+
return eq(turnRoot.conversationId, roots.rootConversationId);
|
|
879
|
+
}
|
|
880
|
+
/**
|
|
881
|
+
* Aggregate rows from {@link personRoots} joined to {@link turnRoot}. A
|
|
882
|
+
* Conversation counts once for each person who ran a Turn in it, and child
|
|
883
|
+
* Conversation Turns count for the root. Each row is one root of one person,
|
|
884
|
+
* so plain counts need no DISTINCT. Active and failed read the root's current
|
|
885
|
+
* status.
|
|
886
|
+
*/
|
|
887
|
+
function rootAggregateColumns(roots) {
|
|
888
|
+
return {
|
|
889
|
+
active: sql`(count(*) FILTER (WHERE ${conversationIsActiveSql(turnRoot)}))::integer`,
|
|
890
|
+
conversations: sql`count(*)::integer`,
|
|
891
|
+
durationMs: sql`COALESCE(sum(${roots.durationMs}), 0)::double precision`,
|
|
892
|
+
failed: sql`(count(*) FILTER (WHERE ${conversationTurnFailedSql(turnRoot)} AND ${turnRoot.stoppedAt} IS NULL))::integer`,
|
|
893
|
+
tokens: sql`sum(${roots.tokens})::double precision`
|
|
894
|
+
};
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* Count the UTC days on which the grouped person ran a Turn. A correlated
|
|
898
|
+
* subquery runs once per person through the actor index, so a bad row
|
|
899
|
+
* estimate cannot make Postgres repeat it once per root.
|
|
900
|
+
*/
|
|
901
|
+
function personActiveDays() {
|
|
902
|
+
const days = getDb().selectDistinct({ day: sql`(${metrics$2.occurredAt} AT TIME ZONE 'UTC')::date`.as("turn_day") }).from(metrics$2).innerJoin(juniorIdentities, eq(juniorIdentities.id, metrics$2.actorIdentityId)).where(and(eq(juniorIdentities.userId, juniorUsers.id), eq(juniorIdentities.kind, "user"), eq(juniorIdentities.emailVerified, true))).as("person_turn_days");
|
|
903
|
+
return sql`(${getDb().select({ days: sql`count(*)` }).from(days)})::integer`;
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Select the identity, Turn range, and totals of one person from roots
|
|
907
|
+
* grouped by person and joined to {@link juniorUsers}.
|
|
908
|
+
*/
|
|
909
|
+
function personTotalColumns(roots) {
|
|
910
|
+
return {
|
|
911
|
+
...rootAggregateColumns(roots),
|
|
912
|
+
activeDays: personActiveDays(),
|
|
913
|
+
email: sql`${juniorUsers.primaryEmailNormalized}`,
|
|
914
|
+
firstSeenAt: sql`min(${roots.firstAt})`.mapWith(metrics$2.occurredAt),
|
|
915
|
+
fullName: juniorUsers.displayName,
|
|
916
|
+
lastSeenAt: sql`max(${roots.lastAt})`.mapWith(metrics$2.occurredAt),
|
|
917
|
+
slackUserId: sql`max(${roots.slackUserId})`,
|
|
918
|
+
slackUserName: sql`max(${roots.slackUserName})`
|
|
919
|
+
};
|
|
920
|
+
}
|
|
921
|
+
/** Normalize emails before matching people API rows. */
|
|
922
|
+
function normalizeEmail$1(email) {
|
|
923
|
+
return email?.trim().toLowerCase() || void 0;
|
|
924
|
+
}
|
|
925
|
+
/** Build a zeroed totals object for people API aggregations. */
|
|
926
|
+
function emptyTotals() {
|
|
927
|
+
return {
|
|
928
|
+
active: 0,
|
|
929
|
+
activeDays: 0,
|
|
930
|
+
conversations: 0,
|
|
931
|
+
durationMs: 0,
|
|
932
|
+
failed: 0
|
|
933
|
+
};
|
|
934
|
+
}
|
|
935
|
+
/** Build a zeroed activity day for the people profile window. */
|
|
936
|
+
function emptyActivityDay(date) {
|
|
937
|
+
return {
|
|
938
|
+
active: 0,
|
|
939
|
+
conversations: 0,
|
|
940
|
+
date,
|
|
941
|
+
durationMs: 0,
|
|
942
|
+
failed: 0
|
|
943
|
+
};
|
|
944
|
+
}
|
|
945
|
+
/** Fill the fixed people profile activity window from sparse day totals. */
|
|
946
|
+
function activityDays(days, nowMs) {
|
|
947
|
+
return fillUtcDays({
|
|
948
|
+
count: 365,
|
|
949
|
+
empty: emptyActivityDay,
|
|
950
|
+
nowMs,
|
|
951
|
+
rows: days
|
|
952
|
+
});
|
|
953
|
+
}
|
|
954
|
+
/**
|
|
955
|
+
* Fill the trailing 7-day people activity hour window from known hour totals.
|
|
956
|
+
* 24h charts use the last 24 points. 7d charts sum hours into 6-hour buckets.
|
|
957
|
+
*/
|
|
958
|
+
function activityHours$1(hours, nowMs) {
|
|
959
|
+
return fillUtcHours({
|
|
960
|
+
count: 168,
|
|
961
|
+
empty: emptyActivityDay,
|
|
962
|
+
nowMs,
|
|
963
|
+
rows: hours
|
|
964
|
+
});
|
|
965
|
+
}
|
|
966
|
+
/**
|
|
967
|
+
* Fill trailing 6-hour people activity buckets from hour keys or hour rows.
|
|
968
|
+
* Hour keys must be summed into 6-hour keys first.
|
|
969
|
+
*/
|
|
970
|
+
function activitySixHours(hours, nowMs) {
|
|
971
|
+
const series = hours instanceof Map ? activityHours$1(hours, nowMs) : [...hours];
|
|
972
|
+
return sumUtcHoursIntoSixHours({
|
|
973
|
+
empty: emptyActivityDay,
|
|
974
|
+
hours: series,
|
|
975
|
+
nowMs
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
/** Return deterministic stats rows for people API responses. */
|
|
979
|
+
function statsItems(map) {
|
|
980
|
+
return [...map.values()].sort((left, right) => right.conversations - left.conversations || right.durationMs - left.durationMs || left.label.localeCompare(right.label));
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* Build the verified person actor predicate shared by People aggregate and
|
|
984
|
+
* recent-row queries.
|
|
985
|
+
*
|
|
986
|
+
* Any provider counts, so Slack and dashboard (web) Conversations roll up to
|
|
987
|
+
* the same person. System identities never count.
|
|
988
|
+
*/
|
|
989
|
+
function verifiedActorWhere(email) {
|
|
990
|
+
const normalizedEmail = normalizeEmail$1(email);
|
|
991
|
+
return and(eq(juniorIdentities.kind, "user"), eq(juniorIdentities.emailVerified, true), sql`${juniorUsers.primaryEmailNormalized} IS NOT NULL`, normalizedEmail ? eq(juniorUsers.primaryEmailNormalized, normalizedEmail) : void 0);
|
|
992
|
+
}
|
|
993
|
+
/** Read the Conversations where a person ran a Turn, by their last Turn. */
|
|
994
|
+
async function recentActorRows(email) {
|
|
995
|
+
const lastTurns = getDb().select({
|
|
996
|
+
conversationId: sql`${metrics$2.conversationId}`.as("turn_conversation_id"),
|
|
997
|
+
lastTurnAt: sql`max(${metrics$2.occurredAt})`.as("last_turn_at")
|
|
998
|
+
}).from(metrics$2).innerJoin(juniorIdentities, eq(juniorIdentities.id, metrics$2.actorIdentityId)).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(and(verifiedActorWhere(email), eq(metrics$2.metric, "duration_ms"))).groupBy(metrics$2.conversationId).as("person_last_turns");
|
|
999
|
+
return getDb().select({
|
|
1000
|
+
channelName: juniorConversations.channelName,
|
|
1001
|
+
conversationId: juniorConversations.conversationId,
|
|
1002
|
+
createdAt: juniorConversations.createdAt,
|
|
1003
|
+
destinationId: juniorDestinations.id,
|
|
1004
|
+
durationMs: juniorConversations.durationMs,
|
|
1005
|
+
email: juniorUsers.primaryEmailNormalized,
|
|
1006
|
+
executionStatus: juniorConversations.executionStatus,
|
|
1007
|
+
executionUpdatedAt: juniorConversations.executionUpdatedAt,
|
|
1008
|
+
fullName: juniorUsers.displayName,
|
|
1009
|
+
kind: juniorConversations.kind,
|
|
1010
|
+
parentConversationId: juniorConversations.parentConversationId,
|
|
1011
|
+
archivedAt: juniorConversations.archivedAt,
|
|
1012
|
+
handle: sql`CASE WHEN ${juniorIdentities.provider} = 'slack' THEN ${juniorIdentities.handle} END`,
|
|
1013
|
+
lastActivityAt: juniorConversations.lastActivityAt,
|
|
1014
|
+
providerSubjectId: sql`CASE WHEN ${juniorIdentities.provider} = 'slack' THEN ${juniorIdentities.providerSubjectId} END`,
|
|
1015
|
+
source: juniorConversations.source,
|
|
1016
|
+
status: conversationStatusSql(juniorConversations),
|
|
1017
|
+
title: juniorConversations.title,
|
|
1018
|
+
updatedAt: juniorConversations.updatedAt,
|
|
1019
|
+
usage: juniorConversations.usage
|
|
1020
|
+
}).from(lastTurns).innerJoin(juniorConversations, eq(juniorConversations.conversationId, lastTurns.conversationId)).leftJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).leftJoin(juniorDestinations, eq(juniorDestinations.id, juniorConversations.destinationId)).where(notLeadConversation()).orderBy(desc(lastTurns.lastTurnAt), asc(juniorConversations.conversationId)).limit(25);
|
|
1021
|
+
}
|
|
1022
|
+
// src/api/conversations/person-spend-days.ts
|
|
1023
|
+
const metrics$1 = juniorConversationMetrics;
|
|
1024
|
+
/**
|
|
1025
|
+
* Read model spend per UTC day, split between verified people and Turns with
|
|
1026
|
+
* no verified person, with the count of active people and the median spend
|
|
1027
|
+
* of one person. A person is one Junior user, so their Slack and web
|
|
1028
|
+
* Identities count once. Every Run writes a `duration_ms` row, so a person
|
|
1029
|
+
* with a Turn but no cost row counts with zero spend.
|
|
1030
|
+
*
|
|
1031
|
+
* Metric rows are grouped by day and Identity before any join, so the joins
|
|
1032
|
+
* read one row per Identity and day.
|
|
1033
|
+
*/
|
|
1034
|
+
async function readPersonSpendDays(db, options) {
|
|
1035
|
+
const day = sql`date_trunc('day', ${metrics$1.occurredAt} at time zone 'UTC')`;
|
|
1036
|
+
const identityDays = db.select({
|
|
1037
|
+
date: day.as("identity_day_date"),
|
|
1038
|
+
identityId: sql`${metrics$1.actorIdentityId}`.as("identity_day_identity_id"),
|
|
1039
|
+
costMicroUsd: sql`coalesce(sum(${metrics$1.value}) FILTER (
|
|
1040
|
+
WHERE ${metrics$1.metric} = 'cost_micro_usd'
|
|
1041
|
+
), 0)`.as("identity_day_micro_usd")
|
|
1042
|
+
}).from(metrics$1).where(and(inArray(metrics$1.metric, ["duration_ms", "cost_micro_usd"]), gte(metrics$1.occurredAt, options.start), lte(metrics$1.occurredAt, options.end))).groupBy(day, metrics$1.actorIdentityId).as("person_identity_days");
|
|
1043
|
+
const identityPeople = db.select({
|
|
1044
|
+
date: sql`${identityDays.date}`.as("identity_person_date"),
|
|
1045
|
+
userId: sql`CASE WHEN ${verifiedActorWhere()} THEN ${juniorUsers.id} END`.as("identity_person_user_id"),
|
|
1046
|
+
costMicroUsd: sql`${identityDays.costMicroUsd}`.as("identity_person_micro_usd")
|
|
1047
|
+
}).from(identityDays).leftJoin(juniorIdentities, eq(juniorIdentities.id, identityDays.identityId)).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).as("person_identity_people");
|
|
1048
|
+
const personDays = db.select({
|
|
1049
|
+
date: sql`${identityPeople.date}`.as("person_day_date"),
|
|
1050
|
+
userId: sql`${identityPeople.userId}`.as("person_day_user_id"),
|
|
1051
|
+
costMicroUsd: sql`sum(${identityPeople.costMicroUsd})`.as("person_day_micro_usd")
|
|
1052
|
+
}).from(identityPeople).groupBy(identityPeople.date, identityPeople.userId).as("person_days");
|
|
1053
|
+
const person = sql`${personDays.userId} IS NOT NULL`;
|
|
1054
|
+
return await db.select({
|
|
1055
|
+
date: sql`to_char(${personDays.date}, 'YYYY-MM-DD')`,
|
|
1056
|
+
medianPersonCostMicroUsd: sql`(percentile_cont(0.5) WITHIN GROUP (ORDER BY ${personDays.costMicroUsd}) FILTER (WHERE ${person}))::double precision`,
|
|
1057
|
+
people: sql`(count(*) FILTER (WHERE ${person}))::integer`,
|
|
1058
|
+
personCostMicroUsd: sql`coalesce(sum(${personDays.costMicroUsd}) FILTER (WHERE ${person}), 0)::double precision`,
|
|
1059
|
+
unattributedCostMicroUsd: sql`coalesce(sum(${personDays.costMicroUsd}) FILTER (WHERE NOT ${person}), 0)::double precision`
|
|
1060
|
+
}).from(personDays).groupBy(personDays.date);
|
|
1061
|
+
}
|
|
843
1062
|
// src/api/conversations/outcome-buckets.ts
|
|
844
1063
|
const changes = juniorCodeChanges;
|
|
845
1064
|
const linked$1 = alias(juniorConversations, "linked");
|
|
@@ -947,6 +1166,7 @@ async function readWindowMerges(db, options) {
|
|
|
947
1166
|
}] : []);
|
|
948
1167
|
}
|
|
949
1168
|
// src/api/conversations/stats.query.ts
|
|
1169
|
+
const WINDOW_DAYS$1 = 90;
|
|
950
1170
|
function addUsd(current, next) {
|
|
951
1171
|
return Math.round(((current ?? 0) + next) * 0xe8d4a51000) / 0xe8d4a51000;
|
|
952
1172
|
}
|
|
@@ -1119,6 +1339,23 @@ function guardianStats(dayRows, hourRows, endMs) {
|
|
|
1119
1339
|
...costUsd !== void 0 ? { costUsd } : void 0
|
|
1120
1340
|
};
|
|
1121
1341
|
}
|
|
1342
|
+
function personSpendDay(row) {
|
|
1343
|
+
return {
|
|
1344
|
+
date: row.date,
|
|
1345
|
+
people: row.people,
|
|
1346
|
+
personCostUsd: microUsdToUsd(row.personCostMicroUsd),
|
|
1347
|
+
unattributedCostUsd: microUsdToUsd(row.unattributedCostMicroUsd),
|
|
1348
|
+
...row.medianPersonCostMicroUsd !== null ? { medianPersonCostUsd: microUsdToUsd(row.medianPersonCostMicroUsd) } : void 0
|
|
1349
|
+
};
|
|
1350
|
+
}
|
|
1351
|
+
function emptyPersonSpendDay(date) {
|
|
1352
|
+
return {
|
|
1353
|
+
date,
|
|
1354
|
+
people: 0,
|
|
1355
|
+
personCostUsd: 0,
|
|
1356
|
+
unattributedCostUsd: 0
|
|
1357
|
+
};
|
|
1358
|
+
}
|
|
1122
1359
|
/** Sum hour rows into UTC day rows, one per day and `key`. */
|
|
1123
1360
|
function sumHoursIntoDays(hours, add, key = () => "") {
|
|
1124
1361
|
const days = /* @__PURE__ */ new Map();
|
|
@@ -1135,7 +1372,7 @@ function sumHoursIntoDays(hours, add, key = () => "") {
|
|
|
1135
1372
|
return [...days.values()];
|
|
1136
1373
|
}
|
|
1137
1374
|
/** Count the window roots that have a tree, per UTC hour of last activity. */
|
|
1138
|
-
function activityHours
|
|
1375
|
+
function activityHours(roots) {
|
|
1139
1376
|
const hours = /* @__PURE__ */ new Map();
|
|
1140
1377
|
for (const root of roots) {
|
|
1141
1378
|
if (root.treeConversations === 0) continue;
|
|
@@ -1154,7 +1391,7 @@ async function readConversationStatsFromSql() {
|
|
|
1154
1391
|
const nowMs = Date.now();
|
|
1155
1392
|
const { end, start } = statsWindow(nowMs);
|
|
1156
1393
|
const db = getDb();
|
|
1157
|
-
const [windowRoots, metrics, merges, guardian] = await Promise.all([
|
|
1394
|
+
const [windowRoots, metrics, merges, guardian, personSpend] = await Promise.all([
|
|
1158
1395
|
readWindowRoots(db, {
|
|
1159
1396
|
start,
|
|
1160
1397
|
end
|
|
@@ -1170,9 +1407,13 @@ async function readConversationStatsFromSql() {
|
|
|
1170
1407
|
readGuardianHours(db, getStateAdapter(), {
|
|
1171
1408
|
start,
|
|
1172
1409
|
end
|
|
1410
|
+
}),
|
|
1411
|
+
readPersonSpendDays(db, {
|
|
1412
|
+
start,
|
|
1413
|
+
end
|
|
1173
1414
|
})
|
|
1174
1415
|
]);
|
|
1175
|
-
const activity = activityHours
|
|
1416
|
+
const activity = activityHours(windowRoots);
|
|
1176
1417
|
const outcomes = outcomeBuckets({ merges });
|
|
1177
1418
|
const hours = metricHours(applyMetricBuckets(activity, metrics, outcomes), nowMs);
|
|
1178
1419
|
return {
|
|
@@ -1194,6 +1435,12 @@ async function readConversationStatsFromSql() {
|
|
|
1194
1435
|
})), nowMs),
|
|
1195
1436
|
metricHours: hours,
|
|
1196
1437
|
metricSixHours: sumMetricHoursIntoSixHours(hours, nowMs),
|
|
1438
|
+
personSpendDays: fillUtcDays({
|
|
1439
|
+
count: WINDOW_DAYS$1,
|
|
1440
|
+
empty: emptyPersonSpendDay,
|
|
1441
|
+
nowMs,
|
|
1442
|
+
rows: new Map(personSpend.map((row) => [row.date, personSpendDay(row)]))
|
|
1443
|
+
}),
|
|
1197
1444
|
source: "conversation_index",
|
|
1198
1445
|
windowEnd: end.toISOString(),
|
|
1199
1446
|
windowStart: start.toISOString()
|
|
@@ -1202,6 +1449,8 @@ async function readConversationStatsFromSql() {
|
|
|
1202
1449
|
// src/api/conversations/stats.ts
|
|
1203
1450
|
/** Load aggregate conversation stats from durable SQL records. */
|
|
1204
1451
|
const readConversationStats = createCachedReport({
|
|
1452
|
+
freshMs: 3e5,
|
|
1453
|
+
keepMs: 36e5,
|
|
1205
1454
|
key: "conversation-stats",
|
|
1206
1455
|
read: readConversationStatsFromSql,
|
|
1207
1456
|
refreshFailedEvent: "conversation_stats.refresh.failed",
|
|
@@ -1330,7 +1579,7 @@ function createConversationRoutes(options) {
|
|
|
1330
1579
|
const app = new Hono();
|
|
1331
1580
|
const messageBodyLimit = bodyLimit({ maxSize: 262144 });
|
|
1332
1581
|
app.get("/", validateRequest("query", conversationFeedQuerySchema, "Invalid query parameters."), async (context) => {
|
|
1333
|
-
const { actorEmail, codeRepositoryId, cursor, include, q, status } = context.req.valid("query");
|
|
1582
|
+
const { actorEmail, codeRepositoryId, cursor, include, q, spaceId, status } = context.req.valid("query");
|
|
1334
1583
|
const viewer = context.get("viewer");
|
|
1335
1584
|
let waitingRows = 0;
|
|
1336
1585
|
const feed = await readConversationFeed({
|
|
@@ -1342,6 +1591,7 @@ function createConversationRoutes(options) {
|
|
|
1342
1591
|
waitingRows = count;
|
|
1343
1592
|
},
|
|
1344
1593
|
...q ? { q } : void 0,
|
|
1594
|
+
...spaceId ? { spaceId } : void 0,
|
|
1345
1595
|
status,
|
|
1346
1596
|
...viewer ? { viewer } : void 0
|
|
1347
1597
|
});
|
|
@@ -1385,6 +1635,7 @@ function createConversationRoutes(options) {
|
|
|
1385
1635
|
app.post("/:conversationId/forks", requireViewer, bodyLimit({ maxSize: 32768 }), validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", forkConversationBodySchema, "Invalid request body."), async (context) => jsonResponse(forkConversationResponseSchema, await forkConversationForViewer(context.get("viewer"), context.req.valid("param").conversationId, context.req.valid("json"))));
|
|
1386
1636
|
app.post("/:conversationId/quick-question/keep", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), async (context) => jsonResponse(forkConversationResponseSchema, await keepQuickQuestionForViewer(context.get("viewer"), context.req.valid("param").conversationId)));
|
|
1387
1637
|
app.patch("/:conversationId/archive", requireViewer, apiOperationHandler(archiveConversationOperation, options));
|
|
1638
|
+
app.put("/:conversationId/space", requireViewer, apiOperationHandler(setConversationSpaceOperation, options));
|
|
1388
1639
|
app.patch("/:conversationId/pin", requireViewer, apiOperationHandler(pinConversationOperation, options));
|
|
1389
1640
|
app.patch("/:conversationId/delivery", requireViewer, validateRequest("param", conversationParamsSchema, "Invalid route parameters."), validateRequest("json", conversationDeliveryBodySchema, "Invalid request body."), async (context) => jsonResponse(conversationDeliveryResponseSchema, await setConversationDeliveryForViewer(context.get("viewer"), context.req.valid("param").conversationId, context.req.valid("json"))));
|
|
1390
1641
|
app.patch("/:conversationId/subscription", requireViewer, apiOperationHandler(setConversationSubscriptionOperation, options));
|
|
@@ -1521,6 +1772,55 @@ function createConversationRoutes(options) {
|
|
|
1521
1772
|
});
|
|
1522
1773
|
return app;
|
|
1523
1774
|
}
|
|
1775
|
+
// src/api/code/stacks.ts
|
|
1776
|
+
/**
|
|
1777
|
+
* Read the stack of each code change: the Automation that ran its first
|
|
1778
|
+
* Conversation's root, or else that root. The first Conversation is the
|
|
1779
|
+
* earliest created one, since `conversation_ids` is sorted by id. A change
|
|
1780
|
+
* whose root the viewer may not read has no stack, so its title stays
|
|
1781
|
+
* hidden.
|
|
1782
|
+
*/
|
|
1783
|
+
async function readCodeChangeStacks(db, changes, viewer) {
|
|
1784
|
+
const linkedIds = [...new Set(changes.flatMap((change) => change.conversationIds))];
|
|
1785
|
+
const createdAt = new Map((linkedIds.length === 0 ? [] : await db.select({
|
|
1786
|
+
conversationId: juniorConversations.conversationId,
|
|
1787
|
+
createdAt: juniorConversations.createdAt
|
|
1788
|
+
}).from(juniorConversations).where(inArray(juniorConversations.conversationId, linkedIds))).map((row) => [row.conversationId, row.createdAt.getTime()]));
|
|
1789
|
+
const firstIds = new Map(changes.flatMap((change) => {
|
|
1790
|
+
const [first] = change.conversationIds.filter((id) => createdAt.has(id)).sort((a, b) => createdAt.get(a) - createdAt.get(b) || a.localeCompare(b));
|
|
1791
|
+
return first ? [[change.id, first]] : [];
|
|
1792
|
+
}));
|
|
1793
|
+
const access = await readConversationAccessFromSql(db, [...new Set(firstIds.values())], viewer);
|
|
1794
|
+
const rootIds = [...new Set([...access.values()].flatMap((entry) => entry.canViewPrivateContent && entry.rootConversationId ? [entry.rootConversationId] : []))];
|
|
1795
|
+
const roots = rootIds.length === 0 ? [] : await db.select({
|
|
1796
|
+
automationId: juniorAutomations.id,
|
|
1797
|
+
automationKind: juniorAutomations.kind,
|
|
1798
|
+
automationTask: sql`${juniorAutomations.record}->'task'`,
|
|
1799
|
+
automationTitle: juniorAutomations.title,
|
|
1800
|
+
conversationId: juniorConversations.conversationId,
|
|
1801
|
+
title: juniorConversations.title
|
|
1802
|
+
}).from(juniorConversations).leftJoin(juniorAutomationRuns, eq(juniorAutomationRuns.conversationId, juniorConversations.conversationId)).leftJoin(juniorAutomations, eq(juniorAutomations.id, juniorAutomationRuns.automationId)).where(inArray(juniorConversations.conversationId, rootIds));
|
|
1803
|
+
const stackOfRoot = new Map(roots.map((root) => [root.conversationId, root.automationId && root.automationKind ? {
|
|
1804
|
+
id: root.automationId,
|
|
1805
|
+
kind: "automation",
|
|
1806
|
+
title: collectionRowTitle({
|
|
1807
|
+
kind: root.automationKind,
|
|
1808
|
+
task: root.automationTask,
|
|
1809
|
+
title: root.automationTitle
|
|
1810
|
+
})
|
|
1811
|
+
} : {
|
|
1812
|
+
id: root.conversationId,
|
|
1813
|
+
kind: "conversation",
|
|
1814
|
+
...root.title ? { title: root.title } : void 0
|
|
1815
|
+
}]));
|
|
1816
|
+
const stacks = /* @__PURE__ */ new Map();
|
|
1817
|
+
for (const [changeId, conversationId] of firstIds) {
|
|
1818
|
+
const entry = access.get(conversationId);
|
|
1819
|
+
const stack = entry?.canViewPrivateContent && entry.rootConversationId ? stackOfRoot.get(entry.rootConversationId) : void 0;
|
|
1820
|
+
if (stack) stacks.set(changeId, stack);
|
|
1821
|
+
}
|
|
1822
|
+
return stacks;
|
|
1823
|
+
}
|
|
1524
1824
|
// src/api/code/overview.ts
|
|
1525
1825
|
const DAY_MS$2 = 864e5;
|
|
1526
1826
|
const WINDOW_DAYS = 30;
|
|
@@ -1600,9 +1900,13 @@ async function readTreeCosts(conversationIds) {
|
|
|
1600
1900
|
};
|
|
1601
1901
|
}
|
|
1602
1902
|
/**
|
|
1603
|
-
* True when any linked conversation actor belongs to the subject user
|
|
1604
|
-
*
|
|
1605
|
-
*
|
|
1903
|
+
* True when any linked conversation actor belongs to the subject user, or
|
|
1904
|
+
* the code change credits one of the user's Identities as requester. A
|
|
1905
|
+
* Thread or an Automation run that someone else started can open a change
|
|
1906
|
+
* for the user, so the requester half finds the changes the actor half
|
|
1907
|
+
* misses. The first subquery starts from the user's Conversations, so
|
|
1908
|
+
* Postgres hash-joins them with the linked ids instead of one lookup per
|
|
1909
|
+
* code change. The second uses the requester GIN index.
|
|
1606
1910
|
*/
|
|
1607
1911
|
function ownedByUserSql(userId) {
|
|
1608
1912
|
return sql`${juniorCodeChanges.id} IN (
|
|
@@ -1616,6 +1920,12 @@ function ownedByUserSql(userId) {
|
|
|
1616
1920
|
) AS linked
|
|
1617
1921
|
ON linked.conversation_id = conversations.conversation_id
|
|
1618
1922
|
WHERE identities.user_id = ${userId}
|
|
1923
|
+
UNION ALL
|
|
1924
|
+
SELECT requested.id
|
|
1925
|
+
FROM junior_identities AS identities
|
|
1926
|
+
INNER JOIN junior_code_changes AS requested
|
|
1927
|
+
ON requested.requester_identity_ids @> ARRAY[identities.id]
|
|
1928
|
+
WHERE identities.user_id = ${userId}
|
|
1619
1929
|
)`;
|
|
1620
1930
|
}
|
|
1621
1931
|
/** Limit code changes to one person's conversations or one repository. */
|
|
@@ -1691,11 +2001,7 @@ async function readCodeWindows(args) {
|
|
|
1691
2001
|
}
|
|
1692
2002
|
/** Columns read for one code change report row. */
|
|
1693
2003
|
const codeChangeReportColumns = {
|
|
1694
|
-
additions: juniorCodeChanges.additions,
|
|
1695
|
-
changedFiles: juniorCodeChanges.changedFiles,
|
|
1696
2004
|
closedAt: juniorCodeChanges.closedAt,
|
|
1697
|
-
deletions: juniorCodeChanges.deletions,
|
|
1698
|
-
draft: juniorCodeChanges.draft,
|
|
1699
2005
|
id: juniorCodeChanges.id,
|
|
1700
2006
|
lastActivityAt: juniorCodeChanges.lastActivityAt,
|
|
1701
2007
|
mergedAt: juniorCodeChanges.mergedAt,
|
|
@@ -1707,14 +2013,9 @@ const codeChangeReportColumns = {
|
|
|
1707
2013
|
title: juniorCodeChanges.title
|
|
1708
2014
|
};
|
|
1709
2015
|
/** Convert one code change row to its report shape. */
|
|
1710
|
-
function codeChangeReport(
|
|
1711
|
-
const size = {};
|
|
1712
|
-
if (additions !== null) size.additions = additions;
|
|
1713
|
-
if (deletions !== null) size.deletions = deletions;
|
|
1714
|
-
if (changedFiles !== null) size.changedFiles = changedFiles;
|
|
2016
|
+
function codeChangeReport(change) {
|
|
1715
2017
|
return {
|
|
1716
2018
|
...change,
|
|
1717
|
-
...Object.keys(size).length > 0 ? { size } : void 0,
|
|
1718
2019
|
closedAt: change.closedAt?.toISOString(),
|
|
1719
2020
|
lastActivityAt: change.lastActivityAt?.toISOString(),
|
|
1720
2021
|
mergedAt: change.mergedAt?.toISOString(),
|
|
@@ -1792,8 +2093,8 @@ function afterPersonCodeCursor(cursor) {
|
|
|
1792
2093
|
return or(completed, sql`${idleSince} > ${since}`, and(sql`${idleSince} = ${since}`, laterInGroup));
|
|
1793
2094
|
}
|
|
1794
2095
|
/**
|
|
1795
|
-
* Read person-scoped code activity and recent code changes linked
|
|
1796
|
-
*
|
|
2096
|
+
* Read person-scoped code activity and recent code changes: the ones linked
|
|
2097
|
+
* to the person's Conversations, and the ones that credit them as requester.
|
|
1797
2098
|
*/
|
|
1798
2099
|
async function readPersonCodeOverview(args) {
|
|
1799
2100
|
const nowMs = args.nowMs ?? Date.now();
|
|
@@ -1804,14 +2105,25 @@ async function readPersonCodeOverview(args) {
|
|
|
1804
2105
|
userId: args.userId
|
|
1805
2106
|
}), db.select({
|
|
1806
2107
|
change: codeChangeReportColumns,
|
|
2108
|
+
conversationIds: juniorCodeChanges.conversationIds,
|
|
1807
2109
|
updatedAt: juniorCodeChanges.updatedAt
|
|
1808
2110
|
}).from(juniorCodeChanges).innerJoin(juniorCodeRepositories, eq(juniorCodeChanges.repositoryId, juniorCodeRepositories.id)).where(and(changeScopeFilter({ userId: args.userId }), after ? afterPersonCodeCursor(after) : void 0)).orderBy(desc(sql`${juniorCodeChanges.state} = 'open'`), asc(sql`CASE WHEN ${juniorCodeChanges.state} = 'open' THEN ${idleSince} END`), desc(juniorCodeChanges.updatedAt), asc(juniorCodeChanges.id)).limit(PERSON_CHANGE_LIMIT)]);
|
|
2111
|
+
const stacks = await readCodeChangeStacks(db, changes.map((row) => ({
|
|
2112
|
+
conversationIds: row.conversationIds,
|
|
2113
|
+
id: row.change.id
|
|
2114
|
+
})), args.viewer);
|
|
1809
2115
|
const last = changes.at(-1);
|
|
1810
2116
|
return {
|
|
1811
2117
|
activityDays: windows.activityDays,
|
|
1812
2118
|
activityHours: windows.activityHours,
|
|
1813
2119
|
activitySixHours: windows.activitySixHours,
|
|
1814
|
-
changes: changes.map((row) =>
|
|
2120
|
+
changes: changes.map((row) => {
|
|
2121
|
+
const stack = stacks.get(row.change.id);
|
|
2122
|
+
return {
|
|
2123
|
+
...codeChangeReport(row.change),
|
|
2124
|
+
...stack ? { stack } : void 0
|
|
2125
|
+
};
|
|
2126
|
+
}),
|
|
1815
2127
|
generatedAt: windows.windowEnd.toISOString(),
|
|
1816
2128
|
nextCursor: last && changes.length === PERSON_CHANGE_LIMIT ? encodePageCursor(personCodeCursorSchema, {
|
|
1817
2129
|
id: last.change.id,
|
|
@@ -1891,8 +2203,8 @@ async function readCodeRepository(repositoryId, options = {}) {
|
|
|
1891
2203
|
// src/api/code/search.query.ts
|
|
1892
2204
|
const CODE_CHANGE_SEARCH_LIMIT = 8;
|
|
1893
2205
|
const CODE_CHANGE_SEARCH_TERMS = 4;
|
|
1894
|
-
const
|
|
1895
|
-
const
|
|
2206
|
+
const CODE_CHANGE_SEARCH_TIMEOUT_MS = 3e3;
|
|
2207
|
+
const matched = alias(juniorCodeChanges, "matched");
|
|
1896
2208
|
const linked = alias(juniorConversations, "linked_conversation");
|
|
1897
2209
|
/**
|
|
1898
2210
|
* Find code changes for the composer `#` menu, newest activity first. A
|
|
@@ -1911,16 +2223,20 @@ async function readCodeChangeSearchFromSql(query, viewerUserId) {
|
|
|
1911
2223
|
const anyTerm = terms.map((term) => `${term}:*`).join(" | ");
|
|
1912
2224
|
const db = getDb();
|
|
1913
2225
|
const changeDocument = codeChangeSearchDocument(juniorCodeChanges);
|
|
1914
|
-
const
|
|
1915
|
-
const
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
2226
|
+
const repositoryDocument = codeRepositorySearchDocument(juniorCodeRepositories);
|
|
2227
|
+
const textMatch = (condition) => db.select({ id: matched.id }).from(matched).innerJoin(juniorCodeRepositories, eq(juniorCodeRepositories.id, matched.repositoryId)).where(and(condition, terms.length > 1 ? sql`(${codeChangeSearchDocument(matched)} || ${repositoryDocument}) @@ to_tsquery('simple', ${everyTerm})` : void 0));
|
|
2228
|
+
const matches = number ? and(sql`${changeDocument} @@ to_tsquery('simple', ${everyTerm})`, sql`${juniorCodeChanges.number}::text like ${`${number}%`}`) : inArray(juniorCodeChanges.id, union(textMatch(sql`${codeChangeSearchDocument(matched)} @@ to_tsquery('simple', ${anyTerm})`), textMatch(sql`${repositoryDocument} @@ to_tsquery('simple', ${anyTerm})`)));
|
|
2229
|
+
const visible = exists(db.select({ conversationId: juniorConversations.conversationId }).from(linked).innerJoin(juniorConversations, eq(juniorConversations.conversationId, sql`coalesce(${linked.rootConversationId}, ${linked.conversationId})`)).leftJoin(juniorDestinations, conversationRecordJoins.location).where(and(sql`${linked.conversationId} = any(${juniorCodeChanges.conversationIds})`, listedConversation(), rootVisibleToViewer(viewerUserId))));
|
|
2230
|
+
return (await db.transaction(async (tx) => {
|
|
2231
|
+
await tx.execute(sql`SELECT set_config('statement_timeout', ${String(CODE_CHANGE_SEARCH_TIMEOUT_MS)}, true)`);
|
|
2232
|
+
return await tx.select({
|
|
2233
|
+
number: juniorCodeChanges.number,
|
|
2234
|
+
provider: juniorCodeChanges.provider,
|
|
2235
|
+
repository: juniorCodeRepositories.name,
|
|
2236
|
+
state: juniorCodeChanges.state,
|
|
2237
|
+
title: juniorCodeChanges.title
|
|
2238
|
+
}).from(juniorCodeChanges).innerJoin(juniorCodeRepositories, eq(juniorCodeRepositories.id, juniorCodeChanges.repositoryId)).where(and(matches, inArray(juniorCodeChanges.provider, providers), visible)).orderBy(...number ? [desc(sql`${juniorCodeChanges.number}::text = ${number}`)] : [], desc(sql`coalesce(${juniorCodeChanges.lastActivityAt}, ${juniorCodeChanges.openedAt})`), asc(juniorCodeChanges.id)).limit(CODE_CHANGE_SEARCH_LIMIT);
|
|
2239
|
+
})).flatMap(({ provider, ...row }) => {
|
|
1924
2240
|
const url = codeChangeUrl({
|
|
1925
2241
|
...row,
|
|
1926
2242
|
provider
|
|
@@ -2122,8 +2438,8 @@ function summaryFromRow(row, options = {}) {
|
|
|
2122
2438
|
});
|
|
2123
2439
|
}
|
|
2124
2440
|
// src/api/locations/query.ts
|
|
2125
|
-
const RECENT_LIMIT
|
|
2126
|
-
const ACTIVITY_DAYS
|
|
2441
|
+
const RECENT_LIMIT = 25;
|
|
2442
|
+
const ACTIVITY_DAYS = 90;
|
|
2127
2443
|
/**
|
|
2128
2444
|
* Location id for every public Conversation with a `local` destination. Each
|
|
2129
2445
|
* such Conversation has its own destination row, so they report as one
|
|
@@ -2278,7 +2594,7 @@ function accumulateLocationActivity(rows) {
|
|
|
2278
2594
|
}
|
|
2279
2595
|
function directoryActivityDays$1(rows, nowMs) {
|
|
2280
2596
|
return fillUtcDays({
|
|
2281
|
-
count: ACTIVITY_DAYS
|
|
2597
|
+
count: ACTIVITY_DAYS,
|
|
2282
2598
|
empty: emptyLocationActivityDay,
|
|
2283
2599
|
nowMs,
|
|
2284
2600
|
rows: accumulateLocationActivity(rows)
|
|
@@ -2308,7 +2624,7 @@ function directoryActivitySixHours$1(rows, nowMs) {
|
|
|
2308
2624
|
/** Load public locations plus one complete privacy-safe aggregate for non-public activity. */
|
|
2309
2625
|
async function readLocationDirectoryFromSql() {
|
|
2310
2626
|
const nowMs = Date.now();
|
|
2311
|
-
const { end, start } = trailingUtcDayWindow(nowMs, ACTIVITY_DAYS
|
|
2627
|
+
const { end, start } = trailingUtcDayWindow(nowMs, ACTIVITY_DAYS);
|
|
2312
2628
|
const hourWindow = trailingUtcHourWindow(nowMs, 168);
|
|
2313
2629
|
const [rows, activity] = await Promise.all([directoryRows(getDb()), directoryActivityRows(getDb(), start, hourWindow.start)]);
|
|
2314
2630
|
const locations = /* @__PURE__ */ new Map();
|
|
@@ -2362,12 +2678,12 @@ async function recentLocationRows(db, locationId) {
|
|
|
2362
2678
|
title: juniorConversations.title,
|
|
2363
2679
|
updatedAt: juniorConversations.updatedAt,
|
|
2364
2680
|
usage: juniorConversations.usage
|
|
2365
|
-
}).from(juniorConversations).innerJoin(juniorDestinations, eq(juniorDestinations.id, juniorConversations.destinationId)).leftJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(publicLocationWhere(locationId)).orderBy(desc(juniorConversations.lastActivityAt), asc(juniorConversations.conversationId)).limit(RECENT_LIMIT
|
|
2681
|
+
}).from(juniorConversations).innerJoin(juniorDestinations, eq(juniorDestinations.id, juniorConversations.destinationId)).leftJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId)).leftJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(publicLocationWhere(locationId)).orderBy(desc(juniorConversations.lastActivityAt), asc(juniorConversations.conversationId)).limit(RECENT_LIMIT);
|
|
2366
2682
|
}
|
|
2367
2683
|
/** Load one public location's complete activity while bounding only recent conversations. */
|
|
2368
2684
|
async function readLocationDetailFromSql(locationId, options = {}) {
|
|
2369
2685
|
const nowMs = Date.now();
|
|
2370
|
-
const { end, start } = trailingUtcDayWindow(nowMs, ACTIVITY_DAYS
|
|
2686
|
+
const { end, start } = trailingUtcDayWindow(nowMs, ACTIVITY_DAYS);
|
|
2371
2687
|
const hourWindow = trailingUtcHourWindow(nowMs, 168);
|
|
2372
2688
|
const where = publicLocationWhere(locationId);
|
|
2373
2689
|
const activityDate = sql`TO_CHAR(
|
|
@@ -2443,7 +2759,7 @@ async function readLocationDetailFromSql(locationId, options = {}) {
|
|
|
2443
2759
|
addMetrics(item, row);
|
|
2444
2760
|
actors.push(item);
|
|
2445
2761
|
}
|
|
2446
|
-
const activity = activityDays$1(days, nowMs, ACTIVITY_DAYS
|
|
2762
|
+
const activity = activityDays$1(days, nowMs, ACTIVITY_DAYS);
|
|
2447
2763
|
const hourlyActivity = activityHours$2(hours, nowMs);
|
|
2448
2764
|
const recentConversationIds = recentRows.map((row) => row.conversationId);
|
|
2449
2765
|
const [accessByConversation, metricsByRoot, automationTitleByConversation, firstHumanMessageTextByConversation] = await Promise.all([
|
|
@@ -2637,211 +2953,179 @@ function createImageRoutes() {
|
|
|
2637
2953
|
});
|
|
2638
2954
|
return app;
|
|
2639
2955
|
}
|
|
2640
|
-
// src/api/
|
|
2641
|
-
/**
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
const lead = await getLeadConversation(context.get("viewer"));
|
|
2646
|
-
const lastSeq = await readConversationLastEventSeq(getSqlExecutor(), lead.conversationId);
|
|
2647
|
-
const watches = await listWatches({ conversationId: lead.conversationId });
|
|
2648
|
-
const watchedConversationIds = [...new Set(watches.filter((watch) => watch.namespace === "junior" && watch.resourceType === "conversation").map((watch) => watch.identifier))];
|
|
2649
|
-
return jsonResponse(leadSchema, {
|
|
2650
|
-
conversationId: lead.conversationId,
|
|
2651
|
-
lastSeq,
|
|
2652
|
-
watchedConversationIds
|
|
2653
|
-
}, { headers: { "cache-control": "private, no-store" } });
|
|
2654
|
-
});
|
|
2655
|
-
return app;
|
|
2656
|
-
}
|
|
2657
|
-
const metrics$1 = juniorConversationMetrics;
|
|
2658
|
-
/** Sum the values of one metric among grouped metric rows. */
|
|
2659
|
-
function metricSum(metric) {
|
|
2660
|
-
return sql`sum(${metrics$1.value}) FILTER (WHERE ${metrics$1.metric} = ${metric})`;
|
|
2661
|
-
}
|
|
2662
|
-
/** Sum the spend of Turn metric rows read straight from their table. */
|
|
2663
|
-
const turnMetricColumns = { costMicroUsd: microUsdSql(metricSum("cost_micro_usd")) };
|
|
2664
|
-
/** Root Conversation of a person's Turn, for status, location, and surface. */
|
|
2665
|
-
const turnRoot = alias(juniorConversations, "person_turn_root");
|
|
2666
|
-
/** Root of a Conversation row: itself when it has no root. */
|
|
2667
|
-
const conversationRootId = sql`coalesce(
|
|
2668
|
-
${juniorConversations.rootConversationId},
|
|
2669
|
-
${juniorConversations.conversationId}
|
|
2670
|
-
)`;
|
|
2671
|
-
/**
|
|
2672
|
-
* Read one row per verified person and root Conversation where they ran a
|
|
2673
|
-
* Turn, over all time: the Turn range and the duration and token totals.
|
|
2674
|
-
*
|
|
2675
|
-
* The person and metric filters apply to the metric rows, and the rows are
|
|
2676
|
-
* grouped before any join. Every Run writes a `duration_ms` row, so these
|
|
2677
|
-
* two metrics mark every Turn.
|
|
2678
|
-
*/
|
|
2679
|
-
function personRoots(email) {
|
|
2680
|
-
const verifiedIdentities = getDb().select({ id: juniorIdentities.id }).from(juniorIdentities).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(verifiedActorWhere(email));
|
|
2681
|
-
const conversations = getDb().select({
|
|
2682
|
-
identityId: sql`${metrics$1.actorIdentityId}`.as("turn_identity_id"),
|
|
2683
|
-
conversationId: sql`${metrics$1.conversationId}`.as("turn_conversation_id"),
|
|
2684
|
-
firstAt: sql`min(${metrics$1.occurredAt})`.as("turn_first_at"),
|
|
2685
|
-
lastAt: sql`max(${metrics$1.occurredAt})`.as("turn_last_at"),
|
|
2686
|
-
durationMs: metricSum("duration_ms").as("turn_duration_ms"),
|
|
2687
|
-
tokens: metricSum("total_tokens").as("turn_tokens")
|
|
2688
|
-
}).from(metrics$1).where(and(inArray(metrics$1.actorIdentityId, verifiedIdentities), inArray(metrics$1.metric, ["duration_ms", "total_tokens"]))).groupBy(metrics$1.actorIdentityId, metrics$1.conversationId).as("person_conversation_turns");
|
|
2689
|
-
return getDb().select({
|
|
2690
|
-
userId: sql`${juniorIdentities.userId}`.as("root_user_id"),
|
|
2691
|
-
rootConversationId: conversationRootId.as("person_root_id"),
|
|
2692
|
-
firstAt: sql`min(${conversations.firstAt})`.as("root_first_at"),
|
|
2693
|
-
lastAt: sql`max(${conversations.lastAt})`.as("root_last_at"),
|
|
2694
|
-
durationMs: sql`sum(${conversations.durationMs})`.as("root_duration_ms"),
|
|
2695
|
-
tokens: sql`sum(${conversations.tokens})`.as("root_tokens"),
|
|
2696
|
-
slackUserId: sql`max(CASE WHEN ${juniorIdentities.provider} = 'slack' THEN ${juniorIdentities.providerSubjectId} END)`.as("root_slack_user_id"),
|
|
2697
|
-
slackUserName: sql`max(CASE WHEN ${juniorIdentities.provider} = 'slack' THEN ${juniorIdentities.handle} END)`.as("root_slack_user_name")
|
|
2698
|
-
}).from(conversations).innerJoin(juniorIdentities, eq(juniorIdentities.id, conversations.identityId)).innerJoin(juniorConversations, eq(juniorConversations.conversationId, conversations.conversationId)).groupBy(juniorIdentities.userId, conversationRootId).as("person_roots");
|
|
2699
|
-
}
|
|
2700
|
-
/** Join a person's roots to the root Conversation rows. */
|
|
2701
|
-
function personRootJoin(roots) {
|
|
2702
|
-
return eq(turnRoot.conversationId, roots.rootConversationId);
|
|
2703
|
-
}
|
|
2704
|
-
/**
|
|
2705
|
-
* Aggregate rows from {@link personRoots} joined to {@link turnRoot}. A
|
|
2706
|
-
* Conversation counts once for each person who ran a Turn in it, and child
|
|
2707
|
-
* Conversation Turns count for the root. Each row is one root of one person,
|
|
2708
|
-
* so plain counts need no DISTINCT. Active and failed read the root's current
|
|
2709
|
-
* status.
|
|
2710
|
-
*/
|
|
2711
|
-
function rootAggregateColumns(roots) {
|
|
2956
|
+
// src/api/spaces/access.ts
|
|
2957
|
+
/** Validate the `:spaceId` route parameter. */
|
|
2958
|
+
const spaceParamsValidator = validateRequest("param", spaceParamsSchema, "Invalid route parameters.");
|
|
2959
|
+
/** Write one Space as the API reports it. */
|
|
2960
|
+
function spaceReport(space) {
|
|
2712
2961
|
return {
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
tokens: sql`sum(${roots.tokens})::double precision`
|
|
2962
|
+
...space,
|
|
2963
|
+
createdAt: space.createdAt.toISOString(),
|
|
2964
|
+
updatedAt: space.updatedAt.toISOString(),
|
|
2965
|
+
archivedAt: space.archivedAt?.toISOString() ?? null
|
|
2718
2966
|
};
|
|
2719
2967
|
}
|
|
2720
2968
|
/**
|
|
2721
|
-
*
|
|
2722
|
-
*
|
|
2723
|
-
* estimate cannot make Postgres repeat it once per root.
|
|
2969
|
+
* Return the Space that the viewer reads, or a 404. A private Space is a 404
|
|
2970
|
+
* to a person who is not a member, so the error does not show it exists.
|
|
2724
2971
|
*/
|
|
2725
|
-
function
|
|
2726
|
-
const
|
|
2727
|
-
|
|
2972
|
+
async function requireSpace(viewerUserId, spaceId) {
|
|
2973
|
+
const space = await readSpace(viewerUserId, spaceId);
|
|
2974
|
+
if (!space) throwApiError(404, "Space was not found.");
|
|
2975
|
+
return space;
|
|
2728
2976
|
}
|
|
2729
2977
|
/**
|
|
2730
|
-
*
|
|
2731
|
-
*
|
|
2978
|
+
* Return the Space that the viewer changes. Anyone can read a public Space,
|
|
2979
|
+
* but only members change a Space.
|
|
2732
2980
|
*/
|
|
2733
|
-
function
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
}
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
failed: 0
|
|
2757
|
-
};
|
|
2758
|
-
}
|
|
2759
|
-
/** Build a zeroed activity day for the people profile window. */
|
|
2760
|
-
function emptyActivityDay(date) {
|
|
2761
|
-
return {
|
|
2762
|
-
active: 0,
|
|
2763
|
-
conversations: 0,
|
|
2764
|
-
date,
|
|
2765
|
-
durationMs: 0,
|
|
2766
|
-
failed: 0
|
|
2767
|
-
};
|
|
2768
|
-
}
|
|
2769
|
-
/** Fill the fixed people profile activity window from sparse day totals. */
|
|
2770
|
-
function activityDays(days, nowMs) {
|
|
2771
|
-
return fillUtcDays({
|
|
2772
|
-
count: 365,
|
|
2773
|
-
empty: emptyActivityDay,
|
|
2774
|
-
nowMs,
|
|
2775
|
-
rows: days
|
|
2981
|
+
async function requireMemberSpace(viewerUserId, spaceId) {
|
|
2982
|
+
const space = await requireSpace(viewerUserId, spaceId);
|
|
2983
|
+
if (!space.viewerIsMember) throwApiError(403, "Join the Space to change it.");
|
|
2984
|
+
return space;
|
|
2985
|
+
}
|
|
2986
|
+
/** Respond with the Space as the viewer sees it now. */
|
|
2987
|
+
async function spaceResponse(viewerUserId, spaceId, init) {
|
|
2988
|
+
return jsonResponse(spaceSchema, spaceReport(await requireSpace(viewerUserId, spaceId)), init);
|
|
2989
|
+
}
|
|
2990
|
+
// src/api/spaces/archive.ts
|
|
2991
|
+
/** Create the route that archives or restores a Space with its Conversations. */
|
|
2992
|
+
function createSpaceArchiveRoutes(options) {
|
|
2993
|
+
const app = new Hono();
|
|
2994
|
+
app.patch("/:spaceId/archive", requireViewer, spaceParamsValidator, validateRequest("json", archiveSpaceBodySchema, "Invalid request body."), async (context) => {
|
|
2995
|
+
const viewerUserId = context.get("viewer").id;
|
|
2996
|
+
const { spaceId } = context.req.valid("param");
|
|
2997
|
+
await requireMemberSpace(viewerUserId, spaceId);
|
|
2998
|
+
await setSpaceArchive({
|
|
2999
|
+
archived: context.req.valid("json").archived,
|
|
3000
|
+
queue: options.queue,
|
|
3001
|
+
spaceId
|
|
3002
|
+
});
|
|
3003
|
+
return await spaceResponse(viewerUserId, spaceId);
|
|
2776
3004
|
});
|
|
3005
|
+
return app;
|
|
2777
3006
|
}
|
|
3007
|
+
// src/api/spaces/configuration.ts
|
|
2778
3008
|
/**
|
|
2779
|
-
*
|
|
2780
|
-
*
|
|
3009
|
+
* Create the route that reads a Space's configuration. Anyone who reads the
|
|
3010
|
+
* Space reads it. Junior changes it with its `setSpaceConfiguration` tool,
|
|
3011
|
+
* when a member asks.
|
|
2781
3012
|
*/
|
|
2782
|
-
function
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
3013
|
+
function createSpaceConfigurationRoutes() {
|
|
3014
|
+
const app = new Hono();
|
|
3015
|
+
app.get("/:spaceId/configuration", requireViewer, spaceParamsValidator, async (context) => {
|
|
3016
|
+
const { spaceId } = context.req.valid("param");
|
|
3017
|
+
await requireSpace(context.get("viewer").id, spaceId);
|
|
3018
|
+
const entries = await listSpaceConfiguration(spaceId);
|
|
3019
|
+
return jsonResponse(spaceConfigurationSchema, { entries: entries.map((entry) => ({
|
|
3020
|
+
...entry,
|
|
3021
|
+
updatedAt: entry.updatedAt.toISOString()
|
|
3022
|
+
})) });
|
|
2788
3023
|
});
|
|
3024
|
+
return app;
|
|
2789
3025
|
}
|
|
3026
|
+
// src/api/spaces/lead.ts
|
|
2790
3027
|
/**
|
|
2791
|
-
*
|
|
2792
|
-
*
|
|
3028
|
+
* Create the route that finds a Space's Lead. A member's first read creates
|
|
3029
|
+
* it. Anyone who reads the Space reads its Lead, which is public like the
|
|
3030
|
+
* Space.
|
|
2793
3031
|
*/
|
|
2794
|
-
function
|
|
2795
|
-
const
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
3032
|
+
function createSpaceLeadRoutes() {
|
|
3033
|
+
const app = new Hono();
|
|
3034
|
+
app.get("/:spaceId/lead", requireViewer, spaceParamsValidator, async (context) => {
|
|
3035
|
+
const viewer = context.get("viewer");
|
|
3036
|
+
const space = await requireSpace(viewer.id, context.req.valid("param").spaceId);
|
|
3037
|
+
const lead = space.viewerIsMember ? await getSpaceLead({
|
|
3038
|
+
member: viewer,
|
|
3039
|
+
space
|
|
3040
|
+
}) : await readSpaceLead(space.id);
|
|
3041
|
+
if (!lead) throwApiError(404, "This Space has no Lead yet.");
|
|
3042
|
+
const lastSeq = await readConversationLastEventSeq(getSqlExecutor(), lead.conversationId);
|
|
3043
|
+
const watches = await listWatches({ conversationId: lead.conversationId });
|
|
3044
|
+
const watchedConversationIds = [...new Set(watches.filter((watch) => watch.namespace === "junior" && isAgentResourceType(watch.resourceType)).map((watch) => watch.identifier))];
|
|
3045
|
+
return jsonResponse(leadSchema, {
|
|
3046
|
+
conversationId: lead.conversationId,
|
|
3047
|
+
lastSeq,
|
|
3048
|
+
watchedConversationIds
|
|
3049
|
+
}, { headers: { "cache-control": "private, no-store" } });
|
|
2800
3050
|
});
|
|
3051
|
+
return app;
|
|
2801
3052
|
}
|
|
2802
|
-
|
|
2803
|
-
function statsItems(map) {
|
|
2804
|
-
return [...map.values()].sort((left, right) => right.conversations - left.conversations || right.durationMs - left.durationMs || left.label.localeCompare(right.label));
|
|
2805
|
-
}
|
|
3053
|
+
// src/api/spaces/members.ts
|
|
2806
3054
|
/**
|
|
2807
|
-
*
|
|
2808
|
-
*
|
|
2809
|
-
*
|
|
2810
|
-
* Any provider counts, so Slack and dashboard (web) Conversations roll up to
|
|
2811
|
-
* the same person. System identities never count.
|
|
3055
|
+
* Create the routes that list a Space's members, add a member, and join or
|
|
3056
|
+
* leave it.
|
|
2812
3057
|
*/
|
|
2813
|
-
function
|
|
2814
|
-
const
|
|
2815
|
-
|
|
3058
|
+
function createSpaceMemberRoutes() {
|
|
3059
|
+
const app = new Hono();
|
|
3060
|
+
app.get("/:spaceId/members", requireViewer, spaceParamsValidator, async (context) => {
|
|
3061
|
+
const { spaceId } = context.req.valid("param");
|
|
3062
|
+
await requireSpace(context.get("viewer").id, spaceId);
|
|
3063
|
+
const members = await listSpaceMembers(spaceId);
|
|
3064
|
+
return jsonResponse(spaceMemberListSchema, { members: members.map((member) => ({
|
|
3065
|
+
...member,
|
|
3066
|
+
joinedAt: member.joinedAt.toISOString()
|
|
3067
|
+
})) });
|
|
3068
|
+
});
|
|
3069
|
+
app.post("/:spaceId/members", requireViewer, spaceParamsValidator, validateRequest("json", addSpaceMemberBodySchema, "Invalid request body."), async (context) => {
|
|
3070
|
+
const viewerUserId = context.get("viewer").id;
|
|
3071
|
+
const { spaceId } = context.req.valid("param");
|
|
3072
|
+
await requireMemberSpace(viewerUserId, spaceId);
|
|
3073
|
+
const email = normalizeIdentityEmail(context.req.valid("json").email);
|
|
3074
|
+
const person = email ? await readCachedUserByEmail(getDb(), email) : void 0;
|
|
3075
|
+
if (!person) throwApiError(404, "No person has that email.");
|
|
3076
|
+
await joinSpace(spaceId, person.user.id);
|
|
3077
|
+
return await spaceResponse(viewerUserId, spaceId);
|
|
3078
|
+
});
|
|
3079
|
+
app.put("/:spaceId/members/me", requireViewer, spaceParamsValidator, async (context) => {
|
|
3080
|
+
const viewerUserId = context.get("viewer").id;
|
|
3081
|
+
const { spaceId } = context.req.valid("param");
|
|
3082
|
+
await requireSpace(viewerUserId, spaceId);
|
|
3083
|
+
await joinSpace(spaceId, viewerUserId);
|
|
3084
|
+
return await spaceResponse(viewerUserId, spaceId);
|
|
3085
|
+
});
|
|
3086
|
+
app.delete("/:spaceId/members/me", requireViewer, spaceParamsValidator, async (context) => {
|
|
3087
|
+
const viewerUserId = context.get("viewer").id;
|
|
3088
|
+
const { spaceId } = context.req.valid("param");
|
|
3089
|
+
const space = await requireSpace(viewerUserId, spaceId);
|
|
3090
|
+
if (await leaveSpace(spaceId, viewerUserId) === "last_member") throwApiError(409, "The last member can't leave a private Space.");
|
|
3091
|
+
if (space.visibility === "private") return jsonResponse(spaceSchema, {
|
|
3092
|
+
...spaceReport(space),
|
|
3093
|
+
memberCount: space.memberCount - 1,
|
|
3094
|
+
viewerIsMember: false
|
|
3095
|
+
});
|
|
3096
|
+
return await spaceResponse(viewerUserId, spaceId);
|
|
3097
|
+
});
|
|
3098
|
+
return app;
|
|
2816
3099
|
}
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
})
|
|
3100
|
+
// src/api/spaces/space.ts
|
|
3101
|
+
/** Create the routes that list, create, read, and change Spaces. */
|
|
3102
|
+
function createSpaceRoutes() {
|
|
3103
|
+
const app = new Hono();
|
|
3104
|
+
app.get("/", requireViewer, validateRequest("query", spaceListQuerySchema, "Invalid query parameters."), async (context) => {
|
|
3105
|
+
const spaces = await listSpaces(context.get("viewer").id, context.req.valid("query"));
|
|
3106
|
+
return jsonResponse(spaceListSchema, { spaces: spaces.map(spaceReport) });
|
|
3107
|
+
});
|
|
3108
|
+
app.post("/", requireViewer, validateRequest("json", createSpaceBodySchema, "Invalid request body."), async (context) => {
|
|
3109
|
+
const body = context.req.valid("json");
|
|
3110
|
+
const space = await createSpace({
|
|
3111
|
+
creatorUserId: context.get("viewer").id,
|
|
3112
|
+
name: body.name,
|
|
3113
|
+
description: body.description ?? null,
|
|
3114
|
+
visibility: body.visibility
|
|
3115
|
+
});
|
|
3116
|
+
return jsonResponse(spaceSchema, spaceReport(space), { status: 201 });
|
|
3117
|
+
});
|
|
3118
|
+
app.get("/:spaceId", requireViewer, spaceParamsValidator, async (context) => spaceResponse(context.get("viewer").id, context.req.valid("param").spaceId));
|
|
3119
|
+
app.patch("/:spaceId", requireViewer, spaceParamsValidator, validateRequest("json", updateSpaceBodySchema, "Invalid request body."), async (context) => {
|
|
3120
|
+
const viewerUserId = context.get("viewer").id;
|
|
3121
|
+
const { spaceId } = context.req.valid("param");
|
|
3122
|
+
const { visibility, ...changes } = context.req.valid("json");
|
|
3123
|
+
if (visibility !== void 0) throwApiError(400, "A Space's visibility is set when it is created. Create a new Space for a different audience.");
|
|
3124
|
+
await requireMemberSpace(viewerUserId, spaceId);
|
|
3125
|
+
await updateSpace(spaceId, changes);
|
|
3126
|
+
return await spaceResponse(viewerUserId, spaceId);
|
|
3127
|
+
});
|
|
3128
|
+
return app;
|
|
2845
3129
|
}
|
|
2846
3130
|
// src/api/people/card.ts
|
|
2847
3131
|
const RECENT_DAYS = 30;
|
|
@@ -2945,7 +3229,7 @@ async function readPersonCard(email, viewer) {
|
|
|
2945
3229
|
}
|
|
2946
3230
|
// src/api/people/code.ts
|
|
2947
3231
|
/** Read person-scoped native code activity for one People profile. */
|
|
2948
|
-
async function readPeopleCode(email, cursor) {
|
|
3232
|
+
async function readPeopleCode(email, cursor, viewer) {
|
|
2949
3233
|
const subject = await findUserByEmail(email);
|
|
2950
3234
|
if (!subject) {
|
|
2951
3235
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -2966,7 +3250,8 @@ async function readPeopleCode(email, cursor) {
|
|
|
2966
3250
|
}
|
|
2967
3251
|
return await readPersonCodeOverview({
|
|
2968
3252
|
cursor,
|
|
2969
|
-
userId: subject.id
|
|
3253
|
+
userId: subject.id,
|
|
3254
|
+
viewer
|
|
2970
3255
|
});
|
|
2971
3256
|
}
|
|
2972
3257
|
// src/api/people/list.query.ts
|
|
@@ -3070,8 +3355,10 @@ function rangeWindow(spend, conversations) {
|
|
|
3070
3355
|
}
|
|
3071
3356
|
/**
|
|
3072
3357
|
* Count active people and root Conversations in each bucket of each series,
|
|
3073
|
-
* from one read of the Turns since `since`. The
|
|
3074
|
-
*
|
|
3358
|
+
* from one read of the Turns since `since`. The Turns are grouped by bucket,
|
|
3359
|
+
* Identity, and Conversation before any join, so the joins and the counts
|
|
3360
|
+
* read a few rows for each Conversation, not one for each Turn. Six-hour
|
|
3361
|
+
* buckets roll up hour buckets.
|
|
3075
3362
|
*
|
|
3076
3363
|
* Each count is a hashed `DISTINCT` of (bucket, person) or (bucket, root)
|
|
3077
3364
|
* pairs, which costs less than sorting for `COUNT(DISTINCT)`.
|
|
@@ -3079,11 +3366,16 @@ function rangeWindow(spend, conversations) {
|
|
|
3079
3366
|
function activityRows(since, read) {
|
|
3080
3367
|
const utc = sql`(${metrics.occurredAt} AT TIME ZONE 'UTC')`;
|
|
3081
3368
|
const readBucket = sql`date_trunc(${sql.raw(`'${read}'`)}, ${utc})`;
|
|
3369
|
+
const bucketTurns = getDb().select({
|
|
3370
|
+
bucket: readBucket.as("turn_bucket"),
|
|
3371
|
+
identityId: sql`${metrics.actorIdentityId}`.as("turn_identity_id"),
|
|
3372
|
+
conversationId: sql`${metrics.conversationId}`.as("turn_conversation_id")
|
|
3373
|
+
}).from(metrics).where(and(eq(metrics.metric, "duration_ms"), gte(metrics.occurredAt, since))).groupBy(readBucket, metrics.actorIdentityId, metrics.conversationId).as("activity_bucket_turns");
|
|
3082
3374
|
const turns = getDb().$with("activity_turns").as(getDb().select({
|
|
3083
|
-
bucket:
|
|
3375
|
+
bucket: sql`${bucketTurns.bucket}`.as("activity_bucket"),
|
|
3084
3376
|
userId: sql`${juniorUsers.id}`.as("activity_user_id"),
|
|
3085
3377
|
rootConversationId: conversationRootId.as("activity_root_id")
|
|
3086
|
-
}).from(
|
|
3378
|
+
}).from(bucketTurns).innerJoin(juniorIdentities, eq(juniorIdentities.id, bucketTurns.identityId)).innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).innerJoin(juniorConversations, eq(juniorConversations.conversationId, bucketTurns.conversationId)).where(verifiedActorWhere()).groupBy(bucketTurns.bucket, juniorUsers.id, conversationRootId));
|
|
3087
3379
|
const unitCounts = (unit) => {
|
|
3088
3380
|
const bucket = unit === "six_hour" ? sql`date_trunc('day', ${turns.bucket}) + FLOOR(EXTRACT(HOUR FROM ${turns.bucket}) / 6) * INTERVAL '6 hours'` : sql`${turns.bucket}`;
|
|
3089
3381
|
const pairs = (kind, id) => getDb().selectDistinct({
|
|
@@ -3225,6 +3517,8 @@ async function readPeopleListFromSql() {
|
|
|
3225
3517
|
* gets the same list, so one cached copy serves them all.
|
|
3226
3518
|
*/
|
|
3227
3519
|
const readPeopleList = createCachedReport({
|
|
3520
|
+
freshMs: 9e5,
|
|
3521
|
+
keepMs: 6048e5,
|
|
3228
3522
|
key: "people-list",
|
|
3229
3523
|
read: readPeopleListFromSql,
|
|
3230
3524
|
refreshFailedEvent: "people_list.refresh.failed",
|
|
@@ -3240,7 +3534,7 @@ async function readPeoplePluginReports(args) {
|
|
|
3240
3534
|
reports: [],
|
|
3241
3535
|
source: "plugins"
|
|
3242
3536
|
});
|
|
3243
|
-
const { getPluginProfileReports } = await import("./
|
|
3537
|
+
const { getPluginProfileReports } = await import("./db-DXTOYRzR.js").then((n) => n.W);
|
|
3244
3538
|
return pluginOperationalReportFeedSchema.parse({
|
|
3245
3539
|
generatedAt: new Date(nowMs).toISOString(),
|
|
3246
3540
|
reports: await getPluginProfileReports({
|
|
@@ -3259,7 +3553,7 @@ function emptyProfile(email, nowMs) {
|
|
|
3259
3553
|
start.setUTCDate(start.getUTCDate() - 364);
|
|
3260
3554
|
return {
|
|
3261
3555
|
activityDays: activityDays(/* @__PURE__ */ new Map(), nowMs),
|
|
3262
|
-
activityHours: activityHours(/* @__PURE__ */ new Map(), nowMs),
|
|
3556
|
+
activityHours: activityHours$1(/* @__PURE__ */ new Map(), nowMs),
|
|
3263
3557
|
activitySixHours: activitySixHours(/* @__PURE__ */ new Map(), nowMs),
|
|
3264
3558
|
generatedAt: new Date(nowMs).toISOString(),
|
|
3265
3559
|
locations: [],
|
|
@@ -3427,7 +3721,7 @@ async function readPeopleProfileFromSql(email, options = {}) {
|
|
|
3427
3721
|
]);
|
|
3428
3722
|
return {
|
|
3429
3723
|
activityDays: activityDays(days, nowMs),
|
|
3430
|
-
activityHours: activityHours(hours, nowMs),
|
|
3724
|
+
activityHours: activityHours$1(hours, nowMs),
|
|
3431
3725
|
activitySixHours: activitySixHours(hours, nowMs),
|
|
3432
3726
|
generatedAt: new Date(nowMs).toISOString(),
|
|
3433
3727
|
locations: statsItems(locations),
|
|
@@ -3611,7 +3905,7 @@ function createPeopleRoutes(options) {
|
|
|
3611
3905
|
app.get("/:email/code", validateRequest("param", personParamsSchema, "Invalid route parameters."), validateRequest("query", personCodeQuerySchema, "Invalid code query."), async (context) => {
|
|
3612
3906
|
const { email } = context.req.valid("param");
|
|
3613
3907
|
const { cursor } = context.req.valid("query");
|
|
3614
|
-
return jsonResponse(codePersonReportSchema, await readPeopleCode(email, cursor));
|
|
3908
|
+
return jsonResponse(codePersonReportSchema, await readPeopleCode(email, cursor, context.get("viewer")));
|
|
3615
3909
|
});
|
|
3616
3910
|
app.get("/:email", validateRequest("param", personParamsSchema, "Invalid route parameters."), async (context) => {
|
|
3617
3911
|
const { email } = context.req.valid("param");
|
|
@@ -5130,10 +5424,11 @@ function inboxItemPayload(item, viewer, roots, mentions, related, wake) {
|
|
|
5130
5424
|
const todo = inboxItemTodo(item);
|
|
5131
5425
|
return {
|
|
5132
5426
|
...root ? { addedByLabel: root.label } : void 0,
|
|
5133
|
-
assignedToEveryone: item
|
|
5427
|
+
assignedToEveryone: isInboxItemForEveryone(item),
|
|
5134
5428
|
assignees: item.assignees,
|
|
5135
5429
|
body: item.body,
|
|
5136
5430
|
canAct: canActOnInboxItem(item, viewer.id),
|
|
5431
|
+
canAnswer: canAnswerInboxItem(item, viewer.id),
|
|
5137
5432
|
canTake: canActOnInboxItem(item, viewer.id) && !isOnlyAssignee(item, viewer.id),
|
|
5138
5433
|
conversationIds: item.conversationIds,
|
|
5139
5434
|
createdAt: item.createdAt.toISOString(),
|
|
@@ -5153,6 +5448,7 @@ function inboxItemPayload(item, viewer, roots, mentions, related, wake) {
|
|
|
5153
5448
|
...item.closedBy ? { closedBy: item.closedBy } : void 0,
|
|
5154
5449
|
...mentions.length > 0 ? { mentions: [...mentions] } : void 0,
|
|
5155
5450
|
...related && (related.items.length > 0 || related.conversationIds.length > 0) ? { related } : void 0,
|
|
5451
|
+
...item.dedupeKey.startsWith("reply:") ? { replyNotice: true } : void 0,
|
|
5156
5452
|
...item.request ? { request: item.request } : void 0,
|
|
5157
5453
|
...item.subject ? { subject: subjectPayload(item.subject) } : void 0,
|
|
5158
5454
|
...todo ? { todoId: todo.id } : void 0,
|
|
@@ -5478,7 +5774,128 @@ async function readStatsReport() {
|
|
|
5478
5774
|
windowStart: start
|
|
5479
5775
|
};
|
|
5480
5776
|
}
|
|
5481
|
-
// src/
|
|
5777
|
+
// src/db/listen.ts
|
|
5778
|
+
/**
|
|
5779
|
+
* The session runs `SELECT 1` this often. A socket that drops with no close
|
|
5780
|
+
* frame reports nothing, and a `NOTIFY` sent to a dead session is lost, so
|
|
5781
|
+
* the ping is the only way to notice.
|
|
5782
|
+
*/
|
|
5783
|
+
const PING_INTERVAL_MS = 15e3;
|
|
5784
|
+
const PING_TIMEOUT_MS = 5e3;
|
|
5785
|
+
/**
|
|
5786
|
+
* Open a session on the direct endpoint of `databaseUrl` and `LISTEN` on
|
|
5787
|
+
* `channel`. The pooled endpoint cannot hold a `LISTEN`, because it shares
|
|
5788
|
+
* one server session between clients.
|
|
5789
|
+
*
|
|
5790
|
+
* `onNotify` runs for each notification. `onLost` runs at most once, when
|
|
5791
|
+
* the session fails, ends, or misses a ping. The caller then opens a new
|
|
5792
|
+
* session: a `NOTIFY` sent while no session listens is lost.
|
|
5793
|
+
*/
|
|
5794
|
+
async function openListenSession(args) {
|
|
5795
|
+
const config = { connectionString: readDirectDatabaseUrl(args.databaseUrl) };
|
|
5796
|
+
const client = args.driver === "postgres" ? new pg.Client(config) : new Client(config);
|
|
5797
|
+
let connected = false;
|
|
5798
|
+
let ended = false;
|
|
5799
|
+
let ping;
|
|
5800
|
+
const end = async () => {
|
|
5801
|
+
ended = true;
|
|
5802
|
+
clearInterval(ping);
|
|
5803
|
+
await client.end().catch(() => void 0);
|
|
5804
|
+
};
|
|
5805
|
+
const lose = (error) => {
|
|
5806
|
+
if (ended) return;
|
|
5807
|
+
end();
|
|
5808
|
+
if (connected) args.onLost(error);
|
|
5809
|
+
};
|
|
5810
|
+
client.on("error", lose);
|
|
5811
|
+
try {
|
|
5812
|
+
await client.connect();
|
|
5813
|
+
await client.query(`SET application_name = '${args.applicationName}'`);
|
|
5814
|
+
await client.query(`LISTEN "${args.channel}"`);
|
|
5815
|
+
connected = true;
|
|
5816
|
+
} catch (error) {
|
|
5817
|
+
await end();
|
|
5818
|
+
throw error;
|
|
5819
|
+
}
|
|
5820
|
+
client.on("notification", () => {
|
|
5821
|
+
if (!ended) args.onNotify();
|
|
5822
|
+
});
|
|
5823
|
+
client.on("end", () => lose(/* @__PURE__ */ new Error("LISTEN session ended")));
|
|
5824
|
+
ping = setInterval(() => {
|
|
5825
|
+
let timer;
|
|
5826
|
+
const timeout = new Promise((_, reject) => {
|
|
5827
|
+
timer = setTimeout(() => reject(/* @__PURE__ */ new Error("LISTEN session missed a ping")), PING_TIMEOUT_MS);
|
|
5828
|
+
});
|
|
5829
|
+
Promise.race([client.query("SELECT 1"), timeout]).catch((error) => lose(error instanceof Error ? error : new Error(String(error)))).finally(() => clearTimeout(timer));
|
|
5830
|
+
}, PING_INTERVAL_MS);
|
|
5831
|
+
ping.unref?.();
|
|
5832
|
+
return { close: end };
|
|
5833
|
+
}
|
|
5834
|
+
// src/api/versions/changes.ts
|
|
5835
|
+
/**
|
|
5836
|
+
* The channel that the `junior_notify_versions` triggers send to. They send
|
|
5837
|
+
* an empty payload, so Postgres folds the notifications of one transaction
|
|
5838
|
+
* into one.
|
|
5839
|
+
*/
|
|
5840
|
+
const VERSIONS_CHANNEL = "junior_versions";
|
|
5841
|
+
/** Lets an operator find this instance's session in `pg_stat_activity`. */
|
|
5842
|
+
const APPLICATION_NAME = "junior-versions-listen";
|
|
5843
|
+
/**
|
|
5844
|
+
* Share one direct Postgres `LISTEN` session among the versions streams of
|
|
5845
|
+
* one API instance. The session opens with the first stream and closes with
|
|
5846
|
+
* the last one.
|
|
5847
|
+
*/
|
|
5848
|
+
function createVersionChanges() {
|
|
5849
|
+
const subscribers = /* @__PURE__ */ new Set();
|
|
5850
|
+
let session;
|
|
5851
|
+
const lose = (lost, error) => {
|
|
5852
|
+
if (session !== lost) return;
|
|
5853
|
+
session = void 0;
|
|
5854
|
+
logWarn("versions_stream.listener_lost", {
|
|
5855
|
+
"error.type": error.name,
|
|
5856
|
+
"exception.message": error.message,
|
|
5857
|
+
"app.versions_stream.subscribers": subscribers.size
|
|
5858
|
+
});
|
|
5859
|
+
const ended = [...subscribers];
|
|
5860
|
+
subscribers.clear();
|
|
5861
|
+
for (const subscriber of ended) subscriber.onLost();
|
|
5862
|
+
};
|
|
5863
|
+
const connect = () => {
|
|
5864
|
+
const { sql } = getChatConfig();
|
|
5865
|
+
const opened = openListenSession({
|
|
5866
|
+
applicationName: APPLICATION_NAME,
|
|
5867
|
+
channel: VERSIONS_CHANNEL,
|
|
5868
|
+
databaseUrl: sql.databaseUrl,
|
|
5869
|
+
driver: sql.driver,
|
|
5870
|
+
onLost: (error) => lose(opened, error),
|
|
5871
|
+
onNotify: () => {
|
|
5872
|
+
for (const subscriber of subscribers) subscriber.onChange();
|
|
5873
|
+
}
|
|
5874
|
+
});
|
|
5875
|
+
opened.catch(() => {
|
|
5876
|
+
if (session === opened) session = void 0;
|
|
5877
|
+
});
|
|
5878
|
+
return opened;
|
|
5879
|
+
};
|
|
5880
|
+
return { async subscribe(subscriber) {
|
|
5881
|
+
session ??= connect();
|
|
5882
|
+
const current = session;
|
|
5883
|
+
subscribers.add(subscriber);
|
|
5884
|
+
try {
|
|
5885
|
+
await current;
|
|
5886
|
+
} catch (error) {
|
|
5887
|
+
subscribers.delete(subscriber);
|
|
5888
|
+
throw error;
|
|
5889
|
+
}
|
|
5890
|
+
return () => {
|
|
5891
|
+
if (!subscribers.delete(subscriber)) return;
|
|
5892
|
+
if (subscribers.size > 0 || session !== current) return;
|
|
5893
|
+
session = void 0;
|
|
5894
|
+
current.then((listen) => listen.close());
|
|
5895
|
+
};
|
|
5896
|
+
} };
|
|
5897
|
+
}
|
|
5898
|
+
// src/api/versions/read.ts
|
|
5482
5899
|
/**
|
|
5483
5900
|
* Build a JSON object of each Conversation's tree token by id, with no entry
|
|
5484
5901
|
* for a missing one. The tokens come from one grouped pass over all the ids.
|
|
@@ -5506,6 +5923,152 @@ async function readVersions(viewer, options) {
|
|
|
5506
5923
|
if (!row) throw new Error("Viewer user row is missing");
|
|
5507
5924
|
return row;
|
|
5508
5925
|
}
|
|
5926
|
+
// src/api/versions/stream.ts
|
|
5927
|
+
/**
|
|
5928
|
+
* A stream ends by itself after about this long. Vercel does not tell the
|
|
5929
|
+
* function when the client goes away, and a write to a closed client does
|
|
5930
|
+
* not fail, so the cap is what ends a stream that nobody reads. The client
|
|
5931
|
+
* reconnects and reads a fresh baseline. The cap also bounds how long a
|
|
5932
|
+
* revoked session keeps getting tokens.
|
|
5933
|
+
*/
|
|
5934
|
+
const STREAM_MAX_MS = 12e4;
|
|
5935
|
+
/** Ends spread out, so tabs that opened together do not reconnect together. */
|
|
5936
|
+
const STREAM_MAX_JITTER_MS = 2e4;
|
|
5937
|
+
/** The stream ends this long before the function's max duration. */
|
|
5938
|
+
const FUNCTION_DEADLINE_MARGIN_MS = 15e3;
|
|
5939
|
+
/** The client counts a stream as healthy while it hears from it this often. */
|
|
5940
|
+
const KEEPALIVE_MS = 15e3;
|
|
5941
|
+
/**
|
|
5942
|
+
* After a read, the next one waits at least this long, the same as the poll
|
|
5943
|
+
* of a present reader. A busy viewer then costs no more than the poll.
|
|
5944
|
+
*/
|
|
5945
|
+
const MIN_READ_GAP_MS = 5e3;
|
|
5946
|
+
/** The client waits this long, plus jitter, before it reconnects. */
|
|
5947
|
+
const RETRY_MS = 1e3;
|
|
5948
|
+
const RETRY_JITTER_MS = 2e3;
|
|
5949
|
+
function streamMaxMs() {
|
|
5950
|
+
const functionMaxMs = getChatConfig().functionMaxDurationSeconds * 1e3 - FUNCTION_DEADLINE_MARGIN_MS;
|
|
5951
|
+
return Math.min(STREAM_MAX_MS - STREAM_MAX_JITTER_MS / 2 + Math.random() * STREAM_MAX_JITTER_MS, functionMaxMs);
|
|
5952
|
+
}
|
|
5953
|
+
/**
|
|
5954
|
+
* Open an SSE stream of one viewer's `Versions`. The first message is the
|
|
5955
|
+
* baseline. After that, a message comes only when a write may have moved a
|
|
5956
|
+
* token and a fresh read differs from the last message. Each message is a
|
|
5957
|
+
* fresh `readVersions`, with the same access as the poll.
|
|
5958
|
+
*/
|
|
5959
|
+
async function openVersionsStream(args) {
|
|
5960
|
+
const encoder = new TextEncoder();
|
|
5961
|
+
let controller;
|
|
5962
|
+
const body = new ReadableStream({
|
|
5963
|
+
start(streamController) {
|
|
5964
|
+
controller = streamController;
|
|
5965
|
+
},
|
|
5966
|
+
cancel() {
|
|
5967
|
+
close();
|
|
5968
|
+
}
|
|
5969
|
+
});
|
|
5970
|
+
let closed = false;
|
|
5971
|
+
let unsubscribe;
|
|
5972
|
+
let keepAlive;
|
|
5973
|
+
let cap;
|
|
5974
|
+
let nextRead;
|
|
5975
|
+
let reading = false;
|
|
5976
|
+
let dirty = false;
|
|
5977
|
+
let lastReadAtMs = 0;
|
|
5978
|
+
let lastMessage;
|
|
5979
|
+
function close() {
|
|
5980
|
+
if (closed) return;
|
|
5981
|
+
closed = true;
|
|
5982
|
+
clearInterval(keepAlive);
|
|
5983
|
+
clearTimeout(cap);
|
|
5984
|
+
clearTimeout(nextRead);
|
|
5985
|
+
unsubscribe?.();
|
|
5986
|
+
try {
|
|
5987
|
+
controller.close();
|
|
5988
|
+
} catch {}
|
|
5989
|
+
}
|
|
5990
|
+
const write = (chunk) => {
|
|
5991
|
+
if (closed) return;
|
|
5992
|
+
try {
|
|
5993
|
+
controller.enqueue(encoder.encode(chunk));
|
|
5994
|
+
} catch {
|
|
5995
|
+
close();
|
|
5996
|
+
}
|
|
5997
|
+
};
|
|
5998
|
+
const read = async () => {
|
|
5999
|
+
reading = true;
|
|
6000
|
+
dirty = false;
|
|
6001
|
+
lastReadAtMs = Date.now();
|
|
6002
|
+
try {
|
|
6003
|
+
const message = JSON.stringify(await readVersions(args.viewer, { conversationIds: args.conversationIds }));
|
|
6004
|
+
if (message !== lastMessage) {
|
|
6005
|
+
lastMessage = message;
|
|
6006
|
+
write(`data: ${message}\n\n`);
|
|
6007
|
+
}
|
|
6008
|
+
} catch (error) {
|
|
6009
|
+
logException(error, "versions_stream.read_failed");
|
|
6010
|
+
close();
|
|
6011
|
+
return;
|
|
6012
|
+
} finally {
|
|
6013
|
+
reading = false;
|
|
6014
|
+
}
|
|
6015
|
+
if (dirty) scheduleRead();
|
|
6016
|
+
};
|
|
6017
|
+
function scheduleRead() {
|
|
6018
|
+
if (closed || reading || nextRead) return;
|
|
6019
|
+
nextRead = setTimeout(() => {
|
|
6020
|
+
nextRead = void 0;
|
|
6021
|
+
read();
|
|
6022
|
+
}, Math.max(0, lastReadAtMs + MIN_READ_GAP_MS - Date.now()));
|
|
6023
|
+
}
|
|
6024
|
+
try {
|
|
6025
|
+
unsubscribe = await args.changes.subscribe({
|
|
6026
|
+
onChange: () => {
|
|
6027
|
+
dirty = true;
|
|
6028
|
+
scheduleRead();
|
|
6029
|
+
},
|
|
6030
|
+
onLost: close
|
|
6031
|
+
});
|
|
6032
|
+
} catch (error) {
|
|
6033
|
+
close();
|
|
6034
|
+
throw error;
|
|
6035
|
+
}
|
|
6036
|
+
write(`retry: ${Math.round(RETRY_MS + Math.random() * RETRY_JITTER_MS)}\n\n`);
|
|
6037
|
+
keepAlive = setInterval(() => write(`event: ${VERSIONS_STREAM_KEEPALIVE_EVENT}\ndata: 1\n\n`), KEEPALIVE_MS);
|
|
6038
|
+
keepAlive.unref?.();
|
|
6039
|
+
cap = setTimeout(close, streamMaxMs());
|
|
6040
|
+
cap.unref?.();
|
|
6041
|
+
read();
|
|
6042
|
+
return new Response(body, { headers: {
|
|
6043
|
+
"cache-control": "private, no-store, no-transform",
|
|
6044
|
+
"content-type": "text/event-stream"
|
|
6045
|
+
} });
|
|
6046
|
+
}
|
|
6047
|
+
// src/api/versions/routes.ts
|
|
6048
|
+
/**
|
|
6049
|
+
* Create the routes of the dashboard change tokens: one poll, and one SSE
|
|
6050
|
+
* stream that pushes the same tokens. The streams of this API share one
|
|
6051
|
+
* Postgres `LISTEN` session.
|
|
6052
|
+
*/
|
|
6053
|
+
function createVersionsRoutes() {
|
|
6054
|
+
const app = new Hono();
|
|
6055
|
+
const changes = createVersionChanges();
|
|
6056
|
+
const query = validateRequest("query", versionsQuerySchema, "Invalid query parameters.");
|
|
6057
|
+
app.get("/", requireViewer, query, async (context) => {
|
|
6058
|
+
const headers = { "cache-control": "private, no-store" };
|
|
6059
|
+
if (getChatConfig().versionsStreamEnabled) headers[VERSIONS_STREAM_HEADER] = "1";
|
|
6060
|
+
return jsonResponse(versionsSchema, await readVersions(context.get("viewer"), context.req.valid("query")), { headers });
|
|
6061
|
+
});
|
|
6062
|
+
app.get("/stream", requireViewer, query, async (context) => {
|
|
6063
|
+
if (!getChatConfig().versionsStreamEnabled) return emptyResponse();
|
|
6064
|
+
return await openVersionsStream({
|
|
6065
|
+
changes,
|
|
6066
|
+
conversationIds: context.req.valid("query").conversationIds,
|
|
6067
|
+
viewer: context.get("viewer")
|
|
6068
|
+
});
|
|
6069
|
+
});
|
|
6070
|
+
return app;
|
|
6071
|
+
}
|
|
5509
6072
|
// src/reporting.ts
|
|
5510
6073
|
function readDescriptionText(home) {
|
|
5511
6074
|
try {
|
|
@@ -5516,7 +6079,7 @@ function readDescriptionText(home) {
|
|
|
5516
6079
|
}
|
|
5517
6080
|
/** Read discovered skills for runtime diagnostics and the Automation editor. */
|
|
5518
6081
|
async function readSkillReports() {
|
|
5519
|
-
const { discoverSkills } = await import("./skills-
|
|
6082
|
+
const { discoverSkills } = await import("./skills-BlHUDj7k.js").then((n) => n.s);
|
|
5520
6083
|
const skills = await discoverSkills();
|
|
5521
6084
|
return skillReportsSchema.parse(skills.map((skill) => ({
|
|
5522
6085
|
name: skill.name,
|
|
@@ -5530,7 +6093,7 @@ async function readSkillReports() {
|
|
|
5530
6093
|
* what the skill tells Junior. Returns null when no skill has that name.
|
|
5531
6094
|
*/
|
|
5532
6095
|
async function readSkillDetailReport(name) {
|
|
5533
|
-
const { discoverSkills, findSkillByName, parseSkillFile } = await import("./skills-
|
|
6096
|
+
const { discoverSkills, findSkillByName, parseSkillFile } = await import("./skills-BlHUDj7k.js").then((n) => n.s);
|
|
5534
6097
|
const skill = findSkillByName(name, await discoverSkills());
|
|
5535
6098
|
if (!skill) return null;
|
|
5536
6099
|
const parsed = parseSkillFile(await fs.readFile(path.join(skill.skillPath, "SKILL.md"), "utf8"), skill.name);
|
|
@@ -5545,7 +6108,7 @@ async function readSkillDetailReport(name) {
|
|
|
5545
6108
|
}
|
|
5546
6109
|
/** Read safe configured plugin metadata for authenticated runtime diagnostics. */
|
|
5547
6110
|
async function readPlugins() {
|
|
5548
|
-
const { pluginCatalogRuntime } = await import("./
|
|
6111
|
+
const { pluginCatalogRuntime } = await import("./db-DXTOYRzR.js").then((n) => n.kr);
|
|
5549
6112
|
return pluginsSchema.parse(pluginCatalogRuntime.getProviders().map((plugin) => ({
|
|
5550
6113
|
configKeys: plugin.manifest.configKeys ?? [],
|
|
5551
6114
|
description: plugin.manifest.description,
|
|
@@ -5556,8 +6119,8 @@ async function readPlugins() {
|
|
|
5556
6119
|
/** Read authenticated runtime discovery data. */
|
|
5557
6120
|
async function readRuntimeInfoReport() {
|
|
5558
6121
|
const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
|
|
5559
|
-
import("./package-discovery-
|
|
5560
|
-
import("./
|
|
6122
|
+
import("./package-discovery-BI6T_RkD.js").then((n) => n.r),
|
|
6123
|
+
import("./db-DXTOYRzR.js").then((n) => n.kr),
|
|
5561
6124
|
readPlugins(),
|
|
5562
6125
|
readSkillReports()
|
|
5563
6126
|
]);
|
|
@@ -5574,7 +6137,7 @@ async function readRuntimeInfoReport() {
|
|
|
5574
6137
|
/** Read sanitized operational summaries contributed by plugins. */
|
|
5575
6138
|
async function readPluginOperationalReportFeed() {
|
|
5576
6139
|
const nowMs = Date.now();
|
|
5577
|
-
const { getPluginOperationalReports } = await import("./
|
|
6140
|
+
const { getPluginOperationalReports } = await import("./db-DXTOYRzR.js").then((n) => n.W);
|
|
5578
6141
|
return pluginOperationalReportFeedSchema.parse({
|
|
5579
6142
|
source: "plugins",
|
|
5580
6143
|
generatedAt: new Date(nowMs).toISOString(),
|
|
@@ -5596,7 +6159,7 @@ function createJuniorApi(options = {}) {
|
|
|
5596
6159
|
});
|
|
5597
6160
|
app.get("/api/plugin-reports", async () => jsonResponse(pluginOperationalReportFeedSchema, await readPluginOperationalReportFeed()));
|
|
5598
6161
|
app.get("/api/stats", async () => jsonResponse(statsReportSchema, await readStatsReport()));
|
|
5599
|
-
app.
|
|
6162
|
+
app.route("/api/versions", createVersionsRoutes());
|
|
5600
6163
|
for (const path of REVALIDATED_READ_PATHS) app.use(path, revalidateContent);
|
|
5601
6164
|
const queue = options.conversationWorkQueue ?? getVercelConversationWorkQueue();
|
|
5602
6165
|
const waitUntil$1 = options.waitUntil ?? ((task) => waitUntil(typeof task === "function" ? task() : task));
|
|
@@ -5618,11 +6181,15 @@ function createJuniorApi(options = {}) {
|
|
|
5618
6181
|
app.route("/api/cache-warming", createCacheWarmingRoutes());
|
|
5619
6182
|
app.route("/api/gateway-providers", createGatewayProviderRoutes());
|
|
5620
6183
|
app.route("/api/images", createImageRoutes());
|
|
5621
|
-
app.route("/api/lead", createLeadRoutes());
|
|
5622
6184
|
app.route("/api/objects", createObjectRoutes());
|
|
5623
6185
|
app.route("/api/people", createPeopleRoutes({ waitUntil: waitUntil$1 }));
|
|
5624
6186
|
app.route("/api/locations", createLocationRoutes());
|
|
5625
6187
|
app.route("/api/search", createSearchRoutes());
|
|
6188
|
+
app.route("/api/spaces", createSpaceRoutes());
|
|
6189
|
+
app.route("/api/spaces", createSpaceArchiveRoutes({ queue }));
|
|
6190
|
+
app.route("/api/spaces", createSpaceMemberRoutes());
|
|
6191
|
+
app.route("/api/spaces", createSpaceConfigurationRoutes());
|
|
6192
|
+
app.route("/api/spaces", createSpaceLeadRoutes());
|
|
5626
6193
|
app.route("/api/user-pages", createUserPageRoutes());
|
|
5627
6194
|
app.route("/api/user-customization", createUserCustomizationRoutes());
|
|
5628
6195
|
app.route("/api/automations", createAutomationRoutes());
|