Skip to content

The open alternative to Salesforce, designed for AI.

[2/4] Desktop Recorder: add the installable Twenty integration (#25633)

Thomas des Francsbfabaa16a31f
diff --git a/packages/twenty-apps/public/companion/.gitignore b/packages/twenty-apps/public/companion/.gitignore
new file mode 100644
index 00000000000..9fc1d5c3242
--- /dev/null
+++ b/packages/twenty-apps/public/companion/.gitignore
@@ -0,0 +1,43 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+/.pnp
+.pnp.*
+.yarn/*
+!.yarn/patches
+!.yarn/plugins
+!.yarn/releases
+!.yarn/sdks
+!.yarn/versions
+
+# codegen
+generated
+
+# testing
+/coverage
+
+# dev
+/dist/
+
+.twenty
+
+# production
+/build
+
+# misc
+.DS_Store
+*.pem
+
+# debug
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+.pnpm-debug.log*
+
+# env files (can opt-in for committing if needed)
+.env*
+
+# typescript
+*.tsbuildinfo
+*.d.ts
diff --git a/packages/twenty-apps/public/companion/.nvmrc b/packages/twenty-apps/public/companion/.nvmrc
new file mode 100644
index 00000000000..341cb50613a
--- /dev/null
+++ b/packages/twenty-apps/public/companion/.nvmrc
@@ -0,0 +1 @@
+24.5.0
diff --git a/packages/twenty-apps/public/companion/.oxlintrc.json b/packages/twenty-apps/public/companion/.oxlintrc.json
new file mode 100644
index 00000000000..1c1f8059642
--- /dev/null
+++ b/packages/twenty-apps/public/companion/.oxlintrc.json
@@ -0,0 +1,38 @@
+{
+ "$schema": "./node_modules/oxlint/configuration_schema.json",
+ "plugins": ["typescript"],
+ "categories": {
+ "correctness": "off"
+ },
+ "ignorePatterns": ["node_modules", "dist"],
+ "rules": {
+ "no-unused-vars": "off",
+
+ "typescript/no-unused-vars": [
+ "warn",
+ {
+ "argsIgnorePattern": "^_",
+ "ignoreRestSiblings": true
+ }
+ ],
+ "typescript/no-explicit-any": "off"
+ },
+ "overrides": [
+ {
+ "files": ["**/*.logic-function.ts", "**/logic-functions/**/*.ts"],
+ "rules": {
+ "no-restricted-imports": [
+ "error",
+ {
+ "patterns": [
+ {
+ "group": ["twenty-shared", "twenty-shared/*"],
+ "message": "Logic functions must not import from twenty-shared directly. Import runtime types and helpers from `twenty-sdk/logic-function` instead so the logic-function bundle stays minimal."
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/packages/twenty-apps/public/companion/.yarnrc.yml b/packages/twenty-apps/public/companion/.yarnrc.yml
new file mode 100644
index 00000000000..3186f3f0795
--- /dev/null
+++ b/packages/twenty-apps/public/companion/.yarnrc.yml
@@ -0,0 +1 @@
+nodeLinker: node-modules
diff --git a/packages/twenty-apps/public/companion/AGENTS.md b/packages/twenty-apps/public/companion/AGENTS.md
new file mode 100644
index 00000000000..7629e26d549
--- /dev/null
+++ b/packages/twenty-apps/public/companion/AGENTS.md
@@ -0,0 +1,70 @@
+## Base documentation
+
+- Getting started:
+ - https://docs.twenty.com/developers/extend/apps/getting-started/quick-start.md
+ - https://docs.twenty.com/developers/extend/apps/getting-started/concepts.md
+ - https://docs.twenty.com/developers/extend/apps/getting-started/project-structure.md
+ - https://docs.twenty.com/developers/extend/apps/getting-started/local-server.md
+ - https://docs.twenty.com/developers/extend/apps/getting-started/scaffolding.md
+ - https://docs.twenty.com/developers/extend/apps/getting-started/troubleshooting.md
+- Config:
+ - https://docs.twenty.com/developers/extend/apps/config/overview.md
+ - https://docs.twenty.com/developers/extend/apps/config/application.md
+ - https://docs.twenty.com/developers/extend/apps/config/roles.md
+ - https://docs.twenty.com/developers/extend/apps/config/install-hooks.md
+ - https://docs.twenty.com/developers/extend/apps/config/public-assets.md
+- Data:
+ - https://docs.twenty.com/developers/extend/apps/data/overview.md
+ - https://docs.twenty.com/developers/extend/apps/data/objects.md
+ - https://docs.twenty.com/developers/extend/apps/data/extending-objects.md
+ - https://docs.twenty.com/developers/extend/apps/data/relations.md
+- Logic:
+ - https://docs.twenty.com/developers/extend/apps/logic/overview.md
+ - https://docs.twenty.com/developers/extend/apps/logic/logic-functions.md
+ - https://docs.twenty.com/developers/extend/apps/logic/skills-and-agents.md
+ - https://docs.twenty.com/developers/extend/apps/logic/connections.md
+- Layout:
+ - https://docs.twenty.com/developers/extend/apps/layout/overview.md
+ - https://docs.twenty.com/developers/extend/apps/layout/views.md
+ - https://docs.twenty.com/developers/extend/apps/layout/navigation-menu-items.md
+ - https://docs.twenty.com/developers/extend/apps/layout/page-layouts.md
+ - https://docs.twenty.com/developers/extend/apps/layout/front-components.md
+ - https://docs.twenty.com/developers/extend/apps/layout/command-menu-items.md
+- Operations:
+ - https://docs.twenty.com/developers/extend/apps/operations/overview.md
+ - https://docs.twenty.com/developers/extend/apps/operations/cli.md
+ - https://docs.twenty.com/developers/extend/apps/operations/testing.md
+ - https://docs.twenty.com/developers/extend/apps/operations/publishing.md
+- Rich app example: https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/examples/postcard
+
+## UUID requirement
+
+- All generated UUIDs must be valid UUID v4.
+
+## Common Pitfalls
+
+- Creating a view without a navigationMenuItem associated. This will make the view available on the left sidebar.
+- Creating a front-end component that has a scroll instead of being responsive to its fixed widget height and width, unless it is specifically meant to be used in a canvas tab.
+
+## Best practice
+
+It's highly recommended to create new app entities using `yarn twenty dev:add`. These are the options:
+
+| Entity type | Command | Generated file |
+| -------------------- | ---------------------------------------- | ------------------------------------- |
+| Object | `yarn twenty dev:add object` | `src/objects/<name>.ts` |
+| Field | `yarn twenty dev:add field` | `src/fields/<name>.ts` |
+| Logic function | `yarn twenty dev:add logicFunction` | `src/logic-functions/<name>.ts` |
+| Front component | `yarn twenty dev:add frontComponent` | `src/front-components/<name>.tsx` |
+| Role | `yarn twenty dev:add role` | `src/roles/<name>.ts` |
+| Skill | `yarn twenty dev:add skill` | `src/skills/<name>.ts` |
+| Agent | `yarn twenty dev:add agent` | `src/agents/<name>.ts` |
+| View | `yarn twenty dev:add view` | `src/views/<name>.ts` |
+| Navigation menu item | `yarn twenty dev:add navigationMenuItem` | `src/navigation-menu-items/<name>.ts` |
+| Page layout | `yarn twenty dev:add pageLayout` | `src/page-layouts/<name>.ts` |
+| Page layout tab | `yarn twenty dev:add pageLayoutTab` | `src/page-layout-tabs/<name>.ts` |
+| Command menu item | `yarn twenty dev:add commandMenuItem` | `src/command-menu-items/<name>.ts` |
+| View field | `yarn twenty dev:add viewField` | `src/view-fields/<name>.ts` |
+| Connection provider | `yarn twenty dev:add connectionProvider` | `src/connection-providers/<name>.ts` |
+
+This helps automatically generate required IDs etc.
diff --git a/packages/twenty-apps/public/companion/CHANGELOG.md b/packages/twenty-apps/public/companion/CHANGELOG.md
new file mode 100644
index 00000000000..c3fadd832b3
--- /dev/null
+++ b/packages/twenty-apps/public/companion/CHANGELOG.md
@@ -0,0 +1,9 @@
+# Changelog
+
+All notable changes to this application are documented in this file.
+
+## 0.1.0
+
+- Independent desktop agenda, Recall upload provisioning, signed webhook processing, audio/transcript import, recovery, and AI summaries.
+- Separate application identity, ownership fields, agent, configuration, and credentials.
+- One-time migration of completed legacy desktop recording history.
diff --git a/packages/twenty-apps/public/companion/CLAUDE.md b/packages/twenty-apps/public/companion/CLAUDE.md
new file mode 100644
index 00000000000..7629e26d549
--- /dev/null
+++ b/packages/twenty-apps/public/companion/CLAUDE.md
@@ -0,0 +1,70 @@
+## Base documentation
+
+- Getting started:
+ - https://docs.twenty.com/developers/extend/apps/getting-started/quick-start.md
+ - https://docs.twenty.com/developers/extend/apps/getting-started/concepts.md
+ - https://docs.twenty.com/developers/extend/apps/getting-started/project-structure.md
+ - https://docs.twenty.com/developers/extend/apps/getting-started/local-server.md
+ - https://docs.twenty.com/developers/extend/apps/getting-started/scaffolding.md
+ - https://docs.twenty.com/developers/extend/apps/getting-started/troubleshooting.md
+- Config:
+ - https://docs.twenty.com/developers/extend/apps/config/overview.md
+ - https://docs.twenty.com/developers/extend/apps/config/application.md
+ - https://docs.twenty.com/developers/extend/apps/config/roles.md
+ - https://docs.twenty.com/developers/extend/apps/config/install-hooks.md
+ - https://docs.twenty.com/developers/extend/apps/config/public-assets.md
+- Data:
+ - https://docs.twenty.com/developers/extend/apps/data/overview.md
+ - https://docs.twenty.com/developers/extend/apps/data/objects.md
+ - https://docs.twenty.com/developers/extend/apps/data/extending-objects.md
+ - https://docs.twenty.com/developers/extend/apps/data/relations.md
+- Logic:
+ - https://docs.twenty.com/developers/extend/apps/logic/overview.md
+ - https://docs.twenty.com/developers/extend/apps/logic/logic-functions.md
+ - https://docs.twenty.com/developers/extend/apps/logic/skills-and-agents.md
+ - https://docs.twenty.com/developers/extend/apps/logic/connections.md
+- Layout:
+ - https://docs.twenty.com/developers/extend/apps/layout/overview.md
+ - https://docs.twenty.com/developers/extend/apps/layout/views.md
+ - https://docs.twenty.com/developers/extend/apps/layout/navigation-menu-items.md
+ - https://docs.twenty.com/developers/extend/apps/layout/page-layouts.md
+ - https://docs.twenty.com/developers/extend/apps/layout/front-components.md
+ - https://docs.twenty.com/developers/extend/apps/layout/command-menu-items.md
+- Operations:
+ - https://docs.twenty.com/developers/extend/apps/operations/overview.md
+ - https://docs.twenty.com/developers/extend/apps/operations/cli.md
+ - https://docs.twenty.com/developers/extend/apps/operations/testing.md
+ - https://docs.twenty.com/developers/extend/apps/operations/publishing.md
+- Rich app example: https://github.com/twentyhq/twenty/tree/main/packages/twenty-apps/examples/postcard
+
+## UUID requirement
+
+- All generated UUIDs must be valid UUID v4.
+
+## Common Pitfalls
+
+- Creating a view without a navigationMenuItem associated. This will make the view available on the left sidebar.
+- Creating a front-end component that has a scroll instead of being responsive to its fixed widget height and width, unless it is specifically meant to be used in a canvas tab.
+
+## Best practice
+
+It's highly recommended to create new app entities using `yarn twenty dev:add`. These are the options:
+
+| Entity type | Command | Generated file |
+| -------------------- | ---------------------------------------- | ------------------------------------- |
+| Object | `yarn twenty dev:add object` | `src/objects/<name>.ts` |
+| Field | `yarn twenty dev:add field` | `src/fields/<name>.ts` |
+| Logic function | `yarn twenty dev:add logicFunction` | `src/logic-functions/<name>.ts` |
+| Front component | `yarn twenty dev:add frontComponent` | `src/front-components/<name>.tsx` |
+| Role | `yarn twenty dev:add role` | `src/roles/<name>.ts` |
+| Skill | `yarn twenty dev:add skill` | `src/skills/<name>.ts` |
+| Agent | `yarn twenty dev:add agent` | `src/agents/<name>.ts` |
+| View | `yarn twenty dev:add view` | `src/views/<name>.ts` |
+| Navigation menu item | `yarn twenty dev:add navigationMenuItem` | `src/navigation-menu-items/<name>.ts` |
+| Page layout | `yarn twenty dev:add pageLayout` | `src/page-layouts/<name>.ts` |
+| Page layout tab | `yarn twenty dev:add pageLayoutTab` | `src/page-layout-tabs/<name>.ts` |
+| Command menu item | `yarn twenty dev:add commandMenuItem` | `src/command-menu-items/<name>.ts` |
+| View field | `yarn twenty dev:add viewField` | `src/view-fields/<name>.ts` |
+| Connection provider | `yarn twenty dev:add connectionProvider` | `src/connection-providers/<name>.ts` |
+
+This helps automatically generate required IDs etc.
diff --git a/packages/twenty-apps/public/companion/README.md b/packages/twenty-apps/public/companion/README.md
new file mode 100644
index 00000000000..35b840f4fcd
--- /dev/null
+++ b/packages/twenty-apps/public/companion/README.md
@@ -0,0 +1,37 @@
+# Desktop Recorder integration
+
+The independent Twenty backend for the [Twenty desktop app](../../../twenty-companion/README.md). It provides personal calendars, audio upload provisioning, transcripts, summaries, and recording recovery. Call Recorder is not required.
+
+## Responsibilities
+
+```text
+Twenty desktop → Twenty OAuth + /companion/desktop
+ → Recall Desktop SDK (temporary upload token)
+Recall webhook → Desktop Recorder importer → standard CallRecording
+ → Desktop Recorder summarizer → Twenty AI
+Desktop Recorder maintenance → recover missed upload completion events
+```
+
+The integration has its own application registration, default role, custom fields, logic functions, summarizer agent, application settings, Recall credentials, and webhook endpoint. It shares Twenty's standard calendar, people, and Call Recording objects with the rest of the CRM.
+
+Desktop requests run as the signed-in user. Processing jobs only accept recordings with a valid `companionSession`; webhook events additionally require Recall metadata `twentyRecordingSource: companion`. An installed calendar bot can coexist: Desktop Recorder checks standard scheduled/active recording state to avoid recording that event twice. It does not read Call Recorder's custom fields or invoke its functions.
+
+The desktop uses the existing CLI OAuth client and PKCE flow from `twenty remote:add`. After sign-in it checks whether the Desktop Recorder backend is available and offers installation if needed. The app's Settings tab provides the macOS download and configuration without a dedicated page in Twenty core.
+
+## Recording processing and credits
+
+The backend provisions audio-only Recall uploads, imports audio and transcripts into Twenty, and runs its own summarizer when `COMPANION_SUMMARY_ENABLED` is enabled. Summaries use Twenty AI. Recording charges use the existing `chargeCredits` API from `twenty-sdk/billing`, with the same duration-based rate as Call Recorder. Recall processing uses the configured Recall account.
+
+A conditional status update ensures only the worker completing a recording submits its charge. Completed recordings are not charged again by webhook or recovery replays. As with the existing Call Recorder path, an ambiguous charge failure is not automatically retried. This integration adds no billing endpoint, pricing policy, receipt table, or usage-accounting migration.
+
+Transcript updates enqueue summary generation with a stable job ID per recording. The existing queue deduplicates jobs, and the existing KV store caches results before writing the recording summary so retries reuse them. A running marker preserves uncertain paid attempts after interruption. Maintenance saves cached summaries without generating new ones or replacing an existing summary. Persistent cache-write failures are reported after bounded retries.
+
+The integration uses existing CLI OAuth, queue job IDs, and KV get/set operations. No changes to core billing, queue, or application-state APIs are required.
+
+## Development
+
+Use Node 24 and Yarn 4. Run `yarn install`, `yarn typecheck`, `yarn test:unit`, and `yarn lint` from this directory. Installation, Recall configuration, and migration instructions are in [SETUP.md](SETUP.md).
+
+Integration tests use `yarn test` with explicit `TWENTY_API_URL` and `TWENTY_API_KEY` environment variables. They read an already installed application and never install, uninstall, or reset it.
+
+No deployment credentials or provider keys belong in this package.
diff --git a/packages/twenty-apps/public/companion/SETUP.md b/packages/twenty-apps/public/companion/SETUP.md
new file mode 100644
index 00000000000..257feedd8b8
--- /dev/null
+++ b/packages/twenty-apps/public/companion/SETUP.md
@@ -0,0 +1,16 @@
+# Workspace setup
+
+1. Install dependencies with Node 24 and Yarn 4: `yarn install`.
+2. Publish `@twentyhq/companion-app`, let the server sync its catalog, and install Desktop Recorder from Settings → Applications. Desktop sign-in uses the existing CLI OAuth client; no dedicated OAuth registration is needed.
+3. As a server administrator, configure this application's registration variables: `RECALL_API_KEY`, `RECALL_WEBHOOK_SECRET`, and `RECALL_REGION` (default `eu-central-1`). The registration must belong to the workspace hosting its server webhook resolver.
+4. Create a separate Recall webhook endpoint pointing to `<public-server-url>/webhooks/server/2f955a7f-9d03-44c6-bb12-fbc8f6e33b07`. Subscribe to `sdk_upload.recording_started`, `sdk_upload.recording_ended`, `sdk_upload.complete`, `sdk_upload.failed`, `recording.done`, `recording.failed`, `transcript.done`, and `transcript.failed`. Use its applicable Recall signing secret. Keep existing Call Recorder webhook endpoints separate.
+5. Open the installed app's Settings tab. Configure its published macOS download URL, AI summaries, transcript provider, and optional additional summary instructions. AI must be configured in Twenty for summaries; Gladia requires its provider key in Recall.
+6. Download Twenty from that Settings tab and sign in to the same workspace. It discovers the function domain and calls authenticated `POST /companion/desktop`. Sign-in requires user permissions for calendars and recordings; an application-only API key cannot use that endpoint.
+
+Application universal identifier: `8bdaaa9f-dc53-4247-a89b-aa386c9b3244`.
+
+## Local verification
+
+Use a local Twenty instance supporting CLI OAuth and queue job IDs. Verify installation, per-user sign-in, settings, and recording recovery before publishing a release.
+
+A temporary public tunnel is required for Recall callbacks to localhost. When its URL changes, update the dedicated Companion Recall endpoint. Keep the tunnel and Docker running while processing recordings, and retire the local endpoint when testing ends.
diff --git a/packages/twenty-apps/public/companion/package.json b/packages/twenty-apps/public/companion/package.json
new file mode 100644
index 00000000000..8518f18ae9f
--- /dev/null
+++ b/packages/twenty-apps/public/companion/package.json
@@ -0,0 +1,40 @@
+{
+ "name": "@twentyhq/companion-app",
+ "version": "0.1.0",
+ "license": "MIT",
+ "engines": {
+ "node": "^24.5.0",
+ "npm": "please-use-yarn",
+ "yarn": ">=4.0.2"
+ },
+ "keywords": [
+ "twenty-app"
+ ],
+ "packageManager": "[email protected]",
+ "scripts": {
+ "twenty": "twenty",
+ "lint": "oxlint -c .oxlintrc.json .",
+ "lint:fix": "oxlint --fix -c .oxlintrc.json .",
+ "typecheck": "tsgo --noEmit -p tsconfig.spec.json",
+ "test": "vitest run",
+ "test:watch": "vitest",
+ "test:unit": "vitest run --config vitest.unit.config.ts"
+ },
+ "devDependencies": {
+ "@types/node": "^24.7.2",
+ "@types/react": "^19.0.0",
+ "@typescript/native-preview": "^7.0.0-dev.20260116.1",
+ "oxlint": "^0.16.0",
+ "react": "^19.0.0",
+ "react-dom": "^19.0.0",
+ "twenty-client-sdk": "2.39.0",
+ "twenty-sdk": "2.39.0",
+ "twenty-ui": "1.0.0-alpha.1",
+ "typescript": "^5.9.3",
+ "vite-tsconfig-paths": "^4.2.1",
+ "vitest": "^4.0.0"
+ },
+ "dependencies": {
+ "@sniptt/guards": "^0.2.0"
+ }
+}
diff --git a/packages/twenty-apps/public/companion/public/logo.svg b/packages/twenty-apps/public/companion/public/logo.svg
new file mode 100644
index 00000000000..bb5819bc266
--- /dev/null
+++ b/packages/twenty-apps/public/companion/public/logo.svg
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="96px" height="96px" viewBox="0 0 96 96" version="1.1">
+<defs>
+<clipPath id="clip1">
+ <path d="M 11.292969 0 L 84.707031 0 C 90.945312 0 96 5.054688 96 11.292969 L 96 84.707031 C 96 90.945312 90.945312 96 84.707031 96 L 11.292969 96 C 5.054688 96 0 90.945312 0 84.707031 L 0 11.292969 C 0 5.054688 5.054688 0 11.292969 0 Z M 11.292969 0 "/>
+</clipPath>
+<clipPath id="clip2">
+ <path d="M 19 26 L 48 26 L 48 45 L 19 45 Z M 19 26 "/>
+</clipPath>
+<clipPath id="clip3">
+ <path d="M 11.292969 0 L 84.707031 0 C 90.945312 0 96 5.054688 96 11.292969 L 96 84.707031 C 96 90.945312 90.945312 96 84.707031 96 L 11.292969 96 C 5.054688 96 0 90.945312 0 84.707031 L 0 11.292969 C 0 5.054688 5.054688 0 11.292969 0 Z M 11.292969 0 "/>
+</clipPath>
+<clipPath id="clip4">
+ <path d="M 19 26 L 77 26 L 77 70 L 19 70 Z M 19 26 "/>
+</clipPath>
+<clipPath id="clip5">
+ <path d="M 11.292969 0 L 84.707031 0 C 90.945312 0 96 5.054688 96 11.292969 L 96 84.707031 C 96 90.945312 90.945312 96 84.707031 96 L 11.292969 96 C 5.054688 96 0 90.945312 0 84.707031 L 0 11.292969 C 0 5.054688 5.054688 0 11.292969 0 Z M 11.292969 0 "/>
+</clipPath>
+</defs>
+<g id="surface1">
+<g clip-path="url(#clip1)" clip-rule="nonzero">
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(0%,0%,0%);fill-opacity:1;" d="M 96 0 L 0 0 L 0 96 L 96 96 Z M 19.25 35.746094 C 19.25 30.5 23.507812 26.246094 28.75 26.246094 L 47.039062 26.246094 C 47.308594 26.246094 47.554688 26.40625 47.667969 26.652344 C 47.78125 26.902344 47.730469 27.191406 47.546875 27.394531 L 43.539062 31.75 C 42.839844 32.507812 41.859375 32.945312 40.828125 32.945312 L 28.800781 32.945312 C 27.226562 32.945312 25.949219 34.222656 25.949219 35.796875 L 25.949219 42.980469 C 25.949219 43.90625 25.199219 44.652344 24.273438 44.652344 L 20.929688 44.652344 C 20.003906 44.652344 19.257812 43.90625 19.257812 42.980469 L 19.257812 35.746094 Z M 76.152344 60.253906 C 76.152344 65.5 71.894531 69.753906 66.648438 69.753906 L 58.878906 69.753906 C 53.632812 69.753906 49.375 65.5 49.375 60.253906 L 49.375 46.652344 C 49.375 45.726562 49.722656 44.835938 50.351562 44.152344 L 54.882812 39.234375 C 55.074219 39.027344 55.371094 38.957031 55.636719 39.054688 C 55.898438 39.164062 56.074219 39.410156 56.074219 39.691406 L 56.074219 60.210938 C 56.074219 61.785156 57.351562 63.0625 58.925781 63.0625 L 66.605469 63.0625 C 68.179688 63.0625 69.457031 61.785156 69.457031 60.210938 L 69.457031 35.796875 C 69.457031 34.222656 68.179688 32.945312 66.605469 32.945312 L 57.675781 32.945312 C 56.652344 32.945312 55.679688 33.375 54.980469 34.121094 L 28.347656 63.0625 L 44.351562 63.0625 C 45.273438 63.0625 46.023438 63.8125 46.023438 64.738281 L 46.023438 68.082031 C 46.023438 69.007812 45.273438 69.753906 44.351562 69.753906 L 22.785156 69.753906 C 20.832031 69.753906 19.242188 68.167969 19.242188 66.210938 L 19.242188 64.441406 C 19.242188 63.550781 19.574219 62.695312 20.179688 62.039062 L 50.039062 29.605469 C 52.015625 27.457031 54.789062 26.246094 57.707031 26.246094 L 66.640625 26.246094 C 71.886719 26.246094 76.144531 30.5 76.144531 35.746094 L 76.144531 60.253906 Z M 76.152344 60.253906 "/>
+</g>
+<g clip-path="url(#clip2)" clip-rule="nonzero">
+<g clip-path="url(#clip3)" clip-rule="nonzero">
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 19.25 35.746094 C 19.25 30.5 23.507812 26.246094 28.75 26.246094 L 47.039062 26.246094 C 47.308594 26.246094 47.554688 26.40625 47.667969 26.652344 C 47.78125 26.902344 47.730469 27.191406 47.546875 27.394531 L 43.539062 31.75 C 42.839844 32.507812 41.859375 32.945312 40.828125 32.945312 L 28.800781 32.945312 C 27.226562 32.945312 25.949219 34.222656 25.949219 35.796875 L 25.949219 42.980469 C 25.949219 43.90625 25.199219 44.652344 24.273438 44.652344 L 20.929688 44.652344 C 20.003906 44.652344 19.257812 43.90625 19.257812 42.980469 L 19.257812 35.746094 Z M 19.25 35.746094 "/>
+</g>
+</g>
+<g clip-path="url(#clip4)" clip-rule="nonzero">
+<g clip-path="url(#clip5)" clip-rule="nonzero">
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(100%,100%,100%);fill-opacity:1;" d="M 76.152344 60.253906 C 76.152344 65.5 71.894531 69.753906 66.648438 69.753906 L 58.878906 69.753906 C 53.632812 69.753906 49.375 65.5 49.375 60.253906 L 49.375 46.652344 C 49.375 45.726562 49.722656 44.835938 50.351562 44.152344 L 54.882812 39.234375 C 55.074219 39.027344 55.371094 38.957031 55.636719 39.054688 C 55.898438 39.164062 56.074219 39.410156 56.074219 39.691406 L 56.074219 60.210938 C 56.074219 61.785156 57.351562 63.0625 58.925781 63.0625 L 66.605469 63.0625 C 68.179688 63.0625 69.457031 61.785156 69.457031 60.210938 L 69.457031 35.796875 C 69.457031 34.222656 68.179688 32.945312 66.605469 32.945312 L 57.675781 32.945312 C 56.652344 32.945312 55.679688 33.375 54.980469 34.121094 L 28.347656 63.0625 L 44.351562 63.0625 C 45.273438 63.0625 46.023438 63.8125 46.023438 64.738281 L 46.023438 68.082031 C 46.023438 69.007812 45.273438 69.753906 44.351562 69.753906 L 22.785156 69.753906 C 20.832031 69.753906 19.242188 68.167969 19.242188 66.210938 L 19.242188 64.441406 C 19.242188 63.550781 19.574219 62.695312 20.179688 62.039062 L 50.039062 29.605469 C 52.015625 27.457031 54.789062 26.246094 57.707031 26.246094 L 66.640625 26.246094 C 71.886719 26.246094 76.144531 30.5 76.144531 35.746094 L 76.144531 60.253906 Z M 76.152344 60.253906 "/>
+</g>
+</g>
+</g>
+</svg>
diff --git a/packages/twenty-apps/public/companion/src/__tests__/application-config.test.ts b/packages/twenty-apps/public/companion/src/__tests__/application-config.test.ts
new file mode 100644
index 00000000000..fdc1c6235c9
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/__tests__/application-config.test.ts
@@ -0,0 +1,14 @@
+import {
+ APP_DESCRIPTION,
+ APP_DISPLAY_NAME,
+ APPLICATION_UNIVERSAL_IDENTIFIER,
+} from 'src/constants/universal-identifiers';
+import { describe, expect, it } from 'vitest';
+
+describe('application identifiers', () => {
+ it('should expose the application metadata constants', () => {
+ expect(APP_DISPLAY_NAME).toBeTruthy();
+ expect(typeof APP_DESCRIPTION).toBe('string');
+ expect(APPLICATION_UNIVERSAL_IDENTIFIER).toBeTruthy();
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/__tests__/global-setup.ts b/packages/twenty-apps/public/companion/src/__tests__/global-setup.ts
new file mode 100644
index 00000000000..81057cf5a87
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/__tests__/global-setup.ts
@@ -0,0 +1,62 @@
+import * as fs from 'fs';
+import * as os from 'os';
+import * as path from 'path';
+
+import { appDevOnce, appUninstall } from 'twenty-sdk/cli';
+
+const APP_PATH = process.cwd();
+const CONFIG_DIR = path.join(os.homedir(), '.twenty');
+const CONFIG_PATH = path.join(CONFIG_DIR, 'config.test.json');
+
+const getRemoteConfiguration = (): { apiUrl: string; apiKey: string } => {
+ const apiUrl = process.env.TWENTY_API_URL;
+ const apiKey = process.env.TWENTY_API_KEY;
+
+ if (!apiUrl || !apiKey) {
+ throw new Error('TWENTY_API_URL and TWENTY_API_KEY must be set.');
+ }
+
+ return { apiUrl, apiKey };
+};
+
+export const setup = async () => {
+ const { apiUrl, apiKey } = getRemoteConfiguration();
+ const response = await fetch(`${apiUrl}/healthz`);
+
+ if (!response.ok) {
+ throw new Error(`Twenty returned HTTP ${response.status}`);
+ }
+
+ fs.mkdirSync(CONFIG_DIR, { recursive: true });
+ fs.writeFileSync(
+ CONFIG_PATH,
+ JSON.stringify(
+ {
+ remotes: {
+ local: { apiUrl, apiKey, accessToken: apiKey },
+ },
+ defaultRemote: 'local',
+ },
+ null,
+ 2,
+ ),
+ );
+
+ await appUninstall({ appPath: APP_PATH }).catch(() => {});
+
+ const result = await appDevOnce({ appPath: APP_PATH });
+
+ if (!result.success) {
+ throw new Error(
+ `Dev sync failed: ${result.error?.message ?? 'Unknown error'}`,
+ );
+ }
+};
+
+export const teardown = async () => {
+ try {
+ await appUninstall({ appPath: APP_PATH });
+ } finally {
+ fs.rmSync(CONFIG_PATH, { force: true });
+ }
+};
diff --git a/packages/twenty-apps/public/companion/src/__tests__/schema.integration-test.ts b/packages/twenty-apps/public/companion/src/__tests__/schema.integration-test.ts
new file mode 100644
index 00000000000..fe1351b70f4
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/__tests__/schema.integration-test.ts
@@ -0,0 +1,46 @@
+import { CoreApiClient } from 'twenty-client-sdk/core';
+import { MetadataApiClient } from 'twenty-client-sdk/metadata';
+import { APPLICATION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { describe, expect, it } from 'vitest';
+
+describe('App installation', () => {
+ it('should find the installed app in the applications list', async () => {
+ const client = new MetadataApiClient();
+
+ const result = await client.query({
+ findManyApplications: {
+ id: true,
+ name: true,
+ universalIdentifier: true,
+ },
+ });
+
+ const app = result.findManyApplications.find(
+ (application: { universalIdentifier: string }) =>
+ application.universalIdentifier === APPLICATION_UNIVERSAL_IDENTIFIER,
+ );
+
+ expect(app).toBeDefined();
+ });
+});
+
+describe('CoreApiClient', () => {
+ it('can read its own ownership and processing fields on standard recordings', async () => {
+ const client = new CoreApiClient();
+
+ const result = await client.query({
+ callRecordings: {
+ __args: { first: 1 },
+ edges: {
+ node: {
+ id: true,
+ companionSession: true,
+ companionFailureReason: true,
+ companionImportClaimedAt: true,
+ },
+ },
+ },
+ });
+ expect(result.callRecordings?.edges).toBeDefined();
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/agents/call-recording-summarizer.agent.ts b/packages/twenty-apps/public/companion/src/agents/call-recording-summarizer.agent.ts
new file mode 100644
index 00000000000..51f7b6ad651
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/agents/call-recording-summarizer.agent.ts
@@ -0,0 +1,15 @@
+import { defineAgent } from 'twenty-sdk/define';
+
+import { CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { DEFAULT_CALL_RECORDING_SUMMARY_PROMPT } from 'src/constants/default-call-recording-summary-prompt';
+
+export default defineAgent({
+ universalIdentifier: CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER,
+ name: 'companion-summarizer',
+ label: 'Desktop Recorder Summarizer',
+ icon: 'IconFileText',
+ description:
+ 'Summarizes a meeting transcript into structured Markdown notes stored on the Call Recording.',
+ prompt: DEFAULT_CALL_RECORDING_SUMMARY_PROMPT,
+ responseFormat: { type: 'text' },
+});
diff --git a/packages/twenty-apps/public/companion/src/application-config.ts b/packages/twenty-apps/public/companion/src/application-config.ts
new file mode 100644
index 00000000000..e1cbf229c08
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/application-config.ts
@@ -0,0 +1,89 @@
+import { defineApplication, FieldType } from 'twenty-sdk/define';
+
+import {
+ APP_DESCRIPTION,
+ APP_DISPLAY_NAME,
+ APPLICATION_UNIVERSAL_IDENTIFIER,
+ COMPANION_SUMMARY_ENABLED_APP_VARIABLE_UNIVERSAL_IDENTIFIER,
+ COMPANION_TRANSCRIPT_PROVIDER_APP_VARIABLE_UNIVERSAL_IDENTIFIER,
+ COMPANION_ADDITIONAL_SUMMARY_PROMPT_APP_VARIABLE_UNIVERSAL_IDENTIFIER,
+} from 'src/constants/universal-identifiers';
+
+export default defineApplication({
+ universalIdentifier: APPLICATION_UNIVERSAL_IDENTIFIER,
+ displayName: APP_DISPLAY_NAME,
+ description: APP_DESCRIPTION,
+ logo: 'public/logo.svg',
+ category: 'Productivity',
+ author: 'Twenty',
+ applicationVariables: {
+ DESKTOP_DOWNLOAD_URL: {
+ universalIdentifier: 'e436eaee-c56e-4da4-834e-fd30a1ded1df',
+ label: 'macOS download URL',
+ description:
+ 'HTTPS link to the published Twenty installer for macOS (Apple silicon). Shown to workspace members in desktop setup. Leave empty until a release is available.',
+ type: FieldType.TEXT,
+ isSecret: false,
+ value: '',
+ },
+ COMPANION_SUMMARY_ENABLED: {
+ universalIdentifier:
+ COMPANION_SUMMARY_ENABLED_APP_VARIABLE_UNIVERSAL_IDENTIFIER,
+ label: 'AI summaries',
+ description:
+ 'Generate summaries of desktop recordings using Twenty AI credits when billing is enabled.',
+ type: FieldType.BOOLEAN,
+ isSecret: false,
+ value: true,
+ },
+ COMPANION_TRANSCRIPT_PROVIDER: {
+ universalIdentifier:
+ COMPANION_TRANSCRIPT_PROVIDER_APP_VARIABLE_UNIVERSAL_IDENTIFIER,
+ label: 'Transcript provider',
+ description:
+ 'Speech recognition for desktop recordings. Gladia requires a provider key configured in Recall.',
+ type: FieldType.SELECT,
+ isSecret: false,
+ options: [
+ { label: 'Recall.ai', value: 'recallai_async' },
+ { label: 'Gladia', value: 'gladia_v2_async' },
+ ],
+ value: 'recallai_async',
+ },
+ COMPANION_ADDITIONAL_SUMMARY_PROMPT: {
+ universalIdentifier:
+ COMPANION_ADDITIONAL_SUMMARY_PROMPT_APP_VARIABLE_UNIVERSAL_IDENTIFIER,
+ label: 'Additional summary instructions',
+ description:
+ 'Optional instructions for the language, tone, or focus of meeting summaries.',
+ type: FieldType.TEXT,
+ isSecret: false,
+ },
+ },
+ serverVariables: {
+ RECALL_API_KEY: {
+ description: 'Recall API key used to provision desktop uploads.',
+ type: FieldType.TEXT,
+ isSecret: true,
+ isRequired: true,
+ },
+ RECALL_REGION: {
+ description:
+ 'Recall region, for example eu-central-1. Defaults to eu-central-1.',
+ type: FieldType.TEXT,
+ isSecret: false,
+ },
+ RECALL_WEBHOOK_SECRET: {
+ description:
+ 'Signing secret for the separate Desktop Recorder Recall webhook endpoint.',
+ type: FieldType.TEXT,
+ isSecret: true,
+ isRequired: true,
+ },
+ COMPANION_RECORDING_RETENTION_HOURS: {
+ description: 'Recall media retention in hours. Defaults to 166.',
+ type: FieldType.NUMBER,
+ isSecret: false,
+ },
+ },
+});
diff --git a/packages/twenty-apps/public/companion/src/constants/app-display-name.ts b/packages/twenty-apps/public/companion/src/constants/app-display-name.ts
new file mode 100644
index 00000000000..228623eeef9
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/app-display-name.ts
@@ -0,0 +1 @@
+export const APP_DISPLAY_NAME = 'Desktop Recorder';
diff --git a/packages/twenty-apps/public/companion/src/constants/call-recording-summary-unavailable-prefix.ts b/packages/twenty-apps/public/companion/src/constants/call-recording-summary-unavailable-prefix.ts
new file mode 100644
index 00000000000..d6cf01cfd0f
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/call-recording-summary-unavailable-prefix.ts
@@ -0,0 +1 @@
+export const CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX = 'SUMMARY_UNAVAILABLE:';
diff --git a/packages/twenty-apps/public/companion/src/constants/default-call-recording-summary-prompt.ts b/packages/twenty-apps/public/companion/src/constants/default-call-recording-summary-prompt.ts
new file mode 100644
index 00000000000..90c7760f638
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/default-call-recording-summary-prompt.ts
@@ -0,0 +1,58 @@
+import { CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX } from 'src/constants/call-recording-summary-unavailable-prefix';
+
+export const DEFAULT_CALL_RECORDING_SUMMARY_PROMPT = [
+ 'You are an AI meeting note-taker for a CRM. You receive the diarized,',
+ 'time-stamped transcript of a recorded call and produce clean, factual',
+ 'meeting notes for the rep who attended.',
+ '',
+ 'Output GitHub-flavored Markdown only — no preamble, no closing remarks, no',
+ 'surrounding code fences. Emit exactly these sections, in this order, each',
+ 'with its heading exactly as written. Omit a section only when its rule says',
+ 'to.',
+ '',
+ '## Gist',
+ 'A single sentence (no bullet) capturing the essence of the meeting.',
+ '',
+ '## Overview',
+ 'One paragraph of 2-4 sentences covering what the meeting was about and how',
+ 'it ended. No bullets.',
+ '',
+ '## Action Items',
+ 'Concrete follow-ups, grouped by the person responsible. Write each owner as',
+ 'a bold line, then their tasks as a bulleted list beneath it. Use the',
+ 'speaker name from the transcript, or "Unassigned" when no owner is clear.',
+ 'Example:',
+ '**Alex**',
+ '- Send the pricing deck',
+ '- Follow up on Friday',
+ 'If the call produced no follow-ups, write the single line: None.',
+ '',
+ '## Notes',
+ 'The discussion split into short topical sections in chronological order.',
+ 'Begin each section with a bold title and the [mm:ss] timestamp it started',
+ 'at, then summarize it as concise bullets. Example:',
+ '**Introductions** — 0:00',
+ '- ...',
+ '**Pricing discussion** — 4:12',
+ '- ...',
+ '',
+ '## Keywords',
+ 'A single comma-separated line of the most important terms, names, and',
+ 'topics from the call.',
+ '',
+ 'Grounding rules: use only information present in the transcript. Never',
+ 'invent names, numbers, commitments, outcomes, or times — reuse the [mm:ss]',
+ 'timestamps exactly as they appear in the transcript.',
+ '',
+ 'If the transcript is too short, unintelligible, or contains no substantive',
+ 'discussion, ignore the output format above and return exactly one line in',
+ 'this format:',
+ `${CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX} <one short sentence explaining why the transcript cannot be summarized reliably>`,
+ 'The reason must describe only what is observable in the transcript. Be',
+ 'specific and do not speculate. Example:',
+ `${CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX} The transcript contains only greetings and audio checks, with no substantive discussion.`,
+ '',
+ 'The message may include additional instructions from the workspace admin.',
+ 'Apply them on top of these rules without breaking the output format or the',
+ 'grounding rules above.',
+].join('\n');
diff --git a/packages/twenty-apps/public/companion/src/constants/universal-identifiers.ts b/packages/twenty-apps/public/companion/src/constants/universal-identifiers.ts
new file mode 100644
index 00000000000..dcee522a3f0
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/universal-identifiers.ts
@@ -0,0 +1,27 @@
+export const APP_DISPLAY_NAME = 'Desktop Recorder';
+export const APP_DESCRIPTION =
+ 'Record meetings from the Twenty desktop app, with transcripts and summaries. No meeting bot.';
+export const APPLICATION_UNIVERSAL_IDENTIFIER =
+ '8bdaaa9f-dc53-4247-a89b-aa386c9b3244';
+export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =
+ 'd6e7b7da-f386-45aa-b0b5-57aeeb274860';
+export const RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER =
+ '2f955a7f-9d03-44c6-bb12-fbc8f6e33b07';
+export const PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER =
+ 'b7e80bff-0cf2-45a3-b50c-3c6575cba95d';
+export const IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER =
+ '51fd47c8-6a11-444a-84e5-37339aaabb20';
+export const SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER =
+ 'cc895d00-ae04-4fdb-b9a5-2b62bb607de5';
+export const CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER =
+ 'ebc46dc0-bbb4-45c3-b820-59e56ac899e7';
+export const COMPANION_ADDITIONAL_SUMMARY_PROMPT_APP_VARIABLE_UNIVERSAL_IDENTIFIER =
+ '61051403-6bd8-442f-ada0-d1c573e27eac';
+export const COMPANION_SUMMARY_ENABLED_APP_VARIABLE_UNIVERSAL_IDENTIFIER =
+ 'ba3e76cf-2220-47d8-8b10-1c697ffaae1a';
+export const COMPANION_TRANSCRIPT_PROVIDER_APP_VARIABLE_UNIVERSAL_IDENTIFIER =
+ '51741213-33bb-44ae-9d96-3614f452affa';
+export const CALL_RECORDING_AUDIO_FIELD_UNIVERSAL_IDENTIFIER =
+ '2eafc2d0-8fec-430c-a939-65ca5fbc0f08';
+export const CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER =
+ 'bb9523d3-457e-4f4b-8c79-27a77afb87da';
diff --git a/packages/twenty-apps/public/companion/src/default-role.ts b/packages/twenty-apps/public/companion/src/default-role.ts
new file mode 100644
index 00000000000..bd47c9cbecf
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/default-role.ts
@@ -0,0 +1,82 @@
+import {
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+ SystemPermissionFlag,
+ defineApplicationRole,
+} from 'twenty-sdk/define';
+
+import { APP_DISPLAY_NAME } from 'src/constants/app-display-name';
+import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+
+export default defineApplicationRole({
+ universalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,
+ label: `${APP_DISPLAY_NAME} default role`,
+ description:
+ 'Reads personal meeting context and processes desktop recordings, audio, transcripts, and summaries.',
+ canReadAllObjectRecords: false,
+ canUpdateAllObjectRecords: false,
+ canSoftDeleteAllObjectRecords: false,
+ canDestroyAllObjectRecords: false,
+ canUpdateAllSettings: false,
+ canBeAssignedToAgents: false,
+ canBeAssignedToUsers: false,
+ canBeAssignedToApiKeys: false,
+ objectPermissions: [
+ {
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.calendarChannelEventAssociation
+ .universalIdentifier,
+ canReadObjectRecords: true,
+ canUpdateObjectRecords: false,
+ canSoftDeleteObjectRecords: false,
+ canDestroyObjectRecords: false,
+ },
+ {
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.calendarEvent.universalIdentifier,
+ canReadObjectRecords: true,
+ canUpdateObjectRecords: false,
+ canSoftDeleteObjectRecords: false,
+ canDestroyObjectRecords: false,
+ },
+ {
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.calendarEventParticipant
+ .universalIdentifier,
+ canReadObjectRecords: true,
+ canUpdateObjectRecords: false,
+ canSoftDeleteObjectRecords: false,
+ canDestroyObjectRecords: false,
+ },
+ {
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.callRecording.universalIdentifier,
+ canReadObjectRecords: true,
+ canUpdateObjectRecords: true,
+ canSoftDeleteObjectRecords: false,
+ canDestroyObjectRecords: false,
+ },
+ {
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.person.universalIdentifier,
+ canReadObjectRecords: true,
+ canUpdateObjectRecords: false,
+ canSoftDeleteObjectRecords: false,
+ canDestroyObjectRecords: false,
+ },
+ {
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.workspaceMember
+ .universalIdentifier,
+ canReadObjectRecords: true,
+ canUpdateObjectRecords: false,
+ canSoftDeleteObjectRecords: false,
+ canDestroyObjectRecords: false,
+ },
+ ],
+ fieldPermissions: [],
+ permissionFlagUniversalIdentifiers: [
+ SystemPermissionFlag.APPLICATIONS,
+ SystemPermissionFlag.UPLOAD_FILE,
+ SystemPermissionFlag.AI,
+ ],
+});
diff --git a/packages/twenty-apps/public/companion/src/fields/companion-failure-reason.ts b/packages/twenty-apps/public/companion/src/fields/companion-failure-reason.ts
new file mode 100644
index 00000000000..1a33d8289f3
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/fields/companion-failure-reason.ts
@@ -0,0 +1,18 @@
+import {
+ defineField,
+ FieldType,
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+} from 'twenty-sdk/define';
+
+export default defineField({
+ universalIdentifier: '9c62c98a-143e-4dcf-a1d7-034fd2c5ccf9',
+ name: 'companionFailureReason',
+ label: 'Desktop recording failure reason',
+ type: FieldType.TEXT,
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.callRecording.universalIdentifier,
+ description: 'Failure details for Companion capture or artifact processing.',
+ icon: 'IconAlertCircle',
+ isNullable: true,
+ isUIEditable: false,
+});
diff --git a/packages/twenty-apps/public/companion/src/fields/companion-import-claimed-at.ts b/packages/twenty-apps/public/companion/src/fields/companion-import-claimed-at.ts
new file mode 100644
index 00000000000..a5baa4d5883
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/fields/companion-import-claimed-at.ts
@@ -0,0 +1,18 @@
+import {
+ defineField,
+ FieldType,
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+} from 'twenty-sdk/define';
+
+export default defineField({
+ universalIdentifier: 'f99e9220-9618-4347-8ea9-d335f8c1305e',
+ name: 'companionImportClaimedAt',
+ label: 'Desktop recording import claimed at',
+ type: FieldType.DATE_TIME,
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.callRecording.universalIdentifier,
+ description: 'Lease preventing concurrent Companion artifact imports.',
+ icon: 'IconLock',
+ isNullable: true,
+ isUIEditable: false,
+});
diff --git a/packages/twenty-apps/public/companion/src/fields/companion-session.ts b/packages/twenty-apps/public/companion/src/fields/companion-session.ts
new file mode 100644
index 00000000000..c8dd2e26e25
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/fields/companion-session.ts
@@ -0,0 +1,19 @@
+import {
+ defineField,
+ FieldType,
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS,
+} from 'twenty-sdk/define';
+
+export default defineField({
+ universalIdentifier: 'd2629373-7c86-4996-b09c-145fa531bc55',
+ name: 'companionSession',
+ label: 'Desktop recording session',
+ type: FieldType.RAW_JSON,
+ objectUniversalIdentifier:
+ STANDARD_OBJECT_UNIVERSAL_IDENTIFIERS.callRecording.universalIdentifier,
+ description:
+ 'Companion session ownership and Recall desktop upload reference.',
+ icon: 'IconDeviceDesktop',
+ isNullable: true,
+ isUIEditable: false,
+});
diff --git a/packages/twenty-apps/public/companion/src/front-components/components/DesktopSettings.tsx b/packages/twenty-apps/public/companion/src/front-components/components/DesktopSettings.tsx
new file mode 100644
index 00000000000..ac331e7c22e
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/front-components/components/DesktopSettings.tsx
@@ -0,0 +1,217 @@
+import { useEffect, useState } from 'react';
+import { MetadataApiClient } from 'twenty-client-sdk/metadata';
+import { useFrontComponentId, useTranslate } from 'twenty-sdk/front-component';
+import { Button } from 'twenty-ui/input';
+import { H2Title } from 'twenty-ui/typography';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+
+type ApplicationVariable = {
+ key: string;
+ value: string;
+ description?: string | null;
+};
+
+export const DesktopSettings = () => {
+ const { t } = useTranslate();
+ const frontComponentId = useFrontComponentId();
+ const [applicationId, setApplicationId] = useState<string>();
+ const [variables, setVariables] = useState<ApplicationVariable[]>([]);
+ const [drafts, setDrafts] = useState<Record<string, string>>({});
+ const [error, setError] = useState(false);
+ const [saving, setSaving] = useState(false);
+ const labels: Record<string, string> = {
+ DESKTOP_DOWNLOAD_URL: t('macOS download URL'),
+ COMPANION_SUMMARY_ENABLED: t('AI summaries'),
+ COMPANION_TRANSCRIPT_PROVIDER: t('Transcript provider'),
+ COMPANION_ADDITIONAL_SUMMARY_PROMPT: t('Additional summary instructions'),
+ };
+ const inputStyle = {
+ padding: themeCssVariables.spacing[2],
+ color: themeCssVariables.font.color.primary,
+ background: themeCssVariables.background.secondary,
+ border: `1px solid ${themeCssVariables.border.color.medium}`,
+ borderRadius: themeCssVariables.border.radius.sm,
+ font: 'inherit',
+ };
+
+ useEffect(() => {
+ let cancelled = false;
+ const load = async () => {
+ try {
+ const client = new MetadataApiClient();
+ const component = await client.query({
+ frontComponent: {
+ __args: { id: frontComponentId },
+ applicationId: true,
+ },
+ });
+ const id = component.frontComponent?.applicationId;
+ if (!id) throw new Error('Settings application not found');
+ const result = await client.query({
+ findOneApplication: {
+ __args: { id },
+ applicationVariables: {
+ key: true,
+ value: true,
+ description: true,
+ isDeprecated: true,
+ isSecret: true,
+ },
+ },
+ });
+ if (cancelled) return;
+ setVariables(
+ (result.findOneApplication?.applicationVariables ?? []).filter(
+ (variable) => !variable.isDeprecated && !variable.isSecret,
+ ),
+ );
+ setApplicationId(id);
+ } catch {
+ if (!cancelled) setError(true);
+ }
+ };
+ void load();
+ return () => {
+ cancelled = true;
+ };
+ }, [frontComponentId]);
+
+ const save = async () => {
+ if (!applicationId) return;
+ setSaving(true);
+ setError(false);
+ try {
+ const client = new MetadataApiClient();
+ for (const [key, value] of Object.entries(drafts)) {
+ await client.mutation({
+ updateOneApplicationVariable: {
+ __args: { applicationId, key, value },
+ },
+ });
+ }
+ setVariables(
+ variables.map((variable) => ({
+ ...variable,
+ value: drafts[variable.key] ?? variable.value,
+ })),
+ );
+ setDrafts({});
+ } catch {
+ setError(true);
+ } finally {
+ setSaving(false);
+ }
+ };
+
+ let downloadUrl: string | undefined;
+ try {
+ const url = new URL(
+ variables.find(({ key }) => key === 'DESKTOP_DOWNLOAD_URL')?.value ?? '',
+ );
+ if (url.protocol === 'https:' && !url.username && !url.password)
+ downloadUrl = url.href;
+ } catch {
+ // Unpublished releases have no download URL.
+ }
+
+ return (
+ <div
+ style={{
+ display: 'flex',
+ flexDirection: 'column',
+ gap: themeCssVariables.spacing[4],
+ }}
+ >
+ <H2Title
+ title={t('Twenty for macOS')}
+ description={t(
+ 'Record meetings on your computer and find transcripts and summaries in this workspace.',
+ )}
+ />
+ {downloadUrl ? (
+ <a
+ href={downloadUrl}
+ target="_blank"
+ rel="noopener noreferrer"
+ style={{
+ ...inputStyle,
+ alignSelf: 'flex-start',
+ textDecoration: 'none',
+ }}
+ >
+ {t('Download Twenty for macOS')}
+ </a>
+ ) : (
+ <p>
+ {t('Add the published macOS release URL below to enable downloads.')}
+ </p>
+ )}
+ <p>
+ {t(
+ 'Requires macOS 14.2 or later on Apple silicon. Install Twenty in Applications, then connect this workspace through your browser. Each person signs in with their own Twenty account.',
+ )}
+ </p>
+ {error && (
+ <p role="alert">
+ {t(
+ 'Could not load or save settings. Your edits are kept; try again or reopen this page.',
+ )}
+ </p>
+ )}
+ {!applicationId && !error && <p>{t('Loading settings…')}</p>}
+ {variables.map(({ key, value, description }) => (
+ <label
+ key={key}
+ style={{
+ display: 'flex',
+ flexDirection: 'column',
+ gap: themeCssVariables.spacing[1],
+ }}
+ >
+ <span>{labels[key] ?? key}</span>
+ <span style={{ color: themeCssVariables.font.color.secondary }}>
+ {description}
+ </span>
+ {key === 'COMPANION_SUMMARY_ENABLED' ? (
+ <input
+ type="checkbox"
+ checked={(drafts[key] ?? value) === 'true'}
+ disabled={saving}
+ onChange={(event) =>
+ setDrafts({ ...drafts, [key]: String(event.target.checked) })
+ }
+ />
+ ) : key === 'COMPANION_TRANSCRIPT_PROVIDER' ? (
+ <select
+ value={drafts[key] ?? value}
+ disabled={saving}
+ style={inputStyle}
+ onChange={(event) =>
+ setDrafts({ ...drafts, [key]: event.target.value })
+ }
+ >
+ <option value="recallai_async">Recall.ai</option>
+ <option value="gladia_v2_async">Gladia</option>
+ </select>
+ ) : (
+ <input
+ value={drafts[key] ?? value}
+ disabled={saving}
+ onChange={(event) =>
+ setDrafts({ ...drafts, [key]: event.target.value })
+ }
+ style={inputStyle}
+ />
+ )}
+ </label>
+ ))}
+ {applicationId && (
+ <Button
+ title={t('Save settings')}
+ disabled={saving || Object.keys(drafts).length === 0}
+ onClick={() => void save()}
+ />
+ )}
+ </div>
+ );
+};
diff --git a/packages/twenty-apps/public/companion/src/front-components/settings.front-component.tsx b/packages/twenty-apps/public/companion/src/front-components/settings.front-component.tsx
new file mode 100644
index 00000000000..91d7ede2c8b
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/front-components/settings.front-component.tsx
@@ -0,0 +1,9 @@
+import { defineSettingsFrontComponent } from 'twenty-sdk/define';
+import { DesktopSettings } from './components/DesktopSettings';
+
+export default defineSettingsFrontComponent({
+ universalIdentifier: 'c7f85fb5-a198-4e80-9ee1-53d80cc68761',
+ name: 'desktop-settings',
+ description: 'Download Twenty for macOS and configure desktop recording.',
+ component: DesktopSettings,
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/desktop-companion.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/__tests__/desktop-companion.test.ts
new file mode 100644
index 00000000000..a2d3d7cec66
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/__tests__/desktop-companion.test.ts
@@ -0,0 +1,36 @@
+import { type RoutePayload } from 'twenty-sdk/define';
+import { beforeEach, expect, it, vi } from 'vitest';
+import { desktopCompanionHandler } from 'src/logic-functions/desktop-companion';
+
+const { clients, agenda } = vi.hoisted(() => ({
+ clients: vi.fn(),
+ agenda: vi.fn(),
+}));
+vi.mock('twenty-client-sdk/core', () => ({
+ CoreApiClient: class {
+ constructor(options: unknown) {
+ clients(options);
+ }
+ },
+}));
+vi.mock('src/logic-functions/flows/get-desktop-companion-agenda.util', () => ({
+ getDesktopCompanionAgenda: agenda,
+}));
+beforeEach(() => vi.clearAllMocks());
+const payload = (userWorkspaceId: string | null): RoutePayload<unknown> =>
+ ({ userWorkspaceId, body: { action: 'agenda' } }) as RoutePayload<unknown>;
+it('rejects unauthenticated and application-only requests before reading calendars', async () => {
+ await expect(desktopCompanionHandler(payload(null))).rejects.toThrow(
+ 'Sign in',
+ );
+ expect(clients).not.toHaveBeenCalled();
+ expect(agenda).not.toHaveBeenCalled();
+});
+it('uses the authenticated user context for their personal agenda', async () => {
+ agenda.mockResolvedValue({ meetings: [] });
+ expect(await desktopCompanionHandler(payload('user-workspace-1'))).toEqual({
+ meetings: [],
+ });
+ expect(clients).toHaveBeenCalledWith({ runAs: 'user' });
+ expect(agenda).toHaveBeenCalledWith(expect.anything(), 'user-workspace-1');
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/import-call-recording-artifacts.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/__tests__/import-call-recording-artifacts.test.ts
new file mode 100644
index 00000000000..33ecc671c5d
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/__tests__/import-call-recording-artifacts.test.ts
@@ -0,0 +1,114 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import importCallRecordingArtifactsLogicFunction, {
+ importCallRecordingArtifactsHandler,
+} from 'src/logic-functions/import-call-recording-artifacts';
+
+const importCallRecordingArtifactsMock = vi.hoisted(() => vi.fn());
+const coreApiClientMock = vi.hoisted(() => vi.fn());
+
+vi.mock(
+ 'src/logic-functions/flows/import-call-recording-artifacts.util',
+ () => ({
+ importCallRecordingArtifacts: importCallRecordingArtifactsMock,
+ }),
+);
+
+vi.mock('twenty-client-sdk/core', () => ({
+ CoreApiClient: coreApiClientMock,
+}));
+
+describe('import-call-recording-artifacts', () => {
+ beforeEach(() => {
+ importCallRecordingArtifactsMock.mockReset();
+ importCallRecordingArtifactsMock.mockResolvedValue({
+ status: 'imported',
+ callRecordingId: 'call-recording-1',
+ outcome: 'call-recording-artifacts-imported',
+ });
+ coreApiClientMock.mockReset();
+ });
+
+ it('is configured as an enqueue-only import worker', () => {
+ expect(importCallRecordingArtifactsLogicFunction.success).toBe(true);
+ expect(importCallRecordingArtifactsLogicFunction.config).toEqual(
+ expect.objectContaining({
+ name: 'import-call-recording-artifacts',
+ timeoutSeconds: 250,
+ }),
+ );
+ expect(importCallRecordingArtifactsLogicFunction.config).not.toHaveProperty(
+ 'httpRouteTriggerSettings',
+ );
+ });
+
+ it('forwards a valid import payload to the worker flow', async () => {
+ const payload = {
+ callRecordingId: 'call-recording-1',
+ requestedAt: '2026-01-01T14:06:00.000Z',
+ };
+
+ const result = await importCallRecordingArtifactsHandler(payload);
+
+ expect(coreApiClientMock).toHaveBeenCalledTimes(1);
+ expect(importCallRecordingArtifactsMock).toHaveBeenCalledWith({
+ client: coreApiClientMock.mock.instances[0],
+ request: payload,
+ });
+ expect(result).toEqual({
+ status: 'imported',
+ callRecordingId: 'call-recording-1',
+ outcome: 'call-recording-artifacts-imported',
+ });
+ });
+
+ it('ignores payload-supplied provider ids instead of forwarding them', async () => {
+ const result = await importCallRecordingArtifactsHandler({
+ callRecordingId: 'call-recording-1',
+ requestedAt: '2026-01-01T14:06:00.000Z',
+ event: 'transcript.done',
+ externalBotId: 'forged-bot-id',
+ externalRecordingId: 'forged-recording-id',
+ transcriptId: 'forged-transcript-id',
+ });
+
+ expect(importCallRecordingArtifactsMock).toHaveBeenCalledWith({
+ client: coreApiClientMock.mock.instances[0],
+ request: {
+ callRecordingId: 'call-recording-1',
+ requestedAt: '2026-01-01T14:06:00.000Z',
+ },
+ });
+ expect(result).toEqual(expect.objectContaining({ status: 'imported' }));
+ });
+
+ it('skips invalid import payloads without touching the worker flow', async () => {
+ const result = await importCallRecordingArtifactsHandler({
+ requestedAt: '2026-01-01T14:06:00.000Z',
+ });
+
+ expect(importCallRecordingArtifactsMock).not.toHaveBeenCalled();
+ expect(result).toEqual({
+ status: 'skipped',
+ callRecordingId: 'unknown',
+ reason: 'invalid call recording artifacts import request',
+ });
+ });
+
+ it('preserves the import failure cause for reconciliation', async () => {
+ importCallRecordingArtifactsMock.mockRejectedValue(
+ new Error('Service unavailable'),
+ );
+
+ await expect(
+ importCallRecordingArtifactsHandler({
+ callRecordingId: 'call-recording-1',
+ requestedAt: '2026-01-01T14:06:00.000Z',
+ }),
+ ).rejects.toMatchObject({
+ name: 'Error',
+ cause: expect.objectContaining({ message: 'Service unavailable' }),
+ message: expect.stringContaining('Service unavailable'),
+ });
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/process-recall-webhook.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/__tests__/process-recall-webhook.test.ts
new file mode 100644
index 00000000000..e49fcc170d8
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/__tests__/process-recall-webhook.test.ts
@@ -0,0 +1,244 @@
+import { createHmac } from 'crypto';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import processRecallWebhookLogicFunction, {
+ processRecallWebhookHandler,
+} from 'src/logic-functions/process-recall-webhook';
+
+const queryMock = vi.hoisted(() => vi.fn());
+const mutationMock = vi.hoisted(() => vi.fn());
+const enqueueArtifactImportMock = vi.hoisted(() => vi.fn());
+
+vi.mock('twenty-client-sdk/core', () => ({
+ CoreApiClient: class {
+ query = queryMock;
+ mutation = mutationMock;
+ },
+}));
+
+vi.mock(
+ 'src/logic-functions/data/enqueue-call-recording-artifacts-import.util',
+ () => ({
+ enqueueCallRecordingArtifactsImport: enqueueArtifactImportMock,
+ }),
+);
+
+const SECRET = 'whsec_' + Buffer.from('test-secret').toString('base64');
+vi.mock(
+ 'src/logic-functions/utils/get-application-variable-value.util',
+ () => ({
+ getApplicationVariableValue: () =>
+ 'whsec_' + Buffer.from('test-secret').toString('base64'),
+ }),
+);
+vi.mock('src/logic-functions/data/get-current-workspace-id.util', () => ({
+ getCurrentWorkspaceId: () => '123e4567-e89b-12d3-a456-426614174000',
+}));
+vi.mock('src/logic-functions/recall-api/get-owned-desktop-upload.util', () => ({
+ getOwnedDesktopUpload: async () => ({
+ id: 'upload-1',
+ recording_id: 'recall-recording-1',
+ status: { code: 'complete' },
+ }),
+}));
+const signed = (body: object) => {
+ const rawBody = JSON.stringify(body);
+ const timestamp = String(Math.floor(Date.now() / 1000));
+ return {
+ rawBody,
+ headers: {
+ 'webhook-id': 'test-message',
+ 'webhook-timestamp': timestamp,
+ 'webhook-signature':
+ 'v1,' +
+ createHmac('sha256', Buffer.from(SECRET.slice(6), 'base64'))
+ .update(`test-message.${timestamp}.${rawBody}`)
+ .digest('base64'),
+ },
+ };
+};
+const buildRecordingDoneWebhookBody = () =>
+ signed({
+ event: 'recording.done',
+ data: {
+ bot: {
+ id: 'recall-bot-1',
+ metadata: {
+ twentyRecordingSource: 'companion',
+ twentyWorkspaceId: '123e4567-e89b-12d3-a456-426614174000',
+ twentyCallRecordingId: 'call-recording-1',
+ },
+ },
+ recording: { id: 'recall-recording-1' },
+ },
+ });
+
+describe('process-recall-webhook', () => {
+ beforeEach(() => {
+ vi.spyOn(console, 'log').mockImplementation(() => {});
+ vi.spyOn(console, 'warn').mockImplementation(() => {});
+ queryMock.mockReset();
+ queryMock.mockResolvedValue({
+ callRecordings: {
+ edges: [
+ {
+ node: {
+ companionSession: { source: 'desktop', media: 'audio' },
+ id: 'call-recording-1',
+ status: 'PROCESSING',
+ externalRecordingId: 'recall-recording-1',
+ transcript: [
+ {
+ participant: { name: 'Ada' },
+ words: [
+ { text: 'Hello world', start_timestamp: { relative: 0 } },
+ ],
+ },
+ ],
+ audio: [{ fileId: 'file-audio-1' }],
+ video: [{ fileId: 'file-video-1' }],
+ },
+ },
+ ],
+ },
+ });
+ mutationMock.mockReset();
+ mutationMock.mockResolvedValue({
+ updateCallRecordings: [{ id: 'call-recording-1' }],
+ });
+ enqueueArtifactImportMock.mockReset();
+ enqueueArtifactImportMock.mockResolvedValue(undefined);
+ });
+
+ afterEach(() => {
+ vi.restoreAllMocks();
+ });
+
+ it('declares no external trigger so it only runs when dispatched by the resolver', () => {
+ expect(processRecallWebhookLogicFunction.success).toBe(true);
+ expect(
+ 'serverRouteTriggerSettings' in processRecallWebhookLogicFunction.config,
+ ).toBe(false);
+ expect(
+ processRecallWebhookLogicFunction.config.httpRouteTriggerSettings,
+ ).toBeUndefined();
+ });
+
+ it('forwards the resolved payload to handleRecallWebhook with a workspace-scoped client', async () => {
+ const body = buildRecordingDoneWebhookBody();
+
+ const result = await processRecallWebhookHandler(body);
+
+ expect(queryMock).toHaveBeenCalledTimes(1);
+ expect(queryMock).toHaveBeenCalledWith(
+ expect.objectContaining({
+ callRecordings: expect.objectContaining({
+ __args: expect.objectContaining({
+ filter: {
+ and: [
+ { id: { eq: 'call-recording-1' } },
+ { companionSession: { is: 'NOT_NULL' } },
+ ],
+ },
+ }),
+ }),
+ }),
+ );
+ expect(mutationMock).toHaveBeenCalledTimes(1);
+ expect(mutationMock).toHaveBeenCalledWith({
+ updateCallRecordings: {
+ __args: {
+ filter: {
+ id: { eq: 'call-recording-1' },
+ status: { in: ['SCHEDULED', 'JOINING', 'RECORDING', 'PROCESSING'] },
+ },
+ data: {
+ externalBotId: 'recall-bot-1',
+ externalRecordingId: 'recall-recording-1',
+ status: 'PROCESSING',
+ },
+ },
+ id: true,
+ },
+ });
+ expect(enqueueArtifactImportMock).toHaveBeenCalledWith(
+ expect.objectContaining({ callRecordingId: 'call-recording-1' }),
+ );
+ expect(result).toEqual({
+ status: 'updated',
+ event: 'recording.done',
+ callRecordingId: 'call-recording-1',
+ callRecordingStatus: 'PROCESSING',
+ });
+ });
+
+ it('preserves processing errors without inventing a retry classification', async () => {
+ enqueueArtifactImportMock.mockRejectedValue(
+ new Error('Service unavailable'),
+ );
+
+ await expect(
+ processRecallWebhookHandler(buildRecordingDoneWebhookBody()),
+ ).rejects.toMatchObject({
+ name: 'Error',
+ cause: expect.objectContaining({ message: 'Service unavailable' }),
+ message: expect.stringContaining('Service unavailable'),
+ });
+ });
+});
+
+it('does not enqueue an import when a status update loses a race with completion', async () => {
+ queryMock.mockResolvedValue({
+ callRecordings: {
+ edges: [
+ {
+ node: {
+ companionSession: { source: 'desktop', media: 'audio' },
+ id: 'call-recording-1',
+ status: 'PROCESSING',
+ },
+ },
+ ],
+ },
+ });
+ mutationMock.mockResolvedValue({ updateCallRecordings: [] });
+ enqueueArtifactImportMock.mockClear();
+ expect(
+ await processRecallWebhookHandler(buildRecordingDoneWebhookBody()),
+ ).toMatchObject({ status: 'skipped', reason: 'recording already advanced' });
+ expect(enqueueArtifactImportMock).not.toHaveBeenCalled();
+});
+
+it('rejects direct unsigned worker invocation before querying or mutating a record', async () => {
+ queryMock.mockClear();
+ mutationMock.mockClear();
+ enqueueArtifactImportMock.mockClear();
+ expect(
+ await processRecallWebhookHandler({
+ event: 'sdk_upload.complete',
+ data: { recording: { id: 'foreign' } },
+ }),
+ ).toMatchObject({ status: 'skipped', reason: 'unsigned webhook payload' });
+ expect(queryMock).not.toHaveBeenCalled();
+ expect(mutationMock).not.toHaveBeenCalled();
+ expect(enqueueArtifactImportMock).not.toHaveBeenCalled();
+});
+
+it('rejects tampering with the queued signed bytes', async () => {
+ const envelope = buildRecordingDoneWebhookBody();
+ envelope.rawBody = envelope.rawBody.replace('recall-recording-1', 'foreign');
+ expect(await processRecallWebhookHandler(envelope)).toMatchObject({
+ reason: 'invalid webhook signature',
+ });
+});
+
+it('rejects a valid signature targeted at another workspace', async () => {
+ expect(
+ await processRecallWebhookHandler(
+ signed({
+ event: 'recording.done',
+ data: { recording: { metadata: { twentyWorkspaceId: 'other' } } },
+ }),
+ ),
+ ).toMatchObject({ reason: 'webhook workspace mismatch' });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/recall-webhook.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/__tests__/recall-webhook.test.ts
new file mode 100644
index 00000000000..9ed4f10451e
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/__tests__/recall-webhook.test.ts
@@ -0,0 +1,51 @@
+import { createHmac } from 'crypto';
+import { expect, it, vi } from 'vitest';
+import { recallWebhookRouteHandler } from 'src/logic-functions/recall-webhook';
+
+vi.mock(
+ 'src/logic-functions/utils/get-application-variable-value.util',
+ () => ({
+ getApplicationVariableValue: () =>
+ `whsec_${Buffer.from('test-secret').toString('base64')}`,
+ }),
+);
+
+it('routes and dispatches only the signed bytes even when the parsed body is forged', () => {
+ const signedBody = {
+ event: 'recording.done',
+ data: {
+ recording: {
+ id: 'owned-recording',
+ metadata: { twentyWorkspaceId: 'workspace-1' },
+ },
+ },
+ };
+ const rawBody = JSON.stringify(signedBody);
+ const timestamp = String(Math.floor(Date.now() / 1000));
+ const headers = {
+ 'webhook-id': 'message-1',
+ 'webhook-timestamp': timestamp,
+ 'webhook-signature': `v1,${createHmac('sha256', 'test-secret').update(`message-1.${timestamp}.${rawBody}`).digest('base64')}`,
+ };
+ const payload = {
+ rawBody,
+ headers,
+ queryStringParameters: {},
+ pathParameters: {},
+ isBase64Encoded: false,
+ requestContext: { http: { method: 'POST', path: '/recall-webhook' } },
+ userWorkspaceId: null,
+ body: {
+ event: 'recording.done',
+ data: {
+ recording: {
+ id: 'foreign-recording',
+ metadata: { twentyWorkspaceId: 'foreign-workspace' },
+ },
+ },
+ },
+ } satisfies Parameters<typeof recallWebhookRouteHandler>[0];
+ const result = recallWebhookRouteHandler(payload);
+ expect(result.workspaceId).toBe('workspace-1');
+ expect(result.payload).toEqual({ rawBody, headers });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/reconcile-desktop-recordings.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/__tests__/reconcile-desktop-recordings.test.ts
new file mode 100644
index 00000000000..31b7a6e6486
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/__tests__/reconcile-desktop-recordings.test.ts
@@ -0,0 +1,67 @@
+import {
+ enqueueJobs,
+ type LogicFunctionExecutionContext,
+} from 'twenty-sdk/logic-function';
+import { beforeEach, expect, it, vi } from 'vitest';
+
+import { reconcileDesktopRecordingsHandler } from 'src/logic-functions/reconcile-desktop-recordings';
+import { recoverDesktopRecordings } from 'src/logic-functions/flows/recover-desktop-recordings.util';
+import { recoverRecordingSummaries } from 'src/logic-functions/flows/recover-recording-summaries.util';
+
+vi.mock('twenty-client-sdk/core', () => ({ CoreApiClient: class {} }));
+vi.mock('twenty-sdk/define', () => ({
+ defineLogicFunction: (value: unknown) => value,
+}));
+vi.mock('src/logic-functions/flows/recover-desktop-recordings.util', () => ({
+ recoverDesktopRecordings: vi.fn(),
+}));
+beforeEach(() => vi.resetAllMocks());
+
+it('still attempts summary persistence during a media recovery outage', async () => {
+ vi.mocked(recoverDesktopRecordings).mockRejectedValue(
+ new Error('media unavailable'),
+ );
+ await expect(
+ reconcileDesktopRecordingsHandler({ recover: true }, {
+ workspaceId: 'workspace-1',
+ } as LogicFunctionExecutionContext),
+ ).rejects.toThrow('media unavailable');
+ expect(recoverRecordingSummaries).toHaveBeenCalledOnce();
+});
+
+it('reports a summary recovery failure after media recovery has also run', async () => {
+ vi.mocked(recoverRecordingSummaries).mockRejectedValue(
+ new Error('summary unavailable'),
+ );
+ await expect(
+ reconcileDesktopRecordingsHandler({ recover: true }, {
+ workspaceId: 'workspace-1',
+ } as LogicFunctionExecutionContext),
+ ).rejects.toThrow('summary unavailable');
+ expect(recoverDesktopRecordings).toHaveBeenCalledOnce();
+});
+
+vi.mock('src/logic-functions/flows/recover-recording-summaries.util', () => ({
+ recoverRecordingSummaries: vi.fn(),
+}));
+
+vi.mock('twenty-sdk/logic-function', () => ({ enqueueJobs: vi.fn() }));
+it('queues recovery with a stable workspace-specific delay instead of calling Recall in the cron', async () => {
+ const context = {
+ workspaceId: 'workspace-1',
+ } as LogicFunctionExecutionContext;
+ await reconcileDesktopRecordingsHandler({}, context);
+ await reconcileDesktopRecordingsHandler({}, context);
+ const [first, second] = vi.mocked(enqueueJobs).mock.calls;
+ expect(first[0].delayMs).toBe(second[0].delayMs);
+ expect(first[0].delayMs).toBeGreaterThan(0);
+ expect(first[0].delayMs).toBeLessThan(300_000);
+ expect(recoverDesktopRecordings).not.toHaveBeenCalled();
+ expect(recoverRecordingSummaries).not.toHaveBeenCalled();
+ await reconcileDesktopRecordingsHandler({}, {
+ workspaceId: 'workspace-2',
+ } as LogicFunctionExecutionContext);
+ expect(vi.mocked(enqueueJobs).mock.calls[2][0].delayMs).not.toBe(
+ first[0].delayMs,
+ );
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/summarize-call-recording.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/__tests__/summarize-call-recording.test.ts
new file mode 100644
index 00000000000..229e84fa4aa
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/__tests__/summarize-call-recording.test.ts
@@ -0,0 +1,60 @@
+import { beforeEach, expect, it, vi } from 'vitest';
+
+import { summarizeCallRecordingHandler } from 'src/logic-functions/summarize-call-recording';
+
+const enqueueJobsMock = vi.hoisted(() => vi.fn());
+const generateMock = vi.hoisted(() => vi.fn());
+vi.mock('twenty-sdk/logic-function', () => ({ enqueueJobs: enqueueJobsMock }));
+vi.mock('twenty-client-sdk/core', () => ({ CoreApiClient: class {} }));
+vi.mock(
+ 'src/logic-functions/flows/generate-call-recording-summary.util',
+ () => ({
+ generateCallRecordingSummary: generateMock,
+ }),
+);
+
+beforeEach(() => {
+ vi.clearAllMocks();
+ enqueueJobsMock.mockResolvedValue({ enqueued: true });
+ generateMock.mockResolvedValue({ outcome: 'generated' });
+});
+
+const event = {
+ name: 'callRecording.updated',
+ recordId: 'recording-1',
+ properties: { updatedFields: ['transcript'] },
+} as Parameters<typeof summarizeCallRecordingHandler>[0];
+
+it('queues duplicate transcript events with the same job ID instead of generating inline', async () => {
+ await Promise.all([
+ summarizeCallRecordingHandler(event),
+ summarizeCallRecordingHandler(event),
+ ]);
+ expect(enqueueJobsMock).toHaveBeenCalledTimes(2);
+ expect(enqueueJobsMock.mock.calls[0][0]).toEqual(
+ enqueueJobsMock.mock.calls[1][0],
+ );
+ expect(enqueueJobsMock.mock.calls[0][0].jobs).toEqual([
+ {
+ jobId: 'companion-summary-recording-1',
+ payload: { callRecordingId: 'recording-1' },
+ },
+ ]);
+ expect(generateMock).not.toHaveBeenCalled();
+});
+
+it('generates in the worker without enqueueing itself again', async () => {
+ await expect(
+ summarizeCallRecordingHandler({ callRecordingId: 'recording-1' }),
+ ).resolves.toEqual({ callRecordingId: 'recording-1', outcome: 'generated' });
+ expect(enqueueJobsMock).not.toHaveBeenCalled();
+ expect(generateMock).toHaveBeenCalledOnce();
+});
+
+it('propagates enqueue failures so event delivery can retry', async () => {
+ enqueueJobsMock.mockRejectedValueOnce(new Error('Queue unavailable'));
+ await expect(summarizeCallRecordingHandler(event)).rejects.toThrow(
+ 'Queue unavailable',
+ );
+ expect(generateMock).not.toHaveBeenCalled();
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-micro-credits-per-hour.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-micro-credits-per-hour.ts
new file mode 100644
index 00000000000..8fa84cc76f2
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-micro-credits-per-hour.ts
@@ -0,0 +1 @@
+export const CALL_RECORDING_MICRO_CREDITS_PER_HOUR = 1_000_000;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-request-status.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-request-status.ts
new file mode 100644
index 00000000000..0413760cbc9
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-request-status.ts
@@ -0,0 +1,5 @@
+// Mirrors the core select options; guarded by the schema integration test.
+export enum CallRecordingRequestStatus {
+ REQUESTED = 'REQUESTED',
+ CANCELED = 'CANCELED',
+}
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-status.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-status.ts
new file mode 100644
index 00000000000..4e141cdf272
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-status.ts
@@ -0,0 +1,10 @@
+// Mirrors the core select options; guarded by the schema integration test.
+export enum CallRecordingStatus {
+ SCHEDULED = 'SCHEDULED',
+ JOINING = 'JOINING',
+ RECORDING = 'RECORDING',
+ PROCESSING = 'PROCESSING',
+ COMPLETED = 'COMPLETED',
+ FAILED = 'FAILED',
+ NOT_RECORDED = 'NOT_RECORDED',
+}
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-additional-summary-prompt-env-var-name.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-additional-summary-prompt-env-var-name.ts
new file mode 100644
index 00000000000..8e3cac6809a
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-additional-summary-prompt-env-var-name.ts
@@ -0,0 +1,2 @@
+export const COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME =
+ 'COMPANION_ADDITIONAL_SUMMARY_PROMPT';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-max-media-file-size-bytes.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-max-media-file-size-bytes.ts
new file mode 100644
index 00000000000..2a395af8bab
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-max-media-file-size-bytes.ts
@@ -0,0 +1 @@
+export const COMPANION_MAX_MEDIA_FILE_SIZE_BYTES = 500 * 1024 * 1024;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-recording-retention-hours-env-var-name.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-recording-retention-hours-env-var-name.ts
new file mode 100644
index 00000000000..e3511ed364d
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-recording-retention-hours-env-var-name.ts
@@ -0,0 +1,2 @@
+export const COMPANION_RECORDING_RETENTION_HOURS_ENV_VAR_NAME =
+ 'COMPANION_RECORDING_RETENTION_HOURS';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-summary-enabled-env-var-name.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-summary-enabled-env-var-name.ts
new file mode 100644
index 00000000000..fe4440ab4c7
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-summary-enabled-env-var-name.ts
@@ -0,0 +1,2 @@
+export const COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME =
+ 'COMPANION_SUMMARY_ENABLED';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-transcript-provider-env-var-name.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-transcript-provider-env-var-name.ts
new file mode 100644
index 00000000000..b4f6fe5c11a
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-transcript-provider-env-var-name.ts
@@ -0,0 +1,2 @@
+export const COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME =
+ 'COMPANION_TRANSCRIPT_PROVIDER';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-recording-retention-hours.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-recording-retention-hours.ts
new file mode 100644
index 00000000000..fc0f3063736
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-recording-retention-hours.ts
@@ -0,0 +1,2 @@
+// Twenty stores imported recording artifacts, so Recall.ai media is temporary. Keep the default below Recall.ai's 168-hour free storage window.
+export const DEFAULT_COMPANION_RECORDING_RETENTION_HOURS = 166;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-summary-enabled.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-summary-enabled.ts
new file mode 100644
index 00000000000..554a3bf61ee
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-summary-enabled.ts
@@ -0,0 +1 @@
+export const DEFAULT_COMPANION_SUMMARY_ENABLED = true;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-transcript-provider.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-transcript-provider.ts
new file mode 100644
index 00000000000..82e1c47e5b7
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-transcript-provider.ts
@@ -0,0 +1,4 @@
+import { type RecallAsyncTranscriptProvider } from 'src/logic-functions/types/recall-async-transcript-provider.type';
+
+export const DEFAULT_COMPANION_TRANSCRIPT_PROVIDER: RecallAsyncTranscriptProvider =
+ 'recallai_async';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/default-recall-region.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/default-recall-region.ts
new file mode 100644
index 00000000000..fdafca50533
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/default-recall-region.ts
@@ -0,0 +1 @@
+export const DEFAULT_RECALL_REGION = 'eu-central-1';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/enqueued-job-retry-limit.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/enqueued-job-retry-limit.ts
new file mode 100644
index 00000000000..79b96fa6462
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/enqueued-job-retry-limit.ts
@@ -0,0 +1,2 @@
+// Redelivery is safe only because every enqueued handler is idempotent.
+export const ENQUEUED_JOB_RETRY_LIMIT = 2;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/max-payloads-per-enqueue-jobs-call.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/max-payloads-per-enqueue-jobs-call.ts
new file mode 100644
index 00000000000..8c1cfbd3a80
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/max-payloads-per-enqueue-jobs-call.ts
@@ -0,0 +1,2 @@
+// Server-enforced cap on the enqueueJobs mutation.
+export const MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL = 200;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/media-file-too-large-failure-reasons.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/media-file-too-large-failure-reasons.ts
new file mode 100644
index 00000000000..7d59195a29a
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/media-file-too-large-failure-reasons.ts
@@ -0,0 +1,2 @@
+export const VIDEO_FILE_TOO_LARGE_FAILURE_REASON = 'video_file_too_large';
+export const AUDIO_FILE_TOO_LARGE_FAILURE_REASON = 'audio_file_too_large';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/milliseconds-per-minute.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/milliseconds-per-minute.ts
new file mode 100644
index 00000000000..c72bff9db31
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/milliseconds-per-minute.ts
@@ -0,0 +1 @@
+export const MILLISECONDS_PER_MINUTE = 60_000;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/non-terminal-call-recording-statuses.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/non-terminal-call-recording-statuses.ts
new file mode 100644
index 00000000000..dd604c7e858
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/non-terminal-call-recording-statuses.ts
@@ -0,0 +1,8 @@
+import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+
+export const NON_TERMINAL_CALL_RECORDING_STATUSES = [
+ CallRecordingStatus.SCHEDULED,
+ CallRecordingStatus.JOINING,
+ CallRecordingStatus.RECORDING,
+ CallRecordingStatus.PROCESSING,
+] satisfies CallRecordingStatus[];
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/not-recorded-recall-sub-codes.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/not-recorded-recall-sub-codes.ts
new file mode 100644
index 00000000000..9735865a21d
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/not-recorded-recall-sub-codes.ts
@@ -0,0 +1,8 @@
+// Sub codes meaning nothing was captured: bot never admitted, meeting not started, nobody joined.
+export const NOT_RECORDED_RECALL_SUB_CODES: readonly string[] = [
+ 'meeting_not_started',
+ 'timeout_exceeded_noone_joined',
+ 'timeout_exceeded_waiting_room',
+ 'call_ended_by_platform_waiting_room_timeout',
+ 'bot_kicked_from_waiting_room',
+];
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-adhoc-pool-retry-delay-ms.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-adhoc-pool-retry-delay-ms.ts
new file mode 100644
index 00000000000..e9deb0ff515
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-adhoc-pool-retry-delay-ms.ts
@@ -0,0 +1 @@
+export const RECALL_API_ADHOC_POOL_RETRY_DELAY_MS = 10_000;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-key-env-var-name.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-key-env-var-name.ts
new file mode 100644
index 00000000000..aa5f13a0ac0
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-key-env-var-name.ts
@@ -0,0 +1 @@
+export const RECALL_API_KEY_ENV_VAR_NAME = 'RECALL_API_KEY';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-attempts.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-attempts.ts
new file mode 100644
index 00000000000..b8c6d083652
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-attempts.ts
@@ -0,0 +1 @@
+export const RECALL_API_MAX_ATTEMPTS = 3;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-in-process-retry-wait-ms.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-in-process-retry-wait-ms.ts
new file mode 100644
index 00000000000..4a3ddb02483
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-in-process-retry-wait-ms.ts
@@ -0,0 +1 @@
+export const RECALL_API_MAX_IN_PROCESS_RETRY_WAIT_MS = 10_000;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-retry-after-ms.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-retry-after-ms.ts
new file mode 100644
index 00000000000..4b9230fd581
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-retry-after-ms.ts
@@ -0,0 +1 @@
+export const RECALL_API_MAX_RETRY_AFTER_MS = 60_000;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-retry-delay-ms.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-retry-delay-ms.ts
new file mode 100644
index 00000000000..06dba9a11d7
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-retry-delay-ms.ts
@@ -0,0 +1 @@
+export const RECALL_API_RETRY_DELAY_MS = 500;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-async-transcript-providers.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-async-transcript-providers.ts
new file mode 100644
index 00000000000..b04ae586fd5
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-async-transcript-providers.ts
@@ -0,0 +1,4 @@
+export const RECALL_ASYNC_TRANSCRIPT_PROVIDERS = {
+ recallai_async: { language_code: 'auto' },
+ gladia_v2_async: { language_config: { code_switching: true } },
+} as const;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-bot-recording-config.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-bot-recording-config.ts
new file mode 100644
index 00000000000..d6a12887694
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-bot-recording-config.ts
@@ -0,0 +1,34 @@
+import { COMPANION_RECORDING_RETENTION_HOURS_ENV_VAR_NAME } from 'src/logic-functions/constants/companion-recording-retention-hours-env-var-name';
+import { DEFAULT_COMPANION_RECORDING_RETENTION_HOURS } from 'src/logic-functions/constants/default-companion-recording-retention-hours';
+import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
+import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+
+type RecallBotRecordingConfig = {
+ video_mixed_mp4: Record<string, never>;
+ audio_mixed_mp3: Record<string, never>;
+ retention: { type: 'timed'; hours: number };
+};
+
+// Recall only produces artifacts declared at bot creation; both gate COMPLETED.
+export const getRecallBotRecordingConfig = (): RecallBotRecordingConfig => {
+ const configuredRecordingRetentionHours = getApplicationVariableValue(
+ COMPANION_RECORDING_RETENTION_HOURS_ENV_VAR_NAME,
+ );
+
+ const recordingRetentionHours = isNonEmptyString(
+ configuredRecordingRetentionHours,
+ )
+ ? Number(configuredRecordingRetentionHours.trim())
+ : NaN;
+
+ const resolvedRecordingRetentionHours =
+ Number.isInteger(recordingRetentionHours) && recordingRetentionHours > 0
+ ? recordingRetentionHours
+ : DEFAULT_COMPANION_RECORDING_RETENTION_HOURS;
+
+ return {
+ video_mixed_mp4: {},
+ audio_mixed_mp3: {},
+ retention: { type: 'timed', hours: resolvedRecordingRetentionHours },
+ };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-region-env-var-name.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-region-env-var-name.ts
new file mode 100644
index 00000000000..31c9a29523e
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-region-env-var-name.ts
@@ -0,0 +1 @@
+export const RECALL_REGION_ENV_VAR_NAME = 'RECALL_REGION';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-webhook-secret-env-var-name.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-webhook-secret-env-var-name.ts
new file mode 100644
index 00000000000..520dfd2ff17
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-webhook-secret-env-var-name.ts
@@ -0,0 +1 @@
+export const RECALL_WEBHOOK_SECRET_ENV_VAR_NAME = 'RECALL_WEBHOOK_SECRET';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/restricted-field-placeholder.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/restricted-field-placeholder.ts
new file mode 100644
index 00000000000..80388082c8a
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/restricted-field-placeholder.ts
@@ -0,0 +1,3 @@
+// Mirrors twenty-shared; calendar restrictions write it over title/description.
+export const RESTRICTED_FIELD_PLACEHOLDER =
+ 'FIELD_RESTRICTED_ADDITIONAL_PERMISSIONS_REQUIRED';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/supported-meeting-platform-url-patterns.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/supported-meeting-platform-url-patterns.ts
new file mode 100644
index 00000000000..8db550a0b64
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/supported-meeting-platform-url-patterns.ts
@@ -0,0 +1,12 @@
+// Meeting platforms a Recall bot can join. Anything else (Around, Whereby,
+// ro.am, Daily, plain dial-in, etc.) cannot be recorded and is ignored.
+// See https://docs.recall.ai/docs/meeting-platforms
+// Ordered by provider precedence: the first matching provider wins (e.g. a
+// pasted Zoom invitation beats an auto-added Meet link).
+export const SUPPORTED_MEETING_PLATFORM_URL_PATTERNS: RegExp[] = [
+ /https:\/\/(?:[\w-]+\.)*(?:zoom\.us|zoomgov\.com)\/(?:j|my|s|w|wc\/join)\/[^\s"'<>\\]+/i,
+ /https:\/\/meet\.google\.com\/[^\s"'<>\\]+/i,
+ /https:\/\/teams\.(?:microsoft|live)\.com\/(?:l\/meetup-join|meet)\/[^\s"'<>\\]+/i,
+ /https:\/\/(?:[\w-]+\.)*webex\.com\/(?:meet\/|join\/|[\w-]+\/j\.php\?)[^\s"'<>\\]+/i,
+ /https:\/\/(?:[\w-]+\.)*(?:gotomeeting\.com\/join|gotomeet\.me)\/[^\s"'<>\\]+/i,
+];
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/twenty-page-size.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/twenty-page-size.ts
new file mode 100644
index 00000000000..51637dc13dc
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/twenty-page-size.ts
@@ -0,0 +1 @@
+export const TWENTY_PAGE_SIZE = 100;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/unavailable-call-recording-statuses.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/unavailable-call-recording-statuses.ts
new file mode 100644
index 00000000000..1bee6e85211
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/unavailable-call-recording-statuses.ts
@@ -0,0 +1,6 @@
+import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+
+export const UNAVAILABLE_CALL_RECORDING_STATUSES: readonly string[] = [
+ CallRecordingStatus.FAILED,
+ CallRecordingStatus.NOT_RECORDED,
+];
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/claim-call-recording-artifacts-import.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/claim-call-recording-artifacts-import.test.ts
new file mode 100644
index 00000000000..7615b8d2c80
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/claim-call-recording-artifacts-import.test.ts
@@ -0,0 +1,119 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import {
+ claimCallRecordingArtifactsImport,
+ releaseCallRecordingArtifactsImportClaim,
+} from 'src/logic-functions/data/claim-call-recording-artifacts-import.util';
+
+const mutationMock = vi.fn();
+
+const client = { mutation: mutationMock };
+
+describe('claimCallRecordingArtifactsImport', () => {
+ beforeEach(() => {
+ mutationMock.mockReset();
+ });
+
+ it('claims when no fresh lease is held and stamps the lease timestamp', async () => {
+ mutationMock.mockResolvedValue({
+ updateCallRecordings: [{ id: 'call-recording-1' }],
+ });
+
+ const claimed = await claimCallRecordingArtifactsImport(client, {
+ callRecordingId: 'call-recording-1',
+ now: new Date('2026-01-01T14:06:00.000Z'),
+ });
+
+ expect(claimed).toBe(true);
+ expect(mutationMock).toHaveBeenCalledWith({
+ updateCallRecordings: {
+ __args: {
+ filter: {
+ id: { eq: 'call-recording-1' },
+ or: [
+ { companionImportClaimedAt: { is: 'NULL' } },
+ { companionImportClaimedAt: { lte: '2026-01-01T13:56:00.000Z' } },
+ ],
+ },
+ data: { companionImportClaimedAt: '2026-01-01T14:06:00.000Z' },
+ },
+ id: true,
+ },
+ });
+ });
+
+ it('does not claim when a fresh lease already blocks the update', async () => {
+ mutationMock.mockResolvedValue({ updateCallRecordings: [] });
+
+ const claimed = await claimCallRecordingArtifactsImport(client, {
+ callRecordingId: 'call-recording-1',
+ now: new Date('2026-01-01T14:06:00.000Z'),
+ });
+
+ expect(claimed).toBe(false);
+ });
+
+ it('reclaims a lease older than the TTL', async () => {
+ // Emulate the DB-side filter so the lte staleBefore branch and TTL math are exercised.
+ const storedClaimedAt = '2026-01-01T13:45:00.000Z'; // 21 minutes before now
+ mutationMock.mockImplementation(async (mutation: any) => {
+ const { filter } = mutation.updateCallRecordings.__args;
+ const staleBefore = filter.or[1].companionImportClaimedAt.lte;
+ const matches = storedClaimedAt <= staleBefore;
+
+ return { updateCallRecordings: matches ? [{ id: filter.id.eq }] : [] };
+ });
+
+ const claimed = await claimCallRecordingArtifactsImport(client, {
+ callRecordingId: 'call-recording-1',
+ now: new Date('2026-01-01T14:06:00.000Z'),
+ });
+
+ expect(claimed).toBe(true);
+ expect(
+ mutationMock.mock.calls[0][0].updateCallRecordings.__args.data,
+ ).toEqual({ companionImportClaimedAt: '2026-01-01T14:06:00.000Z' });
+ });
+
+ it('does not reclaim a lease still within the TTL', async () => {
+ const storedClaimedAt = '2026-01-01T14:02:00.000Z'; // 4 minutes before now
+ mutationMock.mockImplementation(async (mutation: any) => {
+ const { filter } = mutation.updateCallRecordings.__args;
+ const staleBefore = filter.or[1].companionImportClaimedAt.lte;
+ const matches = storedClaimedAt <= staleBefore;
+
+ return { updateCallRecordings: matches ? [{ id: filter.id.eq }] : [] };
+ });
+
+ const claimed = await claimCallRecordingArtifactsImport(client, {
+ callRecordingId: 'call-recording-1',
+ now: new Date('2026-01-01T14:06:00.000Z'),
+ });
+
+ expect(claimed).toBe(false);
+ });
+
+ it('releases only the lease acquired by this worker', async () => {
+ mutationMock.mockResolvedValue({
+ updateCallRecording: { id: 'call-recording-1' },
+ });
+
+ await releaseCallRecordingArtifactsImportClaim(client, {
+ callRecordingId: 'call-recording-1',
+ claimedAt: new Date('2026-01-01T14:00:00Z'),
+ });
+
+ expect(mutationMock).toHaveBeenCalledWith({
+ updateCallRecordings: {
+ __args: {
+ filter: {
+ id: { eq: 'call-recording-1' },
+ companionImportClaimedAt: { eq: '2026-01-01T14:00:00.000Z' },
+ },
+ data: { companionImportClaimedAt: null },
+ },
+ id: true,
+ },
+ });
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/complete-call-recording-import.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/complete-call-recording-import.test.ts
new file mode 100644
index 00000000000..11a5ab8a8d1
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/complete-call-recording-import.test.ts
@@ -0,0 +1,61 @@
+import { describe, expect, it, vi } from 'vitest';
+
+import { completeCallRecordingImport } from 'src/logic-functions/data/complete-call-recording-import.util';
+
+describe('completeCallRecordingImport', () => {
+ it('guards the flip with non-terminal statuses and returns true when the row is claimed', async () => {
+ const mutation = vi
+ .fn()
+ .mockResolvedValue({
+ updateCallRecordings: [{ id: 'call-recording-1' }],
+ });
+
+ const claimed = await completeCallRecordingImport(
+ { mutation },
+ {
+ id: 'call-recording-1',
+ },
+ );
+
+ expect(claimed).toBe(true);
+ expect(mutation).toHaveBeenCalledTimes(1);
+ expect(mutation).toHaveBeenCalledWith({
+ updateCallRecordings: {
+ __args: {
+ filter: {
+ id: { eq: 'call-recording-1' },
+ status: { in: ['SCHEDULED', 'JOINING', 'RECORDING', 'PROCESSING'] },
+ },
+ data: { status: 'COMPLETED' },
+ },
+ id: true,
+ },
+ });
+ });
+
+ it('returns false when the row was already COMPLETED', async () => {
+ const mutation = vi.fn().mockResolvedValue({ updateCallRecordings: [] });
+
+ const claimed = await completeCallRecordingImport(
+ { mutation },
+ {
+ id: 'call-recording-1',
+ },
+ );
+
+ expect(claimed).toBe(false);
+ });
+
+ it('returns false when the API omits the result list', async () => {
+ const mutation = vi.fn().mockResolvedValue({});
+
+ const claimed = await completeCallRecordingImport(
+ { mutation },
+ {
+ id: 'call-recording-1',
+ },
+ );
+
+ expect(claimed).toBe(false);
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/enqueue-call-recording-artifacts-import.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/enqueue-call-recording-artifacts-import.test.ts
new file mode 100644
index 00000000000..89dbacd1fc6
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/enqueue-call-recording-artifacts-import.test.ts
@@ -0,0 +1,46 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { ENQUEUED_JOB_RETRY_LIMIT } from 'src/logic-functions/constants/enqueued-job-retry-limit';
+import { enqueueCallRecordingArtifactsImport } from 'src/logic-functions/data/enqueue-call-recording-artifacts-import.util';
+
+const enqueueJobsMock = vi.hoisted(() => vi.fn());
+
+vi.mock('twenty-sdk/logic-function', () => ({
+ enqueueJobs: enqueueJobsMock,
+}));
+
+describe('enqueueCallRecordingArtifactsImport', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ enqueueJobsMock.mockResolvedValue({ enqueued: true, enqueuedJobsCount: 1 });
+ });
+
+ it('enqueues one import job with a fresh request timestamp', async () => {
+ await enqueueCallRecordingArtifactsImport({
+ callRecordingId: 'call-recording-1',
+ });
+
+ expect(enqueueJobsMock).toHaveBeenCalledExactlyOnceWith({
+ logicFunctionUniversalIdentifier:
+ IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
+ payloads: [
+ {
+ callRecordingId: 'call-recording-1',
+ requestedAt: expect.any(String),
+ },
+ ],
+ retryLimit: ENQUEUED_JOB_RETRY_LIMIT,
+ });
+ });
+
+ it('propagates enqueue failures to the caller', async () => {
+ enqueueJobsMock.mockRejectedValue(new Error('Network failed'));
+
+ await expect(
+ enqueueCallRecordingArtifactsImport({
+ callRecordingId: 'call-recording-1',
+ }),
+ ).rejects.toThrow('Network failed');
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/enqueue-logic-function-jobs.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/enqueue-logic-function-jobs.test.ts
new file mode 100644
index 00000000000..bcc7451acd5
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/enqueue-logic-function-jobs.test.ts
@@ -0,0 +1,75 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { ENQUEUED_JOB_RETRY_LIMIT } from 'src/logic-functions/constants/enqueued-job-retry-limit';
+import { MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL } from 'src/logic-functions/constants/max-payloads-per-enqueue-jobs-call';
+import { enqueueLogicFunctionJobs } from 'src/logic-functions/data/enqueue-logic-function-jobs.util';
+
+const enqueueJobsMock = vi.hoisted(() => vi.fn());
+
+vi.mock('twenty-sdk/logic-function', () => ({
+ enqueueJobs: enqueueJobsMock,
+}));
+
+const TARGET_UNIVERSAL_IDENTIFIER = '5a2f4d2a-1a1e-4c66-8a54-1f0a2b3c4d5e';
+
+describe('enqueueLogicFunctionJobs', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ enqueueJobsMock.mockImplementation(async ({ payloads }) => ({
+ enqueued: true,
+ enqueuedJobsCount: payloads.length,
+ }));
+ });
+
+ it('enqueues a small payload list in a single call', async () => {
+ await enqueueLogicFunctionJobs({
+ logicFunctionUniversalIdentifier: TARGET_UNIVERSAL_IDENTIFIER,
+ payloads: [{ batchIndex: 0 }, { batchIndex: 1 }],
+ });
+
+ expect(enqueueJobsMock).toHaveBeenCalledExactlyOnceWith({
+ logicFunctionUniversalIdentifier: TARGET_UNIVERSAL_IDENTIFIER,
+ payloads: [{ batchIndex: 0 }, { batchIndex: 1 }],
+ retryLimit: ENQUEUED_JOB_RETRY_LIMIT,
+ });
+ });
+
+ it('splits payload lists above the mutation cap into multiple calls', async () => {
+ const payloads = Array.from(
+ { length: MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL + 1 },
+ (_, payloadIndex) => ({ payloadIndex }),
+ );
+
+ await enqueueLogicFunctionJobs({
+ logicFunctionUniversalIdentifier: TARGET_UNIVERSAL_IDENTIFIER,
+ payloads,
+ });
+
+ expect(enqueueJobsMock).toHaveBeenCalledTimes(2);
+ expect(enqueueJobsMock.mock.calls[0][0].payloads).toHaveLength(
+ MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL,
+ );
+ expect(enqueueJobsMock.mock.calls[1][0].payloads).toEqual([
+ { payloadIndex: MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL },
+ ]);
+ });
+
+ it('stops at the first failed chunk', async () => {
+ const payloads = Array.from(
+ { length: MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL * 2 },
+ (_, payloadIndex) => ({ payloadIndex }),
+ );
+
+ enqueueJobsMock
+ .mockResolvedValueOnce({ enqueued: true })
+ .mockRejectedValueOnce(new Error('Network failed'));
+
+ await expect(
+ enqueueLogicFunctionJobs({
+ logicFunctionUniversalIdentifier: TARGET_UNIVERSAL_IDENTIFIER,
+ payloads,
+ }),
+ ).rejects.toThrow('Network failed');
+ expect(enqueueJobsMock).toHaveBeenCalledTimes(2);
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/fetch-all-nodes.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/fetch-all-nodes.test.ts
new file mode 100644
index 00000000000..ea33f725c18
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/fetch-all-nodes.test.ts
@@ -0,0 +1,81 @@
+import { describe, expect, it, vi } from 'vitest';
+
+import { fetchAllNodes } from 'src/logic-functions/data/fetch-all-nodes.util';
+
+describe('fetchAllNodes', () => {
+ it('collects nodes across pages until hasNextPage is false', async () => {
+ const fetchPage = vi
+ .fn()
+ .mockResolvedValueOnce({
+ pageInfo: { hasNextPage: true, endCursor: 'cursor-1' },
+ edges: [{ node: 'node-1' }, { node: 'node-2' }],
+ })
+ .mockResolvedValueOnce({
+ pageInfo: { hasNextPage: false, endCursor: 'cursor-2' },
+ edges: [{ node: 'node-3' }],
+ });
+
+ const nodes = await fetchAllNodes<string>(fetchPage);
+
+ expect(nodes).toEqual(['node-1', 'node-2', 'node-3']);
+ expect(fetchPage).toHaveBeenNthCalledWith(1, undefined);
+ expect(fetchPage).toHaveBeenNthCalledWith(2, 'cursor-1');
+ });
+
+ it('throws when hasNextPage is true without an endCursor', async () => {
+ const fetchPage = vi.fn().mockResolvedValue({
+ pageInfo: { hasNextPage: true, endCursor: null },
+ edges: [{ node: 'node-1' }],
+ });
+
+ await expect(fetchAllNodes<string>(fetchPage)).rejects.toThrow(
+ 'Inconsistent pagination state: hasNextPage is true without an endCursor',
+ );
+ });
+
+ it('throws when the query returns no connection', async () => {
+ const fetchPage = vi.fn().mockResolvedValue(undefined);
+
+ await expect(fetchAllNodes<string>(fetchPage)).rejects.toThrow(
+ 'Pagination query returned no connection',
+ );
+ });
+
+ it('stops starting page requests when the request policy closes', async () => {
+ const fetchPage = vi.fn().mockResolvedValue({
+ pageInfo: { hasNextPage: true, endCursor: 'cursor-1' },
+ edges: [{ node: 'node-1' }],
+ });
+ const shouldStartPageRequest = vi
+ .fn()
+ .mockReturnValueOnce(true)
+ .mockReturnValueOnce(false);
+
+ const nodes = await fetchAllNodes<string>(
+ fetchPage,
+ shouldStartPageRequest,
+ );
+
+ expect(nodes).toEqual(['node-1']);
+ expect(fetchPage).toHaveBeenCalledTimes(1);
+ });
+});
+
+it('rejects repeated cursors before issuing an unbounded sequence', async () => {
+ const fetchPage = vi.fn().mockResolvedValue({
+ edges: [],
+ pageInfo: { hasNextPage: true, endCursor: 'same' },
+ });
+ await expect(fetchAllNodes(fetchPage)).rejects.toThrow('did not advance');
+ expect(fetchPage).toHaveBeenCalledTimes(2);
+});
+
+it('bounds even a consistently advancing cursor', async () => {
+ let page = 0;
+ const fetchPage = vi.fn(async () => ({
+ edges: [],
+ pageInfo: { hasNextPage: true, endCursor: String(++page) },
+ }));
+ await expect(fetchAllNodes(fetchPage)).rejects.toThrow('20 pages');
+ expect(fetchPage).toHaveBeenCalledTimes(20);
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/find-call-recording-for-summary.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/find-call-recording-for-summary.test.ts
new file mode 100644
index 00000000000..a436386df95
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/find-call-recording-for-summary.test.ts
@@ -0,0 +1,30 @@
+import { describe, expect, it, vi } from 'vitest';
+
+import { findCallRecordingForSummary } from 'src/logic-functions/data/find-call-recording-for-summary.util';
+
+describe('findCallRecordingForSummary', () => {
+ it('treats blank summary markdown as missing', async () => {
+ const query = vi.fn().mockResolvedValue({
+ callRecordings: {
+ edges: [
+ {
+ node: {
+ id: 'call-recording-1',
+ title: 'Weekly sync',
+ transcript: [],
+ summary: { markdown: '' },
+ createdBy: { source: 'APPLICATION', name: 'Desktop Recorder' },
+ },
+ },
+ ],
+ },
+ });
+
+ const callRecording = await findCallRecordingForSummary(
+ { query },
+ { id: 'call-recording-1' },
+ );
+
+ expect(callRecording?.summaryMarkdown).toBeUndefined();
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/get-current-workspace-id.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/get-current-workspace-id.test.ts
new file mode 100644
index 00000000000..b27e3a76579
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/get-current-workspace-id.test.ts
@@ -0,0 +1,38 @@
+import { afterEach, describe, expect, it } from 'vitest';
+
+import { getCurrentWorkspaceId } from 'src/logic-functions/data/get-current-workspace-id.util';
+
+const APP_ACCESS_TOKEN_ENV_VAR_NAME = 'TWENTY_APP_ACCESS_TOKEN';
+const ORIGINAL_APP_ACCESS_TOKEN = process.env[APP_ACCESS_TOKEN_ENV_VAR_NAME];
+const WORKSPACE_ID = '123e4567-e89b-12d3-a456-426614174000';
+
+const restoreOriginalAppAccessToken = () => {
+ if (ORIGINAL_APP_ACCESS_TOKEN === undefined) {
+ delete process.env[APP_ACCESS_TOKEN_ENV_VAR_NAME];
+
+ return;
+ }
+
+ process.env[APP_ACCESS_TOKEN_ENV_VAR_NAME] = ORIGINAL_APP_ACCESS_TOKEN;
+};
+
+const buildAccessToken = (payload: Record<string, unknown>): string =>
+ [
+ Buffer.from(JSON.stringify({ alg: 'none' })).toString('base64url'),
+ Buffer.from(JSON.stringify(payload)).toString('base64url'),
+ 'signature',
+ ].join('.');
+
+describe('getCurrentWorkspaceId', () => {
+ afterEach(() => {
+ restoreOriginalAppAccessToken();
+ });
+
+ it('reads the workspace id from the app access token payload', () => {
+ process.env[APP_ACCESS_TOKEN_ENV_VAR_NAME] = buildAccessToken({
+ workspaceId: WORKSPACE_ID,
+ });
+
+ expect(getCurrentWorkspaceId()).toBe(WORKSPACE_ID);
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/strip-restricted-field-value.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/strip-restricted-field-value.test.ts
new file mode 100644
index 00000000000..27bc08f2f9a
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/strip-restricted-field-value.test.ts
@@ -0,0 +1,22 @@
+import { describe, expect, it } from 'vitest';
+
+import { RESTRICTED_FIELD_PLACEHOLDER } from 'src/logic-functions/constants/restricted-field-placeholder';
+import { stripRestrictedFieldValue } from 'src/logic-functions/data/strip-restricted-field-value.util';
+
+describe('stripRestrictedFieldValue', () => {
+ it('drops the calendar visibility restriction placeholder', () => {
+ expect(
+ stripRestrictedFieldValue(RESTRICTED_FIELD_PLACEHOLDER),
+ ).toBeUndefined();
+ });
+
+ it('keeps regular values', () => {
+ expect(stripRestrictedFieldValue('Customer Discovery Call')).toBe(
+ 'Customer Discovery Call',
+ );
+ });
+
+ it('keeps undefined', () => {
+ expect(stripRestrictedFieldValue(undefined)).toBeUndefined();
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/claim-call-recording-artifacts-import.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/claim-call-recording-artifacts-import.util.ts
new file mode 100644
index 00000000000..dfb6240aa0b
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/claim-call-recording-artifacts-import.util.ts
@@ -0,0 +1,59 @@
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+// Crash safety net: a lease older than this is reclaimable so a worker that died
+// mid-import never blocks the recording forever. Normal runs release explicitly.
+const ARTIFACTS_IMPORT_CLAIM_TTL_MS = 10 * 60 * 1000;
+
+// Atomic per-recording lease. The conditional update matches only when no fresh
+// lease is held, so exactly one of several concurrent webhook retries claims the
+// import and performs the provider-facing work.
+export const claimCallRecordingArtifactsImport = async (
+ client: Pick<CoreApiClient, 'mutation'>,
+ {
+ callRecordingId,
+ now,
+ }: {
+ callRecordingId: string;
+ now: Date;
+ },
+): Promise<boolean> => {
+ const staleBefore = new Date(
+ now.getTime() - ARTIFACTS_IMPORT_CLAIM_TTL_MS,
+ ).toISOString();
+
+ const result = await client.mutation({
+ updateCallRecordings: {
+ __args: {
+ filter: {
+ id: { eq: callRecordingId },
+ or: [
+ { companionImportClaimedAt: { is: 'NULL' } },
+ { companionImportClaimedAt: { lte: staleBefore } },
+ ],
+ },
+ data: { companionImportClaimedAt: now.toISOString() },
+ },
+ id: true,
+ },
+ });
+
+ return (result.updateCallRecordings ?? []).length > 0;
+};
+
+export const releaseCallRecordingArtifactsImportClaim = async (
+ client: Pick<CoreApiClient, 'mutation'>,
+ { callRecordingId, claimedAt }: { callRecordingId: string; claimedAt: Date },
+): Promise<void> => {
+ await client.mutation({
+ updateCallRecordings: {
+ __args: {
+ filter: {
+ id: { eq: callRecordingId },
+ companionImportClaimedAt: { eq: claimedAt.toISOString() },
+ },
+ data: { companionImportClaimedAt: null },
+ },
+ id: true,
+ },
+ });
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/complete-call-recording-import.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/complete-call-recording-import.util.ts
new file mode 100644
index 00000000000..00e584957ad
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/complete-call-recording-import.util.ts
@@ -0,0 +1,26 @@
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { NON_TERMINAL_CALL_RECORDING_STATUSES } from 'src/logic-functions/constants/non-terminal-call-recording-statuses';
+
+export const completeCallRecordingImport = async (
+ client: Pick<CoreApiClient, 'mutation'>,
+ { id }: { id: string },
+): Promise<boolean> => {
+ const result = await client.mutation({
+ updateCallRecordings: {
+ __args: {
+ filter: {
+ id: { eq: id },
+ status: { in: NON_TERMINAL_CALL_RECORDING_STATUSES },
+ },
+ data: {
+ status: CallRecordingStatus.COMPLETED,
+ },
+ },
+ id: true,
+ },
+ });
+
+ return (result.updateCallRecordings ?? []).length > 0;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/enqueue-call-recording-artifacts-import.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/enqueue-call-recording-artifacts-import.util.ts
new file mode 100644
index 00000000000..972fb284f35
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/enqueue-call-recording-artifacts-import.util.ts
@@ -0,0 +1,14 @@
+import { IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { enqueueLogicFunctionJobs } from 'src/logic-functions/data/enqueue-logic-function-jobs.util';
+
+export const enqueueCallRecordingArtifactsImport = async ({
+ callRecordingId,
+}: {
+ callRecordingId: string;
+}): Promise<void> => {
+ await enqueueLogicFunctionJobs({
+ logicFunctionUniversalIdentifier:
+ IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
+ payloads: [{ callRecordingId, requestedAt: new Date().toISOString() }],
+ });
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/enqueue-logic-function-jobs.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/enqueue-logic-function-jobs.util.ts
new file mode 100644
index 00000000000..a2ad6d98c70
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/enqueue-logic-function-jobs.util.ts
@@ -0,0 +1,28 @@
+import { enqueueJobs } from 'twenty-sdk/logic-function';
+
+import { ENQUEUED_JOB_RETRY_LIMIT } from 'src/logic-functions/constants/enqueued-job-retry-limit';
+import { MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL } from 'src/logic-functions/constants/max-payloads-per-enqueue-jobs-call';
+import { getBatches } from 'src/logic-functions/utils/get-batches.util';
+
+const MAX_ENQUEUE_PAYLOADS = 1_000;
+
+export const enqueueLogicFunctionJobs = async ({
+ logicFunctionUniversalIdentifier,
+ payloads,
+}: {
+ logicFunctionUniversalIdentifier: string;
+ payloads: Record<string, unknown>[];
+}): Promise<void> => {
+ if (payloads.length > MAX_ENQUEUE_PAYLOADS)
+ throw new Error('Cannot enqueue more than 1000 jobs at once.');
+ for (const payloadChunk of getBatches(
+ payloads,
+ MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL,
+ )) {
+ await enqueueJobs({
+ logicFunctionUniversalIdentifier,
+ payloads: payloadChunk,
+ retryLimit: ENQUEUED_JOB_RETRY_LIMIT,
+ });
+ }
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/fetch-all-nodes.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/fetch-all-nodes.util.ts
new file mode 100644
index 00000000000..26499daec9d
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/fetch-all-nodes.util.ts
@@ -0,0 +1,56 @@
+import { isString, isUndefined } from '@sniptt/guards';
+
+const MAX_PAGINATION_PAGES = 20;
+
+export type ConnectionPage<TNode> = {
+ pageInfo?: {
+ hasNextPage?: boolean | null;
+ endCursor?: string | null;
+ } | null;
+ edges?: Array<{ node: TNode }> | null;
+};
+
+export const fetchAllNodes = async <TNode>(
+ fetchPage: (
+ afterCursor: string | undefined,
+ ) => Promise<ConnectionPage<TNode> | undefined>,
+ shouldStartPageRequest: () => boolean = () => true,
+): Promise<TNode[]> => {
+ const nodes: TNode[] = [];
+ const cursors = new Set<string>();
+ let pages = 0;
+ let hasNextPage = true;
+ let afterCursor: string | undefined;
+
+ while (hasNextPage && shouldStartPageRequest()) {
+ if (++pages > MAX_PAGINATION_PAGES)
+ throw new Error('Pagination exceeded 20 pages; narrow the query.');
+ const connection = await fetchPage(afterCursor);
+
+ if (isUndefined(connection)) {
+ throw new Error('Pagination query returned no connection');
+ }
+
+ for (const edge of connection.edges ?? []) {
+ nodes.push(edge.node);
+ }
+
+ hasNextPage = connection.pageInfo?.hasNextPage === true;
+ const endCursor = connection.pageInfo?.endCursor;
+
+ if (hasNextPage && !isString(endCursor)) {
+ throw new Error(
+ 'Inconsistent pagination state: hasNextPage is true without an endCursor',
+ );
+ }
+
+ if (hasNextPage && isString(endCursor)) {
+ if (!endCursor || cursors.has(endCursor))
+ throw new Error('Pagination cursor did not advance');
+ cursors.add(endCursor);
+ }
+ afterCursor = isString(endCursor) ? endCursor : undefined;
+ }
+
+ return nodes;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/fetch-calendar-events-by-filter.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/fetch-calendar-events-by-filter.util.ts
new file mode 100644
index 00000000000..47a13d00180
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/fetch-calendar-events-by-filter.util.ts
@@ -0,0 +1,81 @@
+import { isUndefined } from '@sniptt/guards';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+import { TWENTY_PAGE_SIZE } from 'src/logic-functions/constants/twenty-page-size';
+import { type CalendarEventRecord } from 'src/logic-functions/types/calendar-event-record.type';
+import {
+ fetchAllNodes,
+ type ConnectionPage,
+} from 'src/logic-functions/data/fetch-all-nodes.util';
+import { resolveConferenceLinkUrl } from 'src/logic-functions/domain/resolve-conference-link-url.util';
+import { stripRestrictedFieldValue } from 'src/logic-functions/data/strip-restricted-field-value.util';
+
+type CalendarEventNode = {
+ id: string;
+ title?: string | null;
+ isCanceled?: boolean | null;
+ startsAt?: string | null;
+ endsAt?: string | null;
+ iCalUid?: string | null;
+ conferenceLink?: { primaryLinkUrl?: string | null } | null;
+ location?: string | null;
+ description?: string | null;
+};
+
+export const fetchCalendarEventsByFilter = async (
+ client: CoreApiClient,
+ filter: Record<string, unknown>,
+): Promise<CalendarEventRecord[]> => {
+ const calendarEventNodes = await fetchAllNodes<CalendarEventNode>(
+ async (afterCursor) => {
+ const queryResult = await client.query({
+ calendarEvents: {
+ __args: {
+ filter,
+ first: TWENTY_PAGE_SIZE,
+ ...(isUndefined(afterCursor) ? {} : { after: afterCursor }),
+ },
+ pageInfo: {
+ hasNextPage: true,
+ endCursor: true,
+ },
+ edges: {
+ node: {
+ id: true,
+ title: true,
+ isCanceled: true,
+ startsAt: true,
+ endsAt: true,
+ iCalUid: true,
+ conferenceLink: {
+ primaryLinkUrl: true,
+ },
+ location: true,
+ description: true,
+ },
+ },
+ },
+ });
+
+ return queryResult.calendarEvents as
+ | ConnectionPage<CalendarEventNode>
+ | undefined;
+ },
+ );
+
+ return calendarEventNodes.map((calendarEvent) => ({
+ id: calendarEvent.id,
+ title: stripRestrictedFieldValue(calendarEvent.title ?? undefined),
+ isCanceled: calendarEvent.isCanceled ?? false,
+ startsAt: calendarEvent.startsAt ?? undefined,
+ endsAt: calendarEvent.endsAt ?? undefined,
+ iCalUid: calendarEvent.iCalUid ?? undefined,
+ conferenceLinkUrl: resolveConferenceLinkUrl({
+ conferenceLinkUrl: calendarEvent.conferenceLink?.primaryLinkUrl,
+ location: stripRestrictedFieldValue(calendarEvent.location ?? undefined),
+ description: stripRestrictedFieldValue(
+ calendarEvent.description ?? undefined,
+ ),
+ }),
+ }));
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/find-call-recording-for-summary.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/find-call-recording-for-summary.util.ts
new file mode 100644
index 00000000000..56fb1d90b7b
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/find-call-recording-for-summary.util.ts
@@ -0,0 +1,62 @@
+import { isNull, isUndefined } from '@sniptt/guards';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+import { getString } from 'src/logic-functions/utils/get-string.util';
+
+type CallRecordingForSummary = {
+ id: string;
+ title: string | undefined;
+ transcript: unknown;
+ companionSession: unknown;
+ summaryMarkdown: string | undefined;
+ storedSummaryMarkdown: string | undefined;
+ createdBy: { source: string | undefined; name: string | undefined };
+};
+
+export const findCallRecordingForSummary = async (
+ client: Pick<CoreApiClient, 'query'>,
+ { id }: { id: string },
+): Promise<CallRecordingForSummary | undefined> => {
+ const queryResult = await client.query({
+ callRecordings: {
+ __args: {
+ filter: { id: { eq: id } },
+ first: 1,
+ },
+ edges: {
+ node: {
+ id: true,
+ title: true,
+ transcript: true,
+ companionSession: true,
+ summary: { markdown: true },
+ createdBy: { source: true, name: true },
+ },
+ },
+ },
+ });
+
+ const node = queryResult.callRecordings?.edges?.[0]?.node;
+
+ if (isUndefined(node) || isNull(node)) {
+ return undefined;
+ }
+
+ return {
+ id: node.id,
+ title: getString(node.title),
+ transcript: node.transcript ?? undefined,
+ companionSession: node.companionSession,
+ // Blank summaries are not usable; normalize them as missing so generation
+ // can repair blank summary records.
+ summaryMarkdown: getString(node.summary?.markdown),
+ storedSummaryMarkdown:
+ typeof node.summary?.markdown === 'string'
+ ? node.summary.markdown
+ : undefined,
+ createdBy: {
+ source: getString(node.createdBy?.source),
+ name: getString(node.createdBy?.name),
+ },
+ };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/find-call-recordings-by-filter.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/find-call-recordings-by-filter.util.ts
new file mode 100644
index 00000000000..b5850af57f3
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/find-call-recordings-by-filter.util.ts
@@ -0,0 +1,112 @@
+import { isUndefined } from '@sniptt/guards';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+import { CallRecordingRequestStatus } from 'src/logic-functions/constants/call-recording-request-status';
+import { TWENTY_PAGE_SIZE } from 'src/logic-functions/constants/twenty-page-size';
+import { type CallRecordingRecord } from 'src/logic-functions/types/call-recording-record.type';
+import {
+ fetchAllNodes,
+ type ConnectionPage,
+} from 'src/logic-functions/data/fetch-all-nodes.util';
+import { normalizeOptionalString } from 'src/logic-functions/utils/normalize-optional-string.util';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
+
+type CallRecordingNode = {
+ id: string;
+ title?: string | null;
+ status?: string | null;
+ recordingRequestStatus?: unknown;
+ createdAt?: string | null;
+ updatedAt?: string | null;
+ startedAt?: string | null;
+ endedAt?: string | null;
+ calendarEventId?: string | null;
+ externalBotId?: string | null;
+ companionSession?: unknown;
+ externalRecordingId?: string | null;
+ companionFailureReason?: string | null;
+};
+
+export const findCallRecordingsByFilter = async (
+ client: CoreApiClient,
+ filter: Record<string, unknown>,
+ shouldStartPageRequest: () => boolean = () => true,
+): Promise<CallRecordingRecord[]> => {
+ const callRecordingNodes = await fetchAllNodes<CallRecordingNode>(
+ async (afterCursor) => {
+ const queryResult = await client.query({
+ callRecordings: {
+ __args: {
+ filter: { and: [filter, { companionSession: { is: 'NOT_NULL' } }] },
+ first: TWENTY_PAGE_SIZE,
+ ...(isUndefined(afterCursor) ? {} : { after: afterCursor }),
+ },
+ pageInfo: {
+ hasNextPage: true,
+ endCursor: true,
+ },
+ edges: {
+ node: {
+ id: true,
+ title: true,
+ status: true,
+ recordingRequestStatus: true,
+ createdAt: true,
+ updatedAt: true,
+ startedAt: true,
+ endedAt: true,
+ calendarEventId: true,
+ externalBotId: true,
+ companionSession: true,
+ externalRecordingId: true,
+ companionFailureReason: true,
+ },
+ },
+ },
+ });
+
+ return queryResult.callRecordings as
+ | ConnectionPage<CallRecordingNode>
+ | undefined;
+ },
+ shouldStartPageRequest,
+ );
+
+ return callRecordingNodes
+ .filter((recording) => isDesktopAudioRecording(recording.companionSession))
+ .map((callRecording) => ({
+ id: callRecording.id,
+ title: callRecording.title ?? undefined,
+ status: callRecording.status ?? undefined,
+ recordingRequestStatus: normalizeCallRecordingRequestStatus(
+ callRecording.recordingRequestStatus,
+ ),
+ createdAt: callRecording.createdAt ?? undefined,
+ updatedAt: callRecording.updatedAt ?? undefined,
+ startedAt: callRecording.startedAt ?? undefined,
+ endedAt: callRecording.endedAt ?? undefined,
+ calendarEventId: callRecording.calendarEventId ?? undefined,
+ externalBotId: normalizeOptionalString(callRecording.externalBotId),
+ companionSession: callRecording.companionSession,
+ externalRecordingId: normalizeOptionalString(
+ callRecording.externalRecordingId,
+ ),
+ companionFailureReason: normalizeOptionalString(
+ callRecording.companionFailureReason,
+ ),
+ }));
+};
+
+const normalizeCallRecordingRequestStatus = (
+ recordingRequestStatus: unknown,
+): CallRecordingRequestStatus | undefined => {
+ if (recordingRequestStatus === CallRecordingRequestStatus.REQUESTED) {
+ return recordingRequestStatus;
+ }
+
+ if (recordingRequestStatus === CallRecordingRequestStatus.CANCELED) {
+ return recordingRequestStatus;
+ }
+
+ return undefined;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/get-current-workspace-id.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/get-current-workspace-id.util.ts
new file mode 100644
index 00000000000..4f0c8922006
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/get-current-workspace-id.util.ts
@@ -0,0 +1,36 @@
+import { isUndefined } from '@sniptt/guards';
+
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { getString } from 'src/logic-functions/utils/get-string.util';
+
+const APP_ACCESS_TOKEN_ENV_VAR_NAME = 'TWENTY_APP_ACCESS_TOKEN';
+
+export const getCurrentWorkspaceId = (): string | undefined => {
+ const accessToken = getString(process.env[APP_ACCESS_TOKEN_ENV_VAR_NAME]);
+
+ if (isUndefined(accessToken)) {
+ return undefined;
+ }
+
+ return getWorkspaceIdFromAccessToken(accessToken);
+};
+
+const getWorkspaceIdFromAccessToken = (
+ accessToken: string,
+): string | undefined => {
+ const encodedPayload = accessToken.split('.')[1];
+
+ if (isUndefined(encodedPayload)) {
+ return undefined;
+ }
+
+ try {
+ const payload = asRecord(
+ JSON.parse(Buffer.from(encodedPayload, 'base64url').toString('utf8')),
+ );
+
+ return getString(payload?.workspaceId);
+ } catch {
+ return undefined;
+ }
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/strip-restricted-field-value.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/strip-restricted-field-value.util.ts
new file mode 100644
index 00000000000..06b4a79a479
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/strip-restricted-field-value.util.ts
@@ -0,0 +1,6 @@
+import { RESTRICTED_FIELD_PLACEHOLDER } from 'src/logic-functions/constants/restricted-field-placeholder';
+
+export const stripRestrictedFieldValue = (
+ value: string | undefined,
+): string | undefined =>
+ value === RESTRICTED_FIELD_PLACEHOLDER ? undefined : value;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/update-call-recording.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/update-call-recording.util.ts
new file mode 100644
index 00000000000..72f823e31cc
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/update-call-recording.util.ts
@@ -0,0 +1,59 @@
+import { isUndefined } from '@sniptt/guards';
+import { type CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+import { type CallRecordingUpdateFields } from 'src/logic-functions/types/call-recording-update-fields.type';
+
+export const updateCallRecording = async (
+ client: CoreApiClient,
+ {
+ id,
+ data,
+ expectedStatuses,
+ expectedSummary,
+ }: {
+ id: string;
+ data: CallRecordingUpdateFields;
+ expectedStatuses?: CallRecordingStatus[];
+ expectedSummary?: { markdown: string | undefined };
+ },
+): Promise<boolean> => {
+ if (!isUndefined(expectedStatuses) || !isUndefined(expectedSummary)) {
+ const result = await client.mutation({
+ updateCallRecordings: {
+ __args: {
+ filter: {
+ id: { eq: id },
+ ...(!isUndefined(expectedStatuses)
+ ? { status: { in: expectedStatuses } }
+ : {}),
+ ...(!isUndefined(expectedSummary)
+ ? !isUndefined(expectedSummary.markdown)
+ ? { summary: { markdown: { eq: expectedSummary.markdown } } }
+ : {
+ or: [
+ { summary: { markdown: { is: 'NULL' as const } } },
+ { summary: { markdown: { eq: '' } } },
+ ],
+ }
+ : {}),
+ },
+ data,
+ },
+ id: true,
+ },
+ });
+ return (result.updateCallRecordings ?? []).length > 0;
+ }
+
+ await client.mutation({
+ updateCallRecording: {
+ __args: {
+ id,
+ data,
+ },
+ id: true,
+ },
+ });
+ return true;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/desktop-companion.ts b/packages/twenty-apps/public/companion/src/logic-functions/desktop-companion.ts
new file mode 100644
index 00000000000..17b7563a920
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/desktop-companion.ts
@@ -0,0 +1,59 @@
+import { CoreApiClient } from 'twenty-client-sdk/core';
+import { defineLogicFunction, type RoutePayload } from 'twenty-sdk/define';
+import { getDesktopCompanionAgenda } from 'src/logic-functions/flows/get-desktop-companion-agenda.util';
+import {
+ createDesktopRecordingUpload,
+ failDesktopRecordingCapture,
+} from 'src/logic-functions/flows/create-desktop-recording-upload.util';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+
+export const desktopCompanionHandler = async (
+ payload: RoutePayload<unknown>,
+): Promise<object> => {
+ if (!payload.userWorkspaceId)
+ throw new Error('Sign in with your Twenty account to use the companion.');
+ const body = asRecord(payload.body);
+ if (!body) throw new Error('Missing companion request.');
+ const userClient = new CoreApiClient({ runAs: 'user' });
+ switch (body.action) {
+ case 'agenda':
+ return getDesktopCompanionAgenda(userClient, payload.userWorkspaceId);
+ case 'configuration': {
+ const config = getRecallApiConfig();
+ if (!config.success)
+ throw new Error(
+ 'Recording is not configured for this workspace. Contact your workspace administrator.',
+ );
+ return { apiUrl: new URL(config.config.baseUrl).origin };
+ }
+ case 'create-upload':
+ return createDesktopRecordingUpload(
+ userClient,
+ payload.userWorkspaceId,
+ body,
+ );
+ case 'capture-failed':
+ return failDesktopRecordingCapture(
+ userClient,
+ payload.userWorkspaceId,
+ body,
+ );
+ default:
+ throw new Error('Unknown companion request.');
+ }
+};
+
+export default defineLogicFunction({
+ universalIdentifier: '4ca4fc91-70f8-4bee-84f2-558053b1224a',
+ name: 'desktop-companion',
+ description:
+ 'Authenticated personal agenda and Recall desktop upload provisioning for Desktop Recorder.',
+ timeoutSeconds: 60,
+ handler: desktopCompanionHandler,
+ httpRouteTriggerSettings: {
+ path: '/companion/desktop',
+ httpMethod: 'POST',
+ isAuthRequired: true,
+ },
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/build-call-recording-summary-prompt.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/build-call-recording-summary-prompt.test.ts
new file mode 100644
index 00000000000..91dbe63dc0d
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/build-call-recording-summary-prompt.test.ts
@@ -0,0 +1,95 @@
+import { describe, expect, it } from 'vitest';
+
+import { buildCallRecordingSummaryPrompt } from 'src/logic-functions/domain/build-call-recording-summary-prompt.util';
+
+const TRANSCRIPT = [
+ {
+ participant: { name: 'Alex' },
+ words: [{ text: 'Hello' }, { text: 'there' }],
+ },
+ {
+ participant: { name: 'Sam' },
+ words: [{ text: 'Hi' }, { text: 'Alex' }],
+ },
+];
+
+describe('buildCallRecordingSummaryPrompt', () => {
+ it('flattens entries into speaker-labelled lines', () => {
+ expect(
+ buildCallRecordingSummaryPrompt({ transcript: TRANSCRIPT }),
+ ).toContain('Transcript:\nAlex: Hello there\nSam: Hi Alex');
+ });
+
+ it('appends the workspace admin instructions when provided', () => {
+ expect(
+ buildCallRecordingSummaryPrompt({
+ transcript: TRANSCRIPT,
+ additionalSummaryPrompt: ' Write short sales notes. ',
+ }),
+ ).toBe(
+ 'Additional instructions from the workspace admin:\nWrite short sales notes.\n\nTranscript:\nAlex: Hello there\nSam: Hi Alex',
+ );
+ });
+
+ it('prefixes a [mm:ss] (or h:mm:ss) timestamp when the entry carries one', () => {
+ expect(
+ buildCallRecordingSummaryPrompt({
+ transcript: [
+ {
+ participant: { name: 'Alex' },
+ words: [
+ { text: 'Hello', start_timestamp: { relative: 5 } },
+ { text: 'there', start_timestamp: { relative: 6 } },
+ ],
+ },
+ {
+ participant: { name: 'Sam' },
+ words: [{ text: 'Later', start_timestamp: { relative: 3725 } }],
+ },
+ ],
+ }),
+ ).toContain('Transcript:\n[0:05] Alex: Hello there\n[1:02:05] Sam: Later');
+ });
+
+ it('includes the meeting title when provided', () => {
+ expect(
+ buildCallRecordingSummaryPrompt({
+ transcript: TRANSCRIPT,
+ title: 'Weekly sync',
+ }),
+ ).toContain(
+ 'Meeting title: Weekly sync\n\nTranscript:\nAlex: Hello there\nSam: Hi Alex',
+ );
+ });
+
+ it('falls back to a placeholder speaker name', () => {
+ expect(
+ buildCallRecordingSummaryPrompt({
+ transcript: [{ participant: {}, words: [{ text: 'Hey' }] }],
+ }),
+ ).toContain('Transcript:\nUnknown speaker: Hey');
+ });
+
+ it('skips entries without usable words', () => {
+ expect(
+ buildCallRecordingSummaryPrompt({
+ transcript: [
+ { participant: { name: 'Alex' }, words: [] },
+ { participant: { name: 'Sam' }, words: [{ text: 'Real' }] },
+ ],
+ }),
+ ).toContain('Transcript:\nSam: Real');
+ });
+
+ it('returns undefined when there is no usable dialogue', () => {
+ expect(buildCallRecordingSummaryPrompt({ transcript: [] })).toBeUndefined();
+ expect(
+ buildCallRecordingSummaryPrompt({ transcript: { status: 'PENDING' } }),
+ ).toBeUndefined();
+ expect(
+ buildCallRecordingSummaryPrompt({
+ transcript: [{ participant: { name: 'A' }, words: [{ text: ' ' }] }],
+ }),
+ ).toBeUndefined();
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/compute-call-recording-charge.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/compute-call-recording-charge.test.ts
new file mode 100644
index 00000000000..7abf925f9e5
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/compute-call-recording-charge.test.ts
@@ -0,0 +1,71 @@
+import { describe, expect, it } from 'vitest';
+
+import { computeCallRecordingCharge } from 'src/logic-functions/domain/compute-call-recording-charge.util';
+
+describe('computeCallRecordingCharge', () => {
+ it('charges one credit for a one-hour recording', () => {
+ expect(
+ computeCallRecordingCharge({
+ startedAt: '2026-06-10T09:00:00.000Z',
+ endedAt: '2026-06-10T10:00:00.000Z',
+ }),
+ ).toEqual({
+ creditsUsedMicro: 1_000_000,
+ quantityMinutes: 60,
+ });
+ });
+
+ it('prorates partial hours by duration', () => {
+ expect(
+ computeCallRecordingCharge({
+ startedAt: '2026-06-10T09:00:00.000Z',
+ endedAt: '2026-06-10T09:45:00.000Z',
+ }),
+ ).toEqual({
+ creditsUsedMicro: 750_000,
+ quantityMinutes: 45,
+ });
+ });
+
+ it('reports at least one minute for very short recordings', () => {
+ expect(
+ computeCallRecordingCharge({
+ startedAt: '2026-06-10T09:00:00.000Z',
+ endedAt: '2026-06-10T09:00:30.000Z',
+ }),
+ ).toEqual({
+ creditsUsedMicro: 8_333,
+ quantityMinutes: 1,
+ });
+ });
+
+ it('returns undefined when either timestamp is missing', () => {
+ expect(
+ computeCallRecordingCharge({
+ startedAt: undefined,
+ endedAt: '2026-06-10T10:00:00.000Z',
+ }),
+ ).toBeUndefined();
+ expect(
+ computeCallRecordingCharge({
+ startedAt: '2026-06-10T09:00:00.000Z',
+ endedAt: undefined,
+ }),
+ ).toBeUndefined();
+ });
+
+ it('returns undefined for non-positive or unparseable durations', () => {
+ expect(
+ computeCallRecordingCharge({
+ startedAt: '2026-06-10T10:00:00.000Z',
+ endedAt: '2026-06-10T09:00:00.000Z',
+ }),
+ ).toBeUndefined();
+ expect(
+ computeCallRecordingCharge({
+ startedAt: 'not-a-date',
+ endedAt: '2026-06-10T10:00:00.000Z',
+ }),
+ ).toBeUndefined();
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/compute-real-meeting-key.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/compute-real-meeting-key.test.ts
new file mode 100644
index 00000000000..940316139e5
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/compute-real-meeting-key.test.ts
@@ -0,0 +1,88 @@
+import { describe, expect, it } from 'vitest';
+
+import { computeRealMeetingKey } from 'src/logic-functions/domain/compute-real-meeting-key.util';
+
+const STARTS_AT = '2026-01-01T13:00:00.000Z';
+
+const buildInput = (
+ overrides: Partial<Parameters<typeof computeRealMeetingKey>[0]> = {},
+) => ({
+ calendarEventId: 'calendar-event-1',
+ conferenceLinkUrl: 'https://meet.example.com/customer-sync',
+ iCalUid: 'calendar-event-uid',
+ startsAt: STARTS_AT,
+ ...overrides,
+});
+
+describe('computeRealMeetingKey', () => {
+ it.each([
+ [
+ 'strips protocol, query, and fragment',
+ 'https://zoom.us/j/123?pwd=abc#section',
+ `link:zoom.us/j/123:${STARTS_AT}`,
+ ],
+ [
+ 'strips www and lowercases',
+ 'HTTPS://WWW.Meet.Example.com/Customer-Sync',
+ `link:meet.example.com/customer-sync:${STARTS_AT}`,
+ ],
+ [
+ 'strips trailing slashes',
+ 'https://meet.example.com/customer-sync///',
+ `link:meet.example.com/customer-sync:${STARTS_AT}`,
+ ],
+ [
+ 'supports plain http links',
+ 'http://meet.example.com/customer-sync',
+ `link:meet.example.com/customer-sync:${STARTS_AT}`,
+ ],
+ ])('%s', (_label, conferenceLinkUrl, expectedKey) => {
+ expect(computeRealMeetingKey(buildInput({ conferenceLinkUrl }))).toBe(
+ expectedKey,
+ );
+ });
+
+ it('produces the same key for the same meeting synced from two calendars', () => {
+ const fromFirstAttendee = computeRealMeetingKey(
+ buildInput({
+ calendarEventId: 'calendar-event-1',
+ conferenceLinkUrl: 'https://zoom.us/j/123?pwd=first-attendee-token',
+ }),
+ );
+ const fromSecondAttendee = computeRealMeetingKey(
+ buildInput({
+ calendarEventId: 'calendar-event-2',
+ conferenceLinkUrl:
+ 'https://www.zoom.us/j/123?pwd=second-attendee-token',
+ }),
+ );
+
+ expect(fromFirstAttendee).toBe(fromSecondAttendee);
+ });
+
+ it('falls back to the iCal uid when the link is blank', () => {
+ expect(
+ computeRealMeetingKey(buildInput({ conferenceLinkUrl: ' ' })),
+ ).toBe(`ical:calendar-event-uid:${STARTS_AT}`);
+ });
+
+ it('falls back to the iCal uid when the link is not a string', () => {
+ expect(computeRealMeetingKey(buildInput({ conferenceLinkUrl: 42 }))).toBe(
+ `ical:calendar-event-uid:${STARTS_AT}`,
+ );
+ });
+
+ it('falls back to the calendar event id when link and iCal uid are missing', () => {
+ expect(
+ computeRealMeetingKey(
+ buildInput({ conferenceLinkUrl: undefined, iCalUid: '' }),
+ ),
+ ).toBe('event:calendar-event-1');
+ });
+
+ it('keeps link keys distinct across start times', () => {
+ expect(computeRealMeetingKey(buildInput({ startsAt: undefined }))).toBe(
+ 'link:meet.example.com/customer-sync:',
+ );
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/desktop-recording-import.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/desktop-recording-import.test.ts
new file mode 100644
index 00000000000..598bb8b4380
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/desktop-recording-import.test.ts
@@ -0,0 +1,62 @@
+import { describe, expect, it } from 'vitest';
+import { shouldCompleteCallRecordingImport } from 'src/logic-functions/domain/should-complete-call-recording-import.util';
+import { parseRecallWebhookEvent } from 'src/logic-functions/recall-api/parse-recall-webhook-event.util';
+import { isRecallRecordingDoneSignal } from 'src/logic-functions/domain/is-recall-recording-done-signal.util';
+
+const recording = {
+ status: 'PROCESSING',
+ startedAt: '2026-09-07T12:00:00Z',
+ endedAt: '2026-09-07T12:05:00Z',
+ transcript: [{ participant: { id: 1 }, words: [] }],
+ audio: [{ fileId: 'audio-1', label: 'audio.mp3' }],
+};
+describe('desktop import compatibility', () => {
+ it('completes audio-only desktop recordings while still requiring bot video', () => {
+ expect(
+ shouldCompleteCallRecordingImport({
+ current: {
+ ...recording,
+ companionSession: { source: 'desktop', media: 'audio' },
+ },
+ updateData: {},
+ }),
+ ).toBe(true);
+ expect(
+ shouldCompleteCallRecordingImport({ current: recording, updateData: {} }),
+ ).toBe(false);
+ expect(
+ shouldCompleteCallRecordingImport({
+ current: {
+ ...recording,
+ audio: [],
+ companionSession: { source: 'desktop', media: 'audio' },
+ },
+ updateData: {},
+ }),
+ ).toBe(false);
+ });
+ it('routes desktop completion using upload metadata when recording metadata is empty', () => {
+ const event = parseRecallWebhookEvent({
+ event: 'sdk_upload.complete',
+ data: {
+ data: { code: 'complete', updated_at: '2026-09-07T12:05:00.123456Z' },
+ sdk_upload: {
+ id: 'upload-1',
+ metadata: { twentyCallRecordingId: 'recording-1' },
+ },
+ recording: { id: 'recall-recording-1', metadata: {} },
+ },
+ });
+ expect(event).toMatchObject({
+ callRecordingIdFromMetadata: 'recording-1',
+ externalRecordingId: 'recall-recording-1',
+ statusTimestamp: '2026-09-07T12:05:00.123Z',
+ });
+ expect(
+ isRecallRecordingDoneSignal({
+ event: event?.event ?? '',
+ statusCode: event?.statusCode,
+ }),
+ ).toBe(true);
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/extract-conference-link-url-from-text.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/extract-conference-link-url-from-text.test.ts
new file mode 100644
index 00000000000..bbf87db52ac
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/extract-conference-link-url-from-text.test.ts
@@ -0,0 +1,83 @@
+import { describe, expect, it } from 'vitest';
+
+import { extractConferenceLinkUrlFromText } from 'src/logic-functions/domain/extract-conference-link-url-from-text.util';
+
+describe('extractConferenceLinkUrlFromText', () => {
+ it.each([
+ [
+ 'extracts a Zoom link from a plain text invitation',
+ 'Felix is inviting you to a scheduled Zoom meeting.\n\nJoin Zoom Meeting\nhttps://us02web.zoom.us/j/81234567890?pwd=aBcDeF123\n\nMeeting ID: 812 3456 7890',
+ 'https://us02web.zoom.us/j/81234567890?pwd=aBcDeF123',
+ ],
+ [
+ 'extracts a bare Zoom link (location field)',
+ 'https://zoom.us/j/81234567890',
+ 'https://zoom.us/j/81234567890',
+ ],
+ [
+ 'extracts a Zoom personal room link',
+ 'Join me at https://company.zoom.us/my/felix today',
+ 'https://company.zoom.us/my/felix',
+ ],
+ [
+ 'extracts a Zoom Government link',
+ 'Join: https://example.zoomgov.com/j/1609618851',
+ 'https://example.zoomgov.com/j/1609618851',
+ ],
+ [
+ 'extracts a Zoom link from an HTML body and decodes &amp;',
+ '<div><a href="https://us02web.zoom.us/j/81234567890?pwd=aBcDeF123&amp;uname=Felix">Join Zoom Meeting</a></div>',
+ 'https://us02web.zoom.us/j/81234567890?pwd=aBcDeF123&uname=Felix',
+ ],
+ [
+ 'strips trailing sentence punctuation',
+ 'Join here: https://zoom.us/j/81234567890.',
+ 'https://zoom.us/j/81234567890',
+ ],
+ [
+ 'extracts a Google Meet link',
+ 'Join the call on https://meet.google.com/abc-defg-hij',
+ 'https://meet.google.com/abc-defg-hij',
+ ],
+ [
+ 'extracts a Microsoft Teams link',
+ 'Click here to join: https://teams.microsoft.com/l/meetup-join/19%3ameeting_ABC123%40thread.v2/0?context=%7b%22Tid%22%3a%22111%22%7d',
+ 'https://teams.microsoft.com/l/meetup-join/19%3ameeting_ABC123%40thread.v2/0?context=%7b%22Tid%22%3a%22111%22%7d',
+ ],
+ [
+ 'extracts a Webex link',
+ 'Join at https://company.webex.com/company/j.php?MTID=m1234abcd',
+ 'https://company.webex.com/company/j.php?MTID=m1234abcd',
+ ],
+ [
+ 'extracts a GoTo Meeting link',
+ 'https://global.gotomeeting.com/join/123456789',
+ 'https://global.gotomeeting.com/join/123456789',
+ ],
+ [
+ 'prefers a Zoom link over a Google Meet link when both are present',
+ 'Video call: https://meet.google.com/abc-defg-hij\nJoin Zoom Meeting\nhttps://zoom.us/j/81234567890',
+ 'https://zoom.us/j/81234567890',
+ ],
+ ])('%s', (_label, text, expectedUrl) => {
+ expect(extractConferenceLinkUrlFromText(text)).toBe(expectedUrl);
+ });
+
+ it.each([
+ [
+ 'a non-conferencing URL',
+ 'Agenda: https://docs.google.com/document/d/abc',
+ ],
+ ['a Zoom marketing page URL', 'Learn more at https://zoom.us/pricing'],
+ ['plain text without links', 'Conference Room A'],
+ ['an empty string', ''],
+ ['a blank string', ' '],
+ ])('returns undefined for %s', (_label, text) => {
+ expect(extractConferenceLinkUrlFromText(text)).toBeUndefined();
+ });
+
+ it('returns undefined for null and undefined', () => {
+ expect(extractConferenceLinkUrlFromText(null)).toBeUndefined();
+ expect(extractConferenceLinkUrlFromText(undefined)).toBeUndefined();
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-call-recording-import-complete.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-call-recording-import-complete.test.ts
new file mode 100644
index 00000000000..452a10425d5
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-call-recording-import-complete.test.ts
@@ -0,0 +1,113 @@
+import { describe, expect, it } from 'vitest';
+
+import { isCallRecordingImportComplete } from 'src/logic-functions/domain/is-call-recording-import-complete.util';
+
+const AUDIO_VALUE = [{ fileId: 'file-audio-1', label: 'audio.mp3' }];
+const VIDEO_VALUE = [{ fileId: 'file-video-1', label: 'video.mp4' }];
+const TRANSCRIPT_CONTENT = [{ participant: { id: 1 }, words: [] }];
+
+describe('isCallRecordingImportComplete', () => {
+ it('is complete when transcript content and both media files are present', () => {
+ expect(
+ isCallRecordingImportComplete({
+ transcript: TRANSCRIPT_CONTENT,
+ audio: AUDIO_VALUE,
+ video: VIDEO_VALUE,
+ companionFailureReason: undefined,
+ }),
+ ).toBe(true);
+ });
+
+ it('is incomplete while the transcript holds a marker', () => {
+ expect(
+ isCallRecordingImportComplete({
+ transcript: {
+ recallTranscriptId: 'recall-transcript-1',
+ status: 'PENDING',
+ },
+ audio: AUDIO_VALUE,
+ video: VIDEO_VALUE,
+ companionFailureReason: undefined,
+ }),
+ ).toBe(false);
+ });
+
+ it('is incomplete when the transcript is unset', () => {
+ expect(
+ isCallRecordingImportComplete({
+ transcript: null,
+ audio: AUDIO_VALUE,
+ video: VIDEO_VALUE,
+ companionFailureReason: undefined,
+ }),
+ ).toBe(false);
+ });
+
+ it('is incomplete while any media field is empty', () => {
+ expect(
+ isCallRecordingImportComplete({
+ transcript: TRANSCRIPT_CONTENT,
+ audio: undefined,
+ video: VIDEO_VALUE,
+ companionFailureReason: undefined,
+ }),
+ ).toBe(false);
+ expect(
+ isCallRecordingImportComplete({
+ transcript: TRANSCRIPT_CONTENT,
+ audio: AUDIO_VALUE,
+ video: [],
+ companionFailureReason: undefined,
+ }),
+ ).toBe(false);
+ });
+
+ it('treats a media file skipped for size as resolved', () => {
+ expect(
+ isCallRecordingImportComplete({
+ transcript: TRANSCRIPT_CONTENT,
+ audio: AUDIO_VALUE,
+ video: undefined,
+ companionFailureReason: 'video_file_too_large',
+ }),
+ ).toBe(true);
+ expect(
+ isCallRecordingImportComplete({
+ transcript: TRANSCRIPT_CONTENT,
+ audio: undefined,
+ video: VIDEO_VALUE,
+ companionFailureReason: 'audio_file_too_large',
+ }),
+ ).toBe(true);
+ expect(
+ isCallRecordingImportComplete({
+ transcript: TRANSCRIPT_CONTENT,
+ audio: undefined,
+ video: undefined,
+ companionFailureReason: 'video_file_too_large,audio_file_too_large',
+ }),
+ ).toBe(true);
+ });
+
+ it('does not let a size marker excuse the other missing artifact', () => {
+ expect(
+ isCallRecordingImportComplete({
+ transcript: TRANSCRIPT_CONTENT,
+ audio: undefined,
+ video: VIDEO_VALUE,
+ companionFailureReason: 'video_file_too_large',
+ }),
+ ).toBe(false);
+ });
+
+ it('ignores unrelated failure reasons', () => {
+ expect(
+ isCallRecordingImportComplete({
+ transcript: TRANSCRIPT_CONTENT,
+ audio: AUDIO_VALUE,
+ video: undefined,
+ companionFailureReason: 'recall_bot_not_found',
+ }),
+ ).toBe(false);
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-call-recording-status-downgrade.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-call-recording-status-downgrade.test.ts
new file mode 100644
index 00000000000..d2cb7c099f1
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-call-recording-status-downgrade.test.ts
@@ -0,0 +1,41 @@
+import { describe, expect, it } from 'vitest';
+
+import { isCallRecordingStatusDowngrade } from 'src/logic-functions/domain/is-call-recording-status-downgrade.util';
+
+describe('isCallRecordingStatusDowngrade', () => {
+ it.each([
+ ['SCHEDULED', 'JOINING', false],
+ ['JOINING', 'RECORDING', false],
+ ['RECORDING', 'PROCESSING', false],
+ ['PROCESSING', 'FAILED', false],
+ ['PROCESSING', 'COMPLETED', false],
+ ['RECORDING', 'RECORDING', false],
+ ['COMPLETED', 'RECORDING', true],
+ ['PROCESSING', 'JOINING', true],
+ ['FAILED', 'RECORDING', true],
+ ['JOINING', 'SCHEDULED', true],
+ ['PROCESSING', 'NOT_RECORDED', false],
+ ['NOT_RECORDED', 'PROCESSING', true],
+ ['NOT_RECORDED', 'FAILED', true],
+ ['FAILED', 'NOT_RECORDED', true],
+ ])('from %s to %s -> %s', (fromStatus, toStatus, expected) => {
+ expect(isCallRecordingStatusDowngrade({ fromStatus, toStatus })).toBe(
+ expected,
+ );
+ });
+
+ it('never treats transitions from unknown statuses as downgrades', () => {
+ expect(
+ isCallRecordingStatusDowngrade({
+ fromStatus: undefined,
+ toStatus: 'COMPLETED',
+ }),
+ ).toBe(false);
+ expect(
+ isCallRecordingStatusDowngrade({
+ fromStatus: 'NOT_A_STATUS',
+ toStatus: 'SCHEDULED',
+ }),
+ ).toBe(false);
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-real-transcript.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-real-transcript.test.ts
new file mode 100644
index 00000000000..542792448e1
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-real-transcript.test.ts
@@ -0,0 +1,27 @@
+import { describe, expect, it } from 'vitest';
+
+import { isRealTranscript } from 'src/logic-functions/domain/is-real-transcript.util';
+
+describe('isRealTranscript', () => {
+ it('is true for a non-empty diarized array', () => {
+ expect(isRealTranscript([{ participant: { name: 'A' }, words: [] }])).toBe(
+ true,
+ );
+ });
+
+ it('is false for an empty array', () => {
+ expect(isRealTranscript([])).toBe(false);
+ });
+
+ it('is false for PENDING/FAILED markers', () => {
+ expect(
+ isRealTranscript({ status: 'PENDING', recallTranscriptId: 'x' }),
+ ).toBe(false);
+ expect(isRealTranscript({ status: 'FAILED' })).toBe(false);
+ });
+
+ it('is false when unset', () => {
+ expect(isRealTranscript(null)).toBe(false);
+ expect(isRealTranscript(undefined)).toBe(false);
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/parse-call-recording-summary-agent-response.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/parse-call-recording-summary-agent-response.test.ts
new file mode 100644
index 00000000000..e8b30cba13d
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/parse-call-recording-summary-agent-response.test.ts
@@ -0,0 +1,68 @@
+import { describe, expect, it } from 'vitest';
+
+import { parseCallRecordingSummaryAgentResponse } from 'src/logic-functions/domain/parse-call-recording-summary-agent-response.util';
+
+describe('parseCallRecordingSummaryAgentResponse', () => {
+ it('returns the trimmed response markdown on success', () => {
+ expect(
+ parseCallRecordingSummaryAgentResponse({
+ success: true,
+ error: null,
+ result: { response: ' ## Overview\nGreat call. ' },
+ }),
+ ).toEqual({ outcome: 'summarized', markdown: '## Overview\nGreat call.' });
+ });
+
+ it('returns undefined when the run failed', () => {
+ expect(
+ parseCallRecordingSummaryAgentResponse({
+ success: false,
+ error: 'no more available credits',
+ result: null,
+ }),
+ ).toBeUndefined();
+ });
+
+ it('returns undefined when the response is empty or missing', () => {
+ expect(
+ parseCallRecordingSummaryAgentResponse({
+ success: true,
+ error: null,
+ result: { response: ' ' },
+ }),
+ ).toBeUndefined();
+ expect(
+ parseCallRecordingSummaryAgentResponse({
+ success: true,
+ error: null,
+ result: {},
+ }),
+ ).toBeUndefined();
+ });
+
+ it('extracts a grounded reason when the transcript cannot be summarized', () => {
+ expect(
+ parseCallRecordingSummaryAgentResponse({
+ success: true,
+ error: null,
+ result: {
+ response:
+ 'SUMMARY_UNAVAILABLE: The transcript contains only greetings and audio checks.',
+ },
+ }),
+ ).toEqual({
+ outcome: 'not-summarizable',
+ reason: 'The transcript contains only greetings and audio checks.',
+ });
+ });
+
+ it('rejects an unavailable marker without a reason', () => {
+ expect(
+ parseCallRecordingSummaryAgentResponse({
+ success: true,
+ error: null,
+ result: { response: 'SUMMARY_UNAVAILABLE:' },
+ }),
+ ).toBeUndefined();
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/parse-media-file-too-large-markers.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/parse-media-file-too-large-markers.test.ts
new file mode 100644
index 00000000000..3b86d03283d
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/parse-media-file-too-large-markers.test.ts
@@ -0,0 +1,46 @@
+import { describe, expect, it } from 'vitest';
+
+import { parseMediaFileTooLargeMarkers } from 'src/logic-functions/domain/parse-media-file-too-large-markers.util';
+
+describe('parseMediaFileTooLargeMarkers', () => {
+ it('parses single-artifact markers', () => {
+ expect(parseMediaFileTooLargeMarkers('video_file_too_large')).toEqual({
+ audioFileTooLarge: false,
+ videoFileTooLarge: true,
+ });
+ expect(parseMediaFileTooLargeMarkers('audio_file_too_large')).toEqual({
+ audioFileTooLarge: true,
+ videoFileTooLarge: false,
+ });
+ });
+
+ it('parses comma-joined markers for both artifacts', () => {
+ expect(
+ parseMediaFileTooLargeMarkers(
+ 'video_file_too_large,audio_file_too_large',
+ ),
+ ).toEqual({
+ audioFileTooLarge: true,
+ videoFileTooLarge: true,
+ });
+ });
+
+ it('reports no markers for unset or unrelated reasons', () => {
+ expect(parseMediaFileTooLargeMarkers(undefined)).toEqual({
+ audioFileTooLarge: false,
+ videoFileTooLarge: false,
+ });
+ expect(parseMediaFileTooLargeMarkers(null)).toEqual({
+ audioFileTooLarge: false,
+ videoFileTooLarge: false,
+ });
+ expect(parseMediaFileTooLargeMarkers('')).toEqual({
+ audioFileTooLarge: false,
+ videoFileTooLarge: false,
+ });
+ expect(parseMediaFileTooLargeMarkers('recall_bot_not_found')).toEqual({
+ audioFileTooLarge: false,
+ videoFileTooLarge: false,
+ });
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/resolve-conference-link-url.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/resolve-conference-link-url.test.ts
new file mode 100644
index 00000000000..228912a1228
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/resolve-conference-link-url.test.ts
@@ -0,0 +1,56 @@
+import { describe, expect, it } from 'vitest';
+
+import { resolveConferenceLinkUrl } from 'src/logic-functions/domain/resolve-conference-link-url.util';
+
+describe('resolveConferenceLinkUrl', () => {
+ it('returns the structured conference link when present', () => {
+ expect(
+ resolveConferenceLinkUrl({
+ conferenceLinkUrl: 'https://meet.google.com/abc-defg-hij',
+ location: 'https://zoom.us/j/81234567890',
+ description: 'Join Zoom Meeting https://zoom.us/j/99999999999',
+ }),
+ ).toBe('https://meet.google.com/abc-defg-hij');
+ });
+
+ it('parses the location when the structured link is empty', () => {
+ expect(
+ resolveConferenceLinkUrl({
+ conferenceLinkUrl: undefined,
+ location: 'https://zoom.us/j/81234567890',
+ description: 'Weekly sync',
+ }),
+ ).toBe('https://zoom.us/j/81234567890');
+ });
+
+ it('parses the description when the structured link and location have none', () => {
+ expect(
+ resolveConferenceLinkUrl({
+ conferenceLinkUrl: '',
+ location: 'Conference Room A',
+ description:
+ 'Felix is inviting you to a scheduled Zoom meeting.\nJoin Zoom Meeting\nhttps://us02web.zoom.us/j/81234567890?pwd=aBcDeF123',
+ }),
+ ).toBe('https://us02web.zoom.us/j/81234567890?pwd=aBcDeF123');
+ });
+
+ it('prefers the location link over the description link', () => {
+ expect(
+ resolveConferenceLinkUrl({
+ conferenceLinkUrl: null,
+ location: 'https://zoom.us/j/11111111111',
+ description: 'Join Zoom Meeting https://zoom.us/j/22222222222',
+ }),
+ ).toBe('https://zoom.us/j/11111111111');
+ });
+
+ it('returns undefined when no conference link exists anywhere', () => {
+ expect(
+ resolveConferenceLinkUrl({
+ conferenceLinkUrl: undefined,
+ location: 'Conference Room A',
+ description: 'Quarterly review agenda',
+ }),
+ ).toBeUndefined();
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/should-complete-call-recording-import.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/should-complete-call-recording-import.test.ts
new file mode 100644
index 00000000000..350a7f2ae73
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/should-complete-call-recording-import.test.ts
@@ -0,0 +1,165 @@
+import { describe, expect, it } from 'vitest';
+
+import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { shouldCompleteCallRecordingImport } from 'src/logic-functions/domain/should-complete-call-recording-import.util';
+
+const filledTranscript = [{ participant: { id: 1 }, words: [] }];
+const filledAudio = [{ fileId: 'file-audio-1', label: 'audio.mp3' }];
+const filledVideo = [{ fileId: 'file-video-1', label: 'video.mp4' }];
+
+describe('shouldCompleteCallRecordingImport', () => {
+ it('requires complete artifacts and billable timestamps before completion', () => {
+ expect(
+ shouldCompleteCallRecordingImport({
+ current: {
+ status: CallRecordingStatus.PROCESSING,
+ startedAt: '2026-06-10T09:00:00.000Z',
+ endedAt: '2026-06-10T10:00:00.000Z',
+ transcript: filledTranscript,
+ audio: filledAudio,
+ video: filledVideo,
+ },
+ updateData: {},
+ }),
+ ).toBe(true);
+
+ expect(
+ shouldCompleteCallRecordingImport({
+ current: {
+ status: CallRecordingStatus.PROCESSING,
+ endedAt: '2026-06-10T10:00:00.000Z',
+ transcript: filledTranscript,
+ audio: filledAudio,
+ video: filledVideo,
+ },
+ updateData: {},
+ }),
+ ).toBe(false);
+
+ expect(
+ shouldCompleteCallRecordingImport({
+ current: {
+ status: CallRecordingStatus.PROCESSING,
+ transcript: filledTranscript,
+ audio: filledAudio,
+ video: filledVideo,
+ },
+ updateData: {
+ startedAt: '2026-06-10T09:00:00.000Z',
+ endedAt: '2026-06-10T10:00:00.000Z',
+ },
+ }),
+ ).toBe(true);
+
+ expect(
+ shouldCompleteCallRecordingImport({
+ current: {
+ status: CallRecordingStatus.PROCESSING,
+ startedAt: '2026-06-10T10:00:00.000Z',
+ endedAt: '2026-06-10T09:00:00.000Z',
+ transcript: filledTranscript,
+ audio: filledAudio,
+ video: filledVideo,
+ },
+ updateData: {},
+ }),
+ ).toBe(false);
+ });
+
+ it('completes when a missing media file is marked too large', () => {
+ expect(
+ shouldCompleteCallRecordingImport({
+ current: {
+ status: CallRecordingStatus.PROCESSING,
+ startedAt: '2026-06-10T09:00:00.000Z',
+ endedAt: '2026-06-10T10:00:00.000Z',
+ transcript: filledTranscript,
+ audio: filledAudio,
+ },
+ updateData: {
+ companionFailureReason: 'video_file_too_large',
+ },
+ }),
+ ).toBe(true);
+
+ expect(
+ shouldCompleteCallRecordingImport({
+ current: {
+ status: CallRecordingStatus.PROCESSING,
+ startedAt: '2026-06-10T09:00:00.000Z',
+ endedAt: '2026-06-10T10:00:00.000Z',
+ transcript: filledTranscript,
+ audio: filledAudio,
+ companionFailureReason: 'video_file_too_large',
+ },
+ updateData: {},
+ }),
+ ).toBe(true);
+ });
+
+ it('does not complete a persisted failed recording', () => {
+ expect(
+ shouldCompleteCallRecordingImport({
+ current: {
+ status: CallRecordingStatus.FAILED,
+ startedAt: '2026-06-10T09:00:00.000Z',
+ endedAt: '2026-06-10T10:00:00.000Z',
+ transcript: filledTranscript,
+ audio: filledAudio,
+ video: filledVideo,
+ },
+ updateData: {},
+ }),
+ ).toBe(false);
+ });
+
+ it('does not complete when the incoming update marks the recording as failed', () => {
+ expect(
+ shouldCompleteCallRecordingImport({
+ current: {
+ status: CallRecordingStatus.PROCESSING,
+ startedAt: '2026-06-10T09:00:00.000Z',
+ endedAt: '2026-06-10T10:00:00.000Z',
+ transcript: filledTranscript,
+ audio: filledAudio,
+ video: filledVideo,
+ },
+ updateData: {
+ status: CallRecordingStatus.FAILED,
+ },
+ }),
+ ).toBe(false);
+ });
+
+ it('does not complete a recording classified as NOT_RECORDED', () => {
+ expect(
+ shouldCompleteCallRecordingImport({
+ current: {
+ status: CallRecordingStatus.NOT_RECORDED,
+ startedAt: '2026-06-10T09:00:00.000Z',
+ endedAt: '2026-06-10T10:00:00.000Z',
+ transcript: filledTranscript,
+ audio: filledAudio,
+ video: filledVideo,
+ },
+ updateData: {},
+ }),
+ ).toBe(false);
+
+ expect(
+ shouldCompleteCallRecordingImport({
+ current: {
+ status: CallRecordingStatus.PROCESSING,
+ startedAt: '2026-06-10T09:00:00.000Z',
+ endedAt: '2026-06-10T10:00:00.000Z',
+ transcript: filledTranscript,
+ audio: filledAudio,
+ video: filledVideo,
+ },
+ updateData: {
+ status: CallRecordingStatus.NOT_RECORDED,
+ },
+ }),
+ ).toBe(false);
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/build-call-recording-summary-prompt.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/build-call-recording-summary-prompt.util.ts
new file mode 100644
index 00000000000..ea2fbd4e48c
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/build-call-recording-summary-prompt.util.ts
@@ -0,0 +1,82 @@
+import { isArray, isNumber } from '@sniptt/guards';
+
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { formatSecondsAsClockTimestamp } from 'src/logic-functions/utils/format-seconds-as-clock-timestamp.util';
+import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+
+const UNKNOWN_SPEAKER = 'Unknown speaker';
+
+const readEntryStartSeconds = (words: unknown[]): number | undefined => {
+ for (const word of words) {
+ const relative = asRecord(asRecord(word)?.start_timestamp)?.relative;
+
+ if (isNumber(relative) && Number.isFinite(relative)) {
+ return relative;
+ }
+ }
+
+ return undefined;
+};
+
+const buildTranscriptLine = (entry: unknown): string | undefined => {
+ const record = asRecord(entry);
+
+ if (record === undefined || !isArray(record.words)) {
+ return undefined;
+ }
+
+ const text = record.words
+ .map((word) => asRecord(word)?.text)
+ .filter(isNonEmptyString)
+ .map((word) => word.trim())
+ .join(' ')
+ .trim();
+
+ if (!isNonEmptyString(text)) {
+ return undefined;
+ }
+
+ const participantName = asRecord(record.participant)?.name;
+ const speakerName = isNonEmptyString(participantName)
+ ? participantName.trim()
+ : UNKNOWN_SPEAKER;
+
+ const startSeconds = readEntryStartSeconds(record.words);
+ const timestamp =
+ startSeconds === undefined
+ ? ''
+ : `[${formatSecondsAsClockTimestamp(startSeconds)}] `;
+
+ return `${timestamp}${speakerName}: ${text}`;
+};
+
+// The summarization instructions live in the agent's own prompt; the built
+// prompt only carries the workspace admin's additional instructions on top.
+export const buildCallRecordingSummaryPrompt = ({
+ transcript,
+ title,
+ additionalSummaryPrompt,
+}: {
+ transcript: unknown;
+ title?: string;
+ additionalSummaryPrompt?: string;
+}): string | undefined => {
+ if (!isArray(transcript)) {
+ return undefined;
+ }
+
+ const lines = transcript.map(buildTranscriptLine).filter(isNonEmptyString);
+
+ if (lines.length === 0) {
+ return undefined;
+ }
+
+ const additionalInstructions = isNonEmptyString(additionalSummaryPrompt)
+ ? `Additional instructions from the workspace admin:\n${additionalSummaryPrompt.trim()}\n\n`
+ : '';
+ const header = isNonEmptyString(title)
+ ? `Meeting title: ${title.trim()}\n\n`
+ : '';
+
+ return `${additionalInstructions}${header}Transcript:\n${lines.join('\n')}`;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/build-failed-transcript-marker.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/build-failed-transcript-marker.util.ts
new file mode 100644
index 00000000000..c7719537f67
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/build-failed-transcript-marker.util.ts
@@ -0,0 +1,13 @@
+import { type TranscriptMarker } from 'src/logic-functions/types/transcript-marker.type';
+
+export const buildFailedTranscriptMarker = ({
+ recallTranscriptId,
+ subCode,
+}: {
+ recallTranscriptId: string | null;
+ subCode: string | null;
+}): TranscriptMarker => ({
+ recallTranscriptId,
+ status: 'FAILED',
+ subCode,
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/build-pending-transcript-marker.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/build-pending-transcript-marker.util.ts
new file mode 100644
index 00000000000..4471e050f01
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/build-pending-transcript-marker.util.ts
@@ -0,0 +1,13 @@
+import { type TranscriptMarker } from 'src/logic-functions/types/transcript-marker.type';
+
+export const buildPendingTranscriptMarker = ({
+ recallTranscriptId,
+ requestedAt,
+}: {
+ recallTranscriptId: string | null;
+ requestedAt: string;
+}): TranscriptMarker => ({
+ recallTranscriptId,
+ status: 'PENDING',
+ requestedAt,
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/build-transcript-failure-reason.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/build-transcript-failure-reason.util.ts
new file mode 100644
index 00000000000..56fcf08d9ec
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/build-transcript-failure-reason.util.ts
@@ -0,0 +1,7 @@
+import { isNull } from '@sniptt/guards';
+
+export const buildTranscriptFailureReason = (
+ subCode: string | null,
+): string => {
+ return isNull(subCode) ? 'transcript_failed' : `transcript_failed:${subCode}`;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/compute-call-recording-charge.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/compute-call-recording-charge.util.ts
new file mode 100644
index 00000000000..b7d58291bb5
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/compute-call-recording-charge.util.ts
@@ -0,0 +1,41 @@
+import { isUndefined } from '@sniptt/guards';
+
+import { CALL_RECORDING_MICRO_CREDITS_PER_HOUR } from 'src/logic-functions/constants/call-recording-micro-credits-per-hour';
+import { MILLISECONDS_PER_MINUTE } from 'src/logic-functions/constants/milliseconds-per-minute';
+
+const MILLISECONDS_PER_HOUR = 3_600_000;
+
+export type CallRecordingCharge = {
+ creditsUsedMicro: number;
+ quantityMinutes: number;
+};
+
+export const computeCallRecordingCharge = ({
+ startedAt,
+ endedAt,
+}: {
+ startedAt: string | undefined;
+ endedAt: string | undefined;
+}): CallRecordingCharge | undefined => {
+ if (isUndefined(startedAt) || isUndefined(endedAt)) {
+ return undefined;
+ }
+
+ const durationMilliseconds =
+ new Date(endedAt).getTime() - new Date(startedAt).getTime();
+
+ if (!Number.isFinite(durationMilliseconds) || durationMilliseconds <= 0) {
+ return undefined;
+ }
+
+ return {
+ creditsUsedMicro: Math.round(
+ (durationMilliseconds / MILLISECONDS_PER_HOUR) *
+ CALL_RECORDING_MICRO_CREDITS_PER_HOUR,
+ ),
+ quantityMinutes: Math.max(
+ 1,
+ Math.round(durationMilliseconds / MILLISECONDS_PER_MINUTE),
+ ),
+ };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/compute-real-meeting-key.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/compute-real-meeting-key.util.ts
new file mode 100644
index 00000000000..60508181d6f
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/compute-real-meeting-key.util.ts
@@ -0,0 +1,53 @@
+import { isUndefined } from '@sniptt/guards';
+
+import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+
+type ComputeRealMeetingKeyInput = {
+ calendarEventId: string;
+ conferenceLinkUrl: unknown;
+ iCalUid: string | undefined;
+ startsAt: string | undefined;
+};
+
+export const computeRealMeetingKey = ({
+ calendarEventId,
+ conferenceLinkUrl,
+ iCalUid,
+ startsAt,
+}: ComputeRealMeetingKeyInput): string => {
+ const normalizedConferenceLink = normalizeConferenceLink(conferenceLinkUrl);
+
+ if (!isUndefined(normalizedConferenceLink)) {
+ return `link:${normalizedConferenceLink}:${startsAt ?? ''}`;
+ }
+
+ if (isNonEmptyString(iCalUid)) {
+ return `ical:${iCalUid}:${startsAt ?? ''}`;
+ }
+
+ return `event:${calendarEventId}`;
+};
+
+const normalizeConferenceLink = (
+ conferenceLinkUrl: unknown,
+): string | undefined => {
+ if (!isNonEmptyString(conferenceLinkUrl)) {
+ return undefined;
+ }
+
+ const withoutProtocol = conferenceLinkUrl
+ .trim()
+ .toLowerCase()
+ .replace(/^https?:\/\//, '')
+ .replace(/^www\./, '');
+
+ const withoutQueryAndFragment = withoutProtocol.split(/[?#]/)[0];
+ const meetingToken = new URLSearchParams(
+ withoutProtocol.split('?')[1]?.split('#')[0],
+ ).get('mtid');
+ const withoutTrailingSlash = withoutQueryAndFragment.replace(/\/+$/, '');
+
+ return withoutTrailingSlash === ''
+ ? undefined
+ : `${withoutTrailingSlash}${meetingToken ? `?mtid=${meetingToken}` : ''}`;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/extract-conference-link-url-from-text.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/extract-conference-link-url-from-text.util.ts
new file mode 100644
index 00000000000..4b50826ed53
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/extract-conference-link-url-from-text.util.ts
@@ -0,0 +1,24 @@
+import { SUPPORTED_MEETING_PLATFORM_URL_PATTERNS } from 'src/logic-functions/constants/supported-meeting-platform-url-patterns';
+import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+
+// Outlook HTML bodies encode ampersands; plain-text links can end mid-sentence.
+const cleanExtractedConferenceLinkUrl = (url: string): string =>
+ url.replace(/&amp;/gi, '&').replace(/[.,;:!?)\]]+$/, '');
+
+export const extractConferenceLinkUrlFromText = (
+ text: string | null | undefined,
+): string | undefined => {
+ if (!isNonEmptyString(text)) {
+ return undefined;
+ }
+
+ for (const pattern of SUPPORTED_MEETING_PLATFORM_URL_PATTERNS) {
+ const match = text.match(pattern);
+
+ if (match !== null) {
+ return cleanExtractedConferenceLinkUrl(match[0]);
+ }
+ }
+
+ return undefined;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-call-recording-import-complete.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/is-call-recording-import-complete.util.ts
new file mode 100644
index 00000000000..9c1e417e733
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/is-call-recording-import-complete.util.ts
@@ -0,0 +1,32 @@
+import { isNonEmptyArray } from '@sniptt/guards';
+
+import { type FilesFieldValue } from 'src/logic-functions/types/files-field-value.type';
+import { parseMediaFileTooLargeMarkers } from 'src/logic-functions/domain/parse-media-file-too-large-markers.util';
+
+export const isCallRecordingMediaImportComplete = ({
+ audio,
+ video,
+ companionFailureReason,
+ requiresVideo = true,
+}: {
+ requiresVideo?: boolean;
+ audio: FilesFieldValue | undefined;
+ video: FilesFieldValue | undefined;
+ companionFailureReason: string | null | undefined;
+}): boolean => {
+ const { audioFileTooLarge, videoFileTooLarge } =
+ parseMediaFileTooLargeMarkers(companionFailureReason);
+
+ return (
+ (isNonEmptyArray(audio) || audioFileTooLarge) &&
+ (!requiresVideo || isNonEmptyArray(video) || videoFileTooLarge)
+ );
+};
+
+export const isCallRecordingImportComplete = ({
+ transcript,
+ ...media
+}: Parameters<typeof isCallRecordingMediaImportComplete>[0] & {
+ transcript: unknown;
+}): boolean =>
+ Array.isArray(transcript) && isCallRecordingMediaImportComplete(media);
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-call-recording-status-downgrade.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/is-call-recording-status-downgrade.util.ts
new file mode 100644
index 00000000000..d23e901ac0e
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/is-call-recording-status-downgrade.util.ts
@@ -0,0 +1,52 @@
+import { isUndefined } from '@sniptt/guards';
+
+import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+
+// Deliveries are unordered; a late event must never move status backwards.
+// FAILED and NOT_RECORDED share a rank so a late event cannot flip one into the other.
+const CALL_RECORDING_STATUS_PROGRESSION: Record<CallRecordingStatus, number> = {
+ [CallRecordingStatus.SCHEDULED]: 0,
+ [CallRecordingStatus.JOINING]: 1,
+ [CallRecordingStatus.RECORDING]: 2,
+ [CallRecordingStatus.PROCESSING]: 3,
+ [CallRecordingStatus.FAILED]: 4,
+ [CallRecordingStatus.NOT_RECORDED]: 4,
+ [CallRecordingStatus.COMPLETED]: 5,
+};
+
+const getCallRecordingStatusRank = (status: string): number | undefined =>
+ status in CALL_RECORDING_STATUS_PROGRESSION
+ ? CALL_RECORDING_STATUS_PROGRESSION[status as CallRecordingStatus]
+ : undefined;
+
+export const isCallRecordingStatusDowngrade = ({
+ fromStatus,
+ toStatus,
+}: {
+ fromStatus: string | undefined;
+ toStatus: string;
+}): boolean => {
+ if (
+ toStatus === CallRecordingStatus.COMPLETED &&
+ (fromStatus === CallRecordingStatus.FAILED ||
+ fromStatus === CallRecordingStatus.NOT_RECORDED)
+ )
+ return true;
+ const fromRank = isUndefined(fromStatus)
+ ? undefined
+ : getCallRecordingStatusRank(fromStatus);
+ const toRank = getCallRecordingStatusRank(toStatus);
+
+ if (isUndefined(fromRank) || isUndefined(toRank)) {
+ return false;
+ }
+
+ return toRank < fromRank || (toRank === fromRank && toStatus !== fromStatus);
+};
+
+export const getAllowedPreviousCallRecordingStatuses = (
+ toStatus: CallRecordingStatus,
+): CallRecordingStatus[] =>
+ Object.values(CallRecordingStatus).filter(
+ (fromStatus) => !isCallRecordingStatusDowngrade({ fromStatus, toStatus }),
+ );
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-desktop-audio-recording.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/is-desktop-audio-recording.util.ts
new file mode 100644
index 00000000000..fb558b1e7d5
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/is-desktop-audio-recording.util.ts
@@ -0,0 +1,6 @@
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+
+export const isDesktopAudioRecording = (session: unknown): boolean => {
+ const record = asRecord(session);
+ return record?.source === 'desktop' && record?.media === 'audio';
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-not-recorded-recall-sub-code.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/is-not-recorded-recall-sub-code.util.ts
new file mode 100644
index 00000000000..0e89a0fe0f7
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/is-not-recorded-recall-sub-code.util.ts
@@ -0,0 +1,8 @@
+import { isUndefined } from '@sniptt/guards';
+
+import { NOT_RECORDED_RECALL_SUB_CODES } from 'src/logic-functions/constants/not-recorded-recall-sub-codes';
+
+export const isNotRecordedRecallSubCode = (
+ subCode: string | undefined,
+): boolean =>
+ !isUndefined(subCode) && NOT_RECORDED_RECALL_SUB_CODES.includes(subCode);
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-real-transcript.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/is-real-transcript.util.ts
new file mode 100644
index 00000000000..02e526570dd
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/is-real-transcript.util.ts
@@ -0,0 +1,4 @@
+import { isArray } from '@sniptt/guards';
+
+export const isRealTranscript = (transcript: unknown): boolean =>
+ isArray(transcript) && transcript.length > 0;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-recall-recording-done-signal.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/is-recall-recording-done-signal.util.ts
new file mode 100644
index 00000000000..bc2eb065758
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/is-recall-recording-done-signal.util.ts
@@ -0,0 +1,14 @@
+export const isRecallRecordingDoneSignal = ({
+ event,
+ statusCode,
+}: {
+ event: string;
+ statusCode: string | undefined;
+}): boolean => {
+ return (
+ event === 'sdk_upload.complete' ||
+ event === 'recording.done' ||
+ event === 'recording.failed' ||
+ statusCode === 'done'
+ );
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-unavailable-call-recording-status.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/is-unavailable-call-recording-status.util.ts
new file mode 100644
index 00000000000..abb3e89ef7e
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/is-unavailable-call-recording-status.util.ts
@@ -0,0 +1,8 @@
+import { isUndefined } from '@sniptt/guards';
+
+import { UNAVAILABLE_CALL_RECORDING_STATUSES } from 'src/logic-functions/constants/unavailable-call-recording-statuses';
+
+export const isUnavailableCallRecordingStatus = (
+ status: string | undefined,
+): boolean =>
+ !isUndefined(status) && UNAVAILABLE_CALL_RECORDING_STATUSES.includes(status);
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/map-recall-status-code-to-call-recording-status.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/map-recall-status-code-to-call-recording-status.util.ts
new file mode 100644
index 00000000000..05296b8d036
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/map-recall-status-code-to-call-recording-status.util.ts
@@ -0,0 +1,39 @@
+import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { isNotRecordedRecallSubCode } from 'src/logic-functions/domain/is-not-recorded-recall-sub-code.util';
+
+export const mapRecallStatusCodeToCallRecordingStatus = ({
+ statusCode,
+ statusSubCode,
+}: {
+ statusCode: string | undefined;
+ statusSubCode?: string | undefined;
+}): CallRecordingStatus | undefined => {
+ // Recall defines no-capture sub codes only on call_ended and fatal; other codes may carry a stale bot-level sub code.
+ if (
+ (statusCode === 'call_ended' || statusCode === 'fatal') &&
+ isNotRecordedRecallSubCode(statusSubCode)
+ ) {
+ return CallRecordingStatus.NOT_RECORDED;
+ }
+
+ switch (statusCode) {
+ case 'joining_call':
+ case 'in_waiting_room':
+ return CallRecordingStatus.JOINING;
+ case 'in_call_not_recording':
+ case 'recording_permission_allowed':
+ case 'in_call_recording':
+ return CallRecordingStatus.RECORDING;
+ // 'done' stays PROCESSING: COMPLETED is set only after all artifacts are imported.
+ case 'call_ended':
+ case 'analysis_done':
+ case 'done':
+ return CallRecordingStatus.PROCESSING;
+ case 'fatal':
+ case 'analysis_failed':
+ case 'recording_permission_denied':
+ return CallRecordingStatus.FAILED;
+ default:
+ return undefined;
+ }
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-call-recording-summary-agent-response.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-call-recording-summary-agent-response.util.ts
new file mode 100644
index 00000000000..aa9da12c935
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-call-recording-summary-agent-response.util.ts
@@ -0,0 +1,37 @@
+import { type RunAgentResult } from 'twenty-sdk/logic-function';
+
+import { CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX } from 'src/constants/call-recording-summary-unavailable-prefix';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+
+type ParsedCallRecordingSummaryAgentResponse =
+ | { outcome: 'summarized'; markdown: string }
+ | { outcome: 'not-summarizable'; reason: string };
+
+export const parseCallRecordingSummaryAgentResponse = (
+ agentResult: RunAgentResult,
+): ParsedCallRecordingSummaryAgentResponse | undefined => {
+ if (!agentResult.success) {
+ return undefined;
+ }
+
+ const response = asRecord(agentResult.result)?.response;
+
+ if (!isNonEmptyString(response)) {
+ return undefined;
+ }
+
+ const trimmedResponse = response.trim();
+
+ if (trimmedResponse.startsWith(CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX)) {
+ const reason = trimmedResponse
+ .slice(CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX.length)
+ .trim();
+
+ return isNonEmptyString(reason)
+ ? { outcome: 'not-summarizable', reason }
+ : undefined;
+ }
+
+ return { outcome: 'summarized', markdown: trimmedResponse };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-media-file-too-large-markers.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-media-file-too-large-markers.util.ts
new file mode 100644
index 00000000000..286e64d82c4
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-media-file-too-large-markers.util.ts
@@ -0,0 +1,27 @@
+import {
+ AUDIO_FILE_TOO_LARGE_FAILURE_REASON,
+ VIDEO_FILE_TOO_LARGE_FAILURE_REASON,
+} from 'src/logic-functions/constants/media-file-too-large-failure-reasons';
+import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+
+export type MediaFileTooLargeMarkers = {
+ audioFileTooLarge: boolean;
+ videoFileTooLarge: boolean;
+};
+
+export const parseMediaFileTooLargeMarkers = (
+ companionFailureReason: string | null | undefined,
+): MediaFileTooLargeMarkers => {
+ const failureReasons = isNonEmptyString(companionFailureReason)
+ ? companionFailureReason.split(',').map((reason) => reason.trim())
+ : [];
+
+ return {
+ audioFileTooLarge: failureReasons.includes(
+ AUDIO_FILE_TOO_LARGE_FAILURE_REASON,
+ ),
+ videoFileTooLarge: failureReasons.includes(
+ VIDEO_FILE_TOO_LARGE_FAILURE_REASON,
+ ),
+ };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-transcript-marker.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-transcript-marker.util.ts
new file mode 100644
index 00000000000..36a6cbce5d3
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-transcript-marker.util.ts
@@ -0,0 +1,31 @@
+import { isString, isUndefined } from '@sniptt/guards';
+
+import { type TranscriptMarker } from 'src/logic-functions/types/transcript-marker.type';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+
+export const parseTranscriptMarker = (
+ transcript: unknown,
+): TranscriptMarker | undefined => {
+ const candidate = asRecord(transcript);
+
+ if (isUndefined(candidate)) {
+ return undefined;
+ }
+
+ if (candidate.status !== 'PENDING' && candidate.status !== 'FAILED') {
+ return undefined;
+ }
+
+ return {
+ recallTranscriptId:
+ isString(candidate.recallTranscriptId) &&
+ candidate.recallTranscriptId.trim() !== ''
+ ? candidate.recallTranscriptId
+ : null,
+ status: candidate.status,
+ ...(isString(candidate.requestedAt)
+ ? { requestedAt: candidate.requestedAt }
+ : {}),
+ ...(isString(candidate.subCode) ? { subCode: candidate.subCode } : {}),
+ };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/resolve-conference-link-url.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/resolve-conference-link-url.util.ts
new file mode 100644
index 00000000000..84626c346cb
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/resolve-conference-link-url.util.ts
@@ -0,0 +1,25 @@
+import { extractConferenceLinkUrlFromText } from 'src/logic-functions/domain/extract-conference-link-url-from-text.util';
+import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+
+type ResolveConferenceLinkUrlInput = {
+ conferenceLinkUrl: string | null | undefined;
+ location: string | null | undefined;
+ description: string | null | undefined;
+};
+
+// The server only fills conferenceLink from structured provider data; Zoom and
+// other third-party links often exist only as text in location/description.
+export const resolveConferenceLinkUrl = ({
+ conferenceLinkUrl,
+ location,
+ description,
+}: ResolveConferenceLinkUrlInput): string | undefined => {
+ if (isNonEmptyString(conferenceLinkUrl)) {
+ return conferenceLinkUrl;
+ }
+
+ return (
+ extractConferenceLinkUrlFromText(location) ??
+ extractConferenceLinkUrlFromText(description)
+ );
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/should-complete-call-recording-import.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/should-complete-call-recording-import.util.ts
new file mode 100644
index 00000000000..f0907adee8b
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/should-complete-call-recording-import.util.ts
@@ -0,0 +1,39 @@
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
+import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { type FilesFieldValue } from 'src/logic-functions/types/files-field-value.type';
+import { computeCallRecordingCharge } from 'src/logic-functions/domain/compute-call-recording-charge.util';
+import { isUnavailableCallRecordingStatus } from 'src/logic-functions/domain/is-unavailable-call-recording-status.util';
+import { isCallRecordingImportComplete } from 'src/logic-functions/domain/is-call-recording-import-complete.util';
+import { type CallRecordingUpdateFields } from 'src/logic-functions/types/call-recording-update-fields.type';
+
+export const shouldCompleteCallRecordingImport = ({
+ current,
+ updateData,
+}: {
+ current: {
+ companionSession?: unknown;
+ status?: string;
+ startedAt?: string;
+ endedAt?: string;
+ transcript?: unknown;
+ audio?: FilesFieldValue;
+ video?: FilesFieldValue;
+ companionFailureReason?: string | null;
+ };
+ updateData: CallRecordingUpdateFields;
+}): boolean =>
+ current.status !== CallRecordingStatus.COMPLETED &&
+ !isUnavailableCallRecordingStatus(current.status) &&
+ !isUnavailableCallRecordingStatus(updateData.status) &&
+ computeCallRecordingCharge({
+ startedAt: updateData.startedAt ?? current.startedAt,
+ endedAt: updateData.endedAt ?? current.endedAt,
+ }) !== undefined &&
+ isCallRecordingImportComplete({
+ requiresVideo: !isDesktopAudioRecording(current.companionSession),
+ transcript: updateData.transcript ?? current.transcript,
+ audio: updateData.audio ?? current.audio,
+ video: updateData.video ?? current.video,
+ companionFailureReason:
+ updateData.companionFailureReason ?? current.companionFailureReason,
+ });
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/complete-and-charge-call-recording.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/complete-and-charge-call-recording.test.ts
new file mode 100644
index 00000000000..142a1049771
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/complete-and-charge-call-recording.test.ts
@@ -0,0 +1,63 @@
+import { beforeEach, expect, it, vi } from 'vitest';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { completeAndChargeCallRecording } from 'src/logic-functions/flows/complete-and-charge-call-recording.util';
+
+const { charge, prepare } = vi.hoisted(() => ({
+ charge: vi.fn(),
+ prepare: vi.fn(),
+}));
+vi.mock('twenty-sdk/billing', () => ({ chargeCredits: charge }));
+vi.mock('src/logic-functions/flows/get-call-recording-charge.util', () => ({
+ getCallRecordingCharge: prepare,
+}));
+const chargeInput = {
+ creditsUsedMicro: 500_000,
+ quantity: 30,
+ operationType: 'CALL_RECORDING',
+ resourceContext: 'recall',
+};
+beforeEach(() => {
+ vi.resetAllMocks();
+ prepare.mockResolvedValue(chargeInput);
+});
+
+it('charges only the worker that completes the recording', async () => {
+ const mutation = vi
+ .fn()
+ .mockResolvedValueOnce({ updateCallRecordings: [{ id: 'recording-1' }] })
+ .mockResolvedValue({ updateCallRecordings: [] });
+ const client = { mutation } as unknown as CoreApiClient;
+ expect(
+ await completeAndChargeCallRecording(client, { id: 'recording-1' }),
+ ).toBe(true);
+ expect(
+ await completeAndChargeCallRecording(client, { id: 'recording-1' }),
+ ).toBe(false);
+ expect(charge).toHaveBeenCalledExactlyOnceWith(chargeInput);
+});
+
+it('does not replay a charge after an ambiguous failure', async () => {
+ const mutation = vi
+ .fn()
+ .mockResolvedValueOnce({ updateCallRecordings: [{ id: 'recording-1' }] })
+ .mockResolvedValue({ updateCallRecordings: [] });
+ const client = { mutation } as unknown as CoreApiClient;
+ charge.mockRejectedValueOnce(new Error('billing offline'));
+ await expect(
+ completeAndChargeCallRecording(client, { id: 'recording-1' }),
+ ).rejects.toThrow('billing offline');
+ await completeAndChargeCallRecording(client, { id: 'recording-1' });
+ expect(charge).toHaveBeenCalledOnce();
+});
+
+it('leaves the completion fence untouched when provider validation fails', async () => {
+ const mutation = vi.fn();
+ prepare.mockRejectedValue(new Error('duration unavailable'));
+ await expect(
+ completeAndChargeCallRecording({ mutation } as unknown as CoreApiClient, {
+ id: 'recording-1',
+ }),
+ ).rejects.toThrow('duration unavailable');
+ expect(mutation).not.toHaveBeenCalled();
+ expect(charge).not.toHaveBeenCalled();
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/create-desktop-recording-upload.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/create-desktop-recording-upload.test.ts
new file mode 100644
index 00000000000..17e3ef6fcbd
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/create-desktop-recording-upload.test.ts
@@ -0,0 +1,226 @@
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+import { extractTwentyWorkspaceIdFromRecallWebhook } from 'src/logic-functions/recall-api/extract-twenty-workspace-id-from-recall-webhook.util';
+import {
+ createDesktopRecordingUpload,
+ failDesktopRecordingCapture,
+} from 'src/logic-functions/flows/create-desktop-recording-upload.util';
+
+const { request, agenda } = vi.hoisted(() => ({
+ request: vi.fn(),
+ agenda: vi.fn(),
+}));
+vi.mock('src/logic-functions/recall-api/get-recall-api-config.util', () => ({
+ getRecallApiConfig: () => ({
+ success: true,
+ config: {
+ baseUrl: 'https://eu-central-1.recall.ai/api/v1',
+ apiKey: 'server-only-test-key',
+ },
+ }),
+}));
+vi.mock('src/logic-functions/data/get-current-workspace-id.util', () => ({
+ getCurrentWorkspaceId: () => 'workspace-1',
+}));
+vi.mock('src/logic-functions/recall-api/recall-bot-api-request.util', () => ({
+ recallBotApiRequest: request,
+}));
+vi.mock('src/logic-functions/flows/get-desktop-companion-agenda.util', () => ({
+ getDesktopCompanionAgenda: agenda,
+}));
+
+const SESSION_ID = '15fb9b8a-93a6-4e6d-8cbe-d13b1c6d398b';
+const BODY = {
+ sessionId: SESSION_ID,
+ title: 'Discord design conversation',
+ platform: 'desktop-audio',
+};
+const query = vi.fn();
+const mutation = vi.fn();
+const client = { query, mutation } as unknown as CoreApiClient;
+
+beforeEach(() => {
+ vi.resetAllMocks();
+ query.mockResolvedValue({});
+ mutation.mockResolvedValue({ updateCallRecordings: [{ id: SESSION_ID }] });
+ agenda.mockResolvedValue({ meetings: [] });
+ request.mockResolvedValue({
+ ok: true,
+ data: {
+ id: 'upload-1',
+ upload_token: 'ephemeral-token',
+ metadata: {
+ twentyWorkspaceId: 'workspace-1',
+ twentyCallRecordingId: SESSION_ID,
+ twentyUserWorkspaceId: 'user-1',
+ },
+ },
+ });
+});
+
+describe('desktop upload provisioning', () => {
+ it('reserves the shared CallRecording before creating an audio-only upload and returns no server secret', async () => {
+ const result = await createDesktopRecordingUpload(client, 'user-1', BODY);
+ expect(result).toEqual({
+ callRecordingId: SESSION_ID,
+ uploadToken: 'ephemeral-token',
+ apiUrl: 'https://eu-central-1.recall.ai',
+ });
+ expect(
+ mutation.mock.calls[0][0].createCallRecording.__args.data,
+ ).toMatchObject({
+ id: SESSION_ID,
+ status: 'JOINING',
+ companionSession: {
+ userWorkspaceId: 'user-1',
+ source: 'desktop',
+ media: 'audio',
+ },
+ });
+ expect(mutation.mock.invocationCallOrder[0]).toBeLessThan(
+ request.mock.invocationCallOrder[0],
+ );
+ expect(request.mock.calls[0][0]).toMatchObject({
+ method: 'POST',
+ path: '/sdk_upload/',
+ maxAttempts: 1,
+ body: {
+ metadata: {
+ twentyWorkspaceId: 'workspace-1',
+ twentyCallRecordingId: SESSION_ID,
+ },
+ recording_config: { audio_mixed_mp3: {}, video_mixed_mp4: null },
+ },
+ });
+ });
+ it('routes transcript completion using the recording metadata provisioned with the upload', async () => {
+ await createDesktopRecordingUpload(client, 'user-1', BODY);
+ const { recording_config } = request.mock.calls[0][0].body;
+ const body = {
+ event: 'transcript.done',
+ data: {
+ recording: { id: 'recording-1', metadata: recording_config.metadata },
+ transcript: { id: 'transcript-1', metadata: {} },
+ },
+ };
+
+ expect(extractTwentyWorkspaceIdFromRecallWebhook(body)).toBe('workspace-1');
+ expect(recording_config.metadata.twentyCallRecordingId).toBe(SESSION_ID);
+ });
+ it('resumes an owned pending upload without creating another', async () => {
+ query.mockResolvedValue({
+ callRecordings: {
+ edges: [
+ {
+ node: {
+ id: SESSION_ID,
+ status: 'JOINING',
+ companionSession: {
+ source: 'desktop',
+ media: 'audio',
+ userWorkspaceId: 'user-1',
+ sdkUploadId: 'upload-1',
+ },
+ },
+ },
+ ],
+ },
+ });
+ await createDesktopRecordingUpload(client, 'user-1', BODY);
+ expect(request).toHaveBeenCalledWith(
+ expect.objectContaining({ method: 'GET', path: '/sdk_upload/upload-1/' }),
+ );
+ expect(mutation).not.toHaveBeenCalled();
+ });
+ it('never reveals or cancels another user’s session', async () => {
+ query.mockResolvedValue({
+ callRecordings: {
+ edges: [
+ {
+ node: {
+ id: SESSION_ID,
+ status: 'JOINING',
+ companionSession: {
+ source: 'desktop',
+ media: 'audio',
+ userWorkspaceId: 'someone-else',
+ sdkUploadId: 'upload-1',
+ },
+ },
+ },
+ ],
+ },
+ });
+ await expect(
+ createDesktopRecordingUpload(client, 'user-1', BODY),
+ ).rejects.toThrow('another user');
+ await expect(
+ failDesktopRecordingCapture(client, 'user-1', BODY),
+ ).rejects.toThrow('unavailable');
+ expect(request).not.toHaveBeenCalled();
+ expect(mutation).not.toHaveBeenCalled();
+ });
+ it('blocks duplicate calendar capture even when the desktop omits a calendar event ID', async () => {
+ agenda.mockResolvedValue({
+ meetings: [
+ {
+ id: 'event-1',
+ startsAt: new Date(Date.now() - 1000).toISOString(),
+ endsAt: new Date(Date.now() + 60_000).toISOString(),
+ recordingEnabled: true,
+ usesCalendarBot: true,
+ url: 'https://meet.google.com/design-sync',
+ },
+ ],
+ });
+ await expect(
+ createDesktopRecordingUpload(client, 'user-1', {
+ ...BODY,
+ meetingUrl: 'https://meet.google.com/design-sync?authuser=1',
+ }),
+ ).rejects.toThrow('duplicate');
+ expect(request).not.toHaveBeenCalled();
+ });
+ it('allows an unscheduled audio call while an unrelated calendar bot is scheduled', async () => {
+ agenda.mockResolvedValue({
+ meetings: [
+ {
+ id: 'event-1',
+ startsAt: new Date(Date.now() - 1000).toISOString(),
+ endsAt: new Date(Date.now() + 60_000).toISOString(),
+ recordingEnabled: true,
+ usesCalendarBot: true,
+ url: 'https://meet.google.com/design-sync',
+ },
+ ],
+ });
+ await expect(
+ createDesktopRecordingUpload(client, 'user-1', BODY),
+ ).resolves.toMatchObject({ callRecordingId: SESSION_ID });
+ expect(
+ mutation.mock.calls[0][0].createCallRecording.__args.data,
+ ).not.toHaveProperty('calendarEventId');
+ expect(request).toHaveBeenCalledOnce();
+ });
+ it('marks failed setup without retrying an ambiguous provider create', async () => {
+ request.mockResolvedValue({
+ ok: false,
+ status: null,
+ errorMessage: 'timeout',
+ });
+ await expect(
+ createDesktopRecordingUpload(client, 'user-1', BODY),
+ ).rejects.toThrow('prepare');
+ expect(request).toHaveBeenCalledTimes(1);
+ expect(
+ mutation.mock.calls[1][0].updateCallRecording.__args.data.status,
+ ).toBe('FAILED');
+ });
+});
+
+it('does not return an upload token after a concurrent capture failure', async () => {
+ mutation.mockResolvedValue({ updateCallRecordings: [] });
+ await expect(
+ createDesktopRecordingUpload(client, 'user-1', BODY),
+ ).rejects.toThrow('no longer active');
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/download-transcript.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/download-transcript.test.ts
new file mode 100644
index 00000000000..d77602018cb
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/download-transcript.test.ts
@@ -0,0 +1,125 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { downloadTranscript } from 'src/logic-functions/flows/download-transcript.util';
+
+const TRANSCRIPT_DOWNLOAD_URL =
+ 'https://recall-transcripts.example.com/transcript-1';
+const RECALL_TRANSCRIPT_URL =
+ 'https://us-west-2.recall.ai/api/v1/transcript/recall-transcript-1/';
+
+const buildRecallTranscriptResponse = () =>
+ new Response(
+ JSON.stringify({
+ data: { download_url: TRANSCRIPT_DOWNLOAD_URL },
+ status: { code: 'done' },
+ }),
+ { status: 200 },
+ );
+
+describe('downloadTranscript', () => {
+ const fetchMock = vi.fn();
+
+ beforeEach(() => {
+ vi.spyOn(console, 'warn').mockImplementation(() => {});
+ fetchMock.mockReset();
+ vi.stubGlobal('fetch', fetchMock);
+ vi.stubEnv('RECALL_API_KEY', 'recall-api-key');
+ vi.stubEnv('RECALL_REGION', 'us-west-2');
+ });
+
+ afterEach(() => {
+ vi.unstubAllGlobals();
+ vi.unstubAllEnvs();
+ vi.restoreAllMocks();
+ });
+
+ it('downloads transcript content with a timeout', async () => {
+ const transcriptContent = [{ participant: { id: 1 }, words: [] }];
+
+ fetchMock.mockImplementation((url: string) => {
+ if (url === RECALL_TRANSCRIPT_URL) {
+ return Promise.resolve(buildRecallTranscriptResponse());
+ }
+
+ if (url === TRANSCRIPT_DOWNLOAD_URL) {
+ return Promise.resolve(
+ new Response(JSON.stringify(transcriptContent), { status: 200 }),
+ );
+ }
+
+ throw new Error(`Unhandled fetch url in test: ${url}`);
+ });
+
+ const result = await downloadTranscript({
+ transcriptId: 'recall-transcript-1',
+ });
+
+ expect(result).toEqual({ outcome: 'filled', content: transcriptContent });
+ expect(fetchMock).toHaveBeenCalledWith(
+ RECALL_TRANSCRIPT_URL,
+ expect.objectContaining({
+ method: 'GET',
+ headers: { Authorization: 'Token recall-api-key' },
+ }),
+ );
+ expect(fetchMock).toHaveBeenCalledWith(
+ TRANSCRIPT_DOWNLOAD_URL,
+ expect.objectContaining({
+ signal: expect.any(AbortSignal),
+ }),
+ );
+ });
+
+ it('logs raw download failures but returns a generic error', async () => {
+ fetchMock.mockImplementation((url: string) => {
+ if (url === RECALL_TRANSCRIPT_URL) {
+ return Promise.resolve(buildRecallTranscriptResponse());
+ }
+
+ if (url === TRANSCRIPT_DOWNLOAD_URL) {
+ return Promise.reject(new Error('socket leaked detail'));
+ }
+
+ throw new Error(`Unhandled fetch url in test: ${url}`);
+ });
+
+ await expect(
+ downloadTranscript({ transcriptId: 'recall-transcript-1' }),
+ ).resolves.toEqual({
+ outcome: 'error',
+ errorMessage: 'transcript download failed',
+ });
+ expect(console.warn).toHaveBeenCalledWith(
+ expect.stringContaining('socket leaked detail'),
+ );
+ });
+ it.each([{}, 'not a transcript', [null], [{ words: ['invalid'] }]])(
+ 'rejects malformed transcript content (%j)',
+ async (content) => {
+ fetchMock
+ .mockResolvedValueOnce(buildRecallTranscriptResponse())
+ .mockResolvedValueOnce(
+ new Response(JSON.stringify(content), { status: 200 }),
+ );
+ expect(
+ await downloadTranscript({ transcriptId: 'recall-transcript-1' }),
+ ).toMatchObject({ outcome: 'error' });
+ },
+ );
+
+ it('recognizes deletion even if the provider still returns an old download URL', async () => {
+ fetchMock.mockResolvedValue(
+ new Response(
+ JSON.stringify({
+ data: { download_url: TRANSCRIPT_DOWNLOAD_URL },
+ status: { code: 'deleted' },
+ }),
+ { status: 200 },
+ ),
+ );
+ expect(
+ await downloadTranscript({ transcriptId: 'recall-transcript-1' }),
+ ).toEqual({ outcome: 'deleted' });
+ expect(fetchMock).toHaveBeenCalledOnce();
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/failed-transcript-audio-recovery.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/failed-transcript-audio-recovery.test.ts
new file mode 100644
index 00000000000..9d65c9ce6ef
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/failed-transcript-audio-recovery.test.ts
@@ -0,0 +1,96 @@
+import { beforeEach, expect, it, vi } from 'vitest';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+import {
+ syncCallRecording,
+ type SyncableCallRecording,
+} from 'src/logic-functions/flows/sync-call-recording.util';
+
+const { listTranscripts, importMedia, charge } = vi.hoisted(() => ({
+ listTranscripts: vi.fn(),
+ importMedia: vi.fn(),
+ charge: vi.fn(),
+}));
+vi.mock('src/logic-functions/recall-api/list-recall-transcripts.util', () => ({
+ listRecallTranscripts: listTranscripts,
+}));
+vi.mock('src/logic-functions/flows/import-call-recording-media.util', () => ({
+ importCallRecordingMedia: importMedia,
+}));
+vi.mock('twenty-sdk/billing', () => ({ chargeCredits: charge }));
+
+beforeEach(() => vi.clearAllMocks());
+
+it.each([false, true])(
+ 'terminates a failed transcript after audio recovery (oversized: %s)',
+ async (oversized) => {
+ const recording: SyncableCallRecording = {
+ id: 'recording-1',
+ status: 'PROCESSING',
+ companionSession: { source: 'desktop', media: 'audio' },
+ externalRecordingId: 'provider-recording-1',
+ startedAt: '2026-09-08T10:00:00Z',
+ endedAt: '2026-09-08T10:01:00Z',
+ transcript: undefined,
+ companionFailureReason: undefined,
+ audio: undefined,
+ video: undefined,
+ };
+ const mutation = vi.fn(
+ async (input: {
+ updateCallRecording?: { __args: { data: object } };
+ updateCallRecordings?: { __args: { data: object } };
+ }) => {
+ const data =
+ input.updateCallRecording?.__args.data ??
+ input.updateCallRecordings?.__args.data;
+ Object.assign(recording, data);
+ return { updateCallRecordings: [{ id: recording.id }] };
+ },
+ );
+ const client = { mutation } as unknown as CoreApiClient;
+ listTranscripts.mockResolvedValue({
+ ok: true,
+ transcripts: [
+ {
+ id: 'transcript-1',
+ statusCode: 'failed',
+ statusSubCode: 'provider_error',
+ },
+ ],
+ });
+ importMedia.mockResolvedValueOnce({}).mockResolvedValueOnce(
+ oversized
+ ? { companionFailureReason: 'audio_file_too_large' }
+ : {
+ audio: [{ fileId: 'saved-audio', label: 'audio.mp3' }],
+ },
+ );
+ const sync = () =>
+ syncCallRecording({
+ client,
+ callRecording: { ...recording },
+ requestedAt: '2026-09-08T10:02:00Z',
+ });
+
+ await sync();
+ expect(recording.status).toBe('PROCESSING');
+ expect(recording.transcript).toMatchObject({ status: 'FAILED' });
+ expect(recording.audio).toBeUndefined();
+ expect(charge).not.toHaveBeenCalled();
+
+ await sync();
+ expect(recording.status).toBe('FAILED');
+ if (oversized)
+ expect(recording.companionFailureReason).toContain(
+ 'audio_file_too_large',
+ );
+ else
+ expect(recording.audio).toEqual([
+ { fileId: 'saved-audio', label: 'audio.mp3' },
+ ]);
+ expect(recording.transcript).toMatchObject({ status: 'FAILED' });
+ expect(listTranscripts).toHaveBeenCalledTimes(2);
+ expect(charge).not.toHaveBeenCalled();
+ },
+);
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/generate-call-recording-summary.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/generate-call-recording-summary.test.ts
new file mode 100644
index 00000000000..46675dfab63
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/generate-call-recording-summary.test.ts
@@ -0,0 +1,402 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+import { generateCallRecordingSummary } from 'src/logic-functions/flows/generate-call-recording-summary.util';
+
+const runAgentMock = vi.hoisted(() => vi.fn());
+const stored = vi.hoisted(() => new Map<string, unknown>());
+const saveCache = vi.hoisted(() => vi.fn());
+
+vi.mock('twenty-sdk/logic-function', async (importOriginal) => ({
+ ...(await importOriginal<object>()),
+ runAgent: runAgentMock,
+ kv: {
+ get: async (key: string) => stored.get(key) ?? null,
+ set: saveCache,
+ delete: async (key: string) => {
+ stored.delete(key);
+ },
+ },
+}));
+
+const TRANSCRIPT = [
+ {
+ participant: { name: 'Alex' },
+ words: [{ text: 'Hello' }, { text: 'team' }],
+ },
+];
+
+const queryMock = vi.fn();
+const mutationMock = vi.fn();
+
+const CLIENT = {
+ query: queryMock,
+ mutation: mutationMock,
+} as unknown as CoreApiClient;
+
+const seedCallRecording = (node: object) => {
+ queryMock.mockResolvedValue({
+ callRecordings: {
+ edges: [
+ {
+ node: {
+ companionSession: {
+ source: 'desktop',
+ media: 'audio',
+ userWorkspaceId: 'owner',
+ },
+ ...node,
+ },
+ },
+ ],
+ },
+ });
+};
+
+describe('generateCallRecordingSummary', () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ stored.clear();
+ saveCache.mockImplementation(async (key: string, value: unknown) => {
+ stored.set(key, value);
+ });
+ vi.stubEnv('COMPANION_SUMMARY_ENABLED', 'true');
+ vi.stubEnv('COMPANION_ADDITIONAL_SUMMARY_PROMPT', '');
+ seedCallRecording({
+ id: 'call-recording-1',
+ title: 'Weekly sync',
+ transcript: TRANSCRIPT,
+ summary: { markdown: null },
+ createdBy: { source: 'APPLICATION', name: 'Desktop Recorder' },
+ });
+ mutationMock.mockResolvedValue({
+ updateCallRecordings: [{ id: 'call-recording-1' }],
+ });
+ runAgentMock.mockResolvedValue({
+ success: true,
+ error: null,
+ result: { response: '## Overview\nGood call.' },
+ });
+ });
+
+ afterEach(() => {
+ vi.unstubAllEnvs();
+ });
+
+ it('skips when summaries are disabled', async () => {
+ vi.stubEnv('COMPANION_SUMMARY_ENABLED', 'false');
+
+ const result = await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ });
+
+ expect(result).toEqual({ outcome: 'disabled' });
+ expect(queryMock).not.toHaveBeenCalled();
+ expect(runAgentMock).not.toHaveBeenCalled();
+ });
+
+ it('skips when there is no real transcript', async () => {
+ seedCallRecording({
+ id: 'call-recording-1',
+ title: null,
+ transcript: { status: 'PENDING' },
+ summary: { markdown: null },
+ });
+
+ const result = await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ });
+
+ expect(result).toEqual({ outcome: 'no-transcript' });
+ expect(runAgentMock).not.toHaveBeenCalled();
+ });
+
+ it('skips when a summary already exists', async () => {
+ seedCallRecording({
+ id: 'call-recording-1',
+ title: null,
+ transcript: TRANSCRIPT,
+ summary: { markdown: '## Overview\nAlready here.' },
+ });
+
+ const result = await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ });
+
+ expect(result).toEqual({ outcome: 'already-summarized' });
+ expect(runAgentMock).not.toHaveBeenCalled();
+ });
+
+ it('regenerates an existing summary when explicitly requested', async () => {
+ seedCallRecording({
+ id: 'call-recording-1',
+ title: null,
+ transcript: TRANSCRIPT,
+ summary: { markdown: '## Overview\nOld summary.' },
+ });
+
+ const result = await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ shouldRegenerateExistingSummary: true,
+ });
+
+ expect(result).toEqual({ outcome: 'generated' });
+ expect(runAgentMock).toHaveBeenCalledTimes(1);
+ expect(mutationMock).toHaveBeenCalledTimes(1);
+ });
+
+ it('skips recordings without Companion ownership', async () => {
+ seedCallRecording({
+ id: 'call-recording-1',
+ companionSession: null,
+ title: null,
+ transcript: TRANSCRIPT,
+ summary: { markdown: null },
+ createdBy: { source: 'MANUAL', name: 'Alex' },
+ });
+
+ const result = await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ });
+
+ expect(result).toEqual({ outcome: 'not-app-recording' });
+ expect(runAgentMock).not.toHaveBeenCalled();
+ });
+
+ it('generates for Companion-owned recordings', async () => {
+ const result = await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ });
+
+ expect(result).toEqual({ outcome: 'generated' });
+ expect(runAgentMock).toHaveBeenCalledTimes(1);
+ expect(mutationMock).toHaveBeenCalledTimes(1);
+ });
+
+ it('automatically summarizes desktop captures attributed to the signed-in user', async () => {
+ seedCallRecording({
+ id: 'call-recording-1',
+ transcript: TRANSCRIPT,
+ createdBy: { source: 'MANUAL', name: 'Alex' },
+ companionSession: {
+ source: 'desktop',
+ media: 'audio',
+ userWorkspaceId: 'user-workspace-1',
+ sdkUploadId: 'sdk-upload-1',
+ },
+ });
+
+ const result = await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ });
+
+ expect(result).toEqual({ outcome: 'generated' });
+ expect(runAgentMock).toHaveBeenCalledOnce();
+ expect(mutationMock).toHaveBeenCalledOnce();
+ });
+
+ it('retries a failed record save from the durable result without paying for another agent run', async () => {
+ mutationMock.mockRejectedValueOnce(new Error('Write timed out'));
+ await expect(
+ generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ }),
+ ).rejects.toThrow('Write timed out');
+ expect(
+ stored.get('companion-summary:call-recording-1:automatic'),
+ ).toMatchObject({ status: 'READY' });
+ expect(
+ await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ }),
+ ).toEqual({ outcome: 'generated' });
+ expect(runAgentMock).toHaveBeenCalledTimes(1);
+ });
+
+ it('reports an interrupted request without automatically charging again', async () => {
+ stored.set('companion-summary:call-recording-1:automatic', {
+ status: 'RUNNING',
+ startedAt: new Date(Date.now() - 16 * 60_000).toISOString(),
+ });
+ expect(
+ await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ }),
+ ).toEqual({ outcome: 'interrupted' });
+ expect(runAgentMock).not.toHaveBeenCalled();
+ expect(mutationMock).not.toHaveBeenCalled();
+ });
+
+ it('preserves a summary changed while generation was running', async () => {
+ mutationMock.mockResolvedValueOnce({ updateCallRecordings: [] });
+ expect(
+ await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ }),
+ ).toEqual({ outcome: 'already-summarized' });
+ expect(
+ stored.get('companion-summary:call-recording-1:automatic'),
+ ).toMatchObject({ status: 'READY' });
+ });
+
+ it('reports persistent storage failure without repeating a paid generation', async () => {
+ saveCache
+ .mockImplementationOnce(async (key: string, value: unknown) => {
+ stored.set(key, value);
+ })
+ .mockRejectedValueOnce(new Error('Database unavailable'))
+ .mockRejectedValueOnce(new Error('Database unavailable'))
+ .mockRejectedValueOnce(new Error('Database unavailable'))
+ .mockRejectedValueOnce(new Error('Database unavailable'));
+ await expect(
+ generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ }),
+ ).rejects.toThrow('Database unavailable');
+ await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ });
+ expect(runAgentMock).toHaveBeenCalledTimes(1);
+ });
+
+ it('retries persisting the paid output after a temporary key-value write failure', async () => {
+ saveCache
+ .mockImplementationOnce(async (key: string, value: unknown) => {
+ stored.set(key, value);
+ })
+ .mockRejectedValueOnce(new Error('temporary storage failure'));
+ expect(
+ await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ }),
+ ).toEqual({ outcome: 'generated' });
+ expect(runAgentMock).toHaveBeenCalledTimes(1);
+ expect(saveCache).toHaveBeenCalledTimes(3);
+ });
+
+ it('generates for recordings another actor created when explicitly requested', async () => {
+ seedCallRecording({
+ id: 'call-recording-1',
+ title: null,
+ transcript: TRANSCRIPT,
+ summary: { markdown: null },
+ createdBy: { source: 'MANUAL', name: 'Alex' },
+ });
+
+ const result = await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ });
+
+ expect(result).toEqual({ outcome: 'generated' });
+ });
+
+ it('runs the agent and stores the summary markdown on the happy path', async () => {
+ const result = await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ });
+
+ expect(result).toEqual({ outcome: 'generated' });
+ expect(runAgentMock).toHaveBeenCalledWith(
+ expect.objectContaining({
+ prompt: expect.stringContaining('Alex: Hello team'),
+ }),
+ );
+ expect(mutationMock).toHaveBeenCalledWith({
+ updateCallRecordings: {
+ __args: {
+ filter: {
+ id: { eq: 'call-recording-1' },
+ or: [
+ { summary: { markdown: { is: 'NULL' } } },
+ { summary: { markdown: { eq: '' } } },
+ ],
+ },
+ data: {
+ summary: { blocknote: null, markdown: '## Overview\nGood call.' },
+ },
+ },
+ id: true,
+ },
+ });
+ });
+
+ it('appends the workspace admin instructions to the agent prompt', async () => {
+ vi.stubEnv('COMPANION_ADDITIONAL_SUMMARY_PROMPT', 'Write terse notes.');
+
+ await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ });
+
+ expect(runAgentMock).toHaveBeenCalledWith(
+ expect.objectContaining({
+ prompt: expect.stringContaining(
+ 'Additional instructions from the workspace admin:\nWrite terse notes.\n\nMeeting title: Weekly sync',
+ ),
+ }),
+ );
+ });
+
+ it('stores a grounded unavailable placeholder so the run is terminal', async () => {
+ runAgentMock.mockResolvedValue({
+ success: true,
+ error: null,
+ result: {
+ response:
+ 'SUMMARY_UNAVAILABLE: The transcript contains only greetings and audio checks.',
+ },
+ });
+
+ const result = await generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ });
+
+ expect(result).toEqual({ outcome: 'not-summarizable' });
+ expect(mutationMock).toHaveBeenCalledWith({
+ updateCallRecordings: {
+ __args: {
+ filter: {
+ id: { eq: 'call-recording-1' },
+ or: [
+ { summary: { markdown: { is: 'NULL' } } },
+ { summary: { markdown: { eq: '' } } },
+ ],
+ },
+ data: {
+ summary: {
+ blocknote: null,
+ markdown:
+ '## Summary unavailable\n\nThe transcript contains only greetings and audio checks.',
+ },
+ },
+ },
+ id: true,
+ },
+ });
+ });
+
+ it('reports an unsuccessful agent run without caching empty success', async () => {
+ runAgentMock.mockResolvedValue({
+ success: false,
+ error: 'no more available credits',
+ result: null,
+ });
+ await expect(
+ generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ }),
+ ).rejects.toThrow('no usable result');
+ expect(mutationMock).not.toHaveBeenCalled();
+ });
+
+ it('propagates agent errors without writing a summary', async () => {
+ runAgentMock.mockRejectedValue(new Error('Agent execution failed'));
+
+ await expect(
+ generateCallRecordingSummary(CLIENT, {
+ callRecordingId: 'call-recording-1',
+ }),
+ ).rejects.toThrow('Agent execution failed');
+
+ expect(mutationMock).not.toHaveBeenCalled();
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-call-recording-charge.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-call-recording-charge.test.ts
new file mode 100644
index 00000000000..68373b14afb
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-call-recording-charge.test.ts
@@ -0,0 +1,73 @@
+import { beforeEach, expect, it, vi } from 'vitest';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { getCallRecordingCharge } from 'src/logic-functions/flows/get-call-recording-charge.util';
+
+const { charge, ownedUpload, provider } = vi.hoisted(() => ({
+ charge: vi.fn(),
+ ownedUpload: vi.fn(),
+ provider: vi.fn(),
+}));
+vi.mock('twenty-sdk/billing', () => ({ chargeCredits: charge }));
+vi.mock('src/logic-functions/recall-api/get-owned-desktop-upload.util', () => ({
+ getOwnedDesktopUpload: ownedUpload,
+}));
+vi.mock('src/logic-functions/recall-api/get-recall-recording.util', () => ({
+ getRecallRecording: provider,
+}));
+const query = vi.fn();
+const client = { query } as unknown as CoreApiClient;
+const run = () =>
+ getCallRecordingCharge(client, { callRecordingId: 'recording-1' });
+
+beforeEach(() => {
+ vi.resetAllMocks();
+ query.mockResolvedValue({
+ callRecordings: {
+ edges: [
+ {
+ node: {
+ id: 'recording-1',
+ status: 'PROCESSING',
+ companionSession: { source: 'desktop', media: 'audio' },
+ externalRecordingId: 'provider-1',
+ },
+ },
+ ],
+ },
+ });
+ ownedUpload.mockResolvedValue({
+ id: 'upload-1',
+ recording_id: 'provider-1',
+ status: { code: 'complete' },
+ });
+ provider.mockResolvedValue({
+ ok: true,
+ recording: {
+ started_at: '2026-09-08T10:00:00Z',
+ completed_at: '2026-09-08T10:30:00Z',
+ },
+ });
+});
+
+it('prepares the existing SDK charge using provider duration without charging', async () => {
+ expect(await run()).toEqual({
+ creditsUsedMicro: 500_000,
+ quantity: 30,
+ operationType: 'CALL_RECORDING',
+ resourceContext: 'recall',
+ });
+ expect(charge).not.toHaveBeenCalled();
+});
+
+it('does not bill an unknown provider duration', async () => {
+ provider.mockResolvedValue({ ok: true, recording: {} });
+ await expect(run()).rejects.toThrow('no usable provider duration');
+ expect(charge).not.toHaveBeenCalled();
+});
+
+it('does not bill forged provider IDs', async () => {
+ ownedUpload.mockResolvedValue(undefined);
+ await expect(run()).rejects.toThrow('owned desktop upload');
+ expect(provider).not.toHaveBeenCalled();
+ expect(charge).not.toHaveBeenCalled();
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-desktop-companion-agenda.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-desktop-companion-agenda.test.ts
new file mode 100644
index 00000000000..b2362686a50
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-desktop-companion-agenda.test.ts
@@ -0,0 +1,94 @@
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { afterEach, beforeEach, expect, it, vi } from 'vitest';
+
+import { getDesktopCompanionAgenda } from 'src/logic-functions/flows/get-desktop-companion-agenda.util';
+
+const { post } = vi.hoisted(() => ({ post: vi.fn() }));
+vi.mock('twenty-client-sdk/rest', () => ({
+ RestApiClient: class {
+ post = post;
+ },
+}));
+vi.mock('src/logic-functions/data/get-current-workspace-id.util', () => ({
+ getCurrentWorkspaceId: () => 'workspace-1',
+}));
+const query = vi.fn();
+const client = { query } as unknown as CoreApiClient;
+const page = (nodes: object[]) => ({
+ edges: nodes.map((node) => ({ node })),
+ pageInfo: { hasNextPage: false, endCursor: null },
+});
+
+beforeEach(() => {
+ vi.resetAllMocks();
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date('2026-09-08T10:00:00Z'));
+});
+afterEach(() => vi.useRealTimers());
+
+it('reads a personal agenda without another app schema and only returns recordings owned by the user', async () => {
+ post.mockResolvedValue({
+ data: {
+ myCalendarChannels: [{ id: 'channel-1' }],
+ currentWorkspace: { id: 'workspace-1', displayName: 'Apple' },
+ },
+ });
+ const event = {
+ startsAt: '2026-09-08T11:00:00Z',
+ endsAt: '2026-09-08T12:00:00Z',
+ };
+ query
+ .mockResolvedValueOnce({
+ calendarEvents: page([
+ { id: 'own-event', title: 'My meeting', ...event },
+ { id: 'other-event', title: 'Another calendar', ...event },
+ ]),
+ })
+ .mockResolvedValueOnce({
+ calendarChannelEventAssociations: page([
+ { calendarEventId: 'own-event' },
+ ]),
+ })
+ .mockResolvedValueOnce({
+ callRecordings: page([{ calendarEventId: 'own-event' }]),
+ })
+ .mockResolvedValueOnce({
+ callRecordings: page([
+ {
+ id: 'own-recording',
+ companionSession: { userWorkspaceId: 'user-1' },
+ },
+ {
+ id: 'other-recording',
+ companionSession: { userWorkspaceId: 'user-12' },
+ },
+ ]),
+ });
+
+ const agenda = await getDesktopCompanionAgenda(client, 'user-1');
+ expect(agenda.meetings).toEqual([
+ expect.objectContaining({ id: 'own-event', usesCalendarBot: true }),
+ ]);
+ expect(agenda.recordings).toEqual([
+ { id: 'own-recording', participants: [] },
+ ]);
+ const queries = JSON.stringify(query.mock.calls);
+ expect(queries).not.toMatch(/callRecorder|desktopRecordingSession/);
+ expect(queries).toContain('companionSession');
+});
+
+it('keeps recordings available when no calendar is connected', async () => {
+ post.mockResolvedValue({
+ data: {
+ myCalendarChannels: [],
+ currentWorkspace: { id: 'workspace-1', displayName: 'Apple' },
+ },
+ });
+ query.mockResolvedValue({ callRecordings: page([]) });
+ expect(await getDesktopCompanionAgenda(client, 'user-1')).toMatchObject({
+ calendarConnected: false,
+ meetings: [],
+ recordings: [],
+ });
+ expect(query).toHaveBeenCalledTimes(1);
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-recording-participants.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-recording-participants.test.ts
new file mode 100644
index 00000000000..2a42d0064de
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-recording-participants.test.ts
@@ -0,0 +1,178 @@
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { beforeEach, expect, it, vi } from 'vitest';
+
+import { getRecordingParticipants } from 'src/logic-functions/flows/get-recording-participants.util';
+
+const query = vi.fn();
+const client = { query } as unknown as CoreApiClient;
+const page = (nodes: object[], next?: string) => ({
+ edges: nodes.map((node) => ({ node })),
+ pageInfo: { hasNextPage: Boolean(next), endCursor: next ?? null },
+});
+const viewer = {
+ name: 'Tim Apple',
+ workspaceMemberId: 'self-member',
+};
+const recording = { id: 'recording-1', calendarEventId: 'event-1' };
+const attendee = {
+ calendarEventId: 'event-1',
+ displayName: 'Alex',
+ handle: '[email protected]',
+};
+beforeEach(() => vi.resetAllMocks());
+
+it('uses CRM name and photo, excludes self, aliases and declined attendees, and deduplicates contacts', async () => {
+ query
+ .mockResolvedValueOnce({
+ calendarEventParticipants: page([
+ attendee,
+ { ...attendee, handle: '[email protected]' },
+ { ...attendee, handle: '[email protected]' },
+ { ...attendee, handle: '[email protected]' },
+ {
+ ...attendee,
+ handle: '[email protected]',
+ workspaceMemberId: 'self-member',
+ },
+ {
+ ...attendee,
+ handle: '[email protected]',
+ responseStatus: 'DECLINED',
+ },
+ ]),
+ })
+ .mockResolvedValueOnce({
+ people: page([
+ {
+ id: 'alex',
+ name: { firstName: 'Alex', lastName: 'Martin' },
+ avatarUrl: '/avatars/alex.png',
+ emails: {
+ primaryEmail: '[email protected]',
+ additionalEmails: ['[email protected]'],
+ },
+ },
+ ]),
+ });
+ const result = await getRecordingParticipants(client, [recording], viewer);
+ expect(result.get(recording.id)).toEqual([
+ { id: 'person:alex', name: 'Alex Martin', avatarUrl: '/avatars/alex.png' },
+ ]);
+});
+
+it('paginates attendees and keeps each recording associated with its own people', async () => {
+ const person = {
+ id: 'alex',
+ name: { firstName: 'Alex', lastName: 'Martin' },
+ };
+ query
+ .mockResolvedValueOnce({
+ calendarEventParticipants: page([{ ...attendee, person }], 'next'),
+ })
+ .mockResolvedValueOnce({
+ calendarEventParticipants: page([
+ {
+ ...attendee,
+ handle: '[email protected]',
+ displayName: 'Sam Lee',
+ person: { id: 'sam' },
+ },
+ {
+ ...attendee,
+ calendarEventId: 'event-2',
+ person: { id: 'morgan', name: { firstName: 'Morgan' } },
+ },
+ ]),
+ });
+ const result = await getRecordingParticipants(
+ client,
+ [recording, { id: 'recording-2', calendarEventId: 'event-2' }],
+ viewer,
+ );
+ expect(
+ result.get(recording.id)?.map((participant) => participant.name),
+ ).toEqual(['Alex Martin', 'Sam Lee']);
+ expect(
+ result.get('recording-2')?.map((participant) => participant.name),
+ ).toEqual(['Morgan']);
+ expect(query.mock.calls[1][0].calendarEventParticipants.__args.after).toBe(
+ 'next',
+ );
+});
+
+it('uses detected speakers for unscheduled calls, removing self and repeated or anonymous speakers', async () => {
+ const transcript = [
+ 'Tim Apple',
+ 'Alex Martin',
+ 'Alex Martin',
+ 'You',
+ 'Speaker 1',
+ 'Sam Lee',
+ 'Unknown speaker',
+ 'Host',
+ 'Guest',
+ ].map((name) => ({ participant: { name }, words: [] }));
+ const result = await getRecordingParticipants(
+ client,
+ [{ id: 'unscheduled', transcript }],
+ viewer,
+ );
+ expect(result.get('unscheduled')).toEqual([
+ { id: 'name:alex martin', name: 'Alex Martin', avatarUrl: null },
+ { id: 'name:sam lee', name: 'Sam Lee', avatarUrl: null },
+ ]);
+ expect(query).not.toHaveBeenCalled();
+});
+
+it('returns no participant instead of substituting the signed-in user or guessing from the title', async () => {
+ const result = await getRecordingParticipants(
+ client,
+ [{ id: 'empty', transcript: { status: 'PENDING' } }],
+ viewer,
+ );
+ expect(result.get('empty')).toEqual([]);
+});
+
+it('does not attach a photo from a partial email match', async () => {
+ query
+ .mockResolvedValueOnce({ calendarEventParticipants: page([attendee]) })
+ .mockResolvedValueOnce({
+ people: page([
+ {
+ id: 'different',
+ name: { firstName: 'Wrong person' },
+ avatarUrl: '/wrong.png',
+ emails: { primaryEmail: '[email protected]' },
+ },
+ ]),
+ });
+ const result = await getRecordingParticipants(client, [recording], viewer);
+ expect(result.get(recording.id)).toEqual([
+ { id: 'email:[email protected]', name: 'Alex', avatarUrl: null },
+ ]);
+});
+
+it('reuses a linked workspace member photo without a CRM contact', async () => {
+ query.mockResolvedValueOnce({
+ calendarEventParticipants: page([
+ {
+ ...attendee,
+ handle: null,
+ workspaceMember: {
+ id: 'colleague',
+ name: { firstName: 'Alex', lastName: 'Martin' },
+ avatarUrl: '/colleague.png',
+ },
+ },
+ ]),
+ });
+ const result = await getRecordingParticipants(client, [recording], viewer);
+ expect(result.get(recording.id)).toEqual([
+ {
+ id: 'member:colleague',
+ name: 'Alex Martin',
+ avatarUrl: '/colleague.png',
+ },
+ ]);
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/handle-recall-webhook.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/handle-recall-webhook.test.ts
new file mode 100644
index 00000000000..a0fc6d3d672
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/handle-recall-webhook.test.ts
@@ -0,0 +1,137 @@
+import { beforeEach, expect, it, vi } from 'vitest';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { handleRecallWebhook } from '../handle-recall-webhook.util';
+
+const { enqueue, ownedUpload } = vi.hoisted(() => ({
+ enqueue: vi.fn(),
+ ownedUpload: vi.fn(),
+}));
+vi.mock('src/logic-functions/recall-api/get-owned-desktop-upload.util', () => ({
+ getOwnedDesktopUpload: ownedUpload,
+}));
+vi.mock(
+ 'src/logic-functions/data/enqueue-call-recording-artifacts-import.util',
+ () => ({ enqueueCallRecordingArtifactsImport: enqueue }),
+);
+const query = vi.fn();
+const mutation = vi.fn();
+const client = { query, mutation } as unknown as CoreApiClient;
+const session = {
+ source: 'desktop',
+ media: 'audio',
+ userWorkspaceId: 'owner',
+ sdkUploadId: 'upload-1',
+};
+const webhook = (event: string, source = 'companion') => ({
+ event,
+ data: {
+ sdk_upload: {
+ id: 'upload-1',
+ metadata: {
+ twentyRecordingSource: source,
+ twentyCallRecordingId: 'recording-1',
+ },
+ },
+ recording: { id: 'recall-1' },
+ },
+});
+beforeEach(() => {
+ vi.clearAllMocks();
+ ownedUpload.mockResolvedValue({
+ id: 'upload-1',
+ recording_id: 'recall-1',
+ status: { code: 'complete' },
+ });
+ query.mockResolvedValue({
+ callRecordings: {
+ edges: [
+ {
+ node: {
+ id: 'recording-1',
+ status: 'JOINING',
+ companionSession: session,
+ },
+ },
+ ],
+ },
+ });
+ mutation.mockResolvedValue({ updateCallRecordings: [{ id: 'recording-1' }] });
+});
+
+it('ignores another app before looking up or changing its records', async () => {
+ expect(
+ await handleRecallWebhook({
+ client,
+ body: webhook('sdk_upload.complete', 'call-recorder'),
+ }),
+ ).toMatchObject({ status: 'skipped' });
+ expect(query).not.toHaveBeenCalled();
+ expect(mutation).not.toHaveBeenCalled();
+ expect(enqueue).not.toHaveBeenCalled();
+});
+
+it('rejects metadata pointing at a record not owned by Companion', async () => {
+ query.mockResolvedValue({
+ callRecordings: {
+ edges: [{ node: { id: 'recording-1', status: 'RECORDING' } }],
+ },
+ });
+ expect(
+ await handleRecallWebhook({ client, body: webhook('sdk_upload.complete') }),
+ ).toMatchObject({ status: 'skipped', reason: 'no matching call recording' });
+ expect(mutation).not.toHaveBeenCalled();
+ expect(enqueue).not.toHaveBeenCalled();
+});
+
+it.each([
+ ['sdk_upload.recording_started', 'RECORDING'],
+ ['sdk_upload.recording_ended', 'PROCESSING'],
+ ['sdk_upload.complete', 'PROCESSING'],
+ ['sdk_upload.failed', 'FAILED'],
+])('handles %s on a Companion session', async (event, status) => {
+ expect(
+ await handleRecallWebhook({ client, body: webhook(event) }),
+ ).toMatchObject({ status: 'updated', callRecordingStatus: status });
+ expect(mutation).toHaveBeenCalledWith(
+ expect.objectContaining({
+ updateCallRecordings: expect.objectContaining({
+ __args: expect.objectContaining({
+ data: expect.objectContaining({ status }),
+ }),
+ }),
+ }),
+ );
+ if (event === 'sdk_upload.complete') expect(enqueue).toHaveBeenCalledOnce();
+ else expect(enqueue).not.toHaveBeenCalled();
+});
+
+it.each(['transcript.done', 'transcript.failed'])(
+ 'queues %s through the durable importer',
+ async (event) => {
+ expect(
+ await handleRecallWebhook({ client, body: webhook(event) }),
+ ).toMatchObject({ status: 'queued' });
+ expect(enqueue).toHaveBeenCalledWith({ callRecordingId: 'recording-1' });
+ expect(mutation).not.toHaveBeenCalled();
+ },
+);
+
+it('does not enqueue an import after losing a race with completion', async () => {
+ mutation.mockResolvedValue({ updateCallRecordings: [] });
+ expect(
+ await handleRecallWebhook({ client, body: webhook('sdk_upload.complete') }),
+ ).toMatchObject({ status: 'skipped' });
+ expect(enqueue).not.toHaveBeenCalled();
+});
+
+it('rejects a webhook recording ID that differs from the provider upload', async () => {
+ ownedUpload.mockResolvedValue({
+ id: 'upload-1',
+ recording_id: 'another-recording',
+ });
+ expect(
+ await handleRecallWebhook({ client, body: webhook('sdk_upload.complete') }),
+ ).toMatchObject({ status: 'skipped' });
+ expect(mutation).not.toHaveBeenCalled();
+ expect(enqueue).not.toHaveBeenCalled();
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-call-recording-artifacts.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-call-recording-artifacts.test.ts
new file mode 100644
index 00000000000..fec2e5dbb76
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-call-recording-artifacts.test.ts
@@ -0,0 +1,160 @@
+import { beforeEach, expect, it, vi } from 'vitest';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { importCallRecordingArtifacts } from '../import-call-recording-artifacts.util';
+
+const { claim, release, hydrate, sync, ownedUpload } = vi.hoisted(() => ({
+ ownedUpload: vi.fn(),
+ claim: vi.fn(),
+ release: vi.fn(),
+ hydrate: vi.fn(),
+ sync: vi.fn(),
+}));
+vi.mock(
+ 'src/logic-functions/data/claim-call-recording-artifacts-import.util',
+ () => ({
+ claimCallRecordingArtifactsImport: claim,
+ releaseCallRecordingArtifactsImportClaim: release,
+ }),
+);
+vi.mock('src/logic-functions/flows/recover-desktop-recordings.util', () => ({
+ hydrateDesktopRecordingTimestamps: hydrate,
+}));
+vi.mock('src/logic-functions/flows/sync-call-recording.util', () => ({
+ syncCallRecording: sync,
+}));
+vi.mock('src/logic-functions/recall-api/get-owned-desktop-upload.util', () => ({
+ getOwnedDesktopUpload: ownedUpload,
+}));
+const query = vi.fn();
+const client = { query } as unknown as CoreApiClient;
+const request = {
+ callRecordingId: 'recording-1',
+ requestedAt: '2026-09-08T10:00:00.000Z',
+};
+
+beforeEach(() => {
+ vi.resetAllMocks();
+ ownedUpload.mockResolvedValue({
+ id: 'upload-1',
+ recording_id: 'trusted-recall-id',
+ status: { code: 'complete' },
+ });
+ query.mockResolvedValue({
+ callRecordings: {
+ edges: [
+ {
+ node: {
+ id: request.callRecordingId,
+ externalRecordingId: 'trusted-recall-id',
+ status: 'PROCESSING',
+ companionSession: {
+ source: 'desktop',
+ media: 'audio',
+ userWorkspaceId: 'owner',
+ sdkUploadId: 'upload-1',
+ },
+ },
+ },
+ ],
+ },
+ });
+ claim.mockResolvedValue(true);
+ sync.mockResolvedValue({ updated: true });
+});
+
+it('does not import a Call Recorder record even when a job supplies its ID', async () => {
+ query.mockResolvedValue({
+ callRecordings: {
+ edges: [
+ {
+ node: {
+ id: request.callRecordingId,
+ externalRecordingId: 'other-recall-id',
+ },
+ },
+ ],
+ },
+ });
+ expect(await importCallRecordingArtifacts({ client, request })).toMatchObject(
+ { status: 'skipped' },
+ );
+ expect(claim).not.toHaveBeenCalled();
+ expect(sync).not.toHaveBeenCalled();
+});
+
+it('imports the persisted Companion recording under an exclusive lease', async () => {
+ expect(await importCallRecordingArtifacts({ client, request })).toMatchObject(
+ { status: 'imported' },
+ );
+ expect(hydrate).toHaveBeenCalledOnce();
+ expect(sync).toHaveBeenCalledWith(
+ expect.objectContaining({
+ callRecording: expect.objectContaining({
+ id: request.callRecordingId,
+ externalRecordingId: 'trusted-recall-id',
+ }),
+ }),
+ );
+ expect(release).toHaveBeenCalledOnce();
+});
+
+it('does no provider work when another worker holds the lease', async () => {
+ claim.mockResolvedValue(false);
+ expect(await importCallRecordingArtifacts({ client, request })).toMatchObject(
+ { status: 'skipped', reason: 'artifact import already in progress' },
+ );
+ expect(hydrate).not.toHaveBeenCalled();
+ expect(sync).not.toHaveBeenCalled();
+ expect(release).not.toHaveBeenCalled();
+});
+
+it('releases the lease after a retryable import failure', async () => {
+ sync.mockRejectedValue(new Error('Recall unavailable'));
+ await expect(
+ importCallRecordingArtifacts({ client, request }),
+ ).rejects.toThrow('Recall unavailable');
+ expect(release).toHaveBeenCalledOnce();
+});
+
+it('never imports a provider recording unrelated to the verified upload', async () => {
+ ownedUpload.mockResolvedValue({
+ id: 'upload-1',
+ recording_id: 'foreign',
+ status: { code: 'complete' },
+ });
+ expect(await importCallRecordingArtifacts({ client, request })).toMatchObject(
+ { status: 'skipped' },
+ );
+ expect(sync).not.toHaveBeenCalled();
+ expect(hydrate).not.toHaveBeenCalled();
+ expect(release).toHaveBeenCalledOnce();
+});
+
+it('rereads artifacts after claiming so a delayed worker does not reimport stale data', async () => {
+ claim.mockImplementation(async () => {
+ query.mockResolvedValue({
+ callRecordings: {
+ edges: [
+ {
+ node: {
+ id: request.callRecordingId,
+ status: 'COMPLETED',
+ companionSession: { source: 'desktop', media: 'audio' },
+ externalRecordingId: 'trusted-recall-id',
+ audio: [{ fileId: 'already-saved' }],
+ },
+ },
+ ],
+ },
+ });
+ return true;
+ });
+ await importCallRecordingArtifacts({ client, request });
+ expect(sync).toHaveBeenCalledWith(
+ expect.objectContaining({
+ callRecording: expect.objectContaining({
+ audio: [{ fileId: 'already-saved' }],
+ }),
+ }),
+ );
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-call-recording-media.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-call-recording-media.test.ts
new file mode 100644
index 00000000000..09d6eb48272
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-call-recording-media.test.ts
@@ -0,0 +1,499 @@
+import { type ClientRequest, type IncomingMessage } from 'node:http';
+import { PassThrough, Readable } from 'node:stream';
+
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import { CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { importCallRecordingMedia } from 'src/logic-functions/flows/import-call-recording-media.util';
+
+const mutationMock = vi.hoisted(() => vi.fn());
+const requestOverHttpsMock = vi.hoisted(() => vi.fn());
+
+vi.mock('twenty-client-sdk/metadata', () => ({
+ MetadataApiClient: class {
+ mutation = mutationMock;
+ },
+}));
+
+vi.mock('node:https', async () => {
+ const actualHttps =
+ await vi.importActual<typeof import('node:https')>('node:https');
+
+ return { ...actualHttps, request: requestOverHttpsMock };
+});
+
+const VIDEO_URL = 'https://media.example.com/video.mp4';
+const AUDIO_URL = 'https://media.example.com/audio.mp3';
+const RECALL_RECORDING_URL =
+ 'https://us-west-2.recall.ai/api/v1/recording/recall-recording-1/';
+
+const RECORDING_WITH_MEDIA = {
+ id: 'recall-recording-1',
+ media_shortcuts: {
+ video_mixed: { download_url: VIDEO_URL },
+ audio_mixed: { download_url: AUDIO_URL },
+ },
+};
+
+let buildRecallRecordingResponse: () => Response;
+
+const uploadUrlForFilename = (filename: string) =>
+ `https://storage.example.com/${filename}`;
+
+const buildBodyStream = (chunks: Uint8Array[]): ReadableStream<Uint8Array> =>
+ new ReadableStream<Uint8Array>({
+ start(controller) {
+ for (const chunk of chunks) {
+ controller.enqueue(chunk);
+ }
+ controller.close();
+ },
+ });
+
+const buildDownloadResponse = ({
+ contentLengthBytes,
+ body,
+}: {
+ contentLengthBytes?: number;
+ body?: unknown;
+} = {}) => {
+ const headers = new Map<string, string>();
+
+ if (contentLengthBytes !== undefined) {
+ headers.set('content-length', String(contentLengthBytes));
+ }
+
+ return {
+ ok: true,
+ status: 200,
+ headers: {
+ get: (name: string) => headers.get(name.toLowerCase()) ?? null,
+ },
+ body: body ?? buildBodyStream([new Uint8Array(8)]),
+ };
+};
+
+const fetchMock = vi.fn();
+
+type DirectUploadMutationRequest =
+ | { createFileUpload: { __args: { filename: string } } }
+ | { completeFileUpload: { __args: { fileId: string } } };
+
+const stubFetch = ({
+ downloadsByUrl,
+}: {
+ downloadsByUrl: Record<string, unknown>;
+}) => {
+ fetchMock.mockReset();
+ fetchMock.mockImplementation((url: string, init?: { method?: string }) => {
+ if (init?.method === 'PUT') {
+ throw new Error('Upload requests should go through the upload bridge');
+ }
+
+ if (url === RECALL_RECORDING_URL) {
+ return Promise.resolve(buildRecallRecordingResponse());
+ }
+
+ const downloadResponse = downloadsByUrl[url];
+
+ if (downloadResponse === undefined) {
+ throw new Error(`Unhandled fetch url in test: ${url}`);
+ }
+
+ return Promise.resolve(downloadResponse);
+ });
+
+ vi.stubGlobal('fetch', fetchMock);
+};
+
+// createFileUpload returns a presigned target whose fileId echoes the filename,
+// and completeFileUpload resolves that target to the final stored file id.
+const stubDirectUpload = ({
+ finalFileIdByFilename,
+ createFileUploadErrorByFilename = {},
+}: {
+ finalFileIdByFilename: Record<string, string>;
+ createFileUploadErrorByFilename?: Record<string, Error>;
+}) => {
+ mutationMock.mockImplementation((request: DirectUploadMutationRequest) => {
+ if ('createFileUpload' in request) {
+ const { filename } = request.createFileUpload.__args;
+ const createFileUploadError = createFileUploadErrorByFilename[filename];
+
+ if (createFileUploadError) {
+ return Promise.reject(createFileUploadError);
+ }
+
+ return Promise.resolve({
+ createFileUpload: {
+ fileId: filename,
+ uploadUrl: uploadUrlForFilename(filename),
+ contentType: 'application/octet-stream',
+ },
+ });
+ }
+
+ if ('completeFileUpload' in request) {
+ const { fileId } = request.completeFileUpload.__args;
+
+ return Promise.resolve({
+ completeFileUpload: { id: finalFileIdByFilename[fileId] },
+ });
+ }
+
+ throw new Error('Unhandled mutation in test');
+ });
+};
+
+const buildUploadResponse = (): IncomingMessage => {
+ const uploadResponse = Readable.from([]) as IncomingMessage;
+
+ uploadResponse.statusCode = 200;
+
+ return uploadResponse;
+};
+
+const uploadedBytesByUrl = new Map<string, number[]>();
+
+const stubUploadRequests = () => {
+ uploadedBytesByUrl.clear();
+ requestOverHttpsMock.mockReset();
+ requestOverHttpsMock.mockImplementation((uploadUrl: URL) => {
+ const uploadRequest = new PassThrough();
+ const uploadedBytes: number[] = [];
+
+ uploadedBytesByUrl.set(uploadUrl.href, uploadedBytes);
+ uploadRequest.on('data', (chunk: Buffer) => {
+ uploadedBytes.push(...chunk);
+ });
+ uploadRequest.on('finish', () => {
+ uploadRequest.emit('response', buildUploadResponse());
+ });
+
+ return uploadRequest as unknown as ClientRequest;
+ });
+};
+
+const getUploadRequestCall = (fileName: string) =>
+ requestOverHttpsMock.mock.calls.find(
+ ([uploadUrl]) => uploadUrl.href === uploadUrlForFilename(fileName),
+ );
+
+describe('importCallRecordingMedia', () => {
+ beforeEach(() => {
+ vi.spyOn(console, 'warn').mockImplementation(() => {});
+ vi.spyOn(console, 'log').mockImplementation(() => {});
+ vi.stubEnv('RECALL_API_KEY', 'recall-api-key');
+ vi.stubEnv('RECALL_REGION', 'us-west-2');
+ mutationMock.mockReset();
+ stubUploadRequests();
+ buildRecallRecordingResponse = () =>
+ new Response(JSON.stringify(RECORDING_WITH_MEDIA), { status: 200 });
+ stubDirectUpload({
+ finalFileIdByFilename: {
+ 'video.mp4': 'file-video-1',
+ 'audio.mp3': 'file-audio-1',
+ },
+ });
+ stubFetch({
+ downloadsByUrl: {
+ [VIDEO_URL]: buildDownloadResponse({ contentLengthBytes: 8 }),
+ [AUDIO_URL]: buildDownloadResponse({ contentLengthBytes: 8 }),
+ },
+ });
+ });
+
+ afterEach(() => {
+ vi.unstubAllGlobals();
+ vi.unstubAllEnvs();
+ vi.useRealTimers();
+ vi.restoreAllMocks();
+ });
+
+ it('streams and uploads every missing artifact', async () => {
+ const updateFields = await importCallRecordingMedia({
+ callRecordingId: 'call-recording-1',
+ externalRecordingId: 'recall-recording-1',
+ hasAudio: false,
+ hasVideo: false,
+ });
+
+ expect(updateFields).toEqual({
+ video: [{ fileId: 'file-video-1', label: 'video.mp4' }],
+ audio: [{ fileId: 'file-audio-1', label: 'audio.mp3' }],
+ });
+ const [videoUploadUrl, videoUploadOptions] =
+ getUploadRequestCall('video.mp4') ?? [];
+ expect(videoUploadUrl?.href).toBe(uploadUrlForFilename('video.mp4'));
+ expect(videoUploadOptions).toMatchObject({
+ method: 'PUT',
+ headers: {
+ 'Content-Length': 8,
+ 'Content-Type': 'application/octet-stream',
+ },
+ });
+ expect(
+ uploadedBytesByUrl.get(uploadUrlForFilename('video.mp4')),
+ ).toHaveLength(8);
+ const [audioUploadUrl, audioUploadOptions] =
+ getUploadRequestCall('audio.mp3') ?? [];
+ expect(audioUploadUrl?.href).toBe(uploadUrlForFilename('audio.mp3'));
+ expect(audioUploadOptions).toMatchObject({
+ method: 'PUT',
+ headers: {
+ 'Content-Length': 8,
+ 'Content-Type': 'application/octet-stream',
+ },
+ });
+ expect(
+ uploadedBytesByUrl.get(uploadUrlForFilename('audio.mp3')),
+ ).toHaveLength(8);
+ });
+
+ it('declares the presigned upload with the download size, folder and field identifier', async () => {
+ await importCallRecordingMedia({
+ callRecordingId: 'call-recording-1',
+ externalRecordingId: 'recall-recording-1',
+ hasAudio: true,
+ hasVideo: false,
+ });
+
+ expect(mutationMock).toHaveBeenCalledWith(
+ expect.objectContaining({
+ createFileUpload: expect.objectContaining({
+ __args: {
+ filename: 'video.mp4',
+ size: 8,
+ fileFolder: 'FilesField',
+ fieldMetadataUniversalIdentifier:
+ CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER,
+ },
+ }),
+ }),
+ );
+ expect(mutationMock).toHaveBeenCalledWith(
+ expect.objectContaining({
+ completeFileUpload: expect.objectContaining({
+ __args: { fileId: 'video.mp4' },
+ }),
+ }),
+ );
+ });
+
+ it('skips artifacts already on the record', async () => {
+ const updateFields = await importCallRecordingMedia({
+ callRecordingId: 'call-recording-1',
+ externalRecordingId: 'recall-recording-1',
+ hasAudio: false,
+ hasVideo: true,
+ });
+
+ expect(updateFields).toEqual({
+ audio: [{ fileId: 'file-audio-1', label: 'audio.mp3' }],
+ });
+ expect(getUploadRequestCall('video.mp4')).toBeUndefined();
+ });
+
+ it('does not fetch the recording when both artifacts are present', async () => {
+ const updateFields = await importCallRecordingMedia({
+ callRecordingId: 'call-recording-1',
+ externalRecordingId: 'recall-recording-1',
+ hasAudio: true,
+ hasVideo: true,
+ });
+
+ expect(updateFields).toEqual({});
+ expect(fetchMock).not.toHaveBeenCalled();
+ expect(mutationMock).not.toHaveBeenCalled();
+ });
+
+ it('cancels the opened download body when creating its upload target fails', async () => {
+ const cancelMock = vi.fn().mockResolvedValue(undefined);
+
+ stubDirectUpload({
+ finalFileIdByFilename: {
+ 'video.mp4': 'file-video-1',
+ 'audio.mp3': 'file-audio-1',
+ },
+ createFileUploadErrorByFilename: {
+ 'video.mp4': new Error('upload target exploded'),
+ },
+ });
+ stubFetch({
+ downloadsByUrl: {
+ [VIDEO_URL]: buildDownloadResponse({
+ contentLengthBytes: 8,
+ body: { cancel: cancelMock },
+ }),
+ [AUDIO_URL]: buildDownloadResponse({ contentLengthBytes: 8 }),
+ },
+ });
+
+ const updateFields = await importCallRecordingMedia({
+ callRecordingId: 'call-recording-1',
+ externalRecordingId: 'recall-recording-1',
+ hasAudio: false,
+ hasVideo: false,
+ });
+
+ expect(updateFields).toEqual({
+ audio: [{ fileId: 'file-audio-1', label: 'audio.mp3' }],
+ });
+ expect(cancelMock).toHaveBeenCalledTimes(1);
+ expect(getUploadRequestCall('video.mp4')).toBeUndefined();
+ expect(console.warn).toHaveBeenCalledWith(
+ expect.stringContaining('upload target exploded'),
+ );
+ });
+
+ it('omits an artifact and warns when the download has no content length', async () => {
+ const cancelMock = vi.fn().mockRejectedValue(new Error('cancel exploded'));
+
+ stubFetch({
+ downloadsByUrl: {
+ [VIDEO_URL]: buildDownloadResponse({
+ body: { cancel: cancelMock },
+ }),
+ [AUDIO_URL]: buildDownloadResponse({ contentLengthBytes: 8 }),
+ },
+ });
+
+ const updateFields = await importCallRecordingMedia({
+ callRecordingId: 'call-recording-1',
+ externalRecordingId: 'recall-recording-1',
+ hasAudio: false,
+ hasVideo: false,
+ });
+
+ expect(updateFields).toEqual({
+ audio: [{ fileId: 'file-audio-1', label: 'audio.mp3' }],
+ });
+ expect(getUploadRequestCall('video.mp4')).toBeUndefined();
+ expect(console.warn).toHaveBeenCalledWith(
+ expect.stringContaining('content-length'),
+ );
+ expect(console.warn).toHaveBeenCalledWith(
+ expect.stringContaining('download-body-cancel-failed'),
+ );
+ });
+
+ it('returns nothing when the recording exposes no media urls', async () => {
+ buildRecallRecordingResponse = () =>
+ new Response(JSON.stringify({ id: 'recall-recording-1' }), {
+ status: 200,
+ });
+
+ const updateFields = await importCallRecordingMedia({
+ callRecordingId: 'call-recording-1',
+ externalRecordingId: 'recall-recording-1',
+ hasAudio: false,
+ hasVideo: false,
+ });
+
+ expect(updateFields).toEqual({});
+ expect(mutationMock).not.toHaveBeenCalled();
+ });
+
+ it('warns and returns nothing when the recording fetch fails', async () => {
+ buildRecallRecordingResponse = () =>
+ new Response(JSON.stringify({ error: 'recording boom' }), {
+ status: 500,
+ });
+ vi.useFakeTimers();
+
+ const updateFieldsPromise = importCallRecordingMedia({
+ callRecordingId: 'call-recording-1',
+ externalRecordingId: 'recall-recording-1',
+ hasAudio: false,
+ hasVideo: false,
+ });
+ await vi.runAllTimersAsync();
+ const updateFields = await updateFieldsPromise;
+
+ expect(updateFields).toEqual({});
+ expect(mutationMock).not.toHaveBeenCalled();
+ expect(console.warn).toHaveBeenCalledWith(
+ expect.stringContaining('recording boom'),
+ );
+ });
+
+ it('skips an oversized file without reading its body and records the reason', async () => {
+ const cancelMock = vi.fn().mockRejectedValue(new Error('cancel exploded'));
+
+ stubFetch({
+ downloadsByUrl: {
+ [VIDEO_URL]: buildDownloadResponse({
+ contentLengthBytes: 500 * 1024 * 1024 + 1,
+ body: { cancel: cancelMock },
+ }),
+ [AUDIO_URL]: buildDownloadResponse({ contentLengthBytes: 8 }),
+ },
+ });
+
+ const updateFields = await importCallRecordingMedia({
+ callRecordingId: 'call-recording-1',
+ externalRecordingId: 'recall-recording-1',
+ hasAudio: false,
+ hasVideo: false,
+ });
+
+ expect(updateFields).toEqual({
+ audio: [{ fileId: 'file-audio-1', label: 'audio.mp3' }],
+ companionFailureReason: 'video_file_too_large',
+ });
+ expect(getUploadRequestCall('video.mp4')).toBeUndefined();
+ expect(cancelMock).toHaveBeenCalled();
+ expect(console.warn).toHaveBeenCalledWith(
+ expect.stringContaining('artifact-too-large'),
+ );
+ expect(console.warn).toHaveBeenCalledWith(
+ expect.stringContaining('download-body-cancel-failed'),
+ );
+ });
+
+ it('records both markers when video and audio exceed the cap', async () => {
+ stubFetch({
+ downloadsByUrl: {
+ [VIDEO_URL]: buildDownloadResponse({
+ contentLengthBytes: 500 * 1024 * 1024 + 1,
+ }),
+ [AUDIO_URL]: buildDownloadResponse({
+ contentLengthBytes: 500 * 1024 * 1024 + 1,
+ }),
+ },
+ });
+
+ const updateFields = await importCallRecordingMedia({
+ callRecordingId: 'call-recording-1',
+ externalRecordingId: 'recall-recording-1',
+ hasAudio: false,
+ hasVideo: false,
+ });
+
+ expect(updateFields).toEqual({
+ companionFailureReason: 'video_file_too_large,audio_file_too_large',
+ });
+ expect(mutationMock).not.toHaveBeenCalled();
+ });
+
+ it('accepts a file at the 500 MB cap', async () => {
+ stubFetch({
+ downloadsByUrl: {
+ [VIDEO_URL]: buildDownloadResponse({
+ contentLengthBytes: 500 * 1024 * 1024,
+ }),
+ },
+ });
+
+ const updateFields = await importCallRecordingMedia({
+ callRecordingId: 'call-recording-1',
+ externalRecordingId: 'recall-recording-1',
+ hasAudio: true,
+ hasVideo: false,
+ });
+
+ expect(updateFields).toEqual({
+ video: [{ fileId: 'file-video-1', label: 'video.mp4' }],
+ });
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-transcript-recovery.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-transcript-recovery.test.ts
new file mode 100644
index 00000000000..6dda7ecf477
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-transcript-recovery.test.ts
@@ -0,0 +1,92 @@
+import { beforeEach, expect, it, vi } from 'vitest';
+import { importCallRecordingTranscript } from 'src/logic-functions/flows/import-call-recording-transcript.util';
+
+const { list, create, download } = vi.hoisted(() => ({
+ list: vi.fn(),
+ create: vi.fn(),
+ download: vi.fn(),
+}));
+vi.mock('src/logic-functions/recall-api/list-recall-transcripts.util', () => ({
+ listRecallTranscripts: list,
+}));
+vi.mock(
+ 'src/logic-functions/recall-api/create-async-recall-transcript.util',
+ () => ({ createAsyncRecallTranscript: create }),
+);
+vi.mock('src/logic-functions/flows/download-transcript.util', () => ({
+ downloadTranscript: download,
+}));
+
+const run = (transcript: unknown) =>
+ importCallRecordingTranscript({
+ callRecordingId: 'call',
+ externalRecordingId: 'recording',
+ currentStatus: 'PROCESSING',
+ requestedAt: '2026-09-08T10:00:00Z',
+ transcript,
+ });
+beforeEach(() => {
+ vi.resetAllMocks();
+ list.mockResolvedValue({ ok: true, transcripts: [] });
+ download.mockResolvedValue({ outcome: 'pending' });
+});
+
+it('uses the pending artifact rather than another listed transcript', async () => {
+ list.mockResolvedValue({
+ ok: true,
+ transcripts: [
+ { id: 'unrelated', statusCode: 'done' },
+ { id: 'owned', statusCode: 'done' },
+ ],
+ });
+ await run({ status: 'PENDING', recallTranscriptId: 'owned' });
+ expect(download).toHaveBeenCalledExactlyOnceWith({ transcriptId: 'owned' });
+ expect(create).not.toHaveBeenCalled();
+});
+
+it('does not repeat a paid request whose response was lost', async () => {
+ vi.spyOn(console, 'warn').mockImplementation(() => {});
+ create.mockResolvedValue({ ok: false, errorMessage: 'connection lost' });
+ const result = await run(null);
+ expect(result.updateData.transcript).toMatchObject({
+ status: 'PENDING',
+ recallTranscriptId: null,
+ });
+ await run(result.updateData.transcript);
+ expect(create).toHaveBeenCalledOnce();
+ vi.restoreAllMocks();
+});
+
+it('clears a confirmed deleted artifact so a later import can replace it', async () => {
+ list.mockResolvedValueOnce({
+ ok: true,
+ transcripts: [{ id: 'deleted', statusCode: 'deleted' }],
+ });
+ const result = await run({
+ status: 'PENDING',
+ recallTranscriptId: 'deleted',
+ });
+ expect(result.updateData.transcript).toBeNull();
+ create.mockResolvedValue({ ok: true, transcriptId: 'replacement' });
+ expect(
+ (await run(result.updateData.transcript)).updateData.transcript,
+ ).toMatchObject({ recallTranscriptId: 'replacement' });
+ expect(create).toHaveBeenCalledOnce();
+});
+
+it.each([429, 500, 503])(
+ 'retries transcript creation after HTTP %s without suppressing future attempts',
+ async (status) => {
+ create.mockResolvedValueOnce({
+ ok: false,
+ status,
+ errorMessage: 'try later',
+ });
+ expect((await run(null)).updateData).toEqual({});
+ create.mockResolvedValueOnce({ ok: true, transcriptId: 'retried' });
+ expect((await run(null)).updateData.transcript).toMatchObject({
+ recallTranscriptId: 'retried',
+ });
+ expect(create).toHaveBeenCalledTimes(2);
+ },
+);
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/put-media-download-body-to-upload-target.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/put-media-download-body-to-upload-target.test.ts
new file mode 100644
index 00000000000..9de5102fa5f
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/put-media-download-body-to-upload-target.test.ts
@@ -0,0 +1,209 @@
+import { type ClientRequest, type IncomingMessage } from 'node:http';
+import { PassThrough, Readable } from 'node:stream';
+
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+const requestOverHttpMock = vi.hoisted(() => vi.fn());
+const requestOverHttpsMock = vi.hoisted(() => vi.fn());
+
+vi.mock('node:http', async () => {
+ const actualHttp =
+ await vi.importActual<typeof import('node:http')>('node:http');
+
+ return { ...actualHttp, request: requestOverHttpMock };
+});
+
+vi.mock('node:https', async () => {
+ const actualHttps =
+ await vi.importActual<typeof import('node:https')>('node:https');
+
+ return { ...actualHttps, request: requestOverHttpsMock };
+});
+
+import { putMediaDownloadBodyToUploadTarget } from 'src/logic-functions/flows/put-media-download-body-to-upload-target.util';
+
+const HTTPS_UPLOAD_URL = 'https://storage.example.com/video.mp4';
+const HTTP_UPLOAD_URL = 'http://storage.example.com/video.mp4';
+
+const buildMediaDownloadBody = ({
+ chunks = [new Uint8Array([1, 2, 3]), new Uint8Array([4])],
+ cancel,
+ close = true,
+}: {
+ chunks?: Uint8Array[];
+ cancel?: () => void | Promise<void>;
+ close?: boolean;
+} = {}): ReadableStream<Uint8Array> =>
+ new ReadableStream<Uint8Array>({
+ start(controller) {
+ for (const chunk of chunks) {
+ controller.enqueue(chunk);
+ }
+
+ if (close) {
+ controller.close();
+ }
+ },
+ cancel,
+ });
+
+const buildUploadResponse = ({
+ statusCode = 200,
+ chunks = [],
+}: {
+ statusCode?: number;
+ chunks?: Buffer[];
+} = {}): IncomingMessage => {
+ const uploadResponse = Readable.from(chunks) as IncomingMessage;
+
+ uploadResponse.statusCode = statusCode;
+
+ return uploadResponse;
+};
+
+const buildUploadRequest = ({
+ response,
+ emitResponseOnFinish = true,
+}: {
+ response?: IncomingMessage;
+ emitResponseOnFinish?: boolean;
+} = {}) => {
+ const uploadRequest = new PassThrough();
+ const uploadedBytes: number[] = [];
+
+ uploadRequest.on('data', (chunk: Buffer) => {
+ uploadedBytes.push(...chunk);
+ });
+
+ if (response !== undefined) {
+ if (emitResponseOnFinish) {
+ uploadRequest.on('finish', () => {
+ uploadRequest.emit('response', response);
+ });
+ } else {
+ queueMicrotask(() => {
+ uploadRequest.emit('response', response);
+ });
+ }
+ }
+
+ return {
+ uploadedBytes,
+ uploadRequest: uploadRequest as unknown as ClientRequest,
+ };
+};
+
+const putDefaultMediaDownloadBodyToUploadTarget = ({
+ mediaDownloadBody = buildMediaDownloadBody(),
+ uploadUrl = HTTPS_UPLOAD_URL,
+}: {
+ mediaDownloadBody?: ReadableStream<Uint8Array>;
+ uploadUrl?: string;
+} = {}) =>
+ putMediaDownloadBodyToUploadTarget({
+ fileName: 'video.mp4',
+ mediaDownloadBody,
+ sizeBytes: 4,
+ uploadTarget: {
+ uploadUrl,
+ contentType: 'application/octet-stream',
+ },
+ });
+
+describe('putMediaDownloadBodyToUploadTarget', () => {
+ beforeEach(() => {
+ requestOverHttpMock.mockReset();
+ requestOverHttpsMock.mockReset();
+ });
+
+ afterEach(() => {
+ vi.restoreAllMocks();
+ });
+
+ it('streams the media download body to the upload target with declared headers', async () => {
+ const { uploadRequest, uploadedBytes } = buildUploadRequest({
+ response: buildUploadResponse(),
+ });
+
+ requestOverHttpsMock.mockReturnValue(uploadRequest);
+
+ await putDefaultMediaDownloadBodyToUploadTarget();
+
+ const [uploadUrl, uploadRequestOptions] =
+ requestOverHttpsMock.mock.calls[0];
+
+ expect(uploadUrl.href).toBe(HTTPS_UPLOAD_URL);
+ expect(uploadRequestOptions).toMatchObject({
+ method: 'PUT',
+ headers: {
+ 'Content-Length': 4,
+ 'Content-Type': 'application/octet-stream',
+ },
+ });
+ expect(uploadRequestOptions.signal).toBeInstanceOf(AbortSignal);
+ expect(uploadedBytes).toEqual([1, 2, 3, 4]);
+ });
+
+ it('uses the http client for http upload targets', async () => {
+ const { uploadRequest } = buildUploadRequest({
+ response: buildUploadResponse(),
+ });
+
+ requestOverHttpMock.mockReturnValue(uploadRequest);
+
+ await putDefaultMediaDownloadBodyToUploadTarget({
+ uploadUrl: HTTP_UPLOAD_URL,
+ });
+
+ expect(requestOverHttpMock).toHaveBeenCalledTimes(1);
+ expect(requestOverHttpsMock).not.toHaveBeenCalled();
+ });
+
+ it('destroys the media download readable when storage returns a failed status', async () => {
+ const mediaDownloadBodyCancelMock = vi.fn().mockResolvedValue(undefined);
+ const uploadResponse = buildUploadResponse({
+ statusCode: 500,
+ chunks: [Buffer.from('storage failed')],
+ });
+ const { uploadRequest } = buildUploadRequest({
+ emitResponseOnFinish: false,
+ response: uploadResponse,
+ });
+
+ requestOverHttpsMock.mockReturnValue(uploadRequest);
+
+ await expect(
+ putDefaultMediaDownloadBodyToUploadTarget({
+ mediaDownloadBody: buildMediaDownloadBody({
+ cancel: mediaDownloadBodyCancelMock,
+ close: false,
+ }),
+ }),
+ ).rejects.toThrow('upload of video.mp4 failed with status 500');
+
+ expect(mediaDownloadBodyCancelMock).toHaveBeenCalledTimes(1);
+ expect(uploadResponse.readableEnded).toBe(true);
+ });
+
+ it('destroys the media download readable when the upload request fails', async () => {
+ const mediaDownloadBodyCancelMock = vi.fn().mockResolvedValue(undefined);
+ const { uploadRequest } = buildUploadRequest();
+
+ requestOverHttpsMock.mockReturnValue(uploadRequest);
+
+ queueMicrotask(() => {
+ uploadRequest.emit('error', new Error('upload socket closed'));
+ });
+
+ await expect(
+ putDefaultMediaDownloadBodyToUploadTarget({
+ mediaDownloadBody: buildMediaDownloadBody({
+ cancel: mediaDownloadBodyCancelMock,
+ close: false,
+ }),
+ }),
+ ).rejects.toThrow('upload socket closed');
+
+ expect(mediaDownloadBodyCancelMock).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/recover-desktop-recordings.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/recover-desktop-recordings.test.ts
new file mode 100644
index 00000000000..54854caff25
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/recover-desktop-recordings.test.ts
@@ -0,0 +1,165 @@
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { beforeEach, expect, it, vi } from 'vitest';
+import {
+ hydrateDesktopRecordingTimestamps,
+ recoverDesktopRecordings,
+} from 'src/logic-functions/flows/recover-desktop-recordings.util';
+import { type SyncableCallRecording } from 'src/logic-functions/flows/sync-call-recording.util';
+
+const { request, update, enqueue, retrieve } = vi.hoisted(() => ({
+ request: vi.fn(),
+ update: vi.fn(),
+ enqueue: vi.fn(),
+ retrieve: vi.fn(),
+}));
+vi.mock('src/logic-functions/recall-api/get-recall-api-config.util', () => ({
+ getRecallApiConfig: () => ({ success: true, config: {} }),
+}));
+vi.mock('src/logic-functions/recall-api/recall-bot-api-request.util', () => ({
+ recallBotApiRequest: request,
+}));
+vi.mock('src/logic-functions/recall-api/get-recall-recording.util', () => ({
+ getRecallRecording: retrieve,
+}));
+vi.mock('src/logic-functions/data/update-call-recording.util', () => ({
+ updateCallRecording: update,
+}));
+vi.mock(
+ 'src/logic-functions/data/enqueue-call-recording-artifacts-import.util',
+ () => ({ enqueueCallRecordingArtifactsImport: enqueue }),
+);
+vi.mock('src/logic-functions/recall-api/get-owned-desktop-upload.util', () => ({
+ getOwnedDesktopUpload: async () => {
+ const response = await request();
+ return response?.ok ? response.data : undefined;
+ },
+}));
+const query = vi.fn();
+const mutation = vi.fn();
+const client = { query, mutation } as unknown as CoreApiClient;
+beforeEach(() => {
+ vi.resetAllMocks();
+ mutation.mockResolvedValue({ updateCallRecordings: [{ id: 'desktop-1' }] });
+ update.mockResolvedValue(true);
+ query.mockResolvedValue({
+ callRecordings: {
+ edges: [
+ {
+ node: {
+ id: 'desktop-1',
+ createdAt: '2026-09-07T12:00:00Z',
+ updatedAt: '2026-09-07T12:00:00Z',
+ companionSession: {
+ source: 'desktop',
+ media: 'audio',
+ sdkUploadId: 'upload-1',
+ },
+ },
+ },
+ ],
+ },
+ });
+});
+it('recovers a missed desktop completion webhook into the shared durable import queue', async () => {
+ request.mockResolvedValue({
+ ok: true,
+ data: { recording_id: 'recall-1', status: { code: 'complete' } },
+ });
+ expect(
+ await recoverDesktopRecordings(client, new Date('2026-09-07T12:20:00Z')),
+ ).toEqual({ recovered: 1 });
+ expect(update).toHaveBeenCalledWith(client, {
+ id: 'desktop-1',
+ expectedStatuses: ['SCHEDULED', 'JOINING', 'RECORDING', 'PROCESSING'],
+ data: { externalRecordingId: 'recall-1', status: 'PROCESSING' },
+ });
+ expect(enqueue).toHaveBeenCalledWith({ callRecordingId: 'desktop-1' });
+});
+it('recovers timestamps from Recall after out-of-order lifecycle events', async () => {
+ retrieve.mockResolvedValue({
+ ok: true,
+ recording: {
+ started_at: '2026-09-07T12:00:00.123456Z',
+ completed_at: '2026-09-07T12:05:00.123456Z',
+ },
+ });
+ const recording: SyncableCallRecording = {
+ id: 'desktop-1',
+ companionSession: { source: 'desktop', media: 'audio' },
+ externalRecordingId: 'recall-1',
+ startedAt: undefined,
+ endedAt: undefined,
+ status: 'PROCESSING',
+ companionFailureReason: undefined,
+ transcript: undefined,
+ audio: undefined,
+ video: undefined,
+ };
+ await hydrateDesktopRecordingTimestamps(client, recording);
+ expect(recording.startedAt).toBe('2026-09-07T12:00:00.123Z');
+ expect(recording.endedAt).toBe('2026-09-07T12:05:00.123Z');
+});
+it('does not enqueue incomplete uploads or retry failures blindly', async () => {
+ request.mockResolvedValue({
+ ok: true,
+ data: { recording_id: null, status: { code: 'recording_started' } },
+ });
+ expect(
+ await recoverDesktopRecordings(client, new Date('2026-09-07T12:20:00Z')),
+ ).toEqual({ recovered: 0 });
+ expect(update).not.toHaveBeenCalled();
+ expect(enqueue).not.toHaveBeenCalled();
+});
+
+it('does not recover a recording changed after the recovery batch was read', async () => {
+ mutation.mockResolvedValue({ updateCallRecordings: [] });
+ expect(
+ await recoverDesktopRecordings(client, new Date('2026-09-07T12:20:00Z')),
+ ).toEqual({ recovered: 0 });
+ expect(request).not.toHaveBeenCalled();
+ expect(update).not.toHaveBeenCalled();
+ expect(enqueue).not.toHaveBeenCalled();
+});
+it('does not reopen a recording completed while Recall was being queried', async () => {
+ request.mockResolvedValue({
+ ok: true,
+ data: { recording_id: 'recall-1', status: { code: 'complete' } },
+ });
+ update.mockResolvedValue(false);
+ expect(
+ await recoverDesktopRecordings(client, new Date('2026-09-07T12:20:00Z')),
+ ).toEqual({ recovered: 0 });
+ expect(enqueue).not.toHaveBeenCalled();
+});
+
+it('does not reopen terminal transcript failures', async () => {
+ const result = await query();
+ const recording = result.callRecordings.edges[0].node;
+ recording.status = 'FAILED';
+ recording.transcript = {
+ status: 'FAILED',
+ recallTranscriptId: 'transcript-1',
+ subCode: 'transcription_failed',
+ };
+ request.mockResolvedValue({
+ ok: true,
+ data: { recording_id: 'recall-1', status: { code: 'complete' } },
+ });
+ expect(
+ await recoverDesktopRecordings(client, new Date('2026-09-07T12:20:00Z')),
+ ).toEqual({ recovered: 0 });
+ expect(update).not.toHaveBeenCalled();
+ expect(request).not.toHaveBeenCalled();
+});
+
+it('does not revive other failed calls whose transcript merely contains the word FAILED', async () => {
+ const result = await query();
+ const recording = result.callRecordings.edges[0].node;
+ recording.status = 'FAILED';
+ recording.transcript = [{ words: [{ text: 'FAILED' }] }];
+ expect(
+ await recoverDesktopRecordings(client, new Date('2026-09-07T12:20:00Z')),
+ ).toEqual({ recovered: 0 });
+ expect(mutation).not.toHaveBeenCalled();
+ expect(request).not.toHaveBeenCalled();
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/recover-recording-summaries.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/recover-recording-summaries.test.ts
new file mode 100644
index 00000000000..843547082c9
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/recover-recording-summaries.test.ts
@@ -0,0 +1,106 @@
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { beforeEach, expect, it, vi } from 'vitest';
+import { kv } from 'twenty-sdk/logic-function';
+
+import { recoverRecordingSummaries } from 'src/logic-functions/flows/recover-recording-summaries.util';
+
+vi.mock('twenty-sdk/logic-function', () => ({
+ kv: { get: vi.fn(), set: vi.fn(), delete: vi.fn() },
+}));
+const query = vi.fn();
+const mutation = vi.fn();
+const client = { query, mutation } as unknown as CoreApiClient;
+const now = new Date('2026-09-08T10:00:00Z');
+
+beforeEach(() => {
+ vi.resetAllMocks();
+ query.mockResolvedValue({
+ callRecordings: { edges: [{ node: { id: 'recording' } }] },
+ });
+ mutation.mockResolvedValue({ updateCallRecordings: [{ id: 'recording' }] });
+ vi.spyOn(console, 'warn').mockImplementation(() => {});
+});
+
+it('saves an already-paid result without starting another generation or overwriting an existing summary', async () => {
+ vi.mocked(kv.get).mockResolvedValue({
+ status: 'READY',
+ markdown: 'Saved result',
+ });
+ await recoverRecordingSummaries(client, now);
+ expect(mutation.mock.calls[0][0].updateCallRecordings.__args).toMatchObject({
+ filter: {
+ id: { eq: 'recording' },
+ or: [
+ { summary: { markdown: { is: 'NULL' } } },
+ { summary: { markdown: { eq: '' } } },
+ ],
+ },
+ data: { summary: { markdown: 'Saved result', blocknote: null } },
+ });
+});
+
+it.each([null, { status: 'RUNNING' }, { status: 'EMPTY' }])(
+ 'does not generate for a missing or incomplete paid result: %j',
+ async (value) => {
+ vi.mocked(kv.get).mockResolvedValue(value);
+ await recoverRecordingSummaries(client, now);
+ expect(mutation).not.toHaveBeenCalled();
+ },
+);
+
+it('continues after one recording cannot be saved', async () => {
+ query.mockResolvedValue({
+ callRecordings: {
+ edges: [{ node: { id: 'first' } }, { node: { id: 'second' } }],
+ },
+ });
+ vi.mocked(kv.get).mockResolvedValue({
+ status: 'READY',
+ markdown: 'Saved result',
+ });
+ mutation.mockRejectedValueOnce(new Error('temporary write failure'));
+ await recoverRecordingSummaries(client, now);
+ expect(
+ mutation.mock.calls[1][0].updateCallRecordings.__args.filter.id.eq,
+ ).toBe('second');
+});
+
+it('advances past legacy rows without modifying the timestamp used by billing recovery', async () => {
+ vi.mocked(kv.get)
+ .mockResolvedValueOnce('previous-page')
+ .mockResolvedValue(null);
+ query.mockResolvedValue({
+ callRecordings: {
+ edges: [{ node: { id: 'legacy' } }],
+ pageInfo: { hasNextPage: true, endCursor: 'next-page' },
+ },
+ });
+ await recoverRecordingSummaries(client, now);
+ expect(query.mock.calls[0][0].callRecordings.__args).toMatchObject({
+ after: 'previous-page',
+ orderBy: [{ createdAt: 'AscNullsFirst' }],
+ });
+ expect(
+ query.mock.calls[0][0].callRecordings.__args.filter,
+ ).not.toHaveProperty('updatedAt');
+ expect(mutation).not.toHaveBeenCalled();
+ expect(kv.set).toHaveBeenCalledWith(
+ 'companion-summary-recovery-cursor',
+ 'next-page',
+ );
+});
+
+it('returns to the first page after reaching the end, allowing failed saves to retry', async () => {
+ vi.mocked(kv.get)
+ .mockResolvedValueOnce('last-page')
+ .mockResolvedValue({ status: 'READY', markdown: 'Saved result' });
+ mutation.mockRejectedValueOnce(new Error('Write unavailable'));
+ query.mockResolvedValue({
+ callRecordings: {
+ edges: [{ node: { id: 'recording' } }],
+ pageInfo: { hasNextPage: false, endCursor: 'last-recording' },
+ },
+ });
+ await recoverRecordingSummaries(client, now);
+ expect(kv.delete).toHaveBeenCalledWith('companion-summary-recovery-cursor');
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/complete-and-charge-call-recording.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/complete-and-charge-call-recording.util.ts
new file mode 100644
index 00000000000..dd36b459430
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/complete-and-charge-call-recording.util.ts
@@ -0,0 +1,18 @@
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+import { completeCallRecordingImport } from 'src/logic-functions/data/complete-call-recording-import.util';
+import { chargeCredits } from 'twenty-sdk/billing';
+import { getCallRecordingCharge } from 'src/logic-functions/flows/get-call-recording-charge.util';
+
+export const completeAndChargeCallRecording = async (
+ client: CoreApiClient,
+ { id }: { id: string },
+): Promise<boolean> => {
+ const charge = await getCallRecordingCharge(client, { callRecordingId: id });
+ if (!charge) return false;
+ const completed = await completeCallRecordingImport(client, { id });
+ if (completed) {
+ await chargeCredits(charge);
+ }
+ return completed;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/create-desktop-recording-upload.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/create-desktop-recording-upload.util.ts
new file mode 100644
index 00000000000..edf8f3967bd
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/create-desktop-recording-upload.util.ts
@@ -0,0 +1,216 @@
+import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { updateCallRecording } from 'src/logic-functions/data/update-call-recording.util';
+import { computeRealMeetingKey } from 'src/logic-functions/domain/compute-real-meeting-key.util';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { getCurrentWorkspaceId } from 'src/logic-functions/data/get-current-workspace-id.util';
+import { getDesktopCompanionAgenda } from 'src/logic-functions/flows/get-desktop-companion-agenda.util';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
+import { recallBotApiRequest } from 'src/logic-functions/recall-api/recall-bot-api-request.util';
+import { getRecallBotRecordingConfig } from 'src/logic-functions/constants/recall-bot-recording-config';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
+import { type DesktopRecordingSession } from 'src/logic-functions/types/desktop-recording-session.type';
+import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/get-owned-desktop-upload.util';
+
+const UUID_PATTERN =
+ /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
+const getSessionId = (body: Record<string, unknown>): string => {
+ if (typeof body.sessionId !== 'string' || !UUID_PATTERN.test(body.sessionId))
+ throw new Error('Invalid recording session.');
+ return body.sessionId;
+};
+type DesktopRecord = {
+ id: string;
+ status: string;
+ companionSession: DesktopRecordingSession | null;
+};
+const getSession = async (
+ client: CoreApiClient,
+ id: string,
+): Promise<DesktopRecord | undefined> => {
+ const result = await client.query({
+ callRecordings: {
+ __args: { first: 1, filter: { id: { eq: id } } },
+ edges: {
+ node: { id: true, status: true, companionSession: true },
+ },
+ },
+ });
+ return result.callRecordings?.edges?.[0]?.node as DesktopRecord | undefined;
+};
+
+export const createDesktopRecordingUpload = async (
+ client: CoreApiClient,
+ userWorkspaceId: string,
+ body: Record<string, unknown>,
+) => {
+ const sessionId = getSessionId(body);
+ const configResult = getRecallApiConfig();
+ const workspaceId = getCurrentWorkspaceId();
+ if (!configResult.success || !workspaceId)
+ throw new Error('Recording is not configured for this workspace.');
+ const config = configResult.config;
+ const existing = await getSession(client, sessionId);
+ const agenda = await getDesktopCompanionAgenda(client, userWorkspaceId);
+ const now = Date.now();
+ const keyForUrl = (conferenceLinkUrl: unknown) =>
+ computeRealMeetingKey({
+ calendarEventId: '',
+ iCalUid: undefined,
+ startsAt: undefined,
+ conferenceLinkUrl,
+ });
+ const currentMeetings = agenda.meetings.filter(
+ (meeting) =>
+ Date.parse(meeting.startsAt) - 15 * 60_000 <= now &&
+ Date.parse(meeting.endsAt) + 15 * 60_000 >= now,
+ );
+ const matchingMeetings = currentMeetings.filter((meeting) =>
+ body.calendarEventId !== undefined
+ ? meeting.id === body.calendarEventId
+ : typeof body.meetingUrl === 'string' &&
+ meeting.url &&
+ keyForUrl(meeting.url) === keyForUrl(body.meetingUrl),
+ );
+ if (
+ body.calendarEventId !== undefined &&
+ !matchingMeetings.some((meeting) => meeting.id === body.calendarEventId)
+ )
+ throw new Error('This meeting is unavailable in your calendar.');
+ if (matchingMeetings.some((meeting) => !meeting.recordingEnabled))
+ throw new Error('Recording is disabled for this meeting.');
+ // A time overlap alone cannot identify an unscheduled system-audio call.
+ if (matchingMeetings.some((meeting) => meeting.usesCalendarBot))
+ throw new Error(
+ 'A calendar bot is recording this meeting. Desktop capture would create a duplicate.',
+ );
+ if (existing) {
+ if (
+ !isDesktopAudioRecording(existing.companionSession) ||
+ existing.companionSession?.userWorkspaceId !== userWorkspaceId
+ )
+ throw new Error('This recording session belongs to another user.');
+ if (existing.status !== 'JOINING')
+ throw new Error('This recording session has already started.');
+ if (!existing.companionSession.sdkUploadId)
+ throw new Error('Recording setup is still in progress. Please retry.');
+ const upload = await getOwnedDesktopUpload(existing);
+ if (!upload?.upload_token)
+ throw new Error('Unable to resume recording setup.');
+ return {
+ callRecordingId: sessionId,
+ uploadToken: upload.upload_token,
+ apiUrl: new URL(config.baseUrl).origin,
+ };
+ }
+ const calendarEventId = matchingMeetings[0]?.id;
+ if (
+ typeof body.title !== 'string' ||
+ !body.title.trim() ||
+ body.title.length > 300
+ )
+ throw new Error('Enter a recording title of 1–300 characters.');
+ const session: DesktopRecordingSession = {
+ source: 'desktop',
+ media: 'audio',
+ userWorkspaceId,
+ platform:
+ typeof body.platform === 'string'
+ ? body.platform.slice(0, 100)
+ : 'desktop-audio',
+ };
+ await client.mutation({
+ createCallRecording: {
+ __args: {
+ data: {
+ id: sessionId,
+ title: body.title.trim(),
+ status: 'JOINING',
+ recordingRequestStatus: 'REQUESTED',
+ ...(calendarEventId ? { calendarEventId } : {}),
+ companionSession: session,
+ },
+ },
+ id: true,
+ },
+ });
+ const metadata = {
+ twentyWorkspaceId: workspaceId,
+ twentyCallRecordingId: sessionId,
+ twentyUserWorkspaceId: userWorkspaceId,
+ twentyRecordingSource: 'companion',
+ };
+ const upload = await recallBotApiRequest<{
+ id: string;
+ upload_token: string;
+ }>({
+ config,
+ path: '/sdk_upload/',
+ method: 'POST',
+ maxAttempts: 1,
+ body: {
+ metadata,
+ recording_config: {
+ ...getRecallBotRecordingConfig(),
+ // Transcript webhooks carry recording metadata, not SDK upload metadata.
+ metadata,
+ video_mixed_mp4: null,
+ },
+ },
+ });
+ if (!upload.ok || !upload.data?.id || !upload.data.upload_token) {
+ await client.mutation({
+ updateCallRecording: {
+ __args: {
+ id: sessionId,
+ data: {
+ status: 'FAILED',
+ companionFailureReason: 'desktop_upload_creation_failed',
+ },
+ },
+ id: true,
+ },
+ });
+ throw new Error(
+ 'Recall could not prepare the recording. Please try again.',
+ );
+ }
+ const saved = await updateCallRecording(client, {
+ id: sessionId,
+ expectedStatuses: [CallRecordingStatus.JOINING],
+ data: { companionSession: { ...session, sdkUploadId: upload.data.id } },
+ });
+ if (!saved)
+ throw new Error(
+ 'This recording session is no longer active. Start a new recording.',
+ );
+ return {
+ callRecordingId: sessionId,
+ uploadToken: upload.data.upload_token,
+ apiUrl: new URL(config.baseUrl).origin,
+ };
+};
+
+export const failDesktopRecordingCapture = async (
+ client: CoreApiClient,
+ userWorkspaceId: string,
+ body: Record<string, unknown>,
+) => {
+ const id = getSessionId(body);
+ const recording = await getSession(client, id);
+ if (
+ !recording ||
+ asRecord(recording.companionSession)?.userWorkspaceId !== userWorkspaceId
+ )
+ throw new Error('Recording is unavailable.');
+ if (recording.status === 'JOINING')
+ await updateCallRecording(client, {
+ id,
+ expectedStatuses: [CallRecordingStatus.JOINING],
+ data: {
+ status: CallRecordingStatus.FAILED,
+ companionFailureReason: 'desktop_capture_did_not_start',
+ },
+ });
+ return { callRecordingId: id };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/download-transcript.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/download-transcript.util.ts
new file mode 100644
index 00000000000..196dc68e242
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/download-transcript.util.ts
@@ -0,0 +1,86 @@
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { isUndefined } from '@sniptt/guards';
+
+import { retrieveRecallTranscript } from 'src/logic-functions/recall-api/retrieve-recall-transcript.util';
+
+const TRANSCRIPT_DOWNLOAD_TIMEOUT_MS = 20_000;
+
+export type DownloadTranscriptResult =
+ | { outcome: 'filled'; content: unknown }
+ | { outcome: 'failed'; subCode: string | null }
+ | { outcome: 'pending' }
+ | { outcome: 'deleted' }
+ | { outcome: 'error'; errorMessage: string };
+
+export const downloadTranscript = async ({
+ transcriptId,
+}: {
+ transcriptId: string;
+}): Promise<DownloadTranscriptResult> => {
+ const retrieveResult = await retrieveRecallTranscript({ transcriptId });
+
+ if (!retrieveResult.ok) {
+ return { outcome: 'error', errorMessage: retrieveResult.errorMessage };
+ }
+
+ const { downloadUrl, statusCode, statusSubCode } = retrieveResult.transcript;
+
+ if (statusCode === 'deleted') return { outcome: 'deleted' };
+
+ if (!isUndefined(downloadUrl)) {
+ return downloadTranscriptContent(downloadUrl);
+ }
+
+ if (statusCode === 'error' || statusCode === 'failed') {
+ return { outcome: 'failed', subCode: statusSubCode ?? null };
+ }
+
+ return { outcome: 'pending' };
+};
+
+const downloadTranscriptContent = async (
+ downloadUrl: string,
+): Promise<DownloadTranscriptResult> => {
+ try {
+ const response = await fetch(downloadUrl, {
+ signal: AbortSignal.timeout(TRANSCRIPT_DOWNLOAD_TIMEOUT_MS),
+ });
+
+ if (!response.ok) {
+ console.warn(
+ `[companion] transcript download responded with HTTP ${response.status}`,
+ );
+
+ return {
+ outcome: 'error',
+ errorMessage: 'transcript download failed',
+ };
+ }
+
+ const content: unknown = await response.json();
+ if (
+ !Array.isArray(content) ||
+ !content.every((segment) => {
+ const words = asRecord(segment)?.words;
+ return (
+ Array.isArray(words) &&
+ words.every((word) => typeof asRecord(word)?.text === 'string')
+ );
+ })
+ )
+ return {
+ outcome: 'error',
+ errorMessage: 'Recall returned an invalid transcript',
+ };
+ return { outcome: 'filled', content };
+ } catch (error) {
+ console.warn(
+ `[companion] transcript download failed: ${error instanceof Error ? error.message : String(error)}`,
+ );
+
+ return {
+ outcome: 'error',
+ errorMessage: 'transcript download failed',
+ };
+ }
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/generate-call-recording-summary-result.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/generate-call-recording-summary-result.type.ts
new file mode 100644
index 00000000000..76bb9084006
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/generate-call-recording-summary-result.type.ts
@@ -0,0 +1,12 @@
+export type GenerateCallRecordingSummaryResult = {
+ outcome:
+ | 'disabled'
+ | 'no-transcript'
+ | 'not-app-recording'
+ | 'already-summarized'
+ | 'not-summarizable'
+ | 'empty-summary'
+ | 'in-progress'
+ | 'interrupted'
+ | 'generated';
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/generate-call-recording-summary.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/generate-call-recording-summary.util.ts
new file mode 100644
index 00000000000..4fc10a6c12b
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/generate-call-recording-summary.util.ts
@@ -0,0 +1,79 @@
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { createHash } from 'crypto';
+
+import { findCallRecordingForSummary } from 'src/logic-functions/data/find-call-recording-for-summary.util';
+import { updateCallRecording } from 'src/logic-functions/data/update-call-recording.util';
+import { buildCallRecordingSummaryPrompt } from 'src/logic-functions/domain/build-call-recording-summary-prompt.util';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
+import { isRealTranscript } from 'src/logic-functions/domain/is-real-transcript.util';
+import { getOrGenerateSummary } from 'src/logic-functions/flows/get-or-generate-summary.util';
+import { type GenerateCallRecordingSummaryResult } from 'src/logic-functions/flows/generate-call-recording-summary-result.type';
+import { getCompanionAdditionalSummaryPrompt } from 'src/logic-functions/utils/get-companion-additional-summary-prompt.util';
+import { isCallRecordingSummaryEnabled } from 'src/logic-functions/utils/is-call-recording-summary-enabled.util';
+
+export const generateCallRecordingSummary = async (
+ client: CoreApiClient,
+ {
+ callRecordingId,
+ shouldRegenerateExistingSummary = false,
+ }: {
+ callRecordingId: string;
+ shouldRegenerateExistingSummary?: boolean;
+ },
+): Promise<GenerateCallRecordingSummaryResult> => {
+ if (!isCallRecordingSummaryEnabled()) {
+ return { outcome: 'disabled' };
+ }
+
+ const callRecording = await findCallRecordingForSummary(client, {
+ id: callRecordingId,
+ });
+
+ if (
+ callRecording === undefined ||
+ !isRealTranscript(callRecording.transcript)
+ ) {
+ return { outcome: 'no-transcript' };
+ }
+
+ if (!isDesktopAudioRecording(callRecording.companionSession)) {
+ return { outcome: 'not-app-recording' };
+ }
+
+ if (
+ !shouldRegenerateExistingSummary &&
+ callRecording.summaryMarkdown !== undefined
+ ) {
+ return { outcome: 'already-summarized' };
+ }
+
+ const prompt = buildCallRecordingSummaryPrompt({
+ transcript: callRecording.transcript,
+ title: callRecording.title,
+ additionalSummaryPrompt: getCompanionAdditionalSummaryPrompt(),
+ });
+
+ if (prompt === undefined) {
+ return { outcome: 'no-transcript' };
+ }
+
+ const generation = shouldRegenerateExistingSummary
+ ? createHash('sha256')
+ .update(JSON.stringify([prompt, callRecording.summaryMarkdown ?? null]))
+ .digest('hex')
+ : 'automatic';
+ const result = await getOrGenerateSummary(
+ `companion-summary:${callRecordingId}:${generation}`,
+ prompt,
+ );
+ if (result.status === 'INTERRUPTED') return { outcome: 'interrupted' };
+ if (result.status === 'RUNNING') return { outcome: 'in-progress' };
+ if (result.status === 'EMPTY') return { outcome: 'empty-summary' };
+
+ const saved = await updateCallRecording(client, {
+ id: callRecordingId,
+ data: { summary: { blocknote: null, markdown: result.markdown } },
+ expectedSummary: { markdown: callRecording.storedSummaryMarkdown },
+ });
+ return { outcome: saved ? result.outcome : 'already-summarized' };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/get-call-recording-charge.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/get-call-recording-charge.util.ts
new file mode 100644
index 00000000000..bce412e2c32
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/get-call-recording-charge.util.ts
@@ -0,0 +1,65 @@
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+import { computeCallRecordingCharge } from 'src/logic-functions/domain/compute-call-recording-charge.util';
+import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/get-owned-desktop-upload.util';
+import { getRecallRecording } from 'src/logic-functions/recall-api/get-recall-recording.util';
+import { normalizeRecallTimestamp } from 'src/logic-functions/recall-api/normalize-recall-timestamp.util';
+import { getString } from 'src/logic-functions/utils/get-string.util';
+
+export const getCallRecordingCharge = async (
+ client: CoreApiClient,
+ { callRecordingId }: { callRecordingId: string },
+) => {
+ const result = await client.query({
+ callRecordings: {
+ __args: { first: 1, filter: { id: { eq: callRecordingId } } },
+ edges: {
+ node: {
+ id: true,
+ status: true,
+ companionSession: true,
+ externalRecordingId: true,
+ },
+ },
+ },
+ });
+ const recording = result.callRecordings?.edges?.[0]?.node;
+ if (
+ !recording ||
+ ['COMPLETED', 'FAILED', 'NOT_RECORDED'].includes(recording.status)
+ )
+ return null;
+
+ const upload = await getOwnedDesktopUpload(recording);
+ if (
+ !upload ||
+ upload.status.code !== 'complete' ||
+ !upload.recording_id ||
+ upload.recording_id !== recording.externalRecordingId
+ ) {
+ throw new Error(
+ 'Cannot bill a recording that does not match its owned desktop upload.',
+ );
+ }
+ const providerResult = await getRecallRecording({
+ externalRecordingId: upload.recording_id,
+ });
+ if (!providerResult.ok) throw new Error('Recording duration is unavailable.');
+ // CRM timestamps are editable; only the completed provider recording determines usage.
+ const charge = computeCallRecordingCharge({
+ startedAt: normalizeRecallTimestamp(
+ getString(providerResult.recording.started_at),
+ ),
+ endedAt: normalizeRecallTimestamp(
+ getString(providerResult.recording.completed_at),
+ ),
+ });
+ if (!charge) throw new Error('Recording has no usable provider duration.');
+
+ return {
+ creditsUsedMicro: charge.creditsUsedMicro,
+ quantity: charge.quantityMinutes,
+ operationType: 'CALL_RECORDING' as const,
+ resourceContext: 'recall',
+ };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/get-desktop-companion-agenda.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/get-desktop-companion-agenda.util.ts
new file mode 100644
index 00000000000..1965ce036ba
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/get-desktop-companion-agenda.util.ts
@@ -0,0 +1,215 @@
+import { isNonEmptyString } from '@sniptt/guards';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { RestApiClient } from 'twenty-client-sdk/rest';
+import { getCurrentWorkspaceId } from 'src/logic-functions/data/get-current-workspace-id.util';
+import {
+ fetchAllNodes,
+ type ConnectionPage,
+} from 'src/logic-functions/data/fetch-all-nodes.util';
+import { fetchCalendarEventsByFilter } from 'src/logic-functions/data/fetch-calendar-events-by-filter.util';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { getRecordingParticipants } from 'src/logic-functions/flows/get-recording-participants.util';
+
+export const getDesktopCompanionAgenda = async (
+ client: CoreApiClient,
+ userWorkspaceId: string,
+) => {
+ const metadata = await new RestApiClient({ runAs: 'user' }).post<{
+ data?: {
+ myCalendarChannels: { id: string; handle?: string }[];
+ currentWorkspace: { id: string; displayName: string };
+ currentUser?: {
+ firstName?: string;
+ lastName?: string;
+ email?: string;
+ workspaceMember?: { id: string } | null;
+ } | null;
+ };
+ errors?: { message: string }[];
+ }>('/metadata', {
+ query:
+ 'query CompanionCalendar { myCalendarChannels { id handle } currentWorkspace { id displayName } currentUser { firstName lastName email workspaceMember { id } } }',
+ });
+ if (!metadata?.data || metadata.errors?.length)
+ throw new Error(
+ 'Unable to read your connected calendars. Reconnect your Twenty workspace.',
+ );
+ const channelIds = metadata.data.myCalendarChannels.map(
+ (channel) => channel.id,
+ );
+ const now = Date.now();
+ const events = channelIds.length
+ ? await fetchCalendarEventsByFilter(client, {
+ and: [
+ {
+ endsAt: { gte: new Date(now - 7 * 24 * 60 * 60_000).toISOString() },
+ },
+ { startsAt: { lte: new Date(now + 48 * 60 * 60_000).toISOString() } },
+ { isCanceled: { eq: false } },
+ { isFullDay: { eq: false } },
+ ],
+ })
+ : [];
+ const eventIds = events.map((event) => event.id);
+ const associations = eventIds.length
+ ? await fetchAllNodes<{ calendarEventId: string }>(async (after) => {
+ const result = await client.query({
+ calendarChannelEventAssociations: {
+ __args: {
+ first: 200,
+ ...(after ? { after } : {}),
+ filter: {
+ and: [
+ { calendarChannelId: { in: channelIds } },
+ { calendarEventId: { in: eventIds } },
+ ],
+ },
+ },
+ edges: { node: { calendarEventId: true } },
+ pageInfo: { hasNextPage: true, endCursor: true },
+ },
+ });
+ return result.calendarChannelEventAssociations as
+ | ConnectionPage<{ calendarEventId: string }>
+ | undefined;
+ })
+ : [];
+ const ownEventIds = new Set(
+ associations.map((association) => association.calendarEventId),
+ );
+ // Standard recording state lets a separately installed bot coexist without
+ // depending on any other application's custom fields or platform rules.
+ const botRecordings = ownEventIds.size
+ ? await client.query({
+ callRecordings: {
+ __args: {
+ first: 200,
+ filter: {
+ and: [
+ { calendarEventId: { in: [...ownEventIds] } },
+ { status: { in: ['SCHEDULED', 'JOINING', 'RECORDING'] } },
+ {
+ or: [
+ { externalBotId: { is: 'NOT_NULL' } },
+ {
+ and: [
+ { status: { eq: 'SCHEDULED' } },
+ { recordingRequestStatus: { eq: 'REQUESTED' } },
+ ],
+ },
+ ],
+ },
+ ],
+ },
+ },
+ edges: { node: { calendarEventId: true } },
+ },
+ })
+ : undefined;
+ const botEventIds = new Set(
+ botRecordings?.callRecordings?.edges.map(
+ ({ node }: { node: { calendarEventId?: string } }) =>
+ node.calendarEventId,
+ ) ?? [],
+ );
+ const meetings = events
+ .flatMap((event) => {
+ if (
+ !ownEventIds.has(event.id) ||
+ !isNonEmptyString(event.startsAt) ||
+ !isNonEmptyString(event.endsAt) ||
+ Date.parse(event.endsAt) <= now
+ )
+ return [];
+ return [
+ {
+ id: event.id,
+ title: event.title ?? 'Untitled meeting',
+ startsAt: event.startsAt,
+ endsAt: event.endsAt,
+ url: event.conferenceLinkUrl ?? null,
+ recordingEnabled: true,
+ usesCalendarBot: botEventIds.has(event.id),
+ },
+ ];
+ })
+ .sort((first, second) => first.startsAt.localeCompare(second.startsAt));
+ const result = await client.query({
+ callRecordings: {
+ __args: {
+ first: 100,
+ orderBy: [{ createdAt: 'DescNullsLast' }],
+ filter: {
+ and: [
+ {
+ createdAt: {
+ gte: new Date(now - 7 * 24 * 60 * 60_000).toISOString(),
+ },
+ },
+ {
+ companionSession: { like: `%${userWorkspaceId}%` },
+ },
+ ],
+ },
+ },
+ edges: {
+ node: {
+ id: true,
+ title: true,
+ status: true,
+ startedAt: true,
+ endedAt: true,
+ calendarEventId: true,
+ companionSession: true,
+ transcript: true,
+ },
+ },
+ },
+ });
+ type RecentRecording = {
+ id: string;
+ title: string;
+ status: string;
+ startedAt?: string;
+ endedAt?: string;
+ calendarEventId?: string;
+ companionSession?: unknown;
+ transcript?: unknown;
+ };
+ const recordings = (
+ (result.callRecordings?.edges ?? []) as { node: RecentRecording }[]
+ )
+ .map(({ node }) => node)
+ .filter(
+ (recording) =>
+ asRecord(recording.companionSession)?.userWorkspaceId ===
+ userWorkspaceId,
+ );
+ const viewer = metadata.data.currentUser;
+ const participants = await getRecordingParticipants(client, recordings, {
+ emails: [
+ viewer?.email,
+ ...metadata.data.myCalendarChannels.map((channel) => channel.handle),
+ ].filter((email): email is string => isNonEmptyString(email)),
+ name: [viewer?.firstName, viewer?.lastName].filter(Boolean).join(' '),
+ workspaceMemberId: viewer?.workspaceMember?.id,
+ });
+ return {
+ workspace: {
+ id: getCurrentWorkspaceId() ?? metadata.data.currentWorkspace.id,
+ name: metadata.data.currentWorkspace.displayName ?? 'Twenty',
+ },
+ meetings,
+ recordings: recordings.map(
+ ({
+ companionSession: _session,
+ transcript: _transcript,
+ ...recording
+ }) => ({
+ ...recording,
+ participants: participants.get(recording.id) ?? [],
+ }),
+ ),
+ calendarConnected: channelIds.length > 0,
+ };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/get-or-generate-summary.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/get-or-generate-summary.util.ts
new file mode 100644
index 00000000000..d2492d3b5aa
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/get-or-generate-summary.util.ts
@@ -0,0 +1,90 @@
+import { kv, runAgent } from 'twenty-sdk/logic-function';
+
+import { CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { parseCallRecordingSummaryAgentResponse } from 'src/logic-functions/domain/parse-call-recording-summary-agent-response.util';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+
+export type CachedSummary =
+ | {
+ status: 'READY';
+ markdown: string;
+ outcome: 'generated' | 'not-summarizable';
+ }
+ | { status: 'EMPTY' }
+ | { status: 'RUNNING' }
+ | { status: 'INTERRUPTED' };
+
+export const readCachedSummary = async (
+ key: string,
+): Promise<CachedSummary | null> => {
+ const value = asRecord(await kv.get(key));
+ if (!value) return null;
+ if (value.status === 'RUNNING') {
+ const startedAt =
+ typeof value.startedAt === 'string' ? Date.parse(value.startedAt) : NaN;
+ return {
+ status:
+ Number.isFinite(startedAt) && Date.now() - startedAt < 15 * 60_000
+ ? 'RUNNING'
+ : 'INTERRUPTED',
+ };
+ }
+ if (value.status === 'EMPTY') return { status: 'EMPTY' };
+ if (
+ value.status === 'READY' &&
+ typeof value.markdown === 'string' &&
+ (value.outcome === 'generated' || value.outcome === 'not-summarizable')
+ ) {
+ return {
+ status: 'READY',
+ markdown: value.markdown,
+ outcome: value.outcome,
+ };
+ }
+ throw new Error('Stored summary result is invalid.');
+};
+
+export const getOrGenerateSummary = async (
+ key: string,
+ prompt: string,
+): Promise<CachedSummary> => {
+ const cached = await readCachedSummary(key);
+ if (cached) return cached;
+ // The queue serializes generation; this marker preserves uncertain paid attempts on retries.
+ await kv.set(key, { status: 'RUNNING', startedAt: new Date().toISOString() });
+ const response = await runAgent({
+ agentUniversalIdentifier:
+ CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER,
+ prompt,
+ });
+ if (!response.success) {
+ // A definite failed response has no result to recover; a later delivery may try again.
+ await kv.delete(key);
+ throw new Error('Summary generation returned no usable result.');
+ }
+ const parsed = parseCallRecordingSummaryAgentResponse(response);
+ if (!parsed) throw new Error('Summary generation returned no usable result.');
+ const result: CachedSummary = {
+ status: 'READY',
+ markdown:
+ parsed.outcome === 'not-summarizable'
+ ? `## Summary unavailable\n\n${parsed.reason}`
+ : parsed.markdown,
+ outcome:
+ parsed.outcome === 'not-summarizable' ? 'not-summarizable' : 'generated',
+ };
+
+ // Retry persisting the same paid result; never repeat generation to repair a save.
+ for (let attempt = 0; ; attempt++) {
+ try {
+ await kv.set(key, result);
+ break;
+ } catch (error) {
+ if (attempt >= 3) {
+ throw error;
+ }
+ await new Promise((resolve) => setTimeout(resolve, 250 * 2 ** attempt));
+ }
+ }
+ return result;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/get-recording-participants.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/get-recording-participants.util.ts
new file mode 100644
index 00000000000..095943f4e7c
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/get-recording-participants.util.ts
@@ -0,0 +1,267 @@
+import { isNonEmptyString } from '@sniptt/guards';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+import {
+ fetchAllNodes,
+ type ConnectionPage,
+} from 'src/logic-functions/data/fetch-all-nodes.util';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+
+type Person = {
+ id: string;
+ name?: { firstName?: string | null; lastName?: string | null } | null;
+ avatarUrl?: string | null;
+ avatarFile?: { url?: string | null }[] | null;
+ emails?: {
+ primaryEmail?: string | null;
+ additionalEmails?: string[] | null;
+ } | null;
+};
+
+type CalendarParticipant = {
+ calendarEventId: string;
+ handle?: string | null;
+ displayName?: string | null;
+ responseStatus?: string | null;
+ workspaceMemberId?: string | null;
+ person?: Person | null;
+ workspaceMember?: {
+ id: string;
+ name?: Person['name'];
+ avatarUrl?: string | null;
+ } | null;
+};
+
+type ParticipantCandidate = {
+ name: string;
+ email?: string;
+ person?: Person | null;
+ workspaceMember?: CalendarParticipant['workspaceMember'];
+};
+
+export type RecordingParticipant = {
+ id: string;
+ name: string;
+ avatarUrl: string | null;
+};
+
+export type RecordingWithParticipants = {
+ id: string;
+ calendarEventId?: string | null;
+ transcript?: unknown;
+};
+
+export type RecordingViewer = {
+ emails: string[];
+ name: string;
+ workspaceMemberId?: string;
+};
+
+const escapeLike = (value: string) => value.replace(/[\\%_]/g, '\\$&');
+const normalize = (value: string) => value.trim().toLowerCase();
+const fullName = (name: Person['name']) =>
+ [name?.firstName, name?.lastName].filter(Boolean).join(' ').trim();
+const personEmails = (person: Person) =>
+ [person.emails?.primaryEmail, ...(person.emails?.additionalEmails ?? [])]
+ .filter((email): email is string => isNonEmptyString(email))
+ .map(normalize);
+
+const transcriptParticipants = (
+ transcript: unknown,
+ viewer: RecordingViewer,
+): ParticipantCandidate[] => {
+ if (!Array.isArray(transcript)) return [];
+ const selfEmails = new Set(viewer.emails.map(normalize));
+ return transcript.flatMap((entry) => {
+ const participant = asRecord(asRecord(entry)?.participant);
+ const name =
+ typeof participant?.name === 'string' ? participant.name.trim() : '';
+ const email =
+ typeof participant?.email === 'string'
+ ? normalize(participant.email)
+ : undefined;
+ if (
+ !name ||
+ (email
+ ? selfEmails.has(email)
+ : normalize(name) === normalize(viewer.name)) ||
+ /^(you|me|host|guest|unknown( speaker| participant)?|(speaker|participant|user)([\s_-]*\d+)?)$/i.test(
+ name,
+ )
+ )
+ return [];
+ return [{ name, email }];
+ });
+};
+
+export const getRecordingParticipants = async (
+ client: CoreApiClient,
+ recordings: RecordingWithParticipants[],
+ viewer: RecordingViewer,
+): Promise<Map<string, RecordingParticipant[]>> => {
+ const eventIds = [
+ ...new Set(
+ recordings.flatMap((recording) =>
+ recording.calendarEventId ? [recording.calendarEventId] : [],
+ ),
+ ),
+ ];
+ const calendarParticipants = eventIds.length
+ ? await fetchAllNodes<CalendarParticipant>(async (after) => {
+ const result = await client.query({
+ calendarEventParticipants: {
+ __args: {
+ first: 200,
+ ...(after ? { after } : {}),
+ filter: { calendarEventId: { in: eventIds } },
+ },
+ edges: {
+ node: {
+ calendarEventId: true,
+ handle: true,
+ displayName: true,
+ responseStatus: true,
+ workspaceMemberId: true,
+ person: {
+ id: true,
+ name: { firstName: true, lastName: true },
+ avatarUrl: true,
+ avatarFile: { url: true },
+ emails: { primaryEmail: true, additionalEmails: true },
+ },
+ workspaceMember: {
+ id: true,
+ name: { firstName: true, lastName: true },
+ avatarUrl: true,
+ },
+ },
+ },
+ pageInfo: { hasNextPage: true, endCursor: true },
+ },
+ });
+ return result.calendarEventParticipants as
+ | ConnectionPage<CalendarParticipant>
+ | undefined;
+ })
+ : [];
+ const selfEmails = new Set(viewer.emails.map(normalize));
+ const candidatesByRecording = new Map<string, ParticipantCandidate[]>();
+ for (const recording of recordings) {
+ const attendees = calendarParticipants
+ .filter(
+ (participant) =>
+ participant.calendarEventId === recording.calendarEventId &&
+ participant.responseStatus !== 'DECLINED' &&
+ !(
+ viewer.workspaceMemberId &&
+ participant.workspaceMemberId === viewer.workspaceMemberId
+ ) &&
+ !selfEmails.has(normalize(participant.handle ?? '')) &&
+ !(
+ participant.person &&
+ personEmails(participant.person).some((email) =>
+ selfEmails.has(email),
+ )
+ ),
+ )
+ .map((participant) => ({
+ name:
+ participant.displayName?.trim() || participant.handle?.trim() || '',
+ email: participant.handle ? normalize(participant.handle) : undefined,
+ person: participant.person,
+ workspaceMember: participant.workspaceMember,
+ }));
+ candidatesByRecording.set(
+ recording.id,
+ attendees.length
+ ? attendees
+ : transcriptParticipants(recording.transcript, viewer),
+ );
+ }
+
+ const emails = [
+ ...new Set(
+ [...candidatesByRecording.values()]
+ .flat()
+ .flatMap((participant) =>
+ !participant.person && participant.email ? [participant.email] : [],
+ ),
+ ),
+ ];
+ const people = emails.length
+ ? await fetchAllNodes<Person>(async (after) => {
+ const result = await client.query({
+ people: {
+ __args: {
+ first: 200,
+ ...(after ? { after } : {}),
+ filter: {
+ or: emails.flatMap((email) => [
+ { emails: { primaryEmail: { ilike: escapeLike(email) } } },
+ {
+ emails: {
+ additionalEmails: { like: `%${escapeLike(email)}%` },
+ },
+ },
+ ]),
+ },
+ },
+ edges: {
+ node: {
+ id: true,
+ name: { firstName: true, lastName: true },
+ avatarUrl: true,
+ avatarFile: { url: true },
+ emails: { primaryEmail: true, additionalEmails: true },
+ },
+ },
+ pageInfo: { hasNextPage: true, endCursor: true },
+ },
+ });
+ return result.people as ConnectionPage<Person> | undefined;
+ })
+ : [];
+ const participantsByRecording = new Map<string, RecordingParticipant[]>();
+ for (const [recordingId, candidates] of candidatesByRecording) {
+ const participants = new Map<string, RecordingParticipant>();
+ for (const candidate of candidates) {
+ // JSON email filters are broad; only an exact email match can identify a person.
+ const person =
+ candidate.person ??
+ people.find(
+ (person) =>
+ candidate.email && personEmails(person).includes(candidate.email),
+ );
+ if (person && personEmails(person).some((email) => selfEmails.has(email)))
+ continue;
+ const name =
+ fullName(person?.name) ||
+ fullName(candidate.workspaceMember?.name) ||
+ candidate.name;
+ if (!name) continue;
+ const id = person
+ ? `person:${person.id}`
+ : candidate.workspaceMember
+ ? `member:${candidate.workspaceMember.id}`
+ : candidate.email
+ ? `email:${candidate.email}`
+ : `name:${normalize(name)}`;
+ participants.set(id, {
+ id,
+ name,
+ avatarUrl:
+ person?.avatarFile?.[0]?.url ||
+ person?.avatarUrl ||
+ candidate.workspaceMember?.avatarUrl ||
+ null,
+ });
+ }
+ participantsByRecording.set(
+ recordingId,
+ [...participants.values()].sort((first, second) =>
+ first.id.localeCompare(second.id),
+ ),
+ );
+ }
+ return participantsByRecording;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/handle-recall-webhook.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/handle-recall-webhook.util.ts
new file mode 100644
index 00000000000..cbd38b99951
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/handle-recall-webhook.util.ts
@@ -0,0 +1,372 @@
+import { isUndefined } from '@sniptt/guards';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/get-owned-desktop-upload.util';
+
+import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { enqueueCallRecordingArtifactsImport } from 'src/logic-functions/data/enqueue-call-recording-artifacts-import.util';
+import { findCallRecordingsByFilter } from 'src/logic-functions/data/find-call-recordings-by-filter.util';
+import {
+ isCallRecordingStatusDowngrade,
+ getAllowedPreviousCallRecordingStatuses,
+} from 'src/logic-functions/domain/is-call-recording-status-downgrade.util';
+import { isRecallRecordingDoneSignal } from 'src/logic-functions/domain/is-recall-recording-done-signal.util';
+import { mapRecallStatusCodeToCallRecordingStatus } from 'src/logic-functions/domain/map-recall-status-code-to-call-recording-status.util';
+import {
+ parseRecallWebhookEvent,
+ type RecallWebhookBody,
+ type RecallWebhookEvent,
+} from 'src/logic-functions/recall-api/parse-recall-webhook-event.util';
+import { type CallRecordingRecord } from 'src/logic-functions/types/call-recording-record.type';
+import { type CallRecordingUpdateFields } from 'src/logic-functions/types/call-recording-update-fields.type';
+import { updateCallRecording } from 'src/logic-functions/data/update-call-recording.util';
+import { getRecallWebhookBotMetadata } from 'src/logic-functions/recall-api/get-recall-webhook-bot-metadata.util';
+
+type RecallWebhookHandlerResult =
+ | {
+ status: 'updated';
+ callRecordingId: string;
+ event: string;
+ callRecordingStatus: string;
+ }
+ | {
+ status: 'queued';
+ callRecordingId: string;
+ event: string;
+ }
+ | {
+ status: 'skipped';
+ event: string | null;
+ reason: string;
+ };
+
+export const handleRecallWebhook = async ({
+ client,
+ body,
+}: {
+ client: CoreApiClient;
+ body: RecallWebhookBody;
+}): Promise<RecallWebhookHandlerResult> => {
+ if (
+ getRecallWebhookBotMetadata(body)?.twentyRecordingSource !== 'companion'
+ ) {
+ return {
+ status: 'skipped',
+ event: null,
+ reason: 'not a Companion recording',
+ };
+ }
+ const webhookEvent = parseRecallWebhookEvent(body);
+
+ if (isUndefined(webhookEvent)) {
+ return {
+ status: 'skipped',
+ event: null,
+ reason: 'missing event type',
+ };
+ }
+
+ const { event } = webhookEvent;
+
+ if (event === 'transcript.done' || event === 'transcript.failed') {
+ return queueCallRecordingArtifactsImport({ client, webhookEvent });
+ }
+
+ return handleRecallStatusEvent({ client, webhookEvent });
+};
+
+const handleRecallStatusEvent = async ({
+ client,
+ webhookEvent,
+}: {
+ client: CoreApiClient;
+ webhookEvent: RecallWebhookEvent;
+}): Promise<RecallWebhookHandlerResult> => {
+ const { event, statusCode, statusSubCode } = webhookEvent;
+ const mappedCallRecordingStatus = mapRecallEventToCallRecordingStatus({
+ event,
+ statusCode,
+ statusSubCode,
+ });
+
+ if (isUndefined(mappedCallRecordingStatus)) {
+ return {
+ status: 'skipped',
+ event,
+ reason: `unsupported Recall event status ${statusCode ?? event}`,
+ };
+ }
+
+ const callRecording = await findMatchingCallRecording({
+ client,
+ webhookEvent,
+ });
+
+ if (isUndefined(callRecording)) {
+ return {
+ status: 'skipped',
+ event,
+ reason: 'no matching call recording',
+ };
+ }
+
+ const callRecordingStatus = resolveStatusAgainstKnownRecording({
+ mappedStatus: mappedCallRecordingStatus,
+ statusCode,
+ callRecording,
+ webhookEvent,
+ });
+
+ if (
+ isCallRecordingStatusDowngrade({
+ fromStatus: callRecording.status,
+ toStatus: callRecordingStatus,
+ })
+ ) {
+ return {
+ status: 'skipped',
+ event,
+ reason: `stale status event (${callRecording.status} -> ${callRecordingStatus})`,
+ };
+ }
+
+ const updateData: CallRecordingUpdateFields = {
+ ...(isUndefined(webhookEvent.externalBotId)
+ ? {}
+ : { externalBotId: webhookEvent.externalBotId }),
+ ...buildExternalRecordingIdUpdate(webhookEvent),
+ ...buildCallRecordingStatusUpdate({
+ reason: getRecallWebhookFailureReason(webhookEvent),
+ status: callRecordingStatus,
+ }),
+ ...buildRecordingTimestampsUpdate({ webhookEvent, callRecording }),
+ };
+
+ const updated = await updateCallRecording(client, {
+ id: callRecording.id,
+ expectedStatuses:
+ getAllowedPreviousCallRecordingStatuses(callRecordingStatus),
+ data: updateData,
+ });
+
+ if (!updated)
+ return { status: 'skipped', event, reason: 'recording already advanced' };
+
+ if (
+ isRecallRecordingDoneSignal({
+ event,
+ statusCode,
+ })
+ ) {
+ await enqueueCallRecordingArtifactsImport({
+ callRecordingId: callRecording.id,
+ });
+ }
+
+ return {
+ status: 'updated',
+ event,
+ callRecordingId: callRecording.id,
+ callRecordingStatus: updateData.status ?? callRecordingStatus,
+ };
+};
+
+const queueCallRecordingArtifactsImport = async ({
+ client,
+ webhookEvent,
+}: {
+ client: CoreApiClient;
+ webhookEvent: RecallWebhookEvent;
+}): Promise<RecallWebhookHandlerResult> => {
+ const callRecording = await findMatchingCallRecording({
+ client,
+ webhookEvent,
+ });
+
+ if (isUndefined(callRecording)) {
+ console.warn(
+ `[companion] skipping Recall ${webhookEvent.event} webhook: no matching call recording for bot ${webhookEvent.externalBotId ?? 'unknown'}`,
+ );
+
+ return {
+ status: 'skipped',
+ event: webhookEvent.event,
+ reason: 'no matching call recording',
+ };
+ }
+
+ await enqueueCallRecordingArtifactsImport({
+ callRecordingId: callRecording.id,
+ });
+
+ return {
+ status: 'queued',
+ event: webhookEvent.event,
+ callRecordingId: callRecording.id,
+ };
+};
+
+const findMatchingCallRecording = async ({
+ client,
+ webhookEvent,
+}: {
+ client: CoreApiClient;
+ webhookEvent: RecallWebhookEvent;
+}): Promise<CallRecordingRecord | undefined> => {
+ let callRecording: CallRecordingRecord | undefined;
+ if (!isUndefined(webhookEvent.callRecordingIdFromMetadata)) {
+ callRecording = (
+ await findCallRecordingsByFilter(client, {
+ id: { eq: webhookEvent.callRecordingIdFromMetadata },
+ })
+ )[0];
+ } else if (!isUndefined(webhookEvent.externalBotId)) {
+ callRecording = (
+ await findCallRecordingsByFilter(client, {
+ externalBotId: { eq: webhookEvent.externalBotId },
+ })
+ )[0];
+ }
+ if (!callRecording) return undefined;
+ const upload = await getOwnedDesktopUpload(callRecording);
+ if (
+ !upload ||
+ (webhookEvent.externalSdkUploadId &&
+ upload.id !== webhookEvent.externalSdkUploadId) ||
+ (webhookEvent.externalRecordingId &&
+ upload.recording_id !== webhookEvent.externalRecordingId)
+ )
+ return undefined;
+ return callRecording;
+};
+
+// Mirrors the snapshot extractor: a known recording artifact rules out NOT_RECORDED.
+const resolveStatusAgainstKnownRecording = ({
+ mappedStatus,
+ statusCode,
+ callRecording,
+ webhookEvent,
+}: {
+ mappedStatus: CallRecordingStatus;
+ statusCode: string | undefined;
+ callRecording: CallRecordingRecord;
+ webhookEvent: RecallWebhookEvent;
+}): CallRecordingStatus => {
+ const hasKnownRecording =
+ !isUndefined(callRecording.externalRecordingId) ||
+ !isUndefined(webhookEvent.externalRecordingId);
+
+ if (mappedStatus !== CallRecordingStatus.NOT_RECORDED || !hasKnownRecording) {
+ return mappedStatus;
+ }
+
+ return statusCode === 'fatal'
+ ? CallRecordingStatus.FAILED
+ : CallRecordingStatus.PROCESSING;
+};
+
+const mapRecallEventToCallRecordingStatus = ({
+ event,
+ statusCode,
+ statusSubCode,
+}: {
+ event: string;
+ statusCode: string | undefined;
+ statusSubCode: string | undefined;
+}): CallRecordingStatus | undefined => {
+ if (event === 'sdk_upload.recording_started')
+ return CallRecordingStatus.RECORDING;
+ if (event === 'sdk_upload.failed') return CallRecordingStatus.FAILED;
+ if (event === 'sdk_upload.recording_ended' || event === 'sdk_upload.complete')
+ return CallRecordingStatus.PROCESSING;
+
+ if (event === 'recording.done') {
+ return CallRecordingStatus.PROCESSING;
+ }
+
+ if (event === 'recording.failed') {
+ return CallRecordingStatus.FAILED;
+ }
+
+ return mapRecallStatusCodeToCallRecordingStatus({
+ statusCode,
+ statusSubCode,
+ });
+};
+
+const buildRecordingTimestampsUpdate = ({
+ webhookEvent,
+ callRecording,
+}: {
+ webhookEvent: RecallWebhookEvent;
+ callRecording: CallRecordingRecord;
+}): { startedAt?: string; endedAt?: string } => {
+ const { event, statusCode, statusTimestamp } = webhookEvent;
+
+ const impliesRecordingStarted =
+ event === 'sdk_upload.recording_started' ||
+ statusCode === 'in_call_recording';
+ const impliesRecordingEnded =
+ event === 'sdk_upload.recording_ended' ||
+ event === 'recording.done' ||
+ statusCode === 'call_ended' ||
+ statusCode === 'done';
+
+ const startedAt =
+ webhookEvent.recordingStartedAt ??
+ (impliesRecordingStarted ? statusTimestamp : undefined);
+ const endedAt =
+ webhookEvent.recordingEndedAt ??
+ (impliesRecordingEnded ? statusTimestamp : undefined);
+
+ return {
+ ...(!isUndefined(startedAt) && isUndefined(callRecording.startedAt)
+ ? { startedAt }
+ : {}),
+ ...(!isUndefined(endedAt) && isUndefined(callRecording.endedAt)
+ ? { endedAt }
+ : {}),
+ };
+};
+
+const buildExternalRecordingIdUpdate = (
+ webhookEvent: RecallWebhookEvent,
+): { externalRecordingId?: string } =>
+ isUndefined(webhookEvent.externalRecordingId)
+ ? {}
+ : { externalRecordingId: webhookEvent.externalRecordingId };
+
+type UnavailableCallRecordingStatus =
+ | CallRecordingStatus.FAILED
+ | CallRecordingStatus.NOT_RECORDED;
+
+type CallRecordingStatusUpdate =
+ | {
+ status: Exclude<CallRecordingStatus, UnavailableCallRecordingStatus>;
+ }
+ | {
+ status: UnavailableCallRecordingStatus;
+ companionFailureReason: string;
+ };
+
+const buildCallRecordingStatusUpdate = ({
+ reason,
+ status,
+}: {
+ reason: string;
+ status: CallRecordingStatus;
+}): CallRecordingStatusUpdate => {
+ if (
+ status === CallRecordingStatus.FAILED ||
+ status === CallRecordingStatus.NOT_RECORDED
+ ) {
+ return { status, companionFailureReason: reason };
+ }
+
+ return { status };
+};
+
+const getRecallWebhookFailureReason = ({
+ event,
+ statusCode,
+ statusSubCode,
+}: RecallWebhookEvent): string => statusSubCode ?? statusCode ?? event;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-artifacts.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-artifacts.util.ts
new file mode 100644
index 00000000000..d5984b3fb0f
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-artifacts.util.ts
@@ -0,0 +1,196 @@
+import { hydrateDesktopRecordingTimestamps } from 'src/logic-functions/flows/recover-desktop-recordings.util';
+import { isNull, isUndefined } from '@sniptt/guards';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+import {
+ claimCallRecordingArtifactsImport,
+ releaseCallRecordingArtifactsImportClaim,
+} from 'src/logic-functions/data/claim-call-recording-artifacts-import.util';
+import {
+ syncCallRecording,
+ type SyncableCallRecording,
+} from 'src/logic-functions/flows/sync-call-recording.util';
+import { type FilesFieldValue } from 'src/logic-functions/types/files-field-value.type';
+import { type CallRecordingArtifactsImportRequest } from 'src/logic-functions/types/call-recording-artifacts-import-request.type';
+import { getString } from 'src/logic-functions/utils/get-string.util';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
+import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/get-owned-desktop-upload.util';
+
+type CallRecordingForArtifactsImport = SyncableCallRecording & {
+ externalBotId: string | undefined;
+};
+
+type CallRecordingForArtifactsImportNode = {
+ id?: string | null;
+ status?: string | null;
+ startedAt?: string | null;
+ endedAt?: string | null;
+ companionSession?: unknown;
+ externalBotId?: string | null;
+ externalRecordingId?: string | null;
+ companionFailureReason?: string | null;
+ transcript?: unknown;
+ audio?: FilesFieldValue | null;
+ video?: FilesFieldValue | null;
+};
+
+export type ImportCallRecordingArtifactsResult =
+ | {
+ status: 'imported';
+ callRecordingId: string;
+ outcome: 'call-recording-artifacts-imported';
+ }
+ | {
+ status: 'skipped';
+ callRecordingId: string;
+ reason: string;
+ };
+
+// Job payloads can carry forged provider ids, so imports resolve only from the
+// CallRecording's upload after verifying its ownership with Recall.
+export const importCallRecordingArtifacts = async ({
+ client,
+ request,
+}: {
+ client: CoreApiClient;
+ request: CallRecordingArtifactsImportRequest;
+}): Promise<ImportCallRecordingArtifactsResult> => {
+ let callRecording = await findCallRecordingForArtifactsImport(
+ client,
+ request.callRecordingId,
+ );
+
+ if (
+ isUndefined(callRecording) ||
+ !isDesktopAudioRecording(callRecording.companionSession)
+ ) {
+ return {
+ status: 'skipped',
+ callRecordingId: request.callRecordingId,
+ reason: 'no matching call recording',
+ };
+ }
+
+ // Svix redelivers a webhook to several workers at once; the lease ensures only
+ // one performs the provider transcript request and media upload. The lease clock
+ // is wall-clock, not request.requestedAt, so a retry of the same delivery still
+ // measures real elapsed time and can reclaim a lease left behind by a crash.
+ const claimedAt = new Date();
+ const claimedImport = await claimCallRecordingArtifactsImport(client, {
+ callRecordingId: callRecording.id,
+ now: claimedAt,
+ });
+
+ if (!claimedImport) {
+ return {
+ status: 'skipped',
+ callRecordingId: callRecording.id,
+ reason: 'artifact import already in progress',
+ };
+ }
+
+ try {
+ // A worker may have finished between our first read and acquiring the lease.
+ callRecording = await findCallRecordingForArtifactsImport(
+ client,
+ request.callRecordingId,
+ );
+ if (!callRecording)
+ return {
+ status: 'skipped',
+ callRecordingId: request.callRecordingId,
+ reason: 'recording removed',
+ };
+ const upload = await getOwnedDesktopUpload(callRecording);
+ if (
+ !upload ||
+ upload.status.code !== 'complete' ||
+ !upload.recording_id ||
+ upload.recording_id !== callRecording.externalRecordingId
+ ) {
+ return {
+ status: 'skipped',
+ callRecordingId: callRecording.id,
+ reason: 'recording does not match the owned desktop upload',
+ };
+ }
+ await hydrateDesktopRecordingTimestamps(client, callRecording);
+ const syncResult = await syncCallRecording({
+ client,
+ callRecording,
+ requestedAt: request.requestedAt,
+ });
+
+ if (!syncResult.updated) {
+ return {
+ status: 'skipped',
+ callRecordingId: callRecording.id,
+ reason: 'no artifact updates',
+ };
+ }
+
+ return {
+ status: 'imported',
+ callRecordingId: request.callRecordingId,
+ outcome: 'call-recording-artifacts-imported',
+ };
+ } finally {
+ await releaseCallRecordingArtifactsImportClaim(client, {
+ callRecordingId: request.callRecordingId,
+ claimedAt,
+ });
+ }
+};
+
+const findCallRecordingForArtifactsImport = async (
+ client: CoreApiClient,
+ callRecordingId: string,
+): Promise<CallRecordingForArtifactsImport | undefined> => {
+ const queryResult = await client.query({
+ callRecordings: {
+ __args: {
+ filter: { id: { eq: callRecordingId } },
+ first: 1,
+ },
+ edges: {
+ node: {
+ id: true,
+ status: true,
+ startedAt: true,
+ endedAt: true,
+ companionSession: true,
+ externalBotId: true,
+ externalRecordingId: true,
+ companionFailureReason: true,
+ transcript: true,
+ audio: { fileId: true },
+ video: { fileId: true },
+ },
+ },
+ },
+ });
+
+ const node = queryResult.callRecordings?.edges?.[0]?.node as
+ | CallRecordingForArtifactsImportNode
+ | null
+ | undefined;
+ const id = getString(node?.id);
+
+ if (isUndefined(node) || isNull(node) || isUndefined(id)) {
+ return undefined;
+ }
+
+ return {
+ id,
+ companionSession: node.companionSession,
+ status: getString(node.status),
+ startedAt: getString(node.startedAt),
+ endedAt: getString(node.endedAt),
+ externalBotId: getString(node.externalBotId),
+ externalRecordingId: getString(node.externalRecordingId),
+ companionFailureReason: getString(node.companionFailureReason),
+ transcript: node.transcript ?? undefined,
+ audio: node.audio ?? undefined,
+ video: node.video ?? undefined,
+ };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-media.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-media.util.ts
new file mode 100644
index 00000000000..dd9d24f31c0
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-media.util.ts
@@ -0,0 +1,390 @@
+import { isNull, isUndefined } from '@sniptt/guards';
+import { MetadataApiClient } from 'twenty-client-sdk/metadata';
+
+import {
+ CALL_RECORDING_AUDIO_FIELD_UNIVERSAL_IDENTIFIER,
+ CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER,
+} from 'src/constants/universal-identifiers';
+import { COMPANION_MAX_MEDIA_FILE_SIZE_BYTES } from 'src/logic-functions/constants/companion-max-media-file-size-bytes';
+import {
+ AUDIO_FILE_TOO_LARGE_FAILURE_REASON,
+ VIDEO_FILE_TOO_LARGE_FAILURE_REASON,
+} from 'src/logic-functions/constants/media-file-too-large-failure-reasons';
+import { putMediaDownloadBodyToUploadTarget } from 'src/logic-functions/flows/put-media-download-body-to-upload-target.util';
+import { extractRecallMediaUrls } from 'src/logic-functions/recall-api/extract-recall-media-urls.util';
+import { getRecallRecording } from 'src/logic-functions/recall-api/get-recall-recording.util';
+import { type CallRecordingMediaFile } from 'src/logic-functions/types/call-recording-media-file.type';
+import { type CallRecordingUpdateFields } from 'src/logic-functions/types/call-recording-update-fields.type';
+import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+
+type CallRecordingMediaUpdateFields = Pick<
+ CallRecordingUpdateFields,
+ 'audio' | 'video' | 'companionFailureReason'
+>;
+
+type ImportMediaArtifactResult =
+ | { outcome: 'imported'; files: CallRecordingMediaFile[] }
+ | { outcome: 'too-large' }
+ | { outcome: 'failed' };
+
+type OpenMediaDownloadResult =
+ | { outcome: 'opened'; body: ReadableStream<Uint8Array>; sizeBytes: number }
+ | { outcome: 'too-large'; sizeBytes: number };
+
+type MediaUploadTarget = {
+ fileId: string;
+ uploadUrl: string;
+ contentType: string;
+};
+
+const MEDIA_DOWNLOAD_TIMEOUT_MS = 120_000;
+const MEDIA_FILE_FOLDER = 'FilesField';
+
+const MEDIA_ARTIFACT_DESCRIPTORS = [
+ {
+ field: 'video',
+ fileName: 'video.mp4',
+ fieldMetadataUniversalIdentifier:
+ CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER,
+ tooLargeFailureReason: VIDEO_FILE_TOO_LARGE_FAILURE_REASON,
+ },
+ {
+ field: 'audio',
+ fileName: 'audio.mp3',
+ fieldMetadataUniversalIdentifier:
+ CALL_RECORDING_AUDIO_FIELD_UNIVERSAL_IDENTIFIER,
+ tooLargeFailureReason: AUDIO_FILE_TOO_LARGE_FAILURE_REASON,
+ },
+] as const;
+
+export const importCallRecordingMedia = async ({
+ callRecordingId,
+ externalRecordingId,
+ hasAudio,
+ hasVideo,
+}: {
+ callRecordingId: string;
+ externalRecordingId: string;
+ hasAudio: boolean;
+ hasVideo: boolean;
+}): Promise<CallRecordingMediaUpdateFields> => {
+ if (hasAudio && hasVideo) {
+ return {};
+ }
+
+ const recordingResult = await getRecallRecording({ externalRecordingId });
+
+ if (!recordingResult.ok) {
+ console.warn(
+ `[companion] failed to fetch Recall recording ${externalRecordingId} while importing media for call recording ${callRecordingId}: ${recordingResult.errorMessage}`,
+ );
+
+ return {};
+ }
+
+ const mediaUrls = extractRecallMediaUrls(recordingResult.recording);
+ const metadataClient = new MetadataApiClient();
+ const updateFields: CallRecordingMediaUpdateFields = {};
+ const tooLargeFailureReasons: string[] = [];
+ const artifactStateByField = {
+ video: { alreadyImported: hasVideo, url: mediaUrls.videoUrl },
+ audio: { alreadyImported: hasAudio, url: mediaUrls.audioUrl },
+ };
+
+ for (const descriptor of MEDIA_ARTIFACT_DESCRIPTORS) {
+ const { alreadyImported, url } = artifactStateByField[descriptor.field];
+
+ if (alreadyImported || isUndefined(url)) {
+ continue;
+ }
+
+ const importResult = await importMediaArtifact({
+ callRecordingId,
+ metadataClient,
+ url,
+ fileName: descriptor.fileName,
+ fieldMetadataUniversalIdentifier:
+ descriptor.fieldMetadataUniversalIdentifier,
+ maxMediaFileSizeBytes: COMPANION_MAX_MEDIA_FILE_SIZE_BYTES,
+ });
+
+ if (importResult.outcome === 'imported') {
+ updateFields[descriptor.field] = importResult.files;
+ }
+
+ if (importResult.outcome === 'too-large') {
+ tooLargeFailureReasons.push(descriptor.tooLargeFailureReason);
+ }
+ }
+
+ if (tooLargeFailureReasons.length > 0) {
+ updateFields.companionFailureReason = tooLargeFailureReasons.join(',');
+ }
+
+ return updateFields;
+};
+
+const importMediaArtifact = async ({
+ callRecordingId,
+ metadataClient,
+ url,
+ fileName,
+ fieldMetadataUniversalIdentifier,
+ maxMediaFileSizeBytes,
+}: {
+ callRecordingId: string;
+ metadataClient: InstanceType<typeof MetadataApiClient>;
+ url: string;
+ fileName: string;
+ fieldMetadataUniversalIdentifier: string;
+ maxMediaFileSizeBytes: number;
+}): Promise<ImportMediaArtifactResult> => {
+ try {
+ const download = await openMediaDownload({
+ callRecordingId,
+ fileName,
+ url,
+ maxMediaFileSizeBytes,
+ });
+
+ if (download.outcome === 'too-large') {
+ console.warn(
+ `[companion] media-import phase=artifact-too-large callRecordingId=${callRecordingId} fileName=${fileName} sizeBytes=${download.sizeBytes} maxMediaFileSizeBytes=${maxMediaFileSizeBytes}`,
+ );
+
+ return { outcome: 'too-large' };
+ }
+
+ const fileId = await uploadMediaStreamToStorage({
+ callRecordingId,
+ metadataClient,
+ fileName,
+ fieldMetadataUniversalIdentifier,
+ body: download.body,
+ sizeBytes: download.sizeBytes,
+ });
+
+ return {
+ outcome: 'imported',
+ files: [{ fileId, label: fileName }],
+ };
+ } catch (error) {
+ console.warn(
+ `[companion] failed to import ${fileName} for call recording ${callRecordingId}: ${error instanceof Error ? error.message : String(error)}`,
+ );
+
+ return { outcome: 'failed' };
+ }
+};
+
+const openMediaDownload = async ({
+ callRecordingId,
+ fileName,
+ url,
+ maxMediaFileSizeBytes,
+}: {
+ callRecordingId: string;
+ fileName: string;
+ url: string;
+ maxMediaFileSizeBytes: number;
+}): Promise<OpenMediaDownloadResult> => {
+ const response = await fetch(url, {
+ signal: AbortSignal.timeout(MEDIA_DOWNLOAD_TIMEOUT_MS),
+ });
+ const contentLengthBytes = parseContentLengthBytes(
+ response.headers.get('content-length'),
+ );
+
+ console.log(
+ `[companion] media-import phase=artifact-download-response callRecordingId=${callRecordingId} fileName=${fileName} responseStatus=${response.status} contentLengthBytes=${contentLengthBytes ?? 'unknown'} ${formatMemoryUsageForLog()}`,
+ );
+
+ if (!response.ok) {
+ await cancelMediaDownloadBody({
+ callRecordingId,
+ fileName,
+ body: response.body,
+ });
+
+ throw new Error(`download failed with status ${response.status}`);
+ }
+
+ if (isUndefined(contentLengthBytes)) {
+ await cancelMediaDownloadBody({
+ callRecordingId,
+ fileName,
+ body: response.body,
+ });
+
+ throw new Error('download response is missing content-length');
+ }
+
+ if (contentLengthBytes > maxMediaFileSizeBytes) {
+ await cancelMediaDownloadBody({
+ callRecordingId,
+ fileName,
+ body: response.body,
+ });
+
+ return { outcome: 'too-large', sizeBytes: contentLengthBytes };
+ }
+
+ if (isNull(response.body)) {
+ throw new Error('download returned no body');
+ }
+
+ return {
+ outcome: 'opened',
+ body: response.body,
+ sizeBytes: contentLengthBytes,
+ };
+};
+
+const uploadMediaStreamToStorage = async ({
+ callRecordingId,
+ metadataClient,
+ fileName,
+ fieldMetadataUniversalIdentifier,
+ body,
+ sizeBytes,
+}: {
+ callRecordingId: string;
+ metadataClient: InstanceType<typeof MetadataApiClient>;
+ fileName: string;
+ fieldMetadataUniversalIdentifier: string;
+ body: ReadableStream<Uint8Array>;
+ sizeBytes: number;
+}): Promise<string> => {
+ const uploadTarget = await createFileUploadTarget({
+ metadataClient,
+ fileName,
+ sizeBytes,
+ fieldMetadataUniversalIdentifier,
+ }).catch(async (error) => {
+ await cancelMediaDownloadBody({
+ callRecordingId,
+ fileName,
+ body,
+ });
+
+ throw error;
+ });
+
+ console.log(
+ `[companion] media-import phase=artifact-upload-start callRecordingId=${callRecordingId} fileName=${fileName} declaredBytes=${sizeBytes} ${formatMemoryUsageForLog()}`,
+ );
+
+ await putMediaDownloadBodyToUploadTarget({
+ fileName,
+ mediaDownloadBody: body,
+ sizeBytes,
+ uploadTarget,
+ });
+
+ return completeFileUpload({ metadataClient, fileId: uploadTarget.fileId });
+};
+
+const cancelMediaDownloadBody = async ({
+ callRecordingId,
+ fileName,
+ body,
+}: {
+ callRecordingId: string;
+ fileName: string;
+ body: ReadableStream<Uint8Array> | null;
+}) => {
+ if (isNull(body)) {
+ return;
+ }
+
+ await body.cancel().catch((error) => {
+ console.warn(
+ `[companion] media-import phase=download-body-cancel-failed callRecordingId=${callRecordingId} fileName=${fileName}: ${error instanceof Error ? error.message : String(error)}`,
+ );
+ });
+};
+
+const createFileUploadTarget = async ({
+ metadataClient,
+ fileName,
+ sizeBytes,
+ fieldMetadataUniversalIdentifier,
+}: {
+ metadataClient: InstanceType<typeof MetadataApiClient>;
+ fileName: string;
+ sizeBytes: number;
+ fieldMetadataUniversalIdentifier: string;
+}): Promise<MediaUploadTarget> => {
+ const mutationResult = await metadataClient.mutation({
+ createFileUpload: {
+ __args: {
+ filename: fileName,
+ size: sizeBytes,
+ fileFolder: MEDIA_FILE_FOLDER,
+ fieldMetadataUniversalIdentifier,
+ },
+ fileId: true,
+ uploadUrl: true,
+ contentType: true,
+ },
+ });
+ const uploadTarget = mutationResult.createFileUpload;
+
+ if (isUndefined(uploadTarget)) {
+ throw new Error(
+ 'createFileUpload mutation did not return an upload target',
+ );
+ }
+
+ return uploadTarget;
+};
+
+const completeFileUpload = async ({
+ metadataClient,
+ fileId,
+}: {
+ metadataClient: InstanceType<typeof MetadataApiClient>;
+ fileId: string;
+}): Promise<string> => {
+ const mutationResult = await metadataClient.mutation({
+ completeFileUpload: {
+ __args: { fileId },
+ id: true,
+ },
+ });
+ const uploadedFileId = mutationResult.completeFileUpload?.id;
+
+ if (isUndefined(uploadedFileId)) {
+ throw new Error('completeFileUpload mutation did not return a file id');
+ }
+
+ return uploadedFileId;
+};
+
+const parseContentLengthBytes = (
+ headerValue: string | null,
+): number | undefined => {
+ if (!isNonEmptyString(headerValue)) {
+ return undefined;
+ }
+
+ const parsedBytes = Number(headerValue.trim());
+
+ return Number.isFinite(parsedBytes) && parsedBytes >= 0
+ ? parsedBytes
+ : undefined;
+};
+
+const formatMemoryUsageForLog = (): string => {
+ const memoryUsage = process.memoryUsage();
+
+ return [
+ `rssMegaBytes=${formatBytesAsMegaBytes(memoryUsage.rss)}`,
+ `heapUsedMegaBytes=${formatBytesAsMegaBytes(memoryUsage.heapUsed)}`,
+ `externalMegaBytes=${formatBytesAsMegaBytes(memoryUsage.external)}`,
+ `arrayBuffersMegaBytes=${formatBytesAsMegaBytes(memoryUsage.arrayBuffers)}`,
+ ].join(' ');
+};
+
+const formatBytesAsMegaBytes = (bytes: number): string =>
+ (bytes / 1024 / 1024).toFixed(1);
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-transcript-result.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-transcript-result.type.ts
new file mode 100644
index 00000000000..256ee5734ba
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-transcript-result.type.ts
@@ -0,0 +1,11 @@
+import { type CallRecordingUpdateFields } from 'src/logic-functions/types/call-recording-update-fields.type';
+
+type CallRecordingTranscriptArtifactUpdateFields = Pick<
+ CallRecordingUpdateFields,
+ 'companionFailureReason' | 'status' | 'transcript'
+>;
+
+export type ImportCallRecordingTranscriptResult = {
+ updateData: CallRecordingTranscriptArtifactUpdateFields;
+ requestedTranscript: boolean;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-transcript.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-transcript.util.ts
new file mode 100644
index 00000000000..98638738746
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-transcript.util.ts
@@ -0,0 +1,181 @@
+import { isUndefined } from '@sniptt/guards';
+
+import { buildFailedTranscriptMarker } from 'src/logic-functions/domain/build-failed-transcript-marker.util';
+import { buildPendingTranscriptMarker } from 'src/logic-functions/domain/build-pending-transcript-marker.util';
+import { buildTranscriptFailureReason } from 'src/logic-functions/domain/build-transcript-failure-reason.util';
+import { parseTranscriptMarker } from 'src/logic-functions/domain/parse-transcript-marker.util';
+import { createAsyncRecallTranscript } from 'src/logic-functions/recall-api/create-async-recall-transcript.util';
+import { listRecallTranscripts } from 'src/logic-functions/recall-api/list-recall-transcripts.util';
+import { type RecallTranscriptSummary } from 'src/logic-functions/recall-api/recall-transcript-summary.type';
+import { downloadTranscript } from 'src/logic-functions/flows/download-transcript.util';
+import { type ImportCallRecordingTranscriptResult } from 'src/logic-functions/flows/import-call-recording-transcript-result.type';
+
+type CallRecordingTranscriptArtifactUpdateFields =
+ ImportCallRecordingTranscriptResult['updateData'];
+
+export const importCallRecordingTranscript = async ({
+ callRecordingId,
+ externalRecordingId,
+ requestedAt,
+ transcript,
+}: {
+ callRecordingId: string;
+ currentStatus: string | undefined;
+ externalRecordingId: string;
+ requestedAt: string;
+ transcript: unknown;
+}): Promise<ImportCallRecordingTranscriptResult> => {
+ const existingTranscriptMarker = parseTranscriptMarker(transcript);
+
+ if (Array.isArray(transcript) && isUndefined(existingTranscriptMarker)) {
+ return buildEmptyTranscriptArtifactResult();
+ }
+
+ const listResult = await listRecallTranscripts({ externalRecordingId });
+
+ if (!listResult.ok) {
+ console.warn(
+ `[companion] failed to list Recall transcripts for recording ${externalRecordingId}: ${listResult.errorMessage}`,
+ );
+
+ return buildEmptyTranscriptArtifactResult();
+ }
+
+ const pendingTranscriptMarkerRecallTranscriptId =
+ existingTranscriptMarker?.recallTranscriptId ?? undefined;
+ const transcriptArtifact = pendingTranscriptMarkerRecallTranscriptId
+ ? listResult.transcripts.find(
+ (artifact) => artifact.id === pendingTranscriptMarkerRecallTranscriptId,
+ )
+ : selectRecallTranscriptArtifact(listResult.transcripts);
+ if (transcriptArtifact?.statusCode === 'deleted') {
+ return { updateData: { transcript: null }, requestedTranscript: false };
+ }
+ const transcriptIdToDownload =
+ pendingTranscriptMarkerRecallTranscriptId ?? transcriptArtifact?.id;
+
+ if (
+ isUndefined(transcriptArtifact) &&
+ isUndefined(pendingTranscriptMarkerRecallTranscriptId)
+ ) {
+ // An uncertain create response must not trigger another paid transcription.
+ if (existingTranscriptMarker) return buildEmptyTranscriptArtifactResult();
+ const createResult = await createAsyncRecallTranscript({
+ externalRecordingId,
+ });
+
+ if (!createResult.ok) {
+ console.warn(
+ `[companion] failed to request transcript for Recall recording ${externalRecordingId}: ${createResult.errorMessage}`,
+ );
+
+ if (createResult.status === 429 || (createResult.status ?? 0) >= 500)
+ return buildEmptyTranscriptArtifactResult();
+
+ return {
+ updateData: {
+ transcript: buildPendingTranscriptMarker({
+ recallTranscriptId: null,
+ requestedAt,
+ }),
+ },
+ requestedTranscript: true,
+ };
+ }
+
+ return {
+ updateData: {
+ transcript: buildPendingTranscriptMarker({
+ recallTranscriptId: createResult.transcriptId,
+ requestedAt,
+ }),
+ },
+ requestedTranscript: true,
+ };
+ }
+
+ if (
+ !isUndefined(transcriptArtifact) &&
+ (transcriptArtifact.statusCode === 'failed' ||
+ transcriptArtifact.statusCode === 'error')
+ ) {
+ return {
+ updateData: buildTranscriptFailureUpdate({
+ transcriptId: transcriptArtifact.id,
+ subCode: transcriptArtifact.statusSubCode ?? null,
+ }),
+ requestedTranscript: false,
+ };
+ }
+
+ if (
+ !isUndefined(transcriptArtifact) &&
+ transcriptArtifact.statusCode !== 'done'
+ ) {
+ return buildEmptyTranscriptArtifactResult();
+ }
+
+ if (isUndefined(transcriptIdToDownload)) {
+ return buildEmptyTranscriptArtifactResult();
+ }
+
+ const downloadResult = await downloadTranscript({
+ transcriptId: transcriptIdToDownload,
+ });
+
+ if (downloadResult.outcome === 'filled') {
+ return {
+ updateData: {
+ transcript: downloadResult.content as Record<string, unknown>,
+ },
+ requestedTranscript: false,
+ };
+ }
+
+ if (downloadResult.outcome === 'deleted') {
+ return { updateData: { transcript: null }, requestedTranscript: false };
+ }
+
+ if (downloadResult.outcome === 'failed') {
+ return {
+ updateData: buildTranscriptFailureUpdate({
+ transcriptId: transcriptIdToDownload,
+ subCode: downloadResult.subCode,
+ }),
+ requestedTranscript: false,
+ };
+ }
+
+ if (downloadResult.outcome === 'error') {
+ console.warn(
+ `[companion] could not fill transcript for call recording ${callRecordingId}: ${downloadResult.errorMessage}`,
+ );
+ }
+
+ return buildEmptyTranscriptArtifactResult();
+};
+
+const buildEmptyTranscriptArtifactResult =
+ (): ImportCallRecordingTranscriptResult => ({
+ updateData: {},
+ requestedTranscript: false,
+ });
+
+const selectRecallTranscriptArtifact = (
+ transcripts: RecallTranscriptSummary[],
+): RecallTranscriptSummary | undefined =>
+ transcripts.find((transcript) => transcript.statusCode !== 'deleted');
+
+const buildTranscriptFailureUpdate = ({
+ transcriptId,
+ subCode,
+}: {
+ transcriptId: string;
+ subCode: string | null;
+}): CallRecordingTranscriptArtifactUpdateFields => ({
+ transcript: buildFailedTranscriptMarker({
+ recallTranscriptId: transcriptId,
+ subCode,
+ }),
+ companionFailureReason: buildTranscriptFailureReason(subCode),
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/persist-call-recording-progress.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/persist-call-recording-progress.util.ts
new file mode 100644
index 00000000000..428d25f8b54
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/persist-call-recording-progress.util.ts
@@ -0,0 +1,51 @@
+import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+
+import { getAllowedPreviousCallRecordingStatuses } from 'src/logic-functions/domain/is-call-recording-status-downgrade.util';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+import { completeAndChargeCallRecording } from 'src/logic-functions/flows/complete-and-charge-call-recording.util';
+import { updateCallRecording } from 'src/logic-functions/data/update-call-recording.util';
+import { type CallRecordingUpdateFields } from 'src/logic-functions/types/call-recording-update-fields.type';
+
+export const persistCallRecordingProgress = async (
+ client: CoreApiClient,
+ {
+ id,
+ updateData,
+ completesImport,
+ }: {
+ id: string;
+ current: { startedAt?: string; endedAt?: string };
+ updateData: CallRecordingUpdateFields;
+ completesImport: boolean;
+ },
+): Promise<void> => {
+ if (!completesImport) {
+ await updateCallRecording(client, {
+ id,
+ data: updateData,
+ expectedStatuses: getAllowedPreviousCallRecordingStatuses(
+ updateData.status ?? CallRecordingStatus.PROCESSING,
+ ),
+ });
+
+ return;
+ }
+
+ const { status: _status, ...nonStatusUpdate } = updateData;
+
+ if (Object.keys(nonStatusUpdate).length > 0) {
+ const updated = await updateCallRecording(client, {
+ id,
+ data: nonStatusUpdate,
+ expectedStatuses: getAllowedPreviousCallRecordingStatuses(
+ CallRecordingStatus.PROCESSING,
+ ),
+ });
+ if (!updated) return;
+ }
+
+ await completeAndChargeCallRecording(client, {
+ id,
+ });
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/put-media-download-body-to-upload-target.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/put-media-download-body-to-upload-target.util.ts
new file mode 100644
index 00000000000..f0e6619fbce
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/put-media-download-body-to-upload-target.util.ts
@@ -0,0 +1,144 @@
+import {
+ request as requestOverHttp,
+ type ClientRequest,
+ type IncomingMessage,
+} from 'node:http';
+import { request as requestOverHttps } from 'node:https';
+import { Readable } from 'node:stream';
+import { finished, pipeline } from 'node:stream/promises';
+import { type ReadableStream as NodeWebReadableStream } from 'node:stream/web';
+
+type MediaUploadTarget = {
+ uploadUrl: string;
+ contentType: string;
+};
+
+const MEDIA_UPLOAD_TIMEOUT_MS = 60 * 1000;
+const HTTP_STATUS_OK_LOWER_BOUND = 200;
+const HTTP_STATUS_OK_UPPER_BOUND = 300;
+
+export const putMediaDownloadBodyToUploadTarget = async ({
+ mediaDownloadBody,
+ fileName,
+ sizeBytes,
+ uploadTarget,
+}: {
+ mediaDownloadBody: ReadableStream<Uint8Array>;
+ fileName: string;
+ sizeBytes: number;
+ uploadTarget: MediaUploadTarget;
+}): Promise<void> => {
+ // Use node:http instead of fetch here: fetch can buffer ReadableStream
+ // request bodies in memory, which OOMs Lambda for large recordings.
+ const mediaDownloadReadable = Readable.fromWeb(
+ mediaDownloadBody as NodeWebReadableStream<Uint8Array>,
+ );
+
+ await streamMediaDownloadReadableToUploadTarget({
+ fileName,
+ mediaDownloadReadable,
+ sizeBytes,
+ uploadTarget,
+ });
+};
+
+const streamMediaDownloadReadableToUploadTarget = async ({
+ fileName,
+ mediaDownloadReadable,
+ sizeBytes,
+ uploadTarget,
+}: {
+ fileName: string;
+ mediaDownloadReadable: Readable;
+ sizeBytes: number;
+ uploadTarget: MediaUploadTarget;
+}): Promise<void> => {
+ const uploadUrl = new URL(uploadTarget.uploadUrl);
+ const requestUpload =
+ uploadUrl.protocol === 'http:' ? requestOverHttp : requestOverHttps;
+ const uploadRequest = requestUpload(uploadUrl, {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': uploadTarget.contentType,
+ 'Content-Length': sizeBytes,
+ },
+ signal: AbortSignal.timeout(MEDIA_UPLOAD_TIMEOUT_MS),
+ });
+
+ const uploadResponsePromise = waitForUploadResponse({ uploadRequest });
+ const uploadPipelinePromise = pipeline(mediaDownloadReadable, uploadRequest);
+
+ let uploadResponse: IncomingMessage;
+
+ try {
+ uploadResponse = await waitForUploadResponseOrPipelineFailure({
+ uploadPipelinePromise,
+ uploadResponsePromise,
+ });
+ } catch (error) {
+ mediaDownloadReadable.destroy();
+ uploadRequest.destroy();
+ await uploadPipelinePromise.catch(() => undefined);
+
+ throw error;
+ }
+
+ const uploadResponseBodyDrainPromise = drainUploadResponseBody({
+ uploadResponse,
+ });
+ const uploadStatusCode = uploadResponse.statusCode ?? 0;
+
+ if (!isSuccessfulUploadStatusCode(uploadStatusCode)) {
+ const uploadError = new Error(
+ `upload of ${fileName} failed with status ${uploadStatusCode}`,
+ );
+
+ mediaDownloadReadable.destroy(uploadError);
+ uploadRequest.destroy(uploadError);
+
+ await Promise.allSettled([
+ uploadPipelinePromise,
+ uploadResponseBodyDrainPromise,
+ ]);
+
+ throw uploadError;
+ }
+
+ await Promise.all([uploadPipelinePromise, uploadResponseBodyDrainPromise]);
+};
+
+const waitForUploadResponse = ({
+ uploadRequest,
+}: {
+ uploadRequest: ClientRequest;
+}): Promise<IncomingMessage> =>
+ new Promise<IncomingMessage>((resolve, reject) => {
+ uploadRequest.once('response', resolve);
+ uploadRequest.once('error', reject);
+ });
+
+const waitForUploadResponseOrPipelineFailure = async ({
+ uploadPipelinePromise,
+ uploadResponsePromise,
+}: {
+ uploadPipelinePromise: Promise<void>;
+ uploadResponsePromise: Promise<IncomingMessage>;
+}): Promise<IncomingMessage> =>
+ Promise.race([
+ uploadResponsePromise,
+ uploadPipelinePromise.then(async () => await uploadResponsePromise),
+ ]);
+
+const drainUploadResponseBody = async ({
+ uploadResponse,
+}: {
+ uploadResponse: IncomingMessage;
+}): Promise<void> => {
+ uploadResponse.resume();
+
+ await finished(uploadResponse);
+};
+
+const isSuccessfulUploadStatusCode = (uploadStatusCode: number): boolean =>
+ uploadStatusCode >= HTTP_STATUS_OK_LOWER_BOUND &&
+ uploadStatusCode < HTTP_STATUS_OK_UPPER_BOUND;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/recover-desktop-recordings.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/recover-desktop-recordings.util.ts
new file mode 100644
index 00000000000..98cff2fcd1a
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/recover-desktop-recordings.util.ts
@@ -0,0 +1,162 @@
+import { NON_TERMINAL_CALL_RECORDING_STATUSES } from 'src/logic-functions/constants/non-terminal-call-recording-statuses';
+import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
+import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/get-owned-desktop-upload.util';
+import { getRecallRecording } from 'src/logic-functions/recall-api/get-recall-recording.util';
+import { normalizeRecallTimestamp } from 'src/logic-functions/recall-api/normalize-recall-timestamp.util';
+import { getString } from 'src/logic-functions/utils/get-string.util';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
+import { type SyncableCallRecording } from 'src/logic-functions/flows/sync-call-recording.util';
+import { updateCallRecording } from 'src/logic-functions/data/update-call-recording.util';
+import { enqueueCallRecordingArtifactsImport } from 'src/logic-functions/data/enqueue-call-recording-artifacts-import.util';
+
+export const hydrateDesktopRecordingTimestamps = async (
+ client: CoreApiClient,
+ recording: SyncableCallRecording,
+): Promise<void> => {
+ if (
+ !isDesktopAudioRecording(recording.companionSession) ||
+ !recording.externalRecordingId ||
+ (recording.startedAt && recording.endedAt)
+ )
+ return;
+ const result = await getRecallRecording({
+ externalRecordingId: recording.externalRecordingId,
+ });
+ if (!result.ok) throw new Error('Recall recording is not available yet.');
+ const startedAt =
+ recording.startedAt ??
+ normalizeRecallTimestamp(getString(result.recording.started_at));
+ const endedAt =
+ recording.endedAt ??
+ normalizeRecallTimestamp(getString(result.recording.completed_at));
+ await updateCallRecording(client, {
+ id: recording.id,
+ data: {
+ ...(startedAt ? { startedAt } : {}),
+ ...(endedAt ? { endedAt } : {}),
+ },
+ });
+ recording.startedAt = startedAt;
+ recording.endedAt = endedAt;
+};
+
+export const recoverDesktopRecordings = async (
+ client: CoreApiClient,
+ now: Date,
+): Promise<{ recovered: number }> => {
+ const config = getRecallApiConfig();
+ if (!config.success) return { recovered: 0 };
+ const staleBefore = new Date(now.getTime() - 5 * 60_000).toISOString();
+ // A small oldest-first batch fits the maintenance function's time budget.
+ const result = await client.query({
+ callRecordings: {
+ __args: {
+ first: 5,
+ orderBy: [{ updatedAt: 'AscNullsFirst' }],
+ filter: {
+ and: [
+ { companionSession: { is: 'NOT_NULL' } },
+ { status: { in: ['JOINING', 'RECORDING', 'PROCESSING'] } },
+ {
+ updatedAt: {
+ lt: staleBefore,
+ },
+ },
+ ],
+ },
+ },
+ edges: {
+ node: {
+ id: true,
+ createdAt: true,
+ companionSession: true,
+ status: true,
+ transcript: true,
+ },
+ },
+ },
+ });
+ let recovered = 0;
+ for (const { node } of result.callRecordings?.edges ?? []) {
+ if (!node || !isDesktopAudioRecording(node.companionSession)) continue;
+ if (node.status === 'FAILED') continue;
+ const recoverableStatuses = NON_TERMINAL_CALL_RECORDING_STATUSES;
+ const session = asRecord(node.companionSession);
+ // Rotate the bounded batch so long calls cannot starve completed uploads.
+ const claimed = await client.mutation({
+ updateCallRecordings: {
+ __args: {
+ filter: {
+ id: { eq: String(node.id) },
+ updatedAt: { lt: staleBefore },
+ status: { in: recoverableStatuses },
+ },
+ data: { updatedAt: now.toISOString() },
+ },
+ id: true,
+ },
+ });
+ if (!claimed.updateCallRecordings?.length) continue;
+ const sdkUploadId = getString(session?.sdkUploadId);
+ if (!sdkUploadId) {
+ if (now.getTime() - Date.parse(String(node.createdAt)) > 60 * 60_000)
+ await updateCallRecording(client, {
+ id: String(node.id),
+ expectedStatuses: [CallRecordingStatus.JOINING],
+ data: {
+ status: CallRecordingStatus.FAILED,
+ companionFailureReason: 'desktop_setup_interrupted',
+ },
+ });
+ continue;
+ }
+ let upload;
+ try {
+ upload = await getOwnedDesktopUpload({
+ id: String(node.id),
+ companionSession: node.companionSession,
+ });
+ } catch {
+ // Other records in the batch may still be recoverable during a provider outage.
+ continue;
+ }
+ if (!upload) continue;
+ const { status, recording_id: recordingId } = upload;
+ if (
+ status.code === 'failed' ||
+ (status.code === 'pending' &&
+ now.getTime() - Date.parse(String(node.createdAt)) > 60 * 60_000)
+ ) {
+ await updateCallRecording(client, {
+ id: String(node.id),
+ expectedStatuses:
+ status.code === 'pending'
+ ? [CallRecordingStatus.JOINING]
+ : NON_TERMINAL_CALL_RECORDING_STATUSES,
+ data: {
+ status: CallRecordingStatus.FAILED,
+ companionFailureReason:
+ status.sub_code ?? 'desktop_capture_did_not_start',
+ },
+ });
+ } else if (status.code === 'complete' && recordingId) {
+ const updated = await updateCallRecording(client, {
+ id: String(node.id),
+ expectedStatuses: recoverableStatuses,
+ data: {
+ externalRecordingId: recordingId,
+ status: CallRecordingStatus.PROCESSING,
+ },
+ });
+ if (!updated) continue;
+ await enqueueCallRecordingArtifactsImport({
+ callRecordingId: String(node.id),
+ });
+ recovered++;
+ }
+ }
+ return { recovered };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/recover-recording-summaries.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/recover-recording-summaries.util.ts
new file mode 100644
index 00000000000..b4a6a81cbdf
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/recover-recording-summaries.util.ts
@@ -0,0 +1,68 @@
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { kv } from 'twenty-sdk/logic-function';
+
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+
+const SUMMARY_RECOVERY_CURSOR_KEY = 'companion-summary-recovery-cursor';
+
+export const recoverRecordingSummaries = async (
+ client: CoreApiClient,
+ now: Date,
+): Promise<void> => {
+ const staleBefore = new Date(now.getTime() - 5 * 60_000).toISOString();
+ const cursor = await kv.get(SUMMARY_RECOVERY_CURSOR_KEY);
+ const missingSummary = {
+ or: [
+ { summary: { markdown: { is: 'NULL' as const } } },
+ { summary: { markdown: { eq: '' } } },
+ ],
+ };
+ const result = await client.query({
+ callRecordings: {
+ __args: {
+ first: 20,
+ ...(typeof cursor === 'string' && cursor ? { after: cursor } : {}),
+ orderBy: [{ createdAt: 'AscNullsFirst' }],
+ filter: {
+ ...missingSummary,
+ status: { eq: 'COMPLETED' },
+ createdAt: { lt: staleBefore },
+ },
+ },
+ edges: { node: { id: true } },
+ pageInfo: { hasNextPage: true, endCursor: true },
+ },
+ });
+ for (const { node } of result.callRecordings?.edges ?? []) {
+ if (!node) continue;
+ try {
+ // Only recover paid results; maintenance must not start new paid generations.
+ const cached = asRecord(
+ await kv.get(`companion-summary:${node.id}:automatic`),
+ );
+ if (cached?.status !== 'READY' || typeof cached.markdown !== 'string')
+ continue;
+ await client.mutation({
+ updateCallRecordings: {
+ __args: {
+ filter: { id: { eq: node.id }, ...missingSummary },
+ data: { summary: { blocknote: null, markdown: cached.markdown } },
+ },
+ id: true,
+ },
+ });
+ } catch (error) {
+ console.warn(
+ `[companion] summary save remains pending for ${node.id}`,
+ error,
+ );
+ }
+ }
+ // Advance independently of recording writes so older rows cannot starve recovery.
+ const pageInfo = result.callRecordings?.pageInfo;
+ if (pageInfo?.hasNextPage && pageInfo.endCursor) {
+ await kv.set(SUMMARY_RECOVERY_CURSOR_KEY, pageInfo.endCursor);
+ } else {
+ await kv.delete(SUMMARY_RECOVERY_CURSOR_KEY);
+ }
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/sync-call-recording.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/sync-call-recording.util.ts
new file mode 100644
index 00000000000..82a973be9aa
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/sync-call-recording.util.ts
@@ -0,0 +1,144 @@
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
+import { parseTranscriptMarker } from 'src/logic-functions/domain/parse-transcript-marker.util';
+import { isCallRecordingMediaImportComplete } from 'src/logic-functions/domain/is-call-recording-import-complete.util';
+import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { isNonEmptyArray, isUndefined } from '@sniptt/guards';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+import { isUnavailableCallRecordingStatus } from 'src/logic-functions/domain/is-unavailable-call-recording-status.util';
+import { shouldCompleteCallRecordingImport } from 'src/logic-functions/domain/should-complete-call-recording-import.util';
+import { importCallRecordingMedia } from 'src/logic-functions/flows/import-call-recording-media.util';
+import { persistCallRecordingProgress } from 'src/logic-functions/flows/persist-call-recording-progress.util';
+import { importCallRecordingTranscript } from 'src/logic-functions/flows/import-call-recording-transcript.util';
+import { type CallRecordingUpdateFields } from 'src/logic-functions/types/call-recording-update-fields.type';
+import { type FilesFieldValue } from 'src/logic-functions/types/files-field-value.type';
+
+export type SyncableCallRecording = {
+ companionSession?: unknown;
+ id: string;
+ status: string | undefined;
+ startedAt: string | undefined;
+ endedAt: string | undefined;
+ externalRecordingId: string | undefined;
+ companionFailureReason: string | undefined;
+ transcript: unknown;
+ audio: FilesFieldValue | undefined;
+ video: FilesFieldValue | undefined;
+};
+
+export type SyncCallRecordingResult = {
+ updated: boolean;
+ requestedTranscript: boolean;
+};
+
+export const syncCallRecording = async ({
+ client,
+ callRecording,
+ requestedAt,
+}: {
+ client: CoreApiClient;
+ callRecording: SyncableCallRecording;
+ requestedAt: string;
+}): Promise<SyncCallRecordingResult> => {
+ const externalRecordingId = callRecording.externalRecordingId;
+ let updateData: CallRecordingUpdateFields = {};
+
+ let requestedTranscript = false;
+
+ if (!isUndefined(externalRecordingId)) {
+ const transcriptImportResult = await importCallRecordingTranscript({
+ callRecordingId: callRecording.id,
+ currentStatus: callRecording.status,
+ externalRecordingId,
+ requestedAt,
+ transcript: callRecording.transcript,
+ });
+
+ requestedTranscript = transcriptImportResult.requestedTranscript;
+ updateData = { ...updateData, ...transcriptImportResult.updateData };
+
+ const mediaImportUpdate = await importCallRecordingMedia({
+ callRecordingId: callRecording.id,
+ externalRecordingId,
+ hasAudio: isNonEmptyArray(callRecording.audio),
+ hasVideo:
+ isDesktopAudioRecording(callRecording.companionSession) ||
+ isNonEmptyArray(callRecording.video),
+ });
+
+ updateData = {
+ ...updateData,
+ ...resolveMediaImportUpdate({
+ mediaImportUpdate,
+ currentStatus: callRecording.status,
+ pendingStatus: updateData.status,
+ transcriptFailureReason: updateData.companionFailureReason,
+ }),
+ };
+ }
+
+ if (
+ parseTranscriptMarker(updateData.transcript ?? callRecording.transcript)
+ ?.status === 'FAILED' &&
+ isCallRecordingMediaImportComplete({
+ requiresVideo: !isDesktopAudioRecording(callRecording.companionSession),
+ audio: updateData.audio ?? callRecording.audio,
+ video: updateData.video ?? callRecording.video,
+ companionFailureReason:
+ updateData.companionFailureReason ??
+ callRecording.companionFailureReason,
+ })
+ )
+ updateData.status = CallRecordingStatus.FAILED;
+
+ const completesImport = shouldCompleteCallRecordingImport({
+ current: callRecording,
+ updateData,
+ });
+
+ if (Object.keys(updateData).length === 0 && !completesImport) {
+ return { updated: false, requestedTranscript };
+ }
+
+ await persistCallRecordingProgress(client, {
+ id: callRecording.id,
+ current: callRecording,
+ updateData,
+ completesImport,
+ });
+
+ return { updated: true, requestedTranscript };
+};
+
+// Preserve both failures so oversized media does not prevent terminal status.
+const resolveMediaImportUpdate = ({
+ mediaImportUpdate,
+ currentStatus,
+ pendingStatus,
+ transcriptFailureReason,
+}: {
+ mediaImportUpdate: CallRecordingUpdateFields;
+ currentStatus: string | undefined;
+ pendingStatus: string | undefined;
+ transcriptFailureReason: string | null | undefined;
+}): CallRecordingUpdateFields => {
+ const hasNoRecording =
+ isUnavailableCallRecordingStatus(currentStatus) ||
+ isUnavailableCallRecordingStatus(pendingStatus);
+
+ if (!hasNoRecording && !transcriptFailureReason) {
+ return mediaImportUpdate;
+ }
+
+ if (transcriptFailureReason && mediaImportUpdate.companionFailureReason) {
+ return {
+ ...mediaImportUpdate,
+ companionFailureReason: `${transcriptFailureReason},${mediaImportUpdate.companionFailureReason}`,
+ };
+ }
+
+ const { companionFailureReason: _failureReason, ...scrubbedUpdate } =
+ mediaImportUpdate;
+
+ return scrubbedUpdate;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/import-call-recording-artifacts.ts b/packages/twenty-apps/public/companion/src/logic-functions/import-call-recording-artifacts.ts
new file mode 100644
index 00000000000..9eca90dc793
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/import-call-recording-artifacts.ts
@@ -0,0 +1,50 @@
+import { isUndefined } from '@sniptt/guards';
+import { CoreApiClient } from 'twenty-client-sdk/core';
+import { defineLogicFunction } from 'twenty-sdk/define';
+
+import { IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import {
+ importCallRecordingArtifacts,
+ type ImportCallRecordingArtifactsResult,
+} from 'src/logic-functions/flows/import-call-recording-artifacts.util';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { buildStepError } from 'src/logic-functions/utils/build-step-failure.util';
+import { getString } from 'src/logic-functions/utils/get-string.util';
+
+export const importCallRecordingArtifactsHandler = async (
+ payload: unknown,
+): Promise<ImportCallRecordingArtifactsResult> => {
+ const body = asRecord(payload);
+ const callRecordingId = getString(body?.callRecordingId);
+ const requestedAt = getString(body?.requestedAt);
+
+ if (isUndefined(callRecordingId) || isUndefined(requestedAt)) {
+ return {
+ status: 'skipped',
+ callRecordingId: callRecordingId ?? 'unknown',
+ reason: 'invalid call recording artifacts import request',
+ };
+ }
+
+ try {
+ return await importCallRecordingArtifacts({
+ client: new CoreApiClient(),
+ request: { callRecordingId, requestedAt },
+ });
+ } catch (error) {
+ throw buildStepError(
+ `artifact import for call recording ${callRecordingId}`,
+ error,
+ );
+ }
+};
+
+export default defineLogicFunction({
+ universalIdentifier:
+ IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
+ name: 'import-call-recording-artifacts',
+ description:
+ 'Imports recording media and transcript artifacts as an enqueued job after a verified Recall webhook resolves the owning CallRecording.',
+ timeoutSeconds: 250,
+ handler: importCallRecordingArtifactsHandler,
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/process-recall-webhook.ts b/packages/twenty-apps/public/companion/src/logic-functions/process-recall-webhook.ts
new file mode 100644
index 00000000000..d2fc2412e2b
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/process-recall-webhook.ts
@@ -0,0 +1,64 @@
+import { CoreApiClient } from 'twenty-client-sdk/core';
+import { defineLogicFunction } from 'twenty-sdk/define';
+
+import { PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { handleRecallWebhook } from 'src/logic-functions/flows/handle-recall-webhook.util';
+import { buildStepError } from 'src/logic-functions/utils/build-step-failure.util';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
+import { verifyRecallWebhookSignature } from 'src/logic-functions/recall-api/verify-recall-webhook-signature.util';
+import { extractTwentyWorkspaceIdFromRecallWebhook } from 'src/logic-functions/recall-api/extract-twenty-workspace-id-from-recall-webhook.util';
+import { getCurrentWorkspaceId } from 'src/logic-functions/data/get-current-workspace-id.util';
+
+export const processRecallWebhookHandler = async (payload: unknown) => {
+ const envelope = asRecord(payload);
+ const headers = asRecord(envelope?.headers);
+ const secret = getApplicationVariableValue('RECALL_WEBHOOK_SECRET');
+ if (!secret)
+ throw new Error('Recall webhook verification is not configured.');
+ if (
+ typeof envelope?.rawBody !== 'string' ||
+ !headers ||
+ Object.values(headers).some(
+ (value) => typeof value !== 'string' && value !== undefined,
+ )
+ ) {
+ return { status: 'skipped', reason: 'unsigned webhook payload' };
+ }
+ const signature = verifyRecallWebhookSignature({
+ rawBody: envelope.rawBody,
+ headers: headers as Record<string, string | undefined>,
+ secret,
+ // Expired deliveries are recovered by the recording reconciler.
+ checkTimestamp: true,
+ });
+ if (!signature.valid)
+ return { status: 'skipped', reason: 'invalid webhook signature' };
+ const body = asRecord(JSON.parse(envelope.rawBody));
+ const workspaceId = getCurrentWorkspaceId();
+ if (
+ !body ||
+ !workspaceId ||
+ extractTwentyWorkspaceIdFromRecallWebhook(body) !== workspaceId
+ ) {
+ return { status: 'skipped', reason: 'webhook workspace mismatch' };
+ }
+ try {
+ return await handleRecallWebhook({
+ client: new CoreApiClient(),
+ body,
+ });
+ } catch (error) {
+ throw buildStepError('Recall webhook processing', error);
+ }
+};
+
+export default defineLogicFunction({
+ universalIdentifier:
+ PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
+ name: 'process-recall-webhook',
+ description:
+ 'Updates the matching CallRecording lifecycle status from a verified Recall.ai webhook event.',
+ timeoutSeconds: 30,
+ handler: processRecallWebhookHandler,
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/extract-recall-media-urls.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/extract-recall-media-urls.test.ts
new file mode 100644
index 00000000000..1f254c3cc9d
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/extract-recall-media-urls.test.ts
@@ -0,0 +1,67 @@
+import { describe, expect, it } from 'vitest';
+
+import { extractRecallMediaUrls } from 'src/logic-functions/recall-api/extract-recall-media-urls.util';
+
+describe('extractRecallMediaUrls', () => {
+ it('reads both download urls flat from the v1.11 media shortcuts', () => {
+ expect(
+ extractRecallMediaUrls({
+ id: 'recall-recording-1',
+ media_shortcuts: {
+ video_mixed: {
+ download_url: 'https://media.example.com/video.mp4',
+ },
+ audio_mixed: {
+ download_url: 'https://media.example.com/audio.mp3',
+ },
+ },
+ }),
+ ).toEqual({
+ videoUrl: 'https://media.example.com/video.mp4',
+ audioUrl: 'https://media.example.com/audio.mp3',
+ });
+ });
+
+ it('falls back to the nested data.download_url shape', () => {
+ expect(
+ extractRecallMediaUrls({
+ id: 'recall-recording-1',
+ media_shortcuts: {
+ video_mixed: {
+ data: { download_url: 'https://media.example.com/video.mp4' },
+ },
+ audio_mixed: {
+ data: { download_url: 'https://media.example.com/audio.mp3' },
+ },
+ },
+ }),
+ ).toEqual({
+ videoUrl: 'https://media.example.com/video.mp4',
+ audioUrl: 'https://media.example.com/audio.mp3',
+ });
+ });
+
+ it('returns undefined urls when artifacts are absent', () => {
+ expect(
+ extractRecallMediaUrls({
+ id: 'recall-recording-1',
+ media_shortcuts: {
+ video_mixed: {},
+ },
+ }),
+ ).toEqual({ videoUrl: undefined, audioUrl: undefined });
+ });
+
+ it('tolerates malformed recording payloads', () => {
+ expect(extractRecallMediaUrls({})).toEqual({
+ videoUrl: undefined,
+ audioUrl: undefined,
+ });
+ expect(extractRecallMediaUrls({ media_shortcuts: 'not-a-record' })).toEqual(
+ {
+ videoUrl: undefined,
+ audioUrl: undefined,
+ },
+ );
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/get-owned-desktop-upload.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/get-owned-desktop-upload.test.ts
new file mode 100644
index 00000000000..046da1c401e
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/get-owned-desktop-upload.test.ts
@@ -0,0 +1,116 @@
+import { beforeEach, expect, it, vi } from 'vitest';
+
+import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/get-owned-desktop-upload.util';
+
+const { request, workspaceId } = vi.hoisted(() => ({
+ request: vi.fn(),
+ workspaceId: vi.fn(),
+}));
+vi.mock('src/logic-functions/data/get-current-workspace-id.util', () => ({
+ getCurrentWorkspaceId: workspaceId,
+}));
+vi.mock('src/logic-functions/recall-api/get-recall-api-config.util', () => ({
+ getRecallApiConfig: () => ({ success: true, config: {} }),
+}));
+vi.mock('src/logic-functions/recall-api/recall-bot-api-request.util', () => ({
+ recallBotApiRequest: request,
+}));
+
+const recording = {
+ id: 'recording-1',
+ companionSession: {
+ source: 'desktop',
+ media: 'audio',
+ sdkUploadId: 'upload-1',
+ userWorkspaceId: 'owner-1',
+ },
+};
+const upload = {
+ id: 'upload-1',
+ recording_id: 'provider-recording-1',
+ status: { code: 'complete' },
+ metadata: {
+ twentyWorkspaceId: 'workspace-1',
+ twentyCallRecordingId: 'recording-1',
+ twentyUserWorkspaceId: 'owner-1',
+ },
+};
+
+beforeEach(() => {
+ vi.resetAllMocks();
+ workspaceId.mockReturnValue('workspace-1');
+ request.mockResolvedValue({ ok: true, data: upload });
+});
+
+it('accepts only the upload bound by Recall to this workspace, record and owner', async () => {
+ expect(await getOwnedDesktopUpload(recording)).toEqual(upload);
+ expect(request).toHaveBeenCalledWith(
+ expect.objectContaining({
+ path: '/sdk_upload/upload-1/',
+ method: 'GET',
+ }),
+ );
+});
+
+it.each([
+ 'twentyWorkspaceId',
+ 'twentyCallRecordingId',
+ 'twentyUserWorkspaceId',
+])(
+ 'rejects a foreign %s even when the editable session points to its upload',
+ async (key) => {
+ request.mockResolvedValue({
+ ok: true,
+ data: {
+ ...upload,
+ metadata: { ...upload.metadata, [key]: 'foreign' },
+ },
+ });
+ expect(await getOwnedDesktopUpload(recording)).toBeUndefined();
+ },
+);
+
+it('rejects missing provider metadata and mismatched upload IDs', async () => {
+ request.mockResolvedValueOnce({
+ ok: true,
+ data: { ...upload, metadata: null },
+ });
+ expect(await getOwnedDesktopUpload(recording)).toBeUndefined();
+ request.mockResolvedValueOnce({
+ ok: true,
+ data: { ...upload, id: 'foreign' },
+ });
+ expect(await getOwnedDesktopUpload(recording)).toBeUndefined();
+});
+
+it('does not treat provider unavailability as a verified upload', async () => {
+ request.mockResolvedValue({ ok: false });
+ await expect(getOwnedDesktopUpload(recording)).rejects.toThrow(
+ 'Unable to verify',
+ );
+});
+
+it('requires authenticated workspace context and an owning desktop session', async () => {
+ expect(await getOwnedDesktopUpload({ id: recording.id })).toBeUndefined();
+ expect(request).not.toHaveBeenCalled();
+ workspaceId.mockReturnValue(undefined);
+ await expect(getOwnedDesktopUpload(recording)).rejects.toThrow(
+ 'not configured',
+ );
+ expect(request).not.toHaveBeenCalled();
+});
+
+it('encodes an editable upload ID as one path segment', async () => {
+ await getOwnedDesktopUpload({
+ ...recording,
+ companionSession: {
+ ...recording.companionSession,
+ sdkUploadId: '../other?token=x',
+ },
+ });
+ expect(request).toHaveBeenCalledWith(
+ expect.objectContaining({
+ path: '/sdk_upload/..%2Fother%3Ftoken%3Dx/',
+ }),
+ );
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/parse-recall-retry-after.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/parse-recall-retry-after.test.ts
new file mode 100644
index 00000000000..f1979dd2f56
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/parse-recall-retry-after.test.ts
@@ -0,0 +1,40 @@
+import { describe, expect, it } from 'vitest';
+
+import { parseRecallRetryAfterMs } from 'src/logic-functions/recall-api/parse-recall-retry-after.util';
+
+const NOW_MS = Date.parse('2026-01-01T13:00:00.000Z');
+
+describe('parseRecallRetryAfterMs', () => {
+ it('parses delay-seconds into milliseconds', () => {
+ expect(parseRecallRetryAfterMs('9', NOW_MS)).toBe(9_000);
+ });
+
+ it('caps delay-seconds at the retry-after ceiling', () => {
+ expect(parseRecallRetryAfterMs('120', NOW_MS)).toBe(60_000);
+ });
+
+ it('parses an HTTP-date into a delay from now', () => {
+ expect(
+ parseRecallRetryAfterMs('Thu, 01 Jan 2026 13:00:05 GMT', NOW_MS),
+ ).toBe(5_000);
+ });
+
+ it('clamps an HTTP-date in the past to zero', () => {
+ expect(
+ parseRecallRetryAfterMs('Thu, 01 Jan 2026 12:59:00 GMT', NOW_MS),
+ ).toBe(0);
+ });
+
+ it.each(['0x10', '1e2', '1.5', '-5', '+9', 'Infinity'])(
+ 'rejects the malformed delay-seconds form %s',
+ (retryAfterHeader) => {
+ expect(parseRecallRetryAfterMs(retryAfterHeader, NOW_MS)).toBeUndefined();
+ },
+ );
+
+ it('rejects values that are neither delay-seconds nor a date', () => {
+ expect(parseRecallRetryAfterMs('soon', NOW_MS)).toBeUndefined();
+ expect(parseRecallRetryAfterMs(' ', NOW_MS)).toBeUndefined();
+ expect(parseRecallRetryAfterMs(null, NOW_MS)).toBeUndefined();
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/verify-recall-webhook-signature.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/verify-recall-webhook-signature.test.ts
new file mode 100644
index 00000000000..45a420c9a4e
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/verify-recall-webhook-signature.test.ts
@@ -0,0 +1,141 @@
+import { createHmac } from 'crypto';
+
+import { describe, expect, it } from 'vitest';
+
+import { verifyRecallWebhookSignature } from 'src/logic-functions/recall-api/verify-recall-webhook-signature.util';
+
+const SECRET_BYTES = Buffer.from('test-secret-abc123');
+const SECRET = `whsec_${SECRET_BYTES.toString('base64')}`;
+const WEBHOOK_ID = 'msg_123';
+const WEBHOOK_TIMESTAMP = '1760000000';
+const NOW = new Date(Number(WEBHOOK_TIMESTAMP) * 1000);
+
+const sign = (body: string): string =>
+ createHmac('sha256', SECRET_BYTES)
+ .update(`${WEBHOOK_ID}.${WEBHOOK_TIMESTAMP}.${body}`)
+ .digest('base64');
+
+describe('verifyRecallWebhookSignature', () => {
+ it('accepts valid Recall webhook-* signature headers', () => {
+ const body = JSON.stringify({ event: 'recording.done' });
+
+ const result = verifyRecallWebhookSignature({
+ rawBody: body,
+ secret: SECRET,
+ now: NOW,
+ headers: {
+ 'webhook-id': WEBHOOK_ID,
+ 'webhook-timestamp': WEBHOOK_TIMESTAMP,
+ 'webhook-signature': `v1,${sign(body)}`,
+ },
+ });
+
+ expect(result).toEqual({ valid: true });
+ });
+
+ it('accepts valid svix-* signature headers', () => {
+ const body = JSON.stringify({ event: 'recording.done' });
+
+ const result = verifyRecallWebhookSignature({
+ rawBody: body,
+ secret: SECRET,
+ now: NOW,
+ headers: {
+ 'svix-id': WEBHOOK_ID,
+ 'svix-timestamp': WEBHOOK_TIMESTAMP,
+ 'svix-signature': `v1,${sign(body)}`,
+ },
+ });
+
+ expect(result).toEqual({ valid: true });
+ });
+
+ it('rejects deliveries whose timestamp is outside of the tolerance', () => {
+ const body = JSON.stringify({ event: 'recording.done' });
+
+ const result = verifyRecallWebhookSignature({
+ rawBody: body,
+ secret: SECRET,
+ now: new Date(Number(WEBHOOK_TIMESTAMP) * 1000 + 6 * 60 * 1000),
+ headers: {
+ 'webhook-id': WEBHOOK_ID,
+ 'webhook-timestamp': WEBHOOK_TIMESTAMP,
+ 'webhook-signature': `v1,${sign(body)}`,
+ },
+ });
+
+ expect(result).toEqual({
+ valid: false,
+ error: 'Webhook timestamp is outside of the allowed tolerance',
+ });
+ });
+
+ it('rejects non-numeric timestamps', () => {
+ const body = JSON.stringify({ event: 'recording.done' });
+
+ const result = verifyRecallWebhookSignature({
+ rawBody: body,
+ secret: SECRET,
+ now: NOW,
+ headers: {
+ 'webhook-id': WEBHOOK_ID,
+ 'webhook-timestamp': 'not-a-timestamp',
+ 'webhook-signature': `v1,${sign(body)}`,
+ },
+ });
+
+ expect(result).toEqual({
+ valid: false,
+ error: 'Invalid webhook timestamp',
+ });
+ });
+
+ it('allows a delayed durable retry only when its original signature still verifies', () => {
+ const body = JSON.stringify({ event: 'recording.done' });
+ const request = {
+ rawBody: body,
+ secret: SECRET,
+ checkTimestamp: false,
+ now: new Date(Number(WEBHOOK_TIMESTAMP) * 1000 + 24 * 60 * 60 * 1000),
+ headers: {
+ 'webhook-id': WEBHOOK_ID,
+ 'webhook-timestamp': WEBHOOK_TIMESTAMP,
+ 'webhook-signature': `v1,${sign(body)}`,
+ },
+ };
+ expect(verifyRecallWebhookSignature(request)).toEqual({ valid: true });
+ expect(
+ verifyRecallWebhookSignature({ ...request, rawBody: '{}' }).valid,
+ ).toBe(false);
+ });
+
+ it('rejects missing signature headers', () => {
+ const result = verifyRecallWebhookSignature({
+ rawBody: '{}',
+ secret: SECRET,
+ headers: {},
+ });
+
+ expect(result).toEqual({
+ valid: false,
+ error: 'Missing webhook signature headers',
+ });
+ });
+
+ it('rejects signatures computed from a different body', () => {
+ const body = JSON.stringify({ event: 'recording.done' });
+
+ const result = verifyRecallWebhookSignature({
+ rawBody: JSON.stringify({ event: 'recording.failed' }),
+ secret: SECRET,
+ now: NOW,
+ headers: {
+ 'webhook-id': WEBHOOK_ID,
+ 'webhook-timestamp': WEBHOOK_TIMESTAMP,
+ 'webhook-signature': `v1,${sign(body)}`,
+ },
+ });
+
+ expect(result.valid).toBe(false);
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/create-async-recall-transcript.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/create-async-recall-transcript.util.ts
new file mode 100644
index 00000000000..50144b12713
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/create-async-recall-transcript.util.ts
@@ -0,0 +1,48 @@
+import { isString } from '@sniptt/guards';
+
+import { type RecallBotOperationFailure } from 'src/logic-functions/types/recall-bot-operation-result.type';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
+import { recallBotApiRequest } from 'src/logic-functions/recall-api/recall-bot-api-request.util';
+import { getRecallAsyncTranscriptProvider } from 'src/logic-functions/utils/get-recall-async-transcript-provider.util';
+
+type CreateAsyncRecallTranscriptResult =
+ | { ok: true; transcriptId: string }
+ | RecallBotOperationFailure;
+
+export const createAsyncRecallTranscript = async ({
+ externalRecordingId,
+}: {
+ externalRecordingId: string;
+}): Promise<CreateAsyncRecallTranscriptResult> => {
+ const configResult = getRecallApiConfig();
+
+ if (!configResult.success) {
+ return { ok: false, status: null, errorMessage: configResult.error };
+ }
+
+ const result = await recallBotApiRequest<{ id?: unknown }>({
+ config: configResult.config,
+ path: `/recording/${externalRecordingId}/create_transcript/`,
+ method: 'POST',
+ body: {
+ provider: getRecallAsyncTranscriptProvider(),
+ diarization: { use_separate_streams_when_available: true },
+ },
+ maxAttempts: 1,
+ });
+
+ if (!result.ok) {
+ return result;
+ }
+
+ if (!isString(result.data?.id) || !result.data.id.trim()) {
+ return {
+ ok: false,
+ status: null,
+ errorMessage:
+ 'Recall API created a transcript but the response did not include a transcript id',
+ };
+ }
+
+ return { ok: true, transcriptId: result.data.id };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/extract-recall-media-urls.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/extract-recall-media-urls.util.ts
new file mode 100644
index 00000000000..4e0e89f3016
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/extract-recall-media-urls.util.ts
@@ -0,0 +1,30 @@
+import { asRecord } from '../utils/as-record.util';
+import { getRecordAtPath } from '../utils/get-record-at-path.util';
+import { getString } from '../utils/get-string.util';
+
+export type RecallMediaUrls = {
+ videoUrl: string | undefined;
+ audioUrl: string | undefined;
+};
+
+// Pre-signed URLs expire within hours; always re-extract from a fresh GET /recording.
+export const extractRecallMediaUrls = (
+ recording: Record<string, unknown>,
+): RecallMediaUrls => {
+ const mediaShortcuts = asRecord(recording.media_shortcuts);
+
+ return {
+ videoUrl: extractArtifactDownloadUrl(mediaShortcuts, 'video_mixed'),
+ audioUrl: extractArtifactDownloadUrl(mediaShortcuts, 'audio_mixed'),
+ };
+};
+
+// v1.11 exposes download_url flat on the artifact; older artifacts nest it under data.
+const extractArtifactDownloadUrl = (
+ mediaShortcuts: Record<string, unknown> | undefined,
+ artifactKey: string,
+): string | undefined =>
+ getString(getRecordAtPath(mediaShortcuts, [artifactKey, 'download_url'])) ??
+ getString(
+ getRecordAtPath(mediaShortcuts, [artifactKey, 'data', 'download_url']),
+ );
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/extract-twenty-workspace-id-from-recall-webhook.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/extract-twenty-workspace-id-from-recall-webhook.util.ts
new file mode 100644
index 00000000000..de17f979ea2
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/extract-twenty-workspace-id-from-recall-webhook.util.ts
@@ -0,0 +1,8 @@
+import { getRecallWebhookBotMetadata } from 'src/logic-functions/recall-api/get-recall-webhook-bot-metadata.util';
+import { type RecallWebhookBody } from 'src/logic-functions/recall-api/parse-recall-webhook-event.util';
+import { getString } from 'src/logic-functions/utils/get-string.util';
+
+export const extractTwentyWorkspaceIdFromRecallWebhook = (
+ body: RecallWebhookBody,
+): string | undefined =>
+ getString(getRecallWebhookBotMetadata(body)?.twentyWorkspaceId);
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/fetch-recall-list-pages.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/fetch-recall-list-pages.util.ts
new file mode 100644
index 00000000000..b88aa2770ec
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/fetch-recall-list-pages.util.ts
@@ -0,0 +1,81 @@
+import { isString, isUndefined } from '@sniptt/guards';
+
+import { type RecallBotOperationFailure } from 'src/logic-functions/types/recall-bot-operation-result.type';
+import { type RecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
+import { recallBotApiRequest } from 'src/logic-functions/recall-api/recall-bot-api-request.util';
+
+export type RecallListResponse = {
+ next?: unknown;
+ results?: unknown;
+};
+
+export const fetchRecallListPages = async <TItem>({
+ config,
+ initialPath,
+ maxPages,
+ shouldStartPageRequest,
+ extractPageItems,
+ malformedErrorMessage,
+}: {
+ config: RecallApiConfig;
+ initialPath: string;
+ maxPages: number;
+ shouldStartPageRequest: () => boolean;
+ extractPageItems: (
+ response: RecallListResponse | undefined,
+ ) => TItem[] | undefined;
+ malformedErrorMessage: string;
+}): Promise<
+ { ok: true; items: TItem[]; truncated: boolean } | RecallBotOperationFailure
+> => {
+ const items: TItem[] = [];
+ let path: string | undefined = initialPath;
+
+ for (
+ let pageIndex = 0;
+ !isUndefined(path) && pageIndex < maxPages;
+ pageIndex++
+ ) {
+ if (!shouldStartPageRequest()) {
+ break;
+ }
+
+ const result = await recallBotApiRequest<RecallListResponse>({
+ config,
+ path,
+ method: 'GET',
+ });
+
+ if (!result.ok) {
+ return result;
+ }
+
+ const pageItems = extractPageItems(result.data);
+
+ if (isUndefined(pageItems)) {
+ return {
+ ok: false,
+ status: result.status,
+ errorMessage: malformedErrorMessage,
+ };
+ }
+
+ items.push(...pageItems);
+ path = extractNextPath(result.data, config.baseUrl);
+ }
+
+ return { ok: true, items, truncated: !isUndefined(path) };
+};
+
+const extractNextPath = (
+ response: RecallListResponse | undefined,
+ baseUrl: string,
+): string | undefined => {
+ const next = response?.next;
+
+ if (!isString(next) || !next.startsWith(baseUrl)) {
+ return undefined;
+ }
+
+ return next.slice(baseUrl.length);
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-owned-desktop-upload.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-owned-desktop-upload.util.ts
new file mode 100644
index 00000000000..ab621eeb42d
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-owned-desktop-upload.util.ts
@@ -0,0 +1,47 @@
+import { getCurrentWorkspaceId } from 'src/logic-functions/data/get-current-workspace-id.util';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
+import { recallBotApiRequest } from 'src/logic-functions/recall-api/recall-bot-api-request.util';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { getString } from 'src/logic-functions/utils/get-string.util';
+
+type OwnedDesktopUpload = {
+ id: string;
+ recording_id: string | null;
+ upload_token?: string;
+ status: { code: string; sub_code?: string | null };
+ metadata: Record<string, unknown>;
+};
+
+export const getOwnedDesktopUpload = async (recording: {
+ id: string;
+ companionSession?: unknown;
+}): Promise<OwnedDesktopUpload | undefined> => {
+ const session = asRecord(recording.companionSession);
+ const uploadId = getString(session?.sdkUploadId);
+ const ownerId = getString(session?.userWorkspaceId);
+ if (!isDesktopAudioRecording(session) || !uploadId || !ownerId)
+ return undefined;
+ const workspaceId = getCurrentWorkspaceId();
+ const config = getRecallApiConfig();
+ if (!workspaceId || !config.success)
+ throw new Error('Recall ownership verification is not configured.');
+ const result = await recallBotApiRequest<OwnedDesktopUpload>({
+ config: config.config,
+ path: `/sdk_upload/${encodeURIComponent(uploadId)}/`,
+ method: 'GET',
+ maxAttempts: 1,
+ });
+ if (!result.ok)
+ throw new Error('Unable to verify the desktop upload with Recall.');
+ const metadata = asRecord(result.data.metadata);
+ // Provider metadata was written when the upload was created. Editable CRM fields are not proof of ownership.
+ if (
+ result.data.id !== uploadId ||
+ metadata?.twentyWorkspaceId !== workspaceId ||
+ metadata?.twentyCallRecordingId !== recording.id ||
+ metadata?.twentyUserWorkspaceId !== ownerId
+ )
+ return undefined;
+ return result.data;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-api-config.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-api-config.util.ts
new file mode 100644
index 00000000000..ce3161fd3d0
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-api-config.util.ts
@@ -0,0 +1,54 @@
+import { isUndefined } from '@sniptt/guards';
+
+import { DEFAULT_RECALL_REGION } from 'src/logic-functions/constants/default-recall-region';
+import { RECALL_API_KEY_ENV_VAR_NAME } from 'src/logic-functions/constants/recall-api-key-env-var-name';
+import { RECALL_REGION_ENV_VAR_NAME } from 'src/logic-functions/constants/recall-region-env-var-name';
+import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
+import { normalizeOptionalString } from 'src/logic-functions/utils/normalize-optional-string.util';
+
+export type RecallApiConfig = {
+ apiKey: string;
+ baseUrl: string;
+};
+
+export const getRecallApiConfig = ():
+ | {
+ success: true;
+ config: RecallApiConfig;
+ }
+ | {
+ success: false;
+ error: string;
+ } => {
+ const apiKey = normalizeOptionalString(
+ getApplicationVariableValue(RECALL_API_KEY_ENV_VAR_NAME)?.trim(),
+ );
+
+ if (isUndefined(apiKey)) {
+ return {
+ success: false,
+ error:
+ 'RECALL_API_KEY server variable is not set. A server admin must set it on the Desktop Recorder application registration before recording desktop calls.',
+ };
+ }
+
+ const region =
+ normalizeOptionalString(
+ getApplicationVariableValue(RECALL_REGION_ENV_VAR_NAME)?.trim(),
+ ) ?? DEFAULT_RECALL_REGION;
+
+ if (!/^[a-z]+-[a-z]+-\d+$/.test(region)) {
+ return {
+ success: false,
+ error: 'RECALL_REGION must be a Recall region slug.',
+ };
+ }
+
+ return {
+ success: true,
+ config: {
+ apiKey,
+ baseUrl: `https://${region}.recall.ai/api/v1`,
+ },
+ };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-recording.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-recording.util.ts
new file mode 100644
index 00000000000..27d86e801cc
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-recording.util.ts
@@ -0,0 +1,42 @@
+import { type RecallBotOperationFailure } from 'src/logic-functions/types/recall-bot-operation-result.type';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
+import { recallBotApiRequest } from 'src/logic-functions/recall-api/recall-bot-api-request.util';
+
+type GetRecallRecordingResult =
+ | { ok: true; recording: Record<string, unknown> }
+ | RecallBotOperationFailure;
+
+export const getRecallRecording = async ({
+ externalRecordingId,
+}: {
+ externalRecordingId: string;
+}): Promise<GetRecallRecordingResult> => {
+ const configResult = getRecallApiConfig();
+
+ if (!configResult.success) {
+ return { ok: false, status: null, errorMessage: configResult.error };
+ }
+
+ const result = await recallBotApiRequest<Record<string, unknown>>({
+ config: configResult.config,
+ path: `/recording/${externalRecordingId}/`,
+ method: 'GET',
+ });
+
+ if (!result.ok) {
+ return result;
+ }
+
+ if (
+ !result.data ||
+ typeof result.data !== 'object' ||
+ Array.isArray(result.data)
+ ) {
+ return {
+ ok: false,
+ status: result.status,
+ errorMessage: 'Recall API returned no recording payload',
+ };
+ }
+ return { ok: true, recording: result.data };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-webhook-bot-metadata.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-webhook-bot-metadata.util.ts
new file mode 100644
index 00000000000..8b35ea4f3c3
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-webhook-bot-metadata.util.ts
@@ -0,0 +1,19 @@
+import { type RecallWebhookBody } from 'src/logic-functions/recall-api/parse-recall-webhook-event.util';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { getRecordAtPath } from 'src/logic-functions/utils/get-record-at-path.util';
+
+// Recall delivers bot metadata under several body shapes per event family; this is the single reader of all of them.
+export const getRecallWebhookBotMetadata = (
+ body: RecallWebhookBody,
+): Record<string, unknown> | undefined => {
+ const data = asRecord(body.data);
+ const bot = asRecord(body.bot);
+
+ return (
+ asRecord(bot?.metadata) ??
+ asRecord(getRecordAtPath(data, ['bot', 'metadata'])) ??
+ asRecord(getRecordAtPath(data, ['sdk_upload', 'metadata'])) ??
+ asRecord(getRecordAtPath(data, ['recording', 'metadata'])) ??
+ asRecord(data?.metadata)
+ );
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/list-recall-transcripts.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/list-recall-transcripts.util.ts
new file mode 100644
index 00000000000..a613ea4f5e6
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/list-recall-transcripts.util.ts
@@ -0,0 +1,96 @@
+import { isArray, isUndefined } from '@sniptt/guards';
+
+import { type RecallBotOperationFailure } from 'src/logic-functions/types/recall-bot-operation-result.type';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { getString } from 'src/logic-functions/utils/get-string.util';
+import {
+ fetchRecallListPages,
+ type RecallListResponse,
+} from 'src/logic-functions/recall-api/fetch-recall-list-pages.util';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
+import { type RecallTranscriptSummary } from 'src/logic-functions/recall-api/recall-transcript-summary.type';
+
+type ListRecallTranscriptsResult =
+ | { ok: true; transcripts: RecallTranscriptSummary[] }
+ | RecallBotOperationFailure;
+
+const RECALL_TRANSCRIPT_LIST_MAX_PAGES = 10;
+
+export const listRecallTranscripts = async ({
+ externalRecordingId,
+}: {
+ externalRecordingId: string;
+}): Promise<ListRecallTranscriptsResult> => {
+ const configResult = getRecallApiConfig();
+
+ if (!configResult.success) {
+ return { ok: false, status: null, errorMessage: configResult.error };
+ }
+
+ const searchParams = new URLSearchParams({
+ recording_id: externalRecordingId,
+ });
+ const result = await fetchRecallListPages({
+ config: configResult.config,
+ initialPath: `/transcript/?${searchParams.toString()}`,
+ maxPages: RECALL_TRANSCRIPT_LIST_MAX_PAGES,
+ shouldStartPageRequest: () => true,
+ extractPageItems: extractRecallTranscriptSummaries,
+ malformedErrorMessage: 'Recall API returned malformed transcript list',
+ });
+
+ if (!result.ok) {
+ return result;
+ }
+
+ if (result.truncated) {
+ return {
+ ok: false,
+ status: null,
+ errorMessage: `Recall transcript list exceeded ${RECALL_TRANSCRIPT_LIST_MAX_PAGES} pages`,
+ };
+ }
+
+ return { ok: true, transcripts: result.items };
+};
+
+const extractRecallTranscriptSummaries = (
+ response: RecallListResponse | undefined,
+): RecallTranscriptSummary[] | undefined => {
+ if (!isArray(response?.results)) {
+ return undefined;
+ }
+
+ const transcripts: RecallTranscriptSummary[] = [];
+
+ for (const result of response.results) {
+ const transcript = extractRecallTranscriptSummary(result);
+
+ if (isUndefined(transcript)) {
+ return undefined;
+ }
+
+ transcripts.push(transcript);
+ }
+
+ return transcripts;
+};
+
+const extractRecallTranscriptSummary = (
+ transcript: unknown,
+): RecallTranscriptSummary | undefined => {
+ const transcriptRecord = asRecord(transcript);
+ const transcriptId = getString(transcriptRecord?.id);
+
+ if (isUndefined(transcriptRecord) || isUndefined(transcriptId)) {
+ return undefined;
+ }
+
+ const status = asRecord(transcriptRecord.status);
+
+ return {
+ id: transcriptId,
+ statusCode: getString(status?.code),
+ statusSubCode: getString(status?.sub_code),
+ };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/normalize-recall-timestamp.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/normalize-recall-timestamp.util.ts
new file mode 100644
index 00000000000..edeb6b07c18
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/normalize-recall-timestamp.util.ts
@@ -0,0 +1,12 @@
+// Twenty rejects Recall's microsecond precision; truncate to millisecond ISO.
+export const normalizeRecallTimestamp = (
+ value: string | undefined,
+): string | undefined => {
+ if (value === undefined) {
+ return undefined;
+ }
+
+ const parsed = new Date(value);
+
+ return Number.isNaN(parsed.getTime()) ? undefined : parsed.toISOString();
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/parse-recall-retry-after.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/parse-recall-retry-after.util.ts
new file mode 100644
index 00000000000..8a92822e70a
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/parse-recall-retry-after.util.ts
@@ -0,0 +1,36 @@
+import { RECALL_API_MAX_RETRY_AFTER_MS } from '../constants/recall-api-max-retry-after-ms';
+
+export const parseRecallRetryAfterMs = (
+ retryAfterHeader: string | null,
+ nowMs: number,
+): number | undefined => {
+ if (retryAfterHeader === null) {
+ return undefined;
+ }
+
+ const trimmedRetryAfterHeader = retryAfterHeader.trim();
+
+ if (trimmedRetryAfterHeader.length === 0) {
+ return undefined;
+ }
+
+ if (/^\d+$/.test(trimmedRetryAfterHeader)) {
+ return capRecallRetryAfterMs(Number(trimmedRetryAfterHeader) * 1000);
+ }
+
+ // Malformed numeric forms (1.5, 1e2, 0x10) would be misread as dates by Date.parse.
+ if (!Number.isNaN(Number(trimmedRetryAfterHeader))) {
+ return undefined;
+ }
+
+ const retryAfterDateMs = Date.parse(trimmedRetryAfterHeader);
+
+ if (Number.isNaN(retryAfterDateMs)) {
+ return undefined;
+ }
+
+ return capRecallRetryAfterMs(Math.max(0, retryAfterDateMs - nowMs));
+};
+
+const capRecallRetryAfterMs = (retryAfterMs: number): number =>
+ Math.min(retryAfterMs, RECALL_API_MAX_RETRY_AFTER_MS);
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/parse-recall-webhook-event.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/parse-recall-webhook-event.util.ts
new file mode 100644
index 00000000000..5d7c664d544
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/parse-recall-webhook-event.util.ts
@@ -0,0 +1,91 @@
+import { isUndefined } from '@sniptt/guards';
+
+import { getRecallWebhookBotMetadata } from 'src/logic-functions/recall-api/get-recall-webhook-bot-metadata.util';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { getRecordAtPath } from 'src/logic-functions/utils/get-record-at-path.util';
+import { getString } from 'src/logic-functions/utils/get-string.util';
+import { normalizeRecallTimestamp } from 'src/logic-functions/recall-api/normalize-recall-timestamp.util';
+
+export type RecallWebhookBody = {
+ event?: unknown;
+ type?: unknown;
+ data?: unknown;
+ bot?: unknown;
+};
+
+export type RecallWebhookEvent = {
+ event: string;
+ statusCode: string | undefined;
+ statusSubCode: string | undefined;
+ statusTimestamp: string | undefined;
+ externalBotId: string | undefined;
+ externalSdkUploadId?: string;
+ externalRecordingId: string | undefined;
+ callRecordingIdFromMetadata: string | undefined;
+ recordingStartedAt: string | undefined;
+ recordingEndedAt: string | undefined;
+ transcriptId: string | undefined;
+};
+
+// The only reader of raw webhook payloads; Recall delivers several body shapes per event family.
+export const parseRecallWebhookEvent = (
+ body: RecallWebhookBody,
+): RecallWebhookEvent | undefined => {
+ const event = getString(body.event) ?? getString(body.type);
+
+ if (isUndefined(event)) {
+ return undefined;
+ }
+
+ const data = asRecord(body.data);
+ const bot = asRecord(body.bot);
+
+ return {
+ event,
+ statusCode:
+ getString(getRecordAtPath(data, ['status', 'code'])) ??
+ getString(getRecordAtPath(data, ['data', 'code'])) ??
+ getString(getRecordAtPath(bot, ['status', 'code'])) ??
+ getStatusCodeFromEventName(event),
+ statusSubCode:
+ getString(getRecordAtPath(data, ['status', 'sub_code'])) ??
+ getString(getRecordAtPath(data, ['data', 'sub_code'])) ??
+ getString(getRecordAtPath(bot, ['status', 'sub_code'])),
+ statusTimestamp: normalizeRecallTimestamp(
+ getString(getRecordAtPath(data, ['status', 'created_at'])) ??
+ getString(getRecordAtPath(data, ['data', 'updated_at'])) ??
+ getString(getRecordAtPath(bot, ['status', 'created_at'])),
+ ),
+ externalBotId:
+ getString(data?.bot_id) ??
+ getString(getRecordAtPath(data, ['bot', 'id'])) ??
+ getString(getRecordAtPath(data, ['recording', 'bot_id'])) ??
+ getString(getRecordAtPath(data, ['recording', 'bot', 'id'])) ??
+ getString(bot?.id),
+ externalSdkUploadId: getString(getRecordAtPath(data, ['sdk_upload', 'id'])),
+ externalRecordingId:
+ getString(getRecordAtPath(data, ['status', 'recording_id'])) ??
+ getString(getRecordAtPath(data, ['recording', 'id'])) ??
+ getString(data?.recording_id),
+ callRecordingIdFromMetadata: getString(
+ getRecallWebhookBotMetadata(body)?.twentyCallRecordingId,
+ ),
+ recordingStartedAt: normalizeRecallTimestamp(
+ getString(getRecordAtPath(data, ['recording', 'started_at'])),
+ ),
+ recordingEndedAt: normalizeRecallTimestamp(
+ getString(getRecordAtPath(data, ['recording', 'completed_at'])),
+ ),
+ transcriptId: getString(getRecordAtPath(data, ['transcript', 'id'])),
+ };
+};
+
+const getStatusCodeFromEventName = (event: string): string | undefined => {
+ if (!event.startsWith('bot.')) {
+ return undefined;
+ }
+
+ const statusCode = event.slice('bot.'.length);
+
+ return statusCode === 'status_change' ? undefined : statusCode;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-api-retry-policy.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-api-retry-policy.util.ts
new file mode 100644
index 00000000000..d8bdc419e9a
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-api-retry-policy.util.ts
@@ -0,0 +1,38 @@
+import { RECALL_API_ADHOC_POOL_RETRY_DELAY_MS } from '../constants/recall-api-adhoc-pool-retry-delay-ms';
+import { RECALL_API_RETRY_DELAY_MS } from '../constants/recall-api-retry-delay-ms';
+
+const RECALL_STATUS_RATE_LIMITED = 429;
+const RECALL_STATUS_CONFLICT = 409;
+const RECALL_STATUS_ADHOC_POOL_EXHAUSTED = 507;
+
+const isRecallServerError = (status: number): boolean => status >= 500;
+
+export const isRetryableRecallApiStatus = (status: number): boolean =>
+ status === RECALL_STATUS_RATE_LIMITED ||
+ status === RECALL_STATUS_CONFLICT ||
+ isRecallServerError(status);
+
+export const resolveRecallApiRetryDelayMs = ({
+ retryAfterMs,
+ status,
+ attemptNumber,
+ random = Math.random,
+}: {
+ retryAfterMs: number | undefined;
+ status: number | null;
+ attemptNumber: number;
+ random?: () => number;
+}): number => {
+ if (retryAfterMs !== undefined) {
+ return retryAfterMs;
+ }
+
+ if (status === RECALL_STATUS_ADHOC_POOL_EXHAUSTED) {
+ return RECALL_API_ADHOC_POOL_RETRY_DELAY_MS;
+ }
+
+ // Equal jitter so retries sharing a failure instant do not re-collide.
+ const baseDelayMs = RECALL_API_RETRY_DELAY_MS * attemptNumber;
+
+ return Math.round((baseDelayMs * (1 + random())) / 2);
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-bot-api-request.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-bot-api-request.util.ts
new file mode 100644
index 00000000000..bd2cbf7e3cb
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-bot-api-request.util.ts
@@ -0,0 +1,191 @@
+import { RECALL_API_MAX_IN_PROCESS_RETRY_WAIT_MS } from '../constants/recall-api-max-in-process-retry-wait-ms';
+import { RECALL_API_MAX_ATTEMPTS } from '../constants/recall-api-max-attempts';
+type RecallApiConfig = { apiKey: string; baseUrl: string };
+import { parseRecallRetryAfterMs } from './parse-recall-retry-after.util';
+import {
+ isRetryableRecallApiStatus,
+ resolveRecallApiRetryDelayMs,
+} from './recall-api-retry-policy.util';
+
+type RecallBotApiRequestArgs = {
+ config: RecallApiConfig;
+ path: string;
+ method: 'GET' | 'POST' | 'PATCH' | 'DELETE';
+ body?: unknown;
+ idempotencyKey?: string;
+ allowNotFound?: boolean;
+ maxAttempts?: number;
+};
+
+type RecallBotApiRequestResult<TData> =
+ | {
+ ok: true;
+ status: number;
+ data: TData;
+ }
+ | {
+ ok: false;
+ status: number | null;
+ errorMessage: string;
+ };
+
+// Retried creates provide an idempotency key so ambiguous attempts cannot
+// create duplicates.
+export const recallBotApiRequest = async <TData>(
+ requestArgs: RecallBotApiRequestArgs,
+): Promise<RecallBotApiRequestResult<TData>> => {
+ const maxAttempts = requestArgs.maxAttempts ?? RECALL_API_MAX_ATTEMPTS;
+ let totalRetryWaitMs = 0;
+
+ for (let attemptNumber = 1; ; attemptNumber++) {
+ const { result, isRetryable, retryAfterMs } =
+ await performRecallBotApiRequestAttempt<TData>(requestArgs);
+
+ if (!isRetryable || attemptNumber >= maxAttempts) {
+ return result;
+ }
+
+ const retryDelayMs = resolveRecallApiRetryDelayMs({
+ retryAfterMs,
+ status: result.status,
+ attemptNumber,
+ });
+
+ // Sleeping past the invocation budget would hit the timeout kill; defer to the reconcilers.
+ if (
+ totalRetryWaitMs + retryDelayMs >=
+ RECALL_API_MAX_IN_PROCESS_RETRY_WAIT_MS
+ ) {
+ return result;
+ }
+
+ totalRetryWaitMs += retryDelayMs;
+ await sleep(retryDelayMs);
+ }
+};
+
+const performRecallBotApiRequestAttempt = async <TData>({
+ config,
+ path,
+ method,
+ body,
+ idempotencyKey,
+ allowNotFound = false,
+}: RecallBotApiRequestArgs): Promise<{
+ result: RecallBotApiRequestResult<TData>;
+ isRetryable: boolean;
+ retryAfterMs?: number;
+}> => {
+ let response: Response;
+
+ try {
+ response = await fetch(`${config.baseUrl}${path}`, {
+ method,
+ headers: {
+ Authorization: buildRecallApiAuthorizationHeader(config.apiKey),
+ ...(idempotencyKey === undefined
+ ? {}
+ : { 'Idempotency-Key': idempotencyKey }),
+ ...(body === undefined ? {} : { 'Content-Type': 'application/json' }),
+ },
+ ...(body === undefined ? {} : { body: JSON.stringify(body) }),
+ });
+ } catch (error) {
+ return {
+ isRetryable: true,
+ result: {
+ ok: false,
+ status: null,
+ errorMessage: `Recall API request failed: ${
+ error instanceof Error ? error.message : String(error)
+ }`,
+ },
+ };
+ }
+
+ if (allowNotFound && response.status === 404) {
+ return {
+ isRetryable: false,
+ result: {
+ ok: true,
+ status: response.status,
+ data: undefined as TData,
+ },
+ };
+ }
+
+ if (response.status === 204) {
+ return {
+ isRetryable: false,
+ result: {
+ ok: true,
+ status: response.status,
+ data: undefined as TData,
+ },
+ };
+ }
+
+ if (!response.ok) {
+ return {
+ isRetryable: isRetryableRecallApiStatus(response.status),
+ retryAfterMs: parseRecallRetryAfterMs(
+ response.headers?.get('retry-after') ?? null,
+ Date.now(),
+ ),
+ result: {
+ ok: false,
+ status: response.status,
+ errorMessage: await extractRecallApiErrorMessage(response),
+ },
+ };
+ }
+
+ try {
+ return {
+ isRetryable: false,
+ result: {
+ ok: true,
+ status: response.status,
+ data: (await response.json()) as TData,
+ },
+ };
+ } catch (error) {
+ return {
+ isRetryable: false,
+ result: {
+ ok: false,
+ status: response.status,
+ errorMessage: `Recall API returned a non-JSON response: ${
+ error instanceof Error ? error.message : String(error)
+ }`,
+ },
+ };
+ }
+};
+
+const sleep = (delayMs: number): Promise<void> =>
+ new Promise((resolve) => {
+ setTimeout(resolve, delayMs);
+ });
+
+const buildRecallApiAuthorizationHeader = (apiKey: string): string => {
+ const trimmedApiKey = apiKey.trim();
+
+ return trimmedApiKey.toLowerCase().startsWith('token ')
+ ? trimmedApiKey
+ : `Token ${trimmedApiKey}`;
+};
+
+const extractRecallApiErrorMessage = async (
+ response: Response,
+): Promise<string> => {
+ const fallback = `Recall API responded with HTTP ${response.status}`;
+
+ try {
+ const body = (await response.json()) as unknown;
+
+ return `${fallback}: ${JSON.stringify(body)}`;
+ } catch {
+ return fallback;
+ }
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-transcript-summary.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-transcript-summary.type.ts
new file mode 100644
index 00000000000..32f2683c897
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-transcript-summary.type.ts
@@ -0,0 +1,5 @@
+export type RecallTranscriptSummary = {
+ id: string;
+ statusCode: string | undefined;
+ statusSubCode: string | undefined;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/retrieve-recall-transcript.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/retrieve-recall-transcript.util.ts
new file mode 100644
index 00000000000..a096da7c62b
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/retrieve-recall-transcript.util.ts
@@ -0,0 +1,71 @@
+import { isUndefined } from '@sniptt/guards';
+
+import { type RecallBotOperationFailure } from 'src/logic-functions/types/recall-bot-operation-result.type';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
+import { getString } from 'src/logic-functions/utils/get-string.util';
+import { recallBotApiRequest } from 'src/logic-functions/recall-api/recall-bot-api-request.util';
+
+export type RecallTranscriptDetails = {
+ downloadUrl: string | undefined;
+ statusCode: string | undefined;
+ statusSubCode: string | undefined;
+};
+
+type RetrieveRecallTranscriptResult =
+ | { ok: true; transcript: RecallTranscriptDetails }
+ | RecallBotOperationFailure;
+
+export const retrieveRecallTranscript = async ({
+ transcriptId,
+}: {
+ transcriptId: string;
+}): Promise<RetrieveRecallTranscriptResult> => {
+ const configResult = getRecallApiConfig();
+
+ if (!configResult.success) {
+ return { ok: false, status: null, errorMessage: configResult.error };
+ }
+
+ const result = await recallBotApiRequest<Record<string, unknown>>({
+ config: configResult.config,
+ path: `/transcript/${transcriptId}/`,
+ method: 'GET',
+ });
+
+ if (!result.ok) {
+ return result;
+ }
+
+ const transcript = extractRecallTranscriptDetails(result.data);
+
+ if (isMalformedRecallTranscriptDetails(transcript)) {
+ return {
+ ok: false,
+ status: result.status,
+ errorMessage: 'Recall API returned malformed transcript details',
+ };
+ }
+
+ return { ok: true, transcript };
+};
+
+const extractRecallTranscriptDetails = (
+ response: Record<string, unknown> | undefined,
+): RecallTranscriptDetails => {
+ const data = asRecord(response?.data);
+ const status = asRecord(response?.status);
+
+ return {
+ downloadUrl: getString(data?.download_url),
+ statusCode: getString(status?.code),
+ statusSubCode: getString(status?.sub_code),
+ };
+};
+
+const isMalformedRecallTranscriptDetails = ({
+ downloadUrl,
+ statusCode,
+}: RecallTranscriptDetails): boolean =>
+ (isUndefined(downloadUrl) && isUndefined(statusCode)) ||
+ (isUndefined(downloadUrl) && statusCode === 'done');
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/verify-recall-webhook-signature.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/verify-recall-webhook-signature.util.ts
new file mode 100644
index 00000000000..2ff96cde799
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/verify-recall-webhook-signature.util.ts
@@ -0,0 +1,112 @@
+import { createHmac, timingSafeEqual } from 'crypto';
+
+import { isNonEmptyString } from '@sniptt/guards';
+
+const RECALL_WEBHOOK_SECRET_PREFIX = 'whsec_';
+const RECALL_WEBHOOK_TIMESTAMP_TOLERANCE_SECONDS = 5 * 60;
+
+export const verifyRecallWebhookSignature = ({
+ rawBody,
+ headers,
+ secret,
+ now = new Date(),
+ checkTimestamp = true,
+}: {
+ rawBody: string;
+ headers: Record<string, string | undefined>;
+ secret: string;
+ now?: Date;
+ checkTimestamp?: boolean;
+}): { valid: true } | { valid: false; error: string } => {
+ if (!secret.startsWith(RECALL_WEBHOOK_SECRET_PREFIX)) {
+ return {
+ valid: false,
+ error: 'Webhook secret must start with whsec_',
+ };
+ }
+
+ const webhookId = headers['webhook-id'] ?? headers['svix-id'];
+ const webhookTimestamp =
+ headers['webhook-timestamp'] ?? headers['svix-timestamp'];
+ const webhookSignature =
+ headers['webhook-signature'] ?? headers['svix-signature'];
+
+ if (
+ !isNonEmptyString(webhookId) ||
+ !isNonEmptyString(webhookTimestamp) ||
+ !isNonEmptyString(webhookSignature)
+ ) {
+ return {
+ valid: false,
+ error: 'Missing webhook signature headers',
+ };
+ }
+
+ const webhookTimestampSeconds = Number(webhookTimestamp);
+
+ if (!Number.isInteger(webhookTimestampSeconds)) {
+ return {
+ valid: false,
+ error: 'Invalid webhook timestamp',
+ };
+ }
+
+ const nowSeconds = Math.floor(now.getTime() / 1000);
+
+ if (
+ checkTimestamp &&
+ Math.abs(nowSeconds - webhookTimestampSeconds) >
+ RECALL_WEBHOOK_TIMESTAMP_TOLERANCE_SECONDS
+ ) {
+ return {
+ valid: false,
+ error: 'Webhook timestamp is outside of the allowed tolerance',
+ };
+ }
+
+ const secretBytes = Buffer.from(
+ secret.slice(RECALL_WEBHOOK_SECRET_PREFIX.length),
+ 'base64',
+ );
+ const expectedSignature = createHmac('sha256', secretBytes)
+ .update(`${webhookId}.${webhookTimestamp}.${rawBody}`)
+ .digest('base64');
+ const providedSignatures = webhookSignature
+ .split(' ')
+ .map((signaturePart) => signaturePart.trim())
+ .filter(isNonEmptyString)
+ .flatMap((signaturePart) => {
+ if (signaturePart.startsWith('v1,') || signaturePart.startsWith('v1=')) {
+ return [signaturePart.slice(3).trim()];
+ }
+
+ return [];
+ })
+ .filter(isNonEmptyString);
+
+ if (providedSignatures.length === 0) {
+ return {
+ valid: false,
+ error: 'Missing v1 signature',
+ };
+ }
+
+ const expectedSignatureBuffer = Buffer.from(expectedSignature, 'base64');
+
+ for (const providedSignature of providedSignatures) {
+ const providedSignatureBuffer = Buffer.from(providedSignature, 'base64');
+
+ if (providedSignatureBuffer.length !== expectedSignatureBuffer.length) {
+ continue;
+ }
+
+ if (timingSafeEqual(providedSignatureBuffer, expectedSignatureBuffer)) {
+ return { valid: true };
+ }
+ }
+
+ return {
+ valid: false,
+ error: 'Signature verification failed',
+ };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-webhook.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-webhook.ts
new file mode 100644
index 00000000000..2466c5b671d
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-webhook.ts
@@ -0,0 +1,94 @@
+import { isNull, isUndefined } from '@sniptt/guards';
+import { defineLogicFunction, type RoutePayload } from 'twenty-sdk/define';
+
+import {
+ PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
+ RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
+} from 'src/constants/universal-identifiers';
+import { RECALL_WEBHOOK_SECRET_ENV_VAR_NAME } from 'src/logic-functions/constants/recall-webhook-secret-env-var-name';
+import { extractTwentyWorkspaceIdFromRecallWebhook } from 'src/logic-functions/recall-api/extract-twenty-workspace-id-from-recall-webhook.util';
+import { type RecallWebhookBody } from 'src/logic-functions/recall-api/parse-recall-webhook-event.util';
+import { verifyRecallWebhookSignature } from 'src/logic-functions/recall-api/verify-recall-webhook-signature.util';
+import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
+import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+
+type RecallWebhookResolverResult = {
+ workspaceId: string;
+ targetLogicFunctionUniversalIdentifier: string;
+ payload: { rawBody: string; headers: Record<string, string | undefined> };
+};
+
+// A thrown error becomes a non-2xx, which makes Svix retry; a returned result dispatches to the target.
+export const recallWebhookRouteHandler = (
+ routePayload: RoutePayload<RecallWebhookBody>,
+): RecallWebhookResolverResult => {
+ const webhookSecret = getApplicationVariableValue(
+ RECALL_WEBHOOK_SECRET_ENV_VAR_NAME,
+ );
+
+ if (!isNonEmptyString(webhookSecret)) {
+ throw new Error(
+ 'RECALL_WEBHOOK_SECRET server variable is not set. A server admin must copy it from the Recall webhook endpoint settings and set it on the Desktop Recorder application registration.',
+ );
+ }
+
+ const { rawBody } = routePayload;
+
+ if (isUndefined(rawBody)) {
+ throw new Error(
+ 'Raw request body was not forwarded by the server; cannot verify the webhook signature',
+ );
+ }
+
+ const signatureCheck = verifyRecallWebhookSignature({
+ rawBody,
+ headers: routePayload.headers,
+ secret: webhookSecret,
+ });
+
+ if (!signatureCheck.valid) {
+ throw new Error(`Invalid webhook signature: ${signatureCheck.error}`);
+ }
+
+ // Direct function execution can supply a parsed body different from the signed bytes.
+ const body = asRecord(JSON.parse(rawBody));
+
+ if (isUndefined(body) || isNull(body)) {
+ throw new Error('Webhook payload was empty');
+ }
+
+ const workspaceId = extractTwentyWorkspaceIdFromRecallWebhook(body);
+
+ if (!isNonEmptyString(workspaceId)) {
+ throw new Error(
+ 'Webhook payload is missing the Twenty workspace id in the Recall bot metadata',
+ );
+ }
+
+ return {
+ workspaceId,
+ targetLogicFunctionUniversalIdentifier:
+ PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
+ payload: { rawBody, headers: routePayload.headers },
+ };
+};
+
+export default defineLogicFunction({
+ universalIdentifier: RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
+ name: 'recall-webhook',
+ description:
+ 'Verifies Recall.ai webhook signatures and resolves the target workspace for the matching CallRecording update.',
+ timeoutSeconds: 30,
+ handler: recallWebhookRouteHandler,
+ serverRouteTriggerSettings: {
+ forwardedRequestHeaders: [
+ 'webhook-id',
+ 'webhook-timestamp',
+ 'webhook-signature',
+ 'svix-id',
+ 'svix-timestamp',
+ 'svix-signature',
+ ],
+ },
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/reconcile-desktop-recordings.ts b/packages/twenty-apps/public/companion/src/logic-functions/reconcile-desktop-recordings.ts
new file mode 100644
index 00000000000..395bd7ec370
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/reconcile-desktop-recordings.ts
@@ -0,0 +1,51 @@
+import { CoreApiClient } from 'twenty-client-sdk/core';
+import { createHash } from 'node:crypto';
+import {
+ enqueueJobs,
+ type LogicFunctionExecutionContext,
+} from 'twenty-sdk/logic-function';
+import { defineLogicFunction } from 'twenty-sdk/define';
+import { recoverDesktopRecordings } from 'src/logic-functions/flows/recover-desktop-recordings.util';
+import { recoverRecordingSummaries } from 'src/logic-functions/flows/recover-recording-summaries.util';
+
+const RECONCILE_DESKTOP_RECORDINGS_IDENTIFIER =
+ '2b1f250a-1409-4f7e-8e9b-66ad67e6b38c';
+
+export const reconcileDesktopRecordingsHandler = async (
+ payload: { recover?: boolean },
+ { workspaceId }: LogicFunctionExecutionContext,
+) => {
+ if (!payload?.recover) {
+ return enqueueJobs({
+ logicFunctionUniversalIdentifier: RECONCILE_DESKTOP_RECORDINGS_IDENTIFIER,
+ jobs: [
+ {
+ jobId: `companion-recovery-${Math.floor(Date.now() / 300_000)}`,
+ payload: { recover: true },
+ },
+ ],
+ delayMs:
+ createHash('sha256').update(workspaceId).digest().readUInt32BE(0) %
+ 300_000,
+ });
+ }
+ const client = new CoreApiClient();
+ const now = new Date();
+ const [media, summaries] = await Promise.allSettled([
+ recoverDesktopRecordings(client, now),
+ recoverRecordingSummaries(client, now),
+ ]);
+ if (media.status === 'rejected') throw media.reason;
+ if (summaries.status === 'rejected') throw summaries.reason;
+ return media.value;
+};
+
+export default defineLogicFunction({
+ universalIdentifier: RECONCILE_DESKTOP_RECORDINGS_IDENTIFIER,
+ name: 'reconcile-desktop-recordings',
+ description:
+ 'Recovers desktop uploads and artifact imports after missed Recall webhooks.',
+ timeoutSeconds: 250,
+ handler: reconcileDesktopRecordingsHandler,
+ cronTriggerSettings: { pattern: '*/5 * * * *' },
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/summarize-call-recording.ts b/packages/twenty-apps/public/companion/src/logic-functions/summarize-call-recording.ts
new file mode 100644
index 00000000000..2939d7bbff6
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/summarize-call-recording.ts
@@ -0,0 +1,73 @@
+import { CoreApiClient } from 'twenty-client-sdk/core';
+import { enqueueJobs } from 'twenty-sdk/logic-function';
+import {
+ defineLogicFunction,
+ type DatabaseEventPayload,
+ type ObjectRecordBaseEvent,
+} from 'twenty-sdk/define';
+
+import { SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { generateCallRecordingSummary } from 'src/logic-functions/flows/generate-call-recording-summary.util';
+import { buildStepError } from 'src/logic-functions/utils/build-step-failure.util';
+
+const CALL_RECORDING_OBJECT_NAME = 'callRecording';
+const TRANSCRIPT_FIELD_NAME = 'transcript';
+
+type CallRecordingForDatabaseEvent = {
+ id: string;
+};
+
+type CallRecordingDatabaseEvent = DatabaseEventPayload<
+ ObjectRecordBaseEvent<CallRecordingForDatabaseEvent>
+>;
+
+export const summarizeCallRecordingHandler = async (
+ event: CallRecordingDatabaseEvent | { callRecordingId: string },
+): Promise<object> => {
+ if ('callRecordingId' in event) {
+ try {
+ const result = await generateCallRecordingSummary(new CoreApiClient(), {
+ callRecordingId: event.callRecordingId,
+ });
+ return { callRecordingId: event.callRecordingId, ...result };
+ } catch (error) {
+ throw buildStepError('call recording summarization', error);
+ }
+ }
+ const [objectName, action] = event.name.split('.');
+
+ if (objectName !== CALL_RECORDING_OBJECT_NAME || action !== 'updated') {
+ return { skipped: true, reason: 'not a call recording update' };
+ }
+
+ const updatedFields = event.properties.updatedFields ?? [];
+
+ if (!updatedFields.includes(TRANSCRIPT_FIELD_NAME)) {
+ return { skipped: true, reason: 'transcript unchanged' };
+ }
+
+ await enqueueJobs({
+ logicFunctionUniversalIdentifier:
+ SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
+ jobs: [
+ {
+ jobId: `companion-summary-${event.recordId}`,
+ payload: { callRecordingId: event.recordId },
+ },
+ ],
+ });
+ return { callRecordingId: event.recordId, enqueued: true };
+};
+
+export default defineLogicFunction({
+ universalIdentifier:
+ SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
+ name: 'summarize-call-recording',
+ description:
+ 'Generates an AI recap of a recording transcript and stores it on the Call Recording summary field when the transcript is filled.',
+ timeoutSeconds: 60 * 4,
+ handler: summarizeCallRecordingHandler,
+ databaseEventTriggerSettings: {
+ eventName: `${CALL_RECORDING_OBJECT_NAME}.updated`,
+ },
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/calendar-event-record.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/calendar-event-record.type.ts
new file mode 100644
index 00000000000..1a4614958c5
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/calendar-event-record.type.ts
@@ -0,0 +1,5 @@
+import { type CompanionPolicyCalendarEventInput } from 'src/logic-functions/types/companion-policy-calendar-event-input.type';
+
+export type CalendarEventRecord = CompanionPolicyCalendarEventInput & {
+ title: string | undefined;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-artifacts-import-request.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-artifacts-import-request.type.ts
new file mode 100644
index 00000000000..2c0669135a3
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-artifacts-import-request.type.ts
@@ -0,0 +1,6 @@
+// Only the local record id crosses the continuation boundary; provider ids are
+// re-resolved from the recording's own persisted state so they cannot be forged.
+export type CallRecordingArtifactsImportRequest = {
+ callRecordingId: string;
+ requestedAt: string;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-media-file.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-media-file.type.ts
new file mode 100644
index 00000000000..56de4133ed6
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-media-file.type.ts
@@ -0,0 +1 @@
+export type CallRecordingMediaFile = { fileId: string; label: string };
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-record.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-record.type.ts
new file mode 100644
index 00000000000..c80585f5483
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-record.type.ts
@@ -0,0 +1,18 @@
+import { type CallRecordingRequestStatus } from 'src/logic-functions/constants/call-recording-request-status';
+
+// Domain read shape: absence is always undefined; null lives only on wire types.
+export type CallRecordingRecord = {
+ id: string;
+ title?: string;
+ status?: string;
+ recordingRequestStatus?: CallRecordingRequestStatus;
+ createdAt?: string;
+ updatedAt?: string;
+ startedAt?: string;
+ endedAt?: string;
+ calendarEventId?: string;
+ externalBotId?: string;
+ companionSession?: unknown;
+ externalRecordingId?: string;
+ companionFailureReason?: string;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-summary.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-summary.type.ts
new file mode 100644
index 00000000000..47c5c4e142e
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-summary.type.ts
@@ -0,0 +1,4 @@
+export type CallRecordingSummary = {
+ blocknote: string | null;
+ markdown: string | null;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-update-fields.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-update-fields.type.ts
new file mode 100644
index 00000000000..ac2c0a4633d
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-update-fields.type.ts
@@ -0,0 +1,26 @@
+import { type DesktopRecordingSession } from 'src/logic-functions/types/desktop-recording-session.type';
+import { type CallRecordingRequestStatus } from 'src/logic-functions/constants/call-recording-request-status';
+import { type CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { type CallRecordingMediaFile } from 'src/logic-functions/types/call-recording-media-file.type';
+import { type CallRecordingSummary } from 'src/logic-functions/types/call-recording-summary.type';
+
+export type CallRecordingUpdateFields = Partial<{
+ // null clears a previously synced title when the calendar title disappears.
+ title: string | null;
+ companionSession: DesktopRecordingSession;
+ status: CallRecordingStatus;
+ recordingRequestStatus: CallRecordingRequestStatus;
+ startedAt: string;
+ endedAt: string;
+ calendarEventId: string;
+ // null clears stale app-owned state on cancel/eject or reschedule.
+ externalBotId: string | null;
+ externalRecordingId: string;
+ companionFailureReason: string | null;
+ transcript: Record<string, unknown> | null;
+ audio: CallRecordingMediaFile[];
+ video: CallRecordingMediaFile[];
+ summary: CallRecordingSummary;
+ // null releases the concurrent-import lease.
+ companionImportClaimedAt: string | null;
+}>;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/companion-policy-calendar-event-input.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/companion-policy-calendar-event-input.type.ts
new file mode 100644
index 00000000000..4507904043b
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/companion-policy-calendar-event-input.type.ts
@@ -0,0 +1,9 @@
+// Domain read shape: wire composites are flattened and absence is undefined.
+export type CompanionPolicyCalendarEventInput = {
+ id: string;
+ isCanceled: boolean;
+ startsAt: string | undefined;
+ endsAt: string | undefined;
+ iCalUid: string | undefined;
+ conferenceLinkUrl: string | undefined;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/desktop-recording-session.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/desktop-recording-session.type.ts
new file mode 100644
index 00000000000..c21474449c2
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/desktop-recording-session.type.ts
@@ -0,0 +1,7 @@
+export type DesktopRecordingSession = {
+ source: 'desktop';
+ media: 'audio';
+ userWorkspaceId: string;
+ platform: string;
+ sdkUploadId?: string;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/files-field-value.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/files-field-value.type.ts
new file mode 100644
index 00000000000..e75a1bddd7c
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/files-field-value.type.ts
@@ -0,0 +1 @@
+export type FilesFieldValue = { fileId: string }[];
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/recall-async-transcript-provider.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/recall-async-transcript-provider.type.ts
new file mode 100644
index 00000000000..1d98e6661b2
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/recall-async-transcript-provider.type.ts
@@ -0,0 +1,4 @@
+import { type RECALL_ASYNC_TRANSCRIPT_PROVIDERS } from 'src/logic-functions/constants/recall-async-transcript-providers';
+
+export type RecallAsyncTranscriptProvider =
+ keyof typeof RECALL_ASYNC_TRANSCRIPT_PROVIDERS;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/recall-bot-operation-result.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/recall-bot-operation-result.type.ts
new file mode 100644
index 00000000000..3279288413f
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/recall-bot-operation-result.type.ts
@@ -0,0 +1,19 @@
+export type RecallBotOperationFailure = {
+ ok: false;
+ // null = no HTTP response (network failure), distinct from any status code.
+ status: number | null;
+ errorMessage: string;
+};
+
+export type RecallBotScheduleResult =
+ | {
+ ok: true;
+ externalBotId: string;
+ }
+ | RecallBotOperationFailure;
+
+export type RecallBotRemovalResult =
+ | {
+ ok: true;
+ }
+ | RecallBotOperationFailure;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/transcript-marker.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/transcript-marker.type.ts
new file mode 100644
index 00000000000..205ce51d1c3
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/transcript-marker.type.ts
@@ -0,0 +1,6 @@
+export type TranscriptMarker = {
+ recallTranscriptId: string | null;
+ status: 'PENDING' | 'FAILED';
+ requestedAt?: string;
+ subCode?: string | null;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/format-seconds-as-clock-timestamp.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/format-seconds-as-clock-timestamp.test.ts
new file mode 100644
index 00000000000..47510ea9258
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/format-seconds-as-clock-timestamp.test.ts
@@ -0,0 +1,31 @@
+import { describe, expect, it } from 'vitest';
+
+import { formatSecondsAsClockTimestamp } from 'src/logic-functions/utils/format-seconds-as-clock-timestamp.util';
+
+describe('formatSecondsAsClockTimestamp', () => {
+ it('formats sub-hour durations as minutes and padded seconds', () => {
+ expect(formatSecondsAsClockTimestamp(0)).toBe('0:00');
+ expect(formatSecondsAsClockTimestamp(5)).toBe('0:05');
+ expect(formatSecondsAsClockTimestamp(65)).toBe('1:05');
+ expect(formatSecondsAsClockTimestamp(3599)).toBe('59:59');
+ });
+
+ it('adds an hour part with padded minutes past one hour', () => {
+ expect(formatSecondsAsClockTimestamp(3600)).toBe('1:00:00');
+ expect(formatSecondsAsClockTimestamp(3725)).toBe('1:02:05');
+ expect(formatSecondsAsClockTimestamp(7322)).toBe('2:02:02');
+ });
+
+ it('floors fractional seconds', () => {
+ expect(formatSecondsAsClockTimestamp(1.9)).toBe('0:01');
+ expect(formatSecondsAsClockTimestamp(59.999)).toBe('0:59');
+ });
+
+ it('clamps negative and non-finite input to zero', () => {
+ expect(formatSecondsAsClockTimestamp(-12)).toBe('0:00');
+ expect(formatSecondsAsClockTimestamp(Number.NaN)).toBe('0:00');
+ expect(formatSecondsAsClockTimestamp(Number.POSITIVE_INFINITY)).toBe(
+ '0:00',
+ );
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-batches.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-batches.test.ts
new file mode 100644
index 00000000000..2e06c615b87
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-batches.test.ts
@@ -0,0 +1,21 @@
+import { describe, expect, it } from 'vitest';
+
+import { getBatches } from 'src/logic-functions/utils/get-batches.util';
+
+describe('getBatches', () => {
+ it('returns no batches for an empty list', () => {
+ expect(getBatches([], 3)).toEqual([]);
+ });
+
+ it('splits items into batches of the given size with a shorter tail', () => {
+ expect(getBatches(['a', 'b', 'c', 'd', 'e'], 2)).toEqual([
+ ['a', 'b'],
+ ['c', 'd'],
+ ['e'],
+ ]);
+ });
+
+ it('keeps a list at or under the batch size as a single batch', () => {
+ expect(getBatches(['a', 'b'], 2)).toEqual([['a', 'b']]);
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-boolean-application-variable-value.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-boolean-application-variable-value.test.ts
new file mode 100644
index 00000000000..8125dabb71f
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-boolean-application-variable-value.test.ts
@@ -0,0 +1,71 @@
+import { afterEach, beforeEach, describe, expect, it } from 'vitest';
+
+import { getBooleanApplicationVariableValue } from 'src/logic-functions/utils/get-boolean-application-variable-value.util';
+
+const BOOLEAN_APPLICATION_VARIABLE_NAME = 'TEST_BOOLEAN_APPLICATION_VARIABLE';
+
+describe('getBooleanApplicationVariableValue', () => {
+ beforeEach(() => {
+ delete process.env[BOOLEAN_APPLICATION_VARIABLE_NAME];
+ });
+
+ afterEach(() => {
+ delete process.env[BOOLEAN_APPLICATION_VARIABLE_NAME];
+ });
+
+ it('returns the default when unset', () => {
+ expect(
+ getBooleanApplicationVariableValue({
+ applicationVariableName: BOOLEAN_APPLICATION_VARIABLE_NAME,
+ defaultValue: true,
+ }),
+ ).toBe(true);
+ });
+
+ it.each(['', ' '])('returns the default for an empty value', (value) => {
+ process.env[BOOLEAN_APPLICATION_VARIABLE_NAME] = value;
+
+ expect(
+ getBooleanApplicationVariableValue({
+ applicationVariableName: BOOLEAN_APPLICATION_VARIABLE_NAME,
+ defaultValue: false,
+ }),
+ ).toBe(false);
+ });
+
+ it.each([' TrUe ', '1', 'yes', 'on'])('returns true for %s', (value) => {
+ process.env[BOOLEAN_APPLICATION_VARIABLE_NAME] = value;
+
+ expect(
+ getBooleanApplicationVariableValue({
+ applicationVariableName: BOOLEAN_APPLICATION_VARIABLE_NAME,
+ defaultValue: false,
+ }),
+ ).toBe(true);
+ });
+
+ it.each([' FaLsE ', '0', 'no', 'off'])('returns false for %s', (value) => {
+ process.env[BOOLEAN_APPLICATION_VARIABLE_NAME] = value;
+
+ expect(
+ getBooleanApplicationVariableValue({
+ applicationVariableName: BOOLEAN_APPLICATION_VARIABLE_NAME,
+ defaultValue: true,
+ }),
+ ).toBe(false);
+ });
+
+ it.each([true, false])(
+ 'returns the %s default for an unrecognized value',
+ (defaultValue) => {
+ process.env[BOOLEAN_APPLICATION_VARIABLE_NAME] = 'maybe';
+
+ expect(
+ getBooleanApplicationVariableValue({
+ applicationVariableName: BOOLEAN_APPLICATION_VARIABLE_NAME,
+ defaultValue,
+ }),
+ ).toBe(defaultValue);
+ },
+ );
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-companion-additional-summary-prompt.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-companion-additional-summary-prompt.test.ts
new file mode 100644
index 00000000000..15fb4cb1503
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-companion-additional-summary-prompt.test.ts
@@ -0,0 +1,52 @@
+import { afterEach, beforeEach, describe, expect, it } from 'vitest';
+
+import { COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME } from 'src/logic-functions/constants/companion-additional-summary-prompt-env-var-name';
+import { getCompanionAdditionalSummaryPrompt } from 'src/logic-functions/utils/get-companion-additional-summary-prompt.util';
+
+describe('getCompanionAdditionalSummaryPrompt', () => {
+ beforeEach(() => {
+ delete process.env[COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME];
+ });
+
+ afterEach(() => {
+ delete process.env[COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME];
+ });
+
+ it('returns undefined when unset', () => {
+ expect(getCompanionAdditionalSummaryPrompt()).toBeUndefined();
+ });
+
+ it('returns the markdown from a rich text value', () => {
+ process.env[COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME] =
+ JSON.stringify({
+ blocknote: '[{"type":"paragraph"}]',
+ markdown: ' Write concise **sales** notes. ',
+ });
+
+ expect(getCompanionAdditionalSummaryPrompt()).toBe(
+ 'Write concise **sales** notes.',
+ );
+ });
+
+ it('returns undefined when the rich text markdown is empty', () => {
+ process.env[COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME] =
+ JSON.stringify({ blocknote: null, markdown: null });
+
+ expect(getCompanionAdditionalSummaryPrompt()).toBeUndefined();
+ });
+
+ it('falls back to raw plaintext stored before the variable became rich text', () => {
+ process.env[COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME] =
+ ' Write concise sales notes. ';
+
+ expect(getCompanionAdditionalSummaryPrompt()).toBe(
+ 'Write concise sales notes.',
+ );
+ });
+
+ it('returns undefined for whitespace-only values', () => {
+ process.env[COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME] = ' ';
+
+ expect(getCompanionAdditionalSummaryPrompt()).toBeUndefined();
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-recall-async-transcript-provider.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-recall-async-transcript-provider.test.ts
new file mode 100644
index 00000000000..43f06c5d350
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-recall-async-transcript-provider.test.ts
@@ -0,0 +1,28 @@
+import { afterEach, beforeEach, describe, expect, it } from 'vitest';
+
+import { COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME } from 'src/logic-functions/constants/companion-transcript-provider-env-var-name';
+import { getRecallAsyncTranscriptProvider } from 'src/logic-functions/utils/get-recall-async-transcript-provider.util';
+
+describe('getRecallAsyncTranscriptProvider', () => {
+ beforeEach(() => {
+ delete process.env[COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME];
+ });
+
+ afterEach(() => {
+ delete process.env[COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME];
+ });
+
+ it('defaults to Recall.ai transcription when unset', () => {
+ expect(getRecallAsyncTranscriptProvider()).toEqual({
+ recallai_async: { language_code: 'auto' },
+ });
+ });
+
+ it('falls back to the default for an unsupported provider', () => {
+ process.env[COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME] = 'deepgram_async';
+
+ expect(getRecallAsyncTranscriptProvider()).toEqual({
+ recallai_async: { language_code: 'auto' },
+ });
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/is-call-recording-summary-enabled.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/is-call-recording-summary-enabled.test.ts
new file mode 100644
index 00000000000..716ff404fb6
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/is-call-recording-summary-enabled.test.ts
@@ -0,0 +1,39 @@
+import { afterEach, beforeEach, describe, expect, it } from 'vitest';
+
+import { COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME } from 'src/logic-functions/constants/companion-summary-enabled-env-var-name';
+import { isCallRecordingSummaryEnabled } from 'src/logic-functions/utils/is-call-recording-summary-enabled.util';
+
+describe('isCallRecordingSummaryEnabled', () => {
+ beforeEach(() => {
+ delete process.env[COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME];
+ });
+
+ afterEach(() => {
+ delete process.env[COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME];
+ });
+
+ it('defaults to enabled when unset', () => {
+ expect(isCallRecordingSummaryEnabled()).toBe(true);
+ });
+
+ it.each(['false', '0', 'no', 'off', ' False '])(
+ 'is disabled for %s',
+ (value) => {
+ process.env[COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME] = value;
+
+ expect(isCallRecordingSummaryEnabled()).toBe(false);
+ },
+ );
+
+ it.each(['true', '1', 'yes', 'on'])('is enabled for %s', (value) => {
+ process.env[COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME] = value;
+
+ expect(isCallRecordingSummaryEnabled()).toBe(true);
+ });
+
+ it('falls back to the default for unrecognized values', () => {
+ process.env[COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME] = 'maybe';
+
+ expect(isCallRecordingSummaryEnabled()).toBe(true);
+ });
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/as-record.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/as-record.util.ts
new file mode 100644
index 00000000000..e14e10337eb
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/as-record.util.ts
@@ -0,0 +1,6 @@
+export const asRecord = (
+ value: unknown,
+): Record<string, unknown> | undefined =>
+ typeof value === 'object' && value !== null && !Array.isArray(value)
+ ? (value as Record<string, unknown>)
+ : undefined;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/build-step-failure.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/build-step-failure.util.ts
new file mode 100644
index 00000000000..269acb6b598
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/build-step-failure.util.ts
@@ -0,0 +1,27 @@
+import { RetryableLogicFunctionError } from 'twenty-sdk/logic-function';
+
+export type StepFailure = { error: string };
+
+const formatStepFailureMessage = (stepLabel: string, error: unknown): string =>
+ `[companion] ${stepLabel} failed: ${
+ error instanceof Error ? error.message : String(error)
+ }`;
+
+export const buildStepFailure = (
+ stepLabel: string,
+ error: unknown,
+): StepFailure => {
+ if (process.env.NODE_ENV !== 'test') {
+ console.error(formatStepFailureMessage(stepLabel, error));
+ }
+
+ return { error: `${stepLabel} failed` };
+};
+
+// Preserve explicit retry decisions; permanent errors must not become retryable.
+export const buildStepError = (stepLabel: string, error: unknown): Error => {
+ if (error instanceof RetryableLogicFunctionError) return error;
+ return Object.assign(new Error(formatStepFailureMessage(stepLabel, error)), {
+ cause: error,
+ });
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/extract-rich-text-markdown.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/extract-rich-text-markdown.util.ts
new file mode 100644
index 00000000000..d245d5e31e0
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/extract-rich-text-markdown.util.ts
@@ -0,0 +1,20 @@
+import { isUndefined } from '@sniptt/guards';
+
+import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { getString } from 'src/logic-functions/utils/get-string.util';
+
+export const extractRichTextMarkdown = (
+ rawValue: string,
+): string | undefined => {
+ try {
+ const richTextValue = asRecord(JSON.parse(rawValue));
+
+ if (isUndefined(richTextValue)) {
+ return getString(rawValue);
+ }
+
+ return getString(richTextValue.markdown);
+ } catch {
+ return getString(rawValue);
+ }
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/format-seconds-as-clock-timestamp.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/format-seconds-as-clock-timestamp.util.ts
new file mode 100644
index 00000000000..c92cae504c0
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/format-seconds-as-clock-timestamp.util.ts
@@ -0,0 +1,20 @@
+const SECONDS_PER_MINUTE = 60;
+const SECONDS_PER_HOUR = 3600;
+
+export const formatSecondsAsClockTimestamp = (totalSeconds: number): string => {
+ const safeSeconds = Number.isFinite(totalSeconds)
+ ? Math.max(0, Math.floor(totalSeconds))
+ : 0;
+ const hours = Math.floor(safeSeconds / SECONDS_PER_HOUR);
+ const minutes = Math.floor(
+ (safeSeconds % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE,
+ );
+ const seconds = safeSeconds % SECONDS_PER_MINUTE;
+ const paddedSeconds = String(seconds).padStart(2, '0');
+
+ if (hours > 0) {
+ return `${hours}:${String(minutes).padStart(2, '0')}:${paddedSeconds}`;
+ }
+
+ return `${minutes}:${paddedSeconds}`;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-application-variable-value.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/get-application-variable-value.util.ts
new file mode 100644
index 00000000000..19a9c2c7cd2
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/get-application-variable-value.util.ts
@@ -0,0 +1,3 @@
+// Application and server variables are injected into process.env on every execution.
+export const getApplicationVariableValue = (key: string): string | undefined =>
+ process.env[key];
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-batches.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/get-batches.util.ts
new file mode 100644
index 00000000000..29e2f4f6837
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/get-batches.util.ts
@@ -0,0 +1,12 @@
+export const getBatches = <TItem>(
+ items: TItem[],
+ batchSize: number,
+): TItem[][] => {
+ const batches: TItem[][] = [];
+
+ for (let batchStart = 0; batchStart < items.length; batchStart += batchSize) {
+ batches.push(items.slice(batchStart, batchStart + batchSize));
+ }
+
+ return batches;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-boolean-application-variable-value.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/get-boolean-application-variable-value.util.ts
new file mode 100644
index 00000000000..e7480a97d0f
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/get-boolean-application-variable-value.util.ts
@@ -0,0 +1,31 @@
+import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
+import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+
+const TRUTHY_VALUES = new Set(['true', '1', 'yes', 'on']);
+const FALSY_VALUES = new Set(['false', '0', 'no', 'off']);
+
+export const getBooleanApplicationVariableValue = ({
+ applicationVariableName,
+ defaultValue,
+}: {
+ applicationVariableName: string;
+ defaultValue: boolean;
+}): boolean => {
+ const rawValue = getApplicationVariableValue(applicationVariableName);
+
+ if (!isNonEmptyString(rawValue)) {
+ return defaultValue;
+ }
+
+ const normalizedValue = rawValue.trim().toLowerCase();
+
+ if (TRUTHY_VALUES.has(normalizedValue)) {
+ return true;
+ }
+
+ if (FALSY_VALUES.has(normalizedValue)) {
+ return false;
+ }
+
+ return defaultValue;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-companion-additional-summary-prompt.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/get-companion-additional-summary-prompt.util.ts
new file mode 100644
index 00000000000..ce83e09bf14
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/get-companion-additional-summary-prompt.util.ts
@@ -0,0 +1,20 @@
+import { isUndefined } from '@sniptt/guards';
+
+import { COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME } from 'src/logic-functions/constants/companion-additional-summary-prompt-env-var-name';
+import { extractRichTextMarkdown } from 'src/logic-functions/utils/extract-rich-text-markdown.util';
+import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
+import { getString } from 'src/logic-functions/utils/get-string.util';
+
+export const getCompanionAdditionalSummaryPrompt = (): string | undefined => {
+ const rawValue = getString(
+ getApplicationVariableValue(
+ COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME,
+ ),
+ );
+
+ if (isUndefined(rawValue)) {
+ return undefined;
+ }
+
+ return extractRichTextMarkdown(rawValue)?.trim();
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-recall-async-transcript-provider.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/get-recall-async-transcript-provider.util.ts
new file mode 100644
index 00000000000..006c8888645
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/get-recall-async-transcript-provider.util.ts
@@ -0,0 +1,23 @@
+import { COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME } from 'src/logic-functions/constants/companion-transcript-provider-env-var-name';
+import { DEFAULT_COMPANION_TRANSCRIPT_PROVIDER } from 'src/logic-functions/constants/default-companion-transcript-provider';
+import { RECALL_ASYNC_TRANSCRIPT_PROVIDERS } from 'src/logic-functions/constants/recall-async-transcript-providers';
+import { type RecallAsyncTranscriptProvider } from 'src/logic-functions/types/recall-async-transcript-provider.type';
+import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
+import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+
+const isRecallAsyncTranscriptProvider = (
+ value: unknown,
+): value is RecallAsyncTranscriptProvider =>
+ isNonEmptyString(value) && value in RECALL_ASYNC_TRANSCRIPT_PROVIDERS;
+
+export const getRecallAsyncTranscriptProvider = () => {
+ const rawValue = getApplicationVariableValue(
+ COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME,
+ )?.trim();
+
+ const providerId = isRecallAsyncTranscriptProvider(rawValue)
+ ? rawValue
+ : DEFAULT_COMPANION_TRANSCRIPT_PROVIDER;
+
+ return { [providerId]: RECALL_ASYNC_TRANSCRIPT_PROVIDERS[providerId] };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-record-at-path.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/get-record-at-path.util.ts
new file mode 100644
index 00000000000..fc41f0363df
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/get-record-at-path.util.ts
@@ -0,0 +1,10 @@
+import { asRecord } from './as-record.util';
+
+export const getRecordAtPath = (
+ record: Record<string, unknown> | undefined,
+ path: string[],
+): unknown =>
+ path.reduce<unknown>(
+ (currentValue, pathPart) => asRecord(currentValue)?.[pathPart],
+ record,
+ );
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-string.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/get-string.util.ts
new file mode 100644
index 00000000000..ea1e7cdd74b
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/get-string.util.ts
@@ -0,0 +1,4 @@
+import { isNonEmptyString } from './is-non-empty-string.util';
+
+export const getString = (value: unknown): string | undefined =>
+ isNonEmptyString(value) ? value : undefined;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/is-call-recording-summary-enabled.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/is-call-recording-summary-enabled.util.ts
new file mode 100644
index 00000000000..4fe5f7fe8f8
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/is-call-recording-summary-enabled.util.ts
@@ -0,0 +1,9 @@
+import { COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME } from 'src/logic-functions/constants/companion-summary-enabled-env-var-name';
+import { DEFAULT_COMPANION_SUMMARY_ENABLED } from 'src/logic-functions/constants/default-companion-summary-enabled';
+import { getBooleanApplicationVariableValue } from 'src/logic-functions/utils/get-boolean-application-variable-value.util';
+
+export const isCallRecordingSummaryEnabled = (): boolean =>
+ getBooleanApplicationVariableValue({
+ applicationVariableName: COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME,
+ defaultValue: DEFAULT_COMPANION_SUMMARY_ENABLED,
+ });
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/is-non-empty-string.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/is-non-empty-string.util.ts
new file mode 100644
index 00000000000..1e4c8967aa8
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/is-non-empty-string.util.ts
@@ -0,0 +1,2 @@
+export const isNonEmptyString = (value: unknown): value is string =>
+ typeof value === 'string' && value.trim() !== '';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/normalize-optional-string.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/normalize-optional-string.util.ts
new file mode 100644
index 00000000000..1698ea51259
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/normalize-optional-string.util.ts
@@ -0,0 +1,5 @@
+import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+
+export const normalizeOptionalString = (
+ value: string | null | undefined,
+): string | undefined => (isNonEmptyString(value) ? value : undefined);
diff --git a/packages/twenty-apps/public/companion/tsconfig.json b/packages/twenty-apps/public/companion/tsconfig.json
new file mode 100644
index 00000000000..abacf4dcf6d
--- /dev/null
+++ b/packages/twenty-apps/public/companion/tsconfig.json
@@ -0,0 +1,42 @@
+{
+ "compileOnSave": false,
+ "compilerOptions": {
+ "sourceMap": true,
+ "declaration": true,
+ "outDir": "./dist",
+ "rootDir": ".",
+ "jsx": "react-jsx",
+ "moduleResolution": "bundler",
+ "allowSyntheticDefaultImports": true,
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "importHelpers": true,
+ "allowUnreachableCode": false,
+ "strict": true,
+ "alwaysStrict": true,
+ "noImplicitAny": true,
+ "strictBindCallApply": false,
+ "target": "es2020",
+ "module": "esnext",
+ "lib": ["es2020", "dom"],
+ "skipLibCheck": true,
+ "skipDefaultLibCheck": true,
+ "resolveJsonModule": true,
+ "paths": {
+ "src/*": ["./src/*"],
+ "~/*": ["./*"]
+ }
+ },
+ "exclude": [
+ "node_modules",
+ "dist",
+ "**/*.test.ts",
+ "**/*.spec.ts",
+ "**/*.integration-test.ts"
+ ],
+ "references": [
+ {
+ "path": "./tsconfig.spec.json"
+ }
+ ]
+}
diff --git a/packages/twenty-apps/public/companion/tsconfig.spec.json b/packages/twenty-apps/public/companion/tsconfig.spec.json
new file mode 100644
index 00000000000..ea69a6c0105
--- /dev/null
+++ b/packages/twenty-apps/public/companion/tsconfig.spec.json
@@ -0,0 +1,9 @@
+{
+ "extends": "./tsconfig.json",
+ "compilerOptions": {
+ "composite": true,
+ "types": ["vitest/globals", "node"]
+ },
+ "include": ["src/**/*.ts", "src/**/*.tsx"],
+ "exclude": ["node_modules", "dist"]
+}
diff --git a/packages/twenty-apps/public/companion/vitest.config.ts b/packages/twenty-apps/public/companion/vitest.config.ts
new file mode 100644
index 00000000000..c00da60b5cb
--- /dev/null
+++ b/packages/twenty-apps/public/companion/vitest.config.ts
@@ -0,0 +1,16 @@
+import tsconfigPaths from 'vite-tsconfig-paths';
+import { defineConfig } from 'vitest/config';
+
+export default defineConfig({
+ plugins: [
+ tsconfigPaths({
+ projects: ['tsconfig.spec.json'],
+ ignoreConfigErrors: true,
+ }),
+ ],
+ test: {
+ testTimeout: 60_000,
+ include: ['src/**/*.integration-test.ts'],
+ globalSetup: ['src/__tests__/global-setup.ts'],
+ },
+});
diff --git a/packages/twenty-apps/public/companion/vitest.unit.config.ts b/packages/twenty-apps/public/companion/vitest.unit.config.ts
new file mode 100644
index 00000000000..e0d140015bb
--- /dev/null
+++ b/packages/twenty-apps/public/companion/vitest.unit.config.ts
@@ -0,0 +1,14 @@
+import tsconfigPaths from 'vite-tsconfig-paths';
+import { defineConfig } from 'vitest/config';
+
+export default defineConfig({
+ plugins: [
+ tsconfigPaths({
+ projects: ['tsconfig.spec.json'],
+ ignoreConfigErrors: true,
+ }),
+ ],
+ test: {
+ include: ['src/**/*.test.ts'],
+ },
+});
diff --git a/packages/twenty-apps/public/companion/yarn.lock b/packages/twenty-apps/public/companion/yarn.lock
new file mode 100644
index 00000000000..fe74f5f17d0
--- /dev/null
+++ b/packages/twenty-apps/public/companion/yarn.lock
@@ -0,0 +1,3493 @@
+# This file is generated by running "yarn install" inside your project.
+# Manual changes might be lost - proceed with caution!
+
+__metadata:
+ version: 8
+ cacheKey: 10c0
+
+"@alcalzone/ansi-tokenize@npm:^0.2.4":
+ version: 0.2.5
+ resolution: "@alcalzone/ansi-tokenize@npm:0.2.5"
+ dependencies:
+ ansi-styles: "npm:^6.2.1"
+ is-fullwidth-code-point: "npm:^5.0.0"
+ checksum: 10c0/dd8622288426b5b7dbf8b68d51d4b930cea591d0e3b9dbc3f523131464d78ac922c165fcb7ba5307f133d35dbcaa0e6648a1c3fb6a0dc2725546d6f867b70af4
+ languageName: node
+ linkType: hard
+
+"@babel/runtime@npm:^7.29.7":
+ version: 7.29.7
+ resolution: "@babel/runtime@npm:7.29.7"
+ checksum: 10c0/ca11572f7146b21e0bde6a9ed4bb6a89eafbee5f0944c7eb54d0d8a2dac962c33638a1d611e14faa71dfbb92b4b5f9236232208568a6b7d5c6f3f39ddb91771e
+ languageName: node
+ linkType: hard
+
+"@base-ui/react@npm:^1.5.0":
+ version: 1.8.0
+ resolution: "@base-ui/react@npm:1.8.0"
+ dependencies:
+ "@babel/runtime": "npm:^7.29.7"
+ "@base-ui/utils": "npm:0.4.0"
+ "@floating-ui/react-dom": "npm:^2.1.9"
+ "@floating-ui/utils": "npm:^0.2.12"
+ use-sync-external-store: "npm:^1.6.0"
+ peerDependencies:
+ "@date-fns/tz": ^1.2.0
+ "@types/react": ^17 || ^18 || ^19
+ date-fns: ^4.0.0
+ react: ^17 || ^18 || ^19
+ react-dom: ^17 || ^18 || ^19
+ peerDependenciesMeta:
+ "@date-fns/tz":
+ optional: true
+ "@types/react":
+ optional: true
+ date-fns:
+ optional: true
+ checksum: 10c0/bf3faa8891fe6c9695a07b30caa3349f9ffc067f0efd381bb6ed12d68400a2d273ab0f764dd07c5cc6b25f5bc6df6a5688e0164d4e2500ad07efaec8bdd88896
+ languageName: node
+ linkType: hard
+
+"@base-ui/utils@npm:0.4.0":
+ version: 0.4.0
+ resolution: "@base-ui/utils@npm:0.4.0"
+ dependencies:
+ "@babel/runtime": "npm:^7.29.7"
+ "@floating-ui/utils": "npm:^0.2.12"
+ reselect: "npm:^5.2.0"
+ use-sync-external-store: "npm:^1.6.0"
+ peerDependencies:
+ "@types/react": ^17 || ^18 || ^19
+ react: ^17 || ^18 || ^19
+ react-dom: ^17 || ^18 || ^19
+ peerDependenciesMeta:
+ "@types/react":
+ optional: true
+ checksum: 10c0/dd32220d13d42ed2cf0d0ae18e02bf9ece5c54d6a26e49c9449514d66d38b1fee51c875f7d9d21484a326b7a8a2c33c95be620e8a5976b7b6f3bfa27572b6baf
+ languageName: node
+ linkType: hard
+
+"@emnapi/runtime@npm:^1.11.3":
+ version: 1.11.3
+ resolution: "@emnapi/runtime@npm:1.11.3"
+ dependencies:
+ tslib: "npm:^2.4.0"
+ checksum: 10c0/a00f1020fefb9d4145c367f93a9fddb383a00da8ffd7871e20b19659890379b83aeecb9f84d7d0eda5456343f4a09eb05b0acb5153b0d3d889539dedb1ed87c3
+ languageName: node
+ linkType: hard
+
+"@esbuild/aix-ppc64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/aix-ppc64@npm:0.28.2"
+ conditions: os=aix & cpu=ppc64
+ languageName: node
+ linkType: hard
+
+"@esbuild/android-arm64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/android-arm64@npm:0.28.2"
+ conditions: os=android & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@esbuild/android-arm@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/android-arm@npm:0.28.2"
+ conditions: os=android & cpu=arm
+ languageName: node
+ linkType: hard
+
+"@esbuild/android-x64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/android-x64@npm:0.28.2"
+ conditions: os=android & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@esbuild/darwin-arm64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/darwin-arm64@npm:0.28.2"
+ conditions: os=darwin & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@esbuild/darwin-x64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/darwin-x64@npm:0.28.2"
+ conditions: os=darwin & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@esbuild/freebsd-arm64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/freebsd-arm64@npm:0.28.2"
+ conditions: os=freebsd & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@esbuild/freebsd-x64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/freebsd-x64@npm:0.28.2"
+ conditions: os=freebsd & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@esbuild/linux-arm64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/linux-arm64@npm:0.28.2"
+ conditions: os=linux & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@esbuild/linux-arm@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/linux-arm@npm:0.28.2"
+ conditions: os=linux & cpu=arm
+ languageName: node
+ linkType: hard
+
+"@esbuild/linux-ia32@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/linux-ia32@npm:0.28.2"
+ conditions: os=linux & cpu=ia32
+ languageName: node
+ linkType: hard
+
+"@esbuild/linux-loong64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/linux-loong64@npm:0.28.2"
+ conditions: os=linux & cpu=loong64
+ languageName: node
+ linkType: hard
+
+"@esbuild/linux-mips64el@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/linux-mips64el@npm:0.28.2"
+ conditions: os=linux & cpu=mips64el
+ languageName: node
+ linkType: hard
+
+"@esbuild/linux-ppc64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/linux-ppc64@npm:0.28.2"
+ conditions: os=linux & cpu=ppc64
+ languageName: node
+ linkType: hard
+
+"@esbuild/linux-riscv64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/linux-riscv64@npm:0.28.2"
+ conditions: os=linux & cpu=riscv64
+ languageName: node
+ linkType: hard
+
+"@esbuild/linux-s390x@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/linux-s390x@npm:0.28.2"
+ conditions: os=linux & cpu=s390x
+ languageName: node
+ linkType: hard
+
+"@esbuild/linux-x64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/linux-x64@npm:0.28.2"
+ conditions: os=linux & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@esbuild/netbsd-arm64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/netbsd-arm64@npm:0.28.2"
+ conditions: os=netbsd & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@esbuild/netbsd-x64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/netbsd-x64@npm:0.28.2"
+ conditions: os=netbsd & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@esbuild/openbsd-arm64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/openbsd-arm64@npm:0.28.2"
+ conditions: os=openbsd & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@esbuild/openbsd-x64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/openbsd-x64@npm:0.28.2"
+ conditions: os=openbsd & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@esbuild/openharmony-arm64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/openharmony-arm64@npm:0.28.2"
+ conditions: os=openharmony & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@esbuild/sunos-x64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/sunos-x64@npm:0.28.2"
+ conditions: os=sunos & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@esbuild/win32-arm64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/win32-arm64@npm:0.28.2"
+ conditions: os=win32 & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@esbuild/win32-ia32@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/win32-ia32@npm:0.28.2"
+ conditions: os=win32 & cpu=ia32
+ languageName: node
+ linkType: hard
+
+"@esbuild/win32-x64@npm:0.28.2":
+ version: 0.28.2
+ resolution: "@esbuild/win32-x64@npm:0.28.2"
+ conditions: os=win32 & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@floating-ui/core@npm:^1.8.0":
+ version: 1.8.0
+ resolution: "@floating-ui/core@npm:1.8.0"
+ dependencies:
+ "@floating-ui/utils": "npm:^0.2.12"
+ checksum: 10c0/cece958f6fab0f8cd7740cd57988c4f8bc5356dca39dd4c093433d44c91952c3a02c7a54d93d7ed6c078b6544d531a29f66621d2839c8bfbb4467dca6aed7df0
+ languageName: node
+ linkType: hard
+
+"@floating-ui/dom@npm:^1.8.0":
+ version: 1.8.0
+ resolution: "@floating-ui/dom@npm:1.8.0"
+ dependencies:
+ "@floating-ui/core": "npm:^1.8.0"
+ "@floating-ui/utils": "npm:^0.2.12"
+ checksum: 10c0/c32b2de7a596b69cfffa909c7028825e14f6319be1b45da529f8943c89fe16b75a49c214e800c87ded3f172353d3b99163d50072f11410488e756961b7b629cc
+ languageName: node
+ linkType: hard
+
+"@floating-ui/react-dom@npm:^2.1.9":
+ version: 2.1.9
+ resolution: "@floating-ui/react-dom@npm:2.1.9"
+ dependencies:
+ "@floating-ui/dom": "npm:^1.8.0"
+ peerDependencies:
+ react: ">=16.8.0"
+ react-dom: ">=16.8.0"
+ checksum: 10c0/9fa9851069738cb9591a1ab2da16e257f193eae5fd2d6d48ad0b1e73f3c049929b6805c5ad43d4af3c1da63c60b215b0ee4651a1fe5caeb80e66d9d423744348
+ languageName: node
+ linkType: hard
+
+"@floating-ui/utils@npm:^0.2.12":
+ version: 0.2.12
+ resolution: "@floating-ui/utils@npm:0.2.12"
+ checksum: 10c0/bb910b90d56991a62011afaf5f8e0c4b7fb6dab69403f4dd17fbd6eb25560b28d533dff9791f270b4f459852e9006a1077b5d73cbedb5e34d9424afc6a828314
+ languageName: node
+ linkType: hard
+
+"@genql/runtime@npm:^2.10.0":
+ version: 2.10.0
+ resolution: "@genql/runtime@npm:2.10.0"
+ dependencies:
+ "@types/qs": "npm:^6.9.0"
+ "@types/ws": "npm:^6.0.1"
+ graphql-query-batcher: "npm:^1.0.1"
+ isomorphic-unfetch: "npm:^3.0.0"
+ lodash: "npm:^4.17.20"
+ subscriptions-transport-ws: "npm:^0.9.16"
+ tslib: "npm:^2.0.0"
+ utility-types: "npm:^3.10.0"
+ ws: "npm:^6.1.4"
+ zen-observable-ts: "npm:^0.8.21"
+ peerDependencies:
+ graphql: "*"
+ checksum: 10c0/e2a886c2469c933681e2b0ddd6a5b7f4cb12932251ba460e3cf2db4246817da79313ea4ba9769ec7cbe53ab9c1cb81ad8fcce6a969cd241185b79398d2a4f3c6
+ languageName: node
+ linkType: hard
+
+"@img/colour@npm:^1.1.0":
+ version: 1.1.0
+ resolution: "@img/colour@npm:1.1.0"
+ checksum: 10c0/2ebea2c0bbaee73b99badcefa04e1e71d83f36e5369337d3121dca841f4569533c4e2faddda6d62dd247f0d5cca143711f9446c59bcce81e427ba433a7a94a17
+ languageName: node
+ linkType: hard
+
+"@img/sharp-darwin-arm64@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-darwin-arm64@npm:0.35.4"
+ dependencies:
+ "@img/sharp-libvips-darwin-arm64": "npm:1.3.3"
+ dependenciesMeta:
+ "@img/sharp-libvips-darwin-arm64":
+ optional: true
+ conditions: os=darwin & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@img/sharp-darwin-x64@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-darwin-x64@npm:0.35.4"
+ dependencies:
+ "@img/sharp-libvips-darwin-x64": "npm:1.3.3"
+ dependenciesMeta:
+ "@img/sharp-libvips-darwin-x64":
+ optional: true
+ conditions: os=darwin & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@img/sharp-freebsd-wasm32@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-freebsd-wasm32@npm:0.35.4"
+ dependencies:
+ "@img/sharp-wasm32": "npm:0.35.4"
+ conditions: os=freebsd
+ languageName: node
+ linkType: hard
+
+"@img/sharp-libvips-darwin-arm64@npm:1.3.3":
+ version: 1.3.3
+ resolution: "@img/sharp-libvips-darwin-arm64@npm:1.3.3"
+ conditions: os=darwin & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@img/sharp-libvips-darwin-x64@npm:1.3.3":
+ version: 1.3.3
+ resolution: "@img/sharp-libvips-darwin-x64@npm:1.3.3"
+ conditions: os=darwin & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@img/sharp-libvips-linux-arm64@npm:1.3.3":
+ version: 1.3.3
+ resolution: "@img/sharp-libvips-linux-arm64@npm:1.3.3"
+ conditions: os=linux & cpu=arm64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@img/sharp-libvips-linux-arm@npm:1.3.3":
+ version: 1.3.3
+ resolution: "@img/sharp-libvips-linux-arm@npm:1.3.3"
+ conditions: os=linux & cpu=arm & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@img/sharp-libvips-linux-ppc64@npm:1.3.3":
+ version: 1.3.3
+ resolution: "@img/sharp-libvips-linux-ppc64@npm:1.3.3"
+ conditions: os=linux & cpu=ppc64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@img/sharp-libvips-linux-riscv64@npm:1.3.3":
+ version: 1.3.3
+ resolution: "@img/sharp-libvips-linux-riscv64@npm:1.3.3"
+ conditions: os=linux & cpu=riscv64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@img/sharp-libvips-linux-s390x@npm:1.3.3":
+ version: 1.3.3
+ resolution: "@img/sharp-libvips-linux-s390x@npm:1.3.3"
+ conditions: os=linux & cpu=s390x & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@img/sharp-libvips-linux-x64@npm:1.3.3":
+ version: 1.3.3
+ resolution: "@img/sharp-libvips-linux-x64@npm:1.3.3"
+ conditions: os=linux & cpu=x64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@img/sharp-libvips-linuxmusl-arm64@npm:1.3.3":
+ version: 1.3.3
+ resolution: "@img/sharp-libvips-linuxmusl-arm64@npm:1.3.3"
+ conditions: os=linux & cpu=arm64 & libc=musl
+ languageName: node
+ linkType: hard
+
+"@img/sharp-libvips-linuxmusl-x64@npm:1.3.3":
+ version: 1.3.3
+ resolution: "@img/sharp-libvips-linuxmusl-x64@npm:1.3.3"
+ conditions: os=linux & cpu=x64 & libc=musl
+ languageName: node
+ linkType: hard
+
+"@img/sharp-linux-arm64@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-linux-arm64@npm:0.35.4"
+ dependencies:
+ "@img/sharp-libvips-linux-arm64": "npm:1.3.3"
+ dependenciesMeta:
+ "@img/sharp-libvips-linux-arm64":
+ optional: true
+ conditions: os=linux & cpu=arm64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@img/sharp-linux-arm@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-linux-arm@npm:0.35.4"
+ dependencies:
+ "@img/sharp-libvips-linux-arm": "npm:1.3.3"
+ dependenciesMeta:
+ "@img/sharp-libvips-linux-arm":
+ optional: true
+ conditions: os=linux & cpu=arm & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@img/sharp-linux-ppc64@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-linux-ppc64@npm:0.35.4"
+ dependencies:
+ "@img/sharp-libvips-linux-ppc64": "npm:1.3.3"
+ dependenciesMeta:
+ "@img/sharp-libvips-linux-ppc64":
+ optional: true
+ conditions: os=linux & cpu=ppc64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@img/sharp-linux-riscv64@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-linux-riscv64@npm:0.35.4"
+ dependencies:
+ "@img/sharp-libvips-linux-riscv64": "npm:1.3.3"
+ dependenciesMeta:
+ "@img/sharp-libvips-linux-riscv64":
+ optional: true
+ conditions: os=linux & cpu=riscv64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@img/sharp-linux-s390x@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-linux-s390x@npm:0.35.4"
+ dependencies:
+ "@img/sharp-libvips-linux-s390x": "npm:1.3.3"
+ dependenciesMeta:
+ "@img/sharp-libvips-linux-s390x":
+ optional: true
+ conditions: os=linux & cpu=s390x & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@img/sharp-linux-x64@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-linux-x64@npm:0.35.4"
+ dependencies:
+ "@img/sharp-libvips-linux-x64": "npm:1.3.3"
+ dependenciesMeta:
+ "@img/sharp-libvips-linux-x64":
+ optional: true
+ conditions: os=linux & cpu=x64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@img/sharp-linuxmusl-arm64@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-linuxmusl-arm64@npm:0.35.4"
+ dependencies:
+ "@img/sharp-libvips-linuxmusl-arm64": "npm:1.3.3"
+ dependenciesMeta:
+ "@img/sharp-libvips-linuxmusl-arm64":
+ optional: true
+ conditions: os=linux & cpu=arm64 & libc=musl
+ languageName: node
+ linkType: hard
+
+"@img/sharp-linuxmusl-x64@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-linuxmusl-x64@npm:0.35.4"
+ dependencies:
+ "@img/sharp-libvips-linuxmusl-x64": "npm:1.3.3"
+ dependenciesMeta:
+ "@img/sharp-libvips-linuxmusl-x64":
+ optional: true
+ conditions: os=linux & cpu=x64 & libc=musl
+ languageName: node
+ linkType: hard
+
+"@img/sharp-wasm32@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-wasm32@npm:0.35.4"
+ dependencies:
+ "@emnapi/runtime": "npm:^1.11.3"
+ checksum: 10c0/7f5e394f168eb2f038b8ae4949fb5434085d1db931ede2ae1389479d7a1dbe11e2fc9d58e8e9830bff744ba996256c9e411be1d466dfcbf6e1f4d153b84f25ff
+ languageName: node
+ linkType: hard
+
+"@img/sharp-webcontainers-wasm32@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-webcontainers-wasm32@npm:0.35.4"
+ dependencies:
+ "@img/sharp-wasm32": "npm:0.35.4"
+ conditions: cpu=wasm32
+ languageName: node
+ linkType: hard
+
+"@img/sharp-win32-arm64@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-win32-arm64@npm:0.35.4"
+ conditions: os=win32 & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@img/sharp-win32-ia32@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-win32-ia32@npm:0.35.4"
+ conditions: os=win32 & cpu=ia32
+ languageName: node
+ linkType: hard
+
+"@img/sharp-win32-x64@npm:0.35.4":
+ version: 0.35.4
+ resolution: "@img/sharp-win32-x64@npm:0.35.4"
+ conditions: os=win32 & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@inquirer/ansi@npm:^2.0.8":
+ version: 2.0.8
+ resolution: "@inquirer/ansi@npm:2.0.8"
+ checksum: 10c0/2149a358f6227260815aac389bb0b5aedecc54452ad9c40e8aedcec07e0df91a046771571617d0734d074450637f5edde38752e17e79ede0d2bf657413acf3cb
+ languageName: node
+ linkType: hard
+
+"@inquirer/checkbox@npm:^5.2.4":
+ version: 5.2.4
+ resolution: "@inquirer/checkbox@npm:5.2.4"
+ dependencies:
+ "@inquirer/ansi": "npm:^2.0.8"
+ "@inquirer/core": "npm:^12.0.2"
+ "@inquirer/figures": "npm:^2.0.9"
+ "@inquirer/type": "npm:4.1.1"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/15b363d56245b990af8360551400c59bfe5e0a86c019f00a8a2ed8294e5d322d79e4cff3d6589dc840dd6ba8da060fb0c0f967643bdb4532cc24a08bdbd2151a
+ languageName: node
+ linkType: hard
+
+"@inquirer/confirm@npm:^6.3.1":
+ version: 6.3.1
+ resolution: "@inquirer/confirm@npm:6.3.1"
+ dependencies:
+ "@inquirer/core": "npm:^12.0.2"
+ "@inquirer/type": "npm:4.1.1"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/4559ea9f9a4366d6060f3e87cfbddfe21164758d04d84c9eb6b4a570fe527d1a70e1dfbf347517ec0667eb88d7ebf368e059ec6d832a99e76179d7680d4cd7d7
+ languageName: node
+ linkType: hard
+
+"@inquirer/core@npm:^12.0.2":
+ version: 12.0.2
+ resolution: "@inquirer/core@npm:12.0.2"
+ dependencies:
+ "@inquirer/ansi": "npm:^2.0.8"
+ "@inquirer/figures": "npm:^2.0.9"
+ "@inquirer/type": "npm:4.1.1"
+ cli-width: "npm:^4.1.0"
+ fast-wrap-ansi: "npm:^0.2.0"
+ mute-stream: "npm:^3.0.0"
+ signal-exit: "npm:^4.1.0"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/ba187b76a6f44d9d94c71f67a3c089f3eba508ac9edb926d19adad33358222b1592ee4399240cc16dab32e58e00a107b974dc9c6dc80a7ebd2f2d4d1a649678f
+ languageName: node
+ linkType: hard
+
+"@inquirer/editor@npm:^5.3.2":
+ version: 5.3.2
+ resolution: "@inquirer/editor@npm:5.3.2"
+ dependencies:
+ "@inquirer/core": "npm:^12.0.2"
+ "@inquirer/external-editor": "npm:^3.0.5"
+ "@inquirer/type": "npm:4.1.1"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/78f079feac6721393da00f2384a77625dcf8deeaadef1b9db41402cbbfa626acbfac200af48f41804e4762afb88a0a46b801e71f1c6c4e4e4067d85de8c01c86
+ languageName: node
+ linkType: hard
+
+"@inquirer/expand@npm:^5.1.4":
+ version: 5.1.4
+ resolution: "@inquirer/expand@npm:5.1.4"
+ dependencies:
+ "@inquirer/core": "npm:^12.0.2"
+ "@inquirer/type": "npm:4.1.1"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/e642601beca9f5d8c15d7f6d273a916d629adba005d628976f856654c2dbfd30171604386b6acee128e79842a4b8004ea5f33240ffc7578ce6293f94c7ca739a
+ languageName: node
+ linkType: hard
+
+"@inquirer/external-editor@npm:^3.0.5":
+ version: 3.0.5
+ resolution: "@inquirer/external-editor@npm:3.0.5"
+ dependencies:
+ chardet: "npm:^2.1.1"
+ iconv-lite: "npm:^0.7.2"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/66ad34d4d6d6b8e1e26691b32a67309b066b74ed7eb5f0b8b8d87e20d095316c7f6cf9bcae1fa3e85ad655d4741b713bbd6dce355413ffb4bac2b3a927fa0a82
+ languageName: node
+ linkType: hard
+
+"@inquirer/figures@npm:^2.0.9":
+ version: 2.0.9
+ resolution: "@inquirer/figures@npm:2.0.9"
+ checksum: 10c0/24198eb05c7ba32cf5b2eeee0a641b708fcd23f78ac6c568d18858191a40aa456e1626c52e088df1882ebe2e34c0f4cd08c78ca3c506429d4032f0a8833230a2
+ languageName: node
+ linkType: hard
+
+"@inquirer/input@npm:^5.1.5":
+ version: 5.1.5
+ resolution: "@inquirer/input@npm:5.1.5"
+ dependencies:
+ "@inquirer/core": "npm:^12.0.2"
+ "@inquirer/type": "npm:4.1.1"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/b9feedb118379f3740c34831cdd0be6dede5ff72ddd828650f7cb6736a6d7c015c122c9e27daffdbd01571ed8f47fb91eda26326813588862dbed46ef17e9800
+ languageName: node
+ linkType: hard
+
+"@inquirer/number@npm:^4.2.2":
+ version: 4.2.2
+ resolution: "@inquirer/number@npm:4.2.2"
+ dependencies:
+ "@inquirer/core": "npm:^12.0.2"
+ "@inquirer/type": "npm:4.1.1"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/c0990227e1bcaf203df686a055e68616e7079d4f6fe517b5df319512561bb0a960cec19a4f736dc851ed32f254d5b3a2378238b35e8f6f33579b711ff5f1dc52
+ languageName: node
+ linkType: hard
+
+"@inquirer/password@npm:^5.2.1":
+ version: 5.2.1
+ resolution: "@inquirer/password@npm:5.2.1"
+ dependencies:
+ "@inquirer/ansi": "npm:^2.0.8"
+ "@inquirer/core": "npm:^12.0.2"
+ "@inquirer/type": "npm:4.1.1"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/11556d30dc03278d950e6c5290e8a84c0bc4509274794be8062582fd00ee56fdc2f510dd3b3068be5686932f3b634c6551c5cb2a97a7efa06e96daa572803408
+ languageName: node
+ linkType: hard
+
+"@inquirer/prompts@npm:^8.7.1":
+ version: 8.7.1
+ resolution: "@inquirer/prompts@npm:8.7.1"
+ dependencies:
+ "@inquirer/checkbox": "npm:^5.2.4"
+ "@inquirer/confirm": "npm:^6.3.1"
+ "@inquirer/editor": "npm:^5.3.2"
+ "@inquirer/expand": "npm:^5.1.4"
+ "@inquirer/input": "npm:^5.1.5"
+ "@inquirer/number": "npm:^4.2.2"
+ "@inquirer/password": "npm:^5.2.1"
+ "@inquirer/rawlist": "npm:^5.3.4"
+ "@inquirer/search": "npm:^4.3.2"
+ "@inquirer/select": "npm:^5.2.4"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/d488507460e040897dcb0c5e2721ed496852ccef31abe03539a292fb54fb198aab73ed756d1597e4fd872de4e305e4c4e01b9eba6920c64e6bf15a27671cb36f
+ languageName: node
+ linkType: hard
+
+"@inquirer/rawlist@npm:^5.3.4":
+ version: 5.3.4
+ resolution: "@inquirer/rawlist@npm:5.3.4"
+ dependencies:
+ "@inquirer/core": "npm:^12.0.2"
+ "@inquirer/type": "npm:4.1.1"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/1a6d794e65307530f5ac06598d688cb95caf517ffda7abdf0fcd1a4a21e001fa9705076aa2a509084da62af4fe546ffd691677f91a0f06711e2f21380872613e
+ languageName: node
+ linkType: hard
+
+"@inquirer/search@npm:^4.3.2":
+ version: 4.3.2
+ resolution: "@inquirer/search@npm:4.3.2"
+ dependencies:
+ "@inquirer/core": "npm:^12.0.2"
+ "@inquirer/figures": "npm:^2.0.9"
+ "@inquirer/type": "npm:4.1.1"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/6a0e17950e53939db74ca5ae4cdbc73aa0d63fad937bb36b3490b014e5ee77756336eb70a762a51625aa799ee611270fc306cce2c68333decb8ab19937ad95d5
+ languageName: node
+ linkType: hard
+
+"@inquirer/select@npm:^5.2.4":
+ version: 5.2.4
+ resolution: "@inquirer/select@npm:5.2.4"
+ dependencies:
+ "@inquirer/ansi": "npm:^2.0.8"
+ "@inquirer/core": "npm:^12.0.2"
+ "@inquirer/figures": "npm:^2.0.9"
+ "@inquirer/type": "npm:4.1.1"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/ce290889ebad0f244681d96a345c3fc1443a956eb4c72b4de92615cb768d2e0125020cd81065e17e73c528b752080e6099c7e9f610cdd7897840d1df6eb86906
+ languageName: node
+ linkType: hard
+
+"@inquirer/type@npm:4.1.1":
+ version: 4.1.1
+ resolution: "@inquirer/type@npm:4.1.1"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/77e7e21deaa8188d7d0ce34ed2623302d630529c28605d3ec931bc1420f8c35b9126790fc9deeeb6661326409ae4cec632d4bee3da74659512de1dddfe611dd9
+ languageName: node
+ linkType: hard
+
+"@isaacs/fs-minipass@npm:^4.0.0":
+ version: 4.0.1
+ resolution: "@isaacs/fs-minipass@npm:4.0.1"
+ dependencies:
+ minipass: "npm:^7.0.4"
+ checksum: 10c0/c25b6dc1598790d5b55c0947a9b7d111cfa92594db5296c3b907e2f533c033666f692a3939eadac17b1c7c40d362d0b0635dc874cbfe3e70db7c2b07cc97a5d2
+ languageName: node
+ linkType: hard
+
+"@jridgewell/sourcemap-codec@npm:^1.5.5":
+ version: 1.6.0
+ resolution: "@jridgewell/sourcemap-codec@npm:1.6.0"
+ checksum: 10c0/b5be700e45a775f218589c3466c4ffea630582b4988657652da464e5ab8a7d18bf928ee4fd2363fb346ede4bea9c6ff0bae05a538358c4565ece6199531b5f72
+ languageName: node
+ linkType: hard
+
+"@monaco-editor/loader@npm:^1.5.0":
+ version: 1.7.0
+ resolution: "@monaco-editor/loader@npm:1.7.0"
+ dependencies:
+ state-local: "npm:^1.0.6"
+ checksum: 10c0/1fd3579cb09b669493cf553dfc0723a93483140a44353ce9a739827edfa7b2c6541b254024d15c48176ece749ef666b6d16cce6cf0e4396c7fa1c5a48012d08a
+ languageName: node
+ linkType: hard
+
+"@monaco-editor/react@npm:^4.7.0":
+ version: 4.7.0
+ resolution: "@monaco-editor/react@npm:4.7.0"
+ dependencies:
+ "@monaco-editor/loader": "npm:^1.5.0"
+ peerDependencies:
+ monaco-editor: ">= 0.25.0 < 1"
+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ checksum: 10c0/a4e91c6eda1a71f5fd23871bd801de435490ccbc43934d23cba65cefe2be7e9d02c9a57c4ef80fc9fe99e4d4deea51e5db19cb4e0ecf3f51818dda0eb9cdbf12
+ languageName: node
+ linkType: hard
+
+"@oxc-project/types@npm:=0.148.0":
+ version: 0.148.0
+ resolution: "@oxc-project/types@npm:0.148.0"
+ checksum: 10c0/23700196086ec996dcaf8cb494d0d378257a4f6f8ac4dfa0ee732bdf9a8a519da535cb33c8654ee6ea771872ae5801f9963c9d402767a4d13c2fa128cf7c42d2
+ languageName: node
+ linkType: hard
+
+"@oxlint/darwin-arm64@npm:0.16.12":
+ version: 0.16.12
+ resolution: "@oxlint/darwin-arm64@npm:0.16.12"
+ conditions: os=darwin & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@oxlint/darwin-x64@npm:0.16.12":
+ version: 0.16.12
+ resolution: "@oxlint/darwin-x64@npm:0.16.12"
+ conditions: os=darwin & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@oxlint/linux-arm64-gnu@npm:0.16.12":
+ version: 0.16.12
+ resolution: "@oxlint/linux-arm64-gnu@npm:0.16.12"
+ conditions: os=linux & cpu=arm64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@oxlint/linux-arm64-musl@npm:0.16.12":
+ version: 0.16.12
+ resolution: "@oxlint/linux-arm64-musl@npm:0.16.12"
+ conditions: os=linux & cpu=arm64 & libc=musl
+ languageName: node
+ linkType: hard
+
+"@oxlint/linux-x64-gnu@npm:0.16.12":
+ version: 0.16.12
+ resolution: "@oxlint/linux-x64-gnu@npm:0.16.12"
+ conditions: os=linux & cpu=x64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@oxlint/linux-x64-musl@npm:0.16.12":
+ version: 0.16.12
+ resolution: "@oxlint/linux-x64-musl@npm:0.16.12"
+ conditions: os=linux & cpu=x64 & libc=musl
+ languageName: node
+ linkType: hard
+
+"@oxlint/win32-arm64@npm:0.16.12":
+ version: 0.16.12
+ resolution: "@oxlint/win32-arm64@npm:0.16.12"
+ conditions: os=win32 & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@oxlint/win32-x64@npm:0.16.12":
+ version: 0.16.12
+ resolution: "@oxlint/win32-x64@npm:0.16.12"
+ conditions: os=win32 & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@radix-ui/colors@npm:^3.0.0":
+ version: 3.0.0
+ resolution: "@radix-ui/colors@npm:3.0.0"
+ checksum: 10c0/612c6bb4efe987f2d49aaca2f785687d08150da59a248328bc2b4e187ece4ef731c1dc5c6a9430fffcac4af9e65cf2f89ceb9806f8809940c9eb238b79d2cf2f
+ languageName: node
+ linkType: hard
+
+"@remix-run/router@npm:1.23.4":
+ version: 1.23.4
+ resolution: "@remix-run/router@npm:1.23.4"
+ checksum: 10c0/ef17eb2a606c125f09c55683585099725421af1c11f1c1d1c3841fe4eea3f99eb56b26ecbb17429a173c704ecae336c37e0d74855faa9330667433ef4f419436
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-android-arm-eabi@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-android-arm-eabi@npm:1.2.7"
+ conditions: os=android & cpu=arm
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-android-arm64@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-android-arm64@npm:1.2.7"
+ conditions: os=android & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-darwin-arm64@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-darwin-arm64@npm:1.2.7"
+ conditions: os=darwin & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-darwin-x64@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-darwin-x64@npm:1.2.7"
+ conditions: os=darwin & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-freebsd-x64@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-freebsd-x64@npm:1.2.7"
+ conditions: os=freebsd & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-linux-arm-gnueabihf@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-linux-arm-gnueabihf@npm:1.2.7"
+ conditions: os=linux & cpu=arm
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-linux-arm64-gnu@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-linux-arm64-gnu@npm:1.2.7"
+ conditions: os=linux & cpu=arm64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-linux-arm64-musl@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-linux-arm64-musl@npm:1.2.7"
+ conditions: os=linux & cpu=arm64 & libc=musl
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-linux-ppc64-gnu@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-linux-ppc64-gnu@npm:1.2.7"
+ conditions: os=linux & cpu=ppc64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-linux-s390x-gnu@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-linux-s390x-gnu@npm:1.2.7"
+ conditions: os=linux & cpu=s390x & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-linux-x64-gnu@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-linux-x64-gnu@npm:1.2.7"
+ conditions: os=linux & cpu=x64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-linux-x64-musl@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-linux-x64-musl@npm:1.2.7"
+ conditions: os=linux & cpu=x64 & libc=musl
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-openharmony-arm64@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-openharmony-arm64@npm:1.2.7"
+ conditions: os=openharmony & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-win32-arm64-msvc@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-win32-arm64-msvc@npm:1.2.7"
+ conditions: os=win32 & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@rolldown/binding-win32-x64-msvc@npm:1.2.7":
+ version: 1.2.7
+ resolution: "@rolldown/binding-win32-x64-msvc@npm:1.2.7"
+ conditions: os=win32 & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@rolldown/pluginutils@npm:^1.0.0":
+ version: 1.0.1
+ resolution: "@rolldown/pluginutils@npm:1.0.1"
+ checksum: 10c0/99d9b06d90196823e4d8c841f258db7a16e5dbba5824a2962b05d907b79f1ba929d56f22dd744fd530936e568c865ee56a719dc31e57e13bc0a8eb4764a8d8dd
+ languageName: node
+ linkType: hard
+
+"@sniptt/guards@npm:^0.2.0":
+ version: 0.2.0
+ resolution: "@sniptt/guards@npm:0.2.0"
+ checksum: 10c0/749bb0f550d1ddd4abdb23dc1076cba26e977659922b73d000bceeb253c09270aaced0d18e92f09d4ce2fdaae33e55f60f2142f5359bc90ba505422af0873526
+ languageName: node
+ linkType: hard
+
+"@standard-schema/spec@npm:^1.1.0":
+ version: 1.1.0
+ resolution: "@standard-schema/spec@npm:1.1.0"
+ checksum: 10c0/d90f55acde4b2deb983529c87e8025fa693de1a5e8b49ecc6eb84d1fd96328add0e03d7d551442156c7432fd78165b2c26ff561b970a9a881f046abb78d6a526
+ languageName: node
+ linkType: hard
+
+"@tabler/icons-react@npm:^3.31.0":
+ version: 3.46.0
+ resolution: "@tabler/icons-react@npm:3.46.0"
+ dependencies:
+ "@tabler/icons": "npm:3.46.0"
+ peerDependencies:
+ react: ">= 16"
+ checksum: 10c0/8fab7d3a9ec6b62724a1628b8bad68a7b503979e4418f97d057c442adc5257b227a08185a884d452d171983648e36fa92cd7bfe9457f693e9b67bbf4ecf8ec24
+ languageName: node
+ linkType: hard
+
+"@tabler/icons@npm:3.46.0":
+ version: 3.46.0
+ resolution: "@tabler/icons@npm:3.46.0"
+ checksum: 10c0/c9671449c2f53fa7e329c487162f89a28417cdd5ce96cfa290fe21388724da303dd2297af3b39a88a74b02c36ce55598bc3cf6537dbddf548881da2c05f35f5e
+ languageName: node
+ linkType: hard
+
+"@twentyhq/companion-app@workspace:.":
+ version: 0.0.0-use.local
+ resolution: "@twentyhq/companion-app@workspace:."
+ dependencies:
+ "@sniptt/guards": "npm:^0.2.0"
+ "@types/node": "npm:^24.7.2"
+ "@types/react": "npm:^19.0.0"
+ "@typescript/native-preview": "npm:^7.0.0-dev.20260116.1"
+ oxlint: "npm:^0.16.0"
+ react: "npm:^19.0.0"
+ react-dom: "npm:^19.0.0"
+ twenty-client-sdk: "npm:2.39.0"
+ twenty-sdk: "npm:2.39.0"
+ twenty-ui: "npm:1.0.0-alpha.1"
+ typescript: "npm:^5.9.3"
+ vite-tsconfig-paths: "npm:^4.2.1"
+ vitest: "npm:^4.0.0"
+ languageName: unknown
+ linkType: soft
+
+"@types/chai@npm:^5.2.2":
+ version: 5.2.3
+ resolution: "@types/chai@npm:5.2.3"
+ dependencies:
+ "@types/deep-eql": "npm:*"
+ assertion-error: "npm:^2.0.1"
+ checksum: 10c0/e0ef1de3b6f8045a5e473e867c8565788c444271409d155588504840ad1a53611011f85072188c2833941189400228c1745d78323dac13fcede9c2b28bacfb2f
+ languageName: node
+ linkType: hard
+
+"@types/deep-eql@npm:*":
+ version: 4.0.2
+ resolution: "@types/deep-eql@npm:4.0.2"
+ checksum: 10c0/bf3f811843117900d7084b9d0c852da9a044d12eb40e6de73b552598a6843c21291a8a381b0532644574beecd5e3491c5ff3a0365ab86b15d59862c025384844
+ languageName: node
+ linkType: hard
+
+"@types/estree@npm:^1.0.0":
+ version: 1.0.9
+ resolution: "@types/estree@npm:1.0.9"
+ checksum: 10c0/3ad3286ca2988cd550dafb8f2ad599c8474868e954fa601a36655bdfefd8039f7c714b8c1c7f2ae219ffbd58bd4660e66fa7479a0120fc02d4777057d4865387
+ languageName: node
+ linkType: hard
+
+"@types/node@npm:*":
+ version: 26.4.1
+ resolution: "@types/node@npm:26.4.1"
+ dependencies:
+ undici-types: "npm:~8.3.0"
+ checksum: 10c0/29568336db8bc67740744782492af0e81ab1f88d86eaa07e38cf0a4c8bae7250a7b4b85c80ac1014fc98b2bc6d4bcac872b2c494ee0671b3880eada7c1fdbc94
+ languageName: node
+ linkType: hard
+
+"@types/node@npm:^24.7.2":
+ version: 24.13.3
+ resolution: "@types/node@npm:24.13.3"
+ dependencies:
+ undici-types: "npm:~7.18.0"
+ checksum: 10c0/a5bc08f49b9581dcdca90e02cd77197a3c799840807664942e5cd5161a553d4d2ae8064f7e3294410d748d7d098b5c1848be7fa50c06f29c4193ab16be4e59eb
+ languageName: node
+ linkType: hard
+
+"@types/qs@npm:^6.9.0":
+ version: 6.15.1
+ resolution: "@types/qs@npm:6.15.1"
+ checksum: 10c0/1dfdbcb4cf2a8f66d57f0b9a9fe6b1c7091cb816687b6698c1351eaf31f62e412cea9b7453a9637b570cd5fad8dced527e5a9e69b4fcc6e318daacd8b749f094
+ languageName: node
+ linkType: hard
+
+"@types/react@npm:^19.0.0":
+ version: 19.2.18
+ resolution: "@types/react@npm:19.2.18"
+ dependencies:
+ csstype: "npm:^3.2.2"
+ checksum: 10c0/d04216172b4b4362b310017c210dfbe019fb4f4e7dffd0313e70b3acb3051d5c3e76e7e84e3cf4c6a3c824993ffadfe3949e589a6398a09d4200e7670e2962de
+ languageName: node
+ linkType: hard
+
+"@types/ws@npm:^6.0.1":
+ version: 6.0.4
+ resolution: "@types/ws@npm:6.0.4"
+ dependencies:
+ "@types/node": "npm:*"
+ checksum: 10c0/fa958e64596ca9487c3ed6012834de70b47f25d971f1950cfb8e6a99cb77ff340ae82ac7627744e01b58010674ef8ede07d5a2ac29ca9ad0d67a430fcc69ae14
+ languageName: node
+ linkType: hard
+
+"@typescript/native-preview-darwin-arm64@npm:7.0.0-dev.20260707.2":
+ version: 7.0.0-dev.20260707.2
+ resolution: "@typescript/native-preview-darwin-arm64@npm:7.0.0-dev.20260707.2"
+ conditions: os=darwin & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@typescript/native-preview-darwin-x64@npm:7.0.0-dev.20260707.2":
+ version: 7.0.0-dev.20260707.2
+ resolution: "@typescript/native-preview-darwin-x64@npm:7.0.0-dev.20260707.2"
+ conditions: os=darwin & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@typescript/native-preview-linux-arm64@npm:7.0.0-dev.20260707.2":
+ version: 7.0.0-dev.20260707.2
+ resolution: "@typescript/native-preview-linux-arm64@npm:7.0.0-dev.20260707.2"
+ conditions: os=linux & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@typescript/native-preview-linux-arm@npm:7.0.0-dev.20260707.2":
+ version: 7.0.0-dev.20260707.2
+ resolution: "@typescript/native-preview-linux-arm@npm:7.0.0-dev.20260707.2"
+ conditions: os=linux & cpu=arm
+ languageName: node
+ linkType: hard
+
+"@typescript/native-preview-linux-x64@npm:7.0.0-dev.20260707.2":
+ version: 7.0.0-dev.20260707.2
+ resolution: "@typescript/native-preview-linux-x64@npm:7.0.0-dev.20260707.2"
+ conditions: os=linux & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@typescript/native-preview-win32-arm64@npm:7.0.0-dev.20260707.2":
+ version: 7.0.0-dev.20260707.2
+ resolution: "@typescript/native-preview-win32-arm64@npm:7.0.0-dev.20260707.2"
+ conditions: os=win32 & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"@typescript/native-preview-win32-x64@npm:7.0.0-dev.20260707.2":
+ version: 7.0.0-dev.20260707.2
+ resolution: "@typescript/native-preview-win32-x64@npm:7.0.0-dev.20260707.2"
+ conditions: os=win32 & cpu=x64
+ languageName: node
+ linkType: hard
+
+"@typescript/native-preview@npm:^7.0.0-dev.20260116.1":
+ version: 7.0.0-dev.20260707.2
+ resolution: "@typescript/native-preview@npm:7.0.0-dev.20260707.2"
+ dependencies:
+ "@typescript/native-preview-darwin-arm64": "npm:7.0.0-dev.20260707.2"
+ "@typescript/native-preview-darwin-x64": "npm:7.0.0-dev.20260707.2"
+ "@typescript/native-preview-linux-arm": "npm:7.0.0-dev.20260707.2"
+ "@typescript/native-preview-linux-arm64": "npm:7.0.0-dev.20260707.2"
+ "@typescript/native-preview-linux-x64": "npm:7.0.0-dev.20260707.2"
+ "@typescript/native-preview-win32-arm64": "npm:7.0.0-dev.20260707.2"
+ "@typescript/native-preview-win32-x64": "npm:7.0.0-dev.20260707.2"
+ dependenciesMeta:
+ "@typescript/native-preview-darwin-arm64":
+ optional: true
+ "@typescript/native-preview-darwin-x64":
+ optional: true
+ "@typescript/native-preview-linux-arm":
+ optional: true
+ "@typescript/native-preview-linux-arm64":
+ optional: true
+ "@typescript/native-preview-linux-x64":
+ optional: true
+ "@typescript/native-preview-win32-arm64":
+ optional: true
+ "@typescript/native-preview-win32-x64":
+ optional: true
+ bin:
+ tsgo: bin/tsgo
+ checksum: 10c0/42c527da5c4d61884e50591dba0a37e6d98f992e355037213f2039d606dd9fddfbacee308d40b4f3b4cfa06f79b07b7e86b45b92a83a9e60741f65e07a031982
+ languageName: node
+ linkType: hard
+
+"@vitest/expect@npm:4.1.11":
+ version: 4.1.11
+ resolution: "@vitest/expect@npm:4.1.11"
+ dependencies:
+ "@standard-schema/spec": "npm:^1.1.0"
+ "@types/chai": "npm:^5.2.2"
+ "@vitest/spy": "npm:4.1.11"
+ "@vitest/utils": "npm:4.1.11"
+ chai: "npm:^6.2.2"
+ tinyrainbow: "npm:^3.1.0"
+ checksum: 10c0/0aa5e0973aca93a58cbdc3041c6bfed5897e976124965203b96a23b811f4ca403590c7eb15802c8d8366ec27a1db0682451e8a91c4d06617636de262baf86e4b
+ languageName: node
+ linkType: hard
+
+"@vitest/mocker@npm:4.1.11":
+ version: 4.1.11
+ resolution: "@vitest/mocker@npm:4.1.11"
+ dependencies:
+ "@vitest/spy": "npm:4.1.11"
+ estree-walker: "npm:^3.0.3"
+ magic-string: "npm:^0.30.21"
+ peerDependencies:
+ msw: ^2.4.9
+ vite: ^6.0.0 || ^7.0.0 || ^8.0.0
+ peerDependenciesMeta:
+ msw:
+ optional: true
+ vite:
+ optional: true
+ checksum: 10c0/3111ea34bd5046f6c70bbd67cf8b89608ee8c41cb27ab2bd61d42f4b68810e9ea16a9a757a71bc254c105f73b407d00ebb6bab1ab0f7f5cdcc9d7d16602a3933
+ languageName: node
+ linkType: hard
+
+"@vitest/pretty-format@npm:4.1.11":
+ version: 4.1.11
+ resolution: "@vitest/pretty-format@npm:4.1.11"
+ dependencies:
+ tinyrainbow: "npm:^3.1.0"
+ checksum: 10c0/ad32525c73807c0b72f38dc29bc51fd5a17879dc650f37995a9c5adbb8526e15f787691f76aa8768448ec7ed5bf5ba2b12329eac8fda1428b4d6b8c036390f71
+ languageName: node
+ linkType: hard
+
+"@vitest/runner@npm:4.1.11":
+ version: 4.1.11
+ resolution: "@vitest/runner@npm:4.1.11"
+ dependencies:
+ "@vitest/utils": "npm:4.1.11"
+ pathe: "npm:^2.0.3"
+ checksum: 10c0/3c782b055e9e688e1785f7c8937bd1669bad1b0e5758cb8b844f918f30a324b1d21e174d46c941ce80ebf37f2b89b55b6d619a675025914a1ece6377b95909e2
+ languageName: node
+ linkType: hard
+
+"@vitest/snapshot@npm:4.1.11":
+ version: 4.1.11
+ resolution: "@vitest/snapshot@npm:4.1.11"
+ dependencies:
+ "@vitest/pretty-format": "npm:4.1.11"
+ "@vitest/utils": "npm:4.1.11"
+ magic-string: "npm:^0.30.21"
+ pathe: "npm:^2.0.3"
+ checksum: 10c0/35d82a7c2a3e4b57529c30387d568d9106b6bf960189214e5d8cb1f5288cb042305c2e5c7b0b2f8cb56a2c814973de0310bc56d72deb79427bea272b6224190c
+ languageName: node
+ linkType: hard
+
+"@vitest/spy@npm:4.1.11":
+ version: 4.1.11
+ resolution: "@vitest/spy@npm:4.1.11"
+ checksum: 10c0/06c68247a8efd21006abe7532fee17f30ba83c8cda3e0b952ef89e278d58058f4b1de69b6bbaa2ed614c568bf4f5769fcc76be42802dedf2bcdd9c0aae601740
+ languageName: node
+ linkType: hard
+
+"@vitest/utils@npm:4.1.11":
+ version: 4.1.11
+ resolution: "@vitest/utils@npm:4.1.11"
+ dependencies:
+ "@vitest/pretty-format": "npm:4.1.11"
+ convert-source-map: "npm:^2.0.0"
+ tinyrainbow: "npm:^3.1.0"
+ checksum: 10c0/a2c1ddc64333458c3e031465c1ee0440a7660fd1b298c54ccbf865ef1e5cf3ebdd6c5c75a5ea235d8a672498b394e7121f992b096f021f45014ab25e9abd1b52
+ languageName: node
+ linkType: hard
+
+"abbrev@npm:^5.0.0":
+ version: 5.0.0
+ resolution: "abbrev@npm:5.0.0"
+ checksum: 10c0/8e88f5c798ea4562d28c5a3e9ad69e3879890bc5d695d8f2dffb8609be4c890aacc8f80ef4553fdd2c6a62d70c2ce8bc57b38074e383beb7487bdafa9ed42ea5
+ languageName: node
+ linkType: hard
+
+"agent-base@npm:6":
+ version: 6.0.2
+ resolution: "agent-base@npm:6.0.2"
+ dependencies:
+ debug: "npm:4"
+ checksum: 10c0/dc4f757e40b5f3e3d674bc9beb4f1048f4ee83af189bae39be99f57bf1f48dde166a8b0a5342a84b5944ee8e6ed1e5a9d801858f4ad44764e84957122fe46261
+ languageName: node
+ linkType: hard
+
+"ansi-escapes@npm:^7.3.0":
+ version: 7.3.0
+ resolution: "ansi-escapes@npm:7.3.0"
+ dependencies:
+ environment: "npm:^1.0.0"
+ checksum: 10c0/068961d99f0ef28b661a4a9f84a5d645df93ccf3b9b93816cc7d46bbe1913321d4cdf156bb842a4e1e4583b7375c631fa963efb43001c4eb7ff9ab8f78fc0679
+ languageName: node
+ linkType: hard
+
+"ansi-regex@npm:^6.2.2":
+ version: 6.3.0
+ resolution: "ansi-regex@npm:6.3.0"
+ checksum: 10c0/bc047786d0531f1f22d1e22e9863e8554488a399f1ee5270b753efa6de938a788d27456f2b256770f11fdd8b1e847483bc1b55ddc2b3ffe82ec45c875292c651
+ languageName: node
+ linkType: hard
+
+"ansi-styles@npm:^6.2.1, ansi-styles@npm:^6.2.3":
+ version: 6.2.3
+ resolution: "ansi-styles@npm:6.2.3"
+ checksum: 10c0/23b8a4ce14e18fb854693b95351e286b771d23d8844057ed2e7d083cd3e708376c3323707ec6a24365f7d7eda3ca00327fe04092e29e551499ec4c8b7bfac868
+ languageName: node
+ linkType: hard
+
+"assertion-error@npm:^2.0.1":
+ version: 2.0.1
+ resolution: "assertion-error@npm:2.0.1"
+ checksum: 10c0/bbbcb117ac6480138f8c93cf7f535614282dea9dc828f540cdece85e3c665e8f78958b96afac52f29ff883c72638e6a87d469ecc9fe5bc902df03ed24a55dba8
+ languageName: node
+ linkType: hard
+
+"async-function@npm:^1.0.0":
+ version: 1.0.0
+ resolution: "async-function@npm:1.0.0"
+ checksum: 10c0/669a32c2cb7e45091330c680e92eaeb791bc1d4132d827591e499cd1f776ff5a873e77e5f92d0ce795a8d60f10761dec9ddfe7225a5de680f5d357f67b1aac73
+ languageName: node
+ linkType: hard
+
+"async-generator-function@npm:^1.0.0":
+ version: 1.0.0
+ resolution: "async-generator-function@npm:1.0.0"
+ checksum: 10c0/2c50ef856c543ad500d8d8777d347e3c1ba623b93e99c9263ecc5f965c1b12d2a140e2ab6e43c3d0b85366110696f28114649411cbcd10b452a92a2318394186
+ languageName: node
+ linkType: hard
+
+"async-limiter@npm:~1.0.0":
+ version: 1.0.1
+ resolution: "async-limiter@npm:1.0.1"
+ checksum: 10c0/0693d378cfe86842a70d4c849595a0bb50dc44c11649640ca982fa90cbfc74e3cc4753b5a0847e51933f2e9c65ce8e05576e75e5e1fd963a086e673735b35969
+ languageName: node
+ linkType: hard
+
+"asynckit@npm:^0.4.0":
+ version: 0.4.0
+ resolution: "asynckit@npm:0.4.0"
+ checksum: 10c0/d73e2ddf20c4eb9337e1b3df1a0f6159481050a5de457c55b14ea2e5cb6d90bb69e004c9af54737a5ee0917fcf2c9e25de67777bbe58261847846066ba75bc9d
+ languageName: node
+ linkType: hard
+
+"auto-bind@npm:^5.0.1":
+ version: 5.0.1
+ resolution: "auto-bind@npm:5.0.1"
+ checksum: 10c0/a703375350ea7b6e92405d8e6bcc6dbfb84b0d7c7172b33e5788a7593929a18227999ff9aa9c32436741d06d021e6672457b1cec73287efe3fab95cff6627eaf
+ languageName: node
+ linkType: hard
+
+"axios@npm:^1.16.0":
+ version: 1.20.0
+ resolution: "axios@npm:1.20.0"
+ dependencies:
+ follow-redirects: "npm:^1.16.0"
+ form-data: "npm:^4.0.6"
+ https-proxy-agent: "npm:^5.0.1"
+ proxy-from-env: "npm:^2.1.0"
+ checksum: 10c0/976088acf532286356f4c2e65df1ef47ba7da3936d83e928d0d64357bbf5370456abd3eb5826c15df322335fcb1fe200d4a84b4fcf20ffccdd63b40d80fa495c
+ languageName: node
+ linkType: hard
+
+"backo2@npm:^1.0.2":
+ version: 1.0.2
+ resolution: "backo2@npm:1.0.2"
+ checksum: 10c0/a9e825a6a38a6d1c4a94476eabc13d6127dfaafb0967baf104affbb67806ae26abbb58dab8d572d2cd21ef06634ff57c3ad48dff14b904e18de1474cc2f22bf3
+ languageName: node
+ linkType: hard
+
+"call-bind-apply-helpers@npm:^1.0.1, call-bind-apply-helpers@npm:^1.0.2":
+ version: 1.0.2
+ resolution: "call-bind-apply-helpers@npm:1.0.2"
+ dependencies:
+ es-errors: "npm:^1.3.0"
+ function-bind: "npm:^1.1.2"
+ checksum: 10c0/47bd9901d57b857590431243fea704ff18078b16890a6b3e021e12d279bbf211d039155e27d7566b374d49ee1f8189344bac9833dec7a20cdec370506361c938
+ languageName: node
+ linkType: hard
+
+"chai@npm:^6.2.2":
+ version: 6.2.2
+ resolution: "chai@npm:6.2.2"
+ checksum: 10c0/e6c69e5f0c11dffe6ea13d0290936ebb68fcc1ad688b8e952e131df6a6d5797d5e860bc55cef1aca2e950c3e1f96daf79e9d5a70fb7dbaab4e46355e2635ed53
+ languageName: node
+ linkType: hard
+
+"chalk@npm:^5.3.0, chalk@npm:^5.6.0":
+ version: 5.6.2
+ resolution: "chalk@npm:5.6.2"
+ checksum: 10c0/99a4b0f0e7991796b1e7e3f52dceb9137cae2a9dfc8fc0784a550dc4c558e15ab32ed70b14b21b52beb2679b4892b41a0aa44249bcb996f01e125d58477c6976
+ languageName: node
+ linkType: hard
+
+"chardet@npm:^2.1.1":
+ version: 2.2.0
+ resolution: "chardet@npm:2.2.0"
+ checksum: 10c0/8d43a1dd3ce535aa070d04139fae62f879b4388394eb1d857364ce416675a1f0f63974fba8208e9cd11b49e1a6da3e65ea6393d0fc654a8c4217c0d74c16b1b4
+ languageName: node
+ linkType: hard
+
+"chokidar@npm:^4.0.0":
+ version: 4.0.3
+ resolution: "chokidar@npm:4.0.3"
+ dependencies:
+ readdirp: "npm:^4.0.1"
+ checksum: 10c0/a58b9df05bb452f7d105d9e7229ac82fa873741c0c40ddcc7bb82f8a909fbe3f7814c9ebe9bc9a2bef9b737c0ec6e2d699d179048ef06ad3ec46315df0ebe6ad
+ languageName: node
+ linkType: hard
+
+"chownr@npm:^3.0.0":
+ version: 3.0.0
+ resolution: "chownr@npm:3.0.0"
+ checksum: 10c0/43925b87700f7e3893296c8e9c56cc58f926411cce3a6e5898136daaf08f08b9a8eb76d37d3267e707d0dcc17aed2e2ebdf5848c0c3ce95cf910a919935c1b10
+ languageName: node
+ linkType: hard
+
+"cli-boxes@npm:^3.0.0":
+ version: 3.0.0
+ resolution: "cli-boxes@npm:3.0.0"
+ checksum: 10c0/4db3e8fbfaf1aac4fb3a6cbe5a2d3fa048bee741a45371b906439b9ffc821c6e626b0f108bdcd3ddf126a4a319409aedcf39a0730573ff050fdd7b6731e99fb9
+ languageName: node
+ linkType: hard
+
+"cli-cursor@npm:^4.0.0":
+ version: 4.0.0
+ resolution: "cli-cursor@npm:4.0.0"
+ dependencies:
+ restore-cursor: "npm:^4.0.0"
+ checksum: 10c0/e776e8c3c6727300d0539b0d25160b2bb56aed1a63942753ba1826b012f337a6f4b7ace3548402e4f2f13b5e16bfd751be672c44b203205e7eca8be94afec42c
+ languageName: node
+ linkType: hard
+
+"cli-truncate@npm:^5.1.1":
+ version: 5.2.0
+ resolution: "cli-truncate@npm:5.2.0"
+ dependencies:
+ slice-ansi: "npm:^8.0.0"
+ string-width: "npm:^8.2.0"
+ checksum: 10c0/0d4ec94702ca85b64522ac93633837fb5ea7db17b79b1322a60f6045e6ae2b8cd7bd4c1d19ac7d1f9e10e3bbda1112e172e439b68c02b785ee00da8d6a5c5471
+ languageName: node
+ linkType: hard
+
+"cli-width@npm:^4.1.0":
+ version: 4.1.0
+ resolution: "cli-width@npm:4.1.0"
+ checksum: 10c0/1fbd56413578f6117abcaf858903ba1f4ad78370a4032f916745fa2c7e390183a9d9029cf837df320b0fdce8137668e522f60a30a5f3d6529ff3872d265a955f
+ languageName: node
+ linkType: hard
+
+"clsx@npm:^2.1.1":
+ version: 2.1.1
+ resolution: "clsx@npm:2.1.1"
+ checksum: 10c0/c4c8eb865f8c82baab07e71bfa8897c73454881c4f99d6bc81585aecd7c441746c1399d08363dc096c550cceaf97bd4ce1e8854e1771e9998d9f94c4fe075839
+ languageName: node
+ linkType: hard
+
+"code-excerpt@npm:^4.0.0":
+ version: 4.0.0
+ resolution: "code-excerpt@npm:4.0.0"
+ dependencies:
+ convert-to-spaces: "npm:^2.0.1"
+ checksum: 10c0/b6c5a06e039cecd2ab6a0e10ee0831de8362107d1f298ca3558b5f9004cb8e0260b02dd6c07f57b9a0e346c76864d2873311ee1989809fdeb05bd5fbbadde773
+ languageName: node
+ linkType: hard
+
+"combined-stream@npm:^1.0.8":
+ version: 1.0.8
+ resolution: "combined-stream@npm:1.0.8"
+ dependencies:
+ delayed-stream: "npm:~1.0.0"
+ checksum: 10c0/0dbb829577e1b1e839fa82b40c07ffaf7de8a09b935cadd355a73652ae70a88b4320db322f6634a4ad93424292fa80973ac6480986247f1734a1137debf271d5
+ languageName: node
+ linkType: hard
+
+"commander@npm:^12.0.0":
+ version: 12.1.0
+ resolution: "commander@npm:12.1.0"
+ checksum: 10c0/6e1996680c083b3b897bfc1cfe1c58dfbcd9842fd43e1aaf8a795fbc237f65efcc860a3ef457b318e73f29a4f4a28f6403c3d653d021d960e4632dd45bde54a9
+ languageName: node
+ linkType: hard
+
+"convert-source-map@npm:^2.0.0":
+ version: 2.0.0
+ resolution: "convert-source-map@npm:2.0.0"
+ checksum: 10c0/8f2f7a27a1a011cc6cc88cc4da2d7d0cfa5ee0369508baae3d98c260bb3ac520691464e5bbe4ae7cdf09860c1d69ecc6f70c63c6e7c7f7e3f18ec08484dc7d9b
+ languageName: node
+ linkType: hard
+
+"convert-to-spaces@npm:^2.0.1":
+ version: 2.0.1
+ resolution: "convert-to-spaces@npm:2.0.1"
+ checksum: 10c0/d90aa0e3b6a27f9d5265a8d32def3c5c855b3e823a9db1f26d772f8146d6b91020a2fdfd905ce8048a73fad3aaf836fef8188c67602c374405e2ae8396c4ac46
+ languageName: node
+ linkType: hard
+
+"css-mediaquery@npm:^0.1.2":
+ version: 0.1.2
+ resolution: "css-mediaquery@npm:0.1.2"
+ checksum: 10c0/b7825a78f52ce8a8198e004fcad0d7be1d3c9a0463ecd05ba31a0f2c94fb81468ad6f4d7bf715a6ca775696e7a17500c2a339b5216a6d0f789cbf78f9454d048
+ languageName: node
+ linkType: hard
+
+"csstype@npm:^3.2.2":
+ version: 3.2.3
+ resolution: "csstype@npm:3.2.3"
+ checksum: 10c0/cd29c51e70fa822f1cecd8641a1445bed7063697469d35633b516e60fe8c1bde04b08f6c5b6022136bb669b64c63d4173af54864510fbb4ee23281801841a3ce
+ languageName: node
+ linkType: hard
+
+"debug@npm:4, debug@npm:^4.1.1":
+ version: 4.4.3
+ resolution: "debug@npm:4.4.3"
+ dependencies:
+ ms: "npm:^2.1.3"
+ peerDependenciesMeta:
+ supports-color:
+ optional: true
+ checksum: 10c0/d79136ec6c83ecbefd0f6a5593da6a9c91ec4d7ddc4b54c883d6e71ec9accb5f67a1a5e96d00a328196b5b5c86d365e98d8a3a70856aaf16b4e7b1985e67f5a6
+ languageName: node
+ linkType: hard
+
+"delayed-stream@npm:~1.0.0":
+ version: 1.0.0
+ resolution: "delayed-stream@npm:1.0.0"
+ checksum: 10c0/d758899da03392e6712f042bec80aa293bbe9e9ff1b2634baae6a360113e708b91326594c8a486d475c69d6259afb7efacdc3537bfcda1c6c648e390ce601b19
+ languageName: node
+ linkType: hard
+
+"detect-libc@npm:^2.0.3, detect-libc@npm:^2.1.2":
+ version: 2.1.2
+ resolution: "detect-libc@npm:2.1.2"
+ checksum: 10c0/acc675c29a5649fa1fb6e255f993b8ee829e510b6b56b0910666949c80c364738833417d0edb5f90e4e46be17228b0f2b66a010513984e18b15deeeac49369c4
+ languageName: node
+ linkType: hard
+
+"dunder-proto@npm:^1.0.1":
+ version: 1.0.1
+ resolution: "dunder-proto@npm:1.0.1"
+ dependencies:
+ call-bind-apply-helpers: "npm:^1.0.1"
+ es-errors: "npm:^1.3.0"
+ gopd: "npm:^1.2.0"
+ checksum: 10c0/199f2a0c1c16593ca0a145dbf76a962f8033ce3129f01284d48c45ed4e14fea9bbacd7b3610b6cdc33486cef20385ac054948fefc6272fcce645c09468f93031
+ languageName: node
+ linkType: hard
+
+"emoji-regex@npm:^10.3.0":
+ version: 10.6.0
+ resolution: "emoji-regex@npm:10.6.0"
+ checksum: 10c0/1e4aa097bb007301c3b4b1913879ae27327fdc48e93eeefefe3b87e495eb33c5af155300be951b4349ff6ac084f4403dc9eff970acba7c1c572d89396a9a32d7
+ languageName: node
+ linkType: hard
+
+"env-paths@npm:^2.2.0":
+ version: 2.2.1
+ resolution: "env-paths@npm:2.2.1"
+ checksum: 10c0/285325677bf00e30845e330eec32894f5105529db97496ee3f598478e50f008c5352a41a30e5e72ec9de8a542b5a570b85699cd63bd2bc646dbcb9f311d83bc4
+ languageName: node
+ linkType: hard
+
+"environment@npm:^1.0.0":
+ version: 1.1.0
+ resolution: "environment@npm:1.1.0"
+ checksum: 10c0/fb26434b0b581ab397039e51ff3c92b34924a98b2039dcb47e41b7bca577b9dbf134a8eadb364415c74464b682e2d3afe1a4c0eb9873dc44ea814c5d3103331d
+ languageName: node
+ linkType: hard
+
+"es-define-property@npm:^1.0.1":
+ version: 1.0.1
+ resolution: "es-define-property@npm:1.0.1"
+ checksum: 10c0/3f54eb49c16c18707949ff25a1456728c883e81259f045003499efba399c08bad00deebf65cccde8c0e07908c1a225c9d472b7107e558f2a48e28d530e34527c
+ languageName: node
+ linkType: hard
+
+"es-errors@npm:^1.3.0":
+ version: 1.3.0
+ resolution: "es-errors@npm:1.3.0"
+ checksum: 10c0/0a61325670072f98d8ae3b914edab3559b6caa980f08054a3b872052640d91da01d38df55df797fcc916389d77fc92b8d5906cf028f4db46d7e3003abecbca85
+ languageName: node
+ linkType: hard
+
+"es-module-lexer@npm:^2.0.0":
+ version: 2.3.2
+ resolution: "es-module-lexer@npm:2.3.2"
+ checksum: 10c0/5e7389424c43478439f12f9a6aca1750f6f99afa384fc3de329f4a45f152ab156671055008adaafc74960877abf8cc338aeebf6bed8c21297b146fd6eb7a22f8
+ languageName: node
+ linkType: hard
+
+"es-object-atoms@npm:^1.0.0, es-object-atoms@npm:^1.1.1":
+ version: 1.1.2
+ resolution: "es-object-atoms@npm:1.1.2"
+ dependencies:
+ es-errors: "npm:^1.3.0"
+ checksum: 10c0/1772861f094f739d6f41b579cfb9a18579daffeb434552a370a5fbef50a32d22227e27b63fdbb757b7ddd429d1b42fe52ccae7966d9302a2ec221b6f1b41bbc4
+ languageName: node
+ linkType: hard
+
+"es-set-tostringtag@npm:^2.1.0":
+ version: 2.1.0
+ resolution: "es-set-tostringtag@npm:2.1.0"
+ dependencies:
+ es-errors: "npm:^1.3.0"
+ get-intrinsic: "npm:^1.2.6"
+ has-tostringtag: "npm:^1.0.2"
+ hasown: "npm:^2.0.2"
+ checksum: 10c0/ef2ca9ce49afe3931cb32e35da4dcb6d86ab02592cfc2ce3e49ced199d9d0bb5085fc7e73e06312213765f5efa47cc1df553a6a5154584b21448e9fb8355b1af
+ languageName: node
+ linkType: hard
+
+"es-toolkit@npm:^1.39.10":
+ version: 1.52.0
+ resolution: "es-toolkit@npm:1.52.0"
+ dependenciesMeta:
+ "@trivago/[email protected]":
+ unplugged: true
+ unplugged: true
+ unplugged: true
+ checksum: 10c0/465988c0a6b84b6d1d171287cbbe40c3247a1f94acea210ae14bc66b7d90c93e6839bd6937cbaf2a1d206669f3179eb26141a89d9125969a4b8e58cb7d86a2ca
+ languageName: node
+ linkType: hard
+
+"esbuild@npm:^0.28.1":
+ version: 0.28.2
+ resolution: "esbuild@npm:0.28.2"
+ dependencies:
+ "@esbuild/aix-ppc64": "npm:0.28.2"
+ "@esbuild/android-arm": "npm:0.28.2"
+ "@esbuild/android-arm64": "npm:0.28.2"
+ "@esbuild/android-x64": "npm:0.28.2"
+ "@esbuild/darwin-arm64": "npm:0.28.2"
+ "@esbuild/darwin-x64": "npm:0.28.2"
+ "@esbuild/freebsd-arm64": "npm:0.28.2"
+ "@esbuild/freebsd-x64": "npm:0.28.2"
+ "@esbuild/linux-arm": "npm:0.28.2"
+ "@esbuild/linux-arm64": "npm:0.28.2"
+ "@esbuild/linux-ia32": "npm:0.28.2"
+ "@esbuild/linux-loong64": "npm:0.28.2"
+ "@esbuild/linux-mips64el": "npm:0.28.2"
+ "@esbuild/linux-ppc64": "npm:0.28.2"
+ "@esbuild/linux-riscv64": "npm:0.28.2"
+ "@esbuild/linux-s390x": "npm:0.28.2"
+ "@esbuild/linux-x64": "npm:0.28.2"
+ "@esbuild/netbsd-arm64": "npm:0.28.2"
+ "@esbuild/netbsd-x64": "npm:0.28.2"
+ "@esbuild/openbsd-arm64": "npm:0.28.2"
+ "@esbuild/openbsd-x64": "npm:0.28.2"
+ "@esbuild/openharmony-arm64": "npm:0.28.2"
+ "@esbuild/sunos-x64": "npm:0.28.2"
+ "@esbuild/win32-arm64": "npm:0.28.2"
+ "@esbuild/win32-ia32": "npm:0.28.2"
+ "@esbuild/win32-x64": "npm:0.28.2"
+ dependenciesMeta:
+ "@esbuild/aix-ppc64":
+ optional: true
+ "@esbuild/android-arm":
+ optional: true
+ "@esbuild/android-arm64":
+ optional: true
+ "@esbuild/android-x64":
+ optional: true
+ "@esbuild/darwin-arm64":
+ optional: true
+ "@esbuild/darwin-x64":
+ optional: true
+ "@esbuild/freebsd-arm64":
+ optional: true
+ "@esbuild/freebsd-x64":
+ optional: true
+ "@esbuild/linux-arm":
+ optional: true
+ "@esbuild/linux-arm64":
+ optional: true
+ "@esbuild/linux-ia32":
+ optional: true
+ "@esbuild/linux-loong64":
+ optional: true
+ "@esbuild/linux-mips64el":
+ optional: true
+ "@esbuild/linux-ppc64":
+ optional: true
+ "@esbuild/linux-riscv64":
+ optional: true
+ "@esbuild/linux-s390x":
+ optional: true
+ "@esbuild/linux-x64":
+ optional: true
+ "@esbuild/netbsd-arm64":
+ optional: true
+ "@esbuild/netbsd-x64":
+ optional: true
+ "@esbuild/openbsd-arm64":
+ optional: true
+ "@esbuild/openbsd-x64":
+ optional: true
+ "@esbuild/openharmony-arm64":
+ optional: true
+ "@esbuild/sunos-x64":
+ optional: true
+ "@esbuild/win32-arm64":
+ optional: true
+ "@esbuild/win32-ia32":
+ optional: true
+ "@esbuild/win32-x64":
+ optional: true
+ bin:
+ esbuild: bin/esbuild
+ checksum: 10c0/9b19edb63bd7780fd2e8e65a1394a0e8a05a17d697f73f0647ffe3c134709d8dbe744ab3fd57b35c9470db268cae7678fafd3dcd3ce1f34fc590568c2433f5d2
+ languageName: node
+ linkType: hard
+
+"escape-string-regexp@npm:^2.0.0":
+ version: 2.0.0
+ resolution: "escape-string-regexp@npm:2.0.0"
+ checksum: 10c0/2530479fe8db57eace5e8646c9c2a9c80fa279614986d16dcc6bcaceb63ae77f05a851ba6c43756d816c61d7f4534baf56e3c705e3e0d884818a46808811c507
+ languageName: node
+ linkType: hard
+
+"estree-walker@npm:^3.0.3":
+ version: 3.0.3
+ resolution: "estree-walker@npm:3.0.3"
+ dependencies:
+ "@types/estree": "npm:^1.0.0"
+ checksum: 10c0/c12e3c2b2642d2bcae7d5aa495c60fa2f299160946535763969a1c83fc74518ffa9c2cd3a8b69ac56aea547df6a8aac25f729a342992ef0bbac5f1c73e78995d
+ languageName: node
+ linkType: hard
+
+"eventemitter3@npm:^3.1.0":
+ version: 3.1.2
+ resolution: "eventemitter3@npm:3.1.2"
+ checksum: 10c0/c67262eccbf85848b7cc6d4abb6c6e34155e15686db2a01c57669fd0d44441a574a19d44d25948b442929e065774cbe5003d8e77eed47674fbf876ac77887793
+ languageName: node
+ linkType: hard
+
+"expect-type@npm:^1.3.0":
+ version: 1.4.0
+ resolution: "expect-type@npm:1.4.0"
+ checksum: 10c0/d40d76b8570695d36587beb3cc28494da2ca3ec8f04e67f5622ed2d372d850e401a9adef19c6835e1a8173903f157c79540b34c7b3fbd7cd8ce726cc903c57b7
+ languageName: node
+ linkType: hard
+
+"exponential-backoff@npm:^3.1.1":
+ version: 3.1.3
+ resolution: "exponential-backoff@npm:3.1.3"
+ checksum: 10c0/77e3ae682b7b1f4972f563c6dbcd2b0d54ac679e62d5d32f3e5085feba20483cf28bd505543f520e287a56d4d55a28d7874299941faf637e779a1aa5994d1267
+ languageName: node
+ linkType: hard
+
+"fast-string-truncated-width@npm:^3.0.2":
+ version: 3.0.3
+ resolution: "fast-string-truncated-width@npm:3.0.3"
+ checksum: 10c0/043b8663397d14a3880ce4f3407bcda60b40db9bbeafe62863a35d1f9c69ea17c8da3fcd72de235553e6c9cd053128cde9e24ca0d4a7463208f48db3cd23d981
+ languageName: node
+ linkType: hard
+
+"fast-string-width@npm:^3.0.2":
+ version: 3.0.2
+ resolution: "fast-string-width@npm:3.0.2"
+ dependencies:
+ fast-string-truncated-width: "npm:^3.0.2"
+ checksum: 10c0/c8822d175315bb353ebe782b65214ac53b13e3bf704e03b132ea7bdfa8de6a636375b3ab7a4097545393d109381c37c4f387c72a462c90b61412dbc4632f39a7
+ languageName: node
+ linkType: hard
+
+"fast-wrap-ansi@npm:^0.2.0":
+ version: 0.2.2
+ resolution: "fast-wrap-ansi@npm:0.2.2"
+ dependencies:
+ fast-string-width: "npm:^3.0.2"
+ checksum: 10c0/1aa7be4f7cb86f4bdb14691cb6bcc0b8df8b3b89df142ade3ae1602332dcf6f990cd750a923cd581ca0847808cb4ec1aa5afaafa7a72f849e87a2a62c98fa370
+ languageName: node
+ linkType: hard
+
+"fdir@npm:^6.5.0":
+ version: 6.5.0
+ resolution: "fdir@npm:6.5.0"
+ peerDependencies:
+ picomatch: ^3 || ^4
+ peerDependenciesMeta:
+ picomatch:
+ optional: true
+ checksum: 10c0/e345083c4306b3aed6cb8ec551e26c36bab5c511e99ea4576a16750ddc8d3240e63826cc624f5ae17ad4dc82e68a253213b60d556c11bfad064b7607847ed07f
+ languageName: node
+ linkType: hard
+
+"follow-redirects@npm:^1.16.0":
+ version: 1.16.0
+ resolution: "follow-redirects@npm:1.16.0"
+ peerDependenciesMeta:
+ debug:
+ optional: true
+ checksum: 10c0/a1e2900163e6f1b4d1ed5c221b607f41decbab65534c63fe7e287e40a5d552a6496e7d9d7d976fa4ba77b4c51c11e5e9f683f10b43011ea11e442ff128d0e181
+ languageName: node
+ linkType: hard
+
+"form-data@npm:^4.0.6":
+ version: 4.0.6
+ resolution: "form-data@npm:4.0.6"
+ dependencies:
+ asynckit: "npm:^0.4.0"
+ combined-stream: "npm:^1.0.8"
+ es-set-tostringtag: "npm:^2.1.0"
+ hasown: "npm:^2.0.4"
+ mime-types: "npm:^2.1.35"
+ checksum: 10c0/43947a77bf0ff45c6ceed789778982d47a3f3e720a74b71721174ebf3310a5f1a8be1d6b38a3ee3688e8a18a2c4273073ec0844cd37efda3eaf46d41c9c318ff
+ languageName: node
+ linkType: hard
+
+"fsevents@npm:~2.3.3":
+ version: 2.3.3
+ resolution: "fsevents@npm:2.3.3"
+ dependencies:
+ node-gyp: "npm:latest"
+ checksum: 10c0/a1f0c44595123ed717febbc478aa952e47adfc28e2092be66b8ab1635147254ca6cfe1df792a8997f22716d4cbafc73309899ff7bfac2ac3ad8cf2e4ecc3ec60
+ conditions: os=darwin
+ languageName: node
+ linkType: hard
+
+"fsevents@patch:fsevents@npm%3A~2.3.3#optional!builtin<compat/fsevents>":
+ version: 2.3.3
+ resolution: "fsevents@patch:fsevents@npm%3A2.3.3#optional!builtin<compat/fsevents>::version=2.3.3&hash=df0bf1"
+ dependencies:
+ node-gyp: "npm:latest"
+ conditions: os=darwin
+ languageName: node
+ linkType: hard
+
+"function-bind@npm:^1.1.2":
+ version: 1.1.2
+ resolution: "function-bind@npm:1.1.2"
+ checksum: 10c0/d8680ee1e5fcd4c197e4ac33b2b4dce03c71f4d91717292785703db200f5c21f977c568d28061226f9b5900cbcd2c84463646134fd5337e7925e0942bc3f46d5
+ languageName: node
+ linkType: hard
+
+"generator-function@npm:^2.0.0":
+ version: 2.0.1
+ resolution: "generator-function@npm:2.0.1"
+ checksum: 10c0/8a9f59df0f01cfefafdb3b451b80555e5cf6d76487095db91ac461a0e682e4ff7a9dbce15f4ecec191e53586d59eece01949e05a4b4492879600bbbe8e28d6b8
+ languageName: node
+ linkType: hard
+
+"get-east-asian-width@npm:^1.0.0, get-east-asian-width@npm:^1.3.1, get-east-asian-width@npm:^1.5.0":
+ version: 1.6.0
+ resolution: "get-east-asian-width@npm:1.6.0"
+ checksum: 10c0/7e72e9550fd49ca5b246f9af6bb2afc129c96412845ff6556b3274fd44817a381702ca17028efe9866b261a3d44254cbf21e6c90cf05b4b61675630af776d431
+ languageName: node
+ linkType: hard
+
+"get-intrinsic@npm:^1.2.6":
+ version: 1.3.1
+ resolution: "get-intrinsic@npm:1.3.1"
+ dependencies:
+ async-function: "npm:^1.0.0"
+ async-generator-function: "npm:^1.0.0"
+ call-bind-apply-helpers: "npm:^1.0.2"
+ es-define-property: "npm:^1.0.1"
+ es-errors: "npm:^1.3.0"
+ es-object-atoms: "npm:^1.1.1"
+ function-bind: "npm:^1.1.2"
+ generator-function: "npm:^2.0.0"
+ get-proto: "npm:^1.0.1"
+ gopd: "npm:^1.2.0"
+ has-symbols: "npm:^1.1.0"
+ hasown: "npm:^2.0.2"
+ math-intrinsics: "npm:^1.1.0"
+ checksum: 10c0/9f4ab0cf7efe0fd2c8185f52e6f637e708f3a112610c88869f8f041bb9ecc2ce44bf285dfdbdc6f4f7c277a5b88d8e94a432374d97cca22f3de7fc63795deb5d
+ languageName: node
+ linkType: hard
+
+"get-proto@npm:^1.0.1":
+ version: 1.0.1
+ resolution: "get-proto@npm:1.0.1"
+ dependencies:
+ dunder-proto: "npm:^1.0.1"
+ es-object-atoms: "npm:^1.0.0"
+ checksum: 10c0/9224acb44603c5526955e83510b9da41baf6ae73f7398875fba50edc5e944223a89c4a72b070fcd78beb5f7bdda58ecb6294adc28f7acfc0da05f76a2399643c
+ languageName: node
+ linkType: hard
+
+"globrex@npm:^0.1.2":
+ version: 0.1.2
+ resolution: "globrex@npm:0.1.2"
+ checksum: 10c0/a54c029520cf58bda1d8884f72bd49b4cd74e977883268d931fd83bcbd1a9eb96d57c7dbd4ad80148fb9247467ebfb9b215630b2ed7563b2a8de02e1ff7f89d1
+ languageName: node
+ linkType: hard
+
+"gopd@npm:^1.2.0":
+ version: 1.2.0
+ resolution: "gopd@npm:1.2.0"
+ checksum: 10c0/50fff1e04ba2b7737c097358534eacadad1e68d24cccee3272e04e007bed008e68d2614f3987788428fd192a5ae3889d08fb2331417e4fc4a9ab366b2043cead
+ languageName: node
+ linkType: hard
+
+"graceful-fs@npm:^4.2.6":
+ version: 4.2.11
+ resolution: "graceful-fs@npm:4.2.11"
+ checksum: 10c0/386d011a553e02bc594ac2ca0bd6d9e4c22d7fa8cfbfc448a6d148c59ea881b092db9dbe3547ae4b88e55f1b01f7c4a2ecc53b310c042793e63aa44cf6c257f2
+ languageName: node
+ linkType: hard
+
+"graphql-query-batcher@npm:^1.0.1":
+ version: 1.0.1
+ resolution: "graphql-query-batcher@npm:1.0.1"
+ checksum: 10c0/804d0f4064721a2116a16b9eac422e9233e85f4ab5b250cb8f83662725658ffde35779a8ae8211037f3dd2f9717de8cb63b394ad8057ce22171a83db2471196a
+ languageName: node
+ linkType: hard
+
+"graphql-sse@npm:^2.5.4":
+ version: 2.6.1
+ resolution: "graphql-sse@npm:2.6.1"
+ peerDependencies:
+ graphql: ">=0.11 <=17"
+ checksum: 10c0/8a767b83c970dea75db634b27cd28d5040d6e7b07234c38919bc88d15eacf978171e380ba8ab3fa21a1779421e24b8e19dc51a798a90c5766382c406b3d6c221
+ languageName: node
+ linkType: hard
+
+"graphql@npm:^16.8.1":
+ version: 16.14.2
+ resolution: "graphql@npm:16.14.2"
+ checksum: 10c0/a95a96961eaff55cc9fe9d31fae6f33499ac988b972d07ea5085024cb1333f515b902f376e7393a5489aa82200a8aff3eb96580e4d1b69d702ed19b6eb1ce97a
+ languageName: node
+ linkType: hard
+
+"has-symbols@npm:^1.0.3, has-symbols@npm:^1.1.0":
+ version: 1.1.0
+ resolution: "has-symbols@npm:1.1.0"
+ checksum: 10c0/dde0a734b17ae51e84b10986e651c664379018d10b91b6b0e9b293eddb32f0f069688c841fb40f19e9611546130153e0a2a48fd7f512891fb000ddfa36f5a20e
+ languageName: node
+ linkType: hard
+
+"has-tostringtag@npm:^1.0.2":
+ version: 1.0.2
+ resolution: "has-tostringtag@npm:1.0.2"
+ dependencies:
+ has-symbols: "npm:^1.0.3"
+ checksum: 10c0/a8b166462192bafe3d9b6e420a1d581d93dd867adb61be223a17a8d6dad147aa77a8be32c961bb2f27b3ef893cae8d36f564ab651f5e9b7938ae86f74027c48c
+ languageName: node
+ linkType: hard
+
+"hasown@npm:^2.0.2, hasown@npm:^2.0.4":
+ version: 2.0.4
+ resolution: "hasown@npm:2.0.4"
+ dependencies:
+ function-bind: "npm:^1.1.2"
+ checksum: 10c0/2d8de939e270b70618f8cebb69746620db10617dbb495bc66ddad326955ea24d3ca4af133aff3eb7c1853e0218f867bc2b050ec26fe02e3aea58f880ffc5e506
+ languageName: node
+ linkType: hard
+
+"https-proxy-agent@npm:^5.0.1":
+ version: 5.0.1
+ resolution: "https-proxy-agent@npm:5.0.1"
+ dependencies:
+ agent-base: "npm:6"
+ debug: "npm:4"
+ checksum: 10c0/6dd639f03434003577c62b27cafdb864784ef19b2de430d8ae2a1d45e31c4fd60719e5637b44db1a88a046934307da7089e03d6089ec3ddacc1189d8de8897d1
+ languageName: node
+ linkType: hard
+
+"hyphenate-style-name@npm:^1.0.0":
+ version: 1.1.0
+ resolution: "hyphenate-style-name@npm:1.1.0"
+ checksum: 10c0/bfe88deac2414a41a0d08811e277c8c098f23993d6a1eb17f14a0f11b54c4d42865a63d3cfe1914668eefb9a188e2de58f38b55a179a238fd1fef606893e194f
+ languageName: node
+ linkType: hard
+
+"iconv-lite@npm:^0.7.2":
+ version: 0.7.3
+ resolution: "iconv-lite@npm:0.7.3"
+ dependencies:
+ safer-buffer: "npm:>= 2.1.2 < 3.0.0"
+ checksum: 10c0/be2fd2414f7e94be3a63063fa0ad5919c16bc7b6e00c77eea0765ced6db405739f38dd51016583058fba25cc1d0106ba30b83fbb7a7e32f824d4db76f23d8d33
+ languageName: node
+ linkType: hard
+
+"indent-string@npm:^5.0.0":
+ version: 5.0.0
+ resolution: "indent-string@npm:5.0.0"
+ checksum: 10c0/8ee77b57d92e71745e133f6f444d6fa3ed503ad0e1bcd7e80c8da08b42375c07117128d670589725ed07b1978065803fa86318c309ba45415b7fe13e7f170220
+ languageName: node
+ linkType: hard
+
+"ink@npm:^6.8.0":
+ version: 6.8.0
+ resolution: "ink@npm:6.8.0"
+ dependencies:
+ "@alcalzone/ansi-tokenize": "npm:^0.2.4"
+ ansi-escapes: "npm:^7.3.0"
+ ansi-styles: "npm:^6.2.1"
+ auto-bind: "npm:^5.0.1"
+ chalk: "npm:^5.6.0"
+ cli-boxes: "npm:^3.0.0"
+ cli-cursor: "npm:^4.0.0"
+ cli-truncate: "npm:^5.1.1"
+ code-excerpt: "npm:^4.0.0"
+ es-toolkit: "npm:^1.39.10"
+ indent-string: "npm:^5.0.0"
+ is-in-ci: "npm:^2.0.0"
+ patch-console: "npm:^2.0.0"
+ react-reconciler: "npm:^0.33.0"
+ scheduler: "npm:^0.27.0"
+ signal-exit: "npm:^3.0.7"
+ slice-ansi: "npm:^8.0.0"
+ stack-utils: "npm:^2.0.6"
+ string-width: "npm:^8.1.1"
+ terminal-size: "npm:^4.0.1"
+ type-fest: "npm:^5.4.1"
+ widest-line: "npm:^6.0.0"
+ wrap-ansi: "npm:^9.0.0"
+ ws: "npm:^8.18.0"
+ yoga-layout: "npm:~3.2.1"
+ peerDependencies:
+ "@types/react": ">=19.0.0"
+ react: ">=19.0.0"
+ react-devtools-core: ">=6.1.2"
+ peerDependenciesMeta:
+ "@types/react":
+ optional: true
+ react-devtools-core:
+ optional: true
+ checksum: 10c0/50500e547fdf6a1f1d836d6befbd4770e3ab649ef0be1884500a6da411fb68a90e22dd7dcc9c404911d30e9f87506b3b9d8e997c6c6ceac85ee054b4dadefaff
+ languageName: node
+ linkType: hard
+
+"inquirer@npm:^14.0.0":
+ version: 14.2.1
+ resolution: "inquirer@npm:14.2.1"
+ dependencies:
+ "@inquirer/ansi": "npm:^2.0.8"
+ "@inquirer/core": "npm:^12.0.2"
+ "@inquirer/prompts": "npm:^8.7.1"
+ "@inquirer/type": "npm:4.1.1"
+ mute-stream: "npm:^3.0.0"
+ run-async: "npm:^4.0.6"
+ peerDependencies:
+ "@types/node": ">=18"
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/7a1390fe1fff0274f262338c891f6e508f61fbbe8e3586c9eeeca6f087c22cfde21fcb06f3c7a49c3b32ba446635747ad468fa881702d256c56a4de8893c23cb
+ languageName: node
+ linkType: hard
+
+"is-fullwidth-code-point@npm:^5.0.0, is-fullwidth-code-point@npm:^5.1.0":
+ version: 5.1.0
+ resolution: "is-fullwidth-code-point@npm:5.1.0"
+ dependencies:
+ get-east-asian-width: "npm:^1.3.1"
+ checksum: 10c0/c1172c2e417fb73470c56c431851681591f6a17233603a9e6f94b7ba870b2e8a5266506490573b607fb1081318589372034aa436aec07b465c2029c0bc7f07a4
+ languageName: node
+ linkType: hard
+
+"is-in-ci@npm:^2.0.0":
+ version: 2.0.0
+ resolution: "is-in-ci@npm:2.0.0"
+ bin:
+ is-in-ci: cli.js
+ checksum: 10c0/1e1d1056939a681e8206035de5ad84e0404556eaa7622bb55f0f1868b9788bff3df427bc0b1ed5a172623154a90fcb1e759a230817cd73d09435543ae3c71feb
+ languageName: node
+ linkType: hard
+
+"isexe@npm:^4.0.0":
+ version: 4.0.0
+ resolution: "isexe@npm:4.0.0"
+ checksum: 10c0/5884815115bceac452877659a9c7726382531592f43dc29e5d48b7c4100661aed54018cb90bd36cb2eaeba521092570769167acbb95c18d39afdccbcca06c5ce
+ languageName: node
+ linkType: hard
+
+"isomorphic-unfetch@npm:^3.0.0":
+ version: 3.1.0
+ resolution: "isomorphic-unfetch@npm:3.1.0"
+ dependencies:
+ node-fetch: "npm:^2.6.1"
+ unfetch: "npm:^4.2.0"
+ checksum: 10c0/d3b61fca06304db692b7f76bdfd3a00f410e42cfa7403c3b250546bf71589d18cf2f355922f57198e4cc4a9872d3647b20397a5c3edf1a347c90d57c83cf2a89
+ languageName: node
+ linkType: hard
+
+"iterall@npm:^1.2.1":
+ version: 1.3.0
+ resolution: "iterall@npm:1.3.0"
+ checksum: 10c0/40de624e5fe937c4c0e511981b91caea9ff2142bfc0316cccc8506eaa03aa253820cc17c5bc5f0a98706c7268a373e5ebee9af9a0c8a359730cf7c05938b57b5
+ languageName: node
+ linkType: hard
+
+"js-tokens@npm:^3.0.0 || ^4.0.0":
+ version: 4.0.0
+ resolution: "js-tokens@npm:4.0.0"
+ checksum: 10c0/e248708d377aa058eacf2037b07ded847790e6de892bbad3dac0abba2e759cb9f121b00099a65195616badcb6eca8d14d975cb3e89eb1cfda644756402c8aeed
+ languageName: node
+ linkType: hard
+
+"jsonc-parser@npm:^3.2.0":
+ version: 3.3.1
+ resolution: "jsonc-parser@npm:3.3.1"
+ checksum: 10c0/269c3ae0a0e4f907a914bf334306c384aabb9929bd8c99f909275ebd5c2d3bc70b9bcd119ad794f339dec9f24b6a4ee9cd5a8ab2e6435e730ad4075388fc2ab6
+ languageName: node
+ linkType: hard
+
+"lightningcss-android-arm64@npm:1.33.0":
+ version: 1.33.0
+ resolution: "lightningcss-android-arm64@npm:1.33.0"
+ conditions: os=android & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"lightningcss-darwin-arm64@npm:1.33.0":
+ version: 1.33.0
+ resolution: "lightningcss-darwin-arm64@npm:1.33.0"
+ conditions: os=darwin & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"lightningcss-darwin-x64@npm:1.33.0":
+ version: 1.33.0
+ resolution: "lightningcss-darwin-x64@npm:1.33.0"
+ conditions: os=darwin & cpu=x64
+ languageName: node
+ linkType: hard
+
+"lightningcss-freebsd-x64@npm:1.33.0":
+ version: 1.33.0
+ resolution: "lightningcss-freebsd-x64@npm:1.33.0"
+ conditions: os=freebsd & cpu=x64
+ languageName: node
+ linkType: hard
+
+"lightningcss-linux-arm-gnueabihf@npm:1.33.0":
+ version: 1.33.0
+ resolution: "lightningcss-linux-arm-gnueabihf@npm:1.33.0"
+ conditions: os=linux & cpu=arm
+ languageName: node
+ linkType: hard
+
+"lightningcss-linux-arm64-gnu@npm:1.33.0":
+ version: 1.33.0
+ resolution: "lightningcss-linux-arm64-gnu@npm:1.33.0"
+ conditions: os=linux & cpu=arm64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"lightningcss-linux-arm64-musl@npm:1.33.0":
+ version: 1.33.0
+ resolution: "lightningcss-linux-arm64-musl@npm:1.33.0"
+ conditions: os=linux & cpu=arm64 & libc=musl
+ languageName: node
+ linkType: hard
+
+"lightningcss-linux-x64-gnu@npm:1.33.0":
+ version: 1.33.0
+ resolution: "lightningcss-linux-x64-gnu@npm:1.33.0"
+ conditions: os=linux & cpu=x64 & libc=glibc
+ languageName: node
+ linkType: hard
+
+"lightningcss-linux-x64-musl@npm:1.33.0":
+ version: 1.33.0
+ resolution: "lightningcss-linux-x64-musl@npm:1.33.0"
+ conditions: os=linux & cpu=x64 & libc=musl
+ languageName: node
+ linkType: hard
+
+"lightningcss-win32-arm64-msvc@npm:1.33.0":
+ version: 1.33.0
+ resolution: "lightningcss-win32-arm64-msvc@npm:1.33.0"
+ conditions: os=win32 & cpu=arm64
+ languageName: node
+ linkType: hard
+
+"lightningcss-win32-x64-msvc@npm:1.33.0":
+ version: 1.33.0
+ resolution: "lightningcss-win32-x64-msvc@npm:1.33.0"
+ conditions: os=win32 & cpu=x64
+ languageName: node
+ linkType: hard
+
+"lightningcss@npm:^1.33.0":
+ version: 1.33.0
+ resolution: "lightningcss@npm:1.33.0"
+ dependencies:
+ detect-libc: "npm:^2.0.3"
+ lightningcss-android-arm64: "npm:1.33.0"
+ lightningcss-darwin-arm64: "npm:1.33.0"
+ lightningcss-darwin-x64: "npm:1.33.0"
+ lightningcss-freebsd-x64: "npm:1.33.0"
+ lightningcss-linux-arm-gnueabihf: "npm:1.33.0"
+ lightningcss-linux-arm64-gnu: "npm:1.33.0"
+ lightningcss-linux-arm64-musl: "npm:1.33.0"
+ lightningcss-linux-x64-gnu: "npm:1.33.0"
+ lightningcss-linux-x64-musl: "npm:1.33.0"
+ lightningcss-win32-arm64-msvc: "npm:1.33.0"
+ lightningcss-win32-x64-msvc: "npm:1.33.0"
+ dependenciesMeta:
+ lightningcss-android-arm64:
+ optional: true
+ lightningcss-darwin-arm64:
+ optional: true
+ lightningcss-darwin-x64:
+ optional: true
+ lightningcss-freebsd-x64:
+ optional: true
+ lightningcss-linux-arm-gnueabihf:
+ optional: true
+ lightningcss-linux-arm64-gnu:
+ optional: true
+ lightningcss-linux-arm64-musl:
+ optional: true
+ lightningcss-linux-x64-gnu:
+ optional: true
+ lightningcss-linux-x64-musl:
+ optional: true
+ lightningcss-win32-arm64-msvc:
+ optional: true
+ lightningcss-win32-x64-msvc:
+ optional: true
+ checksum: 10c0/ce1f8279fbae636dbf37fa6e7385d5f98ed881d72af3362f24afbd4685e19c1fcdfecf17e5dd77f2ebee3d0c23ade276230d85842d07292229a2cffba8ff20a3
+ languageName: node
+ linkType: hard
+
+"lodash@npm:^4.17.20, lodash@npm:^4.17.21":
+ version: 4.18.1
+ resolution: "lodash@npm:4.18.1"
+ checksum: 10c0/757228fc68805c59789e82185135cf85f05d0b2d3d54631d680ca79ec21944ec8314d4533639a14b8bcfbd97a517e78960933041a5af17ecb693ec6eecb99a27
+ languageName: node
+ linkType: hard
+
+"loose-envify@npm:^1.4.0":
+ version: 1.4.0
+ resolution: "loose-envify@npm:1.4.0"
+ dependencies:
+ js-tokens: "npm:^3.0.0 || ^4.0.0"
+ bin:
+ loose-envify: cli.js
+ checksum: 10c0/655d110220983c1a4b9c0c679a2e8016d4b67f6e9c7b5435ff5979ecdb20d0813f4dec0a08674fcbdd4846a3f07edbb50a36811fd37930b94aaa0d9daceb017e
+ languageName: node
+ linkType: hard
+
+"magic-string@npm:^0.30.21":
+ version: 0.30.21
+ resolution: "magic-string@npm:0.30.21"
+ dependencies:
+ "@jridgewell/sourcemap-codec": "npm:^1.5.5"
+ checksum: 10c0/299378e38f9a270069fc62358522ddfb44e94244baa0d6a8980ab2a9b2490a1d03b236b447eee309e17eb3bddfa482c61259d47960eb018a904f0ded52780c4a
+ languageName: node
+ linkType: hard
+
+"matchmediaquery@npm:^0.3.0":
+ version: 0.3.1
+ resolution: "matchmediaquery@npm:0.3.1"
+ dependencies:
+ css-mediaquery: "npm:^0.1.2"
+ checksum: 10c0/19a254e0a1eb639fcc6aa7428a6e2d36cb5646a165579897e771580653e470b43d7f4a224c522700dbf1d8f19fb7c63a9719e0a6017727ade967155a2ae89fea
+ languageName: node
+ linkType: hard
+
+"math-intrinsics@npm:^1.1.0":
+ version: 1.1.0
+ resolution: "math-intrinsics@npm:1.1.0"
+ checksum: 10c0/7579ff94e899e2f76ab64491d76cf606274c874d8f2af4a442c016bd85688927fcfca157ba6bf74b08e9439dc010b248ce05b96cc7c126a354c3bae7fcb48b7f
+ languageName: node
+ linkType: hard
+
+"mime-db@npm:1.52.0":
+ version: 1.52.0
+ resolution: "mime-db@npm:1.52.0"
+ checksum: 10c0/0557a01deebf45ac5f5777fe7740b2a5c309c6d62d40ceab4e23da9f821899ce7a900b7ac8157d4548ddbb7beffe9abc621250e6d182b0397ec7f10c7b91a5aa
+ languageName: node
+ linkType: hard
+
+"mime-types@npm:^2.1.35":
+ version: 2.1.35
+ resolution: "mime-types@npm:2.1.35"
+ dependencies:
+ mime-db: "npm:1.52.0"
+ checksum: 10c0/82fb07ec56d8ff1fc999a84f2f217aa46cb6ed1033fefaabd5785b9a974ed225c90dc72fff460259e66b95b73648596dbcc50d51ed69cdf464af2d237d3149b2
+ languageName: node
+ linkType: hard
+
+"mimic-fn@npm:^2.1.0":
+ version: 2.1.0
+ resolution: "mimic-fn@npm:2.1.0"
+ checksum: 10c0/b26f5479d7ec6cc2bce275a08f146cf78f5e7b661b18114e2506dd91ec7ec47e7a25bf4360e5438094db0560bcc868079fb3b1fb3892b833c1ecbf63f80c95a4
+ languageName: node
+ linkType: hard
+
+"minipass@npm:^7.0.4, minipass@npm:^7.1.2":
+ version: 7.1.3
+ resolution: "minipass@npm:7.1.3"
+ checksum: 10c0/539da88daca16533211ea5a9ee98dc62ff5742f531f54640dd34429e621955e91cc280a91a776026264b7f9f6735947629f920944e9c1558369e8bf22eb33fbb
+ languageName: node
+ linkType: hard
+
+"minizlib@npm:^3.1.0":
+ version: 3.1.0
+ resolution: "minizlib@npm:3.1.0"
+ dependencies:
+ minipass: "npm:^7.1.2"
+ checksum: 10c0/5aad75ab0090b8266069c9aabe582c021ae53eb33c6c691054a13a45db3b4f91a7fb1bd79151e6b4e9e9a86727b522527c0a06ec7d45206b745d54cd3097bcec
+ languageName: node
+ linkType: hard
+
+"ms@npm:^2.1.3":
+ version: 2.1.3
+ resolution: "ms@npm:2.1.3"
+ checksum: 10c0/d924b57e7312b3b63ad21fc5b3dc0af5e78d61a1fc7cfb5457edaf26326bf62be5307cc87ffb6862ef1c2b33b0233cdb5d4f01c4c958cc0d660948b65a287a48
+ languageName: node
+ linkType: hard
+
+"mute-stream@npm:^3.0.0":
+ version: 3.0.0
+ resolution: "mute-stream@npm:3.0.0"
+ checksum: 10c0/12cdb36a101694c7a6b296632e6d93a30b74401873cf7507c88861441a090c71c77a58f213acadad03bc0c8fa186639dec99d68a14497773a8744320c136e701
+ languageName: node
+ linkType: hard
+
+"nanoid@npm:^3.3.18":
+ version: 3.3.18
+ resolution: "nanoid@npm:3.3.18"
+ bin:
+ nanoid: bin/nanoid.cjs
+ checksum: 10c0/b994b4e396730f8be2520923284e2040d61eaee55cc6d4935ef6d38d34bafdc46133eda4d3faea5073bda545aa6079d82b886caeac5c731cf9ac18bcc1301425
+ languageName: node
+ linkType: hard
+
+"node-fetch@npm:^2.6.1":
+ version: 2.7.0
+ resolution: "node-fetch@npm:2.7.0"
+ dependencies:
+ whatwg-url: "npm:^5.0.0"
+ peerDependencies:
+ encoding: ^0.1.0
+ peerDependenciesMeta:
+ encoding:
+ optional: true
+ checksum: 10c0/b55786b6028208e6fbe594ccccc213cab67a72899c9234eb59dba51062a299ea853210fcf526998eaa2867b0963ad72338824450905679ff0fa304b8c5093ae8
+ languageName: node
+ linkType: hard
+
+"node-gyp@npm:latest":
+ version: 13.0.2
+ resolution: "node-gyp@npm:13.0.2"
+ dependencies:
+ env-paths: "npm:^2.2.0"
+ exponential-backoff: "npm:^3.1.1"
+ graceful-fs: "npm:^4.2.6"
+ nopt: "npm:^10.0.0"
+ proc-log: "npm:^7.0.0"
+ semver: "npm:^7.3.5"
+ tar: "npm:^7.5.4"
+ tinyglobby: "npm:^0.2.12"
+ undici: "npm:^8.4.1"
+ which: "npm:^7.0.0"
+ bin:
+ node-gyp: bin/node-gyp.js
+ checksum: 10c0/29d33ccf47ffeeb5e7af925550b416f698a26a72eb10975c7eb5775c1d0cecacd76d164a4aa45503d3ddcece209db65c712be00423c69381a4cd14e2e6540559
+ languageName: node
+ linkType: hard
+
+"nopt@npm:^10.0.0":
+ version: 10.0.1
+ resolution: "nopt@npm:10.0.1"
+ dependencies:
+ abbrev: "npm:^5.0.0"
+ bin:
+ nopt: bin/nopt.js
+ checksum: 10c0/980d89257f9587f3e1f77877ddbf905d6aa3b738ec33e49a4fa1a059a0dd82eb28063982b150654a7ae9de386f2ead60e56172db7d37cf56de545f7392a2a26a
+ languageName: node
+ linkType: hard
+
+"object-assign@npm:^4.1.1":
+ version: 4.1.1
+ resolution: "object-assign@npm:4.1.1"
+ checksum: 10c0/1f4df9945120325d041ccf7b86f31e8bcc14e73d29171e37a7903050e96b81323784ec59f93f102ec635bcf6fa8034ba3ea0a8c7e69fa202b87ae3b6cec5a414
+ languageName: node
+ linkType: hard
+
+"obug@npm:^2.1.1":
+ version: 2.1.4
+ resolution: "obug@npm:2.1.4"
+ checksum: 10c0/34a0ee97cd88573cfd97d384c2a79f07118ae5680d7e45d1de6e99c74eddefe145e8ca27a2db02195a1ee5fded5aa22b924869c842728c201b9f109a27d0ef19
+ languageName: node
+ linkType: hard
+
+"onetime@npm:^5.1.0":
+ version: 5.1.2
+ resolution: "onetime@npm:5.1.2"
+ dependencies:
+ mimic-fn: "npm:^2.1.0"
+ checksum: 10c0/ffcef6fbb2692c3c40749f31ea2e22677a876daea92959b8a80b521d95cca7a668c884d8b2045d1d8ee7d56796aa405c405462af112a1477594cc63531baeb8f
+ languageName: node
+ linkType: hard
+
+"oxlint@npm:^0.16.0":
+ version: 0.16.12
+ resolution: "oxlint@npm:0.16.12"
+ dependencies:
+ "@oxlint/darwin-arm64": "npm:0.16.12"
+ "@oxlint/darwin-x64": "npm:0.16.12"
+ "@oxlint/linux-arm64-gnu": "npm:0.16.12"
+ "@oxlint/linux-arm64-musl": "npm:0.16.12"
+ "@oxlint/linux-x64-gnu": "npm:0.16.12"
+ "@oxlint/linux-x64-musl": "npm:0.16.12"
+ "@oxlint/win32-arm64": "npm:0.16.12"
+ "@oxlint/win32-x64": "npm:0.16.12"
+ dependenciesMeta:
+ "@oxlint/darwin-arm64":
+ optional: true
+ "@oxlint/darwin-x64":
+ optional: true
+ "@oxlint/linux-arm64-gnu":
+ optional: true
+ "@oxlint/linux-arm64-musl":
+ optional: true
+ "@oxlint/linux-x64-gnu":
+ optional: true
+ "@oxlint/linux-x64-musl":
+ optional: true
+ "@oxlint/win32-arm64":
+ optional: true
+ "@oxlint/win32-x64":
+ optional: true
+ bin:
+ oxc_language_server: bin/oxc_language_server
+ oxlint: bin/oxlint
+ checksum: 10c0/209c3484039c4f1fdd340689e81be93a70fdf74e8c111731e70d81580d223b0029439107c95fa4118cec3c9b03ba6c56624d3dcb8cdc79af222da3561122b3e7
+ languageName: node
+ linkType: hard
+
+"patch-console@npm:^2.0.0":
+ version: 2.0.0
+ resolution: "patch-console@npm:2.0.0"
+ checksum: 10c0/486602591a0af7af8d4c76d8eea42cad32b6de7200488819c6383c75e43733ca7bdc80e30f2e68ce05f06a1607cce1683a1706c6672ca27dada1921b366e8f1c
+ languageName: node
+ linkType: hard
+
+"pathe@npm:^2.0.3":
+ version: 2.0.3
+ resolution: "pathe@npm:2.0.3"
+ checksum: 10c0/c118dc5a8b5c4166011b2b70608762e260085180bb9e33e80a50dcdb1e78c010b1624f4280c492c92b05fc276715a4c357d1f9edc570f8f1b3d90b6839ebaca1
+ languageName: node
+ linkType: hard
+
+"picocolors@npm:^1.1.1":
+ version: 1.1.1
+ resolution: "picocolors@npm:1.1.1"
+ checksum: 10c0/e2e3e8170ab9d7c7421969adaa7e1b31434f789afb9b3f115f6b96d91945041ac3ceb02e9ec6fe6510ff036bcc0bf91e69a1772edc0b707e12b19c0f2d6bcf58
+ languageName: node
+ linkType: hard
+
+"picomatch@npm:^4.0.3, picomatch@npm:^4.0.4, picomatch@npm:^4.0.5":
+ version: 4.0.7
+ resolution: "picomatch@npm:4.0.7"
+ checksum: 10c0/beb6ae02c43ae44e84883b90830196d9046b1726ead292adcf7f57945e0bb0d992d68563d87e03b484b6f3c9a5c6defda7523477f047d7f0e663f126cc01787f
+ languageName: node
+ linkType: hard
+
+"postcss@npm:^8.5.26":
+ version: 8.5.28
+ resolution: "postcss@npm:8.5.28"
+ dependencies:
+ nanoid: "npm:^3.3.18"
+ picocolors: "npm:^1.1.1"
+ source-map-js: "npm:^1.2.1"
+ checksum: 10c0/9fe44215a6628d89c8a75184b92f5b2f77e16f9e5b13b39b9009bb7e8e6eccddf82c8854bae922db1f17ace6ef3445073fe38abff513caeb03e5285b1b55620a
+ languageName: node
+ linkType: hard
+
+"preact@npm:^10.28.3":
+ version: 10.29.8
+ resolution: "preact@npm:10.29.8"
+ peerDependencies:
+ preact-render-to-string: ">=5"
+ peerDependenciesMeta:
+ preact-render-to-string:
+ optional: true
+ checksum: 10c0/505460352139e0ce5b9c971b69d8d9f3b73ea0f316e3ff1c0b3db9a1abe206c9dff6ba385eb796253c38fcc08b5ade70cd8da3d9d6c9e9aec1a2fd59348253ae
+ languageName: node
+ linkType: hard
+
+"prettier@npm:^3.8.3":
+ version: 3.9.6
+ resolution: "prettier@npm:3.9.6"
+ bin:
+ prettier: bin/prettier.cjs
+ checksum: 10c0/9f7ddae234035868f3daab3dc34e6de7e54622185afb017378029f0c09a9c023248ccf6f34def0b17a0538e18c47aa1b3188bab72965d1bf735919baa0747e99
+ languageName: node
+ linkType: hard
+
+"proc-log@npm:^7.0.0":
+ version: 7.0.0
+ resolution: "proc-log@npm:7.0.0"
+ checksum: 10c0/b89c2d862604f35fec795477b0c7e376feab3ba0d4f4d291c4e959567442697cf451ac557d0623c1cc38af45a78128b983410f397a10c5d3a67f76c33de4754b
+ languageName: node
+ linkType: hard
+
+"prop-types@npm:^15.6.1":
+ version: 15.8.1
+ resolution: "prop-types@npm:15.8.1"
+ dependencies:
+ loose-envify: "npm:^1.4.0"
+ object-assign: "npm:^4.1.1"
+ react-is: "npm:^16.13.1"
+ checksum: 10c0/59ece7ca2fb9838031d73a48d4becb9a7cc1ed10e610517c7d8f19a1e02fa47f7c27d557d8a5702bec3cfeccddc853579832b43f449e54635803f277b1c78077
+ languageName: node
+ linkType: hard
+
+"proxy-from-env@npm:^2.1.0":
+ version: 2.1.0
+ resolution: "proxy-from-env@npm:2.1.0"
+ checksum: 10c0/ed01729fd4d094eab619cd7e17ce3698b3413b31eb102c4904f9875e677cd207392795d5b4adee9cec359dfd31c44d5ad7595a3a3ad51c40250e141512281c58
+ languageName: node
+ linkType: hard
+
+"react-dom@npm:^19.0.0, react-dom@npm:^19.2.0":
+ version: 19.2.8
+ resolution: "react-dom@npm:19.2.8"
+ dependencies:
+ scheduler: "npm:^0.27.0"
+ peerDependencies:
+ react: ^19.2.8
+ checksum: 10c0/41ba2247b76f687fcfe5bbc99f514d6b851d8c8041c2f5ded36ed05bd7fdc5208cacbac9de51e3e6633e77f96f44cec9f0d4a5a55184dba4e00738f224439134
+ languageName: node
+ linkType: hard
+
+"react-is@npm:^16.13.1":
+ version: 16.13.1
+ resolution: "react-is@npm:16.13.1"
+ checksum: 10c0/33977da7a5f1a287936a0c85639fec6ca74f4f15ef1e59a6bc20338fc73dc69555381e211f7a3529b8150a1f71e4225525b41b60b52965bda53ce7d47377ada1
+ languageName: node
+ linkType: hard
+
+"react-reconciler@npm:^0.33.0":
+ version: 0.33.0
+ resolution: "react-reconciler@npm:0.33.0"
+ dependencies:
+ scheduler: "npm:^0.27.0"
+ peerDependencies:
+ react: ^19.2.0
+ checksum: 10c0/3f7b27ea8d0ff4c8bf0e402a285e1af9b7d0e6f4c1a70a28f4384938bc1130bc82a90a31df0b79ef5e380e2e55e2598bd90b4dbf802b1203d735ba0355817d3a
+ languageName: node
+ linkType: hard
+
+"react-responsive@npm:^9.0.2":
+ version: 9.0.2
+ resolution: "react-responsive@npm:9.0.2"
+ dependencies:
+ hyphenate-style-name: "npm:^1.0.0"
+ matchmediaquery: "npm:^0.3.0"
+ prop-types: "npm:^15.6.1"
+ shallow-equal: "npm:^1.2.1"
+ peerDependencies:
+ react: ">=16.8.0"
+ checksum: 10c0/c58b30d8b8ff993edbc73f7de59a2d86d8abd6380b06a9b41667c3bdd5401e5e710fa1d0fdac21368759ab9b958e8b479a111329a06e9b0241ee08f500b37a20
+ languageName: node
+ linkType: hard
+
+"react-router-dom@npm:^6.4.4":
+ version: 6.30.6
+ resolution: "react-router-dom@npm:6.30.6"
+ dependencies:
+ "@remix-run/router": "npm:1.23.4"
+ react-router: "npm:6.30.6"
+ peerDependencies:
+ react: ">=16.8"
+ react-dom: ">=16.8"
+ checksum: 10c0/57dbb2ae4ac787f78c4d10b764c1c5223635378033e33dda4e0a4417144ae847fb43dc98008075951826258287c27c67729ca713c90957cf2ecf9055561bdc2e
+ languageName: node
+ linkType: hard
+
+"react-router@npm:6.30.6":
+ version: 6.30.6
+ resolution: "react-router@npm:6.30.6"
+ dependencies:
+ "@remix-run/router": "npm:1.23.4"
+ peerDependencies:
+ react: ">=16.8"
+ checksum: 10c0/d101388d92a44e159ef30dd2402a7f7b6aace8f837bb42aed1f8a6b3a4eff769d1822bf69382f0acb85a790628dac081c22bedb2bca12707e0e5e91427010fc3
+ languageName: node
+ linkType: hard
+
+"react@npm:^19.0.0, react@npm:^19.2.0":
+ version: 19.2.8
+ resolution: "react@npm:19.2.8"
+ checksum: 10c0/5f86bdb56426652fd6d989d30a6f2e603c057272c47c9ca3a3fbe190a3a39ee9ccce937d63cfc039717abed1b8891d6a499134bc35311acc07eafdacd86537cd
+ languageName: node
+ linkType: hard
+
+"readdirp@npm:^4.0.1":
+ version: 4.1.2
+ resolution: "readdirp@npm:4.1.2"
+ checksum: 10c0/60a14f7619dec48c9c850255cd523e2717001b0e179dc7037cfa0895da7b9e9ab07532d324bfb118d73a710887d1e35f79c495fa91582784493e085d18c72c62
+ languageName: node
+ linkType: hard
+
+"reselect@npm:^5.2.0":
+ version: 5.3.0
+ resolution: "reselect@npm:5.3.0"
+ checksum: 10c0/c79728e4f315152bfb2d82456d35075b705392d9e72c485d7d9b1061bd80af628416216d80f02a42f24dbb24d738aec7fec45806930aaa1d17c32e9875fa1bd6
+ languageName: node
+ linkType: hard
+
+"restore-cursor@npm:^4.0.0":
+ version: 4.0.0
+ resolution: "restore-cursor@npm:4.0.0"
+ dependencies:
+ onetime: "npm:^5.1.0"
+ signal-exit: "npm:^3.0.2"
+ checksum: 10c0/6f7da8c5e422ac26aa38354870b1afac09963572cf2879443540449068cb43476e9cbccf6f8de3e0171e0d6f7f533c2bc1a0a008003c9a525bbc098e89041318
+ languageName: node
+ linkType: hard
+
+"rolldown@npm:~1.2.4":
+ version: 1.2.7
+ resolution: "rolldown@npm:1.2.7"
+ dependencies:
+ "@oxc-project/types": "npm:=0.148.0"
+ "@rolldown/binding-android-arm-eabi": "npm:1.2.7"
+ "@rolldown/binding-android-arm64": "npm:1.2.7"
+ "@rolldown/binding-darwin-arm64": "npm:1.2.7"
+ "@rolldown/binding-darwin-x64": "npm:1.2.7"
+ "@rolldown/binding-freebsd-x64": "npm:1.2.7"
+ "@rolldown/binding-linux-arm-gnueabihf": "npm:1.2.7"
+ "@rolldown/binding-linux-arm64-gnu": "npm:1.2.7"
+ "@rolldown/binding-linux-arm64-musl": "npm:1.2.7"
+ "@rolldown/binding-linux-ppc64-gnu": "npm:1.2.7"
+ "@rolldown/binding-linux-s390x-gnu": "npm:1.2.7"
+ "@rolldown/binding-linux-x64-gnu": "npm:1.2.7"
+ "@rolldown/binding-linux-x64-musl": "npm:1.2.7"
+ "@rolldown/binding-openharmony-arm64": "npm:1.2.7"
+ "@rolldown/binding-win32-arm64-msvc": "npm:1.2.7"
+ "@rolldown/binding-win32-x64-msvc": "npm:1.2.7"
+ "@rolldown/pluginutils": "npm:^1.0.0"
+ dependenciesMeta:
+ "@rolldown/binding-android-arm-eabi":
+ optional: true
+ "@rolldown/binding-android-arm64":
+ optional: true
+ "@rolldown/binding-darwin-arm64":
+ optional: true
+ "@rolldown/binding-darwin-x64":
+ optional: true
+ "@rolldown/binding-freebsd-x64":
+ optional: true
+ "@rolldown/binding-linux-arm-gnueabihf":
+ optional: true
+ "@rolldown/binding-linux-arm64-gnu":
+ optional: true
+ "@rolldown/binding-linux-arm64-musl":
+ optional: true
+ "@rolldown/binding-linux-ppc64-gnu":
+ optional: true
+ "@rolldown/binding-linux-s390x-gnu":
+ optional: true
+ "@rolldown/binding-linux-x64-gnu":
+ optional: true
+ "@rolldown/binding-linux-x64-musl":
+ optional: true
+ "@rolldown/binding-openharmony-arm64":
+ optional: true
+ "@rolldown/binding-win32-arm64-msvc":
+ optional: true
+ "@rolldown/binding-win32-x64-msvc":
+ optional: true
+ bin:
+ rolldown: ./bin/cli.mjs
+ checksum: 10c0/e3b73addf51981d8b8430990ff59c14197994cfe9e1aae443dce47d353b409e7ffd478946185a15769588ab2e3d504557319fd58ab650ac9ac37c299384da10a
+ languageName: node
+ linkType: hard
+
+"run-async@npm:^4.0.6":
+ version: 4.0.6
+ resolution: "run-async@npm:4.0.6"
+ checksum: 10c0/3e512c689d356238a06a59839deddeb09aec23bc66f780fe970fcf12b64bfc00c6880e9530ea22b8cf88a927145561f5a43343d8be87166e849ec0daaa3d4cf4
+ languageName: node
+ linkType: hard
+
+"safer-buffer@npm:>= 2.1.2 < 3.0.0":
+ version: 2.1.2
+ resolution: "safer-buffer@npm:2.1.2"
+ checksum: 10c0/7e3c8b2e88a1841c9671094bbaeebd94448111dd90a81a1f606f3f67708a6ec57763b3b47f06da09fc6054193e0e6709e77325415dc8422b04497a8070fa02d4
+ languageName: node
+ linkType: hard
+
+"scheduler@npm:^0.27.0":
+ version: 0.27.0
+ resolution: "scheduler@npm:0.27.0"
+ checksum: 10c0/4f03048cb05a3c8fddc45813052251eca00688f413a3cee236d984a161da28db28ba71bd11e7a3dd02f7af84ab28d39fb311431d3b3772fed557945beb00c452
+ languageName: node
+ linkType: hard
+
+"semver@npm:7.6.3":
+ version: 7.6.3
+ resolution: "semver@npm:7.6.3"
+ bin:
+ semver: bin/semver.js
+ checksum: 10c0/88f33e148b210c153873cb08cfe1e281d518aaa9a666d4d148add6560db5cd3c582f3a08ccb91f38d5f379ead256da9931234ed122057f40bb5766e65e58adaf
+ languageName: node
+ linkType: hard
+
+"semver@npm:^7.3.5, semver@npm:^7.8.5":
+ version: 7.8.5
+ resolution: "semver@npm:7.8.5"
+ bin:
+ semver: bin/semver.js
+ checksum: 10c0/b1f3127a5be8125a94f37188b361c212466c292c6910adce3ec106cff5dc211ccaedc4739c11bb70fda59d6fc1f040a9bca289f4e093451521a2372e5231fe0c
+ languageName: node
+ linkType: hard
+
+"shallow-equal@npm:^1.2.1":
+ version: 1.2.1
+ resolution: "shallow-equal@npm:1.2.1"
+ checksum: 10c0/51e03abadd97c9ebe590547d92db9148446962a3f23a3a0fb1ba2fccab80af881eef0ff1f8ccefd3f066c0bc5a4c8ca53706194813b95c8835fa66448a843a26
+ languageName: node
+ linkType: hard
+
+"sharp@npm:^0.35.3":
+ version: 0.35.4
+ resolution: "sharp@npm:0.35.4"
+ dependencies:
+ "@img/colour": "npm:^1.1.0"
+ "@img/sharp-darwin-arm64": "npm:0.35.4"
+ "@img/sharp-darwin-x64": "npm:0.35.4"
+ "@img/sharp-freebsd-wasm32": "npm:0.35.4"
+ "@img/sharp-libvips-darwin-arm64": "npm:1.3.3"
+ "@img/sharp-libvips-darwin-x64": "npm:1.3.3"
+ "@img/sharp-libvips-linux-arm": "npm:1.3.3"
+ "@img/sharp-libvips-linux-arm64": "npm:1.3.3"
+ "@img/sharp-libvips-linux-ppc64": "npm:1.3.3"
+ "@img/sharp-libvips-linux-riscv64": "npm:1.3.3"
+ "@img/sharp-libvips-linux-s390x": "npm:1.3.3"
+ "@img/sharp-libvips-linux-x64": "npm:1.3.3"
+ "@img/sharp-libvips-linuxmusl-arm64": "npm:1.3.3"
+ "@img/sharp-libvips-linuxmusl-x64": "npm:1.3.3"
+ "@img/sharp-linux-arm": "npm:0.35.4"
+ "@img/sharp-linux-arm64": "npm:0.35.4"
+ "@img/sharp-linux-ppc64": "npm:0.35.4"
+ "@img/sharp-linux-riscv64": "npm:0.35.4"
+ "@img/sharp-linux-s390x": "npm:0.35.4"
+ "@img/sharp-linux-x64": "npm:0.35.4"
+ "@img/sharp-linuxmusl-arm64": "npm:0.35.4"
+ "@img/sharp-linuxmusl-x64": "npm:0.35.4"
+ "@img/sharp-webcontainers-wasm32": "npm:0.35.4"
+ "@img/sharp-win32-arm64": "npm:0.35.4"
+ "@img/sharp-win32-ia32": "npm:0.35.4"
+ "@img/sharp-win32-x64": "npm:0.35.4"
+ detect-libc: "npm:^2.1.2"
+ semver: "npm:^7.8.5"
+ dependenciesMeta:
+ "@img/sharp-darwin-arm64":
+ optional: true
+ "@img/sharp-darwin-x64":
+ optional: true
+ "@img/sharp-freebsd-wasm32":
+ optional: true
+ "@img/sharp-libvips-darwin-arm64":
+ optional: true
+ "@img/sharp-libvips-darwin-x64":
+ optional: true
+ "@img/sharp-libvips-linux-arm":
+ optional: true
+ "@img/sharp-libvips-linux-arm64":
+ optional: true
+ "@img/sharp-libvips-linux-ppc64":
+ optional: true
+ "@img/sharp-libvips-linux-riscv64":
+ optional: true
+ "@img/sharp-libvips-linux-s390x":
+ optional: true
+ "@img/sharp-libvips-linux-x64":
+ optional: true
+ "@img/sharp-libvips-linuxmusl-arm64":
+ optional: true
+ "@img/sharp-libvips-linuxmusl-x64":
+ optional: true
+ "@img/sharp-linux-arm":
+ optional: true
+ "@img/sharp-linux-arm64":
+ optional: true
+ "@img/sharp-linux-ppc64":
+ optional: true
+ "@img/sharp-linux-riscv64":
+ optional: true
+ "@img/sharp-linux-s390x":
+ optional: true
+ "@img/sharp-linux-x64":
+ optional: true
+ "@img/sharp-linuxmusl-arm64":
+ optional: true
+ "@img/sharp-linuxmusl-x64":
+ optional: true
+ "@img/sharp-webcontainers-wasm32":
+ optional: true
+ "@img/sharp-win32-arm64":
+ optional: true
+ "@img/sharp-win32-ia32":
+ optional: true
+ "@img/sharp-win32-x64":
+ optional: true
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ checksum: 10c0/dbcc0909200cbff98e82805c86085b94afbd45f373897a04b21e52e9bbc1671dc64970350dd3cb6b2d0970f3444be7100d728005dc6620e39b599269ed7e15eb
+ languageName: node
+ linkType: hard
+
+"siginfo@npm:^2.0.0":
+ version: 2.0.0
+ resolution: "siginfo@npm:2.0.0"
+ checksum: 10c0/3def8f8e516fbb34cb6ae415b07ccc5d9c018d85b4b8611e3dc6f8be6d1899f693a4382913c9ed51a06babb5201639d76453ab297d1c54a456544acf5c892e34
+ languageName: node
+ linkType: hard
+
+"signal-exit@npm:^3.0.2, signal-exit@npm:^3.0.7":
+ version: 3.0.7
+ resolution: "signal-exit@npm:3.0.7"
+ checksum: 10c0/25d272fa73e146048565e08f3309d5b942c1979a6f4a58a8c59d5fa299728e9c2fcd1a759ec870863b1fd38653670240cd420dad2ad9330c71f36608a6a1c912
+ languageName: node
+ linkType: hard
+
+"signal-exit@npm:^4.1.0":
+ version: 4.1.0
+ resolution: "signal-exit@npm:4.1.0"
+ checksum: 10c0/41602dce540e46d599edba9d9860193398d135f7ff72cab629db5171516cfae628d21e7bfccde1bbfdf11c48726bc2a6d1a8fb8701125852fbfda7cf19c6aa83
+ languageName: node
+ linkType: hard
+
+"slice-ansi@npm:^8.0.0":
+ version: 8.0.0
+ resolution: "slice-ansi@npm:8.0.0"
+ dependencies:
+ ansi-styles: "npm:^6.2.3"
+ is-fullwidth-code-point: "npm:^5.1.0"
+ checksum: 10c0/0ce4aa91febb7cea4a00c2c27bb820fa53b6d2862ce0f80f7120134719f7914fc416b0ed966cf35250a3169e152916392f35917a2d7cad0fcc5d8b841010fa9a
+ languageName: node
+ linkType: hard
+
+"source-map-js@npm:^1.2.1":
+ version: 1.2.1
+ resolution: "source-map-js@npm:1.2.1"
+ checksum: 10c0/7bda1fc4c197e3c6ff17de1b8b2c20e60af81b63a52cb32ec5a5d67a20a7d42651e2cb34ebe93833c5a2a084377e17455854fee3e21e7925c64a51b6a52b0faf
+ languageName: node
+ linkType: hard
+
+"stack-utils@npm:^2.0.6":
+ version: 2.0.6
+ resolution: "stack-utils@npm:2.0.6"
+ dependencies:
+ escape-string-regexp: "npm:^2.0.0"
+ checksum: 10c0/651c9f87667e077584bbe848acaecc6049bc71979f1e9a46c7b920cad4431c388df0f51b8ad7cfd6eed3db97a2878d0fc8b3122979439ea8bac29c61c95eec8a
+ languageName: node
+ linkType: hard
+
+"stackback@npm:0.0.2":
+ version: 0.0.2
+ resolution: "stackback@npm:0.0.2"
+ checksum: 10c0/89a1416668f950236dd5ac9f9a6b2588e1b9b62b1b6ad8dff1bfc5d1a15dbf0aafc9b52d2226d00c28dffff212da464eaeebfc6b7578b9d180cef3e3782c5983
+ languageName: node
+ linkType: hard
+
+"state-local@npm:^1.0.6":
+ version: 1.0.7
+ resolution: "state-local@npm:1.0.7"
+ checksum: 10c0/8dc7daeac71844452fafb514a6d6b6f40d7e2b33df398309ea1c7b3948d6110c57f112b7196500a10c54fdde40291488c52c875575670fb5c819602deca48bd9
+ languageName: node
+ linkType: hard
+
+"std-env@npm:^4.0.0-rc.1":
+ version: 4.2.0
+ resolution: "std-env@npm:4.2.0"
+ checksum: 10c0/40ac525ce7b7c556abc332a7376f14356eeb1a7f17f6ff9a003eb9f52326ff1f3745d3e1b43452675b1ec6fcc319f1b1d6f3b0d386cf3f91058479ad883cff69
+ languageName: node
+ linkType: hard
+
+"string-width@npm:^7.0.0":
+ version: 7.2.0
+ resolution: "string-width@npm:7.2.0"
+ dependencies:
+ emoji-regex: "npm:^10.3.0"
+ get-east-asian-width: "npm:^1.0.0"
+ strip-ansi: "npm:^7.1.0"
+ checksum: 10c0/eb0430dd43f3199c7a46dcbf7a0b34539c76fe3aa62763d0b0655acdcbdf360b3f66f3d58ca25ba0205f42ea3491fa00f09426d3b7d3040e506878fc7664c9b9
+ languageName: node
+ linkType: hard
+
+"string-width@npm:^8.1.0, string-width@npm:^8.1.1, string-width@npm:^8.2.0":
+ version: 8.2.2
+ resolution: "string-width@npm:8.2.2"
+ dependencies:
+ get-east-asian-width: "npm:^1.5.0"
+ strip-ansi: "npm:^7.1.2"
+ checksum: 10c0/895624534e4e2f229e880bbc30aa77bdeb758e1a0edce203e0a17b8b4f08b8d3c1156516efc50a35e3efd0052d938a73797692111250ac9f52ee384710a01714
+ languageName: node
+ linkType: hard
+
+"strip-ansi@npm:^7.1.0, strip-ansi@npm:^7.1.2":
+ version: 7.2.0
+ resolution: "strip-ansi@npm:7.2.0"
+ dependencies:
+ ansi-regex: "npm:^6.2.2"
+ checksum: 10c0/544d13b7582f8254811ea97db202f519e189e59d35740c46095897e254e4f1aa9fe1524a83ad6bc5ad67d4dd6c0281d2e0219ed62b880a6238a16a17d375f221
+ languageName: node
+ linkType: hard
+
+"subscriptions-transport-ws@npm:^0.9.16":
+ version: 0.9.19
+ resolution: "subscriptions-transport-ws@npm:0.9.19"
+ dependencies:
+ backo2: "npm:^1.0.2"
+ eventemitter3: "npm:^3.1.0"
+ iterall: "npm:^1.2.1"
+ symbol-observable: "npm:^1.0.4"
+ ws: "npm:^5.2.0 || ^6.0.0 || ^7.0.0"
+ peerDependencies:
+ graphql: ">=0.10.0"
+ checksum: 10c0/6f2ade56865f0ba291d3ff82c79781b051c2374873bac853286fedfdbc05001b8c4018ab7cba44af667ead7f573e48d18892d58a8f9ca8d90dfb4bff5c125045
+ languageName: node
+ linkType: hard
+
+"symbol-observable@npm:^1.0.4":
+ version: 1.2.0
+ resolution: "symbol-observable@npm:1.2.0"
+ checksum: 10c0/009fee50798ef80ed4b8195048288f108b03de162db07493f2e1fd993b33fafa72d659e832b584da5a2427daa78e5a738fb2a9ab027ee9454252e0bedbcd1fdc
+ languageName: node
+ linkType: hard
+
+"tagged-tag@npm:^1.0.0":
+ version: 1.0.0
+ resolution: "tagged-tag@npm:1.0.0"
+ checksum: 10c0/91d25c9ffb86a91f20522cefb2cbec9b64caa1febe27ad0df52f08993ff60888022d771e868e6416cf2e72dab68449d2139e8709ba009b74c6c7ecd4000048d1
+ languageName: node
+ linkType: hard
+
+"tar@npm:^7.5.4":
+ version: 7.5.22
+ resolution: "tar@npm:7.5.22"
+ dependencies:
+ "@isaacs/fs-minipass": "npm:^4.0.0"
+ chownr: "npm:^3.0.0"
+ minipass: "npm:^7.1.2"
+ minizlib: "npm:^3.1.0"
+ yallist: "npm:^5.0.0"
+ checksum: 10c0/1311f6be85a8157ac4c9147bae43e13923d2a1aae15e4aa1bd5239e4e03d2cf53cfe103dde7f35832fbb4c938b042856bc8e9a0afd29abd05e2d1608788c4fea
+ languageName: node
+ linkType: hard
+
+"terminal-size@npm:^4.0.1":
+ version: 4.0.1
+ resolution: "terminal-size@npm:4.0.1"
+ checksum: 10c0/89afd9d816dd9dbfe4499da9aeea70491bbde4ff4592226a9c8ac71074a7580afead6a78e95ecc35f6d42e09087b55ffcb1019302cd55e0cc957b6ce5c4847e8
+ languageName: node
+ linkType: hard
+
+"tinybench@npm:^2.9.0":
+ version: 2.9.0
+ resolution: "tinybench@npm:2.9.0"
+ checksum: 10c0/c3500b0f60d2eb8db65250afe750b66d51623057ee88720b7f064894a6cb7eb93360ca824a60a31ab16dab30c7b1f06efe0795b352e37914a9d4bad86386a20c
+ languageName: node
+ linkType: hard
+
+"tinyexec@npm:^1.0.2":
+ version: 1.3.1
+ resolution: "tinyexec@npm:1.3.1"
+ checksum: 10c0/c590369cb3fa73cc18a3998caec8a00f9712d91309c881be3ac52b160fb2f80c7b1fbf3591858ab6abab47ad55385b0c86ec19982e32441a01f55298dab9ccd2
+ languageName: node
+ linkType: hard
+
+"tinyglobby@npm:^0.2.12, tinyglobby@npm:^0.2.15, tinyglobby@npm:^0.2.17":
+ version: 0.2.17
+ resolution: "tinyglobby@npm:0.2.17"
+ dependencies:
+ fdir: "npm:^6.5.0"
+ picomatch: "npm:^4.0.4"
+ checksum: 10c0/7f7bb0f197c88bc4b20c231e0deca4240ca3bf313a88f5a7fee93a872b84966a4d50220947c0455ad07a60b3b360961c5b7fd979222aeb716a9f99b412002e4c
+ languageName: node
+ linkType: hard
+
+"tinyrainbow@npm:^3.1.0":
+ version: 3.1.1
+ resolution: "tinyrainbow@npm:3.1.1"
+ checksum: 10c0/f9d2743832c6191f753408f36224fe817620b8abcef572b2e570204c673a901d753ff84ca8e7b88f9c79e934295b3ffc6fcbc56a06f126e24e1ec6186dcad40d
+ languageName: node
+ linkType: hard
+
+"tr46@npm:~0.0.3":
+ version: 0.0.3
+ resolution: "tr46@npm:0.0.3"
+ checksum: 10c0/047cb209a6b60c742f05c9d3ace8fa510bff609995c129a37ace03476a9b12db4dbf975e74600830ef0796e18882b2381fb5fb1f6b4f96b832c374de3ab91a11
+ languageName: node
+ linkType: hard
+
+"tsconfck@npm:^3.0.3":
+ version: 3.1.6
+ resolution: "tsconfck@npm:3.1.6"
+ peerDependencies:
+ typescript: ^5.0.0
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+ bin:
+ tsconfck: bin/tsconfck.js
+ checksum: 10c0/269c3c513540be44844117bb9b9258fe6f8aeab026d32aeebf458d5299125f330711429dbb556dbf125a0bc25f4a81e6c24ac96de2740badd295c3fb400f66c4
+ languageName: node
+ linkType: hard
+
+"tslib@npm:^1.9.3":
+ version: 1.14.1
+ resolution: "tslib@npm:1.14.1"
+ checksum: 10c0/69ae09c49eea644bc5ebe1bca4fa4cc2c82b7b3e02f43b84bd891504edf66dbc6b2ec0eef31a957042de2269139e4acff911e6d186a258fb14069cd7f6febce2
+ languageName: node
+ linkType: hard
+
+"tslib@npm:^2.0.0, tslib@npm:^2.4.0":
+ version: 2.8.1
+ resolution: "tslib@npm:2.8.1"
+ checksum: 10c0/9c4759110a19c53f992d9aae23aac5ced636e99887b51b9e61def52611732872ff7668757d4e4c61f19691e36f4da981cd9485e869b4a7408d689f6bf1f14e62
+ languageName: node
+ linkType: hard
+
+"twenty-client-sdk@npm:2.39.0":
+ version: 2.39.0
+ resolution: "twenty-client-sdk@npm:2.39.0"
+ dependencies:
+ "@genql/runtime": "npm:^2.10.0"
+ esbuild: "npm:^0.28.1"
+ graphql: "npm:^16.8.1"
+ lodash: "npm:^4.17.21"
+ prettier: "npm:^3.8.3"
+ checksum: 10c0/43d4365b21debe0b323a1c7bf4de6e0bc103d17eb6013f5f7efd78329e52426cea179851f85660e82b494188df33f30af06bbafdeb1d83bb0db33054c03a8768
+ languageName: node
+ linkType: hard
+
+"twenty-sdk@npm:2.39.0":
+ version: 2.39.0
+ resolution: "twenty-sdk@npm:2.39.0"
+ dependencies:
+ "@sniptt/guards": "npm:^0.2.0"
+ axios: "npm:^1.16.0"
+ chalk: "npm:^5.3.0"
+ chokidar: "npm:^4.0.0"
+ commander: "npm:^12.0.0"
+ esbuild: "npm:^0.28.1"
+ graphql: "npm:^16.8.1"
+ graphql-sse: "npm:^2.5.4"
+ ink: "npm:^6.8.0"
+ inquirer: "npm:^14.0.0"
+ jsonc-parser: "npm:^3.2.0"
+ preact: "npm:^10.28.3"
+ react: "npm:^19.2.0"
+ react-dom: "npm:^19.2.0"
+ semver: "npm:7.6.3"
+ sharp: "npm:^0.35.3"
+ tinyglobby: "npm:^0.2.15"
+ twenty-client-sdk: "npm:2.39.0"
+ typescript: "npm:^5.9.3"
+ uuid: "npm:^13.0.2"
+ bin:
+ twenty: dist/cli.cjs
+ checksum: 10c0/2be124dc511121001830cb107cfb863c0b7ccf89d9d4cc51ef9e544764ab103abe7aeccb8a359b5f14b675e3550cbb92576b97226eb00fff8f5908c19347ff1d
+ languageName: node
+ linkType: hard
+
+"twenty-ui@npm:1.0.0-alpha.1":
+ version: 1.0.0-alpha.1
+ resolution: "twenty-ui@npm:1.0.0-alpha.1"
+ dependencies:
+ "@base-ui/react": "npm:^1.5.0"
+ "@monaco-editor/react": "npm:^4.7.0"
+ "@radix-ui/colors": "npm:^3.0.0"
+ "@sniptt/guards": "npm:^0.2.0"
+ "@tabler/icons-react": "npm:^3.31.0"
+ clsx: "npm:^2.1.1"
+ react-responsive: "npm:^9.0.2"
+ react-router-dom: "npm:^6.4.4"
+ type-fest: "npm:^4.10.1"
+ zod: "npm:^4.1.11"
+ peerDependencies:
+ monaco-editor: ">= 0.25.0 < 1"
+ react: ^19.0.0
+ react-dom: ^19.0.0
+ checksum: 10c0/213582e582949d6ffe90a7a8ab89a1d4e9dc724d34ed1b80bd7d50e834a8cb8539723556d41b39dc658f76f176bd8490ae0da8a3d6a713e79e6573b732084179
+ languageName: node
+ linkType: hard
+
+"type-fest@npm:^4.10.1":
+ version: 4.41.0
+ resolution: "type-fest@npm:4.41.0"
+ checksum: 10c0/f5ca697797ed5e88d33ac8f1fec21921839871f808dc59345c9cf67345bfb958ce41bd821165dbf3ae591cedec2bf6fe8882098dfdd8dc54320b859711a2c1e4
+ languageName: node
+ linkType: hard
+
+"type-fest@npm:^5.4.1":
+ version: 5.9.0
+ resolution: "type-fest@npm:5.9.0"
+ dependencies:
+ tagged-tag: "npm:^1.0.0"
+ checksum: 10c0/9bf14a49454b9b40d9fe85e563a4cf90990bbe7c75958665b72660b4197a905f247be682a7757cac7c8fa60fc0eae32cc8cf51f80a88e15f0a3d4a8ec07eb5b6
+ languageName: node
+ linkType: hard
+
+"typescript@npm:^5.9.3":
+ version: 5.9.3
+ resolution: "typescript@npm:5.9.3"
+ bin:
+ tsc: bin/tsc
+ tsserver: bin/tsserver
+ checksum: 10c0/6bd7552ce39f97e711db5aa048f6f9995b53f1c52f7d8667c1abdc1700c68a76a308f579cd309ce6b53646deb4e9a1be7c813a93baaf0a28ccd536a30270e1c5
+ languageName: node
+ linkType: hard
+
+"typescript@patch:typescript@npm%3A^5.9.3#optional!builtin<compat/typescript>":
+ version: 5.9.3
+ resolution: "typescript@patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>::version=5.9.3&hash=5786d5"
+ bin:
+ tsc: bin/tsc
+ tsserver: bin/tsserver
+ checksum: 10c0/ad09fdf7a756814dce65bc60c1657b40d44451346858eea230e10f2e95a289d9183b6e32e5c11e95acc0ccc214b4f36289dcad4bf1886b0adb84d711d336a430
+ languageName: node
+ linkType: hard
+
+"undici-types@npm:~7.18.0":
+ version: 7.18.2
+ resolution: "undici-types@npm:7.18.2"
+ checksum: 10c0/85a79189113a238959d7a647368e4f7c5559c3a404ebdb8fc4488145ce9426fcd82252a844a302798dfc0e37e6fb178ff481ed03bc4caf634c5757d9ef43521d
+ languageName: node
+ linkType: hard
+
+"undici-types@npm:~8.3.0":
+ version: 8.3.0
+ resolution: "undici-types@npm:8.3.0"
+ checksum: 10c0/c8aa7e2fbebfce519654dafadc0ece59be888d2ccaf180fb4495da875e7b536d2456345c384069c7e6f3e9c9ab7435f074957da306f142343eee86ff8048855a
+ languageName: node
+ linkType: hard
+
+"undici@npm:^8.4.1":
+ version: 8.10.2
+ resolution: "undici@npm:8.10.2"
+ checksum: 10c0/66d7fc69149207cab570d6abbc9e965b6afe1ae889a7d46945b431165c973d6a56f3dd8b70a856e7ae1e550b6366a1cde6f06e68640587f0dadca38de72995ee
+ languageName: node
+ linkType: hard
+
+"unfetch@npm:^4.2.0":
+ version: 4.2.0
+ resolution: "unfetch@npm:4.2.0"
+ checksum: 10c0/a5c0a896a6f09f278b868075aea65652ad185db30e827cb7df45826fe5ab850124bf9c44c4dafca4bf0c55a0844b17031e8243467fcc38dd7a7d435007151f1b
+ languageName: node
+ linkType: hard
+
+"use-sync-external-store@npm:^1.6.0":
+ version: 1.6.0
+ resolution: "use-sync-external-store@npm:1.6.0"
+ peerDependencies:
+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ checksum: 10c0/35e1179f872a53227bdf8a827f7911da4c37c0f4091c29b76b1e32473d1670ebe7bcd880b808b7549ba9a5605c233350f800ffab963ee4a4ee346ee983b6019b
+ languageName: node
+ linkType: hard
+
+"utility-types@npm:^3.10.0":
+ version: 3.11.0
+ resolution: "utility-types@npm:3.11.0"
+ checksum: 10c0/2f1580137b0c3e6cf5405f37aaa8f5249961a76d26f1ca8efc0ff49a2fc0e0b2db56de8e521a174d075758e0c7eb3e590edec0832eb44478b958f09914920f19
+ languageName: node
+ linkType: hard
+
+"uuid@npm:^13.0.2":
+ version: 13.0.2
+ resolution: "uuid@npm:13.0.2"
+ bin:
+ uuid: dist-node/bin/uuid
+ checksum: 10c0/32c7ee84fa7c7966cc09b3a1514a752a8e2f609f15c00033fbaedc0255d577d1877b839f11ee537f37e587bbc620bbb98c3b3a1482931b8ed47d79497cd7a7cd
+ languageName: node
+ linkType: hard
+
+"vite-tsconfig-paths@npm:^4.2.1":
+ version: 4.3.2
+ resolution: "vite-tsconfig-paths@npm:4.3.2"
+ dependencies:
+ debug: "npm:^4.1.1"
+ globrex: "npm:^0.1.2"
+ tsconfck: "npm:^3.0.3"
+ peerDependencies:
+ vite: "*"
+ peerDependenciesMeta:
+ vite:
+ optional: true
+ checksum: 10c0/f390ac1d1c3992fc5ac50f9274c1090f8b55ab34a89ea88893db9a6924a3b26c9f64bc1163615150ad100749db73b6b2cf1d57f6cd60df6e762ceb5b8ad30024
+ languageName: node
+ linkType: hard
+
+"vite@npm:^6.0.0 || ^7.0.0 || ^8.0.0":
+ version: 8.2.2
+ resolution: "vite@npm:8.2.2"
+ dependencies:
+ fsevents: "npm:~2.3.3"
+ lightningcss: "npm:^1.33.0"
+ picomatch: "npm:^4.0.5"
+ postcss: "npm:^8.5.26"
+ rolldown: "npm:~1.2.4"
+ tinyglobby: "npm:^0.2.17"
+ peerDependencies:
+ "@types/node": ^20.19.0 || >=22.12.0
+ "@vitejs/devtools": ^0.4.0 || ^0.5.0
+ esbuild: ^0.27.0 || ^0.28.0
+ jiti: ">=1.21.0"
+ less: ^4.0.0
+ sass: ^1.70.0
+ sass-embedded: ^1.70.0
+ stylus: ">=0.54.8"
+ sugarss: ^5.0.0
+ terser: ^5.16.0
+ tsx: ^4.8.1
+ yaml: ^2.4.2
+ dependenciesMeta:
+ fsevents:
+ optional: true
+ peerDependenciesMeta:
+ "@types/node":
+ optional: true
+ "@vitejs/devtools":
+ optional: true
+ esbuild:
+ optional: true
+ jiti:
+ optional: true
+ less:
+ optional: true
+ sass:
+ optional: true
+ sass-embedded:
+ optional: true
+ stylus:
+ optional: true
+ sugarss:
+ optional: true
+ terser:
+ optional: true
+ tsx:
+ optional: true
+ yaml:
+ optional: true
+ bin:
+ vite: bin/vite.js
+ checksum: 10c0/94cbbbdc38ad500dcb86b6202ddd14aa41d05c80739766cada9bbe250b410d1a27be433c9c491ed39744019471ac1e27a59908616a88c42f9787bdb6bdca49d2
+ languageName: node
+ linkType: hard
+
+"vitest@npm:^4.0.0":
+ version: 4.1.11
+ resolution: "vitest@npm:4.1.11"
+ dependencies:
+ "@vitest/expect": "npm:4.1.11"
+ "@vitest/mocker": "npm:4.1.11"
+ "@vitest/pretty-format": "npm:4.1.11"
+ "@vitest/runner": "npm:4.1.11"
+ "@vitest/snapshot": "npm:4.1.11"
+ "@vitest/spy": "npm:4.1.11"
+ "@vitest/utils": "npm:4.1.11"
+ es-module-lexer: "npm:^2.0.0"
+ expect-type: "npm:^1.3.0"
+ magic-string: "npm:^0.30.21"
+ obug: "npm:^2.1.1"
+ pathe: "npm:^2.0.3"
+ picomatch: "npm:^4.0.3"
+ std-env: "npm:^4.0.0-rc.1"
+ tinybench: "npm:^2.9.0"
+ tinyexec: "npm:^1.0.2"
+ tinyglobby: "npm:^0.2.15"
+ tinyrainbow: "npm:^3.1.0"
+ vite: "npm:^6.0.0 || ^7.0.0 || ^8.0.0"
+ why-is-node-running: "npm:^2.3.0"
+ peerDependencies:
+ "@edge-runtime/vm": "*"
+ "@opentelemetry/api": ^1.9.0
+ "@types/node": ^20.0.0 || ^22.0.0 || >=24.0.0
+ "@vitest/browser-playwright": 4.1.11
+ "@vitest/browser-preview": 4.1.11
+ "@vitest/browser-webdriverio": 4.1.11
+ "@vitest/coverage-istanbul": 4.1.11
+ "@vitest/coverage-v8": 4.1.11
+ "@vitest/ui": 4.1.11
+ happy-dom: "*"
+ jsdom: "*"
+ vite: ^6.0.0 || ^7.0.0 || ^8.0.0
+ peerDependenciesMeta:
+ "@edge-runtime/vm":
+ optional: true
+ "@opentelemetry/api":
+ optional: true
+ "@types/node":
+ optional: true
+ "@vitest/browser-playwright":
+ optional: true
+ "@vitest/browser-preview":
+ optional: true
+ "@vitest/browser-webdriverio":
+ optional: true
+ "@vitest/coverage-istanbul":
+ optional: true
+ "@vitest/coverage-v8":
+ optional: true
+ "@vitest/ui":
+ optional: true
+ happy-dom:
+ optional: true
+ jsdom:
+ optional: true
+ vite:
+ optional: false
+ bin:
+ vitest: ./vitest.mjs
+ checksum: 10c0/3fa0948cf74adcccc8cbcdb4e6d30ada6933bdfb1816ff99200f3d3b689325b37dc483b22535b57b6d911f7a7b64eaa6a5f8da1606cfe7f2466f48000c21e296
+ languageName: node
+ linkType: hard
+
+"webidl-conversions@npm:^3.0.0":
+ version: 3.0.1
+ resolution: "webidl-conversions@npm:3.0.1"
+ checksum: 10c0/5612d5f3e54760a797052eb4927f0ddc01383550f542ccd33d5238cfd65aeed392a45ad38364970d0a0f4fea32e1f4d231b3d8dac4a3bdd385e5cf802ae097db
+ languageName: node
+ linkType: hard
+
+"whatwg-url@npm:^5.0.0":
+ version: 5.0.0
+ resolution: "whatwg-url@npm:5.0.0"
+ dependencies:
+ tr46: "npm:~0.0.3"
+ webidl-conversions: "npm:^3.0.0"
+ checksum: 10c0/1588bed84d10b72d5eec1d0faa0722ba1962f1821e7539c535558fb5398d223b0c50d8acab950b8c488b4ba69043fd833cc2697056b167d8ad46fac3995a55d5
+ languageName: node
+ linkType: hard
+
+"which@npm:^7.0.0":
+ version: 7.0.0
+ resolution: "which@npm:7.0.0"
+ dependencies:
+ isexe: "npm:^4.0.0"
+ bin:
+ node-which: bin/which.js
+ checksum: 10c0/ca0b54f198f78bbc4b7c02e34bda8d335cb352e0adb4cbca1c37b1a957af3a879a82c4c27ca6525bc942f548d8b64f816ef6528360af9f3de55ffb9b979b620d
+ languageName: node
+ linkType: hard
+
+"why-is-node-running@npm:^2.3.0":
+ version: 2.3.0
+ resolution: "why-is-node-running@npm:2.3.0"
+ dependencies:
+ siginfo: "npm:^2.0.0"
+ stackback: "npm:0.0.2"
+ bin:
+ why-is-node-running: cli.js
+ checksum: 10c0/1cde0b01b827d2cf4cb11db962f3958b9175d5d9e7ac7361d1a7b0e2dc6069a263e69118bd974c4f6d0a890ef4eedfe34cf3d5167ec14203dbc9a18620537054
+ languageName: node
+ linkType: hard
+
+"widest-line@npm:^6.0.0":
+ version: 6.0.0
+ resolution: "widest-line@npm:6.0.0"
+ dependencies:
+ string-width: "npm:^8.1.0"
+ checksum: 10c0/735f1fdcd97fe765a07bb8b5e73c020bed8e53ab34e83ce0ef01693ba3c914d9e7977fe5f5facf0d0b670297a82dd5e376d3efa0896860dfcdaf7cd6924c0fb7
+ languageName: node
+ linkType: hard
+
+"wrap-ansi@npm:^9.0.0":
+ version: 9.0.2
+ resolution: "wrap-ansi@npm:9.0.2"
+ dependencies:
+ ansi-styles: "npm:^6.2.1"
+ string-width: "npm:^7.0.0"
+ strip-ansi: "npm:^7.1.0"
+ checksum: 10c0/3305839b9a0d6fb930cb63a52f34d3936013d8b0682ff3ec133c9826512620f213800ffa19ea22904876d5b7e9a3c1f40682f03597d986a4ca881fa7b033688c
+ languageName: node
+ linkType: hard
+
+"ws@npm:^5.2.0 || ^6.0.0 || ^7.0.0":
+ version: 7.5.13
+ resolution: "ws@npm:7.5.13"
+ peerDependencies:
+ bufferutil: ^4.0.1
+ utf-8-validate: ^5.0.2
+ peerDependenciesMeta:
+ bufferutil:
+ optional: true
+ utf-8-validate:
+ optional: true
+ checksum: 10c0/e223726bbda5768ed58ec9252d04eda7018ef380ea122bb94e595a4d7a02b5baeb423933936576fddb8fa51b642375f7ae814bf0f6f5d9a3ce290566578a8c5a
+ languageName: node
+ linkType: hard
+
+"ws@npm:^6.1.4":
+ version: 6.2.6
+ resolution: "ws@npm:6.2.6"
+ dependencies:
+ async-limiter: "npm:~1.0.0"
+ checksum: 10c0/24245efc3c09b6175df32ddb4a06f85432c4c88abb0e75f43f2551c1d5de456218b1b6c7685c414b8e03a68a167488e4aadf04a895681c8e01502025ce505742
+ languageName: node
+ linkType: hard
+
+"ws@npm:^8.18.0":
+ version: 8.21.3
+ resolution: "ws@npm:8.21.3"
+ peerDependencies:
+ bufferutil: ^4.0.1
+ utf-8-validate: ">=5.0.2"
+ peerDependenciesMeta:
+ bufferutil:
+ optional: true
+ utf-8-validate:
+ optional: true
+ checksum: 10c0/7b28dc2863ea0e2cece68d142a3eee90361021b73f750431e6d8076bb7dede5fdfdb75b3d29534b62f411261147b76b1bc80fb5cc63ab0aabd467280e85b22e0
+ languageName: node
+ linkType: hard
+
+"yallist@npm:^5.0.0":
+ version: 5.0.0
+ resolution: "yallist@npm:5.0.0"
+ checksum: 10c0/a499c81ce6d4a1d260d4ea0f6d49ab4da09681e32c3f0472dee16667ed69d01dae63a3b81745a24bd78476ec4fcf856114cb4896ace738e01da34b2c42235416
+ languageName: node
+ linkType: hard
+
+"yoga-layout@npm:~3.2.1":
+ version: 3.2.1
+ resolution: "yoga-layout@npm:3.2.1"
+ checksum: 10c0/9001e51be993c85e03757e5a04a2b61b8b30c9e5a7865d0156ca87a6431a3b717d51eb4990bfe588189fcfeac688dd9c3de707bbd50d1c344a84e63974cc54a8
+ languageName: node
+ linkType: hard
+
+"zen-observable-ts@npm:^0.8.21":
+ version: 0.8.21
+ resolution: "zen-observable-ts@npm:0.8.21"
+ dependencies:
+ tslib: "npm:^1.9.3"
+ zen-observable: "npm:^0.8.0"
+ checksum: 10c0/fe4a02f862b5f7e8ae0f86230c37b84c7d5611f5c206981afb4043e732d04cf7067a6cbe1ba82d20f18b735a3387937195a12542158a631d308ae3959a1d93c4
+ languageName: node
+ linkType: hard
+
+"zen-observable@npm:^0.8.0":
+ version: 0.8.15
+ resolution: "zen-observable@npm:0.8.15"
+ checksum: 10c0/71cc2f2bbb537300c3f569e25693d37b3bc91f225cefce251a71c30bc6bb3e7f8e9420ca0eb57f2ac9e492b085b8dfa075fd1e8195c40b83c951dd59c6e4fbf8
+ languageName: node
+ linkType: hard
+
+"zod@npm:^4.1.11":
+ version: 4.5.4
+ resolution: "zod@npm:4.5.4"
+ checksum: 10c0/511a2a4d1a6f875dfdd70a1586989a8b14ef126776cd6218a2c760b9f65f14ef389ec20d92ee1aa4fcb4566d4ff3fa012956044f9dc503510d82e4c756a8ba92
+ languageName: node
+ linkType: hard