evo360-types 1.3.387 → 1.3.390

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zAiBindingSchema = exports.zHubiaRuleSchema = exports.zHubiaRulesModeSchema = exports.zHubiaRuleActionSchema = exports.zHubiaRuleScopeSchema = exports.zHubiaConditionGroupSchema = exports.zHubiaConditionSchema = exports.zHubiaScheduleSchema = exports.zHubiaScheduleWindowSchema = exports.zHubiaConditionOpSchema = exports.zHubiaOutboundSourceSchema = exports.zHubiaRuleAppliesToSchema = exports.zHubiaRuleOutcomeSchema = exports.zHubiaRuleTriggerSchema = exports.zHubiaRulePhaseSchema = exports.zHubiaConversationModeSchema = exports.zHubiaConversationMessageSchema = exports.zHubiaV1ChannelConfigSchema = exports.zHubiaAttendanceModeSchema = void 0;
3
+ exports.zAiBindingSchema = exports.zHubiaRuleSchema = exports.zHubiaRulesModeSchema = exports.zCreateTaskActionInputSchema = exports.zHubiaRuleActionSchema = exports.zHubiaRuleScopeSchema = exports.zHubiaConditionGroupSchema = exports.zHubiaConditionSchema = exports.zHubiaScheduleSchema = exports.zHubiaScheduleWindowSchema = exports.zHubiaConditionOpSchema = exports.zHubiaOutboundSourceSchema = exports.zHubiaRuleAppliesToSchema = exports.zHubiaRuleOutcomeSchema = exports.zHubiaRuleTriggerSchema = exports.zHubiaRulePhaseSchema = exports.zHubiaConversationModeSchema = exports.zHubiaConversationMessageSchema = exports.zHubiaV1ChannelConfigSchema = exports.zHubiaAttendanceModeSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const zod_schemas_1 = require("../../shared/zod-schemas");
6
6
  // ───────── Attendance Mode (how AI operates on this channel) ─────────
