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(call): import Granola meetings as calls automatically (#7722)

Eric Hayese381f026602d
diff --git a/.github/workspace-dep-closures.json b/.github/workspace-dep-closures.json
index d38205aa2f..b6d7902d52 100644
--- a/.github/workspace-dep-closures.json
+++ b/.github/workspace-dep-closures.json
@@ -5060,6 +5060,7 @@
"crates/github_pull_requests",
"crates/gmail_client",
"crates/google_token",
+ "crates/granola_sync",
"crates/harness_id",
"crates/harness_token",
"crates/image_generation",
@@ -7244,6 +7245,82 @@
"crates/remote_env_var",
"crates/workspace-hack"
],
+ "granola_sync": [
+ "crates/activity",
+ "crates/agent",
+ "crates/ai_toolset",
+ "crates/ai_usage",
+ "crates/attachment",
+ "crates/bot_id",
+ "crates/bot_token",
+ "crates/broadcast",
+ "crates/call",
+ "crates/channel_sender",
+ "crates/channels",
+ "crates/connection",
+ "crates/connection_gateway_client",
+ "crates/connection_gateway_models",
+ "crates/contacts",
+ "crates/cowlike",
+ "crates/database_env_vars",
+ "crates/document_sub_type",
+ "crates/entity_access",
+ "crates/entity_access_db_utils",
+ "crates/entity_mutation",
+ "crates/filter_ast",
+ "crates/frecency",
+ "crates/genai_telemetry",
+ "crates/granola_sync",
+ "crates/harness_id",
+ "crates/harness_token",
+ "crates/initiative",
+ "crates/invite_email",
+ "crates/ip_extractor",
+ "crates/item_filters",
+ "crates/kafka_util",
+ "crates/last_online_tracker",
+ "crates/macro_auth",
+ "crates/macro_authorization",
+ "crates/macro_aws_config",
+ "crates/macro_entrypoint",
+ "crates/macro_env",
+ "crates/macro_env_var",
+ "crates/macro_event_broker",
+ "crates/macro_event_topics",
+ "crates/macro_service_urls",
+ "crates/macro_tower_layers",
+ "crates/macro_user_id",
+ "crates/macro_uuid",
+ "crates/mcp_toolset",
+ "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_bulk_upload",
+ "crates/models_entity_access_management",
+ "crates/models_pagination",
+ "crates/models_permissions",
+ "crates/models_properties",
+ "crates/models_sfs",
+ "crates/non_empty",
+ "crates/notification",
+ "crates/notification_state",
+ "crates/pipedream_mcp",
+ "crates/prompt",
+ "crates/properties",
+ "crates/rate_limit",
+ "crates/remote_env_var",
+ "crates/share_permission_db_utils",
+ "crates/sqs_worker",
+ "crates/static_file_service_client",
+ "crates/system_properties",
+ "crates/workspace-hack"
+ ],
"graphql_activity": [
"crates/activity",
"crates/agent",
diff --git a/.sqlx/query-17472756d69dc95d7b01ac5ef8bab432a38de912d4f346e4827df8b2887462fa.json b/.sqlx/query-17472756d69dc95d7b01ac5ef8bab432a38de912d4f346e4827df8b2887462fa.json
new file mode 100644
index 0000000000..04dfd85da6
--- /dev/null
+++ b/.sqlx/query-17472756d69dc95d7b01ac5ef8bab432a38de912d4f346e4827df8b2887462fa.json
@@ -0,0 +1,151 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n WITH user_source_ids AS (\n SELECT cp.channel_id::text AS source_id\n FROM comms_channel_participants cp\n WHERE cp.user_id = $1 AND cp.left_at IS NULL\n UNION ALL\n SELECT t.team_id::text AS source_id\n FROM team_user t\n WHERE t.user_id = $1\n UNION ALL\n SELECT $1 AS source_id\n ),\n visible_calls AS (\n SELECT\n c.id AS call_id,\n c.channel_id,\n c.room_name,\n c.created_by,\n c.created_at AS started_at,\n NULL::timestamptz AS ended_at,\n NULL::bigint AS duration_ms,\n c.egress_id,\n c.recording_key,\n c.preview_url,\n c.recording_started_at,\n (SELECT title FROM call_meetings WHERE id = c.meeting_id) AS custom_name,\n NULL::text AS summary,\n c.share_with_team,\n sp.team_share_access_level,\n true AS is_active,\n false AS is_imported,\n CASE\n WHEN EXISTS (\n SELECT 1 FROM call_participants cp\n WHERE cp.call_id = c.id AND cp.user_id = $1\n ) THEN 'ATTENDED'::text\n WHEN EXISTS (\n SELECT 1 FROM comms_channel_participants ccp\n WHERE ccp.channel_id = c.channel_id\n AND ccp.user_id = $1\n AND ccp.left_at IS NULL\n ) THEN 'MISSED'::text\n ELSE 'UNATTENDED'::text\n END AS status\n FROM calls c\n JOIN \"SharePermission\" sp ON sp.id = c.share_permission_id\n WHERE EXISTS (\n SELECT 1 FROM entity_access ea\n JOIN user_source_ids u ON u.source_id = ea.source_id\n WHERE ea.entity_id = c.id\n AND ea.entity_type = 'call'\n AND (c.channel_id IS NOT NULL OR (ea.source_type = 'user' AND ea.source_id = $1))\n )\n AND ($3::bool IS FALSE OR c.channel_id = ANY($4))\n AND ($5::bool IS FALSE OR c.id = ANY($6))\n -- Property conditions in conjunctive normal form: every\n -- clause needs a term the call satisfies. Tags (no\n -- definition) match any property value; entity references\n -- match their definition's value.\n AND NOT EXISTS (\n SELECT 1\n FROM generate_series(0, $9::int - 1) AS clause(idx)\n WHERE NOT EXISTS (\n SELECT 1\n FROM UNNEST($10::int[], $11::bool[], $12::uuid[], $13::text[])\n AS term(clause_idx, negated, definition_id, value)\n WHERE term.clause_idx = clause.idx\n AND term.negated <> EXISTS (\n SELECT 1 FROM entity_properties ep\n WHERE ep.entity_id = c.id::text\n AND ep.entity_type = 'CALL_RECORD'\n AND jsonb_typeof(ep.values -> 'value') = 'array'\n AND CASE\n WHEN term.definition_id IS NULL\n THEN jsonb_exists(ep.values -> 'value', term.value)\n ELSE ep.property_definition_id = term.definition_id\n AND ep.values -> 'value' @> jsonb_build_array(\n jsonb_build_object('entity_id', term.value)\n )\n END\n )\n )\n )\n UNION ALL\n SELECT\n cr.id AS call_id,\n cr.channel_id,\n cr.room_name,\n cr.created_by,\n cr.started_at,\n cr.ended_at,\n cr.duration_ms,\n cr.egress_id,\n cr.recording_key,\n cr.preview_url,\n cr.recording_started_at,\n cr.custom_name,\n cr.summary,\n (sp.team_share_access_level IS NOT NULL) AS share_with_team,\n sp.team_share_access_level,\n false AS is_active,\n false AS is_imported,\n CASE\n WHEN EXISTS (\n SELECT 1 FROM call_record_participants crp\n WHERE crp.call_record_id = cr.id AND crp.user_id = $1\n ) THEN 'ATTENDED'::text\n WHEN EXISTS (\n SELECT 1 FROM comms_channel_participants ccp\n WHERE ccp.channel_id = cr.channel_id\n AND ccp.user_id = $1\n AND ccp.left_at IS NULL\n ) THEN 'MISSED'::text\n ELSE 'UNATTENDED'::text\n END AS status\n FROM call_records cr\n JOIN \"SharePermission\" sp ON sp.id = cr.share_permission_id\n WHERE EXISTS (\n SELECT 1 FROM entity_access ea\n JOIN user_source_ids u ON u.source_id = ea.source_id\n WHERE ea.entity_id = cr.id\n AND ea.entity_type = 'call'\n AND (cr.channel_id IS NOT NULL OR (ea.source_type = 'user' AND ea.source_id = $1))\n )\n AND ($3::bool IS FALSE OR cr.channel_id = ANY($4))\n AND ($5::bool IS FALSE OR cr.id = ANY($6))\n -- Property conditions in conjunctive normal form: every\n -- clause needs a term the call satisfies. Tags (no\n -- definition) match any property value; entity references\n -- match their definition's value.\n AND NOT EXISTS (\n SELECT 1\n FROM generate_series(0, $9::int - 1) AS clause(idx)\n WHERE NOT EXISTS (\n SELECT 1\n FROM UNNEST($10::int[], $11::bool[], $12::uuid[], $13::text[])\n AS term(clause_idx, negated, definition_id, value)\n WHERE term.clause_idx = clause.idx\n AND term.negated <> EXISTS (\n SELECT 1 FROM entity_properties ep\n WHERE ep.entity_id = cr.id::text\n AND ep.entity_type = 'CALL_RECORD'\n AND jsonb_typeof(ep.values -> 'value') = 'array'\n AND CASE\n WHEN term.definition_id IS NULL\n THEN jsonb_exists(ep.values -> 'value', term.value)\n ELSE ep.property_definition_id = term.definition_id\n AND ep.values -> 'value' @> jsonb_build_array(\n jsonb_build_object('entity_id', term.value)\n )\n END\n )\n )\n )\n UNION ALL\n -- Imported calls (e.g. Granola) exist only as call entities;\n -- native calls are mirrored there too, so exclude them.\n SELECT\n ce.id AS call_id,\n ce.channel_id,\n NULL::text AS room_name,\n ce.user_id AS created_by,\n COALESCE(ce.started_at, ce.created_at) AS started_at,\n ce.ended_at,\n ce.duration_ms,\n NULL::text AS egress_id,\n NULL::text AS recording_key,\n NULL::text AS preview_url,\n NULL::timestamptz AS recording_started_at,\n ce.title AS custom_name,\n (\n SELECT s.metadata ->> 'summary' FROM call_entity_sources s\n WHERE s.call_id = ce.id\n ORDER BY s.synced_at DESC NULLS LAST\n LIMIT 1\n ) AS summary,\n (sp.team_share_access_level IS NOT NULL) AS share_with_team,\n sp.team_share_access_level,\n false AS is_active,\n true AS is_imported,\n -- The importer was in the meeting; everyone else only\n -- sees it when shared, so it is not theirs to attend.\n CASE WHEN ce.user_id = $1 THEN 'ATTENDED'::text ELSE 'UNATTENDED'::text END AS status\n FROM call_entities ce\n JOIN \"SharePermission\" sp ON sp.id = ce.share_permission_id\n WHERE ce.created_via <> 'native'\n AND EXISTS (\n SELECT 1 FROM entity_access ea\n JOIN user_source_ids u ON u.source_id = ea.source_id\n WHERE ea.entity_id = ce.id\n AND ea.entity_type = 'call'\n AND (ce.channel_id IS NOT NULL OR (ea.source_type = 'user' AND ea.source_id = $1))\n )\n AND ($3::bool IS FALSE OR ce.channel_id = ANY($4))\n AND ($5::bool IS FALSE OR ce.id = ANY($6))\n AND NOT EXISTS (\n SELECT 1\n FROM generate_series(0, $9::int - 1) AS clause(idx)\n WHERE NOT EXISTS (\n SELECT 1\n FROM UNNEST($10::int[], $11::bool[], $12::uuid[], $13::text[])\n AS term(clause_idx, negated, definition_id, value)\n WHERE term.clause_idx = clause.idx\n AND term.negated <> EXISTS (\n SELECT 1 FROM entity_properties ep\n WHERE ep.entity_id = ce.id::text\n AND ep.entity_type = 'CALL_RECORD'\n AND jsonb_typeof(ep.values -> 'value') = 'array'\n AND CASE\n WHEN term.definition_id IS NULL\n THEN jsonb_exists(ep.values -> 'value', term.value)\n ELSE ep.property_definition_id = term.definition_id\n AND ep.values -> 'value' @> jsonb_build_array(\n jsonb_build_object('entity_id', term.value)\n )\n END\n )\n )\n )\n )\n SELECT\n call_id as \"call_id!\",\n channel_id as \"channel_id?\",\n room_name,\n created_by as \"created_by!\",\n started_at as \"started_at!\",\n ended_at,\n duration_ms,\n egress_id,\n recording_key,\n preview_url,\n recording_started_at,\n custom_name,\n summary,\n share_with_team as \"share_with_team!\",\n team_share_access_level as \"team_share_access_level?: AccessLevel\",\n is_active as \"is_active!\",\n is_imported as \"is_imported!\",\n status as \"status!\"\n FROM visible_calls\n WHERE ($7::bool IS FALSE OR status = ANY($8::text[]))\n -- Soup's keyset: calls sort by start, or by last activity.\n AND (\n $15::timestamptz IS NULL\n OR (\n CASE WHEN $14 THEN started_at ELSE COALESCE(ended_at, started_at) END,\n call_id::text\n ) < ($15, $16::text)\n )\n ORDER BY\n CASE WHEN $14 THEN started_at ELSE COALESCE(ended_at, started_at) END DESC,\n call_id::text DESC\n LIMIT $2\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "call_id!",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "channel_id?",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 2,
+ "name": "room_name",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "created_by!",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 4,
+ "name": "started_at!",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 5,
+ "name": "ended_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 6,
+ "name": "duration_ms",
+ "type_info": "Int8"
+ },
+ {
+ "ordinal": 7,
+ "name": "egress_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 8,
+ "name": "recording_key",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 9,
+ "name": "preview_url",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 10,
+ "name": "recording_started_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 11,
+ "name": "custom_name",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 12,
+ "name": "summary",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 13,
+ "name": "share_with_team!",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 14,
+ "name": "team_share_access_level?: AccessLevel",
+ "type_info": {
+ "Custom": {
+ "name": "\"AccessLevel\"",
+ "kind": {
+ "Enum": [
+ "view",
+ "comment",
+ "edit",
+ "owner"
+ ]
+ }
+ }
+ }
+ },
+ {
+ "ordinal": 15,
+ "name": "is_active!",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 16,
+ "name": "is_imported!",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 17,
+ "name": "status!",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Int8",
+ "Bool",
+ "UuidArray",
+ "Bool",
+ "UuidArray",
+ "Bool",
+ "TextArray",
+ "Int4",
+ "Int4Array",
+ "BoolArray",
+ "UuidArray",
+ "TextArray",
+ "Bool",
+ "Timestamptz",
+ "Text"
+ ]
+ },
+ "nullable": [
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null,
+ null
+ ]
+ },
+ "hash": "17472756d69dc95d7b01ac5ef8bab432a38de912d4f346e4827df8b2887462fa"
+}
diff --git a/.sqlx/query-199b167741e310350d5d355d0427d6cb83094182cf77fd9aaf78b7c3961fecb1.json b/.sqlx/query-199b167741e310350d5d355d0427d6cb83094182cf77fd9aaf78b7c3961fecb1.json
new file mode 100644
index 0000000000..34d98da558
--- /dev/null
+++ b/.sqlx/query-199b167741e310350d5d355d0427d6cb83094182cf77fd9aaf78b7c3961fecb1.json
@@ -0,0 +1,18 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE granola_sync_events SET completed_at = CASE WHEN $4 THEN now() ELSE NULL END,\n available_at = now() + make_interval(secs => $5::double precision), lease_id = NULL\n WHERE connection_id = $1 AND event_id = $2 AND lease_id = $3",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Uuid",
+ "Uuid",
+ "Bool",
+ "Float8"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "199b167741e310350d5d355d0427d6cb83094182cf77fd9aaf78b7c3961fecb1"
+}
diff --git a/.sqlx/query-1de43e6d6d7d68c1d7b5df8839afcac615c9c43b14d5853dd48f847ae24b25c0.json b/.sqlx/query-1de43e6d6d7d68c1d7b5df8839afcac615c9c43b14d5853dd48f847ae24b25c0.json
deleted file mode 100644
index 47afde9a82..0000000000
--- a/.sqlx/query-1de43e6d6d7d68c1d7b5df8839afcac615c9c43b14d5853dd48f847ae24b25c0.json
+++ /dev/null
@@ -1,145 +0,0 @@
-{
- "db_name": "PostgreSQL",
- "query": "\n WITH user_source_ids AS (\n SELECT cp.channel_id::text AS source_id\n FROM comms_channel_participants cp\n WHERE cp.user_id = $1 AND cp.left_at IS NULL\n UNION ALL\n SELECT t.team_id::text AS source_id\n FROM team_user t\n WHERE t.user_id = $1\n UNION ALL\n SELECT $1 AS source_id\n ),\n visible_calls AS (\n SELECT\n c.id AS call_id,\n c.channel_id,\n c.room_name,\n c.created_by,\n c.created_at AS started_at,\n NULL::timestamptz AS ended_at,\n NULL::bigint AS duration_ms,\n c.egress_id,\n c.recording_key,\n c.preview_url,\n c.recording_started_at,\n (SELECT title FROM call_meetings WHERE id = c.meeting_id) AS custom_name,\n NULL::text AS summary,\n c.share_with_team,\n sp.team_share_access_level,\n true AS is_active,\n CASE\n WHEN EXISTS (\n SELECT 1 FROM call_participants cp\n WHERE cp.call_id = c.id AND cp.user_id = $1\n ) THEN 'ATTENDED'::text\n WHEN EXISTS (\n SELECT 1 FROM comms_channel_participants ccp\n WHERE ccp.channel_id = c.channel_id\n AND ccp.user_id = $1\n AND ccp.left_at IS NULL\n ) THEN 'MISSED'::text\n ELSE 'UNATTENDED'::text\n END AS status\n FROM calls c\n JOIN \"SharePermission\" sp ON sp.id = c.share_permission_id\n WHERE EXISTS (\n SELECT 1 FROM entity_access ea\n JOIN user_source_ids u ON u.source_id = ea.source_id\n WHERE ea.entity_id = c.id\n AND ea.entity_type = 'call'\n AND (c.channel_id IS NOT NULL OR (ea.source_type = 'user' AND ea.source_id = $1))\n )\n AND ($3::bool IS FALSE OR c.channel_id = ANY($4))\n AND ($5::bool IS FALSE OR c.id = ANY($6))\n -- Property conditions in conjunctive normal form: every\n -- clause needs a term the call satisfies. Tags (no\n -- definition) match any property value; entity references\n -- match their definition's value.\n AND NOT EXISTS (\n SELECT 1\n FROM generate_series(0, $9::int - 1) AS clause(idx)\n WHERE NOT EXISTS (\n SELECT 1\n FROM UNNEST($10::int[], $11::bool[], $12::uuid[], $13::text[])\n AS term(clause_idx, negated, definition_id, value)\n WHERE term.clause_idx = clause.idx\n AND term.negated <> EXISTS (\n SELECT 1 FROM entity_properties ep\n WHERE ep.entity_id = c.id::text\n AND ep.entity_type = 'CALL_RECORD'\n AND jsonb_typeof(ep.values -> 'value') = 'array'\n AND CASE\n WHEN term.definition_id IS NULL\n THEN jsonb_exists(ep.values -> 'value', term.value)\n ELSE ep.property_definition_id = term.definition_id\n AND ep.values -> 'value' @> jsonb_build_array(\n jsonb_build_object('entity_id', term.value)\n )\n END\n )\n )\n )\n UNION ALL\n SELECT\n cr.id AS call_id,\n cr.channel_id,\n cr.room_name,\n cr.created_by,\n cr.started_at,\n cr.ended_at,\n cr.duration_ms,\n cr.egress_id,\n cr.recording_key,\n cr.preview_url,\n cr.recording_started_at,\n cr.custom_name,\n cr.summary,\n (sp.team_share_access_level IS NOT NULL) AS share_with_team,\n sp.team_share_access_level,\n false AS is_active,\n CASE\n WHEN EXISTS (\n SELECT 1 FROM call_record_participants crp\n WHERE crp.call_record_id = cr.id AND crp.user_id = $1\n ) THEN 'ATTENDED'::text\n WHEN EXISTS (\n SELECT 1 FROM comms_channel_participants ccp\n WHERE ccp.channel_id = cr.channel_id\n AND ccp.user_id = $1\n AND ccp.left_at IS NULL\n ) THEN 'MISSED'::text\n ELSE 'UNATTENDED'::text\n END AS status\n FROM call_records cr\n JOIN \"SharePermission\" sp ON sp.id = cr.share_permission_id\n WHERE EXISTS (\n SELECT 1 FROM entity_access ea\n JOIN user_source_ids u ON u.source_id = ea.source_id\n WHERE ea.entity_id = cr.id\n AND ea.entity_type = 'call'\n AND (cr.channel_id IS NOT NULL OR (ea.source_type = 'user' AND ea.source_id = $1))\n )\n AND ($3::bool IS FALSE OR cr.channel_id = ANY($4))\n AND ($5::bool IS FALSE OR cr.id = ANY($6))\n -- Property conditions in conjunctive normal form: every\n -- clause needs a term the call satisfies. Tags (no\n -- definition) match any property value; entity references\n -- match their definition's value.\n AND NOT EXISTS (\n SELECT 1\n FROM generate_series(0, $9::int - 1) AS clause(idx)\n WHERE NOT EXISTS (\n SELECT 1\n FROM UNNEST($10::int[], $11::bool[], $12::uuid[], $13::text[])\n AS term(clause_idx, negated, definition_id, value)\n WHERE term.clause_idx = clause.idx\n AND term.negated <> EXISTS (\n SELECT 1 FROM entity_properties ep\n WHERE ep.entity_id = cr.id::text\n AND ep.entity_type = 'CALL_RECORD'\n AND jsonb_typeof(ep.values -> 'value') = 'array'\n AND CASE\n WHEN term.definition_id IS NULL\n THEN jsonb_exists(ep.values -> 'value', term.value)\n ELSE ep.property_definition_id = term.definition_id\n AND ep.values -> 'value' @> jsonb_build_array(\n jsonb_build_object('entity_id', term.value)\n )\n END\n )\n )\n )\n )\n SELECT\n call_id as \"call_id!\",\n channel_id as \"channel_id?\",\n room_name as \"room_name!\",\n created_by as \"created_by!\",\n started_at as \"started_at!\",\n ended_at,\n duration_ms,\n egress_id,\n recording_key,\n preview_url,\n recording_started_at,\n custom_name,\n summary,\n share_with_team as \"share_with_team!\",\n team_share_access_level as \"team_share_access_level?: AccessLevel\",\n is_active as \"is_active!\",\n status as \"status!\"\n FROM visible_calls\n WHERE ($7::bool IS FALSE OR status = ANY($8::text[]))\n -- Soup's keyset: calls sort by start, or by last activity.\n AND (\n $15::timestamptz IS NULL\n OR (\n CASE WHEN $14 THEN started_at ELSE COALESCE(ended_at, started_at) END,\n call_id::text\n ) < ($15, $16::text)\n )\n ORDER BY\n CASE WHEN $14 THEN started_at ELSE COALESCE(ended_at, started_at) END DESC,\n call_id::text DESC\n LIMIT $2\n ",
- "describe": {
- "columns": [
- {
- "ordinal": 0,
- "name": "call_id!",
- "type_info": "Uuid"
- },
- {
- "ordinal": 1,
- "name": "channel_id?",
- "type_info": "Uuid"
- },
- {
- "ordinal": 2,
- "name": "room_name!",
- "type_info": "Text"
- },
- {
- "ordinal": 3,
- "name": "created_by!",
- "type_info": "Text"
- },
- {
- "ordinal": 4,
- "name": "started_at!",
- "type_info": "Timestamptz"
- },
- {
- "ordinal": 5,
- "name": "ended_at",
- "type_info": "Timestamptz"
- },
- {
- "ordinal": 6,
- "name": "duration_ms",
- "type_info": "Int8"
- },
- {
- "ordinal": 7,
- "name": "egress_id",
- "type_info": "Text"
- },
- {
- "ordinal": 8,
- "name": "recording_key",
- "type_info": "Text"
- },
- {
- "ordinal": 9,
- "name": "preview_url",
- "type_info": "Text"
- },
- {
- "ordinal": 10,
- "name": "recording_started_at",
- "type_info": "Timestamptz"
- },
- {
- "ordinal": 11,
- "name": "custom_name",
- "type_info": "Text"
- },
- {
- "ordinal": 12,
- "name": "summary",
- "type_info": "Text"
- },
- {
- "ordinal": 13,
- "name": "share_with_team!",
- "type_info": "Bool"
- },
- {
- "ordinal": 14,
- "name": "team_share_access_level?: AccessLevel",
- "type_info": {
- "Custom": {
- "name": "\"AccessLevel\"",
- "kind": {
- "Enum": [
- "view",
- "comment",
- "edit",
- "owner"
- ]
- }
- }
- }
- },
- {
- "ordinal": 15,
- "name": "is_active!",
- "type_info": "Bool"
- },
- {
- "ordinal": 16,
- "name": "status!",
- "type_info": "Text"
- }
- ],
- "parameters": {
- "Left": [
- "Text",
- "Int8",
- "Bool",
- "UuidArray",
- "Bool",
- "UuidArray",
- "Bool",
- "TextArray",
- "Int4",
- "Int4Array",
- "BoolArray",
- "UuidArray",
- "TextArray",
- "Bool",
- "Timestamptz",
- "Text"
- ]
- },
- "nullable": [
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null,
- null
- ]
- },
- "hash": "1de43e6d6d7d68c1d7b5df8839afcac615c9c43b14d5853dd48f847ae24b25c0"
-}
diff --git a/.sqlx/query-1e062d941073a48e2367624d929bcaca576834994e1e346a913d386818c94482.json b/.sqlx/query-1e062d941073a48e2367624d929bcaca576834994e1e346a913d386818c94482.json
new file mode 100644
index 0000000000..9ac6fa12d6
--- /dev/null
+++ b/.sqlx/query-1e062d941073a48e2367624d929bcaca576834994e1e346a913d386818c94482.json
@@ -0,0 +1,27 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO granola_sync_connections (id, user_id, account_id, scope, started_at, namespace)\n VALUES ($1, $2, $3, $4, $5, $6)\n ON CONFLICT (user_id) DO UPDATE SET id = EXCLUDED.id, account_id = EXCLUDED.account_id,\n scope = EXCLUDED.scope, started_at = EXCLUDED.started_at, enabled = false,\n endpoint_id = NULL, signing_secret = NULL, last_error = NULL, last_synced_at = NULL\n WHERE granola_sync_connections.endpoint_id IS NOT NULL\n OR granola_sync_connections.last_error IS NOT NULL\n OR granola_sync_connections.started_at < now() - interval '2 minutes'\n RETURNING id",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Text",
+ "Text",
+ "Text",
+ "Timestamptz",
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "1e062d941073a48e2367624d929bcaca576834994e1e346a913d386818c94482"
+}
diff --git a/.sqlx/query-2fb33e7c5ea0c0180c66501665c136ef08972806a9b8d29549f49e00d6f666b3.json b/.sqlx/query-2fb33e7c5ea0c0180c66501665c136ef08972806a9b8d29549f49e00d6f666b3.json
new file mode 100644
index 0000000000..69de07bf3d
--- /dev/null
+++ b/.sqlx/query-2fb33e7c5ea0c0180c66501665c136ef08972806a9b8d29549f49e00d6f666b3.json
@@ -0,0 +1,23 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT jsonb_build_object(\n 'entity', jsonb_build_object(\n 'id', c.id, 'userId', c.user_id, 'title', c.title, 'createdVia', c.created_via,\n 'startedAt', c.started_at, 'endedAt', c.ended_at, 'durationMs', c.duration_ms,\n 'channelId', c.channel_id, 'meetingId', c.meeting_id,\n 'createdAt', c.created_at, 'updatedAt', c.updated_at\n ),\n 'sources', COALESCE((\n SELECT jsonb_agg(jsonb_build_object(\n 'userId', s.user_id, 'namespace', s.namespace, 'provider', s.provider,\n 'objectType', s.object_type, 'externalId', s.external_id, 'externalUrl', s.external_url,\n 'externalUpdatedAt', s.external_updated_at, 'syncedAt', s.synced_at,\n 'metadata', s.metadata - 'participantIds' - 'transcriptId'\n )) FROM call_entity_sources s WHERE s.call_id = c.id\n ), '[]'::jsonb),\n 'participants', COALESCE((\n SELECT jsonb_agg(jsonb_build_object(\n 'id', p.id, 'userId', p.user_id, 'displayName', p.display_name,\n 'email', p.email, 'phone', p.phone, 'externalId', p.external_id,\n 'attendance', COALESCE((SELECT jsonb_agg(jsonb_build_object(\n 'id', a.id, 'joinedAt', a.joined_at, 'leftAt', a.left_at\n ) ORDER BY a.id) FROM call_entity_attendance a\n WHERE a.call_id = p.call_id AND a.participant_id = p.id), '[]'::jsonb)\n ) ORDER BY p.id) FROM call_entity_participants p WHERE p.call_id = c.id\n ), '[]'::jsonb),\n 'recordings', COALESCE((SELECT jsonb_agg(jsonb_build_object(\n 'id', r.id, 'mediaType', r.media_type,\n 'location', jsonb_build_object(\n 'kind', CASE WHEN r.storage_key IS NOT NULL THEN 'storage_key' ELSE 'external_url' END,\n 'value', COALESCE(r.storage_key, r.external_url)),\n 'mimeType', r.mime_type, 'durationMs', r.duration_ms, 'startedAt', r.started_at\n ) ORDER BY r.id) FROM call_entity_recordings r WHERE r.call_id = c.id), '[]'::jsonb),\n 'transcripts', COALESCE((\n SELECT jsonb_agg(jsonb_build_object(\n 'id', t.id, 'recordingId', t.recording_id, 'language', t.language,\n 'provider', t.provider, 'startedAt', t.started_at,\n 'segments', COALESCE((\n SELECT jsonb_agg(jsonb_build_object(\n 'sequenceNum', s.sequence_num, 'participantId', s.participant_id,\n 'speakerLabel', s.speaker_label, 'content', s.content,\n 'startMs', s.start_ms, 'endMs', s.end_ms\n ) ORDER BY s.sequence_num) FROM call_entity_transcript_segments s\n WHERE s.call_id = t.call_id AND s.transcript_id = t.id\n ), '[]'::jsonb)\n ) ORDER BY t.id) FROM call_entity_transcripts t WHERE t.call_id = c.id\n ), '[]'::jsonb)\n) AS \"record!\"\nFROM call_entities c\nWHERE c.user_id = $1 AND c.id = $2 AND c.created_via = 'import';\n",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "record!",
+ "type_info": "Jsonb"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ null
+ ]
+ },
+ "hash": "2fb33e7c5ea0c0180c66501665c136ef08972806a9b8d29549f49e00d6f666b3"
+}
diff --git a/.sqlx/query-3f4b6b5d5df79dc0fa278ebd367135b162479c7ab33b4f93fdab25060c2494e4.json b/.sqlx/query-3f4b6b5d5df79dc0fa278ebd367135b162479c7ab33b4f93fdab25060c2494e4.json
new file mode 100644
index 0000000000..bbd1fa7820
--- /dev/null
+++ b/.sqlx/query-3f4b6b5d5df79dc0fa278ebd367135b162479c7ab33b4f93fdab25060c2494e4.json
@@ -0,0 +1,52 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT p.call_id, p.id, p.display_name, p.email,\n COALESCE(ce.started_at, ce.created_at) AS \"joined_at!\",\n ce.ended_at\n FROM call_entity_participants p\n JOIN call_entities ce ON ce.id = p.call_id\n WHERE p.call_id = ANY($1)\n ORDER BY p.call_id, p.id\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "call_id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 2,
+ "name": "display_name",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "email",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 4,
+ "name": "joined_at!",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 5,
+ "name": "ended_at",
+ "type_info": "Timestamptz"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "UuidArray"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ true,
+ true,
+ null,
+ true
+ ]
+ },
+ "hash": "3f4b6b5d5df79dc0fa278ebd367135b162479c7ab33b4f93fdab25060c2494e4"
+}
diff --git a/.sqlx/query-46162692d2bd5fdd518fd06768d1d34be2182984c0220944283cf579dbd36149.json b/.sqlx/query-46162692d2bd5fdd518fd06768d1d34be2182984c0220944283cf579dbd36149.json
new file mode 100644
index 0000000000..b294d824d4
--- /dev/null
+++ b/.sqlx/query-46162692d2bd5fdd518fd06768d1d34be2182984c0220944283cf579dbd36149.json
@@ -0,0 +1,14 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO \"SharePermission\" (id, \"linkShare\", \"linkShareAccessLevel\") VALUES ($1, NULL, NULL)",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "46162692d2bd5fdd518fd06768d1d34be2182984c0220944283cf579dbd36149"
+}
diff --git a/.sqlx/query-4740614a7dff0dd72b27ae6344fd5595035fdcb819d6dd7edcb57f080f331ecc.json b/.sqlx/query-4740614a7dff0dd72b27ae6344fd5595035fdcb819d6dd7edcb57f080f331ecc.json
new file mode 100644
index 0000000000..cc956cd99b
--- /dev/null
+++ b/.sqlx/query-4740614a7dff0dd72b27ae6344fd5595035fdcb819d6dd7edcb57f080f331ecc.json
@@ -0,0 +1,18 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO granola_sync_events (connection_id, event_id, note_id, event_type, occurred_at)\n SELECT id, $2, $3, $4, $5 FROM granola_sync_connections WHERE id = $1 AND enabled\n ON CONFLICT (connection_id, event_id) DO NOTHING",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Uuid",
+ "Text",
+ "Text",
+ "Timestamptz"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "4740614a7dff0dd72b27ae6344fd5595035fdcb819d6dd7edcb57f080f331ecc"
+}
diff --git a/.sqlx/query-4aa79f5eb0bfd69f15078716e18668a27ae86ff0f1ddbdf281f83e0f948ff1c4.json b/.sqlx/query-4aa79f5eb0bfd69f15078716e18668a27ae86ff0f1ddbdf281f83e0f948ff1c4.json
new file mode 100644
index 0000000000..403520f886
--- /dev/null
+++ b/.sqlx/query-4aa79f5eb0bfd69f15078716e18668a27ae86ff0f1ddbdf281f83e0f948ff1c4.json
@@ -0,0 +1,16 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "DELETE FROM call_entity_participants WHERE call_id = $1 AND id = ANY($2) AND NOT (id = ANY($3))",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "UuidArray",
+ "UuidArray"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "4aa79f5eb0bfd69f15078716e18668a27ae86ff0f1ddbdf281f83e0f948ff1c4"
+}
diff --git a/.sqlx/query-4e5b8b4b3e7584678ce2bdb2d912b35a42f5c2bd395d39651e2f17fbf75f8540.json b/.sqlx/query-4e5b8b4b3e7584678ce2bdb2d912b35a42f5c2bd395d39651e2f17fbf75f8540.json
new file mode 100644
index 0000000000..9069692949
--- /dev/null
+++ b/.sqlx/query-4e5b8b4b3e7584678ce2bdb2d912b35a42f5c2bd395d39651e2f17fbf75f8540.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE granola_sync_connections SET enabled = false, last_error = $2 WHERE id = $1",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "4e5b8b4b3e7584678ce2bdb2d912b35a42f5c2bd395d39651e2f17fbf75f8540"
+}
diff --git a/.sqlx/query-4ec12f89432479fa3efe7f582cf61c15f3db9ab8c9f97d0f44cbca421c12f053.json b/.sqlx/query-4ec12f89432479fa3efe7f582cf61c15f3db9ab8c9f97d0f44cbca421c12f053.json
new file mode 100644
index 0000000000..0e94d1ec0d
--- /dev/null
+++ b/.sqlx/query-4ec12f89432479fa3efe7f582cf61c15f3db9ab8c9f97d0f44cbca421c12f053.json
@@ -0,0 +1,64 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT s.transcript_id, s.sequence_num, s.participant_id, s.speaker_label, s.content,\n s.start_ms, s.end_ms, t.started_at AS transcript_started_at\n FROM call_entity_transcript_segments s\n JOIN call_entity_transcripts t ON t.call_id = s.call_id AND t.id = s.transcript_id\n WHERE s.call_id = $1\n ORDER BY t.started_at NULLS LAST, t.id, s.sequence_num\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "transcript_id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "sequence_num",
+ "type_info": "Int4"
+ },
+ {
+ "ordinal": 2,
+ "name": "participant_id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 3,
+ "name": "speaker_label",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 4,
+ "name": "content",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 5,
+ "name": "start_ms",
+ "type_info": "Int8"
+ },
+ {
+ "ordinal": 6,
+ "name": "end_ms",
+ "type_info": "Int8"
+ },
+ {
+ "ordinal": 7,
+ "name": "transcript_started_at",
+ "type_info": "Timestamptz"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ true,
+ true,
+ false,
+ true,
+ true,
+ true
+ ]
+ },
+ "hash": "4ec12f89432479fa3efe7f582cf61c15f3db9ab8c9f97d0f44cbca421c12f053"
+}
diff --git a/.sqlx/query-5c495861547a41d7acc03142f578757555e2ee4000edd433a77a0139fce32566.json b/.sqlx/query-5c495861547a41d7acc03142f578757555e2ee4000edd433a77a0139fce32566.json
new file mode 100644
index 0000000000..f299276e8f
--- /dev/null
+++ b/.sqlx/query-5c495861547a41d7acc03142f578757555e2ee4000edd433a77a0139fce32566.json
@@ -0,0 +1,20 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO call_entities (id, user_id, title, created_via, started_at, ended_at, duration_ms, share_permission_id)\n VALUES ($1,$2,$3,'import',$4,$5,$6,$7)",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Text",
+ "Text",
+ "Timestamptz",
+ "Timestamptz",
+ "Int8",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "5c495861547a41d7acc03142f578757555e2ee4000edd433a77a0139fce32566"
+}
diff --git a/.sqlx/query-60ea1b62ce55f7f6d7f75e5cf67a5abd8011f10976becc4b68611b648c3d3d95.json b/.sqlx/query-60ea1b62ce55f7f6d7f75e5cf67a5abd8011f10976becc4b68611b648c3d3d95.json
new file mode 100644
index 0000000000..47fb1c0695
--- /dev/null
+++ b/.sqlx/query-60ea1b62ce55f7f6d7f75e5cf67a5abd8011f10976becc4b68611b648c3d3d95.json
@@ -0,0 +1,29 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT id, email FROM call_entity_participants WHERE call_id = $1 AND id = ANY($2)",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "email",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "UuidArray"
+ ]
+ },
+ "nullable": [
+ false,
+ true
+ ]
+ },
+ "hash": "60ea1b62ce55f7f6d7f75e5cf67a5abd8011f10976becc4b68611b648c3d3d95"
+}
diff --git a/.sqlx/query-682c4ee7160f7f9a29f20a82f96e7bab28c140bd2c03618e1c45f4d00fcc369c.json b/.sqlx/query-682c4ee7160f7f9a29f20a82f96e7bab28c140bd2c03618e1c45f4d00fcc369c.json
new file mode 100644
index 0000000000..4d63946933
--- /dev/null
+++ b/.sqlx/query-682c4ee7160f7f9a29f20a82f96e7bab28c140bd2c03618e1c45f4d00fcc369c.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE granola_sync_connections\n SET last_synced_at = CASE WHEN $2 THEN now() ELSE last_synced_at END,\n last_error = CASE WHEN $2 THEN NULL ELSE 'Meeting sync failed; retrying automatically' END\n WHERE id = $1 AND enabled",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Bool"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "682c4ee7160f7f9a29f20a82f96e7bab28c140bd2c03618e1c45f4d00fcc369c"
+}
diff --git a/.sqlx/query-69a2e59ff0365f0497c71434b6fc690a9e2812f8f1a4ffaaea0fd982c7289c0f.json b/.sqlx/query-69a2e59ff0365f0497c71434b6fc690a9e2812f8f1a4ffaaea0fd982c7289c0f.json
new file mode 100644
index 0000000000..18c7bf7899
--- /dev/null
+++ b/.sqlx/query-69a2e59ff0365f0497c71434b6fc690a9e2812f8f1a4ffaaea0fd982c7289c0f.json
@@ -0,0 +1,14 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "DELETE FROM granola_sync_events WHERE connection_id = $1",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "69a2e59ff0365f0497c71434b6fc690a9e2812f8f1a4ffaaea0fd982c7289c0f"
+}
diff --git a/.sqlx/query-6a0913c72b34930cb3389acf26069f959a4ad577770dd75661765d948ef744c5.json b/.sqlx/query-6a0913c72b34930cb3389acf26069f959a4ad577770dd75661765d948ef744c5.json
new file mode 100644
index 0000000000..5a5cf8aeb7
--- /dev/null
+++ b/.sqlx/query-6a0913c72b34930cb3389acf26069f959a4ad577770dd75661765d948ef744c5.json
@@ -0,0 +1,46 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT user_id, app_slug, server_name, account_id, enabled\n FROM pipedream_mcp_connections\n WHERE app_slug = $1 AND enabled\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "user_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 1,
+ "name": "app_slug",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 2,
+ "name": "server_name",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "account_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 4,
+ "name": "enabled",
+ "type_info": "Bool"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ false
+ ]
+ },
+ "hash": "6a0913c72b34930cb3389acf26069f959a4ad577770dd75661765d948ef744c5"
+}
diff --git a/.sqlx/query-83cdfd94501e64feb0e881bee5922ffd22106e171083383e52f10e5c64bf8f79.json b/.sqlx/query-83cdfd94501e64feb0e881bee5922ffd22106e171083383e52f10e5c64bf8f79.json
new file mode 100644
index 0000000000..06d1029909
--- /dev/null
+++ b/.sqlx/query-83cdfd94501e64feb0e881bee5922ffd22106e171083383e52f10e5c64bf8f79.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO call_entity_sources (call_id,user_id,namespace,provider,object_type,external_id,external_url,external_updated_at,synced_at,metadata)\n VALUES ($1,$2,$3,$4,$5,$6,$7,$8,now(),$9)\n ON CONFLICT (user_id,namespace,provider,object_type,external_id) DO UPDATE SET\n external_url = EXCLUDED.external_url, external_updated_at = EXCLUDED.external_updated_at,\n synced_at = now(), metadata = EXCLUDED.metadata",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Text",
+ "Text",
+ "Text",
+ "Text",
+ "Text",
+ "Text",
+ "Timestamptz",
+ "Jsonb"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "83cdfd94501e64feb0e881bee5922ffd22106e171083383e52f10e5c64bf8f79"
+}
diff --git a/.sqlx/query-8dce485472a74aaec7833de1233ac3c5ee8cf0adbc70435370fb8975d26b5d6d.json b/.sqlx/query-8dce485472a74aaec7833de1233ac3c5ee8cf0adbc70435370fb8975d26b5d6d.json
new file mode 100644
index 0000000000..483f89497a
--- /dev/null
+++ b/.sqlx/query-8dce485472a74aaec7833de1233ac3c5ee8cf0adbc70435370fb8975d26b5d6d.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "DELETE FROM call_entity_transcripts WHERE call_id = $1 AND id = $2",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Uuid"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "8dce485472a74aaec7833de1233ac3c5ee8cf0adbc70435370fb8975d26b5d6d"
+}
diff --git a/.sqlx/query-936d32718eb498ad6a673d123c1db27a932b767dd807aa5306547acca01251c6.json b/.sqlx/query-936d32718eb498ad6a673d123c1db27a932b767dd807aa5306547acca01251c6.json
new file mode 100644
index 0000000000..ea949fb6d1
--- /dev/null
+++ b/.sqlx/query-936d32718eb498ad6a673d123c1db27a932b767dd807aa5306547acca01251c6.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO call_entity_participants (call_id, id, display_name, email)\n SELECT $1, id, \"displayName\", email FROM jsonb_to_recordset($2::jsonb)\n AS p(id uuid, \"displayName\" text, email text)\n ON CONFLICT (call_id, id) DO UPDATE SET display_name = EXCLUDED.display_name, email = EXCLUDED.email",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Jsonb"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "936d32718eb498ad6a673d123c1db27a932b767dd807aa5306547acca01251c6"
+}
diff --git a/.sqlx/query-953f1ece49e119bf551b43da504dab7bd2d764a790d473eca86353c3027b0c17.json b/.sqlx/query-953f1ece49e119bf551b43da504dab7bd2d764a790d473eca86353c3027b0c17.json
new file mode 100644
index 0000000000..f0288469db
--- /dev/null
+++ b/.sqlx/query-953f1ece49e119bf551b43da504dab7bd2d764a790d473eca86353c3027b0c17.json
@@ -0,0 +1,38 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT call_id, external_updated_at, metadata FROM call_entity_sources\n WHERE user_id = $1 AND namespace = $2 AND provider = $3 AND object_type = $4 AND external_id = $5",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "call_id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "external_updated_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 2,
+ "name": "metadata",
+ "type_info": "Jsonb"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text",
+ "Text",
+ "Text",
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ true,
+ false
+ ]
+ },
+ "hash": "953f1ece49e119bf551b43da504dab7bd2d764a790d473eca86353c3027b0c17"
+}
diff --git a/.sqlx/query-9a5025e08ccfbb03e7d69f28e54e1a42be1f9b1393dd3bc5ca551ddfc6aa6bc0.json b/.sqlx/query-9a5025e08ccfbb03e7d69f28e54e1a42be1f9b1393dd3bc5ca551ddfc6aa6bc0.json
new file mode 100644
index 0000000000..2fd51bb0df
--- /dev/null
+++ b/.sqlx/query-9a5025e08ccfbb03e7d69f28e54e1a42be1f9b1393dd3bc5ca551ddfc6aa6bc0.json
@@ -0,0 +1,20 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE call_entities SET title = CASE WHEN title IS NOT DISTINCT FROM $7 THEN $2 ELSE title END,\n started_at = $3, ended_at = $4, duration_ms = $5, updated_at = now()\n WHERE id = $1 AND user_id = $6",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Text",
+ "Timestamptz",
+ "Timestamptz",
+ "Int8",
+ "Text",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "9a5025e08ccfbb03e7d69f28e54e1a42be1f9b1393dd3bc5ca551ddfc6aa6bc0"
+}
diff --git a/.sqlx/query-9ae7123249fe08e53a8d9c42ba1275d2f536c34ed68680429d6fd1b5cab745d5.json b/.sqlx/query-9ae7123249fe08e53a8d9c42ba1275d2f536c34ed68680429d6fd1b5cab745d5.json
new file mode 100644
index 0000000000..1d51c13a71
--- /dev/null
+++ b/.sqlx/query-9ae7123249fe08e53a8d9c42ba1275d2f536c34ed68680429d6fd1b5cab745d5.json
@@ -0,0 +1,17 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO call_entity_transcripts (call_id,id,provider,started_at)\n VALUES ($1,$2,$3,$4) ON CONFLICT (call_id,id) DO UPDATE SET started_at = EXCLUDED.started_at",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Uuid",
+ "Text",
+ "Timestamptz"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "9ae7123249fe08e53a8d9c42ba1275d2f536c34ed68680429d6fd1b5cab745d5"
+}
diff --git a/.sqlx/query-a19df938ace9d80b9e679c2f455b21bca7d38f04c8348339f4ef531f1c434ff6.json b/.sqlx/query-a19df938ace9d80b9e679c2f455b21bca7d38f04c8348339f4ef531f1c434ff6.json
new file mode 100644
index 0000000000..d25a4f9749
--- /dev/null
+++ b/.sqlx/query-a19df938ace9d80b9e679c2f455b21bca7d38f04c8348339f4ef531f1c434ff6.json
@@ -0,0 +1,16 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "INSERT INTO call_entity_transcript_segments (call_id,transcript_id,sequence_num,speaker_label,content,start_ms,end_ms)\n SELECT $1,$2,\"sequenceNum\",\"speakerLabel\",content,\"startMs\",\"endMs\"\n FROM jsonb_to_recordset($3::jsonb) AS s(\"sequenceNum\" integer,\"speakerLabel\" text,content text,\"startMs\" bigint,\"endMs\" bigint)",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Uuid",
+ "Jsonb"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "a19df938ace9d80b9e679c2f455b21bca7d38f04c8348339f4ef531f1c434ff6"
+}
diff --git a/.sqlx/query-a42fdcf3527f593ba141955607cb371a4cb001ea6b5443f9b1ebb11d709e7f2a.json b/.sqlx/query-a42fdcf3527f593ba141955607cb371a4cb001ea6b5443f9b1ebb11d709e7f2a.json
new file mode 100644
index 0000000000..9786cf2685
--- /dev/null
+++ b/.sqlx/query-a42fdcf3527f593ba141955607cb371a4cb001ea6b5443f9b1ebb11d709e7f2a.json
@@ -0,0 +1,17 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE granola_sync_connections SET enabled = true, endpoint_id = $2, signing_secret = $3, scope = $4\n WHERE id = $1 AND last_error IS NULL AND endpoint_id IS NULL",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Text",
+ "Bytea",
+ "Text"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "a42fdcf3527f593ba141955607cb371a4cb001ea6b5443f9b1ebb11d709e7f2a"
+}
diff --git a/.sqlx/query-aa6f45c23a13b1438b52edfc96a524483a83e5100152962e9a0f4e5ee59098d1.json b/.sqlx/query-aa6f45c23a13b1438b52edfc96a524483a83e5100152962e9a0f4e5ee59098d1.json
new file mode 100644
index 0000000000..58dfb1737c
--- /dev/null
+++ b/.sqlx/query-aa6f45c23a13b1438b52edfc96a524483a83e5100152962e9a0f4e5ee59098d1.json
@@ -0,0 +1,52 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "WITH candidate AS (\n SELECT e.connection_id, e.event_id FROM granola_sync_events e\n JOIN granola_sync_connections c ON c.id = e.connection_id\n WHERE e.completed_at IS NULL AND e.available_at <= now() AND c.enabled\n ORDER BY e.available_at LIMIT 1 FOR UPDATE OF e SKIP LOCKED\n )\n UPDATE granola_sync_events e SET lease_id = $1, attempts = e.attempts + 1,\n available_at = now() + interval '10 minutes'\n FROM candidate c WHERE e.connection_id = c.connection_id AND e.event_id = c.event_id\n RETURNING e.connection_id, e.event_id, e.note_id, e.event_type, e.occurred_at, e.attempts",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "connection_id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "event_id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 2,
+ "name": "note_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "event_type",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 4,
+ "name": "occurred_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 5,
+ "name": "attempts",
+ "type_info": "Int4"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ false,
+ false
+ ]
+ },
+ "hash": "aa6f45c23a13b1438b52edfc96a524483a83e5100152962e9a0f4e5ee59098d1"
+}
diff --git a/.sqlx/query-b10e8569b37872959f2e84115644b6e59f77feb057fe99b6026abb8f801afed9.json b/.sqlx/query-b10e8569b37872959f2e84115644b6e59f77feb057fe99b6026abb8f801afed9.json
new file mode 100644
index 0000000000..aae0e165ee
--- /dev/null
+++ b/.sqlx/query-b10e8569b37872959f2e84115644b6e59f77feb057fe99b6026abb8f801afed9.json
@@ -0,0 +1,94 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "\n SELECT ce.id, ce.user_id, ce.title, ce.started_at, ce.ended_at, ce.duration_ms, ce.created_at,\n sp.team_share_access_level AS \"team_share_access_level?: AccessLevel\",\n src.provider AS \"provider?\", src.external_url, src.metadata ->> 'summary' AS summary\n FROM call_entities ce\n JOIN \"SharePermission\" sp ON sp.id = ce.share_permission_id\n LEFT JOIN LATERAL (\n SELECT provider, external_url, metadata\n FROM call_entity_sources\n WHERE call_id = ce.id\n ORDER BY synced_at DESC NULLS LAST\n LIMIT 1\n ) src ON true\n WHERE ce.id = $1 AND ce.created_via <> 'native'\n ",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "user_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 2,
+ "name": "title",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "started_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 4,
+ "name": "ended_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 5,
+ "name": "duration_ms",
+ "type_info": "Int8"
+ },
+ {
+ "ordinal": 6,
+ "name": "created_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 7,
+ "name": "team_share_access_level?: AccessLevel",
+ "type_info": {
+ "Custom": {
+ "name": "\"AccessLevel\"",
+ "kind": {
+ "Enum": [
+ "view",
+ "comment",
+ "edit",
+ "owner"
+ ]
+ }
+ }
+ }
+ },
+ {
+ "ordinal": 8,
+ "name": "provider?",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 9,
+ "name": "external_url",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 10,
+ "name": "summary",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ true,
+ true,
+ true,
+ true,
+ false,
+ true,
+ false,
+ true,
+ null
+ ]
+ },
+ "hash": "b10e8569b37872959f2e84115644b6e59f77feb057fe99b6026abb8f801afed9"
+}
diff --git a/.sqlx/query-b7f0cc8d093133220b6f0c09d7e9e8055b31b173b71c4b9ecc05f3c971eebe59.json b/.sqlx/query-b7f0cc8d093133220b6f0c09d7e9e8055b31b173b71c4b9ecc05f3c971eebe59.json
new file mode 100644
index 0000000000..f3bb74ca74
--- /dev/null
+++ b/.sqlx/query-b7f0cc8d093133220b6f0c09d7e9e8055b31b173b71c4b9ecc05f3c971eebe59.json
@@ -0,0 +1,62 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT id, user_id, account_id, scope, enabled, endpoint_id IS NOT NULL AS \"has_endpoint!\",\n started_at, last_error\n FROM granola_sync_connections",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "user_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 2,
+ "name": "account_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "scope",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 4,
+ "name": "enabled",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 5,
+ "name": "has_endpoint!",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 6,
+ "name": "started_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 7,
+ "name": "last_error",
+ "type_info": "Text"
+ }
+ ],
+ "parameters": {
+ "Left": []
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ false,
+ null,
+ false,
+ true
+ ]
+ },
+ "hash": "b7f0cc8d093133220b6f0c09d7e9e8055b31b173b71c4b9ecc05f3c971eebe59"
+}
diff --git a/.sqlx/query-cbbe09ec8bb22fe8120adefdbea35b6929a4589c2a7fe7375fd43a2c4e7f80a5.json b/.sqlx/query-cbbe09ec8bb22fe8120adefdbea35b6929a4589c2a7fe7375fd43a2c4e7f80a5.json
new file mode 100644
index 0000000000..35f55fb6cb
--- /dev/null
+++ b/.sqlx/query-cbbe09ec8bb22fe8120adefdbea35b6929a4589c2a7fe7375fd43a2c4e7f80a5.json
@@ -0,0 +1,40 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT id,title,started_at,created_at FROM call_entities\n WHERE user_id = $1 AND created_via = 'import'\n ORDER BY created_at DESC, id DESC LIMIT 100",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "title",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 2,
+ "name": "started_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 3,
+ "name": "created_at",
+ "type_info": "Timestamptz"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false,
+ true,
+ true,
+ false
+ ]
+ },
+ "hash": "cbbe09ec8bb22fe8120adefdbea35b6929a4589c2a7fe7375fd43a2c4e7f80a5"
+}
diff --git a/.sqlx/query-d7f1bfb8a488778d846925b591111f3aad09be1bc51227df3db14c460f4a8300.json b/.sqlx/query-d7f1bfb8a488778d846925b591111f3aad09be1bc51227df3db14c460f4a8300.json
new file mode 100644
index 0000000000..4ac6d2fb08
--- /dev/null
+++ b/.sqlx/query-d7f1bfb8a488778d846925b591111f3aad09be1bc51227df3db14c460f4a8300.json
@@ -0,0 +1,82 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT * FROM granola_sync_connections WHERE id = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ },
+ {
+ "ordinal": 1,
+ "name": "user_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 2,
+ "name": "account_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 3,
+ "name": "scope",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 4,
+ "name": "enabled",
+ "type_info": "Bool"
+ },
+ {
+ "ordinal": 5,
+ "name": "endpoint_id",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 6,
+ "name": "signing_secret",
+ "type_info": "Bytea"
+ },
+ {
+ "ordinal": 7,
+ "name": "started_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 8,
+ "name": "last_synced_at",
+ "type_info": "Timestamptz"
+ },
+ {
+ "ordinal": 9,
+ "name": "last_error",
+ "type_info": "Text"
+ },
+ {
+ "ordinal": 10,
+ "name": "namespace",
+ "type_info": "Uuid"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": [
+ false,
+ false,
+ false,
+ false,
+ false,
+ true,
+ true,
+ false,
+ true,
+ true,
+ false
+ ]
+ },
+ "hash": "d7f1bfb8a488778d846925b591111f3aad09be1bc51227df3db14c460f4a8300"
+}
diff --git a/.sqlx/query-de1cb526c5e7a2b573e51fc640ee9fb1384ca22c1aa565691945697f208ab5de.json b/.sqlx/query-de1cb526c5e7a2b573e51fc640ee9fb1384ca22c1aa565691945697f208ab5de.json
new file mode 100644
index 0000000000..d554d0f257
--- /dev/null
+++ b/.sqlx/query-de1cb526c5e7a2b573e51fc640ee9fb1384ca22c1aa565691945697f208ab5de.json
@@ -0,0 +1,22 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "SELECT id FROM granola_sync_connections WHERE user_id = $1",
+ "describe": {
+ "columns": [
+ {
+ "ordinal": 0,
+ "name": "id",
+ "type_info": "Uuid"
+ }
+ ],
+ "parameters": {
+ "Left": [
+ "Text"
+ ]
+ },
+ "nullable": [
+ false
+ ]
+ },
+ "hash": "de1cb526c5e7a2b573e51fc640ee9fb1384ca22c1aa565691945697f208ab5de"
+}
diff --git a/.sqlx/query-f6c42f38acc140b9aafda64669da89b3a32867fe3a77ff6f60aa46d72d31ac57.json b/.sqlx/query-f6c42f38acc140b9aafda64669da89b3a32867fe3a77ff6f60aa46d72d31ac57.json
new file mode 100644
index 0000000000..9e0c6392fc
--- /dev/null
+++ b/.sqlx/query-f6c42f38acc140b9aafda64669da89b3a32867fe3a77ff6f60aa46d72d31ac57.json
@@ -0,0 +1,14 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "UPDATE granola_sync_connections SET enabled = false, last_error = 'Could not register Granola webhook' WHERE id = $1",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "f6c42f38acc140b9aafda64669da89b3a32867fe3a77ff6f60aa46d72d31ac57"
+}
diff --git a/.sqlx/query-f9a0b421f44e700d77c1f17f1064eecc9f85b65cc010bbc9206c28994099da86.json b/.sqlx/query-f9a0b421f44e700d77c1f17f1064eecc9f85b65cc010bbc9206c28994099da86.json
new file mode 100644
index 0000000000..ca62826b68
--- /dev/null
+++ b/.sqlx/query-f9a0b421f44e700d77c1f17f1064eecc9f85b65cc010bbc9206c28994099da86.json
@@ -0,0 +1,15 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "DELETE FROM call_entity_transcript_segments WHERE call_id = $1 AND transcript_id = $2",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid",
+ "Uuid"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "f9a0b421f44e700d77c1f17f1064eecc9f85b65cc010bbc9206c28994099da86"
+}
diff --git a/.sqlx/query-fe0987c8f55f647651ffa27d466562608860bb900194b02add44f4a4ea0739b0.json b/.sqlx/query-fe0987c8f55f647651ffa27d466562608860bb900194b02add44f4a4ea0739b0.json
new file mode 100644
index 0000000000..428020508a
--- /dev/null
+++ b/.sqlx/query-fe0987c8f55f647651ffa27d466562608860bb900194b02add44f4a4ea0739b0.json
@@ -0,0 +1,14 @@
+{
+ "db_name": "PostgreSQL",
+ "query": "DELETE FROM granola_sync_events WHERE connection_id = $1 AND completed_at < now() - interval '7 days'",
+ "describe": {
+ "columns": [],
+ "parameters": {
+ "Left": [
+ "Uuid"
+ ]
+ },
+ "nullable": []
+ },
+ "hash": "fe0987c8f55f647651ffa27d466562608860bb900194b02add44f4a4ea0739b0"
+}
diff --git a/Cargo.lock b/Cargo.lock
index 0559f0caf8..a741a50dd8 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -6361,6 +6361,7 @@ dependencies = [
"frecency",
"futures",
"github_pull_requests",
+ "granola_sync",
"http 1.4.0",
"http-body-util",
"import",
@@ -8863,6 +8864,36 @@ dependencies = [
"workspace-hack",
]
+[[package]]
+name = "granola_sync"
+version = "0.1.0"
+dependencies = [
+ "aes-gcm 0.10.3",
+ "anyhow",
+ "async-trait",
+ "axum",
+ "base64 0.22.1",
+ "call",
+ "chrono",
+ "hmac 0.12.1",
+ "macro_db_migrator",
+ "macro_user_id",
+ "macro_uuid",
+ "pipedream_mcp",
+ "rootcause",
+ "serde",
+ "serde_json",
+ "sha2 0.10.9",
+ "sqlx",
+ "thiserror 2.0.18",
+ "tokio",
+ "tower 0.5.3",
+ "tracing",
+ "url",
+ "uuid",
+ "workspace-hack",
+]
+
[[package]]
name = "graphql_activity"
version = "0.1.0"
@@ -9990,7 +10021,7 @@ dependencies = [
"tokio",
"tokio-rustls",
"tower-service",
- "webpki-roots 1.0.7",
+ "webpki-roots 1.0.10",
]
[[package]]
@@ -11269,7 +11300,7 @@ dependencies = [
"tokio",
"tokio-rustls",
"url",
- "webpki-roots 1.0.7",
+ "webpki-roots 1.0.10",
]
[[package]]
@@ -14929,6 +14960,7 @@ dependencies = [
"anyhow",
"async-trait",
"axum",
+ "base64 0.22.1",
"futures",
"macro_authorization",
"macro_user_id",
@@ -16357,7 +16389,7 @@ dependencies = [
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
- "webpki-roots 1.0.7",
+ "webpki-roots 1.0.10",
]
[[package]]
@@ -16941,9 +16973,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f"
[[package]]
name = "rustls-webpki"
-version = "0.103.15"
+version = "0.103.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2"
+checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281"
dependencies = [
"aws-lc-rs",
"ring",
@@ -21451,9 +21483,9 @@ dependencies = [
[[package]]
name = "webpki-root-certs"
-version = "1.0.7"
+version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f31141ce3fc3e300ae89b78c0dd67f9708061d1d2eda54b8209346fd6be9a92c"
+checksum = "58ec80e73fd8baf57bf0d9615554c75348bda990d6d5bbeab964dd068319fecb"
dependencies = [
"rustls-pki-types",
]
@@ -21464,14 +21496,14 @@ version = "0.26.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9"
dependencies = [
- "webpki-roots 1.0.7",
+ "webpki-roots 1.0.10",
]
[[package]]
name = "webpki-roots"
-version = "1.0.7"
+version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "52f5ee44c96cf55f1b349600768e3ece3a8f26010c05265ab73f945bb1a2eb9d"
+checksum = "1c1c8e20c8a38fc7d65abfe74eb7280e4aa667e8eec8bc84996d2874810748d9"
dependencies = [
"rustls-pki-types",
]
diff --git a/Cargo.toml b/Cargo.toml
index 97d341b726..fd10c3a765 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -104,6 +104,7 @@ members = [
"crates/mcp_toolset",
"crates/notification_state",
"crates/pipedream_mcp",
+ "crates/granola_sync",
"crates/onboarding",
"crates/ai_engine",
"crates/docx_engine",
diff --git a/apps/web/src/features/calls-view/components/calls-sidebar.tsx b/apps/web/src/features/calls-view/components/calls-sidebar.tsx
index 68c994d676..5f15f70d62 100644
--- a/apps/web/src/features/calls-view/components/calls-sidebar.tsx
+++ b/apps/web/src/features/calls-view/components/calls-sidebar.tsx
@@ -27,6 +27,8 @@ import {
Show,
} from 'solid-js';
import { Dynamic } from 'solid-js/web';
+import { GranolaPromoChip } from '../../granola-connect/components/GranolaPromoChip';
+import { createGranolaConnection } from '../../granola-connect/primitives/create-granola-connection';
import {
CALL_AUDIENCES,
type CallAudienceId,
@@ -113,6 +115,7 @@ export function CallsSidebar(props: { onNavigate: () => void }) {
);
const activeTab = () => view.activeTab() ?? VIEW_TAB_PRESETS.calls.default;
+ const granola = createGranolaConnection();
const selectAudience = (id: CallAudienceId) => {
props.onNavigate();
@@ -230,6 +233,20 @@ export function CallsSidebar(props: { onNavigate: () => void }) {
onOpenChange={(open) => setOpen('tags', open)}
/>
</ViewSidebar.Content>
+
+ {/* Hidden while loading so a connected user never sees it flash. */}
+ <Show
+ when={
+ granola.status() === 'available' || granola.status() === 'disabled'
+ }
+ >
+ <ViewSidebar.Footer class="border-0">
+ <GranolaPromoChip
+ onConnect={() => fireAndForget(granola.connect(), 'calls-view')}
+ connecting={granola.connecting()}
+ />
+ </ViewSidebar.Footer>
+ </Show>
</ViewSidebar.Root>
);
}
diff --git a/apps/web/src/features/granola-connect/components/GranolaPromoChip.tsx b/apps/web/src/features/granola-connect/components/GranolaPromoChip.tsx
new file mode 100644
index 0000000000..f4842b5ce6
--- /dev/null
+++ b/apps/web/src/features/granola-connect/components/GranolaPromoChip.tsx
@@ -0,0 +1,44 @@
+import { PipedreamConnectorIcon } from '@core/pipedream/ConnectorIcon';
+import ArrowRightIcon from '@phosphor/arrow-right.svg';
+import SpinnerIcon from '@phosphor/spinner.svg';
+import { Show } from 'solid-js';
+import { GRANOLA_APP_SLUG, GRANOLA_ICON_URL } from '../core/granola';
+
+/** Invites the user to import their Granola meetings as calls. */
+export function GranolaPromoChip(props: {
+ onConnect: () => void;
+ connecting: boolean;
+}) {
+ return (
+ <button
+ type="button"
+ disabled={props.connecting}
+ onClick={() => props.onConnect()}
+ class="group flex w-full items-center gap-2.5 rounded-lg border border-accent/25 bg-linear-to-r from-accent/15 via-accent/5 to-success/10 px-2.5 py-2 text-left outline-none transition-colors hover:border-accent/45 hover:from-accent/20 focus-visible:border-edge-focus disabled:opacity-60"
+ >
+ <span class="flex size-7 shrink-0 items-center justify-center rounded-md bg-panel shadow-xs">
+ <PipedreamConnectorIcon
+ appSlug={GRANOLA_APP_SLUG}
+ iconUrl={GRANOLA_ICON_URL}
+ class="size-4"
+ />
+ </span>
+ <span class="min-w-0 flex-1">
+ <span class="block truncate text-sm font-medium text-ink">
+ Connect Granola
+ </span>
+ <span class="block text-xs text-ink-muted">
+ Import meetings as calls
+ </span>
+ </span>
+ <Show
+ when={props.connecting}
+ fallback={
+ <ArrowRightIcon class="size-3.5 shrink-0 text-ink-muted transition-transform group-hover:translate-x-0.5 group-hover:text-ink" />
+ }
+ >
+ <SpinnerIcon class="size-3.5 shrink-0 animate-spin text-ink-muted" />
+ </Show>
+ </button>
+ );
+}
diff --git a/apps/web/src/features/granola-connect/core/granola.test.ts b/apps/web/src/features/granola-connect/core/granola.test.ts
new file mode 100644
index 0000000000..8cdb3fcc18
--- /dev/null
+++ b/apps/web/src/features/granola-connect/core/granola.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from 'vitest';
+import { granolaConnectionStatus } from './granola';
+
+describe('granolaConnectionStatus', () => {
+ it('is available without a Granola connection', () => {
+ expect(
+ granolaConnectionStatus([{ app_slug: 'linear', enabled: true }])
+ ).toBe('available');
+ });
+
+ it('is connected when a Granola connection is enabled', () => {
+ expect(
+ granolaConnectionStatus([{ app_slug: 'granola', enabled: true }])
+ ).toBe('connected');
+ });
+
+ it('is disabled when the only Granola connection is off', () => {
+ expect(
+ granolaConnectionStatus([{ app_slug: 'granola', enabled: false }])
+ ).toBe('disabled');
+ });
+});
diff --git a/apps/web/src/features/granola-connect/core/granola.ts b/apps/web/src/features/granola-connect/core/granola.ts
new file mode 100644
index 0000000000..f42529d8dd
--- /dev/null
+++ b/apps/web/src/features/granola-connect/core/granola.ts
@@ -0,0 +1,17 @@
+/** Granola's Pipedream app; connecting it is all the setup call import needs. */
+export const GRANOLA_APP_SLUG = 'granola';
+export const GRANOLA_DISPLAY_NAME = 'Granola';
+/** Pipedream's directory logo for Granola (proxied by `PipedreamConnectorIcon`). */
+export const GRANOLA_ICON_URL =
+ 'https://assets.pipedream.net/s.v0/app_YMhwDy/logo/orig';
+
+export type GranolaConnectionStatus = 'connected' | 'disabled' | 'available';
+
+/** An enabled connection syncs; a disabled one only needs re-enabling. */
+export function granolaConnectionStatus(
+ connections: readonly { app_slug: string; enabled: boolean }[]
+): GranolaConnectionStatus {
+ const granola = connections.filter((c) => c.app_slug === GRANOLA_APP_SLUG);
+ if (granola.some((c) => c.enabled)) return 'connected';
+ return granola.length ? 'disabled' : 'available';
+}
diff --git a/apps/web/src/features/granola-connect/primitives/create-granola-connection.ts b/apps/web/src/features/granola-connect/primitives/create-granola-connection.ts
new file mode 100644
index 0000000000..826f40c737
--- /dev/null
+++ b/apps/web/src/features/granola-connect/primitives/create-granola-connection.ts
@@ -0,0 +1,73 @@
+import { toast } from '@core/component/Toast/Toast';
+import { queryReadyGate } from '@queries/gate';
+import {
+ connectPipedreamApp,
+ useDeletePipedreamConnectionMutation,
+ usePipedreamConnectionsQuery,
+ useUpdatePipedreamConnectionMutation,
+} from '@queries/pipedream-connectors';
+import { createSignal } from 'solid-js';
+import {
+ GRANOLA_APP_SLUG,
+ GRANOLA_DISPLAY_NAME,
+ type GranolaConnectionStatus,
+ granolaConnectionStatus,
+} from '../core/granola';
+
+/**
+ * The user's Granola connection through Pipedream. Connecting is the whole
+ * setup: the backend starts importing meetings as calls on its own.
+ * `status` is undefined until the connection list has loaded, so callers
+ * never mistake "loading" for "not connected".
+ */
+export function createGranolaConnection() {
+ const connections = usePipedreamConnectionsQuery({ neverSuspend: true });
+ const update = useUpdatePipedreamConnectionMutation();
+ const remove = useDeletePipedreamConnectionMutation();
+ const [connecting, setConnecting] = createSignal(false);
+
+ const status = (): GranolaConnectionStatus | undefined =>
+ !connections.isPlaceholderData && queryReadyGate(connections)
+ ? granolaConnectionStatus(connections.data ?? [])
+ : undefined;
+
+ const connect = async () => {
+ if (connecting()) return;
+ setConnecting(true);
+ try {
+ if (status() === 'disabled') {
+ await update.mutateAsync({
+ app_slug: GRANOLA_APP_SLUG,
+ enabled: true,
+ });
+ return;
+ }
+ const outcome = await connectPipedreamApp({
+ appSlug: GRANOLA_APP_SLUG,
+ serverName: GRANOLA_DISPLAY_NAME,
+ });
+ if (outcome === 'unsupported')
+ toast.failure('Connectors are not available on this deployment');
+ } catch {
+ toast.failure('Failed to connect Granola');
+ } finally {
+ setConnecting(false);
+ }
+ };
+
+ const disconnect = async () => {
+ try {
+ await remove.mutateAsync({ app_slug: GRANOLA_APP_SLUG });
+ } catch {
+ toast.failure('Failed to disconnect Granola');
+ }
+ };
+
+ return {
+ status,
+ connect,
+ connecting,
+ disconnect,
+ disconnecting: () => remove.isPending,
+ };
+}
diff --git a/apps/web/src/features/settings/ConnectedAccounts.tsx b/apps/web/src/features/settings/ConnectedAccounts.tsx
index 4055d22018..09bdbceeea 100644
--- a/apps/web/src/features/settings/ConnectedAccounts.tsx
+++ b/apps/web/src/features/settings/ConnectedAccounts.tsx
@@ -5,6 +5,7 @@ import { Button } from '@ui';
import { Show, Suspense } from 'solid-js';
import { EmailCard } from './Email';
import { GitHubCard } from './GitHub';
+import { GranolaCard } from './Granola';
import {
SettingsCard,
SettingsPage,
@@ -31,6 +32,9 @@ export function ConnectedAccounts() {
<Suspense>
<GitHubCard />
</Suspense>
+ <Suspense>
+ <GranolaCard />
+ </Suspense>
</div>
</SettingsSection>
<SettingsSection
diff --git a/apps/web/src/features/settings/Granola.tsx b/apps/web/src/features/settings/Granola.tsx
new file mode 100644
index 0000000000..d5b59bd4de
--- /dev/null
+++ b/apps/web/src/features/settings/Granola.tsx
@@ -0,0 +1,79 @@
+import { PipedreamConnectorIcon } from '@core/pipedream/ConnectorIcon';
+import { fireAndForget } from '@core/util/fireAndForget';
+import { Match, Switch } from 'solid-js';
+import {
+ GRANOLA_APP_SLUG,
+ GRANOLA_ICON_URL,
+} from '../granola-connect/core/granola';
+import { createGranolaConnection } from '../granola-connect/primitives/create-granola-connection';
+import { ConnectAction, StatusDot } from './integration-ui';
+import { IntegrationRow, SettingsCard, SettingsRow } from './primitives';
+
+/** Granola as a Connected-accounts card; connecting starts call import. */
+export function GranolaCard() {
+ const granola = createGranolaConnection();
+
+ return (
+ <SettingsCard>
+ <IntegrationRow
+ icon={
+ <PipedreamConnectorIcon
+ appSlug={GRANOLA_APP_SLUG}
+ iconUrl={GRANOLA_ICON_URL}
+ class="size-5"
+ />
+ }
+ title="Granola"
+ description="Import your Granola meetings into Calls."
+ />
+
+ <SettingsRow
+ label={
+ <span class="flex items-center gap-2">
+ <span>Account</span>
+ <Switch>
+ <Match when={granola.status() === 'connected'}>
+ <StatusDot state="connected" label="Connected" />
+ </Match>
+ <Match when={granola.status() === 'disabled'}>
+ <StatusDot state="attention" label="Paused" />
+ </Match>
+ </Switch>
+ </span>
+ }
+ description="New and updated notes appear in Calls automatically."
+ >
+ <Switch fallback={<span class="text-xs text-ink-muted">Loading…</span>}>
+ <Match when={granola.status() === 'connected'}>
+ <ConnectAction
+ label="Disconnect"
+ variant="danger"
+ onClick={() =>
+ fireAndForget(granola.disconnect(), 'granola-settings')
+ }
+ disabled={granola.disconnecting()}
+ />
+ </Match>
+ <Match when={granola.status() === 'disabled'}>
+ <ConnectAction
+ label="Resume"
+ onClick={() =>
+ fireAndForget(granola.connect(), 'granola-settings')
+ }
+ loading={granola.connecting()}
+ />
+ </Match>
+ <Match when={granola.status() === 'available'}>
+ <ConnectAction
+ label="Connect"
+ onClick={() =>
+ fireAndForget(granola.connect(), 'granola-settings')
+ }
+ loading={granola.connecting()}
+ />
+ </Match>
+ </Switch>
+ </SettingsRow>
+ </SettingsCard>
+ );
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecord.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecord.ts
index 2820726b78..72953e9603 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecord.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecord.ts
@@ -15,6 +15,8 @@ import type { CallRecordParticipant } from './callRecordParticipant';
import type { CallRecordRecordingPreviewUrl } from './callRecordRecordingPreviewUrl';
import type { CallRecordRecordingStartedAt } from './callRecordRecordingStartedAt';
import type { CallRecordRecordingUrl } from './callRecordRecordingUrl';
+import type { CallRecordRoomName } from './callRecordRoomName';
+import type { CallRecordSourceProperty } from './callRecordSourceProperty';
import type { CallRecordStatus } from './callRecordStatus';
import type { CallRecordSummary } from './callRecordSummary';
import type { CallRecordTeamShareAccessLevel } from './callRecordTeamShareAccessLevel';
@@ -59,12 +61,13 @@ this value when present, falling back to `started_at` otherwise. */
recordingStartedAt?: CallRecordRecordingStartedAt;
/** Presigned URL for the call recording, if available. */
recordingUrl?: CallRecordRecordingUrl;
- /** The RTC room name. */
- roomName: string;
+ /** The RTC room name. `None` for imported calls, which never had a room. */
+ roomName?: CallRecordRoomName;
/** Whether the call is shared with the creator's team. While the call is
live this is the pending toggle applied at archive; afterwards it
mirrors `team_share_access_level`. */
shareWithTeam: boolean;
+ source?: CallRecordSourceProperty;
/** When the call started (created_at for active, started_at for archived). */
startedAt: string;
status?: CallRecordStatus;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecordRoomName.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecordRoomName.ts
new file mode 100644
index 0000000000..cad3fb4043
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecordRoomName.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * The RTC room name. `None` for imported calls, which never had a room.
+ */
+export type CallRecordRoomName = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecordSource.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecordSource.ts
new file mode 100644
index 0000000000..f72682aac9
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecordSource.ts
@@ -0,0 +1,17 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { CallRecordSourceExternalUrl } from './callRecordSourceExternalUrl';
+
+/**
+ * Where an imported call came from.
+ */
+export interface CallRecordSource {
+ /** Link to the call in the provider's app, if it has one. */
+ externalUrl?: CallRecordSourceExternalUrl;
+ /** Provider slug, e.g. `granola`. */
+ provider: string;
+}
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecordSourceExternalUrl.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecordSourceExternalUrl.ts
new file mode 100644
index 0000000000..f5ceab5f72
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecordSourceExternalUrl.ts
@@ -0,0 +1,11 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+
+/**
+ * Link to the call in the provider's app, if it has one.
+ */
+export type CallRecordSourceExternalUrl = string | null;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecordSourceProperty.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecordSourceProperty.ts
new file mode 100644
index 0000000000..4b350dd608
--- /dev/null
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/callRecordSourceProperty.ts
@@ -0,0 +1,9 @@
+/**
+ * Generated by orval v7.21.0 🍺
+ * Do not edit manually.
+ * document_storage_service
+ * OpenAPI spec version: 0.1.0
+ */
+import type { CallRecordSource } from './callRecordSource';
+
+export type CallRecordSourceProperty = null | CallRecordSource;
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts b/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
index 8937b5a32a..6bc764e5c5 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/schemas/index.ts
@@ -283,6 +283,10 @@ export * from './callRecordPreviewOneOfFourAllOfType';
export * from './callRecordRecordingPreviewUrl';
export * from './callRecordRecordingStartedAt';
export * from './callRecordRecordingUrl';
+export * from './callRecordRoomName';
+export * from './callRecordSource';
+export * from './callRecordSourceExternalUrl';
+export * from './callRecordSourceProperty';
export * from './callRecordStatus';
export * from './callRecordSummary';
export * from './callRecordTeamShareAccessLevel';
diff --git a/apps/web/src/lib/service-clients/service-storage/generated/zod.ts b/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
index 29e77097e1..cc0654e620 100644
--- a/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
+++ b/apps/web/src/lib/service-clients/service-storage/generated/zod.ts
@@ -2475,12 +2475,33 @@ export const getCallRecordResponse = zod
.string()
.nullish()
.describe('Presigned URL for the call recording, if available.'),
- roomName: zod.string().describe('The RTC room name.'),
+ roomName: zod
+ .string()
+ .nullish()
+ .describe(
+ 'The RTC room name. `None` for imported calls, which never had a room.'
+ ),
shareWithTeam: zod
.boolean()
.describe(
"Whether the call is shared with the creator's team. While the call is\nlive this is the pending toggle applied at archive; afterwards it\nmirrors `team_share_access_level`."
),
+ source: zod
+ .union([
+ zod.null(),
+ zod
+ .object({
+ externalUrl: zod
+ .string()
+ .nullish()
+ .describe(
+ "Link to the call in the provider's app, if it has one."
+ ),
+ provider: zod.string().describe('Provider slug, e.g. `granola`.'),
+ })
+ .describe('Where an imported call came from.'),
+ ])
+ .optional(),
startedAt: zod.iso
.datetime({})
.describe(
diff --git a/apps/web/src/lib/service-clients/service-storage/openapi.json b/apps/web/src/lib/service-clients/service-storage/openapi.json
index 0f1b56dbfd..0f95aa2822 100644
--- a/apps/web/src/lib/service-clients/service-storage/openapi.json
+++ b/apps/web/src/lib/service-clients/service-storage/openapi.json
@@ -21349,7 +21349,6 @@
"description": "Full record of a call, unifying rows from `calls` (active) and\n`call_records` (archived) into a single response shape.",
"required": [
"callId",
- "roomName",
"createdBy",
"startedAt",
"shareWithTeam",
@@ -21427,13 +21426,24 @@
"description": "Presigned URL for the call recording, if available."
},
"roomName": {
- "type": "string",
- "description": "The RTC room name."
+ "type": ["string", "null"],
+ "description": "The RTC room name. `None` for imported calls, which never had a room."
},
"shareWithTeam": {
"type": "boolean",
"description": "Whether the call is shared with the creator's team. While the call is\nlive this is the pending toggle applied at archive; afterwards it\nmirrors `team_share_access_level`."
},
+ "source": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/CallRecordSource",
+ "description": "External provenance for calls imported from another provider; `None`\nfor calls recorded in Macro."
+ }
+ ]
+ },
"startedAt": {
"type": "string",
"format": "date-time",
@@ -21613,6 +21623,21 @@
}
}
},
+ "CallRecordSource": {
+ "type": "object",
+ "description": "Where an imported call came from.",
+ "required": ["provider"],
+ "properties": {
+ "externalUrl": {
+ "type": ["string", "null"],
+ "description": "Link to the call in the provider's app, if it has one."
+ },
+ "provider": {
+ "type": "string",
+ "description": "Provider slug, e.g. `granola`."
+ }
+ }
+ },
"CallRecordTranscriptSegment": {
"type": "object",
"description": "A transcript segment as returned in a [`CallRecord`].",
diff --git a/crates/agent_code_mode/src/domain/documentation.json b/crates/agent_code_mode/src/domain/documentation.json
index 472ac11b64..60de5ee3b0 100644
--- a/crates/agent_code_mode/src/domain/documentation.json
+++ b/crates/agent_code_mode/src/domain/documentation.json
@@ -75,7 +75,7 @@
"name": "calls",
"description": "Read and edit call records, transcripts and meeting links.",
"overview": "<!-- src/entities/calls/namespace/classes/CallRecordNamespace.md -->\n# Class: CallRecordNamespace\n\n## Constructors\n\n### Constructor\n\n> **new CallRecordNamespace**(`client`): `CallRecordNamespace`\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n\n#### Returns\n\n`CallRecordNamespace`\n\n## Methods\n\n### byId()\n\n> **byId**(`id`): [`CallRecord`](../../call-record/classes/CallRecord.md)\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`CallRecord`](../../call-record/classes/CallRecord.md)\n\n***\n\n### search()\n\n> **search**(`query`, `opts?`): `AsyncGenerator`\\<[`CallRecord`](../../call-record/classes/CallRecord.md)\\>\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `query` | `string` |\n| `opts?` | [`SearchOpts`](../../../search/interfaces/SearchOpts.md) |\n\n#### Returns\n\n`AsyncGenerator`\\<[`CallRecord`](../../call-record/classes/CallRecord.md)\\>\n",
- "documentation": "# Macro SDK: calls\n\nGenerated by TypeDoc. Paths below refer to the canonical Markdown hierarchy. Other entity handles are documented in their named section; request core for shared SDK helpers.\n\n<!-- generated/storage/types.gen/type-aliases/AccessLevel.md -->\n# Type Alias: AccessLevel\n\n> **AccessLevel** = `\"view\"` \\| `\"comment\"` \\| `\"edit\"` \\| `\"owner\"`\n\nOrdered from least to most access top -> bottom\n\n\n<!-- generated/storage/types.gen/type-aliases/BotSenderProfile.md -->\n# Type Alias: BotSenderProfile\n\n> **BotSenderProfile** = \\{ `avatar_url?`: `string` \\| `null`; `name`: `string`; \\}\n\nPublic bot profile attached to bot-authored messages.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-avatar_url\"></a> `avatar_url?` | `string` \\| `null` | Bot avatar URL. |\n| <a id=\"property-name\"></a> `name` | `string` | Bot display name. |\n\n\n<!-- generated/storage/types.gen/type-aliases/CallRecord.md -->\n# Type Alias: CallRecord\n\n> **CallRecord** = \\{ `callId`: `string`; `channelId?`: `string` \\| `null`; `channelName?`: `string` \\| `null`; `createdBy`: `string`; `customName?`: `string` \\| `null`; `durationMs?`: `number` \\| `null`; `egressId?`: `string` \\| `null`; `endedAt?`: `string` \\| `null`; `guests`: [`CallRecordGuest`](CallRecordGuest.md)[]; `isActive`: `boolean`; `participants`: [`CallRecordParticipant`](CallRecordParticipant.md)[]; `recordingPreviewUrl?`: `string` \\| `null`; `recordingStartedAt?`: `string` \\| `null`; `recordingUrl?`: `string` \\| `null`; `roomName`: `string`; `shareWithTeam`: `boolean`; `startedAt`: `string`; `status?`: `null` \\| [`CallStatus`](CallStatus.md); `summary?`: `string` \\| `null`; `teamShareAccessLevel?`: `null` \\| [`AccessLevel`](AccessLevel.md); `transcript`: [`CallRecordTranscriptSegment`](CallRecordTranscriptSegment.md)[]; `userAccessLevel?`: `null` \\| [`AccessLevel`](AccessLevel.md); `viewerHasDeclined?`: `boolean`; \\}\n\nFull record of a call, unifying rows from `calls` (active) and\n`call_records` (archived) into a single response shape.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-callid\"></a> `callId` | `string` | The call identifier. |\n| <a id=\"property-channelid\"></a> `channelId?` | `string` \\| `null` | The channel this call belongs to. |\n| <a id=\"property-channelname\"></a> `channelName?` | `string` \\| `null` | Resolved display name for the channel. |\n| <a id=\"property-createdby\"></a> `createdBy` | `string` | User who created the call. |\n| <a id=\"property-customname\"></a> `customName?` | `string` \\| `null` | User-supplied or AI-generated display name for the call. Only set on archived `call_records`; active calls always return `None`. |\n| <a id=\"property-durationms\"></a> `durationMs?` | `number` \\| `null` | Call duration in milliseconds (None if still active). |\n| <a id=\"property-egressid\"></a> `egressId?` | `string` \\| `null` | Recording egress ID, if any. |\n| <a id=\"property-endedat\"></a> `endedAt?` | `string` \\| `null` | When the call ended (None if still active). |\n| <a id=\"property-guests\"></a> `guests` | [`CallRecordGuest`](CallRecordGuest.md)[] | Non-account guests (both active and historic). Guests only ever exist on standalone meeting calls, never on channel calls. |\n| <a id=\"property-isactive\"></a> `isActive` | `boolean` | Whether the call is currently active (from `calls` table). |\n| <a id=\"property-participants\"></a> `participants` | [`CallRecordParticipant`](CallRecordParticipant.md)[] | Macro-account participants (both active and historic). |\n| <a id=\"property-recordingpreviewurl\"></a> `recordingPreviewUrl?` | `string` \\| `null` | Presigned URL for the call recording preview image, if available. |\n| <a id=\"property-recordingstartedat\"></a> `recordingStartedAt?` | `string` \\| `null` | When the egress recording actually began. `None` until the `egress_started` webhook arrives (typically a few seconds after `started_at`). Frontend should anchor transcript-to-audio sync to this value when present, falling back to `started_at` otherwise. |\n| <a id=\"property-recordingurl\"></a> `recordingUrl?` | `string` \\| `null` | Presigned URL for the call recording, if available. |\n| <a id=\"property-roomname\"></a> `roomName` | `string` | The RTC room name. |\n| <a id=\"property-sharewithteam\"></a> `shareWithTeam` | `boolean` | Whether the call is shared with the creator's team. While the call is live this is the pending toggle applied at archive; afterwards it mirrors `team_share_access_level`. |\n| <a id=\"property-startedat\"></a> `startedAt` | `string` | When the call started (created_at for active, started_at for archived). |\n| <a id=\"property-status\"></a> `status?` | `null` \\| [`CallStatus`](CallStatus.md) | - |\n| <a id=\"property-summary\"></a> `summary?` | `string` \\| `null` | AI-generated summary of the call. Only set on archived `call_records` once summarization has run; active calls always return `None`. |\n| <a id=\"property-teamshareaccesslevel\"></a> `teamShareAccessLevel?` | `null` \\| [`AccessLevel`](AccessLevel.md) | - |\n| <a id=\"property-transcript\"></a> `transcript` | [`CallRecordTranscriptSegment`](CallRecordTranscriptSegment.md)[] | Transcript segments ordered by `sequence_num`. |\n| <a id=\"property-useraccesslevel\"></a> `userAccessLevel?` | `null` \\| [`AccessLevel`](AccessLevel.md) | - |\n| <a id=\"property-viewerhasdeclined\"></a> `viewerHasDeclined?` | `boolean` | Whether the authenticated viewer has declined this call on any device. Set on the single-record read so clients that missed `call_declined` can still stop ringing via reconciliation; `false` in list contexts. |\n\n\n<!-- generated/storage/types.gen/type-aliases/CallRecordGuest.md -->\n# Type Alias: CallRecordGuest\n\n> **CallRecordGuest** = \\{ `displayName`: `string`; `id`: [`GuestId`](GuestId.md); `joinedAt`: `string`; `leftAt?`: `string` \\| `null`; \\}\n\nA non-account guest as returned in a [`CallRecord`].\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-displayname\"></a> `displayName` | `string` | Guest-provided display name. |\n| <a id=\"property-id\"></a> `id` | [`GuestId`](GuestId.md) | Opaque guest identity; matches the guest's transcript `speaker_id`. |\n| <a id=\"property-joinedat\"></a> `joinedAt` | `string` | When the guest joined the call. |\n| <a id=\"property-leftat\"></a> `leftAt?` | `string` \\| `null` | When the guest left (None if still in an active call). |\n\n\n<!-- generated/storage/types.gen/type-aliases/CallRecordParticipant.md -->\n# Type Alias: CallRecordParticipant\n\n> **CallRecordParticipant** = \\{ `joinedAt`: `string`; `leftAt?`: `string` \\| `null`; `userId`: `string`; \\}\n\nA participant as returned in a [`CallRecord`] (historic — includes `left_at`).\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-joinedat\"></a> `joinedAt` | `string` | When the user joined the call. |\n| <a id=\"property-leftat\"></a> `leftAt?` | `string` \\| `null` | When the user left (None if still in an active call). |\n| <a id=\"property-userid\"></a> `userId` | `string` | The Macro user id. |\n\n\n<!-- generated/storage/types.gen/type-aliases/CallRecordTranscriptSegment.md -->\n# Type Alias: CallRecordTranscriptSegment\n\n> **CallRecordTranscriptSegment** = \\{ `content`: `string`; `diarizedSpeakerId?`: `string` \\| `null`; `endedAt?`: `string` \\| `null`; `segmentId?`: `string` \\| `null`; `sequenceNum`: `number`; `speakerId`: `string`; `startedAt`: `string`; `transcriptId`: `string`; \\}\n\nA transcript segment as returned in a [`CallRecord`].\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-content\"></a> `content` | `string` | The transcribed text content. |\n| <a id=\"property-diarizedspeakerid\"></a> `diarizedSpeakerId?` | `string` \\| `null` | Stable per-speaker identifier produced by the STT provider's diarization pass. Unique across tracks in the call. `None` when the provider didn't return a speaker label. |\n| <a id=\"property-endedat\"></a> `endedAt?` | `string` \\| `null` | When the speaker stopped (if known). |\n| <a id=\"property-segmentid\"></a> `segmentId?` | `string` \\| `null` | LiveKit segment ID (nullable for archived records). |\n| <a id=\"property-sequencenum\"></a> `sequenceNum` | `number` | Ordering within the call. |\n| <a id=\"property-speakerid\"></a> `speakerId` | `string` | The speaker's user ID. |\n| <a id=\"property-startedat\"></a> `startedAt` | `string` | When the speaker started this segment. |\n| <a id=\"property-transcriptid\"></a> `transcriptId` | `string` | Stable DB-row id for the segment. |\n\n\n<!-- generated/storage/types.gen/type-aliases/CallStatus.md -->\n# Type Alias: CallStatus\n\n> **CallStatus** = `\"ATTENDED\"` \\| `\"MISSED\"` \\| `\"UNATTENDED\"`\n\nViewer-relative attendance status for a call record.\nSerializes as `ATTENDED`, `MISSED`, or `UNATTENDED`.\n\n\n<!-- generated/storage/types.gen/type-aliases/CountedReaction.md -->\n# Type Alias: CountedReaction\n\n> **CountedReaction** = \\{ `emoji`: `string`; `users`: `string`[]; \\}\n\nReaction emoji and the users who added it.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-emoji\"></a> `emoji` | `string` | Emoji being reacted with. |\n| <a id=\"property-users\"></a> `users` | `string`[] | User identifiers. |\n\n\n<!-- generated/storage/types.gen/type-aliases/CustomSpeakerAssignment.md -->\n# Type Alias: CustomSpeakerAssignment\n\n> **CustomSpeakerAssignment** = \\{ `customSpeaker`: `string`; `diarizedSpeakerId`: `string`; \\}\n\nOne per-diarized-speaker override, used in [`EditCallTranscriptRequest`].\n\n`custom_speaker = None` clears any existing override for this\n`diarized_speaker_id`; `Some(macro_user_id)` sets it. The string is\nexpected to parse as a `MacroUserId` (e.g. `macro|[email protected]`);\nthe service layer rejects malformed values with `400 Bad Request`.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-customspeaker\"></a> `customSpeaker` | `string` | Macro user id to attribute matching rows to, or `None` to clear. |\n| <a id=\"property-diarizedspeakerid\"></a> `diarizedSpeakerId` | `string` | The diarization label whose rows this assignment targets. |\n\n\n<!-- generated/storage/types.gen/type-aliases/DocumentId.md -->\n# Type Alias: DocumentId\n\n> **DocumentId** = `string`\n\nA validated document identifier. Historical document ids need not be UUIDs.\n\n\n<!-- generated/storage/types.gen/type-aliases/EntityPermission.md -->\n# Type Alias: EntityPermission\n\n> **EntityPermission** = \\{ `access_level`: [`AccessLevel`](AccessLevel.md); `type`: `\"access_level\"`; \\} \\| \\{ `type`: `\"channel_view_only\"`; \\} \\| \\{ `role`: [`ParticipantRole`](ParticipantRole.md); `type`: `\"channel_role\"`; \\} \\| \\{ `role`: [`TeamRole`](TeamRole.md); `type`: `\"team_role\"`; \\}\n\nA user's permission for an entity, discriminated by entity kind.\n\nItems (documents, chats, projects, threads) use access levels.\nChannels use view-only permission or participant roles.\n\n## Union Members\n\n### Type Literal\n\n\\{ `access_level`: [`AccessLevel`](AccessLevel.md); `type`: `\"access_level\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `access_level` | [`AccessLevel`](AccessLevel.md) | The access level the user has. |\n| `type` | `\"access_level\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"channel_view_only\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `role`: [`ParticipantRole`](ParticipantRole.md); `type`: `\"channel_role\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `role` | [`ParticipantRole`](ParticipantRole.md) | The role the user has in the channel. |\n| `type` | `\"channel_role\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `role`: [`TeamRole`](TeamRole.md); `type`: `\"team_role\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `role` | [`TeamRole`](TeamRole.md) | The role the user has in the team. |\n| `type` | `\"team_role\"` | - |\n\n\n<!-- generated/storage/types.gen/type-aliases/GuestId.md -->\n# Type Alias: GuestId\n\n> **GuestId** = `string`\n\nA non-account guest of a single call session.\n\nThe id doubles as the guest's RTC participant identity, so identities are\nopaque UUIDs and never share a namespace (or a column) with Macro user\nids. Only the server mints them; Macro users keep `macro|…` identities,\nso an RTC identity classifies as exactly one of the two.\n\n\n<!-- generated/storage/types.gen/type-aliases/ImportedAuthor.md -->\n# Type Alias: ImportedAuthor\n\n> **ImportedAuthor** = \\{ `name`: `string`; \\}\n\nDisplay attribution for a comment imported from an external document.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-name\"></a> `name` | `string` | Original author text; never interpreted as an authenticated principal. |\n\n\n<!-- generated/storage/types.gen/type-aliases/Message.md -->\n# Type Alias: Message\n\n> **Message** = \\{ `attachments`: [`MessageAttachment`](MessageAttachment.md)[]; `bot_profile?`: `null` \\| [`BotSenderProfile`](BotSenderProfile.md); `content`: `string`; `created_at`: `string`; `deleted_at?`: `string` \\| `null`; `edited_at?`: `string` \\| `null`; `guest_name?`: `string` \\| `null`; `id`: `string`; `imported_author?`: `null` \\| [`ImportedAuthor`](ImportedAuthor.md); `mentions`: [`SimpleMention`](SimpleMention.md)[]; `parent`: [`MessageParent`](MessageParent.md); `reactions`: [`CountedReaction`](CountedReaction.md)[]; `sender_id`: `string`; `thread_id?`: `string` \\| `null`; `triggered_by?`: `string` \\| `null`; `updated_at`: `string`; \\}\n\nShared message representation for channel timelines and entity discussions.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-attachments\"></a> `attachments` | [`MessageAttachment`](MessageAttachment.md)[] | Attached entities. |\n| <a id=\"property-bot_profile\"></a> `bot_profile?` | `null` \\| [`BotSenderProfile`](BotSenderProfile.md) | - |\n| <a id=\"property-content\"></a> `content` | `string` | Macro Markdown body. |\n| <a id=\"property-created_at\"></a> `created_at` | `string` | Creation time. |\n| <a id=\"property-deleted_at\"></a> `deleted_at?` | `string` \\| `null` | Message tombstone, independent of thread deletion. |\n| <a id=\"property-edited_at\"></a> `edited_at?` | `string` \\| `null` | Last content edit, if any. |\n| <a id=\"property-guest_name\"></a> `guest_name?` | `string` \\| `null` | Display name of a verified call guest, retained after the call ends. |\n| <a id=\"property-id\"></a> `id` | `string` | Message UUID. |\n| <a id=\"property-imported_author\"></a> `imported_author?` | `null` \\| [`ImportedAuthor`](ImportedAuthor.md) | - |\n| <a id=\"property-mentions\"></a> `mentions` | [`SimpleMention`](SimpleMention.md)[] | Tracked mentions, retained when a caller changes attachments only. |\n| <a id=\"property-parent\"></a> `parent` | [`MessageParent`](MessageParent.md) | Entity that owns this conversation. |\n| <a id=\"property-reactions\"></a> `reactions` | [`CountedReaction`](CountedReaction.md)[] | Aggregated reactions. |\n| <a id=\"property-sender_id\"></a> `sender_id` | `string` | Authenticated actor or owner of imported content. |\n| <a id=\"property-thread_id\"></a> `thread_id?` | `string` \\| `null` | Root message UUID for replies; absent on roots. |\n| <a id=\"property-triggered_by\"></a> `triggered_by?` | `string` \\| `null` | User who triggered a bot-authored message. |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` | Last persisted update. |\n\n\n<!-- generated/storage/types.gen/type-aliases/MessageAttachment.md -->\n# Type Alias: MessageAttachment\n\n> **MessageAttachment** = \\{ `created_at`: `string`; `entity_id`: `string`; `entity_type`: `string`; `height?`: `number` \\| `null`; `id`: `string`; `width?`: `number` \\| `null`; \\}\n\nAn entity attached to a message.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-created_at\"></a> `created_at` | `string` | When the attachment was added. |\n| <a id=\"property-entity_id\"></a> `entity_id` | `string` | Attached entity identifier. |\n| <a id=\"property-entity_type\"></a> `entity_type` | `string` | Attached entity type. |\n| <a id=\"property-height\"></a> `height?` | `number` \\| `null` | Optional media height. |\n| <a id=\"property-id\"></a> `id` | `string` | Attachment UUID. |\n| <a id=\"property-width\"></a> `width?` | `number` \\| `null` | Optional media width. |\n\n\n<!-- generated/storage/types.gen/type-aliases/MessageCursor.md -->\n# Type Alias: MessageCursor\n\n> **MessageCursor** = \\{ `created_at`: `string`; `id`: `string`; \\}\n\nCursor for a chronological parent timeline.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-created_at\"></a> `created_at` | `string` | Last message creation time or activity occurrence time. |\n| <a id=\"property-id\"></a> `id` | `string` | Last entry UUID, used to break timestamp ties across both sources. |\n\n\n<!-- generated/storage/types.gen/type-aliases/MessageParent.md -->\n# Type Alias: MessageParent\n\n> **MessageParent** = \\{ `id`: `string`; `type`: `\"channel\"`; \\} \\| \\{ `id`: [`DocumentId`](DocumentId.md); `type`: `\"document\"`; \\} \\| \\{ `id`: `string`; `type`: `\"initiative\"`; \\} \\| \\{ `id`: `string`; `type`: `\"crm_company\"`; \\} \\| \\{ `id`: `string`; `type`: `\"crm_contact\"`; \\} \\| \\{ `id`: `string`; `type`: `\"call\"`; \\}\n\nThe entity whose permissions and lifecycle govern a message.\n\n## Union Members\n\n### Type Literal\n\n\\{ `id`: `string`; `type`: `\"channel\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `id` | `string` | A channel, including direct messages. |\n| `type` | `\"channel\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `id`: [`DocumentId`](DocumentId.md); `type`: `\"document\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `id` | [`DocumentId`](DocumentId.md) | A document, including tasks and PDFs. |\n| `type` | `\"document\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `id`: `string`; `type`: `\"initiative\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `id` | `string` | An initiative, presented as a project in the application. |\n| `type` | `\"initiative\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `id`: `string`; `type`: `\"crm_company\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `id` | `string` | A CRM company. |\n| `type` | `\"crm_company\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `id`: `string`; `type`: `\"crm_contact\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `id` | `string` | A CRM contact. |\n| `type` | `\"crm_contact\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `id`: `string`; `type`: `\"call\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `id` | `string` | A video call and its persistent chat thread. |\n| `type` | `\"call\"` | - |\n\n\n<!-- generated/storage/types.gen/type-aliases/ParticipantRole.md -->\n# Type Alias: ParticipantRole\n\n> **ParticipantRole** = `\"owner\"` \\| `\"admin\"` \\| `\"member\"`\n\nThe role a user has within a channel.\n\n\n<!-- generated/storage/types.gen/type-aliases/SimpleMention.md -->\n# Type Alias: SimpleMention\n\n> **SimpleMention** = \\{ `entity_id`: `string`; `entity_type`: `string`; \\}\n\nA mention tracked in a message body.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-entity_id\"></a> `entity_id` | `string` | Mentioned entity identifier. |\n| <a id=\"property-entity_type\"></a> `entity_type` | `string` | Mentioned entity type. |\n\n\n<!-- generated/storage/types.gen/type-aliases/TeamRole.md -->\n# Type Alias: TeamRole\n\n> **TeamRole** = `\"member\"` \\| `\"admin\"` \\| `\"owner\"`\n\nThe role a user has within a team.\n\nOrdered least to most privileged so comparisons reflect access strength.\n\n\n<!-- src/entities/calls/call-record/classes/CallRecord.md -->\n# Class: CallRecord\n\nA Macro call record (an archived or still active call).\n\n## Extends\n\n- [`FavoritableEntity`](../../../entity/classes/FavoritableEntity.md)\\<`CallRecordDetail`\\>\n\n## Properties\n\n| Property | Modifier | Type | Default value | Description | Overrides | Inherited from |\n| ------ | ------ | ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-access\"></a> `access` | `readonly` | [`EntityAccess`](../../../sharing/access/classes/EntityAccess.md) | `...` | Access requests and direct user grants. | - | - |\n| <a id=\"property-channel\"></a> `channel` | `readonly` | () => `Promise`\\<[`Channel`](../../../channels/channel/classes/Channel.md) \\| `undefined`\\> | `...` | The channel the call belongs to, if it is a channel call. | - | - |\n| <a id=\"property-channelname\"></a> `channelName` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | The display name of the channel the call belongs to. | - | - |\n| <a id=\"property-creator\"></a> `creator` | `readonly` | () => `Promise`\\<[`User`](../../../users/user/classes/User.md)\\> | `...` | The user who started the call. | - | - |\n| <a id=\"property-durationms\"></a> `durationMs` | `readonly` | () => `Promise`\\<`number` \\| `undefined`\\> | `...` | Call duration in milliseconds (undefined if still active). | - | - |\n| <a id=\"property-endedat\"></a> `endedAt` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | When the call ended (undefined if still active). | - | - |\n| <a id=\"property-entitytype\"></a> `entityType` | `readonly` | `\"call\"` | `'call'` | Favorites identify call records as `call`. | [`FavoritableEntity`](../../../entity/classes/FavoritableEntity.md).[`entityType`](../../../entity/classes/FavoritableEntity.md#property-entitytype) | - |\n| <a id=\"property-guests\"></a> `guests` | `readonly` | () => `Promise`\\<[`CallRecordGuest`](../../../../../generated/storage/types.gen/type-aliases/CallRecordGuest.md)[]\\> | `...` | Current and past guests; each id matches its transcript speaker id. | - | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | `undefined` | - | - | [`FavoritableEntity`](../../../entity/classes/FavoritableEntity.md).[`id`](../../../entity/classes/FavoritableEntity.md#property-id) |\n| <a id=\"property-isactive\"></a> `isActive` | `readonly` | () => `Promise`\\<`boolean`\\> | `...` | Whether the call is still in progress. | - | - |\n| <a id=\"property-name\"></a> `name` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | The call's display name (user-supplied or AI-generated; unset while active). | - | - |\n| <a id=\"property-participants\"></a> `participants` | `readonly` | () => `Promise`\\<[`CallRecordParticipant`](../../../../../generated/storage/types.gen/type-aliases/CallRecordParticipant.md)[]\\> | `...` | Macro-account participants, both active and historic. | - | - |\n| <a id=\"property-recordingpreviewurl\"></a> `recordingPreviewUrl` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | URL of the recording preview (thumbnail), once available. | - | - |\n| <a id=\"property-recordingstartedat\"></a> `recordingStartedAt` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | When the recording started, if it was recorded. | - | - |\n| <a id=\"property-recordingurl\"></a> `recordingUrl` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | URL of the call recording, once available. | - | - |\n| <a id=\"property-roomname\"></a> `roomName` | `readonly` | () => `Promise`\\<`string`\\> | `...` | The realtime room the call runs in. | - | - |\n| <a id=\"property-sharewithteam\"></a> `shareWithTeam` | `readonly` | () => `Promise`\\<`boolean`\\> | `...` | Whether the call is shared with the creator's team: the pending toggle while the call is live, the canonical grant once it is archived. | - | - |\n| <a id=\"property-startedat\"></a> `startedAt` | `readonly` | () => `Promise`\\<`string`\\> | `...` | When the call started. | - | - |\n| <a id=\"property-status\"></a> `status` | `readonly` | () => `Promise`\\<`NonNullable`\\<CallStatus \\| null \\| undefined\\> \\| `undefined`\\> | `...` | The call's status (undefined until set). | - | - |\n| <a id=\"property-summary\"></a> `summary` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | AI-generated summary of the call, once summarization has run. | - | - |\n| <a id=\"property-teamshareaccesslevel\"></a> `teamShareAccessLevel` | `readonly` | () => `Promise`\\<`NonNullable`\\<AccessLevel \\| null \\| undefined\\> \\| `undefined`\\> | `...` | The canonical access level granted to the creator's team once the call is archived, or null when it is not shared. Calls only ever grant `'view'`; while the call is live this is null and [CallRecord.shareWithTeam](#property-sharewithteam) carries the pending toggle. | - | - |\n| <a id=\"property-transcript\"></a> `transcript` | `readonly` | () => `Promise`\\<[`CallRecordTranscriptSegment`](../../../../../generated/storage/types.gen/type-aliases/CallRecordTranscriptSegment.md)[]\\> | `...` | Transcript segments, ordered by sequence number. | - | - |\n| <a id=\"property-search\"></a> `search` | `static` | (`client`, `query`, `searchOpts?`) => `AsyncGenerator`\\<`CallRecord`\\> | `...` | Search calls by name and transcript, most relevant first, auto-paginated. | - | - |\n\n## Methods\n\n### delete()\n\n> **delete**(): `Promise`\\<`void`\\>\n\nDelete the call record.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### editTranscript()\n\n> **editTranscript**(`assignments`): `Promise`\\<`void`\\>\n\nUpdate custom speaker assignments in the transcript.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `assignments` | [`CustomSpeakerAssignment`](../../../../../generated/storage/types.gen/type-aliases/CustomSpeakerAssignment.md)[] |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### favorite()\n\n> **favorite**(): `Promise`\\<`CallRecord`\\>\n\nAdd this entity to the user's favorites. Returns this handle for chaining.\nPlain unwrap: favoriting alters the user's favorites collection, not this\nentity's own detail, so there's nothing cached to invalidate.\n\n#### Returns\n\n`Promise`\\<`CallRecord`\\>\n\n#### Inherited from\n\n[`FavoritableEntity`](../../../entity/classes/FavoritableEntity.md).[`favorite`](../../../entity/classes/FavoritableEntity.md#favorite)\n\n***\n\n### meeting()\n\n> **meeting**(): `Promise`\\<[`Meeting`](../../../meetings/meeting/classes/Meeting.md)\\>\n\nGet or create a shareable meeting for this call.\n\n#### Returns\n\n`Promise`\\<[`Meeting`](../../../meetings/meeting/classes/Meeting.md)\\>\n\n***\n\n### message()\n\n> **message**(`id`): [`CallMessage`](../../message/classes/CallMessage.md)\n\nA message in this call's persistent chat. Fields load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`CallMessage`](../../message/classes/CallMessage.md)\n\n***\n\n### messageThreadById()\n\n> **messageThreadById**(`id`): [`MessageThread`](../../../messages/thread/classes/MessageThread.md)\n\nA shared message thread scoped to this resource.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`MessageThread`](../../../messages/thread/classes/MessageThread.md)\n\n***\n\n### permission()\n\n> **permission**(): `Promise`\\<\\{ `permission`: [`EntityPermission`](../../../../../generated/storage/types.gen/type-aliases/EntityPermission.md); `status`: `\"access\"`; \\} \\| \\{ `status`: `\"no_access\"`; \\}\\>\n\nRead the caller's effective permission on this entity.\n\n#### Returns\n\n`Promise`\\<\\{ `permission`: [`EntityPermission`](../../../../../generated/storage/types.gen/type-aliases/EntityPermission.md); `status`: `\"access\"`; \\} \\| \\{ `status`: `\"no_access\"`; \\}\\>\n\n#### Inherited from\n\n[`FavoritableEntity`](../../../entity/classes/FavoritableEntity.md).[`permission`](../../../entity/classes/FavoritableEntity.md#permission)\n\n***\n\n### rename()\n\n> **rename**(`name`): `Promise`\\<`void`\\>\n\nRename the call or clear the custom name.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `name` | `string` \\| `null` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### setTeamShare()\n\n> **setTeamShare**(`shared`): `Promise`\\<`void`\\>\n\nShare the call with the creator's team (view access), or unshare it.\nWhile the call is live this sets the pending toggle any participant with\nedit access may change; once archived only the call's creator may change\nit and the API answers 403 otherwise.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `shared` | `boolean` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### timelinePage()\n\n> **timelinePage**(`selection?`): `Promise`\\<\\{ `entries`: (\\{ `activity`: \\{ `action`: `string`; `actor`: [`User`](../../../users/user/classes/User.md); `actor_id`: `string`; `id`: `string`; `occurred_at`: `string`; `payload?`: `unknown`; \\}; `message?`: `undefined`; `type`: `\"activity\"`; \\} \\| \\{ `activity?`: `undefined`; `message`: [`CallMessage`](../../message/classes/CallMessage.md); `type`: `\"message\"`; \\})[]; `nextCursor`: [`MessageCursor`](../../../../../generated/storage/types.gen/type-aliases/MessageCursor.md) \\| `undefined`; `previousCursor`: [`MessageCursor`](../../../../../generated/storage/types.gen/type-aliases/MessageCursor.md) \\| `undefined`; \\}\\>\n\nA mixed message and activity timeline page.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selection?` | [`TimelineOptions`](../../../messages/thread/interfaces/TimelineOptions.md)\\<[`CallMessage`](../../message/classes/CallMessage.md)\\> |\n\n#### Returns\n\n`Promise`\\<\\{ `entries`: (\\{ `activity`: \\{ `action`: `string`; `actor`: [`User`](../../../users/user/classes/User.md); `actor_id`: `string`; `id`: `string`; `occurred_at`: `string`; `payload?`: `unknown`; \\}; `message?`: `undefined`; `type`: `\"activity\"`; \\} \\| \\{ `activity?`: `undefined`; `message`: [`CallMessage`](../../message/classes/CallMessage.md); `type`: `\"message\"`; \\})[]; `nextCursor`: [`MessageCursor`](../../../../../generated/storage/types.gen/type-aliases/MessageCursor.md) \\| `undefined`; `previousCursor`: [`MessageCursor`](../../../../../generated/storage/types.gen/type-aliases/MessageCursor.md) \\| `undefined`; \\}\\>\n\n***\n\n### toggleTeamShare()\n\n> **toggleTeamShare**(): `Promise`\\<`boolean`\\>\n\nToggle the server's share-with-team setting and return its new value.\n\n#### Returns\n\n`Promise`\\<`boolean`\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`CallRecord`](../../../../../generated/storage/types.gen/type-aliases/CallRecord.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`CallRecord`](../../../../../generated/storage/types.gen/type-aliases/CallRecord.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`CallRecord`](../../../../../generated/storage/types.gen/type-aliases/CallRecord.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`FavoritableEntity`](../../../entity/classes/FavoritableEntity.md).[`toJSON`](../../../entity/classes/FavoritableEntity.md#tojson)\n\n***\n\n### unfavorite()\n\n> **unfavorite**(): `Promise`\\<`CallRecord`\\>\n\nRemove this entity from the user's favorites. Returns this handle for chaining.\n\n#### Returns\n\n`Promise`\\<`CallRecord`\\>\n\n#### Inherited from\n\n[`FavoritableEntity`](../../../entity/classes/FavoritableEntity.md).[`unfavorite`](../../../entity/classes/FavoritableEntity.md#unfavorite)\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`): `CallRecord`\n\nA handle to a call record by id. Details load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n\n#### Returns\n\n`CallRecord`\n\n\n<!-- src/entities/calls/message/classes/CallMessage.md -->\n# Class: CallMessage\n\nA message in a call's single persistent chat thread.\n\n## Extends\n\n- [`MacroEntity`](../../../entity/classes/MacroEntity.md)\\<[`Message`](../../../../../generated/storage/types.gen/type-aliases/Message.md)\\>\n\n## Properties\n\n| Property | Modifier | Type | Description | Inherited from |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-callid\"></a> `callId` | `readonly` | `string` | - | - |\n| <a id=\"property-content\"></a> `content` | `readonly` | () => `Promise`\\<`string`\\> | The message body (markdown). | - |\n| <a id=\"property-createdat\"></a> `createdAt` | `readonly` | () => `Promise`\\<`string`\\> | When the message was created. | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | - | [`MacroEntity`](../../../entity/classes/MacroEntity.md).[`id`](../../../entity/classes/MacroEntity.md#property-id) |\n| <a id=\"property-updatedat\"></a> `updatedAt` | `readonly` | () => `Promise`\\<`string`\\> | When the message was last updated. | - |\n\n## Methods\n\n### author()\n\n> **author**(): `Promise`\\<[`User`](../../../users/user/classes/User.md)\\>\n\nThe user who sent this message.\n\n#### Returns\n\n`Promise`\\<[`User`](../../../users/user/classes/User.md)\\>\n\n***\n\n### call()\n\n> **call**(): [`CallRecord`](../../call-record/classes/CallRecord.md)\n\nThe call whose chat contains this message.\n\n#### Returns\n\n[`CallRecord`](../../call-record/classes/CallRecord.md)\n\n***\n\n### delete()\n\n> **delete**(): `Promise`\\<`void`\\>\n\nDelete this message, preserving the rest of the call's chat.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### edit()\n\n> **edit**(`body`): `Promise`\\<`CallMessage`\\>\n\nReplace this message's body.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `body` | `string` \\| [`RichMessage`](../../../../mentions/interfaces/RichMessage.md) |\n\n#### Returns\n\n`Promise`\\<`CallMessage`\\>\n\n***\n\n### reply()\n\n> **reply**(`body`): `Promise`\\<`CallMessage`\\>\n\nReply in the call's canonical thread, including when this is a reply.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `body` | `string` \\| [`RichMessage`](../../../../mentions/interfaces/RichMessage.md) |\n\n#### Returns\n\n`Promise`\\<`CallMessage`\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`Message`](../../../../../generated/storage/types.gen/type-aliases/Message.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`Message`](../../../../../generated/storage/types.gen/type-aliases/Message.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`Message`](../../../../../generated/storage/types.gen/type-aliases/Message.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`MacroEntity`](../../../entity/classes/MacroEntity.md).[`toJSON`](../../../entity/classes/MacroEntity.md#tojson)\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `callId`, `id`): `CallMessage`\n\nA handle to a message by id. Fields load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `callId` | `string` |\n| `id` | `string` |\n\n#### Returns\n\n`CallMessage`\n\n***\n\n### from()\n\n> `static` **from**(`client`, `callId`, `record`): `CallMessage`\n\nBuild a message from its record without another fetch.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `callId` | `string` |\n| `record` | [`Message`](../../../../../generated/storage/types.gen/type-aliases/Message.md) |\n\n#### Returns\n\n`CallMessage`\n\n\n<!-- src/entities/calls/namespace/classes/CallRecordNamespace.md -->\n# Class: CallRecordNamespace\n\n## Constructors\n\n### Constructor\n\n> **new CallRecordNamespace**(`client`): `CallRecordNamespace`\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n\n#### Returns\n\n`CallRecordNamespace`\n\n## Methods\n\n### byId()\n\n> **byId**(`id`): [`CallRecord`](../../call-record/classes/CallRecord.md)\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`CallRecord`](../../call-record/classes/CallRecord.md)\n\n***\n\n### search()\n\n> **search**(`query`, `opts?`): `AsyncGenerator`\\<[`CallRecord`](../../call-record/classes/CallRecord.md)\\>\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `query` | `string` |\n| `opts?` | [`SearchOpts`](../../../search/interfaces/SearchOpts.md) |\n\n#### Returns\n\n`AsyncGenerator`\\<[`CallRecord`](../../call-record/classes/CallRecord.md)\\>\n"
+ "documentation": "# Macro SDK: calls\n\nGenerated by TypeDoc. Paths below refer to the canonical Markdown hierarchy. Other entity handles are documented in their named section; request core for shared SDK helpers.\n\n<!-- generated/storage/types.gen/type-aliases/AccessLevel.md -->\n# Type Alias: AccessLevel\n\n> **AccessLevel** = `\"view\"` \\| `\"comment\"` \\| `\"edit\"` \\| `\"owner\"`\n\nOrdered from least to most access top -> bottom\n\n\n<!-- generated/storage/types.gen/type-aliases/BotSenderProfile.md -->\n# Type Alias: BotSenderProfile\n\n> **BotSenderProfile** = \\{ `avatar_url?`: `string` \\| `null`; `name`: `string`; \\}\n\nPublic bot profile attached to bot-authored messages.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-avatar_url\"></a> `avatar_url?` | `string` \\| `null` | Bot avatar URL. |\n| <a id=\"property-name\"></a> `name` | `string` | Bot display name. |\n\n\n<!-- generated/storage/types.gen/type-aliases/CallRecord.md -->\n# Type Alias: CallRecord\n\n> **CallRecord** = \\{ `callId`: `string`; `channelId?`: `string` \\| `null`; `channelName?`: `string` \\| `null`; `createdBy`: `string`; `customName?`: `string` \\| `null`; `durationMs?`: `number` \\| `null`; `egressId?`: `string` \\| `null`; `endedAt?`: `string` \\| `null`; `guests`: [`CallRecordGuest`](CallRecordGuest.md)[]; `isActive`: `boolean`; `participants`: [`CallRecordParticipant`](CallRecordParticipant.md)[]; `recordingPreviewUrl?`: `string` \\| `null`; `recordingStartedAt?`: `string` \\| `null`; `recordingUrl?`: `string` \\| `null`; `roomName?`: `string` \\| `null`; `shareWithTeam`: `boolean`; `source?`: `null` \\| [`CallRecordSource`](CallRecordSource.md); `startedAt`: `string`; `status?`: `null` \\| [`CallStatus`](CallStatus.md); `summary?`: `string` \\| `null`; `teamShareAccessLevel?`: `null` \\| [`AccessLevel`](AccessLevel.md); `transcript`: [`CallRecordTranscriptSegment`](CallRecordTranscriptSegment.md)[]; `userAccessLevel?`: `null` \\| [`AccessLevel`](AccessLevel.md); `viewerHasDeclined?`: `boolean`; \\}\n\nFull record of a call, unifying rows from `calls` (active) and\n`call_records` (archived) into a single response shape.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-callid\"></a> `callId` | `string` | The call identifier. |\n| <a id=\"property-channelid\"></a> `channelId?` | `string` \\| `null` | The channel this call belongs to. |\n| <a id=\"property-channelname\"></a> `channelName?` | `string` \\| `null` | Resolved display name for the channel. |\n| <a id=\"property-createdby\"></a> `createdBy` | `string` | User who created the call. |\n| <a id=\"property-customname\"></a> `customName?` | `string` \\| `null` | User-supplied or AI-generated display name for the call. Only set on archived `call_records`; active calls always return `None`. |\n| <a id=\"property-durationms\"></a> `durationMs?` | `number` \\| `null` | Call duration in milliseconds (None if still active). |\n| <a id=\"property-egressid\"></a> `egressId?` | `string` \\| `null` | Recording egress ID, if any. |\n| <a id=\"property-endedat\"></a> `endedAt?` | `string` \\| `null` | When the call ended (None if still active). |\n| <a id=\"property-guests\"></a> `guests` | [`CallRecordGuest`](CallRecordGuest.md)[] | Non-account guests (both active and historic). Guests only ever exist on standalone meeting calls, never on channel calls. |\n| <a id=\"property-isactive\"></a> `isActive` | `boolean` | Whether the call is currently active (from `calls` table). |\n| <a id=\"property-participants\"></a> `participants` | [`CallRecordParticipant`](CallRecordParticipant.md)[] | Macro-account participants (both active and historic). |\n| <a id=\"property-recordingpreviewurl\"></a> `recordingPreviewUrl?` | `string` \\| `null` | Presigned URL for the call recording preview image, if available. |\n| <a id=\"property-recordingstartedat\"></a> `recordingStartedAt?` | `string` \\| `null` | When the egress recording actually began. `None` until the `egress_started` webhook arrives (typically a few seconds after `started_at`). Frontend should anchor transcript-to-audio sync to this value when present, falling back to `started_at` otherwise. |\n| <a id=\"property-recordingurl\"></a> `recordingUrl?` | `string` \\| `null` | Presigned URL for the call recording, if available. |\n| <a id=\"property-roomname\"></a> `roomName?` | `string` \\| `null` | The RTC room name. `None` for imported calls, which never had a room. |\n| <a id=\"property-sharewithteam\"></a> `shareWithTeam` | `boolean` | Whether the call is shared with the creator's team. While the call is live this is the pending toggle applied at archive; afterwards it mirrors `team_share_access_level`. |\n| <a id=\"property-source\"></a> `source?` | `null` \\| [`CallRecordSource`](CallRecordSource.md) | - |\n| <a id=\"property-startedat\"></a> `startedAt` | `string` | When the call started (created_at for active, started_at for archived). |\n| <a id=\"property-status\"></a> `status?` | `null` \\| [`CallStatus`](CallStatus.md) | - |\n| <a id=\"property-summary\"></a> `summary?` | `string` \\| `null` | AI-generated summary of the call. Only set on archived `call_records` once summarization has run; active calls always return `None`. |\n| <a id=\"property-teamshareaccesslevel\"></a> `teamShareAccessLevel?` | `null` \\| [`AccessLevel`](AccessLevel.md) | - |\n| <a id=\"property-transcript\"></a> `transcript` | [`CallRecordTranscriptSegment`](CallRecordTranscriptSegment.md)[] | Transcript segments ordered by `sequence_num`. |\n| <a id=\"property-useraccesslevel\"></a> `userAccessLevel?` | `null` \\| [`AccessLevel`](AccessLevel.md) | - |\n| <a id=\"property-viewerhasdeclined\"></a> `viewerHasDeclined?` | `boolean` | Whether the authenticated viewer has declined this call on any device. Set on the single-record read so clients that missed `call_declined` can still stop ringing via reconciliation; `false` in list contexts. |\n\n\n<!-- generated/storage/types.gen/type-aliases/CallRecordGuest.md -->\n# Type Alias: CallRecordGuest\n\n> **CallRecordGuest** = \\{ `displayName`: `string`; `id`: [`GuestId`](GuestId.md); `joinedAt`: `string`; `leftAt?`: `string` \\| `null`; \\}\n\nA non-account guest as returned in a [`CallRecord`].\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-displayname\"></a> `displayName` | `string` | Guest-provided display name. |\n| <a id=\"property-id\"></a> `id` | [`GuestId`](GuestId.md) | Opaque guest identity; matches the guest's transcript `speaker_id`. |\n| <a id=\"property-joinedat\"></a> `joinedAt` | `string` | When the guest joined the call. |\n| <a id=\"property-leftat\"></a> `leftAt?` | `string` \\| `null` | When the guest left (None if still in an active call). |\n\n\n<!-- generated/storage/types.gen/type-aliases/CallRecordParticipant.md -->\n# Type Alias: CallRecordParticipant\n\n> **CallRecordParticipant** = \\{ `joinedAt`: `string`; `leftAt?`: `string` \\| `null`; `userId`: `string`; \\}\n\nA participant as returned in a [`CallRecord`] (historic — includes `left_at`).\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-joinedat\"></a> `joinedAt` | `string` | When the user joined the call. |\n| <a id=\"property-leftat\"></a> `leftAt?` | `string` \\| `null` | When the user left (None if still in an active call). |\n| <a id=\"property-userid\"></a> `userId` | `string` | The Macro user id. |\n\n\n<!-- generated/storage/types.gen/type-aliases/CallRecordSource.md -->\n# Type Alias: CallRecordSource\n\n> **CallRecordSource** = \\{ `externalUrl?`: `string` \\| `null`; `provider`: `string`; \\}\n\nWhere an imported call came from.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-externalurl\"></a> `externalUrl?` | `string` \\| `null` | Link to the call in the provider's app, if it has one. |\n| <a id=\"property-provider\"></a> `provider` | `string` | Provider slug, e.g. `granola`. |\n\n\n<!-- generated/storage/types.gen/type-aliases/CallRecordTranscriptSegment.md -->\n# Type Alias: CallRecordTranscriptSegment\n\n> **CallRecordTranscriptSegment** = \\{ `content`: `string`; `diarizedSpeakerId?`: `string` \\| `null`; `endedAt?`: `string` \\| `null`; `segmentId?`: `string` \\| `null`; `sequenceNum`: `number`; `speakerId`: `string`; `startedAt`: `string`; `transcriptId`: `string`; \\}\n\nA transcript segment as returned in a [`CallRecord`].\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-content\"></a> `content` | `string` | The transcribed text content. |\n| <a id=\"property-diarizedspeakerid\"></a> `diarizedSpeakerId?` | `string` \\| `null` | Stable per-speaker identifier produced by the STT provider's diarization pass. Unique across tracks in the call. `None` when the provider didn't return a speaker label. |\n| <a id=\"property-endedat\"></a> `endedAt?` | `string` \\| `null` | When the speaker stopped (if known). |\n| <a id=\"property-segmentid\"></a> `segmentId?` | `string` \\| `null` | LiveKit segment ID (nullable for archived records). |\n| <a id=\"property-sequencenum\"></a> `sequenceNum` | `number` | Ordering within the call. |\n| <a id=\"property-speakerid\"></a> `speakerId` | `string` | The speaker's user ID. |\n| <a id=\"property-startedat\"></a> `startedAt` | `string` | When the speaker started this segment. |\n| <a id=\"property-transcriptid\"></a> `transcriptId` | `string` | Stable DB-row id for the segment. |\n\n\n<!-- generated/storage/types.gen/type-aliases/CallStatus.md -->\n# Type Alias: CallStatus\n\n> **CallStatus** = `\"ATTENDED\"` \\| `\"MISSED\"` \\| `\"UNATTENDED\"`\n\nViewer-relative attendance status for a call record.\nSerializes as `ATTENDED`, `MISSED`, or `UNATTENDED`.\n\n\n<!-- generated/storage/types.gen/type-aliases/CountedReaction.md -->\n# Type Alias: CountedReaction\n\n> **CountedReaction** = \\{ `emoji`: `string`; `users`: `string`[]; \\}\n\nReaction emoji and the users who added it.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-emoji\"></a> `emoji` | `string` | Emoji being reacted with. |\n| <a id=\"property-users\"></a> `users` | `string`[] | User identifiers. |\n\n\n<!-- generated/storage/types.gen/type-aliases/CustomSpeakerAssignment.md -->\n# Type Alias: CustomSpeakerAssignment\n\n> **CustomSpeakerAssignment** = \\{ `customSpeaker`: `string`; `diarizedSpeakerId`: `string`; \\}\n\nOne per-diarized-speaker override, used in [`EditCallTranscriptRequest`].\n\n`custom_speaker = None` clears any existing override for this\n`diarized_speaker_id`; `Some(macro_user_id)` sets it. The string is\nexpected to parse as a `MacroUserId` (e.g. `macro|[email protected]`);\nthe service layer rejects malformed values with `400 Bad Request`.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-customspeaker\"></a> `customSpeaker` | `string` | Macro user id to attribute matching rows to, or `None` to clear. |\n| <a id=\"property-diarizedspeakerid\"></a> `diarizedSpeakerId` | `string` | The diarization label whose rows this assignment targets. |\n\n\n<!-- generated/storage/types.gen/type-aliases/DocumentId.md -->\n# Type Alias: DocumentId\n\n> **DocumentId** = `string`\n\nA validated document identifier. Historical document ids need not be UUIDs.\n\n\n<!-- generated/storage/types.gen/type-aliases/EntityPermission.md -->\n# Type Alias: EntityPermission\n\n> **EntityPermission** = \\{ `access_level`: [`AccessLevel`](AccessLevel.md); `type`: `\"access_level\"`; \\} \\| \\{ `type`: `\"channel_view_only\"`; \\} \\| \\{ `role`: [`ParticipantRole`](ParticipantRole.md); `type`: `\"channel_role\"`; \\} \\| \\{ `role`: [`TeamRole`](TeamRole.md); `type`: `\"team_role\"`; \\}\n\nA user's permission for an entity, discriminated by entity kind.\n\nItems (documents, chats, projects, threads) use access levels.\nChannels use view-only permission or participant roles.\n\n## Union Members\n\n### Type Literal\n\n\\{ `access_level`: [`AccessLevel`](AccessLevel.md); `type`: `\"access_level\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `access_level` | [`AccessLevel`](AccessLevel.md) | The access level the user has. |\n| `type` | `\"access_level\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `type`: `\"channel_view_only\"`; \\}\n\n***\n\n### Type Literal\n\n\\{ `role`: [`ParticipantRole`](ParticipantRole.md); `type`: `\"channel_role\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `role` | [`ParticipantRole`](ParticipantRole.md) | The role the user has in the channel. |\n| `type` | `\"channel_role\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `role`: [`TeamRole`](TeamRole.md); `type`: `\"team_role\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `role` | [`TeamRole`](TeamRole.md) | The role the user has in the team. |\n| `type` | `\"team_role\"` | - |\n\n\n<!-- generated/storage/types.gen/type-aliases/GuestId.md -->\n# Type Alias: GuestId\n\n> **GuestId** = `string`\n\nA non-account guest of a single call session.\n\nThe id doubles as the guest's RTC participant identity, so identities are\nopaque UUIDs and never share a namespace (or a column) with Macro user\nids. Only the server mints them; Macro users keep `macro|…` identities,\nso an RTC identity classifies as exactly one of the two.\n\n\n<!-- generated/storage/types.gen/type-aliases/ImportedAuthor.md -->\n# Type Alias: ImportedAuthor\n\n> **ImportedAuthor** = \\{ `name`: `string`; \\}\n\nDisplay attribution for a comment imported from an external document.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-name\"></a> `name` | `string` | Original author text; never interpreted as an authenticated principal. |\n\n\n<!-- generated/storage/types.gen/type-aliases/Message.md -->\n# Type Alias: Message\n\n> **Message** = \\{ `attachments`: [`MessageAttachment`](MessageAttachment.md)[]; `bot_profile?`: `null` \\| [`BotSenderProfile`](BotSenderProfile.md); `content`: `string`; `created_at`: `string`; `deleted_at?`: `string` \\| `null`; `edited_at?`: `string` \\| `null`; `guest_name?`: `string` \\| `null`; `id`: `string`; `imported_author?`: `null` \\| [`ImportedAuthor`](ImportedAuthor.md); `mentions`: [`SimpleMention`](SimpleMention.md)[]; `parent`: [`MessageParent`](MessageParent.md); `reactions`: [`CountedReaction`](CountedReaction.md)[]; `sender_id`: `string`; `thread_id?`: `string` \\| `null`; `triggered_by?`: `string` \\| `null`; `updated_at`: `string`; \\}\n\nShared message representation for channel timelines and entity discussions.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-attachments\"></a> `attachments` | [`MessageAttachment`](MessageAttachment.md)[] | Attached entities. |\n| <a id=\"property-bot_profile\"></a> `bot_profile?` | `null` \\| [`BotSenderProfile`](BotSenderProfile.md) | - |\n| <a id=\"property-content\"></a> `content` | `string` | Macro Markdown body. |\n| <a id=\"property-created_at\"></a> `created_at` | `string` | Creation time. |\n| <a id=\"property-deleted_at\"></a> `deleted_at?` | `string` \\| `null` | Message tombstone, independent of thread deletion. |\n| <a id=\"property-edited_at\"></a> `edited_at?` | `string` \\| `null` | Last content edit, if any. |\n| <a id=\"property-guest_name\"></a> `guest_name?` | `string` \\| `null` | Display name of a verified call guest, retained after the call ends. |\n| <a id=\"property-id\"></a> `id` | `string` | Message UUID. |\n| <a id=\"property-imported_author\"></a> `imported_author?` | `null` \\| [`ImportedAuthor`](ImportedAuthor.md) | - |\n| <a id=\"property-mentions\"></a> `mentions` | [`SimpleMention`](SimpleMention.md)[] | Tracked mentions, retained when a caller changes attachments only. |\n| <a id=\"property-parent\"></a> `parent` | [`MessageParent`](MessageParent.md) | Entity that owns this conversation. |\n| <a id=\"property-reactions\"></a> `reactions` | [`CountedReaction`](CountedReaction.md)[] | Aggregated reactions. |\n| <a id=\"property-sender_id\"></a> `sender_id` | `string` | Authenticated actor or owner of imported content. |\n| <a id=\"property-thread_id\"></a> `thread_id?` | `string` \\| `null` | Root message UUID for replies; absent on roots. |\n| <a id=\"property-triggered_by\"></a> `triggered_by?` | `string` \\| `null` | User who triggered a bot-authored message. |\n| <a id=\"property-updated_at\"></a> `updated_at` | `string` | Last persisted update. |\n\n\n<!-- generated/storage/types.gen/type-aliases/MessageAttachment.md -->\n# Type Alias: MessageAttachment\n\n> **MessageAttachment** = \\{ `created_at`: `string`; `entity_id`: `string`; `entity_type`: `string`; `height?`: `number` \\| `null`; `id`: `string`; `width?`: `number` \\| `null`; \\}\n\nAn entity attached to a message.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-created_at\"></a> `created_at` | `string` | When the attachment was added. |\n| <a id=\"property-entity_id\"></a> `entity_id` | `string` | Attached entity identifier. |\n| <a id=\"property-entity_type\"></a> `entity_type` | `string` | Attached entity type. |\n| <a id=\"property-height\"></a> `height?` | `number` \\| `null` | Optional media height. |\n| <a id=\"property-id\"></a> `id` | `string` | Attachment UUID. |\n| <a id=\"property-width\"></a> `width?` | `number` \\| `null` | Optional media width. |\n\n\n<!-- generated/storage/types.gen/type-aliases/MessageCursor.md -->\n# Type Alias: MessageCursor\n\n> **MessageCursor** = \\{ `created_at`: `string`; `id`: `string`; \\}\n\nCursor for a chronological parent timeline.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-created_at\"></a> `created_at` | `string` | Last message creation time or activity occurrence time. |\n| <a id=\"property-id\"></a> `id` | `string` | Last entry UUID, used to break timestamp ties across both sources. |\n\n\n<!-- generated/storage/types.gen/type-aliases/MessageParent.md -->\n# Type Alias: MessageParent\n\n> **MessageParent** = \\{ `id`: `string`; `type`: `\"channel\"`; \\} \\| \\{ `id`: [`DocumentId`](DocumentId.md); `type`: `\"document\"`; \\} \\| \\{ `id`: `string`; `type`: `\"initiative\"`; \\} \\| \\{ `id`: `string`; `type`: `\"crm_company\"`; \\} \\| \\{ `id`: `string`; `type`: `\"crm_contact\"`; \\} \\| \\{ `id`: `string`; `type`: `\"call\"`; \\}\n\nThe entity whose permissions and lifecycle govern a message.\n\n## Union Members\n\n### Type Literal\n\n\\{ `id`: `string`; `type`: `\"channel\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `id` | `string` | A channel, including direct messages. |\n| `type` | `\"channel\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `id`: [`DocumentId`](DocumentId.md); `type`: `\"document\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `id` | [`DocumentId`](DocumentId.md) | A document, including tasks and PDFs. |\n| `type` | `\"document\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `id`: `string`; `type`: `\"initiative\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `id` | `string` | An initiative, presented as a project in the application. |\n| `type` | `\"initiative\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `id`: `string`; `type`: `\"crm_company\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `id` | `string` | A CRM company. |\n| `type` | `\"crm_company\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `id`: `string`; `type`: `\"crm_contact\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `id` | `string` | A CRM contact. |\n| `type` | `\"crm_contact\"` | - |\n\n***\n\n### Type Literal\n\n\\{ `id`: `string`; `type`: `\"call\"`; \\}\n\n| Name | Type | Description |\n| ------ | ------ | ------ |\n| `id` | `string` | A video call and its persistent chat thread. |\n| `type` | `\"call\"` | - |\n\n\n<!-- generated/storage/types.gen/type-aliases/ParticipantRole.md -->\n# Type Alias: ParticipantRole\n\n> **ParticipantRole** = `\"owner\"` \\| `\"admin\"` \\| `\"member\"`\n\nThe role a user has within a channel.\n\n\n<!-- generated/storage/types.gen/type-aliases/SimpleMention.md -->\n# Type Alias: SimpleMention\n\n> **SimpleMention** = \\{ `entity_id`: `string`; `entity_type`: `string`; \\}\n\nA mention tracked in a message body.\n\n## Properties\n\n| Property | Type | Description |\n| ------ | ------ | ------ |\n| <a id=\"property-entity_id\"></a> `entity_id` | `string` | Mentioned entity identifier. |\n| <a id=\"property-entity_type\"></a> `entity_type` | `string` | Mentioned entity type. |\n\n\n<!-- generated/storage/types.gen/type-aliases/TeamRole.md -->\n# Type Alias: TeamRole\n\n> **TeamRole** = `\"member\"` \\| `\"admin\"` \\| `\"owner\"`\n\nThe role a user has within a team.\n\nOrdered least to most privileged so comparisons reflect access strength.\n\n\n<!-- src/entities/calls/call-record/classes/CallRecord.md -->\n# Class: CallRecord\n\nA Macro call record (an archived or still active call).\n\n## Extends\n\n- [`FavoritableEntity`](../../../entity/classes/FavoritableEntity.md)\\<`CallRecordDetail`\\>\n\n## Properties\n\n| Property | Modifier | Type | Default value | Description | Overrides | Inherited from |\n| ------ | ------ | ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-access\"></a> `access` | `readonly` | [`EntityAccess`](../../../sharing/access/classes/EntityAccess.md) | `...` | Access requests and direct user grants. | - | - |\n| <a id=\"property-channel\"></a> `channel` | `readonly` | () => `Promise`\\<[`Channel`](../../../channels/channel/classes/Channel.md) \\| `undefined`\\> | `...` | The channel the call belongs to, if it is a channel call. | - | - |\n| <a id=\"property-channelname\"></a> `channelName` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | The display name of the channel the call belongs to. | - | - |\n| <a id=\"property-creator\"></a> `creator` | `readonly` | () => `Promise`\\<[`User`](../../../users/user/classes/User.md)\\> | `...` | The user who started the call. | - | - |\n| <a id=\"property-durationms\"></a> `durationMs` | `readonly` | () => `Promise`\\<`number` \\| `undefined`\\> | `...` | Call duration in milliseconds (undefined if still active). | - | - |\n| <a id=\"property-endedat\"></a> `endedAt` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | When the call ended (undefined if still active). | - | - |\n| <a id=\"property-entitytype\"></a> `entityType` | `readonly` | `\"call\"` | `'call'` | Favorites identify call records as `call`. | [`FavoritableEntity`](../../../entity/classes/FavoritableEntity.md).[`entityType`](../../../entity/classes/FavoritableEntity.md#property-entitytype) | - |\n| <a id=\"property-guests\"></a> `guests` | `readonly` | () => `Promise`\\<[`CallRecordGuest`](../../../../../generated/storage/types.gen/type-aliases/CallRecordGuest.md)[]\\> | `...` | Current and past guests; each id matches its transcript speaker id. | - | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | `undefined` | - | - | [`FavoritableEntity`](../../../entity/classes/FavoritableEntity.md).[`id`](../../../entity/classes/FavoritableEntity.md#property-id) |\n| <a id=\"property-isactive\"></a> `isActive` | `readonly` | () => `Promise`\\<`boolean`\\> | `...` | Whether the call is still in progress. | - | - |\n| <a id=\"property-name\"></a> `name` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | The call's display name (user-supplied or AI-generated; unset while active). | - | - |\n| <a id=\"property-participants\"></a> `participants` | `readonly` | () => `Promise`\\<[`CallRecordParticipant`](../../../../../generated/storage/types.gen/type-aliases/CallRecordParticipant.md)[]\\> | `...` | Macro-account participants, both active and historic. | - | - |\n| <a id=\"property-recordingpreviewurl\"></a> `recordingPreviewUrl` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | URL of the recording preview (thumbnail), once available. | - | - |\n| <a id=\"property-recordingstartedat\"></a> `recordingStartedAt` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | When the recording started, if it was recorded. | - | - |\n| <a id=\"property-recordingurl\"></a> `recordingUrl` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | URL of the call recording, once available. | - | - |\n| <a id=\"property-roomname\"></a> `roomName` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | The realtime room the call runs in. | - | - |\n| <a id=\"property-sharewithteam\"></a> `shareWithTeam` | `readonly` | () => `Promise`\\<`boolean`\\> | `...` | Whether the call is shared with the creator's team: the pending toggle while the call is live, the canonical grant once it is archived. | - | - |\n| <a id=\"property-startedat\"></a> `startedAt` | `readonly` | () => `Promise`\\<`string`\\> | `...` | When the call started. | - | - |\n| <a id=\"property-status\"></a> `status` | `readonly` | () => `Promise`\\<`NonNullable`\\<CallStatus \\| null \\| undefined\\> \\| `undefined`\\> | `...` | The call's status (undefined until set). | - | - |\n| <a id=\"property-summary\"></a> `summary` | `readonly` | () => `Promise`\\<`string` \\| `undefined`\\> | `...` | AI-generated summary of the call, once summarization has run. | - | - |\n| <a id=\"property-teamshareaccesslevel\"></a> `teamShareAccessLevel` | `readonly` | () => `Promise`\\<`NonNullable`\\<AccessLevel \\| null \\| undefined\\> \\| `undefined`\\> | `...` | The canonical access level granted to the creator's team once the call is archived, or null when it is not shared. Calls only ever grant `'view'`; while the call is live this is null and [CallRecord.shareWithTeam](#property-sharewithteam) carries the pending toggle. | - | - |\n| <a id=\"property-transcript\"></a> `transcript` | `readonly` | () => `Promise`\\<[`CallRecordTranscriptSegment`](../../../../../generated/storage/types.gen/type-aliases/CallRecordTranscriptSegment.md)[]\\> | `...` | Transcript segments, ordered by sequence number. | - | - |\n| <a id=\"property-search\"></a> `search` | `static` | (`client`, `query`, `searchOpts?`) => `AsyncGenerator`\\<`CallRecord`\\> | `...` | Search calls by name and transcript, most relevant first, auto-paginated. | - | - |\n\n## Methods\n\n### delete()\n\n> **delete**(): `Promise`\\<`void`\\>\n\nDelete the call record.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### editTranscript()\n\n> **editTranscript**(`assignments`): `Promise`\\<`void`\\>\n\nUpdate custom speaker assignments in the transcript.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `assignments` | [`CustomSpeakerAssignment`](../../../../../generated/storage/types.gen/type-aliases/CustomSpeakerAssignment.md)[] |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### favorite()\n\n> **favorite**(): `Promise`\\<`CallRecord`\\>\n\nAdd this entity to the user's favorites. Returns this handle for chaining.\nPlain unwrap: favoriting alters the user's favorites collection, not this\nentity's own detail, so there's nothing cached to invalidate.\n\n#### Returns\n\n`Promise`\\<`CallRecord`\\>\n\n#### Inherited from\n\n[`FavoritableEntity`](../../../entity/classes/FavoritableEntity.md).[`favorite`](../../../entity/classes/FavoritableEntity.md#favorite)\n\n***\n\n### meeting()\n\n> **meeting**(): `Promise`\\<[`Meeting`](../../../meetings/meeting/classes/Meeting.md)\\>\n\nGet or create a shareable meeting for this call.\n\n#### Returns\n\n`Promise`\\<[`Meeting`](../../../meetings/meeting/classes/Meeting.md)\\>\n\n***\n\n### message()\n\n> **message**(`id`): [`CallMessage`](../../message/classes/CallMessage.md)\n\nA message in this call's persistent chat. Fields load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`CallMessage`](../../message/classes/CallMessage.md)\n\n***\n\n### messageThreadById()\n\n> **messageThreadById**(`id`): [`MessageThread`](../../../messages/thread/classes/MessageThread.md)\n\nA shared message thread scoped to this resource.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`MessageThread`](../../../messages/thread/classes/MessageThread.md)\n\n***\n\n### permission()\n\n> **permission**(): `Promise`\\<\\{ `permission`: [`EntityPermission`](../../../../../generated/storage/types.gen/type-aliases/EntityPermission.md); `status`: `\"access\"`; \\} \\| \\{ `status`: `\"no_access\"`; \\}\\>\n\nRead the caller's effective permission on this entity.\n\n#### Returns\n\n`Promise`\\<\\{ `permission`: [`EntityPermission`](../../../../../generated/storage/types.gen/type-aliases/EntityPermission.md); `status`: `\"access\"`; \\} \\| \\{ `status`: `\"no_access\"`; \\}\\>\n\n#### Inherited from\n\n[`FavoritableEntity`](../../../entity/classes/FavoritableEntity.md).[`permission`](../../../entity/classes/FavoritableEntity.md#permission)\n\n***\n\n### rename()\n\n> **rename**(`name`): `Promise`\\<`void`\\>\n\nRename the call or clear the custom name.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `name` | `string` \\| `null` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### setTeamShare()\n\n> **setTeamShare**(`shared`): `Promise`\\<`void`\\>\n\nShare the call with the creator's team (view access), or unshare it.\nWhile the call is live this sets the pending toggle any participant with\nedit access may change; once archived only the call's creator may change\nit and the API answers 403 otherwise.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `shared` | `boolean` |\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### timelinePage()\n\n> **timelinePage**(`selection?`): `Promise`\\<\\{ `entries`: (\\{ `activity`: \\{ `action`: `string`; `actor`: [`User`](../../../users/user/classes/User.md); `actor_id`: `string`; `id`: `string`; `occurred_at`: `string`; `payload?`: `unknown`; \\}; `message?`: `undefined`; `type`: `\"activity\"`; \\} \\| \\{ `activity?`: `undefined`; `message`: [`CallMessage`](../../message/classes/CallMessage.md); `type`: `\"message\"`; \\})[]; `nextCursor`: [`MessageCursor`](../../../../../generated/storage/types.gen/type-aliases/MessageCursor.md) \\| `undefined`; `previousCursor`: [`MessageCursor`](../../../../../generated/storage/types.gen/type-aliases/MessageCursor.md) \\| `undefined`; \\}\\>\n\nA mixed message and activity timeline page.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `selection?` | [`TimelineOptions`](../../../messages/thread/interfaces/TimelineOptions.md)\\<[`CallMessage`](../../message/classes/CallMessage.md)\\> |\n\n#### Returns\n\n`Promise`\\<\\{ `entries`: (\\{ `activity`: \\{ `action`: `string`; `actor`: [`User`](../../../users/user/classes/User.md); `actor_id`: `string`; `id`: `string`; `occurred_at`: `string`; `payload?`: `unknown`; \\}; `message?`: `undefined`; `type`: `\"activity\"`; \\} \\| \\{ `activity?`: `undefined`; `message`: [`CallMessage`](../../message/classes/CallMessage.md); `type`: `\"message\"`; \\})[]; `nextCursor`: [`MessageCursor`](../../../../../generated/storage/types.gen/type-aliases/MessageCursor.md) \\| `undefined`; `previousCursor`: [`MessageCursor`](../../../../../generated/storage/types.gen/type-aliases/MessageCursor.md) \\| `undefined`; \\}\\>\n\n***\n\n### toggleTeamShare()\n\n> **toggleTeamShare**(): `Promise`\\<`boolean`\\>\n\nToggle the server's share-with-team setting and return its new value.\n\n#### Returns\n\n`Promise`\\<`boolean`\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`CallRecord`](../../../../../generated/storage/types.gen/type-aliases/CallRecord.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`CallRecord`](../../../../../generated/storage/types.gen/type-aliases/CallRecord.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`CallRecord`](../../../../../generated/storage/types.gen/type-aliases/CallRecord.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`FavoritableEntity`](../../../entity/classes/FavoritableEntity.md).[`toJSON`](../../../entity/classes/FavoritableEntity.md#tojson)\n\n***\n\n### unfavorite()\n\n> **unfavorite**(): `Promise`\\<`CallRecord`\\>\n\nRemove this entity from the user's favorites. Returns this handle for chaining.\n\n#### Returns\n\n`Promise`\\<`CallRecord`\\>\n\n#### Inherited from\n\n[`FavoritableEntity`](../../../entity/classes/FavoritableEntity.md).[`unfavorite`](../../../entity/classes/FavoritableEntity.md#unfavorite)\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `id`): `CallRecord`\n\nA handle to a call record by id. Details load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `id` | `string` |\n\n#### Returns\n\n`CallRecord`\n\n\n<!-- src/entities/calls/message/classes/CallMessage.md -->\n# Class: CallMessage\n\nA message in a call's single persistent chat thread.\n\n## Extends\n\n- [`MacroEntity`](../../../entity/classes/MacroEntity.md)\\<[`Message`](../../../../../generated/storage/types.gen/type-aliases/Message.md)\\>\n\n## Properties\n\n| Property | Modifier | Type | Description | Inherited from |\n| ------ | ------ | ------ | ------ | ------ |\n| <a id=\"property-callid\"></a> `callId` | `readonly` | `string` | - | - |\n| <a id=\"property-content\"></a> `content` | `readonly` | () => `Promise`\\<`string`\\> | The message body (markdown). | - |\n| <a id=\"property-createdat\"></a> `createdAt` | `readonly` | () => `Promise`\\<`string`\\> | When the message was created. | - |\n| <a id=\"property-id\"></a> `id` | `public readonly` | `string` | - | [`MacroEntity`](../../../entity/classes/MacroEntity.md).[`id`](../../../entity/classes/MacroEntity.md#property-id) |\n| <a id=\"property-updatedat\"></a> `updatedAt` | `readonly` | () => `Promise`\\<`string`\\> | When the message was last updated. | - |\n\n## Methods\n\n### author()\n\n> **author**(): `Promise`\\<[`User`](../../../users/user/classes/User.md)\\>\n\nThe user who sent this message.\n\n#### Returns\n\n`Promise`\\<[`User`](../../../users/user/classes/User.md)\\>\n\n***\n\n### call()\n\n> **call**(): [`CallRecord`](../../call-record/classes/CallRecord.md)\n\nThe call whose chat contains this message.\n\n#### Returns\n\n[`CallRecord`](../../call-record/classes/CallRecord.md)\n\n***\n\n### delete()\n\n> **delete**(): `Promise`\\<`void`\\>\n\nDelete this message, preserving the rest of the call's chat.\n\n#### Returns\n\n`Promise`\\<`void`\\>\n\n***\n\n### edit()\n\n> **edit**(`body`): `Promise`\\<`CallMessage`\\>\n\nReplace this message's body.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `body` | `string` \\| [`RichMessage`](../../../../mentions/interfaces/RichMessage.md) |\n\n#### Returns\n\n`Promise`\\<`CallMessage`\\>\n\n***\n\n### reply()\n\n> **reply**(`body`): `Promise`\\<`CallMessage`\\>\n\nReply in the call's canonical thread, including when this is a reply.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `body` | `string` \\| [`RichMessage`](../../../../mentions/interfaces/RichMessage.md) |\n\n#### Returns\n\n`Promise`\\<`CallMessage`\\>\n\n***\n\n### toJSON()\n\n> **toJSON**(): \\{ `detail?`: [`Message`](../../../../../generated/storage/types.gen/type-aliases/Message.md); `id`: `string`; \\}\n\n#### Returns\n\n\\{ `detail?`: [`Message`](../../../../../generated/storage/types.gen/type-aliases/Message.md); `id`: `string`; \\}\n\n| Name | Type |\n| ------ | ------ |\n| `detail?` | [`Message`](../../../../../generated/storage/types.gen/type-aliases/Message.md) |\n| `id` | `string` |\n\n#### Inherited from\n\n[`MacroEntity`](../../../entity/classes/MacroEntity.md).[`toJSON`](../../../entity/classes/MacroEntity.md#tojson)\n\n***\n\n### byId()\n\n> `static` **byId**(`client`, `callId`, `id`): `CallMessage`\n\nA handle to a message by id. Fields load on first access.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `callId` | `string` |\n| `id` | `string` |\n\n#### Returns\n\n`CallMessage`\n\n***\n\n### from()\n\n> `static` **from**(`client`, `callId`, `record`): `CallMessage`\n\nBuild a message from its record without another fetch.\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n| `callId` | `string` |\n| `record` | [`Message`](../../../../../generated/storage/types.gen/type-aliases/Message.md) |\n\n#### Returns\n\n`CallMessage`\n\n\n<!-- src/entities/calls/namespace/classes/CallRecordNamespace.md -->\n# Class: CallRecordNamespace\n\n## Constructors\n\n### Constructor\n\n> **new CallRecordNamespace**(`client`): `CallRecordNamespace`\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `client` | `MacroClient` |\n\n#### Returns\n\n`CallRecordNamespace`\n\n## Methods\n\n### byId()\n\n> **byId**(`id`): [`CallRecord`](../../call-record/classes/CallRecord.md)\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `id` | `string` |\n\n#### Returns\n\n[`CallRecord`](../../call-record/classes/CallRecord.md)\n\n***\n\n### search()\n\n> **search**(`query`, `opts?`): `AsyncGenerator`\\<[`CallRecord`](../../call-record/classes/CallRecord.md)\\>\n\n#### Parameters\n\n| Parameter | Type |\n| ------ | ------ |\n| `query` | `string` |\n| `opts?` | [`SearchOpts`](../../../search/interfaces/SearchOpts.md) |\n\n#### Returns\n\n`AsyncGenerator`\\<[`CallRecord`](../../call-record/classes/CallRecord.md)\\>\n"
},
{
"name": "channels",
diff --git a/crates/call/fixtures/import_users.sql b/crates/call/fixtures/import_users.sql
new file mode 100644
index 0000000000..fe4d990528
--- /dev/null
+++ b/crates/call/fixtures/import_users.sql
@@ -0,0 +1,6 @@
+INSERT INTO macro_user (id, username, email, stripe_customer_id) VALUES
+('019a0000-0000-7000-8000-000000000001', 'import-a', '[email protected]', 'import-a'),
+('019a0000-0000-7000-8000-000000000002', 'import-b', '[email protected]', 'import-b');
+INSERT INTO "User" (id, email, macro_user_id) VALUES
+('macro|[email protected]', '[email protected]', '019a0000-0000-7000-8000-000000000001'),
+('macro|[email protected]', '[email protected]', '019a0000-0000-7000-8000-000000000002');
diff --git a/crates/call/src/domain/imports.rs b/crates/call/src/domain/imports.rs
new file mode 100644
index 0000000000..60fd295bf9
--- /dev/null
+++ b/crates/call/src/domain/imports.rs
@@ -0,0 +1,105 @@
+//! Trusted integration entry point. Import ownership comes from the connected
+//! Macro user, never from provider attendees; imports confer no attendee access.
+use super::records::{CallEntityRecord, CallParticipant, CallSource, CallTranscript};
+use async_trait::async_trait;
+use chrono::{DateTime, Utc};
+use macro_user_id::user_id::MacroUserIdStr;
+use serde::Serialize;
+use uuid::Uuid;
+
+/// A complete provider snapshot. Native room state is deliberately absent.
+pub struct ImportedCall {
+ /// Authenticated import provenance and revision.
+ pub source: CallSource,
+ /// Provider title.
+ pub title: Option<String>,
+ /// Observed conversation start; calendar schedule is source metadata.
+ pub started_at: Option<DateTime<Utc>>,
+ /// Observed conversation end.
+ pub ended_at: Option<DateTime<Utc>>,
+ /// Provider attendees, without inferred Macro identities or attendance.
+ pub participants: Vec<CallParticipant>,
+ /// Available transcript, independent of recordings.
+ pub transcript: Option<CallTranscript>,
+}
+
+/// Compact owner-scoped discovery for imported call records.
+#[derive(Debug, Serialize)]
+#[serde(rename_all = "camelCase")]
+pub struct ImportedCallPreview {
+ /// Macro call entity ID.
+ pub id: Uuid,
+ /// Display title.
+ pub title: Option<String>,
+ /// Observed call time, if available.
+ pub started_at: Option<DateTime<Utc>>,
+ /// Time this record entered Macro.
+ pub created_at: DateTime<Utc>,
+}
+
+/// Owning persistence boundary for imported call entities and resources.
+#[async_trait]
+pub trait ImportedCallRepository: Send + Sync {
+ /// Atomically insert or update by the complete source identity and revision.
+ async fn upsert(&self, call: ImportedCall) -> Result<Uuid, rootcause::Report>;
+ /// List recent records owned by this user, bounded by the service.
+ async fn list_owned(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ ) -> Result<Vec<ImportedCallPreview>, rootcause::Report>;
+ /// Read only when the user owns the imported call.
+ async fn read_owned(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ id: Uuid,
+ ) -> Result<Option<CallEntityRecord>, rootcause::Report>;
+}
+
+/// Domain service used by trusted integrations and authenticated owner reads.
+#[async_trait]
+pub trait CallImportService: Send + Sync {
+ /// Persist an imported snapshot with private owner-only initial access.
+ async fn ingest(&self, call: ImportedCall) -> Result<Uuid, rootcause::Report>;
+ /// List the caller's imported calls.
+ async fn list(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ ) -> Result<Vec<ImportedCallPreview>, rootcause::Report>;
+ /// Read the caller's imported call; other owners' records are invisible.
+ async fn read(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ id: Uuid,
+ ) -> Result<Option<CallEntityRecord>, rootcause::Report>;
+}
+
+/// Validates provider snapshots before passing them to persistence.
+pub struct CallImportServiceImpl<R>(pub R);
+
+#[async_trait]
+impl<R: ImportedCallRepository> CallImportService for CallImportServiceImpl<R> {
+ async fn ingest(&self, call: ImportedCall) -> Result<Uuid, rootcause::Report> {
+ if call.source.namespace.trim().is_empty() || call.source.object_type.trim().is_empty() {
+ return Err(rootcause::report!(
+ "an import requires a scoped source identity"
+ ));
+ }
+ if matches!((call.started_at, call.ended_at), (Some(start), Some(end)) if end < start) {
+ return Err(rootcause::report!("reversed imported call timing"));
+ }
+ self.0.upsert(call).await
+ }
+ async fn list(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ ) -> Result<Vec<ImportedCallPreview>, rootcause::Report> {
+ self.0.list_owned(user).await
+ }
+ async fn read(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ id: Uuid,
+ ) -> Result<Option<CallEntityRecord>, rootcause::Report> {
+ self.0.read_owned(user, id).await
+ }
+}
diff --git a/crates/call/src/domain/mod.rs b/crates/call/src/domain/mod.rs
index 605547250c..3952b56288 100644
--- a/crates/call/src/domain/mod.rs
+++ b/crates/call/src/domain/mod.rs
@@ -23,3 +23,7 @@ pub mod meetings;
/// Provider-independent durable call entities and optional resources.
pub mod records;
+
+/// Authorized ingestion and owner-scoped reads of imported calls.
+#[cfg(feature = "ports")]
+pub mod imports;
diff --git a/crates/call/src/domain/models.rs b/crates/call/src/domain/models.rs
index fa1f7cdaf3..dab9643314 100644
--- a/crates/call/src/domain/models.rs
+++ b/crates/call/src/domain/models.rs
@@ -471,8 +471,8 @@ pub struct CallRecord {
pub call_id: Uuid,
/// The channel this call belongs to.
pub channel_id: Option<Uuid>,
- /// The RTC room name.
- pub room_name: String,
+ /// The RTC room name. `None` for imported calls, which never had a room.
+ pub room_name: Option<String>,
/// User who created the call.
pub created_by: String,
/// When the call started (created_at for active, started_at for archived).
@@ -536,6 +536,20 @@ pub struct CallRecord {
pub guests: Vec<CallRecordGuest>,
/// Transcript segments ordered by `sequence_num`.
pub transcript: Vec<CallRecordTranscriptSegment>,
+ /// External provenance for calls imported from another provider; `None`
+ /// for calls recorded in Macro.
+ pub source: Option<CallRecordSource>,
+}
+
+/// Where an imported call came from.
+#[derive(Debug, Clone, serde::Serialize)]
+#[cfg_attr(feature = "inbound", derive(utoipa::ToSchema))]
+#[serde(rename_all = "camelCase")]
+pub struct CallRecordSource {
+ /// Provider slug, e.g. `granola`.
+ pub provider: String,
+ /// Link to the call in the provider's app, if it has one.
+ pub external_url: Option<String>,
}
/// Storage object keys associated with a deleted archived call record.
diff --git a/crates/call/src/domain/service/meetings.rs b/crates/call/src/domain/service/meetings.rs
index 49f73e812b..92ad141fa5 100644
--- a/crates/call/src/domain/service/meetings.rs
+++ b/crates/call/src/domain/service/meetings.rs
@@ -42,7 +42,7 @@ impl<
.map_err(|e| CallError::Internal(e.into()))?;
if let Some(record) = record
&& record.channel_id.is_none()
- && record.room_name == room_name
+ && record.room_name.as_deref() == Some(room_name)
{
self.repo
.attach_meeting_recording(&call_id, egress_id)
diff --git a/crates/call/src/domain/service/test.rs b/crates/call/src/domain/service/test.rs
index 31f9f02bd4..008205e068 100644
--- a/crates/call/src/domain/service/test.rs
+++ b/crates/call/src/domain/service/test.rs
@@ -1541,7 +1541,7 @@ fn call_record_for_mutation() -> CallRecord {
CallRecord {
call_id: MUTATED_EVENT_CALL_ID,
channel_id: Some(MUTATED_EVENT_CHANNEL_ID),
- room_name: "mutation-event-room".to_string(),
+ room_name: Some("mutation-event-room".to_string()),
created_by: "macro|[email protected]".to_string(),
started_at: archived_event_started_at(),
ended_at: Some(archived_event_ended_at()),
@@ -1564,6 +1564,7 @@ fn call_record_for_mutation() -> CallRecord {
participants: Vec::new(),
guests: Vec::new(),
transcript: Vec::new(),
+ source: None,
}
}
@@ -2684,7 +2685,7 @@ fn summarized_call_record(custom_name: Option<&str>) -> CallRecord {
CallRecord {
call_id: SUMMARIZED_EVENT_CALL_ID,
channel_id: Some(SUMMARIZED_EVENT_CHANNEL_ID),
- room_name: SUMMARIZED_EVENT_CHANNEL_ID.to_string(),
+ room_name: Some(SUMMARIZED_EVENT_CHANNEL_ID.to_string()),
created_by: "macro|[email protected]".to_string(),
started_at: started_event_timestamp(),
ended_at: Some(started_event_timestamp()),
@@ -2716,6 +2717,7 @@ fn summarized_call_record(custom_name: Option<&str>) -> CallRecord {
ended_at: Some(started_event_timestamp()),
sequence_num: 1,
}],
+ source: None,
}
}
diff --git a/crates/call/src/domain/service/test/meeting_startup.rs b/crates/call/src/domain/service/test/meeting_startup.rs
index e7af2d04de..b9e298d4cd 100644
--- a/crates/call/src/domain/service/test/meeting_startup.rs
+++ b/crates/call/src/domain/service/test/meeting_startup.rs
@@ -363,11 +363,11 @@ async fn recording_webhook_can_link_before_the_startup_response() {
let mut record = standalone_record(false);
let call_id = record.call_id;
let room_name = call_id.to_string();
- record.room_name = if correct_room {
+ record.room_name = Some(if correct_room {
room_name.clone()
} else {
"different-room".to_string()
- };
+ });
let mut repo = MockCallRepository::new();
repo.expect_get_call_record_by_call_id()
.times(1)
diff --git a/crates/call/src/outbound/mod.rs b/crates/call/src/outbound/mod.rs
index 8af1bd792d..c37699a06e 100644
--- a/crates/call/src/outbound/mod.rs
+++ b/crates/call/src/outbound/mod.rs
@@ -4,6 +4,8 @@ pub mod ai_call_summarizer;
pub mod livekit_rtc_client;
/// Postgres-backed repository implementing [`CallRepository`](crate::domain::ports::CallRepository).
pub mod pg_call_repo;
+/// Atomic import persistence and owner-scoped reads.
+pub mod pg_imported_call_repo;
/// Postgres-backed repository implementing [`VoiceRepository`](crate::domain::ports::VoiceRepository).
pub mod pg_voice_repo;
/// S3-backed recording storage implementing [`RecordingStorage`](crate::domain::ports::RecordingStorage).
diff --git a/crates/call/src/outbound/pg_call_repo.rs b/crates/call/src/outbound/pg_call_repo.rs
index 295b47721e..2ab296a439 100644
--- a/crates/call/src/outbound/pg_call_repo.rs
+++ b/crates/call/src/outbound/pg_call_repo.rs
@@ -1,6 +1,7 @@
//! Postgres-backed repository for call state.
mod edit;
+mod imported;
mod lifecycle;
mod meetings;
mod preparations;
@@ -1347,7 +1348,7 @@ impl CallRepository for PgCallRepo {
call_id: active.id,
user_access_level: None,
channel_id: active.channel_id,
- room_name: active.room_name,
+ room_name: Some(active.room_name),
created_by: active.created_by,
started_at: active.created_at,
ended_at: None,
@@ -1371,6 +1372,7 @@ impl CallRepository for PgCallRepo {
participants,
guests,
transcript,
+ source: None,
}));
}
@@ -1388,8 +1390,10 @@ impl CallRepository for PgCallRepo {
.fetch_optional(&mut *tx)
.await?
else {
+ // Imported calls never had a room, so they live only in `call_entities`.
+ let imported = imported::read_imported_call_record(&mut tx, call_id).await?;
tx.commit().await?;
- return Ok(None);
+ return Ok(imported);
};
let participants = sqlx::query!(
@@ -1460,7 +1464,7 @@ impl CallRepository for PgCallRepo {
call_id: archived.id,
user_access_level: None,
channel_id: archived.channel_id,
- room_name: archived.room_name,
+ room_name: Some(archived.room_name),
created_by: archived.created_by,
started_at: archived.started_at,
ended_at: Some(archived.ended_at),
@@ -1482,6 +1486,7 @@ impl CallRepository for PgCallRepo {
participants,
guests,
transcript,
+ source: None,
}))
}
@@ -1637,6 +1642,7 @@ impl CallRepository for PgCallRepo {
c.share_with_team,
sp.team_share_access_level,
true AS is_active,
+ false AS is_imported,
CASE
WHEN EXISTS (
SELECT 1 FROM call_participants cp
@@ -1707,6 +1713,7 @@ impl CallRepository for PgCallRepo {
(sp.team_share_access_level IS NOT NULL) AS share_with_team,
sp.team_share_access_level,
false AS is_active,
+ false AS is_imported,
CASE
WHEN EXISTS (
SELECT 1 FROM call_record_participants crp
@@ -1759,11 +1766,76 @@ impl CallRepository for PgCallRepo {
)
)
)
+ UNION ALL
+ -- Imported calls (e.g. Granola) exist only as call entities;
+ -- native calls are mirrored there too, so exclude them.
+ SELECT
+ ce.id AS call_id,
+ ce.channel_id,
+ NULL::text AS room_name,
+ ce.user_id AS created_by,
+ COALESCE(ce.started_at, ce.created_at) AS started_at,
+ ce.ended_at,
+ ce.duration_ms,
+ NULL::text AS egress_id,
+ NULL::text AS recording_key,
+ NULL::text AS preview_url,
+ NULL::timestamptz AS recording_started_at,
+ ce.title AS custom_name,
+ (
+ SELECT s.metadata ->> 'summary' FROM call_entity_sources s
+ WHERE s.call_id = ce.id
+ ORDER BY s.synced_at DESC NULLS LAST
+ LIMIT 1
+ ) AS summary,
+ (sp.team_share_access_level IS NOT NULL) AS share_with_team,
+ sp.team_share_access_level,
+ false AS is_active,
+ true AS is_imported,
+ -- The importer was in the meeting; everyone else only
+ -- sees it when shared, so it is not theirs to attend.
+ CASE WHEN ce.user_id = $1 THEN 'ATTENDED'::text ELSE 'UNATTENDED'::text END AS status
+ FROM call_entities ce
+ JOIN "SharePermission" sp ON sp.id = ce.share_permission_id
+ WHERE ce.created_via <> 'native'
+ AND EXISTS (
+ SELECT 1 FROM entity_access ea
+ JOIN user_source_ids u ON u.source_id = ea.source_id
+ WHERE ea.entity_id = ce.id
+ AND ea.entity_type = 'call'
+ AND (ce.channel_id IS NOT NULL OR (ea.source_type = 'user' AND ea.source_id = $1))
+ )
+ AND ($3::bool IS FALSE OR ce.channel_id = ANY($4))
+ AND ($5::bool IS FALSE OR ce.id = ANY($6))
+ AND NOT EXISTS (
+ SELECT 1
+ FROM generate_series(0, $9::int - 1) AS clause(idx)
+ WHERE NOT EXISTS (
+ SELECT 1
+ FROM UNNEST($10::int[], $11::bool[], $12::uuid[], $13::text[])
+ AS term(clause_idx, negated, definition_id, value)
+ WHERE term.clause_idx = clause.idx
+ AND term.negated <> EXISTS (
+ SELECT 1 FROM entity_properties ep
+ WHERE ep.entity_id = ce.id::text
+ AND ep.entity_type = 'CALL_RECORD'
+ AND jsonb_typeof(ep.values -> 'value') = 'array'
+ AND CASE
+ WHEN term.definition_id IS NULL
+ THEN jsonb_exists(ep.values -> 'value', term.value)
+ ELSE ep.property_definition_id = term.definition_id
+ AND ep.values -> 'value' @> jsonb_build_array(
+ jsonb_build_object('entity_id', term.value)
+ )
+ END
+ )
+ )
+ )
)
SELECT
call_id as "call_id!",
channel_id as "channel_id?",
- room_name as "room_name!",
+ room_name,
created_by as "created_by!",
started_at as "started_at!",
ended_at,
@@ -1777,6 +1849,7 @@ impl CallRepository for PgCallRepo {
share_with_team as "share_with_team!",
team_share_access_level as "team_share_access_level?: AccessLevel",
is_active as "is_active!",
+ is_imported as "is_imported!",
status as "status!"
FROM visible_calls
WHERE ($7::bool IS FALSE OR status = ANY($8::text[]))
@@ -1820,8 +1893,11 @@ impl CallRepository for PgCallRepo {
// in one round-trip; we then group by id in memory (avoids N+1).
let mut active_ids: Vec<Uuid> = Vec::new();
let mut archived_ids: Vec<Uuid> = Vec::new();
+ let mut imported_ids: Vec<Uuid> = Vec::new();
for row in &rows {
- if row.is_active {
+ if row.is_imported {
+ imported_ids.push(row.call_id);
+ } else if row.is_active {
active_ids.push(row.call_id);
} else {
archived_ids.push(row.call_id);
@@ -1888,6 +1964,10 @@ impl CallRepository for PgCallRepo {
});
}
+ let mut conn = self.pool.acquire().await?;
+ guests_by_call.extend(imported::imported_guests(&mut conn, &imported_ids).await?);
+ drop(conn);
+
let mut records = Vec::with_capacity(rows.len());
for row in rows {
let participants = participants_by_call
@@ -1921,6 +2001,7 @@ impl CallRepository for PgCallRepo {
participants,
guests,
transcript: Vec::new(),
+ source: None,
});
}
diff --git a/crates/call/src/outbound/pg_call_repo/imported.rs b/crates/call/src/outbound/pg_call_repo/imported.rs
new file mode 100644
index 0000000000..ca0a6c72ec
--- /dev/null
+++ b/crates/call/src/outbound/pg_call_repo/imported.rs
@@ -0,0 +1,183 @@
+//! Reads for calls that exist only as `call_entities` rows (Granola and other
+//! imports). They never had an RTC room, so they have no `calls` or
+//! `call_records` row; native calls are mirrored into `call_entities` too and
+//! are excluded here by `created_via`.
+
+use std::collections::HashMap;
+
+use chrono::Duration;
+use entity_access::domain::models::AccessLevel;
+use sqlx::PgConnection;
+use uuid::Uuid;
+
+use crate::domain::meetings::GuestId;
+use crate::domain::models::{
+ CallRecord, CallRecordGuest, CallRecordSource, CallRecordTranscriptSegment,
+};
+
+/// Imported attendees, shown as guests: they carry provider identity hints
+/// (name, email) but never a Macro account.
+pub(super) async fn imported_guests(
+ conn: &mut PgConnection,
+ call_ids: &[Uuid],
+) -> Result<HashMap<Uuid, Vec<CallRecordGuest>>, sqlx::Error> {
+ let mut guests: HashMap<Uuid, Vec<CallRecordGuest>> = HashMap::new();
+ if call_ids.is_empty() {
+ return Ok(guests);
+ }
+ for row in sqlx::query!(
+ r#"
+ SELECT p.call_id, p.id, p.display_name, p.email,
+ COALESCE(ce.started_at, ce.created_at) AS "joined_at!",
+ ce.ended_at
+ FROM call_entity_participants p
+ JOIN call_entities ce ON ce.id = p.call_id
+ WHERE p.call_id = ANY($1)
+ ORDER BY p.call_id, p.id
+ "#,
+ call_ids,
+ )
+ .fetch_all(conn)
+ .await?
+ {
+ guests
+ .entry(row.call_id)
+ .or_default()
+ .push(CallRecordGuest {
+ id: GuestId::from_uuid(row.id),
+ display_name: row
+ .display_name
+ .or(row.email)
+ .unwrap_or_else(|| "Participant".into()),
+ joined_at: row.joined_at,
+ left_at: row.ended_at,
+ });
+ }
+ Ok(guests)
+}
+
+/// Full record for an imported call, or `None` when `call_id` is not one.
+pub(super) async fn read_imported_call_record(
+ conn: &mut PgConnection,
+ call_id: &Uuid,
+) -> Result<Option<CallRecord>, sqlx::Error> {
+ let Some(call) = sqlx::query!(
+ r#"
+ SELECT ce.id, ce.user_id, ce.title, ce.started_at, ce.ended_at, ce.duration_ms, ce.created_at,
+ sp.team_share_access_level AS "team_share_access_level?: AccessLevel",
+ src.provider AS "provider?", src.external_url, src.metadata ->> 'summary' AS summary
+ FROM call_entities ce
+ JOIN "SharePermission" sp ON sp.id = ce.share_permission_id
+ LEFT JOIN LATERAL (
+ SELECT provider, external_url, metadata
+ FROM call_entity_sources
+ WHERE call_id = ce.id
+ ORDER BY synced_at DESC NULLS LAST
+ LIMIT 1
+ ) src ON true
+ WHERE ce.id = $1 AND ce.created_via <> 'native'
+ "#,
+ call_id,
+ )
+ .fetch_optional(&mut *conn)
+ .await?
+ else {
+ return Ok(None);
+ };
+
+ let started_at = call.started_at.unwrap_or(call.created_at);
+ let guests = imported_guests(&mut *conn, &[call.id])
+ .await?
+ .remove(&call.id)
+ .unwrap_or_default();
+
+ let segments = sqlx::query!(
+ r#"
+ SELECT s.transcript_id, s.sequence_num, s.participant_id, s.speaker_label, s.content,
+ s.start_ms, s.end_ms, t.started_at AS transcript_started_at
+ FROM call_entity_transcript_segments s
+ JOIN call_entity_transcripts t ON t.call_id = s.call_id AND t.id = s.transcript_id
+ WHERE s.call_id = $1
+ ORDER BY t.started_at NULLS LAST, t.id, s.sequence_num
+ "#,
+ call_id,
+ )
+ .fetch_all(&mut *conn)
+ .await?;
+
+ let transcript = segments
+ .into_iter()
+ .enumerate()
+ .map(|(index, s)| {
+ let origin = s.transcript_started_at.unwrap_or(started_at);
+ let at = |ms: i64| origin + Duration::milliseconds(ms);
+ CallRecordTranscriptSegment {
+ // Segments have a composite key; derive a stable per-segment id
+ // so transcript deep links can target one.
+ transcript_id: Uuid::new_v5(&s.transcript_id, &s.sequence_num.to_be_bytes()),
+ segment_id: None,
+ speaker_id: imported_speaker_id(&guests, s.participant_id, s.speaker_label),
+ diarized_speaker_id: None,
+ content: s.content,
+ started_at: s.start_ms.map(at).unwrap_or(origin),
+ ended_at: s.end_ms.map(at),
+ // Renumber across transcripts; the UI keys rows by this.
+ sequence_num: index as i32,
+ }
+ })
+ .collect();
+
+ Ok(Some(CallRecord {
+ call_id: call.id,
+ user_access_level: None,
+ channel_id: None,
+ room_name: None,
+ created_by: call.user_id,
+ started_at,
+ ended_at: call.ended_at,
+ duration_ms: call.duration_ms,
+ egress_id: None,
+ recording_started_at: None,
+ recording_key: None,
+ preview_key: None,
+ recording_url: None,
+ recording_preview_url: None,
+ channel_name: None,
+ custom_name: call.title,
+ summary: call.summary,
+ share_with_team: call.team_share_access_level.is_some(),
+ team_share_access_level: call.team_share_access_level,
+ is_active: false,
+ status: None,
+ // Imports never ring, so there is nothing to decline.
+ viewer_has_declined: false,
+ participants: Vec::new(),
+ guests,
+ transcript,
+ source: call.provider.map(|provider| CallRecordSource {
+ provider,
+ external_url: call.external_url,
+ }),
+ }))
+}
+
+/// Attribute a segment to an attendee when the provider linked one or the
+/// label names one; otherwise keep the provider's label so the UI shows it.
+fn imported_speaker_id(
+ guests: &[CallRecordGuest],
+ participant_id: Option<Uuid>,
+ speaker_label: Option<String>,
+) -> String {
+ if let Some(id) = participant_id {
+ return GuestId::from_uuid(id).to_string();
+ }
+ let label = speaker_label.unwrap_or_else(|| "Unknown speaker".into());
+ guests
+ .iter()
+ .find(|g| g.display_name.eq_ignore_ascii_case(&label))
+ .map(|g| g.id.to_string())
+ .unwrap_or(label)
+}
+
+#[cfg(test)]
+mod test;
diff --git a/crates/call/src/outbound/pg_call_repo/imported/test.rs b/crates/call/src/outbound/pg_call_repo/imported/test.rs
new file mode 100644
index 0000000000..c1c6ff1ffc
--- /dev/null
+++ b/crates/call/src/outbound/pg_call_repo/imported/test.rs
@@ -0,0 +1,180 @@
+use std::sync::Arc;
+
+use chrono::{Duration, TimeZone, Utc};
+use filter_ast::Expr;
+use item_filters::{
+ CallStatus,
+ ast::{LiteralTree, call::CallLiteral},
+};
+use macro_db_migrator::MACRO_DB_MIGRATIONS;
+use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
+use serde_json::json;
+use sqlx::{Pool, Postgres};
+use uuid::Uuid;
+
+use crate::domain::imports::{ImportedCall, ImportedCallRepository};
+use crate::domain::models::CallRecordPage;
+use crate::domain::ports::CallRepository;
+use crate::domain::records::*;
+use crate::outbound::pg_call_repo::PgCallRepo;
+use crate::outbound::pg_imported_call_repo::PgImportedCallRepository;
+
+const LATEST_FIRST: CallRecordPage = CallRecordPage {
+ by_start: false,
+ after: None,
+};
+
+fn user(name: &str) -> MacroUserIdStr<'static> {
+ MacroUserIdStr::parse_from_str(&format!("macro|{name}@test.com"))
+ .unwrap()
+ .into_owned()
+}
+
+fn granola_meeting(owner: &str) -> ImportedCall {
+ let attendee = macro_uuid::generate_uuid_v7();
+ let started_at = Utc.with_ymd_and_hms(2026, 10, 15, 18, 54, 0).unwrap();
+ ImportedCall {
+ title: Some("Design review".into()),
+ started_at: Some(started_at),
+ ended_at: Some(started_at + Duration::minutes(3)),
+ participants: vec![CallParticipant {
+ id: attendee,
+ user_id: None,
+ display_name: Some("Ada".into()),
+ email: Some("[email protected]".into()),
+ phone: None,
+ external_id: None,
+ attendance: vec![],
+ }],
+ transcript: Some(CallTranscript {
+ id: macro_uuid::generate_uuid_v7(),
+ recording_id: None,
+ language: None,
+ provider: Some(CallProvider::Granola),
+ started_at: Some(started_at),
+ segments: vec![
+ CallTranscriptSegment {
+ sequence_num: 0,
+ participant_id: None,
+ speaker_label: Some("Ada".into()),
+ content: "Ship it".into(),
+ start_ms: Some(0),
+ end_ms: Some(1_000),
+ },
+ CallTranscriptSegment {
+ sequence_num: 1,
+ participant_id: None,
+ speaker_label: Some("Someone else".into()),
+ content: "Agreed".into(),
+ start_ms: Some(2_000),
+ end_ms: None,
+ },
+ ],
+ }),
+ source: CallSource {
+ user_id: user(owner),
+ namespace: "account".into(),
+ provider: CallProvider::Granola,
+ object_type: "note".into(),
+ external_id: "not_123456789abcde".to_owned().try_into().unwrap(),
+ external_url: Some("https://notes.granola.ai/d/abc".into()),
+ external_updated_at: Some(started_at),
+ synced_at: None,
+ metadata: serde_json::from_value(json!({"summary": "We shipped it"})).unwrap(),
+ },
+ }
+}
+
+fn status_filter(status: CallStatus) -> LiteralTree<CallLiteral> {
+ Some(Arc::new(Expr::Literal(CallLiteral::Status(status))))
+}
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(path = "../../../../fixtures", scripts("import_users"))
+)]
+async fn imported_calls_are_listed_for_their_owner(pool: Pool<Postgres>) -> anyhow::Result<()> {
+ let call_id = PgImportedCallRepository::new(pool.clone())
+ .upsert(granola_meeting("import-a"))
+ .await?;
+ let repo = PgCallRepo::new(pool);
+
+ let records = repo
+ .get_call_records_by_user(user("import-a").copied(), 10, &None, LATEST_FIRST)
+ .await?;
+ assert_eq!(records.len(), 1);
+ let record = &records[0];
+ assert_eq!(record.call_id, call_id);
+ assert_eq!(record.custom_name.as_deref(), Some("Design review"));
+ assert_eq!(record.summary.as_deref(), Some("We shipped it"));
+ assert_eq!(record.status, Some(CallStatus::Attended));
+ assert_eq!(record.room_name, None);
+ assert!(!record.is_active);
+ assert_eq!(record.duration_ms, Some(180_000));
+ assert_eq!(record.guests.len(), 1);
+ assert_eq!(record.guests[0].display_name, "Ada");
+
+ let unattended = repo
+ .get_call_records_by_user(
+ user("import-a").copied(),
+ 10,
+ &status_filter(CallStatus::Unattended),
+ LATEST_FIRST,
+ )
+ .await?;
+ assert!(unattended.is_empty());
+
+ let others = repo
+ .get_call_records_by_user(user("import-b").copied(), 10, &None, LATEST_FIRST)
+ .await?;
+ assert!(others.is_empty(), "imports are private to their owner");
+ Ok(())
+}
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(path = "../../../../fixtures", scripts("import_users"))
+)]
+async fn imported_call_record_reads_source_and_transcript(
+ pool: Pool<Postgres>,
+) -> anyhow::Result<()> {
+ let call_id = PgImportedCallRepository::new(pool.clone())
+ .upsert(granola_meeting("import-a"))
+ .await?;
+ let repo = PgCallRepo::new(pool);
+
+ let record = repo
+ .get_call_record_by_call_id(&call_id)
+ .await?
+ .expect("imported call should be readable");
+ assert_eq!(record.created_by, "macro|[email protected]");
+ assert_eq!(record.channel_id, None);
+ let source = record.source.expect("imported calls carry their source");
+ assert_eq!(source.provider, "granola");
+ assert_eq!(
+ source.external_url.as_deref(),
+ Some("https://notes.granola.ai/d/abc")
+ );
+ let guest_id = record.guests[0].id.to_string();
+ assert_eq!(record.transcript.len(), 2);
+ assert_eq!(
+ record.transcript[0].speaker_id, guest_id,
+ "label matches attendee"
+ );
+ assert_eq!(record.transcript[1].speaker_id, "Someone else");
+ assert_eq!(
+ record.transcript[1].started_at - record.transcript[0].started_at,
+ Duration::seconds(2)
+ );
+ assert_ne!(
+ record.transcript[0].transcript_id,
+ record.transcript[1].transcript_id
+ );
+
+ assert!(
+ repo.get_call_record_by_call_id(&Uuid::nil())
+ .await?
+ .is_none()
+ );
+ Ok(())
+}
diff --git a/crates/call/src/outbound/pg_imported_call_repo.rs b/crates/call/src/outbound/pg_imported_call_repo.rs
new file mode 100644
index 0000000000..5febfe1bcb
--- /dev/null
+++ b/crates/call/src/outbound/pg_imported_call_repo.rs
@@ -0,0 +1,210 @@
+//! Imported calls use durable entities, never synthetic RTC/archive rows.
+use crate::domain::{imports::*, records::*};
+use async_trait::async_trait;
+use entity_access_db_utils::{AccessLevel, EntityAccessSourceType, EntityType};
+use macro_user_id::user_id::MacroUserIdStr;
+use serde_json::json;
+use sqlx::PgPool;
+use uuid::Uuid;
+
+/// Transactional call-owned import storage.
+pub struct PgImportedCallRepository {
+ pool: PgPool,
+}
+impl PgImportedCallRepository {
+ /// Use the shared application database.
+ pub fn new(pool: PgPool) -> Self {
+ Self { pool }
+ }
+}
+
+#[async_trait]
+impl ImportedCallRepository for PgImportedCallRepository {
+ async fn upsert(&self, mut call: ImportedCall) -> Result<Uuid, rootcause::Report> {
+ let source = &call.source;
+ let provider = match source.provider {
+ CallProvider::Macro => "macro",
+ CallProvider::Granola => "granola",
+ };
+ let key = serde_json::to_string(&(
+ source.user_id.as_ref(),
+ &source.namespace,
+ provider,
+ &source.object_type,
+ source.external_id.as_ref(),
+ ))?;
+ let mut tx = self.pool.begin().await?;
+ sqlx::query!("SELECT pg_advisory_xact_lock(hashtextextended($1, 0))", key)
+ .execute(tx.as_mut())
+ .await?;
+ let existing = sqlx::query!(
+ r#"SELECT call_id, external_updated_at, metadata FROM call_entity_sources
+ WHERE user_id = $1 AND namespace = $2 AND provider = $3 AND object_type = $4 AND external_id = $5"#,
+ source.user_id.as_ref(), source.namespace, provider, source.object_type, source.external_id.as_ref()
+ ).fetch_optional(tx.as_mut()).await?;
+ if let Some(existing) = &existing
+ && matches!((source.external_updated_at, existing.external_updated_at), (Some(new), Some(old)) if new < old)
+ {
+ return Ok(existing.call_id);
+ }
+ let id = existing
+ .as_ref()
+ .map(|r| r.call_id)
+ .unwrap_or_else(macro_uuid::generate_uuid_v7);
+ let duration = call
+ .started_at
+ .zip(call.ended_at)
+ .map(|(s, e)| (e - s).num_milliseconds());
+ if existing.is_none() {
+ let share_id = macro_uuid::generate_uuid_v7().to_string();
+ share_permission_db_utils::create_private_share_permission(tx.as_mut(), &share_id)
+ .await?;
+ sqlx::query!(
+ r#"INSERT INTO call_entities (id, user_id, title, created_via, started_at, ended_at, duration_ms, share_permission_id)
+ VALUES ($1,$2,$3,'import',$4,$5,$6,$7)"#,
+ id, source.user_id.as_ref(), call.title, call.started_at, call.ended_at, duration, share_id
+ ).execute(tx.as_mut()).await?;
+ entity_access_db_utils::insert_entity_access_row(
+ &mut tx,
+ &id,
+ EntityType::Call,
+ source.user_id.as_ref(),
+ EntityAccessSourceType::User,
+ AccessLevel::Owner,
+ )
+ .await?;
+ } else {
+ let old_title = existing
+ .as_ref()
+ .and_then(|e| e.metadata.get("sourceTitle"))
+ .and_then(|v| v.as_str());
+ // Preserve a title edited in Macro instead of clobbering it on sync.
+ sqlx::query!(
+ r#"UPDATE call_entities SET title = CASE WHEN title IS NOT DISTINCT FROM $7 THEN $2 ELSE title END,
+ started_at = $3, ended_at = $4, duration_ms = $5, updated_at = now()
+ WHERE id = $1 AND user_id = $6"#,
+ id, call.title, call.started_at, call.ended_at, duration, source.user_id.as_ref(), old_title
+ ).execute(tx.as_mut()).await?;
+ }
+ // Keep call-local participant IDs stable across edits. These email values
+ // are provider identity hints only; they never create Macro-user grants.
+ let old_ids: Vec<Uuid> = existing
+ .as_ref()
+ .and_then(|e| e.metadata.get("participantIds"))
+ .map(|v| serde_json::from_value(v.clone()))
+ .transpose()?
+ .unwrap_or_default();
+ let previous = sqlx::query!(
+ "SELECT id, email FROM call_entity_participants WHERE call_id = $1 AND id = ANY($2)",
+ id,
+ &old_ids
+ )
+ .fetch_all(tx.as_mut())
+ .await?;
+ for participant in &mut call.participants {
+ if let Some(previous) = previous.iter().find(|p| {
+ p.email
+ .as_deref()
+ .zip(participant.email.as_deref())
+ .is_some_and(|(a, b)| a.eq_ignore_ascii_case(b))
+ }) {
+ participant.id = previous.id;
+ }
+ }
+ let participant_ids: Vec<Uuid> = call.participants.iter().map(|p| p.id).collect();
+ sqlx::query!("DELETE FROM call_entity_participants WHERE call_id = $1 AND id = ANY($2) AND NOT (id = ANY($3))", id, &old_ids, &participant_ids)
+ .execute(tx.as_mut()).await?;
+ let participants = serde_json::to_value(&call.participants)?;
+ sqlx::query!(
+ r#"INSERT INTO call_entity_participants (call_id, id, display_name, email)
+ SELECT $1, id, "displayName", email FROM jsonb_to_recordset($2::jsonb)
+ AS p(id uuid, "displayName" text, email text)
+ ON CONFLICT (call_id, id) DO UPDATE SET display_name = EXCLUDED.display_name, email = EXCLUDED.email"#,
+ id, participants
+ ).execute(tx.as_mut()).await?;
+ call.source
+ .metadata
+ .insert("participantIds".into(), json!(participant_ids));
+ let old_transcript_id: Option<Uuid> = existing
+ .as_ref()
+ .and_then(|e| e.metadata.get("transcriptId"))
+ .map(|v| serde_json::from_value(v.clone()))
+ .transpose()?;
+ if let Some(mut transcript) = call.transcript {
+ transcript.id = old_transcript_id.unwrap_or(transcript.id);
+ let transcript_id = transcript.id;
+ sqlx::query!(
+ r#"INSERT INTO call_entity_transcripts (call_id,id,provider,started_at)
+ VALUES ($1,$2,$3,$4) ON CONFLICT (call_id,id) DO UPDATE SET started_at = EXCLUDED.started_at"#,
+ id, transcript_id, provider, transcript.started_at
+ ).execute(tx.as_mut()).await?;
+ sqlx::query!("DELETE FROM call_entity_transcript_segments WHERE call_id = $1 AND transcript_id = $2", id, transcript_id)
+ .execute(tx.as_mut()).await?;
+ let segments = serde_json::to_value(transcript.segments)?;
+ sqlx::query!(
+ r#"INSERT INTO call_entity_transcript_segments (call_id,transcript_id,sequence_num,speaker_label,content,start_ms,end_ms)
+ SELECT $1,$2,"sequenceNum","speakerLabel",content,"startMs","endMs"
+ FROM jsonb_to_recordset($3::jsonb) AS s("sequenceNum" integer,"speakerLabel" text,content text,"startMs" bigint,"endMs" bigint)"#,
+ id, transcript_id, segments
+ ).execute(tx.as_mut()).await?;
+ call.source
+ .metadata
+ .insert("transcriptId".into(), json!(transcript_id));
+ } else if let Some(transcript_id) = old_transcript_id {
+ sqlx::query!(
+ "DELETE FROM call_entity_transcripts WHERE call_id = $1 AND id = $2",
+ id,
+ transcript_id
+ )
+ .execute(tx.as_mut())
+ .await?;
+ }
+ let metadata = json!(call.source.metadata);
+ sqlx::query!(
+ r#"INSERT INTO call_entity_sources (call_id,user_id,namespace,provider,object_type,external_id,external_url,external_updated_at,synced_at,metadata)
+ VALUES ($1,$2,$3,$4,$5,$6,$7,$8,now(),$9)
+ ON CONFLICT (user_id,namespace,provider,object_type,external_id) DO UPDATE SET
+ external_url = EXCLUDED.external_url, external_updated_at = EXCLUDED.external_updated_at,
+ synced_at = now(), metadata = EXCLUDED.metadata"#,
+ id, call.source.user_id.as_ref(), call.source.namespace, provider, call.source.object_type,
+ call.source.external_id.as_ref(), call.source.external_url, call.source.external_updated_at, metadata
+ ).execute(tx.as_mut()).await?;
+ tx.commit().await?;
+ Ok(id)
+ }
+
+ async fn list_owned(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ ) -> Result<Vec<ImportedCallPreview>, rootcause::Report> {
+ Ok(sqlx::query_as!(
+ ImportedCallPreview,
+ r#"SELECT id,title,started_at,created_at FROM call_entities
+ WHERE user_id = $1 AND created_via = 'import'
+ ORDER BY created_at DESC, id DESC LIMIT 100"#,
+ user.as_ref()
+ )
+ .fetch_all(&self.pool)
+ .await?)
+ }
+
+ async fn read_owned(
+ &self,
+ user: &MacroUserIdStr<'static>,
+ id: Uuid,
+ ) -> Result<Option<CallEntityRecord>, rootcause::Report> {
+ // One MVCC snapshot includes all children; no partially replaced transcript.
+ let row = sqlx::query_file!(
+ "src/outbound/pg_imported_call_repo/read.sql",
+ user.as_ref(),
+ id
+ )
+ .fetch_optional(&self.pool)
+ .await?;
+ row.map(|row| serde_json::from_value(row.record).map_err(rootcause::Report::from))
+ .transpose()
+ }
+}
+
+#[cfg(test)]
+mod test;
diff --git a/crates/call/src/outbound/pg_imported_call_repo/read.sql b/crates/call/src/outbound/pg_imported_call_repo/read.sql
new file mode 100644
index 0000000000..f51761802a
--- /dev/null
+++ b/crates/call/src/outbound/pg_imported_call_repo/read.sql
@@ -0,0 +1,49 @@
+SELECT jsonb_build_object(
+ 'entity', jsonb_build_object(
+ 'id', c.id, 'userId', c.user_id, 'title', c.title, 'createdVia', c.created_via,
+ 'startedAt', c.started_at, 'endedAt', c.ended_at, 'durationMs', c.duration_ms,
+ 'channelId', c.channel_id, 'meetingId', c.meeting_id,
+ 'createdAt', c.created_at, 'updatedAt', c.updated_at
+ ),
+ 'sources', COALESCE((
+ SELECT jsonb_agg(jsonb_build_object(
+ 'userId', s.user_id, 'namespace', s.namespace, 'provider', s.provider,
+ 'objectType', s.object_type, 'externalId', s.external_id, 'externalUrl', s.external_url,
+ 'externalUpdatedAt', s.external_updated_at, 'syncedAt', s.synced_at,
+ 'metadata', s.metadata - 'participantIds' - 'transcriptId'
+ )) FROM call_entity_sources s WHERE s.call_id = c.id
+ ), '[]'::jsonb),
+ 'participants', COALESCE((
+ SELECT jsonb_agg(jsonb_build_object(
+ 'id', p.id, 'userId', p.user_id, 'displayName', p.display_name,
+ 'email', p.email, 'phone', p.phone, 'externalId', p.external_id,
+ 'attendance', COALESCE((SELECT jsonb_agg(jsonb_build_object(
+ 'id', a.id, 'joinedAt', a.joined_at, 'leftAt', a.left_at
+ ) ORDER BY a.id) FROM call_entity_attendance a
+ WHERE a.call_id = p.call_id AND a.participant_id = p.id), '[]'::jsonb)
+ ) ORDER BY p.id) FROM call_entity_participants p WHERE p.call_id = c.id
+ ), '[]'::jsonb),
+ 'recordings', COALESCE((SELECT jsonb_agg(jsonb_build_object(
+ 'id', r.id, 'mediaType', r.media_type,
+ 'location', jsonb_build_object(
+ 'kind', CASE WHEN r.storage_key IS NOT NULL THEN 'storage_key' ELSE 'external_url' END,
+ 'value', COALESCE(r.storage_key, r.external_url)),
+ 'mimeType', r.mime_type, 'durationMs', r.duration_ms, 'startedAt', r.started_at
+ ) ORDER BY r.id) FROM call_entity_recordings r WHERE r.call_id = c.id), '[]'::jsonb),
+ 'transcripts', COALESCE((
+ SELECT jsonb_agg(jsonb_build_object(
+ 'id', t.id, 'recordingId', t.recording_id, 'language', t.language,
+ 'provider', t.provider, 'startedAt', t.started_at,
+ 'segments', COALESCE((
+ SELECT jsonb_agg(jsonb_build_object(
+ 'sequenceNum', s.sequence_num, 'participantId', s.participant_id,
+ 'speakerLabel', s.speaker_label, 'content', s.content,
+ 'startMs', s.start_ms, 'endMs', s.end_ms
+ ) ORDER BY s.sequence_num) FROM call_entity_transcript_segments s
+ WHERE s.call_id = t.call_id AND s.transcript_id = t.id
+ ), '[]'::jsonb)
+ ) ORDER BY t.id) FROM call_entity_transcripts t WHERE t.call_id = c.id
+ ), '[]'::jsonb)
+) AS "record!"
+FROM call_entities c
+WHERE c.user_id = $1 AND c.id = $2 AND c.created_via = 'import';
diff --git a/crates/call/src/outbound/pg_imported_call_repo/test.rs b/crates/call/src/outbound/pg_imported_call_repo/test.rs
new file mode 100644
index 0000000000..244607e85c
--- /dev/null
+++ b/crates/call/src/outbound/pg_imported_call_repo/test.rs
@@ -0,0 +1,98 @@
+use super::*;
+use chrono::Utc;
+use macro_db_migrator::MACRO_DB_MIGRATIONS;
+use macro_user_id::cowlike::CowLike;
+
+fn user(email: &str) -> MacroUserIdStr<'static> {
+ MacroUserIdStr::parse_from_str(&format!("macro|{email}@test.com"))
+ .unwrap()
+ .into_owned()
+}
+fn snapshot(owner: &str, revision: chrono::DateTime<Utc>) -> ImportedCall {
+ ImportedCall {
+ title: Some("Design review".into()),
+ started_at: None,
+ ended_at: None,
+ participants: vec![CallParticipant {
+ id: macro_uuid::generate_uuid_v7(),
+ user_id: None,
+ display_name: Some("Guest".into()),
+ email: Some("[email protected]".into()),
+ phone: None,
+ external_id: None,
+ attendance: vec![],
+ }],
+ transcript: Some(CallTranscript {
+ id: macro_uuid::generate_uuid_v7(),
+ recording_id: None,
+ language: None,
+ provider: Some(CallProvider::Granola),
+ started_at: None,
+ segments: vec![CallTranscriptSegment {
+ sequence_num: 0,
+ participant_id: None,
+ speaker_label: Some("Speaker A".into()),
+ content: "Ship it".into(),
+ start_ms: None,
+ end_ms: None,
+ }],
+ }),
+ source: CallSource {
+ user_id: user(owner),
+ namespace: "account".into(),
+ provider: CallProvider::Granola,
+ object_type: "note".into(),
+ external_id: "not_123456789abcde".to_owned().try_into().unwrap(),
+ external_url: None,
+ external_updated_at: Some(revision),
+ synced_at: None,
+ metadata: serde_json::from_value(
+ json!({"sourceTitle":"Design review","summary":"Ship it"}),
+ )
+ .unwrap(),
+ },
+ }
+}
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(path = "../../../fixtures", scripts("import_users"))
+)]
+async fn imports_are_private_idempotent_owner_scoped_and_revision_ordered(pool: PgPool) {
+ let service = CallImportServiceImpl(PgImportedCallRepository::new(pool.clone()));
+ let now = Utc::now();
+ let id = service.ingest(snapshot("import-a", now)).await.unwrap();
+ let first = service.read(&user("import-a"), id).await.unwrap().unwrap();
+ assert_eq!(first.entity.created_via, CallCreatedVia::Import);
+ assert!(first.entity.started_at.is_none());
+ assert!(service.read(&user("import-b"), id).await.unwrap().is_none());
+ let same = service.ingest(snapshot("import-a", now)).await.unwrap();
+ assert_eq!(same, id);
+ let updated = service.read(&user("import-a"), id).await.unwrap().unwrap();
+ assert_eq!(updated.participants[0].id, first.participants[0].id);
+ assert_eq!(updated.transcripts[0].id, first.transcripts[0].id);
+ assert_eq!(updated.transcripts[0].segments.len(), 1);
+ let permissions = sqlx::query!(
+ r#"SELECT s."linkShare"::text AS link_share, (SELECT count(*) FROM entity_access WHERE entity_id = c.id) AS grants
+ FROM call_entities c JOIN "SharePermission" s ON s.id = c.share_permission_id WHERE c.id = $1"#, id
+ ).fetch_one(&pool).await.unwrap();
+ assert!(permissions.link_share.is_none());
+ assert_eq!(permissions.grants, Some(1));
+ sqlx::query!(
+ "UPDATE call_entities SET title = 'My title' WHERE id = $1",
+ id
+ )
+ .execute(&pool)
+ .await
+ .unwrap();
+ let mut newer = snapshot("import-a", now + chrono::Duration::seconds(1));
+ newer.transcript.as_mut().unwrap().segments[0].content = "Updated".into();
+ service.ingest(newer).await.unwrap();
+ service.ingest(snapshot("import-a", now)).await.unwrap();
+ let record = service.read(&user("import-a"), id).await.unwrap().unwrap();
+ assert_eq!(record.entity.title.as_deref(), Some("My title"));
+ assert_eq!(record.transcripts[0].segments[0].content, "Updated");
+ let other = service.ingest(snapshot("import-b", now)).await.unwrap();
+ assert_ne!(other, id);
+ assert_eq!(service.list(&user("import-a")).await.unwrap().len(), 1);
+}
diff --git a/crates/granola_sync/AGENTS.md b/crates/granola_sync/AGENTS.md
new file mode 100644
index 0000000000..b4b4404e22
--- /dev/null
+++ b/crates/granola_sync/AGENTS.md
@@ -0,0 +1,49 @@
+# granola_sync
+
+## What it is
+
+Imports Granola meeting notes as private Macro calls. Sync follows the user's
+Granola connection in Pipedream; there are no user controls or user routes.
+
+## How it works
+
+The DCS worker (`inbound::run_worker`) reconciles every 30 seconds: each enabled
+Granola account gets one webhook at the widest scope the key accepts (`All`,
+falling back to `Workspace`), and syncs whose account was removed or replaced
+are stopped. Granola posts signed events to the public webhook route; they are
+stored durably, then leased, fetched through the Pipedream proxy, and ingested
+through `call::domain::imports`.
+
+## Start here
+
+- `src/domain/service.rs`: `plan` decides start/stop; `start` handles scope fallback.
+- `src/outbound/pg_repo.rs`: reservation, leases, and encrypted signing secrets.
+
+## Scope
+
+- Owns: webhook lifecycle, delivery verification and deduplication, Granola note mapping.
+- Not here: call storage and reads → `crates/call`; Pipedream accounts → `crates/pipedream_mcp`.
+
+## Boundaries
+
+- Depends on: `call` import port, `pipedream_mcp` `ApiProxy` / `ConnectionStore` / `AppConnections`.
+- Used by: `services/document_cognition_service` (composition root, worker, webhook route).
+
+## Checks
+
+- `cargo test -p granola_sync` (DB tests; leave `SQLX_OFFLINE` unset)
+
+## Gotchas
+
+- Granola only accepts public HTTPS webhook URLs, built from DCS `MCP_PUBLIC_URL`;
+ reconcile is a no-op otherwise. Local stacks need a tunnel on
+ `/cognition/integrations/granola/webhooks`.
+- Granola discards a delivery permanently on 401 or other 4xx; return 503 while
+ setup is still in flight so it retries.
+- `namespace` must survive reconnects: it is the import identity in
+ `call_entity_sources`, so re-registering never duplicates calls.
+- Never log provider response bodies; webhook registration returns the signing secret.
+
+## Related
+
+- Docs: `docs/agent-guide/calls.md` (Imported Granola meetings)
diff --git a/crates/granola_sync/CLAUDE.md b/crates/granola_sync/CLAUDE.md
new file mode 120000
index 0000000000..47dc3e3d86
--- /dev/null
+++ b/crates/granola_sync/CLAUDE.md
@@ -0,0 +1 @@
+AGENTS.md
\ No newline at end of file
diff --git a/crates/granola_sync/Cargo.toml b/crates/granola_sync/Cargo.toml
new file mode 100644
index 0000000000..b3c05a777c
--- /dev/null
+++ b/crates/granola_sync/Cargo.toml
@@ -0,0 +1,33 @@
+[package]
+name = "granola_sync"
+version = "0.1.0"
+edition = "2024"
+publish = false
+
+[dependencies]
+aes-gcm.workspace = true
+async-trait.workspace = true
+axum.workspace = true
+base64.workspace = true
+call = { path = "../call", default-features = false, features = ["ports"] }
+chrono.workspace = true
+hmac.workspace = true
+macro_user_id = { path = "../macro_user_id" }
+macro_uuid = { path = "../macro_uuid" }
+pipedream_mcp = { path = "../pipedream_mcp" }
+rootcause.workspace = true
+serde.workspace = true
+serde_json.workspace = true
+sha2.workspace = true
+sqlx.workspace = true
+thiserror.workspace = true
+tokio.workspace = true
+tracing.workspace = true
+url.workspace = true
+uuid.workspace = true
+workspace-hack = { version = "0.1", path = "../workspace-hack" }
+
+[dev-dependencies]
+anyhow.workspace = true
+macro_db_migrator = { path = "../macro_db_migrator" }
+tower.workspace = true
diff --git a/crates/granola_sync/fixtures/users.sql b/crates/granola_sync/fixtures/users.sql
new file mode 100644
index 0000000000..1c1dad3e48
--- /dev/null
+++ b/crates/granola_sync/fixtures/users.sql
@@ -0,0 +1,4 @@
+INSERT INTO macro_user (id, username, email, stripe_customer_id) VALUES
+('019a0000-0000-7000-8000-000000000001', 'granola-a', '[email protected]', 'granola-a');
+INSERT INTO "User" (id, email, macro_user_id) VALUES
+('macro|[email protected]', '[email protected]', '019a0000-0000-7000-8000-000000000001');
diff --git a/crates/granola_sync/src/domain/mod.rs b/crates/granola_sync/src/domain/mod.rs
new file mode 100644
index 0000000000..901e625fda
--- /dev/null
+++ b/crates/granola_sync/src/domain/mod.rs
@@ -0,0 +1,3 @@
+pub mod models;
+pub mod ports;
+pub mod service;
diff --git a/crates/granola_sync/src/domain/models.rs b/crates/granola_sync/src/domain/models.rs
new file mode 100644
index 0000000000..52c8d82a81
--- /dev/null
+++ b/crates/granola_sync/src/domain/models.rs
@@ -0,0 +1,177 @@
+use chrono::{DateTime, Utc};
+use macro_user_id::user_id::MacroUserIdStr;
+use serde::{Deserialize, Serialize};
+use uuid::Uuid;
+
+/// Webhook access scope. Sync always asks for the widest scope the key accepts:
+/// `All` for personal keys, `Workspace` for workspace keys. `Personal` and
+/// `Public` remain readable for connections stored before that policy.
+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
+#[serde(rename_all = "snake_case")]
+pub enum Scope {
+ Personal,
+ Public,
+ All,
+ Workspace,
+}
+
+impl Scope {
+ pub fn as_str(self) -> &'static str {
+ match self {
+ Self::Personal => "personal",
+ Self::Public => "public",
+ Self::All => "all",
+ Self::Workspace => "workspace",
+ }
+ }
+
+ pub fn scopes(self) -> Vec<&'static str> {
+ match self {
+ Self::Personal => vec!["personal"],
+ Self::Public => vec!["public"],
+ Self::All => vec!["personal", "public"],
+ Self::Workspace => vec!["workspace"],
+ }
+ }
+}
+
+/// Signing material must never appear in logs or API responses.
+#[derive(Clone)]
+pub struct SigningSecret(pub String);
+
+/// Internal connection state. A connection ID changes when sync is restarted.
+#[derive(Clone)]
+pub struct Connection {
+ pub id: Uuid,
+ /// Stable import namespace, retained when credentials or webhooks change.
+ pub namespace: Uuid,
+ pub user_id: MacroUserIdStr<'static>,
+ pub account_id: String,
+ pub scope: Scope,
+ pub enabled: bool,
+ pub endpoint_id: Option<String>,
+ pub secret: Option<SigningSecret>,
+ pub started_at: DateTime<Utc>,
+ pub last_synced_at: Option<DateTime<Utc>>,
+ pub last_error: Option<String>,
+}
+
+/// Events refer to meeting records, although Granola names those records notes.
+#[derive(Debug, Clone, Copy, Deserialize, Serialize)]
+pub enum EventType {
+ #[serde(rename = "note.generated")]
+ Generated,
+ #[serde(rename = "note.edited")]
+ Edited,
+ #[serde(rename = "note.access_granted")]
+ AccessGranted,
+}
+
+impl EventType {
+ pub fn as_str(self) -> &'static str {
+ match self {
+ Self::Generated => "note.generated",
+ Self::Edited => "note.edited",
+ Self::AccessGranted => "note.access_granted",
+ }
+ }
+}
+
+/// Validated provider identity, safe to embed in an API path.
+#[derive(Debug, Clone, Deserialize, Serialize)]
+#[serde(try_from = "String", into = "String")]
+pub struct NoteId(String);
+
+impl TryFrom<String> for NoteId {
+ type Error = &'static str;
+ fn try_from(value: String) -> Result<Self, Self::Error> {
+ let suffix = value
+ .strip_prefix("not_")
+ .ok_or("invalid Granola meeting ID")?;
+ if suffix.len() != 14 || !suffix.bytes().all(|c| c.is_ascii_alphanumeric()) {
+ return Err("invalid Granola meeting ID");
+ }
+ Ok(Self(value))
+ }
+}
+impl From<NoteId> for String {
+ fn from(value: NoteId) -> Self {
+ value.0
+ }
+}
+impl AsRef<str> for NoteId {
+ fn as_ref(&self) -> &str {
+ &self.0
+ }
+}
+
+#[derive(Debug, Clone, Deserialize)]
+pub struct Event {
+ pub event_id: Uuid,
+ pub event_type: EventType,
+ pub note_id: NoteId,
+ pub occurred_at: DateTime<Utc>,
+}
+
+/// A leased delivery. Completion is fenced by lease_id.
+pub struct Job {
+ pub connection: Connection,
+ pub event: Event,
+ pub lease_id: Uuid,
+ pub attempts: i32,
+}
+
+/// Marks a sync stopped because its account went away; a reconnect restarts it
+/// at once, unlike a failed setup, which waits for the retry delay.
+pub const STOPPED: &str = "Sync stopped";
+
+/// Reconciliation view of a connection row.
+pub struct SyncState {
+ pub id: Uuid,
+ pub user_id: MacroUserIdStr<'static>,
+ pub account_id: String,
+ pub scope: Scope,
+ pub enabled: bool,
+ pub has_endpoint: bool,
+ pub started_at: DateTime<Utc>,
+ pub last_error: Option<String>,
+}
+
+/// Outcome of registering a webhook with one scope.
+pub enum Registration {
+ Registered(Webhook),
+ /// Granola rejected the scope for this kind of key; try the next one.
+ ScopeRejected,
+}
+
+/// Registration response; deliberately not Debug.
+pub struct Webhook {
+ pub id: String,
+ pub secret: SigningSecret,
+}
+
+/// Raw authentication envelope. Verify before decoding the provider event.
+pub struct Delivery<'a> {
+ pub id: &'a str,
+ pub timestamp: &'a str,
+ pub signature: &'a str,
+ pub body: &'a [u8],
+}
+
+#[derive(Debug, thiserror::Error)]
+pub enum SyncError {
+ #[error("Sync setup is already running")]
+ Conflict,
+ #[error("Invalid webhook signature or payload")]
+ InvalidDelivery,
+ #[error("Granola sync is not configured")]
+ Unavailable,
+ #[error("Granola sync request failed: {0}")]
+ Internal(rootcause::Report),
+}
+
+impl From<rootcause::Report> for SyncError {
+ fn from(error: rootcause::Report) -> Self {
+ Self::Internal(error)
+ }
+}
diff --git a/crates/granola_sync/src/domain/ports.rs b/crates/granola_sync/src/domain/ports.rs
new file mode 100644
index 0000000000..ea4ab7c70a
--- /dev/null
+++ b/crates/granola_sync/src/domain/ports.rs
@@ -0,0 +1,49 @@
+use super::models::*;
+use async_trait::async_trait;
+use call::domain::imports::ImportedCall;
+use macro_user_id::user_id::MacroUserIdStr;
+use uuid::Uuid;
+
+pub type Result<T> = std::result::Result<T, rootcause::Report>;
+
+/// Storage owns atomic registration, durable delivery deduplication, and leases.
+#[async_trait]
+pub trait SyncRepository: Send + Sync {
+ async fn by_user(&self, user: &MacroUserIdStr<'static>) -> Result<Option<Connection>>;
+ async fn by_id(&self, id: Uuid) -> Result<Option<Connection>>;
+ /// Every user's sync state, without signing secrets.
+ async fn states(&self) -> Result<Vec<SyncState>>;
+ async fn reserve(&self, connection: &Connection) -> Result<bool>;
+ async fn activate(&self, id: Uuid, webhook: Webhook, scope: Scope) -> Result<bool>;
+ async fn stop(&self, id: Uuid) -> Result<()>;
+ async fn failed_setup(&self, id: Uuid) -> Result<()>;
+ async fn enqueue(&self, id: Uuid, event: Event) -> Result<()>;
+ async fn claim(&self) -> Result<Option<Job>>;
+ async fn finish(&self, job: &Job, success: bool) -> Result<()>;
+}
+
+/// Provider I/O uses the user's already-verified Pipedream account.
+#[async_trait]
+pub trait Granola: Send + Sync {
+ async fn register(
+ &self,
+ connection: &Connection,
+ url: &str,
+ scope: Scope,
+ ) -> Result<Registration>;
+ async fn unregister(&self, connection: &Connection) -> Result<()>;
+ async fn meeting(&self, connection: &Connection, note: &NoteId)
+ -> Result<Option<ImportedCall>>;
+}
+
+/// A credential connection is rechecked before ingesting, including after fetch.
+#[async_trait]
+pub trait Accounts: Send + Sync {
+ async fn account(&self, user: &MacroUserIdStr<'static>) -> Result<Option<String>>;
+ /// Every user with an enabled Granola account, with that account ID.
+ async fn connected(&self) -> Result<Vec<(MacroUserIdStr<'static>, String)>>;
+}
+
+pub trait DeliveryVerifier: Send + Sync {
+ fn verify(&self, secret: &SigningSecret, delivery: &Delivery<'_>) -> bool;
+}
diff --git a/crates/granola_sync/src/domain/service.rs b/crates/granola_sync/src/domain/service.rs
new file mode 100644
index 0000000000..ec782e211f
--- /dev/null
+++ b/crates/granola_sync/src/domain/service.rs
@@ -0,0 +1,291 @@
+use super::{models::*, ports::*};
+use async_trait::async_trait;
+use call::domain::imports::CallImportService;
+use macro_user_id::user_id::MacroUserIdStr;
+use std::sync::Arc;
+use tracing::Instrument;
+use uuid::Uuid;
+
+/// Scopes tried in order; Granola accepts exactly one of these per key type.
+const SCOPE_PREFERENCE: [Scope; 2] = [Scope::All, Scope::Workspace];
+/// Reconcile work per pass, so one pass never monopolizes the worker.
+const RECONCILE_BATCH: usize = 20;
+/// Failed setups (no Business plan, revoked key) retry at this interval.
+const SETUP_RETRY: chrono::Duration = chrono::Duration::hours(1);
+/// Matches the reservation window in which another instance owns setup.
+const SETUP_LEASE: chrono::Duration = chrono::Duration::minutes(2);
+
+#[derive(Debug, Default, PartialEq)]
+pub(crate) struct Plan {
+ pub stop: Vec<Uuid>,
+ pub start: Vec<MacroUserIdStr<'static>>,
+}
+
+/// Every enabled Granola account should have one active webhook at the widest
+/// scope; syncs whose account went away are stopped.
+pub(crate) fn plan(
+ accounts: &[(MacroUserIdStr<'static>, String)],
+ states: &[SyncState],
+ now: chrono::DateTime<chrono::Utc>,
+) -> Plan {
+ let account = |user: &MacroUserIdStr<'static>| {
+ accounts
+ .iter()
+ .find(|(u, _)| u == user)
+ .map(|(_, a)| a.as_str())
+ };
+ let mut plan = Plan::default();
+ for state in states {
+ if state.enabled && account(&state.user_id) != Some(state.account_id.as_str()) {
+ plan.stop.push(state.id);
+ }
+ }
+ for (user, account_id) in accounts {
+ let Some(state) = states.iter().find(|s| &s.user_id == user) else {
+ plan.start.push(user.clone());
+ continue;
+ };
+ let due = if state.account_id != *account_id {
+ true
+ } else if state.enabled {
+ !SCOPE_PREFERENCE.contains(&state.scope)
+ } else {
+ match state.last_error.as_deref() {
+ Some(STOPPED) => true,
+ Some(_) => state.started_at < now - SETUP_RETRY,
+ // A reservation that never finished; its owner likely exited.
+ None => !state.has_endpoint && state.started_at < now - SETUP_LEASE,
+ }
+ };
+ if due {
+ plan.start.push(user.clone());
+ }
+ }
+ plan
+}
+
+/// Sync follows the user's Granola connection; there are no user controls.
+/// Webhook ingestion and reconciliation are the only entry points.
+#[async_trait]
+pub trait SyncService: Send + Sync {
+ async fn receive(&self, id: Uuid, delivery: Delivery<'_>)
+ -> std::result::Result<(), SyncError>;
+ /// Process one queued delivery. Returns whether there was work.
+ async fn tick(&self) -> Result<bool>;
+ /// Start sync for newly connected accounts and stop it for removed ones.
+ async fn reconcile(&self) -> Result<()>;
+}
+
+pub struct Service<R, G, A, V> {
+ pub repo: R,
+ pub granola: G,
+ pub accounts: A,
+ pub verifier: V,
+ pub calls: Arc<dyn CallImportService>,
+ /// Public DCS origin, supplied by the composition root's existing config.
+ pub public_url: String,
+}
+
+impl<R: SyncRepository, G: Granola, A: Accounts, V: DeliveryVerifier> Service<R, G, A, V> {
+ async fn is_current(&self, connection: &Connection) -> Result<bool> {
+ Ok(connection.enabled
+ && self.accounts.account(&connection.user_id).await?.as_deref()
+ == Some(connection.account_id.as_str()))
+ }
+
+ #[tracing::instrument(name = "granola.start_sync", skip_all, fields(scope), err(Display))]
+ async fn start(&self, user: MacroUserIdStr<'static>) -> std::result::Result<(), SyncError> {
+ let Some(account) = self.accounts.account(&user).await? else {
+ return Ok(());
+ };
+ let old = self.repo.by_user(&user).await?;
+ let connection = Connection {
+ id: macro_uuid::generate_uuid_v7(),
+ user_id: user,
+ account_id: account,
+ namespace: old
+ .as_ref()
+ .map(|c| c.namespace)
+ .unwrap_or_else(macro_uuid::generate_uuid_v7),
+ scope: SCOPE_PREFERENCE[0],
+ enabled: false,
+ endpoint_id: None,
+ secret: None,
+ started_at: chrono::Utc::now(),
+ last_synced_at: None,
+ last_error: None,
+ };
+ if !self.repo.reserve(&connection).await? {
+ return Err(SyncError::Conflict);
+ }
+ // Old deliveries stop being accepted once the new connection ID is saved.
+ if let Some(old) = &old
+ && let Err(error) = self.granola.unregister(old).await
+ {
+ tracing::warn!(error = ?error, "could not remove old Granola endpoint");
+ }
+ let url = format!(
+ "{}/integrations/granola/webhooks/{}",
+ self.public_url.trim_end_matches('/'),
+ connection.id
+ );
+ let mut registered = None;
+ for scope in SCOPE_PREFERENCE {
+ match self.granola.register(&connection, &url, scope).await {
+ Ok(Registration::Registered(webhook)) => {
+ registered = Some((webhook, scope));
+ break;
+ }
+ Ok(Registration::ScopeRejected) => continue,
+ Err(error) => {
+ self.repo.failed_setup(connection.id).await?;
+ return Err(SyncError::Internal(error));
+ }
+ }
+ }
+ let Some((webhook, scope)) = registered else {
+ self.repo.failed_setup(connection.id).await?;
+ return Err(SyncError::Internal(rootcause::report!(
+ "Granola rejected every webhook scope for this key"
+ )));
+ };
+ // If a disconnect or another instance raced registration, retire the endpoint.
+ let cleanup = Connection {
+ endpoint_id: Some(webhook.id.clone()),
+ ..connection.clone()
+ };
+ if !self.repo.activate(connection.id, webhook, scope).await? {
+ self.granola.unregister(&cleanup).await?;
+ return Err(SyncError::Conflict);
+ }
+ tracing::Span::current().record("scope", scope.as_str());
+ tracing::info!("Granola meeting sync started");
+ Ok(())
+ }
+
+ async fn stop(&self, id: Uuid) -> Result<()> {
+ let Some(connection) = self.repo.by_id(id).await? else {
+ return Ok(());
+ };
+ self.repo.stop(connection.id).await?;
+ // A removed Pipedream account can no longer authenticate this call; the
+ // endpoint then fails deliveries until Granola disables it.
+ if let Err(error) = self.granola.unregister(&connection).await {
+ tracing::warn!(error = ?error, "could not remove disabled Granola endpoint");
+ }
+ Ok(())
+ }
+}
+
+#[async_trait]
+impl<R: SyncRepository, G: Granola, A: Accounts, V: DeliveryVerifier> SyncService
+ for Service<R, G, A, V>
+{
+ async fn receive(
+ &self,
+ id: Uuid,
+ delivery: Delivery<'_>,
+ ) -> std::result::Result<(), SyncError> {
+ let connection = self
+ .repo
+ .by_id(id)
+ .await?
+ .ok_or(SyncError::InvalidDelivery)?;
+ // Granola discards 401 deliveries permanently; setup races must retry.
+ let secret = connection.secret.as_ref().ok_or_else(|| {
+ if connection.last_error.is_none() {
+ SyncError::Unavailable
+ } else {
+ SyncError::InvalidDelivery
+ }
+ })?;
+ if !self.verifier.verify(secret, &delivery) {
+ return Err(SyncError::InvalidDelivery);
+ }
+ let event: Event =
+ serde_json::from_slice(delivery.body).map_err(|_| SyncError::InvalidDelivery)?;
+ if event.event_id.to_string() != delivery.id {
+ return Err(SyncError::InvalidDelivery);
+ }
+ if self.is_current(&connection).await? {
+ self.repo.enqueue(id, event).await?;
+ }
+ Ok(())
+ }
+
+ async fn tick(&self) -> Result<bool> {
+ let Some(job) = self.repo.claim().await? else {
+ return Ok(false);
+ };
+ let span = tracing::info_span!(
+ "granola.sync_meeting",
+ connection_id = %job.connection.id,
+ event_id = %job.event.event_id,
+ event_type = job.event.event_type.as_str(),
+ attempts = job.attempts,
+ imported = tracing::field::Empty,
+ );
+ let result = async {
+ if !self.is_current(&job.connection).await? {
+ return Ok(());
+ }
+ let Some(meeting) = self
+ .granola
+ .meeting(&job.connection, &job.event.note_id)
+ .await?
+ else {
+ return Ok(());
+ };
+ let current = self.repo.by_id(job.connection.id).await?;
+ if let Some(current) = current
+ && self.is_current(&current).await?
+ {
+ let call_id = self.calls.ingest(meeting).await?;
+ tracing::Span::current().record("imported", tracing::field::display(call_id));
+ }
+ Ok::<(), rootcause::Report>(())
+ }
+ .instrument(span)
+ .await;
+ self.repo.finish(&job, result.is_ok()).await?;
+ if let Err(error) = result {
+ tracing::warn!(error = ?error, event_id = %job.event.event_id, "Granola meeting sync will retry");
+ }
+ Ok(true)
+ }
+
+ #[tracing::instrument(
+ name = "granola.reconcile",
+ skip(self),
+ fields(stopped, started),
+ err(Debug)
+ )]
+ async fn reconcile(&self) -> Result<()> {
+ // Granola only delivers to public HTTPS endpoints.
+ if !self.public_url.starts_with("https://") {
+ return Ok(());
+ }
+ let accounts = self.accounts.connected().await?;
+ let states = self.repo.states().await?;
+ let plan = plan(&accounts, &states, chrono::Utc::now());
+ let span = tracing::Span::current();
+ span.record("stopped", plan.stop.len().min(RECONCILE_BATCH));
+ span.record("started", plan.start.len().min(RECONCILE_BATCH));
+ for id in plan.stop.into_iter().take(RECONCILE_BATCH) {
+ self.stop(id).await?;
+ }
+ for user in plan.start.into_iter().take(RECONCILE_BATCH) {
+ match self.start(user).await {
+ // Another instance is setting this user up.
+ Ok(()) | Err(SyncError::Conflict) => {}
+ Err(error) => {
+ tracing::warn!(error = %error, "Granola meeting sync setup failed; will retry")
+ }
+ }
+ }
+ Ok(())
+ }
+}
+
+#[cfg(test)]
+mod test;
diff --git a/crates/granola_sync/src/domain/service/test.rs b/crates/granola_sync/src/domain/service/test.rs
new file mode 100644
index 0000000000..4b5acdce33
--- /dev/null
+++ b/crates/granola_sync/src/domain/service/test.rs
@@ -0,0 +1,104 @@
+use super::*;
+use macro_user_id::cowlike::CowLike;
+
+fn user(name: &str) -> MacroUserIdStr<'static> {
+ MacroUserIdStr::parse_from_str(&format!("macro|{name}@test.com"))
+ .unwrap()
+ .into_owned()
+}
+fn state(name: &str, account: &str) -> SyncState {
+ SyncState {
+ id: macro_uuid::generate_uuid_v7(),
+ user_id: user(name),
+ account_id: account.into(),
+ scope: Scope::All,
+ enabled: true,
+ has_endpoint: true,
+ started_at: chrono::Utc::now(),
+ last_error: None,
+ }
+}
+
+#[test]
+fn connecting_an_account_starts_sync_without_user_action() {
+ let plan = plan(&[(user("a"), "apn_a".into())], &[], chrono::Utc::now());
+ assert_eq!(plan.start, vec![user("a")]);
+ assert!(plan.stop.is_empty());
+}
+
+#[test]
+fn an_active_sync_at_the_widest_scope_is_left_alone() {
+ let plan = plan(
+ &[(user("a"), "apn_a".into())],
+ &[state("a", "apn_a")],
+ chrono::Utc::now(),
+ );
+ assert_eq!(plan, Plan::default());
+}
+
+#[test]
+fn removing_or_replacing_the_account_stops_the_old_sync() {
+ let removed = state("a", "apn_a");
+ let replaced = state("b", "apn_old");
+ let plan = plan(
+ &[(user("b"), "apn_new".into())],
+ &[removed, replaced],
+ chrono::Utc::now(),
+ );
+ assert_eq!(plan.stop.len(), 2);
+ assert_eq!(plan.start, vec![user("b")]);
+}
+
+#[test]
+fn narrower_scopes_from_earlier_settings_are_widened() {
+ let plan = plan(
+ &[(user("a"), "apn_a".into())],
+ &[SyncState {
+ scope: Scope::Personal,
+ ..state("a", "apn_a")
+ }],
+ chrono::Utc::now(),
+ );
+ assert_eq!(plan.start, vec![user("a")]);
+}
+
+#[test]
+fn failed_setups_wait_for_the_retry_delay_but_reconnects_restart_at_once() {
+ let now = chrono::Utc::now();
+ let failed = |error: &str, age: chrono::Duration| SyncState {
+ enabled: false,
+ has_endpoint: false,
+ started_at: now - age,
+ last_error: Some(error.into()),
+ ..state("a", "apn_a")
+ };
+ let accounts = [(user("a"), "apn_a".into())];
+ let recent = failed(
+ "Could not register Granola webhook",
+ chrono::Duration::minutes(5),
+ );
+ assert!(plan(&accounts, &[recent], now).start.is_empty());
+ let old = failed(
+ "Could not register Granola webhook",
+ chrono::Duration::hours(2),
+ );
+ assert_eq!(plan(&accounts, &[old], now).start.len(), 1);
+ let stopped = failed(STOPPED, chrono::Duration::minutes(1));
+ assert_eq!(plan(&accounts, &[stopped], now).start.len(), 1);
+}
+
+#[test]
+fn an_in_flight_reservation_is_not_raced() {
+ let now = chrono::Utc::now();
+ let reserving = |age| SyncState {
+ enabled: false,
+ has_endpoint: false,
+ started_at: now - age,
+ ..state("a", "apn_a")
+ };
+ let accounts = [(user("a"), "apn_a".into())];
+ let fresh = reserving(chrono::Duration::seconds(10));
+ assert!(plan(&accounts, &[fresh], now).start.is_empty());
+ let abandoned = reserving(chrono::Duration::minutes(5));
+ assert_eq!(plan(&accounts, &[abandoned], now).start.len(), 1);
+}
diff --git a/crates/granola_sync/src/inbound.rs b/crates/granola_sync/src/inbound.rs
new file mode 100644
index 0000000000..2a151487f7
--- /dev/null
+++ b/crates/granola_sync/src/inbound.rs
@@ -0,0 +1,86 @@
+use crate::domain::{models::*, service::SyncService};
+use axum::{
+ Router,
+ body::Bytes,
+ extract::{DefaultBodyLimit, Path, State},
+ http::{HeaderMap, StatusCode},
+ response::{IntoResponse, Response},
+ routing::post,
+};
+use std::sync::Arc;
+use uuid::Uuid;
+
+pub fn webhook_router<S: Send + Sync>(service: Option<Arc<dyn SyncService>>) -> Router<S> {
+ Router::new()
+ .route("/integrations/granola/webhooks/{id}", post(webhook))
+ .layer(DefaultBodyLimit::max(16 * 1024))
+ .with_state(service)
+}
+fn error(error: SyncError) -> Response {
+ let status = match error {
+ SyncError::Conflict => StatusCode::CONFLICT,
+ SyncError::InvalidDelivery => StatusCode::UNAUTHORIZED,
+ SyncError::Unavailable => StatusCode::SERVICE_UNAVAILABLE,
+ SyncError::Internal(ref error) => {
+ tracing::error!(error = ?error, "Granola sync request failed");
+ StatusCode::BAD_GATEWAY
+ }
+ };
+ // Provider bodies can contain secrets; never reflect them to the caller.
+ (status, "Granola sync request could not be completed").into_response()
+}
+async fn webhook(
+ State(service): State<Option<Arc<dyn SyncService>>>,
+ Path(id): Path<Uuid>,
+ headers: HeaderMap,
+ body: Bytes,
+) -> Response {
+ let Some(service) = service else {
+ return error(SyncError::Unavailable);
+ };
+ let header = |name| {
+ headers
+ .get(name)
+ .and_then(|h| h.to_str().ok())
+ .unwrap_or("")
+ };
+ let delivery = Delivery {
+ id: header("webhook-id"),
+ timestamp: header("webhook-timestamp"),
+ signature: header("webhook-signature"),
+ body: &body,
+ };
+ match service.receive(id, delivery).await {
+ Ok(()) => StatusCode::NO_CONTENT.into_response(),
+ Err(e) => error(e),
+ }
+}
+
+/// Restart-safe work is in Postgres; multiple DCS instances can run this loop.
+pub async fn run_worker(service: Arc<dyn SyncService>) {
+ const RECONCILE_EVERY: std::time::Duration = std::time::Duration::from_secs(30);
+ let mut next_reconcile = tokio::time::Instant::now();
+ loop {
+ if tokio::time::Instant::now() >= next_reconcile {
+ next_reconcile = tokio::time::Instant::now() + RECONCILE_EVERY;
+ match tokio::time::timeout(std::time::Duration::from_secs(120), service.reconcile())
+ .await
+ {
+ Ok(Ok(())) => {}
+ other => {
+ tracing::warn!(error = ?other, "Granola sync reconcile failed; will retry")
+ }
+ }
+ }
+ let result =
+ tokio::time::timeout(std::time::Duration::from_secs(300), service.tick()).await;
+ match result {
+ Ok(Ok(true)) => tokio::time::sleep(std::time::Duration::from_millis(500)).await,
+ Ok(Ok(false)) => tokio::time::sleep(std::time::Duration::from_secs(2)).await,
+ other => {
+ tracing::warn!(error = ?other, "Granola worker attempt failed; lease will recover");
+ tokio::time::sleep(std::time::Duration::from_secs(10)).await;
+ }
+ }
+ }
+}
diff --git a/crates/granola_sync/src/lib.rs b/crates/granola_sync/src/lib.rs
new file mode 100644
index 0000000000..4b9372e28b
--- /dev/null
+++ b/crates/granola_sync/src/lib.rs
@@ -0,0 +1,4 @@
+//! Continuous, opt-in Granola meeting sync through Pipedream-managed credentials.
+pub mod domain;
+pub mod inbound;
+pub mod outbound;
diff --git a/crates/granola_sync/src/outbound/accounts.rs b/crates/granola_sync/src/outbound/accounts.rs
new file mode 100644
index 0000000000..e0925f48e3
--- /dev/null
+++ b/crates/granola_sync/src/outbound/accounts.rs
@@ -0,0 +1,32 @@
+use crate::domain::ports::{Accounts, Result};
+use async_trait::async_trait;
+use macro_user_id::user_id::MacroUserIdStr;
+use pipedream_mcp::domain::ports::{AppConnections, ConnectionStore};
+
+const APP: &str = "granola";
+
+/// Uses the Pipedream domain ports rather than reaching into its storage.
+pub struct ConnectedAccounts<S>(pub S);
+
+#[async_trait]
+impl<S: ConnectionStore + AppConnections> Accounts for ConnectedAccounts<S> {
+ async fn account(&self, user: &MacroUserIdStr<'static>) -> Result<Option<String>> {
+ Ok(self
+ .0
+ .load(user, APP)
+ .await
+ .map_err(|error| rootcause::report!("Pipedream connection lookup failed: {error:?}"))?
+ .filter(|connection| connection.enabled)
+ .map(|connection| connection.account_id))
+ }
+ async fn connected(&self) -> Result<Vec<(MacroUserIdStr<'static>, String)>> {
+ Ok(self
+ .0
+ .list_enabled_for_app(APP)
+ .await
+ .map_err(|error| rootcause::report!("Pipedream connection listing failed: {error:?}"))?
+ .into_iter()
+ .map(|connection| (connection.user_id, connection.account_id))
+ .collect())
+ }
+}
diff --git a/crates/granola_sync/src/outbound/api.rs b/crates/granola_sync/src/outbound/api.rs
new file mode 100644
index 0000000000..4975c63880
--- /dev/null
+++ b/crates/granola_sync/src/outbound/api.rs
@@ -0,0 +1,358 @@
+//! The REST adapter translates Granola meeting-note objects into call resources.
+use crate::domain::{
+ models::*,
+ ports::{Granola, Result},
+};
+use async_trait::async_trait;
+use call::domain::{imports::ImportedCall, records::*};
+use chrono::{DateTime, Utc};
+use pipedream_mcp::domain::{
+ models::PipedreamConnection,
+ ports::{ApiProxy, ProxyMethod, ProxyResponse},
+};
+use rootcause::prelude::IntoRootcause;
+use serde::Deserialize;
+use serde_json::{Value, json};
+use std::{collections::HashSet, sync::Arc};
+
+pub struct GranolaApi<P>(pub Arc<P>);
+
+impl<P: ApiProxy> GranolaApi<P> {
+ async fn send(
+ &self,
+ connection: &Connection,
+ method: ProxyMethod,
+ path: &str,
+ body: Option<Value>,
+ ) -> Result<ProxyResponse> {
+ let account = PipedreamConnection {
+ user_id: connection.user_id.clone(),
+ app_slug: "granola".into(),
+ server_name: "Granola".into(),
+ account_id: connection.account_id.clone(),
+ enabled: true,
+ };
+ self.0
+ .proxy(
+ &account,
+ method,
+ &format!("https://public-api.granola.ai/v1{path}"),
+ body,
+ )
+ .await
+ .into_rootcause()
+ }
+
+ async fn request(
+ &self,
+ connection: &Connection,
+ method: ProxyMethod,
+ path: &str,
+ body: Option<Value>,
+ ) -> Result<Option<Value>> {
+ let response = self.send(connection, method, path, body).await?;
+ checked(response)
+ }
+}
+
+fn checked(response: ProxyResponse) -> Result<Option<Value>> {
+ match response.status {
+ 200..=299 => Ok(Some(response.body)),
+ 404 => Ok(None),
+ status => Err(rootcause::report!(
+ "Granola API returned HTTP {status}: {}",
+ error_reason(&response.body)
+ )),
+ }
+}
+
+/// Granola reports a key-type mismatch as a validation error on `scopes`.
+fn scope_rejected(body: &Value) -> bool {
+ body["code"] == "VALIDATION_ERROR"
+ && body["details"]
+ .as_array()
+ .is_some_and(|details| details.iter().any(|d| d["field"] == "scopes"))
+}
+
+/// Granola error bodies carry a code and field issues, never credentials;
+/// only those fields are surfaced so success payloads cannot leak into logs.
+fn error_reason(body: &Value) -> String {
+ let issues: Vec<String> = body["details"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .filter_map(|d| {
+ Some(format!(
+ "{}: {}",
+ d["field"].as_str()?,
+ d["issue"].as_str()?
+ ))
+ })
+ .collect();
+ format!(
+ "{} {}",
+ body["code"].as_str().unwrap_or("unknown error"),
+ issues.join("; ")
+ )
+ .trim_end()
+ .to_string()
+}
+
+#[async_trait]
+impl<P: ApiProxy> Granola for GranolaApi<P> {
+ async fn register(
+ &self,
+ connection: &Connection,
+ url: &str,
+ scope: Scope,
+ ) -> Result<Registration> {
+ let response = self
+ .send(
+ connection,
+ ProxyMethod::Post,
+ "/webhook-endpoints",
+ Some(json!({
+ "url": url, "scopes": scope.scopes(),
+ "events": ["note.generated", "note.edited", "note.access_granted"]
+ })),
+ )
+ .await?;
+ if response.status == 400 && scope_rejected(&response.body) {
+ return Ok(Registration::ScopeRejected);
+ }
+ let body = checked(response)?.ok_or_else(|| {
+ rootcause::report!("Granola webhooks are unavailable for this account")
+ })?;
+ #[derive(Deserialize)]
+ struct Created {
+ id: String,
+ signing_secret: String,
+ }
+ let result: Created = serde_json::from_value(body)?;
+ Ok(Registration::Registered(Webhook {
+ id: result.id,
+ secret: SigningSecret(result.signing_secret),
+ }))
+ }
+ async fn unregister(&self, connection: &Connection) -> Result<()> {
+ if let Some(id) = &connection.endpoint_id {
+ // Treat provider IDs as path segments rather than concatenating input.
+ let id = url::form_urlencoded::byte_serialize(id.as_bytes()).collect::<String>();
+ self.request(
+ connection,
+ ProxyMethod::Delete,
+ &format!("/webhook-endpoints/{id}"),
+ None,
+ )
+ .await?;
+ }
+ Ok(())
+ }
+ async fn meeting(&self, connection: &Connection, id: &NoteId) -> Result<Option<ImportedCall>> {
+ let Some(body) = self
+ .request(
+ connection,
+ ProxyMethod::Get,
+ &format!("/notes/{}", id.as_ref()),
+ None,
+ )
+ .await?
+ else {
+ return Ok(None);
+ };
+ let note: Note = serde_json::from_value(body)?;
+ if note.id.as_ref() != id.as_ref() {
+ return Err(rootcause::report!("Granola returned a different meeting"));
+ }
+ if note.deleted_at.is_some() {
+ return Ok(None);
+ }
+ let mut transcript = Vec::new();
+ let mut cursor: Option<String> = None;
+ let mut seen = HashSet::new();
+ loop {
+ let mut path = format!("/notes/{}/transcript", id.as_ref());
+ if let Some(cursor) = &cursor {
+ let query = url::form_urlencoded::Serializer::new(String::new())
+ .append_pair("cursor", cursor)
+ .finish();
+ path.push('?');
+ path.push_str(&query);
+ }
+ let Some(page) = self
+ .request(connection, ProxyMethod::Get, &path, None)
+ .await?
+ else {
+ if cursor.is_some() {
+ return Err(rootcause::report!(
+ "Granola transcript disappeared during pagination"
+ ));
+ }
+ // Missing/expired transcript does not make the meeting disappear.
+ break;
+ };
+ let page: TranscriptPage = serde_json::from_value(page)?;
+ transcript.extend(page.transcript);
+ if !page.has_more {
+ break;
+ }
+ let next = page
+ .cursor
+ .filter(|c| !c.is_empty())
+ .ok_or_else(|| rootcause::report!("Granola transcript pagination has no cursor"))?;
+ if !seen.insert(next.clone()) || transcript.len() > 100_000 {
+ return Err(rootcause::report!(
+ "Granola transcript pagination exceeded safe bounds"
+ ));
+ }
+ cursor = Some(next);
+ // Stay below Granola's five requests/second sustained allowance.
+ tokio::time::sleep(std::time::Duration::from_millis(250)).await;
+ }
+ Ok(Some(map_meeting(connection, note, transcript)?))
+ }
+}
+
+#[derive(Deserialize)]
+struct Person {
+ name: Option<String>,
+ email: String,
+}
+#[derive(Deserialize)]
+struct Note {
+ id: NoteId,
+ title: Option<String>,
+ owner: Person,
+ updated_at: DateTime<Utc>,
+ deleted_at: Option<DateTime<Utc>>,
+ web_url: String,
+ calendar_event: Option<Value>,
+ #[serde(default)]
+ attendees: Vec<Person>,
+ summary_markdown: Option<String>,
+ summary_text: Option<String>,
+}
+#[derive(Deserialize)]
+struct TranscriptPage {
+ transcript: Vec<Segment>,
+ #[serde(rename = "hasMore")]
+ has_more: bool,
+ cursor: Option<String>,
+}
+#[derive(Deserialize)]
+struct Segment {
+ text: String,
+ start_time: Option<DateTime<Utc>>,
+ end_time: Option<DateTime<Utc>>,
+ speaker: Option<Speaker>,
+}
+#[derive(Deserialize)]
+struct Speaker {
+ name: Option<String>,
+ attribution: Option<String>,
+ diarization_label: Option<String>,
+ source: Option<String>,
+}
+
+fn map_meeting(
+ connection: &Connection,
+ note: Note,
+ segments: Vec<Segment>,
+) -> Result<ImportedCall> {
+ let start = segments.iter().filter_map(|s| s.start_time).min();
+ let end = segments.iter().filter_map(|s| s.end_time).max();
+ let mut emails = HashSet::new();
+ let participants = note
+ .attendees
+ .into_iter()
+ .filter(|p| emails.insert(p.email.to_lowercase()))
+ .map(|p| CallParticipant {
+ id: macro_uuid::generate_uuid_v7(),
+ user_id: None,
+ display_name: p.name,
+ email: Some(p.email),
+ phone: None,
+ external_id: None,
+ attendance: vec![],
+ })
+ .collect();
+ let segments = segments
+ .into_iter()
+ .enumerate()
+ .map(|(index, segment)| {
+ let speaker_label = segment.speaker.and_then(|s| {
+ s.name
+ .or(s.diarization_label)
+ .or_else(|| match s.attribution.as_deref() {
+ Some("me") => Some(
+ note.owner
+ .name
+ .clone()
+ .unwrap_or_else(|| note.owner.email.clone()),
+ ),
+ Some("them") => Some("Other participants".into()),
+ _ => s.source,
+ })
+ });
+ let start_ms = segment
+ .start_time
+ .zip(start)
+ .map(|(t, origin)| (t - origin).num_milliseconds());
+ let end_ms = segment
+ .end_time
+ .zip(start)
+ .map(|(t, origin)| (t - origin).num_milliseconds());
+ // Retain text if the provider supplies malformed timing.
+ let valid = start_ms.is_none_or(|v| v >= 0)
+ && end_ms.is_none_or(|v| v >= 0)
+ && !matches!((start_ms, end_ms), (Some(a), Some(b)) if b < a);
+ CallTranscriptSegment {
+ sequence_num: index as i32,
+ participant_id: None,
+ speaker_label,
+ content: segment.text,
+ start_ms: if valid { start_ms } else { None },
+ end_ms: if valid { end_ms } else { None },
+ }
+ })
+ .collect::<Vec<_>>();
+ let transcript = (!segments.is_empty()).then(|| CallTranscript {
+ id: macro_uuid::generate_uuid_v7(),
+ recording_id: None,
+ language: None,
+ provider: Some(CallProvider::Granola),
+ started_at: start,
+ segments,
+ });
+ let mut metadata = serde_json::Map::new();
+ metadata.insert(
+ "summary".into(),
+ json!(note.summary_markdown.or(note.summary_text)),
+ );
+ metadata.insert("calendarEvent".into(), json!(note.calendar_event));
+ metadata.insert("sourceTitle".into(), json!(note.title));
+ // Private scratch notes are intentionally not part of a meeting import.
+ Ok(ImportedCall {
+ title: note.title,
+ started_at: start,
+ ended_at: end.filter(|end| start.is_none_or(|start| *end >= start)),
+ participants,
+ transcript,
+ source: CallSource {
+ user_id: connection.user_id.clone(),
+ namespace: connection.namespace.to_string(),
+ provider: CallProvider::Granola,
+ object_type: "note".into(),
+ external_id: String::from(note.id)
+ .try_into()
+ .map_err(|e| rootcause::report!("{e}"))?,
+ external_url: Some(note.web_url),
+ external_updated_at: Some(note.updated_at),
+ synced_at: Some(Utc::now()),
+ metadata,
+ },
+ })
+}
+
+#[cfg(test)]
+mod test;
diff --git a/crates/granola_sync/src/outbound/api/test.rs b/crates/granola_sync/src/outbound/api/test.rs
new file mode 100644
index 0000000000..cb5d1b9297
--- /dev/null
+++ b/crates/granola_sync/src/outbound/api/test.rs
@@ -0,0 +1,214 @@
+use super::*;
+use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
+
+fn connection() -> Connection {
+ Connection {
+ id: macro_uuid::generate_uuid_v7(),
+ namespace: macro_uuid::generate_uuid_v7(),
+ user_id: MacroUserIdStr::parse_from_str("macro|[email protected]")
+ .unwrap()
+ .into_owned(),
+ account_id: "apn_account".into(),
+ scope: Scope::Personal,
+ enabled: true,
+ endpoint_id: None,
+ secret: None,
+ started_at: Utc::now(),
+ last_synced_at: None,
+ last_error: None,
+ }
+}
+fn note() -> Note {
+ serde_json::from_value(json!({
+ "id": "not_123456789abcde", "title": "Design review",
+ "owner": {"name": "Owner", "email": "[email protected]"},
+ "updated_at": "2026-10-07T15:00:00Z", "deleted_at": null,
+ "web_url": "https://notes.granola.ai/d/example",
+ "calendar_event": {"scheduled_start_time": "2026-10-07T12:00:00Z"},
+ "attendees": [{"name": "Guest", "email": "[email protected]"}],
+ "summary_markdown": "Decided to ship", "private_notes_text": "Do not import"
+ }))
+ .unwrap()
+}
+
+#[test]
+fn meetings_without_transcripts_do_not_fabricate_timing_or_macro_participants() {
+ let call = map_meeting(&connection(), note(), vec![]).unwrap();
+ assert!(call.started_at.is_none());
+ assert!(call.ended_at.is_none());
+ assert!(call.transcript.is_none());
+ assert_eq!(call.participants.len(), 1);
+ assert!(call.participants[0].user_id.is_none());
+ assert!(call.participants[0].attendance.is_empty());
+ assert_eq!(call.source.provider, CallProvider::Granola);
+ assert_eq!(call.source.metadata["summary"], "Decided to ship");
+ assert!(
+ !json!(call.source.metadata)
+ .to_string()
+ .contains("Do not import")
+ );
+}
+
+#[test]
+fn transcript_timing_is_relative_to_observed_audio_and_speakers_are_not_guessed() {
+ let segments = serde_json::from_value(json!([
+ {"text":"Hello","start_time":"2026-10-07T12:03:00Z","end_time":"2026-10-07T12:03:02Z","speaker":{"attribution":"me"}},
+ {"text":"Hi","start_time":"2026-10-07T12:03:03Z","end_time":"2026-10-07T12:03:04Z","speaker":{"attribution":"them"}},
+ {"text":"No timing","speaker":{"diarization_label":"Speaker A"}}
+ ])).unwrap();
+ let call = map_meeting(&connection(), note(), segments).unwrap();
+ assert_eq!(
+ call.started_at.unwrap().to_rfc3339(),
+ "2026-10-07T12:03:00+00:00"
+ );
+ let transcript = call.transcript.unwrap();
+ assert_eq!(transcript.segments[1].start_ms, Some(3000));
+ assert_eq!(
+ transcript.segments[0].speaker_label.as_deref(),
+ Some("Owner")
+ );
+ assert_eq!(
+ transcript.segments[1].speaker_label.as_deref(),
+ Some("Other participants")
+ );
+ assert_eq!(
+ transcript.segments[2].speaker_label.as_deref(),
+ Some("Speaker A")
+ );
+ assert!(
+ transcript
+ .segments
+ .iter()
+ .all(|s| s.participant_id.is_none())
+ );
+}
+
+#[test]
+fn provider_ids_reject_path_injection() {
+ assert!(NoteId::try_from("not_123456789abcde".to_owned()).is_ok());
+ for id in [
+ "../webhook-endpoints",
+ "not_123456789abcd/",
+ "",
+ "not_short",
+ ] {
+ assert!(NoteId::try_from(id.to_owned()).is_err());
+ }
+}
+
+struct FakeProxy {
+ responses:
+ std::sync::Mutex<std::collections::VecDeque<pipedream_mcp::domain::ports::ProxyResponse>>,
+ urls: std::sync::Mutex<Vec<String>>,
+}
+impl FakeProxy {
+ fn new(responses: Vec<(u16, Value)>) -> Arc<Self> {
+ Arc::new(Self {
+ responses: std::sync::Mutex::new(
+ responses
+ .into_iter()
+ .map(
+ |(status, body)| pipedream_mcp::domain::ports::ProxyResponse {
+ status,
+ body,
+ },
+ )
+ .collect(),
+ ),
+ urls: Default::default(),
+ })
+ }
+}
+impl ApiProxy for FakeProxy {
+ async fn proxy(
+ &self,
+ connection: &PipedreamConnection,
+ _method: ProxyMethod,
+ url: &str,
+ _body: Option<Value>,
+ ) -> anyhow::Result<pipedream_mcp::domain::ports::ProxyResponse> {
+ assert_eq!(connection.app_slug, "granola");
+ assert_eq!(connection.account_id, "apn_account");
+ self.urls.lock().unwrap().push(url.into());
+ Ok(self
+ .responses
+ .lock()
+ .unwrap()
+ .pop_front()
+ .expect("unexpected request"))
+ }
+}
+fn meeting_json() -> Value {
+ json!({"id":"not_123456789abcde", "title":"Review", "owner":{"email":"[email protected]"},
+ "updated_at":"2026-10-07T15:00:00Z", "web_url":"https://notes.granola.ai/t/test"})
+}
+
+#[tokio::test]
+async fn pagination_fetches_all_text_and_encodes_opaque_cursors() {
+ let proxy = FakeProxy::new(vec![
+ (200, meeting_json()),
+ (
+ 200,
+ json!({"transcript":[{"text":"One"}],"hasMore":true,"cursor":"next/&?"}),
+ ),
+ (
+ 200,
+ json!({"transcript":[{"text":"Two"}],"hasMore":false,"cursor":null}),
+ ),
+ ]);
+ let adapter = GranolaApi(proxy.clone());
+ let call = adapter
+ .meeting(
+ &connection(),
+ &"not_123456789abcde".to_owned().try_into().unwrap(),
+ )
+ .await
+ .unwrap()
+ .unwrap();
+ let segments = call.transcript.unwrap().segments;
+ assert_eq!(segments.len(), 2);
+ assert_eq!(segments[1].content, "Two");
+ assert!(proxy.urls.lock().unwrap()[2].ends_with("?cursor=next%2F%26%3F"));
+}
+
+#[tokio::test]
+async fn failed_later_pages_never_commit_partial_transcripts() {
+ for status in [404, 429, 500] {
+ let proxy = FakeProxy::new(vec![
+ (200, meeting_json()),
+ (
+ 200,
+ json!({"transcript":[{"text":"Partial"}],"hasMore":true,"cursor":"next"}),
+ ),
+ (status, Value::Null),
+ ]);
+ let adapter = GranolaApi(proxy);
+ assert!(
+ adapter
+ .meeting(
+ &connection(),
+ &"not_123456789abcde".to_owned().try_into().unwrap()
+ )
+ .await
+ .is_err()
+ );
+ }
+}
+
+#[tokio::test]
+async fn absent_transcript_still_imports_a_meeting() {
+ let adapter = GranolaApi(FakeProxy::new(vec![
+ (200, meeting_json()),
+ (404, Value::Null),
+ ]));
+ let meeting = adapter
+ .meeting(
+ &connection(),
+ &"not_123456789abcde".to_owned().try_into().unwrap(),
+ )
+ .await
+ .unwrap()
+ .unwrap();
+ assert!(meeting.transcript.is_none());
+ assert_eq!(meeting.title.as_deref(), Some("Review"));
+}
diff --git a/crates/granola_sync/src/outbound/mod.rs b/crates/granola_sync/src/outbound/mod.rs
new file mode 100644
index 0000000000..6cb83c3a83
--- /dev/null
+++ b/crates/granola_sync/src/outbound/mod.rs
@@ -0,0 +1,4 @@
+pub mod accounts;
+pub mod api;
+pub mod pg_repo;
+pub mod signature;
diff --git a/crates/granola_sync/src/outbound/pg_repo.rs b/crates/granola_sync/src/outbound/pg_repo.rs
new file mode 100644
index 0000000000..00bd756261
--- /dev/null
+++ b/crates/granola_sync/src/outbound/pg_repo.rs
@@ -0,0 +1,251 @@
+use crate::domain::{
+ models::*,
+ ports::{Result, SyncRepository},
+};
+use aes_gcm::{
+ Aes256Gcm, KeyInit,
+ aead::{Aead, AeadCore, OsRng, Payload},
+};
+use async_trait::async_trait;
+use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
+use sqlx::PgPool;
+use uuid::Uuid;
+
+/// Signing secrets are encrypted at rest and bound to their connection ID.
+pub struct PgSyncRepository {
+ pool: PgPool,
+ cipher: Aes256Gcm,
+}
+
+impl PgSyncRepository {
+ pub fn new(pool: PgPool, key: &[u8; 32]) -> Self {
+ Self {
+ pool,
+ cipher: Aes256Gcm::new(key.into()),
+ }
+ }
+ fn encrypt(&self, id: Uuid, secret: SigningSecret) -> Result<Vec<u8>> {
+ let nonce = Aes256Gcm::generate_nonce(&mut OsRng);
+ let ciphertext = self
+ .cipher
+ .encrypt(
+ &nonce,
+ Payload {
+ msg: secret.0.as_bytes(),
+ aad: id.as_bytes(),
+ },
+ )
+ .map_err(|_| rootcause::report!("could not encrypt webhook secret"))?;
+ Ok([&nonce[..], &ciphertext].concat())
+ }
+ fn decrypt(&self, id: Uuid, data: Vec<u8>) -> Result<SigningSecret> {
+ if data.len() < 12 {
+ return Err(rootcause::report!("invalid encrypted webhook secret"));
+ }
+ let plaintext = self
+ .cipher
+ .decrypt(
+ data[..12].into(),
+ Payload {
+ msg: &data[12..],
+ aad: id.as_bytes(),
+ },
+ )
+ .map_err(|_| rootcause::report!("could not decrypt webhook secret"))?;
+ Ok(SigningSecret(String::from_utf8(plaintext)?))
+ }
+}
+
+#[async_trait]
+impl SyncRepository for PgSyncRepository {
+ async fn by_user(&self, user: &MacroUserIdStr<'static>) -> Result<Option<Connection>> {
+ let row = sqlx::query!(
+ "SELECT id FROM granola_sync_connections WHERE user_id = $1",
+ user.as_ref()
+ )
+ .fetch_optional(&self.pool)
+ .await?;
+ match row {
+ Some(row) => self.by_id(row.id).await,
+ None => Ok(None),
+ }
+ }
+ async fn by_id(&self, id: Uuid) -> Result<Option<Connection>> {
+ let row = sqlx::query!("SELECT * FROM granola_sync_connections WHERE id = $1", id)
+ .fetch_optional(&self.pool)
+ .await?;
+ row.map(|row| {
+ Ok(Connection {
+ id: row.id,
+ namespace: row.namespace,
+ user_id: MacroUserIdStr::parse_from_str(&row.user_id)?.into_owned(),
+ account_id: row.account_id,
+ scope: serde_json::from_value(serde_json::Value::String(row.scope))?,
+ enabled: row.enabled,
+ endpoint_id: row.endpoint_id,
+ secret: row
+ .signing_secret
+ .map(|s| self.decrypt(id, s))
+ .transpose()?,
+ started_at: row.started_at,
+ last_synced_at: row.last_synced_at,
+ last_error: row.last_error,
+ })
+ })
+ .transpose()
+ }
+ async fn states(&self) -> Result<Vec<SyncState>> {
+ let rows = sqlx::query!(
+ r#"SELECT id, user_id, account_id, scope, enabled, endpoint_id IS NOT NULL AS "has_endpoint!",
+ started_at, last_error
+ FROM granola_sync_connections"#
+ )
+ .fetch_all(&self.pool)
+ .await?;
+ rows.into_iter()
+ .map(|row| {
+ Ok(SyncState {
+ id: row.id,
+ user_id: MacroUserIdStr::parse_from_str(&row.user_id)?.into_owned(),
+ account_id: row.account_id,
+ scope: serde_json::from_value(serde_json::Value::String(row.scope))?,
+ enabled: row.enabled,
+ has_endpoint: row.has_endpoint,
+ started_at: row.started_at,
+ last_error: row.last_error,
+ })
+ })
+ .collect()
+ }
+ async fn reserve(&self, connection: &Connection) -> Result<bool> {
+ let mut tx = self.pool.begin().await?;
+ let row = sqlx::query!(
+ r#"INSERT INTO granola_sync_connections (id, user_id, account_id, scope, started_at, namespace)
+ VALUES ($1, $2, $3, $4, $5, $6)
+ ON CONFLICT (user_id) DO UPDATE SET id = EXCLUDED.id, account_id = EXCLUDED.account_id,
+ scope = EXCLUDED.scope, started_at = EXCLUDED.started_at, enabled = false,
+ endpoint_id = NULL, signing_secret = NULL, last_error = NULL, last_synced_at = NULL
+ WHERE granola_sync_connections.endpoint_id IS NOT NULL
+ OR granola_sync_connections.last_error IS NOT NULL
+ OR granola_sync_connections.started_at < now() - interval '2 minutes'
+ RETURNING id"#,
+ connection.id, connection.user_id.as_ref(), connection.account_id,
+ connection.scope.as_str(), connection.started_at, connection.namespace
+ ).fetch_optional(tx.as_mut()).await?;
+ if row.is_some() {
+ sqlx::query!(
+ "DELETE FROM granola_sync_events WHERE connection_id = $1",
+ connection.id
+ )
+ .execute(tx.as_mut())
+ .await?;
+ }
+ tx.commit().await?;
+ Ok(row.is_some())
+ }
+ async fn activate(&self, id: Uuid, webhook: Webhook, scope: Scope) -> Result<bool> {
+ let encrypted = self.encrypt(id, webhook.secret)?;
+ let changed = sqlx::query!(
+ "UPDATE granola_sync_connections SET enabled = true, endpoint_id = $2, signing_secret = $3, scope = $4
+ WHERE id = $1 AND last_error IS NULL AND endpoint_id IS NULL",
+ id, webhook.id, encrypted, scope.as_str()
+ ).execute(&self.pool).await?.rows_affected();
+ Ok(changed == 1)
+ }
+ async fn stop(&self, id: Uuid) -> Result<()> {
+ sqlx::query!(
+ "UPDATE granola_sync_connections SET enabled = false, last_error = $2 WHERE id = $1",
+ id,
+ STOPPED
+ )
+ .execute(&self.pool)
+ .await?;
+ Ok(())
+ }
+ async fn failed_setup(&self, id: Uuid) -> Result<()> {
+ sqlx::query!("UPDATE granola_sync_connections SET enabled = false, last_error = 'Could not register Granola webhook' WHERE id = $1", id)
+ .execute(&self.pool).await?;
+ Ok(())
+ }
+ async fn enqueue(&self, id: Uuid, event: Event) -> Result<()> {
+ sqlx::query!(
+ r#"INSERT INTO granola_sync_events (connection_id, event_id, note_id, event_type, occurred_at)
+ SELECT id, $2, $3, $4, $5 FROM granola_sync_connections WHERE id = $1 AND enabled
+ ON CONFLICT (connection_id, event_id) DO NOTHING"#,
+ id, event.event_id, event.note_id.as_ref(), event.event_type.as_str(), event.occurred_at
+ ).execute(&self.pool).await?;
+ Ok(())
+ }
+ async fn claim(&self) -> Result<Option<Job>> {
+ let lease = macro_uuid::generate_uuid_v7();
+ let row = sqlx::query!(
+ r#"WITH candidate AS (
+ SELECT e.connection_id, e.event_id FROM granola_sync_events e
+ JOIN granola_sync_connections c ON c.id = e.connection_id
+ WHERE e.completed_at IS NULL AND e.available_at <= now() AND c.enabled
+ ORDER BY e.available_at LIMIT 1 FOR UPDATE OF e SKIP LOCKED
+ )
+ UPDATE granola_sync_events e SET lease_id = $1, attempts = e.attempts + 1,
+ available_at = now() + interval '10 minutes'
+ FROM candidate c WHERE e.connection_id = c.connection_id AND e.event_id = c.event_id
+ RETURNING e.connection_id, e.event_id, e.note_id, e.event_type, e.occurred_at, e.attempts"#,
+ lease
+ ).fetch_optional(&self.pool).await?;
+ let Some(row) = row else {
+ return Ok(None);
+ };
+ let Some(connection) = self.by_id(row.connection_id).await? else {
+ return Ok(None);
+ };
+ Ok(Some(Job {
+ connection,
+ lease_id: lease,
+ attempts: row.attempts,
+ event: Event {
+ event_id: row.event_id,
+ note_id: row
+ .note_id
+ .try_into()
+ .map_err(|e| rootcause::report!("{e}"))?,
+ event_type: serde_json::from_value(serde_json::Value::String(row.event_type))?,
+ occurred_at: row.occurred_at,
+ },
+ }))
+ }
+ async fn finish(&self, job: &Job, success: bool) -> Result<()> {
+ let mut tx = self.pool.begin().await?;
+ let retry_seconds = 5_i32
+ .saturating_mul(2_i32.saturating_pow(job.attempts.min(10) as u32))
+ .min(3600);
+ let changed = sqlx::query!(
+ r#"UPDATE granola_sync_events SET completed_at = CASE WHEN $4 THEN now() ELSE NULL END,
+ available_at = now() + make_interval(secs => $5::double precision), lease_id = NULL
+ WHERE connection_id = $1 AND event_id = $2 AND lease_id = $3"#,
+ job.connection.id,
+ job.event.event_id,
+ job.lease_id,
+ success,
+ f64::from(retry_seconds)
+ )
+ .execute(tx.as_mut())
+ .await?
+ .rows_affected();
+ if changed == 1 {
+ sqlx::query!(
+ r#"UPDATE granola_sync_connections
+ SET last_synced_at = CASE WHEN $2 THEN now() ELSE last_synced_at END,
+ last_error = CASE WHEN $2 THEN NULL ELSE 'Meeting sync failed; retrying automatically' END
+ WHERE id = $1 AND enabled"#,
+ job.connection.id, success
+ ).execute(tx.as_mut()).await?;
+ }
+ // Keep deduplication records longer than Granola's four-day retry window.
+ sqlx::query!("DELETE FROM granola_sync_events WHERE connection_id = $1 AND completed_at < now() - interval '7 days'", job.connection.id)
+ .execute(tx.as_mut()).await?;
+ tx.commit().await?;
+ Ok(())
+ }
+}
+
+#[cfg(test)]
+mod test;
diff --git a/crates/granola_sync/src/outbound/pg_repo/test.rs b/crates/granola_sync/src/outbound/pg_repo/test.rs
new file mode 100644
index 0000000000..ff5fd22ede
--- /dev/null
+++ b/crates/granola_sync/src/outbound/pg_repo/test.rs
@@ -0,0 +1,249 @@
+use super::*;
+use macro_db_migrator::MACRO_DB_MIGRATIONS;
+
+fn connection() -> Connection {
+ Connection {
+ id: macro_uuid::generate_uuid_v7(),
+ namespace: macro_uuid::generate_uuid_v7(),
+ user_id: MacroUserIdStr::parse_from_str("macro|[email protected]")
+ .unwrap()
+ .into_owned(),
+ account_id: "apn_test".into(),
+ scope: Scope::Personal,
+ enabled: false,
+ endpoint_id: None,
+ secret: None,
+ started_at: chrono::Utc::now(),
+ last_synced_at: None,
+ last_error: None,
+ }
+}
+fn event() -> Event {
+ Event {
+ event_id: macro_uuid::generate_uuid_v7(),
+ event_type: EventType::Generated,
+ note_id: "not_123456789abcde".to_owned().try_into().unwrap(),
+ occurred_at: chrono::Utc::now(),
+ }
+}
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(path = "../../../fixtures", scripts("users"))
+)]
+async fn durable_deduplication_leases_and_stop(pool: PgPool) {
+ let repo = PgSyncRepository::new(pool.clone(), &[7; 32]);
+ let connection = connection();
+ assert!(repo.reserve(&connection).await.unwrap());
+ assert!(!repo.reserve(&connection).await.unwrap());
+ assert!(
+ repo.activate(
+ connection.id,
+ Webhook {
+ id: "whe_test".into(),
+ secret: SigningSecret("secret".into())
+ },
+ Scope::All,
+ )
+ .await
+ .unwrap()
+ );
+ assert_eq!(
+ repo.by_id(connection.id)
+ .await
+ .unwrap()
+ .unwrap()
+ .secret
+ .unwrap()
+ .0,
+ "secret"
+ );
+ let event = event();
+ repo.enqueue(connection.id, event.clone()).await.unwrap();
+ repo.enqueue(connection.id, event.clone()).await.unwrap();
+ let job = repo.claim().await.unwrap().unwrap();
+ assert!(repo.claim().await.unwrap().is_none());
+ repo.finish(&job, false).await.unwrap();
+ assert!(repo.claim().await.unwrap().is_none());
+ sqlx::query!(
+ "UPDATE granola_sync_events SET available_at = now() WHERE connection_id = $1",
+ connection.id
+ )
+ .execute(&pool)
+ .await
+ .unwrap();
+ let retry = repo.claim().await.unwrap().unwrap();
+ assert_ne!(job.lease_id, retry.lease_id);
+ repo.finish(&job, true).await.unwrap(); // expired worker cannot complete a newer lease
+ let state = sqlx::query!(
+ "SELECT completed_at FROM granola_sync_events WHERE connection_id = $1",
+ connection.id
+ )
+ .fetch_one(&pool)
+ .await
+ .unwrap();
+ assert!(state.completed_at.is_none());
+ repo.finish(&retry, true).await.unwrap();
+ repo.enqueue(connection.id, event).await.unwrap();
+ assert!(repo.claim().await.unwrap().is_none());
+ repo.enqueue(connection.id, super::test::event())
+ .await
+ .unwrap();
+ repo.stop(connection.id).await.unwrap();
+ assert!(repo.claim().await.unwrap().is_none());
+}
+
+#[tokio::test]
+async fn encryption_is_bound_to_the_connection() {
+ // No database I/O: a lazy pool suffices for the cipher round trip.
+ let pool = sqlx::postgres::PgPoolOptions::new()
+ .connect_lazy("postgres://localhost/test")
+ .unwrap();
+ let repo = PgSyncRepository::new(pool, &[7; 32]);
+ let id = macro_uuid::generate_uuid_v7();
+ let encrypted = repo.encrypt(id, SigningSecret("secret".into())).unwrap();
+ assert!(
+ repo.decrypt(macro_uuid::generate_uuid_v7(), encrypted)
+ .is_err()
+ );
+}
+
+use crate::domain::{
+ ports::{Accounts, Granola},
+ service::{Service, SyncService},
+};
+use call::domain::{
+ imports::{CallImportService, ImportedCall, ImportedCallPreview},
+ records::CallEntityRecord,
+};
+use std::sync::{
+ Arc,
+ atomic::{AtomicBool, Ordering},
+};
+
+struct Account(Arc<AtomicBool>);
+#[async_trait]
+impl Accounts for Account {
+ async fn account(&self, _: &MacroUserIdStr<'static>) -> Result<Option<String>> {
+ Ok(self.0.load(Ordering::SeqCst).then(|| "apn_test".into()))
+ }
+ async fn connected(&self) -> Result<Vec<(MacroUserIdStr<'static>, String)>> {
+ Ok(self
+ .0
+ .load(Ordering::SeqCst)
+ .then(|| (connection().user_id, "apn_test".to_string()))
+ .into_iter()
+ .collect())
+ }
+}
+/// A personal key: Granola rejects the workspace scope.
+struct Provider;
+#[async_trait]
+impl Granola for Provider {
+ async fn register(&self, _: &Connection, _: &str, scope: Scope) -> Result<Registration> {
+ if scope == Scope::Workspace {
+ return Ok(Registration::ScopeRejected);
+ }
+ Ok(Registration::Registered(Webhook {
+ id: "whe_test".into(),
+ secret: SigningSecret("whsec_c2VjcmV0".into()),
+ }))
+ }
+ async fn unregister(&self, _: &Connection) -> Result<()> {
+ Ok(())
+ }
+ async fn meeting(&self, _: &Connection, _: &NoteId) -> Result<Option<ImportedCall>> {
+ panic!("webhook receipt must not fetch provider content")
+ }
+}
+struct Calls;
+#[async_trait]
+impl CallImportService for Calls {
+ async fn ingest(&self, _: ImportedCall) -> Result<Uuid> {
+ panic!("webhook receipt must only enqueue")
+ }
+ async fn list(&self, _: &MacroUserIdStr<'static>) -> Result<Vec<ImportedCallPreview>> {
+ Ok(vec![])
+ }
+ async fn read(&self, _: &MacroUserIdStr<'static>, _: Uuid) -> Result<Option<CallEntityRecord>> {
+ Ok(None)
+ }
+}
+
+#[sqlx::test(
+ migrator = "MACRO_DB_MIGRATIONS",
+ fixtures(path = "../../../fixtures", scripts("users"))
+)]
+async fn connecting_starts_sync_and_disconnecting_stops_it_without_leaking_deliveries(
+ pool: PgPool,
+) {
+ use base64::Engine;
+ use hmac::{Hmac, Mac};
+ let enabled = Arc::new(AtomicBool::new(true));
+ let service = Service {
+ repo: PgSyncRepository::new(pool, &[7; 32]),
+ granola: Provider,
+ accounts: Account(enabled.clone()),
+ verifier: crate::outbound::signature::StandardWebhooks,
+ calls: Arc::new(Calls),
+ public_url: "https://macro.test".into(),
+ };
+ let user = connection().user_id;
+ // Connecting the account is enough; no user action starts sync.
+ service.reconcile().await.unwrap();
+ let connection = service.repo.by_user(&user).await.unwrap().unwrap();
+ assert!(connection.enabled);
+ assert_eq!(connection.scope, Scope::All);
+ service.reconcile().await.unwrap();
+ assert_eq!(
+ service.repo.by_user(&user).await.unwrap().unwrap().id,
+ connection.id,
+ "an active sync is not re-registered"
+ );
+ let id = macro_uuid::generate_uuid_v7().to_string();
+ let timestamp = chrono::Utc::now().timestamp().to_string();
+ let body = serde_json::to_vec(&serde_json::json!({
+ "event_id":id, "event_type":"note.generated", "note_id":"not_123456789abcde",
+ "occurred_at": connection.started_at - chrono::Duration::seconds(30)
+ }))
+ .unwrap();
+ let mut mac = <Hmac<sha2::Sha256> as Mac>::new_from_slice(b"secret").unwrap();
+ mac.update(format!("{id}.{timestamp}.").as_bytes());
+ mac.update(&body);
+ let signature = format!(
+ "v1,{}",
+ base64::engine::general_purpose::STANDARD.encode(mac.finalize().into_bytes())
+ );
+ let delivery = || Delivery {
+ id: &id,
+ timestamp: &timestamp,
+ signature: &signature,
+ body: &body,
+ };
+ service.receive(connection.id, delivery()).await.unwrap();
+ let job = service.repo.claim().await.unwrap().unwrap();
+ assert_eq!(job.event.event_id.to_string(), id); // accepted despite provider clock skew
+ service.repo.finish(&job, true).await.unwrap();
+ let invalid = Delivery {
+ signature: "v1,invalid",
+ ..delivery()
+ };
+ assert!(matches!(
+ service.receive(connection.id, invalid).await,
+ Err(SyncError::InvalidDelivery)
+ ));
+ // Disconnecting stops sync; reconnecting restarts it with the same namespace.
+ enabled.store(false, Ordering::SeqCst);
+ service.reconcile().await.unwrap();
+ assert!(!service.repo.by_user(&user).await.unwrap().unwrap().enabled);
+ enabled.store(true, Ordering::SeqCst);
+ service.reconcile().await.unwrap();
+ let renewed = service.repo.by_user(&user).await.unwrap().unwrap();
+ assert!(renewed.enabled);
+ assert_ne!(renewed.id, connection.id);
+ assert_eq!(renewed.namespace, connection.namespace);
+ assert!(matches!(
+ service.receive(connection.id, delivery()).await,
+ Err(SyncError::InvalidDelivery)
+ ));
+}
diff --git a/crates/granola_sync/src/outbound/signature.rs b/crates/granola_sync/src/outbound/signature.rs
new file mode 100644
index 0000000000..12b3677334
--- /dev/null
+++ b/crates/granola_sync/src/outbound/signature.rs
@@ -0,0 +1,51 @@
+use crate::domain::{
+ models::{Delivery, SigningSecret},
+ ports::DeliveryVerifier,
+};
+use base64::{Engine, engine::general_purpose::STANDARD};
+use hmac::{Hmac, Mac};
+use sha2::Sha256;
+
+/// Standard Webhooks HMAC verification with a five-minute replay window.
+pub struct StandardWebhooks;
+
+impl DeliveryVerifier for StandardWebhooks {
+ fn verify(&self, secret: &SigningSecret, delivery: &Delivery<'_>) -> bool {
+ verify_at(secret, delivery, chrono::Utc::now().timestamp())
+ }
+}
+
+fn verify_at(secret: &SigningSecret, delivery: &Delivery<'_>, now: i64) -> bool {
+ let Ok(timestamp) = delivery.timestamp.parse::<i64>() else {
+ return false;
+ };
+ if now.abs_diff(timestamp) > 300 {
+ return false;
+ }
+ let Some(secret) = secret.0.strip_prefix("whsec_") else {
+ return false;
+ };
+ let Ok(key) = STANDARD.decode(secret) else {
+ return false;
+ };
+ let Ok(mut mac) = Hmac::<Sha256>::new_from_slice(&key) else {
+ return false;
+ };
+ mac.update(delivery.id.as_bytes());
+ mac.update(b".");
+ mac.update(delivery.timestamp.as_bytes());
+ mac.update(b".");
+ mac.update(delivery.body);
+ delivery.signature.split_whitespace().any(|signature| {
+ let Some(signature) = signature.strip_prefix("v1,") else {
+ return false;
+ };
+ let Ok(signature) = STANDARD.decode(signature) else {
+ return false;
+ };
+ mac.clone().verify_slice(&signature).is_ok()
+ })
+}
+
+#[cfg(test)]
+mod test;
diff --git a/crates/granola_sync/src/outbound/signature/test.rs b/crates/granola_sync/src/outbound/signature/test.rs
new file mode 100644
index 0000000000..37cd772a97
--- /dev/null
+++ b/crates/granola_sync/src/outbound/signature/test.rs
@@ -0,0 +1,48 @@
+use super::*;
+
+#[test]
+fn signatures_cover_raw_body_timestamp_and_id() {
+ let secret = SigningSecret(format!("whsec_{}", STANDARD.encode([7_u8; 32])));
+ let mut mac = Hmac::<Sha256>::new_from_slice(&[7; 32]).unwrap();
+ mac.update(b"event.1000.{\"hello\":true}");
+ let signature = format!("v1,{}", STANDARD.encode(mac.finalize().into_bytes()));
+ let mut delivery = Delivery {
+ id: "event",
+ timestamp: "1000",
+ signature: &signature,
+ body: br#"{"hello":true}"#,
+ };
+ assert!(verify_at(&secret, &delivery, 1000));
+ assert!(!verify_at(&secret, &delivery, 1301));
+ assert!(!verify_at(&secret, &delivery, 699));
+ delivery.body = br#"{"hello":false}"#;
+ assert!(!verify_at(&secret, &delivery, 1000));
+ delivery.body = br#"{"hello":true}"#;
+ delivery.id = "other";
+ assert!(!verify_at(&secret, &delivery, 1000));
+}
+
+#[test]
+fn accepts_a_valid_signature_among_rotated_keys_but_not_unknown_versions() {
+ let secret = SigningSecret(format!("whsec_{}", STANDARD.encode([9_u8; 32])));
+ let mut mac = Hmac::<Sha256>::new_from_slice(&[9; 32]).unwrap();
+ mac.update(b"event.1000.{}");
+ let valid = STANDARD.encode(mac.finalize().into_bytes());
+ let signature = format!("v1,invalid v1,{valid}");
+ let delivery = Delivery {
+ id: "event",
+ timestamp: "1000",
+ signature: &signature,
+ body: b"{}",
+ };
+ assert!(verify_at(&secret, &delivery, 1000));
+ let invalid = format!("v2,{valid}");
+ assert!(!verify_at(
+ &secret,
+ &Delivery {
+ signature: &invalid,
+ ..delivery
+ },
+ 1000
+ ));
+}
diff --git a/crates/macro_db_client/migrations/20261007190852_granola_meeting_sync.sql b/crates/macro_db_client/migrations/20261007190852_granola_meeting_sync.sql
new file mode 100644
index 0000000000..e5fe4de2d9
--- /dev/null
+++ b/crates/macro_db_client/migrations/20261007190852_granola_meeting_sync.sql
@@ -0,0 +1,31 @@
+-- Sync is explicit and independent of enabling a connector for AI tools.
+CREATE TABLE granola_sync_connections (
+ id UUID PRIMARY KEY,
+ user_id TEXT NOT NULL UNIQUE REFERENCES "User"(id) ON UPDATE CASCADE ON DELETE CASCADE,
+ account_id TEXT NOT NULL,
+ scope TEXT NOT NULL CHECK (scope IN ('personal', 'public', 'all', 'workspace')),
+ enabled BOOLEAN NOT NULL DEFAULT FALSE,
+ endpoint_id TEXT,
+ signing_secret BYTEA,
+ started_at TIMESTAMPTZ NOT NULL DEFAULT now(),
+ last_synced_at TIMESTAMPTZ,
+ last_error TEXT,
+ CHECK ((endpoint_id IS NULL) = (signing_secret IS NULL))
+);
+
+-- The provider delivers at least once. Persist before acknowledging; processing
+-- leases recover automatically if a service instance exits mid-import.
+CREATE TABLE granola_sync_events (
+ connection_id UUID NOT NULL REFERENCES granola_sync_connections(id) ON UPDATE CASCADE ON DELETE CASCADE,
+ event_id UUID NOT NULL,
+ note_id TEXT NOT NULL CHECK (note_id ~ '^not_[a-zA-Z0-9]{14}$'),
+ event_type TEXT NOT NULL CHECK (event_type IN ('note.generated', 'note.edited', 'note.access_granted')),
+ occurred_at TIMESTAMPTZ NOT NULL,
+ attempts INTEGER NOT NULL DEFAULT 0,
+ available_at TIMESTAMPTZ NOT NULL DEFAULT now(),
+ lease_id UUID,
+ completed_at TIMESTAMPTZ,
+ PRIMARY KEY (connection_id, event_id)
+);
+CREATE INDEX granola_sync_events_pending_idx ON granola_sync_events(available_at)
+ WHERE completed_at IS NULL;
diff --git a/crates/macro_db_client/migrations/20261007191926_granola_sync_stable_namespace.sql b/crates/macro_db_client/migrations/20261007191926_granola_sync_stable_namespace.sql
new file mode 100644
index 0000000000..1026db3fb1
--- /dev/null
+++ b/crates/macro_db_client/migrations/20261007191926_granola_sync_stable_namespace.sql
@@ -0,0 +1,4 @@
+-- Credential rotation must not change imported meeting identity.
+ALTER TABLE granola_sync_connections ADD COLUMN namespace UUID;
+UPDATE granola_sync_connections SET namespace = id;
+ALTER TABLE granola_sync_connections ALTER COLUMN namespace SET NOT NULL;
diff --git a/crates/models_soup/src/call_record/test.rs b/crates/models_soup/src/call_record/test.rs
index 163e6b5833..f24e5d7609 100644
--- a/crates/models_soup/src/call_record/test.rs
+++ b/crates/models_soup/src/call_record/test.rs
@@ -11,7 +11,7 @@ fn record_with_participants(user_ids: &[&str]) -> CallRecord {
CallRecord {
call_id: Uuid::now_v7(),
channel_id: Some(Uuid::now_v7()),
- room_name: "room".to_string(),
+ room_name: Some("room".to_string()),
created_by: "macro|[email protected]".to_string(),
started_at: now,
ended_at: None,
@@ -39,6 +39,7 @@ fn record_with_participants(user_ids: &[&str]) -> CallRecord {
.collect(),
guests: Vec::new(),
transcript: Vec::new(),
+ source: None,
user_access_level: None,
viewer_has_declined: false,
}
diff --git a/crates/pipedream_mcp/Cargo.toml b/crates/pipedream_mcp/Cargo.toml
index 6fa0d89f9b..1278ff9e0b 100644
--- a/crates/pipedream_mcp/Cargo.toml
+++ b/crates/pipedream_mcp/Cargo.toml
@@ -8,6 +8,7 @@ publish = false
ai_toolset = { path = "../ai_toolset" }
anyhow.workspace = true
async-trait.workspace = true
+base64.workspace = true
axum.workspace = true
futures.workspace = true
macro_authorization = { path = "../macro_authorization", default-features = false, features = [
diff --git a/crates/pipedream_mcp/src/domain/ports.rs b/crates/pipedream_mcp/src/domain/ports.rs
index 79115b9f2e..4823a3a9bd 100644
--- a/crates/pipedream_mcp/src/domain/ports.rs
+++ b/crates/pipedream_mcp/src/domain/ports.rs
@@ -3,6 +3,47 @@ use super::models::{
PipedreamConnection,
};
+/// HTTP methods supported by trusted backend integrations through Connect Proxy.
+#[derive(Clone, Copy)]
+pub enum ProxyMethod {
+ /// Read a provider resource.
+ Get,
+ /// Create a provider resource, such as a webhook subscription.
+ Post,
+ /// Remove a provider resource.
+ Delete,
+}
+
+/// A provider response. Never log the body: registration can return secrets.
+pub struct ProxyResponse {
+ /// Upstream HTTP status.
+ pub status: u16,
+ /// Provider JSON body.
+ pub body: serde_json::Value,
+}
+
+/// Authenticated provider requests using credentials held by Pipedream.
+/// Callers must obtain the account from the authenticated user's connection.
+pub trait ApiProxy: Send + Sync {
+ /// Pipedream restricts targets to the connected app's allowed domains.
+ fn proxy(
+ &self,
+ connection: &PipedreamConnection,
+ method: ProxyMethod,
+ url: &str,
+ body: Option<serde_json::Value>,
+ ) -> impl Future<Output = anyhow::Result<ProxyResponse>> + Send;
+}
+
+/// Cross-user lookup for background integrations that follow a connected app.
+pub trait AppConnections: Send + Sync + 'static {
+ /// Every user's enabled connection to `app_slug`.
+ fn list_enabled_for_app(
+ &self,
+ app_slug: &str,
+ ) -> impl Future<Output = anyhow::Result<Vec<PipedreamConnection>>> + Send;
+}
+
/// Port for persisting Pipedream-connected apps, keyed by user and app slug.
pub trait ConnectionStore: Send + Sync + 'static {
/// Error type for store operations.
diff --git a/crates/pipedream_mcp/src/outbound/api.rs b/crates/pipedream_mcp/src/outbound/api.rs
index 66d7d3b4bf..aead082711 100644
--- a/crates/pipedream_mcp/src/outbound/api.rs
+++ b/crates/pipedream_mcp/src/outbound/api.rs
@@ -2,8 +2,10 @@ use crate::domain::models::{
CatalogEntry, CatalogPage, ConnectToken, McpServer, PipedreamAccount, PipedreamConnection,
client_info,
};
+use crate::domain::ports::{ApiProxy, ProxyMethod, ProxyResponse};
use crate::domain::ports::{ConnectorDirectory, McpConnection, PipedreamConnect};
use anyhow::Context;
+use base64::Engine;
use reqwest::header::{HeaderMap, HeaderValue};
use rmcp::service::ServiceExt;
use rmcp::transport::StreamableHttpClientTransport;
@@ -15,6 +17,50 @@ use url::Url;
mod capabilities;
+impl ApiProxy for PipedreamClient {
+ #[tracing::instrument(skip_all, err)]
+ async fn proxy(
+ &self,
+ connection: &PipedreamConnection,
+ method: ProxyMethod,
+ url: &str,
+ body: Option<serde_json::Value>,
+ ) -> anyhow::Result<ProxyResponse> {
+ let target = base64::engine::general_purpose::URL_SAFE_NO_PAD.encode(url);
+ let method = match method {
+ ProxyMethod::Get => reqwest::Method::GET,
+ ProxyMethod::Post => reqwest::Method::POST,
+ ProxyMethod::Delete => reqwest::Method::DELETE,
+ };
+ let mut request = self
+ .authed(
+ self.http
+ .request(method, self.connect_api(&format!("/proxy/{target}"))),
+ )
+ .await?
+ .query(&[
+ ("external_user_id", connection.user_id.as_ref()),
+ ("account_id", connection.account_id.as_str()),
+ ]);
+ if let Some(body) = body {
+ request = request.json(&body);
+ }
+ let response = request
+ .send()
+ .await
+ .context("Pipedream proxy request failed")?;
+ let status = response.status().as_u16();
+ // Preserve status for provider-specific retries and missing resources.
+ let bytes = response.bytes().await?;
+ let body = if bytes.is_empty() {
+ serde_json::Value::Null
+ } else {
+ serde_json::from_slice(&bytes).context("invalid proxy JSON response")?
+ };
+ Ok(ProxyResponse { status, body })
+ }
+}
+
/// Default base URL of the Pipedream REST API.
pub const DEFAULT_API_URL: &str = "https://api.pipedream.com";
diff --git a/crates/pipedream_mcp/src/outbound/api/test.rs b/crates/pipedream_mcp/src/outbound/api/test.rs
index 0e8629bd36..dd244258dd 100644
--- a/crates/pipedream_mcp/src/outbound/api/test.rs
+++ b/crates/pipedream_mcp/src/outbound/api/test.rs
@@ -29,3 +29,98 @@ fn an_app_without_an_auth_flow_is_not_connectable() {
fn a_different_slug_than_the_one_asked_for_is_not_that_app() {
assert!(connectable_catalog_entry("linear", app("slack", Some("oauth"))).is_none());
}
+
+#[tokio::test]
+async fn proxy_routes_the_connected_user_and_preserves_provider_status() {
+ use super::{
+ ApiProxy, CachedToken, PipedreamClient, PipedreamConfig, PipedreamConnection, ProxyMethod,
+ };
+ use axum::{
+ Router,
+ body::Bytes,
+ extract::OriginalUri,
+ http::{HeaderMap, Method, StatusCode},
+ routing::any,
+ };
+ use base64::Engine;
+ use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
+ use std::{
+ sync::{Arc, Mutex},
+ time::{Duration, Instant},
+ };
+ let received = Arc::new(Mutex::new(Vec::new()));
+ let requests = received.clone();
+ let router = Router::new().fallback(any(
+ move |method: Method, uri: OriginalUri, headers: HeaderMap, body: Bytes| {
+ let requests = requests.clone();
+ async move {
+ requests
+ .lock()
+ .unwrap()
+ .push((method, uri.0, headers, body));
+ (
+ StatusCode::TOO_MANY_REQUESTS,
+ axum::Json(serde_json::json!({"error":"rate limited"})),
+ )
+ }
+ },
+ ));
+ let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
+ let address = listener.local_addr().unwrap();
+ let server = tokio::spawn(async move {
+ axum::serve(listener, router).await.unwrap();
+ });
+ let client = PipedreamClient::new(PipedreamConfig {
+ client_id: "client".into(),
+ client_secret: "secret".into(),
+ project_id: "proj_test".into(),
+ environment: "development".into(),
+ allowed_origins: vec![],
+ api_url: format!("http://{address}"),
+ mcp_url: "https://unused.test".into(),
+ })
+ .unwrap();
+ *client.access_token.lock().unwrap() = Some(CachedToken {
+ token: "test-token".into(),
+ valid_until: Instant::now() + Duration::from_secs(3600),
+ });
+ let account = PipedreamConnection {
+ user_id: MacroUserIdStr::parse_from_str("macro|[email protected]")
+ .unwrap()
+ .into_owned(),
+ app_slug: "granola".into(),
+ server_name: "Granola".into(),
+ account_id: "apn_123".into(),
+ enabled: true,
+ };
+ let target = "https://public-api.granola.ai/v1/webhook-endpoints";
+ let body = serde_json::json!({"url":"https://macro.test/webhook"});
+ let result = client
+ .proxy(&account, ProxyMethod::Post, target, Some(body.clone()))
+ .await
+ .unwrap();
+ assert_eq!(result.status, 429);
+ let requests = received.lock().unwrap();
+ let (method, uri, headers, bytes) = &requests[0];
+ assert_eq!(*method, Method::POST);
+ assert_eq!(
+ uri.path(),
+ format!(
+ "/v1/connect/proj_test/proxy/{}",
+ base64::engine::general_purpose::URL_SAFE_NO_PAD.encode(target)
+ )
+ );
+ let query: std::collections::HashMap<_, _> =
+ url::form_urlencoded::parse(uri.query().unwrap().as_bytes())
+ .into_owned()
+ .collect();
+ assert_eq!(query["external_user_id"], "macro|[email protected]");
+ assert_eq!(query["account_id"], "apn_123");
+ assert_eq!(headers["authorization"], "Bearer test-token");
+ assert_eq!(headers["x-pd-environment"], "development");
+ assert_eq!(
+ serde_json::from_slice::<serde_json::Value>(bytes).unwrap(),
+ body
+ );
+ server.abort();
+}
diff --git a/crates/pipedream_mcp/src/outbound/pg_connection_repo.rs b/crates/pipedream_mcp/src/outbound/pg_connection_repo.rs
index ea57597cc9..c43de399b7 100644
--- a/crates/pipedream_mcp/src/outbound/pg_connection_repo.rs
+++ b/crates/pipedream_mcp/src/outbound/pg_connection_repo.rs
@@ -1,5 +1,5 @@
use crate::domain::models::{MacroUserIdStr, PipedreamConnection};
-use crate::domain::ports::ConnectionStore;
+use crate::domain::ports::{AppConnections, ConnectionStore};
use macro_user_id::cowlike::CowLike;
use sqlx::PgPool;
@@ -122,6 +122,37 @@ impl ConnectionStore for PgConnectionRepo {
}
}
+impl AppConnections for PgConnectionRepo {
+ #[tracing::instrument(skip(self), err)]
+ async fn list_enabled_for_app(
+ &self,
+ app_slug: &str,
+ ) -> anyhow::Result<Vec<PipedreamConnection>> {
+ let rows = sqlx::query!(
+ r#"
+ SELECT user_id, app_slug, server_name, account_id, enabled
+ FROM pipedream_mcp_connections
+ WHERE app_slug = $1 AND enabled
+ "#,
+ app_slug,
+ )
+ .fetch_all(&self.pool)
+ .await?;
+
+ rows.into_iter()
+ .map(|row| {
+ to_record(
+ row.user_id,
+ row.app_slug,
+ row.server_name,
+ row.account_id,
+ row.enabled,
+ )
+ })
+ .collect()
+ }
+}
+
fn to_record(
user_id: String,
app_slug: String,
diff --git a/crates/share_permission_db_utils/src/lib.rs b/crates/share_permission_db_utils/src/lib.rs
index 6db95f8a45..7f7617be1e 100644
--- a/crates/share_permission_db_utils/src/lib.rs
+++ b/crates/share_permission_db_utils/src/lib.rs
@@ -2,6 +2,19 @@
pub mod team_share;
+/// Create private sharing state for an entity, without team defaults or grants.
+pub async fn create_private_share_permission<'e, E>(
+ executor: E,
+ id: &str,
+) -> Result<(), sqlx::Error>
+where
+ E: sqlx::Executor<'e, Database = sqlx::Postgres>,
+{
+ sqlx::query!(r#"INSERT INTO "SharePermission" (id, "linkShare", "linkShareAccessLevel") VALUES ($1, NULL, NULL)"#, id)
+ .execute(executor).await?;
+ Ok(())
+}
+
use anyhow::Context;
use macro_user_id::{cowlike::CowLike, user_id::MacroUserIdStr};
use models_permissions::share_permission::access_level::AccessLevel;
diff --git a/crates/soup/src/domain/service/tests.rs b/crates/soup/src/domain/service/tests.rs
index 71e887211c..61e71a02ae 100644
--- a/crates/soup/src/domain/service/tests.rs
+++ b/crates/soup/src/domain/service/tests.rs
@@ -249,7 +249,7 @@ fn call_record(
call::domain::models::CallRecord {
call_id,
channel_id: Some(channel_id),
- room_name: String::new(),
+ room_name: None,
created_by: created_by.to_string(),
started_at,
ended_at: None,
@@ -272,6 +272,7 @@ fn call_record(
participants: Vec::new(),
guests: Vec::new(),
transcript: Vec::new(),
+ source: None,
}
}
diff --git a/deny.toml b/deny.toml
index 266eb580d6..eb418d5683 100644
--- a/deny.toml
+++ b/deny.toml
@@ -96,6 +96,8 @@ ignore = [
{ id = "RUSTSEC-2026-0367", reason = "zip 3.0.0 is a utoipa-swagger-ui build-dependency that reads its vendored Swagger UI archive entry by entry and never calls extract(); no release uses patched zip >= 9" },
{ id = "RUSTSEC-2026-0368", reason = "zip 3.0.0 is a utoipa-swagger-ui build-dependency that reads its vendored Swagger UI archive entry by entry and never calls extract(); no release uses patched zip >= 9" },
{ id = "RUSTSEC-2026-0369", reason = "zip 3.0.0 is a utoipa-swagger-ui build-dependency that reads its vendored Swagger UI archive entry by entry and never calls extract(); no release uses patched zip >= 9" },
+ # Revisit: drop when sqlx depends on webpki-roots 1.x directly.
+ { id = "RUSTSEC-2026-0381", reason = "webpki-roots 0.26.11 pinned by sqlx-core 0.8.6 is a semver-trick facade over webpki-roots 1.x; this lockfile resolves it to patched 1.0.10, which removed the distrusted emSign root" },
#{ id = "RUSTSEC-0000-0000", reason = "you can specify a reason the advisory is ignored" },
#"[email protected]", # you can also ignore yanked crate versions if you wish
#{ crate = "[email protected]", reason = "you can specify why you are ignoring the yanked crate" },
diff --git a/docs/agent-guide/calls.md b/docs/agent-guide/calls.md
index 8177094b8f..4189761298 100644
--- a/docs/agent-guide/calls.md
+++ b/docs/agent-guide/calls.md
@@ -36,6 +36,20 @@ the breadcrumb return, browser Back/Forward, and clicking the same transcript
search hit twice after playing elsewhere. On phones, recorded call headers omit
**Call Again**.
+### Imported Granola meetings
+
+Adding Granola in **Settings → Agent connections** (Pipedream Connect, Granola
+Business or Enterprise API key) is the only setup; there are no sync controls.
+Within about 30 seconds the backend registers a Granola webhook at the widest
+scope the key allows, and removing or disabling the connection stops sync. Notes
+whose first summary is generated, edited, or shared after that are imported as
+private calls about a minute after Granola finishes the summary; history is not
+backfilled. Imported calls appear in `All` and `Attended`, never in a channel's
+`Calls` tab, and open in the normal call detail with title, summary, attendees
+(shown as guests), and transcript but no recording. Rename and delete do not
+apply to imported calls yet. Webhooks require a public HTTPS `MCP_PUBLIC_URL`;
+on a laptop stack, expose the webhook path with a tunnel such as Tailscale Funnel.
+
A channel's `Calls` tab lists that channel's recordings with the same rows, filtered
by the channel id. Its search field matches call names and transcripts in that
channel.
diff --git a/packages/sdk-docs/reference/generated/storage/types.gen/README.md b/packages/sdk-docs/reference/generated/storage/types.gen/README.md
index a0c6354740..ca3c875eea 100644
--- a/packages/sdk-docs/reference/generated/storage/types.gen/README.md
+++ b/packages/sdk-docs/reference/generated/storage/types.gen/README.md
@@ -152,6 +152,7 @@
- [CallRecordParticipant](type-aliases/CallRecordParticipant.md)
- [CallRecordPreview](type-aliases/CallRecordPreview.md)
- [CallRecordPreviewData](type-aliases/CallRecordPreviewData.md)
+- [CallRecordSource](type-aliases/CallRecordSource.md)
- [CallRecordTranscriptSegment](type-aliases/CallRecordTranscriptSegment.md)
- [CallStatus](type-aliases/CallStatus.md)
- [CallTokenResponse](type-aliases/CallTokenResponse.md)
diff --git a/packages/sdk-docs/reference/generated/storage/types.gen/type-aliases/CallRecord.md b/packages/sdk-docs/reference/generated/storage/types.gen/type-aliases/CallRecord.md
index d9c0088cfe..f2abd59ae2 100644
--- a/packages/sdk-docs/reference/generated/storage/types.gen/type-aliases/CallRecord.md
+++ b/packages/sdk-docs/reference/generated/storage/types.gen/type-aliases/CallRecord.md
@@ -1,6 +1,6 @@
# Type Alias: CallRecord
-> **CallRecord** = \{ `callId`: `string`; `channelId?`: `string` \| `null`; `channelName?`: `string` \| `null`; `createdBy`: `string`; `customName?`: `string` \| `null`; `durationMs?`: `number` \| `null`; `egressId?`: `string` \| `null`; `endedAt?`: `string` \| `null`; `guests`: [`CallRecordGuest`](CallRecordGuest.md)[]; `isActive`: `boolean`; `participants`: [`CallRecordParticipant`](CallRecordParticipant.md)[]; `recordingPreviewUrl?`: `string` \| `null`; `recordingStartedAt?`: `string` \| `null`; `recordingUrl?`: `string` \| `null`; `roomName`: `string`; `shareWithTeam`: `boolean`; `startedAt`: `string`; `status?`: `null` \| [`CallStatus`](CallStatus.md); `summary?`: `string` \| `null`; `teamShareAccessLevel?`: `null` \| [`AccessLevel`](AccessLevel.md); `transcript`: [`CallRecordTranscriptSegment`](CallRecordTranscriptSegment.md)[]; `userAccessLevel?`: `null` \| [`AccessLevel`](AccessLevel.md); `viewerHasDeclined?`: `boolean`; \}
+> **CallRecord** = \{ `callId`: `string`; `channelId?`: `string` \| `null`; `channelName?`: `string` \| `null`; `createdBy`: `string`; `customName?`: `string` \| `null`; `durationMs?`: `number` \| `null`; `egressId?`: `string` \| `null`; `endedAt?`: `string` \| `null`; `guests`: [`CallRecordGuest`](CallRecordGuest.md)[]; `isActive`: `boolean`; `participants`: [`CallRecordParticipant`](CallRecordParticipant.md)[]; `recordingPreviewUrl?`: `string` \| `null`; `recordingStartedAt?`: `string` \| `null`; `recordingUrl?`: `string` \| `null`; `roomName?`: `string` \| `null`; `shareWithTeam`: `boolean`; `source?`: `null` \| [`CallRecordSource`](CallRecordSource.md); `startedAt`: `string`; `status?`: `null` \| [`CallStatus`](CallStatus.md); `summary?`: `string` \| `null`; `teamShareAccessLevel?`: `null` \| [`AccessLevel`](AccessLevel.md); `transcript`: [`CallRecordTranscriptSegment`](CallRecordTranscriptSegment.md)[]; `userAccessLevel?`: `null` \| [`AccessLevel`](AccessLevel.md); `viewerHasDeclined?`: `boolean`; \}
Full record of a call, unifying rows from `calls` (active) and
`call_records` (archived) into a single response shape.
@@ -23,8 +23,9 @@ Full record of a call, unifying rows from `calls` (active) and
| <a id="property-recordingpreviewurl"></a> `recordingPreviewUrl?` | `string` \| `null` | Presigned URL for the call recording preview image, if available. |
| <a id="property-recordingstartedat"></a> `recordingStartedAt?` | `string` \| `null` | When the egress recording actually began. `None` until the `egress_started` webhook arrives (typically a few seconds after `started_at`). Frontend should anchor transcript-to-audio sync to this value when present, falling back to `started_at` otherwise. |
| <a id="property-recordingurl"></a> `recordingUrl?` | `string` \| `null` | Presigned URL for the call recording, if available. |
-| <a id="property-roomname"></a> `roomName` | `string` | The RTC room name. |
+| <a id="property-roomname"></a> `roomName?` | `string` \| `null` | The RTC room name. `None` for imported calls, which never had a room. |
| <a id="property-sharewithteam"></a> `shareWithTeam` | `boolean` | Whether the call is shared with the creator's team. While the call is live this is the pending toggle applied at archive; afterwards it mirrors `team_share_access_level`. |
+| <a id="property-source"></a> `source?` | `null` \| [`CallRecordSource`](CallRecordSource.md) | - |
| <a id="property-startedat"></a> `startedAt` | `string` | When the call started (created_at for active, started_at for archived). |
| <a id="property-status"></a> `status?` | `null` \| [`CallStatus`](CallStatus.md) | - |
| <a id="property-summary"></a> `summary?` | `string` \| `null` | AI-generated summary of the call. Only set on archived `call_records` once summarization has run; active calls always return `None`. |
diff --git a/packages/sdk-docs/reference/generated/storage/types.gen/type-aliases/CallRecordSource.md b/packages/sdk-docs/reference/generated/storage/types.gen/type-aliases/CallRecordSource.md
new file mode 100644
index 0000000000..09977ca344
--- /dev/null
+++ b/packages/sdk-docs/reference/generated/storage/types.gen/type-aliases/CallRecordSource.md
@@ -0,0 +1,12 @@
+# Type Alias: CallRecordSource
+
+> **CallRecordSource** = \{ `externalUrl?`: `string` \| `null`; `provider`: `string`; \}
+
+Where an imported call came from.
+
+## Properties
+
+| Property | Type | Description |
+| ------ | ------ | ------ |
+| <a id="property-externalurl"></a> `externalUrl?` | `string` \| `null` | Link to the call in the provider's app, if it has one. |
+| <a id="property-provider"></a> `provider` | `string` | Provider slug, e.g. `granola`. |
diff --git a/packages/sdk-docs/reference/src/entities/calls/call-record/classes/CallRecord.md b/packages/sdk-docs/reference/src/entities/calls/call-record/classes/CallRecord.md
index 405e733cd3..d28f6fb424 100644
--- a/packages/sdk-docs/reference/src/entities/calls/call-record/classes/CallRecord.md
+++ b/packages/sdk-docs/reference/src/entities/calls/call-record/classes/CallRecord.md
@@ -25,7 +25,7 @@ A Macro call record (an archived or still active call).
| <a id="property-recordingpreviewurl"></a> `recordingPreviewUrl` | `readonly` | () => `Promise`\<`string` \| `undefined`\> | `...` | URL of the recording preview (thumbnail), once available. | - | - |
| <a id="property-recordingstartedat"></a> `recordingStartedAt` | `readonly` | () => `Promise`\<`string` \| `undefined`\> | `...` | When the recording started, if it was recorded. | - | - |
| <a id="property-recordingurl"></a> `recordingUrl` | `readonly` | () => `Promise`\<`string` \| `undefined`\> | `...` | URL of the call recording, once available. | - | - |
-| <a id="property-roomname"></a> `roomName` | `readonly` | () => `Promise`\<`string`\> | `...` | The realtime room the call runs in. | - | - |
+| <a id="property-roomname"></a> `roomName` | `readonly` | () => `Promise`\<`string` \| `undefined`\> | `...` | The realtime room the call runs in. | - | - |
| <a id="property-sharewithteam"></a> `shareWithTeam` | `readonly` | () => `Promise`\<`boolean`\> | `...` | Whether the call is shared with the creator's team: the pending toggle while the call is live, the canonical grant once it is archived. | - | - |
| <a id="property-startedat"></a> `startedAt` | `readonly` | () => `Promise`\<`string`\> | `...` | When the call started. | - | - |
| <a id="property-status"></a> `status` | `readonly` | () => `Promise`\<`NonNullable`\<CallStatus \| null \| undefined\> \| `undefined`\> | `...` | The call's status (undefined until set). | - | - |
diff --git a/packages/sdk/generated/storage/index.ts b/packages/sdk/generated/storage/index.ts
index dbfb966eae..a53f4b69ba 100644
--- a/packages/sdk/generated/storage/index.ts
+++ b/packages/sdk/generated/storage/index.ts
@@ -1,4 +1,4 @@
// This file is auto-generated by @hey-api/openapi-ts
export { type Options, Sdk } from './sdk.gen';
-export type { AccessiblePipeline, AccessLevel, AccessRequest, AccessRequestsCancelData, AccessRequestsCancelErrors, AccessRequestsCancelResponses, AccessRequestsDirectData, AccessRequestsDirectErrors, AccessRequestsDirectResponse, AccessRequestsDirectResponses, AccessRequestsRemoveDirectData, AccessRequestsRemoveDirectErrors, AccessRequestsRemoveDirectResponses, AccessRequestsResolveData, AccessRequestsResolveErrors, AccessRequestsResolveResponse, AccessRequestsResolveResponses, AccessRequestsSetDirectData, AccessRequestsSetDirectErrors, AccessRequestsSetDirectResponses, AccessRequestsStateData, AccessRequestsStateErrors, AccessRequestsStateResponse, AccessRequestsStateResponses, AccessRequestsSubmitData, AccessRequestsSubmitErrors, AccessRequestsSubmitResponse, AccessRequestsSubmitResponses, AccessRequestState, ActiveCallsResponse, ActiveCallSummary, ActiveMeeting, ActiveMeetingsResponse, ActivityType, AddFavoriteData, AddFavoriteError, AddFavoriteErrors, AddFavoriteRequest, AddFavoriteResponse, AddFavoriteResponses, AddParticipantsData, AddParticipantsError, AddParticipantsErrors, AddParticipantsRequest, AddParticipantsResponses, AddPinHandlerData, AddPinHandlerError, AddPinHandlerErrors, AddPinHandlerResponse, AddPinHandlerResponses, AddPinRequest, Agent, AgentActionId, AgentChannelScope, AgentDmProfile, AgentMcpServer, AgentMcpServers, AgentPullRequestState, AgentSessionFilters, AgentSessionLifecycleEvent, AgentTyping, AgentTypingPhase, Anchor, AnchorId, AnchorResponse, AnnotationIncrementalUpdate, Answer, ApiActivity, ApiAttachmentChannelReference, ApiAttachmentEntityReference, ApiAttachmentGenericReference, ApiChannelAttachment, ApiChannelAttachmentsPage, ApiChannelDetail, ApiChannelListMessage, ApiChannelListPage, ApiChannelListParticipant, ApiChannelListType, ApiChannelParticipant, ApiChannelWithLatest, ApiEntityFilterAst, ApiGroupByField, ApiGroupMeta, ApiParticipantListRole, ApiParticipantRole, ApiPropertyEntityType, AppliedOps, ApplyCrmPipelineOpsData, ApplyCrmPipelineOpsResponse, ApplyCrmPipelineOpsResponses, ApplyDatabaseOpsData, ApplyDatabaseOpsError, ApplyDatabaseOpsErrors, ApplyDatabaseOpsResponse, ApplyDatabaseOpsResponses, ApplyOpsRequest, ApplyOpsResponse, ApproveHarnessPairingData, ApproveHarnessPairingError, ApproveHarnessPairingErrors, ApproveHarnessPairingResponse, ApproveHarnessPairingResponses, ApprovePairingRequest, AttachmentChange, AttendeeResponseStatus, Audience, Awareness, AwarenessRelay, BasicDocument, BasicDocumentSubType, BomPart, BookingTarget, Bot, BotChannel, BotChannelType, BotId, BotKind, BotOwner, BotOwnerProfile, BotSenderProfile, BotToken, BranchNameResponse, BTreeMap, BulkWakeupRequest, BulkWakeupResponse, BulkWakeupSyncServiceDocumentsData, BulkWakeupSyncServiceDocumentsErrors, BulkWakeupSyncServiceDocumentsResponse, BulkWakeupSyncServiceDocumentsResponses, CalendarAttendee, CalendarEvent, CalendarEventFilters, CalendarEventSourceContent, CalendarMentionEvent, CalendarMentionPreviewItem, CalendarMentionPreviewKind, CalendarMentionPreviewRequest, CalendarMentionPreviewRequestItem, CalendarMentionPreviewResponse, CalendarOccurrence, CalendarOccurrenceItem, CalendarOccurrenceResponse, CalendarSyncStatus, CallActiveResponse, CallFilters, CallRecord, CallRecordGuest, CallRecordParticipant, CallRecordPreview, CallRecordPreviewData, CallRecordTranscriptSegment, CallStatus, CallTokenResponse, CallWebhookData, CallWebhookError, CallWebhookErrors, CallWebhookResponses, CancelSlackImportData, CancelSlackImportErrors, CancelSlackImportResponse, CancelSlackImportResponses, CardPosition, CastVerdict, CellValue, CellWrite, ChangedFileDto, ChangesetDto, ChangesetSourceDto, Channel, ChannelCreatedMetadata, ChannelDeletedMetadata, ChannelFilters, ChannelJoinCodeResponse, ChannelLabel, ChannelLabelRule, ChannelLabelsList, ChannelMessage, ChannelParticipant, ChannelParticipantAddedMetadata, ChannelParticipantRemovedMetadata, ChannelPictureChangedMetadata, ChannelPreview, ChannelPreviewData, ChannelSender, ChannelSharePermission, ChannelThreadFilters, ChannelTopicEvent, ChannelType, ChannelUpdatedMetadata, ChannelWebhookRequest, ChannelWebhookResponse, ChannelWithParticipants, Chat, ChatFilters, CheckActiveCallData, CheckActiveCallError, CheckActiveCallErrors, CheckActiveCallResponse, CheckActiveCallResponses, ClaimedPairing, ClaimHarnessPairingData, ClaimHarnessPairingError, ClaimHarnessPairingErrors, ClaimHarnessPairingResponse, ClaimHarnessPairingResponses, ClaimPairingRequest, ClientOptions, CloudStorageItemType, CollaborateFormData, CollaborateFormError, CollaborateFormErrors, CollaborateFormResponse, CollaborateFormResponses, CollabSurfaceResponse, CollabSurfaceTokenResponse, Column, ColumnCast, ColumnChange, ColumnChangeKind, ColumnConfig, ColumnConversion, ColumnConversionRequest, ColumnDetail, ColumnId, ColumnKind, ColumnProtection, ColumnResult, CommandFailure, CommandRejectedMetadata, CommittedChange, CompleteSlackImportUploadsData, CompleteSlackImportUploadsErrors, CompleteSlackImportUploadsResponse, CompleteSlackImportUploadsResponses, CompleteUploads, ConferenceProvider, Conjunction, ConversationId, ConversationKind, ConversationMetadata, ConversationProgress, ConversationSeal, ConversationStatus, ConvertDatabaseColumnData, ConvertDatabaseColumnError, ConvertDatabaseColumnErrors, ConvertDatabaseColumnResponse, ConvertDatabaseColumnResponses, ConvertedCell, CopyDocumentData, CopyDocumentError, CopyDocumentErrors, CopyDocumentQueryParams, CopyDocumentRequest, CopyDocumentResponse, CopyDocumentResponse2, CopyDocumentResponses, CountedReaction, CreateAgentData, CreateAgentError, CreateAgentErrors, CreateAgentRequest, CreateAgentResponse, CreateAgentResponses, CreateAnchorData, CreateAnchorError, CreateAnchorErrors, CreateAnchorResponse, CreateAnchorResponses, CreateBotRequest, CreateBulkDocumentResponse, CreateBulkDocumentResponseData, CreateChannelData, CreateChannelError, CreateChannelErrors, CreateChannelLabelData, CreateChannelLabelError, CreateChannelLabelErrors, CreateChannelLabelRequest, CreateChannelLabelResponse, CreateChannelLabelResponses, CreateChannelRequest, CreateChannelResponse, CreateChannelResponse2, CreateChannelResponses, CreateChannelScopedBotData, CreateChannelScopedBotError, CreateChannelScopedBotErrors, CreateChannelScopedBotRequest, CreateChannelScopedBotResponse, CreateChannelScopedBotResponse2, CreateChannelScopedBotResponses, CreateCollabSurfaceTokenData, CreateCollabSurfaceTokenError, CreateCollabSurfaceTokenErrors, CreateCollabSurfaceTokenResponse, CreateCollabSurfaceTokenResponses, CreateCrmCompanyData, CreateCrmCompanyError, CreateCrmCompanyErrors, CreateCrmCompanyRequest, CreateCrmCompanyResponse, CreateCrmCompanyResponses, CreateCrmContactData, CreateCrmContactError, CreateCrmContactErrors, CreateCrmContactRequest, CreateCrmContactResponse, CreateCrmContactResponses, CreateCrmPipelineData, CreateCrmPipelineResponse, CreateCrmPipelineResponses, CreateDatabaseData, CreateDatabaseError, CreateDatabaseErrors, CreateDatabaseRequest, CreateDatabaseResponse, CreateDatabaseResponses, CreateDatabaseWebhookData, CreateDatabaseWebhookError, CreateDatabaseWebhookErrors, CreateDatabaseWebhookRequest, CreateDatabaseWebhookResponse, CreateDatabaseWebhookResponses, CreatedDatabaseWebhookResponse, CreateDocumentData, CreateDocumentError, CreateDocumentErrors, CreateDocumentRequest, CreateDocumentResponse, CreateDocumentResponseData, CreateDocumentResponses, CreatedPairing, CreatedUserApiKey, CreateEntityMentionData, CreateEntityMentionError, CreateEntityMentionErrors, CreateEntityMentionRequest, CreateEntityMentionResponse, CreateEntityMentionResponse2, CreateEntityMentionResponses, CreateForm, CreateFormData, CreateFormError, CreateFormErrors, CreateFormResponse, CreateFormResponses, CreateHarnessPairingData, CreateHarnessPairingError, CreateHarnessPairingErrors, CreateHarnessPairingResponse, CreateHarnessPairingResponses, CreateImport, CreateInitiativeData, CreateInitiativeError, CreateInitiativeErrors, CreateInitiativeRequest, CreateInitiativeResponse, CreateInitiativeResponses, CreateInstructionsDocumentResponse, CreateInstructionsHandlerData, CreateInstructionsHandlerError, CreateInstructionsHandlerErrors, CreateInstructionsHandlerResponse, CreateInstructionsHandlerResponses, CreateMarkdownDocumentRequest, CreateMarkdownDocumentResponse, CreateMarkdownHandlerData, CreateMarkdownHandlerError, CreateMarkdownHandlerErrors, CreateMarkdownHandlerResponse, CreateMarkdownHandlerResponses, CreateMeetingRequest, CreatePairingRequest, CreatePipeline, CreateProjectHandlerData, CreateProjectHandlerError, CreateProjectHandlerErrors, CreateProjectHandlerResponse, CreateProjectHandlerResponses, CreateProjectRequest, CreateProjectResponse, CreateSkillHandlerData, CreateSkillHandlerError, CreateSkillHandlerErrors, CreateSkillHandlerResponse, CreateSkillHandlerResponses, CreateSkillRequest, CreateSkillResponse, CreateSlackImportData, CreateSlackImportErrors, CreateSlackImportResponse, CreateSlackImportResponses, CreateSnippetHandlerData, CreateSnippetHandlerError, CreateSnippetHandlerErrors, CreateSnippetHandlerResponse, CreateSnippetHandlerResponses, CreateSnippetRequest, CreateSnippetResponse, CreateTaskHandlerData, CreateTaskHandlerError, CreateTaskHandlerErrors, CreateTaskHandlerResponse, CreateTaskHandlerResponses, CreateTaskRequest, CreateTaskResponse, CreateToken, CreateUnthreadedAnchorRequest, CreateUnthreadedAnchorResponse, CreateUnthreadedPdfAnchorRequest, CreateUserApiKeyData, CreateUserApiKeyError, CreateUserApiKeyErrors, CreateUserApiKeyRequest, CreateUserApiKeyResponse, CreateUserApiKeyResponses, CreateViewHandlerData, CreateViewHandlerError, CreateViewHandlerErrors, CreateViewHandlerResponse, CreateViewHandlerResponses, CreateViewRequest, CreateWebhookData, CreateWebhookError, CreateWebhookErrors, CreateWebhookRequest, CreateWebhookResponse, CreateWebhookResponse2, CreateWebhookResponses, CrmAssociation, CrmCompanyFilters, CrmCompanyResponse, CrmContactResponse, CrmDomainResponse, CrmPermissionRole, CrmStageInput, CrmStageResponse, CrmStagesResponse, CrmTeamSettingsResponse, CustomSpeakerAssignment, Database, DatabaseDetail, DatabaseId, DatabaseOp, DatabaseQueryRequest, DatabaseView, DatabaseWebhookDeliveryResponse, DatabaseWebhookPayloadProblem, DatabaseWebhookResponse, DataType, DateOperator, DeclineCallData, DeclineCallError, DeclineCallErrors, DeclineCallResponse, DeclineCallResponses, DeclineRingData, DeclineRingError, DeclineRingErrors, DeclineRingResponse, DeclineRingResponses, DeleteAnchorData, DeleteAnchorError, DeleteAnchorErrors, DeleteAnchorResponse, DeleteAnchorResponses, DeleteCallRecordData, DeleteCallRecordError, DeleteCallRecordErrors, DeleteCallRecordResponse, DeleteCallRecordResponses, DeleteChannelData, DeleteChannelError, DeleteChannelErrors, DeleteChannelLabelData, DeleteChannelLabelError, DeleteChannelLabelErrors, DeleteChannelLabelResponse, DeleteChannelLabelResponses, DeleteChannelResponse, DeleteChannelResponses, DeleteCollabSurfaceData, DeleteCollabSurfaceError, DeleteCollabSurfaceErrors, DeleteCollabSurfaceResponse, DeleteCollabSurfaceResponses, DeleteDatabaseWebhookData, DeleteDatabaseWebhookError, DeleteDatabaseWebhookErrors, DeleteDatabaseWebhookResponse, DeleteDatabaseWebhookResponses, DeleteDocumentData, DeleteDocumentError, DeleteDocumentErrors, DeleteDocumentResponse, DeleteDocumentResponses, DeleteEntityMentionData, DeleteEntityMentionError, DeleteEntityMentionErrors, DeleteEntityMentionResponse, DeleteEntityMentionResponse2, DeleteEntityMentionResponses, DeleteHarnessData, DeleteHarnessError, DeleteHarnessErrors, DeleteHarnessResponse, DeleteHarnessResponses, DeleteHistoryHandlerData, DeleteHistoryHandlerError, DeleteHistoryHandlerErrors, DeleteHistoryHandlerResponse, DeleteHistoryHandlerResponses, DeleteInitiativeData, DeleteInitiativeError, DeleteInitiativeErrors, DeleteInitiativeResponse, DeleteInitiativeResponses, DeleteProjectHandlerData, DeleteProjectHandlerError, DeleteProjectHandlerErrors, DeleteProjectHandlerResponse, DeleteProjectHandlerResponses, DeleteSelfHarnessData, DeleteSelfHarnessError, DeleteSelfHarnessErrors, DeleteSelfHarnessResponse, DeleteSelfHarnessResponses, DeleteUnthreadedAnchorRequest, DeleteUnthreadedAnchorResponse, DeleteUnthreadedPdfAnchorRequest, DeleteUserApiKeyData, DeleteUserApiKeyError, DeleteUserApiKeyErrors, DeleteUserApiKeyResponse, DeleteUserApiKeyResponses, DeleteUserDocumentViewLocationData, DeleteUserDocumentViewLocationError, DeleteUserDocumentViewLocationErrors, DeleteUserDocumentViewLocationResponse, DeleteUserDocumentViewLocationResponses, DeleteViewHandlerData, DeleteViewHandlerError, DeleteViewHandlerErrors, DeleteViewHandlerResponses, DeleteWebhookData, DeleteWebhookError, DeleteWebhookErrors, DeleteWebhookResponse, DeleteWebhookResponses, DeliverDatabaseWebhookData, DeliverDatabaseWebhookError, DeliverDatabaseWebhookErrors, DeliverDatabaseWebhookResponse, DeliverDatabaseWebhookResponses, DirectAccess, DocumentBasic, DocumentContent, DocumentContentLocation, DocumentContentState, DocumentContentUploadedMetadata, DocumentCopiedMetadata, DocumentCreatedMetadata, DocumentDeletedMetadata, DocumentFilters, DocumentId, DocumentInteractionMetadata, DocumentMetadata, DocumentMetadataWithContent, DocumentPermissionsToken, DocumentPermissionsTokenRequest, DocumentPermissionsTokenResponse, DocumentPreview, DocumentPreviewData, DocumentPreviewDataSubType, DocumentPurgedMetadata, DocumentResponse, DocumentResponseMetadata, DocumentResponseMetadataWithContent, DocumentStorageServiceApiVersion, DocumentSubType, DocumentSyncContentUpdatedMetadata, DocumentSyncEditor, DocumentTeamShareResponse, DocumentTextContent, DocumentTopicEvent, DocumentUpdatedMetadata, EditAnchorData, EditAnchorError, EditAnchorErrors, EditAnchorRequest, EditAnchorResponse, EditAnchorResponse2, EditAnchorResponses, EditCallRecordData, EditCallRecordError, EditCallRecordErrors, EditCallRecordRequest, EditCallRecordResponse, EditCallRecordResponses, EditCallTranscriptData, EditCallTranscriptError, EditCallTranscriptErrors, EditCallTranscriptRequest, EditCallTranscriptResponse, EditCallTranscriptResponses, EditDocumentData, EditDocumentError, EditDocumentErrors, EditDocumentResponse, EditDocumentResponse2, EditDocumentResponses, EditDocumentServiceArgs, EditMyFormResponseData, EditMyFormResponseError, EditMyFormResponseErrors, EditMyFormResponseResponse, EditMyFormResponseResponses, EditPdfAnchorRequest, EditPdfPlaceableCommentAnchorRequest, EditProjectV2Data, EditProjectV2Error, EditProjectV2Errors, EditProjectV2Response, EditProjectV2Responses, EditThreadV2Data, EditThreadV2Error, EditThreadV2Errors, EditThreadV2Response, EditThreadV2Responses, EmailFilters, EmailFollowup, EmailFollowupCommand, EmailFollowupResponse, EmailReminderCondition, EmailReminderPage, EmailReminderSummary, EmptyResponse, EnsureCollabSurfaceData, EnsureCollabSurfaceError, EnsureCollabSurfaceErrors, EnsureCollabSurfaceRequest, EnsureCollabSurfaceResponse, EnsureCollabSurfaceResponses, EnsureStarterHandlerData, EnsureStarterHandlerErrors, EnsureStarterHandlerResponse, EnsureStarterHandlerResponses, EntityFilters, EntityKind, EntityMessageCreateData, EntityMessageCreateResponse, EntityMessageCreateResponses, EntityMessageDeleteMessageData, EntityMessageDeleteMessageResponse, EntityMessageDeleteMessageResponses, EntityMessageDeleteThreadData, EntityMessageDeleteThreadResponse, EntityMessageDeleteThreadResponses, EntityMessageEditData, EntityMessageEditResponse, EntityMessageEditResponses, EntityMessageGetMessageData, EntityMessageGetMessageResponse, EntityMessageGetMessageResponses, EntityMessageGetThreadData, EntityMessageGetThreadResponse, EntityMessageGetThreadResponses, EntityMessageLegacyData, EntityMessageLegacyResponse, EntityMessageLegacyResponses, EntityMessagePatchThreadData, EntityMessagePatchThreadResponse, EntityMessagePatchThreadResponses, EntityMessageReactData, EntityMessageReactResponse, EntityMessageReactResponses, EntityMessageTypingData, EntityMessageTypingResponse, EntityMessageTypingResponses, EntityPermission, EntityPermissionResponse, EntityRef, EntityReference, EntityType, ErrorResponse, EventReminderOverride, EventReminders, EventStatus, EventTime, EventTransparency, EventType, EventVisibility, ExcludedDefaultView, ExcludeDefaultViewHandlerData, ExcludeDefaultViewHandlerError, ExcludeDefaultViewHandlerErrors, ExcludeDefaultViewHandlerResponses, ExcludeDefaultViewRequest, ExportDocumentData, ExportDocumentError, ExportDocumentErrors, ExportDocumentResponse, ExportDocumentResponse2, ExportDocumentResponses, Favorite, FavoriteEntityRef, FavoritesList, FileChangeKindDto, FileSystemNodeWithIds, FileType, FileTypeUpdate, FilterCondition, FilterGroup, FilterNode, FilterTest, FinalizeSlackImportData, FinalizeSlackImportErrors, FinalizeSlackImportResponse, FinalizeSlackImportResponses, FolderItem, FollowupState, ForeignEntity, ForeignEntityFilters, Form, FormAccess, FormCollaboration, FormDetail, FormErrorCode, FormErrorResponse, FormLayout, FormPublicationProblem, FormQuestionDetail, FormResponse, FormSection, FormSectionDetail, FormSource, FormStatus, FormTally, Formula, GenericErrorResponse, GenericResponse, GenericSuccessResponse, GetActiveCallsData, GetActiveCallsError, GetActiveCallsErrors, GetActiveCallsResponse, GetActiveCallsResponses, GetActivityData, GetActivityError, GetActivityErrors, GetActivityResponse, GetActivityResponses, GetAttachmentReferencesData, GetAttachmentReferencesError, GetAttachmentReferencesErrors, GetAttachmentReferencesResponse, GetAttachmentReferencesResponse2, GetAttachmentReferencesResponses, GetBatchCallRecordPreviewData, GetBatchCallRecordPreviewError, GetBatchCallRecordPreviewErrors, GetBatchCallRecordPreviewRequest, GetBatchCallRecordPreviewResponse, GetBatchCallRecordPreviewResponse2, GetBatchCallRecordPreviewResponses, GetBatchChannelPreviewData, GetBatchChannelPreviewError, GetBatchChannelPreviewErrors, GetBatchChannelPreviewRequest, GetBatchChannelPreviewResponse, GetBatchChannelPreviewResponse2, GetBatchChannelPreviewResponses, GetBatchPreviewHandlerData, GetBatchPreviewHandlerError, GetBatchPreviewHandlerErrors, GetBatchPreviewHandlerResponse, GetBatchPreviewHandlerResponses, GetBatchPreviewRequest, GetBatchPreviewResponse, GetBatchProjectPreviewData, GetBatchProjectPreviewError, GetBatchProjectPreviewErrors, GetBatchProjectPreviewRequest, GetBatchProjectPreviewResponse, GetBatchProjectPreviewResponse2, GetBatchProjectPreviewResponses, GetBotOwnerProfilesData, GetBotOwnerProfilesError, GetBotOwnerProfilesErrors, GetBotOwnerProfilesResponse, GetBotOwnerProfilesResponses, GetCallRecordData, GetCallRecordError, GetCallRecordErrors, GetCallRecordResponse, GetCallRecordResponses, GetChannelAttachmentsData, GetChannelAttachmentsError, GetChannelAttachmentsErrors, GetChannelAttachmentsResponse, GetChannelAttachmentsResponses, GetChannelData, GetChannelError, GetChannelErrors, GetChannelJoinLinkData, GetChannelJoinLinkError, GetChannelJoinLinkErrors, GetChannelJoinLinkResponse, GetChannelJoinLinkResponses, GetChannelParticipantsData, GetChannelParticipantsError, GetChannelParticipantsErrors, GetChannelParticipantsResponse, GetChannelParticipantsResponses, GetChannelResponse, GetChannelResponses, GetChannelsData, GetChannelsError, GetChannelsErrors, GetChannelsResponse, GetChannelsResponses, GetCollabSurfaceData, GetCollabSurfaceError, GetCollabSurfaceErrors, GetCollabSurfaceResponse, GetCollabSurfaceResponses, GetCompanyData, GetCompanyError, GetCompanyErrors, GetCompanyResponse, GetCompanyResponses, GetContactByEmailData, GetContactByEmailError, GetContactByEmailErrors, GetContactByEmailResponse, GetContactByEmailResponse2, GetContactByEmailResponses, GetContactData, GetContactError, GetContactErrors, GetContactResponse, GetContactResponses, GetCrmPipelineData, GetCrmPipelinePermissionsData, GetCrmPipelinePermissionsResponse, GetCrmPipelinePermissionsResponses, GetCrmPipelineResponse, GetCrmPipelineResponses, GetCrmPipelineRowsData, GetCrmPipelineRowsResponse, GetCrmPipelineRowsResponses, GetCrmPipelineTableData, GetCrmPipelineTableResponse, GetCrmPipelineTableResponses, GetCrmTeamSettingsData, GetCrmTeamSettingsError, GetCrmTeamSettingsErrors, GetCrmTeamSettingsResponse, GetCrmTeamSettingsResponses, GetDatabaseData, GetDatabaseError, GetDatabaseErrors, GetDatabasePermissionsData, GetDatabasePermissionsError, GetDatabasePermissionsErrors, GetDatabasePermissionsResponse, GetDatabasePermissionsResponses, GetDatabaseQueryData, GetDatabaseQueryError, GetDatabaseQueryErrors, GetDatabaseQueryResponse, GetDatabaseQueryResponses, GetDatabaseResponse, GetDatabaseResponses, GetDatabaseRowHistoryData, GetDatabaseRowHistoryError, GetDatabaseRowHistoryErrors, GetDatabaseRowHistoryResponse, GetDatabaseRowHistoryResponses, GetDatabaseTableChangesData, GetDatabaseTableChangesError, GetDatabaseTableChangesErrors, GetDatabaseTableChangesResponse, GetDatabaseTableChangesResponses, GetDatabaseViewPositionsData, GetDatabaseViewPositionsError, GetDatabaseViewPositionsErrors, GetDatabaseViewPositionsResponse, GetDatabaseViewPositionsResponses, GetDocumentAnchorsData, GetDocumentAnchorsError, GetDocumentAnchorsErrors, GetDocumentAnchorsResponse, GetDocumentAnchorsResponses, GetDocumentBranchNameData, GetDocumentBranchNameError, GetDocumentBranchNameErrors, GetDocumentBranchNameResponse, GetDocumentBranchNameResponses, GetDocumentByTeamSlugData, GetDocumentByTeamSlugError, GetDocumentByTeamSlugErrors, GetDocumentByTeamSlugResponse, GetDocumentByTeamSlugResponses, GetDocumentData, GetDocumentError, GetDocumentErrors, GetDocumentGithubPullRequestsData, GetDocumentGithubPullRequestsError, GetDocumentGithubPullRequestsErrors, GetDocumentGithubPullRequestsResponse, GetDocumentGithubPullRequestsResponses, GetDocumentKeyResponse, GetDocumentKeyResponseData, GetDocumentListHandlerData, GetDocumentListHandlerError, GetDocumentListHandlerErrors, GetDocumentListHandlerResponse, GetDocumentListHandlerResponses, GetDocumentListResult, GetDocumentLocationV3Data, GetDocumentLocationV3Error, GetDocumentLocationV3Errors, GetDocumentLocationV3Response, GetDocumentLocationV3Responses, GetDocumentPermissionsResponseDataV2, GetDocumentPermissionsTokenData, GetDocumentPermissionsTokenError, GetDocumentPermissionsTokenErrors, GetDocumentPermissionsTokenResponse, GetDocumentPermissionsTokenResponses, GetDocumentPermissionsV2Data, GetDocumentPermissionsV2Error, GetDocumentPermissionsV2Errors, GetDocumentPermissionsV2Response, GetDocumentPermissionsV2Responses, GetDocumentProcessingResult, GetDocumentProcessingResultData, GetDocumentProcessingResultError, GetDocumentProcessingResultErrors, GetDocumentProcessingResultResponse, GetDocumentProcessingResultResponse2, GetDocumentProcessingResultResponses, GetDocumentResponse, GetDocumentResponse2, GetDocumentResponseData, GetDocumentResponses, GetDocumentSearchResponse, GetDocumentShortIdData, GetDocumentShortIdError, GetDocumentShortIdErrors, GetDocumentShortIdResponse, GetDocumentShortIdResponses, GetDocumentsResponse, GetDocumentTeamShareData, GetDocumentTeamShareError, GetDocumentTeamShareErrors, GetDocumentTeamShareResponse, GetDocumentTeamShareResponses, GetDocumentTextContentData, GetDocumentTextContentErrors, GetDocumentTextContentResponse, GetDocumentTextContentResponses, GetDocumentUserAccessLevelResponse, GetDocumentVersionData, GetDocumentVersionError, GetDocumentVersionErrors, GetDocumentVersionResponse, GetDocumentVersionResponses, GetDocumentViewsHandlerData, GetDocumentViewsHandlerError, GetDocumentViewsHandlerErrors, GetDocumentViewsHandlerResponse, GetDocumentViewsHandlerResponses, GetEmailFollowupData, GetEmailFollowupError, GetEmailFollowupErrors, GetEmailFollowupResponse, GetEmailFollowupResponses, GetEntityPermissionData, GetEntityPermissionErrors, GetEntityPermissionResponse, GetEntityPermissionResponses, GetForeignEntityBySourceData, GetForeignEntityBySourceError, GetForeignEntityBySourceErrors, GetForeignEntityBySourceResponse, GetForeignEntityBySourceResponses, GetForeignEntityData, GetForeignEntityError, GetForeignEntityErrors, GetForeignEntityResponse, GetForeignEntityResponses, GetFormData, GetFormError, GetFormErrors, GetFormPermissionsData, GetFormPermissionsError, GetFormPermissionsErrors, GetFormPermissionsResponse, GetFormPermissionsResponses, GetFormResponse, GetFormResponses, GetFormResponseSummaryData, GetFormResponseSummaryError, GetFormResponseSummaryErrors, GetFormResponseSummaryResponse, GetFormResponseSummaryResponses, GetFormTallyData, GetFormTallyError, GetFormTallyErrors, GetFormTallyResponse, GetFormTallyResponses, GetGithubPullRequestChangesData, GetGithubPullRequestChangesError, GetGithubPullRequestChangesErrors, GetGithubPullRequestChangesPatchData, GetGithubPullRequestChangesPatchError, GetGithubPullRequestChangesPatchErrors, GetGithubPullRequestChangesPatchResponse, GetGithubPullRequestChangesPatchResponses, GetGithubPullRequestChangesResponse, GetGithubPullRequestChangesResponses, GetGithubPullRequestData, GetGithubPullRequestError, GetGithubPullRequestErrors, GetGithubPullRequestFacetsData, GetGithubPullRequestFacetsError, GetGithubPullRequestFacetsErrors, GetGithubPullRequestFacetsResponse, GetGithubPullRequestFacetsResponses, GetGithubPullRequestResponse, GetGithubPullRequestResponses, GetGithubPullRequestTasksData, GetGithubPullRequestTasksError, GetGithubPullRequestTasksErrors, GetGithubPullRequestTasksResponse, GetGithubPullRequestTasksResponses, GetHarnessPairingData, GetHarnessPairingError, GetHarnessPairingErrors, GetHarnessPairingResponse, GetHarnessPairingResponses, GetHistoryHandlerData, GetHistoryHandlerError, GetHistoryHandlerErrors, GetHistoryHandlerResponse, GetHistoryHandlerResponses, GetInitiativeData, GetInitiativeError, GetInitiativeErrors, GetInitiativeResponse, GetInitiativeResponses, GetInstructionsDocumentResponse, GetInstructionsHandlerData, GetInstructionsHandlerError, GetInstructionsHandlerErrors, GetInstructionsHandlerResponse, GetInstructionsHandlerResponses, GetItemsSoupData, GetItemsSoupError, GetItemsSoupErrors, GetItemsSoupResponse, GetItemsSoupResponses, GetLocationHandlerData, GetLocationHandlerError, GetLocationHandlerErrors, GetLocationHandlerResponse, GetLocationHandlerResponses, GetMyFormResponseData, GetMyFormResponseError, GetMyFormResponseErrors, GetMyFormResponseResponse, GetMyFormResponseResponses, GetOrCreateAction, GetOrCreateCallData, GetOrCreateCallError, GetOrCreateCallErrors, GetOrCreateCallResponse, GetOrCreateCallResponses, GetOrCreateChannelResponse, GetOrCreateDmData, GetOrCreateDmError, GetOrCreateDmErrors, GetOrCreateDmRequest, GetOrCreateDmResponse, GetOrCreateDmResponses, GetOrCreatePrivateData, GetOrCreatePrivateError, GetOrCreatePrivateErrors, GetOrCreatePrivateRequest, GetOrCreatePrivateResponse, GetOrCreatePrivateResponses, GetPendingProjectsHandlerData, GetPendingProjectsHandlerError, GetPendingProjectsHandlerErrors, GetPendingProjectsHandlerResponse, GetPendingProjectsHandlerResponses, GetPinsHandlerData, GetPinsHandlerError, GetPinsHandlerErrors, GetPinsHandlerResponse, GetPinsHandlerResponses, GetPinsResponse, GetProjectContentHandlerData, GetProjectContentHandlerError, GetProjectContentHandlerErrors, GetProjectContentHandlerResponse, GetProjectContentHandlerResponses, GetProjectContentResponse, GetProjectHandlerData, GetProjectHandlerError, GetProjectHandlerErrors, GetProjectHandlerResponse, GetProjectHandlerResponses, GetProjectPermissionsV2Data, GetProjectPermissionsV2Error, GetProjectPermissionsV2Errors, GetProjectPermissionsV2Response, GetProjectPermissionsV2Responses, GetProjectResponse, GetProjectResponseData, GetProjectsHandlerData, GetProjectsHandlerError, GetProjectsHandlerErrors, GetProjectsHandlerResponse, GetProjectsHandlerResponses, GetProjectsResponse, GetProjectUserAccessLevelData, GetProjectUserAccessLevelError, GetProjectUserAccessLevelErrors, GetProjectUserAccessLevelResponse, GetProjectUserAccessLevelResponses, GetRingStatusData, GetRingStatusError, GetRingStatusErrors, GetRingStatusResponse, GetRingStatusResponses, GetSelfBotData, GetSelfBotError, GetSelfBotErrors, GetSelfBotResponse, GetSelfBotResponses, GetSelfHarnessData, GetSelfHarnessError, GetSelfHarnessErrors, GetSelfHarnessResponse, GetSelfHarnessResponses, GetSlackImportData, GetSlackImportErrors, GetSlackImportResponse, GetSlackImportResponses, GetSystemSkillsHandlerData, GetSystemSkillsHandlerError, GetSystemSkillsHandlerErrors, GetSystemSkillsHandlerResponse, GetSystemSkillsHandlerResponses, GetUserDocumentsHandlerData, GetUserDocumentsHandlerError, GetUserDocumentsHandlerErrors, GetUserDocumentsHandlerResponse, GetUserDocumentsHandlerResponses, GetUserDocumentViewLocationData, GetUserDocumentViewLocationError, GetUserDocumentViewLocationErrors, GetUserDocumentViewLocationResponse, GetUserDocumentViewLocationResponses, GetUserHistoryResponse, GetViewsHandlerData, GetViewsHandlerError, GetViewsHandlerErrors, GetViewsHandlerResponse, GetViewsHandlerResponses, GetWebhookData, GetWebhookError, GetWebhookErrors, GetWebhookResponse, GetWebhookResponses, GithubLabelFacet, GithubPullRequest, GithubPullRequestChangesPatchResponse, GithubPullRequestChangesResponse, GithubPullRequestCheckRun, GithubPullRequestComment, GithubPullRequestFacets, GithubPullRequestLabel, GithubPullRequestReview, GithubPullRequestReviewDecision, GithubPullRequestReviewState, GithubPullRequestsResponse, GithubPullRequestTasks, GithubPullRequestTasksRequest, GithubPullRequestTasksResponse, GithubPullRequestUser, GithubRepositoryFacet, GithubUserFacet, GitRefDto, GroupedInitialParams, GroupedPageParams, GroupedSoupGroupPage, GroupedSoupInitialPage, GroupedSoupPage, GroupedSoupSort, GuestCallChatPostData, GuestCallChatPostErrors, GuestCallChatPostResponse, GuestCallChatPostResponses, GuestCallChatReadData, GuestCallChatReadErrors, GuestCallChatReadResponse, GuestCallChatReadResponses, GuestChatMessage, GuestChatPage, GuestChatPost, GuestId, GuestJoinRequest, HandlerData, HandlerError, HandlerErrors, HandlerResponse, HandlerResponses, Harness, HarnessAgent, HarnessId, HarnessOwner, HarnessSession, HashMap, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, HighlightType, ImportCounters, ImportDatabaseTableData, ImportDatabaseTableError, ImportDatabaseTableErrors, ImportDatabaseTableResponse, ImportDatabaseTableResponses, ImportedAuthor, ImportError, ImportLimits, ImportPage, ImportProgress, ImportTable, ImportWarning, InferColumnTypeOutcome, InferColumnTypeRequest, InferDatabaseColumnTypeData, InferDatabaseColumnTypeError, InferDatabaseColumnTypeErrors, InferDatabaseColumnTypeResponse, InferDatabaseColumnTypeResponses, InFlightTurnSummary, IngestTranscriptData, IngestTranscriptError, IngestTranscriptErrors, IngestTranscriptResponses, InitializeUserDocumentsData, InitializeUserDocumentsError, InitializeUserDocumentsErrors, InitializeUserDocumentsResponse, InitializeUserDocumentsResponses, InitialPropertyValue, InitiativeDetail, InitiativeFilters, InitiativeId, InitiativeList, InitiativeSummary, InputReceivedMetadata, InstallSyncData, InstallSyncErrors, InteractionReason, InvalidDatabaseWebhookPayloadResponse, InviteMeetingRequest, InviteMeetingUsersRequest, Item, ItemWithUserAccessLevel, JobId, JobProcessingResultHandlerData, JobProcessingResultHandlerError, JobProcessingResultHandlerErrors, JobProcessingResultHandlerResponse, JobProcessingResultHandlerResponses, JobStatus, JoinChannelByCodeData, JoinChannelByCodeError, JoinChannelByCodeErrors, JoinChannelByCodeResponses, JoinChannelData, JoinChannelError, JoinChannelErrors, JoinChannelResponses, KeySegment, Lane, LaneKey, LatestMessage, LayoutProblem, LeaveCallResponse, LeaveChannelData, LeaveChannelError, LeaveChannelErrors, LeaveChannelResponses, LeaveOrEndCallData, LeaveOrEndCallError, LeaveOrEndCallErrors, LeaveOrEndCallResponse, LeaveOrEndCallResponses, LinkShare, ListAccessibleFormsData, ListAccessibleFormsError, ListAccessibleFormsErrors, ListAccessibleFormsResponse, ListAccessibleFormsResponses, ListAgentsData, ListAgentsError, ListAgentsErrors, ListAgentsResponse, ListAgentsResponses, ListBotChannelsData, ListBotChannelsError, ListBotChannelsErrors, ListBotChannelsResponse, ListBotChannelsResponses, ListChannelLabelsData, ListChannelLabelsError, ListChannelLabelsErrors, ListChannelLabelsResponse, ListChannelLabelsResponses, ListCompanyContactsData, ListCompanyContactsError, ListCompanyContactsErrors, ListCompanyContactsResponse, ListCompanyContactsResponses, ListCrmPipelinesData, ListCrmPipelinesResponse, ListCrmPipelinesResponses, ListDatabaseColumnCastsData, ListDatabaseColumnCastsError, ListDatabaseColumnCastsErrors, ListDatabaseColumnCastsResponse, ListDatabaseColumnCastsResponses, ListDatabasesData, ListDatabasesError, ListDatabasesErrors, ListDatabasesResponse, ListDatabasesResponses, ListDatabaseWebhooksData, ListDatabaseWebhooksError, ListDatabaseWebhooksErrors, ListDatabaseWebhooksResponse, ListDatabaseWebhooksResponse2, ListDatabaseWebhooksResponses, ListedDatabase, ListedForm, ListEmailRemindersData, ListEmailRemindersError, ListEmailRemindersErrors, ListEmailRemindersResponse, ListEmailRemindersResponses, ListFavoritesData, ListFavoritesError, ListFavoritesErrors, ListFavoritesResponse, ListFavoritesResponses, ListFormsData, ListFormsError, ListFormsErrors, ListFormsResponse, ListFormsResponses, ListHarnessAgentsData, ListHarnessAgentsError, ListHarnessAgentsErrors, ListHarnessAgentsResponse, ListHarnessAgentsResponses, ListHarnessesData, ListHarnessesError, ListHarnessesErrors, ListHarnessesResponse, ListHarnessesResponses, ListHarnessSessionsData, ListHarnessSessionsError, ListHarnessSessionsErrors, ListHarnessSessionsResponse, ListHarnessSessionsResponses, ListInitiativesData, ListInitiativesError, ListInitiativesErrors, ListInitiativesResponse, ListInitiativesResponses, ListOccurrencesData, ListOccurrencesErrors, ListOccurrencesResponse, ListOccurrencesResponses, ListSlackImportsData, ListSlackImportsResponse, ListSlackImportsResponses, ListTeamCalendarData, ListTeamCalendarResponse, ListTeamCalendarResponses, ListTeamOutOfOfficeData, ListTeamOutOfOfficeErrors, ListTeamOutOfOfficeResponse, ListTeamOutOfOfficeResponses, ListUserApiKeysData, ListUserApiKeysError, ListUserApiKeysErrors, ListUserApiKeysResponse, ListUserApiKeysResponses, ListWebhooksData, ListWebhooksError, ListWebhooksErrors, ListWebhooksResponse, ListWebhooksResponse2, ListWebhooksResponses, LocationResponseData, LocationResponseV3, MacroUserIdStr, Meeting, MeetingCancelData, MeetingCancelError, MeetingCancelErrors, MeetingCancelPreparationData, MeetingCancelPreparationError, MeetingCancelPreparationErrors, MeetingCancelPreparationResponse, MeetingCancelPreparationResponses, MeetingCancelResponse, MeetingCancelResponses, MeetingCreateData, MeetingCreateError, MeetingCreateErrors, MeetingCreateResponse, MeetingCreateResponses, MeetingGuestJoinData, MeetingGuestJoinError, MeetingGuestJoinErrors, MeetingGuestJoinResponse, MeetingGuestJoinResponses, MeetingGuestParticipantsData, MeetingGuestParticipantsError, MeetingGuestParticipantsErrors, MeetingGuestParticipantsResponse, MeetingGuestParticipantsResponses, MeetingInviteData, MeetingInviteError, MeetingInviteErrors, MeetingInvitePermissions, MeetingInvitePermissionsData, MeetingInvitePermissionsError, MeetingInvitePermissionsErrors, MeetingInvitePermissionsResponse, MeetingInvitePermissionsResponses, MeetingInviteResponse, MeetingInviteResponses, MeetingInviteUsersData, MeetingInviteUsersError, MeetingInviteUsersErrors, MeetingInviteUsersResponse, MeetingInviteUsersResponses, MeetingJoinData, MeetingJoinError, MeetingJoinErrors, MeetingJoinResponse, MeetingJoinResponses, MeetingLeaveData, MeetingLeaveError, MeetingLeaveErrors, MeetingLeaveResponse, MeetingLeaveResponses, MeetingListActiveData, MeetingListActiveError, MeetingListActiveErrors, MeetingListActiveResponse, MeetingListActiveResponses, MeetingListData, MeetingListError, MeetingListErrors, MeetingListResponse, MeetingListResponses, MeetingLookupData, MeetingLookupError, MeetingLookupErrors, MeetingLookupResponse, MeetingLookupResponses, MeetingParticipant, MeetingParticipants, MeetingParticipantsData, MeetingParticipantsError, MeetingParticipantsErrors, MeetingParticipantsResponse, MeetingParticipantsResponses, MeetingPreparation, MeetingPrepareData, MeetingPrepareError, MeetingPrepareErrors, MeetingPrepareResponse, MeetingPrepareResponses, MeetingShareData, MeetingShareError, MeetingShareErrors, MeetingShareResponse, MeetingShareResponses, MeetingsResponse, MeetingToken, MeetingUpdateData, MeetingUpdateError, MeetingUpdateErrors, MeetingUpdateResponse, MeetingUpdateResponses, MentionPreviewsData, MentionPreviewsErrors, MentionPreviewsResponse, MentionPreviewsResponses, Message, MessageAttachment, MessageAttachmentCreatedMetadata, MessageAttachmentRemovedMetadata, MessageChange, MessageCursor, MessageDeletedMetadata, MessageDirection, MessageEvent, MessageEventAttachment, MessageListItem, MessageMentionedMetadata, MessagePage, MessageParent, MessagePatch, MessagePatchedMetadata, MessagePostedMetadata, MessageThread, MessageThreadPreview, MessageTimelineData, MessageTimelineEntriesData, MessageTimelineEntriesResponse, MessageTimelineEntriesResponses, MessageTimelineEntry, MessageTimelinePage, MessageTimelineQuery, MessageTimelineResponse, MessageTimelineResponses, MessageTopicEvent, MyResponse, NewAttachment, NewColumn, NewOption, NewThreadAnchor, NewView, NotificationFilters, NotificationState, NumberOperator, OpBatch, Operator, OpRefusalResponse, OpResult, OptionId, OptionRef, PairingDetails, Params, ParticipantRole, PatchBotRequest, PatchChannelData, PatchChannelError, PatchChannelErrors, PatchChannelRequest, PatchChannelResponse, PatchChannelResponses, PatchMessageNotificationPolicy, PatchProjectRequestV2, PatchThreadRequestV2, PatchViewHandlerData, PatchViewHandlerError, PatchViewHandlerErrors, PatchViewHandlerResponses, PatchWebhookData, PatchWebhookError, PatchWebhookErrors, PatchWebhookRequest, PatchWebhookResponse, PatchWebhookResponses, PdfAnchor, PdfAnchorId, PdfHighlightAnchor, PdfHighlightAnchorRequest, PdfHighlightRect, PdfHighlightRectAnchorRequest, PdfPlaceableCommentAnchor, PendingClaimResponse, PermanentlyDeleteDocumentData, PermanentlyDeleteDocumentError, PermanentlyDeleteDocumentErrors, PermanentlyDeleteDocumentResponse, PermanentlyDeleteDocumentResponses, PermanentlyDeleteProjectData, PermanentlyDeleteProjectError, PermanentlyDeleteProjectErrors, PermanentlyDeleteProjectResponse, PermanentlyDeleteProjectResponses, PinnedItem, PinRequest, Pipeline, PipelineRecordType, PipelineSharing, PostActivityData, PostActivityError, PostActivityErrors, PostActivityRequest, PostActivityResponse, PostActivityResponses, PostChannelBotWebhookData, PostChannelBotWebhookError, PostChannelBotWebhookErrors, PostChannelBotWebhookResponse, PostChannelBotWebhookResponses, PostGroupedSoupAstGroupPageRequest, PostGroupedSoupAstInitialRequest, PostGroupedSoupAstRequest, PostItemsSoupAstData, PostItemsSoupAstError, PostItemsSoupAstErrors, PostItemsSoupAstGroupedData, PostItemsSoupAstGroupedError, PostItemsSoupAstGroupedErrors, PostItemsSoupAstGroupedResponse, PostItemsSoupAstGroupedResponses, PostItemsSoupAstResponse, PostItemsSoupAstResponses, PostItemsSoupData, PostItemsSoupError, PostItemsSoupErrors, PostItemsSoupResponse, PostItemsSoupResponses, PostMessage, PostMessageNotificationPolicy, PostSoupAstRequest, PostSoupRequest, PresaveDocumentHandlerData, PresaveDocumentHandlerError, PresaveDocumentHandlerErrors, PresaveDocumentHandlerResponse, PresaveDocumentHandlerResponses, PreSaveDocumentRequest, PreSaveDocumentResponse, PreSaveDocumentResponseData, PresenceOperator, PresignedUrl, PreviewSmartTagData, PreviewSmartTagError, PreviewSmartTagErrors, PreviewSmartTagResponse, PreviewSmartTagResponses, Project, ProjectDeleteResponseData, ProjectDocumentStatus, ProjectFilters, ProjectPreview, ProjectPreviewData, PropertyDefinition, PropertyDefinitionWithOptions, PropertyFilter, PropertyInput, PropertyOption, PropertyOptionValue, PropertyOwner, PropertyValue, PutCrmTeamSettingsData, PutCrmTeamSettingsError, PutCrmTeamSettingsErrors, PutCrmTeamSettingsResponse, PutCrmTeamSettingsResponses, PutCrmTeamStagesData, PutCrmTeamStagesError, PutCrmTeamStagesErrors, PutCrmTeamStagesResponse, PutCrmTeamStagesResponses, PutFormLayoutData, PutFormLayoutError, PutFormLayoutErrors, PutFormLayoutResponse, PutFormLayoutResponses, QueryCrmPipelineRowsData, QueryCrmPipelineRowsResponse, QueryCrmPipelineRowsResponses, QueryDatabasesData, QueryDatabasesError, QueryDatabasesErrors, QueryDatabasesResponse, QueryDatabasesResponses, QueryDefinition, QuestionLayout, QuestionOption, QuestionTally, ReactionInput, RecentlyDeletedData, RecentlyDeletedError, RecentlyDeletedErrors, RecentlyDeletedResponse, RecentlyDeletedResponseData, RecentlyDeletedResponses, RegisterSlackImportUploadsData, RegisterSlackImportUploadsErrors, RegisterSlackImportUploadsResponse, RegisterSlackImportUploadsResponses, RegisterUploads, RemoveBotFromChannelByBotData, RemoveBotFromChannelByBotError, RemoveBotFromChannelByBotErrors, RemoveBotFromChannelByBotResponse, RemoveBotFromChannelByBotResponses, RemoveFavoriteByEntityData, RemoveFavoriteByEntityError, RemoveFavoriteByEntityErrors, RemoveFavoriteByEntityResponses, RemoveParticipantsData, RemoveParticipantsError, RemoveParticipantsErrors, RemoveParticipantsRequest, RemoveParticipantsResponses, RemovePinHandlerData, RemovePinHandlerError, RemovePinHandlerErrors, RemovePinHandlerResponse, RemovePinHandlerResponses, RenameChannelLabelData, RenameChannelLabelError, RenameChannelLabelErrors, RenameChannelLabelRequest, RenameChannelLabelResponse, RenameChannelLabelResponses, RenameCrmPipelineData, RenameCrmPipelineResponse, RenameCrmPipelineResponses, RenamePipeline, ReorderFavoritesData, ReorderFavoritesError, ReorderFavoritesErrors, ReorderFavoritesRequest, ReorderFavoritesResponses, ReorderPinRequest, ReorderPinsHandlerData, ReorderPinsHandlerError, ReorderPinsHandlerErrors, ReorderPinsHandlerResponse, ReorderPinsHandlerResponses, ReplaceCrmStagesRequest, RequestAccess, RequestedHarnessScope, RequestedLayout, RequestStatus, ResetCrmTeamStagesData, ResetCrmTeamStagesError, ResetCrmTeamStagesErrors, ResetCrmTeamStagesResponse, ResetCrmTeamStagesResponses, ResolveRequest, ResponseStatus, ResponseSummary, ResultColumn, ResultSet, RevertDeleteDocumentData, RevertDeleteDocumentError, RevertDeleteDocumentErrors, RevertDeleteDocumentResponse, RevertDeleteDocumentResponses, RevertDeleteProjectData, RevertDeleteProjectError, RevertDeleteProjectErrors, RevertDeleteProjectResponse, RevertDeleteProjectResponses, RingStatus, RingStatusResponse, RowChange, RowChangeKind, RowChanges, RowHistoryEntry, RowHistoryResponse, RowId, RowsChange, RowsResult, S3ObjectInfo, SaveBomPart, SaveDatabaseQueryData, SaveDatabaseQueryError, SaveDatabaseQueryErrors, SaveDatabaseQueryResponse, SaveDatabaseQueryResponses, SaveDocumentHandlerData, SaveDocumentHandlerError, SaveDocumentHandlerErrors, SaveDocumentHandlerResponse, SaveDocumentHandlerResponses, SaveDocumentRequest, SaveDocumentResponse, SaveDocumentResponseData, SavedQuery, SaveQueryRequest, SearchContactsData, SearchContactsError, SearchContactsErrors, SearchContactsResponse, SearchContactsResponse2, SearchContactsResponses, SearchState, SectionCount, SessionDeletedMetadata, SessionIdentity, SessionMentionedMetadata, SessionOpenedMetadata, SessionRenamedMetadata, SessionSettledMetadata, SessionStoppedMetadata, SetChannelLabelData, SetChannelLabelError, SetChannelLabelErrors, SetChannelLabelRequest, SetChannelLabelResponse, SetChannelLabelResponses, SetChannelPictureData, SetChannelPictureError, SetChannelPictureErrors, SetChannelPictureRequest, SetChannelPictureResponse, SetChannelPictureResponses, SetCompanyHiddenData, SetCompanyHiddenError, SetCompanyHiddenErrors, SetCompanyHiddenRequest, SetCompanyHiddenResponse, SetCompanyHiddenResponses, SetCompanyNameRequest, SetContactHiddenData, SetContactHiddenError, SetContactHiddenErrors, SetContactHiddenRequest, SetContactHiddenResponse, SetContactHiddenResponses, SetContactNameRequest, SetCrmCompanyNameData, SetCrmCompanyNameError, SetCrmCompanyNameErrors, SetCrmCompanyNameResponse, SetCrmCompanyNameResponses, SetCrmContactNameData, SetCrmContactNameError, SetCrmContactNameErrors, SetCrmContactNameResponse, SetCrmContactNameResponses, SetDirectAccess, SetDocumentTeamShareData, SetDocumentTeamShareError, SetDocumentTeamShareErrors, SetDocumentTeamShareRequest, SetDocumentTeamShareResponse, SetDocumentTeamShareResponses, SetEmailFollowupData, SetEmailFollowupError, SetEmailFollowupErrors, SetEmailFollowupResponse, SetEmailFollowupResponses, SetEmailSyncData, SetEmailSyncError, SetEmailSyncErrors, SetEmailSyncRequest, SetEmailSyncResponse, SetEmailSyncResponses, SetOperator, SetPropertyValue, Sha256Digest, ShareCrmPipelineData, ShareCrmPipelineResponse, ShareCrmPipelineResponses, ShareDatabaseAwarenessData, ShareDatabaseAwarenessError, ShareDatabaseAwarenessErrors, ShareDatabaseAwarenessResponse, ShareDatabaseAwarenessResponses, SharedEmailFilter, ShareEntity, ShareEntityType, SharePermissionV2, SharePipeline, ShortIdResponse, SimpleMention, SimpleSaveData, SimpleSaveError, SimpleSaveErrors, SimpleSaveResponse, SimpleSaveResponses, SkippedCell, SlackCompleteRequest, SlackCreateRequest, SlackRegisterRequest, SlackTimestamp, SlackUserId, SmartTagChannelMatch, SmartTagPreview, SortDirection, SortKey, SoupAgentSessionSoupPropertiesField, SoupApiItem, SoupApiSort, SoupApiSortDirection, SoupAttachment, SoupCalendarEventSoupPropertiesField, SoupCalendarEventTime, SoupCallRecordGuest, SoupCallRecordParticipant, SoupCallRecordSoupPropertiesField, SoupChannel, SoupChannelThread, SoupChatSoupPropertiesField, SoupContact, SoupCountedReaction, SoupCrmCompanySoupPropertiesField, SoupCrmContactSoupPropertiesField, SoupCrmDomain, SoupDatabaseRowSoupPropertiesField, SoupDocumentSoupPropertiesField, SoupDocumentSubType, SoupEmailThreadPreview, SoupEnrichedEmailThreadPreviewSoupPropertiesField, SoupForeignEntity, SoupInitiativeSoupPropertiesField, SoupItem, SoupLabel, SoupLabelListVisibility, SoupLabelType, SoupMessageAttachment, SoupMessageListVisibility, SoupMessageSender, SoupMessageSenderType, SoupPage, SoupProjectSoupPropertiesField, SoupPropertiesField, SoupProperty, SoupThreadInfo, SoupThreadReply, SourceBinding, SourceId, SourceIdentity, SqlCell, SqlEntityKind, SqlOutcome, SqlOutcomeKind, SqlSelectOption, SqlStatement, StarterDatabase, StarterDocumentsResponse, StorageRow, StorageRows, StorageRowsQuery, StoredGithubPullRequest, StreamEventsData, StreamEventsError, StreamEventsErrors, StreamEventsResponse, StreamEventsResponses, String, Submission, SubmissionOutcome, SubmitFormResponseData, SubmitFormResponseError, SubmitFormResponseErrors, SubmitFormResponseResponse, SubmitFormResponseResponses, SuccessResponse, SurfaceState, SyncServiceVersionId, SystemSkillSummary, Table, TableChange, TableChanged, TableChanges, TableDetail, TableId, TableResult, TableVersion, TagFilterMode, TakenId, TallyBucket, TallyValue, TaskFilters, TeamCalendarContent, TeamCalendarCoverage, TeamCalendarDetails, TeamCalendarItem, TeamCalendarMember, TeamCalendarPage, TeamCalendarSharing, TeamOutOfOfficeItem, TeamOutOfOfficeResponse, TeamRole, TextOperator, ThreadAnchor, ThreadOrigin, ThreadPatch, ThreadState, TimelineActivity, ToggleShareWithTeamData, ToggleShareWithTeamError, ToggleShareWithTeamErrors, ToggleShareWithTeamResponse, ToggleShareWithTeamResponses, TouchedColumn, TouchedRow, TranscribeDictationData, TranscribeDictationError, TranscribeDictationErrors, TranscribeDictationResponse, TranscribeDictationResponses, TranscribeResponse, TranscriptSegmentRequest, TrashCrmPipelineData, TrashCrmPipelineResponse, TrashCrmPipelineResponses, TrashPipeline, TurnEndedMetadata, TurnStartedMetadata, TurnSummary, TypedSuccessResponse, TypedSuccessResponseGetDocumentResponseData, TypingInput, UndoChangeResponse, UndoDatabaseChangeData, UndoDatabaseChangeError, UndoDatabaseChangeErrors, UndoDatabaseChangeResponse, UndoDatabaseChangeResponses, UndoOutcome, UndoRefusal, UnlockedBooking, UpdateAgentData, UpdateAgentError, UpdateAgentErrors, UpdateAgentRequest, UpdateAgentResponse, UpdateAgentResponses, UpdateChannelSharePermission, UpdateCrmPipelinePermissionsData, UpdateCrmPipelinePermissionsResponse, UpdateCrmPipelinePermissionsResponses, UpdateCrmTeamSettingsRequest, UpdateDatabasePermissionsData, UpdateDatabasePermissionsError, UpdateDatabasePermissionsErrors, UpdateDatabasePermissionsResponse, UpdateDatabasePermissionsResponses, UpdateForm, UpdateFormData, UpdateFormError, UpdateFormErrors, UpdateFormPermissionsData, UpdateFormPermissionsError, UpdateFormPermissionsErrors, UpdateFormPermissionsResponse, UpdateFormPermissionsResponses, UpdateFormResponse, UpdateFormResponses, UpdateInitiativeData, UpdateInitiativeError, UpdateInitiativeErrors, UpdateInitiativeRequest, UpdateInitiativeResponse, UpdateInitiativeResponses, UpdateMeetingRequest, UpdateOperation, UpdateSharePermissionRequestV2, UploadDescriptor, UploadDocumentStatus, UploadExtractFolderHandlerData, UploadExtractFolderHandlerError, UploadExtractFolderHandlerErrors, UploadExtractFolderHandlerResponse, UploadExtractFolderHandlerResponses, UploadExtractFolderRequest, UploadFolderHandlerData, UploadFolderHandlerError, UploadFolderHandlerErrors, UploadFolderHandlerResponse, UploadFolderHandlerResponses, UploadFolderRequest, UploadGrant, UploadId, UpsertHistoryHandlerData, UpsertHistoryHandlerError, UpsertHistoryHandlerErrors, UpsertHistoryHandlerResponse, UpsertHistoryHandlerResponses, UpsertUserDocumentViewLocationData, UpsertUserDocumentViewLocationError, UpsertUserDocumentViewLocationErrors, UpsertUserDocumentViewLocationRequest, UpsertUserDocumentViewLocationResponse, UpsertUserDocumentViewLocationResponses, UserApiKeyId, UserApiKeyInfo, UserApiKeysList, UserDocumentsResponse, UserDocumentViewLocation, UserDocumentViewLocationResponse, UserPinsResponse, UserViewsResponse, ValidateDocumentPermissionsTokenData, ValidateDocumentPermissionsTokenError, ValidateDocumentPermissionsTokenErrors, ValidateDocumentPermissionsTokenResponse, ValidateDocumentPermissionsTokenResponses, ValidateWebhookData, ValidateWebhookError, ValidateWebhookErrors, ValidateWebhookResponse, ValidateWebhookResponse2, ValidateWebhookResponses, Vec, VersionedTable, View, ViewChange, ViewColumn, ViewLayout, ViewPatch, ViewPosition, ViewPositionsResponse, ViewQuery, ViewResult, ViewsResponse, WaitingForInputMetadata, Webhook, WebhookEvent, WebhookFilter, WebhookScope, WebhookStatus, WebhookValidationTestEvent, Widget, WithCallId, WithChannelId, WithDocumentId, WithProjectId } from './types.gen';
+export type { AccessiblePipeline, AccessLevel, AccessRequest, AccessRequestsCancelData, AccessRequestsCancelErrors, AccessRequestsCancelResponses, AccessRequestsDirectData, AccessRequestsDirectErrors, AccessRequestsDirectResponse, AccessRequestsDirectResponses, AccessRequestsRemoveDirectData, AccessRequestsRemoveDirectErrors, AccessRequestsRemoveDirectResponses, AccessRequestsResolveData, AccessRequestsResolveErrors, AccessRequestsResolveResponse, AccessRequestsResolveResponses, AccessRequestsSetDirectData, AccessRequestsSetDirectErrors, AccessRequestsSetDirectResponses, AccessRequestsStateData, AccessRequestsStateErrors, AccessRequestsStateResponse, AccessRequestsStateResponses, AccessRequestsSubmitData, AccessRequestsSubmitErrors, AccessRequestsSubmitResponse, AccessRequestsSubmitResponses, AccessRequestState, ActiveCallsResponse, ActiveCallSummary, ActiveMeeting, ActiveMeetingsResponse, ActivityType, AddFavoriteData, AddFavoriteError, AddFavoriteErrors, AddFavoriteRequest, AddFavoriteResponse, AddFavoriteResponses, AddParticipantsData, AddParticipantsError, AddParticipantsErrors, AddParticipantsRequest, AddParticipantsResponses, AddPinHandlerData, AddPinHandlerError, AddPinHandlerErrors, AddPinHandlerResponse, AddPinHandlerResponses, AddPinRequest, Agent, AgentActionId, AgentChannelScope, AgentDmProfile, AgentMcpServer, AgentMcpServers, AgentPullRequestState, AgentSessionFilters, AgentSessionLifecycleEvent, AgentTyping, AgentTypingPhase, Anchor, AnchorId, AnchorResponse, AnnotationIncrementalUpdate, Answer, ApiActivity, ApiAttachmentChannelReference, ApiAttachmentEntityReference, ApiAttachmentGenericReference, ApiChannelAttachment, ApiChannelAttachmentsPage, ApiChannelDetail, ApiChannelListMessage, ApiChannelListPage, ApiChannelListParticipant, ApiChannelListType, ApiChannelParticipant, ApiChannelWithLatest, ApiEntityFilterAst, ApiGroupByField, ApiGroupMeta, ApiParticipantListRole, ApiParticipantRole, ApiPropertyEntityType, AppliedOps, ApplyCrmPipelineOpsData, ApplyCrmPipelineOpsResponse, ApplyCrmPipelineOpsResponses, ApplyDatabaseOpsData, ApplyDatabaseOpsError, ApplyDatabaseOpsErrors, ApplyDatabaseOpsResponse, ApplyDatabaseOpsResponses, ApplyOpsRequest, ApplyOpsResponse, ApproveHarnessPairingData, ApproveHarnessPairingError, ApproveHarnessPairingErrors, ApproveHarnessPairingResponse, ApproveHarnessPairingResponses, ApprovePairingRequest, AttachmentChange, AttendeeResponseStatus, Audience, Awareness, AwarenessRelay, BasicDocument, BasicDocumentSubType, BomPart, BookingTarget, Bot, BotChannel, BotChannelType, BotId, BotKind, BotOwner, BotOwnerProfile, BotSenderProfile, BotToken, BranchNameResponse, BTreeMap, BulkWakeupRequest, BulkWakeupResponse, BulkWakeupSyncServiceDocumentsData, BulkWakeupSyncServiceDocumentsErrors, BulkWakeupSyncServiceDocumentsResponse, BulkWakeupSyncServiceDocumentsResponses, CalendarAttendee, CalendarEvent, CalendarEventFilters, CalendarEventSourceContent, CalendarMentionEvent, CalendarMentionPreviewItem, CalendarMentionPreviewKind, CalendarMentionPreviewRequest, CalendarMentionPreviewRequestItem, CalendarMentionPreviewResponse, CalendarOccurrence, CalendarOccurrenceItem, CalendarOccurrenceResponse, CalendarSyncStatus, CallActiveResponse, CallFilters, CallRecord, CallRecordGuest, CallRecordParticipant, CallRecordPreview, CallRecordPreviewData, CallRecordSource, CallRecordTranscriptSegment, CallStatus, CallTokenResponse, CallWebhookData, CallWebhookError, CallWebhookErrors, CallWebhookResponses, CancelSlackImportData, CancelSlackImportErrors, CancelSlackImportResponse, CancelSlackImportResponses, CardPosition, CastVerdict, CellValue, CellWrite, ChangedFileDto, ChangesetDto, ChangesetSourceDto, Channel, ChannelCreatedMetadata, ChannelDeletedMetadata, ChannelFilters, ChannelJoinCodeResponse, ChannelLabel, ChannelLabelRule, ChannelLabelsList, ChannelMessage, ChannelParticipant, ChannelParticipantAddedMetadata, ChannelParticipantRemovedMetadata, ChannelPictureChangedMetadata, ChannelPreview, ChannelPreviewData, ChannelSender, ChannelSharePermission, ChannelThreadFilters, ChannelTopicEvent, ChannelType, ChannelUpdatedMetadata, ChannelWebhookRequest, ChannelWebhookResponse, ChannelWithParticipants, Chat, ChatFilters, CheckActiveCallData, CheckActiveCallError, CheckActiveCallErrors, CheckActiveCallResponse, CheckActiveCallResponses, ClaimedPairing, ClaimHarnessPairingData, ClaimHarnessPairingError, ClaimHarnessPairingErrors, ClaimHarnessPairingResponse, ClaimHarnessPairingResponses, ClaimPairingRequest, ClientOptions, CloudStorageItemType, CollaborateFormData, CollaborateFormError, CollaborateFormErrors, CollaborateFormResponse, CollaborateFormResponses, CollabSurfaceResponse, CollabSurfaceTokenResponse, Column, ColumnCast, ColumnChange, ColumnChangeKind, ColumnConfig, ColumnConversion, ColumnConversionRequest, ColumnDetail, ColumnId, ColumnKind, ColumnProtection, ColumnResult, CommandFailure, CommandRejectedMetadata, CommittedChange, CompleteSlackImportUploadsData, CompleteSlackImportUploadsErrors, CompleteSlackImportUploadsResponse, CompleteSlackImportUploadsResponses, CompleteUploads, ConferenceProvider, Conjunction, ConversationId, ConversationKind, ConversationMetadata, ConversationProgress, ConversationSeal, ConversationStatus, ConvertDatabaseColumnData, ConvertDatabaseColumnError, ConvertDatabaseColumnErrors, ConvertDatabaseColumnResponse, ConvertDatabaseColumnResponses, ConvertedCell, CopyDocumentData, CopyDocumentError, CopyDocumentErrors, CopyDocumentQueryParams, CopyDocumentRequest, CopyDocumentResponse, CopyDocumentResponse2, CopyDocumentResponses, CountedReaction, CreateAgentData, CreateAgentError, CreateAgentErrors, CreateAgentRequest, CreateAgentResponse, CreateAgentResponses, CreateAnchorData, CreateAnchorError, CreateAnchorErrors, CreateAnchorResponse, CreateAnchorResponses, CreateBotRequest, CreateBulkDocumentResponse, CreateBulkDocumentResponseData, CreateChannelData, CreateChannelError, CreateChannelErrors, CreateChannelLabelData, CreateChannelLabelError, CreateChannelLabelErrors, CreateChannelLabelRequest, CreateChannelLabelResponse, CreateChannelLabelResponses, CreateChannelRequest, CreateChannelResponse, CreateChannelResponse2, CreateChannelResponses, CreateChannelScopedBotData, CreateChannelScopedBotError, CreateChannelScopedBotErrors, CreateChannelScopedBotRequest, CreateChannelScopedBotResponse, CreateChannelScopedBotResponse2, CreateChannelScopedBotResponses, CreateCollabSurfaceTokenData, CreateCollabSurfaceTokenError, CreateCollabSurfaceTokenErrors, CreateCollabSurfaceTokenResponse, CreateCollabSurfaceTokenResponses, CreateCrmCompanyData, CreateCrmCompanyError, CreateCrmCompanyErrors, CreateCrmCompanyRequest, CreateCrmCompanyResponse, CreateCrmCompanyResponses, CreateCrmContactData, CreateCrmContactError, CreateCrmContactErrors, CreateCrmContactRequest, CreateCrmContactResponse, CreateCrmContactResponses, CreateCrmPipelineData, CreateCrmPipelineResponse, CreateCrmPipelineResponses, CreateDatabaseData, CreateDatabaseError, CreateDatabaseErrors, CreateDatabaseRequest, CreateDatabaseResponse, CreateDatabaseResponses, CreateDatabaseWebhookData, CreateDatabaseWebhookError, CreateDatabaseWebhookErrors, CreateDatabaseWebhookRequest, CreateDatabaseWebhookResponse, CreateDatabaseWebhookResponses, CreatedDatabaseWebhookResponse, CreateDocumentData, CreateDocumentError, CreateDocumentErrors, CreateDocumentRequest, CreateDocumentResponse, CreateDocumentResponseData, CreateDocumentResponses, CreatedPairing, CreatedUserApiKey, CreateEntityMentionData, CreateEntityMentionError, CreateEntityMentionErrors, CreateEntityMentionRequest, CreateEntityMentionResponse, CreateEntityMentionResponse2, CreateEntityMentionResponses, CreateForm, CreateFormData, CreateFormError, CreateFormErrors, CreateFormResponse, CreateFormResponses, CreateHarnessPairingData, CreateHarnessPairingError, CreateHarnessPairingErrors, CreateHarnessPairingResponse, CreateHarnessPairingResponses, CreateImport, CreateInitiativeData, CreateInitiativeError, CreateInitiativeErrors, CreateInitiativeRequest, CreateInitiativeResponse, CreateInitiativeResponses, CreateInstructionsDocumentResponse, CreateInstructionsHandlerData, CreateInstructionsHandlerError, CreateInstructionsHandlerErrors, CreateInstructionsHandlerResponse, CreateInstructionsHandlerResponses, CreateMarkdownDocumentRequest, CreateMarkdownDocumentResponse, CreateMarkdownHandlerData, CreateMarkdownHandlerError, CreateMarkdownHandlerErrors, CreateMarkdownHandlerResponse, CreateMarkdownHandlerResponses, CreateMeetingRequest, CreatePairingRequest, CreatePipeline, CreateProjectHandlerData, CreateProjectHandlerError, CreateProjectHandlerErrors, CreateProjectHandlerResponse, CreateProjectHandlerResponses, CreateProjectRequest, CreateProjectResponse, CreateSkillHandlerData, CreateSkillHandlerError, CreateSkillHandlerErrors, CreateSkillHandlerResponse, CreateSkillHandlerResponses, CreateSkillRequest, CreateSkillResponse, CreateSlackImportData, CreateSlackImportErrors, CreateSlackImportResponse, CreateSlackImportResponses, CreateSnippetHandlerData, CreateSnippetHandlerError, CreateSnippetHandlerErrors, CreateSnippetHandlerResponse, CreateSnippetHandlerResponses, CreateSnippetRequest, CreateSnippetResponse, CreateTaskHandlerData, CreateTaskHandlerError, CreateTaskHandlerErrors, CreateTaskHandlerResponse, CreateTaskHandlerResponses, CreateTaskRequest, CreateTaskResponse, CreateToken, CreateUnthreadedAnchorRequest, CreateUnthreadedAnchorResponse, CreateUnthreadedPdfAnchorRequest, CreateUserApiKeyData, CreateUserApiKeyError, CreateUserApiKeyErrors, CreateUserApiKeyRequest, CreateUserApiKeyResponse, CreateUserApiKeyResponses, CreateViewHandlerData, CreateViewHandlerError, CreateViewHandlerErrors, CreateViewHandlerResponse, CreateViewHandlerResponses, CreateViewRequest, CreateWebhookData, CreateWebhookError, CreateWebhookErrors, CreateWebhookRequest, CreateWebhookResponse, CreateWebhookResponse2, CreateWebhookResponses, CrmAssociation, CrmCompanyFilters, CrmCompanyResponse, CrmContactResponse, CrmDomainResponse, CrmPermissionRole, CrmStageInput, CrmStageResponse, CrmStagesResponse, CrmTeamSettingsResponse, CustomSpeakerAssignment, Database, DatabaseDetail, DatabaseId, DatabaseOp, DatabaseQueryRequest, DatabaseView, DatabaseWebhookDeliveryResponse, DatabaseWebhookPayloadProblem, DatabaseWebhookResponse, DataType, DateOperator, DeclineCallData, DeclineCallError, DeclineCallErrors, DeclineCallResponse, DeclineCallResponses, DeclineRingData, DeclineRingError, DeclineRingErrors, DeclineRingResponse, DeclineRingResponses, DeleteAnchorData, DeleteAnchorError, DeleteAnchorErrors, DeleteAnchorResponse, DeleteAnchorResponses, DeleteCallRecordData, DeleteCallRecordError, DeleteCallRecordErrors, DeleteCallRecordResponse, DeleteCallRecordResponses, DeleteChannelData, DeleteChannelError, DeleteChannelErrors, DeleteChannelLabelData, DeleteChannelLabelError, DeleteChannelLabelErrors, DeleteChannelLabelResponse, DeleteChannelLabelResponses, DeleteChannelResponse, DeleteChannelResponses, DeleteCollabSurfaceData, DeleteCollabSurfaceError, DeleteCollabSurfaceErrors, DeleteCollabSurfaceResponse, DeleteCollabSurfaceResponses, DeleteDatabaseWebhookData, DeleteDatabaseWebhookError, DeleteDatabaseWebhookErrors, DeleteDatabaseWebhookResponse, DeleteDatabaseWebhookResponses, DeleteDocumentData, DeleteDocumentError, DeleteDocumentErrors, DeleteDocumentResponse, DeleteDocumentResponses, DeleteEntityMentionData, DeleteEntityMentionError, DeleteEntityMentionErrors, DeleteEntityMentionResponse, DeleteEntityMentionResponse2, DeleteEntityMentionResponses, DeleteHarnessData, DeleteHarnessError, DeleteHarnessErrors, DeleteHarnessResponse, DeleteHarnessResponses, DeleteHistoryHandlerData, DeleteHistoryHandlerError, DeleteHistoryHandlerErrors, DeleteHistoryHandlerResponse, DeleteHistoryHandlerResponses, DeleteInitiativeData, DeleteInitiativeError, DeleteInitiativeErrors, DeleteInitiativeResponse, DeleteInitiativeResponses, DeleteProjectHandlerData, DeleteProjectHandlerError, DeleteProjectHandlerErrors, DeleteProjectHandlerResponse, DeleteProjectHandlerResponses, DeleteSelfHarnessData, DeleteSelfHarnessError, DeleteSelfHarnessErrors, DeleteSelfHarnessResponse, DeleteSelfHarnessResponses, DeleteUnthreadedAnchorRequest, DeleteUnthreadedAnchorResponse, DeleteUnthreadedPdfAnchorRequest, DeleteUserApiKeyData, DeleteUserApiKeyError, DeleteUserApiKeyErrors, DeleteUserApiKeyResponse, DeleteUserApiKeyResponses, DeleteUserDocumentViewLocationData, DeleteUserDocumentViewLocationError, DeleteUserDocumentViewLocationErrors, DeleteUserDocumentViewLocationResponse, DeleteUserDocumentViewLocationResponses, DeleteViewHandlerData, DeleteViewHandlerError, DeleteViewHandlerErrors, DeleteViewHandlerResponses, DeleteWebhookData, DeleteWebhookError, DeleteWebhookErrors, DeleteWebhookResponse, DeleteWebhookResponses, DeliverDatabaseWebhookData, DeliverDatabaseWebhookError, DeliverDatabaseWebhookErrors, DeliverDatabaseWebhookResponse, DeliverDatabaseWebhookResponses, DirectAccess, DocumentBasic, DocumentContent, DocumentContentLocation, DocumentContentState, DocumentContentUploadedMetadata, DocumentCopiedMetadata, DocumentCreatedMetadata, DocumentDeletedMetadata, DocumentFilters, DocumentId, DocumentInteractionMetadata, DocumentMetadata, DocumentMetadataWithContent, DocumentPermissionsToken, DocumentPermissionsTokenRequest, DocumentPermissionsTokenResponse, DocumentPreview, DocumentPreviewData, DocumentPreviewDataSubType, DocumentPurgedMetadata, DocumentResponse, DocumentResponseMetadata, DocumentResponseMetadataWithContent, DocumentStorageServiceApiVersion, DocumentSubType, DocumentSyncContentUpdatedMetadata, DocumentSyncEditor, DocumentTeamShareResponse, DocumentTextContent, DocumentTopicEvent, DocumentUpdatedMetadata, EditAnchorData, EditAnchorError, EditAnchorErrors, EditAnchorRequest, EditAnchorResponse, EditAnchorResponse2, EditAnchorResponses, EditCallRecordData, EditCallRecordError, EditCallRecordErrors, EditCallRecordRequest, EditCallRecordResponse, EditCallRecordResponses, EditCallTranscriptData, EditCallTranscriptError, EditCallTranscriptErrors, EditCallTranscriptRequest, EditCallTranscriptResponse, EditCallTranscriptResponses, EditDocumentData, EditDocumentError, EditDocumentErrors, EditDocumentResponse, EditDocumentResponse2, EditDocumentResponses, EditDocumentServiceArgs, EditMyFormResponseData, EditMyFormResponseError, EditMyFormResponseErrors, EditMyFormResponseResponse, EditMyFormResponseResponses, EditPdfAnchorRequest, EditPdfPlaceableCommentAnchorRequest, EditProjectV2Data, EditProjectV2Error, EditProjectV2Errors, EditProjectV2Response, EditProjectV2Responses, EditThreadV2Data, EditThreadV2Error, EditThreadV2Errors, EditThreadV2Response, EditThreadV2Responses, EmailFilters, EmailFollowup, EmailFollowupCommand, EmailFollowupResponse, EmailReminderCondition, EmailReminderPage, EmailReminderSummary, EmptyResponse, EnsureCollabSurfaceData, EnsureCollabSurfaceError, EnsureCollabSurfaceErrors, EnsureCollabSurfaceRequest, EnsureCollabSurfaceResponse, EnsureCollabSurfaceResponses, EnsureStarterHandlerData, EnsureStarterHandlerErrors, EnsureStarterHandlerResponse, EnsureStarterHandlerResponses, EntityFilters, EntityKind, EntityMessageCreateData, EntityMessageCreateResponse, EntityMessageCreateResponses, EntityMessageDeleteMessageData, EntityMessageDeleteMessageResponse, EntityMessageDeleteMessageResponses, EntityMessageDeleteThreadData, EntityMessageDeleteThreadResponse, EntityMessageDeleteThreadResponses, EntityMessageEditData, EntityMessageEditResponse, EntityMessageEditResponses, EntityMessageGetMessageData, EntityMessageGetMessageResponse, EntityMessageGetMessageResponses, EntityMessageGetThreadData, EntityMessageGetThreadResponse, EntityMessageGetThreadResponses, EntityMessageLegacyData, EntityMessageLegacyResponse, EntityMessageLegacyResponses, EntityMessagePatchThreadData, EntityMessagePatchThreadResponse, EntityMessagePatchThreadResponses, EntityMessageReactData, EntityMessageReactResponse, EntityMessageReactResponses, EntityMessageTypingData, EntityMessageTypingResponse, EntityMessageTypingResponses, EntityPermission, EntityPermissionResponse, EntityRef, EntityReference, EntityType, ErrorResponse, EventReminderOverride, EventReminders, EventStatus, EventTime, EventTransparency, EventType, EventVisibility, ExcludedDefaultView, ExcludeDefaultViewHandlerData, ExcludeDefaultViewHandlerError, ExcludeDefaultViewHandlerErrors, ExcludeDefaultViewHandlerResponses, ExcludeDefaultViewRequest, ExportDocumentData, ExportDocumentError, ExportDocumentErrors, ExportDocumentResponse, ExportDocumentResponse2, ExportDocumentResponses, Favorite, FavoriteEntityRef, FavoritesList, FileChangeKindDto, FileSystemNodeWithIds, FileType, FileTypeUpdate, FilterCondition, FilterGroup, FilterNode, FilterTest, FinalizeSlackImportData, FinalizeSlackImportErrors, FinalizeSlackImportResponse, FinalizeSlackImportResponses, FolderItem, FollowupState, ForeignEntity, ForeignEntityFilters, Form, FormAccess, FormCollaboration, FormDetail, FormErrorCode, FormErrorResponse, FormLayout, FormPublicationProblem, FormQuestionDetail, FormResponse, FormSection, FormSectionDetail, FormSource, FormStatus, FormTally, Formula, GenericErrorResponse, GenericResponse, GenericSuccessResponse, GetActiveCallsData, GetActiveCallsError, GetActiveCallsErrors, GetActiveCallsResponse, GetActiveCallsResponses, GetActivityData, GetActivityError, GetActivityErrors, GetActivityResponse, GetActivityResponses, GetAttachmentReferencesData, GetAttachmentReferencesError, GetAttachmentReferencesErrors, GetAttachmentReferencesResponse, GetAttachmentReferencesResponse2, GetAttachmentReferencesResponses, GetBatchCallRecordPreviewData, GetBatchCallRecordPreviewError, GetBatchCallRecordPreviewErrors, GetBatchCallRecordPreviewRequest, GetBatchCallRecordPreviewResponse, GetBatchCallRecordPreviewResponse2, GetBatchCallRecordPreviewResponses, GetBatchChannelPreviewData, GetBatchChannelPreviewError, GetBatchChannelPreviewErrors, GetBatchChannelPreviewRequest, GetBatchChannelPreviewResponse, GetBatchChannelPreviewResponse2, GetBatchChannelPreviewResponses, GetBatchPreviewHandlerData, GetBatchPreviewHandlerError, GetBatchPreviewHandlerErrors, GetBatchPreviewHandlerResponse, GetBatchPreviewHandlerResponses, GetBatchPreviewRequest, GetBatchPreviewResponse, GetBatchProjectPreviewData, GetBatchProjectPreviewError, GetBatchProjectPreviewErrors, GetBatchProjectPreviewRequest, GetBatchProjectPreviewResponse, GetBatchProjectPreviewResponse2, GetBatchProjectPreviewResponses, GetBotOwnerProfilesData, GetBotOwnerProfilesError, GetBotOwnerProfilesErrors, GetBotOwnerProfilesResponse, GetBotOwnerProfilesResponses, GetCallRecordData, GetCallRecordError, GetCallRecordErrors, GetCallRecordResponse, GetCallRecordResponses, GetChannelAttachmentsData, GetChannelAttachmentsError, GetChannelAttachmentsErrors, GetChannelAttachmentsResponse, GetChannelAttachmentsResponses, GetChannelData, GetChannelError, GetChannelErrors, GetChannelJoinLinkData, GetChannelJoinLinkError, GetChannelJoinLinkErrors, GetChannelJoinLinkResponse, GetChannelJoinLinkResponses, GetChannelParticipantsData, GetChannelParticipantsError, GetChannelParticipantsErrors, GetChannelParticipantsResponse, GetChannelParticipantsResponses, GetChannelResponse, GetChannelResponses, GetChannelsData, GetChannelsError, GetChannelsErrors, GetChannelsResponse, GetChannelsResponses, GetCollabSurfaceData, GetCollabSurfaceError, GetCollabSurfaceErrors, GetCollabSurfaceResponse, GetCollabSurfaceResponses, GetCompanyData, GetCompanyError, GetCompanyErrors, GetCompanyResponse, GetCompanyResponses, GetContactByEmailData, GetContactByEmailError, GetContactByEmailErrors, GetContactByEmailResponse, GetContactByEmailResponse2, GetContactByEmailResponses, GetContactData, GetContactError, GetContactErrors, GetContactResponse, GetContactResponses, GetCrmPipelineData, GetCrmPipelinePermissionsData, GetCrmPipelinePermissionsResponse, GetCrmPipelinePermissionsResponses, GetCrmPipelineResponse, GetCrmPipelineResponses, GetCrmPipelineRowsData, GetCrmPipelineRowsResponse, GetCrmPipelineRowsResponses, GetCrmPipelineTableData, GetCrmPipelineTableResponse, GetCrmPipelineTableResponses, GetCrmTeamSettingsData, GetCrmTeamSettingsError, GetCrmTeamSettingsErrors, GetCrmTeamSettingsResponse, GetCrmTeamSettingsResponses, GetDatabaseData, GetDatabaseError, GetDatabaseErrors, GetDatabasePermissionsData, GetDatabasePermissionsError, GetDatabasePermissionsErrors, GetDatabasePermissionsResponse, GetDatabasePermissionsResponses, GetDatabaseQueryData, GetDatabaseQueryError, GetDatabaseQueryErrors, GetDatabaseQueryResponse, GetDatabaseQueryResponses, GetDatabaseResponse, GetDatabaseResponses, GetDatabaseRowHistoryData, GetDatabaseRowHistoryError, GetDatabaseRowHistoryErrors, GetDatabaseRowHistoryResponse, GetDatabaseRowHistoryResponses, GetDatabaseTableChangesData, GetDatabaseTableChangesError, GetDatabaseTableChangesErrors, GetDatabaseTableChangesResponse, GetDatabaseTableChangesResponses, GetDatabaseViewPositionsData, GetDatabaseViewPositionsError, GetDatabaseViewPositionsErrors, GetDatabaseViewPositionsResponse, GetDatabaseViewPositionsResponses, GetDocumentAnchorsData, GetDocumentAnchorsError, GetDocumentAnchorsErrors, GetDocumentAnchorsResponse, GetDocumentAnchorsResponses, GetDocumentBranchNameData, GetDocumentBranchNameError, GetDocumentBranchNameErrors, GetDocumentBranchNameResponse, GetDocumentBranchNameResponses, GetDocumentByTeamSlugData, GetDocumentByTeamSlugError, GetDocumentByTeamSlugErrors, GetDocumentByTeamSlugResponse, GetDocumentByTeamSlugResponses, GetDocumentData, GetDocumentError, GetDocumentErrors, GetDocumentGithubPullRequestsData, GetDocumentGithubPullRequestsError, GetDocumentGithubPullRequestsErrors, GetDocumentGithubPullRequestsResponse, GetDocumentGithubPullRequestsResponses, GetDocumentKeyResponse, GetDocumentKeyResponseData, GetDocumentListHandlerData, GetDocumentListHandlerError, GetDocumentListHandlerErrors, GetDocumentListHandlerResponse, GetDocumentListHandlerResponses, GetDocumentListResult, GetDocumentLocationV3Data, GetDocumentLocationV3Error, GetDocumentLocationV3Errors, GetDocumentLocationV3Response, GetDocumentLocationV3Responses, GetDocumentPermissionsResponseDataV2, GetDocumentPermissionsTokenData, GetDocumentPermissionsTokenError, GetDocumentPermissionsTokenErrors, GetDocumentPermissionsTokenResponse, GetDocumentPermissionsTokenResponses, GetDocumentPermissionsV2Data, GetDocumentPermissionsV2Error, GetDocumentPermissionsV2Errors, GetDocumentPermissionsV2Response, GetDocumentPermissionsV2Responses, GetDocumentProcessingResult, GetDocumentProcessingResultData, GetDocumentProcessingResultError, GetDocumentProcessingResultErrors, GetDocumentProcessingResultResponse, GetDocumentProcessingResultResponse2, GetDocumentProcessingResultResponses, GetDocumentResponse, GetDocumentResponse2, GetDocumentResponseData, GetDocumentResponses, GetDocumentSearchResponse, GetDocumentShortIdData, GetDocumentShortIdError, GetDocumentShortIdErrors, GetDocumentShortIdResponse, GetDocumentShortIdResponses, GetDocumentsResponse, GetDocumentTeamShareData, GetDocumentTeamShareError, GetDocumentTeamShareErrors, GetDocumentTeamShareResponse, GetDocumentTeamShareResponses, GetDocumentTextContentData, GetDocumentTextContentErrors, GetDocumentTextContentResponse, GetDocumentTextContentResponses, GetDocumentUserAccessLevelResponse, GetDocumentVersionData, GetDocumentVersionError, GetDocumentVersionErrors, GetDocumentVersionResponse, GetDocumentVersionResponses, GetDocumentViewsHandlerData, GetDocumentViewsHandlerError, GetDocumentViewsHandlerErrors, GetDocumentViewsHandlerResponse, GetDocumentViewsHandlerResponses, GetEmailFollowupData, GetEmailFollowupError, GetEmailFollowupErrors, GetEmailFollowupResponse, GetEmailFollowupResponses, GetEntityPermissionData, GetEntityPermissionErrors, GetEntityPermissionResponse, GetEntityPermissionResponses, GetForeignEntityBySourceData, GetForeignEntityBySourceError, GetForeignEntityBySourceErrors, GetForeignEntityBySourceResponse, GetForeignEntityBySourceResponses, GetForeignEntityData, GetForeignEntityError, GetForeignEntityErrors, GetForeignEntityResponse, GetForeignEntityResponses, GetFormData, GetFormError, GetFormErrors, GetFormPermissionsData, GetFormPermissionsError, GetFormPermissionsErrors, GetFormPermissionsResponse, GetFormPermissionsResponses, GetFormResponse, GetFormResponses, GetFormResponseSummaryData, GetFormResponseSummaryError, GetFormResponseSummaryErrors, GetFormResponseSummaryResponse, GetFormResponseSummaryResponses, GetFormTallyData, GetFormTallyError, GetFormTallyErrors, GetFormTallyResponse, GetFormTallyResponses, GetGithubPullRequestChangesData, GetGithubPullRequestChangesError, GetGithubPullRequestChangesErrors, GetGithubPullRequestChangesPatchData, GetGithubPullRequestChangesPatchError, GetGithubPullRequestChangesPatchErrors, GetGithubPullRequestChangesPatchResponse, GetGithubPullRequestChangesPatchResponses, GetGithubPullRequestChangesResponse, GetGithubPullRequestChangesResponses, GetGithubPullRequestData, GetGithubPullRequestError, GetGithubPullRequestErrors, GetGithubPullRequestFacetsData, GetGithubPullRequestFacetsError, GetGithubPullRequestFacetsErrors, GetGithubPullRequestFacetsResponse, GetGithubPullRequestFacetsResponses, GetGithubPullRequestResponse, GetGithubPullRequestResponses, GetGithubPullRequestTasksData, GetGithubPullRequestTasksError, GetGithubPullRequestTasksErrors, GetGithubPullRequestTasksResponse, GetGithubPullRequestTasksResponses, GetHarnessPairingData, GetHarnessPairingError, GetHarnessPairingErrors, GetHarnessPairingResponse, GetHarnessPairingResponses, GetHistoryHandlerData, GetHistoryHandlerError, GetHistoryHandlerErrors, GetHistoryHandlerResponse, GetHistoryHandlerResponses, GetInitiativeData, GetInitiativeError, GetInitiativeErrors, GetInitiativeResponse, GetInitiativeResponses, GetInstructionsDocumentResponse, GetInstructionsHandlerData, GetInstructionsHandlerError, GetInstructionsHandlerErrors, GetInstructionsHandlerResponse, GetInstructionsHandlerResponses, GetItemsSoupData, GetItemsSoupError, GetItemsSoupErrors, GetItemsSoupResponse, GetItemsSoupResponses, GetLocationHandlerData, GetLocationHandlerError, GetLocationHandlerErrors, GetLocationHandlerResponse, GetLocationHandlerResponses, GetMyFormResponseData, GetMyFormResponseError, GetMyFormResponseErrors, GetMyFormResponseResponse, GetMyFormResponseResponses, GetOrCreateAction, GetOrCreateCallData, GetOrCreateCallError, GetOrCreateCallErrors, GetOrCreateCallResponse, GetOrCreateCallResponses, GetOrCreateChannelResponse, GetOrCreateDmData, GetOrCreateDmError, GetOrCreateDmErrors, GetOrCreateDmRequest, GetOrCreateDmResponse, GetOrCreateDmResponses, GetOrCreatePrivateData, GetOrCreatePrivateError, GetOrCreatePrivateErrors, GetOrCreatePrivateRequest, GetOrCreatePrivateResponse, GetOrCreatePrivateResponses, GetPendingProjectsHandlerData, GetPendingProjectsHandlerError, GetPendingProjectsHandlerErrors, GetPendingProjectsHandlerResponse, GetPendingProjectsHandlerResponses, GetPinsHandlerData, GetPinsHandlerError, GetPinsHandlerErrors, GetPinsHandlerResponse, GetPinsHandlerResponses, GetPinsResponse, GetProjectContentHandlerData, GetProjectContentHandlerError, GetProjectContentHandlerErrors, GetProjectContentHandlerResponse, GetProjectContentHandlerResponses, GetProjectContentResponse, GetProjectHandlerData, GetProjectHandlerError, GetProjectHandlerErrors, GetProjectHandlerResponse, GetProjectHandlerResponses, GetProjectPermissionsV2Data, GetProjectPermissionsV2Error, GetProjectPermissionsV2Errors, GetProjectPermissionsV2Response, GetProjectPermissionsV2Responses, GetProjectResponse, GetProjectResponseData, GetProjectsHandlerData, GetProjectsHandlerError, GetProjectsHandlerErrors, GetProjectsHandlerResponse, GetProjectsHandlerResponses, GetProjectsResponse, GetProjectUserAccessLevelData, GetProjectUserAccessLevelError, GetProjectUserAccessLevelErrors, GetProjectUserAccessLevelResponse, GetProjectUserAccessLevelResponses, GetRingStatusData, GetRingStatusError, GetRingStatusErrors, GetRingStatusResponse, GetRingStatusResponses, GetSelfBotData, GetSelfBotError, GetSelfBotErrors, GetSelfBotResponse, GetSelfBotResponses, GetSelfHarnessData, GetSelfHarnessError, GetSelfHarnessErrors, GetSelfHarnessResponse, GetSelfHarnessResponses, GetSlackImportData, GetSlackImportErrors, GetSlackImportResponse, GetSlackImportResponses, GetSystemSkillsHandlerData, GetSystemSkillsHandlerError, GetSystemSkillsHandlerErrors, GetSystemSkillsHandlerResponse, GetSystemSkillsHandlerResponses, GetUserDocumentsHandlerData, GetUserDocumentsHandlerError, GetUserDocumentsHandlerErrors, GetUserDocumentsHandlerResponse, GetUserDocumentsHandlerResponses, GetUserDocumentViewLocationData, GetUserDocumentViewLocationError, GetUserDocumentViewLocationErrors, GetUserDocumentViewLocationResponse, GetUserDocumentViewLocationResponses, GetUserHistoryResponse, GetViewsHandlerData, GetViewsHandlerError, GetViewsHandlerErrors, GetViewsHandlerResponse, GetViewsHandlerResponses, GetWebhookData, GetWebhookError, GetWebhookErrors, GetWebhookResponse, GetWebhookResponses, GithubLabelFacet, GithubPullRequest, GithubPullRequestChangesPatchResponse, GithubPullRequestChangesResponse, GithubPullRequestCheckRun, GithubPullRequestComment, GithubPullRequestFacets, GithubPullRequestLabel, GithubPullRequestReview, GithubPullRequestReviewDecision, GithubPullRequestReviewState, GithubPullRequestsResponse, GithubPullRequestTasks, GithubPullRequestTasksRequest, GithubPullRequestTasksResponse, GithubPullRequestUser, GithubRepositoryFacet, GithubUserFacet, GitRefDto, GroupedInitialParams, GroupedPageParams, GroupedSoupGroupPage, GroupedSoupInitialPage, GroupedSoupPage, GroupedSoupSort, GuestCallChatPostData, GuestCallChatPostErrors, GuestCallChatPostResponse, GuestCallChatPostResponses, GuestCallChatReadData, GuestCallChatReadErrors, GuestCallChatReadResponse, GuestCallChatReadResponses, GuestChatMessage, GuestChatPage, GuestChatPost, GuestId, GuestJoinRequest, HandlerData, HandlerError, HandlerErrors, HandlerResponse, HandlerResponses, Harness, HarnessAgent, HarnessId, HarnessOwner, HarnessSession, HashMap, HealthHandlerData, HealthHandlerResponse, HealthHandlerResponses, HighlightType, ImportCounters, ImportDatabaseTableData, ImportDatabaseTableError, ImportDatabaseTableErrors, ImportDatabaseTableResponse, ImportDatabaseTableResponses, ImportedAuthor, ImportError, ImportLimits, ImportPage, ImportProgress, ImportTable, ImportWarning, InferColumnTypeOutcome, InferColumnTypeRequest, InferDatabaseColumnTypeData, InferDatabaseColumnTypeError, InferDatabaseColumnTypeErrors, InferDatabaseColumnTypeResponse, InferDatabaseColumnTypeResponses, InFlightTurnSummary, IngestTranscriptData, IngestTranscriptError, IngestTranscriptErrors, IngestTranscriptResponses, InitializeUserDocumentsData, InitializeUserDocumentsError, InitializeUserDocumentsErrors, InitializeUserDocumentsResponse, InitializeUserDocumentsResponses, InitialPropertyValue, InitiativeDetail, InitiativeFilters, InitiativeId, InitiativeList, InitiativeSummary, InputReceivedMetadata, InstallSyncData, InstallSyncErrors, InteractionReason, InvalidDatabaseWebhookPayloadResponse, InviteMeetingRequest, InviteMeetingUsersRequest, Item, ItemWithUserAccessLevel, JobId, JobProcessingResultHandlerData, JobProcessingResultHandlerError, JobProcessingResultHandlerErrors, JobProcessingResultHandlerResponse, JobProcessingResultHandlerResponses, JobStatus, JoinChannelByCodeData, JoinChannelByCodeError, JoinChannelByCodeErrors, JoinChannelByCodeResponses, JoinChannelData, JoinChannelError, JoinChannelErrors, JoinChannelResponses, KeySegment, Lane, LaneKey, LatestMessage, LayoutProblem, LeaveCallResponse, LeaveChannelData, LeaveChannelError, LeaveChannelErrors, LeaveChannelResponses, LeaveOrEndCallData, LeaveOrEndCallError, LeaveOrEndCallErrors, LeaveOrEndCallResponse, LeaveOrEndCallResponses, LinkShare, ListAccessibleFormsData, ListAccessibleFormsError, ListAccessibleFormsErrors, ListAccessibleFormsResponse, ListAccessibleFormsResponses, ListAgentsData, ListAgentsError, ListAgentsErrors, ListAgentsResponse, ListAgentsResponses, ListBotChannelsData, ListBotChannelsError, ListBotChannelsErrors, ListBotChannelsResponse, ListBotChannelsResponses, ListChannelLabelsData, ListChannelLabelsError, ListChannelLabelsErrors, ListChannelLabelsResponse, ListChannelLabelsResponses, ListCompanyContactsData, ListCompanyContactsError, ListCompanyContactsErrors, ListCompanyContactsResponse, ListCompanyContactsResponses, ListCrmPipelinesData, ListCrmPipelinesResponse, ListCrmPipelinesResponses, ListDatabaseColumnCastsData, ListDatabaseColumnCastsError, ListDatabaseColumnCastsErrors, ListDatabaseColumnCastsResponse, ListDatabaseColumnCastsResponses, ListDatabasesData, ListDatabasesError, ListDatabasesErrors, ListDatabasesResponse, ListDatabasesResponses, ListDatabaseWebhooksData, ListDatabaseWebhooksError, ListDatabaseWebhooksErrors, ListDatabaseWebhooksResponse, ListDatabaseWebhooksResponse2, ListDatabaseWebhooksResponses, ListedDatabase, ListedForm, ListEmailRemindersData, ListEmailRemindersError, ListEmailRemindersErrors, ListEmailRemindersResponse, ListEmailRemindersResponses, ListFavoritesData, ListFavoritesError, ListFavoritesErrors, ListFavoritesResponse, ListFavoritesResponses, ListFormsData, ListFormsError, ListFormsErrors, ListFormsResponse, ListFormsResponses, ListHarnessAgentsData, ListHarnessAgentsError, ListHarnessAgentsErrors, ListHarnessAgentsResponse, ListHarnessAgentsResponses, ListHarnessesData, ListHarnessesError, ListHarnessesErrors, ListHarnessesResponse, ListHarnessesResponses, ListHarnessSessionsData, ListHarnessSessionsError, ListHarnessSessionsErrors, ListHarnessSessionsResponse, ListHarnessSessionsResponses, ListInitiativesData, ListInitiativesError, ListInitiativesErrors, ListInitiativesResponse, ListInitiativesResponses, ListOccurrencesData, ListOccurrencesErrors, ListOccurrencesResponse, ListOccurrencesResponses, ListSlackImportsData, ListSlackImportsResponse, ListSlackImportsResponses, ListTeamCalendarData, ListTeamCalendarResponse, ListTeamCalendarResponses, ListTeamOutOfOfficeData, ListTeamOutOfOfficeErrors, ListTeamOutOfOfficeResponse, ListTeamOutOfOfficeResponses, ListUserApiKeysData, ListUserApiKeysError, ListUserApiKeysErrors, ListUserApiKeysResponse, ListUserApiKeysResponses, ListWebhooksData, ListWebhooksError, ListWebhooksErrors, ListWebhooksResponse, ListWebhooksResponse2, ListWebhooksResponses, LocationResponseData, LocationResponseV3, MacroUserIdStr, Meeting, MeetingCancelData, MeetingCancelError, MeetingCancelErrors, MeetingCancelPreparationData, MeetingCancelPreparationError, MeetingCancelPreparationErrors, MeetingCancelPreparationResponse, MeetingCancelPreparationResponses, MeetingCancelResponse, MeetingCancelResponses, MeetingCreateData, MeetingCreateError, MeetingCreateErrors, MeetingCreateResponse, MeetingCreateResponses, MeetingGuestJoinData, MeetingGuestJoinError, MeetingGuestJoinErrors, MeetingGuestJoinResponse, MeetingGuestJoinResponses, MeetingGuestParticipantsData, MeetingGuestParticipantsError, MeetingGuestParticipantsErrors, MeetingGuestParticipantsResponse, MeetingGuestParticipantsResponses, MeetingInviteData, MeetingInviteError, MeetingInviteErrors, MeetingInvitePermissions, MeetingInvitePermissionsData, MeetingInvitePermissionsError, MeetingInvitePermissionsErrors, MeetingInvitePermissionsResponse, MeetingInvitePermissionsResponses, MeetingInviteResponse, MeetingInviteResponses, MeetingInviteUsersData, MeetingInviteUsersError, MeetingInviteUsersErrors, MeetingInviteUsersResponse, MeetingInviteUsersResponses, MeetingJoinData, MeetingJoinError, MeetingJoinErrors, MeetingJoinResponse, MeetingJoinResponses, MeetingLeaveData, MeetingLeaveError, MeetingLeaveErrors, MeetingLeaveResponse, MeetingLeaveResponses, MeetingListActiveData, MeetingListActiveError, MeetingListActiveErrors, MeetingListActiveResponse, MeetingListActiveResponses, MeetingListData, MeetingListError, MeetingListErrors, MeetingListResponse, MeetingListResponses, MeetingLookupData, MeetingLookupError, MeetingLookupErrors, MeetingLookupResponse, MeetingLookupResponses, MeetingParticipant, MeetingParticipants, MeetingParticipantsData, MeetingParticipantsError, MeetingParticipantsErrors, MeetingParticipantsResponse, MeetingParticipantsResponses, MeetingPreparation, MeetingPrepareData, MeetingPrepareError, MeetingPrepareErrors, MeetingPrepareResponse, MeetingPrepareResponses, MeetingShareData, MeetingShareError, MeetingShareErrors, MeetingShareResponse, MeetingShareResponses, MeetingsResponse, MeetingToken, MeetingUpdateData, MeetingUpdateError, MeetingUpdateErrors, MeetingUpdateResponse, MeetingUpdateResponses, MentionPreviewsData, MentionPreviewsErrors, MentionPreviewsResponse, MentionPreviewsResponses, Message, MessageAttachment, MessageAttachmentCreatedMetadata, MessageAttachmentRemovedMetadata, MessageChange, MessageCursor, MessageDeletedMetadata, MessageDirection, MessageEvent, MessageEventAttachment, MessageListItem, MessageMentionedMetadata, MessagePage, MessageParent, MessagePatch, MessagePatchedMetadata, MessagePostedMetadata, MessageThread, MessageThreadPreview, MessageTimelineData, MessageTimelineEntriesData, MessageTimelineEntriesResponse, MessageTimelineEntriesResponses, MessageTimelineEntry, MessageTimelinePage, MessageTimelineQuery, MessageTimelineResponse, MessageTimelineResponses, MessageTopicEvent, MyResponse, NewAttachment, NewColumn, NewOption, NewThreadAnchor, NewView, NotificationFilters, NotificationState, NumberOperator, OpBatch, Operator, OpRefusalResponse, OpResult, OptionId, OptionRef, PairingDetails, Params, ParticipantRole, PatchBotRequest, PatchChannelData, PatchChannelError, PatchChannelErrors, PatchChannelRequest, PatchChannelResponse, PatchChannelResponses, PatchMessageNotificationPolicy, PatchProjectRequestV2, PatchThreadRequestV2, PatchViewHandlerData, PatchViewHandlerError, PatchViewHandlerErrors, PatchViewHandlerResponses, PatchWebhookData, PatchWebhookError, PatchWebhookErrors, PatchWebhookRequest, PatchWebhookResponse, PatchWebhookResponses, PdfAnchor, PdfAnchorId, PdfHighlightAnchor, PdfHighlightAnchorRequest, PdfHighlightRect, PdfHighlightRectAnchorRequest, PdfPlaceableCommentAnchor, PendingClaimResponse, PermanentlyDeleteDocumentData, PermanentlyDeleteDocumentError, PermanentlyDeleteDocumentErrors, PermanentlyDeleteDocumentResponse, PermanentlyDeleteDocumentResponses, PermanentlyDeleteProjectData, PermanentlyDeleteProjectError, PermanentlyDeleteProjectErrors, PermanentlyDeleteProjectResponse, PermanentlyDeleteProjectResponses, PinnedItem, PinRequest, Pipeline, PipelineRecordType, PipelineSharing, PostActivityData, PostActivityError, PostActivityErrors, PostActivityRequest, PostActivityResponse, PostActivityResponses, PostChannelBotWebhookData, PostChannelBotWebhookError, PostChannelBotWebhookErrors, PostChannelBotWebhookResponse, PostChannelBotWebhookResponses, PostGroupedSoupAstGroupPageRequest, PostGroupedSoupAstInitialRequest, PostGroupedSoupAstRequest, PostItemsSoupAstData, PostItemsSoupAstError, PostItemsSoupAstErrors, PostItemsSoupAstGroupedData, PostItemsSoupAstGroupedError, PostItemsSoupAstGroupedErrors, PostItemsSoupAstGroupedResponse, PostItemsSoupAstGroupedResponses, PostItemsSoupAstResponse, PostItemsSoupAstResponses, PostItemsSoupData, PostItemsSoupError, PostItemsSoupErrors, PostItemsSoupResponse, PostItemsSoupResponses, PostMessage, PostMessageNotificationPolicy, PostSoupAstRequest, PostSoupRequest, PresaveDocumentHandlerData, PresaveDocumentHandlerError, PresaveDocumentHandlerErrors, PresaveDocumentHandlerResponse, PresaveDocumentHandlerResponses, PreSaveDocumentRequest, PreSaveDocumentResponse, PreSaveDocumentResponseData, PresenceOperator, PresignedUrl, PreviewSmartTagData, PreviewSmartTagError, PreviewSmartTagErrors, PreviewSmartTagResponse, PreviewSmartTagResponses, Project, ProjectDeleteResponseData, ProjectDocumentStatus, ProjectFilters, ProjectPreview, ProjectPreviewData, PropertyDefinition, PropertyDefinitionWithOptions, PropertyFilter, PropertyInput, PropertyOption, PropertyOptionValue, PropertyOwner, PropertyValue, PutCrmTeamSettingsData, PutCrmTeamSettingsError, PutCrmTeamSettingsErrors, PutCrmTeamSettingsResponse, PutCrmTeamSettingsResponses, PutCrmTeamStagesData, PutCrmTeamStagesError, PutCrmTeamStagesErrors, PutCrmTeamStagesResponse, PutCrmTeamStagesResponses, PutFormLayoutData, PutFormLayoutError, PutFormLayoutErrors, PutFormLayoutResponse, PutFormLayoutResponses, QueryCrmPipelineRowsData, QueryCrmPipelineRowsResponse, QueryCrmPipelineRowsResponses, QueryDatabasesData, QueryDatabasesError, QueryDatabasesErrors, QueryDatabasesResponse, QueryDatabasesResponses, QueryDefinition, QuestionLayout, QuestionOption, QuestionTally, ReactionInput, RecentlyDeletedData, RecentlyDeletedError, RecentlyDeletedErrors, RecentlyDeletedResponse, RecentlyDeletedResponseData, RecentlyDeletedResponses, RegisterSlackImportUploadsData, RegisterSlackImportUploadsErrors, RegisterSlackImportUploadsResponse, RegisterSlackImportUploadsResponses, RegisterUploads, RemoveBotFromChannelByBotData, RemoveBotFromChannelByBotError, RemoveBotFromChannelByBotErrors, RemoveBotFromChannelByBotResponse, RemoveBotFromChannelByBotResponses, RemoveFavoriteByEntityData, RemoveFavoriteByEntityError, RemoveFavoriteByEntityErrors, RemoveFavoriteByEntityResponses, RemoveParticipantsData, RemoveParticipantsError, RemoveParticipantsErrors, RemoveParticipantsRequest, RemoveParticipantsResponses, RemovePinHandlerData, RemovePinHandlerError, RemovePinHandlerErrors, RemovePinHandlerResponse, RemovePinHandlerResponses, RenameChannelLabelData, RenameChannelLabelError, RenameChannelLabelErrors, RenameChannelLabelRequest, RenameChannelLabelResponse, RenameChannelLabelResponses, RenameCrmPipelineData, RenameCrmPipelineResponse, RenameCrmPipelineResponses, RenamePipeline, ReorderFavoritesData, ReorderFavoritesError, ReorderFavoritesErrors, ReorderFavoritesRequest, ReorderFavoritesResponses, ReorderPinRequest, ReorderPinsHandlerData, ReorderPinsHandlerError, ReorderPinsHandlerErrors, ReorderPinsHandlerResponse, ReorderPinsHandlerResponses, ReplaceCrmStagesRequest, RequestAccess, RequestedHarnessScope, RequestedLayout, RequestStatus, ResetCrmTeamStagesData, ResetCrmTeamStagesError, ResetCrmTeamStagesErrors, ResetCrmTeamStagesResponse, ResetCrmTeamStagesResponses, ResolveRequest, ResponseStatus, ResponseSummary, ResultColumn, ResultSet, RevertDeleteDocumentData, RevertDeleteDocumentError, RevertDeleteDocumentErrors, RevertDeleteDocumentResponse, RevertDeleteDocumentResponses, RevertDeleteProjectData, RevertDeleteProjectError, RevertDeleteProjectErrors, RevertDeleteProjectResponse, RevertDeleteProjectResponses, RingStatus, RingStatusResponse, RowChange, RowChangeKind, RowChanges, RowHistoryEntry, RowHistoryResponse, RowId, RowsChange, RowsResult, S3ObjectInfo, SaveBomPart, SaveDatabaseQueryData, SaveDatabaseQueryError, SaveDatabaseQueryErrors, SaveDatabaseQueryResponse, SaveDatabaseQueryResponses, SaveDocumentHandlerData, SaveDocumentHandlerError, SaveDocumentHandlerErrors, SaveDocumentHandlerResponse, SaveDocumentHandlerResponses, SaveDocumentRequest, SaveDocumentResponse, SaveDocumentResponseData, SavedQuery, SaveQueryRequest, SearchContactsData, SearchContactsError, SearchContactsErrors, SearchContactsResponse, SearchContactsResponse2, SearchContactsResponses, SearchState, SectionCount, SessionDeletedMetadata, SessionIdentity, SessionMentionedMetadata, SessionOpenedMetadata, SessionRenamedMetadata, SessionSettledMetadata, SessionStoppedMetadata, SetChannelLabelData, SetChannelLabelError, SetChannelLabelErrors, SetChannelLabelRequest, SetChannelLabelResponse, SetChannelLabelResponses, SetChannelPictureData, SetChannelPictureError, SetChannelPictureErrors, SetChannelPictureRequest, SetChannelPictureResponse, SetChannelPictureResponses, SetCompanyHiddenData, SetCompanyHiddenError, SetCompanyHiddenErrors, SetCompanyHiddenRequest, SetCompanyHiddenResponse, SetCompanyHiddenResponses, SetCompanyNameRequest, SetContactHiddenData, SetContactHiddenError, SetContactHiddenErrors, SetContactHiddenRequest, SetContactHiddenResponse, SetContactHiddenResponses, SetContactNameRequest, SetCrmCompanyNameData, SetCrmCompanyNameError, SetCrmCompanyNameErrors, SetCrmCompanyNameResponse, SetCrmCompanyNameResponses, SetCrmContactNameData, SetCrmContactNameError, SetCrmContactNameErrors, SetCrmContactNameResponse, SetCrmContactNameResponses, SetDirectAccess, SetDocumentTeamShareData, SetDocumentTeamShareError, SetDocumentTeamShareErrors, SetDocumentTeamShareRequest, SetDocumentTeamShareResponse, SetDocumentTeamShareResponses, SetEmailFollowupData, SetEmailFollowupError, SetEmailFollowupErrors, SetEmailFollowupResponse, SetEmailFollowupResponses, SetEmailSyncData, SetEmailSyncError, SetEmailSyncErrors, SetEmailSyncRequest, SetEmailSyncResponse, SetEmailSyncResponses, SetOperator, SetPropertyValue, Sha256Digest, ShareCrmPipelineData, ShareCrmPipelineResponse, ShareCrmPipelineResponses, ShareDatabaseAwarenessData, ShareDatabaseAwarenessError, ShareDatabaseAwarenessErrors, ShareDatabaseAwarenessResponse, ShareDatabaseAwarenessResponses, SharedEmailFilter, ShareEntity, ShareEntityType, SharePermissionV2, SharePipeline, ShortIdResponse, SimpleMention, SimpleSaveData, SimpleSaveError, SimpleSaveErrors, SimpleSaveResponse, SimpleSaveResponses, SkippedCell, SlackCompleteRequest, SlackCreateRequest, SlackRegisterRequest, SlackTimestamp, SlackUserId, SmartTagChannelMatch, SmartTagPreview, SortDirection, SortKey, SoupAgentSessionSoupPropertiesField, SoupApiItem, SoupApiSort, SoupApiSortDirection, SoupAttachment, SoupCalendarEventSoupPropertiesField, SoupCalendarEventTime, SoupCallRecordGuest, SoupCallRecordParticipant, SoupCallRecordSoupPropertiesField, SoupChannel, SoupChannelThread, SoupChatSoupPropertiesField, SoupContact, SoupCountedReaction, SoupCrmCompanySoupPropertiesField, SoupCrmContactSoupPropertiesField, SoupCrmDomain, SoupDatabaseRowSoupPropertiesField, SoupDocumentSoupPropertiesField, SoupDocumentSubType, SoupEmailThreadPreview, SoupEnrichedEmailThreadPreviewSoupPropertiesField, SoupForeignEntity, SoupInitiativeSoupPropertiesField, SoupItem, SoupLabel, SoupLabelListVisibility, SoupLabelType, SoupMessageAttachment, SoupMessageListVisibility, SoupMessageSender, SoupMessageSenderType, SoupPage, SoupProjectSoupPropertiesField, SoupPropertiesField, SoupProperty, SoupThreadInfo, SoupThreadReply, SourceBinding, SourceId, SourceIdentity, SqlCell, SqlEntityKind, SqlOutcome, SqlOutcomeKind, SqlSelectOption, SqlStatement, StarterDatabase, StarterDocumentsResponse, StorageRow, StorageRows, StorageRowsQuery, StoredGithubPullRequest, StreamEventsData, StreamEventsError, StreamEventsErrors, StreamEventsResponse, StreamEventsResponses, String, Submission, SubmissionOutcome, SubmitFormResponseData, SubmitFormResponseError, SubmitFormResponseErrors, SubmitFormResponseResponse, SubmitFormResponseResponses, SuccessResponse, SurfaceState, SyncServiceVersionId, SystemSkillSummary, Table, TableChange, TableChanged, TableChanges, TableDetail, TableId, TableResult, TableVersion, TagFilterMode, TakenId, TallyBucket, TallyValue, TaskFilters, TeamCalendarContent, TeamCalendarCoverage, TeamCalendarDetails, TeamCalendarItem, TeamCalendarMember, TeamCalendarPage, TeamCalendarSharing, TeamOutOfOfficeItem, TeamOutOfOfficeResponse, TeamRole, TextOperator, ThreadAnchor, ThreadOrigin, ThreadPatch, ThreadState, TimelineActivity, ToggleShareWithTeamData, ToggleShareWithTeamError, ToggleShareWithTeamErrors, ToggleShareWithTeamResponse, ToggleShareWithTeamResponses, TouchedColumn, TouchedRow, TranscribeDictationData, TranscribeDictationError, TranscribeDictationErrors, TranscribeDictationResponse, TranscribeDictationResponses, TranscribeResponse, TranscriptSegmentRequest, TrashCrmPipelineData, TrashCrmPipelineResponse, TrashCrmPipelineResponses, TrashPipeline, TurnEndedMetadata, TurnStartedMetadata, TurnSummary, TypedSuccessResponse, TypedSuccessResponseGetDocumentResponseData, TypingInput, UndoChangeResponse, UndoDatabaseChangeData, UndoDatabaseChangeError, UndoDatabaseChangeErrors, UndoDatabaseChangeResponse, UndoDatabaseChangeResponses, UndoOutcome, UndoRefusal, UnlockedBooking, UpdateAgentData, UpdateAgentError, UpdateAgentErrors, UpdateAgentRequest, UpdateAgentResponse, UpdateAgentResponses, UpdateChannelSharePermission, UpdateCrmPipelinePermissionsData, UpdateCrmPipelinePermissionsResponse, UpdateCrmPipelinePermissionsResponses, UpdateCrmTeamSettingsRequest, UpdateDatabasePermissionsData, UpdateDatabasePermissionsError, UpdateDatabasePermissionsErrors, UpdateDatabasePermissionsResponse, UpdateDatabasePermissionsResponses, UpdateForm, UpdateFormData, UpdateFormError, UpdateFormErrors, UpdateFormPermissionsData, UpdateFormPermissionsError, UpdateFormPermissionsErrors, UpdateFormPermissionsResponse, UpdateFormPermissionsResponses, UpdateFormResponse, UpdateFormResponses, UpdateInitiativeData, UpdateInitiativeError, UpdateInitiativeErrors, UpdateInitiativeRequest, UpdateInitiativeResponse, UpdateInitiativeResponses, UpdateMeetingRequest, UpdateOperation, UpdateSharePermissionRequestV2, UploadDescriptor, UploadDocumentStatus, UploadExtractFolderHandlerData, UploadExtractFolderHandlerError, UploadExtractFolderHandlerErrors, UploadExtractFolderHandlerResponse, UploadExtractFolderHandlerResponses, UploadExtractFolderRequest, UploadFolderHandlerData, UploadFolderHandlerError, UploadFolderHandlerErrors, UploadFolderHandlerResponse, UploadFolderHandlerResponses, UploadFolderRequest, UploadGrant, UploadId, UpsertHistoryHandlerData, UpsertHistoryHandlerError, UpsertHistoryHandlerErrors, UpsertHistoryHandlerResponse, UpsertHistoryHandlerResponses, UpsertUserDocumentViewLocationData, UpsertUserDocumentViewLocationError, UpsertUserDocumentViewLocationErrors, UpsertUserDocumentViewLocationRequest, UpsertUserDocumentViewLocationResponse, UpsertUserDocumentViewLocationResponses, UserApiKeyId, UserApiKeyInfo, UserApiKeysList, UserDocumentsResponse, UserDocumentViewLocation, UserDocumentViewLocationResponse, UserPinsResponse, UserViewsResponse, ValidateDocumentPermissionsTokenData, ValidateDocumentPermissionsTokenError, ValidateDocumentPermissionsTokenErrors, ValidateDocumentPermissionsTokenResponse, ValidateDocumentPermissionsTokenResponses, ValidateWebhookData, ValidateWebhookError, ValidateWebhookErrors, ValidateWebhookResponse, ValidateWebhookResponse2, ValidateWebhookResponses, Vec, VersionedTable, View, ViewChange, ViewColumn, ViewLayout, ViewPatch, ViewPosition, ViewPositionsResponse, ViewQuery, ViewResult, ViewsResponse, WaitingForInputMetadata, Webhook, WebhookEvent, WebhookFilter, WebhookScope, WebhookStatus, WebhookValidationTestEvent, Widget, WithCallId, WithChannelId, WithDocumentId, WithProjectId } from './types.gen';
diff --git a/packages/sdk/generated/storage/types.gen.ts b/packages/sdk/generated/storage/types.gen.ts
index b382366b10..5454a9b52c 100644
--- a/packages/sdk/generated/storage/types.gen.ts
+++ b/packages/sdk/generated/storage/types.gen.ts
@@ -2012,15 +2012,16 @@ export type CallRecord = {
*/
recordingUrl?: string | null;
/**
- * The RTC room name.
+ * The RTC room name. `None` for imported calls, which never had a room.
*/
- roomName: string;
+ roomName?: string | null;
/**
* Whether the call is shared with the creator's team. While the call is
* live this is the pending toggle applied at archive; afterwards it
* mirrors `team_share_access_level`.
*/
shareWithTeam: boolean;
+ source?: null | CallRecordSource;
/**
* When the call started (created_at for active, started_at for archived).
*/
@@ -2129,6 +2130,20 @@ export type CallRecordPreviewData = {
startedAt: string;
};
+/**
+ * Where an imported call came from.
+ */
+export type CallRecordSource = {
+ /**
+ * Link to the call in the provider's app, if it has one.
+ */
+ externalUrl?: string | null;
+ /**
+ * Provider slug, e.g. `granola`.
+ */
+ provider: string;
+};
+
/**
* A transcript segment as returned in a [`CallRecord`].
*/
diff --git a/packages/sdk/specs/storage.json b/packages/sdk/specs/storage.json
index 0f1b56dbfd..0f95aa2822 100644
--- a/packages/sdk/specs/storage.json
+++ b/packages/sdk/specs/storage.json
@@ -21349,7 +21349,6 @@
"description": "Full record of a call, unifying rows from `calls` (active) and\n`call_records` (archived) into a single response shape.",
"required": [
"callId",
- "roomName",
"createdBy",
"startedAt",
"shareWithTeam",
@@ -21427,13 +21426,24 @@
"description": "Presigned URL for the call recording, if available."
},
"roomName": {
- "type": "string",
- "description": "The RTC room name."
+ "type": ["string", "null"],
+ "description": "The RTC room name. `None` for imported calls, which never had a room."
},
"shareWithTeam": {
"type": "boolean",
"description": "Whether the call is shared with the creator's team. While the call is\nlive this is the pending toggle applied at archive; afterwards it\nmirrors `team_share_access_level`."
},
+ "source": {
+ "oneOf": [
+ {
+ "type": "null"
+ },
+ {
+ "$ref": "#/components/schemas/CallRecordSource",
+ "description": "External provenance for calls imported from another provider; `None`\nfor calls recorded in Macro."
+ }
+ ]
+ },
"startedAt": {
"type": "string",
"format": "date-time",
@@ -21613,6 +21623,21 @@
}
}
},
+ "CallRecordSource": {
+ "type": "object",
+ "description": "Where an imported call came from.",
+ "required": ["provider"],
+ "properties": {
+ "externalUrl": {
+ "type": ["string", "null"],
+ "description": "Link to the call in the provider's app, if it has one."
+ },
+ "provider": {
+ "type": "string",
+ "description": "Provider slug, e.g. `granola`."
+ }
+ }
+ },
"CallRecordTranscriptSegment": {
"type": "object",
"description": "A transcript segment as returned in a [`CallRecord`].",
diff --git a/services/document_cognition_service/Cargo.toml b/services/document_cognition_service/Cargo.toml
index e79c2b3354..258a746ac9 100644
--- a/services/document_cognition_service/Cargo.toml
+++ b/services/document_cognition_service/Cargo.toml
@@ -44,7 +44,7 @@ aws-sdk-s3 = { workspace = true }
aws-sdk-secretsmanager = { workspace = true }
aws-sdk-sqs = { workspace = true }
axum = { workspace = true, features = ["tower-log", "ws"] }
-call = { path = "../../crates/call", default-features = false, features = ["ports"] }
+call = { path = "../../crates/call", default-features = false, features = ["ports", "outbound"] }
chat = { path = "../../crates/chat", features = ["attachment"] }
channels = { path = "../../crates/channels", features = ["outbound", "attachment"] }
chrono = { workspace = true }
@@ -101,6 +101,7 @@ jev = { path = "../../crates/jev", features = ["decisions", "outbound"] }
mcp_client = { path = "../../crates/mcp_client" }
mcp_select = { path = "../../crates/mcp_select" }
pipedream_mcp = { path = "../../crates/pipedream_mcp" }
+granola_sync = { path = "../../crates/granola_sync" }
model-error-response = { path = "../../crates/model-error-response" }
memory = { path = "../../crates/memory" }
onboarding = { path = "../../crates/onboarding" }
diff --git a/services/document_cognition_service/src/api.rs b/services/document_cognition_service/src/api.rs
index f57a311947..2047cf92ed 100644
--- a/services/document_cognition_service/src/api.rs
+++ b/services/document_cognition_service/src/api.rs
@@ -165,7 +165,10 @@ fn api_router(api_context: ApiContext) -> Router {
let app = Router::new()
.nest("/{version}", internal_router.clone())
.merge(internal_router)
- .merge(mcp_client::inbound::mcp_oauth_callback_router(mcp_state));
+ .merge(mcp_client::inbound::mcp_oauth_callback_router(mcp_state))
+ .merge(granola_sync::inbound::webhook_router(
+ api_context.granola_sync.clone(),
+ ));
match api_context.config.pipedream_webhook_secret.value() {
Some(secret) => app.merge(pipedream_mcp::inbound::pipedream_webhook_router(
diff --git a/services/document_cognition_service/src/api/context.rs b/services/document_cognition_service/src/api/context.rs
index d9e8ae8550..2b2f8612bc 100644
--- a/services/document_cognition_service/src/api/context.rs
+++ b/services/document_cognition_service/src/api/context.rs
@@ -180,6 +180,7 @@ pub struct ApiContext {
pub ai_stream_registry: AiStreamRegistry,
pub mcp_state: DcsMcpRouterState,
pub pipedream_state: DcsPipedreamRouterState,
+ pub granola_sync: Option<Arc<dyn granola_sync::domain::service::SyncService>>,
/// Selects which MCP stack (Pipedream vs native) serves a user's tools.
pub mcp_selector: Arc<ai_tools::ToolMcpSelector>,
pub import_service: Arc<DcsImportService>,
diff --git a/services/document_cognition_service/src/api/context/test.rs b/services/document_cognition_service/src/api/context/test.rs
index 9cb1dcc153..8381265d09 100644
--- a/services/document_cognition_service/src/api/context/test.rs
+++ b/services/document_cognition_service/src/api/context/test.rs
@@ -795,6 +795,7 @@ pub async fn test_api_context(pool: sqlx::Pool<sqlx::Postgres>) -> std::sync::Ar
ai_stream_registry: crate::service::ai_stream_registry::AiStreamRegistry::new(Arc::new(
redis::Client::open("redis://127.0.0.1:6379/").expect("valid redis url"),
)),
+ granola_sync: None,
pipedream_state: pipedream_mcp::inbound::PipedreamRouterState::new(
pipedream_mcp::outbound::pg_connection_repo::PgConnectionRepo::new(pool.clone()),
None,
diff --git a/services/document_cognition_service/src/server.rs b/services/document_cognition_service/src/server.rs
index d90e70c8e4..ce309f06c3 100644
--- a/services/document_cognition_service/src/server.rs
+++ b/services/document_cognition_service/src/server.rs
@@ -564,6 +564,7 @@ pub async fn run() -> anyhow::Result<()> {
config.mcp_credentials_key_secret_name.as_ref(),
)
.context("invalid MCP credentials encryption key")?;
+ let granola_signing_key = *mcp_encryption_key.as_bytes();
let mcp_server_repo =
mcp_client::outbound::pg_server_repo::PgServerRepo::new(db.clone(), mcp_encryption_key);
@@ -644,6 +645,29 @@ pub async fn run() -> anyhow::Result<()> {
};
let pipedream_repo =
pipedream_mcp::outbound::pg_connection_repo::PgConnectionRepo::new(db.clone());
+ let granola_sync: Option<Arc<dyn granola_sync::domain::service::SyncService>> =
+ pipedream_client.as_ref().map(|client| {
+ Arc::new(granola_sync::domain::service::Service {
+ repo: granola_sync::outbound::pg_repo::PgSyncRepository::new(
+ db.clone(),
+ &granola_signing_key,
+ ),
+ granola: granola_sync::outbound::api::GranolaApi(client.clone()),
+ accounts: granola_sync::outbound::accounts::ConnectedAccounts(
+ pipedream_repo.clone(),
+ ),
+ verifier: granola_sync::outbound::signature::StandardWebhooks,
+ calls: Arc::new(call::domain::imports::CallImportServiceImpl(
+ call::outbound::pg_imported_call_repo::PgImportedCallRepository::new(
+ db.clone(),
+ ),
+ )),
+ public_url: config.mcp_public_url.clone(),
+ }) as Arc<dyn granola_sync::domain::service::SyncService>
+ });
+ let granola_worker = granola_sync
+ .as_ref()
+ .map(|service| tokio::spawn(granola_sync::inbound::run_worker(service.clone())));
// The one sanctioned meeting point of the two MCP stacks: agents load
// tools through this selector, which prefers a user's Pipedream
@@ -1021,6 +1045,7 @@ pub async fn run() -> anyhow::Result<()> {
),
mcp_state,
pipedream_state,
+ granola_sync,
mcp_selector,
import_service,
onboarding_service,
@@ -1030,6 +1055,10 @@ pub async fn run() -> anyhow::Result<()> {
.context("failed to setup and serve api");
ai_projection_worker_task.abort();
+ if let Some(worker) = granola_worker {
+ worker.abort();
+ let _ = worker.await;
+ }
match ai_projection_worker_task.await {
Err(error) if error.is_cancelled() => {
tracing::info!("ai projection worker stopped");
diff --git a/services/scheduled_action/src/outbound/event_content/routine_event/test.rs b/services/scheduled_action/src/outbound/event_content/routine_event/test.rs
index f87bc4a170..4997f27231 100644
--- a/services/scheduled_action/src/outbound/event_content/routine_event/test.rs
+++ b/services/scheduled_action/src/outbound/event_content/routine_event/test.rs
@@ -72,7 +72,7 @@ fn ended_call(transcript: Vec<CallRecordTranscriptSegment>) -> CallRecord {
CallRecord {
call_id: Uuid::parse_str(CALL_ID).unwrap(),
channel_id: Some(Uuid::parse_str("01928f3e-6a2b-7c3d-8e4f-0000000c4a77").unwrap()),
- room_name: "room".into(),
+ room_name: Some("room".into()),
created_by: "macro|[email protected]".into(),
started_at: at(0),
ended_at: Some(at(30)),
@@ -99,6 +99,7 @@ fn ended_call(transcript: Vec<CallRecordTranscriptSegment>) -> CallRecord {
}],
guests: Vec::new(),
transcript,
+ source: None,
}
}
diff --git a/services/scheduled_action/src/outbound/event_content/test.rs b/services/scheduled_action/src/outbound/event_content/test.rs
index 1f74f514a2..0d59787e61 100644
--- a/services/scheduled_action/src/outbound/event_content/test.rs
+++ b/services/scheduled_action/src/outbound/event_content/test.rs
@@ -231,7 +231,7 @@ fn calls_show_who_joined_and_what_they_said() {
let record = CallRecord {
call_id: Uuid::nil(),
channel_id: None,
- room_name: "room".into(),
+ room_name: Some("room".into()),
created_by: "macro|[email protected]".into(),
started_at: at,
ended_at: Some(at + chrono::Duration::minutes(30)),
@@ -267,6 +267,7 @@ fn calls_show_who_joined_and_what_they_said() {
ended_at: None,
sequence_num: 0,
}],
+ source: None,
};
let event = event("call.ended", None);