Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
b8ab156
refactor: DRY up Convex backend with shared validators, helpers, and …
larryro Feb 7, 2026
a3ef9f9
chore: regenerate OpenAPI spec after Convex backend refactor
larryro Feb 7, 2026
6130225
refactor: standardize Convex endpoint structure for clean OpenAPI paths
larryro Feb 7, 2026
de297fa
refactor: consolidate shared helpers, remove redundant types, and cle…
larryro Feb 7, 2026
234dd34
refactor: rename Convex endpoints to remove redundant suffixes and el…
larryro Feb 7, 2026
0b86bb6
refactor: eliminate type casts, DRY up validators, and remove obsolet…
larryro Feb 7, 2026
51e16ad
refactor: remove unused pagination opts and fix integration function …
larryro Feb 7, 2026
cf162e0
fix(conversations): consistent union argument order in return validator
larryro Feb 7, 2026
63ace12
fix(conversations): validate organizationId matches conversation befo…
larryro Feb 7, 2026
f2f62aa
fix(documents): remove misleading Record<string, never> cast from db.…
larryro Feb 7, 2026
c689eeb
fix(convex): add exhaustive default to hasRecordsInOrg switch
larryro Feb 7, 2026
5825f16
fix(members): replace type cast with type guard for BetterAuthCreateR…
larryro Feb 7, 2026
b85079d
fix(members): guard getMyTeams auth lookup with try/catch for consist…
larryro Feb 7, 2026
2a9f7eb
fix(review): use Doc<'products'>['metadata'] type for consistency wit…
larryro Feb 7, 2026
4ca4003
fix(streaming): remove unnecessary `as any` casts from streamId param…
larryro Feb 7, 2026
8e7ed6c
fix(team-members): add authorization, target validation, and duplicat…
larryro Feb 7, 2026
9955e10
fix(team-members): validate team belongs to organization before remov…
larryro Feb 7, 2026
08ce645
fix(team_members): add organization membership check before listing t…
larryro Feb 7, 2026
3e76d8b
fix(team-members): raise numItems cap from 100 to 1000 in listByTeam …
larryro Feb 7, 2026
4c0d793
fix(threads): remove redundant await in return statement
larryro Feb 7, 2026
0093fb8
fix(websites): add missing lastScannedAt field to patchWebsite call i…
larryro Feb 7, 2026
6a40bb6
fix(review): remove redundant spread and property assignment in getEx…
larryro Feb 7, 2026
b817bff
fix(workflow-engine): add auth and org membership checks to startWork…
larryro Feb 7, 2026
1d406f3
fix(convex): align output type with runtime validator using ConvexJso…
larryro Feb 7, 2026
b329ee5
refactor(convex): separate internal functions into dedicated internal…
larryro Feb 7, 2026
fdab254
fix(documents): add organization membership check to getDocumentById …
larryro Feb 7, 2026
1d2b971
fix(convex): correct module path in saveMessageMetadata function ref
larryro Feb 7, 2026
81012a2
fix(review): validate team belongs to organization in addMember mutation
larryro Feb 7, 2026
ead57c3
fix(human-input): default yes/no options in createHumanInputRequest m…
larryro Feb 7, 2026
596d3e4
refactor(convex): replace function_refs abstraction with direct inter…
larryro Feb 7, 2026
d89d5d4
fix(integrations): replace redundant dynamic import with existing sta…
larryro Feb 7, 2026
66646cb
fix(integrations): capture executedAt timestamp once in updateApprova…
larryro Feb 7, 2026
bceb422
refactor(chat): use shared getDefaultAgentRuntimeConfig helper instea…
larryro Feb 7, 2026
8011ee6
fix(approvals): add returns validator to getApprovalById for consistency
larryro Feb 7, 2026
efbaccd
fix(conversations): add org mismatch guard in addMessageToConversation
larryro Feb 7, 2026
6b99e68
fix(conversations): guard unknown metadata before object spread in ad…
larryro Feb 7, 2026
cc022d9
fix(conversations): correct lastId type declaration to match actual u…
larryro Feb 7, 2026
e026b29
fix(conversations): align metadata access pattern in extractSenderEmail
larryro Feb 7, 2026
98276a7
fix(customers): use customerSourceValidator for updates.source in upd…
larryro Feb 7, 2026
5cc77a1
fix(customers): tighten source array validation to use customerSource…
larryro Feb 7, 2026
5cb6b4d
fix(documents): make templateStorageId required in generatePptx actio…
larryro Feb 7, 2026
9fff95a
fix(documents): remove unused error field from createDocumentFromUplo…
larryro Feb 7, 2026
a232d65
fix(integrations): add explicit auth checks to create and update actions
larryro Feb 7, 2026
ee99a5a
refactor(integrations): use Object.fromEntries pattern for undefined …
larryro Feb 7, 2026
1dc43f9
refactor(helpers): reduce repetition in hasRecordsInOrg by removing s…
larryro Feb 7, 2026
2dbd335
perf(members): parallelize team lookups in getMyTeams with Promise.all
larryro Feb 7, 2026
32dd26f
fix(imap): add runtime guard for missing auth credentials in retrieve…
larryro Feb 7, 2026
cb05149
refactor(workflows): add explicit types to predefined workflows, remo…
larryro Feb 7, 2026
3f1714d
refactor(products): align metadata casting with established codebase …
larryro Feb 7, 2026
79f8151
fix(team_members): enforce admin/owner/self authorization when removi…
larryro Feb 7, 2026
08ebdba
fix(threads): add returns validator to getOrCreateSubThreadAtomic
larryro Feb 7, 2026
d79f3c1
fix(tone_of_voice): add missing authentication check to generateToneO…
larryro Feb 7, 2026
26f4eea
fix(tone_of_voice): prevent metadata erasure when args.metadata is om…
larryro Feb 7, 2026
ec679c3
fix(platform): add pagination scan limits and fix event propagation
larryro Feb 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export function ApprovalsClient({
const pageSize = 10;

const approvalsResult = useQuery(
api.approvals.queries.getApprovalsByOrganization,
api.approvals.queries.listApprovalsByOrganization,
{
organizationId,
status: status === 'pending' ? 'pending' : undefined,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useMutation } from 'convex/react';
import { api } from '@/convex/_generated/api';

// Note: Uses preloaded query with complex filters - params not predictable
export function useUpdateApprovalStatus() {
return useMutation(api.approvals.mutations.updateApprovalStatusPublic);
return useMutation(api.approvals.mutations.updateApprovalStatus);
}
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ function AutomationAssistantContent({

// Load workflow to get threadId from metadata (use public API)
const workflow = useQuery(
api.wf_definitions.queries.getWorkflowPublic,
api.wf_definitions.queries.getWorkflow,
automationId ? { wfDefinitionId: automationId } : 'skip',
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function AutomationNavigation({

// Fetch all versions of this automation
const versions = useQuery(
api.wf_definitions.queries.listVersionsPublic,
api.wf_definitions.queries.listVersions,
automation?.name && organizationId
? {
organizationId: organizationId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,12 @@ export function AutomationsClient({
organizationId,
searchTerm: searchTerm || undefined,
status: status && status.length > 0 ? status : undefined,
paginationOpts: { cursor: null, numItems: 1000 },
}),
[organizationId, searchTerm, status],
);

const automationsResult = useQuery(
api.wf_definitions.queries.getAutomations,
api.wf_definitions.queries.listAutomations,
queryArgs,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ export function ExecutionsClient({
dateFrom: dateFrom || undefined,
dateTo: dateTo || undefined,
cursor: undefined,
numItems: 1000,
numItems: pageSize,
}),
[amId, searchTerm, status, triggeredBy, dateFrom, dateTo],
[amId, searchTerm, status, triggeredBy, dateFrom, dateTo, pageSize],
);

const executionsResult = useQuery(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function useExecutionsTableConfig() {
columns,
searchPlaceholder: tCommon('search.placeholder'),
stickyLayout: true as const,
pageSize: 10,
pageSize: 30,
defaultSort: 'startedAt' as const,
defaultSortDesc: true,
infiniteScroll: true as const,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { api } from '@/convex/_generated/api';

// Note: Create operation - navigates to new automation page after creation
export function useCreateAutomation() {
return useMutation(api.wf_definitions.mutations.createWorkflowWithStepsPublic);
return useMutation(api.wf_definitions.mutations.createWorkflowWithSteps);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { api } from '@/convex/_generated/api';

// Note: Create operation - creates draft version from active workflow
export function useCreateDraftFromActive() {
return useMutation(api.wf_definitions.mutations.createDraftFromActivePublic);
return useMutation(api.wf_definitions.mutations.createDraftFromActive);
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/**
* Hook for creating workflow step definitions
*/

import { useMutation } from 'convex/react';
import { api } from '@/convex/_generated/api';

export function useCreateStep() {
return useMutation(api.wf_step_defs.mutations.createStepPublic);
return useMutation(api.wf_step_defs.mutations.createStep);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { api } from '@/convex/_generated/api';

// Note: Optimistic updates not added - automations table uses local state for filtering
export function useDeleteAutomation() {
return useMutation(api.wf_definitions.mutations.deleteWorkflowPublic);
return useMutation(api.wf_definitions.mutations.deleteWorkflow);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { api } from '@/convex/_generated/api';

// Note: Create operation - clones workflow with new ID
export function useDuplicateAutomation() {
return useMutation(api.wf_definitions.mutations.duplicateWorkflowPublic);
return useMutation(api.wf_definitions.mutations.duplicateWorkflow);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { api } from '@/convex/_generated/api';

// Note: Complex state change - converts draft to active version
export function usePublishAutomationDraft() {
return useMutation(api.wf_definitions.mutations.publishDraftPublic);
return useMutation(api.wf_definitions.mutations.publishDraft);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { api } from '@/convex/_generated/api';

// Note: Triggers workflow execution - creates execution record
export function useStartWorkflow() {
return useMutation(api.workflow_engine.engine.startWorkflow);
return useMutation(api.workflow_engine.mutations.startWorkflow);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { api } from '@/convex/_generated/api';

// Note: Updates workflow steps/config - complex nested structure
export function useUpdateAutomation() {
return useMutation(api.wf_definitions.mutations.updateWorkflowPublic);
return useMutation(api.wf_definitions.mutations.updateWorkflow);
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
/**
* Hook for updating workflow step definitions
*/

import { useMutation } from 'convex/react';
import { api } from '@/convex/_generated/api';

export function useUpdateStep() {
return useMutation(api.wf_step_defs.mutations.updateStepPublic);
return useMutation(api.wf_step_defs.mutations.updateStep);
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function HumanInputRequestCardComponent({
const [selectedValues, setSelectedValues] = useState<string[]>([]);

const submitResponse = useMutation(
api.agent_tools.human_input.submit_human_input_response.submitHumanInputResponse,
api.agent_tools.human_input.mutations.submitHumanInputResponse,
);

const isPending = status === 'pending';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function IntegrationApprovalCardComponent({
const [isRejecting, setIsRejecting] = useState(false);
const [error, setError] = useState<string | null>(null);

const updateApprovalStatus = useMutation(api.approvals.mutations.updateApprovalStatusPublic);
const updateApprovalStatus = useMutation(api.approvals.mutations.updateApprovalStatus);
const executeApprovedOperation = useAction(
api.approvals.actions.executeApprovedIntegrationOperation
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function WorkflowCreationApprovalCardComponent({

// No optimistic update: approval triggers external workflow creation action with
// side effects that cannot be safely rolled back if the mutation fails.
const updateApprovalStatus = useMutation(api.approvals.mutations.updateApprovalStatusPublic);
const updateApprovalStatus = useMutation(api.approvals.mutations.updateApprovalStatus);
const executeApprovedWorkflow = useAction(
api.approvals.actions.executeApprovedWorkflowCreation
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { api } from '@/convex/_generated/api';

// Note: Utility - returns URL, doesn't affect any query
export function useGenerateUploadUrl() {
return useMutation(api.file.mutations.generateUploadUrl);
return useMutation(api.files.mutations.generateUploadUrl);
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function useHumanInputRequests(threadId: string | undefined) {
*/
export function useSubmitHumanInputResponse() {
const submitMutation = useMutation(
api.agent_tools.human_input.submit_human_input_response.submitHumanInputResponse,
api.agent_tools.human_input.mutations.submitHumanInputResponse,
);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export async function improveMessage(
instruction?: string,
): Promise<{ improvedMessage: string; error?: string }> {
try {
const result = await fetchAction(api.improve_message.improveMessage, {
const result = await fetchAction(api.improve_message.actions.improveMessage, {
originalMessage,
instruction,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { api } from '@/convex/_generated/api';

// Note: Utility - returns URL, doesn't affect any query
export function useGenerateUploadUrl() {
return useMutation(api.file.mutations.generateUploadUrl);
return useMutation(api.files.mutations.generateUploadUrl);
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function DocumentPreviewDialog({

// Use documentId if available, otherwise use storagePath
const dataById = useQuery(
api.documents.queries.getDocumentByIdPublic,
api.documents.queries.getDocumentById,
open && Boolean(documentId)
? {
documentId: documentId as Id<'documents'>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function DocumentTeamTagsDialogContent({

// Fetch only teams that the current user belongs to
const teamsResult = useQuery(
api.member.getMyTeams,
api.members.queries.getMyTeams,
organizationId ? { organizationId } : 'skip',
);
const teams = teamsResult?.teams ?? null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function DocumentUploadDialog({

// Fetch user's teams via Convex query
const teamsResult = useQuery(
api.member.getMyTeams,
api.members.queries.getMyTeams,
open ? { organizationId } : 'skip',
);
const teams = teamsResult?.teams ?? null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function DocumentsClient({
);

const documentsResult = useQuery(
api.documents.queries.getDocumentsCursor,
api.documents.queries.listDocuments,
queryArgs,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ export function OneDriveImportDialog({

// Fetch user's teams via Convex query (only in settings stage)
const teamsResult = useConvexQuery(
api.member.getMyTeams,
api.members.queries.getMyTeams,
stage === 'settings' ? { organizationId } : 'skip',
);
const teams = teamsResult?.teams ?? null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export function RagStatusBadge({
[t],
);

const handleRetry = async () => {
const handleRetry = async (e: React.MouseEvent) => {
e.stopPropagation();
if (!documentId) {
toast({
title: t('rag.toast.documentIdRequired'),
Expand Down Expand Up @@ -135,7 +136,10 @@ export function RagStatusBadge({
<>
<button
type="button"
onClick={() => setIsCompletedDialogOpen(true)}
onClick={(e) => {
e.stopPropagation();
setIsCompletedDialogOpen(true);
}}
className="cursor-pointer"
aria-label={t('rag.dialog.indexed.title')}
>
Expand Down Expand Up @@ -168,7 +172,10 @@ export function RagStatusBadge({
<span className="inline-flex items-center gap-1.5">
<button
type="button"
onClick={() => setIsFailedDialogOpen(true)}
onClick={(e) => {
e.stopPropagation();
setIsFailedDialogOpen(true);
}}
className="cursor-pointer"
aria-label={t('rag.dialog.failed.title')}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { api } from '@/convex/_generated/api';
import { useT } from '@/lib/i18n/client';
import type { Id } from '@/convex/_generated/dataModel';

export { DOCUMENT_MAX_FILE_SIZE as MAX_FILE_SIZE_BYTES } from '@/lib/shared/file-types';
import { DOCUMENT_MAX_FILE_SIZE } from '@/lib/shared/file-types';

/**
* Calculate SHA-256 hash of a file using Web Crypto API
Expand Down Expand Up @@ -39,7 +39,6 @@ interface UploadFilesOptions {
interface CreateDocumentResult {
success: boolean;
documentId: Id<'documents'>;
error?: string;
}

interface UploadOptions {
Expand All @@ -52,7 +51,7 @@ export function useDocumentUpload(options: UploadOptions) {
const { t } = useT('documents');
const [isUploading, setIsUploading] = useState(false);
const abortControllerRef = useRef<AbortController | null>(null);
const generateUploadUrl = useMutation(api.file.mutations.generateUploadUrl);
const generateUploadUrl = useMutation(api.files.mutations.generateUploadUrl);
const createDocumentFromUpload = useMutation(
api.documents.mutations.createDocumentFromUpload,
);
Expand Down Expand Up @@ -82,8 +81,8 @@ export function useDocumentUpload(options: UploadOptions) {

// Check file sizes
for (const file of files) {
if (file.size > MAX_FILE_SIZE_BYTES) {
const maxSizeMB = MAX_FILE_SIZE_BYTES / (1024 * 1024);
if (file.size > DOCUMENT_MAX_FILE_SIZE) {
const maxSizeMB = DOCUMENT_MAX_FILE_SIZE / (1024 * 1024);
const fileSizeMB = (file.size / (1024 * 1024)).toFixed(1);
const error = t('upload.fileSizeExceeded', {
name: file.name,
Expand Down Expand Up @@ -164,7 +163,7 @@ export function useDocumentUpload(options: UploadOptions) {
(result: CreateDocumentResult) => !result.success,
);
if (failedUploads.length > 0) {
throw new Error(failedUploads[0].error || t('upload.uploadFailed'));
throw new Error(t('upload.uploadFailed'));
}

// Show success toast
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import { api } from '@/convex/_generated/api';
* where multiple products are created and proper validation is needed.
*/
export function useCreateProduct() {
return useMutation(api.products.mutations.createProductPublic);
return useMutation(api.products.mutations.createProduct);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { api } from '@/convex/_generated/api';

// Note: useAction - preloaded query with specific name param makes optimistic complex
export function useCreateIntegration() {
return useAction(api.integrations.actions.create.create);
return useAction(api.integrations.actions.create);
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export interface UseDeleteIntegrationParams {
}

export function useDeleteIntegration({ integrationName }: UseDeleteIntegrationParams) {
return useMutation(api.integrations.mutations.delete_integration.deleteIntegration);
return useMutation(api.integrations.mutations.deleteIntegration);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ import { useAction } from 'convex/react';
import { api } from '@/convex/_generated/api';

export function useSsoCredentials() {
return useAction(api.sso_providers.queries.getSsoCredentialsForEmail);
return useAction(api.sso_providers.actions.getSsoCredentialsForEmail);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { api } from '@/convex/_generated/api';

// Note: useAction returns test result - can't predict success/failure
export function useTestIntegration() {
return useAction(api.integrations.actions.test_connection.testConnection);
return useAction(api.integrations.actions.testConnection);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import { api } from '@/convex/_generated/api';

// Note: useAction - preloaded query with specific name param makes optimistic complex
export function useUpdateIntegration() {
return useAction(api.integrations.actions.update.update);
return useAction(api.integrations.actions.update);
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export function TeamCreateDialog({
const { t: tSettings } = useT('settings');
const { t: tCommon } = useT('common');
const { toast } = useToast();
const addMember = useMutation(api.team_members.addMember);
const addMember = useMutation(api.team_members.mutations.addMember);

const nameRequiredError = tSettings('teams.teamNameRequired');
const schema = useMemo(
Expand Down
Loading