@@ -98,17 +98,23 @@ exports.zHubiaConversationModeSchema = zod_1.z.enum(["ai_only", "hybrid_assist",
98
98
  // - `when=outbound_message` + `phase=post_llm` : RESERVADO — habilitado
99
99
  // quando "LLM em outbound" for liberado (fora de
100
100
  // escopo na v1.0). Schema aceita, runtime não dispara.
101
+ // - `when=ticket_closed` + `phase=ticket_closed` (feat-037): avalia quando
102
+ // um atendimento é fechado (v1: ATTENDANCE_CLOSED do
103
+ // Chatbee). 4ª phase, side-effects only — não há
104
+ // mensagem em trânsito; a regra apenas executa actions
105
+ // (ex: `create_task` para agendar a reativação).
101
106
  //
102
107
  // Matriz when × outcome (enforced pelo superRefine de `zHubiaRuleSchema`):
103
108
  // - inbound_message + outcome ∈ {stop, to_llm, to_llm_with_context}
104
109
  // - llm_completed + outcome = stop
105
110
  // - outbound_message + outcome = stop (to_llm reservado p/ LLM-em-outbound)
111
+ // - ticket_closed + outcome = stop (side-effects only, sem msg em trânsito)
106
112
  //
107
113
  // As regras moram em `binding.rules[]` — o binding É o cruzamento canal⨯
108
114
  // departamento, então o escopo de departamento é implícito.
109
115
  /** Fase de avaliação. Tipos TS em src/types/evo-hub-ia/v1/. */
110
- exports.zHubiaRulePhaseSchema = zod_1.z.enum(["pre_llm", "post_llm"]);
111
- exports.zHubiaRuleTriggerSchema = zod_1.z.enum(["inbound_message", "llm_completed", "outbound_message"]);
116
+ exports.zHubiaRulePhaseSchema = zod_1.z.enum(["pre_llm", "post_llm", "ticket_closed"]);
117
+ exports.zHubiaRuleTriggerSchema = zod_1.z.enum(["inbound_message", "llm_completed", "outbound_message", "ticket_closed"]);
112
118
  exports.zHubiaRuleOutcomeSchema = zod_1.z.enum(["stop", "to_llm", "to_llm_with_context"]);
113
119
  exports.zHubiaRuleAppliesToSchema = zod_1.z.enum(["real_message", "kickoff", "any"]);
114
120
  /** Filtro por origem da mensagem outbound (apenas `when=outbound_message`).
@@ -202,10 +208,32 @@ exports.zHubiaRuleScopeSchema = zod_1.z.object({
202
208
  * `{{fact.path}}` resolvido em runtime pelo facts provider. */
203
209
  exports.zHubiaRuleActionSchema = zod_1.z.object({
204
210
  /** Nome de uma tool `category: 'action'` do evo-hubia-tools
205
- * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
211
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags,
212
+ * create_task, …). */
206
213
  tool: zod_1.z.string().min(1),
207
214
  input: zod_1.z.record(zod_1.z.unknown()).default({}),
208
215
  });
216
+ /** External link (shape mínimo) p/ a action `create_task`. Inline para não
217
+ * acoplar evo-hub-ia ao app evo-task; o executor mapeia p/ `IExternalLink`. */
218
+ const zCreateTaskExternalLinkSchema = zod_1.z.object({
219
+ type: zod_1.z.string().min(1),
220
+ id: zod_1.z.string().min(1),
221
+ label: zod_1.z.string().optional(),
222
+ }).passthrough();
223
+ /** Input da action `create_task` (feat-037) — genérica: cria qualquer
224
+ * `IAutoTask` (reativação de lead é o 1º caso de uso). Permitida apenas na
225
+ * phase `ticket_closed`. Strings/records aceitam templating `{{fact.path}}`
226
+ * resolvido em runtime — por isso os campos são tolerantes (sem regex aqui;
227
+ * a validação forte fica no schema do executor após resolução). */
228
+ exports.zCreateTaskActionInputSchema = zod_1.z.object({
229
+ handler: zod_1.z.string().min(1),
230
+ kind: zod_1.z.string().min(1),
231
+ payload: zod_1.z.record(zod_1.z.unknown()).default({}),
232
+ delay_hours: zod_1.z.number().min(0),
233
+ send_window: exports.zHubiaScheduleSchema.optional(),
234
+ external_links: zod_1.z.array(zCreateTaskExternalLinkSchema).optional(),
235
+ idempotency_key: zod_1.z.string().optional(),
236
+ }).passthrough();
209
237
  /** Master switch do binding. `dry_run` força TODAS as regras do binding a
210
238
  * modo seco (kill switch). Default runtime quando ausente: `live`. */
211
239
  exports.zHubiaRulesModeSchema = zod_1.z.enum(["live", "dry_run"]);
@@ -263,6 +291,31 @@ exports.zHubiaRuleSchema = zod_1.z.object({
263
291
  message: "when=outbound_message aceita apenas outcome=stop (to_llm será habilitado quando LLM em outbound for liberado)",
264
292
  });
265
293
  }
294
+ // feat-037: ticket_closed é side-effects only — phase e when andam juntos,
295
+ // único outcome permitido é stop (não há mensagem em trânsito).
296
+ if (rule.phase === "ticket_closed") {
297
+ if (rule.outcome !== "stop") {
298
+ ctx.addIssue({
299
+ code: zod_1.z.ZodIssueCode.custom,
300
+ path: ["outcome"],
301
+ message: "phase=ticket_closed aceita apenas outcome=stop (side-effects only)",
302
+ });
303
+ }
304
+ if (rule.when !== "ticket_closed") {
305
+ ctx.addIssue({
306
+ code: zod_1.z.ZodIssueCode.custom,
307
+ path: ["when"],
308
+ message: "phase=ticket_closed requer when=ticket_closed",
309
+ });
310
+ }
311
+ }
312
+ if (rule.when === "ticket_closed" && rule.phase !== "ticket_closed") {
313
+ ctx.addIssue({
314
+ code: zod_1.z.ZodIssueCode.custom,
315
+ path: ["phase"],
316
+ message: "when=ticket_closed requer phase=ticket_closed",
317
+ });
318
+ }
266
319
  });
267
320
  // ───────── AI Binding (department → AI agent routing) ─────────
