evo360-types 1.3.550 → 1.3.555

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.
Files changed (33) hide show
  1. package/dist/apps/evo-chat/ticket/zod-schemas.d.ts +66 -0
  2. package/dist/apps/evo-chat/ticket/zod-schemas.js +4 -0
  3. package/dist/apps/evo-chat/ticket/zod-schemas.ts +4 -0
  4. package/dist/apps/evo-core/zod-schemas.d.ts +30 -0
  5. package/dist/apps/evo-core/zod-schemas.js +2 -0
  6. package/dist/apps/evo-core/zod-schemas.ts +2 -0
  7. package/dist/apps/evo-csq/zod-schemas.d.ts +10414 -0
  8. package/dist/apps/evo-csq/zod-schemas.js +546 -0
  9. package/dist/apps/evo-csq/zod-schemas.ts +627 -0
  10. package/dist/apps/evo-finops/zod-schemas.d.ts +2 -2
  11. package/dist/apps/evo-hub-ia/v1/zod-schemas.d.ts +161 -0
  12. package/dist/apps/evo-hub-ia/v1/zod-schemas.js +43 -1
  13. package/dist/apps/evo-hub-ia/v1/zod-schemas.ts +46 -0
  14. package/dist/apps/hub-automation/zod-schemas.d.ts +18 -18
  15. package/dist/index.d.ts +3 -0
  16. package/dist/index.js +3 -0
  17. package/dist/index.ts +3 -0
  18. package/dist/types/evo-chat/ticket/index.d.ts +4 -0
  19. package/dist/types/evo-chat/ticket/index.ts +5 -0
  20. package/dist/types/evo-core/index.d.ts +2 -0
  21. package/dist/types/evo-core/index.ts +2 -0
  22. package/dist/types/evo-csq/fb_collections.d.ts +5 -0
  23. package/dist/types/evo-csq/fb_collections.js +13 -0
  24. package/dist/types/evo-csq/fb_collections.ts +14 -0
  25. package/dist/types/evo-csq/index.d.ts +624 -0
  26. package/dist/types/evo-csq/index.js +180 -0
  27. package/dist/types/evo-csq/index.ts +888 -0
  28. package/dist/types/evo-hub-ia/v1/index.d.ts +37 -0
  29. package/dist/types/evo-hub-ia/v1/index.ts +44 -0
  30. package/dist/types/evo-reports/index.d.ts +100 -0
  31. package/dist/types/evo-reports/index.js +8 -0
  32. package/dist/types/evo-reports/index.ts +122 -0
  33. package/package.json +1 -1
