Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
feat(call): call custom name (#2891)
Will Hutchinson81b61acd50d0
diff --git a/js/app/packages/block-call/component/CallBlockAdapter.tsx b/js/app/packages/block-call/component/CallBlockAdapter.tsxindex c6dbe1374a..d26c77771c 100644--- a/js/app/packages/block-call/component/CallBlockAdapter.tsx+++ b/js/app/packages/block-call/component/CallBlockAdapter.tsx@@ -2,11 +2,13 @@ import { useBlockId } from '@core/block';import Unauthorized from '@core/component/AccessErrorViews/Unauthorized';import { MaybeResultError } from '@core/util/maybeResult';import { useCallRecordQuery } from '@queries/call/call';-import { Match, Show, Switch } from 'solid-js';+import { createSignal, Match, Show, Switch } from 'solid-js';import { CallTranscript } from './CallTranscript';import type { CallRecord } from '@service-storage/generated/schemas/callRecord';import { format } from 'date-fns';import PhoneCallIcon from '@macro-icons/wide/call.svg';+import ChevronDownIcon from '@icon/regular/caret-down.svg?component-solid';+import { cn } from '@ui/utils/classname';import { formatCallDuration } from '../utils';function isUnauthorized(error: Error | null): boolean {@@ -20,13 +22,40 @@ function formatCallDate(dateStr: string): string {return format(new Date(dateStr), 'MMM d, yyyy h:mm a');}+function CallSummary(props: { summary: string }) {+ const [expanded, setExpanded] = createSignal(true);+ return (+ <div class="px-4 py-3 border-b border-edge">+ <button+ type="button"+ class="flex items-center gap-1.5 text-xs font-medium text-ink-muted hover:text-ink"+ aria-expanded={expanded()}+ onClick={() => setExpanded((prev) => !prev)}+ >+ <ChevronDownIcon+ class={cn('w-3 h-3 transition-transform duration-100', {+ 'rotate-180': expanded(),+ '-rotate-90': !expanded(),+ })}+ />+ <span>AI summary</span>+ </button>+ <Show when={expanded()}>+ <div class="mt-2 text-sm text-ink whitespace-pre-wrap">+ {props.summary}+ </div>+ </Show>+ </div>+ );+}+function CallHeader(props: { record: CallRecord }) {return (<div class="px-4 py-3 border-b border-edge shrink-0 flex items-center gap-3"><PhoneCallIcon class="size-5 text-ink-muted shrink-0" /><div class="flex flex-col min-w-0"><h2 class="text-sm font-medium text-ink truncate">- {props.record.channelName ?? 'Call'}+ {props.record.customName ?? props.record.channelName ?? 'Call'}</h2><div class="flex items-center gap-2 text-xs text-ink-muted"><Show when={props.record.endedAt}>@@ -95,10 +124,13 @@ export function CallBlockAdapter() {</div>)}</Show>+ <Show when={data().summary}>+ {(summary) => <CallSummary summary={summary()} />}+ </Show><Showwhen={data().transcript.length > 0}fallback={- <Show when={!data().recordingUrl}>+ <Show when={!data().recordingUrl && !data().summary}><div class="flex items-center justify-center h-full text-ink-faint text-sm">No recording or transcript available.</div>diff --git a/js/app/packages/core/component/FileList/itemOperations.ts b/js/app/packages/core/component/FileList/itemOperations.tsindex f7c6eee444..a60735f11b 100644--- a/js/app/packages/core/component/FileList/itemOperations.ts+++ b/js/app/packages/core/component/FileList/itemOperations.ts@@ -2,6 +2,7 @@ import { analytics } from '@app/lib/analytics';import { usePaywallState } from '@core/constant/PaywallState';import { isPaymentError } from '@core/util/handlePaymentError';import { isErr, isOk } from '@core/util/maybeResult';+import { callServiceClient } from '@service-call/client';import { cognitionApiServiceClient } from '@service-cognition/client';import { commsServiceClient } from '@service-comms/client';import { emailClient } from '@service-email/client';@@ -111,6 +112,13 @@ export async function renameItem(args: {});break;}+ case 'call': {+ result = await callServiceClient.editCallRecord({+ callId: id,+ customName: newName,+ });+ break;+ }default: {return false;}diff --git a/js/app/packages/macro-entity/src/queries/rename.ts b/js/app/packages/macro-entity/src/queries/rename.tsindex 250cfff495..46f46811da 100644--- a/js/app/packages/macro-entity/src/queries/rename.ts+++ b/js/app/packages/macro-entity/src/queries/rename.ts@@ -13,6 +13,7 @@ import {import { type MutationCallbacks, withCallbacks } from '@queries/utils';import { ChannelTypeEnum } from '@service-comms/client';import type { ApiChannelWithLatest } from '@service-comms/generated/models';+import type { CallRecord } from '@service-call/client';import type { ItemType } from '@service-storage/client';import { useMutation } from '@tanstack/solid-query';@@ -61,7 +62,6 @@ const getEntityRenameData = (operation: EntityRenameOperation): EntityRenameData | null => {const { entity, newName } = operation;- if (entity.type === 'call') return null;return {id: entity.id,itemType: entity.type,@@ -88,6 +88,7 @@ const validateEntityRename = (entity: EntityData): void => {case 'document':case 'chat':case 'project':+ case 'call':return;default:throw new Error(`Unsupported entity type: ${entity.type}`);@@ -110,11 +111,19 @@ const renameDssSetData = (frecency_score: score,}));+ } else if (itemType === 'call') {+ txns.set(+ id,+ optimisticUpdateSoupEntity({+ tag: 'callRecord',+ data: { callId: id, customName: newName },+ frecency_score: score,+ })+ );} else if (itemType !== 'email' &&itemType !== 'channel_message' &&- itemType !== 'automation' &&- itemType !== 'call'+ itemType !== 'automation') {txns.set(id,@@ -148,6 +157,18 @@ const renameChannelSetData = (entities: EntityRenameOptimisticInfo[]): void => {);};+const renameCallRecordSetData = (+ entities: EntityRenameOptimisticInfo[]+): void => {+ entities.forEach(({ id, newName, itemType }) => {+ if (itemType !== 'call') return;+ queryClient.setQueryData<CallRecord>(['call', 'record', id], (prev) => {+ if (!prev) return prev;+ return { ...prev, customName: newName };+ });+ });+};+const renamePreviewSetData = (entities: EntityRenameOptimisticInfo[]) => {entities.forEach(({ id, newName, itemType }) => {setPreviewName({@@ -170,6 +191,7 @@ function performOptimisticRenameUpdates(renamePreviewSetData(entities);renameHistorySetData(entities);renameChannelSetData(entities);+ renameCallRecordSetData(entities);const soupTransactions = renameDssSetData(entities);return { soupTransactions };@@ -192,6 +214,7 @@ function rollbackOptimisticRenameUpdates({renameHistorySetData(rollbackEntities);renamePreviewSetData(rollbackEntities);renameChannelSetData(rollbackEntities);+ renameCallRecordSetData(rollbackEntities);}const bulkRenameMutationFn = async (@@ -265,7 +288,7 @@ const bulkRenameOnSettled = (}};-/** supports channel/document/chat/project rename */+/** supports channel/document/chat/project/call rename */export function createRenameDssEntityMutation(callbacks?: MutationCallbacks<RenameDssEntityMutationData,@@ -303,7 +326,7 @@ export function createRenameDssEntityMutation(}));}-/** supports channel/document/chat/project bulk rename */+/** supports channel/document/chat/project/call bulk rename */export function createBulkRenameDssEntityMutation() {return useMutation<BulkRenameDssEntityMutationData,diff --git a/js/app/packages/queries/soup/transform-utils.ts b/js/app/packages/queries/soup/transform-utils.tsindex a69d271150..d140261f86 100644--- a/js/app/packages/queries/soup/transform-utils.ts+++ b/js/app/packages/queries/soup/transform-utils.ts@@ -511,7 +511,10 @@ export const mapSoupPageToEntityList: (return {type: 'call',id: item.data.callId,- name: item.data.channelName ?? blockNameToDefaultFile('call'),+ name:+ item.data.customName ??+ item.data.channelName ??+ blockNameToDefaultFile('call'),channelId: item.data.channelId,channelName: item.data.channelName ?? undefined,ownerId: item.data.createdBy,diff --git a/js/app/packages/service-clients/service-call/client.ts b/js/app/packages/service-clients/service-call/client.tsindex 2480731a0c..b561093d7e 100644--- a/js/app/packages/service-clients/service-call/client.ts+++ b/js/app/packages/service-clients/service-call/client.ts@@ -73,4 +73,17 @@ export const callServiceClient = {);return mapOk(result, (r) => r as unknown as boolean);},++ async editCallRecord(params: { callId: string; customName: string }) {+ return mapOk(+ await fetchWithToken<Record<string, never>>(+ `${host}/call/record/${params.callId}`,+ {+ method: 'PATCH',+ body: JSON.stringify({ customName: params.customName }),+ }+ ),+ () => undefined+ );+ },};diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/callRecord.ts b/js/app/packages/service-clients/service-storage/generated/schemas/callRecord.tsindex 537844427c..2d8a9a28d8 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/callRecord.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/callRecord.ts@@ -5,11 +5,13 @@* OpenAPI spec version: 0.1.0*/import type { CallRecordChannelName } from './callRecordChannelName';+import type { CallRecordCustomName } from './callRecordCustomName';import type { CallRecordDurationMs } from './callRecordDurationMs';import type { CallRecordEgressId } from './callRecordEgressId';import type { CallRecordEndedAt } from './callRecordEndedAt';import type { CallRecordParticipant } from './callRecordParticipant';import type { CallRecordRecordingUrl } from './callRecordRecordingUrl';+import type { CallRecordSummary } from './callRecordSummary';import type { CallRecordTranscriptSegment } from './callRecordTranscriptSegment';/**@@ -25,6 +27,9 @@ export interface CallRecord {channelName?: CallRecordChannelName;/** User who created the call. */createdBy: string;+ /** User-supplied or AI-generated display name for the call. Only set on+archived `call_records`; active calls always return `None`. */+ customName?: CallRecordCustomName;/** Call duration in milliseconds (None if still active). */durationMs?: CallRecordDurationMs;/** Recording egress ID, if any. */@@ -41,6 +46,9 @@ export interface CallRecord {roomName: string;/** When the call started (created_at for active, started_at for archived). */startedAt: string;+ /** AI-generated summary of the call. Only set on archived `call_records`+once summarization has run; active calls always return `None`. */+ summary?: CallRecordSummary;/** Transcript segments ordered by `sequence_num`. */transcript: CallRecordTranscriptSegment[];}diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/callRecordCustomName.ts b/js/app/packages/service-clients/service-storage/generated/schemas/callRecordCustomName.tsnew file mode 100644index 0000000000..82368a677e--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/callRecordCustomName.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * User-supplied or AI-generated display name for the call. Only set on+archived `call_records`; active calls always return `None`.+ */+export type CallRecordCustomName = string | null;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/callRecordSummary.ts b/js/app/packages/service-clients/service-storage/generated/schemas/callRecordSummary.tsnew file mode 100644index 0000000000..7f530fe4bb--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/callRecordSummary.ts@@ -0,0 +1,12 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * AI-generated summary of the call. Only set on archived `call_records`+once summarization has run; active calls always return `None`.+ */+export type CallRecordSummary = string | null;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/editCallRecordRequest.ts b/js/app/packages/service-clients/service-storage/generated/schemas/editCallRecordRequest.tsindex 1b55f472fb..8c80cf83f1 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/editCallRecordRequest.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/editCallRecordRequest.ts@@ -4,6 +4,7 @@* document_storage_service* OpenAPI spec version: 0.1.0*/+import type { EditCallRecordRequestCustomName } from './editCallRecordRequestCustomName';import type { EditCallRecordRequestSharePermission } from './editCallRecordRequestSharePermission';import type { EditCallRecordRequestShareWithTeam } from './editCallRecordRequestShareWithTeam';@@ -11,6 +12,12 @@ import type { EditCallRecordRequestShareWithTeam } from './editCallRecordRequest* Edit call request*/export interface EditCallRecordRequest {+ /** Updated user-supplied display name for the call. `None` is a no-op;+`Some("")` clears `call_records.custom_name`; any other `Some(s)`+overwrites it with `s`. Only the archived `call_records` row carries+this column — patching while the call is still active is a no-op for+this field. */+ customName?: EditCallRecordRequestCustomName;sharePermission?: EditCallRecordRequestSharePermission;/** If `Some(true)`, grant the creator's team View access on the call.If `Some(false)`, revoke the creator's team's access. `None` is a no-op.diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/editCallRecordRequestCustomName.ts b/js/app/packages/service-clients/service-storage/generated/schemas/editCallRecordRequestCustomName.tsnew file mode 100644index 0000000000..96f3c32294--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/editCallRecordRequestCustomName.ts@@ -0,0 +1,15 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * Updated user-supplied display name for the call. `None` is a no-op;+`Some("")` clears `call_records.custom_name`; any other `Some(s)`+overwrites it with `s`. Only the archived `call_records` row carries+this column — patching while the call is still active is a no-op for+this field.+ */+export type EditCallRecordRequestCustomName = string | null;diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts b/js/app/packages/service-clients/service-storage/generated/schemas/index.tsindex 5c4200db6e..dd44384a3f 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/index.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/index.ts@@ -81,6 +81,7 @@ export * from './callFilters';export * from './callFiltersAttended';export * from './callRecord';export * from './callRecordChannelName';+export * from './callRecordCustomName';export * from './callRecordDurationMs';export * from './callRecordEgressId';export * from './callRecordEndedAt';@@ -97,6 +98,7 @@ export * from './callRecordPreviewOneOfFour';export * from './callRecordPreviewOneOfFourAllOf';export * from './callRecordPreviewOneOfFourAllOfType';export * from './callRecordRecordingUrl';+export * from './callRecordSummary';export * from './callRecordTranscriptSegment';export * from './callRecordTranscriptSegmentDiarizedSpeakerId';export * from './callRecordTranscriptSegmentEndedAt';@@ -271,6 +273,7 @@ export * from './editAnchorRequestOneOfAllOfFileType';export * from './editAnchorResponse';export * from './editAnchorResponseAllOf';export * from './editCallRecordRequest';+export * from './editCallRecordRequestCustomName';export * from './editCallRecordRequestSharePermission';export * from './editCallRecordRequestShareWithTeam';export * from './editCommentRequest';@@ -565,6 +568,7 @@ export * from './soupAttachmentProviderAttachmentId';export * from './soupAttachmentSizeBytes';export * from './soupCallRecord';export * from './soupCallRecordChannelName';+export * from './soupCallRecordCustomName';export * from './soupCallRecordDurationMs';export * from './soupCallRecordEndedAt';export * from './soupCallRecordParticipant';diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/soupCallRecord.ts b/js/app/packages/service-clients/service-storage/generated/schemas/soupCallRecord.tsindex f443505e97..e2a6a93ed8 100644--- a/js/app/packages/service-clients/service-storage/generated/schemas/soupCallRecord.ts+++ b/js/app/packages/service-clients/service-storage/generated/schemas/soupCallRecord.ts@@ -5,6 +5,7 @@* OpenAPI spec version: 0.1.0*/import type { SoupCallRecordChannelName } from './soupCallRecordChannelName';+import type { SoupCallRecordCustomName } from './soupCallRecordCustomName';import type { SoupCallRecordDurationMs } from './soupCallRecordDurationMs';import type { SoupCallRecordEndedAt } from './soupCallRecordEndedAt';import type { SoupCallRecordParticipant } from './soupCallRecordParticipant';@@ -25,6 +26,8 @@ export interface SoupCallRecord {channelName?: SoupCallRecordChannelName;/** User who created the call. */createdBy: string;+ /** User-supplied or AI-generated display name for the call. */+ customName?: SoupCallRecordCustomName;/** Call duration in milliseconds (None if still active). */durationMs?: SoupCallRecordDurationMs;/** When the call ended (None if still active). */diff --git a/js/app/packages/service-clients/service-storage/generated/schemas/soupCallRecordCustomName.ts b/js/app/packages/service-clients/service-storage/generated/schemas/soupCallRecordCustomName.tsnew file mode 100644index 0000000000..bdf98e3da5--- /dev/null+++ b/js/app/packages/service-clients/service-storage/generated/schemas/soupCallRecordCustomName.ts@@ -0,0 +1,11 @@+/**+ * Generated by orval v7.21.0 🍺+ * Do not edit manually.+ * document_storage_service+ * OpenAPI spec version: 0.1.0+ */++/**+ * User-supplied or AI-generated display name for the call.+ */+export type SoupCallRecordCustomName = string | null;diff --git a/js/app/packages/service-clients/service-storage/generated/zod.ts b/js/app/packages/service-clients/service-storage/generated/zod.tsindex 7a046746a9..3432d297a1 100644--- a/js/app/packages/service-clients/service-storage/generated/zod.ts+++ b/js/app/packages/service-clients/service-storage/generated/zod.ts@@ -913,6 +913,12 @@ export const getCallRecordResponse = zod.nullish().describe('Resolved display name for the channel.'),createdBy: zod.string().describe('User who created the call.'),+ customName: zod+ .string()+ .nullish()+ .describe(+ 'User-supplied or AI-generated display name for the call. Only set on\narchived `call_records`; active calls always return `None`.'+ ),durationMs: zod.number().nullish()@@ -959,6 +965,12 @@ export const getCallRecordResponse = zod.describe('When the call started (created_at for active, started_at for archived).'),+ summary: zod+ .string()+ .nullish()+ .describe(+ 'AI-generated summary of the call. Only set on archived `call_records`\nonce summarization has run; active calls always return `None`.'+ ),transcript: zod.array(zod@@ -1014,6 +1026,12 @@ export const editCallRecordParams = zod.object({export const editCallRecordBody = zod.object({+ customName: zod+ .string()+ .nullish()+ .describe(+ 'Updated user-supplied display name for the call. `None` is a no-op;\n`Some(\"\")` clears `call_records.custom_name`; any other `Some(s)`\noverwrites it with `s`. Only the archived `call_records` row carries\nthis column — patching while the call is still active is a no-op for\nthis field.'+ ),sharePermission: zod.union([zod.null(),@@ -5116,6 +5134,12 @@ export const getItemsSoupResponse = zod.object({.nullish().describe('Resolved display name for the channel.'),createdBy: zod.string().describe('User who created the call.'),+ customName: zod+ .string()+ .nullish()+ .describe(+ 'User-supplied or AI-generated display name for the call.'+ ),durationMs: zod.number().nullish()@@ -6813,6 +6837,12 @@ export const postItemsSoupResponse = zod.object({.nullish().describe('Resolved display name for the channel.'),createdBy: zod.string().describe('User who created the call.'),+ customName: zod+ .string()+ .nullish()+ .describe(+ 'User-supplied or AI-generated display name for the call.'+ ),durationMs: zod.number().nullish()@@ -8154,6 +8184,12 @@ export const postItemsSoupAstResponse = zod.object({.nullish().describe('Resolved display name for the channel.'),createdBy: zod.string().describe('User who created the call.'),+ customName: zod+ .string()+ .nullish()+ .describe(+ 'User-supplied or AI-generated display name for the call.'+ ),durationMs: zod.number().nullish()diff --git a/js/app/packages/service-clients/service-storage/openapi.json b/js/app/packages/service-clients/service-storage/openapi.jsonindex debede067f..8d6365bd62 100644--- a/js/app/packages/service-clients/service-storage/openapi.json+++ b/js/app/packages/service-clients/service-storage/openapi.json@@ -6256,6 +6256,10 @@"type": "string","description": "User who created the call."},+ "customName": {+ "type": ["string", "null"],+ "description": "User-supplied or AI-generated display name for the call. Only set on\narchived `call_records`; active calls always return `None`."+ },"durationMs": {"type": ["integer", "null"],"format": "int64",@@ -6294,6 +6298,10 @@"format": "date-time","description": "When the call started (created_at for active, started_at for archived)."},+ "summary": {+ "type": ["string", "null"],+ "description": "AI-generated summary of the call. Only set on archived `call_records`\nonce summarization has run; active calls always return `None`."+ },"transcript": {"type": "array","items": {@@ -7822,6 +7830,10 @@"type": "object","description": "Edit call request","properties": {+ "customName": {+ "type": ["string", "null"],+ "description": "Updated user-supplied display name for the call. `None` is a no-op;\n`Some(\"\")` clears `call_records.custom_name`; any other `Some(s)`\noverwrites it with `s`. Only the archived `call_records` row carries\nthis column — patching while the call is still active is a no-op for\nthis field."+ },"sharePermission": {"oneOf": [{@@ -10987,6 +10999,10 @@"type": "string","description": "User who created the call."},+ "customName": {+ "type": ["string", "null"],+ "description": "User-supplied or AI-generated display name for the call."+ },"durationMs": {"type": ["integer", "null"],"format": "int64",diff --git a/js/bun.lock b/js/bun.lockindex dc462ec199..5a688912fb 100644--- a/js/bun.lock+++ b/js/bun.lock@@ -835,7 +835,7 @@"@img/sharp-win32-x64": ["@img/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw=="],- "@inkibra/tauri-plugins": ["@inkibra/tauri-plugins@github:macro-inc/tauri-plugins#6152009", { "dependencies": { "react": "^18.3.1", "react-dom": "^18.3.1" } }, "macro-inc-tauri-plugins-6152009", "sha512-XLN+niDA9BkzrxiZqBjYf+DL4TLoMIcI80ypCowacVfrfAjWt0qLwLkzWVUXjD7k3v0DB/G+BP4OLJNkGygHIw=="],+ "@inkibra/tauri-plugins": ["@inkibra/tauri-plugins@github:macro-inc/tauri-plugins#6152009", { "dependencies": { "react": "^18.3.1", "react-dom": "^18.3.1" } }, "macro-inc-tauri-plugins-6152009"],"@inquirer/external-editor": ["@inquirer/[email protected]", "", { "dependencies": { "chardet": "^2.1.1", "iconv-lite": "^0.7.0" }, "peerDependencies": { "@types/node": ">=18" }, "optionalPeers": ["@types/node"] }, "sha512-RWbSrDiYmO4LbejWY7ttpxczuwQyZLBUyygsA9Nsv95hpzUWwnNTVQmAq3xuh7vNwCp07UTmE5i11XAEExx4RA=="],@@ -2623,7 +2623,7 @@"pathval": ["[email protected]", "", {}, "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ=="],- "pdfjs-dist": ["pdfjs-dist@github:macro-inc/pdf.js#f9b2ce6", { "dependencies": { "dommatrix": "^1.0.3", "web-streams-polyfill": "^3.2.1" }, "peerDependencies": { "worker-loader": "^3.0.8" }, "optionalPeers": ["worker-loader"] }, "macro-inc-pdf.js-f9b2ce6", "sha512-HDFaPbCxLG2GHpf1smUG97nku5aPGBGaCcIbK05dGdp07TBLUlDcXsM4WcE82mO5W4RBPIBVYobX5N/6M6NFrA=="],+ "pdfjs-dist": ["pdfjs-dist@github:macro-inc/pdf.js#f9b2ce6", { "dependencies": { "dommatrix": "^1.0.3", "web-streams-polyfill": "^3.2.1" }, "peerDependencies": { "worker-loader": "^3.0.8" }, "optionalPeers": ["worker-loader"] }, "macro-inc-pdf.js-f9b2ce6"],"performance-now": ["[email protected]", "", {}, "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow=="],diff --git a/rust/cloud-storage/.sqlx/query-0f2057f8430788bb20f5d0f144445f28fba6434c9a2fe208e0a4a45b892dea2b.json b/rust/cloud-storage/.sqlx/query-0f2057f8430788bb20f5d0f144445f28fba6434c9a2fe208e0a4a45b892dea2b.jsondeleted file mode 100644index 14012e1c66..0000000000--- a/rust/cloud-storage/.sqlx/query-0f2057f8430788bb20f5d0f144445f28fba6434c9a2fe208e0a4a45b892dea2b.json+++ /dev/null@@ -1,87 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n INSERT INTO team_user (team_id, user_id, team_role, tier)\n VALUES ($1, $2, $3, $4)\n RETURNING user_id, team_role as \"role!: TeamRole\", tier as \"tier!: TeamUserTier\", team_id\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "user_id",- "type_info": "Text"- },- {- "ordinal": 1,- "name": "role!: TeamRole",- "type_info": {- "Custom": {- "name": "team_role",- "kind": {- "Enum": [- "member",- "admin",- "owner"- ]- }- }- }- },- {- "ordinal": 2,- "name": "tier!: TeamUserTier",- "type_info": {- "Custom": {- "name": "team_user_tier",- "kind": {- "Enum": [- "haiku",- "sonnet",- "opus"- ]- }- }- }- },- {- "ordinal": 3,- "name": "team_id",- "type_info": "Uuid"- }- ],- "parameters": {- "Left": [- "Uuid",- "Text",- {- "Custom": {- "name": "team_role",- "kind": {- "Enum": [- "member",- "admin",- "owner"- ]- }- }- },- {- "Custom": {- "name": "team_user_tier",- "kind": {- "Enum": [- "haiku",- "sonnet",- "opus"- ]- }- }- }- ]- },- "nullable": [- false,- false,- false,- false- ]- },- "hash": "0f2057f8430788bb20f5d0f144445f28fba6434c9a2fe208e0a4a45b892dea2b"-}diff --git a/rust/cloud-storage/.sqlx/query-418d7b5ab3d820694166d0a3e3b17b9fc9b9bc8e769d50fddf4c06f09e855b9b.json b/rust/cloud-storage/.sqlx/query-418d7b5ab3d820694166d0a3e3b17b9fc9b9bc8e769d50fddf4c06f09e855b9b.jsondeleted file mode 100644index b583f8d531..0000000000--- a/rust/cloud-storage/.sqlx/query-418d7b5ab3d820694166d0a3e3b17b9fc9b9bc8e769d50fddf4c06f09e855b9b.json+++ /dev/null@@ -1,14 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n DELETE FROM team_invite\n WHERE id = $1\n ",- "describe": {- "columns": [],- "parameters": {- "Left": [- "Uuid"- ]- },- "nullable": []- },- "hash": "418d7b5ab3d820694166d0a3e3b17b9fc9b9bc8e769d50fddf4c06f09e855b9b"-}diff --git a/rust/cloud-storage/.sqlx/query-bff6b39be7dcea0033c8105a13952ab868eb03143e3132e63a868f516ca71646.json b/rust/cloud-storage/.sqlx/query-4e7539c4785010f5ff402f0bc8574bd04152bf07c7bd8696ea226057e2e38558.jsonsimilarity index 76%rename from rust/cloud-storage/.sqlx/query-bff6b39be7dcea0033c8105a13952ab868eb03143e3132e63a868f516ca71646.jsonrename to rust/cloud-storage/.sqlx/query-4e7539c4785010f5ff402f0bc8574bd04152bf07c7bd8696ea226057e2e38558.jsonindex ca7ef24f72..c19d97b116 100644--- a/rust/cloud-storage/.sqlx/query-bff6b39be7dcea0033c8105a13952ab868eb03143e3132e63a868f516ca71646.json+++ b/rust/cloud-storage/.sqlx/query-4e7539c4785010f5ff402f0bc8574bd04152bf07c7bd8696ea226057e2e38558.json@@ -1,6 +1,6 @@{"db_name": "PostgreSQL",- "query": "\n SELECT id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key\n FROM call_records\n WHERE id = $1\n ",+ "query": "\n SELECT id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key, custom_name, summary\n FROM call_records\n WHERE id = $1\n ","describe": {"columns": [{@@ -47,6 +47,16 @@"ordinal": 8,"name": "recording_key","type_info": "Text"+ },+ {+ "ordinal": 9,+ "name": "custom_name",+ "type_info": "Text"+ },+ {+ "ordinal": 10,+ "name": "summary",+ "type_info": "Text"}],"parameters": {@@ -63,8 +73,10 @@false,false,true,+ true,+ true,true]},- "hash": "bff6b39be7dcea0033c8105a13952ab868eb03143e3132e63a868f516ca71646"+ "hash": "4e7539c4785010f5ff402f0bc8574bd04152bf07c7bd8696ea226057e2e38558"}diff --git a/rust/cloud-storage/.sqlx/query-50332c40ef917c839c4539f12419035115d61a4c9e8146a894e41db59b0f0daa.json b/rust/cloud-storage/.sqlx/query-50332c40ef917c839c4539f12419035115d61a4c9e8146a894e41db59b0f0daa.jsondeleted file mode 100644index 76d5ad2fda..0000000000--- a/rust/cloud-storage/.sqlx/query-50332c40ef917c839c4539f12419035115d61a4c9e8146a894e41db59b0f0daa.json+++ /dev/null@@ -1,57 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT team_role as \"team_role!: TeamRole\", team_id, tier as \"tier!: TeamUserTier\"\n FROM team_invite\n WHERE id = $1 AND email = $2\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "team_role!: TeamRole",- "type_info": {- "Custom": {- "name": "team_role",- "kind": {- "Enum": [- "member",- "admin",- "owner"- ]- }- }- }- },- {- "ordinal": 1,- "name": "team_id",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "tier!: TeamUserTier",- "type_info": {- "Custom": {- "name": "team_user_tier",- "kind": {- "Enum": [- "haiku",- "sonnet",- "opus"- ]- }- }- }- }- ],- "parameters": {- "Left": [- "Uuid",- "Text"- ]- },- "nullable": [- false,- false,- false- ]- },- "hash": "50332c40ef917c839c4539f12419035115d61a4c9e8146a894e41db59b0f0daa"-}diff --git a/rust/cloud-storage/.sqlx/query-7ca2625f94aef2b7062954af797b72725b7ae867499427329ef036d7d4df8e38.json b/rust/cloud-storage/.sqlx/query-7ca2625f94aef2b7062954af797b72725b7ae867499427329ef036d7d4df8e38.jsonnew file mode 100644index 0000000000..b70fd661f5--- /dev/null+++ b/rust/cloud-storage/.sqlx/query-7ca2625f94aef2b7062954af797b72725b7ae867499427329ef036d7d4df8e38.json@@ -0,0 +1,86 @@+{+ "db_name": "PostgreSQL",+ "query": "\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n room_name as \"room_name!\",\n created_by as \"created_by!\",\n created_at as \"started_at!\",\n NULL::timestamptz as \"ended_at\",\n NULL::bigint as \"duration_ms\",\n egress_id,\n recording_key,\n NULL::text as \"custom_name\",\n true as \"is_active!\"\n FROM calls c\n WHERE EXISTS (\n SELECT 1 FROM comms_channel_participants ccp\n WHERE ccp.channel_id = c.channel_id\n AND ccp.user_id = $1\n AND ccp.left_at IS NULL\n )\n AND ($3::bool IS FALSE OR c.channel_id = ANY($4))\n AND ($5::bool IS NULL OR EXISTS (\n SELECT 1 FROM call_participants cp\n WHERE cp.call_id = c.id AND cp.user_id = $1\n ) = $5)\n UNION ALL\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n room_name as \"room_name!\",\n created_by as \"created_by!\",\n started_at as \"started_at!\",\n ended_at as \"ended_at\",\n duration_ms as \"duration_ms\",\n egress_id,\n recording_key,\n custom_name,\n false as \"is_active!\"\n FROM call_records cr\n WHERE EXISTS (\n SELECT 1 FROM comms_channel_participants ccp\n WHERE ccp.channel_id = cr.channel_id\n AND ccp.user_id = $1\n AND ccp.left_at IS NULL\n )\n AND ($3::bool IS FALSE OR cr.channel_id = ANY($4))\n AND ($5::bool IS NULL OR EXISTS (\n SELECT 1 FROM call_record_participants crp\n WHERE crp.call_record_id = cr.id AND crp.user_id = $1\n ) = $5)\n ORDER BY \"started_at!\" DESC\n LIMIT $2\n ",+ "describe": {+ "columns": [+ {+ "ordinal": 0,+ "name": "call_id!",+ "type_info": "Uuid"+ },+ {+ "ordinal": 1,+ "name": "channel_id!",+ "type_info": "Uuid"+ },+ {+ "ordinal": 2,+ "name": "room_name!",+ "type_info": "Text"+ },+ {+ "ordinal": 3,+ "name": "created_by!",+ "type_info": "Text"+ },+ {+ "ordinal": 4,+ "name": "started_at!",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 5,+ "name": "ended_at",+ "type_info": "Timestamptz"+ },+ {+ "ordinal": 6,+ "name": "duration_ms",+ "type_info": "Int8"+ },+ {+ "ordinal": 7,+ "name": "egress_id",+ "type_info": "Text"+ },+ {+ "ordinal": 8,+ "name": "recording_key",+ "type_info": "Text"+ },+ {+ "ordinal": 9,+ "name": "custom_name",+ "type_info": "Text"+ },+ {+ "ordinal": 10,+ "name": "is_active!",+ "type_info": "Bool"+ }+ ],+ "parameters": {+ "Left": [+ "Text",+ "Int8",+ "Bool",+ "UuidArray",+ "Bool"+ ]+ },+ "nullable": [+ null,+ null,+ null,+ null,+ null,+ null,+ null,+ null,+ null,+ null,+ null+ ]+ },+ "hash": "7ca2625f94aef2b7062954af797b72725b7ae867499427329ef036d7d4df8e38"+}diff --git a/rust/cloud-storage/.sqlx/query-98e00e0037837e450a38491da828ff7403ad803c5dfb3bcf1345167fa756211a.json b/rust/cloud-storage/.sqlx/query-98e00e0037837e450a38491da828ff7403ad803c5dfb3bcf1345167fa756211a.jsondeleted file mode 100644index 97d26f67f9..0000000000--- a/rust/cloud-storage/.sqlx/query-98e00e0037837e450a38491da828ff7403ad803c5dfb3bcf1345167fa756211a.json+++ /dev/null@@ -1,80 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n room_name as \"room_name!\",\n created_by as \"created_by!\",\n created_at as \"started_at!\",\n NULL::timestamptz as \"ended_at\",\n NULL::bigint as \"duration_ms\",\n egress_id,\n recording_key,\n true as \"is_active!\"\n FROM calls c\n WHERE EXISTS (\n SELECT 1 FROM comms_channel_participants ccp\n WHERE ccp.channel_id = c.channel_id\n AND ccp.user_id = $1\n AND ccp.left_at IS NULL\n )\n AND ($3::bool IS FALSE OR c.channel_id = ANY($4))\n AND ($5::bool IS NULL OR EXISTS (\n SELECT 1 FROM call_participants cp\n WHERE cp.call_id = c.id AND cp.user_id = $1\n ) = $5)\n UNION ALL\n SELECT\n id as \"call_id!\",\n channel_id as \"channel_id!\",\n room_name as \"room_name!\",\n created_by as \"created_by!\",\n started_at as \"started_at!\",\n ended_at as \"ended_at\",\n duration_ms as \"duration_ms\",\n egress_id,\n recording_key,\n false as \"is_active!\"\n FROM call_records cr\n WHERE EXISTS (\n SELECT 1 FROM comms_channel_participants ccp\n WHERE ccp.channel_id = cr.channel_id\n AND ccp.user_id = $1\n AND ccp.left_at IS NULL\n )\n AND ($3::bool IS FALSE OR cr.channel_id = ANY($4))\n AND ($5::bool IS NULL OR EXISTS (\n SELECT 1 FROM call_record_participants crp\n WHERE crp.call_record_id = cr.id AND crp.user_id = $1\n ) = $5)\n ORDER BY \"started_at!\" DESC\n LIMIT $2\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "call_id!",- "type_info": "Uuid"- },- {- "ordinal": 1,- "name": "channel_id!",- "type_info": "Uuid"- },- {- "ordinal": 2,- "name": "room_name!",- "type_info": "Text"- },- {- "ordinal": 3,- "name": "created_by!",- "type_info": "Text"- },- {- "ordinal": 4,- "name": "started_at!",- "type_info": "Timestamptz"- },- {- "ordinal": 5,- "name": "ended_at",- "type_info": "Timestamptz"- },- {- "ordinal": 6,- "name": "duration_ms",- "type_info": "Int8"- },- {- "ordinal": 7,- "name": "egress_id",- "type_info": "Text"- },- {- "ordinal": 8,- "name": "recording_key",- "type_info": "Text"- },- {- "ordinal": 9,- "name": "is_active!",- "type_info": "Bool"- }- ],- "parameters": {- "Left": [- "Text",- "Int8",- "Bool",- "UuidArray",- "Bool"- ]- },- "nullable": [- null,- null,- null,- null,- null,- null,- null,- null,- null,- null- ]- },- "hash": "98e00e0037837e450a38491da828ff7403ad803c5dfb3bcf1345167fa756211a"-}diff --git a/rust/cloud-storage/.sqlx/query-b32146bc8bdbfa29785dca351729944da36cdeb0c7d3d9e778dd91ff8a470b51.json b/rust/cloud-storage/.sqlx/query-b32146bc8bdbfa29785dca351729944da36cdeb0c7d3d9e778dd91ff8a470b51.jsonnew file mode 100644index 0000000000..1a175da2ba--- /dev/null+++ b/rust/cloud-storage/.sqlx/query-b32146bc8bdbfa29785dca351729944da36cdeb0c7d3d9e778dd91ff8a470b51.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE call_records SET custom_name = $2 WHERE id = $1 AND custom_name IS NULL",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Text"+ ]+ },+ "nullable": []+ },+ "hash": "b32146bc8bdbfa29785dca351729944da36cdeb0c7d3d9e778dd91ff8a470b51"+}diff --git a/rust/cloud-storage/.sqlx/query-b470add8d87f6fff56d158c2aa9bf5dd871973fd3b9b6e1f25033f24a2cde3bd.json b/rust/cloud-storage/.sqlx/query-b470add8d87f6fff56d158c2aa9bf5dd871973fd3b9b6e1f25033f24a2cde3bd.jsondeleted file mode 100644index 81c4b7f8fe..0000000000--- a/rust/cloud-storage/.sqlx/query-b470add8d87f6fff56d158c2aa9bf5dd871973fd3b9b6e1f25033f24a2cde3bd.json+++ /dev/null@@ -1,34 +0,0 @@-{- "db_name": "PostgreSQL",- "query": "\n DELETE FROM team_user\n WHERE team_id = $1 AND user_id = $2\n RETURNING tier AS \"tier!: TeamUserTier\"\n ",- "describe": {- "columns": [- {- "ordinal": 0,- "name": "tier!: TeamUserTier",- "type_info": {- "Custom": {- "name": "team_user_tier",- "kind": {- "Enum": [- "haiku",- "sonnet",- "opus"- ]- }- }- }- }- ],- "parameters": {- "Left": [- "Uuid",- "Text"- ]- },- "nullable": [- false- ]- },- "hash": "b470add8d87f6fff56d158c2aa9bf5dd871973fd3b9b6e1f25033f24a2cde3bd"-}diff --git a/rust/cloud-storage/.sqlx/query-ce008daea4cb34b00a1c882b25444c58e68634e942d43ed59582b7bf0786893f.json b/rust/cloud-storage/.sqlx/query-ce008daea4cb34b00a1c882b25444c58e68634e942d43ed59582b7bf0786893f.jsonnew file mode 100644index 0000000000..8a6b62eddf--- /dev/null+++ b/rust/cloud-storage/.sqlx/query-ce008daea4cb34b00a1c882b25444c58e68634e942d43ed59582b7bf0786893f.json@@ -0,0 +1,15 @@+{+ "db_name": "PostgreSQL",+ "query": "UPDATE call_records SET custom_name = $2 WHERE id = $1",+ "describe": {+ "columns": [],+ "parameters": {+ "Left": [+ "Uuid",+ "Text"+ ]+ },+ "nullable": []+ },+ "hash": "ce008daea4cb34b00a1c882b25444c58e68634e942d43ed59582b7bf0786893f"+}diff --git a/rust/cloud-storage/call/src/domain/models.rs b/rust/cloud-storage/call/src/domain/models.rsindex e21987d549..e95dd779b0 100644--- a/rust/cloud-storage/call/src/domain/models.rs+++ b/rust/cloud-storage/call/src/domain/models.rs@@ -156,6 +156,12 @@ pub struct EditCallRecordRequest {/// If `Some(false)`, revoke the creator's team's access. `None` is a no-op./// The team is resolved from the call's `created_by`, not the acting user.pub share_with_team: Option<bool>,+ /// Updated user-supplied display name for the call. `None` is a no-op;+ /// `Some("")` clears `call_records.custom_name`; any other `Some(s)`+ /// overwrites it with `s`. Only the archived `call_records` row carries+ /// this column — patching while the call is still active is a no-op for+ /// this field.+ pub custom_name: Option<String>,}/// A transcript segment as returned in a [`CallRecord`].@@ -224,6 +230,12 @@ pub struct CallRecord {pub recording_url: Option<String>,/// Resolved display name for the channel.pub channel_name: Option<String>,+ /// User-supplied or AI-generated display name for the call. Only set on+ /// archived `call_records`; active calls always return `None`.+ pub custom_name: Option<String>,+ /// AI-generated summary of the call. Only set on archived `call_records`+ /// once summarization has run; active calls always return `None`.+ pub summary: Option<String>,/// Whether the call is currently active (from `calls` table).pub is_active: bool,/// Participants (both active and historic).diff --git a/rust/cloud-storage/call/src/domain/ports.rs b/rust/cloud-storage/call/src/domain/ports.rsindex c1b74bcae6..af4820cfe8 100644--- a/rust/cloud-storage/call/src/domain/ports.rs+++ b/rust/cloud-storage/call/src/domain/ports.rs@@ -229,6 +229,16 @@ pub trait CallRepository: Send + Sync + 'static {call_id: &Uuid,summary: &str,) -> impl Future<Output = Result<(), Self::Err>> + Send;++ /// Set `call_records.custom_name = $name` only when the existing value is+ /// `NULL`. Used by the AI auto-naming flow so a user-set custom name is+ /// never overwritten. No-op if no row matches or the column is already+ /// populated.+ fn set_custom_name_if_null(+ &self,+ call_id: &Uuid,+ name: &str,+ ) -> impl Future<Output = Result<(), Self::Err>> + Send;}/// Storage port for generating presigned recording URLs.@@ -290,6 +300,15 @@ pub trait CallSummarizer: Send + Sync + 'static {call_id: &Uuid,transcript: Vec<CallRecordTranscriptSegment>,) -> impl Future<Output = Result<String, Self::Err>> + Send;++ /// Produce a short (typically 3–6 word) display name for the call from+ /// its already-generated summary. Used by the auto-name flow only when+ /// the call has no user-supplied `custom_name` yet.+ fn generate_call_name(+ &self,+ call_id: &Uuid,+ summary: &str,+ ) -> impl Future<Output = Result<String, Self::Err>> + Send;}/// RTC client port for interacting with the real-time communication service (e.g., LiveKit).diff --git a/rust/cloud-storage/call/src/domain/service.rs b/rust/cloud-storage/call/src/domain/service.rsindex 9b6ee31f7b..aa9edd4aa4 100644--- a/rust/cloud-storage/call/src/domain/service.rs+++ b/rust/cloud-storage/call/src/domain/service.rs@@ -994,6 +994,28 @@ impl<.inspect_err(|e| tracing::error!(error=?e, %call_id, "failed to persist call summary")).map_err(|e| CallError::Internal(e.into()))?;+ // Auto-generate a display name from the summary; only persisted when+ // the user has not already set one (`set_custom_name_if_null`). Best+ // effort — naming failures must not fail summarization.+ if record.custom_name.is_none() {+ match summarizer.generate_call_name(call_id, &summary).await {+ Ok(name) => {+ if let Err(e) = self.repo.set_custom_name_if_null(call_id, &name).await {+ tracing::error!(+ error=?e, %call_id,+ "failed to persist ai-generated call name"+ );+ }+ }+ Err(e) => {+ tracing::error!(+ error=?e, %call_id,+ "ai call naming failed after summary; leaving name unset"+ );+ }+ }+ }+Ok(())}}@@ -1049,6 +1071,26 @@ impl<if let Err(e) = repo.insert_call_summary(&call_id, &summary).await {tracing::error!(error=?e, %call_id, "failed to persist call summary");+ return;+ }++ if record.custom_name.is_none() {+ match summarizer.generate_call_name(&call_id, &summary).await {+ Ok(name) => {+ if let Err(e) = repo.set_custom_name_if_null(&call_id, &name).await {+ tracing::error!(+ error=?e, %call_id,+ "failed to persist ai-generated call name"+ );+ }+ }+ Err(e) => {+ tracing::error!(+ error=?e, %call_id,+ "ai call naming failed after summary; leaving name unset"+ );+ }+ }}});}@@ -1092,6 +1134,16 @@ impl CallSummarizer for NoopCallSummarizer {"NoopCallSummarizer::summarize_call invoked; it exists only as a type placeholder when the optional summarizer is None")}++ async fn generate_call_name(+ &self,+ _call_id: &Uuid,+ _summary: &str,+ ) -> Result<String, Self::Err> {+ unreachable!(+ "NoopCallSummarizer::generate_call_name invoked; it exists only as a type placeholder when the optional summarizer is None"+ )+ }}/// Lightweight implementation of [`CallRecordQueryService`] for read-onlydiff --git a/rust/cloud-storage/call/src/outbound/ai_call_summarizer.rs b/rust/cloud-storage/call/src/outbound/ai_call_summarizer.rsindex 6f1933f075..6d036fefde 100644--- a/rust/cloud-storage/call/src/outbound/ai_call_summarizer.rs+++ b/rust/cloud-storage/call/src/outbound/ai_call_summarizer.rs@@ -35,6 +35,25 @@ Rules:fabricating content.- Respond with only the summary text — no preamble, no sign-off.";+/// System prompt for naming a call from its summary. Kept tight so the model+/// returns a bare title instead of a sentence.+const CALL_NAME_SYSTEM_PROMPT: &str = "\+You write short titles for recorded calls based on their summary. \+Output a single title — 3 to 6 words, Title Case, no punctuation, no \+quotes, no preamble, no sign-off. The title should reflect the main \+topic of the call; if the summary is empty or uninformative, respond \+with `Untitled Call`.";++/// Maximum characters of summary text we send to the naming model. The+/// summary is already concise; this is a safety cap so a runaway summary+/// does not blow up the prompt.+const CALL_NAME_SUMMARY_CHAR_CAP: usize = 4_000;++/// Hard cap on the title returned to callers. Anything longer is truncated+/// at a word boundary — protects the DB column / UI from misbehaving model+/// output regardless of the system prompt.+const CALL_NAME_MAX_CHARS: usize = 80;+/// AI-powered [`CallSummarizer`] that delegates to/// [`ai::chat_completion::get_chat_completion`].///@@ -75,6 +94,76 @@ impl CallSummarizer for AiCallSummarizer {tracing::error!(error = ?e, %call_id, "ai call summarization failed");})}++ #[tracing::instrument(skip(self, summary), fields(summary_len = summary.len()), err)]+ async fn generate_call_name(&self, call_id: &Uuid, summary: &str) -> Result<String, Self::Err> {+ let trimmed_summary = summary.trim();+ if trimmed_summary.is_empty() {+ return Ok("Untitled Call".to_string());+ }++ let summary_for_prompt: &str = if trimmed_summary.len() > CALL_NAME_SUMMARY_CHAR_CAP {+ let mut end = CALL_NAME_SUMMARY_CHAR_CAP;+ while end > 0 && !trimmed_summary.is_char_boundary(end) {+ end -= 1;+ }+ &trimmed_summary[..end]+ } else {+ trimmed_summary+ };++ let user_message = format!(+ "Call {call_id} summary follows. Produce a title per the rules in \+ the system prompt.\n\n{summary_for_prompt}"+ );++ let request = RequestBuilder::new()+ .model(SUMMARIZATION_MODEL)+ .system_prompt(CALL_NAME_SYSTEM_PROMPT)+ .user_message(user_message)+ .build();++ let raw = get_chat_completion(request)+ .await+ .map_err(|e| anyhow::anyhow!(e))+ .inspect_err(|e| {+ tracing::error!(error = ?e, %call_id, "ai call naming failed");+ })?;++ Ok(sanitize_call_name(&raw))+ }+}++#[cfg(test)]+mod test;++/// Trim quotes/whitespace, normalize internal whitespace, and clamp to+/// [`CALL_NAME_MAX_CHARS`] at a word boundary so the persisted name is+/// well-formed regardless of model output.+fn sanitize_call_name(raw: &str) -> String {+ let trimmed = raw+ .trim()+ .trim_matches(|c: char| c == '"' || c == '\'' || c == '`')+ .trim();+ let normalized = trimmed.split_whitespace().collect::<Vec<_>>().join(" ");++ if normalized.is_empty() {+ return "Untitled Call".to_string();+ }++ if normalized.chars().count() <= CALL_NAME_MAX_CHARS {+ return normalized;+ }++ let mut taken = String::with_capacity(CALL_NAME_MAX_CHARS);+ for ch in normalized.chars().take(CALL_NAME_MAX_CHARS) {+ taken.push(ch);+ }+ // Cut back to the last whitespace so we don't end mid-word.+ if let Some(idx) = taken.rfind(char::is_whitespace) {+ taken.truncate(idx);+ }+ taken.trim_end().to_string()}/// Render the transcript as a chronological, speaker-labeled block suitablediff --git a/rust/cloud-storage/call/src/outbound/ai_call_summarizer/test.rs b/rust/cloud-storage/call/src/outbound/ai_call_summarizer/test.rsnew file mode 100644index 0000000000..82ccaf16db--- /dev/null+++ b/rust/cloud-storage/call/src/outbound/ai_call_summarizer/test.rs@@ -0,0 +1,41 @@+use super::{CALL_NAME_MAX_CHARS, sanitize_call_name};++#[test]+fn sanitize_strips_quotes_and_whitespace() {+ assert_eq!(+ sanitize_call_name(" \"Q4 Planning Sync\" "),+ "Q4 Planning Sync"+ );+ assert_eq!(sanitize_call_name("'Standup Prep'"), "Standup Prep");+ assert_eq!(sanitize_call_name("`Rocket Launch`"), "Rocket Launch");+}++#[test]+fn sanitize_falls_back_to_untitled_for_empty_or_quote_only_input() {+ assert_eq!(sanitize_call_name(""), "Untitled Call");+ assert_eq!(sanitize_call_name(" "), "Untitled Call");+ assert_eq!(sanitize_call_name("\"\""), "Untitled Call");+}++#[test]+fn sanitize_collapses_internal_unicode_whitespace() {+ assert_eq!(+ sanitize_call_name(" \"Weekly\nPlanning\tSync\u{00a0}Notes\" "),+ "Weekly Planning Sync Notes"+ );+}++#[test]+fn sanitize_truncates_to_word_boundary_under_cap() {+ let input = "Quarterly Goals Sync ".repeat(20);+ let out = sanitize_call_name(&input);+ assert!(out.chars().count() <= CALL_NAME_MAX_CHARS);+ assert!(!out.ends_with(' '));+ assert!(out.starts_with("Quarterly Goals Sync"));+}++#[test]+fn sanitize_preserves_short_titles_verbatim() {+ let input = "Rocket Launch Postmortem";+ assert_eq!(sanitize_call_name(input), input);+}diff --git a/rust/cloud-storage/call/src/outbound/pg_call_repo.rs b/rust/cloud-storage/call/src/outbound/pg_call_repo.rsindex 1382465453..ab28fe3a7d 100644--- a/rust/cloud-storage/call/src/outbound/pg_call_repo.rs+++ b/rust/cloud-storage/call/src/outbound/pg_call_repo.rs@@ -839,6 +839,8 @@ impl CallRepository for PgCallRepo {recording_key: active.recording_key,recording_url: None,channel_name: None,+ custom_name: None,+ summary: None,is_active: true,participants,transcript,@@ -848,7 +850,7 @@ impl CallRepository for PgCallRepo {// Fall back to archived `call_records`.let Some(archived) = sqlx::query!(r#"- SELECT id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key+ SELECT id, channel_id, room_name, created_by, started_at, ended_at, duration_ms, egress_id, recording_key, custom_name, summaryFROM call_recordsWHERE id = $1"#,@@ -916,6 +918,8 @@ impl CallRepository for PgCallRepo {recording_key: archived.recording_key,recording_url: None,channel_name: None,+ custom_name: archived.custom_name,+ summary: archived.summary,is_active: false,participants,transcript,@@ -1037,6 +1041,7 @@ impl CallRepository for PgCallRepo {NULL::bigint as "duration_ms",egress_id,recording_key,+ NULL::text as "custom_name",true as "is_active!"FROM calls cWHERE EXISTS (@@ -1061,6 +1066,7 @@ impl CallRepository for PgCallRepo {duration_ms as "duration_ms",egress_id,recording_key,+ custom_name,false as "is_active!"FROM call_records crWHERE EXISTS (@@ -1141,6 +1147,8 @@ impl CallRepository for PgCallRepo {recording_key: row.recording_key,recording_url: None,channel_name: None,+ custom_name: row.custom_name,+ summary: None,is_active: row.is_active,participants,transcript: Vec::new(),@@ -1312,6 +1320,15 @@ impl CallRepository for PgCallRepo {edit::set_share_with_team(&mut tx, call_record_id, share_with_team).await?;}+ if let Some(custom_name) = request.custom_name.as_deref() {+ let custom_name = if custom_name.is_empty() {+ None+ } else {+ Some(custom_name)+ };+ edit::set_custom_name(&mut tx, call_record_id, custom_name).await?;+ }+tx.commit().await?;Ok(())}@@ -1330,4 +1347,12 @@ impl CallRepository for PgCallRepo {.await?;Ok(())}++ #[tracing::instrument(skip(self, name), err)]+ async fn set_custom_name_if_null(&self, call_id: &Uuid, name: &str) -> Result<(), Self::Err> {+ let mut tx = self.pool.begin().await?;+ edit::set_custom_name_if_null(&mut tx, call_id, name).await?;+ tx.commit().await?;+ Ok(())+ }}diff --git a/rust/cloud-storage/call/src/outbound/pg_call_repo/edit.rs b/rust/cloud-storage/call/src/outbound/pg_call_repo/edit.rsindex f84f35ec2b..280b3f974a 100644--- a/rust/cloud-storage/call/src/outbound/pg_call_repo/edit.rs+++ b/rust/cloud-storage/call/src/outbound/pg_call_repo/edit.rs@@ -137,6 +137,43 @@ pub(super) async fn set_share_with_team(Ok(())}+/// Set or clear the user-supplied display name on an archived call record.+/// No-op if no `call_records` row matches `call_id` (the call may still be+/// active in the `calls` table — that table does not carry `custom_name`).+pub(super) async fn set_custom_name(+ transaction: &mut Transaction<'_, Postgres>,+ call_id: &Uuid,+ custom_name: Option<&str>,+) -> Result<(), sqlx::Error> {+ sqlx::query!(+ r#"UPDATE call_records SET custom_name = $2 WHERE id = $1"#,+ call_id,+ custom_name,+ )+ .execute(transaction.as_mut())+ .await?;+ Ok(())+}++/// Set `call_records.custom_name` only when the existing value is `NULL`.+///+/// Used by the AI auto-naming flow so a user-set name is never overwritten.+/// No-op if no `call_records` row matches.+pub(super) async fn set_custom_name_if_null(+ transaction: &mut Transaction<'_, Postgres>,+ call_id: &Uuid,+ custom_name: &str,+) -> Result<(), sqlx::Error> {+ sqlx::query!(+ r#"UPDATE call_records SET custom_name = $2 WHERE id = $1 AND custom_name IS NULL"#,+ call_id,+ custom_name,+ )+ .execute(transaction.as_mut())+ .await?;+ Ok(())+}+/// Update the SharePermission row (isPublic, publicAccessLevel).async fn update_share_permission_row(transaction: &mut Transaction<'_, Postgres>,diff --git a/rust/cloud-storage/call/src/outbound/pg_call_repo/test.rs b/rust/cloud-storage/call/src/outbound/pg_call_repo/test.rsindex 0b7056a511..8e049b90a8 100644--- a/rust/cloud-storage/call/src/outbound/pg_call_repo/test.rs+++ b/rust/cloud-storage/call/src/outbound/pg_call_repo/test.rs@@ -1207,6 +1207,7 @@ async fn patch_call_record_sets_is_public_true_defaults_view(channel_share_permissions: None,}),share_with_team: None,+ custom_name: None,},).await?;@@ -1253,6 +1254,7 @@ async fn patch_call_record_sets_is_public_false_clears_public_access_level(channel_share_permissions: None,}),share_with_team: None,+ custom_name: None,},).await?;@@ -1289,6 +1291,7 @@ async fn patch_call_record_sets_public_access_level(pool: Pool<Postgres>) -> anychannel_share_permissions: None,}),share_with_team: None,+ custom_name: None,},).await?;@@ -1331,6 +1334,7 @@ async fn patch_call_record_adds_channel_share_permission(}]),}),share_with_team: None,+ custom_name: None,},).await?;@@ -1405,6 +1409,7 @@ async fn patch_call_record_removes_channel_share_permission(}]),}),share_with_team: None,+ custom_name: None,},).await?;@@ -1447,6 +1452,7 @@ async fn patch_call_record_none_is_noop(pool: Pool<Postgres>) -> anyhow::Result<&EditCallRecordRequest {share_permission: None,share_with_team: None,+ custom_name: None,},).await?;@@ -1467,6 +1473,152 @@ async fn patch_call_record_none_is_noop(pool: Pool<Postgres>) -> anyhow::Result<Ok(())}+// -- patch_call_record: custom_name -------------------------------------------++#[sqlx::test(+ fixtures(path = "../../../fixtures", scripts("call_repo")),+ migrator = "MACRO_DB_MIGRATIONS"+)]+async fn patch_call_record_sets_custom_name_on_archived_record(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = repo(pool.clone());++ repo.patch_call_record(+ &CALL_ARCHIVED,+ &EditCallRecordRequest {+ share_permission: None,+ share_with_team: None,+ custom_name: Some("Q4 sync".to_string()),+ },+ )+ .await?;++ let stored = sqlx::query_scalar!(+ r#"SELECT custom_name FROM call_records WHERE id = $1"#,+ CALL_ARCHIVED,+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(stored.as_deref(), Some("Q4 sync"));++ let record = repo.get_call_record_by_call_id(&CALL_ARCHIVED).await?;+ assert_eq!(+ record.and_then(|r| r.custom_name).as_deref(),+ Some("Q4 sync"),+ );+ Ok(())+}++#[sqlx::test(+ fixtures(path = "../../../fixtures", scripts("call_repo")),+ migrator = "MACRO_DB_MIGRATIONS"+)]+async fn patch_call_record_custom_name_overwrites_existing(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = repo(pool.clone());++ sqlx::query!(+ r#"UPDATE call_records SET custom_name = $2 WHERE id = $1"#,+ CALL_ARCHIVED,+ "Old name",+ )+ .execute(&pool)+ .await?;++ repo.patch_call_record(+ &CALL_ARCHIVED,+ &EditCallRecordRequest {+ share_permission: None,+ share_with_team: None,+ custom_name: Some("New name".to_string()),+ },+ )+ .await?;++ let stored = sqlx::query_scalar!(+ r#"SELECT custom_name FROM call_records WHERE id = $1"#,+ CALL_ARCHIVED,+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(stored.as_deref(), Some("New name"));+ Ok(())+}++#[sqlx::test(+ fixtures(path = "../../../fixtures", scripts("call_repo")),+ migrator = "MACRO_DB_MIGRATIONS"+)]+async fn patch_call_record_custom_name_empty_string_clears_existing(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = repo(pool.clone());++ sqlx::query!(+ r#"UPDATE call_records SET custom_name = $2 WHERE id = $1"#,+ CALL_ARCHIVED,+ "Existing",+ )+ .execute(&pool)+ .await?;++ repo.patch_call_record(+ &CALL_ARCHIVED,+ &EditCallRecordRequest {+ share_permission: None,+ share_with_team: None,+ custom_name: Some(String::new()),+ },+ )+ .await?;++ let stored = sqlx::query_scalar!(+ r#"SELECT custom_name FROM call_records WHERE id = $1"#,+ CALL_ARCHIVED,+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(stored, None);+ Ok(())+}++#[sqlx::test(+ fixtures(path = "../../../fixtures", scripts("call_repo")),+ migrator = "MACRO_DB_MIGRATIONS"+)]+async fn patch_call_record_custom_name_none_is_noop(pool: Pool<Postgres>) -> anyhow::Result<()> {+ let repo = repo(pool.clone());++ sqlx::query!(+ r#"UPDATE call_records SET custom_name = $2 WHERE id = $1"#,+ CALL_ARCHIVED,+ "Existing",+ )+ .execute(&pool)+ .await?;++ repo.patch_call_record(+ &CALL_ARCHIVED,+ &EditCallRecordRequest {+ share_permission: None,+ share_with_team: None,+ custom_name: None,+ },+ )+ .await?;++ let stored = sqlx::query_scalar!(+ r#"SELECT custom_name FROM call_records WHERE id = $1"#,+ CALL_ARCHIVED,+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(stored.as_deref(), Some("Existing"));+ Ok(())+}+// -- patch_call_record: share_with_team ---------------------------------------#[sqlx::test(@@ -1487,6 +1639,7 @@ async fn patch_call_record_share_with_team_true_grants_team_access_on_active_cal&EditCallRecordRequest {share_permission: None,share_with_team: Some(true),+ custom_name: None,},).await?;@@ -1540,6 +1693,7 @@ async fn patch_call_record_share_with_team_false_removes_team_access(&EditCallRecordRequest {share_permission: None,share_with_team: Some(false),+ custom_name: None,},).await?;@@ -1579,6 +1733,7 @@ async fn patch_call_record_share_with_team_works_on_archived_record(&EditCallRecordRequest {share_permission: None,share_with_team: Some(true),+ custom_name: None,},).await?;@@ -1650,6 +1805,7 @@ async fn patch_call_record_share_with_team_ignores_non_creator_teams(&EditCallRecordRequest {share_permission: None,share_with_team: Some(true),+ custom_name: None,},).await?;@@ -1683,6 +1839,7 @@ async fn patch_call_record_share_with_team_true_noop_when_creator_has_no_team(&EditCallRecordRequest {share_permission: None,share_with_team: Some(true),+ custom_name: None,},).await?;@@ -1704,6 +1861,73 @@ async fn patch_call_record_share_with_team_true_noop_when_creator_has_no_team(Ok(())}+// -- set_custom_name_if_null --------------------------------------------------++#[sqlx::test(+ fixtures(path = "../../../fixtures", scripts("call_repo")),+ migrator = "MACRO_DB_MIGRATIONS"+)]+async fn set_custom_name_if_null_writes_when_column_is_null(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = repo(pool.clone());++ repo.set_custom_name_if_null(&CALL_ARCHIVED, "AI Generated Name")+ .await?;++ let stored = sqlx::query_scalar!(+ r#"SELECT custom_name FROM call_records WHERE id = $1"#,+ CALL_ARCHIVED,+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(stored.as_deref(), Some("AI Generated Name"));+ Ok(())+}++#[sqlx::test(+ fixtures(path = "../../../fixtures", scripts("call_repo")),+ migrator = "MACRO_DB_MIGRATIONS"+)]+async fn set_custom_name_if_null_does_not_overwrite_existing_name(+ pool: Pool<Postgres>,+) -> anyhow::Result<()> {+ let repo = repo(pool.clone());++ sqlx::query!(+ r#"UPDATE call_records SET custom_name = $2 WHERE id = $1"#,+ CALL_ARCHIVED,+ "User Picked",+ )+ .execute(&pool)+ .await?;++ repo.set_custom_name_if_null(&CALL_ARCHIVED, "AI Generated")+ .await?;++ let stored = sqlx::query_scalar!(+ r#"SELECT custom_name FROM call_records WHERE id = $1"#,+ CALL_ARCHIVED,+ )+ .fetch_one(&pool)+ .await?;+ assert_eq!(stored.as_deref(), Some("User Picked"));+ Ok(())+}++#[sqlx::test(+ fixtures(path = "../../../fixtures", scripts("call_repo")),+ migrator = "MACRO_DB_MIGRATIONS"+)]+async fn set_custom_name_if_null_noop_for_unknown_id(pool: Pool<Postgres>) -> anyhow::Result<()> {+ let repo = repo(pool.clone());++ // Idempotent on missing rows — must not error.+ repo.set_custom_name_if_null(&Uuid::now_v7(), "Whatever")+ .await?;+ Ok(())+}+// -- insert_call_summary ------------------------------------------------------#[sqlx::test(diff --git a/rust/cloud-storage/macro_db_client/migrations/20260427120000_call_record_custom_name.sql b/rust/cloud-storage/macro_db_client/migrations/20260427120000_call_record_custom_name.sqlnew file mode 100644index 0000000000..eeb3ab6a16--- /dev/null+++ b/rust/cloud-storage/macro_db_client/migrations/20260427120000_call_record_custom_name.sql@@ -0,0 +1 @@+ALTER TABLE call_records ADD COLUMN custom_name TEXT;diff --git a/rust/cloud-storage/models_soup/src/call_record.rs b/rust/cloud-storage/models_soup/src/call_record.rsindex 47e44bf2e0..a71ad12dd5 100644--- a/rust/cloud-storage/models_soup/src/call_record.rs+++ b/rust/cloud-storage/models_soup/src/call_record.rs@@ -35,6 +35,8 @@ pub struct SoupCallRecord {pub duration_ms: Option<i64>,/// Resolved display name for the channel.pub channel_name: Option<String>,+ /// User-supplied or AI-generated display name for the call.+ pub custom_name: Option<String>,/// Whether the call is currently active.pub is_active: bool,/// Whether the requesting user attended this call (i.e. appears in the@@ -58,6 +60,7 @@ impl SoupCallRecord {ended_at: record.ended_at,duration_ms: record.duration_ms,channel_name: record.channel_name,+ custom_name: record.custom_name,is_active: record.is_active,attended,participants: recorddiff --git a/rust/cloud-storage/models_soup/src/call_record/test.rs b/rust/cloud-storage/models_soup/src/call_record/test.rsindex c135436799..7b38e2c83a 100644--- a/rust/cloud-storage/models_soup/src/call_record/test.rs+++ b/rust/cloud-storage/models_soup/src/call_record/test.rs@@ -17,6 +17,8 @@ fn record_with_participants(user_ids: &[&str]) -> CallRecord {recording_key: None,recording_url: None,channel_name: None,+ custom_name: None,+ summary: None,is_active: true,participants: user_ids.iter()