268
321
  const zHubiaCapabilitiesSchema = zod_1.z.object({
@@ -112,19 +112,25 @@ export type IHubiaConversationMode = z.infer<typeof zHubiaConversationModeSchema
112
112
  // - `when=outbound_message` + `phase=post_llm` : RESERVADO — habilitado
113
113
  // quando "LLM em outbound" for liberado (fora de
114
114
  // escopo na v1.0). Schema aceita, runtime não dispara.
115
+ // - `when=ticket_closed` + `phase=ticket_closed` (feat-037): avalia quando
116
+ // um atendimento é fechado (v1: ATTENDANCE_CLOSED do
117
+ // Chatbee). 4ª phase, side-effects only — não há
118
+ // mensagem em trânsito; a regra apenas executa actions
119
+ // (ex: `create_task` para agendar a reativação).
115
120
  //
116
121
  // Matriz when × outcome (enforced pelo superRefine de `zHubiaRuleSchema`):
117
122
  // - inbound_message + outcome ∈ {stop, to_llm, to_llm_with_context}
118
123
  // - llm_completed + outcome = stop
119
124
  // - outbound_message + outcome = stop (to_llm reservado p/ LLM-em-outbound)
125
+ // - ticket_closed + outcome = stop (side-effects only, sem msg em trânsito)
120
126
  //
121
127
  // As regras moram em `binding.rules[]` — o binding É o cruzamento canal⨯
122
128
  // departamento, então o escopo de departamento é implícito.
123
129
 
124
130
  /** Fase de avaliação. Tipos TS em src/types/evo-hub-ia/v1/. */
125
- export const zHubiaRulePhaseSchema = z.enum(["pre_llm", "post_llm"]);
131
+ export const zHubiaRulePhaseSchema = z.enum(["pre_llm", "post_llm", "ticket_closed"]);
126
132
 
127
- export const zHubiaRuleTriggerSchema = z.enum(["inbound_message", "llm_completed", "outbound_message"]);
133
+ export const zHubiaRuleTriggerSchema = z.enum(["inbound_message", "llm_completed", "outbound_message", "ticket_closed"]);
128
134
 
129
135
  export const zHubiaRuleOutcomeSchema = z.enum(["stop", "to_llm", "to_llm_with_context"]);
130
136
 
@@ -232,11 +238,37 @@ export const zHubiaRuleScopeSchema = z.object({
232
238
  * `{{fact.path}}` resolvido em runtime pelo facts provider. */
233
239
  export const zHubiaRuleActionSchema = z.object({
234
240
  /** Nome de uma tool `category: 'action'` do evo-hubia-tools
235
- * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
241
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags,
242
+ * create_task, …). */
236
243
  tool: z.string().min(1),
237
244
  input: z.record(z.unknown()).default({}),
238
245
  });
239
246
 
247
+ /** External link (shape mínimo) p/ a action `create_task`. Inline para não
248
+ * acoplar evo-hub-ia ao app evo-task; o executor mapeia p/ `IExternalLink`. */
249
+ const zCreateTaskExternalLinkSchema = z.object({
250
+ type: z.string().min(1),
251
+ id: z.string().min(1),
252
+ label: z.string().optional(),
253
+ }).passthrough();
254
+
255
+ /** Input da action `create_task` (feat-037) — genérica: cria qualquer
256
+ * `IAutoTask` (reativação de lead é o 1º caso de uso). Permitida apenas na
257
+ * phase `ticket_closed`. Strings/records aceitam templating `{{fact.path}}`
258
+ * resolvido em runtime — por isso os campos são tolerantes (sem regex aqui;
259
+ * a validação forte fica no schema do executor após resolução). */
260
+ export const zCreateTaskActionInputSchema = z.object({
261
+ handler: z.string().min(1),
262
+ kind: z.string().min(1),
263
+ payload: z.record(z.unknown()).default({}),
264
+ delay_hours: z.number().min(0),
265
+ send_window: zHubiaScheduleSchema.optional(),
266
+ external_links: z.array(zCreateTaskExternalLinkSchema).optional(),
267
+ idempotency_key: z.string().optional(),
268
+ }).passthrough();
269
+
270
+ export type ICreateTaskActionInputParsed = z.infer<typeof zCreateTaskActionInputSchema>;
271
+
240
272
  /** Master switch do binding. `dry_run` força TODAS as regras do binding a
241
273
  * modo seco (kill switch). Default runtime quando ausente: `live`. */
242
274
  export const zHubiaRulesModeSchema = z.enum(["live", "dry_run"]);
@@ -299,6 +331,31 @@ export const zHubiaRuleSchema = z.object({
299
331
  message: "when=outbound_message aceita apenas outcome=stop (to_llm será habilitado quando LLM em outbound for liberado)",
300
332
  });
301
333
  }
334
+ // feat-037: ticket_closed é side-effects only — phase e when andam juntos,
335
+ // único outcome permitido é stop (não há mensagem em trânsito).
336
+ if (rule.phase === "ticket_closed") {
337
+ if (rule.outcome !== "stop") {
338
+ ctx.addIssue({
339
+ code: z.ZodIssueCode.custom,
340
+ path: ["outcome"],
341
+ message: "phase=ticket_closed aceita apenas outcome=stop (side-effects only)",
342
+ });
343
+ }
344
+ if (rule.when !== "ticket_closed") {
345
+ ctx.addIssue({
346
+ code: z.ZodIssueCode.custom,
347
+ path: ["when"],
348
+ message: "phase=ticket_closed requer when=ticket_closed",
349
+ });
350
+ }
351
+ }
352
+ if (rule.when === "ticket_closed" && rule.phase !== "ticket_closed") {
353
+ ctx.addIssue({
354
+ code: z.ZodIssueCode.custom,
355
+ path: ["phase"],
356
+ message: "when=ticket_closed requer phase=ticket_closed",
357
+ });
358
+ }
302
359
  });
303
360
 
304
361
  // ───────── AI Binding (department → AI agent routing) ─────────
@@ -4,7 +4,7 @@ export declare const zTaskStatusSchema: z.ZodEnum<["not_started", "in_progress",
4
4
  export declare const zTaskPrioritySchema: z.ZodEnum<["low", "medium", "high"]>;
5
5
  export declare const zTaskSourceSchema: z.ZodEnum<["user", "automation_hub", "system"]>;
6
6
  export declare const zTaskModeSchema: z.ZodEnum<["human", "auto"]>;
7
- export declare const zTaskAutoHandlerSchema: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
7
+ export declare const zTaskAutoHandlerSchema: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
8
8
  export declare const zTaskRetryStrategySchema: z.ZodEnum<["fixed", "exponential"]>;
9
9
  export declare const zTaskDedupScopeSchema: z.ZodEnum<["per_recipient", "per_recipient_and_object", "custom"]>;
10
10
  export declare const zTaskDedupWindowSchema: z.ZodEnum<["same_day", "n_hours", "custom"]>;
@@ -188,19 +188,19 @@ export declare const zTaskDedupSchema: z.ZodObject<{
188
188
  importance: z.ZodOptional<z.ZodNumber>;
189
189
  }, z.ZodTypeAny, "passthrough">>;
190
190
  export declare const zTaskAutoSpecSchema: z.ZodObject<{
191
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
191
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
192
192
  kind: z.ZodString;
193
193
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
194
194
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
195
195
  idempotency_key: z.ZodOptional<z.ZodString>;
196
196
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
197
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
197
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
198
198
  kind: z.ZodString;
199
199
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
200
200
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
201
201
  idempotency_key: z.ZodOptional<z.ZodString>;
202
202
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
203
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
203
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
204
204
  kind: z.ZodString;
205
205
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
206
206
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -264,16 +264,16 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
264
264
  priority?: "low" | "medium" | "high" | undefined;
265
265
  }>>;
266
266
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
267
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
267
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
268
268
  kind: z.ZodString;
269
269
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
270
270
  }, "strip", z.ZodTypeAny, {
271
271
  kind: string;
272
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
272
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
273
273
  payload: Record<string, unknown>;
274
274
  }, {
275
275
  kind: string;
276
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
276
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
277
277
  payload: Record<string, unknown>;
278
278
  }>, "many">>;
279
279
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -334,16 +334,16 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
334
334
  priority?: "low" | "medium" | "high" | undefined;
335
335
  }>>;
