export type TEmploid = { id: string; name: string; description: string; status: string; occupation: string; createdAt: string; updatedAt: string; }; export type TPaginatedEmploidsResult = { emploids: TEmploid[]; totalCount: number; hasMore: boolean; nextCursor?: string; }; export type TScope = { id: string; tenantId: string; workerId: string; parentScopeId?: string | null; name: string; description: string; type?: string; isFolderType?: boolean; content?: any; markdownContent?: string; createdAt?: string; updatedAt?: string; }; export type TWorkerBackgroundJobRule = { mode: "everyMinute" | "everyHour" | "everyDay" | "everyWeek" | "everyMonth" | "cronExpression"; interval?: number; minute?: number; hour?: number; weekday?: string | number; dayOfMonth?: number; cron?: string; }; export type TWorkerBackgroundJobSchedule = { timezone: string; rule: TWorkerBackgroundJobRule; }; export type TWorkerBackgroundJob = { id: string; scopeId: string; scheduledJobId: string | null; tenantId: string; workerId: string; parentScopeId: string | null; name: string; description: string; enabled: boolean; needsSchedule: boolean; cron: string | null; timezone: string | null; schedule: TWorkerBackgroundJobSchedule | null; lastRun: string | null; nextRun: string | null; lastExecutionId: string | null; lastExecutionStatus: string | null; createdAt: string | null; updatedAt: string | null; }; export type TWorkerBackgroundJobAttempt = { attempt: number; startedAt: string; endedAt: string; status: "completed" | "failed"; error?: string; responseMessageId?: string | null; }; export type TWorkerBackgroundJobExecution = { id: string; scheduledJobId: string; scheduledAt: string; startedAt: string | null; endedAt: string | null; executionTime: number | null; status: string; output: string | null; error: string | null; details?: { attempts?: TWorkerBackgroundJobAttempt[]; reason?: string; skipped?: boolean; nextRetryAt?: string; activeExecutionId?: string; request?: { text?: string; source?: string; platform?: string; userId?: string; channelId?: string; messageId?: string; requestId?: string; scopeId?: string; workerId?: string; executionId?: string; scheduledJobId?: string; }; response?: { messageId?: string | null; attachments?: unknown[]; knowledgeTrace?: unknown; }; scopeId?: string; workerId?: string; [key: string]: unknown; } | null; createdAt: string; updatedAt: string; }; export type TWorkerBackgroundJobExecutionPage = { items: TWorkerBackgroundJobExecution[]; nextCursor: string | null; }; export type TClearWorkerBackgroundJobExecutionsResult = { deletedCount: number; cancelledActiveCount: number; retainedActiveCount: number; }; export type TOccupation = { tenantId: string; id: string; name: string; description: string; topics: TDomainTopic[]; }; export type TDomainTopic = { id: string; title: string; prompt: string; instructions: string[]; }; export type TJobDefinition = { id: string; emploidId: string; scopeId: string; name: string; description: string; category: string; priority: string; status: string; }; export type TCompetency = { id: string; emploidId: string; scopeId: string; jobDefinitionId: string; name: string; description: string; inputs: any[]; }; export type TKnowledgeTreeExportPayload = { schema: "emploid.knowledge-tree"; version: 1; exportedAt: string; source: { tenantId: string; workerId: string; }; scopes: Array; jobDefinitions: Array; competencies: Array; references: Array<{ id: string; pageId: string | null; workspaceId: string | null; type: string; name: string; content: string; previewContent: string | null; createdBy: string | null; updatedBy: string | null; createdAt?: string | null; updatedAt?: string | null; }>; assets?: Array<{ id: string; fileName: string; mimeType: string; pageId: string | null; size: number; dataBase64: string; createdAt: string; updatedAt: string; }>; }; export type TKnowledgeTreeImportResult = { scopes: TScope[]; jobDefinitions: TJobDefinition[]; competencies: TCompetency[]; }; export type TAgentFlow = { id: string; name: string; description: string | null; folderId: string | null; }; export type TDataModelAgentFlow = { id: string; dataModelId: string; name: string; description: string | null; updatedAt: string; }; export type TDataModelAgentFlowPage = { items: TDataModelAgentFlow[]; total: number; }; export type TDeleteAgentFlowResult = { deleted: boolean; id: string; }; export type TAgentFlowFolder = { id: string; name: string; description: string; tenantId?: string; visibility?: "public" | "private"; ownerId?: string | null; agentFlows: TAgentFlow[]; }; export type TExtension = { tenantId: string; id: string; extensionId: string; config: any; }; export type TAssistant = { id: string; alias: string; name: string; description: string; prompt: string; config: { mode: "simple" | "advanced"; }; }; export type TAssistantInstruction = { tenantId: string; id: string; title: string; prompt: string; instructions: any; assistantId: string; assistant: TAssistant; createdAt: string; updatedAt: string; }; export type TAssistantConstraint = { tenantId: string; id: string; title: string; prompt: string; constraints: any; assistantId: string; assistant: TAssistant; createdAt: string; updatedAt: string; }; export type TAssistantDatasource = { tenantId: string; id: string; type: string; assistantId: string; name: string; config: any; }; export type TAssistantSkill = { tenantId: string; id: string; type: string; assistantId: string; name: string; config: any; }; export type TAssistantChannel = { tenantId: string; id: string; type: string; assistantId: string; name: string; config: any; }; export type TWorker = { id: string; emploidId: string; marketStoreId?: string | null; emploid: TEmploid; name: string; description: string; avatar: string; agentContainerImage: string; modelSettings?: Record | null; status: string; version: number; publishDate: string; }; export type TInput = { id: string; emploidId: string; competencyId: string; name: string; description: string; type: string; }; export type TTeam = { id: string; alias: string; name: string; description: string; }; export type TChat = { id: string; createdAt: string; title: string; userId: string; visibility: string; lastContext: any; }; export type TDocument = { id: string; createdAt: string; title: string; content?: string; kind: string; userId: string; }; export type TUploadedFile = { id?: string; fileId?: string; bucketId?: string; fileName?: string; path?: string; pathname?: string; url?: string; filePath?: string; contentType?: string; mimeType?: string; fileSize?: number; size?: number; type?: string; createdAt?: string; updatedAt?: string; [key: string]: any; }; export type TDriveBreadcrumb = { id: string; name: string; }; export type TDriveRootProvider = "LOCAL" | "GOOGLE_DRIVE" | "DROPBOX"; export type TDriveRoot = { id: string; tenantId: string; provider: TDriveRootProvider; name: string; credentialId?: string | null; remoteRootId?: string | null; remoteRootPath?: string | null; isDefaultLocal: boolean; createdAt?: string; updatedAt?: string; }; export type TDriveProviderFolder = { id: string; name: string; parentId?: string | null; path?: string | null; }; export type TDriveItem = { id: string; tenantId: string; rootId?: string; provider?: TDriveRootProvider; isRemote?: boolean; name: string; normalizedName?: string; kind: string; status: string; parentId?: string | null; storageKey?: string | null; mimeType?: string | null; extension?: string | null; sizeBytes?: number | null; createdBy?: string | null; updatedBy?: string | null; createdAt?: string; updatedAt?: string; breadcrumbs?: TDriveBreadcrumb[]; downloadPath?: string | null; }; export type TDriveTreeNode = { id: string; tenantId: string; rootId?: string; provider?: TDriveRootProvider; name: string; parentId?: string | null; kind: string; children: TDriveTreeNode[]; }; export type TPreparedDriveUpload = { item: TDriveItem; uploadPath: string; downloadPath: string; }; export type TDriveDeleteImpact = { itemId: string; name: string; kind: string; totalItems: number; totalFiles: number; totalFolders: number; totalBytes: number; }; export type TDriveFileContent = { item: TDriveItem; base64: string; content: string | null; mimeType: string; sizeBytes: number; }; export type TDriveFileTextContent = { item: TDriveItem; content: string; text: string; extracted: boolean; extractionMethod: string; mimeType: string; sizeBytes: number; }; export type TWikiFileViewResolution = { fileId: string; path: string; url: string; filePath: string; [key: string]: any; }; export type TStreamId = { id: string; chatId: string; createdAt: string; }; export type TInstruction = { id: string; emploidId: string; content: string; type: string; active: boolean; }; export type TConstraint = { id: string; emploidId: string; content: string; type: string; active: boolean; }; export type TCommand = { id: string; tenantId: string; name: string; description: string; type: string; targetId: string; targetType: string; }; export type TTaskTemplate = { id: string; task: string; description?: string | null; tenantId: string; emploidId?: string | null; workerId?: string | null; }; export type TWikiPageStatus = "DRAFT" | "PUBLISHED" | "ARCHIVED"; export type TWikiPageNodeType = "DOCUMENT" | "FOLDER"; export interface TWikiPage { id: string; tenantId: string; workspaceId: string; title: string; slug: string; description?: string; icon?: string | null; iconColor?: string | null; fullPageWidth?: boolean; parentId?: string; nodeType?: TWikiPageNodeType; sortOrder?: number; status: TWikiPageStatus; createdAt: string; updatedAt: string; deletedAt?: string; parent?: TWikiPage; children?: TWikiPage[]; revisions?: TWikiRevision[]; revisionCount?: number; content?: any; contentText?: string; canView?: boolean; canEdit?: boolean; canDelete?: boolean; canManage?: boolean; userState?: TWikiPageUserState; } export type TWikiPageUserState = { isFavorite: boolean; isWatching: boolean; }; export type TWikiSpace = { id: string; tenantId: string; name: string; description?: string | null; icon?: string | null; iconColor?: string | null; visibility?: string | null; ownerId?: string | null; createdBy?: string | null; updatedBy?: string | null; createdAt: string; updatedAt: string; deletedAt?: string | null; }; export type TWikiAiSetting = { id: string; tenantId: string; workspaceId?: string | null; credentialId?: string | null; chatModelName: string; modelName: string; llmModel?: string | null; llmModelConfig?: Record | null; createdAt?: string; updatedAt?: string; }; export type TWikiAiCommand = { id: string; tenantId: string; workspaceId?: string | null; key: string; title: string; description?: string | null; icon?: string | null; prompt: string; sortOrder: number; isSystem: boolean; createdAt?: string; updatedAt?: string; }; export type TWikiAiRunResult = { content: any; }; export interface TWikiRevision { id: string; wikiPageId: string; content: any; createdBy: string; createdAt: string; } export interface TWikiCommentUser { id: string; name: string; avatarUrl: string; } export interface TWikiComment { id: string; pageId: string; parentCommentId?: string | null; content: string; selection?: string | null; creatorId: string; workspaceId: string; resolvedAt?: string | null; resolvedById?: string | null; createdAt: string; editedAt?: string | null; deletedAt?: string | null; creator: TWikiCommentUser; resolvedBy?: TWikiCommentUser | null; } export interface TWikiCommentPagination { items: TWikiComment[]; meta: { page: number; limit: number; hasNextPage: boolean; hasPrevPage: boolean; }; } export type TWikiReference = { id: string; tenantId: string; workspaceId?: string | null; pageId?: string | null; type: string; name: string; content: string; previewContent?: string | null; createdBy?: string | null; updatedBy?: string | null; createdAt?: string | Date; updatedAt?: string | Date; deletedAt?: string | Date | null; }; export type TWikiReferenceListResponse = { items: TWikiReference[]; total: number; limit: number; offset: number; }; export type TDataModel = { id: string; name: string; displayName: string; description?: string | null; importSource?: string | null; }; export type TCollection = { tenantId: string; dataModel: TDataModel; id: string; name: string; displayName: string; description?: string | null; stats?: { totalFields: number; activeFields: number; deletedFields: number; data: string; storage: string; }; fields?: TCollectionField[]; archived?: boolean; ignoredFields?: string[]; }; export type TCollectionChecklistItem = { id: string; text: string; checked: boolean; }; export type TCollectionSignatureValue = { kind: "typed" | "drawn"; value: string; signedAt: string; signedBy: string; }; /** Client write shape; provenance is always attached by the collection service. */ export type TCollectionSignatureInput = Pick; export type TCollectionUserReference = string | { id: string; name?: string; email?: string; }; export type TCollectionDerivedCondition = { fieldId: string; fieldName?: string; operator: "eq" | "neq" | "contains" | "not-contains" | "gt" | "gte" | "lt" | "lte" | "is-empty" | "is-not-empty"; value?: unknown; }; export type TCollectionFieldConfig = { [key: string]: any; relationFieldId?: string; relationFieldName?: string; relationId?: string; targetCollectionId?: string; targetFieldId?: string; targetFieldName?: string; resultMode?: "first" | "list"; operation?: "count" | "count-values" | "count-unique" | "sum" | "average" | "min" | "max"; condition?: TCollectionDerivedCondition; maxItems?: number; min?: number; max?: number; precision?: number; mode?: "typed" | "drawn" | "both"; source?: "organization" | "users" | "employees" | "both"; includeInactive?: boolean; }; export type TCollectionField = { id: string; collectionId: string; dataModelId: string; name: string; displayName: string; type: string; required: boolean; config?: TCollectionFieldConfig; order?: number; deletedAt?: string; deletedBy?: string; }; export type TCsvImportInvalidRowPolicy = "reject" | "skip-row" | "set-null"; export type TCsvImportRowRepair = { rowIndex: number; fieldId: string; value: unknown; }; export type TCsvImportRowIssue = { rowIndex: number; fieldId: string; fieldName: string; code: "required" | "type" | "option" | "relation_config" | "relation_cardinality"; message: string; rawValue: unknown; }; export type TCsvImportRowPreview = { totalRows: number; validRows: number; invalidRows: number; acceptedRows: number; skippedRows: number; blockingIssueCount: number; issues: TCsvImportRowIssue[]; truncatedIssueCount: number; invalidRowPolicy: TCsvImportInvalidRowPolicy; }; export type TCollectionRecord = { id: string; data: Record; meta?: Record; }; export type TCollectionRecordPage = { query?: string; total: number; limit: number; offset: number; items: TCollectionRecord[]; /** Compatibility alias returned for older consumers. */ records?: TCollectionRecord[]; }; export type TBulkUpdateRecordsResult = { matchedCount: number; modifiedCount: number; }; export type TCollectionFieldOrder = { fieldId: string; order: number; }; export type TReorderCollectionFieldsResult = { collectionId: string; reorderedCount: number; orderStep: number; fields: TCollectionFieldOrder[]; }; export type TRecordPermission = { id: string; recordId: string; subjectType: string; subjectId: string; actor: string; action: string; effect: "allow" | "deny"; createdBy?: string; createdAt?: string | Date; }; export type TCollectionAccessPolicyScopeType = "app" | "list" | "field"; export type TCollectionAccessPolicySubjectType = "user" | "role" | "team" | "service"; export type TCollectionAccessPolicyEffect = "allow" | "deny"; export type TCollectionAccessPolicyAction = "read" | "create" | "update" | "delete" | "comment" | "assign"; export type TCollectionAccessPolicyRowOperator = "me" | "user" | "team" | "linked-record"; export type TCollectionAccessPolicyRowFilter = { match: "all" | "any"; conditions: Array<{ fieldId: string; operator: TCollectionAccessPolicyRowOperator; value?: string; }>; }; export type TCollectionAccessPolicy = { id: string; tenantId: string; dataModelId: string; collectionId: string | null; fieldId: string | null; name: string; scopeType: TCollectionAccessPolicyScopeType; subjectType: TCollectionAccessPolicySubjectType; subjectId: string; effect: TCollectionAccessPolicyEffect; actions: TCollectionAccessPolicyAction[]; rowFilter: TCollectionAccessPolicyRowFilter | null; enabled: boolean; createdAt?: string | Date; updatedAt?: string | Date; createdBy?: string; updatedBy?: string; }; export type TCollectionAccessPolicyPreview = { valid: true; policy: Omit & { id?: string; }; currentActorMatches: boolean; preview: { allowed: boolean; reason: string; } | null; }; export type TCollectionAccessTeamMember = { id: string; teamId: string; userId: string; createdAt: string | Date; createdBy: string; }; export type TSetCollectionAccessTeamMembersResult = { teamId: string; userIds: string[]; memberCount: number; updatedBy: string; }; export type TCollectionFormLayoutField = { fieldId: string; label?: string; helpText?: string; placeholder?: string; required?: boolean; width?: "full" | "half"; }; export type TCollectionFormLayoutSection = { id: string; title?: string; description?: string; fields: TCollectionFormLayoutField[]; }; export type TCollectionFormLayout = { sections: TCollectionFormLayoutSection[]; }; export type TCollectionFormStatus = "draft" | "published" | "archived"; export type TCollectionForm = { id: string; tenantId: string; dataModelId: string; collectionId: string; name: string; description: string; layout: TCollectionFormLayout; submitLabel: string; successMessage: string; enabled: boolean; status: TCollectionFormStatus; serviceSubjectId: string; tokenHint: string | null; publishedAt: string | null; expiresAt: string | null; revokedAt: string | null; rateLimitPerMinute: number; maxSubmissions: number | null; submissionCount: number; createdAt: string | null; updatedAt: string | null; createdBy: string; updatedBy: string; }; export type TResolvedCollectionFormField = { id: string; type: string; label: string; helpText?: string; placeholder?: string; required: boolean; width?: "full" | "half"; config?: Record; }; export type TResolvedCollectionFormSection = { id: string; title?: string; description?: string; fields: TResolvedCollectionFormField[]; }; export type TResolvedCollectionForm = { name: string; description?: string; submitLabel: string; successMessage: string; expiresAt?: string | null; sections: TResolvedCollectionFormSection[]; }; export type TResolvedInternalCollectionForm = TCollectionForm & { sections: TResolvedCollectionFormSection[]; }; export type TCollectionFormPublishResult = { form: TCollectionForm; token: string; }; export type TCollectionFormSubmissionResult = { submissionId: string; successMessage: string; idempotent: boolean; recordId?: string | null; }; export type TCollectionAppGenerationField = { name: string; displayName: string; type: string; required: boolean; config: Record; }; export type TCollectionAppGenerationView = { name: string; type: "grid" | "board" | "calendar"; config: Record; }; export type TCollectionAppGenerationProposal = { version: 1; app: { name: string; displayName: string; }; collections: Array<{ name: string; displayName: string; fields: TCollectionAppGenerationField[]; views: TCollectionAppGenerationView[]; }>; }; export type TCollectionAppGenerationDiff = { version: 1; destructive: false; summary: { creates: number; updates: number; deletes: number; }; operations: Array<{ operation: "create"; kind: "dataModel" | "collection" | "field" | "view"; path: string; displayName?: string; fieldType?: string; viewType?: string; required?: boolean; }>; }; export type TCollectionAppGenerationResources = { dataModel: { id: string; name: string; }; collections: Array<{ id: string; name: string; }>; }; export type TCollectionAppGenerationRun = { id: string; planId: string; tenantId: string; status: string; createdResources: TCollectionAppGenerationResources | null; errorCode: string | null; errorMessage: string | null; applyActorId: string; rollbackActorId: string | null; appliedAt: string | Date | null; rolledBackAt: string | Date | null; rollbackMetadataDeletedAt: string | Date | null; createdAt: string | Date; updatedAt: string | Date; }; export type TCollectionAppGenerationPlan = { id: string; tenantId: string; prompt: string; promptHash: string; proposal: TCollectionAppGenerationProposal; proposalHash: string; diff: TCollectionAppGenerationDiff; status: string; activeRunId: string | null; createdBy: string; createdAt: string | Date; updatedAt: string | Date; runs: TCollectionAppGenerationRun[]; }; export type TCollectionAppGenerationPlanPage = { items: TCollectionAppGenerationPlan[]; nextOffset: number | null; }; export type TCollectionAppGenerationRunPage = { items: TCollectionAppGenerationRun[]; nextOffset: number | null; }; export type TCollectionReportType = "table" | "metric" | "chart"; export type TCollectionReportVisibility = "personal" | "shared"; export type TCollectionReportTableConfig = { filter?: Record; fields: string[]; sort?: Record; limit?: number; }; export type TCollectionReportAggregateConfig = { filter?: Record; aggregate: "count" | "sum" | "avg" | "min" | "max"; valueField?: string; groupBy?: string; limit?: number; }; export type TCollectionReport = { id: string; tenantId: string; dataModelId: string; collectionId: string; name: string; description: string | null; type: TCollectionReportType; visibility: TCollectionReportVisibility; ownerId: string; config: TCollectionReportTableConfig | TCollectionReportAggregateConfig | null; available: boolean; unavailableReason?: string; canEdit: boolean; createdAt: string | Date; updatedAt: string | Date; createdBy: string; updatedBy: string; }; export type TCollectionReportPage = { total: number; limit: number; offset: number; items: TCollectionReport[]; }; export type TCollectionReportTableResult = { type: "table"; fields: Array<{ name: string; displayName: string; type: string; }>; items: Array<{ id: string; data: Record; }>; count: number; truncated: boolean; }; export type TCollectionReportMetricResult = { type: "metric"; value: number; }; export type TCollectionReportChartResult = { type: "chart"; points: Array<{ label: string | number | boolean | null; value: number; }>; truncated: boolean; }; export type TCollectionReportResult = TCollectionReportTableResult | TCollectionReportMetricResult | TCollectionReportChartResult; export type TCollectionReportEvaluation = { report: TCollectionReport; result: TCollectionReportResult; evaluatedAt: string | Date; }; export type TCollectionDashboardWidget = { id: string; title: string; type: TCollectionReportType; order: number; reportId: string | null; reportName?: string; config: Record | null; available: boolean; unavailableReason?: string; createdAt: string | Date; updatedAt: string | Date; }; export type TCollectionDashboard = { id: string; tenantId: string; dataModelId: string; collectionId: string; name: string; description: string | null; visibility: TCollectionReportVisibility; ownerId: string; settings: { columns: number; compact: boolean; }; widgets: TCollectionDashboardWidget[]; canEdit: boolean; createdAt: string | Date; updatedAt: string | Date; createdBy: string; updatedBy: string; }; export type TCollectionDashboardPage = { total: number; limit: number; offset: number; items: TCollectionDashboard[]; }; export type TCollectionDashboardEvaluation = { dashboard: TCollectionDashboard; widgets: Array<{ widgetId: string; status: "ready" | "unavailable"; result?: TCollectionReportResult; error?: string; }>; evaluatedAt: string | Date; }; export type TCollectionComment = { id: string; parentId: string | null; authorId: string; body: string | null; mentionUserIds: string[]; createdAt: string | Date; updatedAt: string | Date; editedAt?: string | Date | null; deletedAt?: string | Date | null; canEdit?: boolean; canDelete?: boolean; }; export type TCollectionCommentPage = { comments: TCollectionComment[]; total: number; limit: number; offset: number; hasMore: boolean; }; export type TCollectionRecordActivity = { id: string; type: string; actorId: string; resourceType?: string | null; resourceId?: string | null; payload?: Record | null; createdAt: string | Date; }; export type TCollectionRecordEvent = { id: string; type: string; actorId: string; source?: string | null; createdAt: string | Date; }; export type TCollectionRecordActivityPage = { activity: TCollectionRecordActivity[]; total: number; recordEvents: TCollectionRecordEvent[]; recordEventTotal: number; limit: number; offset: number; hasMore: boolean; recordEventsHasMore: boolean; }; export type TCollectionRecordCollaborator = { id: string; userId: string; kind: "assignee" | "watcher"; createdAt: string | Date; createdBy: string; }; export type TCollectionRecordCollaborators = { assigneeIds: string[]; watcherIds: string[]; collaborators: TCollectionRecordCollaborator[]; updatedBy?: string; }; export type TCollectionNotification = { id: string; type: string; actorId: string; collectionId?: string | null; recordId?: string | null; resourceType?: string | null; resourceId?: string | null; payload?: Record | null; readAt?: string | Date | null; createdAt: string | Date; }; export type TCollectionNotificationPage = { notifications: TCollectionNotification[]; unreadCount: number; limit: number; offset: number; nextOffset: number; hasMore: boolean; }; export type TRecordPermissionDecision = { action: string; allowed: boolean; reason?: string; }; export type TRecordPermissionListResult = { recordId: string; actor?: string; reason?: string; permissions: Array; }; export type TGrantRecordPermissionResult = { recordId: string; subjectType: string; subjectId: string; actor: string; actions: string[]; action?: string; effect: "allow" | "deny"; id?: string; permissions: TRecordPermission[]; }; export type TRevokeRecordPermissionResult = { recordId: string; subjectType: string; subjectId: string; actor: string; actions: string[]; action?: string; revoked: boolean; revokedCount: number; revokedBy: string; }; export type TCollectionRelation = { id: string; fieldId: string; fieldName: string; displayName: string; description?: string; cardinality: "one" | "many"; inverseCardinality: "one" | "many"; targetCollectionId: string; targetCollection?: { id: string; name: string; displayName: string; } | null; targetFieldId?: string | null; targetFieldName?: string | null; targetFieldDisplayName?: string | null; }; export type TAutomationRuleTriggerType = "created" | "updated" | "linked" | "unlinked" | "schedule"; export type TCollectionAutomationRuleConditionOperator = "is" | "is-not" | "contains" | "is-empty" | "is-not-empty"; export type TCollectionAutomationRuleTriggerConfig = { updatedFieldId?: string | null; cron?: string | null; timezone?: string | null; maxRecords?: number; }; export type TCollectionAutomationRuleCondition = { id: string; fieldId: string; operator: TCollectionAutomationRuleConditionOperator; value?: string | string[] | boolean | null; }; export type TAutomationRuleActionType = "create" | "update" | "delete" | "append-description" | "script" | "conditional-branch" | "find-records" | "for-each" | "copy-record" | "move-record" | "webhook" | "approval"; export type TAutomationRuleAction = { id: string; type: TAutomationRuleActionType | null; fieldId?: string | null; value?: string; valueMode?: "literal" | "formula"; formula?: string; template?: string; script?: string; condition?: TCollectionAutomationRuleCondition | null; thenActions?: TAutomationRuleAction[]; elseActions?: TAutomationRuleAction[]; collectionId?: string | null; filters?: TCollectionAutomationRuleCondition[]; limit?: number; resultKey?: string; sourceKey?: string; maxIterations?: number; actions?: TAutomationRuleAction[]; targetCollectionId?: string | null; fieldMap?: Record; url?: string; method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE"; headers?: Record; body?: unknown; timeoutMs?: number; approverIds?: string[]; approvalMessage?: string; }; export type TAutomationRuleActivityItem = { id: string; message: string; createdAt: string; }; export type TCollectionAutomationRule = { id: string; tenantId: string; dataModelId: string; collectionId: string; name: string; description: string; enabled: boolean; trigger: TAutomationRuleTriggerType; triggerConfig?: TCollectionAutomationRuleTriggerConfig | null; conditions?: TCollectionAutomationRuleCondition[]; actions: TAutomationRuleAction[]; activity: TAutomationRuleActivityItem[]; createdBy?: string | null; updatedBy?: string | null; createdAt: string; updatedAt: string; }; export type TCollectionAutomationExecutionStatus = "queued" | "running" | "waiting_approval" | "succeeded" | "failed" | "skipped" | "cancelled"; export type TCollectionAutomationStepExecution = { id: string; actionId: string; actionType: string; sequence: number; status: string; output?: Record | null; error?: string | null; startedAt: string; finishedAt?: string | null; }; export type TCollectionAutomationApproval = { id: string; actionId: string; status: "pending" | "approved" | "rejected"; approverIds: string[]; message: string; requestedBy: string; decidedBy?: string | null; decisionNote?: string; decidedAt?: string | null; createdAt: string; }; export type TCollectionAutomationExecution = { id: string; tenantId: string; dataModelId: string; collectionId: string; ruleId?: string | null; ruleName?: string | null; recordId?: string | null; trigger: TAutomationRuleTriggerType; status: TCollectionAutomationExecutionStatus; attempt: number; maxAttempts: number; principalType: "user" | "service"; principalId: string; output?: Record | null; error?: string | null; nextAttemptAt?: string | null; startedAt?: string | null; finishedAt?: string | null; createdAt: string; updatedAt: string; steps: TCollectionAutomationStepExecution[]; approvals: TCollectionAutomationApproval[]; }; export type TCollectionAutomationExecutionPage = { items: TCollectionAutomationExecution[]; nextCursor?: string | null; }; export type TCollectionViewColumn = { fieldName: string; visible: boolean; width?: number; }; export type TCollectionGridViewConfig = { version: 1; columns: TCollectionViewColumn[]; filters: TCollectionBoardFilterRule[]; gridEngine: "canvas" | "ag-grid" | "tanstack"; sorts: TCollectionBoardSortRule[]; }; export type TCollectionBoardCardSize = "small" | "medium" | "large"; export type TCollectionBoardColorMode = "group" | "none"; export type TCollectionBoardFilterOperator = "is" | "is-not" | "contains" | "is-empty" | "is-not-empty"; export type TCollectionBoardFilterRule = { id: string; fieldName: string; operator: TCollectionBoardFilterOperator; value?: string | string[] | boolean | null; }; export type TCollectionBoardSortRule = { id: string; fieldName: string; direction: "asc" | "desc"; }; export type TCollectionBoardGroupVisibleFieldOverride = { groupId: string; visibleFieldNames: string[]; }; export type TCollectionBoardViewConfig = { version: 1; columns: TCollectionViewColumn[]; titleFieldName: string; groupByFieldName: string; columnOrder: string[]; hiddenColumnIds: string[]; cardOrderByColumn?: Record; cardSize: TCollectionBoardCardSize; filters: TCollectionBoardFilterRule[]; sorts: TCollectionBoardSortRule[]; colorMode: TCollectionBoardColorMode; groupVisibleFieldOverrides: TCollectionBoardGroupVisibleFieldOverride[]; }; export type TCollectionCalendarDefaultMode = "month" | "week" | "agenda"; export type TCollectionCalendarViewConfig = { version: 1; columns: TCollectionViewColumn[]; titleFieldName: string; startDateFieldName: string; endDateFieldName: string; colorFieldName: string; defaultMode: TCollectionCalendarDefaultMode; filters: TCollectionBoardFilterRule[]; sorts: TCollectionBoardSortRule[]; }; export type TCollectionPresentationViewConfigBase = { version: 1; columns: TCollectionViewColumn[]; filters: TCollectionBoardFilterRule[]; sorts: TCollectionBoardSortRule[]; }; export type TCollectionTimelineViewConfig = TCollectionPresentationViewConfigBase & { titleFieldName: string; startDateFieldName: string; endDateFieldName: string; groupByFieldName: string; }; export type TCollectionTreeViewConfig = TCollectionPresentationViewConfigBase & { labelFieldName: string; parentRelationFieldName: string; }; export type TCollectionGalleryViewConfig = TCollectionPresentationViewConfigBase & { imageFieldName: string; titleFieldName: string; summaryFieldName: string; }; export type TCollectionMapViewConfig = TCollectionPresentationViewConfigBase & { titleFieldName: string; locationFieldName: string; latitudeFieldName: string; longitudeFieldName: string; }; export type TCollectionDocumentViewConfig = TCollectionPresentationViewConfigBase & { titleFieldName: string; bodyFieldName: string; metadataFieldNames: string[]; }; export type TCollectionViewConfig = TCollectionGridViewConfig | TCollectionBoardViewConfig | TCollectionCalendarViewConfig | TCollectionTimelineViewConfig | TCollectionTreeViewConfig | TCollectionGalleryViewConfig | TCollectionMapViewConfig | TCollectionDocumentViewConfig; export type TCollectionViewType = "grid" | "board" | "calendar" | "timeline" | "tree" | "gallery" | "map" | "document"; export type TCollectionViewVisibility = "shared" | "personal"; export type TCollectionViewPreference = { columns: TCollectionViewColumn[]; updatedAt?: string; }; export type TCollectionView = { id: string; tenantId: string; dataModelId: string; collectionId: string; name: string; type: TCollectionViewType; config: TCollectionViewConfig; visibility?: TCollectionViewVisibility; ownerId?: string | null; isOwner?: boolean; canEdit?: boolean; preference?: TCollectionViewPreference | null; createdAt: string; updatedAt: string; }; export type TCollectionViewPreferenceResult = { viewId: string; userId: string; columns: TCollectionViewColumn[]; updatedAt: string; }; export type TCollectionButtonAction = TAutomationRuleAction; export type TCollectionButtonActivityItem = TAutomationRuleActivityItem; export type TCollectionButton = { id: string; tenantId: string; dataModelId: string; collectionId: string; name: string; description: string; enabled: boolean; actions: TCollectionButtonAction[]; activity: TCollectionButtonActivityItem[]; createdAt: string; updatedAt: string; }; export type TRelationRecordOption = { id: string; label: string; collectionId: string; }; export type TDatasource = { id: string; tenantId: string; entityId: string; name: string; description: string; type: string; config: any; }; export type TSkill = { id: string; tenantId: string; entityId: string; name: string; description: string; type: string; config: any; }; export type TChannel = { id: string; tenantId: string; entityId: string; name: string; description: string; type: string; config: any; }; export type TWorkerChannelMessage = { id: string; tenantId: string; channelId: string; workerId: string; provider: string; direction: 'INBOUND' | 'OUTBOUND'; providerMessageId?: string | null; idempotencyKey?: string | null; inReplyToMessageId?: string | null; inReplyToProviderMessageId?: string | null; fromAddress: string; toAddress: string; kind: string; body?: string | null; media?: unknown; status: string; attemptCount?: number; nextAttemptAt?: string | null; leaseExpiresAt?: string | null; error?: string | null; processedAt?: string | null; createdAt: string; updatedAt: string; }; export type TWorkerWhatsAppMessageHistory = { channel: { id: string; name: string; provider: string; mode: 'sandbox' | 'production'; senderAddress: string; status: string; } | null; messages: TWorkerChannelMessage[]; nextCursor: string | null; }; export type TWorkerWhatsAppHealthCheck = { id: string; status: 'passed' | 'failed' | 'skipped'; message: string; }; export type TWorkerWhatsAppHealth = { checkedAt?: string; inboundUrl?: string; statusUrl?: string; checks: TWorkerWhatsAppHealthCheck[]; }; export type TSlackConversation = { id: string; name: string; isPrivate: boolean; isMember: boolean; }; export type TSlackConversationList = { team: { id: string; name: string; }; bot: { id: string; name: string; }; conversations: TSlackConversation[]; }; export type TWorkerSlackHealthCheck = { id: string; status: 'passed' | 'failed' | 'skipped'; message: string; }; export type TWorkerSlackHealth = { checkedAt?: string; eventsUrl?: string; webhookVerifiedAt?: string; teamId?: string; teamName?: string; botUserId?: string; botName?: string; checks: TWorkerSlackHealthCheck[]; }; export type TWorkerSlackMessageHistory = { channel: { id: string; name: string; provider: 'slack'; teamId: string; teamName: string; botUserId: string; status: string; } | null; messages: TWorkerChannelMessage[]; nextCursor: string | null; }; export type TDiscordGuild = { id: string; name: string; icon: string | null; }; export type TDiscordGuildList = { bot: { id: string; name: string; }; application: { id: string; name: string; }; guilds: TDiscordGuild[]; }; export type TDiscordGuildChannel = { id: string; name: string; type: 'text' | 'announcement'; parentId: string | null; position: number; }; export type TDiscordGuildChannelList = { guild: { id: string; name: string; }; channels: TDiscordGuildChannel[]; }; export type TWorkerDiscordHealthCheck = { id: string; status: 'passed' | 'failed' | 'skipped'; message: string; }; export type TWorkerDiscordHealth = { checkedAt?: string; gatewayStatus?: string; connectedAt?: string; lastEventAt?: string; botUserId?: string; botName?: string; applicationId?: string; guildName?: string; checks: TWorkerDiscordHealthCheck[]; }; export type TWorkerDiscordMessageHistory = { channel: { id: string; name: string; provider: 'discord'; guildId: string; guildName: string; botUserId: string; status: string; } | null; messages: TWorkerChannelMessage[]; nextCursor: string | null; }; export type TGoogleMeetCalendar = { id: string; summary: string; description?: string; primary: boolean; accessRole?: string; timeZone?: string; }; export type TGoogleMeetCalendarSources = { accountEmail?: string; calendars: TGoogleMeetCalendar[]; }; export type TGoogleMeetBrowserBotAvailability = { featureEnabled: boolean; identityProvisioned: boolean; accountEmail?: string; }; export type TGoogleMeetCredentialTest = { ok: boolean; status: "READY" | "LIMITED" | "NEEDS_ATTENTION"; accountEmail?: string; calendarCount: number; capabilities: { calendar: boolean; nativeTranscript: boolean; }; message?: string; }; export type TGoogleMeetEmailApproval = { id: string; tenantId: string; channelId: string; sessionId: string; workerDispatchId: string; recipientEmail: string; messageVariant: string; status: string; approvalStatus: "PENDING" | "APPROVED" | "REJECTED"; subject?: string | null; meetingTitle?: string | null; scheduledStartAt: string; createdAt: string; updatedAt: string; }; export type TKnowledge = { id: string; tenantId: string; entityId: string; entityType: string; name: string; description: string; loaderId: string; config: any; }; export type TWorkerTopic = { tenantId: string; workerId: string; id: string; title: string; prompt: string; instructions: string[]; }; export type TWorkerNotebookSource = { id: string; tenantId: string; workerId: string; notebookId: string; type: string; title: string; url?: string | null; content?: string | null; metadata?: Record | null; status: string; createdAt: string; updatedAt: string; }; export type TWorkerNotebookDiscoveredSource = { title: string; url: string; snippet: string; source: string; }; export type TWorkerNotebookSourceDiscoveryResult = { query: string; sourceType?: string; researchMode?: string; results: TWorkerNotebookDiscoveredSource[]; }; export type TWorkerNotebookContextResult = { notebookId: string; context: { sources: Array>; notes: Array>; }; contextText: string; charCount: number; tokenCount: number; }; export type TWorkerNotebookMessage = { id: string; tenantId: string; workerId: string; notebookId: string; role: string; content: string; metadata?: Record | null; createdAt: string; }; export type TWorkerNotebookNote = { id: string; tenantId: string; workerId: string; notebookId: string; title: string; content?: string | null; createdAt: string; updatedAt: string; }; export type TWorkerNotebookStudioOutput = { id: string; tenantId: string; workerId: string; notebookId: string; type: string; title: string; content?: string | null; metadata?: Record | null; createdAt: string; updatedAt: string; }; export type TWorkerNotebook = { id: string; tenantId: string; workerId: string; name: string; description?: string | null; createdBy?: string | null; sources?: TWorkerNotebookSource[]; messages?: TWorkerNotebookMessage[]; notes?: TWorkerNotebookNote[]; studioOutputs?: TWorkerNotebookStudioOutput[]; _count?: { sources?: number; messages?: number; notes?: number; studioOutputs?: number; }; createdAt: string; updatedAt: string; }; export type TWorkerNotebookSendMessageResult = TWorkerNotebookMessage; export type TWorkerNotebookClearMessagesResult = { count: number; }; export type TTopic = { tenantId: string; entityId: string; entityType: string; id: string; title: string; prompt: string; instructions: string[]; category: string; }; export type TPublishDomain = { id: string; tenantId: string; occupationId: string; version: number; prompt: string; data: any; }; export type TPublishEmploid = { id: string; tenantId: string; emploidId: string; version: number; prompt: string; data: any; }; export type TMarketStoreItem = { id: string; tenantId: string; workerId: string; itemType: "worker"; title: string; description: string; avatar: string; summary: Record; package: any; createdAt: string; updatedAt: string; publishedAt: string; }; export type TPublishWorkerToMarketStore = { id: string; tenantId: string; workerId: string; itemType: "worker"; title: string; description: string; avatar: string; summary: Record; package: any; createdAt: string; updatedAt: string; publishedAt: string; }; export type TEnhanceTopic = { tone: string[]; };