Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(email): add Focus view for signal mail (#7880)

teo9839b2ed4755
diff --git a/.github/services-config.json b/.github/services-config.json
index 13f843588d..dfa4d384da 100644
--- a/.github/services-config.json
+++ b/.github/services-config.json
@@ -154,12 +154,14 @@
"source_paths": [
"services/email_service/**",
"services/email_refresh_handler/**",
- "services/email_scheduled_handler/**"
+ "services/email_scheduled_handler/**",
+ "services/email_focus_worker/**"
],
"stack_path": "infra/stacks/email-service/**",
"deploy_binaries": [
"email_service",
- "pubsub_workers"
+ "pubsub_workers",
+ "email_focus_worker"
],
"deploy_lambdas": [
"email_refresh_handler",
diff --git a/.github/workspace-dep-closures.json b/.github/workspace-dep-closures.json
index e570373760..9f8b33905f 100644
--- a/.github/workspace-dep-closures.json
+++ b/.github/workspace-dep-closures.json
@@ -6007,6 +6007,183 @@
"crates/models_pagination",
"crates/workspace-hack"
],
+ "email_focus_worker": [
+ "crates/activity",
+ "crates/agent",
+ "crates/agent_changes",
+ "crates/agent_code_mode",
+ "crates/agent_runtime_protocol",
+ "crates/agent_session",
+ "crates/ai_billing",
+ "crates/ai_engine",
+ "crates/ai_tools",
+ "crates/ai_toolset",
+ "crates/ai_usage",
+ "crates/analytics_client",
+ "crates/anthropic",
+ "crates/attachment",
+ "crates/authentication_service_client",
+ "crates/bot_id",
+ "crates/bot_token",
+ "crates/bots",
+ "crates/broadcast",
+ "crates/calendar_events",
+ "crates/calendar_scheduling",
+ "crates/call",
+ "crates/channel_sender",
+ "crates/channels",
+ "crates/chat",
+ "crates/code_execution",
+ "crates/cognition",
+ "crates/collab_surface",
+ "crates/comms_db_client",
+ "crates/connection",
+ "crates/connection_gateway_client",
+ "crates/connection_gateway_models",
+ "crates/contacts",
+ "crates/cowlike",
+ "crates/crm",
+ "crates/database_env_vars",
+ "crates/database_sql",
+ "crates/databases",
+ "crates/databases_sql",
+ "crates/document_sub_type",
+ "crates/documents",
+ "crates/docx_engine",
+ "crates/dynamodb_client",
+ "crates/email",
+ "crates/email_api_client",
+ "crates/email_db_client",
+ "crates/email_service_client",
+ "crates/email_utils",
+ "crates/email_validator",
+ "crates/embedding",
+ "crates/entity_access",
+ "crates/entity_access_db_utils",
+ "crates/entity_access_management",
+ "crates/entity_mutation",
+ "crates/entity_registry/entity_registry",
+ "crates/entity_registry/entity_registry_db_utils",
+ "crates/entity_registry/shared_entity_registry",
+ "crates/favorites",
+ "crates/fig_engine",
+ "crates/filter_ast",
+ "crates/folds/agent_fold",
+ "crates/foreign_entity",
+ "crates/forms",
+ "crates/frecency",
+ "crates/genai_telemetry",
+ "crates/generic_email_domains",
+ "crates/git_patch",
+ "crates/github_pull_requests",
+ "crates/gmail_client",
+ "crates/google_token",
+ "crates/harness_id",
+ "crates/harness_token",
+ "crates/image_generation",
+ "crates/import",
+ "crates/import_jira",
+ "crates/import_linear",
+ "crates/import_notion",
+ "crates/import_tracker",
+ "crates/initiative",
+ "crates/initiative_description",
+ "crates/invite_email",
+ "crates/ip_extractor",
+ "crates/item_filters",
+ "crates/jev",
+ "crates/kafka_util",
+ "crates/last_online_tracker",
+ "crates/lexical_client",
+ "crates/lexical_mention_extractor",
+ "crates/macro_auth",
+ "crates/macro_authorization",
+ "crates/macro_aws_config",
+ "crates/macro_config",
+ "crates/macro_config_derive",
+ "crates/macro_db_client",
+ "crates/macro_entrypoint",
+ "crates/macro_env",
+ "crates/macro_env_var",
+ "crates/macro_event_broker",
+ "crates/macro_event_topics",
+ "crates/macro_queues",
+ "crates/macro_service_urls",
+ "crates/macro_sha_count_client",
+ "crates/macro_sync_service_jwt",
+ "crates/macro_tower_layers",
+ "crates/macro_user_id",
+ "crates/macro_uuid",
+ "crates/maybe_send",
+ "crates/mcp_client",
+ "crates/mcp_select",
+ "crates/mcp_toolset",
+ "crates/memory",
+ "crates/mention_utils",
+ "crates/messages",
+ "crates/model",
+ "crates/model-entity",
+ "crates/model-error-response",
+ "crates/model_file_type",
+ "crates/model_notifications",
+ "crates/model_owner",
+ "crates/model_user",
+ "crates/models_ai_projection",
+ "crates/models_bulk_upload",
+ "crates/models_databases",
+ "crates/models_dcs",
+ "crates/models_email",
+ "crates/models_entity_access_management",
+ "crates/models_forms",
+ "crates/models_grouping",
+ "crates/models_opensearch",
+ "crates/models_pagination",
+ "crates/models_permissions",
+ "crates/models_properties",
+ "crates/models_search",
+ "crates/models_search_cursor",
+ "crates/models_sfs",
+ "crates/models_soup",
+ "crates/models_team",
+ "crates/non_empty",
+ "crates/notification",
+ "crates/notification_state",
+ "crates/opensearch_client",
+ "crates/opensearch_query_builder",
+ "crates/pipedream_mcp",
+ "crates/pptx_engine",
+ "crates/projects",
+ "crates/prompt",
+ "crates/properties",
+ "crates/psd_engine",
+ "crates/rate_limit",
+ "crates/readonly_pool",
+ "crates/reminders",
+ "crates/remote_env_var",
+ "crates/roles_and_permissions",
+ "crates/routines",
+ "crates/s3_key",
+ "crates/search_service_client",
+ "crates/secretsmanager_client",
+ "crates/share_permission_db_utils",
+ "crates/skills",
+ "crates/soup",
+ "crates/sqs_client",
+ "crates/sqs_worker",
+ "crates/static_file",
+ "crates/static_file_service_client",
+ "crates/sync_service",
+ "crates/sync_service_client",
+ "crates/system_properties",
+ "crates/system_skills",
+ "crates/task_dedup",
+ "crates/teams",
+ "crates/trigger_context",
+ "crates/unfurl",
+ "crates/user_quota",
+ "crates/workspace-hack",
+ "services/email_focus_worker"
+ ],
"email_formatting": [
"crates/ai_toolset",
"crates/bot_id",
diff --git a/.sqlx/query-1cf488babaabb9e301eb886c49df39d9fa77a17de10005d6991a9d9e2e23f07e.json b/.sqlx/query-1cf488babaabb9e301eb886c49df39d9fa77a17de10005d6991a9d9e2e23f07e.json
new file mode 100644
index 0000000000..495800c714
--- /dev/null
+++ b/.sqlx/query-1cf488babaabb9e301eb886c49df39d9fa77a17de10005d6991a9d9e2e23f07e.json
@@ -0,0 +1,58 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT t.id, t.link_id, t.is_signal, t.inbox_visible, el.macro_id, el.email_address,\n f.classified_message_id AS \"classified_message_id?\"\n FROM email_threads t\n JOIN email_links el ON el.id = t.link_id\n LEFT JOIN email_thread_focus f ON f.thread_id = t.id\n WHERE t.id = $1\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "link_id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 2,
+ "name": "is_signal",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 3,
+ "name": "inbox_visible",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 4,
+ "name": "macro_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 5,
+ "name": "email_address",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 6,
+ "name": "classified_message_id?",
+ "type_info": "Uuid"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false
+ ]
+ },
+ "hash": "1cf488babaabb9e301eb886c49df39d9fa77a17de10005d6991a9d9e2e23f07e"
+}
diff --git a/.sqlx/query-2110d42dd38744a81f045a881557e43847c3fe531c5f473ceb755682534db90a.json b/.sqlx/query-2110d42dd38744a81f045a881557e43847c3fe531c5f473ceb755682534db90a.json
new file mode 100644
index 0000000000..67e5c9edd3
--- /dev/null
+++ b/.sqlx/query-2110d42dd38744a81f045a881557e43847c3fe531c5f473ceb755682534db90a.json
@@ -0,0 +1,90 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT\n m.id,\n COALESCE(m.internal_date_ts, m.created_at) AS \"at!\",\n m.is_sent,\n m.has_attachments,\n m.subject,\n m.snippet,\n LEFT(m.body_text, $2) AS body,\n c.email_address AS \"from_email?\",\n COALESCE(m.from_name, c.name) AS from_name,\n COALESCE((\n SELECT array_agg(rc.email_address ORDER BY rc.email_address)\n FROM email_message_recipients r\n JOIN email_contacts rc ON rc.id = r.contact_id\n WHERE r.message_id = m.id AND r.recipient_type = 'TO'\n ), '{}') AS \"to_emails!\",\n COALESCE((\n SELECT array_agg(rc.email_address ORDER BY rc.email_address)\n FROM email_message_recipients r\n JOIN email_contacts rc ON rc.id = r.contact_id\n WHERE r.message_id = m.id AND r.recipient_type = 'CC'\n ), '{}') AS \"cc_emails!\",\n EXISTS (\n SELECT 1\n FROM jsonb_array_elements(\n CASE WHEN jsonb_typeof(m.headers_jsonb) = 'array'\n THEN m.headers_jsonb ELSE '[]'::jsonb END\n ) h\n WHERE LOWER(h->>'name') IN (\n 'list-unsubscribe', 'list-id', 'feedback-id', 'x-sg-eid',\n 'x-ses-outgoing', 'x-mailgun-tag', 'x-campaign'\n )\n OR (LOWER(h->>'name') = 'precedence'\n AND LOWER(h->>'value') IN ('bulk', 'list', 'junk'))\n ) AS \"bulk!\"\n FROM email_messages m\n LEFT JOIN email_contacts c ON c.id = m.from_contact_id\n WHERE m.thread_id = $1\n AND NOT m.is_draft\n AND NOT EXISTS (\n SELECT 1 FROM email_message_labels ml\n JOIN email_labels l ON l.id = ml.label_id\n WHERE ml.message_id = m.id AND l.name = 'TRASH'\n )\n ORDER BY COALESCE(m.internal_date_ts, m.created_at) DESC, m.id DESC\n LIMIT $3\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "at!",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 2,
+ "name": "is_sent",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 3,
+ "name": "has_attachments",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 4,
+ "name": "subject",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 5,
+ "name": "snippet",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 6,
+ "name": "body",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 7,
+ "name": "from_email?",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 8,
+ "name": "from_name",
+ "type_info": "Varchar"
+ },
+ {
+ "ordinal": 9,
+ "name": "to_emails!",
+ "type_info": "VarcharArray"
+ },
+ {
+ "ordinal": 10,
+ "name": "cc_emails!",
+ "type_info": "VarcharArray"
+ },
+ {
+ "ordinal": 11,
+ "name": "bulk!",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Int4",
+ "Int8"
+ ]
+ },
+ "nullable": [
+ false,
+ null,
+ false,
+ false,
+ true,
+ true,
+ null,
+ false,
+ null,
+ null,
+ null,
+ null
+ ]
+ },
+ "hash": "2110d42dd38744a81f045a881557e43847c3fe531c5f473ceb755682534db90a"
+}
diff --git a/.sqlx/query-5d67f3eb1f40039f8c892b01dfcdf48969c3943748d447b14b5ac1e497a1d1a9.json b/.sqlx/query-5d67f3eb1f40039f8c892b01dfcdf48969c3943748d447b14b5ac1e497a1d1a9.json
new file mode 100644
index 0000000000..dacbb26585
--- /dev/null
+++ b/.sqlx/query-5d67f3eb1f40039f8c892b01dfcdf48969c3943748d447b14b5ac1e497a1d1a9.json
@@ -0,0 +1,30 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT t.id,\n GREATEST(t.latest_inbound_message_ts, t.latest_outbound_message_ts)\n AS \"latest_at!\"\n FROM email_links el\n JOIN email_threads t ON t.link_id = el.id\n LEFT JOIN email_thread_focus f ON f.thread_id = t.id\n WHERE LOWER(SPLIT_PART(el.email_address, '@', 2)) = ANY($2)\n AND t.inbox_visible\n AND t.is_signal\n AND t.latest_inbound_message_ts IS NOT NULL\n AND t.latest_inbound_message_ts >= $1\n AND (\n f.thread_id IS NULL\n OR f.classified_message_ts\n < GREATEST(t.latest_inbound_message_ts, t.latest_outbound_message_ts)\n )\n ORDER BY t.latest_inbound_message_ts DESC\n LIMIT $3\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "latest_at!",
+ "type_info": "Timestamptz"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Timestamptz",
+ "TextArray",
+ "Int8"
+ ]
+ },
+ "nullable": [
+ false,
+ null
+ ]
+ },
+ "hash": "5d67f3eb1f40039f8c892b01dfcdf48969c3943748d447b14b5ac1e497a1d1a9"
+}
diff --git a/.sqlx/query-65114771d7f78f812488196eba0b96b325ac8c8fe9eafb3bba2c58a0f75c2917.json b/.sqlx/query-65114771d7f78f812488196eba0b96b325ac8c8fe9eafb3bba2c58a0f75c2917.json
new file mode 100644
index 0000000000..aa4bbfae6b
--- /dev/null
+++ b/.sqlx/query-65114771d7f78f812488196eba0b96b325ac8c8fe9eafb3bba2c58a0f75c2917.json
@@ -0,0 +1,24 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT f.thread_id\n FROM email_thread_focus f\n -- Joining on the inbox too lets the planner walk each inbox's recent\n -- signal threads (idx_email_threads_signal_view) instead of every\n -- Focus row the inbox ever had.\n JOIN email_threads t ON t.id = f.thread_id AND t.link_id = f.link_id\n WHERE f.link_id IN (\n -- The owner's inboxes, as Soup lists them: their own and linked ones.\n SELECT el.id FROM email_links el WHERE el.macro_id = $1\n UNION\n SELECT mul.link_id FROM macro_user_links mul WHERE mul.primary_macro_id = $1\n )\n AND f.is_focus\n AND t.inbox_visible\n AND t.is_signal\n AND t.latest_inbound_message_ts >= $2\n -- Priority: importance, halved for every 2 days (172800 s) since the\n -- latest inbound mail. As a sum of logs the key doesn't depend on the\n -- current time, so the order only changes when new mail arrives.\n ORDER BY log(2.0, GREATEST(f.importance, 1))\n + extract(epoch FROM t.latest_inbound_message_ts) / 172800 DESC,\n t.latest_inbound_message_ts DESC,\n f.thread_id\n LIMIT $3\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "thread_id",
+ "type_info": "Uuid"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Timestamptz",
+ "Int8"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "65114771d7f78f812488196eba0b96b325ac8c8fe9eafb3bba2c58a0f75c2917"
+}
diff --git a/.sqlx/query-862dc37caafc34b0e704a54a782f2d6d4b949f78a45d3c0bda01c63e1842f5c1.json b/.sqlx/query-862dc37caafc34b0e704a54a782f2d6d4b949f78a45d3c0bda01c63e1842f5c1.json
new file mode 100644
index 0000000000..911880b907
--- /dev/null
+++ b/.sqlx/query-862dc37caafc34b0e704a54a782f2d6d4b949f78a45d3c0bda01c63e1842f5c1.json
@@ -0,0 +1,25 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n INSERT INTO email_thread_focus (\n thread_id, link_id, classified_message_id, classified_message_ts, is_focus,\n category, importance, needs_reply, needs_follow_up, scores, model, classified_at\n )\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)\n ON CONFLICT (thread_id) DO UPDATE SET\n link_id = EXCLUDED.link_id,\n classified_message_id = EXCLUDED.classified_message_id,\n classified_message_ts = EXCLUDED.classified_message_ts,\n is_focus = EXCLUDED.is_focus,\n category = EXCLUDED.category,\n importance = EXCLUDED.importance,\n needs_reply = EXCLUDED.needs_reply,\n needs_follow_up = EXCLUDED.needs_follow_up,\n scores = EXCLUDED.scores,\n model = EXCLUDED.model,\n classified_at = EXCLUDED.classified_at\n WHERE email_thread_focus.classified_message_ts <= EXCLUDED.classified_message_ts\n ",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Uuid",
+ "Uuid",
+ "Timestamptz",
+ "Bool",
+ "Text",
+ "Int2",
+ "Bool",
+ "Bool",
+ "Jsonb",
+ "Text",
+ "Timestamptz"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "862dc37caafc34b0e704a54a782f2d6d4b949f78a45d3c0bda01c63e1842f5c1"
+}
diff --git a/.sqlx/query-cd9fbd473a524bea0be21c40dc68018d0552b556a93e9c5e8a6a8d1d4a3d9fec.json b/.sqlx/query-cd9fbd473a524bea0be21c40dc68018d0552b556a93e9c5e8a6a8d1d4a3d9fec.json
new file mode 100644
index 0000000000..5497058963
--- /dev/null
+++ b/.sqlx/query-cd9fbd473a524bea0be21c40dc68018d0552b556a93e9c5e8a6a8d1d4a3d9fec.json
@@ -0,0 +1,59 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT f.thread_id, f.is_focus, f.category, f.importance, f.needs_reply,\n f.needs_follow_up, f.classified_at\n FROM email_thread_focus f\n WHERE f.thread_id = ANY($1)\n AND f.link_id IN (\n SELECT el.id FROM email_links el WHERE el.macro_id = $2\n UNION\n SELECT mul.link_id FROM macro_user_links mul WHERE mul.primary_macro_id = $2\n )\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "thread_id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "is_focus",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 2,
+ "name": "category",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "importance",
+ "type_info": "Int2"
+ },
+ {
+ "ordinal": 4,
+ "name": "needs_reply",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 5,
+ "name": "needs_follow_up",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 6,
+ "name": "classified_at",
+ "type_info": "Timestamptz"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "UuidArray",
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ false
+ ]
+ },
+ "hash": "cd9fbd473a524bea0be21c40dc68018d0552b556a93e9c5e8a6a8d1d4a3d9fec"
+}
diff --git a/.sqlx/query-e0fb2c92ab5c17b3b872c396babd02295055a9eb318fa968a4db79ba6807d381.json b/.sqlx/query-e0fb2c92ab5c17b3b872c396babd02295055a9eb318fa968a4db79ba6807d381.json
new file mode 100644
index 0000000000..e76f5582a1
--- /dev/null
+++ b/.sqlx/query-e0fb2c92ab5c17b3b872c396babd02295055a9eb318fa968a4db79ba6807d381.json
@@ -0,0 +1,31 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT newest.recipient AS \"recipient!\", LEFT(m.body_text, $3) AS body\n FROM (\n SELECT LOWER(rc.email_address) AS recipient, m.id, m.internal_date_ts\n FROM email_contacts rc\n JOIN email_message_recipients r ON r.contact_id = rc.id\n JOIN email_messages m ON m.id = r.message_id\n WHERE rc.link_id = $1\n AND LOWER(rc.email_address) = ANY($2)\n AND m.is_sent\n AND NOT m.is_draft\n ORDER BY m.internal_date_ts DESC NULLS LAST\n LIMIT $4\n ) newest\n JOIN email_messages m ON m.id = newest.id\n ORDER BY newest.internal_date_ts DESC NULLS LAST\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "recipient!",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 1,
+ "name": "body",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "TextArray",
+ "Int4",
+ "Int8"
+ ]
+ },
+ "nullable": [
+ null,
+ null
+ ]
+ },
+ "hash": "e0fb2c92ab5c17b3b872c396babd02295055a9eb318fa968a4db79ba6807d381"
+}
diff --git a/Cargo.lock b/Cargo.lock
index 6ce8782f9b..00e34415d3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -7318,6 +7318,35 @@ dependencies = [
"workspace-hack",
]
+[[package]]
+name = "email_focus_worker"
+version = "0.1.0"
+dependencies = [
+ "ai_usage",
+ "chrono",
+ "doppler-config",
+ "email",
+ "jev",
+ "kafka_util",
+ "macro_config",
+ "macro_entrypoint",
+ "macro_env",
+ "macro_env_var",
+ "macro_event_broker",
+ "macro_user_id",
+ "memory",
+ "rdkafka",
+ "rootcause",
+ "serde",
+ "serde_json",
+ "sqlx",
+ "tokio",
+ "tokio-util",
+ "tracing",
+ "uuid",
+ "workspace-hack",
+]
+
[[package]]
name = "email_formatting"
version = "0.1.0"
@@ -9099,6 +9128,7 @@ dependencies = [
"futures",
"graphql_common",
"macro_user_id",
+ "rootcause",
"serde_json",
"tokio",
"tracing",
diff --git a/Cargo.toml b/Cargo.toml
index 07ca31fff7..0ff385c597 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -161,6 +161,7 @@ members = [
"services/document_text_extractor",
"services/document_upload_finalizer_handler",
"services/docx_unzip_handler",
+ "services/email_focus_worker",
"services/email_refresh_handler",
"services/email_scheduled_handler",
"services/email_service",
diff --git a/apps/web/src/features/email-view/components/EmailControls.tsx b/apps/web/src/features/email-view/components/EmailControls.tsx
index 4de2ef2105..3191f52c89 100644
--- a/apps/web/src/features/email-view/components/EmailControls.tsx
+++ b/apps/web/src/features/email-view/components/EmailControls.tsx
@@ -1,14 +1,32 @@
-import { ListFilterDropdown } from '@app/components/view-shell';
+import {
+ ListFilterDropdown,
+ ListSortDropdown,
+} from '@app/components/view-shell';
import { HeaderActionGroup } from '@components/app/HeaderActionGroup';
import { TOKENS } from '@core/hotkey/tokens';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import ColumnsIcon from '@icon/system/regular/columns.svg';
import { ButtonGroup } from '@ui';
import { Show } from 'solid-js';
+import { EMAIL_FOCUS_SORT_OPTIONS } from '../constants';
import { useEmailView } from '../email-view-context';
import { useEmailFilters } from '../filters/use-email-filters';
import { EmailInboxMenu } from './EmailInboxSelector';
+const FOCUS_SORT_OPTIONS = EMAIL_FOCUS_SORT_OPTIONS.map((option) => ({
+ id: option.id,
+ label: option.label,
+ content:
+ option.description === undefined
+ ? undefined
+ : () => (
+ <span class="flex flex-col">
+ <span>{option.label}</span>
+ <span class="text-xs text-ink-muted">{option.description}</span>
+ </span>
+ ),
+}));
+
export type EmailControlsProps = {
/** Controlled filter-menu state, so the header's `f` hotkey can open it. */
filterOpen?: boolean;
@@ -17,7 +35,7 @@ export type EmailControlsProps = {
export function EmailControls(props: EmailControlsProps) {
const filters = useEmailFilters();
- const { readingPane, setReadingPane } = useEmailView();
+ const { state, setFocusSort, readingPane, setReadingPane } = useEmailView();
return (
<>
@@ -46,6 +64,16 @@ export function EmailControls(props: EmailControlsProps) {
</HeaderActionGroup>
</div>
<HeaderActionGroup label="Email view options" size="md">
+ <Show when={state.tab === 'focus'}>
+ <ListSortDropdown
+ grouped
+ size="icon-md"
+ label="Sort Focus"
+ value={state.focusSort}
+ options={FOCUS_SORT_OPTIONS}
+ onChange={setFocusSort}
+ />
+ </Show>
<Show when={!isTouchDevice()}>
<ButtonGroup.Button
aria-label={
diff --git a/apps/web/src/features/email-view/components/EmailEmptyState.tsx b/apps/web/src/features/email-view/components/EmailEmptyState.tsx
index 56c1c8b19e..10cca2bedb 100644
--- a/apps/web/src/features/email-view/components/EmailEmptyState.tsx
+++ b/apps/web/src/features/email-view/components/EmailEmptyState.tsx
@@ -5,6 +5,7 @@ import EmptyStateEmailGraphic from '@design/empty-state-email.svg';
import EmptyStateInboxTrayGraphic from '@design/empty-state-inbox-tray.svg';
import EmptyStateNoFilterMatchGraphic from '@design/empty-state-no-filter-match.svg';
import EmptyStateNoSearchMatchGraphic from '@design/empty-state-no-search-match.svg';
+import { FOCUS_WINDOW_DAYS } from '@queries/email/focus';
import { EmptyStatePanel, FilteredHiddenBanner } from '@ui';
import { Match, Switch } from 'solid-js';
import { match } from 'ts-pattern';
@@ -57,6 +58,10 @@ function tabCopy(tab: EmailTab): { title: string; description: string } {
title: 'No archived email',
description: 'Email you archive will appear here.',
}))
+ .with('focus', () => ({
+ title: 'Nothing needs you',
+ description: `Signal email worth your attention from the last ${FOCUS_WINDOW_DAYS} days appears here.`,
+ }))
.with('all', () => ({
title: 'No email yet',
description: 'Everything in your inbox will appear here as it arrives.',
@@ -111,7 +116,11 @@ export function EmailEmptyState() {
centered
graphic={EmptyStateNoSearchMatchGraphic}
title={`No results for "${search()}"`}
- description="Search across subjects, senders, and message content. Try a different query."
+ description={
+ state.tab === 'focus'
+ ? 'Focus search covers subjects, senders, and previews. Try a different query.'
+ : 'Search across subjects, senders, and message content. Try a different query.'
+ }
documentationUrl={`${DOCS_BASE}/product/search`}
/>
)}
diff --git a/apps/web/src/features/email-view/components/EmailFocusBadges.tsx b/apps/web/src/features/email-view/components/EmailFocusBadges.tsx
new file mode 100644
index 0000000000..4745d58792
--- /dev/null
+++ b/apps/web/src/features/email-view/components/EmailFocusBadges.tsx
@@ -0,0 +1,106 @@
+import type { EmailFocus, EntityData } from '@entity';
+import { useListLayout } from '@entity/composed/list-entity/shared';
+import { Badge, cn, TagDot, Tooltip } from '@ui';
+import { For, type ParentProps, Show } from 'solid-js';
+
+/** A Focus row's classification; other rows have none. */
+export const emailFocusOf = (entity: EntityData): EmailFocus | undefined =>
+ entity.type === 'email' ? entity.focus : undefined;
+
+/** Lit bars for each importance band, highest first. */
+const IMPORTANCE_LEVELS = [
+ { from: 80, lit: 5, color: 'bg-green' },
+ { from: 60, lit: 4, color: 'bg-lime' },
+ { from: 40, lit: 3, color: 'bg-yellow' },
+ { from: 20, lit: 2, color: 'bg-orange' },
+ { from: 5, lit: 1, color: 'bg-red' },
+ { from: 0, lit: 0, color: '' },
+] as const;
+
+const BARS = [0, 1, 2, 3, 4] as const;
+
+/** The 0-100 importance score as a number and a five-bar meter. */
+function ImportanceMeter(props: { focus: EmailFocus }) {
+ const label = () => `Importance ${props.focus.importance} of 100`;
+ const level = () =>
+ IMPORTANCE_LEVELS.find((band) => props.focus.importance >= band.from) ??
+ IMPORTANCE_LEVELS[IMPORTANCE_LEVELS.length - 1];
+ return (
+ <Tooltip as="span" label={label()} class="inline-flex shrink-0">
+ <span role="img" aria-label={label()} class="flex items-center gap-2">
+ <span class="w-[3ch] text-right text-xs font-medium tabular-nums text-ink-muted">
+ {props.focus.importance}
+ </span>
+ <span class="flex items-center gap-[3px]">
+ <For each={BARS}>
+ {(bar) => (
+ <span
+ class={cn(
+ 'h-3.5 w-1.5 rounded-full',
+ bar < level().lit ? level().color : 'bg-ink-extra-muted/25'
+ )}
+ />
+ )}
+ </For>
+ </span>
+ </span>
+ </Tooltip>
+ );
+}
+
+/** The score at the end of a wide Focus row, after the labels and tags. */
+export function EmailFocusScore(props: { focus: EmailFocus }) {
+ return <ImportanceMeter focus={props.focus} />;
+}
+
+/** The score ahead of the subject in narrow rows, which have no metadata column. */
+export function EmailFocusNarrowScore(props: { focus: EmailFocus }) {
+ const listLayout = useListLayout();
+ return (
+ <Show when={!(listLayout?.isWide() ?? true)}>
+ <ImportanceMeter focus={props.focus} />
+ </Show>
+ );
+}
+
+/**
+ * Dot color per label. Follow up is blue, not the accent: the accent can be
+ * orange, which reads as Reply needed's amber beside it.
+ */
+const LABEL_TONES = {
+ warning: 'var(--color-warning)',
+ blue: 'var(--color-blue)',
+} as const;
+
+type LabelTone = keyof typeof LABEL_TONES;
+
+/**
+ * A read-only label drawn like a row's tag pills (`tagPillClasses`). Rows
+ * under 56rem leave the room to the subject; the filter menu still finds them.
+ */
+function FocusLabel(props: ParentProps<{ tone: LabelTone }>) {
+ return (
+ <Badge
+ variant="outline"
+ size="sm"
+ class="hidden select-none border-edge-button bg-control @4xl/entity:inline-flex"
+ >
+ <TagDot size="sm" fill={LABEL_TONES[props.tone]} />
+ {props.children}
+ </Badge>
+ );
+}
+
+/** Reply-needed and follow-up labels in a Focus row's metadata. */
+export function EmailFocusFlags(props: { focus: EmailFocus }) {
+ return (
+ <>
+ <Show when={props.focus.needsReply}>
+ <FocusLabel tone="warning">Reply needed</FocusLabel>
+ </Show>
+ <Show when={props.focus.needsFollowUp}>
+ <FocusLabel tone="blue">Follow up</FocusLabel>
+ </Show>
+ </>
+ );
+}
diff --git a/apps/web/src/features/email-view/components/EmailHeader.tsx b/apps/web/src/features/email-view/components/EmailHeader.tsx
index 65ac825b15..395042e0a0 100644
--- a/apps/web/src/features/email-view/components/EmailHeader.tsx
+++ b/apps/web/src/features/email-view/components/EmailHeader.tsx
@@ -12,13 +12,20 @@ import { useSplitLayout } from '@components/app/split-layout/layout';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import { registerHotkey } from '@core/hotkey/hotkeys';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
-import { Tabs } from '@ui';
+import { Badge, Tabs } from '@ui';
import { tourTarget } from '@ui/components/Tour';
import { createSignal, Show } from 'solid-js';
import { composeEmail } from '../compose-email';
-import { EMAIL_TAB_LABELS, EMAIL_TABS } from '../constants';
+import {
+ EMAIL_FOCUS_TAB,
+ EMAIL_INBOX_TAB_IDS,
+ EMAIL_TAB_LABELS,
+ EMAIL_TABS,
+ isEmailInboxTab,
+} from '../constants';
import { useEmailView } from '../email-view-context';
import { EMAIL_TOUR } from '../tour';
+import { useVisibleEmailTab } from '../use-visible-email-tab';
import { EmailControls } from './EmailControls';
export type EmailHeaderProps = {
@@ -29,8 +36,7 @@ export type EmailHeaderProps = {
export function EmailViewBreadcrumbItem() {
const { state, tagViewTitle } = useEmailView();
- const inboxSelected = () =>
- !isTouchDevice() && (state.tab === 'important' || state.tab === 'noise');
+ const inboxSelected = () => !isTouchDevice() && isEmailInboxTab(state.tab);
const tabTitle = () =>
tagViewTitle() ??
(inboxSelected()
@@ -81,8 +87,13 @@ export function EmailHeader(props: EmailHeaderProps) {
const [filterOpen, setFilterOpen] = createSignal(false);
let focusSearch: (() => void) | undefined;
const searchTarget = tourTarget(EMAIL_TOUR.search);
- const inboxSelected = () =>
- state.tab === 'important' || state.tab === 'noise';
+ const isVisible = useVisibleEmailTab();
+ const inboxSelected = () => isEmailInboxTab(state.tab);
+ const inboxTabs = () =>
+ EMAIL_INBOX_TAB_IDS.filter(isVisible).map((id) => ({
+ value: id,
+ label: EMAIL_TAB_LABELS[id],
+ }));
const selectedTabLabel = () =>
tagViewTitle() ??
(inboxSelected()
@@ -150,14 +161,16 @@ export function EmailHeader(props: EmailHeaderProps) {
aria-label="Inbox view"
size="md"
class="shrink-0"
- options={[
- { value: 'important', label: EMAIL_TAB_LABELS.important },
- { value: 'noise', label: EMAIL_TAB_LABELS.noise },
- ]}
+ options={inboxTabs()}
value={state.tab}
onChange={setTab}
/>
</Show>
+ <Show when={state.tab === 'focus'}>
+ <Badge variant="outline" size="xs" class="shrink-0">
+ {EMAIL_FOCUS_TAB.badge}
+ </Badge>
+ </Show>
</div>
}
>
diff --git a/apps/web/src/features/email-view/components/EmailList.tsx b/apps/web/src/features/email-view/components/EmailList.tsx
index c0de3e906b..246d0a4d55 100644
--- a/apps/web/src/features/email-view/components/EmailList.tsx
+++ b/apps/web/src/features/email-view/components/EmailList.tsx
@@ -80,6 +80,12 @@ import { EMAIL_TOUR } from '../tour';
import { useEmailListHotkeys } from '../use-email-list-hotkeys';
import { EmailDateGroupHeader } from './EmailDateGroupHeader';
import { EmailEmptyState } from './EmailEmptyState';
+import {
+ EmailFocusFlags,
+ EmailFocusNarrowScore,
+ EmailFocusScore,
+ emailFocusOf,
+} from './EmailFocusBadges';
import { EmailRowActions, EmailStarAction } from './EmailRowActions';
type EmailActionRow = {
@@ -768,6 +774,41 @@ export function EmailList(props: EmailListProps) {
<ListEntity
entity={entityRow().entity}
onFilterByTag={filterByTag}
+ titleLeading={
+ <Show
+ when={emailFocusOf(
+ entityRow().entity
+ )}
+ >
+ {(focus) => (
+ <EmailFocusNarrowScore
+ focus={focus()}
+ />
+ )}
+ </Show>
+ }
+ meta={
+ <Show
+ when={emailFocusOf(
+ entityRow().entity
+ )}
+ >
+ {(focus) => (
+ <EmailFocusFlags focus={focus()} />
+ )}
+ </Show>
+ }
+ metaEnd={
+ <Show
+ when={emailFocusOf(
+ entityRow().entity
+ )}
+ >
+ {(focus) => (
+ <EmailFocusScore focus={focus()} />
+ )}
+ </Show>
+ }
scheduleStatus={
<Show
when={source.reminderForThread?.(
diff --git a/apps/web/src/features/email-view/components/EmailSidebar.tsx b/apps/web/src/features/email-view/components/EmailSidebar.tsx
index c9fe3c73dc..f4acd01651 100644
--- a/apps/web/src/features/email-view/components/EmailSidebar.tsx
+++ b/apps/web/src/features/email-view/components/EmailSidebar.tsx
@@ -4,15 +4,14 @@ import {
ViewSidebar,
} from '@app/components/view-shell';
import { SidebarCreateButton } from '@app/components/view-shell/SidebarCreateButton';
-import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { useSplitLayout } from '@components/app/split-layout/layout';
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
-import { enableReminders } from '@core/constant/featureFlags';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import ArchiveIcon from '@icon/system/regular/archive.svg';
import BellIcon from '@icon/system/regular/bell-simple.svg';
import CalendarBlankIcon from '@icon/system/regular/calendar-blank.svg';
import ClockIcon from '@icon/system/regular/clock.svg';
+import FocusIcon from '@icon/system/regular/crosshair.svg';
import EnvelopeIcon from '@icon/system/regular/envelope.svg';
import FileIcon from '@icon/system/regular/file.svg';
import PaperPlaneTiltIcon from '@icon/system/regular/paper-plane-tilt.svg';
@@ -23,23 +22,27 @@ import SignalIcon from '@icon/system/regular/wave-sine.svg';
import NoiseIcon from '@icon/system/regular/waveform.svg';
import { SidebarTagsSection } from '@property/tags/SidebarTagsSection';
import type { TagScope } from '@service-properties/generated/schemas/tagScope';
-import { pressHandlers } from '@ui';
+import { Badge, pressHandlers } from '@ui';
import { tourTarget } from '@ui/components/Tour';
import { type Component, For, Show } from 'solid-js';
import { Dynamic } from 'solid-js/web';
import { composeEmail } from '../compose-email';
-import { EMAIL_TAB_IDS, EMAIL_TAB_LABELS, EMAIL_TABS } from '../constants';
+import {
+ EMAIL_FOCUS_TAB,
+ EMAIL_INBOX_TAB_IDS,
+ EMAIL_TAB_IDS,
+ EMAIL_TAB_LABELS,
+ EMAIL_TABS,
+ isEmailInboxTab,
+} from '../constants';
import { useEmailView } from '../email-view-context';
import { EMAIL_TOUR } from '../tour';
import type { EmailTab } from '../types';
+import { useVisibleEmailTab } from '../use-visible-email-tab';
import { EmailInboxList } from './EmailInboxSelector';
// Email is personal, so the sidebar lists only the user's own tags.
const SIDEBAR_TAG_SCOPES: readonly TagScope[] = ['user'];
-const INBOX_TAB_IDS = [
- 'important',
- 'noise',
-] as const satisfies readonly EmailTab[];
const PRIMARY_TAB_IDS = [
'favorites',
'drafts',
@@ -70,9 +73,15 @@ const TAB_ICONS: Record<EmailTab, Component<{ class?: string }>> = {
shared: UsersThreeIcon,
archived: ArchiveIcon,
all: EnvelopeIcon,
+ focus: FocusIcon,
};
-function Tab(props: { id: EmailTab; label?: string; onNavigate?: () => void }) {
+function Tab(props: {
+ id: EmailTab;
+ label?: string;
+ badge?: string;
+ onNavigate?: () => void;
+}) {
const { state, setTab } = useEmailView();
return (
@@ -87,22 +96,32 @@ function Tab(props: { id: EmailTab; label?: string; onNavigate?: () => void }) {
<Dynamic component={TAB_ICONS[props.id]} class="size-4" />
</ViewSidebar.Icon>
<span class="truncate">{props.label ?? EMAIL_TAB_LABELS[props.id]}</span>
+ <Show when={props.badge}>
+ {(badge) => (
+ <Badge variant="outline" size="xs" class="ml-auto">
+ {badge()}
+ </Badge>
+ )}
+ </Show>
</ViewSidebar.Item>
);
}
export function EmailNavigation(props: { onNavigate?: () => void }) {
const { state, setTab } = useEmailView();
- const reminders = useFeatureFlag(enableReminders);
- const showTab = (id: EmailTab) =>
- id !== 'reminders' ||
- reminders().enabled ||
- (reminders().loading && state.tab === 'reminders');
+ const isVisible = useVisibleEmailTab();
return (
<Show
when={!isTouchDevice()}
fallback={
<ViewSidebar.Nav aria-label="Email tabs">
+ <Show when={isVisible('focus')}>
+ <Tab
+ id="focus"
+ badge={EMAIL_FOCUS_TAB.badge}
+ onNavigate={props.onNavigate}
+ />
+ </Show>
<div
ref={tourTarget(EMAIL_TOUR.signalNoise)}
class="flex flex-col gap-(--sidebar-row-gap)"
@@ -111,7 +130,11 @@ export function EmailNavigation(props: { onNavigate?: () => void }) {
{(item) => <Tab id={item.id} onNavigate={props.onNavigate} />}
</For>
</div>
- <For each={EMAIL_TABS.slice(2).filter((tab) => showTab(tab.id))}>
+ <For
+ each={EMAIL_TABS.slice(2).filter(
+ (tab) => tab.id !== 'focus' && isVisible(tab.id)
+ )}
+ >
{(item) => <Tab id={item.id} onNavigate={props.onNavigate} />}
</For>
</ViewSidebar.Nav>
@@ -120,9 +143,10 @@ export function EmailNavigation(props: { onNavigate?: () => void }) {
<ViewSidebar.Nav aria-label="Email tabs">
<ViewSidebar.Item
ref={tourTarget(EMAIL_TOUR.inbox)}
- active={state.tab === 'important' || state.tab === 'noise'}
+ active={isEmailInboxTab(state.tab)}
{...pressHandlers(() => {
- setTab(state.tab === 'noise' ? 'noise' : 'important');
+ // Reopen the Inbox view that was last open: Focus, Signal or Noise.
+ setTab(isEmailInboxTab(state.tab) ? state.tab : 'important');
props.onNavigate?.();
})}
>
@@ -131,7 +155,7 @@ export function EmailNavigation(props: { onNavigate?: () => void }) {
</ViewSidebar.Icon>
<span class="truncate">Inbox</span>
</ViewSidebar.Item>
- <For each={PRIMARY_TAB_IDS.filter(showTab)}>
+ <For each={PRIMARY_TAB_IDS.filter(isVisible)}>
{(id) => <Tab id={id} onNavigate={props.onNavigate} />}
</For>
</ViewSidebar.Nav>
@@ -159,7 +183,7 @@ export function EmailNavigation(props: { onNavigate?: () => void }) {
}
export function EmailSidebar() {
- const reminders = useFeatureFlag(enableReminders);
+ const isVisible = useVisibleEmailTab();
const panel = useSplitPanelOrThrow();
const { openWithSplit } = useSplitLayout();
const {
@@ -172,20 +196,16 @@ export function EmailSidebar() {
} = useEmailView();
const tabIds = () =>
- (isTouchDevice() ? EMAIL_TAB_IDS : DESKTOP_TAB_IDS).filter(
- (id) =>
- id !== 'reminders' ||
- reminders().enabled ||
- (reminders().loading && state.tab === 'reminders')
- );
+ (isTouchDevice() ? EMAIL_TAB_IDS : DESKTOP_TAB_IDS).filter(isVisible);
useViewTabHotkeys({
scopeId: panel.splitHotkeyScope,
enabled: panel.isPanelActive,
ids: tabIds,
- // Desktop groups Signal and Noise under Inbox, so Tab toggles between
- // them instead of walking the sidebar.
- sequentialIds: () => (isTouchDevice() ? tabIds() : INBOX_TAB_IDS),
+ // Desktop groups the Inbox views under Inbox, so Tab moves between its
+ // header tabs instead of walking the sidebar.
+ sequentialIds: () =>
+ isTouchDevice() ? tabIds() : EMAIL_INBOX_TAB_IDS.filter(isVisible),
activeId: () => state.tab,
setActiveId: setTab,
shouldHandleSequentialKeyEvent: (event) =>
diff --git a/apps/web/src/features/email-view/constants.ts b/apps/web/src/features/email-view/constants.ts
index 506327ee36..45857bd904 100644
--- a/apps/web/src/features/email-view/constants.ts
+++ b/apps/web/src/features/email-view/constants.ts
@@ -1,6 +1,8 @@
/**
* Existing tab ids match the legacy mail view (`important` is Signal).
* Favorites extends that list; entity action capabilities use `${view}-${tab}`.
+ * Focus comes last so the Signal/Noise pair keeps its position and hotkeys;
+ * the Inbox tabs and the touch layouts draw it before them.
*/
export const EMAIL_TAB_IDS = [
'important',
@@ -14,6 +16,7 @@ export const EMAIL_TAB_IDS = [
'shared',
'archived',
'all',
+ 'focus',
] as const;
export type EmailTab = (typeof EMAIL_TAB_IDS)[number];
@@ -30,11 +33,14 @@ export const EMAIL_TAB_LABELS = {
shared: 'Shared',
archived: 'Archived',
all: 'All',
+ focus: 'Focus',
} as const satisfies Record<EmailTab, string>;
export type EmailTabItem = {
id: EmailTab;
label: string;
+ /** A short status beside the label, e.g. for an experimental tab. */
+ badge?: string;
};
export const EMAIL_TABS: readonly EmailTabItem[] = EMAIL_TAB_IDS.map((id) => ({
@@ -43,3 +49,46 @@ export const EMAIL_TABS: readonly EmailTabItem[] = EMAIL_TAB_IDS.map((id) => ({
}));
export const DEFAULT_EMAIL_TAB: EmailTab = 'important';
+
+/** The views behind the desktop sidebar's Inbox item, as the header's tabs. */
+export const EMAIL_INBOX_TAB_IDS = [
+ 'focus',
+ 'important',
+ 'noise',
+] as const satisfies readonly EmailTab[];
+
+export const isEmailInboxTab = (tab: EmailTab) =>
+ (EMAIL_INBOX_TAB_IDS as readonly EmailTab[]).includes(tab);
+
+/** Leads the mobile pills and the touch sidebar, above the Signal/Noise pair. */
+export const EMAIL_FOCUS_TAB: EmailTabItem = {
+ id: 'focus',
+ label: EMAIL_TAB_LABELS.focus,
+ badge: 'Experimental',
+};
+
+/** How the Focus tab orders its threads. */
+export const EMAIL_FOCUS_SORT_IDS = [
+ 'priority',
+ 'importance',
+ 'recent',
+] as const;
+
+export type EmailFocusSort = (typeof EMAIL_FOCUS_SORT_IDS)[number];
+
+export const DEFAULT_EMAIL_FOCUS_SORT: EmailFocusSort = 'priority';
+
+export const EMAIL_FOCUS_SORT_OPTIONS: readonly {
+ id: EmailFocusSort;
+ label: string;
+ /** A second line in the sort menu, for orders the label can't explain. */
+ description?: string;
+}[] = [
+ {
+ id: 'priority',
+ label: 'Priority',
+ description: 'Importance, halved every 2 days since mail last came in',
+ },
+ { id: 'importance', label: 'Importance' },
+ { id: 'recent', label: 'Most recent' },
+];
diff --git a/apps/web/src/features/email-view/email-view-context.test.tsx b/apps/web/src/features/email-view/email-view-context.test.tsx
index bd0749c576..b0c31d75a0 100644
--- a/apps/web/src/features/email-view/email-view-context.test.tsx
+++ b/apps/web/src/features/email-view/email-view-context.test.tsx
@@ -12,13 +12,16 @@ const mocks = vi.hoisted(() => ({
navigate: vi.fn(),
useRouteParams: vi.fn(),
useEmailLinksQuery: vi.fn(),
- reminders: (): boolean => true,
+ /** Whether the remote flag with this PostHog key is on. */
+ flag: (_key: string): boolean => true,
tab: (): string => 'important',
tagSets: (): TagSetResponse[] => [],
}));
vi.mock('@app/lib/analytics/posthog', () => ({
- useFeatureFlag: () => () => ({ enabled: mocks.reminders() }),
+ useFeatureFlag:
+ ({ key }: { key: string }) =>
+ () => ({ enabled: mocks.flag(key), loading: false }),
}));
vi.mock('@app/components/list', () => ({
createListController: () => ({}),
@@ -91,7 +94,7 @@ vi.mock('./email-route', () => ({
afterEach(() => {
cleanup();
vi.clearAllMocks();
- mocks.reminders = () => true;
+ mocks.flag = () => true;
mocks.tab = () => 'important';
mocks.tagSets = () => [];
});
@@ -214,7 +217,7 @@ describe('tag view title', () => {
it('normalizes restored and route-driven Reminders when the rollout is disabled', () => {
const [flag, setFlag] = createStore({ enabled: true });
- mocks.reminders = () => flag.enabled;
+ mocks.flag = (key) => key !== 'enable-reminders' || flag.enabled;
mocks.tab = () => 'reminders';
const { view } = mount();
expect(view.state.tab).toBe('reminders');
@@ -224,3 +227,18 @@ it('normalizes restored and route-driven Reminders when the rollout is disabled'
view.setTab('reminders');
expect(view.state.tab).toBe('important');
});
+
+it('leaves a restored Focus tab when Focus or GraphQL Soup turns off', () => {
+ for (const off of ['enable-email-focus', 'enable-graphql-soup']) {
+ const [flag, setFlag] = createStore({ enabled: true });
+ mocks.flag = (key) => key !== off || flag.enabled;
+ mocks.tab = () => 'focus';
+ const { view } = mount();
+ expect(view.state.tab).toBe('focus');
+ setFlag('enabled', false);
+ expect(view.state.tab).toBe('important');
+ view.setTab('focus');
+ expect(view.state.tab).toBe('important');
+ cleanup();
+ }
+});
diff --git a/apps/web/src/features/email-view/email-view-context.tsx b/apps/web/src/features/email-view/email-view-context.tsx
index 370e16e8cd..910b7fe5e0 100644
--- a/apps/web/src/features/email-view/email-view-context.tsx
+++ b/apps/web/src/features/email-view/email-view-context.tsx
@@ -8,7 +8,6 @@ import {
import { setSidebarSectionCollapsed } from '@app/components/view-shell';
import { normalizeFacetSelection } from '@app/features/soup';
import { registerListNavigationSource } from '@app/features/soup/collection/list-navigation-source';
-import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { makePersistedState } from '@app/lib/persistence';
import {
createSearchParams,
@@ -22,7 +21,6 @@ import {
useSplitPanelOrThrow,
withSplitPanelOwner,
} from '@components/app/split-layout/layoutUtils';
-import { enableReminders } from '@core/constant/featureFlags';
import { createAssertedContextProvider } from '@core/context/createContext';
import { useUserId } from '@core/context/user';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
@@ -45,7 +43,7 @@ import {
type SetStoreFunction,
type Store,
} from 'solid-js/store';
-import { DEFAULT_EMAIL_TAB } from './constants';
+import { DEFAULT_EMAIL_FOCUS_SORT, DEFAULT_EMAIL_TAB } from './constants';
import {
emailDetailSearch,
emailTabSearch,
@@ -59,7 +57,9 @@ import {
type EmailDataSourceItem,
useEmailDataSource,
} from './queries/use-email-query';
+import { useEmailTabAvailability } from './tab-availability';
import type {
+ EmailFocusSort,
EmailTab,
EmailThreadTarget,
EmailViewState,
@@ -87,6 +87,7 @@ export type EmailViewContext = {
setInboxIds: (ids: string[] | undefined) => void;
setAliasFilter: (alias: NonNullable<EmailViewState['aliasFilter']>) => void;
setFacets: (facets: EmailViewState['facets']) => void;
+ setFocusSort: (sort: EmailFocusSort) => void;
/**
* Shows the given tags across the whole mailbox: a non-empty selection
* lands on the All tab. Clearing keeps the current tab.
@@ -139,11 +140,11 @@ export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<
const tagSets = useTagSets();
const tagSetsReady = useTagSetsReady();
const initial = props.initialState ?? {};
- const reminders = useFeatureFlag(enableReminders);
+ const tabAvailability = useEmailTabAvailability();
+ // A flag-gated tab stays put while its flags load, then falls back if off.
+ const isTabOff = (tab: EmailTab) => tabAvailability(tab) === 'off';
const availableTab = (tab: EmailTab) =>
- tab === 'reminders' && !reminders().enabled && !reminders().loading
- ? DEFAULT_EMAIL_TAB
- : tab;
+ isTabOff(tab) ? DEFAULT_EMAIL_TAB : tab;
const [persistedState, setState] = makePersistedState(
createStore<EmailViewState>({
@@ -154,6 +155,7 @@ export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<
: normalizeInboxSelection(initial.inboxIds),
...(initial.aliasFilter ? { aliasFilter: initial.aliasFilter } : {}),
facets: normalizeFacetSelection(initial.facets),
+ focusSort: initial.focusSort ?? DEFAULT_EMAIL_FOCUS_SORT,
collapsedSidebarSectionIds: [
...(initial.collapsedSidebarSectionIds ?? []),
],
@@ -186,11 +188,7 @@ export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<
);
createEffect(() => {
- if (
- state.tab === 'reminders' &&
- !reminders().enabled &&
- !reminders().loading
- ) {
+ if (isTabOff(state.tab)) {
setState({ tab: DEFAULT_EMAIL_TAB, search: '', facets: {} });
}
});
@@ -399,6 +397,8 @@ export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<
setState('facets', reconcile(normalizeFacetSelection(facets)));
};
+ const setFocusSort = (sort: EmailFocusSort) => setState('focusSort', sort);
+
// A tag reaches across every mailbox slice, so choosing one from a narrower
// tab moves to All; as with `setTab`, that move drops the tab's other filters.
const showTags = (tagIds: string[]) => {
@@ -454,6 +454,7 @@ export const [EmailViewProvider, useEmailView] = createAssertedContextProvider<
setInboxIds,
setAliasFilter,
setFacets,
+ setFocusSort,
showTags,
filterByTag,
tagViewTitle,
diff --git a/apps/web/src/features/email-view/email-view.tsx b/apps/web/src/features/email-view/email-view.tsx
index 27e05a3537..b77f18710b 100644
--- a/apps/web/src/features/email-view/email-view.tsx
+++ b/apps/web/src/features/email-view/email-view.tsx
@@ -4,7 +4,6 @@ import {
ViewShell,
} from '@app/components/view-shell';
import { ViewTour } from '@app/features/tours/ViewTour';
-import { useFeatureFlag } from '@app/lib/analytics/posthog';
import { SplitRouter } from '@app/lib/split-router';
import { usePreference } from '@app/preferences/use-preference';
import { type PillTabItem, PillTabs } from '@components/app/mobile/PillTabs';
@@ -12,7 +11,6 @@ import { SplitHeaderLeft } from '@components/app/split-layout/components/SplitHe
import { useSplitPanelOrThrow } from '@components/app/split-layout/layoutUtils';
import { SplitPanel } from '@components/app/split-panel';
import { StaticMarkdownContext } from '@core/component/LexicalMarkdown/component/core/StaticMarkdown';
-import { enableReminders } from '@core/constant/featureFlags';
import { isTouchDevice } from '@core/mobile/isTouchDevice';
import { ListEntityMetadataQueryProvider } from '@entity';
import SpinnerIcon from '@icon/system/regular/spinner.svg';
@@ -29,13 +27,14 @@ import { EmailHeader, EmailViewBreadcrumbItem } from './components/EmailHeader';
import { EmailList } from './components/EmailList';
import { EmailReader } from './components/EmailReader';
import { EmailSidebar } from './components/EmailSidebar';
-import { EMAIL_TABS } from './constants';
+import { EMAIL_FOCUS_TAB, EMAIL_TABS } from './constants';
import { EmailViewProvider, useEmailView } from './email-view-context';
import type { EmailListPane } from './reader-pane';
import { emailTour } from './tour';
import type { EmailTab, EmailViewStateOptions } from './types';
import { useEmailViewHotkeys } from './use-email-view-hotkeys';
import { useReadingPaneHotkey } from './use-reading-pane-hotkey';
+import { useVisibleEmailTab } from './use-visible-email-tab';
export type EmailViewProps = {
/** Explicit navigation state. When present, it wins over entry restoration. */
@@ -170,13 +169,17 @@ function EmailDesktopLayout(props: {
);
}
-const MOBILE_EMAIL_TABS: PillTabItem<EmailTab>[] = EMAIL_TABS.map((tab) => ({
+// Focus leads, as it does in the desktop Inbox tabs.
+const MOBILE_EMAIL_TABS: PillTabItem<EmailTab>[] = [
+ EMAIL_FOCUS_TAB,
+ ...EMAIL_TABS.filter((tab) => tab.id !== EMAIL_FOCUS_TAB.id),
+].map((tab) => ({
value: tab.id,
- label: tab.label,
+ label: tab.badge ? `${tab.label} · ${tab.badge}` : tab.label,
}));
function EmailMobileLayout(props: ParentProps) {
- const reminders = useFeatureFlag(enableReminders);
+ const isVisible = useVisibleEmailTab();
const { state, setTab } = useEmailView();
return (
@@ -188,12 +191,7 @@ function EmailMobileLayout(props: ParentProps) {
class="-ml-(--mobile-chrome-gutter) w-[100cqw] max-w-none flex-none"
contentClass="px-(--mobile-chrome-gutter)"
leading={<EmailFilterDrawer />}
- items={MOBILE_EMAIL_TABS.filter(
- (tab) =>
- tab.value !== 'reminders' ||
- reminders().enabled ||
- (reminders().loading && state.tab === 'reminders')
- )}
+ items={MOBILE_EMAIL_TABS.filter((tab) => isVisible(tab.value))}
value={state.tab}
onChange={setTab}
/>
diff --git a/apps/web/src/features/email-view/filters/email-facets.ts b/apps/web/src/features/email-view/filters/email-facets.ts
index 27b8ea9f11..40594ad019 100644
--- a/apps/web/src/features/email-view/filters/email-facets.ts
+++ b/apps/web/src/features/email-view/filters/email-facets.ts
@@ -13,7 +13,7 @@ import {
tagFacetOption,
} from '@app/features/soup';
import type { EntityIconSelector } from '@core/component/EntityIcon';
-import type { EmailEntity, EntityData } from '@entity';
+import type { EmailEntity, EmailFocus, EntityData } from '@entity';
import type { EmailFilterGroupId, EmailFilterOptionId } from '../types';
type EmailFilterOption = {
@@ -101,11 +101,34 @@ const EMAIL_CALENDAR_OPTIONS: EmailFacetOption[] = [
},
];
+// Focus rows carry their classification; other rows never match these.
+function focusOption(
+ id: EmailFilterOptionId,
+ label: string,
+ predicate: (focus: EmailFocus) => boolean
+): EmailFacetOption {
+ return {
+ id,
+ label,
+ predicate: (email) => email.focus !== undefined && predicate(email.focus),
+ };
+}
+
+const EMAIL_FOCUS_OPTIONS: EmailFacetOption[] = [
+ focusOption(
+ 'focus-reply-needed',
+ 'Reply needed',
+ (focus) => focus.needsReply
+ ),
+ focusOption('focus-follow-up', 'Follow up', (focus) => focus.needsFollowUp),
+];
+
export const EMAIL_FACETS: Facet<EmailEntity, EmailFacetContext>[] = [
{ id: 'read', mode: 'or', options: EMAIL_READ_OPTIONS },
{ id: 'done', mode: 'or', options: EMAIL_DONE_OPTIONS },
{ id: 'attachments', mode: 'or', options: EMAIL_ATTACHMENT_OPTIONS },
{ id: 'calendar', mode: 'or', options: EMAIL_CALENDAR_OPTIONS },
+ { id: 'focus', mode: 'or', options: EMAIL_FOCUS_OPTIONS },
{
id: TAG_FACET_ID,
mode: 'or',
@@ -126,6 +149,18 @@ type EmailFilterGroup = {
const toGroupOptions = (options: EmailFacetOption[]) =>
options.map(({ id, label, iconType }) => ({ id, label, iconType }));
+/** The Focus tab's flag menu; shown only there, first. */
+export const EMAIL_FOCUS_FILTER_GROUP: EmailFilterGroup = {
+ id: 'focus',
+ label: 'Focus',
+ selectionMode: 'single',
+ defaultOptionId: 'all',
+ options: [
+ ...toGroupOptions(EMAIL_FOCUS_OPTIONS),
+ { id: 'all', label: 'All' },
+ ],
+};
+
/** Filter menu layout: the legacy mail filters, split into single-select status groups. */
export const EMAIL_FILTER_GROUPS: EmailFilterGroup[] = [
{
diff --git a/apps/web/src/features/email-view/filters/use-email-filters.tsx b/apps/web/src/features/email-view/filters/use-email-filters.tsx
index 9c2e2847be..d7711f4ec6 100644
--- a/apps/web/src/features/email-view/filters/use-email-filters.tsx
+++ b/apps/web/src/features/email-view/filters/use-email-filters.tsx
@@ -6,37 +6,56 @@ import { useTagFilterGroup } from '@property/tags/use-tag-filter-group';
import { type Accessor, createMemo } from 'solid-js';
import { useEmailView } from '../email-view-context';
import type { EmailFilterGroupId } from '../types';
-import { EMAIL_FILTER_GROUPS } from './email-facets';
+import { EMAIL_FILTER_GROUPS, EMAIL_FOCUS_FILTER_GROUP } from './email-facets';
type EmailFilterGroup = ListFilterGroup<EmailFilterGroupId, string>;
-const STATIC_FILTER_GROUPS: EmailFilterGroup[] = EMAIL_FILTER_GROUPS.map(
- (group) => ({
- ...group,
- options: group.options.map((option) => ({
- ...option,
- icon: option.iconType
- ? () => <EntityIcon targetType={option.iconType} size="xs" />
- : undefined,
- })),
- })
-);
+const withIcons = (
+ group: (typeof EMAIL_FILTER_GROUPS)[number]
+): EmailFilterGroup => ({
+ ...group,
+ options: group.options.map((option) => ({
+ ...option,
+ icon: option.iconType
+ ? () => <EntityIcon targetType={option.iconType} size="xs" />
+ : undefined,
+ })),
+});
+
+const STATIC_FILTER_GROUPS: EmailFilterGroup[] =
+ EMAIL_FILTER_GROUPS.map(withIcons);
+
+// Focus lists only threads still in the inbox, so Done has nothing to filter.
+// Status filters on the client, where opening a thread would mark it read and
+// drop it from an Unread list mid-read, so Focus leaves it out too.
+const FOCUS_FILTER_GROUPS: EmailFilterGroup[] = [
+ withIcons(EMAIL_FOCUS_FILTER_GROUP),
+ ...STATIC_FILTER_GROUPS.filter(
+ (group) => group.id !== 'done' && group.id !== 'read'
+ ),
+];
/** Shared selection semantics for the desktop menu and mobile drawer. */
export function useEmailFilters() {
const { state, setFacets } = useEmailView();
- return createEmailFilters(() => state.facets, setFacets);
+ return createEmailFilters(
+ () => state.facets,
+ setFacets,
+ () => state.tab === 'focus'
+ );
}
/** Shared Email filters without coupling an embedded list to the Email host. */
export function createEmailFilters(
facets: Accessor<FacetSelection>,
- setFacets: (facets: FacetSelection) => void
+ setFacets: (facets: FacetSelection) => void,
+ /** Whether the list is Focus, which has its own filter groups. */
+ isFocus: Accessor<boolean> = () => false
) {
const tagGroup = useTagFilterGroup();
// Tags come last: the static groups are short, the tag list grows with use.
const groups = createMemo((): EmailFilterGroup[] => [
- ...STATIC_FILTER_GROUPS,
+ ...(isFocus() ? FOCUS_FILTER_GROUPS : STATIC_FILTER_GROUPS),
...(tagGroup().options.length > 0 ? [tagGroup()] : []),
]);
const groupFor = (groupId: string) =>
diff --git a/apps/web/src/features/email-view/persistence.test.ts b/apps/web/src/features/email-view/persistence.test.ts
index 28d334d322..b701ff2ec2 100644
--- a/apps/web/src/features/email-view/persistence.test.ts
+++ b/apps/web/src/features/email-view/persistence.test.ts
@@ -21,6 +21,7 @@ const current = (): EmailViewState => ({
search: '',
inboxIds: undefined,
facets: {},
+ focusSort: 'importance',
collapsedSidebarSectionIds: [],
});
@@ -76,4 +77,31 @@ describe('createEmailViewPersistence', () => {
expect(state.tab).toBe('archived');
});
+
+ it('keeps the Focus tab and its sort per user', () => {
+ const handle: EntryPersistenceHandle = {
+ currentEntryState: () => ({}),
+ registerEntryStateCaptor: () => () => {},
+ };
+ const { storages } = createEmailViewPersistence({
+ handle,
+ userId: () => 'focus-sort-user',
+ restoreEntryState: false,
+ restorePreferences: false,
+ });
+ const list = Array.isArray(storages) ? storages : [storages];
+ for (const storage of list) {
+ storage.initialize?.(current(), current);
+ storage.write({ ...current(), tab: 'focus', focusSort: 'recent' });
+ }
+
+ let state = current();
+ for (const storage of list) {
+ const next = storage.restore(state);
+ if (next !== undefined) state = next;
+ }
+
+ expect(state.tab).toBe('focus');
+ expect(state.focusSort).toBe('recent');
+ });
});
diff --git a/apps/web/src/features/email-view/persistence.ts b/apps/web/src/features/email-view/persistence.ts
index b04f2663dd..a8308edffb 100644
--- a/apps/web/src/features/email-view/persistence.ts
+++ b/apps/web/src/features/email-view/persistence.ts
@@ -12,7 +12,12 @@ import {
import { createUserScopedStorage } from '@core/util/userScopedStorage';
import type { Accessor } from 'solid-js';
import { z } from 'zod';
-import { DEFAULT_EMAIL_TAB, EMAIL_TAB_IDS } from './constants';
+import {
+ DEFAULT_EMAIL_FOCUS_SORT,
+ DEFAULT_EMAIL_TAB,
+ EMAIL_FOCUS_SORT_IDS,
+ EMAIL_TAB_IDS,
+} from './constants';
import { normalizeInboxSelection } from './inbox-selection';
import type { EmailViewState } from './types';
@@ -30,6 +35,10 @@ const aliasFilterSchema = z
.optional()
.catch(undefined);
+const emailFocusSortSchema = z
+ .enum(EMAIL_FOCUS_SORT_IDS)
+ .catch(DEFAULT_EMAIL_FOCUS_SORT);
+
const emailEntryStateSchemaWithDefaults = z.object({
version: z.literal(1).default(1),
tab: emailTabSchema.default(DEFAULT_EMAIL_TAB),
@@ -116,6 +125,7 @@ const emailLocalStateSchemaWithDefaults = z.object({
inboxIds: inboxIdsEntrySchema,
aliasFilter: aliasFilterSchema,
facets: emailFacetsSchema.default({}),
+ focusSort: emailFocusSortSchema.default(DEFAULT_EMAIL_FOCUS_SORT),
});
type EmailLocalState = z.infer<typeof emailLocalStateSchemaWithDefaults>;
@@ -133,6 +143,7 @@ function selectLocalState(state: EmailViewState): EmailLocalState {
inboxIds: normalizeInboxSelection(state.inboxIds),
aliasFilter: state.aliasFilter,
facets: normalizeFacetSelection(state.facets),
+ focusSort: state.focusSort,
};
}
@@ -164,6 +175,7 @@ function createEmailLocalStateStorage(options: {
: restored.inboxIds,
aliasFilter: restored.aliasFilter,
facets: normalizeFacetSelection(restored.facets),
+ focusSort: restored.focusSort,
};
} catch {
return undefined;
diff --git a/apps/web/src/features/email-view/queries/email-query.test.ts b/apps/web/src/features/email-view/queries/email-query.test.ts
index f55058b146..884d957da2 100644
--- a/apps/web/src/features/email-view/queries/email-query.test.ts
+++ b/apps/web/src/features/email-view/queries/email-query.test.ts
@@ -165,6 +165,7 @@ describe('buildEmailQuery', () => {
['shared', 'all'],
['archived', 'all'],
['all', 'all'],
+ ['focus', 'all'],
]);
for (const tab of EMAIL_TAB_IDS) {
diff --git a/apps/web/src/features/email-view/queries/email-query.ts b/apps/web/src/features/email-view/queries/email-query.ts
index 6103cebfb6..dce1bce2cc 100644
--- a/apps/web/src/features/email-view/queries/email-query.ts
+++ b/apps/web/src/features/email-view/queries/email-query.ts
@@ -43,6 +43,8 @@ export const emailViewForTab = (tab: EmailTab): string =>
'all',
'reminders',
'archived',
+ // Focus has a dedicated GraphQL list; the dormant Soup source stays valid.
+ 'focus',
() => 'all'
)
.exhaustive(() => 'all');
@@ -99,6 +101,7 @@ function tabClause(context: EmailQueryContext): TargetExpr {
'favorites',
'all',
'reminders',
+ 'focus',
anyThread
)
.exhaustive(anyThread)
diff --git a/apps/web/src/features/email-view/queries/email-search.ts b/apps/web/src/features/email-view/queries/email-search.ts
index c81fafef2f..118bd90875 100644
--- a/apps/web/src/features/email-view/queries/email-search.ts
+++ b/apps/web/src/features/email-view/queries/email-search.ts
@@ -29,8 +29,12 @@ const nonEmailFilters: EntityFilters = {
// user's own threads — the same reach the legacy mail search had. It cannot
// filter archive state either, so `emailMatchesTab` trims Archived hits.
function tabFilters(tab: EmailTab): EmailFilters {
+ // Focus filters its own list on the client; this search stays dormant there.
return match(tab)
- .with('important', () => ({ importance: true, shared: 'exclude' as const }))
+ .with('important', 'focus', () => ({
+ importance: true,
+ shared: 'exclude' as const,
+ }))
.with('noise', () => ({ importance: false, shared: 'exclude' as const }))
.with('calendar', () => ({
calendar_only: true,
diff --git a/apps/web/src/features/email-view/queries/use-email-query.test.ts b/apps/web/src/features/email-view/queries/use-email-query.test.ts
index eb16ae5b34..f52c6720ed 100644
--- a/apps/web/src/features/email-view/queries/use-email-query.test.ts
+++ b/apps/web/src/features/email-view/queries/use-email-query.test.ts
@@ -72,6 +72,21 @@ vi.mock('./use-scheduled-email-source', () => ({
refresh: async () => {},
}),
}));
+const focusRows = vi.hoisted(() => ({
+ current: [] as import('./use-email-query').EmailDataSourceItem[],
+}));
+vi.mock('./use-focus-email-source', () => ({
+ useFocusEmailSource: () => ({
+ items: () => focusRows.current,
+ isLoading: () => false,
+ isFetching: () => false,
+ error: () => undefined,
+ hasMore: () => false,
+ isLoadingMore: () => false,
+ loadMore: async () => {},
+ refresh: async () => {},
+ }),
+}));
vi.mock('@service-storage/websocket', () => ({
storageWS: { reconnectIfDisconnected: vi.fn() },
createWebSocketJob: vi.fn(),
@@ -112,6 +127,7 @@ function mount(search = '') {
search,
inboxIds: ['inbox-a'],
facets: {},
+ focusSort: 'importance',
collapsedSidebarSectionIds: [],
});
const [entities, setDiscoveryEntities] = createSignal([email('noise')]);
@@ -406,6 +422,7 @@ describe('Email list query transitions', () => {
refetch: vi.fn(async () => {}),
});
scheduledRows.current = [];
+ focusRows.current = [];
});
afterEach(() => dispose?.());
@@ -473,6 +490,35 @@ describe('Email list query transitions', () => {
expect(ids(source)).toEqual(['noise']);
});
+ it('lists the Focus source on the Focus tab and pauses Soup discovery', () => {
+ focusRows.current = [
+ {
+ kind: 'entity',
+ id: 'focus-row',
+ entity: {
+ ...email('focus'),
+ focus: {
+ category: 'CUSTOMER',
+ importance: 87,
+ needsReply: true,
+ needsFollowUp: false,
+ },
+ },
+ } as EmailDataSourceItem,
+ ];
+ const { source, setState } = mount();
+ expect(ids(source)).toEqual(['noise']);
+
+ setState('tab', 'focus');
+ expect(ids(source)).toEqual(['focus']);
+ expect(source.hasMore()).toBe(false);
+ const options = vi.mocked(useSoupAstItemsQuery).mock.calls[0][1];
+ expect(options?.().enabled).toBe(false);
+
+ setState('tab', 'noise');
+ expect(ids(source)).toEqual(['noise']);
+ });
+
it('does not read disabled native data on the Reminders tab', () => {
const { source, setState } = mount();
expect(() => setState('tab', 'reminders')).not.toThrow();
diff --git a/apps/web/src/features/email-view/queries/use-email-query.ts b/apps/web/src/features/email-view/queries/use-email-query.ts
index 7646d6860e..fcb846b71c 100644
--- a/apps/web/src/features/email-view/queries/use-email-query.ts
+++ b/apps/web/src/features/email-view/queries/use-email-query.ts
@@ -39,6 +39,7 @@ import { buildEmailQuery, type EmailQueryContext } from './email-query';
import { buildEmailDateRows } from './email-results';
import { buildEmailSearchRequest } from './email-search';
import { emailAdmissionBatches, mergeEmailAdmission } from './read-admission';
+import { useFocusEmailSource } from './use-focus-email-source';
import { useReminderEmailSource } from './use-reminder-email-source';
import { useScheduledEmailSource } from './use-scheduled-email-source';
@@ -50,7 +51,7 @@ export type EmailDataSource = ListDataSource<EmailDataSourceItem> & {
export type EmailDataSourceInput = Pick<
EmailViewState,
- 'tab' | 'search' | 'inboxIds' | 'facets' | 'aliasFilter'
+ 'tab' | 'search' | 'inboxIds' | 'facets' | 'focusSort' | 'aliasFilter'
>;
export type UseEmailDataSourceOptions = {
@@ -90,6 +91,7 @@ function emailMatchesTab(
'reminders',
'calendar',
'all',
+ 'focus',
() => true
)
.exhaustive(() => true)
@@ -114,7 +116,9 @@ export function useEmailDataSource(
const userId = useUserId();
const scheduled = useScheduledEmailSource(state);
const reminders = useReminderEmailSource(state, options);
+ const focus = useFocusEmailSource(state, options);
const showsReminders = () => state.tab === 'reminders';
+ const showsFocus = () => state.tab === 'focus';
const showsScheduled = () => state.tab === 'scheduled';
const showsFavorites = () => state.tab === 'favorites';
// Uses GraphQL favorites with enable-graphql-soup, REST otherwise. Guard
@@ -155,7 +159,10 @@ export function useEmailDataSource(
const filtersReady = () =>
tagsReady() && (!state.search.trim() || searchFavoritesReady());
const sourceEnabled = () =>
- tagsReady() && state.tab !== 'scheduled' && state.tab !== 'reminders';
+ tagsReady() &&
+ state.tab !== 'scheduled' &&
+ state.tab !== 'reminders' &&
+ state.tab !== 'focus';
const searchContext = (): EmailQueryContext => ({
...queryContext(),
...(showsFavorites() ? { favoriteThreadIds: favoriteThreadIds() } : {}),
@@ -236,7 +243,7 @@ export function useEmailDataSource(
);
const rawEntities = createMemo<EntityData[]>(() => {
- // Scheduled/Reminders disable native discovery. Reading its pending data
+ // Scheduled/Reminders/Focus disable native discovery. Reading its pending data
// would suspend the whole split even though that query is not fetching.
// Disabled searches can also retain previous-facet placeholder data.
if (!sourceEnabled() || !filtersReady()) return [];
@@ -575,16 +582,21 @@ export function useEmailDataSource(
? reminders.items()
: showsScheduled()
? scheduled.items()
- : items(),
+ : showsFocus()
+ ? focus.items()
+ : items(),
isLoading: () =>
showsReminders()
? reminders.isLoading()
: showsScheduled()
? scheduled.isLoading()
- : isLoading(),
+ : showsFocus()
+ ? focus.isLoading()
+ : isLoading(),
isFetching: () => {
if (showsReminders()) return reminders.isFetching();
if (showsScheduled()) return scheduled.isFetching();
+ if (showsFocus()) return focus.isFetching();
if (search.isSettling()) return true;
return (
refreshing() ||
@@ -595,6 +607,7 @@ export function useEmailDataSource(
error: () => {
if (showsReminders()) return reminders.error();
if (showsScheduled()) return scheduled.error();
+ if (showsFocus()) return focus.error();
return (
(search.isSearching() && showsFavorites()
? favorites.error
@@ -609,17 +622,19 @@ export function useEmailDataSource(
);
},
hasMore: () =>
- showsReminders() ? reminders.hasMore() : !showsScheduled() && hasMore(),
+ showsReminders()
+ ? reminders.hasMore()
+ : !showsScheduled() && !showsFocus() && hasMore(),
isLoadingMore: () =>
showsReminders()
? reminders.isLoadingMore()
- : !showsScheduled() && isLoadingMore(),
+ : !showsScheduled() && !showsFocus() && isLoadingMore(),
loadMore: async () => {
if (showsReminders()) {
await reminders.loadMore();
return;
}
- if (showsScheduled()) return;
+ if (showsScheduled() || showsFocus()) return;
if (usesServiceSearch()) {
aliasAdvance.resetError();
await search.fetchNextPage();
@@ -636,6 +651,10 @@ export function useEmailDataSource(
await scheduled.refresh();
return;
}
+ if (showsFocus()) {
+ await focus.refresh();
+ return;
+ }
const requestScope = scope();
setRefreshing(true);
aliasAdvance.resetError();
diff --git a/apps/web/src/features/email-view/queries/use-focus-email-source.test.ts b/apps/web/src/features/email-view/queries/use-focus-email-source.test.ts
new file mode 100644
index 0000000000..af7a5a93d3
--- /dev/null
+++ b/apps/web/src/features/email-view/queries/use-focus-email-source.test.ts
@@ -0,0 +1,195 @@
+import { createTagFacetContext } from '@app/features/soup';
+import type { EmailEntity, EmailFocus } from '@entity';
+import { describe, expect, it, vi } from 'vitest';
+import type { EmailDataSourceInput } from './use-email-query';
+import { selectFocusEmails } from './use-focus-email-source';
+
+// Exercise the pure selection without UI barrels or live connections.
+vi.mock('@queries/email/focus', () => ({ useEmailFocusQuery: vi.fn() }));
+vi.mock('@queries/soup/graphql/done-projection', () => ({
+ createGraphqlSoupDoneProjection: vi.fn(),
+}));
+vi.mock('@queries/soup/graphql/optimistic-done', () => ({
+ usePendingGraphqlSoupDone: vi.fn(),
+}));
+vi.mock('../tab-availability', () => ({ useEmailTabAvailability: vi.fn() }));
+vi.mock('@app/features/soup', async () => ({
+ ...(await import('@app/features/soup/filters')),
+ ...(await import('@app/features/soup/collection/rows')),
+}));
+vi.mock('@app/features/soup/entity-notifications', () => ({
+ withEntityNotifications: vi.fn(),
+}));
+vi.mock('@components/app/GlobalAppState', () => ({
+ useGlobalNotificationSource: vi.fn(),
+}));
+vi.mock('@entity', async () => ({
+ ...(await import('@entity/types/entity')),
+}));
+vi.mock('@service-storage/websocket', () => ({
+ storageWS: { reconnectIfDisconnected: vi.fn() },
+ createWebSocketJob: vi.fn(),
+}));
+vi.mock('@service-connection/websocket', () => ({
+ ws: { addEventListener: vi.fn(), send: vi.fn() },
+ state: () => 'closed',
+ createConnectionBlockWebsocketEffect: vi.fn(),
+ createConnectionWebsocketEffect: vi.fn(),
+}));
+
+function email(
+ id: string,
+ focus: Partial<EmailFocus>,
+ overrides: Partial<EmailEntity> = {}
+): EmailEntity {
+ return {
+ type: 'email',
+ id,
+ name: `Subject ${id}`,
+ ownerId: 'alice',
+ linkId: 'inbox-a',
+ isRead: false,
+ isDraft: false,
+ isImportant: false,
+ done: false,
+ focus: {
+ importance: 50,
+ needsReply: false,
+ needsFollowUp: false,
+ ...focus,
+ },
+ ...overrides,
+ };
+}
+
+// Server order: by priority, so the fresh invoice leads the older report.
+const EMAILS = [
+ email(
+ 'invoice',
+ { importance: 70, needsReply: true },
+ {
+ sortTs: '2026-10-08T10:00:00Z',
+ senderName: 'Casey',
+ }
+ ),
+ email(
+ 'report',
+ { importance: 93 },
+ {
+ sortTs: '2026-10-05T10:00:00Z',
+ linkId: 'inbox-b',
+ }
+ ),
+ email(
+ 'plan',
+ { importance: 61, needsFollowUp: true },
+ {
+ sortTs: '2026-10-06T10:00:00Z',
+ snippet: 'CRM rollout plan',
+ }
+ ),
+];
+
+const context = createTagFacetContext([]);
+
+function select(
+ input: Partial<EmailDataSourceInput>,
+ emails: readonly EmailEntity[] = EMAILS
+): string[] {
+ return selectFocusEmails(
+ emails,
+ {
+ tab: 'focus',
+ search: '',
+ inboxIds: undefined,
+ facets: {},
+ focusSort: 'priority',
+ ...input,
+ },
+ context
+ ).map((selected) => selected.id);
+}
+
+describe('selectFocusEmails', () => {
+ it('keeps the server order by priority', () => {
+ expect(select({})).toEqual(['invoice', 'report', 'plan']);
+ });
+
+ it('orders by importance on request', () => {
+ expect(select({ focusSort: 'importance' })).toEqual([
+ 'report',
+ 'invoice',
+ 'plan',
+ ]);
+ });
+
+ it('breaks importance ties by recency', () => {
+ const [invoice, report, plan] = EMAILS;
+ const tied = [
+ invoice,
+ report,
+ { ...plan, focus: { ...plan.focus!, importance: 93 } },
+ ];
+ expect(select({ focusSort: 'importance' }, tied)).toEqual([
+ 'plan',
+ 'report',
+ 'invoice',
+ ]);
+ });
+
+ it('orders by recency on request', () => {
+ expect(select({ focusSort: 'recent' })).toEqual([
+ 'invoice',
+ 'plan',
+ 'report',
+ ]);
+ });
+
+ it('filters by Focus flags', () => {
+ expect(select({ facets: { focus: ['focus-reply-needed'] } })).toEqual([
+ 'invoice',
+ ]);
+ expect(select({ facets: { focus: ['focus-follow-up'] } })).toEqual([
+ 'plan',
+ ]);
+ });
+
+ it('scopes to the selected inboxes', () => {
+ expect(select({ inboxIds: ['inbox-b'] })).toEqual(['report']);
+ expect(select({ inboxIds: [] })).toEqual([]);
+ });
+
+ it('searches subject, snippet and sender', () => {
+ expect(select({ search: 'casey' })).toEqual(['invoice']);
+ expect(select({ search: 'rollout' })).toEqual(['plan']);
+ expect(select({ search: 'subject report' })).toEqual(['report']);
+ });
+
+ it('does not reorder the input list', () => {
+ select({ focusSort: 'importance' });
+ select({ focusSort: 'recent' });
+ expect(EMAILS.map((selected) => selected.id)).toEqual([
+ 'invoice',
+ 'report',
+ 'plan',
+ ]);
+ });
+
+ it('ignores Status and Done filters, which Focus does not offer', () => {
+ const [invoice, ...rest] = EMAILS;
+ expect(
+ select({ facets: { read: ['read'], done: ['done'] } }, [
+ { ...invoice, isRead: true },
+ ...rest,
+ ])
+ ).toEqual(['invoice', 'report', 'plan']);
+ });
+
+ it('drops threads marked done', () => {
+ const [invoice, ...rest] = EMAILS;
+ expect(select({}, [{ ...invoice, done: true }, ...rest])).toEqual([
+ 'report',
+ 'plan',
+ ]);
+ });
+});
diff --git a/apps/web/src/features/email-view/queries/use-focus-email-source.ts b/apps/web/src/features/email-view/queries/use-focus-email-source.ts
new file mode 100644
index 0000000000..7cff8516ed
--- /dev/null
+++ b/apps/web/src/features/email-view/queries/use-focus-email-source.ts
@@ -0,0 +1,144 @@
+import {
+ buildFlatSoupRows,
+ createSoupRowStore,
+ createTagFacetContext,
+ tagFacetReady,
+ testFacets,
+} from '@app/features/soup';
+import { withEntityNotifications } from '@app/features/soup/entity-notifications';
+import { useGlobalNotificationSource } from '@components/app/GlobalAppState';
+import type { DateValue } from '@core/util/date';
+import { type EmailEntity, isEmailEntity } from '@entity';
+import { useEmailFocusQuery } from '@queries/email/focus';
+import { createGraphqlSoupDoneProjection } from '@queries/soup/graphql/done-projection';
+import { usePendingGraphqlSoupDone } from '@queries/soup/graphql/optimistic-done';
+import { createMemo } from 'solid-js';
+import { match } from 'ts-pattern';
+import { EMAIL_FACETS, type EmailFacetContext } from '../filters/email-facets';
+import { useEmailTabAvailability } from '../tab-availability';
+import type {
+ EmailDataSource,
+ EmailDataSourceInput,
+ EmailDataSourceItem,
+ UseEmailDataSourceOptions,
+} from './use-email-query';
+
+const timestamp = (value: DateValue | null | undefined) =>
+ value instanceof Date ? value.getTime() : Date.parse(value ?? '') || 0;
+
+// The same recency the other tabs order and group by.
+const recency = (email: EmailEntity) =>
+ timestamp(email.sortTs ?? email.updatedAt ?? email.createdAt);
+
+const byRecency = (left: EmailEntity, right: EmailEntity) =>
+ recency(right) - recency(left);
+
+const byImportance = (left: EmailEntity, right: EmailEntity) =>
+ (right.focus?.importance ?? 0) - (left.focus?.importance ?? 0) ||
+ byRecency(left, right);
+
+function matchesSearch(email: EmailEntity, text: string): boolean {
+ return [email.name, email.snippet, email.senderName, email.senderEmail].some(
+ (value) => value?.toLowerCase().includes(text) === true
+ );
+}
+
+/**
+ * Applies the view's inbox scope, filters and search to the Focus list. The
+ * server returns it by priority; "Importance" and "Most recent" reorder it here.
+ * Done threads leave at once, as on Signal: the server drops archived
+ * threads only on the next read. Focus has no Status or Done filters.
+ */
+export function selectFocusEmails(
+ emails: readonly EmailEntity[],
+ input: EmailDataSourceInput,
+ facetContext: EmailFacetContext
+): EmailEntity[] {
+ const inboxes =
+ input.inboxIds === undefined ? undefined : new Set(input.inboxIds);
+ const text = input.search.trim().toLowerCase();
+ const selected = emails.filter(
+ (email) =>
+ email.done !== true &&
+ (inboxes === undefined ||
+ (email.linkId !== undefined && inboxes.has(email.linkId))) &&
+ testFacets(
+ { ...input.facets, read: [], done: [] },
+ EMAIL_FACETS,
+ email,
+ facetContext
+ ) &&
+ (text === '' || matchesSearch(email, text))
+ );
+ return (
+ match(input.focusSort)
+ .with('priority', () => selected)
+ .with('importance', () => selected.sort(byImportance))
+ .with('recent', () => selected.sort(byRecency))
+ // An order this build doesn't know keeps the server's priority order.
+ .exhaustive(() => selected)
+ );
+}
+
+/**
+ * The Focus tab: signal threads the email focus worker found worth the
+ * owner's attention. The whole list arrives in one read, so filtering and
+ * ordering happen here rather than on the server.
+ */
+export function useFocusEmailSource(
+ state: EmailDataSourceInput,
+ options: UseEmailDataSourceOptions
+): EmailDataSource {
+ const notificationSource = useGlobalNotificationSource();
+ const tabAvailability = useEmailTabAvailability();
+ // Never read Focus while its flags are off or still loading.
+ const focus = useEmailFocusQuery(
+ () => state.tab === 'focus' && tabAvailability('focus') === 'on'
+ );
+ const pendingDone = usePendingGraphqlSoupDone();
+ const projectDone = createGraphqlSoupDoneProjection();
+ const facetContext = createMemo(
+ (): EmailFacetContext => createTagFacetContext(options.tagSets())
+ );
+ const ready = () => tagFacetReady(state.facets, options.tagSetsReady());
+
+ // Done and Undo show at once, with or without the normalized cache: Soup's
+ // pending done intents are projected onto the server's list.
+ const emails = createMemo((): EmailEntity[] => {
+ const data = focus.data
+ ? { entities: focus.data, groups: undefined }
+ : undefined;
+ const projected = projectDone(
+ 'email:focus',
+ data,
+ pendingDone(),
+ true,
+ new Set()
+ );
+ return projected?.entities.filter(isEmailEntity) ?? [];
+ });
+
+ const built = createMemo((): EmailDataSourceItem[] => {
+ if (!ready()) return [];
+ return buildFlatSoupRows(
+ selectFocusEmails(emails(), state, facetContext()).map((email) =>
+ withEntityNotifications(email, notificationSource)
+ )
+ );
+ });
+ const items = createSoupRowStore(built);
+
+ return {
+ items,
+ isLoading: () =>
+ tabAvailability('focus') === 'loading' || focus.isLoading || !ready(),
+ isFetching: () => focus.isFetching,
+ error: () => focus.error ?? undefined,
+ hasMore: () => false,
+ isLoadingMore: () => false,
+ loadMore: async () => {},
+ refresh: async () => {
+ await focus.refetch({ requestPolicy: 'network-only' });
+ },
+ };
+}
diff --git a/apps/web/src/features/email-view/queries/use-reminder-email-source.test.ts b/apps/web/src/features/email-view/queries/use-reminder-email-source.test.ts
index 0a7b5a47a5..5b647898db 100644
--- a/apps/web/src/features/email-view/queries/use-reminder-email-source.test.ts
+++ b/apps/web/src/features/email-view/queries/use-reminder-email-source.test.ts
@@ -55,6 +55,7 @@ function mount() {
search: 'persisted text',
inboxIds: ['selected-inbox'],
facets: {},
+ focusSort: 'importance',
collapsedSidebarSectionIds: [],
});
const [collection, setCollection] = createStore({
diff --git a/apps/web/src/features/email-view/queries/use-scheduled-email-source.test.ts b/apps/web/src/features/email-view/queries/use-scheduled-email-source.test.ts
index 9cb1342f74..a7231e9edb 100644
--- a/apps/web/src/features/email-view/queries/use-scheduled-email-source.test.ts
+++ b/apps/web/src/features/email-view/queries/use-scheduled-email-source.test.ts
@@ -76,6 +76,7 @@ function mount() {
search: '',
inboxIds: undefined,
facets: {},
+ focusSort: 'importance',
collapsedSidebarSectionIds: [],
});
return useScheduledEmailSource(state);
diff --git a/apps/web/src/features/email-view/tab-availability.ts b/apps/web/src/features/email-view/tab-availability.ts
new file mode 100644
index 0000000000..8b765c9981
--- /dev/null
+++ b/apps/web/src/features/email-view/tab-availability.ts
@@ -0,0 +1,34 @@
+import { useFeatureFlag } from '@app/lib/analytics/posthog';
+import {
+ enableEmailFocus,
+ enableGraphqlSoup,
+ enableReminders,
+} from '@core/constant/featureFlags';
+import { match } from 'ts-pattern';
+import type { EmailTab } from './types';
+
+/** Whether a flag-gated tab is on, still waiting for its flags, or off. */
+export type EmailTabAvailability = 'on' | 'loading' | 'off';
+
+type Flag = { enabled: boolean; loading: boolean };
+
+function availability(...flags: Flag[]): EmailTabAvailability {
+ if (flags.some((flag) => !flag.enabled && !flag.loading)) return 'off';
+ return flags.some((flag) => flag.loading) ? 'loading' : 'on';
+}
+
+/** The one rule for which Email tabs are flag-gated. Every other tab is on. */
+export function useEmailTabAvailability(): (
+ tab: EmailTab
+) => EmailTabAvailability {
+ const reminders = useFeatureFlag(enableReminders);
+ const focus = useFeatureFlag(enableEmailFocus);
+ // Focus is read through GraphQL Soup, and its Done/Undo use Soup's done
+ // intents, which only the GraphQL mark-done path publishes.
+ const graphqlSoup = useFeatureFlag(enableGraphqlSoup);
+ return (tab) =>
+ match(tab)
+ .with('reminders', () => availability(reminders()))
+ .with('focus', () => availability(focus(), graphqlSoup()))
+ .otherwise(() => 'on' as const);
+}
diff --git a/apps/web/src/features/email-view/types.ts b/apps/web/src/features/email-view/types.ts
index ab8e29def6..79ef88dece 100644
--- a/apps/web/src/features/email-view/types.ts
+++ b/apps/web/src/features/email-view/types.ts
@@ -1,13 +1,14 @@
import type { FacetSelection } from '@app/features/soup';
-import type { EmailTab } from './constants';
+import type { EmailFocusSort, EmailTab } from './constants';
-export type { EmailTab };
+export type { EmailFocusSort, EmailTab };
export type EmailFilterGroupId =
| 'read'
| 'done'
| 'attachments'
| 'calendar'
+ | 'focus'
| 'tags';
export type EmailFilterOptionId =
@@ -19,7 +20,9 @@ export type EmailFilterOptionId =
| 'attachment-pdf'
| 'attachment-image'
| 'attachment-document'
- | 'has-calendar-invite';
+ | 'has-calendar-invite'
+ | 'focus-reply-needed'
+ | 'focus-follow-up';
export type EmailViewState = {
tab: EmailTab;
@@ -33,6 +36,8 @@ export type EmailViewState = {
/** An alias is always scoped to the inbox that owns its provider grant. */
aliasFilter?: { inboxId: string; emailAddress: string };
facets: FacetSelection;
+ /** The Focus tab's order; kept per user. */
+ focusSort: EmailFocusSort;
/** Sidebar sections the user folded away; kept per user, not per visit. */
collapsedSidebarSectionIds: string[];
};
diff --git a/apps/web/src/features/email-view/use-visible-email-tab.ts b/apps/web/src/features/email-view/use-visible-email-tab.ts
new file mode 100644
index 0000000000..4840e3bfc5
--- /dev/null
+++ b/apps/web/src/features/email-view/use-visible-email-tab.ts
@@ -0,0 +1,16 @@
+import { useEmailView } from './email-view-context';
+import { useEmailTabAvailability } from './tab-availability';
+import type { EmailTab } from './types';
+
+/**
+ * Whether a tab shows in Email's navigation. Flag-gated tabs show once their
+ * flags are on, or while they load with that tab already open.
+ */
+export function useVisibleEmailTab(): (id: EmailTab) => boolean {
+ const { state } = useEmailView();
+ const availability = useEmailTabAvailability();
+ return (id) => {
+ const tab = availability(id);
+ return tab === 'on' || (tab === 'loading' && state.tab === id);
+ };
+}
diff --git a/apps/web/src/features/entity/composed/ListEntity.tsx b/apps/web/src/features/entity/composed/ListEntity.tsx
index 401b7541f5..92e5b3a1e4 100644
--- a/apps/web/src/features/entity/composed/ListEntity.tsx
+++ b/apps/web/src/features/entity/composed/ListEntity.tsx
@@ -107,6 +107,7 @@ export function ListEntity(props: ListEntityProps) {
const icon = children(() => props.icon);
const titleTrailing = children(() => props.titleTrailing);
const meta = children(() => props.meta);
+ const metaEnd = children(() => props.metaEnd);
const scheduleStatus = children(() => props.scheduleStatus);
const unread = () => unreadFilterFn(props.entity);
@@ -169,6 +170,7 @@ export function ListEntity(props: ListEntityProps) {
icon: icon(),
titleTrailing: titleTrailing(),
meta: meta(),
+ metaEnd: metaEnd(),
scheduleStatus: scheduleStatus(),
referenceProperties: referenceProperties(),
authorDisplayName: props.authorDisplayName,
diff --git a/apps/web/src/features/entity/composed/list-entity/shared.tsx b/apps/web/src/features/entity/composed/list-entity/shared.tsx
index 43a8fdcf65..1954f618ac 100644
--- a/apps/web/src/features/entity/composed/list-entity/shared.tsx
+++ b/apps/web/src/features/entity/composed/list-entity/shared.tsx
@@ -46,6 +46,8 @@ export interface BaseListEntityProps<E extends EntityData = EntityData>
titleTrailing?: JSX.Element;
/** Caller-owned metadata ahead of the entity's own, in wide rows only. */
meta?: JSX.Element;
+ /** Caller-owned metadata after the entity's own, in wide rows only. */
+ metaEnd?: JSX.Element;
hideContentHits?: boolean;
/** Resolved app display name for a linked GitHub PR author, when available. */
authorDisplayName?: string;
@@ -86,6 +88,7 @@ export interface LayoutProps {
/** Supporting text after the title in the standard content slot. */
titleTrailing?: JSX.Element;
meta?: JSX.Element;
+ metaEnd?: JSX.Element;
/** Stored reference values alongside the existing property pills. */
referenceProperties?: JSX.Element;
checked?: boolean;
diff --git a/apps/web/src/features/entity/composed/list-entity/wide-layout.tsx b/apps/web/src/features/entity/composed/list-entity/wide-layout.tsx
index 5a3f8fc383..a9a4255168 100644
--- a/apps/web/src/features/entity/composed/list-entity/wide-layout.tsx
+++ b/apps/web/src/features/entity/composed/list-entity/wide-layout.tsx
@@ -341,6 +341,7 @@ export function WideLayout(props: LayoutProps) {
>
{(entity) => <ChannelJoinButton entity={entity()} />}
</Show>
+ {props.metaEnd}
</Entity.Slot>
<Entity.Slot
placement="timestamp"
diff --git a/apps/web/src/features/entity/types/entity.ts b/apps/web/src/features/entity/types/entity.ts
index 968163d666..fefd3c691f 100644
--- a/apps/web/src/features/entity/types/entity.ts
+++ b/apps/web/src/features/entity/types/entity.ts
@@ -295,6 +295,14 @@ export type EmailAttachment = {
sizeBytes?: number | null;
};
+/** A thread's Focus classification; present only on Focus list rows. */
+export type EmailFocus = {
+ /** 0 to 100. */
+ importance: number;
+ needsReply: boolean;
+ needsFollowUp: boolean;
+};
+
// We spread ApiThreadPreviewCursor into the email entity, should we explcitly include all those fields here, or only add them as needed?
export type EmailEntity = EntityBase & {
type: 'email';
@@ -319,6 +327,7 @@ export type EmailEntity = EntityBase & {
properties?: SoupProperty[];
/** ISO 8601 time of the thread draft's confirmed scheduled send. */
scheduledSendTime?: string;
+ focus?: EmailFocus;
};
export type ProjectEntity = EntityBase & {
diff --git a/apps/web/src/features/next-soup/actions/make-mark-done-action.ts b/apps/web/src/features/next-soup/actions/make-mark-done-action.ts
index 2022b6eef7..ef16b14637 100644
--- a/apps/web/src/features/next-soup/actions/make-mark-done-action.ts
+++ b/apps/web/src/features/next-soup/actions/make-mark-done-action.ts
@@ -53,6 +53,8 @@ const VALID_MARK_DONE_LIST_VIEWS: `${ListView}-${string}`[] = [
// Calendar lists invite threads from the "all" email view, so done rows
// stay in place and flip to the done state exactly like mail "All".
'mail-calendar',
+ // Focus rows are signal threads; done archives them like Signal does.
+ 'mail-focus',
'mail-shared',
'mail-archived',
// Search lists done and open rows alike, like mail "All": a marked row flips
diff --git a/apps/web/src/lib/core/constant/featureFlags.ts b/apps/web/src/lib/core/constant/featureFlags.ts
index 484da879ca..d9c4823b66 100644
--- a/apps/web/src/lib/core/constant/featureFlags.ts
+++ b/apps/web/src/lib/core/constant/featureFlags.ts
@@ -520,6 +520,15 @@ export const enableReminders = defineFlag({
default: onInDev,
});
+// The Focus tab in Mail: signal threads the email focus worker classified as
+// worth the owner's attention. Only allowlisted inboxes are classified, so the
+// tab is empty for everyone else.
+export const enableEmailFocus = defineFlag({
+ key: 'enable-email-focus',
+ env: 'ENABLE_EMAIL_FOCUS',
+ default: onInDev,
+});
+
export const enableHistoryComponent = defineFlag({
key: 'enable-history-component',
env: 'ENABLE_HISTORY_COMPONENT',
diff --git a/apps/web/src/lib/queries/email/focus.ts b/apps/web/src/lib/queries/email/focus.ts
new file mode 100644
index 0000000000..72f391c2da
--- /dev/null
+++ b/apps/web/src/lib/queries/email/focus.ts
@@ -0,0 +1,54 @@
+import { type EmailEntity, isEmailEntity } from '@entity';
+import { createLiveQuery } from '@graphql-cache/solid/create-live-query';
+import {
+ EmailFocusDocument,
+ type EmailFocusQuery,
+} from '@service-storage/graphql/generated/graphql';
+import {
+ getGraphqlSoupClient,
+ mapGraphqlSoupItem,
+} from '@service-storage/graphql-soup';
+import type { Accessor } from 'solid-js';
+import {
+ isDisplayableSoupItem,
+ mapApiSoupItemToEntity,
+} from '../soup/transform-utils';
+
+/** Days of mail the Focus list covers. */
+export const FOCUS_WINDOW_DAYS = 30;
+
+/**
+ * The viewer's Focus threads as email rows, highest priority first, each
+ * carrying its classification in `focus`.
+ */
+export function mapEmailFocus(data: EmailFocusQuery): EmailEntity[] {
+ const threads: EmailEntity[] = [];
+ for (const thread of data.user.emailFocus) {
+ const item = mapGraphqlSoupItem(thread);
+ if (!item || !isDisplayableSoupItem(item)) continue;
+ const entity = mapApiSoupItemToEntity(item);
+ if (!isEmailEntity(entity) || !thread.focus) continue;
+ threads.push({
+ ...entity,
+ focus: {
+ importance: thread.focus.importance,
+ needsReply: thread.focus.needsReply,
+ needsFollowUp: thread.focus.needsFollowUp,
+ },
+ });
+ }
+ return threads;
+}
+
+/** The viewer's Focus list, read through the shared GraphQL client. */
+export function useEmailFocusQuery(enabled: Accessor<boolean>) {
+ return createLiveQuery(
+ EmailFocusDocument,
+ () => (enabled() ? { days: FOCUS_WINDOW_DAYS } : undefined),
+ () => ({
+ client: getGraphqlSoupClient(),
+ requestPolicy: 'cache-and-network' as const,
+ select: mapEmailFocus,
+ })
+ );
+}
diff --git a/apps/web/src/lib/service-clients/service-cognition/generated/schemas/aiFeature.ts b/apps/web/src/lib/service-clients/service-cognition/generated/schemas/aiFeature.ts
index daa6677262..d634856598 100644
--- a/apps/web/src/lib/service-clients/service-cognition/generated/schemas/aiFeature.ts
+++ b/apps/web/src/lib/service-clients/service-cognition/generated/schemas/aiFeature.ts
@@ -28,4 +28,5 @@ export const AiFeature = {
agent_mode_choice: 'agent_mode_choice',
dictation: 'dictation',
image_generation: 'image_generation',
+ email_focus: 'email_focus',
} as const;
diff --git a/apps/web/src/lib/service-clients/service-cognition/openapi.json b/apps/web/src/lib/service-clients/service-cognition/openapi.json
index d5ce2e62ea..01b9b633a7 100644
--- a/apps/web/src/lib/service-clients/service-cognition/openapi.json
+++ b/apps/web/src/lib/service-clients/service-cognition/openapi.json
@@ -2658,7 +2658,8 @@
"agent_repository_choice",
"agent_mode_choice",
"dictation",
- "image_generation"
+ "image_generation",
+ "email_focus"
]
},
"AssistantMessagePart": {
diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/email-focus.graphql b/apps/web/src/lib/service-clients/service-storage/graphql/email-focus.graphql
new file mode 100644
index 0000000000..266445ed07
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/graphql/email-focus.graphql
@@ -0,0 +1,13 @@
+query EmailFocus($days: Int) {
+ user {
+ id
+ emailFocus(days: $days) {
+ ...SoupItemFields
+ focus {
+ importance
+ needsReply
+ needsFollowUp
+ }
+ }
+ }
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
index 45402cea6c..cc691c53b0 100644
--- a/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
+++ b/apps/web/src/lib/service-clients/service-storage/graphql/generated/graphql.ts
@@ -4732,6 +4732,56 @@ export type DeleteEmailDraftMutation = { deleteEmailDraft: { draftId: string, de
| { __typename: 'GraphqlStringPropertyValue', stringValue: string }
| null }> } | null } };
+export type EmailFocusQueryVariables = Exact<{
+ days?: number | null | undefined;
+}>;
+
+
+export type EmailFocusQuery = { user: { id: string, emailFocus: Array<{ __typename: 'GraphqlSoupEmailThread', providerId: string | null, ownerId: string, inboxVisible: boolean, linkId: string, latestInboundMessageTs: string | null, latestOutboundMessageTs: string | null, latestNonSpamMessageTs: string | null, reminderReturnedAt: string | null, snippet: string | null, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null, isRead: boolean, isDraft: boolean, isImportant: boolean, isSignal: boolean, projectId: string | null, createdAt: string, updatedAt: string, viewedAt: string | null, cacheProjection: string | null, frecencyScore: number | null, id: string, entityType: GraphqlSoupEntityType, displayName: string | null, isFavorited: boolean, emailName: string | null, focus: { importance: number, needsReply: boolean, needsFollowUp: boolean } | null, notifications: Array<{ __typename: 'GraphqlNotification', id: string, eventType: string, entityType: GraphqlSoupEntityType, targetEntityType: GraphqlEntityType, entityId: string, sent: boolean, state: NotificationState, createdAt: string, viewedAt: string | null, updatedAt: string, senderId: string | null, metadata:
+ | { __typename: 'GraphqlAgentSessionMentionedMetadata', agentSessionMentionedMentionedBy: string | null, agentSessionMentionedActionId: string, agentSessionMentionedSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }
+ | { __typename: 'GraphqlAgentSessionSettledMetadata', agentSessionSettledTurn: number, agentSessionSettledActor: string | null, agentSessionSettledStopReason: string, agentSessionSettledExcerpt: string | null, agentSessionSettledSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }
+ | { __typename: 'GraphqlAgentSessionWaitingForInputMetadata', agentSessionWaitingForInputTurn: number, agentSessionWaitingForInputQuestion: string, agentSessionWaitingForInputSession: { sessionId: string, sessionName: string, botId: string, botName: string, channelId: string | null, threadId: string | null, announcementMessageId: string | null } }
+ | { __typename: 'GraphqlAiResponseMetadata', aiResponseSummary: string, aiResponseMessageId: string }
+ | { __typename: 'GraphqlCalendarEventJoinRequestMetadata', calendarEventJoinRequestRequestId: string, calendarEventJoinRequestEventId: string, calendarEventJoinRequestTitle: string }
+ | { __typename: 'GraphqlCalendarEventReminderMetadata', calendarEventReminderEventId: string, calendarEventReminderOccurrenceKey: string, calendarEventReminderTitle: string, calendarEventReminderStartsAt: string | null, calendarEventReminderEndsAt: string | null, calendarEventReminderStartDate: string | null, calendarEventReminderTimeZone: string | null, calendarEventReminderMinutesBefore: number }
+ | { __typename: 'GraphqlCallStartedMetadata', callStartedChannelName: string | null, callStartedSenderProfilePictureUrl: string | null }
+ | { __typename: 'GraphqlChannelInviteMetadata', channelInviteInvitedBy: string, channelInviteChannelName: string, channelInviteMessageContent: string | null, channelInviteSenderProfilePictureUrl: string | null }
+ | { __typename: 'GraphqlChannelMentionMetadata', channelMentionHasAttachments: boolean, channelMentionSenderDisplayName: string | null, channelMentionChannelName: string, channelMentionSenderProfilePictureUrl: string | null, channelMentionMessageId: string, channelMentionMessageContent: string, channelMentionThreadId: string | null, channelMentionChannelType: GraphqlNotificationChannelType }
+ | { __typename: 'GraphqlChannelMessageReactionMetadata', channelMessageReactionMessageId: string, channelMessageReactionThreadId: string | null, channelMessageReactionMessageContent: string, channelMessageReactionEmoji: string, channelMessageReactionChannelType: GraphqlNotificationChannelType, channelMessageReactionChannelName: string, channelMessageReactionSenderProfilePictureUrl: string | null }
+ | { __typename: 'GraphqlChannelMessageSendMetadata', channelMessageSendMessageContent: string, channelMessageSendHasAttachments: boolean, channelMessageSendSenderDisplayName: string | null, channelMessageSendChannelName: string, channelMessageSendSenderProfilePictureUrl: string | null, channelMessageSendSender: string | null, channelMessageSendMessageId: string, channelMessageSendChannelType: GraphqlNotificationChannelType }
+ | { __typename: 'GraphqlChannelReplyMetadata', channelReplyHasAttachments: boolean, channelReplySenderDisplayName: string | null, channelReplyChannelName: string, channelReplySenderProfilePictureUrl: string | null, channelReplyThreadId: string, channelReplyMessageId: string, channelReplyUserId: string | null, channelReplyMessageContent: string, channelReplyThreadParentSenderId: string | null, channelReplyChannelType: GraphqlNotificationChannelType }
+ | { __typename: 'GraphqlCommentedOnDocumentMetadata', commentedOnDocumentDocumentName: string, commentedOnDocumentOwner: string, commentedOnDocumentFileType: string | null, commentedOnDocumentSubType: GraphqlNotificationDocumentSubType | null, commentedOnDocumentCommentId: string, commentedOnDocumentThreadId: string, commentedOnDocumentText: string, commentedOnDocumentSenderProfilePictureUrl: string | null, commentedOnDocumentSenderDisplayName: string | null }
+ | { __typename: 'GraphqlCrmDiscussionMetadata', crmDiscussionRecordName: string, crmDiscussionReason: GraphqlCrmDiscussionReason, crmDiscussionMessageId: string, crmDiscussionThreadId: string, crmDiscussionText: string, crmDiscussionSenderDisplayName: string | null, crmDiscussionSenderProfilePictureUrl: string | null }
+ | { __typename: 'GraphqlDocumentMentionMetadata', documentMentionDocumentName: string, documentMentionOwner: string, documentMentionFileType: string | null, documentMentionSubType: GraphqlNotificationDocumentSubType | null, documentMentionMessageId: string, documentMentionMessageContent: string, documentMentionHasAttachments: boolean, documentMentionThreadId: string | null, documentMentionSenderDisplayName: string | null, documentMentionChannelType: GraphqlNotificationChannelType, documentMentionChannelName: string, documentMentionSenderProfilePictureUrl: string | null }
+ | { __typename: 'GraphqlEntityAccessGrantedMetadata', entityAccessGrantedRequestId: string, entityAccessGrantedRevision: number, entityAccessGrantedEntityName: string, entityAccessGrantedFileType: string | null, entityAccessGrantedAccessLevel: string }
+ | { __typename: 'GraphqlEntityAccessRequestedMetadata', entityAccessRequestedRequestId: string, entityAccessRequestedRevision: number, entityAccessRequestedEntityName: string, entityAccessRequestedFileType: string | null, entityAccessRequestedAccessLevel: string }
+ | { __typename: 'GraphqlExternalChatMessageMetadata', externalChatProvider: string, externalChatName: string, externalChatMessageId: string }
+ | { __typename: 'GraphqlGithubPrCheckRunMetadata', githubPrCheckRunForeignEntityId: string, githubPrCheckRunGithubKey: string, githubPrCheckRunOwner: string, githubPrCheckRunRepo: string, githubPrCheckRunNumber: string, githubPrCheckRunUrl: string, githubPrCheckRunDisplayName: string, githubPrCheckRunTitle: string, githubPrCheckRunSenderGithubLogin: string | null, githubPrCheckRunSenderGithubUserId: string | null, githubPrCheckRunSenderGithubAvatarUrl: string | null, githubPrCheckRunCheckRunGithubId: string, githubPrCheckRunCheckName: string, githubPrCheckRunCheckStatus: string, githubPrCheckRunConclusion: string, githubPrCheckRunState: GraphqlGithubPrCheckRunState, githubPrCheckRunCheckUrl: string, githubPrCheckRunCompletedAt: string }
+ | { __typename: 'GraphqlGithubPrCommentMetadata', githubPrCommentForeignEntityId: string, githubPrCommentGithubKey: string, githubPrCommentOwner: string, githubPrCommentRepo: string, githubPrCommentNumber: string, githubPrCommentUrl: string, githubPrCommentDisplayName: string, githubPrCommentTitle: string, githubPrCommentSenderGithubLogin: string | null, githubPrCommentSenderGithubUserId: string | null, githubPrCommentSenderGithubAvatarUrl: string | null, githubPrCommentCommentKind: GraphqlGithubPrCommentKind, githubPrCommentCommentGithubId: string | null, githubPrCommentCommentUrl: string | null, githubPrCommentCommentSnippet: string }
+ | { __typename: 'GraphqlGithubPrMentionMetadata', githubPrMentionForeignEntityId: string, githubPrMentionGithubKey: string, githubPrMentionOwner: string, githubPrMentionRepo: string, githubPrMentionNumber: string, githubPrMentionUrl: string, githubPrMentionDisplayName: string, githubPrMentionTitle: string, githubPrMentionSenderGithubLogin: string | null, githubPrMentionSenderGithubUserId: string | null, githubPrMentionSenderGithubAvatarUrl: string | null, githubPrMentionLocation: GraphqlGithubPrMentionLocation, githubPrMentionCommentGithubId: string | null, githubPrMentionCommentUrl: string | null, githubPrMentionTextSnippet: string }
+ | { __typename: 'GraphqlGithubPrReviewMetadata', githubPrReviewForeignEntityId: string, githubPrReviewGithubKey: string, githubPrReviewOwner: string, githubPrReviewRepo: string, githubPrReviewNumber: string, githubPrReviewUrl: string, githubPrReviewDisplayName: string, githubPrReviewTitle: string, githubPrReviewSenderGithubLogin: string | null, githubPrReviewSenderGithubUserId: string | null, githubPrReviewSenderGithubAvatarUrl: string | null, githubPrReviewReviewGithubId: string | null, githubPrReviewReviewUrl: string | null, githubPrReviewState: GraphqlGithubPrReviewState, githubPrReviewReviewSnippet: string | null }
+ | { __typename: 'GraphqlGithubPrStatusChangedMetadata', githubPrStatusChangedForeignEntityId: string, githubPrStatusChangedGithubKey: string, githubPrStatusChangedOwner: string, githubPrStatusChangedRepo: string, githubPrStatusChangedNumber: string, githubPrStatusChangedUrl: string, githubPrStatusChangedDisplayName: string, githubPrStatusChangedTitle: string, githubPrStatusChangedSenderGithubLogin: string | null, githubPrStatusChangedSenderGithubUserId: string | null, githubPrStatusChangedSenderGithubAvatarUrl: string | null, githubPrStatusChangedStatus: GraphqlGithubPrEventStatus, githubPrStatusChangedAction: GraphqlGithubPrEventAction, githubPrStatusChangedPreviousStatus: GraphqlGithubPrEventStatus | null, githubPrStatusChangedHeadBranch: string | null, githubPrStatusChangedBaseBranch: string | null, githubPrStatusChangedMergedAt: string | null }
+ | { __typename: 'GraphqlGithubReviewRequestedMetadata', githubReviewRequestedForeignEntityId: string, githubReviewRequestedGithubKey: string, githubReviewRequestedOwner: string, githubReviewRequestedRepo: string, githubReviewRequestedNumber: string, githubReviewRequestedUrl: string, githubReviewRequestedDisplayName: string, githubReviewRequestedTitle: string, githubReviewRequestedSenderGithubLogin: string | null, githubReviewRequestedSenderGithubUserId: string | null, githubReviewRequestedSenderGithubAvatarUrl: string | null, githubReviewRequestedRequestedReviewerGithubLogin: string | null, githubReviewRequestedRequestedReviewerGithubUserId: string | null }
+ | { __typename: 'GraphqlInboxReauthRequiredMetadata', inboxReauthRequiredEmailAddress: string }
+ | { __typename: 'GraphqlInitiativeDiscussionMetadata', initiativeDiscussionProjectName: string, initiativeDiscussionOwner: string, initiativeDiscussionReason: GraphqlInitiativeDiscussionReason, initiativeDiscussionMessageId: string, initiativeDiscussionThreadId: string, initiativeDiscussionText: string, initiativeDiscussionSenderDisplayName: string | null, initiativeDiscussionSenderProfilePictureUrl: string | null }
+ | { __typename: 'GraphqlInviteToTeamMetadata', inviteToTeamTeamName: string, inviteToTeamTeamId: string, inviteToTeamTeamInviteId: string, inviteToTeamInvitedBy: string, inviteToTeamRole: string | null, inviteToTeamSenderProfilePictureUrl: string | null }
+ | { __typename: 'GraphqlMentionedInDocumentCommentMetadata', mentionedInDocumentCommentDocumentName: string, mentionedInDocumentCommentOwner: string, mentionedInDocumentCommentFileType: string | null, mentionedInDocumentCommentSubType: GraphqlNotificationDocumentSubType | null, mentionedInDocumentCommentMentionId: string, mentionedInDocumentCommentCommentId: string, mentionedInDocumentCommentThreadId: string, mentionedInDocumentCommentText: string, mentionedInDocumentCommentSenderProfilePictureUrl: string | null, mentionedInDocumentCommentSenderDisplayName: string | null }
+ | { __typename: 'GraphqlNewEmailMetadata', newEmailSender: string | null, newEmailToEmail: string, newEmailThreadId: string, newEmailSubject: string, newEmailSnippet: string }
+ | { __typename: 'GraphqlReminderMetadata', reminderReminderId: string, reminderDescription: string, reminderScheduledFor: string | null }
+ | { __typename: 'GraphqlRepliedToDocumentCommentThreadMetadata', repliedToDocumentCommentThreadDocumentName: string, repliedToDocumentCommentThreadOwner: string, repliedToDocumentCommentThreadFileType: string | null, repliedToDocumentCommentThreadSubType: GraphqlNotificationDocumentSubType | null, repliedToDocumentCommentThreadCommentId: string, repliedToDocumentCommentThreadThreadId: string, repliedToDocumentCommentThreadText: string, repliedToDocumentCommentThreadSenderProfilePictureUrl: string | null, repliedToDocumentCommentThreadSenderDisplayName: string | null }
+ | { __typename: 'GraphqlTaskAssignedMetadata', taskAssignedTaskId: string, taskAssignedTaskName: string | null, taskAssignedSubType: GraphqlNotificationDocumentSubType | null, taskAssignedAssignedBy: string, taskAssignedSenderProfilePictureUrl: string | null }
+ | { __typename: 'GraphqlWhatsappGroupMessageMetadata' }
+ }>, mailDraftState: { baseline: { messageCount: number, inboxVisible: boolean, isRead: boolean, isSignal: boolean, hasCalendarAttachment: boolean, latestInboundMessageTs: string | null, latestNonSpamMessageTs: string | null, latestOutboundMessageTs: string | null, previewTs: string | null, preview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null }, drafts: Array<{ id: string, macroDraft: boolean, facts: { messageCount: number, inboxVisible: boolean, isRead: boolean, isSignal: boolean, hasCalendarAttachment: boolean, latestInboundMessageTs: string | null, latestNonSpamMessageTs: string | null, latestOutboundMessageTs: string | null, previewTs: string | null, preview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null } }> } | null, mailAllPreview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null, mailDraftPreview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null, mailSentPreview: { id: string, subject: string | null, snippet: string | null, isDraft: boolean, senderEmail: string | null, senderName: string | null, senderPhotoUrl: string | null } | null, participants: Array<{ contactId: string, linkId: string, name: string | null, email: string | null, sfsPhotoUrl: string | null }>, attachments: Array<{ id: string, messageId: string, providerAttachmentId: string | null, filename: string | null, mimeType: string | null, sizeBytes: number | null, contentId: string | null, createdAt: string }>, labels: Array<{ __typename: 'GraphqlSoupEmailLabel', id: string, linkId: string, providerLabelId: string, name: string, createdAt: string, messageListVisibility: string, labelListVisibility: string, type: string }>, properties: Array<{ id: string, propertyDefinitionId: string, displayName: string, dataType: GraphqlPropertyDataType, isMultiSelect: boolean, specificEntityType: GraphqlPropertyEntityType | null, isSystem: boolean, isMetadata: boolean, value:
+ | { __typename: 'GraphqlBooleanPropertyValue', boolValue: boolean }
+ | { __typename: 'GraphqlDatePropertyValue', dateValue: string }
+ | { __typename: 'GraphqlDateRangePropertyValue', rangeStart: string, rangeEnd: string }
+ | { __typename: 'GraphqlEntityReferencePropertyValue', references: Array<{ entityId: string, entityType: GraphqlPropertyEntityType, specificMessageId: string | null }> }
+ | { __typename: 'GraphqlLinkPropertyValue', urls: Array<string> }
+ | { __typename: 'GraphqlNumberPropertyValue', numberValue: number }
+ | { __typename: 'GraphqlSelectOptionPropertyValue', optionIds: Array<string> }
+ | { __typename: 'GraphqlStringPropertyValue', stringValue: string }
+ | null }> }> } };
+
export type EmailReadStateFieldsFragment = { __typename: 'GraphqlSoupEmailThread', id: string, isRead: boolean };
export type MarkEmailThreadSeenMutationVariables = Exact<{
@@ -21250,6 +21300,7 @@ export const SetEmailThreadArchivedDocument = {"kind":"Document","definitions":[
export const SetEmailThreadsArchivedDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SetEmailThreadsArchived"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SetEmailThreadsArchivedInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"setEmailThreadsArchived"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"threads"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}}]}},{"kind":"Field","name":{"kind":"Name","value":"failedThreadIds"}}]}}]}}]} as unknown as DocumentNode<SetEmailThreadsArchivedMutation, SetEmailThreadsArchivedMutationVariables>;
export const SaveEmailDraftDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SaveEmailDraft"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SaveEmailDraftInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"saveEmailDraft"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"draft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"thread"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftThreadFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDateRangePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"rangeStart"},"name":{"kind":"Name","value":"start"}},{"kind":"Field","alias":{"kind":"Name","value":"rangeEnd"},"name":{"kind":"Name","value":"end"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupAgentSessionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupAgentSessionFields"}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"targetEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlExternalChatMessageMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"externalChatProvider"},"name":{"kind":"Name","value":"provider"}},{"kind":"Field","alias":{"kind":"Name","value":"externalChatName"},"name":{"kind":"Name","value":"chatName"}},{"kind":"Field","alias":{"kind":"Name","value":"externalChatMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventJoinRequestMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestTitle"},"name":{"kind":"Name","value":"title"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftThreadFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"20"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]} as unknown as DocumentNode<SaveEmailDraftMutation, SaveEmailDraftMutationVariables>;
export const DeleteEmailDraftDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"DeleteEmailDraft"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"DeleteEmailDraftInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"deleteEmailDraft"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"deleted"}},{"kind":"Field","name":{"kind":"Name","value":"threadDeleted"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"thread"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftThreadFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDateRangePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"rangeStart"},"name":{"kind":"Name","value":"start"}},{"kind":"Field","alias":{"kind":"Name","value":"rangeEnd"},"name":{"kind":"Name","value":"end"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupAgentSessionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupAgentSessionFields"}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"targetEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlExternalChatMessageMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"externalChatProvider"},"name":{"kind":"Name","value":"provider"}},{"kind":"Field","alias":{"kind":"Name","value":"externalChatName"},"name":{"kind":"Name","value":"chatName"}},{"kind":"Field","alias":{"kind":"Name","value":"externalChatMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventJoinRequestMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestTitle"},"name":{"kind":"Name","value":"title"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftThreadFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"20"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]} as unknown as DocumentNode<DeleteEmailDraftMutation, DeleteEmailDraftMutationVariables>;
+export const EmailFocusDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"EmailFocus"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"days"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"user"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"emailFocus"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"days"},"value":{"kind":"Variable","name":{"kind":"Name","value":"days"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"focus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"importance"}},{"kind":"Field","name":{"kind":"Name","value":"needsReply"}},{"kind":"Field","name":{"kind":"Name","value":"needsFollowUp"}}]}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDateRangePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"rangeStart"},"name":{"kind":"Name","value":"start"}},{"kind":"Field","alias":{"kind":"Name","value":"rangeEnd"},"name":{"kind":"Name","value":"end"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupAgentSessionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupAgentSessionFields"}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"targetEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlExternalChatMessageMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"externalChatProvider"},"name":{"kind":"Name","value":"provider"}},{"kind":"Field","alias":{"kind":"Name","value":"externalChatName"},"name":{"kind":"Name","value":"chatName"}},{"kind":"Field","alias":{"kind":"Name","value":"externalChatMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventJoinRequestMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestTitle"},"name":{"kind":"Name","value":"title"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}}]} as unknown as DocumentNode<EmailFocusQuery, EmailFocusQueryVariables>;
export const MarkEmailThreadSeenDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"MarkEmailThreadSeen"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"MarkEmailThreadSeenInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"markEmailThreadSeen"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailReadStateFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailReadStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}}]}}]} as unknown as DocumentNode<MarkEmailThreadSeenMutation, MarkEmailThreadSeenMutationVariables>;
export const MarkEmailThreadUnreadDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"MarkEmailThreadUnread"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"MarkEmailThreadUnreadInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"markEmailThreadUnread"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailReadStateFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailReadStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}}]}}]} as unknown as DocumentNode<MarkEmailThreadUnreadMutation, MarkEmailThreadUnreadMutationVariables>;
export const SendEmailMessageDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"mutation","name":{"kind":"Name","value":"SendEmailMessage"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"input"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"SendEmailAttemptInput"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sendEmailMessage"},"name":{"kind":"Name","value":"sendEmailAttempt"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"input"},"value":{"kind":"Variable","name":{"kind":"Name","value":"input"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attempt"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailSendAttemptFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"thread"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftThreadFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailThreadMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"draftGeneration"}},{"kind":"Field","name":{"kind":"Name","value":"operationStatus"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"revision"}},{"kind":"Field","name":{"kind":"Name","value":"remoteVersion"}},{"kind":"Field","name":{"kind":"Name","value":"issue"}}]}},{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"replyingToId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"internalDateTs"}},{"kind":"Field","name":{"kind":"Name","value":"sentAt"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isStarred"}},{"kind":"Field","name":{"kind":"Name","value":"isSent"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendTime"}},{"kind":"Field","name":{"kind":"Name","value":"scheduledSendStatus"}},{"kind":"Field","name":{"kind":"Name","value":"from"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"to"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"cc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bcc"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"photoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}}]}},{"kind":"Field","name":{"kind":"Name","value":"bodyText"}},{"kind":"Field","name":{"kind":"Name","value":"bodyHtmlSanitized"}},{"kind":"Field","name":{"kind":"Name","value":"bodyMacro"}},{"kind":"Field","name":{"kind":"Name","value":"calendarInvitations"}},{"kind":"Field","name":{"kind":"Name","value":"bodyReplyless"}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"sfsId"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"referenceUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsDraft"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"fileName"}},{"kind":"Field","name":{"kind":"Name","value":"contentType"}},{"kind":"Field","name":{"kind":"Name","value":"sha"}},{"kind":"Field","name":{"kind":"Name","value":"size"}},{"kind":"Field","name":{"kind":"Name","value":"s3Key"}},{"kind":"Field","name":{"kind":"Name","value":"uploadPending"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"isInline"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachmentsForwarded"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"attachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"draftId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"messageProviderId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}}]}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupEntityIdentityFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"isFavorited"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyValueFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlBooleanPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"boolValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNumberPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"numberValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlStringPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"stringValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDatePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"dateValue"},"name":{"kind":"Name","value":"value"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDateRangePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"rangeStart"},"name":{"kind":"Name","value":"start"}},{"kind":"Field","alias":{"kind":"Name","value":"rangeEnd"},"name":{"kind":"Name","value":"end"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSelectOptionPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"optionIds"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityReferencePropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"references"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"specificMessageId"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlLinkPropertyValue"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"urls"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupPropertyFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlProperty"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"propertyDefinitionId"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"dataType"}},{"kind":"Field","name":{"kind":"Name","value":"isMultiSelect"}},{"kind":"Field","name":{"kind":"Name","value":"specificEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"isSystem"}},{"kind":"Field","name":{"kind":"Name","value":"isMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"value"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyValueFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupAgentSessionFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupAgentSession"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"sessionName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"isArchived"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"harness"}},{"kind":"Field","name":{"kind":"Name","value":"repoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"repoBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestUrl"}},{"kind":"Field","name":{"kind":"Name","value":"workingBranch"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestState"}},{"kind":"Field","name":{"kind":"Name","value":"pullRequestId"}},{"kind":"Field","name":{"kind":"Name","value":"turnState"}},{"kind":"Field","name":{"kind":"Name","value":"bot"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"avatarUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"source"}},{"kind":"Field","name":{"kind":"Name","value":"visibility"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"MailPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailPreviewMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"subject"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftAggregateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftAggregate"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageCount"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"hasCalendarAttachment"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"previewTs"}},{"kind":"Field","name":{"kind":"Name","value":"preview"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMailDraftState"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"baseline"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"drafts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"macroDraft"}},{"kind":"Field","name":{"kind":"Name","value":"facts"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftAggregateFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupChannelMessageFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessagePreview"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mentions"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"GraphqlCrmContactFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmContact"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"contactTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"companyId"}},{"kind":"Field","name":{"kind":"Name","value":"companyName"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","alias":{"kind":"Name","value":"crmContactName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"firstInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"lastInteraction"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemPreviewFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"cacheProjection"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}]},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupEntityIdentityFields"}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupAgentSessionFields"}},{"kind":"Field","name":{"kind":"Name","value":"frecencyScore"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDatabaseRow"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"tableId"}},{"kind":"Field","name":{"kind":"Name","value":"databaseId"}},{"kind":"Field","name":{"kind":"Name","value":"position"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"creatorId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupInitiative"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupDocument"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"fileType"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"subType"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskSubType"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"isCompleted"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChat"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"chatName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"model"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"isPersistent"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupProject"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"projectName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"parentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"deletedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"providerId"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"inboxVisible"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"latestInboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestOutboundMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"latestNonSpamMessageTs"}},{"kind":"Field","name":{"kind":"Name","value":"reminderReturnedAt"}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftState"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailDraftStateFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailAllPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailDraftPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"mailSentPreview"},"directives":[{"kind":"Directive","name":{"kind":"Name","value":"cacheOnly"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"MailPreviewFields"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"emailName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"snippet"}},{"kind":"Field","name":{"kind":"Name","value":"senderEmail"}},{"kind":"Field","name":{"kind":"Name","value":"senderName"}},{"kind":"Field","name":{"kind":"Name","value":"senderPhotoUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isRead"}},{"kind":"Field","name":{"kind":"Name","value":"isDraft"}},{"kind":"Field","name":{"kind":"Name","value":"isImportant"}},{"kind":"Field","name":{"kind":"Name","value":"isSignal"}},{"kind":"Field","name":{"kind":"Name","value":"projectId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","alias":{"kind":"Name","value":"participants"},"name":{"kind":"Name","value":"senders"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"contactId"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"email"}},{"kind":"Field","name":{"kind":"Name","value":"sfsPhotoUrl"}}]}},{"kind":"Field","name":{"kind":"Name","value":"attachments"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"messageId"}},{"kind":"Field","name":{"kind":"Name","value":"providerAttachmentId"}},{"kind":"Field","name":{"kind":"Name","value":"filename"}},{"kind":"Field","name":{"kind":"Name","value":"mimeType"}},{"kind":"Field","name":{"kind":"Name","value":"sizeBytes"}},{"kind":"Field","name":{"kind":"Name","value":"contentId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"labels"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"linkId"}},{"kind":"Field","name":{"kind":"Name","value":"providerLabelId"}},{"kind":"Field","name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"messageListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"labelListVisibility"}},{"kind":"Field","name":{"kind":"Name","value":"type"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannel"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"channelType"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"organizationId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"interactedAt"}},{"kind":"Field","name":{"kind":"Name","value":"isParticipant"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"role"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}},{"kind":"Field","name":{"kind":"Name","value":"latestNonThreadMessage"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupChannelMessageFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupChannelMessage"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}},{"kind":"Field","name":{"kind":"Name","value":"content"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"effectiveUpdatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"replyCount"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCall"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callChannelId"},"name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"channelName"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"customName"}},{"kind":"Field","name":{"kind":"Name","value":"summary"}},{"kind":"Field","name":{"kind":"Name","value":"startedAt"}},{"kind":"Field","name":{"kind":"Name","value":"endedAt"}},{"kind":"Field","name":{"kind":"Name","value":"durationMs"}},{"kind":"Field","name":{"kind":"Name","value":"isActive"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"attended"}},{"kind":"Field","name":{"kind":"Name","value":"participants"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"userId"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"guests"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"displayName"}},{"kind":"Field","name":{"kind":"Name","value":"joinedAt"}},{"kind":"Field","name":{"kind":"Name","value":"leftAt"}}]}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"FragmentSpread","name":{"kind":"Name","value":"GraphqlCrmContactFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCrmCompany"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmCompanyName"},"name":{"kind":"Name","value":"name"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"emailSync"}},{"kind":"Field","name":{"kind":"Name","value":"hidden"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"domains"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupForeignEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","name":{"kind":"Name","value":"foreignEntitySource"}},{"kind":"Field","name":{"kind":"Name","value":"storedForId"}},{"kind":"Field","name":{"kind":"Name","value":"storedForAuthEntity"}},{"kind":"Field","name":{"kind":"Name","value":"sourceMetadata"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupCalendarEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"time"}},{"kind":"Field","name":{"kind":"Name","value":"conferenceUrl"}},{"kind":"Field","name":{"kind":"Name","value":"isReadOnly"}},{"kind":"Field","name":{"kind":"Name","value":"ownerId"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"properties"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupPropertyFields"}}]}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationStateFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"eventType"}},{"kind":"Field","name":{"kind":"Name","value":"entityType"}},{"kind":"Field","name":{"kind":"Name","value":"targetEntityType"}},{"kind":"Field","name":{"kind":"Name","value":"entityId"}},{"kind":"Field","name":{"kind":"Name","value":"sent"}},{"kind":"Field","name":{"kind":"Name","value":"state"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"viewedAt"}},{"kind":"Field","name":{"kind":"Name","value":"updatedAt"}},{"kind":"Field","name":{"kind":"Name","value":"senderId"}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlExternalChatMessageMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"externalChatProvider"},"name":{"kind":"Name","value":"provider"}},{"kind":"Field","alias":{"kind":"Name","value":"externalChatName"},"name":{"kind":"Name","value":"chatName"}},{"kind":"Field","alias":{"kind":"Name","value":"externalChatMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlDocumentMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"documentMentionDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"documentMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlMentionedInDocumentCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentMentionId"},"name":{"kind":"Name","value":"mentionId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"mentionedInDocumentCommentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlRepliedToDocumentCommentThreadMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"repliedToDocumentCommentThreadSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessRequestedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlEntityAccessGrantedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedRevision"},"name":{"kind":"Name","value":"revision"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedEntityName"},"name":{"kind":"Name","value":"entityName"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"entityAccessGrantedAccessLevel"},"name":{"kind":"Name","value":"accessLevel"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCommentedOnDocumentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentDocumentName"},"name":{"kind":"Name","value":"documentName"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentFileType"},"name":{"kind":"Name","value":"fileType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentCommentId"},"name":{"kind":"Name","value":"commentId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"commentedOnDocumentSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInitiativeDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionProjectName"},"name":{"kind":"Name","value":"projectName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"initiativeDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCrmDiscussionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionRecordName"},"name":{"kind":"Name","value":"recordName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionReason"},"name":{"kind":"Name","value":"reason"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionText"},"name":{"kind":"Name","value":"text"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"crmDiscussionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelInviteMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelInviteInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelInviteSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageReactionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionEmoji"},"name":{"kind":"Name","value":"emoji"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelType"},"name":{"kind":"Name","value":"channelType"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageReactionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageId"},"name":{"kind":"Name","value":"messageId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyUserId"},"name":{"kind":"Name","value":"userId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyThreadParentSenderId"},"name":{"kind":"Name","value":"threadParentSenderId"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelType"},"name":{"kind":"Name","value":"channelType"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCallStartedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"callStartedChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"callStartedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNewEmailMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"newEmailSender"},"name":{"kind":"Name","value":"sender"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailToEmail"},"name":{"kind":"Name","value":"toEmail"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailThreadId"},"name":{"kind":"Name","value":"threadId"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSubject"},"name":{"kind":"Name","value":"subject"}},{"kind":"Field","alias":{"kind":"Name","value":"newEmailSnippet"},"name":{"kind":"Name","value":"snippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInboxReauthRequiredMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inboxReauthRequiredEmailAddress"},"name":{"kind":"Name","value":"emailAddress"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlInviteToTeamMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamName"},"name":{"kind":"Name","value":"teamName"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamId"},"name":{"kind":"Name","value":"teamId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamTeamInviteId"},"name":{"kind":"Name","value":"teamInviteId"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamInvitedBy"},"name":{"kind":"Name","value":"invitedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamRole"},"name":{"kind":"Name","value":"role"}},{"kind":"Field","alias":{"kind":"Name","value":"inviteToTeamSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlTaskAssignedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskId"},"name":{"kind":"Name","value":"taskId"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedTaskName"},"name":{"kind":"Name","value":"taskName"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSubType"},"name":{"kind":"Name","value":"subType"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedAssignedBy"},"name":{"kind":"Name","value":"assignedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"taskAssignedSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"reminderReminderId"},"name":{"kind":"Name","value":"reminderId"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderDescription"},"name":{"kind":"Name","value":"description"}},{"kind":"Field","alias":{"kind":"Name","value":"reminderScheduledFor"},"name":{"kind":"Name","value":"scheduledFor"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventReminderMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderOccurrenceKey"},"name":{"kind":"Name","value":"occurrenceKey"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartsAt"},"name":{"kind":"Name","value":"startsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderEndsAt"},"name":{"kind":"Name","value":"endsAt"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderStartDate"},"name":{"kind":"Name","value":"startDate"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderTimeZone"},"name":{"kind":"Name","value":"timeZone"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventReminderMinutesBefore"},"name":{"kind":"Name","value":"minutesBefore"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlCalendarEventJoinRequestMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestRequestId"},"name":{"kind":"Name","value":"requestId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestEventId"},"name":{"kind":"Name","value":"eventId"}},{"kind":"Field","alias":{"kind":"Name","value":"calendarEventJoinRequestTitle"},"name":{"kind":"Name","value":"title"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAiResponseMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"aiResponseSummary"},"name":{"kind":"Name","value":"summary"}},{"kind":"Field","alias":{"kind":"Name","value":"aiResponseMessageId"},"name":{"kind":"Name","value":"messageId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrStatusChangedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedStatus"},"name":{"kind":"Name","value":"status"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedAction"},"name":{"kind":"Name","value":"action"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedPreviousStatus"},"name":{"kind":"Name","value":"previousStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedHeadBranch"},"name":{"kind":"Name","value":"headBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedBaseBranch"},"name":{"kind":"Name","value":"baseBranch"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrStatusChangedMergedAt"},"name":{"kind":"Name","value":"mergedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCheckRunMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckRunGithubId"},"name":{"kind":"Name","value":"checkRunGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckName"},"name":{"kind":"Name","value":"checkName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckStatus"},"name":{"kind":"Name","value":"checkStatus"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunConclusion"},"name":{"kind":"Name","value":"conclusion"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCheckUrl"},"name":{"kind":"Name","value":"checkUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCheckRunCompletedAt"},"name":{"kind":"Name","value":"completedAt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubReviewRequestedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubLogin"},"name":{"kind":"Name","value":"requestedReviewerGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubReviewRequestedRequestedReviewerGithubUserId"},"name":{"kind":"Name","value":"requestedReviewerGithubUserId"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrCommentMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentKind"},"name":{"kind":"Name","value":"commentKind"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrCommentCommentSnippet"},"name":{"kind":"Name","value":"commentSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionLocation"},"name":{"kind":"Name","value":"location"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentGithubId"},"name":{"kind":"Name","value":"commentGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionCommentUrl"},"name":{"kind":"Name","value":"commentUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrMentionTextSnippet"},"name":{"kind":"Name","value":"textSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlGithubPrReviewMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewForeignEntityId"},"name":{"kind":"Name","value":"foreignEntityId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewGithubKey"},"name":{"kind":"Name","value":"githubKey"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewOwner"},"name":{"kind":"Name","value":"owner"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewRepo"},"name":{"kind":"Name","value":"repo"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewNumber"},"name":{"kind":"Name","value":"number"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewUrl"},"name":{"kind":"Name","value":"url"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewDisplayName"},"name":{"kind":"Name","value":"displayName"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewTitle"},"name":{"kind":"Name","value":"title"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubLogin"},"name":{"kind":"Name","value":"senderGithubLogin"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubUserId"},"name":{"kind":"Name","value":"senderGithubUserId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewSenderGithubAvatarUrl"},"name":{"kind":"Name","value":"senderGithubAvatarUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewGithubId"},"name":{"kind":"Name","value":"reviewGithubId"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewUrl"},"name":{"kind":"Name","value":"reviewUrl"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewState"},"name":{"kind":"Name","value":"state"}},{"kind":"Field","alias":{"kind":"Name","value":"githubPrReviewReviewSnippet"},"name":{"kind":"Name","value":"reviewSnippet"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionSettledMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledActor"},"name":{"kind":"Name","value":"actor"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledStopReason"},"name":{"kind":"Name","value":"stopReason"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionSettledExcerpt"},"name":{"kind":"Name","value":"excerpt"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionWaitingForInputMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputTurn"},"name":{"kind":"Name","value":"turn"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionWaitingForInputQuestion"},"name":{"kind":"Name","value":"question"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAgentSessionMentionedMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedSession"},"name":{"kind":"Name","value":"session"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"sessionId"}},{"kind":"Field","name":{"kind":"Name","value":"sessionName"}},{"kind":"Field","name":{"kind":"Name","value":"botId"}},{"kind":"Field","name":{"kind":"Name","value":"botName"}},{"kind":"Field","name":{"kind":"Name","value":"channelId"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"announcementMessageId"}}]}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedMentionedBy"},"name":{"kind":"Name","value":"mentionedBy"}},{"kind":"Field","alias":{"kind":"Name","value":"agentSessionMentionedActionId"},"name":{"kind":"Name","value":"actionId"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationMetadataFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotifEvent"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationNavigationMetadataFields"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMentionMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMentionHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMentionSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelMessageSendMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendMessageContent"},"name":{"kind":"Name","value":"messageContent"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelMessageSendSenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlChannelReplyMetadata"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","alias":{"kind":"Name","value":"channelReplyHasAttachments"},"name":{"kind":"Name","value":"hasAttachments"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderDisplayName"},"name":{"kind":"Name","value":"senderDisplayName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplyChannelName"},"name":{"kind":"Name","value":"channelName"}},{"kind":"Field","alias":{"kind":"Name","value":"channelReplySenderProfilePictureUrl"},"name":{"kind":"Name","value":"senderProfilePictureUrl"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupNotificationFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlNotification"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationStateFields"}},{"kind":"Field","name":{"kind":"Name","value":"metadata"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationMetadataFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"SoupItemFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEntity"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemPreviewFields"}},{"kind":"Field","name":{"kind":"Name","value":"notifications"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupNotificationFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailSendAttemptFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"EmailSendAttemptPayload"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"attemptId"}},{"kind":"Field","name":{"kind":"Name","value":"status"}},{"kind":"Field","name":{"kind":"Name","value":"sendTime"}},{"kind":"Field","name":{"kind":"Name","value":"threadId"}},{"kind":"Field","name":{"kind":"Name","value":"message"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}},{"kind":"FragmentDefinition","name":{"kind":"Name","value":"EmailDraftThreadFields"},"typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlSoupEmailThread"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"SoupItemFields"}},{"kind":"Field","name":{"kind":"Name","value":"viewerPermission"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"__typename"}},{"kind":"InlineFragment","typeCondition":{"kind":"NamedType","name":{"kind":"Name","value":"GraphqlAccessLevelPermission"}},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accessLevel"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"messages"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"offset"},"value":{"kind":"IntValue","value":"0"}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"20"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"FragmentSpread","name":{"kind":"Name","value":"EmailThreadMessageFields"}}]}}]}}]} as unknown as DocumentNode<SendEmailMessageMutation, SendEmailMessageMutationVariables>;
diff --git a/apps/web/tests/native/filter-matrix.ts b/apps/web/tests/native/filter-matrix.ts
index fe177753a0..d1fe1e46ec 100644
--- a/apps/web/tests/native/filter-matrix.ts
+++ b/apps/web/tests/native/filter-matrix.ts
@@ -92,9 +92,10 @@ const emailTabSources = {
shared: 'soup',
archived: 'soup',
all: 'soup',
+ focus: 'focus-list',
} as const satisfies Record<
(typeof EMAIL_TABS)[number]['id'],
- 'soup' | 'scheduled-message-service' | 'reminder-collection'
+ 'soup' | 'scheduled-message-service' | 'reminder-collection' | 'focus-list'
>;
const taskTabSources = {
'my-tasks': 'soup',
@@ -202,7 +203,7 @@ function* cases(scope?: Scope): Generator<Case> {
);
assert(
EMAIL_FACETS.map((facet) => facet.id).join() ===
- 'read,done,attachments,calendar,tags',
+ 'read,done,attachments,calendar,focus,tags',
'Add new Email facets to the matrix'
);
assert(
diff --git a/apps/web/tests/native/fixtures/filter-oracle.ts b/apps/web/tests/native/fixtures/filter-oracle.ts
index a73d6a5f78..60a57f6dac 100644
--- a/apps/web/tests/native/fixtures/filter-oracle.ts
+++ b/apps/web/tests/native/fixtures/filter-oracle.ts
@@ -14,7 +14,7 @@ export function emailMatchesSelection(
tab: EmailTab,
selection: Record<string, string[]>
): boolean {
- if (tab === 'scheduled' || tab === 'reminders') {
+ if (tab === 'scheduled' || tab === 'reminders' || tab === 'focus') {
throw new Error(`${tab} membership is not owned by the Soup query`);
}
if (row.kind !== 'email') return false;
diff --git a/crates/agent_code_mode/src/domain/documentation.json b/crates/agent_code_mode/src/domain/documentation.json
index 1f6a74fb73..681bfe2a87 100644
--- a/crates/agent_code_mode/src/domain/documentation.json
+++ b/crates/agent_code_mode/src/domain/documentation.json
@@ -259,7 +259,7 @@
"calendar.TeamCalendarSharing": "# Type Alias: TeamCalendarSharing\n\n> **TeamCalendarSharing** = `\"all\"` \\| `\"busy_only\"` \\| `\"none\"`\n\nWhat a user exposes through their team membership.",
"calendar.ViewerCapabilities": "# Type Alias: ViewerCapabilities\n\n> **ViewerCapabilities** = \\{ `editDetails`: `boolean`; `inviteGuests`: `boolean`; `organize`: `boolean`; `removeGuests`: `boolean`; `rsvp`: `boolean`; `setGuestPolicy`: `boolean`; \\}\n\nWhat the viewing requester may do with an event.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-editdetails\"></a> `editDetails` | `boolean` | Change the event's details (title, time, description, conference). |\n| <a id=\"property-inviteguests\"></a> `inviteGuests` | `boolean` | Add guests. |\n| <a id=\"property-organize\"></a> `organize` | `boolean` | Act as the event's organizer: replace its whole guest list and manage its conferencing. |\n| <a id=\"property-removeguests\"></a> `removeGuests` | `boolean` | Remove guests. |\n| <a id=\"property-rsvp\"></a> `rsvp` | `boolean` | Answer the invitation. |\n| <a id=\"property-setguestpolicy\"></a> `setGuestPolicy` | `boolean` | Change the event's guest policy, which only Google calendars have. |",
"VisibleCalendar": "# Type Alias: VisibleCalendar\n\n> **VisibleCalendar** = \\{ `capabilities`: `CalendarCapabilities`; `color?`: `string` \\| `null`; `defaultReminders`: `calendar.EventReminderOverride`[]; `emailAddress`: `string`; `emailLinkId`: `string`; `id`: `string`; `isPrimary`: `boolean`; `isSubscription`: `boolean`; `isWritable`: `boolean`; `name`: `string`; `provider`: `CalendarProvider`; `syncError?`: `string` \\| `null`; \\}\n\nA calendar visible to a requester, listed for pickers and filters.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-capabilities\"></a> `capabilities` | `CalendarCapabilities` | Provider features available on this actual calendar. |\n| <a id=\"property-color\"></a> `color?` | `string` \\| `null` | Provider color. |\n| <a id=\"property-defaultreminders\"></a> `defaultReminders` | `calendar.EventReminderOverride`[] | Default reminders applied to events that keep `useDefault`. |\n| <a id=\"property-emailaddress\"></a> `emailAddress` | `string` | Connected inbox address, for grouping in multi-inbox pickers. |\n| <a id=\"property-emaillinkid\"></a> `emailLinkId` | `string` | Connected inbox that syncs this calendar. |\n| <a id=\"property-id\"></a> `id` | `string` | Persisted Macro calendar identifier. |\n| <a id=\"property-isprimary\"></a> `isPrimary` | `boolean` | Whether this is its account's primary calendar. |\n| <a id=\"property-issubscription\"></a> `isSubscription` | `boolean` | Whether this is one of Google's shared system calendars (holidays, birthdays) the account subscribes to rather than one a person maintains. |\n| <a id=\"property-iswritable\"></a> `isWritable` | `boolean` | Whether the grant can create and modify events on this calendar. |\n| <a id=\"property-name\"></a> `name` | `string` | Provider display name. |\n| <a id=\"property-provider\"></a> `provider` | `CalendarProvider` | Calendar provider, for display and reconnect routing. |\n| <a id=\"property-syncerror\"></a> `syncError?` | `string` \\| `null` | A persistent sync failure isolated to this calendar, surfaced so the settings row can badge it. `None` while the calendar is syncing normally or a failure has not yet crossed the persistence threshold. |",
- "AiFeature": "# Type Alias: AiFeature\n\n> **AiFeature** = `\"chat\"` \\| `\"memory\"` \\| `\"automation\"` \\| `\"dynamic_completions_api\"` \\| `\"chat_rename\"` \\| `\"call_summary\"` \\| `\"channel_bot\"` \\| `\"ai_projection\"` \\| `\"ai_editing\"` \\| `\"import\"` \\| `\"agent_session\"` \\| `\"agent_repository_choice\"` \\| `\"agent_mode_choice\"` \\| `\"dictation\"` \\| `\"image_generation\"`\n\nEverything we use AI for. The wire / DB form of each variant is its\n`snake_case` name.",
+ "AiFeature": "# Type Alias: AiFeature\n\n> **AiFeature** = `\"chat\"` \\| `\"memory\"` \\| `\"automation\"` \\| `\"dynamic_completions_api\"` \\| `\"chat_rename\"` \\| `\"call_summary\"` \\| `\"channel_bot\"` \\| `\"ai_projection\"` \\| `\"ai_editing\"` \\| `\"import\"` \\| `\"agent_session\"` \\| `\"agent_repository_choice\"` \\| `\"agent_mode_choice\"` \\| `\"dictation\"` \\| `\"image_generation\"` \\| `\"email_focus\"`\n\nEverything we use AI for. The wire / DB form of each variant is its\n`snake_case` name.",
"CompletionUsage": "# Type Alias: CompletionUsage\n\n> **CompletionUsage** = \\{ `cost`: `Usage`; `entity?`: `string` \\| `null`; `feature`: `AiFeature`; `user`: `cognition.MacroUserIdStr`; \\}\n\nUser and feature attribution for one invocation.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-cost\"></a> `cost` | `Usage` | Measured usage and resolved cost. |\n| <a id=\"property-entity\"></a> `entity?` | `string` \\| `null` | Related entity, if any. |\n| <a id=\"property-feature\"></a> `feature` | `AiFeature` | Feature that performed the invocation. |\n| <a id=\"property-user\"></a> `user` | `cognition.MacroUserIdStr` | User the invocation was performed for. |",
"DatabaseChange": "# Type Alias: DatabaseChange\n\n> **DatabaseChange** = \\{ `kind`: `\"none\"`; \\} \\| \\{ `kind`: `\"schema\"`; \\} \\| \\{ `count`: `number`; `kind`: `\"rows\"`; \\}\n\nWhat a successful tool call committed to the user's databases.",
"DecisionRequest": "# Type Alias: DecisionRequest\n\n> **DecisionRequest** = \\{ `input`: `unknown`; `questions`: \\{\\[`key`: `string`\\]: `string`; \\}; \\}\n\nNamed yes/no questions to evaluate against one arbitrary JSON input.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-input\"></a> `input` | `unknown` | Data to classify. The entire compact request must fit in 64 KiB. |\n| <a id=\"property-questions\"></a> `questions` | \\{\\[`key`: `string`\\]: `string`; \\} | One to 32 questions, each at most 500 characters. Keys must be nonblank and at most 80 UTF-8 bytes; they are preserved in the response. |",
diff --git a/crates/ai_usage/src/domain/counting.rs b/crates/ai_usage/src/domain/counting.rs
index 79d1ad1999..5c4de5a771 100644
--- a/crates/ai_usage/src/domain/counting.rs
+++ b/crates/ai_usage/src/domain/counting.rs
@@ -35,14 +35,16 @@ impl AiUsageEnforcement {
/// Features whose provider costs are recorded but never consume allowances,
/// prepaid credits, or overage. Dictation is the Whispr transcription feature;
/// chat rename is the automatic title given to a new chat or agent session; agent
-/// mode choice is the Auto composer routing a prompt to Chat or Code.
-pub const NON_BILLABLE_AI_FEATURES: [AiFeature; 6] = [
+/// mode choice is the Auto composer routing a prompt to Chat or Code; email
+/// focus classifies incoming mail in the background.
+pub const NON_BILLABLE_AI_FEATURES: [AiFeature; 7] = [
AiFeature::Memory,
AiFeature::AiProjection,
AiFeature::CallSummary,
AiFeature::Dictation,
AiFeature::ChatRename,
AiFeature::AgentModeChoice,
+ AiFeature::EmailFocus,
];
/// Whether a feature's usage is billable, independent of enforcement or identity.
@@ -54,7 +56,8 @@ pub const fn is_billable_feature(feature: AiFeature) -> bool {
| AiFeature::CallSummary
| AiFeature::Dictation
| AiFeature::ChatRename
- | AiFeature::AgentModeChoice => false,
+ | AiFeature::AgentModeChoice
+ | AiFeature::EmailFocus => false,
AiFeature::Chat
| AiFeature::Automation
| AiFeature::DynamicCompletionsApi
diff --git a/crates/ai_usage/src/domain/counting/test.rs b/crates/ai_usage/src/domain/counting/test.rs
index 331e2a3395..7202c0252a 100644
--- a/crates/ai_usage/src/domain/counting/test.rs
+++ b/crates/ai_usage/src/domain/counting/test.rs
@@ -1,6 +1,6 @@
use super::*;
-const FEATURES: [(AiFeature, bool); 15] = [
+const FEATURES: [(AiFeature, bool); 16] = [
(AiFeature::Chat, true),
(AiFeature::Memory, false),
(AiFeature::Automation, true),
@@ -16,6 +16,7 @@ const FEATURES: [(AiFeature, bool); 15] = [
(AiFeature::AgentModeChoice, false),
(AiFeature::Dictation, false),
(AiFeature::ImageGeneration, true),
+ (AiFeature::EmailFocus, false),
];
#[test]
@@ -31,7 +32,7 @@ fn feature_classification_preserves_billing_policy() {
assert_eq!(is_billable_feature(feature), billable, "{feature:?}");
assert_eq!(NON_BILLABLE_AI_FEATURES.contains(&feature), !billable);
}
- assert_eq!(NON_BILLABLE_AI_FEATURES.len(), 6);
+ assert_eq!(NON_BILLABLE_AI_FEATURES.len(), 7);
}
#[test]
diff --git a/crates/ai_usage/src/domain/ports.rs b/crates/ai_usage/src/domain/ports.rs
index e780fbde9b..24163e2955 100644
--- a/crates/ai_usage/src/domain/ports.rs
+++ b/crates/ai_usage/src/domain/ports.rs
@@ -77,6 +77,8 @@ pub enum AiFeature {
Dictation,
/// Image generation and editing.
ImageGeneration,
+ /// Classifying signal email threads for the Focus view.
+ EmailFocus,
}
/// Strip a provider prefix from a routing id, yielding the bare model api id
diff --git a/crates/complete_graph/src/edges.rs b/crates/complete_graph/src/edges.rs
index ce7379333a..afa483aee2 100644
--- a/crates/complete_graph/src/edges.rs
+++ b/crates/complete_graph/src/edges.rs
@@ -15,8 +15,8 @@ use graphql_activity::{
};
use graphql_crm::{CrmRecord, GraphqlCrmPipelineEntry, load_pipeline_entries};
use graphql_email::{
- EmailContentKey, GraphqlSoupEmailMessage, SoupEmailEdgeReader,
- email_message_selection_requires_full_payload, load_email_messages,
+ EmailContentKey, GraphqlEmailThreadFocus, GraphqlSoupEmailMessage, SoupEmailEdgeReader,
+ email_message_selection_requires_full_payload, load_email_messages, load_email_thread_focus,
load_email_thread_mail_projection, load_email_thread_metadata, load_latest_email_message,
};
use graphql_favorite::{EntityFavoriteEdgeReader, load_entity_favorite};
@@ -583,6 +583,16 @@ where
.map(|timestamp| timestamp.to_rfc3339()))
}
+ /// The thread's Focus classification: whether it belongs in Focus, why,
+ /// and how important it is. `null` until the thread is classified, and
+ /// for threads in inboxes the viewer does not own.
+ async fn focus(
+ &self,
+ ctx: &Context<'_>,
+ ) -> async_graphql::Result<Option<GraphqlEmailThreadFocus>> {
+ load_email_thread_focus(ctx, self.thread_id).await
+ }
+
/// Timestamp of the latest outbound message, in RFC 3339 format: the SENT
/// view's sort key.
async fn latest_outbound_message_ts(
diff --git a/crates/complete_graph/src/lib.rs b/crates/complete_graph/src/lib.rs
index 915636fe02..63ea743364 100644
--- a/crates/complete_graph/src/lib.rs
+++ b/crates/complete_graph/src/lib.rs
@@ -34,14 +34,15 @@ pub use graphql_channel::{
pub use graphql_common::GraphqlRequestParts;
pub use graphql_email::{
DeleteEmailDraftInput, DeleteEmailDraftPayload, EmailContentKey, EmailContentLoad,
- EmailContentLoader, EmailMutationService, EmailServiceEmailContentReader,
- EmailThreadMailProjectionLoad, EmailThreadMailProjectionLoader, EmailThreadMetadataLoad,
- EmailThreadMetadataLoader, EmailThreadUnavailable, GraphqlEmailLabel, GraphqlEmailLink,
- GraphqlEmailLinkSettings, GraphqlEmailMutation, GraphqlEmailProvider, GraphqlEmailQuery,
- GraphqlEmailSyncStatus, MarkEmailThreadSeenInput, NoOpSoupEmailContentEdgeReader,
- SaveEmailDraftContactInput, SaveEmailDraftInput, SaveEmailDraftPayload,
- SoupEmailContentEdgeReader, SoupEmailEdgeReader, SoupEmailThreadMailProjectionEdgeReader,
- SoupEmailThreadMetadataEdgeReader, UpdateEmailThreadLabelInput, email_content_loader,
+ EmailContentLoader, EmailFocusContext, EmailFocusReader, EmailMutationService,
+ EmailServiceEmailContentReader, EmailThreadFocusLoader, EmailThreadMailProjectionLoad,
+ EmailThreadMailProjectionLoader, EmailThreadMetadataLoad, EmailThreadMetadataLoader,
+ EmailThreadUnavailable, GraphqlEmailLabel, GraphqlEmailLink, GraphqlEmailLinkSettings,
+ GraphqlEmailMutation, GraphqlEmailProvider, GraphqlEmailQuery, GraphqlEmailSyncStatus,
+ MarkEmailThreadSeenInput, NoOpSoupEmailContentEdgeReader, SaveEmailDraftContactInput,
+ SaveEmailDraftInput, SaveEmailDraftPayload, SoupEmailContentEdgeReader, SoupEmailEdgeReader,
+ SoupEmailThreadMailProjectionEdgeReader, SoupEmailThreadMetadataEdgeReader,
+ UpdateEmailThreadLabelInput, email_content_loader, email_thread_focus_loader,
email_thread_mail_projection_loader, email_thread_metadata_loader,
};
pub use graphql_entity_mutation::{
diff --git a/crates/complete_graph/src/schema.rs b/crates/complete_graph/src/schema.rs
index 1c7c57ff8a..b49bbf27dd 100644
--- a/crates/complete_graph/src/schema.rs
+++ b/crates/complete_graph/src/schema.rs
@@ -32,6 +32,7 @@ use graphql_channel::{
use graphql_common::{GraphqlSoupEntityType, parse_id, require_authorized_user};
use graphql_email::{
GraphqlEmailMutation, GraphqlEmailQuery, NoOpSoupEmailContentEdgeReader, SoupEmailEdgeReader,
+ load_email_focus_thread_ids,
};
use graphql_entity_mutation::EntityMutationRoot;
use graphql_favorite::{
@@ -58,8 +59,8 @@ use graphql_soup::{
GraphqlSoupAgentSession, GraphqlSoupEmailThread, GraphqlSoupEntity, GraphqlSoupInitiative,
GraphqlSoupProject, GroupedSoup, GroupedSoupInput, SoupEmailThreadMutationOutput,
SoupEntityEdges, SoupInput, SoupPage, SoupPatch, resolve_folders, resolve_grouped_soup,
- resolve_soup, resolve_soup_agent_session, resolve_soup_email_thread, resolve_soup_entity,
- resolve_soup_updates,
+ resolve_soup, resolve_soup_agent_session, resolve_soup_email_thread,
+ resolve_soup_email_threads, resolve_soup_entity, resolve_soup_updates,
};
use graphql_work_feed::{
GraphqlWorkFeedPage, WorkFeedInput, WorkFeedMutationRoot, WorkFeedSubscriptionRoot,
@@ -925,6 +926,26 @@ where
.await
}
+ /// The viewer's Focus: signal threads in their own inboxes worth their
+ /// attention, highest priority first (importance, halved for every 2 days
+ /// since the latest inbound mail), with mail in the last `days` days
+ /// (default 30, at most 90). Each thread's `focus` field explains why.
+ async fn email_focus(
+ &self,
+ ctx: &Context<'_>,
+ days: Option<i32>,
+ ) -> async_graphql::Result<Vec<GraphqlSoupEmailThread<SoupEdges<NR, PR, ER, FR, AR, AcR>>>>
+ {
+ let days = u16::try_from(days.unwrap_or(30).clamp(1, 90)).unwrap_or(30);
+ let thread_ids = load_email_focus_thread_ids(ctx, &self.user_id, days).await?;
+ resolve_soup_email_threads::<SoupEdges<NR, PR, ER, FR, AR, AcR>>(
+ ctx,
+ self.user_id.clone(),
+ thread_ids,
+ )
+ .await
+ }
+
/// Fetch one accessible agent session by id, with its protocol log
/// reachable through `log`.
async fn agent_session(
diff --git a/crates/email/fixtures/email_focus.sql b/crates/email/fixtures/email_focus.sql
new file mode 100644
index 0000000000..78acb84b5b
--- /dev/null
+++ b/crates/email/fixtures/email_focus.sql
@@ -0,0 +1,87 @@
+-- Fixture for the Focus repository (email crate, outbound/focus_pg).
+--
+-- Link f01 is [email protected]; link f02 is [email protected].
+-- Thread f201: signal, in inbox. Casey wrote, the owner replied, Casey wrote
+-- again, and a later message from Casey is in the trash.
+-- Thread f202: signal but archived.
+-- Thread f203: in inbox but not signal.
+-- Thread f204: signal bulk mail (List-Unsubscribe) from [email protected].
+-- Thread f205: the owner's own "No thanks" to [email protected].
+-- Thread f206: signal, in inbox, but its mail is 60 days old.
+-- Thread f207: signal, in inbox, on the other link.
+
+INSERT INTO email_links (id, macro_id, fusionauth_user_id, email_address, provider, is_sync_active, created_at, updated_at)
+VALUES ('00000000-0000-0000-0000-000000000f01', 'macro|[email protected]', '00000000-0000-0000-0000-000000000f01',
+ '[email protected]', 'GMAIL', true, NOW(), NOW()),
+ ('00000000-0000-0000-0000-000000000f02', 'macro|[email protected]', '00000000-0000-0000-0000-000000000f02',
+ '[email protected]', 'GMAIL', true, NOW(), NOW());
+
+INSERT INTO email_contacts (id, link_id, email_address, name, created_at, updated_at)
+VALUES ('00000000-0000-0000-0000-0000000cf001', '00000000-0000-0000-0000-000000000f01', '[email protected]', 'Casey', NOW(), NOW()),
+ ('00000000-0000-0000-0000-0000000cf002', '00000000-0000-0000-0000-000000000f01', '[email protected]', 'Owner', NOW(), NOW()),
+ ('00000000-0000-0000-0000-0000000cf003', '00000000-0000-0000-0000-000000000f01', '[email protected]', 'Jacob', NOW(), NOW()),
+ ('00000000-0000-0000-0000-0000000cf004', '00000000-0000-0000-0000-000000000f01', '[email protected]', NULL, NOW(), NOW()),
+ ('00000000-0000-0000-0000-0000000cf005', '00000000-0000-0000-0000-000000000f02', '[email protected]', NULL, NOW(), NOW());
+
+INSERT INTO email_labels (id, link_id, provider_label_id, name, created_at)
+VALUES ('00000000-0000-0000-0000-0000000bf001', '00000000-0000-0000-0000-000000000f01', 'TRASH', 'TRASH', NOW());
+
+INSERT INTO email_threads (id, link_id, inbox_visible, is_read, is_signal, latest_inbound_message_ts, latest_outbound_message_ts, created_at, updated_at)
+VALUES ('00000000-0000-0000-0000-00000000f201', '00000000-0000-0000-0000-000000000f01', true, false, true,
+ NOW() - INTERVAL '20 hours', NOW() - INTERVAL '1 day', NOW(), NOW()),
+ ('00000000-0000-0000-0000-00000000f202', '00000000-0000-0000-0000-000000000f01', false, true, true,
+ NULL, NULL, NOW(), NOW()),
+ ('00000000-0000-0000-0000-00000000f203', '00000000-0000-0000-0000-000000000f01', true, false, false,
+ NOW() - INTERVAL '2 hours', NULL, NOW(), NOW()),
+ ('00000000-0000-0000-0000-00000000f204', '00000000-0000-0000-0000-000000000f01', true, false, true,
+ NOW() - INTERVAL '3 days', NULL, NOW(), NOW()),
+ ('00000000-0000-0000-0000-00000000f205', '00000000-0000-0000-0000-000000000f01', false, true, true,
+ NULL, NOW() - INTERVAL '4 days', NOW(), NOW()),
+ ('00000000-0000-0000-0000-00000000f206', '00000000-0000-0000-0000-000000000f01', true, false, true,
+ NOW() - INTERVAL '60 days', NULL, NOW(), NOW()),
+ ('00000000-0000-0000-0000-00000000f207', '00000000-0000-0000-0000-000000000f02', true, false, true,
+ NOW() - INTERVAL '1 hour', NULL, NOW(), NOW());
+
+INSERT INTO email_messages (id, thread_id, link_id, provider_id, global_id, is_sent, from_contact_id, from_name,
+ internal_date_ts, subject, body_text, headers_jsonb,
+ has_attachments, is_read, is_starred, is_draft, created_at, updated_at)
+VALUES ('00000000-0000-0000-0000-00000000f501', '00000000-0000-0000-0000-00000000f201', '00000000-0000-0000-0000-000000000f01',
+ 'p-f501', 'g-f501', false, '00000000-0000-0000-0000-0000000cf001', NULL,
+ NOW() - INTERVAL '2 days', 'Unpaid invoice', 'Can you approve the invoice?', '[]'::jsonb,
+ true, true, false, false, NOW(), NOW()),
+ ('00000000-0000-0000-0000-00000000f502', '00000000-0000-0000-0000-00000000f201', '00000000-0000-0000-0000-000000000f01',
+ 'p-f502', 'g-f502', true, '00000000-0000-0000-0000-0000000cf002', 'Owner',
+ NOW() - INTERVAL '1 day', 'Re: Unpaid invoice', 'Thanks, I will take a look today.', NULL,
+ false, true, false, false, NOW(), NOW()),
+ ('00000000-0000-0000-0000-00000000f503', '00000000-0000-0000-0000-00000000f201', '00000000-0000-0000-0000-000000000f01',
+ 'p-f503', 'g-f503', false, '00000000-0000-0000-0000-0000000cf001', 'Casey C.',
+ NOW() - INTERVAL '20 hours', 'Re: Unpaid invoice', 'Any update?', '[{"name": "Precedence", "value": "normal"}]'::jsonb,
+ false, false, false, false, NOW(), NOW()),
+ ('00000000-0000-0000-0000-00000000f504', '00000000-0000-0000-0000-00000000f201', '00000000-0000-0000-0000-000000000f01',
+ 'p-f504', 'g-f504', false, '00000000-0000-0000-0000-0000000cf001', NULL,
+ NOW() - INTERVAL '10 hours', 'Re: Unpaid invoice', 'Trashed follow-up', NULL,
+ false, false, false, false, NOW(), NOW()),
+ ('00000000-0000-0000-0000-00000000f505', '00000000-0000-0000-0000-00000000f204', '00000000-0000-0000-0000-000000000f01',
+ 'p-f505', 'g-f505', false, '00000000-0000-0000-0000-0000000cf004', 'Sam Seller',
+ NOW() - INTERVAL '3 days', 'Quick question', 'Worth a chat?',
+ '[{"name": "List-Unsubscribe", "value": "<mailto:[email protected]>"}]'::jsonb,
+ false, false, false, false, NOW(), NOW()),
+ ('00000000-0000-0000-0000-00000000f506', '00000000-0000-0000-0000-00000000f205', '00000000-0000-0000-0000-000000000f01',
+ 'p-f506', 'g-f506', true, '00000000-0000-0000-0000-0000000cf002', 'Owner',
+ NOW() - INTERVAL '4 days', 'Re: Earlier pitch', 'No thanks', NULL,
+ false, true, false, false, NOW(), NOW()),
+ ('00000000-0000-0000-0000-00000000f507', '00000000-0000-0000-0000-00000000f207', '00000000-0000-0000-0000-000000000f02',
+ 'p-f507', 'g-f507', false, '00000000-0000-0000-0000-0000000cf005', NULL,
+ NOW() - INTERVAL '1 hour', 'Hi', 'Hello there', NULL,
+ false, false, false, false, NOW(), NOW());
+
+INSERT INTO email_message_recipients (message_id, contact_id, recipient_type)
+VALUES ('00000000-0000-0000-0000-00000000f501', '00000000-0000-0000-0000-0000000cf002', 'TO'),
+ ('00000000-0000-0000-0000-00000000f501', '00000000-0000-0000-0000-0000000cf003', 'CC'),
+ ('00000000-0000-0000-0000-00000000f502', '00000000-0000-0000-0000-0000000cf001', 'TO'),
+ ('00000000-0000-0000-0000-00000000f503', '00000000-0000-0000-0000-0000000cf002', 'TO'),
+ ('00000000-0000-0000-0000-00000000f505', '00000000-0000-0000-0000-0000000cf002', 'TO'),
+ ('00000000-0000-0000-0000-00000000f506', '00000000-0000-0000-0000-0000000cf004', 'TO');
+
+INSERT INTO email_message_labels (message_id, label_id)
+VALUES ('00000000-0000-0000-0000-00000000f504', '00000000-0000-0000-0000-0000000bf001');
diff --git a/crates/email/fixtures/email_focus_linked.sql b/crates/email/fixtures/email_focus_linked.sql
new file mode 100644
index 0000000000..0e182e7152
--- /dev/null
+++ b/crates/email/fixtures/email_focus_linked.sql
@@ -0,0 +1,10 @@
+-- Fixture for the Focus repository (email crate, outbound/focus_pg), loaded
+-- after email_focus: link f02 ([email protected]) is linked to the
+-- [email protected] account, as a secondary inbox Soup lists for that owner.
+
+SET session_replication_role = 'replica';
+
+INSERT INTO macro_user_links (primary_macro_id, child_macro_id, link_id)
+VALUES ('macro|[email protected]', 'macro|[email protected]', '00000000-0000-0000-0000-000000000f02');
+
+SET session_replication_role = 'origin';
diff --git a/crates/email/src/domain.rs b/crates/email/src/domain.rs
index 0d48964843..3aae5dc704 100644
--- a/crates/email/src/domain.rs
+++ b/crates/email/src/domain.rs
@@ -6,6 +6,8 @@ pub mod calendar_invitation_parser;
pub mod event_forward;
pub mod events;
#[cfg(feature = "ports")]
+pub mod focus;
+#[cfg(feature = "ports")]
pub mod followup;
#[cfg(feature = "ports")]
pub mod forwarded_attachments;
diff --git a/crates/email/src/domain/focus.rs b/crates/email/src/domain/focus.rs
new file mode 100644
index 0000000000..c400dbfa0b
--- /dev/null
+++ b/crates/email/src/domain/focus.rs
@@ -0,0 +1,26 @@
+//! Focus: which signal threads deserve the owner's attention.
+//!
+//! Each signal thread is classified on every new message. Jev, a yes/no
+//! classifier, answers a fixed set of questions about the thread with the
+//! owner's stored memory as context; a deterministic rule then turns those
+//! answers and the owner's relationship with the sender into a verdict: in or
+//! out of Focus, a category, reply-needed and follow-up flags, and a 0-100
+//! importance score. Only inboxes on the worker's allowlist are classified.
+
+mod input;
+mod models;
+mod ports;
+mod questions;
+mod rule;
+mod service;
+mod signals;
+
+pub use input::{is_dismissive_reply, new_text};
+pub use models::{
+ FocusAnswers, FocusCategory, FocusInbox, FocusMail, FocusMessage, FocusRecord, FocusSignals,
+ FocusThread, FocusVerdict, SentNote, StaleThread, ThreadFocus,
+};
+pub use ports::{FocusClassifier, FocusClassifierError, FocusStore, ProfileSource};
+pub use questions::{FOCUS_QUESTIONS, FocusQuestion};
+pub use rule::{decide, is_calendar_subject};
+pub use service::{ClassifyOutcome, FocusQueries, FocusService, SweepReport};
diff --git a/crates/email/src/domain/focus/input.rs b/crates/email/src/domain/focus/input.rs
new file mode 100644
index 0000000000..e7af63fe7e
--- /dev/null
+++ b/crates/email/src/domain/focus/input.rs
@@ -0,0 +1,146 @@
+//! What Jev reads about a thread: the owner's profile and the latest messages.
+
+use serde_json::{Value, json};
+
+use super::models::{FocusMessage, FocusThread};
+
+/// Messages shown to Jev, counting back from the latest.
+const SHOWN_MESSAGES: usize = 3;
+/// Characters of text per shown message.
+const MESSAGE_CHARS: usize = 1_500;
+/// New text shorter than this is a bump ("waiting to hear back"); Jev gets the
+/// whole body instead, so the original request is still in view.
+const BUMP_CHARS: usize = 200;
+/// Characters of the owner's profile passed as context.
+const PROFILE_CHARS: usize = 30_000;
+/// To and Cc addresses shown per message; a distribution list stays readable.
+const SHOWN_RECIPIENTS: usize = 20;
+/// Replies longer than this are never brush-offs.
+const BRUSH_OFF_WORDS: usize = 20;
+/// Words that make a short reply a brush-off rather than a conversation.
+const BRUSH_OFF_PHRASES: [&str; 5] = [
+ "not interested",
+ "no thanks",
+ "no thank you",
+ "unsubscribe",
+ "remove me",
+];
+
+/// The part of a plain-text body above the quoted history.
+pub fn new_text(body: &str) -> String {
+ let mut kept = Vec::new();
+ for line in body.lines() {
+ let trimmed = line.trim();
+ if starts_quoted_history(trimmed) {
+ break;
+ }
+ if trimmed.starts_with('>') {
+ continue;
+ }
+ kept.push(trimmed);
+ }
+ kept.join("\n").trim().to_owned()
+}
+
+fn starts_quoted_history(line: &str) -> bool {
+ (line.starts_with("On ") && line.ends_with("wrote:") && line.len() <= 250)
+ || (line.starts_with("--") && line.contains("Original Message"))
+ || line.starts_with("From: ")
+ || line.starts_with("_____")
+ || line.starts_with("Sent from my ")
+}
+
+/// Whether a reply only turns the sender away ("I'm not interested", "No thanks").
+pub fn is_dismissive_reply(text: &str) -> bool {
+ let lowered = text.to_lowercase();
+ if lowered.split_whitespace().count() > BRUSH_OFF_WORDS {
+ return false;
+ }
+ let bare = lowered.trim().trim_end_matches(['.', '!']);
+ matches!(bare, "no" | "stop")
+ || BRUSH_OFF_PHRASES
+ .iter()
+ .any(|phrase| contains_words(&lowered, phrase))
+}
+
+/// `phrase` appears in `text` as whole words.
+fn contains_words(text: &str, phrase: &str) -> bool {
+ text.match_indices(phrase).any(|(start, matched)| {
+ let before = text[..start].chars().next_back();
+ let after = text[start + matched.len()..].chars().next();
+ !before.is_some_and(char::is_alphanumeric) && !after.is_some_and(char::is_alphanumeric)
+ })
+}
+
+fn truncate(text: &str, chars: usize) -> &str {
+ text.char_indices()
+ .nth(chars)
+ .map_or(text, |(end, _)| &text[..end])
+}
+
+/// The text Jev reads for one message: the new part, or the whole body when
+/// the new part is only a bump.
+fn message_text(message: &FocusMessage) -> String {
+ let body = message.body.as_deref().unwrap_or_default();
+ let new = new_text(body);
+ let text = if new.chars().count() < BUMP_CHARS {
+ match body.trim() {
+ "" => message.snippet.clone().unwrap_or_default(),
+ whole => whole.to_owned(),
+ }
+ } else {
+ new
+ };
+ let collapsed = text.split_whitespace().collect::<Vec<_>>().join(" ");
+ truncate(&collapsed, MESSAGE_CHARS).to_owned()
+}
+
+fn sender(message: &FocusMessage) -> String {
+ let address = message.from_email.as_deref().unwrap_or_default();
+ match message.from_name.as_deref().map(str::trim) {
+ Some(name) if !name.is_empty() => format!("{name} <{address}>"),
+ _ => format!("<{address}>"),
+ }
+}
+
+fn message_json(message: &FocusMessage) -> Value {
+ let to = &message.to[..message.to.len().min(SHOWN_RECIPIENTS)];
+ let cc = &message.cc[..message.cc.len().min(SHOWN_RECIPIENTS)];
+ let mut json = json!({
+ "from": sender(message),
+ "sent_by_recipient": message.is_sent,
+ "to": to,
+ "cc": cc,
+ "date": message.at.format("%Y-%m-%dT%H:%M").to_string(),
+ "has_attachments": message.has_attachments,
+ "bulk_mail_headers": message.bulk,
+ "text": message_text(message),
+ });
+ let omitted = message.to.len() + message.cc.len() - to.len() - cc.len();
+ if omitted > 0 {
+ json["other_recipients"] = json!(omitted);
+ }
+ json
+}
+
+/// The JSON state Jev classifies: the owner's profile and the thread's latest messages.
+pub(super) fn jev_input(thread: &FocusThread, profile: Option<&str>) -> Value {
+ let mut recipient = format!("The recipient's address is {}.", thread.owner_email);
+ if let Some(profile) = profile.map(str::trim).filter(|profile| !profile.is_empty()) {
+ recipient.push_str("\n\n");
+ recipient.push_str(truncate(profile, PROFILE_CHARS));
+ }
+ let shown = &thread.messages[thread.messages.len().saturating_sub(SHOWN_MESSAGES)..];
+ json!({
+ "recipient": recipient,
+ "thread": {
+ "subject": thread.messages.first().and_then(|message| message.subject.as_deref()),
+ "message_count": thread.messages.len(),
+ "earlier_messages_omitted": thread.messages.len() - shown.len(),
+ "messages": shown.iter().map(message_json).collect::<Vec<_>>(),
+ },
+ })
+}
+
+#[cfg(test)]
+mod test;
diff --git a/crates/email/src/domain/focus/input/test.rs b/crates/email/src/domain/focus/input/test.rs
new file mode 100644
index 0000000000..42f7ed4a4a
--- /dev/null
+++ b/crates/email/src/domain/focus/input/test.rs
@@ -0,0 +1,136 @@
+use chrono::{TimeZone, Utc};
+use uuid::Uuid;
+
+use super::*;
+use crate::domain::focus::models::FocusThread;
+
+fn message(body: &str, is_sent: bool) -> FocusMessage {
+ FocusMessage {
+ id: Uuid::new_v4(),
+ at: Utc.with_ymd_and_hms(2026, 10, 6, 21, 31, 47).unwrap(),
+ is_sent,
+ from_email: Some("[email protected]".to_owned()),
+ from_name: Some("Ava".to_owned()),
+ to: vec!["[email protected]".to_owned()],
+ cc: Vec::new(),
+ subject: Some("Contract".to_owned()),
+ has_attachments: false,
+ bulk: false,
+ body: Some(body.to_owned()),
+ snippet: Some("snippet".to_owned()),
+ }
+}
+
+fn thread(messages: Vec<FocusMessage>) -> FocusThread {
+ FocusThread {
+ thread_id: Uuid::new_v4(),
+ link_id: Uuid::new_v4(),
+ owner: macro_user_id::user_id::MacroUserIdStr::try_from_email("[email protected]")
+ .unwrap(),
+ owner_email: "[email protected]".to_owned(),
+ is_signal: true,
+ inbox_visible: true,
+ classified_message_id: None,
+ messages,
+ sent_notes: Vec::new(),
+ }
+}
+
+#[test]
+fn new_text_drops_quoted_history() {
+ let body = "Sounds good, see you Monday.\n\nOn Mon, Oct 5, 2026 at 9:00 AM Ava <[email protected]> wrote:\n> Can we meet?\n> Thanks";
+ assert_eq!(new_text(body), "Sounds good, see you Monday.");
+ assert_eq!(new_text("> only quoted\n> lines"), "");
+ assert_eq!(new_text("Thanks!\n\nSent from my iPhone\nmore"), "Thanks!");
+ assert_eq!(new_text("Hi\n-----Original Message-----\nFrom: x"), "Hi");
+}
+
+#[test]
+fn brush_offs() {
+ for reply in [
+ "I'm not interested",
+ "No Thanks",
+ "no.",
+ "Please remove me from this list",
+ "STOP",
+ ] {
+ assert!(is_dismissive_reply(reply), "{reply}");
+ }
+ for reply in [
+ "Hey Basil! Really sorry, I'll see you tomorrow.",
+ "Notice the stopwatch",
+ "Sure, stop by at 3pm",
+ "Not interested in GPU infrastructure, but we would love to chat about our CI pipeline and the contract terms next week, could you send over the details please",
+ "No problem, take your time",
+ ] {
+ assert!(!is_dismissive_reply(reply), "{reply}");
+ }
+}
+
+#[test]
+fn shows_the_last_three_messages_with_the_profile() {
+ let thread = thread(vec![
+ message("one", false),
+ message("two", true),
+ message("three", false),
+ message("four", false),
+ ]);
+ let input = jev_input(&thread, Some("Owner leads engineering at Acme."));
+ assert_eq!(
+ input["recipient"],
+ "The recipient's address is [email protected].\n\nOwner leads engineering at Acme."
+ );
+ assert_eq!(input["thread"]["message_count"], 4);
+ assert_eq!(input["thread"]["earlier_messages_omitted"], 1);
+ let shown = input["thread"]["messages"].as_array().unwrap();
+ assert_eq!(shown.len(), 3);
+ assert_eq!(shown[0]["sent_by_recipient"], true);
+ assert_eq!(shown[0]["from"], "Ava <[email protected]>");
+ assert_eq!(shown[0]["date"], "2026-10-06T21:31");
+ assert_eq!(input["thread"]["subject"], "Contract");
+}
+
+#[test]
+fn a_bump_shows_the_quoted_request() {
+ let bump = "waiting to hear back\n\nOn Sun, 16 Aug 2026 at 23:55, Sam <[email protected]> wrote:\n> The /proxy endpoint fetches any URL unauthenticated.";
+ let thread = thread(vec![message(bump, false)]);
+ let text = jev_input(&thread, None)["thread"]["messages"][0]["text"]
+ .as_str()
+ .unwrap()
+ .to_owned();
+ assert!(text.contains("fetches any URL"), "{text}");
+}
+
+#[test]
+fn long_text_is_cut_on_a_character_boundary() {
+ let long = "é".repeat(MESSAGE_CHARS + 500);
+ let thread = thread(vec![message(&long, false)]);
+ let text = jev_input(&thread, None)["thread"]["messages"][0]["text"]
+ .as_str()
+ .unwrap()
+ .to_owned();
+ assert_eq!(text.chars().count(), MESSAGE_CHARS);
+}
+
+#[test]
+fn no_profile_means_address_only() {
+ let thread = thread(vec![message("hello there", false)]);
+ assert_eq!(
+ jev_input(&thread, Some(" "))["recipient"],
+ "The recipient's address is [email protected]."
+ );
+}
+
+#[test]
+fn long_recipient_lists_are_cut() {
+ let mut list = message("Quarterly all-hands notes", false);
+ list.to = (0..30).map(|n| format!("person{n}@acme.example")).collect();
+ list.cc = vec!["[email protected]".to_owned()];
+ let shown = &jev_input(&thread(vec![list]), None)["thread"]["messages"][0];
+ assert_eq!(shown["to"].as_array().unwrap().len(), SHOWN_RECIPIENTS);
+ assert_eq!(shown["cc"], json!(["[email protected]"]));
+ assert_eq!(shown["other_recipients"], 10);
+
+ let short = &jev_input(&thread(vec![message("hi", false)]), None)["thread"]["messages"][0];
+ assert!(short.get("other_recipients").is_none());
+}
diff --git a/crates/email/src/domain/focus/models.rs b/crates/email/src/domain/focus/models.rs
new file mode 100644
index 0000000000..f543c875a9
--- /dev/null
+++ b/crates/email/src/domain/focus/models.rs
@@ -0,0 +1,266 @@
+//! Focus value objects.
+
+use chrono::{DateTime, Utc};
+use macro_user_id::user_id::MacroUserIdStr;
+use serde::{Deserialize, Serialize};
+use strum::{Display, EnumString};
+use uuid::Uuid;
+
+use super::questions::FocusQuestion;
+
+/// Why a thread is in or out of Focus. The first four are Focus categories;
+/// the rest name the reason a thread was left out. None depends on the owner's
+/// line of work: who the mail is from comes from their own history.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Display, EnumString)]
+#[serde(rename_all = "snake_case")]
+#[strum(serialize_all = "snake_case")]
+pub enum FocusCategory {
+ /// A customer, client or user asking for help or giving feedback.
+ Customer,
+ /// Mail from someone at the owner's own company.
+ Team,
+ /// Mail from someone the owner corresponds with.
+ Known,
+ /// Relevant mail that fits no narrower category.
+ Other,
+ /// A calendar invite, update or RSVP.
+ Calendar,
+ /// Unsolicited outreach: a pitch, recruiting or a job application.
+ Outreach,
+ /// Automated, bulk or templated mail.
+ Automated,
+ /// Nothing marks the thread as relevant.
+ LowRelevance,
+}
+
+/// Jev's probability of "yes", from 0 to 1, for each Focus question.
+#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
+pub struct FocusAnswers {
+ /// Would the owner want this in a short Focus inbox?
+ pub focus: f32,
+ /// Is it unsolicited outreach from a stranger?
+ pub outreach: f32,
+ /// Is it automated, bulk or templated mail?
+ pub automated: f32,
+ /// Is it a customer, client or user asking for help or giving feedback?
+ pub customer: f32,
+ /// Is it only a calendar invite, update or RSVP?
+ pub calendar_rsvp: f32,
+ /// Does it ask for a decision only the owner can make?
+ pub needs_decision: f32,
+ /// Does the latest message ask the owner something unanswered?
+ pub needs_response: f32,
+ /// Is there an open loop the owner should come back to?
+ pub needs_follow_up: f32,
+}
+
+impl FocusAnswers {
+ /// Answers in [`FocusQuestion::ALL`] order, or `None` when the count is wrong.
+ pub fn from_probabilities(probabilities: &[f32]) -> Option<Self> {
+ let [
+ focus,
+ outreach,
+ automated,
+ customer,
+ calendar_rsvp,
+ needs_decision,
+ needs_response,
+ needs_follow_up,
+ ] = <[f32; FocusQuestion::ALL.len()]>::try_from(probabilities).ok()?;
+ Some(Self {
+ focus,
+ outreach,
+ automated,
+ customer,
+ calendar_rsvp,
+ needs_decision,
+ needs_response,
+ needs_follow_up,
+ })
+ }
+}
+
+/// What the owner's history says about a thread, independent of its words.
+#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
+pub struct FocusSignals {
+ /// The owner corresponds with the sender: they wrote to them for real,
+ /// replied in this thread, or a teammate is on it. Brushed-off senders
+ /// never count, and neither does a teammate on bulk mail.
+ pub contact: bool,
+ /// The owner sent anything in the thread after its first incoming message.
+ pub replied: bool,
+ /// A sender shares the owner's company domain.
+ pub teammate: bool,
+ /// The thread's latest message is the owner's.
+ pub latest_from_owner: bool,
+ /// The subject reads as a calendar invite or RSVP.
+ pub calendar_subject: bool,
+}
+
+/// The rule's decision about one thread.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
+pub struct FocusVerdict {
+ /// Whether the thread belongs in Focus.
+ pub is_focus: bool,
+ /// The Focus category, or why the thread was left out.
+ pub category: FocusCategory,
+ /// A Focus thread whose latest message waits on the owner's answer.
+ pub needs_reply: bool,
+ /// A Focus thread with an open loop to come back to.
+ pub needs_follow_up: bool,
+ /// Sort key for the Focus list, 0 to 100.
+ pub importance: u8,
+}
+
+/// One message as the classifier needs it.
+#[derive(Debug, Clone, PartialEq)]
+pub struct FocusMessage {
+ /// Message row id.
+ pub id: Uuid,
+ /// Provider receive time.
+ pub at: DateTime<Utc>,
+ /// Sent by the owner.
+ pub is_sent: bool,
+ /// Sender address.
+ pub from_email: Option<String>,
+ /// Sender display name.
+ pub from_name: Option<String>,
+ /// `To` addresses.
+ pub to: Vec<String>,
+ /// `Cc` addresses.
+ pub cc: Vec<String>,
+ /// Subject header.
+ pub subject: Option<String>,
+ /// Whether the message carries attachments.
+ pub has_attachments: bool,
+ /// Whether its headers mark it as mailing-list or bulk mail.
+ pub bulk: bool,
+ /// Plain-text body, truncated by the store.
+ pub body: Option<String>,
+ /// Provider snippet.
+ pub snippet: Option<String>,
+}
+
+/// A message the owner sent to one of the thread's senders, anywhere in the inbox.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct SentNote {
+ /// The recipient, lowercased.
+ pub recipient: String,
+ /// Plain-text body, truncated by the store.
+ pub body: Option<String>,
+}
+
+/// Where a thread lives and how it stands; read before any message content.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct FocusInbox {
+ /// Thread row id.
+ pub thread_id: Uuid,
+ /// Inbox that holds the thread.
+ pub link_id: Uuid,
+ /// Owner of that inbox.
+ pub owner: MacroUserIdStr<'static>,
+ /// The inbox's address, lowercased.
+ pub owner_email: String,
+ /// Whether the thread is in the signal inbox.
+ pub is_signal: bool,
+ /// Whether the thread is still in the inbox.
+ pub inbox_visible: bool,
+ /// Message the stored result is based on, when one exists.
+ pub classified_message_id: Option<Uuid>,
+}
+
+/// A thread's mail and the owner's sent mail to its senders.
+#[derive(Debug, Clone, Default, PartialEq)]
+pub struct FocusMail {
+ /// Non-draft, non-trashed messages, oldest first.
+ pub messages: Vec<FocusMessage>,
+ /// The owner's sent mail to this thread's senders, newest first.
+ pub sent_notes: Vec<SentNote>,
+}
+
+/// Everything the classifier reads about one thread.
+#[derive(Debug, Clone, PartialEq)]
+pub struct FocusThread {
+ /// Thread row id.
+ pub thread_id: Uuid,
+ /// Inbox that holds the thread.
+ pub link_id: Uuid,
+ /// Owner of that inbox.
+ pub owner: MacroUserIdStr<'static>,
+ /// The inbox's address.
+ pub owner_email: String,
+ /// Whether the thread is in the signal inbox.
+ pub is_signal: bool,
+ /// Whether the thread is still in the inbox.
+ pub inbox_visible: bool,
+ /// Message the stored result is based on, when one exists.
+ pub classified_message_id: Option<Uuid>,
+ /// Non-draft, non-trashed messages, oldest first.
+ pub messages: Vec<FocusMessage>,
+ /// The owner's sent mail to this thread's senders, newest first.
+ pub sent_notes: Vec<SentNote>,
+}
+
+impl FocusThread {
+ /// Join a thread's inbox facts with its mail.
+ pub fn new(inbox: FocusInbox, mail: FocusMail) -> Self {
+ Self {
+ thread_id: inbox.thread_id,
+ link_id: inbox.link_id,
+ owner: inbox.owner,
+ owner_email: inbox.owner_email,
+ is_signal: inbox.is_signal,
+ inbox_visible: inbox.inbox_visible,
+ classified_message_id: inbox.classified_message_id,
+ messages: mail.messages,
+ sent_notes: mail.sent_notes,
+ }
+ }
+}
+
+/// A signal thread whose stored classification may be out of date.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub struct StaleThread {
+ /// Thread row id.
+ pub thread_id: Uuid,
+ /// The thread's latest mail activity, as the thread row records it.
+ pub latest_at: DateTime<Utc>,
+}
+
+/// A classification to store.
+#[derive(Debug, Clone, PartialEq)]
+pub struct FocusRecord {
+ /// Classified thread.
+ pub thread_id: Uuid,
+ /// Inbox that holds the thread.
+ pub link_id: Uuid,
+ /// The thread's latest message when it was classified.
+ pub classified_message_id: Uuid,
+ /// That message's receive time.
+ pub classified_message_ts: DateTime<Utc>,
+ /// The rule's decision.
+ pub verdict: FocusVerdict,
+ /// Jev's raw answers.
+ pub answers: FocusAnswers,
+ /// Model that answered.
+ pub model: String,
+ /// When the classification was made.
+ pub classified_at: DateTime<Utc>,
+}
+
+/// A stored classification, as the Focus view reads it.
+#[derive(Debug, Clone, PartialEq, Eq)]
+pub struct ThreadFocus {
+ /// Whether the thread belongs in Focus.
+ pub is_focus: bool,
+ /// The Focus category, or why the thread was left out.
+ pub category: FocusCategory,
+ /// Sort key, 0 to 100.
+ pub importance: u8,
+ /// The latest message waits on the owner's answer.
+ pub needs_reply: bool,
+ /// An open loop to come back to.
+ pub needs_follow_up: bool,
+ /// When the classification was made.
+ pub classified_at: DateTime<Utc>,
+}
diff --git a/crates/email/src/domain/focus/ports.rs b/crates/email/src/domain/focus/ports.rs
new file mode 100644
index 0000000000..873e1cb7dc
--- /dev/null
+++ b/crates/email/src/domain/focus/ports.rs
@@ -0,0 +1,94 @@
+//! Capabilities the Focus service needs from the outside.
+
+use std::{collections::HashMap, future::Future};
+
+use chrono::{DateTime, Utc};
+use macro_user_id::user_id::MacroUserIdStr;
+use rootcause::Report;
+use serde_json::Value;
+use uuid::Uuid;
+
+use super::models::{FocusInbox, FocusMail, FocusRecord, StaleThread, ThreadFocus};
+
+/// Focus storage and the thread reads classification needs.
+pub trait FocusStore: Send + Sync + 'static {
+ /// Where a thread lives and how it stands, or `None` when it no longer
+ /// exists. A single-row read: every email event starts here.
+ fn thread_inbox(
+ &self,
+ thread_id: Uuid,
+ ) -> impl Future<Output = Result<Option<FocusInbox>, Report>> + Send;
+
+ /// A thread's messages and the owner's sent mail to its senders.
+ fn thread_mail(
+ &self,
+ inbox: &FocusInbox,
+ ) -> impl Future<Output = Result<FocusMail, Report>> + Send;
+
+ /// Store a thread's classification unless one of a later message is
+ /// already stored. Returns whether it was stored.
+ fn save(&self, record: &FocusRecord) -> impl Future<Output = Result<bool, Report>> + Send;
+
+ /// Inbox signal threads with mail since `since` and no classification of
+ /// their latest message, newest first, from inboxes whose address is at
+ /// one of `domains`.
+ fn stale_threads(
+ &self,
+ since: DateTime<Utc>,
+ domains: &[String],
+ limit: i64,
+ ) -> impl Future<Output = Result<Vec<StaleThread>, Report>> + Send;
+
+ /// The owner's Focus threads still in the inbox with mail since `since`,
+ /// highest priority first: importance, halved for every 2 days since the
+ /// latest inbound mail.
+ fn focus_thread_ids(
+ &self,
+ owner: &MacroUserIdStr<'static>,
+ since: DateTime<Utc>,
+ limit: i64,
+ ) -> impl Future<Output = Result<Vec<Uuid>, Report>> + Send;
+
+ /// Stored classifications of the owner's threads among `thread_ids`.
+ fn focus_for_threads(
+ &self,
+ owner: &MacroUserIdStr<'static>,
+ thread_ids: &[Uuid],
+ ) -> impl Future<Output = Result<HashMap<Uuid, ThreadFocus>, Report>> + Send;
+}
+
+/// A short description of the owner that Jev reads as context.
+pub trait ProfileSource: Send + Sync + 'static {
+ /// The owner's stored profile, or `None` when there isn't one. Never
+ /// generates a profile.
+ fn profile(
+ &self,
+ owner: &MacroUserIdStr<'static>,
+ ) -> impl Future<Output = Result<Option<String>, Report>> + Send;
+}
+
+/// Why the classifier gave no answers.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
+pub enum FocusClassifierError {
+ /// A timeout, rate limit or outage; the sweep will try again.
+ #[error("the classifier is temporarily unavailable")]
+ Unavailable,
+ /// The classifier refused the request or answered unusably.
+ #[error("the classifier rejected the request")]
+ Rejected,
+}
+
+/// Yes/no answers about a thread, metered against its owner.
+pub trait FocusClassifier: Send + Sync + 'static {
+ /// The probability of "yes" for each question, in question order.
+ fn answer(
+ &self,
+ owner: &MacroUserIdStr<'static>,
+ thread_id: Uuid,
+ input: &Value,
+ questions: &[&'static str],
+ ) -> impl Future<Output = Result<Vec<f32>, FocusClassifierError>> + Send;
+
+ /// Model identifier stored with each classification.
+ fn model(&self) -> &'static str;
+}
diff --git a/crates/email/src/domain/focus/questions.rs b/crates/email/src/domain/focus/questions.rs
new file mode 100644
index 0000000000..5198bcd6d8
--- /dev/null
+++ b/crates/email/src/domain/focus/questions.rs
@@ -0,0 +1,106 @@
+//! The yes/no questions Jev answers about every thread.
+//!
+//! The wording was tested against four months of real signal mail; change it
+//! only together with a re-run of that comparison. Each question stays under
+//! Jev's 500-character limit.
+
+/// One Focus question. [`FocusQuestion::ALL`] fixes the order answers come back in.
+///
+/// The questions name no role or line of work: the owner's profile, which Jev
+/// reads as `recipient`, says what matters to them.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum FocusQuestion {
+ /// Would the owner want this in a short Focus inbox?
+ Focus,
+ /// Is it unsolicited outreach from a stranger?
+ Outreach,
+ /// Is it automated, bulk or templated mail?
+ Automated,
+ /// Is it a customer, client or user asking for help or giving feedback?
+ Customer,
+ /// Is it only a calendar invite, update or RSVP?
+ CalendarRsvp,
+ /// Does it ask for a decision only the owner can make?
+ NeedsDecision,
+ /// Does the latest message ask the owner something unanswered?
+ NeedsResponse,
+ /// Is there an open loop the owner should come back to?
+ NeedsFollowUp,
+}
+
+impl FocusQuestion {
+ /// Every question, in the order Jev is asked and answers.
+ pub const ALL: [Self; 8] = [
+ Self::Focus,
+ Self::Outreach,
+ Self::Automated,
+ Self::Customer,
+ Self::CalendarRsvp,
+ Self::NeedsDecision,
+ Self::NeedsResponse,
+ Self::NeedsFollowUp,
+ ];
+
+ /// The question as Jev reads it.
+ pub const fn text(self) -> &'static str {
+ match self {
+ Self::Focus => {
+ "Would the recipient described in `recipient` want this email in a short Focus inbox that \
+ holds only mail that genuinely matters to them: from people they work with or already \
+ know, warm introductions, customers, clients or users of their work, or anything needing \
+ their decision or action? Answer no for unsolicited outreach, bulk or automated mail, and \
+ anything they would skip."
+ }
+ Self::Outreach => {
+ "Is this unsolicited outreach from someone with no existing relationship with the \
+ recipient: a pitch for a product, service, investment, media, event or partnership, \
+ recruiting, or a job application, even if it is written to look personal?"
+ }
+ Self::Automated => {
+ "Is this automated, bulk or templated mail (newsletter, product announcement, marketing, \
+ notification, receipt, digest, AI meeting notes, or system alert) rather than a message \
+ a person wrote specifically to the recipient?"
+ }
+ Self::Customer => {
+ "Is this from a customer, client or user of the recipient's organization, product or \
+ service asking for help, reporting a problem, or giving feedback?"
+ }
+ Self::CalendarRsvp => {
+ "Is this only a calendar invitation, invitation update, or RSVP notice (accepted, \
+ declined, tentative) with no other personal message?"
+ }
+ Self::NeedsDecision => {
+ "Does this ask the recipient for a decision, approval, signature, payment or answer that \
+ only they can give, within an existing business or working relationship?"
+ }
+ Self::NeedsResponse => {
+ "Looking at the latest message in the thread: does it ask the recipient a direct question \
+ or make a request that expects a written reply from them personally, which they have not \
+ answered yet in this thread? Answer no for mass emails, unsolicited outreach, FYI \
+ updates, automated notices, calendar notices, and threads where their own message is the \
+ latest one."
+ }
+ Self::NeedsFollowUp => {
+ "Is there an open loop on this thread that the recipient should track and come back to \
+ later: something they promised to do or send, a pending decision, deadline, payment, \
+ signature or scheduled next step, or a question they asked that the other side has not \
+ answered yet? Answer no if the thread is resolved, or it is unsolicited outreach, a mass \
+ email, or an automated notice."
+ }
+ }
+ }
+}
+
+/// Every question's text, in [`FocusQuestion::ALL`] order.
+pub const FOCUS_QUESTIONS: [&str; FocusQuestion::ALL.len()] = {
+ let mut texts = [""; FocusQuestion::ALL.len()];
+ let mut index = 0;
+ while index < FocusQuestion::ALL.len() {
+ texts[index] = FocusQuestion::ALL[index].text();
+ index += 1;
+ }
+ texts
+};
+
+#[cfg(test)]
+mod test;
diff --git a/crates/email/src/domain/focus/questions/test.rs b/crates/email/src/domain/focus/questions/test.rs
new file mode 100644
index 0000000000..a91137c96d
--- /dev/null
+++ b/crates/email/src/domain/focus/questions/test.rs
@@ -0,0 +1,30 @@
+use super::*;
+
+#[test]
+fn every_question_fits_jev_limits() {
+ for text in FOCUS_QUESTIONS {
+ assert!(!text.trim().is_empty());
+ assert!(
+ text.chars().count() <= 500,
+ "question over Jev's 500-character limit: {text}"
+ );
+ }
+ // Jev accepts at most 32 questions in one request.
+ assert!(FOCUS_QUESTIONS.len() <= 32);
+}
+
+#[test]
+fn questions_name_no_particular_person_or_company() {
+ for text in FOCUS_QUESTIONS {
+ for word in ["Teo", "Macro", " him", " his ", " her ", " she ", " he "] {
+ assert!(!text.contains(word), "question mentions {word:?}: {text}");
+ }
+ }
+}
+
+#[test]
+fn texts_follow_the_answer_order() {
+ for (index, question) in FocusQuestion::ALL.into_iter().enumerate() {
+ assert_eq!(FOCUS_QUESTIONS[index], question.text());
+ }
+}
diff --git a/crates/email/src/domain/focus/rule.rs b/crates/email/src/domain/focus/rule.rs
new file mode 100644
index 0000000000..ea9f3a4667
--- /dev/null
+++ b/crates/email/src/domain/focus/rule.rs
@@ -0,0 +1,116 @@
+//! The deterministic rule that turns Jev's answers into a Focus verdict.
+
+use super::models::{FocusAnswers, FocusCategory, FocusSignals, FocusVerdict};
+
+/// A "yes" from Jev.
+const YES: f32 = 0.5;
+/// The lower Focus bar for threads from people the owner corresponds with.
+const CONTACT_FOCUS: f32 = 0.3;
+/// The higher Focus bar for unsolicited outreach from strangers. Only a
+/// profile that asks for such mail (a recruiter's applications) clears it;
+/// on the experiment's founder inbox no stranger outreach scored above 0.5.
+const OUTREACH_FOCUS: f32 = 0.6;
+/// Jev's calendar answer only vetoes a thread when it is this sure; below it,
+/// it flagged real conversations that merely mentioned an invite.
+const CALENDAR: f32 = 0.7;
+/// The bar for the reply-needed and follow-up flags. With the owner's memory
+/// as context Jev leans towards "yes", so a plain yes flagged half of Focus.
+const FLAG: f32 = 0.7;
+
+/// Subject prefixes Google Calendar and Outlook put on invites and RSVPs.
+const CALENDAR_PREFIXES: [&str; 10] = [
+ "accepted",
+ "declined",
+ "tentatively accepted",
+ "invitation",
+ "updated invitation",
+ "updated invitation with note",
+ "canceled",
+ "canceled event",
+ "new event",
+ "event updated",
+];
+
+/// Importance weights; they sum to 1.
+const WEIGHT_FOCUS: f32 = 0.55;
+const WEIGHT_REPLY: f32 = 0.15;
+const WEIGHT_FOLLOW_UP: f32 = 0.10;
+const WEIGHT_DECISION: f32 = 0.10;
+const WEIGHT_CONTACT: f32 = 0.10;
+
+/// Whether a subject is a calendar invite or RSVP, e.g. "Accepted: Demo @ Fri".
+pub fn is_calendar_subject(subject: &str) -> bool {
+ let subject = subject.to_lowercase();
+ CALENDAR_PREFIXES.iter().any(|prefix| {
+ subject
+ .strip_prefix(prefix)
+ .is_some_and(|rest| rest.trim_start().starts_with(':'))
+ })
+}
+
+/// Decide whether a thread belongs in Focus, why, and how important it is.
+///
+/// A thread is left out when it is a calendar notice or automated mail nobody
+/// vouches for. Otherwise it is in when Jev says the owner, as their profile
+/// describes them, would want it. Unsolicited outreach from strangers needs a
+/// firmer yes. Customers, and contacts Jev finds at least somewhat relevant,
+/// need less, unless the mail is outreach.
+pub fn decide(answers: &FocusAnswers, signals: &FocusSignals) -> FocusVerdict {
+ let calendar = signals.calendar_subject || answers.calendar_rsvp >= CALENDAR;
+ let customer = answers.customer >= YES;
+ let outreach = answers.outreach >= YES;
+ let vouched = signals.contact && answers.focus >= YES;
+ let automated = answers.automated >= YES && !customer && !signals.replied && !vouched;
+ let stranger = !signals.contact && !signals.replied;
+ let focus_bar = if outreach && stranger {
+ OUTREACH_FOCUS
+ } else {
+ YES
+ };
+
+ let is_focus = !calendar
+ && !automated
+ && (answers.focus >= focus_bar
+ || (!outreach && (customer || (signals.contact && answers.focus >= CONTACT_FOCUS))));
+ let needs_reply = is_focus && !signals.latest_from_owner && answers.needs_response >= FLAG;
+ let needs_follow_up = is_focus && answers.needs_follow_up >= FLAG;
+
+ let category = if is_focus {
+ if customer {
+ FocusCategory::Customer
+ } else if signals.teammate {
+ FocusCategory::Team
+ } else if signals.contact {
+ FocusCategory::Known
+ } else {
+ FocusCategory::Other
+ }
+ } else if calendar {
+ FocusCategory::Calendar
+ } else if outreach {
+ FocusCategory::Outreach
+ } else if automated {
+ FocusCategory::Automated
+ } else {
+ FocusCategory::LowRelevance
+ };
+
+ let score = WEIGHT_FOCUS * answers.focus
+ + WEIGHT_REPLY * f32::from(u8::from(needs_reply))
+ + WEIGHT_FOLLOW_UP * f32::from(u8::from(needs_follow_up))
+ + WEIGHT_DECISION * f32::from(u8::from(answers.needs_decision >= YES))
+ + WEIGHT_CONTACT * f32::from(u8::from(signals.contact));
+ // Answers are probabilities, so the score already sits in 0..=1.
+ let importance = (score.clamp(0.0, 1.0) * 100.0).round() as u8;
+
+ FocusVerdict {
+ is_focus,
+ category,
+ needs_reply,
+ needs_follow_up,
+ importance,
+ }
+}
+
+#[cfg(test)]
+mod test;
diff --git a/crates/email/src/domain/focus/rule/experiment.csv b/crates/email/src/domain/focus/rule/experiment.csv
new file mode 100644
index 0000000000..5a676119b4
--- /dev/null
+++ b/crates/email/src/domain/focus/rule/experiment.csv
@@ -0,0 +1,644 @@
+focus,outreach,automated,customer,calendar_rsvp,needs_decision,needs_response,needs_follow_up,contact,replied,teammate,latest_from_owner,calendar_subject,expect_is_focus,expect_needs_reply,expect_needs_follow_up
+0.52,0.19,0.08,0.48,0.05,0.3,0.13,0.72,1,1,0,0,0,1,0,1
+0.08,0.95,0.15,0.03,0.01,0.14,0.84,0.07,0,0,0,0,0,0,0,0
+0.17,0.95,0.07,0.05,0.01,0.23,0.81,0.16,0,0,0,0,0,0,0,0
+0.07,0.96,0.62,0.02,0.02,0.15,0.84,0.06,0,0,0,0,0,0,0,0
+0.14,0.55,0.77,0.06,0.02,0.47,0.81,0.23,0,0,0,0,0,0,0,0
+0.1,0.75,0.45,0.04,0.02,0.2,0.8,0.08,0,0,0,0,0,0,0,0
+0.09,0.87,0.26,0.03,0.02,0.23,0.8,0.11,0,0,0,0,0,0,0,0
+0.07,0.97,0.83,0.03,0.02,0.16,0.69,0.05,0,0,0,0,0,0,0,0
+0.08,0.94,0.45,0.03,0.01,0.14,0.77,0.08,0,0,0,0,0,0,0,0
+0.08,0.96,0.66,0.02,0.02,0.15,0.74,0.05,0,0,0,0,0,0,0,0
+0.2,0.08,0.98,0.08,0.07,0.26,0.25,0.53,0,0,0,0,0,0,0,0
+0.07,0.96,0.3,0.03,0.01,0.13,0.83,0.08,0,0,0,0,0,0,0,0
+0.09,0.96,0.69,0.03,0.01,0.15,0.83,0.07,0,0,0,0,0,0,0,0
+0.07,0.95,0.61,0.02,0.02,0.25,0.79,0.06,0,0,0,0,0,0,0,0
+0.68,0.03,0.06,0.52,0.04,0.14,0.08,0.7,1,0,0,0,0,1,0,1
+0.28,0.06,0.62,0.93,0.02,0.27,0.63,0.29,0,0,0,0,0,1,0,0
+0.34,0.11,0.49,0.79,0.02,0.21,0.83,0.4,0,0,0,0,0,1,1,0
+0.43,0.12,0.82,0.28,0.02,0.19,0.12,0.19,0,0,0,0,0,0,0,0
+0.08,0.97,0.84,0.02,0.02,0.11,0.79,0.05,0,0,0,0,0,0,0,0
+0.1,0.77,0.48,0.03,0.02,0.17,0.87,0.09,0,0,0,0,0,0,0,0
+0.34,0.96,0.1,0.03,0.02,0.27,0.81,0.15,0,0,0,0,0,0,0,0
+0.07,0.95,0.55,0.03,0.02,0.15,0.46,0.08,0,0,0,0,0,0,0,0
+0.08,0.98,0.78,0.02,0.01,0.14,0.75,0.05,0,0,0,0,0,0,0,0
+0.08,0.91,0.8,0.03,0.03,0.19,0.53,0.09,0,0,0,0,0,0,0,0
+0.07,0.96,0.45,0.04,0.02,0.17,0.87,0.08,0,0,0,0,0,0,0,0
+0.31,0.23,0.14,0.17,0.02,0.29,0.92,0.32,0,0,0,0,0,0,0,0
+0.08,0.96,0.74,0.03,0.02,0.1,0.42,0.06,0,0,0,0,0,0,0,0
+0.76,0.02,0.92,0.03,0.94,0.2,0.06,0.33,1,0,1,0,1,0,0,0
+0.86,0.03,0.19,0.03,0.01,0.42,0.14,0.75,0,0,0,0,0,1,0,1
+0.2,0.14,0.64,0.08,0.01,0.26,0.57,0.16,0,0,0,0,0,0,0,0
+0.32,0.09,0.16,0.67,0.04,0.57,0.87,0.48,0,0,0,0,0,1,1,0
+0.07,0.57,0.86,0.02,0.02,0.07,0.6,0.05,0,0,0,0,0,0,0,0
+0.1,0.54,0.6,0.12,0.02,0.12,0.67,0.12,0,0,0,0,0,0,0,0
+0.08,0.97,0.82,0.02,0.01,0.14,0.79,0.05,0,0,0,0,0,0,0,0
+0.06,0.97,0.8,0.02,0.01,0.21,0.87,0.05,0,0,0,0,0,0,0,0
+0.06,0.97,0.87,0.03,0.02,0.07,0.2,0.04,0,0,0,0,0,0,0,0
+0.08,0.78,0.75,0.02,0.03,0.14,0.8,0.07,0,0,0,0,0,0,0,0
+0.06,0.96,0.79,0.02,0.02,0.19,0.79,0.07,0,0,0,0,0,0,0,0
+0.52,0.22,0.1,0.1,0.03,0.34,0.89,0.6,1,0,1,0,0,1,1,0
+0.1,0.43,0.97,0.04,0.04,0.05,0.05,0.05,0,0,0,0,0,0,0,0
+0.61,0.05,0.1,0.94,0.01,0.4,0.88,0.52,0,0,0,0,0,1,1,0
+0.4,0.94,0.11,0.03,0.02,0.4,0.47,0.2,0,0,0,0,0,0,0,0
+0.82,0.02,0.64,0.04,0.75,0.26,0.06,0.66,0,0,0,0,0,0,0,0
+0.08,0.97,0.56,0.02,0.02,0.15,0.09,0.05,0,0,0,0,0,0,0,0
+0.75,0.02,0.79,0.03,0.89,0.22,0.07,0.28,1,0,1,0,1,0,0,0
+0.06,0.98,0.67,0.02,0.01,0.09,0.82,0.05,0,0,0,0,0,0,0,0
+0.08,0.97,0.65,0.02,0.01,0.14,0.83,0.07,0,0,0,0,0,0,0,0
+0.07,0.96,0.38,0.03,0.01,0.08,0.59,0.07,0,0,0,0,0,0,0,0
+0.06,0.97,0.61,0.02,0.02,0.23,0.86,0.07,0,0,0,0,0,0,0,0
+0.08,0.83,0.14,0.04,0.01,0.08,0.63,0.07,0,0,0,0,0,0,0,0
+0.1,0.94,0.27,0.04,0.02,0.31,0.74,0.13,0,1,0,0,0,0,0,0
+0.08,0.97,0.9,0.02,0.02,0.1,0.4,0.04,0,0,0,0,0,0,0,0
+0.62,0.06,0.07,0.29,0.01,0.28,0.37,0.38,1,0,1,0,0,1,0,0
+0.78,0.03,0.9,0.02,0.95,0.11,0.06,0.45,0,0,1,0,1,0,0,0
+0.68,0.04,0.09,0.05,0.14,0.15,0.07,0.78,1,0,1,0,0,1,0,1
+0.16,0.97,0.9,0.03,0.01,0.07,0.37,0.05,0,0,0,0,0,0,0,0
+0.09,0.97,0.75,0.02,0.01,0.14,0.79,0.05,0,0,0,0,0,0,0,0
+0.08,0.96,0.52,0.03,0.02,0.26,0.81,0.13,0,0,0,0,0,0,0,0
+0.87,0.03,0.56,0.03,0.82,0.33,0.11,0.72,1,0,1,0,1,0,0,0
+0.1,0.65,0.39,0.05,0.05,0.45,0.79,0.31,1,0,1,0,0,0,0,0
+0.18,0.96,0.12,0.03,0.01,0.28,0.56,0.11,0,0,0,0,0,0,0,0
+0.07,0.98,0.75,0.02,0.01,0.15,0.89,0.06,0,0,0,0,0,0,0,0
+0.08,0.92,0.61,0.07,0.03,0.21,0.83,0.08,0,0,0,0,0,0,0,0
+0.45,0.1,0.92,0.09,0.95,0.1,0.04,0.17,0,0,0,0,1,0,0,0
+0.78,0.02,0.64,0.02,0.77,0.38,0.09,0.38,1,0,1,0,1,0,0,0
+0.07,0.98,0.89,0.02,0.01,0.14,0.81,0.06,0,0,0,0,0,0,0,0
+0.12,0.73,0.96,0.04,0.01,0.05,0.08,0.07,0,0,0,0,0,0,0,0
+0.74,0.03,0.1,0.04,0.02,0.12,0.09,0.24,1,1,1,1,0,1,0,0
+0.07,0.93,0.62,0.03,0.02,0.13,0.77,0.07,0,0,0,0,0,0,0,0
+0.73,0.02,0.78,0.03,0.92,0.54,0.1,0.63,0,0,1,0,1,0,0,0
+0.07,0.96,0.45,0.03,0.01,0.21,0.83,0.08,0,0,0,0,0,0,0,0
+0.37,0.37,0.05,0.05,0.02,0.13,0.12,0.8,1,1,0,1,0,1,0,1
+0.8,0.03,0.03,0.08,0.11,0.74,0.93,0.79,1,0,1,0,0,1,1,1
+0.09,0.96,0.1,0.04,0.01,0.19,0.82,0.09,0,0,0,0,0,0,0,0
+0.73,0.05,0.73,0.19,0.87,0.36,0.08,0.49,1,0,1,0,1,0,0,0
+0.63,0.09,0.29,0.08,0.24,0.65,0.91,0.69,1,0,0,0,0,1,1,0
+0.9,0.03,0.04,0.04,0.02,0.73,0.6,0.79,1,0,1,0,0,1,0,1
+0.82,0.03,0.74,0.03,0.9,0.27,0.07,0.62,1,0,1,0,1,0,0,0
+0.08,0.95,0.44,0.06,0.02,0.14,0.57,0.09,0,0,0,0,0,0,0,0
+0.26,0.96,0.11,0.03,0.01,0.38,0.73,0.16,0,0,0,0,0,0,0,0
+0.67,0.03,0.94,0.03,0.95,0.08,0.04,0.17,0,0,1,0,1,0,0,0
+0.13,0.8,0.95,0.03,0.01,0.08,0.35,0.04,0,0,0,0,0,0,0,0
+0.1,0.78,0.98,0.03,0.02,0.06,0.1,0.05,0,0,0,0,0,0,0,0
+0.7,0.03,0.82,0.02,0.89,0.3,0.08,0.4,1,0,1,0,1,0,0,0
+0.69,0.02,0.05,0.02,0.02,0.04,0.06,0.08,1,0,1,0,0,1,0,0
+0.45,0.32,0.46,0.23,0.03,0.31,0.33,0.68,1,0,1,0,0,1,0,0
+0.07,0.96,0.53,0.03,0.04,0.26,0.86,0.07,0,0,0,0,0,0,0,0
+0.07,0.94,0.48,0.03,0.01,0.18,0.79,0.06,0,0,0,0,0,0,0,0
+0.78,0.02,0.76,0.04,0.78,0.43,0.09,0.77,0,0,0,0,0,0,0,0
+0.06,0.97,0.72,0.02,0.02,0.18,0.83,0.07,0,0,0,0,0,0,0,0
+0.2,0.96,0.15,0.03,0.01,0.33,0.56,0.16,0,0,0,0,0,0,0,0
+0.88,0.02,0.56,0.03,0.71,0.22,0.06,0.69,1,0,1,0,1,0,0,0
+0.78,0.03,0.35,0.03,0.69,0.31,0.11,0.61,0,0,0,0,1,0,0,0
+0.32,0.03,0.18,0.04,0.02,0.05,0.05,0.07,1,0,1,0,0,1,0,0
+0.76,0.03,0.04,0.45,0.01,0.23,0.84,0.61,0,0,0,0,0,1,1,0
+0.08,0.97,0.82,0.02,0.03,0.12,0.59,0.05,0,0,0,0,0,0,0,0
+0.26,0.95,0.27,0.03,0.02,0.29,0.41,0.11,0,0,0,0,0,0,0,0
+0.08,0.97,0.52,0.03,0.01,0.15,0.9,0.07,0,0,0,0,0,0,0,0
+0.06,0.96,0.72,0.03,0.02,0.18,0.88,0.07,0,0,0,0,0,0,0,0
+0.45,0.05,0.99,0.06,0.01,0.11,0.07,0.12,0,0,0,0,0,0,0,0
+0.67,0.07,0.1,0.23,0.02,0.24,0.86,0.54,0,0,0,0,0,1,1,0
+0.08,0.59,0.97,0.03,0.04,0.06,0.06,0.06,0,0,0,0,0,0,0,0
+0.06,0.97,0.28,0.03,0.01,0.2,0.89,0.09,0,0,0,0,0,0,0,0
+0.06,0.97,0.77,0.02,0.02,0.16,0.81,0.06,0,0,0,0,0,0,0,0
+0.09,0.97,0.65,0.03,0.04,0.12,0.77,0.07,0,0,0,0,0,0,0,0
+0.44,0.07,0.09,0.4,0.02,0.11,0.08,0.25,1,0,1,0,0,1,0,0
+0.79,0.03,0.05,0.83,0.02,0.17,0.09,0.29,1,1,1,0,0,1,0,0
+0.58,0.04,0.24,0.12,0.02,0.17,0.08,0.85,1,0,1,0,0,1,0,1
+0.37,0.93,0.1,0.03,0.02,0.35,0.38,0.21,0,0,0,0,0,0,0,0
+0.07,0.95,0.41,0.04,0.02,0.13,0.83,0.05,0,0,0,0,0,0,0,0
+0.1,0.72,0.86,0.03,0.06,0.29,0.43,0.11,0,0,0,0,0,0,0,0
+0.71,0.03,0.92,0.03,0.95,0.11,0.05,0.42,0,0,1,0,1,0,0,0
+0.08,0.98,0.87,0.02,0.02,0.16,0.81,0.06,0,0,0,0,0,0,0,0
+0.17,0.16,0.86,0.27,0.02,0.05,0.07,0.1,0,0,0,0,0,0,0,0
+0.07,0.96,0.51,0.03,0.01,0.15,0.88,0.09,0,0,0,0,0,0,0,0
+0.73,0.02,0.71,0.02,0.81,0.42,0.11,0.53,1,0,1,0,1,0,0,0
+0.07,0.97,0.74,0.03,0.02,0.19,0.78,0.06,0,0,0,0,0,0,0,0
+0.84,0.02,0.84,0.03,0.92,0.16,0.07,0.52,1,0,1,0,1,0,0,0
+0.13,0.89,0.78,0.27,0.02,0.11,0.08,0.1,0,0,0,0,0,0,0,0
+0.61,0.02,0.94,0.03,0.95,0.06,0.04,0.17,0,0,1,0,1,0,0,0
+0.06,0.98,0.47,0.02,0.01,0.1,0.84,0.05,0,0,0,0,0,0,0,0
+0.53,0.06,0.23,0.06,0.04,0.07,0.08,0.1,1,1,1,1,0,1,0,0
+0.07,0.98,0.82,0.02,0.02,0.14,0.83,0.06,0,0,0,0,0,0,0,0
+0.08,0.96,0.64,0.02,0.02,0.17,0.84,0.07,0,0,0,0,0,0,0,0
+0.81,0.03,0.54,0.04,0.82,0.65,0.14,0.7,1,0,1,0,1,0,0,0
+0.1,0.81,0.91,0.04,0.01,0.14,0.62,0.04,0,0,0,0,0,0,0,0
+0.12,0.67,0.98,0.03,0.01,0.08,0.12,0.05,0,0,0,0,0,0,0,0
+0.13,0.81,0.26,0.1,0.01,0.18,0.62,0.2,0,0,0,0,0,0,0,0
+0.59,0.03,0.92,0.03,0.95,0.14,0.05,0.26,0,0,1,0,1,0,0,0
+0.62,0.03,0.94,0.03,0.95,0.07,0.05,0.09,0,0,1,0,1,0,0,0
+0.81,0.02,0.83,0.02,0.91,0.2,0.07,0.42,1,0,1,0,1,0,0,0
+0.08,0.97,0.64,0.02,0.01,0.25,0.85,0.08,0,0,0,0,0,0,0,0
+0.07,0.98,0.78,0.02,0.01,0.19,0.79,0.05,0,0,0,0,0,0,0,0
+0.1,0.91,0.97,0.02,0.14,0.07,0.11,0.05,0,0,0,0,0,0,0,0
+0.26,0.96,0.09,0.03,0.02,0.22,0.74,0.11,0,0,0,0,0,0,0,0
+0.09,0.97,0.74,0.03,0.01,0.16,0.7,0.08,0,0,0,0,0,0,0,0
+0.08,0.95,0.89,0.02,0.02,0.06,0.15,0.05,0,0,0,0,0,0,0,0
+0.75,0.04,0.62,0.09,0.91,0.35,0.07,0.5,0,0,0,0,1,0,0,0
+0.8,0.03,0.76,0.02,0.9,0.27,0.07,0.55,1,0,1,0,1,0,0,0
+0.22,0.61,0.24,0.05,0.09,0.4,0.91,0.43,0,0,0,0,0,0,0,0
+0.08,0.95,0.4,0.02,0.02,0.18,0.87,0.08,0,0,0,0,0,0,0,0
+0.05,0.98,0.74,0.02,0.01,0.14,0.32,0.06,0,0,0,0,0,0,0,0
+0.26,0.92,0.23,0.07,0.01,0.17,0.19,0.17,0,0,0,0,0,0,0,0
+0.06,0.97,0.5,0.02,0.01,0.25,0.78,0.06,0,0,0,0,0,0,0,0
+0.07,0.95,0.88,0.02,0.11,0.07,0.19,0.05,0,0,0,0,0,0,0,0
+0.18,0.57,0.5,0.05,0.02,0.53,0.87,0.38,0,0,0,0,0,0,0,0
+0.57,0.07,0.08,0.31,0.02,0.34,0.86,0.81,1,0,1,0,0,1,1,1
+0.07,0.91,0.98,0.03,0.02,0.16,0.17,0.05,0,0,0,0,0,0,0,0
+0.46,0.92,0.07,0.03,0.01,0.45,0.68,0.28,0,0,0,0,0,0,0,0
+0.09,0.91,0.41,0.04,0.02,0.13,0.58,0.08,0,0,0,0,0,0,0,0
+0.73,0.15,0.09,0.04,0.04,0.69,0.5,0.83,1,1,0,1,0,1,0,1
+0.08,0.7,0.98,0.03,0.01,0.1,0.09,0.06,0,0,0,0,0,0,0,0
+0.68,0.05,0.27,0.93,0.02,0.18,0.07,0.44,1,0,1,0,0,1,0,0
+0.32,0.19,0.97,0.07,0.07,0.11,0.06,0.32,0,0,0,0,0,0,0,0
+0.67,0.14,0.18,0.17,0.03,0.68,0.72,0.91,1,0,1,0,0,1,1,1
+0.2,0.95,0.08,0.03,0.01,0.35,0.53,0.15,0,0,0,0,0,0,0,0
+0.08,0.97,0.64,0.03,0.01,0.17,0.87,0.06,0,0,0,0,0,0,0,0
+0.07,0.97,0.5,0.02,0.01,0.14,0.81,0.05,0,0,0,0,0,0,0,0
+0.32,0.09,0.35,0.77,0.02,0.2,0.62,0.31,0,0,0,0,0,1,0,0
+0.07,0.97,0.61,0.03,0.02,0.18,0.83,0.07,0,0,0,0,0,0,0,0
+0.49,0.17,0.92,0.12,0.95,0.11,0.04,0.34,0,0,0,0,1,0,0,0
+0.71,0.02,0.91,0.02,0.95,0.11,0.06,0.44,0,0,1,0,1,0,0,0
+0.08,0.96,0.47,0.02,0.01,0.24,0.91,0.07,0,0,0,0,0,0,0,0
+0.08,0.85,0.54,0.03,0.16,0.18,0.51,0.08,0,0,0,0,0,0,0,0
+0.53,0.09,0.04,0.25,0.02,0.73,0.21,0.91,1,1,0,0,0,1,0,1
+0.7,0.13,0.68,0.03,0.89,0.63,0.11,0.62,1,0,1,0,1,0,0,0
+0.1,0.88,0.56,0.09,0.02,0.1,0.72,0.09,0,0,0,0,0,0,0,0
+0.08,0.96,0.49,0.03,0.01,0.16,0.81,0.07,0,0,0,0,0,0,0,0
+0.37,0.92,0.14,0.03,0.01,0.36,0.49,0.22,0,0,0,0,0,0,0,0
+0.16,0.96,0.06,0.08,0.01,0.14,0.44,0.12,0,0,0,0,0,0,0,0
+0.07,0.97,0.64,0.02,0.09,0.12,0.34,0.06,0,0,0,0,0,0,0,0
+0.08,0.96,0.63,0.02,0.02,0.31,0.88,0.08,0,0,0,0,0,0,0,0
+0.07,0.97,0.53,0.03,0.01,0.18,0.88,0.08,0,0,0,0,0,0,0,0
+0.56,0.09,0.16,0.18,0.01,0.24,0.85,0.5,0,0,0,0,0,1,1,0
+0.63,0.03,0.95,0.03,0.95,0.06,0.04,0.12,0,0,1,0,1,0,0,0
+0.08,0.96,0.27,0.03,0.01,0.19,0.84,0.08,0,0,0,0,0,0,0,0
+0.52,0.03,0.96,0.03,0.95,0.07,0.04,0.09,0,0,1,0,1,0,0,0
+0.07,0.97,0.46,0.02,0.01,0.34,0.88,0.07,0,0,0,0,0,0,0,0
+0.85,0.03,0.57,0.03,0.56,0.35,0.11,0.69,1,0,1,0,1,0,0,0
+0.08,0.96,0.23,0.03,0.01,0.27,0.85,0.08,0,0,0,0,0,0,0,0
+0.1,0.87,0.97,0.03,0.11,0.08,0.12,0.05,0,0,0,0,0,0,0,0
+0.07,0.97,0.58,0.03,0.03,0.15,0.79,0.08,0,0,0,0,0,0,0,0
+0.15,0.74,0.59,0.22,0.02,0.09,0.26,0.11,0,0,0,0,0,0,0,0
+0.79,0.04,0.05,0.95,0.01,0.43,0.91,0.62,0,0,0,0,0,1,1,0
+0.11,0.6,0.89,0.21,0.01,0.25,0.6,0.09,0,0,0,0,0,0,0,0
+0.09,0.96,0.46,0.03,0.01,0.18,0.86,0.08,0,0,0,0,0,0,0,0
+0.61,0.03,0.94,0.03,0.95,0.06,0.04,0.13,0,0,1,0,1,0,0,0
+0.07,0.97,0.87,0.03,0.02,0.14,0.8,0.06,0,0,0,0,0,0,0,0
+0.42,0.63,0.6,0.04,0.88,0.43,0.09,0.49,0,0,0,0,1,0,0,0
+0.09,0.96,0.34,0.03,0.02,0.36,0.86,0.17,0,0,0,0,0,0,0,0
+0.75,0.03,0.7,0.03,0.9,0.42,0.1,0.51,1,0,1,0,1,0,0,0
+0.09,0.96,0.96,0.03,0.02,0.04,0.08,0.05,0,0,0,0,0,0,0,0
+0.07,0.95,0.51,0.04,0.01,0.08,0.41,0.06,0,0,0,0,0,0,0,0
+0.55,0.06,0.04,0.32,0.06,0.34,0.12,0.71,1,0,0,0,0,1,0,1
+0.09,0.97,0.34,0.03,0.01,0.11,0.73,0.05,0,0,0,0,0,0,0,0
+0.33,0.03,0.14,0.04,0.02,0.04,0.05,0.07,1,0,1,0,0,1,0,0
+0.08,0.93,0.49,0.03,0.01,0.24,0.82,0.11,0,0,0,0,0,0,0,0
+0.77,0.04,0.18,0.04,0.03,0.85,0.52,0.91,1,0,1,0,0,1,0,1
+0.4,0.94,0.1,0.03,0.01,0.37,0.52,0.29,0,0,0,0,0,0,0,0
+0.08,0.97,0.62,0.04,0.01,0.12,0.85,0.06,0,0,0,0,0,0,0,0
+0.66,0.03,0.92,0.09,0.95,0.1,0.05,0.25,0,0,0,0,1,0,0,0
+0.08,0.97,0.75,0.02,0.01,0.1,0.75,0.04,0,0,0,0,0,0,0,0
+0.63,0.05,0.1,0.95,0.02,0.34,0.14,0.83,1,0,1,0,0,1,0,1
+0.2,0.96,0.16,0.04,0.02,0.15,0.42,0.12,0,0,0,0,0,0,0,0
+0.86,0.03,0.03,0.29,0.01,0.83,0.91,0.84,1,0,1,0,0,1,1,1
+0.62,0.09,0.21,0.43,0.02,0.7,0.93,0.81,1,0,0,0,0,1,1,1
+0.1,0.97,0.66,0.03,0.01,0.21,0.74,0.06,0,0,0,0,0,0,0,0
+0.66,0.03,0.82,0.02,0.9,0.17,0.07,0.13,1,0,1,0,1,0,0,0
+0.61,0.03,0.91,0.02,0.95,0.09,0.05,0.17,0,0,1,0,1,0,0,0
+0.11,0.23,0.94,0.18,0.02,0.61,0.58,0.09,0,0,0,0,0,0,0,0
+0.73,0.05,0.08,0.4,0.02,0.1,0.06,0.24,1,0,1,0,0,1,0,0
+0.07,0.97,0.72,0.03,0.02,0.12,0.88,0.06,0,0,0,0,0,0,0,0
+0.21,0.36,0.13,0.45,0.01,0.23,0.77,0.23,0,0,0,0,0,0,0,0
+0.08,0.93,0.17,0.04,0.02,0.08,0.59,0.1,0,0,0,0,0,0,0,0
+0.09,0.78,0.98,0.03,0.01,0.14,0.11,0.05,0,0,0,0,0,0,0,0
+0.3,0.1,0.24,0.76,0.02,0.17,0.7,0.5,1,0,0,0,0,1,1,0
+0.08,0.97,0.67,0.03,0.01,0.27,0.87,0.07,0,0,0,0,0,0,0,0
+0.09,0.97,0.78,0.02,0.01,0.15,0.75,0.05,0,0,0,0,0,0,0,0
+0.08,0.98,0.9,0.02,0.01,0.08,0.63,0.04,0,0,0,0,0,0,0,0
+0.58,0.03,0.81,0.03,0.85,0.08,0.05,0.15,0,0,1,0,1,0,0,0
+0.07,0.97,0.91,0.02,0.02,0.09,0.47,0.05,0,0,0,0,0,0,0,0
+0.11,0.47,0.96,0.04,0.01,0.16,0.42,0.06,0,0,0,0,0,0,0,0
+0.09,0.93,0.59,0.04,0.01,0.09,0.2,0.07,0,0,0,0,0,0,0,0
+0.21,0.1,0.9,0.58,0.02,0.09,0.1,0.12,0,0,0,0,0,1,0,0
+0.07,0.97,0.75,0.04,0.01,0.15,0.77,0.07,0,0,0,0,0,0,0,0
+0.38,0.06,0.97,0.07,0.07,0.14,0.32,0.77,0,0,0,0,0,0,0,0
+0.07,0.98,0.64,0.02,0.02,0.15,0.84,0.05,0,0,0,0,0,0,0,0
+0.24,0.44,0.12,0.37,0.02,0.17,0.09,0.22,1,0,1,0,0,0,0,0
+0.15,0.98,0.94,0.03,0.01,0.1,0.31,0.05,0,0,0,0,0,0,0,0
+0.1,0.57,0.95,0.05,0.02,0.05,0.07,0.06,0,0,0,0,0,0,0,0
+0.07,0.96,0.61,0.03,0.02,0.13,0.82,0.05,0,0,0,0,0,0,0,0
+0.37,0.06,0.34,0.87,0.02,0.42,0.73,0.54,0,0,0,0,0,1,1,0
+0.07,0.98,0.94,0.02,0.02,0.09,0.54,0.05,0,0,0,0,0,0,0,0
+0.12,0.9,0.93,0.04,0.01,0.09,0.33,0.05,0,0,0,0,0,0,0,0
+0.36,0.92,0.15,0.03,0.02,0.29,0.4,0.16,0,0,0,0,0,0,0,0
+0.11,0.97,0.96,0.03,0.01,0.05,0.15,0.05,0,0,0,0,0,0,0,0
+0.31,0.35,0.42,0.36,0.02,0.67,0.92,0.32,0,0,0,0,0,0,0,0
+0.64,0.04,0.79,0.03,0.58,0.37,0.09,0.43,1,0,1,0,1,0,0,0
+0.71,0.04,0.92,0.08,0.95,0.09,0.04,0.26,0,0,0,0,1,0,0,0
+0.07,0.96,0.61,0.03,0.01,0.25,0.84,0.08,0,0,0,0,0,0,0,0
+0.72,0.02,0.84,0.03,0.93,0.73,0.08,0.38,1,0,1,0,0,0,0,0
+0.09,0.86,0.82,0.03,0.06,0.25,0.77,0.12,0,0,0,0,0,0,0,0
+0.53,0.04,0.87,0.04,0.62,0.06,0.05,0.09,1,0,1,0,1,0,0,0
+0.67,0.03,0.92,0.03,0.95,0.08,0.04,0.25,0,0,1,0,1,0,0,0
+0.78,0.02,0.78,0.03,0.72,0.8,0.15,0.52,1,0,1,0,0,0,0,0
+0.63,0.03,0.9,0.03,0.95,0.13,0.05,0.22,0,0,1,0,1,0,0,0
+0.11,0.82,0.96,0.04,0.01,0.04,0.13,0.06,0,0,0,0,0,0,0,0
+0.36,0.27,0.88,0.15,0.04,0.39,0.46,0.25,0,0,0,0,0,0,0,0
+0.65,0.29,0.05,0.06,0.01,0.9,0.96,0.65,1,0,0,0,0,1,1,0
+0.52,0.03,0.9,0.04,0.68,0.05,0.04,0.08,1,0,1,0,1,0,0,0
+0.8,0.03,0.85,0.03,0.01,0.33,0.07,0.25,1,0,1,0,0,1,0,0
+0.08,0.93,0.48,0.03,0.02,0.23,0.84,0.11,0,0,0,0,0,0,0,0
+0.12,0.84,0.95,0.04,0.06,0.16,0.13,0.08,0,0,0,0,0,0,0,0
+0.09,0.94,0.31,0.04,0.02,0.1,0.47,0.1,0,0,0,0,0,0,0,0
+0.09,0.95,0.29,0.03,0.02,0.36,0.91,0.12,0,0,0,0,0,0,0,0
+0.07,0.97,0.93,0.02,0.02,0.11,0.74,0.04,0,0,0,0,0,0,0,0
+0.27,0.58,0.37,0.04,0.59,0.34,0.18,0.41,0,0,0,0,0,0,0,0
+0.06,0.97,0.59,0.02,0.01,0.23,0.86,0.05,0,0,0,0,0,0,0,0
+0.8,0.05,0.05,0.46,0.01,0.26,0.55,0.5,0,0,0,0,0,1,0,0
+0.07,0.97,0.6,0.02,0.01,0.12,0.53,0.07,0,0,0,0,0,0,0,0
+0.78,0.03,0.64,0.06,0.86,0.34,0.1,0.58,1,0,1,0,1,0,0,0
+0.58,0.09,0.09,0.92,0.02,0.12,0.1,0.42,1,0,1,0,0,1,0,0
+0.48,0.17,0.95,0.11,0.03,0.74,0.46,0.46,0,0,0,0,0,0,0,0
+0.34,0.27,0.1,0.73,0.02,0.2,0.13,0.61,1,1,0,1,0,1,0,0
+0.08,0.95,0.33,0.03,0.01,0.18,0.81,0.07,0,0,0,0,0,0,0,0
+0.14,0.92,0.68,0.04,0.02,0.11,0.32,0.08,0,0,0,0,0,0,0,0
+0.76,0.03,0.78,0.08,0.91,0.28,0.06,0.44,0,0,0,0,1,0,0,0
+0.06,0.97,0.6,0.02,0.01,0.29,0.73,0.07,0,0,0,0,0,0,0,0
+0.08,0.93,0.49,0.03,0.02,0.25,0.71,0.09,0,0,0,0,0,0,0,0
+0.08,0.93,0.55,0.08,0.02,0.09,0.61,0.07,0,0,0,0,0,0,0,0
+0.09,0.86,0.56,0.03,0.02,0.16,0.77,0.07,0,0,0,0,0,0,0,0
+0.42,0.04,0.92,0.07,0.04,0.11,0.09,0.13,1,0,1,0,0,0,0,0
+0.07,0.97,0.67,0.03,0.02,0.15,0.74,0.05,0,0,0,0,0,0,0,0
+0.59,0.03,0.95,0.03,0.96,0.08,0.04,0.12,0,0,1,0,1,0,0,0
+0.07,0.97,0.71,0.02,0.01,0.13,0.72,0.05,0,0,0,0,0,0,0,0
+0.12,0.42,0.97,0.06,0.02,0.1,0.07,0.08,0,0,0,0,0,0,0,0
+0.07,0.97,0.51,0.03,0.01,0.11,0.82,0.07,0,0,0,0,0,0,0,0
+0.63,0.04,0.09,0.96,0.02,0.24,0.53,0.59,1,0,1,0,0,1,0,0
+0.77,0.08,0.09,0.38,0.01,0.17,0.18,0.47,0,0,0,0,0,1,0,0
+0.48,0.02,0.07,0.04,0.02,0.03,0.04,0.07,1,0,1,0,0,1,0,0
+0.08,0.97,0.45,0.03,0.01,0.29,0.89,0.08,0,0,0,0,0,0,0,0
+0.08,0.97,0.54,0.03,0.02,0.16,0.88,0.06,0,0,0,0,0,0,0,0
+0.45,0.05,0.32,0.91,0.02,0.36,0.74,0.61,0,0,0,0,0,1,1,0
+0.08,0.93,0.7,0.04,0.02,0.07,0.29,0.06,0,0,0,0,0,0,0,0
+0.42,0.11,0.94,0.08,0.95,0.08,0.04,0.3,0,0,0,0,1,0,0,0
+0.07,0.94,0.16,0.03,0.01,0.08,0.72,0.07,0,0,0,0,0,0,0,0
+0.58,0.02,0.95,0.03,0.96,0.11,0.04,0.18,0,0,1,0,1,0,0,0
+0.06,0.96,0.56,0.02,0.01,0.23,0.83,0.07,0,0,0,0,0,0,0,0
+0.07,0.97,0.58,0.03,0.02,0.12,0.19,0.05,0,0,0,0,0,0,0,0
+0.11,0.95,0.64,0.05,0.02,0.06,0.2,0.05,0,0,0,0,0,0,0,0
+0.64,0.02,0.68,0.03,0.57,0.38,0.07,0.43,1,0,1,0,1,0,0,0
+0.06,0.97,0.73,0.02,0.01,0.1,0.78,0.05,0,0,0,0,0,0,0,0
+0.45,0.29,0.87,0.1,0.93,0.13,0.05,0.2,1,0,0,0,0,0,0,0
+0.64,0.03,0.95,0.03,0.95,0.08,0.05,0.14,0,0,1,0,1,0,0,0
+0.12,0.35,0.3,0.05,0.02,0.04,0.06,0.06,0,0,0,0,0,0,0,0
+0.09,0.94,0.2,0.05,0.01,0.16,0.47,0.08,0,0,0,0,0,0,0,0
+0.47,0.12,0.97,0.32,0.05,0.14,0.09,0.35,0,0,0,0,0,0,0,0
+0.41,0.95,0.11,0.03,0.01,0.3,0.72,0.24,0,0,0,0,0,0,0,0
+0.7,0.04,0.76,0.03,0.88,0.18,0.06,0.28,1,0,1,0,1,0,0,0
+0.65,0.04,0.72,0.03,0.51,0.31,0.08,0.42,1,0,1,0,1,0,0,0
+0.5,0.89,0.08,0.03,0.01,0.35,0.44,0.27,0,0,0,0,0,0,0,0
+0.2,0.8,0.1,0.07,0.02,0.15,0.83,0.23,0,0,0,0,0,0,0,0
+0.41,0.1,0.23,0.75,0.02,0.25,0.79,0.47,0,0,0,0,0,1,1,0
+0.1,0.71,0.94,0.03,0.1,0.14,0.13,0.06,0,0,0,0,0,0,0,0
+0.76,0.03,0.63,0.03,0.82,0.61,0.11,0.58,1,0,1,0,1,0,0,0
+0.11,0.95,0.56,0.03,0.01,0.1,0.17,0.11,0,0,0,0,0,0,0,0
+0.08,0.91,0.98,0.03,0.25,0.08,0.11,0.05,0,0,0,0,0,0,0,0
+0.24,0.95,0.3,0.03,0.02,0.21,0.58,0.16,0,0,0,0,0,0,0,0
+0.07,0.96,0.22,0.03,0.01,0.1,0.68,0.07,0,0,0,0,0,0,0,0
+0.07,0.97,0.54,0.02,0.02,0.12,0.76,0.06,0,0,0,0,0,0,0,0
+0.28,0.03,0.98,0.06,0.05,0.1,0.38,0.4,0,0,0,0,0,0,0,0
+0.69,0.03,0.93,0.03,0.93,0.33,0.06,0.32,1,0,1,0,1,0,0,0
+0.12,0.19,0.32,0.46,0.02,0.07,0.25,0.11,0,0,0,0,0,0,0,0
+0.15,0.1,0.13,0.57,0.02,0.04,0.07,0.09,0,0,0,0,0,1,0,0
+0.43,0.09,0.97,0.09,0.07,0.3,0.55,0.82,0,0,0,0,0,0,0,0
+0.66,0.03,0.94,0.03,0.95,0.07,0.04,0.19,0,0,1,0,1,0,0,0
+0.18,0.89,0.28,0.03,0.03,0.36,0.89,0.19,0,0,0,0,0,0,0,0
+0.2,0.36,0.91,0.19,0.02,0.1,0.12,0.19,0,0,0,0,0,0,0,0
+0.09,0.96,0.72,0.03,0.02,0.15,0.67,0.06,0,0,0,0,0,0,0,0
+0.33,0.18,0.9,0.1,0.14,0.27,0.22,0.2,0,0,0,0,0,0,0,0
+0.11,0.97,0.95,0.02,0.01,0.06,0.25,0.04,0,0,0,0,0,0,0,0
+0.09,0.83,0.21,0.1,0.02,0.25,0.88,0.12,0,0,0,0,0,0,0,0
+0.07,0.96,0.93,0.02,0.01,0.17,0.23,0.06,0,0,0,0,0,0,0,0
+0.39,0.19,0.45,0.65,0.03,0.31,0.77,0.45,0,0,0,0,0,1,1,0
+0.1,0.93,0.98,0.02,0.03,0.04,0.08,0.05,0,0,0,0,0,0,0,0
+0.06,0.97,0.53,0.02,0.02,0.11,0.88,0.06,0,0,0,0,0,0,0,0
+0.07,0.91,0.71,0.05,0.02,0.14,0.57,0.09,0,0,0,0,0,0,0,0
+0.61,0.03,0.94,0.03,0.95,0.07,0.05,0.09,0,0,1,0,1,0,0,0
+0.46,0.43,0.58,0.08,0.9,0.36,0.09,0.58,0,0,0,0,1,0,0,0
+0.11,0.91,0.47,0.03,0.02,0.24,0.88,0.1,0,0,0,0,0,0,0,0
+0.81,0.09,0.11,0.16,0.03,0.68,0.71,0.94,1,0,1,0,0,1,1,1
+0.67,0.02,0.93,0.03,0.95,0.08,0.04,0.16,0,0,1,0,1,0,0,0
+0.12,0.91,0.96,0.06,0.02,0.07,0.13,0.06,0,0,0,0,0,0,0,0
+0.14,0.06,0.75,0.05,0.06,0.07,0.05,0.09,1,0,1,0,0,0,0,0
+0.09,0.96,0.35,0.05,0.01,0.16,0.86,0.09,0,0,0,0,0,0,0,0
+0.07,0.98,0.66,0.02,0.01,0.14,0.62,0.06,0,0,0,0,0,0,0,0
+0.09,0.92,0.76,0.03,0.08,0.29,0.71,0.1,0,0,0,0,0,0,0,0
+0.1,0.87,0.5,0.04,0.01,0.19,0.85,0.11,0,0,0,0,0,0,0,0
+0.23,0.95,0.16,0.04,0.02,0.2,0.2,0.13,0,0,0,0,0,0,0,0
+0.06,0.96,0.28,0.02,0.01,0.17,0.86,0.08,0,0,0,0,0,0,0,0
+0.52,0.03,0.9,0.03,0.75,0.05,0.04,0.08,1,0,1,0,1,0,0,0
+0.36,0.15,0.41,0.86,0.02,0.37,0.55,0.52,1,0,1,0,0,1,0,0
+0.82,0.07,0.57,0.06,0.84,0.46,0.08,0.61,0,0,0,0,1,0,0,0
+0.08,0.96,0.54,0.05,0.01,0.14,0.75,0.08,0,0,0,0,0,0,0,0
+0.58,0.03,0.89,0.03,0.94,0.15,0.05,0.18,0,0,1,0,1,0,0,0
+0.44,0.05,0.97,0.1,0.1,0.27,0.4,0.73,0,0,0,0,0,0,0,0
+0.07,0.96,0.51,0.04,0.01,0.21,0.87,0.1,0,0,0,0,0,0,0,0
+0.09,0.96,0.55,0.03,0.02,0.17,0.51,0.08,0,0,0,0,0,0,0,0
+0.67,0.03,0.94,0.04,0.95,0.09,0.05,0.19,0,0,1,0,1,0,0,0
+0.14,0.95,0.35,0.03,0.02,0.17,0.58,0.09,0,0,0,0,0,0,0,0
+0.71,0.03,0.81,0.03,0.9,0.58,0.09,0.56,0,0,1,0,1,0,0,0
+0.62,0.03,0.82,0.02,0.83,0.09,0.06,0.19,0,0,1,0,1,0,0,0
+0.57,0.02,0.93,0.03,0.96,0.11,0.04,0.12,0,0,1,0,1,0,0,0
+0.06,0.97,0.65,0.02,0.01,0.15,0.88,0.06,0,0,0,0,0,0,0,0
+0.64,0.03,0.92,0.06,0.95,0.08,0.04,0.2,0,0,0,0,1,0,0,0
+0.55,0.74,0.08,0.05,0.05,0.53,0.75,0.94,1,1,0,1,0,1,0,1
+0.09,0.56,0.98,0.03,0.02,0.04,0.06,0.05,0,0,0,0,0,0,0,0
+0.08,0.96,0.56,0.03,0.01,0.06,0.56,0.05,0,0,0,0,0,0,0,0
+0.08,0.97,0.78,0.02,0.01,0.11,0.82,0.05,0,0,0,0,0,0,0,0
+0.24,0.82,0.17,0.25,0.01,0.18,0.59,0.14,0,0,0,0,0,0,0,0
+0.61,0.03,0.78,0.03,0.89,0.09,0.05,0.12,0,0,1,0,1,0,0,0
+0.13,0.89,0.93,0.04,0.02,0.07,0.09,0.07,0,0,0,0,0,0,0,0
+0.55,0.07,0.91,0.07,0.94,0.1,0.04,0.17,0,0,0,0,1,0,0,0
+0.68,0.02,0.94,0.03,0.95,0.08,0.05,0.18,0,0,1,0,1,0,0,0
+0.07,0.97,0.6,0.02,0.02,0.16,0.83,0.05,0,0,0,0,0,0,0,0
+0.18,0.86,0.1,0.06,0.02,0.35,0.92,0.24,0,0,0,0,0,0,0,0
+0.42,0.1,0.96,0.1,0.06,0.65,0.44,0.82,0,0,0,0,0,0,0,0
+0.73,0.15,0.48,0.04,0.86,0.26,0.07,0.58,1,0,0,0,1,0,0,0
+0.32,0.95,0.13,0.04,0.01,0.24,0.55,0.15,0,0,0,0,0,0,0,0
+0.06,0.97,0.74,0.03,0.01,0.12,0.74,0.06,0,0,0,0,0,0,0,0
+0.39,0.06,0.33,0.89,0.02,0.28,0.79,0.41,0,0,0,0,0,1,1,0
+0.23,0.94,0.27,0.02,0.02,0.35,0.84,0.17,0,0,0,0,0,0,0,0
+0.15,0.77,0.14,0.2,0.02,0.18,0.67,0.15,0,0,0,0,0,0,0,0
+0.15,0.96,0.08,0.03,0.02,0.2,0.53,0.08,0,0,0,0,0,0,0,0
+0.09,0.97,0.51,0.03,0.02,0.15,0.16,0.08,0,0,0,0,0,0,0,0
+0.54,0.11,0.19,0.19,0.03,0.19,0.09,0.28,1,1,0,0,0,1,0,0
+0.07,0.65,0.97,0.03,0.04,0.05,0.05,0.05,0,0,0,0,0,0,0,0
+0.3,0.95,0.09,0.04,0.02,0.38,0.9,0.17,0,0,0,0,0,0,0,0
+0.12,0.91,0.11,0.05,0.02,0.14,0.91,0.1,0,0,0,0,0,0,0,0
+0.79,0.05,0.04,0.07,0.26,0.37,0.11,0.84,1,0,1,0,0,1,0,1
+0.07,0.95,0.56,0.03,0.01,0.2,0.75,0.06,0,0,0,0,0,0,0,0
+0.08,0.95,0.52,0.03,0.02,0.34,0.86,0.12,0,0,0,0,0,0,0,0
+0.65,0.03,0.95,0.03,0.95,0.07,0.05,0.17,0,0,1,0,1,0,0,0
+0.08,0.98,0.7,0.02,0.01,0.12,0.78,0.05,0,0,0,0,0,0,0,0
+0.08,0.78,0.41,0.04,0.02,0.12,0.77,0.07,0,0,0,0,0,0,0,0
+0.09,0.97,0.95,0.02,0.02,0.07,0.45,0.05,0,0,0,0,0,0,0,0
+0.36,0.96,0.09,0.04,0.01,0.26,0.46,0.18,0,0,0,0,0,0,0,0
+0.17,0.06,0.5,0.53,0.02,0.04,0.07,0.09,0,0,0,0,0,1,0,0
+0.08,0.96,0.43,0.03,0.01,0.14,0.74,0.07,0,0,0,0,0,0,0,0
+0.08,0.92,0.72,0.03,0.02,0.16,0.66,0.06,0,0,0,0,0,0,0,0
+0.07,0.98,0.84,0.02,0.01,0.12,0.82,0.05,0,0,0,0,0,0,0,0
+0.34,0.07,0.97,0.16,0.03,0.47,0.43,0.61,0,0,0,0,0,0,0,0
+0.31,0.95,0.09,0.04,0.01,0.28,0.61,0.19,0,0,0,0,0,0,0,0
+0.64,0.03,0.95,0.02,0.94,0.08,0.04,0.09,0,0,1,0,1,0,0,0
+0.08,0.93,0.11,0.04,0.01,0.08,0.68,0.07,0,0,0,0,0,0,0,0
+0.08,0.96,0.58,0.04,0.01,0.28,0.84,0.09,0,0,0,0,0,0,0,0
+0.07,0.97,0.49,0.03,0.01,0.08,0.71,0.06,0,0,0,0,0,0,0,0
+0.09,0.92,0.7,0.06,0.02,0.11,0.48,0.09,0,0,0,0,0,0,0,0
+0.52,0.04,0.08,0.04,0.02,0.06,0.09,0.06,1,1,1,1,0,1,0,0
+0.77,0.03,0.82,0.03,0.91,0.63,0.08,0.68,0,0,1,0,1,0,0,0
+0.24,0.15,0.68,0.39,0.04,0.09,0.11,0.16,0,0,0,0,0,0,0,0
+0.08,0.97,0.5,0.05,0.01,0.14,0.88,0.08,0,0,0,0,0,0,0,0
+0.07,0.97,0.6,0.03,0.01,0.08,0.48,0.05,0,0,0,0,0,0,0,0
+0.23,0.31,0.14,0.59,0.02,0.14,0.81,0.33,0,0,0,0,0,1,1,0
+0.09,0.92,0.22,0.14,0.01,0.16,0.74,0.09,0,0,0,0,0,0,0,0
+0.09,0.96,0.67,0.03,0.01,0.13,0.55,0.05,0,0,0,0,0,0,0,0
+0.76,0.22,0.04,0.05,0.55,0.34,0.09,0.34,1,1,0,1,0,1,0,0
+0.77,0.05,0.63,0.1,0.87,0.37,0.08,0.54,0,0,0,0,1,0,0,0
+0.11,0.9,0.22,0.04,0.05,0.2,0.83,0.18,0,0,0,0,0,0,0,0
+0.08,0.97,0.45,0.03,0.01,0.16,0.77,0.07,0,0,0,0,0,0,0,0
+0.49,0.03,0.22,0.05,0.02,0.16,0.06,0.36,1,0,1,0,0,1,0,0
+0.23,0.05,0.66,0.05,0.09,0.08,0.04,0.14,1,0,1,0,0,0,0,0
+0.3,0.04,0.51,0.47,0.01,0.06,0.06,0.1,1,0,1,0,0,0,0,0
+0.09,0.96,0.73,0.03,0.01,0.17,0.8,0.07,0,0,0,0,0,0,0,0
+0.4,0.94,0.07,0.03,0.01,0.34,0.53,0.24,0,0,0,0,0,0,0,0
+0.63,0.04,0.26,0.96,0.02,0.18,0.57,0.59,0,0,0,0,0,1,0,0
+0.59,0.03,0.75,0.03,0.86,0.12,0.06,0.34,0,0,1,0,1,0,0,0
+0.07,0.98,0.79,0.02,0.01,0.14,0.86,0.05,0,0,0,0,0,0,0,0
+0.16,0.5,0.22,0.1,0.03,0.06,0.15,0.11,0,0,0,0,0,0,0,0
+0.57,0.02,0.96,0.03,0.96,0.06,0.03,0.08,0,0,1,0,1,0,0,0
+0.71,0.03,0.93,0.03,0.95,0.1,0.04,0.29,0,0,1,0,1,0,0,0
+0.37,0.19,0.11,0.06,0.05,0.18,0.06,0.24,1,0,0,0,0,1,0,0
+0.54,0.03,0.95,0.03,0.96,0.06,0.04,0.11,0,0,1,0,1,0,0,0
+0.48,0.02,0.96,0.02,0.96,0.09,0.04,0.08,0,0,1,0,1,0,0,0
+0.67,0.03,0.92,0.03,0.95,0.08,0.04,0.2,0,0,1,0,1,0,0,0
+0.07,0.97,0.74,0.02,0.01,0.09,0.82,0.05,0,0,0,0,0,0,0,0
+0.14,0.96,0.36,0.03,0.02,0.21,0.3,0.08,0,0,0,0,0,0,0,0
+0.06,0.97,0.35,0.02,0.02,0.21,0.89,0.07,0,0,0,0,0,0,0,0
+0.09,0.93,0.98,0.02,0.04,0.05,0.08,0.05,0,0,0,0,0,0,0,0
+0.08,0.95,0.39,0.03,0.01,0.24,0.89,0.1,0,0,0,0,0,0,0,0
+0.66,0.03,0.89,0.03,0.92,0.29,0.07,0.4,1,0,1,0,1,0,0,0
+0.67,0.03,0.91,0.03,0.94,0.08,0.05,0.18,0,0,1,0,1,0,0,0
+0.11,0.93,0.98,0.02,0.02,0.04,0.06,0.05,0,0,0,0,0,0,0,0
+0.07,0.97,0.68,0.02,0.01,0.09,0.8,0.05,0,0,0,0,0,0,0,0
+0.1,0.95,0.34,0.05,0.01,0.14,0.36,0.07,0,0,0,0,0,0,0,0
+0.26,0.96,0.2,0.04,0.01,0.18,0.64,0.13,0,0,0,0,0,0,0,0
+0.2,0.91,0.14,0.08,0.02,0.19,0.58,0.56,1,0,1,0,0,0,0,0
+0.07,0.97,0.51,0.03,0.01,0.14,0.82,0.05,0,0,0,0,0,0,0,0
+0.08,0.65,0.98,0.03,0.02,0.04,0.07,0.05,0,0,0,0,0,0,0,0
+0.46,0.04,0.18,0.04,0.02,0.04,0.08,0.08,1,1,1,1,0,1,0,0
+0.11,0.91,0.95,0.03,0.01,0.06,0.09,0.06,0,0,0,0,0,0,0,0
+0.08,0.93,0.21,0.02,0.02,0.15,0.84,0.07,0,0,0,0,0,0,0,0
+0.77,0.03,0.65,0.03,0.8,0.17,0.07,0.42,1,0,1,0,1,0,0,0
+0.07,0.98,0.69,0.03,0.01,0.16,0.8,0.05,0,0,0,0,0,0,0,0
+0.47,0.08,0.92,0.07,0.96,0.09,0.05,0.21,0,0,0,0,1,0,0,0
+0.18,0.95,0.46,0.03,0.01,0.19,0.43,0.13,0,0,0,0,0,0,0,0
+0.53,0.03,0.96,0.03,0.96,0.06,0.04,0.08,0,0,1,0,1,0,0,0
+0.49,0.03,0.09,0.94,0.01,0.35,0.85,0.71,0,0,0,0,0,1,1,1
+0.86,0.02,0.11,0.06,0.01,0.27,0.08,0.69,1,0,1,0,0,1,0,0
+0.51,0.08,0.07,0.21,0.02,0.29,0.17,0.58,1,1,1,1,0,1,0,0
+0.85,0.04,0.77,0.16,0.67,0.82,0.08,0.88,0,0,0,0,1,0,0,0
+0.07,0.92,0.98,0.02,0.18,0.07,0.12,0.05,0,0,0,0,0,0,0,0
+0.06,0.97,0.93,0.02,0.58,0.06,0.18,0.05,0,0,0,0,1,0,0,0
+0.09,0.95,0.56,0.02,0.02,0.33,0.81,0.09,0,0,0,0,0,0,0,0
+0.22,0.11,0.76,0.41,0.02,0.07,0.09,0.12,0,0,0,0,0,0,0,0
+0.09,0.9,0.47,0.08,0.02,0.21,0.78,0.13,0,0,0,0,0,0,0,0
+0.1,0.95,0.98,0.02,0.03,0.05,0.07,0.06,0,0,0,0,0,0,0,0
+0.38,0.94,0.13,0.03,0.02,0.34,0.52,0.37,0,0,0,0,0,0,0,0
+0.06,0.97,0.53,0.02,0.01,0.15,0.83,0.06,0,0,0,0,0,0,0,0
+0.42,0.92,0.08,0.03,0.01,0.32,0.62,0.21,0,0,0,0,0,0,0,0
+0.68,0.03,0.93,0.03,0.95,0.09,0.05,0.16,0,0,1,0,1,0,0,0
+0.07,0.96,0.61,0.02,0.02,0.16,0.82,0.06,0,0,0,0,0,0,0,0
+0.09,0.89,0.15,0.03,0.01,0.17,0.87,0.07,0,0,0,0,0,0,0,0
+0.59,0.12,0.23,0.56,0.02,0.24,0.35,0.63,1,0,1,0,0,1,0,0
+0.34,0.94,0.14,0.03,0.01,0.19,0.74,0.21,0,0,0,0,0,0,0,0
+0.06,0.97,0.42,0.03,0.01,0.11,0.79,0.06,0,0,0,0,0,0,0,0
+0.38,0.94,0.09,0.04,0.02,0.26,0.34,0.23,0,0,0,0,0,0,0,0
+0.43,0.93,0.08,0.03,0.01,0.29,0.8,0.32,0,0,0,0,0,0,0,0
+0.31,0.05,0.97,0.06,0.06,0.13,0.24,0.41,0,0,0,0,0,0,0,0
+0.09,0.37,0.98,0.03,0.03,0.05,0.04,0.05,0,0,0,0,0,0,0,0
+0.72,0.03,0.93,0.03,0.95,0.07,0.04,0.19,0,0,1,0,1,0,0,0
+0.47,0.95,0.06,0.03,0.02,0.36,0.85,0.28,0,0,0,0,0,0,0,0
+0.3,0.95,0.22,0.03,0.01,0.28,0.64,0.16,0,0,0,0,0,0,0,0
+0.81,0.02,0.76,0.02,0.91,0.36,0.07,0.51,1,0,1,0,1,0,0,0
+0.07,0.94,0.29,0.03,0.02,0.18,0.88,0.08,0,0,0,0,0,0,0,0
+0.83,0.03,0.5,0.03,0.89,0.21,0.07,0.49,0,0,0,0,1,0,0,0
+0.52,0.03,0.9,0.06,0.91,0.06,0.04,0.12,1,0,0,0,1,0,0,0
+0.26,0.31,0.08,0.21,0.02,0.28,0.9,0.28,0,0,0,0,0,0,0,0
+0.08,0.97,0.74,0.02,0.02,0.15,0.89,0.07,0,0,0,0,0,0,0,0
+0.41,0.95,0.11,0.03,0.01,0.26,0.82,0.23,0,0,0,0,0,0,0,0
+0.74,0.03,0.75,0.03,0.85,0.23,0.07,0.29,1,0,1,0,1,0,0,0
+0.15,0.69,0.13,0.14,0.02,0.13,0.83,0.12,0,0,0,0,0,0,0,0
+0.07,0.98,0.84,0.02,0.01,0.13,0.85,0.05,0,0,0,0,0,0,0,0
+0.26,0.96,0.09,0.04,0.02,0.26,0.85,0.13,0,0,0,0,0,0,0,0
+0.12,0.8,0.98,0.03,0.01,0.05,0.07,0.05,0,0,0,0,0,0,0,0
+0.37,0.95,0.06,0.03,0.01,0.34,0.74,0.23,0,0,0,0,0,0,0,0
+0.06,0.96,0.35,0.03,0.01,0.22,0.87,0.07,0,0,0,0,0,0,0,0
+0.78,0.02,0.9,0.03,0.94,0.21,0.06,0.36,1,0,1,0,1,0,0,0
+0.25,0.21,0.76,0.55,0.02,0.07,0.1,0.12,0,0,0,0,0,1,0,0
+0.39,0.08,0.08,0.08,0.03,0.09,0.06,0.09,1,0,1,0,0,1,0,0
+0.37,0.03,0.99,0.07,0.01,0.09,0.05,0.1,0,0,0,0,0,0,0,0
+0.11,0.84,0.71,0.06,0.03,0.31,0.4,0.11,0,0,0,0,0,0,0,0
+0.72,0.12,0.12,0.15,0.02,0.5,0.63,0.71,1,0,1,0,0,1,0,1
+0.36,0.95,0.06,0.04,0.02,0.23,0.77,0.2,0,0,0,0,0,0,0,0
+0.1,0.96,0.16,0.03,0.01,0.14,0.53,0.09,0,0,0,0,0,0,0,0
+0.07,0.97,0.62,0.02,0.01,0.16,0.8,0.06,0,0,0,0,0,0,0,0
+0.07,0.96,0.73,0.03,0.01,0.13,0.73,0.06,0,0,0,0,0,0,0,0
+0.1,0.95,0.48,0.03,0.01,0.2,0.77,0.07,0,0,0,0,0,0,0,0
+0.08,0.95,0.98,0.03,0.04,0.11,0.15,0.06,0,0,0,0,0,0,0,0
+0.08,0.92,0.31,0.04,0.03,0.3,0.79,0.13,0,0,0,0,0,0,0,0
+0.07,0.63,0.97,0.03,0.06,0.06,0.06,0.05,0,0,0,0,0,0,0,0
+0.08,0.96,0.42,0.03,0.01,0.15,0.81,0.07,0,0,0,0,0,0,0,0
+0.07,0.96,0.41,0.02,0.02,0.2,0.8,0.07,0,0,0,0,0,0,0,0
+0.08,0.97,0.69,0.03,0.02,0.13,0.88,0.06,0,0,0,0,0,0,0,0
+0.29,0.95,0.18,0.04,0.02,0.3,0.37,0.14,0,0,0,0,0,0,0,0
+0.4,0.95,0.07,0.04,0.02,0.28,0.81,0.24,0,0,0,0,0,0,0,0
+0.09,0.97,0.65,0.03,0.01,0.16,0.87,0.07,0,0,0,0,0,0,0,0
+0.16,0.64,0.17,0.05,0.02,0.15,0.9,0.13,0,0,0,0,0,0,0,0
+0.71,0.04,0.82,0.08,0.9,0.13,0.04,0.6,1,0,0,0,0,0,0,0
+0.17,0.95,0.1,0.05,0.01,0.19,0.48,0.16,0,0,0,0,0,0,0,0
+0.08,0.93,0.46,0.03,0.02,0.12,0.8,0.08,0,0,0,0,0,0,0,0
+0.86,0.04,0.57,0.12,0.65,0.81,0.11,0.9,0,0,0,0,1,0,0,0
+0.07,0.97,0.76,0.02,0.01,0.14,0.74,0.05,1,0,0,0,0,0,0,0
+0.73,0.03,0.91,0.03,0.95,0.09,0.05,0.29,0,0,1,0,1,0,0,0
+0.07,0.96,0.57,0.03,0.02,0.18,0.86,0.09,0,0,0,0,0,0,0,0
+0.11,0.67,0.11,0.07,0.01,0.23,0.09,0.15,0,0,0,0,0,0,0,0
+0.07,0.98,0.54,0.02,0.02,0.15,0.52,0.05,0,0,0,0,0,0,0,0
+0.08,0.96,0.87,0.02,0.01,0.13,0.8,0.05,0,0,0,0,0,0,0,0
+0.07,0.97,0.76,0.02,0.01,0.16,0.84,0.05,0,0,0,0,0,0,0,0
+0.33,0.95,0.06,0.03,0.02,0.32,0.77,0.2,0,0,0,0,0,0,0,0
+0.35,0.94,0.06,0.04,0.01,0.26,0.54,0.21,0,0,0,0,0,0,0,0
+0.1,0.92,0.28,0.05,0.02,0.08,0.21,0.09,0,0,0,0,0,0,0,0
+0.07,0.96,0.23,0.03,0.01,0.08,0.58,0.06,0,0,0,0,0,0,0,0
+0.08,0.96,0.46,0.03,0.02,0.17,0.82,0.06,0,0,0,0,0,0,0,0
+0.07,0.97,0.59,0.02,0.01,0.13,0.74,0.04,0,0,0,0,0,0,0,0
+0.71,0.03,0.72,0.02,0.85,0.28,0.07,0.21,1,0,1,0,1,0,0,0
+0.1,0.96,0.11,0.03,0.02,0.23,0.87,0.08,0,0,0,0,0,0,0,0
+0.59,0.38,0.6,0.32,0.86,0.39,0.08,0.62,1,0,0,0,1,0,0,0
+0.76,0.03,0.77,0.02,0.87,0.34,0.07,0.29,1,0,1,0,1,0,0,0
+0.32,0.95,0.11,0.03,0.02,0.33,0.6,0.19,0,0,0,0,0,0,0,0
+0.06,0.95,0.56,0.04,0.02,0.26,0.82,0.08,0,0,0,0,0,0,0,0
+0.62,0.05,0.95,0.09,0.87,0.14,0.07,0.21,1,0,0,0,0,0,0,0
+0.35,0.94,0.07,0.06,0.01,0.35,0.93,0.44,0,0,0,0,0,0,0,0
+0.07,0.96,0.78,0.04,0.01,0.13,0.79,0.06,0,0,0,0,0,0,0,0
+0.09,0.96,0.36,0.03,0.01,0.17,0.86,0.08,0,0,0,0,0,0,0,0
+0.37,0.06,0.14,0.93,0.02,0.08,0.08,0.12,1,0,1,0,0,1,0,0
+0.12,0.93,0.24,0.09,0.02,0.12,0.67,0.17,0,0,0,0,0,0,0,0
+0.1,0.77,0.97,0.04,0.04,0.06,0.32,0.06,0,0,0,0,0,0,0,0
+0.1,0.96,0.65,0.03,0.02,0.22,0.85,0.08,0,0,0,0,0,0,0,0
+0.07,0.96,0.64,0.02,0.02,0.09,0.63,0.06,0,0,0,0,0,0,0,0
+0.09,0.97,0.48,0.03,0.01,0.14,0.71,0.06,0,0,0,0,0,0,0,0
+0.09,0.95,0.78,0.03,0.03,0.16,0.81,0.07,0,0,0,0,0,0,0,0
+0.7,0.03,0.89,0.02,0.91,0.1,0.06,0.12,1,0,1,0,1,0,0,0
+0.08,0.95,0.47,0.04,0.02,0.13,0.1,0.07,0,1,0,1,0,0,0,0
+0.11,0.92,0.98,0.03,0.06,0.13,0.17,0.05,0,0,0,0,0,0,0,0
+0.24,0.95,0.08,0.04,0.01,0.23,0.25,0.17,0,0,0,0,0,0,0,0
+0.16,0.97,0.21,0.04,0.02,0.25,0.67,0.11,0,0,0,0,0,0,0,0
+0.22,0.96,0.1,0.03,0.01,0.27,0.81,0.12,0,0,0,0,0,0,0,0
+0.28,0.37,0.96,0.13,0.05,0.26,0.39,0.64,0,0,0,0,0,0,0,0
+0.07,0.97,0.45,0.02,0.01,0.13,0.6,0.06,0,0,0,0,0,0,0,0
+0.07,0.98,0.48,0.03,0.02,0.1,0.1,0.07,0,1,0,1,0,0,0,0
+0.78,0.02,0.77,0.03,0.92,0.39,0.08,0.44,1,0,1,0,1,0,0,0
+0.08,0.97,0.94,0.03,0.02,0.08,0.5,0.04,0,0,0,0,0,0,0,0
+0.16,0.51,0.26,0.07,0.02,0.2,0.89,0.35,0,0,0,0,0,0,0,0
+0.09,0.76,0.97,0.03,0.07,0.05,0.05,0.04,0,0,0,0,0,0,0,0
+0.73,0.02,0.84,0.02,0.9,0.11,0.06,0.13,1,0,1,0,1,0,0,0
+0.24,0.03,0.98,0.06,0.01,0.07,0.06,0.07,0,0,0,0,0,0,0,0
+0.38,0.94,0.09,0.04,0.01,0.38,0.88,0.33,0,0,0,0,0,0,0,0
+0.06,0.96,0.82,0.04,0.01,0.16,0.85,0.06,0,0,0,0,0,0,0,0
+0.07,0.97,0.87,0.02,0.01,0.1,0.62,0.04,0,0,0,0,0,0,0,0
+0.71,0.03,0.92,0.03,0.92,0.1,0.05,0.31,0,0,1,0,1,0,0,0
+0.58,0.02,0.91,0.03,0.93,0.04,0.04,0.07,1,0,1,0,1,0,0,0
+0.07,0.98,0.88,0.02,0.01,0.1,0.79,0.05,0,0,0,0,0,0,0,0
+0.09,0.97,0.59,0.03,0.02,0.13,0.83,0.07,0,0,0,0,0,0,0,0
+0.09,0.98,0.59,0.02,0.02,0.3,0.42,0.06,0,0,0,0,0,0,0,0
+0.21,0.12,0.09,0.62,0.01,0.16,0.75,0.34,0,0,0,0,0,1,1,0
+0.46,0.06,0.91,0.09,0.95,0.08,0.04,0.15,0,0,0,0,1,0,0,0
+0.08,0.98,0.46,0.02,0.01,0.16,0.78,0.06,0,0,0,0,0,0,0,0
+0.07,0.94,0.43,0.02,0.02,0.13,0.86,0.06,0,0,0,0,0,0,0,0
+0.08,0.97,0.58,0.02,0.02,0.14,0.81,0.06,0,0,0,0,0,0,0,0
+0.17,0.96,0.13,0.04,0.02,0.27,0.59,0.11,0,0,0,0,0,0,0,0
+0.09,0.93,0.7,0.04,0.02,0.12,0.66,0.08,0,0,0,0,0,0,0,0
+0.24,0.4,0.15,0.45,0.02,0.16,0.9,0.31,0,0,0,0,0,0,0,0
+0.13,0.96,0.11,0.03,0.02,0.2,0.83,0.1,0,0,0,0,0,0,0,0
+0.07,0.97,0.68,0.03,0.01,0.14,0.8,0.06,0,0,0,0,0,0,0,0
+0.08,0.97,0.67,0.03,0.01,0.11,0.59,0.05,0,0,0,0,0,0,0,0
+0.07,0.97,0.44,0.02,0.02,0.2,0.85,0.06,0,0,0,0,0,0,0,0
+0.08,0.95,0.6,0.02,0.01,0.22,0.74,0.07,0,0,0,0,0,0,0,0
+0.1,0.95,0.46,0.05,0.01,0.19,0.86,0.13,0,0,0,0,0,0,0,0
+0.27,0.96,0.14,0.03,0.01,0.34,0.72,0.19,0,0,0,0,0,0,0,0
+0.37,0.94,0.1,0.04,0.01,0.25,0.61,0.14,0,0,0,0,0,0,0,0
+0.08,0.96,0.73,0.03,0.01,0.11,0.63,0.06,0,0,0,0,0,0,0,0
+0.72,0.03,0.88,0.03,0.91,0.12,0.06,0.12,1,0,1,0,1,0,0,0
+0.69,0.03,0.39,0.07,0.3,0.42,0.27,0.52,1,0,0,0,1,0,0,0
+0.08,0.96,0.59,0.03,0.01,0.21,0.83,0.06,0,0,0,0,0,0,0,0
+0.76,0.02,0.82,0.02,0.92,0.36,0.06,0.31,1,0,1,0,1,0,0,0
+0.08,0.97,0.92,0.02,0.02,0.07,0.65,0.05,0,0,0,0,0,0,0,0
+0.83,0.04,0.34,0.07,0.86,0.32,0.09,0.65,1,0,0,0,1,0,0,0
+0.07,0.97,0.59,0.03,0.02,0.22,0.87,0.07,0,0,0,0,0,0,0,0
+0.8,0.03,0.71,0.03,0.86,0.18,0.08,0.67,1,0,1,0,1,0,0,0
+0.46,0.92,0.08,0.03,0.01,0.37,0.6,0.25,0,0,0,0,0,0,0,0
+0.33,0.96,0.08,0.03,0.01,0.24,0.82,0.18,0,0,0,0,0,0,0,0
+0.08,0.91,0.36,0.05,0.03,0.14,0.52,0.09,0,0,0,0,0,0,0,0
+0.07,0.96,0.54,0.02,0.02,0.15,0.68,0.06,0,0,0,0,0,0,0,0
+0.54,0.05,0.96,0.07,0.79,0.08,0.05,0.14,1,0,0,0,0,0,0,0
+0.35,0.94,0.07,0.04,0.01,0.38,0.83,0.19,0,0,0,0,0,0,0,0
+0.36,0.96,0.08,0.04,0.02,0.27,0.72,0.19,0,0,0,0,0,0,0,0
+0.1,0.94,0.91,0.02,0.03,0.09,0.26,0.05,0,0,0,0,0,0,0,0
+0.08,0.28,0.97,0.03,0.03,0.05,0.05,0.05,0,0,0,0,0,0,0,0
+0.62,0.07,0.18,0.79,0.05,0.46,0.16,0.91,1,1,0,1,0,1,0,1
+0.09,0.97,0.63,0.02,0.01,0.14,0.79,0.05,0,0,0,0,0,0,0,0
+0.07,0.97,0.52,0.03,0.01,0.19,0.88,0.06,0,0,0,0,0,0,0,0
+0.38,0.94,0.09,0.03,0.01,0.4,0.76,0.24,0,0,0,0,0,0,0,0
+0.08,0.98,0.47,0.03,0.01,0.16,0.65,0.06,0,0,0,0,0,0,0,0
+0.08,0.97,0.46,0.04,0.02,0.14,0.81,0.08,0,0,0,0,0,0,0,0
+0.57,0.03,0.91,0.03,0.93,0.05,0.04,0.08,1,0,1,0,1,0,0,0
+0.07,0.97,0.55,0.02,0.02,0.11,0.75,0.05,0,0,0,0,0,0,0,0
+0.07,0.97,0.89,0.02,0.01,0.1,0.7,0.05,0,0,0,0,0,0,0,0
+0.62,0.04,0.92,0.03,0.95,0.11,0.05,0.13,0,0,1,0,1,0,0,0
+0.14,0.8,0.75,0.07,0.01,0.39,0.59,0.11,0,0,0,0,0,0,0,0
+0.79,0.02,0.77,0.03,0.92,0.43,0.08,0.5,1,0,1,0,1,0,0,0
+0.1,0.8,0.97,0.04,0.01,0.06,0.08,0.07,0,0,0,0,0,0,0,0
+0.75,0.03,0.84,0.02,0.9,0.13,0.06,0.15,1,0,1,0,1,0,0,0
+0.07,0.97,0.62,0.02,0.01,0.17,0.86,0.06,0,0,0,0,0,0,0,0
+0.75,0.04,0.91,0.04,0.95,0.13,0.06,0.41,0,0,1,0,1,0,0,0
+0.07,0.97,0.53,0.02,0.01,0.2,0.87,0.07,0,0,0,0,0,0,0,0
+0.45,0.05,0.12,0.93,0.02,0.22,0.54,0.46,1,0,0,0,0,1,0,0
+0.13,0.96,0.99,0.02,0.01,0.04,0.07,0.04,0,0,0,0,0,0,0,0
+0.29,0.47,0.45,0.08,0.81,0.23,0.07,0.51,1,0,0,0,0,0,0,0
+0.07,0.97,0.75,0.03,0.02,0.09,0.46,0.05,0,0,0,0,0,0,0,0
+0.63,0.21,0.22,0.13,0.02,0.67,0.66,0.68,0,0,0,0,0,1,0,0
+0.81,0.04,0.64,0.08,0.92,0.22,0.06,0.55,1,0,0,0,1,0,0,0
+0.08,0.96,0.32,0.02,0.01,0.2,0.72,0.06,0,0,0,0,0,0,0,0
+0.58,0.04,0.92,0.03,0.95,0.13,0.06,0.13,0,0,1,0,1,0,0,0
+0.08,0.97,0.94,0.03,0.01,0.1,0.61,0.05,0,0,0,0,0,0,0,0
+0.22,0.03,0.99,0.05,0.01,0.08,0.06,0.06,0,0,0,0,0,0,0,0
+0.5,0.47,0.64,0.26,0.87,0.4,0.08,0.61,1,0,0,0,1,0,0,0
+0.57,0.27,0.11,0.09,0.08,0.65,0.91,0.72,1,1,0,0,0,1,1,1
+0.1,0.69,0.33,0.03,0.02,0.32,0.88,0.1,0,0,0,0,0,0,0,0
+0.07,0.97,0.8,0.03,0.01,0.13,0.73,0.05,0,0,0,0,0,0,0,0
+0.83,0.02,0.75,0.03,0.89,0.53,0.08,0.58,1,0,1,0,1,0,0,0
+0.75,0.03,0.62,0.03,0.85,0.57,0.12,0.53,1,0,1,0,1,0,0,0
+0.71,0.03,0.84,0.02,0.88,0.41,0.09,0.29,1,0,1,0,1,0,0,0
+0.07,0.96,0.51,0.02,0.02,0.24,0.84,0.07,0,0,0,0,0,0,0,0
+0.5,0.07,0.17,0.88,0.02,0.27,0.8,0.71,1,0,1,0,0,1,1,1
+0.79,0.03,0.55,0.03,0.84,0.14,0.07,0.38,1,0,1,0,1,0,0,0
+0.76,0.02,0.89,0.03,0.85,0.14,0.05,0.22,1,0,1,0,1,0,0,0
+0.42,0.93,0.09,0.04,0.02,0.4,0.53,0.31,0,0,0,0,0,0,0,0
+0.08,0.36,0.77,0.06,0.04,0.04,0.05,0.07,0,0,0,0,0,0,0,0
+0.06,0.96,0.77,0.03,0.01,0.19,0.84,0.06,0,0,0,0,0,0,0,0
+0.52,0.23,0.5,0.26,0.47,0.52,0.53,0.45,1,0,0,0,0,1,0,0
+0.1,0.93,0.44,0.05,0.01,0.13,0.8,0.07,0,0,0,0,0,0,0,0
+0.36,0.18,0.12,0.07,0.06,0.52,0.07,0.65,1,1,0,0,0,1,0,0
diff --git a/crates/email/src/domain/focus/rule/test.rs b/crates/email/src/domain/focus/rule/test.rs
new file mode 100644
index 0000000000..6d519ae082
--- /dev/null
+++ b/crates/email/src/domain/focus/rule/test.rs
@@ -0,0 +1,260 @@
+use super::*;
+use crate::domain::focus::FocusQuestion;
+
+/// Jev's recorded answers (the shipped questions, with the owner's memory as
+/// context) and the owner's signals for 643 real signal threads from one
+/// founder's inbox, with the verdicts of the experiment's reference
+/// implementation. No email content.
+const EXPERIMENT: &str = include_str!("experiment.csv");
+
+fn flag(value: &str) -> bool {
+ match value {
+ "0" => false,
+ "1" => true,
+ other => panic!("not a 0/1 flag: {other}"),
+ }
+}
+
+fn parse_row(line: &str) -> (FocusAnswers, FocusSignals, (bool, bool, bool)) {
+ let cells = line.split(',').collect::<Vec<_>>();
+ let answer_count = FocusQuestion::ALL.len();
+ assert_eq!(cells.len(), answer_count + 8, "bad fixture row: {line}");
+ let (probabilities, rest) = cells.split_at(answer_count);
+ let probabilities = probabilities
+ .iter()
+ .map(|cell| cell.parse::<f32>().expect("probability"))
+ .collect::<Vec<_>>();
+ let answers =
+ FocusAnswers::from_probabilities(&probabilities).expect("one answer per question");
+ let signals = FocusSignals {
+ contact: flag(rest[0]),
+ replied: flag(rest[1]),
+ teammate: flag(rest[2]),
+ latest_from_owner: flag(rest[3]),
+ calendar_subject: flag(rest[4]),
+ };
+ (
+ answers,
+ signals,
+ (flag(rest[5]), flag(rest[6]), flag(rest[7])),
+ )
+}
+
+fn answers(focus: f32) -> FocusAnswers {
+ FocusAnswers {
+ focus,
+ outreach: 0.0,
+ automated: 0.0,
+ customer: 0.0,
+ calendar_rsvp: 0.0,
+ needs_decision: 0.0,
+ needs_response: 0.0,
+ needs_follow_up: 0.0,
+ }
+}
+
+#[test]
+fn reproduces_the_experiment_verdicts() {
+ let mut rows = EXPERIMENT.lines();
+ assert!(
+ rows.next()
+ .is_some_and(|header| header.starts_with("focus,"))
+ );
+ let (mut focus, mut reply, mut follow_up, mut total) = (0, 0, 0, 0);
+ for (index, line) in rows.enumerate() {
+ let (answers, signals, (expect_focus, expect_reply, expect_follow_up)) = parse_row(line);
+ let verdict = decide(&answers, &signals);
+ assert_eq!(verdict.is_focus, expect_focus, "row {index}: {line}");
+ assert_eq!(verdict.needs_reply, expect_reply, "row {index}: {line}");
+ assert_eq!(
+ verdict.needs_follow_up, expect_follow_up,
+ "row {index}: {line}"
+ );
+ total += 1;
+ focus += usize::from(verdict.is_focus);
+ reply += usize::from(verdict.needs_reply);
+ follow_up += usize::from(verdict.needs_follow_up);
+ }
+ assert_eq!((total, focus, reply, follow_up), (643, 84, 27, 25));
+}
+
+#[test]
+fn calendar_subjects() {
+ for subject in [
+ "Accepted: Demo @ Fri Aug 7, 2026",
+ "Tentatively Accepted: Sync Team Meet",
+ "Updated invitation with note: Scoping/Planning",
+ "Canceled event: Standup @ Fri",
+ "Invitation : spaced colon",
+ "DECLINED: Prod Deploy",
+ ] {
+ assert!(is_calendar_subject(subject), "{subject}");
+ }
+ for subject in [
+ "Re: Invitation: thoughts on the deck",
+ "Invitations for the launch party",
+ "Greg x Teo",
+ "",
+ ] {
+ assert!(!is_calendar_subject(subject), "{subject}");
+ }
+}
+
+#[test]
+fn calendar_notices_stay_out_even_when_relevant() {
+ let mut relevant = answers(0.9);
+ let by_subject = decide(
+ &relevant,
+ &FocusSignals {
+ calendar_subject: true,
+ contact: true,
+ ..FocusSignals::default()
+ },
+ );
+ assert!(!by_subject.is_focus);
+ assert_eq!(by_subject.category, FocusCategory::Calendar);
+
+ relevant.calendar_rsvp = 0.65;
+ assert!(decide(&relevant, &FocusSignals::default()).is_focus);
+ relevant.calendar_rsvp = 0.7;
+ assert!(!decide(&relevant, &FocusSignals::default()).is_focus);
+}
+
+#[test]
+fn outreach_from_strangers_needs_a_firmer_yes() {
+ let mut application = answers(0.55);
+ application.outreach = 0.96;
+ let stranger = decide(&application, &FocusSignals::default());
+ assert!(!stranger.is_focus);
+ assert_eq!(stranger.category, FocusCategory::Outreach);
+
+ // A profile that asks for this kind of mail clears the higher bar.
+ application.focus = 0.6;
+ assert!(decide(&application, &FocusSignals::default()).is_focus);
+
+ application.focus = 0.55;
+ let replied = FocusSignals {
+ replied: true,
+ contact: true,
+ ..FocusSignals::default()
+ };
+ assert!(decide(&application, &replied).is_focus);
+}
+
+#[test]
+fn contacts_get_a_lower_bar_unless_it_is_a_pitch() {
+ let contact = FocusSignals {
+ contact: true,
+ ..FocusSignals::default()
+ };
+ let borderline = answers(0.35);
+ assert!(!decide(&borderline, &FocusSignals::default()).is_focus);
+ let verdict = decide(&borderline, &contact);
+ assert!(verdict.is_focus);
+ assert_eq!(verdict.category, FocusCategory::Known);
+
+ let mut pitch = borderline;
+ pitch.outreach = 0.8;
+ assert!(!decide(&pitch, &contact).is_focus);
+}
+
+#[test]
+fn automated_mail_needs_someone_to_vouch_for_it() {
+ let mut automated = answers(0.6);
+ automated.automated = 0.9;
+ let verdict = decide(&automated, &FocusSignals::default());
+ assert!(!verdict.is_focus);
+ assert_eq!(verdict.category, FocusCategory::Automated);
+
+ let contact = FocusSignals {
+ contact: true,
+ ..FocusSignals::default()
+ };
+ assert!(decide(&automated, &contact).is_focus);
+
+ let mut customer = automated;
+ customer.customer = 0.7;
+ let verdict = decide(&customer, &FocusSignals::default());
+ assert!(verdict.is_focus);
+ assert_eq!(verdict.category, FocusCategory::Customer);
+}
+
+#[test]
+fn flags_need_a_confident_yes() {
+ let mut maybe = answers(0.8);
+ maybe.needs_response = 0.65;
+ maybe.needs_follow_up = 0.65;
+ let verdict = decide(&maybe, &FocusSignals::default());
+ assert!(verdict.is_focus);
+ assert!(!verdict.needs_reply);
+ assert!(!verdict.needs_follow_up);
+}
+
+#[test]
+fn reply_needed_clears_once_the_owner_answers() {
+ let mut asked = answers(0.8);
+ asked.needs_response = 0.9;
+ assert!(decide(&asked, &FocusSignals::default()).needs_reply);
+ let answered = FocusSignals {
+ latest_from_owner: true,
+ ..FocusSignals::default()
+ };
+ assert!(!decide(&asked, &answered).needs_reply);
+}
+
+#[test]
+fn flags_only_apply_inside_focus() {
+ let mut pitch = answers(0.1);
+ pitch.outreach = 0.95;
+ pitch.needs_response = 0.9;
+ pitch.needs_follow_up = 0.9;
+ let verdict = decide(&pitch, &FocusSignals::default());
+ assert!(!verdict.is_focus);
+ assert!(!verdict.needs_reply);
+ assert!(!verdict.needs_follow_up);
+ assert_eq!(verdict.category, FocusCategory::Outreach);
+}
+
+#[test]
+fn importance_weights_reply_decision_and_relationship() {
+ let mut everything = answers(1.0);
+ everything.needs_response = 1.0;
+ everything.needs_follow_up = 1.0;
+ everything.needs_decision = 1.0;
+ let contact = FocusSignals {
+ contact: true,
+ ..FocusSignals::default()
+ };
+ assert_eq!(decide(&everything, &contact).importance, 100);
+ assert_eq!(
+ decide(&answers(0.8), &FocusSignals::default()).importance,
+ 44
+ );
+ assert_eq!(
+ decide(&answers(0.0), &FocusSignals::default()).importance,
+ 0
+ );
+}
+
+#[test]
+fn customers_outrank_other_focus_categories() {
+ let mut request = answers(0.7);
+ request.customer = 0.6;
+ let teammate = FocusSignals {
+ teammate: true,
+ contact: true,
+ ..FocusSignals::default()
+ };
+ assert_eq!(
+ decide(&request, &teammate).category,
+ FocusCategory::Customer
+ );
+ assert_eq!(
+ decide(&answers(0.7), &teammate).category,
+ FocusCategory::Team
+ );
+ assert_eq!(
+ decide(&answers(0.7), &FocusSignals::default()).category,
+ FocusCategory::Other
+ );
+}
diff --git a/crates/email/src/domain/focus/service.rs b/crates/email/src/domain/focus/service.rs
new file mode 100644
index 0000000000..457aa0d7dc
--- /dev/null
+++ b/crates/email/src/domain/focus/service.rs
@@ -0,0 +1,301 @@
+//! Classifying threads and reading Focus back.
+
+use std::{
+ collections::{HashMap, HashSet},
+ sync::{Mutex, MutexGuard, PoisonError},
+};
+
+use chrono::{DateTime, Duration, Utc};
+use macro_user_id::user_id::MacroUserIdStr;
+use rootcause::Report;
+use uuid::Uuid;
+
+use super::{
+ input::jev_input,
+ models::{FocusAnswers, FocusRecord, FocusThread, FocusVerdict, StaleThread, ThreadFocus},
+ ports::{FocusClassifier, FocusClassifierError, FocusStore, ProfileSource},
+ questions::FOCUS_QUESTIONS,
+ rule::decide,
+ signals::signals,
+};
+
+/// Most Focus threads one list returns; one hydration batch.
+const MAX_FOCUS_THREADS: i64 = 500;
+/// Longest window the Focus list looks back over, in days.
+const MAX_WINDOW_DAYS: u16 = 90;
+/// Rejections in a row that end a sweep: the classifier is refusing every
+/// request (a revoked key, say), not one thread.
+const MAX_REJECTIONS_IN_A_ROW: usize = 5;
+
+/// What happened to one thread.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub enum ClassifyOutcome {
+ /// Classified and stored.
+ Classified(FocusVerdict),
+ /// Already classified at its latest message.
+ UpToDate,
+ /// The thread is gone, or has no message from anyone but the owner.
+ Missing,
+ /// The thread is not in the signal inbox.
+ NotSignal,
+ /// The inbox is not on the allowlist, so nothing left the system.
+ NotEnabled,
+ /// The classifier was unavailable; a later sweep retries.
+ Unavailable,
+ /// The classifier refused the thread.
+ Rejected,
+}
+
+/// Counts from one sweep.
+#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
+pub struct SweepReport {
+ /// Threads the sweep found stale.
+ pub candidates: usize,
+ /// Threads classified.
+ pub classified: usize,
+ /// Threads skipped as up to date, missing, not signal or not enabled, or
+ /// already checked at their latest mail.
+ pub skipped: usize,
+ /// Threads that failed. A rejected thread waits for new mail; any other
+ /// failure is retried by the next sweep.
+ pub failed: usize,
+ /// Whether the sweep stopped early because the classifier was unavailable
+ /// or kept rejecting requests.
+ pub stopped_early: bool,
+}
+
+/// Classifies threads for inboxes on the allowlist.
+pub struct FocusService<S, P, C> {
+ store: S,
+ profiles: P,
+ classifier: C,
+ enabled_domains: Vec<String>,
+ /// Threads a sweep checked at their latest mail without storing a result
+ /// (rejected, nothing to classify, or a result already stored), so later
+ /// sweeps skip them until new mail arrives. In memory: a restart retries
+ /// each once.
+ settled: Mutex<HashMap<Uuid, DateTime<Utc>>>,
+}
+
+impl<S, P, C> FocusService<S, P, C>
+where
+ S: FocusStore,
+ P: ProfileSource,
+ C: FocusClassifier,
+{
+ /// Classify only inboxes whose address is at one of `enabled_domains`;
+ /// with none, nothing is classified.
+ pub fn new(store: S, profiles: P, classifier: C, enabled_domains: Vec<String>) -> Self {
+ let enabled_domains = enabled_domains
+ .into_iter()
+ .map(|domain| domain.trim().to_lowercase())
+ .filter(|domain| !domain.is_empty())
+ .collect();
+ Self {
+ store,
+ profiles,
+ classifier,
+ enabled_domains,
+ settled: Mutex::default(),
+ }
+ }
+
+ fn settled(&self) -> MutexGuard<'_, HashMap<Uuid, DateTime<Utc>>> {
+ self.settled.lock().unwrap_or_else(PoisonError::into_inner)
+ }
+
+ fn is_enabled(&self, address: &str) -> bool {
+ let address = address.to_lowercase();
+ address
+ .rsplit_once('@')
+ .is_some_and(|(_, domain)| self.enabled_domains.iter().any(|enabled| enabled == domain))
+ }
+
+ /// Classify a thread as it stands now. Safe to call repeatedly: a thread
+ /// already classified at its latest message is left alone.
+ #[tracing::instrument(skip(self), err)]
+ pub async fn classify_thread(&self, thread_id: Uuid) -> Result<ClassifyOutcome, Report> {
+ let Some(inbox) = self.store.thread_inbox(thread_id).await? else {
+ return Ok(ClassifyOutcome::Missing);
+ };
+ if !self.is_enabled(&inbox.owner_email) {
+ return Ok(ClassifyOutcome::NotEnabled);
+ }
+ if !inbox.is_signal || !inbox.inbox_visible {
+ return Ok(ClassifyOutcome::NotSignal);
+ }
+ let mail = self.store.thread_mail(&inbox).await?;
+ let thread = FocusThread::new(inbox, mail);
+ let Some(latest) = thread.messages.last() else {
+ return Ok(ClassifyOutcome::Missing);
+ };
+ if thread.messages.iter().all(|message| message.is_sent) {
+ return Ok(ClassifyOutcome::Missing);
+ }
+ if thread.classified_message_id == Some(latest.id) {
+ return Ok(ClassifyOutcome::UpToDate);
+ }
+
+ // The profile only sharpens the answers; classify without it rather than not at all.
+ let profile = self
+ .profiles
+ .profile(&thread.owner)
+ .await
+ .inspect_err(|error| tracing::warn!(error = ?error, "focus profile unavailable"))
+ .ok()
+ .flatten();
+ let input = jev_input(&thread, profile.as_deref());
+ let probabilities = match self
+ .classifier
+ .answer(&thread.owner, thread.thread_id, &input, &FOCUS_QUESTIONS)
+ .await
+ {
+ Ok(probabilities) => probabilities,
+ Err(FocusClassifierError::Unavailable) => return Ok(ClassifyOutcome::Unavailable),
+ Err(FocusClassifierError::Rejected) => return Ok(ClassifyOutcome::Rejected),
+ };
+ let Some(answers) = FocusAnswers::from_probabilities(&probabilities) else {
+ tracing::warn!(
+ answers = probabilities.len(),
+ "focus classifier returned the wrong number of answers"
+ );
+ return Ok(ClassifyOutcome::Rejected);
+ };
+ let verdict = decide(&answers, &signals(&thread));
+ let stored = self
+ .store
+ .save(&FocusRecord {
+ thread_id: thread.thread_id,
+ link_id: thread.link_id,
+ classified_message_id: latest.id,
+ classified_message_ts: latest.at,
+ verdict,
+ answers,
+ model: self.classifier.model().to_owned(),
+ classified_at: Utc::now(),
+ })
+ .await?;
+ if !stored {
+ // A concurrent classification of a later message won.
+ return Ok(ClassifyOutcome::UpToDate);
+ }
+ Ok(ClassifyOutcome::Classified(verdict))
+ }
+
+ /// Classify up to `limit` stale signal threads from the last `window`,
+ /// newest first. Stops at the first sign the classifier is unavailable,
+ /// or after a run of rejections.
+ #[tracing::instrument(skip(self), err)]
+ pub async fn sweep(&self, window: Duration, limit: i64) -> Result<SweepReport, Report> {
+ let mut report = SweepReport::default();
+ if self.enabled_domains.is_empty() {
+ return Ok(report);
+ }
+ let candidates = self
+ .store
+ .stale_threads(Utc::now() - window, &self.enabled_domains, limit)
+ .await?;
+ report.candidates = candidates.len();
+ // Only this sweep's candidates can be skipped, so the map stays as
+ // small as one sweep.
+ let stale = candidates
+ .iter()
+ .map(|candidate| candidate.thread_id)
+ .collect::<HashSet<_>>();
+ self.settled()
+ .retain(|thread_id, _| stale.contains(thread_id));
+
+ let mut rejections_in_a_row = 0;
+ for StaleThread {
+ thread_id,
+ latest_at,
+ } in candidates
+ {
+ if self.settled().get(&thread_id) == Some(&latest_at) {
+ report.skipped += 1;
+ continue;
+ }
+ let outcome = self.classify_thread(thread_id).await;
+ if !matches!(outcome, Ok(ClassifyOutcome::Rejected)) {
+ rejections_in_a_row = 0;
+ }
+ match outcome {
+ Ok(ClassifyOutcome::Classified(_)) => {
+ report.classified += 1;
+ self.settled().remove(&thread_id);
+ }
+ Ok(ClassifyOutcome::Unavailable) => {
+ report.failed += 1;
+ report.stopped_early = true;
+ break;
+ }
+ Ok(ClassifyOutcome::Rejected) => {
+ report.failed += 1;
+ self.settled().insert(thread_id, latest_at);
+ rejections_in_a_row += 1;
+ if rejections_in_a_row >= MAX_REJECTIONS_IN_A_ROW {
+ tracing::warn!(
+ rejections_in_a_row,
+ "focus sweep stopped: the classifier rejects every thread"
+ );
+ report.stopped_early = true;
+ break;
+ }
+ }
+ Ok(_) => {
+ report.skipped += 1;
+ self.settled().insert(thread_id, latest_at);
+ }
+ Err(error) => {
+ tracing::warn!(error = ?error, %thread_id, "focus sweep could not classify a thread");
+ report.failed += 1;
+ }
+ }
+ }
+ Ok(report)
+ }
+}
+
+/// Reads the Focus view needs.
+pub struct FocusQueries<S> {
+ store: S,
+}
+
+impl<S: FocusStore> FocusQueries<S> {
+ /// Read Focus from `store`.
+ pub fn new(store: S) -> Self {
+ Self { store }
+ }
+
+ /// The owner's Focus threads still in the inbox with mail in the last
+ /// `window_days` (at most 90), highest priority first.
+ pub async fn focus_thread_ids(
+ &self,
+ owner: &MacroUserIdStr<'static>,
+ window_days: u16,
+ ) -> Result<Vec<Uuid>, Report> {
+ let days = window_days.clamp(1, MAX_WINDOW_DAYS);
+ self.store
+ .focus_thread_ids(
+ owner,
+ Utc::now() - Duration::days(i64::from(days)),
+ MAX_FOCUS_THREADS,
+ )
+ .await
+ }
+
+ /// Stored classifications for the owner's threads among `thread_ids`.
+ pub async fn focus_for_threads(
+ &self,
+ owner: &MacroUserIdStr<'static>,
+ thread_ids: &[Uuid],
+ ) -> Result<HashMap<Uuid, ThreadFocus>, Report> {
+ if thread_ids.is_empty() {
+ return Ok(HashMap::new());
+ }
+ self.store.focus_for_threads(owner, thread_ids).await
+ }
+}
+
+#[cfg(test)]
+mod test;
diff --git a/crates/email/src/domain/focus/service/test.rs b/crates/email/src/domain/focus/service/test.rs
new file mode 100644
index 0000000000..b79c0e4a74
--- /dev/null
+++ b/crates/email/src/domain/focus/service/test.rs
@@ -0,0 +1,427 @@
+use std::{
+ collections::HashMap,
+ sync::{Arc, Mutex},
+};
+
+use chrono::{DateTime, TimeZone, Utc};
+use macro_user_id::user_id::MacroUserIdStr;
+use rootcause::Report;
+use serde_json::Value;
+use uuid::Uuid;
+
+use super::*;
+use crate::domain::focus::models::{
+ FocusCategory, FocusInbox, FocusMail, FocusMessage, FocusThread,
+};
+
+#[derive(Clone, Default)]
+struct FakeStore {
+ threads: Arc<Mutex<HashMap<Uuid, FocusThread>>>,
+ saved: Arc<Mutex<Vec<FocusRecord>>>,
+ /// Refuse every save, as when a later message's result is already stored.
+ refuse_saves: bool,
+ stale: Arc<Mutex<Vec<StaleThread>>>,
+ stale_domains: Arc<Mutex<Vec<String>>>,
+ mail_reads: Arc<Mutex<usize>>,
+}
+
+impl FocusStore for FakeStore {
+ async fn thread_inbox(&self, thread_id: Uuid) -> Result<Option<FocusInbox>, Report> {
+ Ok(self
+ .threads
+ .lock()
+ .unwrap()
+ .get(&thread_id)
+ .map(|thread| FocusInbox {
+ thread_id: thread.thread_id,
+ link_id: thread.link_id,
+ owner: thread.owner.clone(),
+ owner_email: thread.owner_email.clone(),
+ is_signal: thread.is_signal,
+ inbox_visible: thread.inbox_visible,
+ classified_message_id: thread.classified_message_id,
+ }))
+ }
+
+ async fn thread_mail(&self, inbox: &FocusInbox) -> Result<FocusMail, Report> {
+ *self.mail_reads.lock().unwrap() += 1;
+ let threads = self.threads.lock().unwrap();
+ let thread = threads.get(&inbox.thread_id).expect("inbox read first");
+ Ok(FocusMail {
+ messages: thread.messages.clone(),
+ sent_notes: thread.sent_notes.clone(),
+ })
+ }
+
+ async fn save(&self, record: &FocusRecord) -> Result<bool, Report> {
+ if self.refuse_saves {
+ return Ok(false);
+ }
+ self.saved.lock().unwrap().push(record.clone());
+ Ok(true)
+ }
+
+ async fn stale_threads(
+ &self,
+ _since: DateTime<Utc>,
+ domains: &[String],
+ _limit: i64,
+ ) -> Result<Vec<StaleThread>, Report> {
+ *self.stale_domains.lock().unwrap() = domains.to_vec();
+ Ok(self.stale.lock().unwrap().clone())
+ }
+
+ async fn focus_thread_ids(
+ &self,
+ _owner: &MacroUserIdStr<'static>,
+ _since: DateTime<Utc>,
+ _limit: i64,
+ ) -> Result<Vec<Uuid>, Report> {
+ Ok(Vec::new())
+ }
+
+ async fn focus_for_threads(
+ &self,
+ _owner: &MacroUserIdStr<'static>,
+ _thread_ids: &[Uuid],
+ ) -> Result<HashMap<Uuid, ThreadFocus>, Report> {
+ Ok(HashMap::new())
+ }
+}
+
+struct FakeProfiles(Option<String>);
+
+impl ProfileSource for FakeProfiles {
+ async fn profile(&self, _owner: &MacroUserIdStr<'static>) -> Result<Option<String>, Report> {
+ Ok(self.0.clone())
+ }
+}
+
+#[derive(Clone)]
+struct FakeClassifier {
+ answers: Result<Vec<f32>, FocusClassifierError>,
+ inputs: Arc<Mutex<Vec<Value>>>,
+}
+
+impl FakeClassifier {
+ fn answering(answers: Result<Vec<f32>, FocusClassifierError>) -> Self {
+ Self {
+ answers,
+ inputs: Arc::default(),
+ }
+ }
+}
+
+impl FocusClassifier for FakeClassifier {
+ async fn answer(
+ &self,
+ _owner: &MacroUserIdStr<'static>,
+ _thread_id: Uuid,
+ input: &Value,
+ questions: &[&'static str],
+ ) -> Result<Vec<f32>, FocusClassifierError> {
+ assert_eq!(questions.len(), FOCUS_QUESTIONS.len());
+ self.inputs.lock().unwrap().push(input.clone());
+ self.answers.clone()
+ }
+
+ fn model(&self) -> &'static str {
+ "jev-test"
+ }
+}
+
+/// Focus yes, reply needed, everything else no.
+fn relevant() -> Vec<f32> {
+ vec![0.9, 0.0, 0.0, 0.0, 0.0, 0.0, 0.9, 0.0]
+}
+
+fn thread(owner_email: &str) -> FocusThread {
+ FocusThread {
+ thread_id: Uuid::new_v4(),
+ link_id: Uuid::new_v4(),
+ owner: MacroUserIdStr::try_from_email(owner_email).unwrap(),
+ owner_email: owner_email.to_owned(),
+ is_signal: true,
+ inbox_visible: true,
+ classified_message_id: None,
+ messages: vec![FocusMessage {
+ id: Uuid::new_v4(),
+ at: Utc.with_ymd_and_hms(2026, 10, 8, 12, 0, 0).unwrap(),
+ is_sent: false,
+ from_email: Some("[email protected]".to_owned()),
+ from_name: Some("Casey".to_owned()),
+ to: vec![owner_email.to_owned()],
+ cc: Vec::new(),
+ subject: Some("Unpaid invoice".to_owned()),
+ has_attachments: false,
+ bulk: false,
+ body: Some("Can you approve the invoice today?".to_owned()),
+ snippet: None,
+ }],
+ sent_notes: Vec::new(),
+ }
+}
+
+fn service(
+ store: &FakeStore,
+ classifier: &FakeClassifier,
+ domains: &[&str],
+) -> FocusService<FakeStore, FakeProfiles, FakeClassifier> {
+ FocusService::new(
+ store.clone(),
+ FakeProfiles(Some("Owner runs finance at Acme.".to_owned())),
+ classifier.clone(),
+ domains.iter().map(|domain| (*domain).to_owned()).collect(),
+ )
+}
+
+fn insert(store: &FakeStore, thread: FocusThread) -> Uuid {
+ let id = thread.thread_id;
+ store.threads.lock().unwrap().insert(id, thread);
+ id
+}
+
+/// Mark `thread_ids` stale, all last active at `latest_at`.
+fn set_stale(store: &FakeStore, thread_ids: &[Uuid], latest_at: DateTime<Utc>) {
+ *store.stale.lock().unwrap() = thread_ids
+ .iter()
+ .map(|&thread_id| StaleThread {
+ thread_id,
+ latest_at,
+ })
+ .collect();
+}
+
+fn noon() -> DateTime<Utc> {
+ Utc.with_ymd_and_hms(2026, 10, 8, 12, 0, 0).unwrap()
+}
+
+#[tokio::test]
+async fn classifies_and_stores_an_enabled_inbox() {
+ let store = FakeStore::default();
+ let classifier = FakeClassifier::answering(Ok(relevant()));
+ let id = insert(&store, thread("[email protected]"));
+ let outcome = service(&store, &classifier, &[" ACME.example "])
+ .classify_thread(id)
+ .await
+ .unwrap();
+
+ let ClassifyOutcome::Classified(verdict) = outcome else {
+ panic!("expected a classification, got {outcome:?}");
+ };
+ assert!(verdict.is_focus);
+ assert!(verdict.needs_reply);
+ assert_eq!(verdict.category, FocusCategory::Other);
+ let saved = store.saved.lock().unwrap();
+ assert_eq!(saved.len(), 1);
+ assert_eq!(saved[0].thread_id, id);
+ assert_eq!(saved[0].model, "jev-test");
+ let inputs = classifier.inputs.lock().unwrap();
+ assert!(
+ inputs[0]["recipient"]
+ .as_str()
+ .unwrap()
+ .contains("Owner runs finance at Acme.")
+ );
+}
+
+#[tokio::test]
+async fn never_sends_mail_from_inboxes_off_the_allowlist() {
+ let store = FakeStore::default();
+ let classifier = FakeClassifier::answering(Ok(relevant()));
+ let id = insert(&store, thread("[email protected]"));
+ for domains in [&[][..], &["acme.example"][..]] {
+ let outcome = service(&store, &classifier, domains)
+ .classify_thread(id)
+ .await
+ .unwrap();
+ assert_eq!(outcome, ClassifyOutcome::NotEnabled);
+ }
+ assert!(classifier.inputs.lock().unwrap().is_empty());
+ assert!(store.saved.lock().unwrap().is_empty());
+ // No message content is even read for an inbox off the allowlist.
+ assert_eq!(*store.mail_reads.lock().unwrap(), 0);
+}
+
+#[tokio::test]
+async fn skips_threads_outside_the_signal_inbox_and_up_to_date_ones() {
+ let store = FakeStore::default();
+ let classifier = FakeClassifier::answering(Ok(relevant()));
+ let mut archived = thread("[email protected]");
+ archived.inbox_visible = false;
+ let archived = insert(&store, archived);
+ let mut current = thread("[email protected]");
+ current.classified_message_id = Some(current.messages[0].id);
+ let current = insert(&store, current);
+ let mut only_sent = thread("[email protected]");
+ only_sent.messages[0].is_sent = true;
+ let only_sent = insert(&store, only_sent);
+
+ let service = service(&store, &classifier, &["acme.example"]);
+ assert_eq!(
+ service.classify_thread(archived).await.unwrap(),
+ ClassifyOutcome::NotSignal
+ );
+ assert_eq!(
+ service.classify_thread(current).await.unwrap(),
+ ClassifyOutcome::UpToDate
+ );
+ assert_eq!(
+ service.classify_thread(only_sent).await.unwrap(),
+ ClassifyOutcome::Missing
+ );
+ assert_eq!(
+ service.classify_thread(Uuid::new_v4()).await.unwrap(),
+ ClassifyOutcome::Missing
+ );
+ assert!(classifier.inputs.lock().unwrap().is_empty());
+}
+
+#[tokio::test]
+async fn classifier_failures_store_nothing() {
+ for (answers, expected) in [
+ (
+ Err(FocusClassifierError::Unavailable),
+ ClassifyOutcome::Unavailable,
+ ),
+ (
+ Err(FocusClassifierError::Rejected),
+ ClassifyOutcome::Rejected,
+ ),
+ (Ok(vec![0.5; 3]), ClassifyOutcome::Rejected),
+ ] {
+ let store = FakeStore::default();
+ let classifier = FakeClassifier::answering(answers);
+ let id = insert(&store, thread("[email protected]"));
+ let outcome = service(&store, &classifier, &["acme.example"])
+ .classify_thread(id)
+ .await
+ .unwrap();
+ assert_eq!(outcome, expected);
+ assert!(store.saved.lock().unwrap().is_empty());
+ }
+}
+
+#[tokio::test]
+async fn sweep_stops_when_the_classifier_is_down() {
+ let store = FakeStore::default();
+ let classifier = FakeClassifier::answering(Err(FocusClassifierError::Unavailable));
+ let first = insert(&store, thread("[email protected]"));
+ let second = insert(&store, thread("[email protected]"));
+ set_stale(&store, &[first, second], noon());
+
+ let report = service(&store, &classifier, &["acme.example"])
+ .sweep(Duration::days(30), 100)
+ .await
+ .unwrap();
+ assert_eq!(report.candidates, 2);
+ assert_eq!(report.failed, 1);
+ assert!(report.stopped_early);
+ assert_eq!(classifier.inputs.lock().unwrap().len(), 1);
+ assert_eq!(*store.stale_domains.lock().unwrap(), vec!["acme.example"]);
+}
+
+#[tokio::test]
+async fn sweep_classifies_every_stale_thread() {
+ let store = FakeStore::default();
+ let classifier = FakeClassifier::answering(Ok(relevant()));
+ let first = insert(&store, thread("[email protected]"));
+ let second = insert(&store, thread("[email protected]"));
+ set_stale(&store, &[first, second, Uuid::new_v4()], noon());
+
+ let report = service(&store, &classifier, &["acme.example"])
+ .sweep(Duration::days(30), 100)
+ .await
+ .unwrap();
+ assert_eq!(
+ report,
+ SweepReport {
+ candidates: 3,
+ classified: 2,
+ skipped: 1,
+ failed: 0,
+ stopped_early: false,
+ }
+ );
+}
+
+#[tokio::test]
+async fn sweep_does_nothing_without_an_allowlist() {
+ let store = FakeStore::default();
+ let classifier = FakeClassifier::answering(Ok(relevant()));
+ set_stale(
+ &store,
+ &[insert(&store, thread("[email protected]"))],
+ noon(),
+ );
+ let report = service(&store, &classifier, &[])
+ .sweep(Duration::days(30), 100)
+ .await
+ .unwrap();
+ assert_eq!(report, SweepReport::default());
+ assert!(classifier.inputs.lock().unwrap().is_empty());
+}
+
+#[tokio::test]
+async fn reports_up_to_date_when_a_later_result_is_already_stored() {
+ let store = FakeStore {
+ refuse_saves: true,
+ ..FakeStore::default()
+ };
+ let classifier = FakeClassifier::answering(Ok(relevant()));
+ let id = insert(&store, thread("[email protected]"));
+ let outcome = service(&store, &classifier, &["acme.example"])
+ .classify_thread(id)
+ .await
+ .unwrap();
+ assert_eq!(outcome, ClassifyOutcome::UpToDate);
+}
+
+#[tokio::test]
+async fn sweep_leaves_rejected_and_settled_threads_until_new_mail() {
+ let store = FakeStore::default();
+ let classifier = FakeClassifier::answering(Err(FocusClassifierError::Rejected));
+ let rejected = insert(&store, thread("[email protected]"));
+ let mut only_sent = thread("[email protected]");
+ only_sent.messages[0].is_sent = true;
+ let only_sent = insert(&store, only_sent);
+ let service = service(&store, &classifier, &["acme.example"]);
+
+ set_stale(&store, &[rejected, only_sent], noon());
+ let first = service.sweep(Duration::days(30), 100).await.unwrap();
+ assert_eq!((first.failed, first.skipped), (1, 1));
+ assert_eq!(*store.mail_reads.lock().unwrap(), 2);
+
+ // Same mail: neither thread is read or sent again.
+ let second = service.sweep(Duration::days(30), 100).await.unwrap();
+ assert_eq!((second.failed, second.skipped), (0, 2));
+ assert_eq!(*store.mail_reads.lock().unwrap(), 2);
+ assert_eq!(classifier.inputs.lock().unwrap().len(), 1);
+
+ // New mail on the rejected thread: it is tried again.
+ set_stale(&store, &[rejected], noon() + Duration::minutes(5));
+ let third = service.sweep(Duration::days(30), 100).await.unwrap();
+ assert_eq!(third.failed, 1);
+ assert_eq!(classifier.inputs.lock().unwrap().len(), 2);
+}
+
+#[tokio::test]
+async fn sweep_stops_when_the_classifier_rejects_everything() {
+ let store = FakeStore::default();
+ let classifier = FakeClassifier::answering(Err(FocusClassifierError::Rejected));
+ let threads = (0..MAX_REJECTIONS_IN_A_ROW + 3)
+ .map(|_| insert(&store, thread("[email protected]")))
+ .collect::<Vec<_>>();
+ set_stale(&store, &threads, noon());
+
+ let report = service(&store, &classifier, &["acme.example"])
+ .sweep(Duration::days(30), 100)
+ .await
+ .unwrap();
+ assert!(report.stopped_early);
+ assert_eq!(report.failed, MAX_REJECTIONS_IN_A_ROW);
+ assert_eq!(
+ classifier.inputs.lock().unwrap().len(),
+ MAX_REJECTIONS_IN_A_ROW
+ );
+}
diff --git a/crates/email/src/domain/focus/signals.rs b/crates/email/src/domain/focus/signals.rs
new file mode 100644
index 0000000000..cd415aba1c
--- /dev/null
+++ b/crates/email/src/domain/focus/signals.rs
@@ -0,0 +1,151 @@
+//! The owner's history with a thread's senders, read from stored mail.
+
+use std::collections::HashSet;
+
+use super::{
+ input::{is_dismissive_reply, new_text},
+ models::{FocusSignals, FocusThread},
+ rule::is_calendar_subject,
+};
+
+/// Consumer mail providers; sharing one of these is not being teammates.
+const FREEMAIL_DOMAINS: [&str; 11] = [
+ "gmail.com",
+ "googlemail.com",
+ "outlook.com",
+ "hotmail.com",
+ "live.com",
+ "yahoo.com",
+ "icloud.com",
+ "me.com",
+ "aol.com",
+ "protonmail.com",
+ "proton.me",
+];
+
+/// Local parts of addresses that send mail no person wrote, e.g. `no-reply@`.
+const AUTOMATED_LOCAL_PARTS: [&str; 30] = [
+ "noreply",
+ "no-reply",
+ "donotreply",
+ "do-not-reply",
+ "donot-reply",
+ "do-notreply",
+ "notification",
+ "notifications",
+ "notify",
+ "alert",
+ "alerts",
+ "mailer",
+ "bounce",
+ "update",
+ "updates",
+ "news",
+ "newsletter",
+ "info",
+ "hello",
+ "support",
+ "team",
+ "billing",
+ "receipt",
+ "receipts",
+ "invoice",
+ "digest",
+ "calendar-notification",
+ "comment",
+ "comments",
+ "mailer-daemon",
+];
+
+fn domain(address: &str) -> &str {
+ address.rsplit_once('@').map_or("", |(_, domain)| domain)
+}
+
+/// An address that sends automated mail; matches the end of the local part,
+/// so `team@` and `product-updates@` both count.
+fn is_automated_sender(address: &str) -> bool {
+ let local = address.split_once('@').map_or(address, |(local, _)| local);
+ AUTOMATED_LOCAL_PARTS
+ .iter()
+ .any(|part| local.ends_with(part))
+}
+
+fn is_substantive(body: Option<&str>) -> bool {
+ !is_dismissive_reply(&new_text(body.unwrap_or_default()))
+}
+
+/// Derive the owner's relationship with a thread from its messages and the
+/// owner's sent mail.
+pub(super) fn signals(thread: &FocusThread) -> FocusSignals {
+ let owner = thread.owner_email.to_lowercase();
+ let incoming = thread
+ .messages
+ .iter()
+ .filter(|message| !message.is_sent)
+ .collect::<Vec<_>>();
+ let senders = incoming
+ .iter()
+ .filter_map(|message| message.from_email.as_deref())
+ .map(str::to_lowercase)
+ .filter(|sender| *sender != owner)
+ .collect::<HashSet<_>>();
+ let first_incoming = incoming.first().map(|message| message.at);
+ let replies = thread
+ .messages
+ .iter()
+ .filter(|message| message.is_sent && first_incoming.is_some_and(|first| message.at > first))
+ .collect::<Vec<_>>();
+ let replied = !replies.is_empty();
+ let replied_for_real = replies
+ .iter()
+ .any(|message| is_substantive(message.body.as_deref()));
+
+ let owner_domain = domain(&owner);
+ let teammate = !owner_domain.is_empty()
+ && !FREEMAIL_DOMAINS.contains(&owner_domain)
+ && senders.iter().any(|sender| domain(sender) == owner_domain);
+
+ let notes_to_senders = thread
+ .sent_notes
+ .iter()
+ .filter(|note| senders.contains(&note.recipient))
+ .collect::<Vec<_>>();
+ let written_to = notes_to_senders
+ .iter()
+ .any(|note| is_substantive(note.body.as_deref()));
+
+ let primary = incoming
+ .first()
+ .and_then(|message| message.from_email.as_deref())
+ .map(str::to_lowercase)
+ .unwrap_or_default();
+ let notes_to_primary = notes_to_senders
+ .iter()
+ .filter(|note| note.recipient == primary)
+ .collect::<Vec<_>>();
+ let brushed_off = !notes_to_primary.is_empty()
+ && notes_to_primary
+ .iter()
+ .all(|note| !is_substantive(note.body.as_deref()));
+ let bulk = incoming.iter().any(|message| message.bulk) || is_automated_sender(&primary);
+
+ let contact = !brushed_off && (replied_for_real || written_to || (teammate && !bulk));
+
+ FocusSignals {
+ contact,
+ replied,
+ teammate,
+ latest_from_owner: thread
+ .messages
+ .last()
+ .is_some_and(|message| message.is_sent),
+ calendar_subject: thread
+ .messages
+ .first()
+ .and_then(|message| message.subject.as_deref())
+ .is_some_and(is_calendar_subject),
+ }
+}
+
+#[cfg(test)]
+mod test;
diff --git a/crates/email/src/domain/focus/signals/test.rs b/crates/email/src/domain/focus/signals/test.rs
new file mode 100644
index 0000000000..c827fd7750
--- /dev/null
+++ b/crates/email/src/domain/focus/signals/test.rs
@@ -0,0 +1,147 @@
+use chrono::{Duration, TimeZone, Utc};
+use macro_user_id::user_id::MacroUserIdStr;
+use uuid::Uuid;
+
+use super::*;
+use crate::domain::focus::models::{FocusMessage, SentNote};
+
+fn message(from: &str, minutes: i64, is_sent: bool, body: &str) -> FocusMessage {
+ FocusMessage {
+ id: Uuid::new_v4(),
+ at: Utc.with_ymd_and_hms(2026, 10, 1, 9, 0, 0).unwrap() + Duration::minutes(minutes),
+ is_sent,
+ from_email: Some(from.to_owned()),
+ from_name: None,
+ to: Vec::new(),
+ cc: Vec::new(),
+ subject: Some("Hello".to_owned()),
+ has_attachments: false,
+ bulk: false,
+ body: Some(body.to_owned()),
+ snippet: None,
+ }
+}
+
+fn thread(messages: Vec<FocusMessage>, sent_notes: Vec<SentNote>) -> FocusThread {
+ FocusThread {
+ thread_id: Uuid::new_v4(),
+ link_id: Uuid::new_v4(),
+ owner: MacroUserIdStr::try_from_email("[email protected]").unwrap(),
+ owner_email: "[email protected]".to_owned(),
+ is_signal: true,
+ inbox_visible: true,
+ classified_message_id: None,
+ messages,
+ sent_notes,
+ }
+}
+
+fn note(recipient: &str, body: &str) -> SentNote {
+ SentNote {
+ recipient: recipient.to_owned(),
+ body: Some(body.to_owned()),
+ }
+}
+
+#[test]
+fn a_stranger_is_not_a_contact() {
+ let signals = signals(&thread(
+ vec![message(
+ 0,
+ false,
+ "Quick question for you",
+ )],
+ Vec::new(),
+ ));
+ assert_eq!(signals, FocusSignals::default());
+}
+
+#[test]
+fn someone_the_owner_wrote_to_is_a_contact() {
+ let signals = signals(&thread(
+ vec![message("[email protected]", 0, false, "Your invoice")],
+ vec![note("[email protected]", "Yes, please send it over!")],
+ ));
+ assert!(signals.contact);
+ assert!(!signals.replied);
+}
+
+#[test]
+fn a_brushed_off_sender_is_not_a_contact() {
+ let signals = signals(&thread(
+ vec![
+ message("[email protected]", 0, false, "Following up"),
+ message("[email protected]", 5, true, "I'm not interested"),
+ ],
+ vec![note("[email protected]", "No thanks")],
+ ));
+ assert!(signals.replied);
+ assert!(!signals.contact);
+ assert!(signals.latest_from_owner);
+}
+
+#[test]
+fn a_real_reply_makes_a_contact() {
+ let signals = signals(&thread(
+ vec![
+ message("[email protected]", 0, false, "Application"),
+ message(
+ 5,
+ true,
+ "Let's chat, are you free tomorrow?",
+ ),
+ message("[email protected]", 10, false, "Yes!"),
+ ],
+ Vec::new(),
+ ));
+ assert!(signals.contact);
+ assert!(signals.replied);
+ assert!(!signals.latest_from_owner);
+}
+
+#[test]
+fn teammates_count_unless_it_is_bulk_mail() {
+ let teammate = signals(&thread(
+ vec![message("[email protected]", 0, false, "CRM plan")],
+ Vec::new(),
+ ));
+ assert!(teammate.teammate);
+ assert!(teammate.contact);
+
+ let mut bulk = message("[email protected]", 0, false, "Weekly digest");
+ bulk.bulk = true;
+ let bulk = signals(&thread(vec![bulk], Vec::new()));
+ assert!(bulk.teammate);
+ assert!(!bulk.contact);
+
+ let automated = signals(&thread(
+ vec![message(
+ 0,
+ false,
+ "Build failed",
+ )],
+ Vec::new(),
+ ));
+ assert!(!automated.contact);
+}
+
+#[test]
+fn freemail_owners_have_no_teammates() {
+ let freemail = FREEMAIL_DOMAINS[0];
+ let mut thread = thread(
+ vec![message(&format!("friend@{freemail}"), 0, false, "Dinner?")],
+ Vec::new(),
+ );
+ thread.owner_email = format!("owner@{freemail}");
+ assert!(!signals(&thread).teammate);
+}
+
+#[test]
+fn calendar_subject_comes_from_the_first_message() {
+ let mut invite = message("[email protected]", 0, false, "");
+ invite.subject = Some("Invitation: Standup @ Mon".to_owned());
+ assert!(signals(&thread(vec![invite], Vec::new())).calendar_subject);
+}
diff --git a/crates/email/src/outbound.rs b/crates/email/src/outbound.rs
index 5d1dc79a69..77692e342a 100644
--- a/crates/email/src/outbound.rs
+++ b/crates/email/src/outbound.rs
@@ -2,6 +2,8 @@
mod email_pg_repo;
#[cfg(feature = "http_client")]
mod email_service_http;
+#[cfg(feature = "outbound")]
+mod focus_pg;
#[cfg(feature = "gmail_senders")]
mod gmail_sender_provider;
#[cfg(feature = "gmail_token")]
@@ -17,6 +19,8 @@ pub use email_pg_repo::EmailPgRepo;
pub mod mailbox_pg;
#[cfg(feature = "http_client")]
pub use email_service_http::EmailServiceHttpClient;
+#[cfg(feature = "outbound")]
+pub use focus_pg::FocusPgRepository;
#[cfg(feature = "gmail_senders")]
pub use gmail_sender_provider::GmailSenderProvider;
#[cfg(feature = "gmail_token")]
diff --git a/crates/email/src/outbound/focus_pg.rs b/crates/email/src/outbound/focus_pg.rs
new file mode 100644
index 0000000000..41ca279ed7
--- /dev/null
+++ b/crates/email/src/outbound/focus_pg.rs
@@ -0,0 +1,378 @@
+//! Postgres storage for Focus classifications and the thread reads behind them.
+
+use std::{collections::HashMap, str::FromStr};
+
+use chrono::{DateTime, Utc};
+use macro_user_id::user_id::MacroUserIdStr;
+use rootcause::Report;
+use sqlx::PgPool;
+use uuid::Uuid;
+
+use crate::domain::focus::{
+ FocusCategory, FocusInbox, FocusMail, FocusMessage, FocusRecord, FocusStore, SentNote,
+ StaleThread, ThreadFocus,
+};
+
+/// Most recent messages read per thread.
+const THREAD_MESSAGES: i64 = 200;
+/// Characters of each message body read.
+const BODY_CHARS: i32 = 6_000;
+/// The owner's sent messages read when judging the relationship.
+const SENT_NOTES: i64 = 100;
+/// Characters of each sent message read.
+const SENT_NOTE_CHARS: i32 = 2_000;
+
+/// Focus storage on the Macro database.
+#[derive(Clone)]
+pub struct FocusPgRepository(pub PgPool);
+
+impl FocusPgRepository {
+ async fn messages(&self, thread_id: Uuid) -> Result<Vec<FocusMessage>, Report> {
+ let rows = sqlx::query!(
+ r#"
+ SELECT
+ m.id,
+ COALESCE(m.internal_date_ts, m.created_at) AS "at!",
+ m.is_sent,
+ m.has_attachments,
+ m.subject,
+ m.snippet,
+ LEFT(m.body_text, $2) AS body,
+ c.email_address AS "from_email?",
+ COALESCE(m.from_name, c.name) AS from_name,
+ COALESCE((
+ SELECT array_agg(rc.email_address ORDER BY rc.email_address)
+ FROM email_message_recipients r
+ JOIN email_contacts rc ON rc.id = r.contact_id
+ WHERE r.message_id = m.id AND r.recipient_type = 'TO'
+ ), '{}') AS "to_emails!",
+ COALESCE((
+ SELECT array_agg(rc.email_address ORDER BY rc.email_address)
+ FROM email_message_recipients r
+ JOIN email_contacts rc ON rc.id = r.contact_id
+ WHERE r.message_id = m.id AND r.recipient_type = 'CC'
+ ), '{}') AS "cc_emails!",
+ EXISTS (
+ SELECT 1
+ FROM jsonb_array_elements(
+ CASE WHEN jsonb_typeof(m.headers_jsonb) = 'array'
+ THEN m.headers_jsonb ELSE '[]'::jsonb END
+ ) h
+ WHERE LOWER(h->>'name') IN (
+ 'list-unsubscribe', 'list-id', 'feedback-id', 'x-sg-eid',
+ 'x-ses-outgoing', 'x-mailgun-tag', 'x-campaign'
+ )
+ OR (LOWER(h->>'name') = 'precedence'
+ AND LOWER(h->>'value') IN ('bulk', 'list', 'junk'))
+ ) AS "bulk!"
+ FROM email_messages m
+ LEFT JOIN email_contacts c ON c.id = m.from_contact_id
+ WHERE m.thread_id = $1
+ AND NOT m.is_draft
+ AND NOT EXISTS (
+ SELECT 1 FROM email_message_labels ml
+ JOIN email_labels l ON l.id = ml.label_id
+ WHERE ml.message_id = m.id AND l.name = 'TRASH'
+ )
+ ORDER BY COALESCE(m.internal_date_ts, m.created_at) DESC, m.id DESC
+ LIMIT $3
+ "#,
+ thread_id,
+ BODY_CHARS,
+ THREAD_MESSAGES,
+ )
+ .fetch_all(&self.0)
+ .await?;
+ let mut messages = rows
+ .into_iter()
+ .map(|row| FocusMessage {
+ id: row.id,
+ at: row.at,
+ is_sent: row.is_sent,
+ from_email: row.from_email,
+ from_name: row.from_name,
+ to: row.to_emails,
+ cc: row.cc_emails,
+ subject: row.subject,
+ has_attachments: row.has_attachments,
+ bulk: row.bulk,
+ body: row.body,
+ snippet: row.snippet,
+ })
+ .collect::<Vec<_>>();
+ messages.reverse();
+ Ok(messages)
+ }
+
+ async fn sent_notes(
+ &self,
+ link_id: Uuid,
+ recipients: &[String],
+ ) -> Result<Vec<SentNote>, Report> {
+ if recipients.is_empty() {
+ return Ok(Vec::new());
+ }
+ // Pick the newest messages first and read bodies only for those: a
+ // close correspondent can have thousands of messages.
+ let rows = sqlx::query!(
+ r#"
+ SELECT newest.recipient AS "recipient!", LEFT(m.body_text, $3) AS body
+ FROM (
+ SELECT LOWER(rc.email_address) AS recipient, m.id, m.internal_date_ts
+ FROM email_contacts rc
+ JOIN email_message_recipients r ON r.contact_id = rc.id
+ JOIN email_messages m ON m.id = r.message_id
+ WHERE rc.link_id = $1
+ AND LOWER(rc.email_address) = ANY($2)
+ AND m.is_sent
+ AND NOT m.is_draft
+ ORDER BY m.internal_date_ts DESC NULLS LAST
+ LIMIT $4
+ ) newest
+ JOIN email_messages m ON m.id = newest.id
+ ORDER BY newest.internal_date_ts DESC NULLS LAST
+ "#,
+ link_id,
+ recipients,
+ SENT_NOTE_CHARS,
+ SENT_NOTES,
+ )
+ .fetch_all(&self.0)
+ .await?;
+ Ok(rows
+ .into_iter()
+ .map(|row| SentNote {
+ recipient: row.recipient,
+ body: row.body,
+ })
+ .collect())
+ }
+}
+
+impl FocusStore for FocusPgRepository {
+ #[tracing::instrument(skip(self), err)]
+ async fn thread_inbox(&self, thread_id: Uuid) -> Result<Option<FocusInbox>, Report> {
+ let Some(row) = sqlx::query!(
+ r#"
+ SELECT t.id, t.link_id, t.is_signal, t.inbox_visible, el.macro_id, el.email_address,
+ f.classified_message_id AS "classified_message_id?"
+ FROM email_threads t
+ JOIN email_links el ON el.id = t.link_id
+ LEFT JOIN email_thread_focus f ON f.thread_id = t.id
+ WHERE t.id = $1
+ "#,
+ thread_id,
+ )
+ .fetch_optional(&self.0)
+ .await?
+ else {
+ return Ok(None);
+ };
+ Ok(Some(FocusInbox {
+ thread_id: row.id,
+ link_id: row.link_id,
+ owner: MacroUserIdStr::try_from(row.macro_id)?,
+ owner_email: row.email_address.to_lowercase(),
+ is_signal: row.is_signal,
+ inbox_visible: row.inbox_visible,
+ classified_message_id: row.classified_message_id,
+ }))
+ }
+
+ #[tracing::instrument(skip(self, inbox), fields(thread_id = %inbox.thread_id), err)]
+ async fn thread_mail(&self, inbox: &FocusInbox) -> Result<FocusMail, Report> {
+ let messages = self.messages(inbox.thread_id).await?;
+ let mut senders = messages
+ .iter()
+ .filter(|message| !message.is_sent)
+ .filter_map(|message| message.from_email.as_deref())
+ .map(str::to_lowercase)
+ .filter(|sender| *sender != inbox.owner_email)
+ .collect::<Vec<_>>();
+ senders.sort_unstable();
+ senders.dedup();
+ let sent_notes = self.sent_notes(inbox.link_id, &senders).await?;
+ Ok(FocusMail {
+ messages,
+ sent_notes,
+ })
+ }
+
+ #[tracing::instrument(skip(self, record), fields(thread_id = %record.thread_id), err)]
+ async fn save(&self, record: &FocusRecord) -> Result<bool, Report> {
+ let scores = serde_json::to_value(record.answers)?;
+ // A slower classification of an older message never replaces a newer one.
+ let result = sqlx::query!(
+ r#"
+ INSERT INTO email_thread_focus (
+ thread_id, link_id, classified_message_id, classified_message_ts, is_focus,
+ category, importance, needs_reply, needs_follow_up, scores, model, classified_at
+ )
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)
+ ON CONFLICT (thread_id) DO UPDATE SET
+ link_id = EXCLUDED.link_id,
+ classified_message_id = EXCLUDED.classified_message_id,
+ classified_message_ts = EXCLUDED.classified_message_ts,
+ is_focus = EXCLUDED.is_focus,
+ category = EXCLUDED.category,
+ importance = EXCLUDED.importance,
+ needs_reply = EXCLUDED.needs_reply,
+ needs_follow_up = EXCLUDED.needs_follow_up,
+ scores = EXCLUDED.scores,
+ model = EXCLUDED.model,
+ classified_at = EXCLUDED.classified_at
+ WHERE email_thread_focus.classified_message_ts <= EXCLUDED.classified_message_ts
+ "#,
+ record.thread_id,
+ record.link_id,
+ record.classified_message_id,
+ record.classified_message_ts,
+ record.verdict.is_focus,
+ record.verdict.category.to_string(),
+ i16::from(record.verdict.importance),
+ record.verdict.needs_reply,
+ record.verdict.needs_follow_up,
+ scores,
+ record.model,
+ record.classified_at,
+ )
+ .execute(&self.0)
+ .await?;
+ Ok(result.rows_affected() > 0)
+ }
+
+ #[tracing::instrument(skip(self), err)]
+ async fn stale_threads(
+ &self,
+ since: DateTime<Utc>,
+ domains: &[String],
+ limit: i64,
+ ) -> Result<Vec<StaleThread>, Report> {
+ let rows = sqlx::query!(
+ r#"
+ SELECT t.id,
+ GREATEST(t.latest_inbound_message_ts, t.latest_outbound_message_ts)
+ AS "latest_at!"
+ FROM email_links el
+ JOIN email_threads t ON t.link_id = el.id
+ LEFT JOIN email_thread_focus f ON f.thread_id = t.id
+ WHERE LOWER(SPLIT_PART(el.email_address, '@', 2)) = ANY($2)
+ AND t.inbox_visible
+ AND t.is_signal
+ AND t.latest_inbound_message_ts IS NOT NULL
+ AND t.latest_inbound_message_ts >= $1
+ AND (
+ f.thread_id IS NULL
+ OR f.classified_message_ts
+ < GREATEST(t.latest_inbound_message_ts, t.latest_outbound_message_ts)
+ )
+ ORDER BY t.latest_inbound_message_ts DESC
+ LIMIT $3
+ "#,
+ since,
+ domains,
+ limit,
+ )
+ .fetch_all(&self.0)
+ .await?;
+ Ok(rows
+ .into_iter()
+ .map(|row| StaleThread {
+ thread_id: row.id,
+ latest_at: row.latest_at,
+ })
+ .collect())
+ }
+
+ #[tracing::instrument(skip(self), err)]
+ async fn focus_thread_ids(
+ &self,
+ owner: &MacroUserIdStr<'static>,
+ since: DateTime<Utc>,
+ limit: i64,
+ ) -> Result<Vec<Uuid>, Report> {
+ // GREATEST floors importance at 1 below: log(0) is an error.
+ Ok(sqlx::query_scalar!(
+ r#"
+ SELECT f.thread_id
+ FROM email_thread_focus f
+ -- Joining on the inbox too lets the planner walk each inbox's recent
+ -- signal threads (idx_email_threads_signal_view) instead of every
+ -- Focus row the inbox ever had.
+ JOIN email_threads t ON t.id = f.thread_id AND t.link_id = f.link_id
+ WHERE f.link_id IN (
+ -- The owner's inboxes, as Soup lists them: their own and linked ones.
+ SELECT el.id FROM email_links el WHERE el.macro_id = $1
+ UNION
+ SELECT mul.link_id FROM macro_user_links mul WHERE mul.primary_macro_id = $1
+ )
+ AND f.is_focus
+ AND t.inbox_visible
+ AND t.is_signal
+ AND t.latest_inbound_message_ts >= $2
+ -- Priority: importance, halved for every 2 days (172800 s) since the
+ -- latest inbound mail. As a sum of logs the key doesn't depend on the
+ -- current time, so the order only changes when new mail arrives.
+ ORDER BY log(2.0, GREATEST(f.importance, 1))
+ + extract(epoch FROM t.latest_inbound_message_ts) / 172800 DESC,
+ t.latest_inbound_message_ts DESC,
+ f.thread_id
+ LIMIT $3
+ "#,
+ owner.as_ref(),
+ since,
+ limit,
+ )
+ .fetch_all(&self.0)
+ .await?)
+ }
+
+ #[tracing::instrument(skip(self, thread_ids), fields(threads = thread_ids.len()), err)]
+ async fn focus_for_threads(
+ &self,
+ owner: &MacroUserIdStr<'static>,
+ thread_ids: &[Uuid],
+ ) -> Result<HashMap<Uuid, ThreadFocus>, Report> {
+ let rows = sqlx::query!(
+ r#"
+ SELECT f.thread_id, f.is_focus, f.category, f.importance, f.needs_reply,
+ f.needs_follow_up, f.classified_at
+ FROM email_thread_focus f
+ WHERE f.thread_id = ANY($1)
+ AND f.link_id IN (
+ SELECT el.id FROM email_links el WHERE el.macro_id = $2
+ UNION
+ SELECT mul.link_id FROM macro_user_links mul WHERE mul.primary_macro_id = $2
+ )
+ "#,
+ thread_ids,
+ owner.as_ref(),
+ )
+ .fetch_all(&self.0)
+ .await?;
+ Ok(rows
+ .into_iter()
+ .filter_map(|row| {
+ let category = FocusCategory::from_str(&row.category)
+ .inspect_err(|_| {
+ tracing::warn!(thread_id = %row.thread_id, "unknown focus category stored");
+ })
+ .ok()?;
+ Some((
+ row.thread_id,
+ ThreadFocus {
+ is_focus: row.is_focus,
+ category,
+ importance: u8::try_from(row.importance.clamp(0, 100)).unwrap_or(0),
+ needs_reply: row.needs_reply,
+ needs_follow_up: row.needs_follow_up,
+ classified_at: row.classified_at,
+ },
+ ))
+ })
+ .collect())
+ }
+}
+
+#[cfg(test)]
+mod test;
diff --git a/crates/email/src/outbound/focus_pg/test.rs b/crates/email/src/outbound/focus_pg/test.rs
new file mode 100644
index 0000000000..3a919c31c4
--- /dev/null
+++ b/crates/email/src/outbound/focus_pg/test.rs
@@ -0,0 +1,286 @@
+use chrono::Duration;
+use macro_db_migrator::MACRO_DB_MIGRATIONS;
+use sqlx::{Pool, Postgres};
+
+use super::*;
+use crate::domain::focus::{FocusAnswers, FocusQuestion, FocusThread, FocusVerdict};
+
+const OWNER_LINK: Uuid = uuid::uuid!("00000000-0000-0000-0000-000000000f01");
+const OTHER_LINK: Uuid = uuid::uuid!("00000000-0000-0000-0000-000000000f02");
+const OTHER_THREAD: Uuid = uuid::uuid!("00000000-0000-0000-0000-00000000f207");
+const INVOICE: Uuid = uuid::uuid!("00000000-0000-0000-0000-00000000f201");
+const ARCHIVED: Uuid = uuid::uuid!("00000000-0000-0000-0000-00000000f202");
+const BULK: Uuid = uuid::uuid!("00000000-0000-0000-0000-00000000f204");
+const FIRST_MESSAGE: Uuid = uuid::uuid!("00000000-0000-0000-0000-00000000f501");
+const LATEST_MESSAGE: Uuid = uuid::uuid!("00000000-0000-0000-0000-00000000f503");
+
+async fn load_thread(
+ repo: &FocusPgRepository,
+ thread_id: Uuid,
+) -> Result<Option<FocusThread>, Report> {
+ let Some(inbox) = repo.thread_inbox(thread_id).await? else {
+ return Ok(None);
+ };
+ let mail = repo.thread_mail(&inbox).await?;
+ Ok(Some(FocusThread::new(inbox, mail)))
+}
+
+fn owner() -> MacroUserIdStr<'static> {
+ MacroUserIdStr::try_from_email("[email protected]").unwrap()
+}
+
+fn record(thread_id: Uuid, message_id: Uuid, at: DateTime<Utc>, importance: u8) -> FocusRecord {
+ FocusRecord {
+ thread_id,
+ link_id: OWNER_LINK,
+ classified_message_id: message_id,
+ classified_message_ts: at,
+ verdict: FocusVerdict {
+ is_focus: true,
+ category: FocusCategory::Customer,
+ needs_reply: true,
+ needs_follow_up: false,
+ importance,
+ },
+ answers: FocusAnswers::from_probabilities(&[0.5; FocusQuestion::ALL.len()]).unwrap(),
+ model: "jev-test".to_owned(),
+ classified_at: Utc::now(),
+ }
+}
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(path = "../../../fixtures", scripts("email_focus"))
+)]
+async fn reads_a_thread_with_its_relationship(pool: Pool<Postgres>) -> Result<(), Report> {
+ let repo = FocusPgRepository(pool);
+ let thread = load_thread(&repo, INVOICE).await?.expect("thread exists");
+
+ assert_eq!(thread.owner, owner());
+ assert_eq!(thread.owner_email, "[email protected]");
+ assert!(thread.is_signal && thread.inbox_visible);
+ assert_eq!(thread.classified_message_id, None);
+ // Oldest first; the trashed follow-up is left out.
+ let ids = thread.messages.iter().map(|m| m.id).collect::<Vec<_>>();
+ assert_eq!(ids.first(), Some(&FIRST_MESSAGE));
+ assert_eq!(ids.last(), Some(&LATEST_MESSAGE));
+ assert_eq!(ids.len(), 3);
+ let first = &thread.messages[0];
+ assert_eq!(first.from_email.as_deref(), Some("[email protected]"));
+ assert_eq!(first.from_name.as_deref(), Some("Casey"));
+ assert_eq!(first.to, vec!["[email protected]"]);
+ assert_eq!(first.cc, vec!["[email protected]"]);
+ assert!(first.has_attachments && !first.bulk);
+ assert_eq!(thread.messages[2].from_name.as_deref(), Some("Casey C."));
+ assert!(thread.messages[1].is_sent);
+ assert_eq!(
+ thread.sent_notes,
+ vec![SentNote {
+ recipient: "[email protected]".to_owned(),
+ body: Some("Thanks, I will take a look today.".to_owned()),
+ }]
+ );
+ assert!(load_thread(&repo, Uuid::new_v4()).await?.is_none());
+ Ok(())
+}
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(path = "../../../fixtures", scripts("email_focus"))
+)]
+async fn marks_bulk_mail_and_finds_brush_offs(pool: Pool<Postgres>) -> Result<(), Report> {
+ let repo = FocusPgRepository(pool);
+ let thread = load_thread(&repo, BULK).await?.expect("thread exists");
+ assert!(thread.messages[0].bulk);
+ assert_eq!(
+ thread.sent_notes,
+ vec![SentNote {
+ recipient: "[email protected]".to_owned(),
+ body: Some("No thanks".to_owned()),
+ }]
+ );
+ Ok(())
+}
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(path = "../../../fixtures", scripts("email_focus"))
+)]
+async fn stale_threads_cover_enabled_inbox_signal_mail_in_the_window(
+ pool: Pool<Postgres>,
+) -> Result<(), Report> {
+ let repo = FocusPgRepository(pool);
+ let since = Utc::now() - Duration::days(30);
+ let enabled = vec!["acme.example".to_owned()];
+ let stale = async |limit| -> Result<Vec<Uuid>, Report> {
+ Ok(repo
+ .stale_threads(since, &enabled, limit)
+ .await?
+ .into_iter()
+ .map(|stale| stale.thread_id)
+ .collect())
+ };
+
+ assert_eq!(stale(10).await?, vec![INVOICE, BULK]);
+ assert_eq!(stale(1).await?, vec![INVOICE]);
+ assert!(repo.stale_threads(since, &[], 10).await?.is_empty());
+
+ // Classified at an older message: still stale. At the latest: done.
+ let thread = load_thread(&repo, INVOICE).await?.unwrap();
+ repo.save(&record(INVOICE, FIRST_MESSAGE, thread.messages[0].at, 50))
+ .await?;
+ assert_eq!(stale(10).await?, vec![INVOICE, BULK]);
+ let latest = thread.messages.last().unwrap();
+ repo.save(&record(INVOICE, latest.id, latest.at, 50))
+ .await?;
+ assert_eq!(stale(10).await?, vec![BULK]);
+ assert_eq!(
+ load_thread(&repo, INVOICE)
+ .await?
+ .unwrap()
+ .classified_message_id,
+ Some(LATEST_MESSAGE)
+ );
+ Ok(())
+}
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(path = "../../../fixtures", scripts("email_focus"))
+)]
+async fn an_older_classification_never_replaces_a_newer_one(
+ pool: Pool<Postgres>,
+) -> Result<(), Report> {
+ let repo = FocusPgRepository(pool);
+ let thread = load_thread(&repo, INVOICE).await?.unwrap();
+ let latest = thread.messages.last().unwrap();
+ assert!(
+ repo.save(&record(INVOICE, latest.id, latest.at, 80))
+ .await?
+ );
+ assert!(
+ !repo
+ .save(&record(INVOICE, FIRST_MESSAGE, thread.messages[0].at, 10))
+ .await?
+ );
+
+ let stored = repo.focus_for_threads(&owner(), &[INVOICE]).await?;
+ let focus = stored.get(&INVOICE).expect("stored");
+ assert_eq!(focus.importance, 80);
+ assert_eq!(focus.category, FocusCategory::Customer);
+ assert!(focus.needs_reply && !focus.needs_follow_up && focus.is_focus);
+ assert_eq!(
+ load_thread(&repo, INVOICE)
+ .await?
+ .unwrap()
+ .classified_message_id,
+ Some(LATEST_MESSAGE)
+ );
+
+ // Reclassifying the same message replaces the result.
+ assert!(
+ repo.save(&record(INVOICE, latest.id, latest.at, 70))
+ .await?
+ );
+ let stored = repo.focus_for_threads(&owner(), &[INVOICE]).await?;
+ assert_eq!(stored.get(&INVOICE).expect("stored").importance, 70);
+ Ok(())
+}
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(path = "../../../fixtures", scripts("email_focus"))
+)]
+async fn focus_list_is_the_owners_inbox_by_priority(pool: Pool<Postgres>) -> Result<(), Report> {
+ let repo = FocusPgRepository(pool);
+ let now = Utc::now();
+ repo.save(&record(INVOICE, LATEST_MESSAGE, now, 60)).await?;
+ repo.save(&record(BULK, Uuid::new_v4(), now, 90)).await?;
+ // Archived threads leave Focus even with a stored verdict.
+ repo.save(&record(ARCHIVED, Uuid::new_v4(), now, 99))
+ .await?;
+ // Someone else's inbox, not linked to the owner.
+ repo.save(&FocusRecord {
+ link_id: OTHER_LINK,
+ ..record(OTHER_THREAD, Uuid::new_v4(), now, 95)
+ })
+ .await?;
+
+ // Mail from 20 hours ago at 60 outranks mail from 3 days ago at 90: the
+ // older thread has lost a half-life more.
+ let since = now - Duration::days(30);
+ assert_eq!(
+ repo.focus_thread_ids(&owner(), since, 10).await?,
+ vec![INVOICE, BULK]
+ );
+ assert_eq!(
+ repo.focus_thread_ids(&owner(), since, 1).await?,
+ vec![INVOICE]
+ );
+ // A wide enough importance gap still wins.
+ repo.save(&record(INVOICE, LATEST_MESSAGE, now, 30)).await?;
+ assert_eq!(
+ repo.focus_thread_ids(&owner(), since, 10).await?,
+ vec![BULK, INVOICE]
+ );
+ // Importance 0 ranks as 1 instead of failing on log(0).
+ repo.save(&record(INVOICE, LATEST_MESSAGE, now, 0)).await?;
+ assert_eq!(
+ repo.focus_thread_ids(&owner(), since, 10).await?,
+ vec![BULK, INVOICE]
+ );
+ assert_eq!(
+ repo.focus_thread_ids(&owner(), now - Duration::days(1), 10)
+ .await?,
+ vec![INVOICE]
+ );
+
+ // The other inbox's owner sees only their own thread.
+ let stranger = MacroUserIdStr::try_from_email("[email protected]").unwrap();
+ assert_eq!(
+ repo.focus_thread_ids(&stranger, since, 10).await?,
+ vec![OTHER_THREAD]
+ );
+ assert!(
+ repo.focus_for_threads(&stranger, &[INVOICE, BULK])
+ .await?
+ .is_empty()
+ );
+ assert_eq!(
+ repo.focus_for_threads(&owner(), &[INVOICE, BULK, ARCHIVED])
+ .await?
+ .len(),
+ 3
+ );
+ Ok(())
+}
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(
+ path = "../../../fixtures",
+ scripts("email_focus", "email_focus_linked")
+ )
+)]
+async fn focus_covers_inboxes_linked_to_the_owner(pool: Pool<Postgres>) -> Result<(), Report> {
+ let repo = FocusPgRepository(pool);
+ let now = Utc::now();
+ repo.save(&FocusRecord {
+ link_id: OTHER_LINK,
+ ..record(OTHER_THREAD, Uuid::new_v4(), now, 70)
+ })
+ .await?;
+
+ // The other inbox is linked to the owner's account, so its Focus is theirs too.
+ assert_eq!(
+ repo.focus_thread_ids(&owner(), now - Duration::days(30), 10)
+ .await?,
+ vec![OTHER_THREAD]
+ );
+ assert!(
+ repo.focus_for_threads(&owner(), &[OTHER_THREAD])
+ .await?
+ .contains_key(&OTHER_THREAD)
+ );
+ Ok(())
+}
diff --git a/crates/graphql_email/Cargo.toml b/crates/graphql_email/Cargo.toml
index 90db052873..e1de858c5c 100644
--- a/crates/graphql_email/Cargo.toml
+++ b/crates/graphql_email/Cargo.toml
@@ -13,6 +13,7 @@ entity_access = { path = "../entity_access", default-features = false }
futures = { workspace = true }
graphql_common = { path = "../graphql_common" }
macro_user_id = { path = "../macro_user_id" }
+rootcause = { workspace = true }
serde_json = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
diff --git a/crates/graphql_email/src/focus.rs b/crates/graphql_email/src/focus.rs
new file mode 100644
index 0000000000..016739c807
--- /dev/null
+++ b/crates/graphql_email/src/focus.rs
@@ -0,0 +1,192 @@
+//! Focus: the importance classification stored for signal email threads.
+
+use std::{collections::HashMap, sync::Arc};
+
+use async_graphql::{Context, Enum, SimpleObject, dataloader::DataLoader, dataloader::Loader};
+use email::domain::focus::{FocusCategory, FocusQueries, FocusStore, ThreadFocus};
+use futures::future::BoxFuture;
+use macro_user_id::user_id::MacroUserIdStr;
+use uuid::Uuid;
+
+#[cfg(test)]
+mod test;
+
+/// Most thread ids folded into one Focus lookup.
+const MAX_FOCUS_KEYS: usize = 500;
+
+/// Focus reads on behalf of a viewer, limited to the viewer's own inboxes.
+pub trait EmailFocusReader: Send + Sync + 'static {
+ /// The viewer's Focus threads with mail in the last `window_days`,
+ /// highest priority first.
+ fn focus_thread_ids<'a>(
+ &'a self,
+ user: &'a MacroUserIdStr<'static>,
+ window_days: u16,
+ ) -> BoxFuture<'a, Result<Vec<Uuid>, rootcause::Report>>;
+
+ /// Stored classifications for the viewer's threads among `thread_ids`.
+ fn focus_for_threads<'a>(
+ &'a self,
+ user: &'a MacroUserIdStr<'static>,
+ thread_ids: Vec<Uuid>,
+ ) -> BoxFuture<'a, Result<HashMap<Uuid, ThreadFocus>, rootcause::Report>>;
+}
+
+impl<S: FocusStore> EmailFocusReader for FocusQueries<S> {
+ fn focus_thread_ids<'a>(
+ &'a self,
+ user: &'a MacroUserIdStr<'static>,
+ window_days: u16,
+ ) -> BoxFuture<'a, Result<Vec<Uuid>, rootcause::Report>> {
+ Box::pin(FocusQueries::focus_thread_ids(self, user, window_days))
+ }
+
+ fn focus_for_threads<'a>(
+ &'a self,
+ user: &'a MacroUserIdStr<'static>,
+ thread_ids: Vec<Uuid>,
+ ) -> BoxFuture<'a, Result<HashMap<Uuid, ThreadFocus>, rootcause::Report>> {
+ Box::pin(async move { FocusQueries::focus_for_threads(self, user, &thread_ids).await })
+ }
+}
+
+/// The Focus reader for one request, supplied by the composition root.
+#[derive(Clone)]
+pub struct EmailFocusContext(pub Arc<dyn EmailFocusReader>);
+
+/// Why a thread is in or out of Focus.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Enum)]
+#[graphql(name = "GraphqlEmailFocusCategory")]
+pub enum GraphqlEmailFocusCategory {
+ /// A customer, client or user asking for help or giving feedback.
+ Customer,
+ /// Mail from someone at the owner's own company.
+ Team,
+ /// Mail from someone the owner corresponds with.
+ Known,
+ /// Relevant mail that fits no narrower category.
+ Other,
+ /// A calendar invite, update or RSVP.
+ Calendar,
+ /// Unsolicited outreach: a pitch, recruiting or a job application.
+ Outreach,
+ /// Automated, bulk or templated mail.
+ Automated,
+ /// Nothing marks the thread as relevant.
+ LowRelevance,
+}
+
+impl From<FocusCategory> for GraphqlEmailFocusCategory {
+ fn from(category: FocusCategory) -> Self {
+ match category {
+ FocusCategory::Customer => Self::Customer,
+ FocusCategory::Team => Self::Team,
+ FocusCategory::Known => Self::Known,
+ FocusCategory::Other => Self::Other,
+ FocusCategory::Calendar => Self::Calendar,
+ FocusCategory::Outreach => Self::Outreach,
+ FocusCategory::Automated => Self::Automated,
+ FocusCategory::LowRelevance => Self::LowRelevance,
+ }
+ }
+}
+
+/// The Focus classification of one email thread.
+#[derive(Debug, Clone, SimpleObject)]
+#[graphql(name = "GraphqlEmailThreadFocus")]
+pub struct GraphqlEmailThreadFocus {
+ /// Whether the thread belongs in Focus.
+ is_focus: bool,
+ /// The Focus category, or why the thread was left out.
+ category: GraphqlEmailFocusCategory,
+ /// Sort key for the Focus list, 0 to 100.
+ importance: i32,
+ /// The latest message waits on the owner's answer.
+ needs_reply: bool,
+ /// An open loop the owner should come back to.
+ needs_follow_up: bool,
+ /// When the classification was made, in RFC 3339 format.
+ classified_at: String,
+}
+
+impl From<ThreadFocus> for GraphqlEmailThreadFocus {
+ fn from(focus: ThreadFocus) -> Self {
+ Self {
+ is_focus: focus.is_focus,
+ category: focus.category.into(),
+ importance: i32::from(focus.importance),
+ needs_reply: focus.needs_reply,
+ needs_follow_up: focus.needs_follow_up,
+ classified_at: focus.classified_at.to_rfc3339(),
+ }
+ }
+}
+
+/// DataLoader for the viewer's stored Focus classifications.
+pub struct EmailThreadFocusLoader {
+ user_id: MacroUserIdStr<'static>,
+ reader: Arc<dyn EmailFocusReader>,
+}
+
+impl Loader<Uuid> for EmailThreadFocusLoader {
+ type Value = ThreadFocus;
+ type Error = Arc<rootcause::Report>;
+
+ async fn load(&self, keys: &[Uuid]) -> Result<HashMap<Uuid, Self::Value>, Self::Error> {
+ self.reader
+ .focus_for_threads(&self.user_id, keys.to_vec())
+ .await
+ // Once per batch; every thread in it then fails with the same error.
+ .inspect_err(|error| {
+ tracing::error!(error = ?error, threads = keys.len(), "email thread focus load failed");
+ })
+ .map_err(Arc::new)
+ }
+}
+
+/// Build a Focus DataLoader scoped to the requesting user.
+pub fn email_thread_focus_loader(
+ user_id: MacroUserIdStr<'static>,
+ reader: Arc<dyn EmailFocusReader>,
+) -> DataLoader<EmailThreadFocusLoader> {
+ let loader = DataLoader::new(EmailThreadFocusLoader { user_id, reader }, tokio::spawn)
+ .max_batch_size(MAX_FOCUS_KEYS);
+ // Subscription connection data outlives one payload; never serve a stale verdict.
+ loader.enable_all_cache(false);
+ loader
+}
+
+/// The stored Focus classification of a thread, or `None` when the thread is
+/// unclassified, belongs to someone else's inbox, or Focus is not served here.
+pub async fn load_email_thread_focus(
+ ctx: &Context<'_>,
+ thread_id: Uuid,
+) -> async_graphql::Result<Option<GraphqlEmailThreadFocus>> {
+ let Some(loader) = ctx.data_opt::<DataLoader<EmailThreadFocusLoader>>() else {
+ return Ok(None);
+ };
+ loader
+ .load_one(thread_id)
+ .await
+ .map(|focus| focus.map(Into::into))
+ .map_err(|_| async_graphql::Error::new("email thread focus is unavailable"))
+}
+
+/// The viewer's Focus thread ids, highest priority first; empty when Focus is
+/// not served here.
+pub async fn load_email_focus_thread_ids(
+ ctx: &Context<'_>,
+ user_id: &MacroUserIdStr<'static>,
+ window_days: u16,
+) -> async_graphql::Result<Vec<Uuid>> {
+ let Some(EmailFocusContext(reader)) = ctx.data_opt::<EmailFocusContext>() else {
+ return Ok(Vec::new());
+ };
+ reader
+ .focus_thread_ids(user_id, window_days)
+ .await
+ .map_err(|error| {
+ tracing::error!(error = ?error, "email focus list load failed");
+ async_graphql::Error::new("email focus is unavailable")
+ })
+}
diff --git a/crates/graphql_email/src/focus/test.rs b/crates/graphql_email/src/focus/test.rs
new file mode 100644
index 0000000000..f6f4ab0754
--- /dev/null
+++ b/crates/graphql_email/src/focus/test.rs
@@ -0,0 +1,190 @@
+use std::sync::Mutex;
+
+use async_graphql::{EmptyMutation, EmptySubscription, Object, Schema};
+use chrono::{TimeZone, Utc};
+
+use super::*;
+
+struct FakeReader {
+ stored: HashMap<Uuid, ThreadFocus>,
+ ordered: Vec<Uuid>,
+ calls: Mutex<Vec<(String, Vec<Uuid>)>>,
+ /// Fail every classification lookup, as when the database is down.
+ failing: bool,
+}
+
+impl EmailFocusReader for FakeReader {
+ fn focus_thread_ids<'a>(
+ &'a self,
+ user: &'a MacroUserIdStr<'static>,
+ window_days: u16,
+ ) -> BoxFuture<'a, Result<Vec<Uuid>, rootcause::Report>> {
+ self.calls
+ .lock()
+ .unwrap()
+ .push((format!("{user}:{window_days}"), Vec::new()));
+ Box::pin(async { Ok(self.ordered.clone()) })
+ }
+
+ fn focus_for_threads<'a>(
+ &'a self,
+ user: &'a MacroUserIdStr<'static>,
+ thread_ids: Vec<Uuid>,
+ ) -> BoxFuture<'a, Result<HashMap<Uuid, ThreadFocus>, rootcause::Report>> {
+ self.calls
+ .lock()
+ .unwrap()
+ .push((user.to_string(), thread_ids.clone()));
+ Box::pin(async move {
+ if self.failing {
+ return Err(rootcause::report!("database unavailable"));
+ }
+ Ok(thread_ids
+ .into_iter()
+ .filter_map(|id| self.stored.get(&id).map(|focus| (id, focus.clone())))
+ .collect())
+ })
+ }
+}
+
+fn user() -> MacroUserIdStr<'static> {
+ MacroUserIdStr::try_from_email("[email protected]").unwrap()
+}
+
+fn focus(importance: u8) -> ThreadFocus {
+ ThreadFocus {
+ is_focus: true,
+ category: FocusCategory::Outreach,
+ importance,
+ needs_reply: true,
+ needs_follow_up: false,
+ classified_at: Utc.with_ymd_and_hms(2026, 10, 9, 12, 0, 0).unwrap(),
+ }
+}
+
+struct Query {
+ threads: Vec<Uuid>,
+}
+
+#[Object]
+impl Query {
+ async fn focus(
+ &self,
+ ctx: &Context<'_>,
+ ) -> async_graphql::Result<Vec<Option<GraphqlEmailThreadFocus>>> {
+ // Fields resolve concurrently in a real query; load the same way so they batch.
+ futures::future::try_join_all(
+ self.threads
+ .iter()
+ .map(|thread_id| load_email_thread_focus(ctx, *thread_id)),
+ )
+ .await
+ }
+
+ async fn ids(&self, ctx: &Context<'_>) -> async_graphql::Result<Vec<String>> {
+ Ok(load_email_focus_thread_ids(ctx, &user(), 30)
+ .await?
+ .into_iter()
+ .map(|id| id.to_string())
+ .collect())
+ }
+}
+
+#[tokio::test]
+async fn focus_edge_maps_stored_classifications() {
+ let (known, unknown) = (Uuid::new_v4(), Uuid::new_v4());
+ let reader = Arc::new(FakeReader {
+ stored: HashMap::from([(known, focus(87))]),
+ ordered: vec![known],
+ calls: Mutex::default(),
+ failing: false,
+ });
+ let schema = Schema::build(
+ Query {
+ threads: vec![known, unknown],
+ },
+ EmptyMutation,
+ EmptySubscription,
+ )
+ .data(email_thread_focus_loader(user(), reader.clone()))
+ .data(EmailFocusContext(reader.clone()))
+ .finish();
+
+ let response = schema
+ .execute(
+ "{ focus { isFocus category importance needsReply needsFollowUp classifiedAt } ids }",
+ )
+ .await;
+ assert!(response.errors.is_empty(), "{:?}", response.errors);
+ let data = response.data.into_json().unwrap();
+ assert_eq!(data["focus"][0]["category"], "OUTREACH");
+ assert_eq!(data["focus"][0]["importance"], 87);
+ assert_eq!(data["focus"][0]["needsReply"], true);
+ assert_eq!(
+ data["focus"][0]["classifiedAt"],
+ "2026-10-09T12:00:00+00:00"
+ );
+ assert!(data["focus"][1].is_null());
+ assert_eq!(data["ids"][0], known.to_string());
+ // Both edge lookups were batched into one read for the viewer.
+ let calls = reader.calls.lock().unwrap();
+ assert!(
+ calls
+ .iter()
+ .any(|(who, ids)| who == "macro|[email protected]" && ids.len() == 2)
+ );
+ // The list is read for the viewer over the requested window.
+ assert!(
+ calls
+ .iter()
+ .any(|(who, _)| who == "macro|[email protected]:30")
+ );
+}
+
+#[tokio::test]
+async fn a_failed_lookup_errors_only_the_focus_field() {
+ let thread = Uuid::new_v4();
+ let reader = Arc::new(FakeReader {
+ stored: HashMap::new(),
+ ordered: vec![thread],
+ calls: Mutex::default(),
+ failing: true,
+ });
+ let schema = Schema::build(
+ Query {
+ threads: vec![thread],
+ },
+ EmptyMutation,
+ EmptySubscription,
+ )
+ .data(email_thread_focus_loader(user(), reader.clone()))
+ .data(EmailFocusContext(reader))
+ .finish();
+
+ let response = schema.execute("{ focus { importance } ids }").await;
+ assert_eq!(response.errors.len(), 1, "{:?}", response.errors);
+ assert_eq!(
+ response.errors[0].message,
+ "email thread focus is unavailable"
+ );
+ let data = response.data.into_json().unwrap();
+ assert!(data["focus"].is_null());
+ assert_eq!(data["ids"][0], thread.to_string());
+}
+
+#[tokio::test]
+async fn focus_is_absent_where_it_is_not_served() {
+ let schema = Schema::build(
+ Query {
+ threads: vec![Uuid::new_v4()],
+ },
+ EmptyMutation,
+ EmptySubscription,
+ )
+ .finish();
+ let response = schema.execute("{ focus { importance } ids }").await;
+ assert!(response.errors.is_empty(), "{:?}", response.errors);
+ let data = response.data.into_json().unwrap();
+ assert!(data["focus"][0].is_null());
+ assert_eq!(data["ids"], serde_json::json!([]));
+}
diff --git a/crates/graphql_email/src/lib.rs b/crates/graphql_email/src/lib.rs
index e28c9b26fb..8b6d64711a 100644
--- a/crates/graphql_email/src/lib.rs
+++ b/crates/graphql_email/src/lib.rs
@@ -2,6 +2,7 @@
//! and the DataLoader-backed Soup email-message edge.
#![deny(missing_docs)]
+mod focus;
mod loaders;
mod mutation;
mod send;
@@ -14,6 +15,11 @@ mod operation;
mod user_objects;
mod user_query;
+pub use focus::{
+ EmailFocusContext, EmailFocusReader, EmailThreadFocusLoader, GraphqlEmailFocusCategory,
+ GraphqlEmailThreadFocus, email_thread_focus_loader, load_email_focus_thread_ids,
+ load_email_thread_focus,
+};
pub use loaders::{
EmailContentKey, EmailContentLoad, EmailContentLoader, EmailContentMessage,
EmailServiceEmailContentReader, EmailThreadMailProjectionLoad, EmailThreadMailProjectionLoader,
diff --git a/crates/graphql_soup/src/lib.rs b/crates/graphql_soup/src/lib.rs
index fe18f32abb..fc7771d0d5 100644
--- a/crates/graphql_soup/src/lib.rs
+++ b/crates/graphql_soup/src/lib.rs
@@ -43,5 +43,6 @@ pub use objects::{
};
pub use resolvers::{
SoupEmailThreadMutationOutput, resolve_grouped_soup, resolve_soup, resolve_soup_agent_session,
- resolve_soup_email_thread, resolve_soup_entity, resolve_soup_updates,
+ resolve_soup_email_thread, resolve_soup_email_threads, resolve_soup_entity,
+ resolve_soup_updates,
};
diff --git a/crates/graphql_soup/src/loaders.rs b/crates/graphql_soup/src/loaders.rs
index 2d4597eebf..16d4ab418a 100644
--- a/crates/graphql_soup/src/loaders.rs
+++ b/crates/graphql_soup/src/loaders.rs
@@ -507,15 +507,23 @@ where
SoupItemDataLoader::new(loader)
}
-/// Build an OR tree from literals, falling back to an impossible literal when empty.
+/// Build an OR tree from literals, falling back to an impossible literal when
+/// empty. Balanced, not folded: a batch of hundreds of ids folded linearly is
+/// a tree too deep for downstream walkers and serializers.
fn literal_tree<T>(literals: Vec<T>, impossible: T) -> Arc<Expr<T>> {
- Arc::new(
- literals
- .into_iter()
- .map(Expr::val)
- .reduce(Expr::or)
- .unwrap_or_else(|| Expr::val(impossible)),
- )
+ let mut nodes = literals.into_iter().map(Expr::val).collect::<Vec<_>>();
+ while nodes.len() > 1 {
+ let mut pairs = nodes.into_iter();
+ let mut next = Vec::new();
+ while let Some(left) = pairs.next() {
+ next.push(match pairs.next() {
+ Some(right) => Expr::or(left, right),
+ None => left,
+ });
+ }
+ nodes = next;
+ }
+ Arc::new(nodes.pop().unwrap_or_else(|| Expr::val(impossible)))
}
/// Parse an entity's id, which every Soup-hydrated entity carries as a UUID.
diff --git a/crates/graphql_soup/src/loaders/test.rs b/crates/graphql_soup/src/loaders/test.rs
index 30b1db6521..3927ddc18c 100644
--- a/crates/graphql_soup/src/loaders/test.rs
+++ b/crates/graphql_soup/src/loaders/test.rs
@@ -675,6 +675,29 @@ async fn pr_and_session_hydration_recheck_team_on_each_batch() {
assert_eq!(soup.calls.lock().unwrap()[1].team_id, None);
}
+fn depth<T>(expr: &Expr<T>) -> usize {
+ match expr {
+ Expr::And(left, right) | Expr::Or(left, right) => 1 + depth(left).max(depth(right)),
+ Expr::Not(inner) => 1 + depth(inner),
+ Expr::Literal(_) => 1,
+ }
+}
+
+#[test]
+fn a_full_batch_of_ids_is_a_shallow_tree() {
+ let ids = (0..500).map(Uuid::from_u128).collect::<Vec<_>>();
+ let tree = literal_tree(
+ ids.iter().copied().map(DocumentLiteral::Id).collect(),
+ DocumentLiteral::Id(Uuid::nil()),
+ );
+ assert!(depth(&tree) <= 10, "depth {}", depth(&tree));
+ let collected = collect_ids(&tree, |literal| match literal {
+ DocumentLiteral::Id(id) => Some(*id),
+ _ => None,
+ });
+ assert_eq!(collected, ids.into_iter().collect());
+}
+
#[tokio::test]
async fn crm_record_hydration_carries_the_viewer_team() {
use entity_access::domain::models::{EntityPermission, TeamRole};
diff --git a/crates/graphql_soup/src/resolvers.rs b/crates/graphql_soup/src/resolvers.rs
index 8dc811a17a..25290ec9a4 100644
--- a/crates/graphql_soup/src/resolvers.rs
+++ b/crates/graphql_soup/src/resolvers.rs
@@ -135,6 +135,39 @@ where
}
}
+/// Resolve email threads, in the given order, through the user-scoped Soup
+/// item loader. Missing or inaccessible threads are left out.
+pub async fn resolve_soup_email_threads<Edges>(
+ ctx: &Context<'_>,
+ user_id: MacroUserIdStr<'static>,
+ thread_ids: Vec<uuid::Uuid>,
+) -> async_graphql::Result<Vec<GraphqlSoupEmailThread<Edges>>>
+where
+ Edges: SoupEntityEdges,
+{
+ let loader = ctx.data::<SoupItemDataLoader>()?;
+ // Concurrent loads coalesce into one batched Soup request per user.
+ let items = futures::future::try_join_all(thread_ids.into_iter().map(|thread_id| {
+ loader.load_one((
+ user_id.clone(),
+ EntityType::EmailThread.with_entity_string(thread_id.to_string()),
+ ))
+ }))
+ .await?;
+ let mut threads = Vec::with_capacity(items.len());
+ for item in items.into_iter().flatten() {
+ match GraphqlSoupEntity::<Edges>::new_with_projection(item) {
+ GraphqlSoupEntity::EmailThread(thread) => threads.push(thread),
+ _ => {
+ return Err(async_graphql::Error::new(
+ "Soup returned a non-email entity for an email-thread request",
+ ));
+ }
+ }
+ }
+ Ok(threads)
+}
+
/// Fetch one agent session the viewer can see, through the same access
/// filter the Soup list uses, so a session outside their grants reads as
/// absent rather than as an error. Reads the primary: see
diff --git a/crates/macro_db_client/migrations/20261009192412_create_email_thread_focus.sql b/crates/macro_db_client/migrations/20261009192412_create_email_thread_focus.sql
new file mode 100644
index 0000000000..d68ce8e5cf
--- /dev/null
+++ b/crates/macro_db_client/migrations/20261009192412_create_email_thread_focus.sql
@@ -0,0 +1,27 @@
+-- Focus: one relevance classification per signal email thread, written by the
+-- email focus worker and read by the Focus view. Results only; the worker
+-- classifies on each new message and an hourly sweep reclassifies stale rows.
+-- Rows go away with their thread, and threads go away with their link.
+-- The foreign key briefly locks email_threads; fail rather than queue writes.
+SET LOCAL lock_timeout = '5s';
+
+CREATE TABLE email_thread_focus (
+ thread_id UUID PRIMARY KEY REFERENCES email_threads (id) ON DELETE CASCADE,
+ link_id UUID NOT NULL,
+ classified_message_id UUID NOT NULL,
+ classified_message_ts TIMESTAMPTZ NOT NULL,
+ is_focus BOOLEAN NOT NULL,
+ category TEXT NOT NULL,
+ importance SMALLINT NOT NULL CHECK (importance BETWEEN 0 AND 100),
+ needs_reply BOOLEAN NOT NULL,
+ needs_follow_up BOOLEAN NOT NULL,
+ scores JSONB NOT NULL,
+ model TEXT NOT NULL,
+ classified_at TIMESTAMPTZ NOT NULL
+);
+
+-- The Focus list: one inbox's Focus threads. The list sorts its few hundred
+-- rows by priority, which decays with time, so the index carries no order.
+CREATE INDEX email_thread_focus_list_idx
+ ON email_thread_focus (link_id)
+ WHERE is_focus;
diff --git a/docs/agent-guide/email.md b/docs/agent-guide/email.md
index 875213f9cd..6920301907 100644
--- a/docs/agent-guide/email.md
+++ b/docs/agent-guide/email.md
@@ -39,17 +39,18 @@ and its `New tag` action creates a personal tag with no Team sharing option.
Full email client. Desktop groups `Signal` and `Noise` under one `Inbox` sidebar
item, with pill tabs beside the Inbox title in the content header, matching the
-Chat sidebar tabs. Selecting Inbox
-from another mailbox opens Signal; selecting it while in Noise keeps Noise.
+Chat sidebar tabs; with the Focus flags on, a `Focus` tab leads them. Selecting
+Inbox from another mailbox opens Signal; selecting it while in Focus or Noise
+keeps that tab.
The desktop sidebar continues with `Favorites`, `Drafts`, `Sent`, `Scheduled`,
and `Reminders` (when reminders are enabled), followed by a **Library** section containing `All mail`,
`Archived`, and `Shared`, then **Tags**. Sidebar number shortcuts follow that
-order; `Tab` and `Shift+Tab` toggle between Signal and Noise (from another
-mailbox, `Tab` opens Signal and `Shift+Tab` Noise). While the email list itself
-has focus, `Tab` moves browser focus instead; use `g i` or `g o`. Calendar
-mail remains available through the calendar filter and existing Calendar route.
-Mobile keeps its original tabs and order, including separate Signal, Noise, and
-Calendar tabs.
+order; `Tab` and `Shift+Tab` move between the Inbox tabs (from another mailbox,
+`Tab` opens the first, Focus when it shows, else Signal, and `Shift+Tab` Noise).
+While the email list itself has focus, `Tab` moves browser focus instead; use
+`g i` or `g o`. Calendar mail remains available through the calendar filter and
+existing Calendar route. Mobile keeps its original tabs and order, including
+separate Signal, Noise, and Calendar tabs, with `Focus` (flagged) first.
Compose via the `Email` button (or `Create` → `Email E`). On a fresh local user it
shows `Connect your email`; Gmail/Google Workspace and enabled Outlook connections
use provider consent. Most functionality needs a connected account. Search is `Ctrl+F` or `/` within the surface.
@@ -126,6 +127,27 @@ REST Soup uses `favorites_only: true`. Starring changes membership without
changing the list query. Text search still resolves favorite IDs for the search
service. An empty favorites list shows `No favorite emails`.
+With `enable-email-focus` and `enable-graphql-soup` on, a `Focus` tab leads the
+desktop Inbox tabs (with an `Experimental` badge beside them while it is open)
+and the mobile pills (`Focus · Experimental`). It lists signal
+threads from the last 30 days that the email focus worker
+(`services/email_focus_worker`) classified as worth attention, including inboxes
+linked to the account, by priority: the importance score halved for every 2 days
+since the thread's latest inbound mail. Rows at least 32rem wide show the 0-100
+importance score with a five-bar meter just before the date, and from 56rem also
+`Reply needed` and `Follow up` tag pills ahead of it. Narrower rows drop both;
+without a touch screen the score moves before the subject, and touch screens
+show neither. The desktop header's sort dropdown (`Sort Focus`, among the view
+options) switches between **Priority**,
+**Importance** and **Most recent**; touch layouts have no dropdown and keep the
+saved order (Priority by default). The filter menu adds a Focus group (Reply
+needed, Follow up) on this tab only and has no Status or Done group there. The
+list is one `user.emailFocus` GraphQL read filtered on the client; it refreshes
+on open, not live. Mark Done hides the row at once and archives the thread; Undo
+brings it back. The worker classifies only inboxes on its
+`FOCUS_ENABLED_EMAIL_DOMAINS` allowlist, so other accounts see the empty state
+`Nothing needs you`.
+
`Archived`, between All mail and Shared in the desktop Library section, lists
your own archived (Mail Done) threads: the
All mailbox with Done applied, excluding threads teammates shared with you. It
diff --git a/infra/stacks/email-service/focus_worker.ts b/infra/stacks/email-service/focus_worker.ts
new file mode 100644
index 0000000000..76df0be0a7
--- /dev/null
+++ b/infra/stacks/email-service/focus_worker.ts
@@ -0,0 +1,166 @@
+import * as aws from '@pulumi/aws';
+import * as awsx from '@pulumi/awsx';
+import * as pulumi from '@pulumi/pulumi';
+import {
+ DATADOG_API_KEY,
+ DEFAULT_CONTINUE_BEFORE_STEADY_STATE,
+ EcsDeploymentFailureAlarm,
+ withTelemetry,
+} from '../../packages/resources';
+import { EcrImage } from '../../packages/service';
+import { type DopplerEcsEnvironment, stack } from '../../packages/shared';
+
+const BASE_NAME = 'email-focus-worker';
+const REPO_ROOT = '../../..';
+
+type Args = {
+ role: aws.iam.Role;
+ ecsClusterArn: pulumi.Output<string> | string;
+ vpc: {
+ vpcId: pulumi.Output<string> | string;
+ privateSubnetIds: pulumi.Output<string[]> | string[];
+ };
+ platform: { family: string; architecture: 'amd64' | 'arm64' };
+ containerEnvVars: { name: string; value: pulumi.Output<string> | string }[];
+ tags: { [key: string]: string };
+ dopplerEcsEnvironment: DopplerEcsEnvironment;
+};
+
+/**
+ * Classifies signal threads for the Focus view. One task: it consumes the
+ * email event topic and runs an hourly sweep, and every write it makes is
+ * idempotent, so it needs no scaling or coordination.
+ */
+export class EmailFocusWorker extends pulumi.ComponentResource {
+ public ecr: awsx.ecr.Repository;
+ public service: awsx.ecs.FargateService;
+
+ constructor(
+ name: string,
+ {
+ role,
+ ecsClusterArn,
+ vpc,
+ platform,
+ containerEnvVars,
+ dopplerEcsEnvironment,
+ tags,
+ }: Args,
+ opts?: pulumi.ComponentResourceOptions
+ ) {
+ super('my:components:EmailFocusWorker', name, {}, opts);
+
+ const image = new EcrImage(
+ `${BASE_NAME}-ecr-image-${stack}`,
+ {
+ repositoryId: `${BASE_NAME}-ecr-${stack}`,
+ repositoryName: `${BASE_NAME}-${stack}`,
+ imageId: `${BASE_NAME}-image-${stack}`,
+ imagePath: REPO_ROOT,
+ dockerfile: 'docker/Dockerfile',
+ platform,
+ tags,
+ buildArgs: {
+ SERVICE_NAME: 'email_focus_worker',
+ },
+ },
+ { parent: this }
+ );
+ this.ecr = image.ecr;
+
+ // The worker only calls out: Postgres, Kafka and the classifier API.
+ const serviceSg = new aws.ec2.SecurityGroup(
+ `${BASE_NAME}-sg-${stack}`,
+ {
+ name: `${BASE_NAME}-sg-${stack}`,
+ vpcId: vpc.vpcId,
+ description: `${BASE_NAME} security group that is attached directly to the service`,
+ tags,
+ },
+ { parent: this }
+ );
+ new aws.vpc.SecurityGroupEgressRule(
+ `${BASE_NAME}-all-out`,
+ {
+ securityGroupId: serviceSg.id,
+ description: 'Allow all outbound',
+ cidrIpv4: '0.0.0.0/0',
+ ipProtocol: '-1',
+ tags,
+ },
+ { parent: this }
+ );
+
+ this.service = new awsx.ecs.FargateService(
+ BASE_NAME,
+ {
+ tags,
+ cluster: ecsClusterArn,
+ networkConfiguration: {
+ subnets: vpc.privateSubnetIds,
+ securityGroups: [serviceSg.id],
+ },
+ continueBeforeSteadyState: DEFAULT_CONTINUE_BEFORE_STEADY_STATE,
+ deploymentCircuitBreaker: {
+ enable: true,
+ rollback: true,
+ },
+ taskDefinitionArgs: {
+ taskRole: {
+ roleArn: role.arn,
+ },
+ executionRole: {
+ roleArn: dopplerEcsEnvironment.executionRole.arn,
+ },
+ containers: withTelemetry(BASE_NAME, {
+ service: {
+ name: BASE_NAME,
+ image: image.image.imageUri,
+ stopTimeout: 10, // 10 seconds to force kill the task
+ cpu: 512,
+ memory: 718, // 1024 - 256 for datadog - 50 for log_router
+ // Trace as its own service so worker errors stay out of email-service's APM.
+ environment: [
+ ...containerEnvVars.filter((env) => env.name !== 'DD_SERVICE'),
+ { name: 'DD_SERVICE', value: BASE_NAME },
+ ],
+ secrets: [...dopplerEcsEnvironment.containerSecrets],
+ logConfiguration: {
+ logDriver: 'awsfirelens',
+ options: {
+ Name: 'datadog',
+ Host: 'http-intake.logs.us5.datadoghq.com',
+ apikey: DATADOG_API_KEY,
+ dd_service: `${BASE_NAME}-${stack}`,
+ dd_source: 'fargate',
+ dd_tags: `project:cloudstorage, env:${stack}`,
+ provider: 'ecs',
+ },
+ },
+ },
+ }),
+ runtimePlatform: {
+ operatingSystemFamily: `${platform.family.toUpperCase()}`,
+ cpuArchitecture: `${
+ platform.architecture === 'amd64'
+ ? 'X86_64'
+ : platform.architecture.toUpperCase()
+ }`,
+ },
+ },
+ desiredCount: 1,
+ },
+ { parent: this }
+ );
+
+ new EcsDeploymentFailureAlarm(
+ `${BASE_NAME}-deployment-failure-alarm`,
+ {
+ serviceName: BASE_NAME,
+ serviceArn: this.service.service.arn,
+ tags,
+ },
+ { parent: this }
+ );
+ }
+}
diff --git a/infra/stacks/email-service/index.ts b/infra/stacks/email-service/index.ts
index 0f9be1e613..9cbfc26ebc 100644
--- a/infra/stacks/email-service/index.ts
+++ b/infra/stacks/email-service/index.ts
@@ -17,6 +17,7 @@ import {
} from '../../packages/shared';
import { get_coparse_api_vpc } from '../../packages/vpc';
import { EmailAttachmentsBucket } from './attachments-bucket';
+import { EmailFocusWorker } from './focus_worker';
import { EmailPubSubWorkers } from './pubsub_workers';
import { EmailRefreshHandler } from './refresh_lambda';
import {
@@ -437,6 +438,18 @@ new EmailPubSubWorkers('email-pubsub-workers', {
dopplerEcsEnvironment,
});
+// Classifies signal threads for the Focus view. It reads mail only for
+// inboxes on FOCUS_ENABLED_EMAIL_DOMAINS (Doppler) and idles when that is empty.
+new EmailFocusWorker('email-focus-worker', {
+ vpc: coparse_api_vpc,
+ tags,
+ ecsClusterArn: cloudStorageClusterArn,
+ role: emailServiceRole,
+ platform: { family: 'linux', architecture: 'amd64' },
+ containerEnvVars,
+ dopplerEcsEnvironment,
+});
+
const DELETE_UNUSED_AFTER_DAYS = config.require(`delete_unused_after_days`);
const DELETE_INACTIVE_AFTER_DAYS = config.require(`delete_inactive_after_days`);
const INBOX_HEALTH_POLL_INTERVAL_HOURS = config.require(
diff --git a/nix/cloud-storage.nix b/nix/cloud-storage.nix
index 956fe40355..7c489068ec 100644
--- a/nix/cloud-storage.nix
+++ b/nix/cloud-storage.nix
@@ -409,6 +409,11 @@
"pubsub_workers"
];
}
+ {
+ serviceName = "email-focus-worker";
+ packageName = "email_focus_worker";
+ binaries = [ "email_focus_worker" ];
+ }
{
serviceName = "image-proxy-service";
packageName = "image_proxy_service";
@@ -551,6 +556,24 @@
${checkBinaries}
'';
+ # Same for the email service and its Focus worker.
+ emailServiceDeployBinaries =
+ let
+ cfg = builtins.fromJSON (builtins.readFile ../.github/services-config.json);
+ checkBinaries = pkgs.lib.concatMapStringsSep "\n" (binary: ''
+ test -x "$out/bin/${binary}" || {
+ echo "Missing deploy binary: ${binary}" >&2
+ exit 1
+ }
+ '') cfg.services.email-service.deploy_binaries;
+ in
+ pkgs.runCommand "cloud-storage-email-service-deploy-binaries" { } ''
+ mkdir -p $out/bin
+ cp ${deployServiceBinaryPackages.deploy-service-binaries-email-service}/bin/* $out/bin/
+ cp ${deployServiceBinaryPackages.deploy-service-binaries-email-focus-worker}/bin/* $out/bin/
+ ${checkBinaries}
+ '';
+
localStackBinaryPackages = pkgs.lib.listToAttrs (
map (def: {
name = "local-stack-binaries-${def.serviceName}";
@@ -1093,6 +1116,7 @@
// deployServiceBinaryPackages
// {
deploy-service-binaries-document-storage-service = documentStorageDeployBinaries;
+ deploy-service-binaries-email-service = emailServiceDeployBinaries;
}
// deployLambdaPackages
// pkgs.lib.optionalAttrs isLinux {
diff --git a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/AiFeature.md b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/AiFeature.md
index 8278bbd08f..7f7e7c6876 100644
--- a/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/AiFeature.md
+++ b/packages/sdk-docs/reference/generated/cognition/types.gen/type-aliases/AiFeature.md
@@ -1,6 +1,6 @@
# Type Alias: AiFeature
-> **AiFeature** = `"chat"` \| `"memory"` \| `"automation"` \| `"dynamic_completions_api"` \| `"chat_rename"` \| `"call_summary"` \| `"channel_bot"` \| `"ai_projection"` \| `"ai_editing"` \| `"import"` \| `"agent_session"` \| `"agent_repository_choice"` \| `"agent_mode_choice"` \| `"dictation"` \| `"image_generation"`
+> **AiFeature** = `"chat"` \| `"memory"` \| `"automation"` \| `"dynamic_completions_api"` \| `"chat_rename"` \| `"call_summary"` \| `"channel_bot"` \| `"ai_projection"` \| `"ai_editing"` \| `"import"` \| `"agent_session"` \| `"agent_repository_choice"` \| `"agent_mode_choice"` \| `"dictation"` \| `"image_generation"` \| `"email_focus"`
Everything we use AI for. The wire / DB form of each variant is its
`snake_case` name.
diff --git a/packages/sdk/generated/cognition/types.gen.ts b/packages/sdk/generated/cognition/types.gen.ts
index 0e993eca1c..6fb8c2a389 100644
--- a/packages/sdk/generated/cognition/types.gen.ts
+++ b/packages/sdk/generated/cognition/types.gen.ts
@@ -27,7 +27,7 @@ export type AddServerRequest = {
* Everything we use AI for. The wire / DB form of each variant is its
* `snake_case` name.
*/
-export type AiFeature = 'chat' | 'memory' | 'automation' | 'dynamic_completions_api' | 'chat_rename' | 'call_summary' | 'channel_bot' | 'ai_projection' | 'ai_editing' | 'import' | 'agent_session' | 'agent_repository_choice' | 'agent_mode_choice' | 'dictation' | 'image_generation';
+export type AiFeature = 'chat' | 'memory' | 'automation' | 'dynamic_completions_api' | 'chat_rename' | 'call_summary' | 'channel_bot' | 'ai_projection' | 'ai_editing' | 'import' | 'agent_session' | 'agent_repository_choice' | 'agent_mode_choice' | 'dictation' | 'image_generation' | 'email_focus';
/**
* A structured part within an assistant message.
diff --git a/packages/sdk/specs/cognition.json b/packages/sdk/specs/cognition.json
index d5ce2e62ea..01b9b633a7 100644
--- a/packages/sdk/specs/cognition.json
+++ b/packages/sdk/specs/cognition.json
@@ -2658,7 +2658,8 @@
"agent_repository_choice",
"agent_mode_choice",
"dictation",
- "image_generation"
+ "image_generation",
+ "email_focus"
]
},
"AssistantMessagePart": {
diff --git a/services/document_storage_service/src/api/context.rs b/services/document_storage_service/src/api/context.rs
index c3fe96b0bf..dba9a6fa15 100644
--- a/services/document_storage_service/src/api/context.rs
+++ b/services/document_storage_service/src/api/context.rs
@@ -885,6 +885,8 @@ pub(crate) struct ApiContext {
pub graphql_work_feed_context: complete_graph::WorkFeedGraphqlContext,
pub graphql_initiative_entity_loader: graphql_initiative::InitiativeEntityLoader,
pub graphql_agent_session_entity_loader: graphql_soup::AgentSessionEntityLoader,
+ /// Focus reads for the GraphQL `emailFocus` list and thread `focus` field.
+ pub email_focus_reader: Arc<dyn complete_graph::EmailFocusReader>,
pub graphql_primary_soup_item_loader: graphql_soup::PrimarySoupItemLoader,
pub graphql_soup_item_loader: graphql_soup::SoupItemDataLoader,
pub databases_state: DssDatabasesState,
diff --git a/services/document_storage_service/src/api/graphql_soup.rs b/services/document_storage_service/src/api/graphql_soup.rs
index 87a97a2826..ac0aab0e51 100644
--- a/services/document_storage_service/src/api/graphql_soup.rs
+++ b/services/document_storage_service/src/api/graphql_soup.rs
@@ -246,6 +246,13 @@ fn insert_graphql_context_data(
viewer_id,
email_content_reader,
));
+ data.insert(complete_graph::EmailFocusContext(
+ state.email_focus_reader.clone(),
+ ));
+ data.insert(complete_graph::email_thread_focus_loader(
+ macro_user_id.clone(),
+ state.email_focus_reader.clone(),
+ ));
data.insert(complete_graph::entity_favorite_loader(
macro_user_id.clone(),
state.favorites_service.clone(),
diff --git a/services/document_storage_service/src/server.rs b/services/document_storage_service/src/server.rs
index 96cc5bdd2a..c3654cdf0d 100644
--- a/services/document_storage_service/src/server.rs
+++ b/services/document_storage_service/src/server.rs
@@ -2197,6 +2197,9 @@ pub async fn run() -> anyhow::Result<()> {
Arc::new(readonly_email_service),
entity_access_service.as_ref().clone(),
),
+ email_focus_reader: Arc::new(email::domain::focus::FocusQueries::new(
+ email::outbound::FocusPgRepository(readonly_db.clone()),
+ )),
graphql_crm_context: graphql_crm::CrmGraphqlContext::new(pipeline_service.clone()),
graphql_initiative_context: graphql_initiative::InitiativeGraphqlContext::new(
initiative_service.clone(),
diff --git a/services/email_focus_worker/Cargo.toml b/services/email_focus_worker/Cargo.toml
new file mode 100644
index 0000000000..f9cbcc0be6
--- /dev/null
+++ b/services/email_focus_worker/Cargo.toml
@@ -0,0 +1,38 @@
+[package]
+edition = "2024"
+name = "email_focus_worker"
+publish = false
+version = "0.1.0"
+
+[[bin]]
+name = "email_focus_worker"
+path = "src/main.rs"
+
+[[bin]]
+name = "email_focus_worker_doppler_config"
+path = "src/doppler_config.rs"
+
+[dependencies]
+ai_usage = { path = "../../crates/ai_usage" }
+chrono = { workspace = true }
+doppler-config = { workspace = true }
+email = { path = "../../crates/email", default-features = false, features = ["outbound", "ports"] }
+jev = { path = "../../crates/jev", features = ["outbound"] }
+kafka_util = { path = "../../crates/kafka_util" }
+macro_config = { path = "../../crates/macro_config" }
+macro_entrypoint = { path = "../../crates/macro_entrypoint" }
+macro_env = { path = "../../crates/macro_env" }
+macro_env_var = { path = "../../crates/macro_env_var" }
+macro_event_broker = { path = "../../crates/macro_event_broker", features = ["outbound"] }
+macro_user_id = { path = "../../crates/macro_user_id" }
+memory = { path = "../../crates/memory" }
+rdkafka = { workspace = true }
+rootcause = { workspace = true }
+serde = { workspace = true }
+serde_json = { workspace = true }
+sqlx = { workspace = true }
+tokio = { workspace = true, features = ["signal", "time"] }
+tokio-util = { workspace = true }
+tracing = { workspace = true }
+uuid = { workspace = true }
+workspace-hack = { version = "0.1", path = "../../crates/workspace-hack" }
diff --git a/services/email_focus_worker/src/config.rs b/services/email_focus_worker/src/config.rs
new file mode 100644
index 0000000000..6c574b37cb
--- /dev/null
+++ b/services/email_focus_worker/src/config.rs
@@ -0,0 +1,53 @@
+//! Configuration for the email focus worker, loaded with `macro_config` from
+//! the email-service Doppler project it shares with the other email binaries.
+
+pub use macro_env::Environment;
+use macro_env_var::env_vars;
+
+env_vars! {
+ /// The connection URL for the Macro database.
+ pub struct MacroDbUrl;
+ /// Comma-separated Kafka bootstrap servers for the macro event broker.
+ pub struct KafkaBrokers;
+}
+
+/// The email focus worker's configuration.
+#[derive(macro_config::MacroConfig)]
+#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
+pub struct Config {
+ /// The environment we are in.
+ #[macro_config_default(Environment::new_or_prod())]
+ pub environment: Environment,
+ /// The connection URL for the Macro database.
+ pub macro_db_url: MacroDbUrl,
+ /// Kafka bootstrap servers; the worker reads `macro.email`.
+ pub kafka_brokers: KafkaBrokers,
+ /// TypeSafe credential for Jev. While it is unset the worker classifies nothing.
+ pub typesafe_api_key: jev::outbound::TypesafeApiKey,
+ /// Comma-separated inbox domains to classify, e.g. `macro.com`. Mail from
+ /// any other inbox never leaves the system. Empty classifies nothing.
+ #[macro_config_default(String::new())]
+ pub focus_enabled_email_domains: String,
+ /// Seconds between sweeps for threads the event stream missed.
+ #[macro_config_default(3600)]
+ pub focus_sweep_interval_secs: u64,
+ /// Days of mail the sweep and the Focus list cover.
+ #[macro_config_default(30)]
+ pub focus_window_days: u16,
+}
+
+impl Config {
+ /// Load and validate the configuration from the environment.
+ pub fn from_env() -> Result<Self, rootcause::Report> {
+ Ok(macro_config::ConfigLoader::load::<Config>()?)
+ }
+
+ /// The allowlisted inbox domains, trimmed and lowercased.
+ pub fn enabled_domains(&self) -> Vec<String> {
+ self.focus_enabled_email_domains
+ .split(',')
+ .map(|domain| domain.trim().to_lowercase())
+ .filter(|domain| !domain.is_empty())
+ .collect()
+ }
+}
diff --git a/services/email_focus_worker/src/doppler_config.rs b/services/email_focus_worker/src/doppler_config.rs
new file mode 100644
index 0000000000..45c9ce8c75
--- /dev/null
+++ b/services/email_focus_worker/src/doppler_config.rs
@@ -0,0 +1,24 @@
+#![recursion_limit = "256"]
+//! Validates that the worker's configuration loads from both Doppler environments.
+
+use macro_env::Environment;
+
+#[expect(dead_code, reason = "only the configuration's shape is validated here")]
+mod config;
+
+/// The worker runs on the email service's Doppler project.
+const DOPPLER_PROJECT: &str = "email-service";
+
+#[tokio::main]
+async fn main() -> Result<(), rootcause::Report> {
+ for environment in [Environment::Develop, Environment::Production] {
+ doppler_config::DopplerConfig::builder()
+ .token_from_env("DOPPLER_TOKEN")
+ .config(environment.to_doppler_slug())
+ .project(DOPPLER_PROJECT)
+ .build()?
+ .load::<config::Config>()
+ .await?;
+ }
+ Ok(())
+}
diff --git a/services/email_focus_worker/src/inbound/kafka_consumer.rs b/services/email_focus_worker/src/inbound/kafka_consumer.rs
new file mode 100644
index 0000000000..a7443dc2a4
--- /dev/null
+++ b/services/email_focus_worker/src/inbound/kafka_consumer.rs
@@ -0,0 +1,131 @@
+//! Classify a thread whenever mail arrives in it or its owner sends a reply.
+//!
+//! Every email event on the platform passes through here, so the consumer
+//! hands each thread to the Focus service, which drops inboxes off the
+//! allowlist after a single-row read. Offsets are committed whatever the
+//! outcome: a lost or failed classification is picked up by the hourly sweep.
+
+use std::{future::Future, sync::Arc};
+
+use email::domain::{
+ events::{EmailMacroEvent, EmailTopicEvent},
+ focus::{ClassifyOutcome, FocusClassifier, FocusService, FocusStore, ProfileSource},
+};
+use kafka_util::{GroupName, InitialOffset, KafkaEventConsumer};
+use macro_event_broker::{
+ KafkaConsumerAdapter, MacroEvent as _, MacroEventCollection as _, MacroEventConsumerService,
+};
+use rdkafka::consumer::CommitMode;
+use rootcause::Report;
+use tracing::Instrument as _;
+use uuid::Uuid;
+
+#[cfg(test)]
+mod test;
+
+macro_event_broker::declare_topics!(FocusEvent: EmailMacroEvent);
+
+struct EmailFocusGroup;
+
+impl GroupName for EmailFocusGroup {
+ const GROUP_NAME: &'static str = "email-focus";
+ // The sweep covers mail from before the group existed; never replay the topic.
+ const INITIAL_OFFSET: InitialOffset = InitialOffset::Latest;
+}
+
+/// The thread an event touches, when the event can change the thread's Focus.
+fn thread_to_classify(event: &EmailTopicEvent) -> Option<Uuid> {
+ match event {
+ EmailTopicEvent::MessageReceived(message) if !message.is_spam_or_trash => {
+ Some(message.thread_id)
+ }
+ // The owner's reply clears "reply needed" and can open a follow-up.
+ EmailTopicEvent::MessageSent(message) => Some(message.thread_id),
+ _ => None,
+ }
+}
+
+async fn classify<S, P, C>(service: &FocusService<S, P, C>, thread_id: Uuid)
+where
+ S: FocusStore,
+ P: ProfileSource,
+ C: FocusClassifier,
+{
+ match service.classify_thread(thread_id).await {
+ Ok(ClassifyOutcome::Classified(verdict)) => tracing::info!(
+ %thread_id,
+ is_focus = verdict.is_focus,
+ category = %verdict.category,
+ importance = verdict.importance,
+ "focus classified"
+ ),
+ Ok(outcome @ (ClassifyOutcome::Unavailable | ClassifyOutcome::Rejected)) => {
+ tracing::warn!(%thread_id, ?outcome, "focus classification left for the sweep");
+ }
+ Ok(outcome) => tracing::debug!(%thread_id, ?outcome, "focus skipped"),
+ Err(error) => {
+ tracing::warn!(%thread_id, error = ?error, "focus classification failed");
+ }
+ }
+}
+
+/// Consume `macro.email` under the `email-focus` group until `shutdown`
+/// resolves. Receive and commit failures are logged and skipped, as in the
+/// activity consumer: a restart would only re-run the startup sweep.
+pub async fn run_focus_consumer<S, P, C>(
+ brokers: &str,
+ service: Arc<FocusService<S, P, C>>,
+ shutdown: impl Future<Output = ()> + Send,
+) -> Result<(), Report>
+where
+ S: FocusStore,
+ P: ProfileSource,
+ C: FocusClassifier,
+{
+ let consumer = KafkaEventConsumer::<EmailFocusGroup>::from_env(brokers)?;
+ let consumer =
+ KafkaConsumerAdapter::<EmailFocusGroup, ()>::new(consumer).subscribe::<FocusEvent>()?;
+ let consumer = MacroEventConsumerService::new(consumer);
+ tracing::info!(
+ topics = ?FocusEvent::topics(),
+ group = EmailFocusGroup::GROUP_NAME,
+ "email focus consumer listening"
+ );
+ let mut shutdown = std::pin::pin!(shutdown);
+ loop {
+ let message = tokio::select! {
+ biased;
+ () = &mut shutdown => return Ok(()),
+ result = consumer.recv() => match result {
+ Ok(message) => message,
+ Err(error) => {
+ tracing::error!(error = ?error, "kafka receive error");
+ continue;
+ }
+ },
+ };
+ let span = kafka_util::consumer_span(message.inner(), EmailFocusGroup::GROUP_NAME);
+ let thread_id = match message.decode_payload() {
+ Ok(FocusEvent::EmailMacroEvent(event)) => thread_to_classify(&event.event().event),
+ Err(_) => {
+ // Decode errors can echo payload text; log only that it happened.
+ tracing::warn!(parent: &span, "undecodable email event skipped");
+ None
+ }
+ };
+ if let Some(thread_id) = thread_id {
+ tokio::select! {
+ biased;
+ // Uncommitted: the event is redelivered to the next consumer.
+ () = &mut shutdown => return Ok(()),
+ () = classify(&service, thread_id).instrument(span.clone()) => {}
+ }
+ }
+ if let Err(error) = consumer
+ .inner()
+ .commit_message(message.inner(), CommitMode::Async)
+ {
+ tracing::error!(error = ?error, "kafka commit error");
+ }
+ }
+}
diff --git a/services/email_focus_worker/src/inbound/kafka_consumer/test.rs b/services/email_focus_worker/src/inbound/kafka_consumer/test.rs
new file mode 100644
index 0000000000..abc2c957e4
--- /dev/null
+++ b/services/email_focus_worker/src/inbound/kafka_consumer/test.rs
@@ -0,0 +1,68 @@
+use chrono::Utc;
+use email::domain::events::{
+ EmailEventOrigin, MessageReceivedMetadata, MessageSentMetadata, ThreadReadMetadata,
+};
+use macro_user_id::user_id::MacroUserIdStr;
+
+use super::*;
+
+fn owner() -> MacroUserIdStr<'static> {
+ MacroUserIdStr::try_from_email("[email protected]").unwrap()
+}
+
+fn received(thread_id: Uuid, is_spam_or_trash: bool) -> EmailTopicEvent {
+ EmailTopicEvent::MessageReceived(MessageReceivedMetadata {
+ link_id: Uuid::new_v4(),
+ owner: owner(),
+ message_id: Uuid::new_v4(),
+ provider_message_id: "p".to_owned(),
+ thread_id,
+ provider_thread_id: "t".to_owned(),
+ is_new_thread: false,
+ subject: None,
+ from_email: None,
+ from_name: None,
+ to_emails: Vec::new(),
+ attachment_count: 0,
+ is_spam_or_trash,
+ received_at: None,
+ })
+}
+
+#[test]
+fn incoming_mail_and_replies_trigger_classification() {
+ let thread_id = Uuid::new_v4();
+ assert_eq!(
+ thread_to_classify(&received(thread_id, false)),
+ Some(thread_id)
+ );
+ assert_eq!(thread_to_classify(&received(thread_id, true)), None);
+ let sent = EmailTopicEvent::MessageSent(MessageSentMetadata {
+ link_id: Uuid::new_v4(),
+ owner: owner(),
+ actor: None,
+ message_id: Uuid::new_v4(),
+ provider_message_id: "p".to_owned(),
+ thread_id,
+ provider_thread_id: "t".to_owned(),
+ subject: None,
+ to_emails: Vec::new(),
+ cc_emails: Vec::new(),
+ origin: EmailEventOrigin::ProviderSync,
+ sent_at: Utc::now(),
+ });
+ assert_eq!(thread_to_classify(&sent), Some(thread_id));
+}
+
+#[test]
+fn other_events_are_ignored() {
+ let read = EmailTopicEvent::ThreadRead(ThreadReadMetadata {
+ link_id: Uuid::new_v4(),
+ owner: owner(),
+ actor: None,
+ thread_id: Uuid::new_v4(),
+ is_read: true,
+ origin: EmailEventOrigin::ProviderSync,
+ });
+ assert_eq!(thread_to_classify(&read), None);
+}
diff --git a/services/email_focus_worker/src/inbound/sweep.rs b/services/email_focus_worker/src/inbound/sweep.rs
new file mode 100644
index 0000000000..1c664bdf0a
--- /dev/null
+++ b/services/email_focus_worker/src/inbound/sweep.rs
@@ -0,0 +1,56 @@
+//! The hourly sweep: classify signal threads the event stream missed.
+//!
+//! Events can be lost, a classification can fail, initial sync emits no
+//! events, and a thread can become signal without one. The sweep covers all
+//! of these. The first sweep runs at startup, which backfills a newly
+//! allowlisted inbox. Overlapping sweeps (during a deploy) are harmless: a
+//! stored result for a thread's latest message is never classified again.
+
+use std::{sync::Arc, time::Duration};
+
+use email::domain::focus::{FocusClassifier, FocusService, FocusStore, ProfileSource};
+use rootcause::Report;
+use tokio_util::sync::CancellationToken;
+
+/// Threads one sweep classifies at most; the next sweep continues.
+const SWEEP_LIMIT: i64 = 2_000;
+
+/// Sweep every `interval` over the last `window_days` until `shutdown`.
+pub async fn run_sweeps<S, P, C>(
+ service: Arc<FocusService<S, P, C>>,
+ interval: Duration,
+ window_days: u16,
+ shutdown: CancellationToken,
+) -> Result<(), Report>
+where
+ S: FocusStore,
+ P: ProfileSource,
+ C: FocusClassifier,
+{
+ let window = chrono::Duration::days(i64::from(window_days));
+ let mut ticker = tokio::time::interval(interval);
+ ticker.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Delay);
+ loop {
+ tokio::select! {
+ biased;
+ () = shutdown.cancelled() => return Ok(()),
+ _ = ticker.tick() => {}
+ }
+ let sweep = tokio::select! {
+ biased;
+ () = shutdown.cancelled() => return Ok(()),
+ result = service.sweep(window, SWEEP_LIMIT) => result,
+ };
+ match sweep {
+ Ok(report) => tracing::info!(
+ candidates = report.candidates,
+ classified = report.classified,
+ skipped = report.skipped,
+ failed = report.failed,
+ stopped_early = report.stopped_early,
+ "focus sweep finished"
+ ),
+ Err(error) => tracing::error!(error = ?error, "focus sweep failed"),
+ }
+ }
+}
diff --git a/services/email_focus_worker/src/main.rs b/services/email_focus_worker/src/main.rs
new file mode 100644
index 0000000000..40acb130e2
--- /dev/null
+++ b/services/email_focus_worker/src/main.rs
@@ -0,0 +1,102 @@
+#![recursion_limit = "256"]
+//! Classifies signal email threads for the Focus view.
+//!
+//! Reads `macro.email` for new and sent messages, asks Jev about each thread
+//! in an allowlisted inbox with the owner's stored memory as context, and
+//! stores the verdict in `email_thread_focus`. An hourly sweep catches what
+//! the event stream missed.
+
+mod config;
+mod inbound {
+ pub mod kafka_consumer;
+ pub mod sweep;
+}
+mod outbound {
+ pub mod jev_classifier;
+ pub mod memory_profile;
+}
+
+use std::{sync::Arc, time::Duration};
+
+use email::{domain::focus::FocusService, outbound::FocusPgRepository};
+use jev::{domain::JevClassifier, outbound::SystemOneJev};
+use macro_entrypoint::{MacroEntrypoint, shutdown_signal};
+use memory::outbound::pg_memory_repo::PgMemoryRepo;
+use rootcause::Report;
+use sqlx::postgres::PgPoolOptions;
+use tokio_util::sync::CancellationToken;
+
+use crate::{
+ config::Config,
+ inbound::{kafka_consumer::run_focus_consumer, sweep::run_sweeps},
+ outbound::{jev_classifier::JevFocusClassifier, memory_profile::MemoryProfiles},
+};
+
+#[tokio::main]
+async fn main() -> Result<(), Report> {
+ let config = Config::from_env()?;
+ MacroEntrypoint::new(config.environment).init();
+ let enforcement = ai_usage::config::load_ai_usage_enforcement()?;
+
+ let domains = config.enabled_domains();
+ let provider = config
+ .typesafe_api_key
+ .value()
+ .map(SystemOneJev::typesafe)
+ .transpose()?;
+ let Some(provider) = provider.filter(|_| !domains.is_empty()) else {
+ // Off until both are configured; stay up so the deployment stays healthy.
+ tracing::warn!(
+ enabled_domains = domains.len(),
+ "email focus is off: set TYPESAFE_API_KEY and FOCUS_ENABLED_EMAIL_DOMAINS"
+ );
+ shutdown_signal().await;
+ return Ok(());
+ };
+
+ let db = PgPoolOptions::new()
+ .min_connections(1)
+ .max_connections(5)
+ .connect(config.macro_db_url.as_ref())
+ .await?;
+ let service = Arc::new(FocusService::new(
+ FocusPgRepository(db.clone()),
+ MemoryProfiles::new(PgMemoryRepo::new(db.clone())),
+ JevFocusClassifier::new(JevClassifier::new(
+ provider,
+ ai_usage::pg_recorder_with_enforcement(db, enforcement),
+ )),
+ domains,
+ ));
+ tracing::info!(
+ domains = ?config.enabled_domains(),
+ window_days = config.focus_window_days,
+ "email focus worker started"
+ );
+
+ let shutdown = CancellationToken::new();
+ tokio::spawn({
+ let shutdown = shutdown.clone();
+ async move {
+ shutdown_signal().await;
+ shutdown.cancel();
+ }
+ });
+ let brokers = config.kafka_brokers.to_string();
+ let consumer = run_focus_consumer(
+ &brokers,
+ Arc::clone(&service),
+ shutdown.clone().cancelled_owned(),
+ );
+ let sweeps = run_sweeps(
+ service,
+ // A zero interval would panic the timer.
+ Duration::from_secs(config.focus_sweep_interval_secs.max(60)),
+ config.focus_window_days,
+ shutdown.clone(),
+ );
+ // Either loop ending with an error stops the worker so it restarts fresh.
+ let result = tokio::try_join!(consumer, sweeps).map(|_| ());
+ shutdown.cancel();
+ result
+}
diff --git a/services/email_focus_worker/src/outbound/jev_classifier.rs b/services/email_focus_worker/src/outbound/jev_classifier.rs
new file mode 100644
index 0000000000..56ee215318
--- /dev/null
+++ b/services/email_focus_worker/src/outbound/jev_classifier.rs
@@ -0,0 +1,53 @@
+//! The Focus classifier port, backed by Jev and metered as email focus usage.
+
+use ai_usage::{AiFeature, UsageContext};
+use email::domain::focus::{FocusClassifier, FocusClassifierError};
+use jev::domain::{JevClassifier, JevProvider, Probability, YesNoClassifier, YesNoQuestion};
+use macro_user_id::user_id::MacroUserIdStr;
+use serde_json::Value;
+use uuid::Uuid;
+
+/// Model id recorded with each classification; Jev's own name for its latest model.
+const MODEL: &str = "jev-latest";
+
+/// Jev answering Focus questions on the owner's behalf.
+pub struct JevFocusClassifier<P> {
+ classifier: JevClassifier<P>,
+}
+
+impl<P> JevFocusClassifier<P> {
+ /// Classify through `classifier`, which records usage per call.
+ pub fn new(classifier: JevClassifier<P>) -> Self {
+ Self { classifier }
+ }
+}
+
+impl<P: JevProvider> FocusClassifier for JevFocusClassifier<P> {
+ async fn answer(
+ &self,
+ owner: &MacroUserIdStr<'static>,
+ thread_id: Uuid,
+ input: &Value,
+ questions: &[&'static str],
+ ) -> Result<Vec<f32>, FocusClassifierError> {
+ let questions = questions
+ .iter()
+ .map(|question| YesNoQuestion::try_from(*question))
+ .collect::<Result<Vec<_>, _>>()
+ .map_err(|error| {
+ tracing::error!(error = ?error, "invalid focus question");
+ FocusClassifierError::Rejected
+ })?;
+ let usage =
+ UsageContext::new(AiFeature::EmailFocus, owner.clone()).with_entity(Some(thread_id));
+ match self.classifier.classify(usage, input, &questions).await {
+ Ok(probabilities) => Ok(probabilities.into_iter().map(Probability::get).collect()),
+ Err(error) if error.is_transient() => Err(FocusClassifierError::Unavailable),
+ Err(_) => Err(FocusClassifierError::Rejected),
+ }
+ }
+
+ fn model(&self) -> &'static str {
+ MODEL
+ }
+}
diff --git a/services/email_focus_worker/src/outbound/memory_profile.rs b/services/email_focus_worker/src/outbound/memory_profile.rs
new file mode 100644
index 0000000000..73044083db
--- /dev/null
+++ b/services/email_focus_worker/src/outbound/memory_profile.rs
@@ -0,0 +1,29 @@
+//! The owner's stored Macro memory as Focus context.
+
+use email::domain::focus::ProfileSource;
+use macro_user_id::user_id::MacroUserIdStr;
+use memory::domain::MemoryRepo;
+use rootcause::Report;
+
+/// Reads the stored memory and never generates one: generation is a full
+/// agent run, and classifying mail must not start it.
+pub struct MemoryProfiles<R> {
+ repo: R,
+}
+
+impl<R> MemoryProfiles<R> {
+ /// Read memories from `repo`.
+ pub fn new(repo: R) -> Self {
+ Self { repo }
+ }
+}
+
+impl<R: MemoryRepo> ProfileSource for MemoryProfiles<R> {
+ async fn profile(&self, owner: &MacroUserIdStr<'static>) -> Result<Option<String>, Report> {
+ Ok(self
+ .repo
+ .get_latest_memory(owner.clone())
+ .await?
+ .map(|record| record.memory))
+ }
+}
diff --git a/static_assets/schema.graphql b/static_assets/schema.graphql
index 9f1d9d7168..b4851312d6 100644
--- a/static_assets/schema.graphql
+++ b/static_assets/schema.graphql
@@ -3927,6 +3927,44 @@ input GraphqlEmailFilterAst {
crmScope: GraphqlCrmScope
}
+"""
+Why a thread is in or out of Focus.
+"""
+enum GraphqlEmailFocusCategory {
+ """
+ A customer, client or user asking for help or giving feedback.
+ """
+ CUSTOMER
+ """
+ Mail from someone at the owner's own company.
+ """
+ TEAM
+ """
+ Mail from someone the owner corresponds with.
+ """
+ KNOWN
+ """
+ Relevant mail that fits no narrower category.
+ """
+ OTHER
+ """
+ A calendar invite, update or RSVP.
+ """
+ CALENDAR
+ """
+ Unsolicited outreach: a pitch, recruiting or a job application.
+ """
+ OUTREACH
+ """
+ Automated, bulk or templated mail.
+ """
+ AUTOMATED
+ """
+ Nothing marks the thread as relevant.
+ """
+ LOW_RELEVANCE
+}
+
"""
Enriched email link accessible to the authenticated user.
"""
@@ -4141,6 +4179,36 @@ enum GraphqlEmailSyncStatus {
INACTIVE
}
+"""
+The Focus classification of one email thread.
+"""
+type GraphqlEmailThreadFocus {
+ """
+ Whether the thread belongs in Focus.
+ """
+ isFocus: Boolean!
+ """
+ The Focus category, or why the thread was left out.
+ """
+ category: GraphqlEmailFocusCategory!
+ """
+ Sort key for the Focus list, 0 to 100.
+ """
+ importance: Int!
+ """
+ The latest message waits on the owner's answer.
+ """
+ needsReply: Boolean!
+ """
+ An open loop the owner should come back to.
+ """
+ needsFollowUp: Boolean!
+ """
+ When the classification was made, in RFC 3339 format.
+ """
+ classifiedAt: String!
+}
+
"""
GraphQL input representing the email value.
"""
@@ -8800,6 +8868,12 @@ type GraphqlSoupEmailThread implements GraphqlSoupEntity {
"""
reminderReturnedAt: String
"""
+ The thread's Focus classification: whether it belongs in Focus, why,
+ and how important it is. `null` until the thread is classified, and
+ for threads in inboxes the viewer does not own.
+ """
+ focus: GraphqlEmailThreadFocus
+ """
Timestamp of the latest outbound message, in RFC 3339 format: the SENT
view's sort key.
"""
@@ -9535,6 +9609,13 @@ type GraphqlUser {
"""
emailThread(input: EmailThreadInput!): GraphqlSoupEmailThread
"""
+ The viewer's Focus: signal threads in their own inboxes worth their
+ attention, highest priority first (importance, halved for every 2 days
+ since the latest inbound mail), with mail in the last `days` days
+ (default 30, at most 90). Each thread's `focus` field explains why.
+ """
+ emailFocus(days: Int): [GraphqlSoupEmailThread!]!
+ """
Fetch one accessible agent session by id, with its protocol log
reachable through `log`.
"""