336
336
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
337
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
337
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
338
338
  kind: z.ZodString;
339
339
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
340
340
  }, "strip", z.ZodTypeAny, {
341
341
  kind: string;
342
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
342
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
343
343
  payload: Record<string, unknown>;
344
344
  }, {
345
345
  kind: string;
346
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
346
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
347
347
  payload: Record<string, unknown>;
348
348
  }>, "many">>;
349
349
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
@@ -404,16 +404,16 @@ export declare const zTaskOnFailureSchema: z.ZodObject<{
404
404
  priority?: "low" | "medium" | "high" | undefined;
405
405
  }>>;
406
406
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
407
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
407
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
408
408
  kind: z.ZodString;
409
409
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
410
410
  }, "strip", z.ZodTypeAny, {
411
411
  kind: string;
412
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
412
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
413
413
  payload: Record<string, unknown>;
414
414
  }, {
415
415
  kind: string;
416
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
416
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
417
417
  payload: Record<string, unknown>;
418
418
  }>, "many">>;
419
419
  }, z.ZodTypeAny, "passthrough">>;
@@ -677,16 +677,16 @@ export declare const zTaskSchema: z.ZodObject<{
677
677
  priority?: "low" | "medium" | "high" | undefined;
678
678
  }>>;
679
679
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
680
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
680
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
681
681
  kind: z.ZodString;
