evo360-types 1.3.143 → 1.3.145

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,54 +14,96 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.ITaskExternalObjectType = exports.IIATaskType = exports.ITaskPriority = exports.ITaskStatus = exports.ITaskAction = void 0;
17
+ exports.TaskExecutionStatusEnum = exports.TaskExternalObjectTypeEnum = exports.TaskDedupWindowEnum = exports.TaskDedupScopeEnum = exports.TaskRetryStrategyEnum = exports.TaskAutoHandlerEnum = exports.TaskModeEnum = exports.TaskSourceEnum = exports.TaskPriorityEnum = exports.TaskStatusEnum = exports.TaskActionEnum = exports.EvoTaskCollections = void 0;
18
18
  __exportStar(require("./fb_collections"), exports);
19
- var ITaskAction;
20
- (function (ITaskAction) {
21
- ITaskAction["Create_task"] = "CREATE_TASK";
22
- ITaskAction["Delete_task"] = "DELETE_TASK";
23
- ITaskAction["Update_task"] = "UPDATE_TASK";
24
- })(ITaskAction || (exports.ITaskAction = ITaskAction = {}));
25
- var ITaskStatus;
26
- (function (ITaskStatus) {
27
- ITaskStatus["NotStarted"] = "not_started";
28
- ITaskStatus["InProgress"] = "in_progress";
29
- ITaskStatus["Completed"] = "completed";
30
- ITaskStatus["Cancelled"] = "cancelled";
31
- ITaskStatus["OnHold"] = "on_hold";
32
- })(ITaskStatus || (exports.ITaskStatus = ITaskStatus = {}));
33
- var ITaskPriority;
34
- (function (ITaskPriority) {
35
- ITaskPriority["Low"] = "low";
36
- ITaskPriority["Medium"] = "medium";
37
- ITaskPriority["High"] = "high";
38
- })(ITaskPriority || (exports.ITaskPriority = ITaskPriority = {}));
39
- var IIATaskType;
40
- (function (IIATaskType) {
41
- IIATaskType["DataAnalysis"] = "data_analysis";
42
- IIATaskType["ContentGeneration"] = "content_generation";
43
- IIATaskType["Classification"] = "classification";
44
- IIATaskType["Extraction"] = "extraction";
45
- IIATaskType["Summarization"] = "summarization";
46
- IIATaskType["Translation"] = "translation";
47
- IIATaskType["SentimentAnalysis"] = "sentiment_analysis";
48
- IIATaskType["QuestionAnswering"] = "question_answering";
49
- IIATaskType["SendReminder"] = "send_reminder";
50
- IIATaskType["RequestContactInfo"] = "request_contact_info";
51
- IIATaskType["RequestOperatorInfo"] = "request_operator_info";
52
- IIATaskType["ConfirmAppointment"] = "confirm_appointment";
53
- IIATaskType["SendDocuments"] = "send_documents";
54
- IIATaskType["CreateAppointment"] = "create_appointment";
55
- IIATaskType["RescheduleAppointment"] = "reschedule_appointment";
56
- IIATaskType["CancelAppointment"] = "cancel_appointment";
57
- IIATaskType["FinancialCharge"] = "financial_charge";
58
- IIATaskType["Custom"] = "custom";
59
- })(IIATaskType || (exports.IIATaskType = IIATaskType = {}));
60
- var ITaskExternalObjectType;
61
- (function (ITaskExternalObjectType) {
62
- ITaskExternalObjectType["CrmLead"] = "crm_lead";
63
- ITaskExternalObjectType["MedPatient"] = "med_patient";
64
- ITaskExternalObjectType["MedProfessional"] = "med_professional";
65
- ITaskExternalObjectType["MedAppointment"] = "med_appointment";
66
- ITaskExternalObjectType["ChatContact"] = "chat_contact";
67
- })(ITaskExternalObjectType || (exports.ITaskExternalObjectType = ITaskExternalObjectType = {}));
19
+ // ======================================================
20
+ // evo-task (Tasks)
21
+ //
22
+ // Design goals:
23
+ // - Single, generic Task model used by humans and automation
24
+ // - AUTO tasks are executed by Task Runner (in evo-task-runner)
25
+ // - Payloads for specific handlers (notifications, AI, invoices, etc.)
26
+ // live in their own modules; here we keep the contract generic
27
+ // - Sub-collections (executions/comments/logs) keep lists fast
28
+ // ======================================================
29
+ // ----- Firestore collection conventions (per tenant)
30
+ // Root: /tenants/{tenant}/apps/evo-task/tasks/{taskId}
31
+ exports.EvoTaskCollections = {
32
+ Tasks: "tasks",
33
+ Executions: "executions",
34
+ Comments: "comments",
35
+ Logs: "logs",
36
+ };
37
+ // ----- Activities tracking
38
+ exports.TaskActionEnum = {
39
+ CreateTask: "CREATE_TASK",
40
+ DeleteTask: "DELETE_TASK",
41
+ UpdateTask: "UPDATE_TASK",
42
+ };
43
+ // ----- Task lifecycle status
44
+ // Keep the human-friendly lifecycle states (legacy-friendly): not_started / in_progress.
45
+ exports.TaskStatusEnum = {
46
+ NotStarted: "not_started",
47
+ InProgress: "in_progress",
48
+ Completed: "completed",
49
+ Failed: "failed", // final failure (after retries)
50
+ Cancelled: "cancelled",
51
+ OnHold: "on_hold",
52
+ Suppressed: "suppressed", // intentionally skipped (e.g., dedup)
53
+ };
54
+ // ----- Task priority (human-friendly)
55
+ exports.TaskPriorityEnum = {
56
+ Low: "low",
57
+ Medium: "medium",
58
+ High: "high",
59
+ };
60
+ // ----- Task source (who created it)
61
+ exports.TaskSourceEnum = {
62
+ User: "user",
63
+ AutomationHub: "automation_hub",
64
+ System: "system",
65
+ };
66
+ // ----- Task execution mode
67
+ exports.TaskModeEnum = {
68
+ Human: "human",
69
+ Auto: "auto",
70
+ };
71
+ // ----- AUTO task handler (which executor processes the task)
72
+ // Keep it open for future modules; these are logical handler identifiers.
73
+ exports.TaskAutoHandlerEnum = {
74
+ Notifications: "notifications",
75
+ AIAgent: "ai_agent",
76
+ Invoices: "invoices",
77
+ Webhook: "webhook",
78
+ Custom: "custom",
79
+ };
80
+ // ----- Retry policy
81
+ exports.TaskRetryStrategyEnum = {
82
+ Fixed: "fixed",
83
+ Exponential: "exponential",
84
+ };
85
+ // ----- Dedup / suppression (optional)
86
+ exports.TaskDedupScopeEnum = {
87
+ PerRecipient: "per_recipient",
88
+ PerRecipientAndObject: "per_recipient_and_object",
89
+ Custom: "custom",
90
+ };
91
+ exports.TaskDedupWindowEnum = {
92
+ SameDay: "same_day",
93
+ NHours: "n_hours",
94
+ Custom: "custom",
95
+ };
96
+ // ----- External object links (for unified UI views)
97
+ exports.TaskExternalObjectTypeEnum = {
98
+ CrmLead: "crm_lead",
99
+ MedPatient: "med_patient",
100
+ MedProfessional: "med_professional",
101
+ MedAppointment: "med_appointment",
102
+ ChatContact: "chat_contact",
103
+ };
104
+ // ----- Task execution attempts (sub-collection: tasks/{taskId}/executions)
105
+ exports.TaskExecutionStatusEnum = {
106
+ Success: "success",
107
+ Error: "error",
108
+ Retry: "retry",
109
+ };
@@ -1,145 +1,343 @@
1
1
  export * from "./fb_collections";