@@ -2308,6 +2308,9 @@ export declare const zAiBindingSchema: z.ZodObject<{
2308
2308
  * `dry_run` força todas as regras deste binding a modo seco (sem executar
2309
2309
  * actions; apenas avalia e grava trace). Default runtime quando ausente: `live`. */
2310
2310
  rules_mode: z.ZodOptional<z.ZodEnum<["live", "dry_run"]>>;
2311
+ /** CSQ 2.0 — off (default) | shadow (avalia, não notifica) | active.
2312
+ * Ausente equivale a `off`: o gate do pipeline só segue com `shadow`/`active`. */
2313
+ csq_mode: z.ZodOptional<z.ZodEnum<["off", "shadow", "active"]>>;
2311
2314
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2312
2315
  id: z.ZodString;
2313
2316
  ref: z.ZodAny;
@@ -3051,6 +3054,9 @@ export declare const zAiBindingSchema: z.ZodObject<{
3051
3054
  * `dry_run` força todas as regras deste binding a modo seco (sem executar
3052
3055
  * actions; apenas avalia e grava trace). Default runtime quando ausente: `live`. */
3053
3056
  rules_mode: z.ZodOptional<z.ZodEnum<["live", "dry_run"]>>;
3057
+ /** CSQ 2.0 — off (default) | shadow (avalia, não notifica) | active.
3058
+ * Ausente equivale a `off`: o gate do pipeline só segue com `shadow`/`active`. */
3059
+ csq_mode: z.ZodOptional<z.ZodEnum<["off", "shadow", "active"]>>;
3054
3060
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
3055
3061
  id: z.ZodString;
3056
3062
  ref: z.ZodAny;
@@ -3794,5 +3800,160 @@ export declare const zAiBindingSchema: z.ZodObject<{
3794
3800
  * `dry_run` força todas as regras deste binding a modo seco (sem executar
3795
3801
  * actions; apenas avalia e grava trace). Default runtime quando ausente: `live`. */
3796
3802
  rules_mode: z.ZodOptional<z.ZodEnum<["live", "dry_run"]>>;
3803
+ /** CSQ 2.0 — off (default) | shadow (avalia, não notifica) | active.
3804
+ * Ausente equivale a `off`: o gate do pipeline só segue com `shadow`/`active`. */
3805
+ csq_mode: z.ZodOptional<z.ZodEnum<["off", "shadow", "active"]>>;
3797
3806
  }, z.ZodTypeAny, "passthrough">>;
3798
3807
  export type IAiBinding = z.infer<typeof zAiBindingSchema>;
3808
+ /** Disposição de fechamento publicada no evento. Os bridges publicam `null`
3809
+ * quando o operador não escolheu disposição. */
3810
+ export declare const zHubiaTicketClosedCloseSchema: z.ZodObject<{
3811
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3812
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3813
+ type_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3814
+ type_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3815
+ /** Observação livre do operador ao fechar (novo em feat-154). */
3816
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3817
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
3818
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3819
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3820
+ type_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3821
+ type_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3822
+ /** Observação livre do operador ao fechar (novo em feat-154). */
3823
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3824
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
3825
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3826
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3827
+ type_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3828
+ type_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3829
+ /** Observação livre do operador ao fechar (novo em feat-154). */
3830
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3831
+ }, z.ZodTypeAny, "passthrough">>;
3832
+ /** Payload do tópico `hubia-ticket-closed`, publicado pelo bridge do hub-omni
3833
+ * (`provider: 'hub-waba'`) e pelo do Chatbee (`provider: 'chatbee'`).
3834
+ * Os campos marcados como novos (feat-154) são OPCIONAIS de propósito: o
3835
+ * bridge do Chatbee continua publicando o shape antigo. Schema passthrough. */
3836
+ export declare const zHubiaTicketClosedEventSchema: z.ZodObject<{
3837
+ tenant: z.ZodString;
3838
+ evoChatChannelId: z.ZodString;
3839
+ contactId: z.ZodString;
3840
+ departmentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3841
+ close: z.ZodObject<{
3842
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3843
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3844
+ type_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3845
+ type_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3846
+ /** Observação livre do operador ao fechar (novo em feat-154). */
3847
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3848
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
3849
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3850
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3851
+ type_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3852
+ type_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3853
+ /** Observação livre do operador ao fechar (novo em feat-154). */
3854
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3855
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
3856
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3857
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3858
+ type_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3859
+ type_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3860
+ /** Observação livre do operador ao fechar (novo em feat-154). */
3861
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3862
+ }, z.ZodTypeAny, "passthrough">>;
3863
+ /** ISO 8601 do instante de fechamento. */
3864
+ closedAt: z.ZodString;
3865
+ /** Idempotência do consumidor de regras (history_id no Chatbee, ticketId no omni). */
3866
+ idempotencyKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3867
+ /** `${ticketId}:${closedAt ISO}` — chave do ledger `runs/{eventId}` do CSQ. */
3868
+ event_id: z.ZodOptional<z.ZodString>;
3869
+ /** Versão do payload. 1 = feat-154. */
3870
+ schema_version: z.ZodOptional<z.ZodNumber>;
3871
+ ticketId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3872
+ threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3873
+ leadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3874
+ closedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3875
+ /** Quem fechou. O CSQ só avalia `human`. */
3876
+ actorType: z.ZodOptional<z.ZodEnum<["human", "system", "automation"]>>;
3877
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
3878
+ tenant: z.ZodString;
3879
+ evoChatChannelId: z.ZodString;
3880
+ contactId: z.ZodString;
3881
+ departmentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3882
+ close: z.ZodObject<{
3883
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3884
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3885
+ type_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3886
+ type_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3887
+ /** Observação livre do operador ao fechar (novo em feat-154). */
3888
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3889
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
3890
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3891
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3892
+ type_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3893
+ type_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3894
+ /** Observação livre do operador ao fechar (novo em feat-154). */
3895
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3896
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
3897
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3898
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3899
+ type_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3900
+ type_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3901
+ /** Observação livre do operador ao fechar (novo em feat-154). */
3902
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3903
+ }, z.ZodTypeAny, "passthrough">>;
3904
+ /** ISO 8601 do instante de fechamento. */
3905
+ closedAt: z.ZodString;
3906
+ /** Idempotência do consumidor de regras (history_id no Chatbee, ticketId no omni). */
3907
+ idempotencyKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3908
+ /** `${ticketId}:${closedAt ISO}` — chave do ledger `runs/{eventId}` do CSQ. */
3909
+ event_id: z.ZodOptional<z.ZodString>;
3910
+ /** Versão do payload. 1 = feat-154. */
3911
+ schema_version: z.ZodOptional<z.ZodNumber>;
3912
+ ticketId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3913
+ threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3914
+ leadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3915
+ closedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3916
+ /** Quem fechou. O CSQ só avalia `human`. */
3917
+ actorType: z.ZodOptional<z.ZodEnum<["human", "system", "automation"]>>;
3918
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
3919
+ tenant: z.ZodString;
3920
+ evoChatChannelId: z.ZodString;
3921
+ contactId: z.ZodString;
3922
+ departmentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3923
+ close: z.ZodObject<{
3924
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3925
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3926
+ type_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3927
+ type_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3928
+ /** Observação livre do operador ao fechar (novo em feat-154). */
3929
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3930
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
3931
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3932
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3933
+ type_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3934
+ type_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3935
+ /** Observação livre do operador ao fechar (novo em feat-154). */
3936
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3937
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
3938
+ code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3939
+ name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3940
+ type_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3941
+ type_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3942
+ /** Observação livre do operador ao fechar (novo em feat-154). */
3943
+ notes: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3944
+ }, z.ZodTypeAny, "passthrough">>;
3945
+ /** ISO 8601 do instante de fechamento. */
3946
+ closedAt: z.ZodString;
3947
+ /** Idempotência do consumidor de regras (history_id no Chatbee, ticketId no omni). */
3948
+ idempotencyKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3949
+ /** `${ticketId}:${closedAt ISO}` — chave do ledger `runs/{eventId}` do CSQ. */
3950
+ event_id: z.ZodOptional<z.ZodString>;
3951
+ /** Versão do payload. 1 = feat-154. */
3952
+ schema_version: z.ZodOptional<z.ZodNumber>;
3953
+ ticketId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3954
+ threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3955
+ leadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3956
+ closedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
3957
+ /** Quem fechou. O CSQ só avalia `human`. */
3958
+ actorType: z.ZodOptional<z.ZodEnum<["human", "system", "automation"]>>;
3959
+ }, z.ZodTypeAny, "passthrough">>;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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;
3
+ exports.zHubiaTicketClosedEventSchema = exports.zHubiaTicketClosedCloseSchema = 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
+ const zod_schemas_2 = require("../../evo-csq/zod-schemas");
6
7
  // ───────── Attendance Mode (how AI operates on this channel) ─────────
7
8
  exports.zHubiaAttendanceModeSchema = zod_1.z.enum(["ai_auto", "ai_suggest", "disabled"]);
8
9
  // ───────── Channel Config (evo-hubia-v1 automation config per channel) ─────────
@@ -356,4 +357,45 @@ exports.zAiBindingSchema = zod_schemas_1.zFireDocSchema.extend({
356
357
  * `dry_run` força todas as regras deste binding a modo seco (sem executar
357
358
  * actions; apenas avalia e grava trace). Default runtime quando ausente: `live`. */
358
359
  rules_mode: exports.zHubiaRulesModeSchema.optional(),
360
+ // ───── evo-csq (CSQ 2.0) ─────
361
+ /** CSQ 2.0 — off (default) | shadow (avalia, não notifica) | active.
362
+ * Ausente equivale a `off`: o gate do pipeline só segue com `shadow`/`active`. */
363
+ csq_mode: zod_schemas_2.zCsqModeSchema.optional(),
364
+ }).passthrough();
365
+ // ───────── Evento `hubia-ticket-closed` (payload do tópico PubSub) ─────────
366
+ /** Disposição de fechamento publicada no evento. Os bridges publicam `null`
367
+ * quando o operador não escolheu disposição. */
368
+ exports.zHubiaTicketClosedCloseSchema = zod_1.z.object({
369
+ code: zod_1.z.string().nullable().optional(),
370
+ name: zod_1.z.string().nullable().optional(),
371
+ type_code: zod_1.z.string().nullable().optional(),
372
+ type_name: zod_1.z.string().nullable().optional(),
373
+ /** Observação livre do operador ao fechar (novo em feat-154). */
374
+ notes: zod_1.z.string().nullable().optional(),
375
+ }).passthrough();
376
+ /** Payload do tópico `hubia-ticket-closed`, publicado pelo bridge do hub-omni
377
+ * (`provider: 'hub-waba'`) e pelo do Chatbee (`provider: 'chatbee'`).
378
+ * Os campos marcados como novos (feat-154) são OPCIONAIS de propósito: o
379
+ * bridge do Chatbee continua publicando o shape antigo. Schema passthrough. */
380
+ exports.zHubiaTicketClosedEventSchema = zod_1.z.object({
381
+ tenant: zod_1.z.string(),
382
+ evoChatChannelId: zod_1.z.string(),
383
+ contactId: zod_1.z.string(),
384
+ departmentId: zod_1.z.string().nullable().optional(),
385
+ close: exports.zHubiaTicketClosedCloseSchema,
386
+ /** ISO 8601 do instante de fechamento. */
387
+ closedAt: zod_1.z.string(),
388
+ /** Idempotência do consumidor de regras (history_id no Chatbee, ticketId no omni). */
389
+ idempotencyKey: zod_1.z.string().nullable().optional(),
390
+ // ───── novos em feat-154 (todos opcionais: compat com o bridge do Chatbee) ─────
391
+ /** `${ticketId}:${closedAt ISO}` — chave do ledger `runs/{eventId}` do CSQ. */
392
+ event_id: zod_1.z.string().optional(),
393
+ /** Versão do payload. 1 = feat-154. */
394
+ schema_version: zod_1.z.number().optional(),
395
+ ticketId: zod_1.z.string().nullable().optional(),
396
+ threadId: zod_1.z.string().nullable().optional(),
397
+ leadId: zod_1.z.string().nullable().optional(),
398
+ closedByUserId: zod_1.z.string().nullable().optional(),
399
+ /** Quem fechou. O CSQ só avalia `human`. */
400
+ actorType: zod_1.z.enum(["human", "system", "automation"]).optional(),
359
401
  }).passthrough();
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { zFireDocSchema } from "../../shared/zod-schemas";
3
+ import { zCsqModeSchema } from "../../evo-csq/zod-schemas";
3
4
 
4
5
  // ───────── Attendance Mode (how AI operates on this channel) ─────────
5
6
 
@@ -401,7 +402,52 @@ export const zAiBindingSchema = zFireDocSchema.extend({
401
402
  * `dry_run` força todas as regras deste binding a modo seco (sem executar
402
403
  * actions; apenas avalia e grava trace). Default runtime quando ausente: `live`. */
403
404
  rules_mode: zHubiaRulesModeSchema.optional(),
405
+
406
+ // ───── evo-csq (CSQ 2.0) ─────
407
+ /** CSQ 2.0 — off (default) | shadow (avalia, não notifica) | active.
408
+ * Ausente equivale a `off`: o gate do pipeline só segue com `shadow`/`active`. */
409
+ csq_mode: zCsqModeSchema.optional(),
404
410
  }).passthrough();
405
411
 
406
412
  export type IAiBinding = z.infer<typeof zAiBindingSchema>;
407
413
 
414
+ // ───────── Evento `hubia-ticket-closed` (payload do tópico PubSub) ─────────
415
+
416
+ /** Disposição de fechamento publicada no evento. Os bridges publicam `null`
417
+ * quando o operador não escolheu disposição. */
418
+ export const zHubiaTicketClosedCloseSchema = z.object({
419
+ code: z.string().nullable().optional(),
420
+ name: z.string().nullable().optional(),
421
+ type_code: z.string().nullable().optional(),
422
+ type_name: z.string().nullable().optional(),
423
+ /** Observação livre do operador ao fechar (novo em feat-154). */
424
+ notes: z.string().nullable().optional(),
425
+ }).passthrough();
426
+
427
+ /** Payload do tópico `hubia-ticket-closed`, publicado pelo bridge do hub-omni
428
+ * (`provider: 'hub-waba'`) e pelo do Chatbee (`provider: 'chatbee'`).
429
+ * Os campos marcados como novos (feat-154) são OPCIONAIS de propósito: o
430
+ * bridge do Chatbee continua publicando o shape antigo. Schema passthrough. */
431
+ export const zHubiaTicketClosedEventSchema = z.object({
432
+ tenant: z.string(),
433
+ evoChatChannelId: z.string(),
434
+ contactId: z.string(),
435
+ departmentId: z.string().nullable().optional(),
436
+ close: zHubiaTicketClosedCloseSchema,
437
+ /** ISO 8601 do instante de fechamento. */
438
+ closedAt: z.string(),
439
+ /** Idempotência do consumidor de regras (history_id no Chatbee, ticketId no omni). */
440
+ idempotencyKey: z.string().nullable().optional(),
441
+
442
+ // ───── novos em feat-154 (todos opcionais: compat com o bridge do Chatbee) ─────
443
+ /** `${ticketId}:${closedAt ISO}` — chave do ledger `runs/{eventId}` do CSQ. */
444
+ event_id: z.string().optional(),
445
+ /** Versão do payload. 1 = feat-154. */
446
+ schema_version: z.number().optional(),
447
+ ticketId: z.string().nullable().optional(),
448
+ threadId: z.string().nullable().optional(),
449
+ leadId: z.string().nullable().optional(),
450
+ closedByUserId: z.string().nullable().optional(),
451
+ /** Quem fechou. O CSQ só avalia `human`. */
452
+ actorType: z.enum(["human", "system", "automation"]).optional(),
453
+ }).passthrough();
@@ -311,21 +311,21 @@ export declare const zAutomationLeadSelectionSchema: z.ZodObject<{
311
311
  tag_names?: string[] | undefined;
312
312
  }>;
313
313
  }, "strip", z.ZodTypeAny, {
314
- target: "lead";
315
314
  lead: {
316
315
  status_in?: string[] | undefined;
317
316
  qualification_codes?: string[] | undefined;
318
317
  dist_channel_codes?: string[] | undefined;
319
318
  tag_names?: string[] | undefined;
320
319
  };
321
- }, {
322
320
  target: "lead";
321
+ }, {
323
322
  lead: {
324
323
  status_in?: string[] | undefined;
325
324
  qualification_codes?: string[] | undefined;
326
325
  dist_channel_codes?: string[] | undefined;
327
326
  tag_names?: string[] | undefined;
328
327
  };
328
+ target: "lead";
329
329
  }>;
330
330
  export declare const zAutomationPatientSelectionSchema: z.ZodObject<{
331
331
  target: z.ZodLiteral<"patient">;
@@ -543,21 +543,21 @@ export declare const zAutomationSelectionSchema: z.ZodDiscriminatedUnion<"target
543
543
  tag_names?: string[] | undefined;
544
544
  }>;
545
545
  }, "strip", z.ZodTypeAny, {
546
- target: "lead";
547
546
  lead: {
548
547
  status_in?: string[] | undefined;
549
548
  qualification_codes?: string[] | undefined;
550
549
  dist_channel_codes?: string[] | undefined;
551
550
  tag_names?: string[] | undefined;
552
551
  };
553
- }, {
554
552
  target: "lead";
553
+ }, {
555
554
  lead: {
556
555
  status_in?: string[] | undefined;
557
556
  qualification_codes?: string[] | undefined;
558
557
  dist_channel_codes?: string[] | undefined;
559
558
  tag_names?: string[] | undefined;
560
559
  };
560
+ target: "lead";
561
561
  }>, z.ZodObject<{
562
562
  target: z.ZodLiteral<"patient">;
563
563
  patient: z.ZodObject<{
@@ -2810,21 +2810,21 @@ export declare const zAutomationRoutineSchema: z.ZodObject<{
2810
2810
  tag_names?: string[] | undefined;
2811
2811
  }>;
2812
2812
  }, "strip", z.ZodTypeAny, {
2813
- target: "lead";
2814
2813
  lead: {
2815
2814
  status_in?: string[] | undefined;
2816
2815
  qualification_codes?: string[] | undefined;
2817
2816
  dist_channel_codes?: string[] | undefined;
2818
2817
  tag_names?: string[] | undefined;
2819
2818
  };
2820
- }, {
2821
2819
  target: "lead";
2820
+ }, {
2822
2821
  lead: {
2823
2822
  status_in?: string[] | undefined;
2824
2823
  qualification_codes?: string[] | undefined;
2825
2824
  dist_channel_codes?: string[] | undefined;
2826
2825
  tag_names?: string[] | undefined;
2827
2826
  };
2827
+ target: "lead";
2828
2828
  }>, z.ZodObject<{
2829
2829
  target: z.ZodLiteral<"patient">;
2830
2830
  patient: z.ZodObject<{
@@ -3748,13 +3748,13 @@ export declare const zAutomationRoutineSchema: z.ZodObject<{
3748
3748
  };
3749
3749
  target: "appointment";
3750
3750
  } | {
3751
- target: "lead";
3752
3751
  lead: {
3753
3752
  status_in?: string[] | undefined;
3754
3753
  qualification_codes?: string[] | undefined;
3755
3754
  dist_channel_codes?: string[] | undefined;
3756
3755
  tag_names?: string[] | undefined;
3757
3756
  };
3757
+ target: "lead";
3758
3758
  } | {
3759
3759
  patient: {
3760
3760
  status_in?: string[] | undefined;
@@ -3958,13 +3958,13 @@ export declare const zAutomationRoutineSchema: z.ZodObject<{
3958
3958
  };
3959
3959
  target: "appointment";
3960
3960
  } | {
3961
- target: "lead";
3962
3961
  lead: {
3963
3962
  status_in?: string[] | undefined;
3964
3963
  qualification_codes?: string[] | undefined;
3965
3964
  dist_channel_codes?: string[] | undefined;
3966
3965
  tag_names?: string[] | undefined;
3967
3966
  };
3967
+ target: "lead";
3968
3968
  } | {
3969
3969
  patient: {
3970
3970
  status_in?: string[] | undefined;
@@ -4380,21 +4380,21 @@ export declare const zAutomationRoutineWriteSchema: z.ZodObject<{
4380
4380
  tag_names?: string[] | undefined;
4381
4381
  }>;
4382
4382
  }, "strip", z.ZodTypeAny, {
4383
- target: "lead";
4384
4383
  lead: {
4385
4384
  status_in?: string[] | undefined;
4386
4385
  qualification_codes?: string[] | undefined;
4387
4386
  dist_channel_codes?: string[] | undefined;
4388
4387
  tag_names?: string[] | undefined;
4389
4388
  };
4390
- }, {
4391
4389
  target: "lead";
4390
+ }, {
4392
4391
  lead: {
4393
4392
  status_in?: string[] | undefined;
4394
4393
  qualification_codes?: string[] | undefined;
4395
4394
  dist_channel_codes?: string[] | undefined;
4396
4395
  tag_names?: string[] | undefined;
4397
4396
  };
4397
+ target: "lead";
4398
4398
  }>, z.ZodObject<{
4399
4399
  target: z.ZodLiteral<"patient">;
4400
4400
  patient: z.ZodObject<{
@@ -5280,13 +5280,13 @@ export declare const zAutomationRoutineWriteSchema: z.ZodObject<{
5280
5280
  };
5281
5281
  target: "appointment";
5282
5282
  } | {
5283
- target: "lead";
5284
5283
  lead: {
5285
5284
  status_in?: string[] | undefined;
5286
5285
  qualification_codes?: string[] | undefined;
5287
5286
  dist_channel_codes?: string[] | undefined;
5288
5287
  tag_names?: string[] | undefined;
5289
5288
  };
5289
+ target: "lead";
5290
5290
  } | {
5291
5291
  patient: {
5292
5292
  status_in?: string[] | undefined;
@@ -5475,13 +5475,13 @@ export declare const zAutomationRoutineWriteSchema: z.ZodObject<{
5475
5475
  };
5476
5476
  target: "appointment";
5477
5477
  } | {
5478
- target: "lead";
5479
5478
  lead: {
5480
5479
  status_in?: string[] | undefined;
5481
5480
  qualification_codes?: string[] | undefined;
5482
5481
  dist_channel_codes?: string[] | undefined;
5483
5482
  tag_names?: string[] | undefined;
5484
5483
  };
5484
+ target: "lead";
5485
5485
  } | {
5486
5486
  patient: {
5487
5487
  status_in?: string[] | undefined;
@@ -5884,21 +5884,21 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
5884
5884
  tag_names?: string[] | undefined;
5885
5885
  }>;
5886
5886
  }, "strip", z.ZodTypeAny, {
5887
- target: "lead";
5888
5887
  lead: {
5889
5888
  status_in?: string[] | undefined;
5890
5889
  qualification_codes?: string[] | undefined;
5891
5890
  dist_channel_codes?: string[] | undefined;
5892
5891
  tag_names?: string[] | undefined;
5893
5892
  };
5894
- }, {
5895
5893
  target: "lead";
5894
+ }, {
5896
5895
  lead: {
5897
5896
  status_in?: string[] | undefined;
5898
5897
  qualification_codes?: string[] | undefined;
5899
5898
  dist_channel_codes?: string[] | undefined;
5900
5899
  tag_names?: string[] | undefined;
5901
5900
  };
5901
+ target: "lead";
5902
5902
  }>, z.ZodObject<{
5903
5903
  target: z.ZodLiteral<"patient">;
5904
5904
  patient: z.ZodObject<{
@@ -6784,13 +6784,13 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
6784
6784
  };
6785
6785
  target: "appointment";
6786
6786
  } | {
6787
- target: "lead";
6788
6787
  lead: {
6789
6788
  status_in?: string[] | undefined;
6790
6789
  qualification_codes?: string[] | undefined;
6791
6790
  dist_channel_codes?: string[] | undefined;
6792
6791
  tag_names?: string[] | undefined;
6793
6792
  };
6793
+ target: "lead";
6794
6794
  } | {
6795
6795
  patient: {
6796
6796
  status_in?: string[] | undefined;
@@ -6979,13 +6979,13 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
6979
6979
  };
6980
6980
  target: "appointment";
6981
6981
  } | {
6982
- target: "lead";
6983
6982
  lead: {
6984
6983
  status_in?: string[] | undefined;
6985
6984
  qualification_codes?: string[] | undefined;
6986
6985
  dist_channel_codes?: string[] | undefined;
6987
6986
  tag_names?: string[] | undefined;
6988
6987
  };
6988
+ target: "lead";
6989
6989
  } | {
6990
6990
  patient: {
6991
6991
  status_in?: string[] | undefined;
@@ -7179,13 +7179,13 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
7179
7179
  };
7180
7180
  target: "appointment";
7181
7181
  } | {
7182
- target: "lead";
7183
7182
  lead: {
7184
7183
  status_in?: string[] | undefined;
7185
7184
  qualification_codes?: string[] | undefined;
7186
7185
  dist_channel_codes?: string[] | undefined;
7187
7186
  tag_names?: string[] | undefined;
7188
7187
  };
7188
+ target: "lead";
7189
7189
  } | {
7190
7190
  patient: {
7191
7191
  status_in?: string[] | undefined;
@@ -7377,13 +7377,13 @@ export declare const zAutomationRoutineUpdateRequestSchema: z.ZodObject<{
7377
7377
  };
7378
7378
  target: "appointment";
7379
7379
  } | {
7380
- target: "lead";
7381
7380
  lead: {
7382
7381
  status_in?: string[] | undefined;
7383
7382
  qualification_codes?: string[] | undefined;
7384
7383
  dist_channel_codes?: string[] | undefined;
7385
7384
  tag_names?: string[] | undefined;
7386
7385
  };
7386
+ target: "lead";
7387
7387
  } | {
7388
7388
  patient: {
7389
7389
  status_in?: string[] | undefined;
package/dist/index.d.ts CHANGED
@@ -32,7 +32,9 @@ export * from "./types/nex-tenants";
32
32
  export * from "./types/nex-vendas";
33
33
  export * from "./types/nexus-webhooks";
34
34
  export * from "./types/evo-hub-ia";
35
+ export * from "./types/evo-csq";
35
36
  export * from "./types/evo-mcp";
37
+ export * from "./types/evo-reports";
36
38
  export * from "./apps/shared/zod-schemas";
37
39
  export * from "./apps/evo-core/zod-schemas";
38
40
  export * from "./apps/evo-tenant/zod-schemas";
@@ -56,6 +58,7 @@ export * from "./apps/evo-chat/quick-reply/zod-schemas";
56
58
  export * from "./apps/evo-hub-ia/channel/zod-schemas";
57
59
  export * from "./apps/evo-hub-ia/v1/zod-schemas";
58
60
  export * from "./apps/evo-hub-ia/v1/adapter-tool-registry";
61
+ export * from "./apps/evo-csq/zod-schemas";
59
62
  export * from "./apps/evo-med/calendar/zod-schemas";
60
63
  export * from "./apps/evo-med/appointment/zod-schemas";
61
64
  export * from "./apps/evo-med/dic/zod-schemas";
package/dist/index.js CHANGED
@@ -49,7 +49,9 @@ __exportStar(require("./types/nex-tenants"), exports);
49
49
  __exportStar(require("./types/nex-vendas"), exports);
50
50
  __exportStar(require("./types/nexus-webhooks"), exports);
51
51
  __exportStar(require("./types/evo-hub-ia"), exports);
52
+ __exportStar(require("./types/evo-csq"), exports);
52
53
  __exportStar(require("./types/evo-mcp"), exports);
54
+ __exportStar(require("./types/evo-reports"), exports);
53
55
  // zod schemas
54
56
  __exportStar(require("./apps/shared/zod-schemas"), exports);
55
57
  __exportStar(require("./apps/evo-core/zod-schemas"), exports);
@@ -74,6 +76,7 @@ __exportStar(require("./apps/evo-chat/quick-reply/zod-schemas"), exports);
74
76
  __exportStar(require("./apps/evo-hub-ia/channel/zod-schemas"), exports);
75
77
  __exportStar(require("./apps/evo-hub-ia/v1/zod-schemas"), exports);
76
78
  __exportStar(require("./apps/evo-hub-ia/v1/adapter-tool-registry"), exports);
79
+ __exportStar(require("./apps/evo-csq/zod-schemas"), exports);
77
80
  __exportStar(require("./apps/evo-med/calendar/zod-schemas"), exports);
78
81
  __exportStar(require("./apps/evo-med/appointment/zod-schemas"), exports);
79
82
  __exportStar(require("./apps/evo-med/dic/zod-schemas"), exports);
package/dist/index.ts CHANGED
@@ -33,7 +33,9 @@ export * from "./types/nex-tenants";
33
33
  export * from "./types/nex-vendas";
34
34
  export * from "./types/nexus-webhooks";
35
35
  export * from "./types/evo-hub-ia";
36
+ export * from "./types/evo-csq";
36
37
  export * from "./types/evo-mcp";
38
+ export * from "./types/evo-reports";
37
39
 
38
40
  // zod schemas
39
41
  export * from "./apps/shared/zod-schemas";
@@ -59,6 +61,7 @@ export * from "./apps/evo-chat/quick-reply/zod-schemas";
59
61
  export * from "./apps/evo-hub-ia/channel/zod-schemas";
60
62
  export * from "./apps/evo-hub-ia/v1/zod-schemas";
61
63
  export * from "./apps/evo-hub-ia/v1/adapter-tool-registry";
64
+ export * from "./apps/evo-csq/zod-schemas";
62
65
  export * from "./apps/evo-med/calendar/zod-schemas";
63
66
  export * from "./apps/evo-med/appointment/zod-schemas";
64
67
  export * from "./apps/evo-med/dic/zod-schemas";
@@ -1,4 +1,5 @@
1
1
  import { IFireDoc } from "../../shared";
2
+ import { ICsqTicketSummary } from "../../evo-csq";
2
3
  export type TicketStatus = 'open' | 'closed';
3
4
  export interface ITicketCloseInfo {
4
5
  base?: string;
@@ -37,5 +38,8 @@ export interface ITicket extends IFireDoc {
37
38
  assigned_user_id?: string | null;
38
39
  postponed_until?: Date | null;
39
40
  created_by?: ITicketCreatedBy;
41
+ /** Resumo denormalizado da última avaliação do CSQ 2.0 do lead deste ticket.
42
+ * Escrito pelo pipeline do evo-csq; ausente = nunca avaliado. */
43
+ csq?: ICsqTicketSummary;
40
44
  [key: string]: unknown;
41
45
  }
@@ -1,4 +1,5 @@
1
1
  import { IFireDoc } from "../../shared";
2
+ import { ICsqTicketSummary } from "../../evo-csq";
2
3
 
3
4
  // ── Ticket status ──
4
5
 
@@ -59,5 +60,9 @@ export interface ITicket extends IFireDoc {
59
60
 
60
61
  created_by?: ITicketCreatedBy;
61
62
 
63
+ /** Resumo denormalizado da última avaliação do CSQ 2.0 do lead deste ticket.
64
+ * Escrito pelo pipeline do evo-csq; ausente = nunca avaliado. */
65
+ csq?: ICsqTicketSummary;
66
+
62
67
  [key: string]: unknown;
63
68
  }
@@ -49,6 +49,8 @@ export interface IActionArgs {
49
49
  export interface INexusModuleChatPermissions {
50
50
  management?: boolean;
51
51
  supervision?: boolean;
52
+ /** Supervisão 2.0 (CSQ). Gate da fila e do laudo do evo-csq no Nexus. */
53
+ csq?: boolean;
52
54
  }
53
55
  export interface INexusReports {
54
56
  }
@@ -60,6 +60,8 @@ export interface IActionArgs {
60
60
  export interface INexusModuleChatPermissions {
61
61
  management?: boolean;
62
62
  supervision?: boolean;
63
+ /** Supervisão 2.0 (CSQ). Gate da fila e do laudo do evo-csq no Nexus. */
64
+ csq?: boolean;
63
65
  }
64
66
 
65
67
  export interface INexusReports {}
@@ -0,0 +1,5 @@
1
+ export declare const EVO_CSQ_APP = "evo-csq";
2
+ export declare const CSQ_LEAD_REPORTS_COLLECTION = "lead-reports";
3
+ export declare const CSQ_RUNS_COLLECTION = "runs";
4
+ export declare const CSQ_ARTIFACTS_COLLECTION = "artifacts";
5
+ export declare const CSQ_BQ_TOPIC_EVALUATIONS = "app_evo-csq_evaluations_log";