682
682
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
683
683
  }, "strip", z.ZodTypeAny, {
684
684
  kind: string;
685
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
685
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
686
686
  payload: Record<string, unknown>;
687
687
  }, {
688
688
  kind: string;
689
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
689
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
690
690
  payload: Record<string, unknown>;
691
691
  }>, "many">>;
692
692
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -747,16 +747,16 @@ export declare const zTaskSchema: z.ZodObject<{
747
747
  priority?: "low" | "medium" | "high" | undefined;
748
748
  }>>;
749
749
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
750
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
750
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
751
751
  kind: z.ZodString;
752
752
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
753
753
  }, "strip", z.ZodTypeAny, {
754
754
  kind: string;
755
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
755
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
756
756
  payload: Record<string, unknown>;
757
757
  }, {
758
758
  kind: string;
759
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
759
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
760
760
  payload: Record<string, unknown>;
761
761
  }>, "many">>;
762
762
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
@@ -817,16 +817,16 @@ export declare const zTaskSchema: z.ZodObject<{
817
817
  priority?: "low" | "medium" | "high" | undefined;
818
818
  }>>;
819
819
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
820
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
820
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
821
821
  kind: z.ZodString;
822
822
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
823
823
  }, "strip", z.ZodTypeAny, {
824
824
  kind: string;
825
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
825
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
826
826
  payload: Record<string, unknown>;
827
827
  }, {
828
828
  kind: string;
829
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
829
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
830
830
  payload: Record<string, unknown>;
831
831
  }>, "many">>;
832
832
  }, z.ZodTypeAny, "passthrough">>>;
@@ -847,19 +847,19 @@ export declare const zTaskSchema: z.ZodObject<{
847
847
  dispatched_attempts: z.ZodOptional<z.ZodNumber>;
848
848
  }, z.ZodTypeAny, "passthrough">>>;
849
849
  auto: z.ZodOptional<z.ZodObject<{
850
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
850
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
851
851
  kind: z.ZodString;
852
852
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
853
853
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
854
854
  idempotency_key: z.ZodOptional<z.ZodString>;
855
855
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
856
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
856
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
857
857
  kind: z.ZodString;
858
858
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
859
859
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
860
860
  idempotency_key: z.ZodOptional<z.ZodString>;
861
861
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
862
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
862
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
863
863
  kind: z.ZodString;
864
864
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
865
865
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -1115,16 +1115,16 @@ export declare const zTaskSchema: z.ZodObject<{
1115
1115
  priority?: "low" | "medium" | "high" | undefined;
1116
1116
  }>>;
1117
1117
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1118
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1118
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1119
1119
  kind: z.ZodString;
1120
1120
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1121
1121
  }, "strip", z.ZodTypeAny, {
1122
1122
  kind: string;
1123
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
1123
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
1124
1124
  payload: Record<string, unknown>;
1125
1125
  }, {
1126
1126
  kind: string;
1127
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
1127
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
1128
1128
  payload: Record<string, unknown>;
1129
1129
  }>, "many">>;