2
2
  import type { FirestoreDocumentReference, IFireDoc, ITag } from "../shared";
3
- // ----- TaskTypes
4
-
5
- // Enum for Task Action - used in Activities tracking
6
- export type TaskAction = "CREATE_TASK" | "DELETE_TASK" | "UPDATE_TASK";
7
- export enum ITaskAction {
8
- Create_task = "CREATE_TASK",
9
- Delete_task = "DELETE_TASK",
10
- Update_task = "UPDATE_TASK",
11
- }
12
3
 
13
- // Enum for Task Instance Status
14
-
15
- export type TaskStatus =
16
- | "not_started"
17
- | "in_progress"
18
- | "completed"
19
- | "cancelled"
20
- | "on_hold";
21
-
22
- export enum ITaskStatus {
23
- NotStarted = "not_started",
24
- InProgress = "in_progress",
25
- Completed = "completed",
26
- Cancelled = "cancelled",
27
- OnHold = "on_hold",
4
+ // ======================================================
5
+ // evo-task (Tasks)
6
+ //
7
+ // Design goals:
8
+ // - Single, generic Task model used by humans and automation
9
+ // - AUTO tasks are executed by Task Runner (in evo-task-runner)
10
+ // - Payloads for specific handlers (notifications, AI, invoices, etc.)
11
+ // live in their own modules; here we keep the contract generic
12
+ // - Sub-collections (executions/comments/logs) keep lists fast
13
+ // ======================================================
14
+
15
+ // ----- Firestore collection conventions (per tenant)
16
+ // Root: /tenants/{tenant}/apps/evo-task/tasks/{taskId}
17
+ export const EvoTaskCollections = {
18
+ Tasks: "tasks",
19
+ Executions: "executions",
20
+ Comments: "comments",
21
+ Logs: "logs",
22
+ } as const;
23
+
24
+ export type EvoTaskCollectionName =
25
+ (typeof EvoTaskCollections)[keyof typeof EvoTaskCollections];
26
+
27
+ // ----- Activities tracking
28
+ export const TaskActionEnum = {
29
+ CreateTask: "CREATE_TASK",
30
+ DeleteTask: "DELETE_TASK",
31
+ UpdateTask: "UPDATE_TASK",
32
+ } as const;
33
+
34
+ export type TaskAction = (typeof TaskActionEnum)[keyof typeof TaskActionEnum];
35
+
36
+ // ----- Task lifecycle status
37
+ // Keep the human-friendly lifecycle states (legacy-friendly): not_started / in_progress.
38
+ export const TaskStatusEnum = {
39
+ NotStarted: "not_started",
40
+ InProgress: "in_progress",
41
+ Completed: "completed",
42
+ Failed: "failed", // final failure (after retries)
43
+ Cancelled: "cancelled",
44
+ OnHold: "on_hold",
45
+ Suppressed: "suppressed", // intentionally skipped (e.g., dedup)
46
+ } as const;
47
+
48
+ export type TaskStatus = (typeof TaskStatusEnum)[keyof typeof TaskStatusEnum];
49
+
50
+ // ----- Task priority (human-friendly)
51
+ export const TaskPriorityEnum = {
52
+ Low: "low",
53
+ Medium: "medium",
54
+ High: "high",
55
+ } as const;
56
+
57
+ export type TaskPriority =
58
+ (typeof TaskPriorityEnum)[keyof typeof TaskPriorityEnum];
59
+
60
+ // ----- Task source (who created it)
61
+ export const TaskSourceEnum = {
62
+ User: "user",
63
+ AutomationHub: "automation_hub",
64
+ System: "system",
65
+ } as const;
66
+
67
+ export type TaskSource = (typeof TaskSourceEnum)[keyof typeof TaskSourceEnum];
68
+
69
+ // ----- Task execution mode
70
+ export const TaskModeEnum = {
71
+ Human: "human",
72
+ Auto: "auto",
73
+ } as const;
74
+
75
+ export type TaskMode = (typeof TaskModeEnum)[keyof typeof TaskModeEnum];
76
+
77
+ // ----- AUTO task handler (which executor processes the task)
78
+ // Keep it open for future modules; these are logical handler identifiers.
79
+ export const TaskAutoHandlerEnum = {
80
+ Notifications: "notifications",
81
+ AIAgent: "ai_agent",
82
+ Invoices: "invoices",
83
+ Webhook: "webhook",
84
+ Custom: "custom",
85
+ } as const;
86
+
87
+ export type TaskAutoHandler =
88
+ (typeof TaskAutoHandlerEnum)[keyof typeof TaskAutoHandlerEnum];
89
+
90
+ // ----- Retry policy
91
+ export const TaskRetryStrategyEnum = {
92
+ Fixed: "fixed",
93
+ Exponential: "exponential",
94
+ } as const;
95
+
96
+ export type TaskRetryStrategy =
97
+ (typeof TaskRetryStrategyEnum)[keyof typeof TaskRetryStrategyEnum];
98
+
99
+ export interface ITaskRetryPolicy {
100
+ max_attempts: number; // total attempts allowed (including first attempt)
101
+ attempt: number; // 0-based attempt counter
102
+ strategy: TaskRetryStrategy;
103
+ backoff_seconds: number; // base backoff in seconds
104
+ next_attempt_at?: Date; // computed by Task Runner
105
+ last_error?: {
106
+ message: string;
107
+ code?: string | number;
108
+ at: Date;
109
+ details?: Record<string, unknown>;
110
+ };
111
+ [key: string]: unknown;
28
112
  }
29
113
 
30
- // Interface for Task Priority
31
- export type TaskPriority = "low" | "medium" | "high";
32
- export enum ITaskPriority {
33
- Low = "low",
34
- Medium = "medium",
35
- High = "high",
114
+ // ----- Lock/lease control (to avoid double execution)
115
+ export interface ITaskLock {
116
+ locked_by: string; // worker id / instance id
117
+ lock_until: Date; // lease expiration time
118
+ [key: string]: unknown;
36
119
  }
37
120
 
38
- // Enum for IA Task Type
39
- export type IATaskType =
40
- | "data_analysis"
41
- | "content_generation"
42
- | "classification"
43
- | "extraction"
44
- | "summarization"
45
- | "translation"
46
- | "sentiment_analysis"
47
- | "question_answering"
48
- | "send_reminder"
49
- | "request_contact_info"
50
- | "request_operator_info"
51
- | "confirm_appointment"
52
- | "send_documents"
53
- | "create_appointment"
54
- | "reschedule_appointment"
55
- | "cancel_appointment"
56
- | "financial_charge"
57
- | "custom";
58
-
59
- export enum IIATaskType {
60
- DataAnalysis = "data_analysis",
61
- ContentGeneration = "content_generation",
62
- Classification = "classification",
63
- Extraction = "extraction",
64
- Summarization = "summarization",
65
- Translation = "translation",
66
- SentimentAnalysis = "sentiment_analysis",
67
- QuestionAnswering = "question_answering",
68
- SendReminder = "send_reminder",
69
- RequestContactInfo = "request_contact_info",
70
- RequestOperatorInfo = "request_operator_info",
71
- ConfirmAppointment = "confirm_appointment",
72
- SendDocuments = "send_documents",
73
- CreateAppointment = "create_appointment",
74
- RescheduleAppointment = "reschedule_appointment",
75
- CancelAppointment = "cancel_appointment",
76
- FinancialCharge = "financial_charge",
77
- Custom = "custom",
121
+ // ----- Dedup / suppression (optional)
122
+ export const TaskDedupScopeEnum = {
123
+ PerRecipient: "per_recipient",
124
+ PerRecipientAndObject: "per_recipient_and_object",
125
+ Custom: "custom",
126
+ } as const;
127
+
128
+ export type TaskDedupScope =
129
+ (typeof TaskDedupScopeEnum)[keyof typeof TaskDedupScopeEnum];
130
+
131
+ export const TaskDedupWindowEnum = {
132
+ SameDay: "same_day",
133
+ NHours: "n_hours",
134
+ Custom: "custom",
135
+ } as const;
136
+
137
+ export type TaskDedupWindow =
138
+ (typeof TaskDedupWindowEnum)[keyof typeof TaskDedupWindowEnum];
139
+
140
+ export interface ITaskDedup {
141
+ enabled: boolean;
142
+ key: string; // deterministic key used for suppression
143
+ group_key?: string; // e.g. "APPT_REMINDER"
144
+ scope?: TaskDedupScope;
145
+ window?: TaskDedupWindow;
146
+ window_hours?: number; // when window = n_hours
147
+ importance?: number; // numeric tie-breaker (0-100)
148
+ [key: string]: unknown;
78
149
  }
79
150
 
80
- // Enum for External Object Type (for task links)
151
+ // ----- External object links (for unified UI views)
152
+ export const TaskExternalObjectTypeEnum = {
153
+ CrmLead: "crm_lead",
154
+ MedPatient: "med_patient",
155
+ MedProfessional: "med_professional",
156
+ MedAppointment: "med_appointment",
157
+ ChatContact: "chat_contact",
158
+ } as const;
159
+
81
160
  export type TaskExternalObjectType =
82
- | "crm_lead"
83
- | "med_patient"
84
- | "med_professional"
85
- | "med_appointment"
86
- | "chat_contact";
87
-
88
- export enum ITaskExternalObjectType {
89
- CrmLead = "crm_lead",
90
- MedPatient = "med_patient",
91
- MedProfessional = "med_professional",
92
- MedAppointment = "med_appointment",
93
- ChatContact = "chat_contact",
94
- }
161
+ (typeof TaskExternalObjectTypeEnum)[keyof typeof TaskExternalObjectTypeEnum];
95
162
 
96
- // Interface for External Object Link
97
163
  export interface ITaskExternalLink {
98
- type: TaskExternalObjectType; // Type of external object
99
- id: string; // ID of the linked object
100
- [key: string]: unknown; // index signature
164
+ type: TaskExternalObjectType;
165
+ id: string;
166
+ label?: string;
167
+ [key: string]: unknown;
168
+ }
169
+
170
+ // ----- Assignee (human)
171
+ export interface ITaskUserAssignee {
172
+ kind: "user";
173
+ name?: string;
174
+ ref?: FirestoreDocumentReference;
175
+ [key: string]: unknown;
176
+ }
177
+
178
+ // ----- Common schedule fields
179
+ export interface ITaskSchedule {
180
+ execute_at?: Date; // when AUTO tasks should run (Task Runner uses this)
181
+ due_at?: Date; // optional deadline (also used for human tasks)
182
+ timezone?: string; // optional IANA timezone
183
+ [key: string]: unknown;
184
+ }
185
+
186
+ // ----- AUTO execution contract (generic)
187
+ // The concrete payload schema for each handler/kind should live in its own module.
188
+ export interface ITaskAutoSpec {
189
+ handler: TaskAutoHandler;
190
+ kind: string; // e.g. "notification.send", "ai.execute", "invoice.issue"
191
+ version?: number | string;
192
+ payload: Record<string, unknown>;
193
+ idempotency_key?: string; // used by the handler to deduplicate provider calls
194
+ [key: string]: unknown;
101
195
  }
102
196
 
103
- // Interface for Task Instances (taskInstances)
104
- export interface ITask extends IFireDoc {
105
- title: string; // Title of the task
106
- description?: string; // Optional description of the task
107
- creatorName: string; // Name of the user who created the task
108
- creatorRef?: FirestoreDocumentReference; // reference to the user who created the task
109
- startDate: Date; // Start date and time of the task
110
- dueDate?: Date; // Optional due date and time of the task
111
- status: TaskStatus; // Status of the task
112
- priority?: TaskPriority; // Priority of the task (optional)
113
- assigneeName?: string; // Name of the assignee (optional)
114
- assigneeRef?: FirestoreDocumentReference; // Reference to the assignee (optional)
197
+ // ----- Failure handling / handoff (generic)
198
+ export interface ITaskOnFailure {
199
+ // Task Runner can optionally create/convert into a HUMAN task.
200
+ handoff_to_user?: {
201
+ name?: string;
202
+ ref?: FirestoreDocumentReference;
203
+ };
204
+
205
+ create_handoff_task?: {
206
+ title?: string;
207
+ description?: string;
208
+ priority?: TaskPriority;
209
+ tags?: ITag[] | null;
210
+ };
211
+
212
+ // Optional fallbacks the Task Runner may attempt (still AUTO).
213
+ auto_fallbacks?: Array<{
214
+ handler: TaskAutoHandler;
215
+ kind: string;
216
+ payload: Record<string, unknown>;
217
+ }>;
218
+
219
+ [key: string]: unknown;
220
+ }
221
+
222
+ // ----- Base task shape
223
+ export interface ITaskBase extends IFireDoc {
224
+ title: string;
225
+ description?: string;
226
+ status: TaskStatus;
227
+
228
+ // Human-friendly priority + numeric tie-breaker (optional)
229
+ priority?: TaskPriority;
230
+ importance?: number; // 0-100 (recommended for automation tie-breakers)
231
+
232
+ // Who created it
233
+ source: TaskSource;
234
+ creator: {
235
+ name: string;
236
+ ref?: FirestoreDocumentReference;
237
+ };
238
+
239
+ // Scheduling / deadlines
240
+ schedule?: ITaskSchedule;
241
+
242
+ // Links and taxonomy
115
243
  tags?: ITag[] | null;
116
- // IA (Inteligência Artificial) related fields
117
- ia_assigned?: boolean; // Indicates if the task is assigned to an AI agent
118
- ia_agent?: string; // Identifier/name of the AI agent assigned to the task
119
- ia_duescheduled?: Date; // Scheduled due date for AI execution
120
- ia_task_type?: IATaskType; // Type of AI task to be executed
121
- ia_result?: string; // Result/output from AI execution
122
- ia_result_code?: number; // Result code from AI execution (e.g., HTTP status, error code)
123
- ia_started_at?: Date; // Timestamp when AI started processing the task
124
- ia_completed_at?: Date; // Timestamp when AI completed processing the task
125
- ia_error?: string; // Error message if AI execution failed
126
- ia_retry_count?: number; // Number of retry attempts for AI execution
127
- ia_metadata?: Record<string, unknown>; // Additional metadata about AI execution
128
- ia_prompt?: string; // Prompt used for AI task execution
129
- ia_model?: string; // AI model used for task execution
130
- ia_progress?: number; // Progress percentage (0-100) of AI task execution
131
- // External object links
132
- externalLinks?: ITaskExternalLink[]; // Array of links to external objects
133
- [key: string]: unknown; // index signature
244
+ externalLinks?: ITaskExternalLink[];
245
+
246
+ // Optional deterministic key to avoid duplicates on rebuild/events
247
+ idempotency_key?: string;
248
+
249
+ // Optional dedup configuration
250
+ dedup?: ITaskDedup;
251
+
252
+ // Free metadata
253
+ metadata?: Record<string, unknown>;
254
+
255
+ [key: string]: unknown;
256
+ }
257
+
258
+ // ----- HUMAN task
259
+ export interface IHumanTask extends ITaskBase {
260
+ mode: "human";
261
+ assignee?: ITaskUserAssignee;
134
262
  }
135
263
 
136
- // Interface for Task Comments (sub-collection in Firestore)
264
+ // ----- AUTO task
265
+ export interface IAutoTask extends ITaskBase {
266
+ mode: "auto";
267
+
268
+ // Required for AUTO execution
269
+ schedule: ITaskSchedule & {
270
+ execute_at: Date;
271
+ };
272
+
273
+ // Execution control
274
+ lock?: ITaskLock;
275
+ retry?: ITaskRetryPolicy;
276
+ on_failure?: ITaskOnFailure;
277
+
278
+ // What to execute
279
+ auto: ITaskAutoSpec;
280
+ }
281
+
282
+ // Union task type
283
+ export type ITask = IHumanTask | IAutoTask;
284
+
285
+ // ----- Task execution attempts (sub-collection: tasks/{taskId}/executions)
286
+ export const TaskExecutionStatusEnum = {
287
+ Success: "success",
288
+ Error: "error",
289
+ Retry: "retry",
290
+ } as const;
291
+
292
+ export type TaskExecutionStatus =
293
+ (typeof TaskExecutionStatusEnum)[keyof typeof TaskExecutionStatusEnum];
294
+
295
+ export interface ITaskExecution extends IFireDoc {
296
+ taskId: string;
297
+ handler: TaskAutoHandler;
298
+ kind: string; // mirrors task.auto.kind
299
+ status: TaskExecutionStatus;
300
+ attempt: number;
301
+ started_at: Date;
302
+ completed_at?: Date;
303
+
304
+ // Handler-specific outputs/errors (keep concise)
305
+ result?: Record<string, unknown>;
306
+ error?: {
307
+ message: string;
308
+ code?: string | number;
309
+ details?: Record<string, unknown>;
310
+ };
311
+
312
+ // Optional provider metadata (e.g. WhatsApp provider message id)
313
+ provider?: {
314
+ name?: string;
315
+ message_id?: string;
316
+ [key: string]: unknown;
317
+ };
318
+
319
+ [key: string]: unknown;
320
+ }
321
+
322
+ // ----- Task comments (sub-collection: tasks/{taskId}/comments)
137
323
  export interface ITaskComment extends IFireDoc {
138
- taskId: string; // ID of the task
139
- text: string; // Comment text content
140
- authorName: string; // Name of the user who created the comment
141
- authorRef?: FirestoreDocumentReference; // Reference to the user who created the comment
142
- edited?: boolean; // Indicates if the comment was edited
143
- edited_at?: Date; // Timestamp when the comment was last edited
144
- [key: string]: unknown; // index signature
324
+ taskId: string;
325
+ text: string;
326
+ author: {
327
+ name: string;
328
+ ref?: FirestoreDocumentReference;
329
+ };
330
+ edited?: boolean;
331
+ edited_at?: Date;
332
+ [key: string]: unknown;
333
+ }
334
+
335
+ // ----- Task logs (optional sub-collection: tasks/{taskId}/logs)
336
+ export interface ITaskLog extends IFireDoc {
337
+ taskId: string;
338
+ level: "debug" | "info" | "warn" | "error";
339
+ message: string;
340
+ data?: Record<string, unknown>;
341
+ at: Date;
342
+ [key: string]: unknown;
145
343
  }