1130
1130
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -1185,16 +1185,16 @@ export declare const zTaskSchema: z.ZodObject<{
1185
1185
  priority?: "low" | "medium" | "high" | undefined;
1186
1186
  }>>;
1187
1187
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1188
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1188
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1189
1189
  kind: z.ZodString;
1190
1190
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1191
1191
  }, "strip", z.ZodTypeAny, {
1192
1192
  kind: string;
1193
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
1193
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
1194
1194
  payload: Record<string, unknown>;
1195
1195
  }, {
1196
1196
  kind: string;
1197
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
1197
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
1198
1198
  payload: Record<string, unknown>;
1199
1199
  }>, "many">>;
1200
1200
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
@@ -1255,16 +1255,16 @@ export declare const zTaskSchema: z.ZodObject<{
1255
1255
  priority?: "low" | "medium" | "high" | undefined;
1256
1256
  }>>;
1257
1257
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1258
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1258
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1259
1259
  kind: z.ZodString;
1260
1260
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1261
1261
  }, "strip", z.ZodTypeAny, {
1262
1262
  kind: string;
1263
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
1263
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
1264
1264
  payload: Record<string, unknown>;
1265
1265
  }, {
1266
1266
  kind: string;
1267
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
1267
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
1268
1268
  payload: Record<string, unknown>;
1269
1269
  }>, "many">>;
1270
1270
  }, z.ZodTypeAny, "passthrough">>>;
@@ -1285,19 +1285,19 @@ export declare const zTaskSchema: z.ZodObject<{
1285
1285
  dispatched_attempts: z.ZodOptional<z.ZodNumber>;
1286
1286
  }, z.ZodTypeAny, "passthrough">>>;
1287
1287
  auto: z.ZodOptional<z.ZodObject<{
1288
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1288
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1289
1289
  kind: z.ZodString;
1290
1290
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
1291
1291
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1292
1292
  idempotency_key: z.ZodOptional<z.ZodString>;
1293
1293
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1294
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1294
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1295
1295
  kind: z.ZodString;
1296
1296
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
1297
1297
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1298
1298
  idempotency_key: z.ZodOptional<z.ZodString>;
1299
1299
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1300
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1300
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1301
1301
  kind: z.ZodString;
1302
1302
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
1303
1303
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -1553,16 +1553,16 @@ export declare const zTaskSchema: z.ZodObject<{
1553
1553
  priority?: "low" | "medium" | "high" | undefined;
1554
1554
  }>>;
1555
1555
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1556
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1556
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1557
1557
  kind: z.ZodString;
1558
1558
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1559
1559
  }, "strip", z.ZodTypeAny, {
1560
1560
  kind: string;
1561
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
1561
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
1562
1562
  payload: Record<string, unknown>;
1563
1563
  }, {
1564
1564
  kind: string;
1565
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
1565
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
1566
1566
  payload: Record<string, unknown>;
1567
1567
  }>, "many">>;
1568
1568
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -1623,16 +1623,16 @@ export declare const zTaskSchema: z.ZodObject<{
1623
1623
  priority?: "low" | "medium" | "high" | undefined;
1624
1624
  }>>;
1625
1625
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1626
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1626
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1627
1627
  kind: z.ZodString;
1628
1628
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1629
1629
  }, "strip", z.ZodTypeAny, {
1630
1630
  kind: string;
1631
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
1631
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
1632
1632
  payload: Record<string, unknown>;
1633
1633
  }, {
1634
1634
  kind: string;
1635
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
1635
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
1636
1636
  payload: Record<string, unknown>;
1637
1637
  }>, "many">>;
1638
1638
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
@@ -1693,16 +1693,16 @@ export declare const zTaskSchema: z.ZodObject<{
1693
1693
  priority?: "low" | "medium" | "high" | undefined;
1694
1694
  }>>;
1695
1695
  auto_fallbacks: z.ZodOptional<z.ZodArray<z.ZodObject<{
1696
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1696
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1697
1697
  kind: z.ZodString;
1698
1698
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1699
1699
  }, "strip", z.ZodTypeAny, {
1700
1700
  kind: string;
1701
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
1701
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
1702
1702
  payload: Record<string, unknown>;
1703
1703
  }, {
1704
1704
  kind: string;
1705
- handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom";
1705
+ handler: "notifications" | "ai_agent" | "invoices" | "webhook" | "custom" | "lead_reactivation";
1706
1706
  payload: Record<string, unknown>;
1707
1707
  }>, "many">>;
1708
1708
  }, z.ZodTypeAny, "passthrough">>>;
@@ -1723,19 +1723,19 @@ export declare const zTaskSchema: z.ZodObject<{
1723
1723
  dispatched_attempts: z.ZodOptional<z.ZodNumber>;
1724
1724
  }, z.ZodTypeAny, "passthrough">>>;
1725
1725
  auto: z.ZodOptional<z.ZodObject<{
1726
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1726
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1727
1727
  kind: z.ZodString;
1728
1728
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
1729
1729
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1730
1730
  idempotency_key: z.ZodOptional<z.ZodString>;
1731
1731
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1732
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1732
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1733
1733
  kind: z.ZodString;
1734
1734
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
1735
1735
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1736
1736
  idempotency_key: z.ZodOptional<z.ZodString>;
1737
1737
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1738
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1738
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1739
1739
  kind: z.ZodString;
1740
1740
  version: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
1741
1741
  payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
@@ -1855,7 +1855,7 @@ export declare const zTaskExecutionSchema: z.ZodObject<{
1855
1855
  deleted_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
1856
1856
  } & {
1857
1857
  taskId: z.ZodString;
1858
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1858
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1859
1859
  kind: z.ZodString;
1860
1860
  status: z.ZodEnum<["success", "error", "retry"]>;
1861
1861
  attempt: z.ZodNumber;
@@ -1895,7 +1895,7 @@ export declare const zTaskExecutionSchema: z.ZodObject<{
1895
1895
  deleted_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
1896
1896
  } & {
1897
1897
  taskId: z.ZodString;
1898
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1898
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1899
1899
  kind: z.ZodString;
1900
1900
  status: z.ZodEnum<["success", "error", "retry"]>;
1901
1901
  attempt: z.ZodNumber;
@@ -1935,7 +1935,7 @@ export declare const zTaskExecutionSchema: z.ZodObject<{
1935
1935
  deleted_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
1936
1936
  } & {
1937
1937
  taskId: z.ZodString;
1938
- handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom"]>;
1938
+ handler: z.ZodEnum<["notifications", "ai_agent", "invoices", "webhook", "custom", "lead_reactivation"]>;
1939
1939
  kind: z.ZodString;
1940
1940
  status: z.ZodEnum<["success", "error", "retry"]>;
1941
1941
  attempt: z.ZodNumber;
@@ -27,6 +27,8 @@ exports.zTaskAutoHandlerSchema = zod_1.z.enum([
27
27
  "invoices",
28
28
  "webhook",
29
29
  "custom",
30
+ // feat-037: handler da régua de reativação de lead (ticket_closed → create_task).
31
+ "lead_reactivation",
30
32
  ]);
31
33
  exports.zTaskRetryStrategySchema = zod_1.z.enum(["fixed", "exponential"]);
32
34
  exports.zTaskDedupScopeSchema = zod_1.z.enum([
@@ -30,6 +30,8 @@ export const zTaskAutoHandlerSchema = z.enum([
30
30
  "invoices",
31
31
  "webhook",
32
32
  "custom",
33
+ // feat-037: handler da régua de reativação de lead (ticket_closed → create_task).
34
+ "lead_reactivation",
33
35
  ]);
34
36
 
35
37
  export const zTaskRetryStrategySchema = z.enum(["fixed", "exponential"]);