evo360-types 1.3.367 → 1.3.369

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.
@@ -469,6 +469,479 @@ export declare const zHubiaConversationMessageSchema: z.ZodObject<{
469
469
  export type IHubiaConversationMessage = z.infer<typeof zHubiaConversationMessageSchema>;
470
470
  export declare const zHubiaConversationModeSchema: z.ZodEnum<["ai_only", "hybrid_assist", "human_only", "blocked"]>;
471
471
  export type IHubiaConversationMode = z.infer<typeof zHubiaConversationModeSchema>;
472
+ /** Fase de avaliação. Tipos TS em src/types/evo-hub-ia/v1/. */
473
+ export declare const zHubiaRulePhaseSchema: z.ZodEnum<["pre_llm", "post_llm"]>;
474
+ export declare const zHubiaRuleTriggerSchema: z.ZodEnum<["inbound_message", "llm_completed"]>;
475
+ export declare const zHubiaRuleOutcomeSchema: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
476
+ export declare const zHubiaRuleAppliesToSchema: z.ZodEnum<["real_message", "kickoff", "any"]>;
477
+ export declare const zHubiaConditionOpSchema: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
478
+ /** Uma condição: avalia `op(fact, value)` contra o facts provider do runtime.
479
+ * `value` é ausente para `exists`/`not_exists`. */
480
+ export declare const zHubiaConditionSchema: z.ZodObject<{
481
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
482
+ fact: z.ZodString;
483
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
484
+ value: z.ZodOptional<z.ZodUnknown>;
485
+ }, "strip", z.ZodTypeAny, {
486
+ fact: string;
487
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
488
+ value?: unknown;
489
+ }, {
490
+ fact: string;
491
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
492
+ value?: unknown;
493
+ }>;
494
+ /** Grupo de condições. Nível 2: um nível de AND/OR, sem aninhamento profundo
495
+ * (Nível 3 fica para depois). Pelo menos uma das listas precisa ter ≥1 condição. */
496
+ export declare const zHubiaConditionGroupSchema: z.ZodEffects<z.ZodObject<{
497
+ all: z.ZodOptional<z.ZodArray<z.ZodObject<{
498
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
499
+ fact: z.ZodString;
500
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
501
+ value: z.ZodOptional<z.ZodUnknown>;
502
+ }, "strip", z.ZodTypeAny, {
503
+ fact: string;
504
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
505
+ value?: unknown;
506
+ }, {
507
+ fact: string;
508
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
509
+ value?: unknown;
510
+ }>, "many">>;
511
+ any: z.ZodOptional<z.ZodArray<z.ZodObject<{
512
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
513
+ fact: z.ZodString;
514
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
515
+ value: z.ZodOptional<z.ZodUnknown>;
516
+ }, "strip", z.ZodTypeAny, {
517
+ fact: string;
518
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
519
+ value?: unknown;
520
+ }, {
521
+ fact: string;
522
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
523
+ value?: unknown;
524
+ }>, "many">>;
525
+ }, "strip", z.ZodTypeAny, {
526
+ all?: {
527
+ fact: string;
528
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
529
+ value?: unknown;
530
+ }[] | undefined;
531
+ any?: {
532
+ fact: string;
533
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
534
+ value?: unknown;
535
+ }[] | undefined;
536
+ }, {
537
+ all?: {
538
+ fact: string;
539
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
540
+ value?: unknown;
541
+ }[] | undefined;
542
+ any?: {
543
+ fact: string;
544
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
545
+ value?: unknown;
546
+ }[] | undefined;
547
+ }>, {
548
+ all?: {
549
+ fact: string;
550
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
551
+ value?: unknown;
552
+ }[] | undefined;
553
+ any?: {
554
+ fact: string;
555
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
556
+ value?: unknown;
557
+ }[] | undefined;
558
+ }, {
559
+ all?: {
560
+ fact: string;
561
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
562
+ value?: unknown;
563
+ }[] | undefined;
564
+ any?: {
565
+ fact: string;
566
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
567
+ value?: unknown;
568
+ }[] | undefined;
569
+ }>;
570
+ /** Refinamento opcional do escopo. Departamento é implícito (regra mora no
571
+ * binding do departamento). */
572
+ export declare const zHubiaRuleScopeSchema: z.ZodObject<{
573
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
574
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
575
+ }, "strip", z.ZodTypeAny, {
576
+ provider?: "chatbee" | "hub-waba" | undefined;
577
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
578
+ }, {
579
+ provider?: "chatbee" | "hub-waba" | undefined;
580
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
581
+ }>;
582
+ /** Uma ação a executar via ToolRegistry. `input` aceita templating
583
+ * `{{fact.path}}` resolvido em runtime pelo facts provider. */
584
+ export declare const zHubiaRuleActionSchema: z.ZodObject<{
585
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
586
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
587
+ tool: z.ZodString;
588
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
589
+ }, "strip", z.ZodTypeAny, {
590
+ input: Record<string, unknown>;
591
+ tool: string;
592
+ }, {
593
+ tool: string;
594
+ input?: Record<string, unknown> | undefined;
595
+ }>;
596
+ /** Master switch do binding. `dry_run` força TODAS as regras do binding a
597
+ * modo seco (kill switch). Default runtime quando ausente: `live`. */
598
+ export declare const zHubiaRulesModeSchema: z.ZodEnum<["live", "dry_run"]>;
599
+ /** Uma regra completa. Mora em `binding.rules[]`. Avaliada pelo motor
600
+ * `evo-hubia-rules`. Reusa ToolRegistry para executar actions, herdando
601
+ * as policies já existentes (mode, requiresLinkedLead, etc.). */
602
+ export declare const zHubiaRuleSchema: z.ZodObject<{
603
+ /** Identificador estável (auditoria, idempotência). */
604
+ id: z.ZodString;
605
+ /** Nome legível ("Paciente existente → Clínica"). */
606
+ name: z.ZodString;
607
+ active: z.ZodDefault<z.ZodBoolean>;
608
+ /** Menor avalia primeiro (first-match). */
609
+ priority: z.ZodDefault<z.ZodNumber>;
610
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
611
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
612
+ scope: z.ZodOptional<z.ZodObject<{
613
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
614
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
615
+ }, "strip", z.ZodTypeAny, {
616
+ provider?: "chatbee" | "hub-waba" | undefined;
617
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
618
+ }, {
619
+ provider?: "chatbee" | "hub-waba" | undefined;
620
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
621
+ }>>;
622
+ conditions: z.ZodEffects<z.ZodObject<{
623
+ all: z.ZodOptional<z.ZodArray<z.ZodObject<{
624
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
625
+ fact: z.ZodString;
626
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
627
+ value: z.ZodOptional<z.ZodUnknown>;
628
+ }, "strip", z.ZodTypeAny, {
629
+ fact: string;
630
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
631
+ value?: unknown;
632
+ }, {
633
+ fact: string;
634
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
635
+ value?: unknown;
636
+ }>, "many">>;
637
+ any: z.ZodOptional<z.ZodArray<z.ZodObject<{
638
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
639
+ fact: z.ZodString;
640
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
641
+ value: z.ZodOptional<z.ZodUnknown>;
642
+ }, "strip", z.ZodTypeAny, {
643
+ fact: string;
644
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
645
+ value?: unknown;
646
+ }, {
647
+ fact: string;
648
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
649
+ value?: unknown;
650
+ }>, "many">>;
651
+ }, "strip", z.ZodTypeAny, {
652
+ all?: {
653
+ fact: string;
654
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
655
+ value?: unknown;
656
+ }[] | undefined;
657
+ any?: {
658
+ fact: string;
659
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
660
+ value?: unknown;
661
+ }[] | undefined;
662
+ }, {
663
+ all?: {
664
+ fact: string;
665
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
666
+ value?: unknown;
667
+ }[] | undefined;
668
+ any?: {
669
+ fact: string;
670
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
671
+ value?: unknown;
672
+ }[] | undefined;
673
+ }>, {
674
+ all?: {
675
+ fact: string;
676
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
677
+ value?: unknown;
678
+ }[] | undefined;
679
+ any?: {
680
+ fact: string;
681
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
682
+ value?: unknown;
683
+ }[] | undefined;
684
+ }, {
685
+ all?: {
686
+ fact: string;
687
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
688
+ value?: unknown;
689
+ }[] | undefined;
690
+ any?: {
691
+ fact: string;
692
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
693
+ value?: unknown;
694
+ }[] | undefined;
695
+ }>;
696
+ actions: z.ZodArray<z.ZodObject<{
697
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
698
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
699
+ tool: z.ZodString;
700
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
701
+ }, "strip", z.ZodTypeAny, {
702
+ input: Record<string, unknown>;
703
+ tool: string;
704
+ }, {
705
+ tool: string;
706
+ input?: Record<string, unknown> | undefined;
707
+ }>, "many">;
708
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
709
+ /** Shadow mode por regra (característica permanente, não só de rollout):
710
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
711
+ * regras novas convivendo com regras live no mesmo binding.
712
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
713
+ dry_run: z.ZodDefault<z.ZodBoolean>;
714
+ /** Aborta sequência de ações no primeiro erro. */
715
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
716
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
717
+ /** Identificador estável (auditoria, idempotência). */
718
+ id: z.ZodString;
719
+ /** Nome legível ("Paciente existente → Clínica"). */
720
+ name: z.ZodString;
721
+ active: z.ZodDefault<z.ZodBoolean>;
722
+ /** Menor avalia primeiro (first-match). */
723
+ priority: z.ZodDefault<z.ZodNumber>;
724
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
725
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
726
+ scope: z.ZodOptional<z.ZodObject<{
727
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
728
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
729
+ }, "strip", z.ZodTypeAny, {
730
+ provider?: "chatbee" | "hub-waba" | undefined;
731
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
732
+ }, {
733
+ provider?: "chatbee" | "hub-waba" | undefined;
734
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
735
+ }>>;
736
+ conditions: z.ZodEffects<z.ZodObject<{
737
+ all: z.ZodOptional<z.ZodArray<z.ZodObject<{
738
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
739
+ fact: z.ZodString;
740
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
741
+ value: z.ZodOptional<z.ZodUnknown>;
742
+ }, "strip", z.ZodTypeAny, {
743
+ fact: string;
744
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
745
+ value?: unknown;
746
+ }, {
747
+ fact: string;
748
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
749
+ value?: unknown;
750
+ }>, "many">>;
751
+ any: z.ZodOptional<z.ZodArray<z.ZodObject<{
752
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
753
+ fact: z.ZodString;
754
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
755
+ value: z.ZodOptional<z.ZodUnknown>;
756
+ }, "strip", z.ZodTypeAny, {
757
+ fact: string;
758
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
759
+ value?: unknown;
760
+ }, {
761
+ fact: string;
762
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
763
+ value?: unknown;
764
+ }>, "many">>;
765
+ }, "strip", z.ZodTypeAny, {
766
+ all?: {
767
+ fact: string;
768
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
769
+ value?: unknown;
770
+ }[] | undefined;
771
+ any?: {
772
+ fact: string;
773
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
774
+ value?: unknown;
775
+ }[] | undefined;
776
+ }, {
777
+ all?: {
778
+ fact: string;
779
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
780
+ value?: unknown;
781
+ }[] | undefined;
782
+ any?: {
783
+ fact: string;
784
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
785
+ value?: unknown;
786
+ }[] | undefined;
787
+ }>, {
788
+ all?: {
789
+ fact: string;
790
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
791
+ value?: unknown;
792
+ }[] | undefined;
793
+ any?: {
794
+ fact: string;
795
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
796
+ value?: unknown;
797
+ }[] | undefined;
798
+ }, {
799
+ all?: {
800
+ fact: string;
801
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
802
+ value?: unknown;
803
+ }[] | undefined;
804
+ any?: {
805
+ fact: string;
806
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
807
+ value?: unknown;
808
+ }[] | undefined;
809
+ }>;
810
+ actions: z.ZodArray<z.ZodObject<{
811
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
812
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
813
+ tool: z.ZodString;
814
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
815
+ }, "strip", z.ZodTypeAny, {
816
+ input: Record<string, unknown>;
817
+ tool: string;
818
+ }, {
819
+ tool: string;
820
+ input?: Record<string, unknown> | undefined;
821
+ }>, "many">;
822
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
823
+ /** Shadow mode por regra (característica permanente, não só de rollout):
824
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
825
+ * regras novas convivendo com regras live no mesmo binding.
826
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
827
+ dry_run: z.ZodDefault<z.ZodBoolean>;
828
+ /** Aborta sequência de ações no primeiro erro. */
829
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
830
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
831
+ /** Identificador estável (auditoria, idempotência). */
832
+ id: z.ZodString;
833
+ /** Nome legível ("Paciente existente → Clínica"). */
834
+ name: z.ZodString;
835
+ active: z.ZodDefault<z.ZodBoolean>;
836
+ /** Menor avalia primeiro (first-match). */
837
+ priority: z.ZodDefault<z.ZodNumber>;
838
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
839
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
840
+ scope: z.ZodOptional<z.ZodObject<{
841
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
842
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
843
+ }, "strip", z.ZodTypeAny, {
844
+ provider?: "chatbee" | "hub-waba" | undefined;
845
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
846
+ }, {
847
+ provider?: "chatbee" | "hub-waba" | undefined;
848
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
849
+ }>>;
850
+ conditions: z.ZodEffects<z.ZodObject<{
851
+ all: z.ZodOptional<z.ZodArray<z.ZodObject<{
852
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
853
+ fact: z.ZodString;
854
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
855
+ value: z.ZodOptional<z.ZodUnknown>;
856
+ }, "strip", z.ZodTypeAny, {
857
+ fact: string;
858
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
859
+ value?: unknown;
860
+ }, {
861
+ fact: string;
862
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
863
+ value?: unknown;
864
+ }>, "many">>;
865
+ any: z.ZodOptional<z.ZodArray<z.ZodObject<{
866
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
867
+ fact: z.ZodString;
868
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
869
+ value: z.ZodOptional<z.ZodUnknown>;
870
+ }, "strip", z.ZodTypeAny, {
871
+ fact: string;
872
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
873
+ value?: unknown;
874
+ }, {
875
+ fact: string;
876
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
877
+ value?: unknown;
878
+ }>, "many">>;
879
+ }, "strip", z.ZodTypeAny, {
880
+ all?: {
881
+ fact: string;
882
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
883
+ value?: unknown;
884
+ }[] | undefined;
885
+ any?: {
886
+ fact: string;
887
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
888
+ value?: unknown;
889
+ }[] | undefined;
890
+ }, {
891
+ all?: {
892
+ fact: string;
893
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
894
+ value?: unknown;
895
+ }[] | undefined;
896
+ any?: {
897
+ fact: string;
898
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
899
+ value?: unknown;
900
+ }[] | undefined;
901
+ }>, {
902
+ all?: {
903
+ fact: string;
904
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
905
+ value?: unknown;
906
+ }[] | undefined;
907
+ any?: {
908
+ fact: string;
909
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
910
+ value?: unknown;
911
+ }[] | undefined;
912
+ }, {
913
+ all?: {
914
+ fact: string;
915
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
916
+ value?: unknown;
917
+ }[] | undefined;
918
+ any?: {
919
+ fact: string;
920
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
921
+ value?: unknown;
922
+ }[] | undefined;
923
+ }>;
924
+ actions: z.ZodArray<z.ZodObject<{
925
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
926
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
927
+ tool: z.ZodString;
928
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
929
+ }, "strip", z.ZodTypeAny, {
930
+ input: Record<string, unknown>;
931
+ tool: string;
932
+ }, {
933
+ tool: string;
934
+ input?: Record<string, unknown> | undefined;
935
+ }>, "many">;
936
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
937
+ /** Shadow mode por regra (característica permanente, não só de rollout):
938
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
939
+ * regras novas convivendo com regras live no mesmo binding.
940
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
941
+ dry_run: z.ZodDefault<z.ZodBoolean>;
942
+ /** Aborta sequência de ações no primeiro erro. */
943
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
944
+ }, z.ZodTypeAny, "passthrough">>;
472
945
  export declare const zAiBindingSchema: z.ZodObject<{
473
946
  id: z.ZodString;
474
947
  ref: z.ZodAny;
@@ -525,6 +998,355 @@ export declare const zAiBindingSchema: z.ZodObject<{
525
998
  routing?: string | undefined;
526
999
  tool_usage?: string | undefined;
527
1000
  }>>;
1001
+ /** Camada de regras determinísticas avaliada antes do LLM (e, no futuro,
1002
+ * também depois). Ausente/vazio = camada off, comportamento atual (só LLM). */
1003
+ rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
1004
+ /** Identificador estável (auditoria, idempotência). */
1005
+ id: z.ZodString;
1006
+ /** Nome legível ("Paciente existente → Clínica"). */
1007
+ name: z.ZodString;
1008
+ active: z.ZodDefault<z.ZodBoolean>;
1009
+ /** Menor avalia primeiro (first-match). */
1010
+ priority: z.ZodDefault<z.ZodNumber>;
1011
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
1012
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
1013
+ scope: z.ZodOptional<z.ZodObject<{
1014
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
1015
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
1016
+ }, "strip", z.ZodTypeAny, {
1017
+ provider?: "chatbee" | "hub-waba" | undefined;
1018
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1019
+ }, {
1020
+ provider?: "chatbee" | "hub-waba" | undefined;
1021
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1022
+ }>>;
1023
+ conditions: z.ZodEffects<z.ZodObject<{
1024
+ all: z.ZodOptional<z.ZodArray<z.ZodObject<{
1025
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1026
+ fact: z.ZodString;
1027
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1028
+ value: z.ZodOptional<z.ZodUnknown>;
1029
+ }, "strip", z.ZodTypeAny, {
1030
+ fact: string;
1031
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1032
+ value?: unknown;
1033
+ }, {
1034
+ fact: string;
1035
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1036
+ value?: unknown;
1037
+ }>, "many">>;
1038
+ any: z.ZodOptional<z.ZodArray<z.ZodObject<{
1039
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1040
+ fact: z.ZodString;
1041
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1042
+ value: z.ZodOptional<z.ZodUnknown>;
1043
+ }, "strip", z.ZodTypeAny, {
1044
+ fact: string;
1045
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1046
+ value?: unknown;
1047
+ }, {
1048
+ fact: string;
1049
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1050
+ value?: unknown;
1051
+ }>, "many">>;
1052
+ }, "strip", z.ZodTypeAny, {
1053
+ all?: {
1054
+ fact: string;
1055
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1056
+ value?: unknown;
1057
+ }[] | undefined;
1058
+ any?: {
1059
+ fact: string;
1060
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1061
+ value?: unknown;
1062
+ }[] | undefined;
1063
+ }, {
1064
+ all?: {
1065
+ fact: string;
1066
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1067
+ value?: unknown;
1068
+ }[] | undefined;
1069
+ any?: {
1070
+ fact: string;
1071
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1072
+ value?: unknown;
1073
+ }[] | undefined;
1074
+ }>, {
1075
+ all?: {
1076
+ fact: string;
1077
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1078
+ value?: unknown;
1079
+ }[] | undefined;
1080
+ any?: {
1081
+ fact: string;
1082
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1083
+ value?: unknown;
1084
+ }[] | undefined;
1085
+ }, {
1086
+ all?: {
1087
+ fact: string;
1088
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1089
+ value?: unknown;
1090
+ }[] | undefined;
1091
+ any?: {
1092
+ fact: string;
1093
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1094
+ value?: unknown;
1095
+ }[] | undefined;
1096
+ }>;
1097
+ actions: z.ZodArray<z.ZodObject<{
1098
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
1099
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
1100
+ tool: z.ZodString;
1101
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1102
+ }, "strip", z.ZodTypeAny, {
1103
+ input: Record<string, unknown>;
1104
+ tool: string;
1105
+ }, {
1106
+ tool: string;
1107
+ input?: Record<string, unknown> | undefined;
1108
+ }>, "many">;
1109
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
1110
+ /** Shadow mode por regra (característica permanente, não só de rollout):
1111
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
1112
+ * regras novas convivendo com regras live no mesmo binding.
1113
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
1114
+ dry_run: z.ZodDefault<z.ZodBoolean>;
1115
+ /** Aborta sequência de ações no primeiro erro. */
1116
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1117
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1118
+ /** Identificador estável (auditoria, idempotência). */
1119
+ id: z.ZodString;
1120
+ /** Nome legível ("Paciente existente → Clínica"). */
1121
+ name: z.ZodString;
1122
+ active: z.ZodDefault<z.ZodBoolean>;
1123
+ /** Menor avalia primeiro (first-match). */
1124
+ priority: z.ZodDefault<z.ZodNumber>;
1125
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
1126
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
1127
+ scope: z.ZodOptional<z.ZodObject<{
1128
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
1129
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
1130
+ }, "strip", z.ZodTypeAny, {
1131
+ provider?: "chatbee" | "hub-waba" | undefined;
1132
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1133
+ }, {
1134
+ provider?: "chatbee" | "hub-waba" | undefined;
1135
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1136
+ }>>;
1137
+ conditions: z.ZodEffects<z.ZodObject<{
1138
+ all: z.ZodOptional<z.ZodArray<z.ZodObject<{
1139
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1140
+ fact: z.ZodString;
1141
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1142
+ value: z.ZodOptional<z.ZodUnknown>;
1143
+ }, "strip", z.ZodTypeAny, {
1144
+ fact: string;
1145
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1146
+ value?: unknown;
1147
+ }, {
1148
+ fact: string;
1149
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1150
+ value?: unknown;
1151
+ }>, "many">>;
1152
+ any: z.ZodOptional<z.ZodArray<z.ZodObject<{
1153
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1154
+ fact: z.ZodString;
1155
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1156
+ value: z.ZodOptional<z.ZodUnknown>;
1157
+ }, "strip", z.ZodTypeAny, {
1158
+ fact: string;
1159
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1160
+ value?: unknown;
1161
+ }, {
1162
+ fact: string;
1163
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1164
+ value?: unknown;
1165
+ }>, "many">>;
1166
+ }, "strip", z.ZodTypeAny, {
1167
+ all?: {
1168
+ fact: string;
1169
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1170
+ value?: unknown;
1171
+ }[] | undefined;
1172
+ any?: {
1173
+ fact: string;
1174
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1175
+ value?: unknown;
1176
+ }[] | undefined;
1177
+ }, {
1178
+ all?: {
1179
+ fact: string;
1180
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1181
+ value?: unknown;
1182
+ }[] | undefined;
1183
+ any?: {
1184
+ fact: string;
1185
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1186
+ value?: unknown;
1187
+ }[] | undefined;
1188
+ }>, {
1189
+ all?: {
1190
+ fact: string;
1191
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1192
+ value?: unknown;
1193
+ }[] | undefined;
1194
+ any?: {
1195
+ fact: string;
1196
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1197
+ value?: unknown;
1198
+ }[] | undefined;
1199
+ }, {
1200
+ all?: {
1201
+ fact: string;
1202
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1203
+ value?: unknown;
1204
+ }[] | undefined;
1205
+ any?: {
1206
+ fact: string;
1207
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1208
+ value?: unknown;
1209
+ }[] | undefined;
1210
+ }>;
1211
+ actions: z.ZodArray<z.ZodObject<{
1212
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
1213
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
1214
+ tool: z.ZodString;
1215
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1216
+ }, "strip", z.ZodTypeAny, {
1217
+ input: Record<string, unknown>;
1218
+ tool: string;
1219
+ }, {
1220
+ tool: string;
1221
+ input?: Record<string, unknown> | undefined;
1222
+ }>, "many">;
1223
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
1224
+ /** Shadow mode por regra (característica permanente, não só de rollout):
1225
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
1226
+ * regras novas convivendo com regras live no mesmo binding.
1227
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
1228
+ dry_run: z.ZodDefault<z.ZodBoolean>;
1229
+ /** Aborta sequência de ações no primeiro erro. */
1230
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1231
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1232
+ /** Identificador estável (auditoria, idempotência). */
1233
+ id: z.ZodString;
1234
+ /** Nome legível ("Paciente existente → Clínica"). */
1235
+ name: z.ZodString;
1236
+ active: z.ZodDefault<z.ZodBoolean>;
1237
+ /** Menor avalia primeiro (first-match). */
1238
+ priority: z.ZodDefault<z.ZodNumber>;
1239
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
1240
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
1241
+ scope: z.ZodOptional<z.ZodObject<{
1242
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
1243
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
1244
+ }, "strip", z.ZodTypeAny, {
1245
+ provider?: "chatbee" | "hub-waba" | undefined;
1246
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1247
+ }, {
1248
+ provider?: "chatbee" | "hub-waba" | undefined;
1249
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1250
+ }>>;
1251
+ conditions: z.ZodEffects<z.ZodObject<{
1252
+ all: z.ZodOptional<z.ZodArray<z.ZodObject<{
1253
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1254
+ fact: z.ZodString;
1255
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1256
+ value: z.ZodOptional<z.ZodUnknown>;
1257
+ }, "strip", z.ZodTypeAny, {
1258
+ fact: string;
1259
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1260
+ value?: unknown;
1261
+ }, {
1262
+ fact: string;
1263
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1264
+ value?: unknown;
1265
+ }>, "many">>;
1266
+ any: z.ZodOptional<z.ZodArray<z.ZodObject<{
1267
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1268
+ fact: z.ZodString;
1269
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1270
+ value: z.ZodOptional<z.ZodUnknown>;
1271
+ }, "strip", z.ZodTypeAny, {
1272
+ fact: string;
1273
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1274
+ value?: unknown;
1275
+ }, {
1276
+ fact: string;
1277
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1278
+ value?: unknown;
1279
+ }>, "many">>;
1280
+ }, "strip", z.ZodTypeAny, {
1281
+ all?: {
1282
+ fact: string;
1283
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1284
+ value?: unknown;
1285
+ }[] | undefined;
1286
+ any?: {
1287
+ fact: string;
1288
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1289
+ value?: unknown;
1290
+ }[] | undefined;
1291
+ }, {
1292
+ all?: {
1293
+ fact: string;
1294
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1295
+ value?: unknown;
1296
+ }[] | undefined;
1297
+ any?: {
1298
+ fact: string;
1299
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1300
+ value?: unknown;
1301
+ }[] | undefined;
1302
+ }>, {
1303
+ all?: {
1304
+ fact: string;
1305
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1306
+ value?: unknown;
1307
+ }[] | undefined;
1308
+ any?: {
1309
+ fact: string;
1310
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1311
+ value?: unknown;
1312
+ }[] | undefined;
1313
+ }, {
1314
+ all?: {
1315
+ fact: string;
1316
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1317
+ value?: unknown;
1318
+ }[] | undefined;
1319
+ any?: {
1320
+ fact: string;
1321
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1322
+ value?: unknown;
1323
+ }[] | undefined;
1324
+ }>;
1325
+ actions: z.ZodArray<z.ZodObject<{
1326
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
1327
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
1328
+ tool: z.ZodString;
1329
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1330
+ }, "strip", z.ZodTypeAny, {
1331
+ input: Record<string, unknown>;
1332
+ tool: string;
1333
+ }, {
1334
+ tool: string;
1335
+ input?: Record<string, unknown> | undefined;
1336
+ }>, "many">;
1337
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
1338
+ /** Shadow mode por regra (característica permanente, não só de rollout):
1339
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
1340
+ * regras novas convivendo com regras live no mesmo binding.
1341
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
1342
+ dry_run: z.ZodDefault<z.ZodBoolean>;
1343
+ /** Aborta sequência de ações no primeiro erro. */
1344
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1345
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
1346
+ /** Master switch do binding para a camada de regras.
1347
+ * `dry_run` força todas as regras deste binding a modo seco (sem executar
1348
+ * actions; apenas avalia e grava trace). Default runtime quando ausente: `live`. */
1349
+ rules_mode: z.ZodOptional<z.ZodEnum<["live", "dry_run"]>>;
528
1350
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
529
1351
  id: z.ZodString;
530
1352
  ref: z.ZodAny;
@@ -581,6 +1403,355 @@ export declare const zAiBindingSchema: z.ZodObject<{
581
1403
  routing?: string | undefined;
582
1404
  tool_usage?: string | undefined;
583
1405
  }>>;
1406
+ /** Camada de regras determinísticas avaliada antes do LLM (e, no futuro,
1407
+ * também depois). Ausente/vazio = camada off, comportamento atual (só LLM). */
1408
+ rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
1409
+ /** Identificador estável (auditoria, idempotência). */
1410
+ id: z.ZodString;
1411
+ /** Nome legível ("Paciente existente → Clínica"). */
1412
+ name: z.ZodString;
1413
+ active: z.ZodDefault<z.ZodBoolean>;
1414
+ /** Menor avalia primeiro (first-match). */
1415
+ priority: z.ZodDefault<z.ZodNumber>;
1416
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
1417
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
1418
+ scope: z.ZodOptional<z.ZodObject<{
1419
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
1420
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
1421
+ }, "strip", z.ZodTypeAny, {
1422
+ provider?: "chatbee" | "hub-waba" | undefined;
1423
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1424
+ }, {
1425
+ provider?: "chatbee" | "hub-waba" | undefined;
1426
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1427
+ }>>;
1428
+ conditions: z.ZodEffects<z.ZodObject<{
1429
+ all: z.ZodOptional<z.ZodArray<z.ZodObject<{
1430
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1431
+ fact: z.ZodString;
1432
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1433
+ value: z.ZodOptional<z.ZodUnknown>;
1434
+ }, "strip", z.ZodTypeAny, {
1435
+ fact: string;
1436
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1437
+ value?: unknown;
1438
+ }, {
1439
+ fact: string;
1440
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1441
+ value?: unknown;
1442
+ }>, "many">>;
1443
+ any: z.ZodOptional<z.ZodArray<z.ZodObject<{
1444
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1445
+ fact: z.ZodString;
1446
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1447
+ value: z.ZodOptional<z.ZodUnknown>;
1448
+ }, "strip", z.ZodTypeAny, {
1449
+ fact: string;
1450
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1451
+ value?: unknown;
1452
+ }, {
1453
+ fact: string;
1454
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1455
+ value?: unknown;
1456
+ }>, "many">>;
1457
+ }, "strip", z.ZodTypeAny, {
1458
+ all?: {
1459
+ fact: string;
1460
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1461
+ value?: unknown;
1462
+ }[] | undefined;
1463
+ any?: {
1464
+ fact: string;
1465
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1466
+ value?: unknown;
1467
+ }[] | undefined;
1468
+ }, {
1469
+ all?: {
1470
+ fact: string;
1471
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1472
+ value?: unknown;
1473
+ }[] | undefined;
1474
+ any?: {
1475
+ fact: string;
1476
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1477
+ value?: unknown;
1478
+ }[] | undefined;
1479
+ }>, {
1480
+ all?: {
1481
+ fact: string;
1482
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1483
+ value?: unknown;
1484
+ }[] | undefined;
1485
+ any?: {
1486
+ fact: string;
1487
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1488
+ value?: unknown;
1489
+ }[] | undefined;
1490
+ }, {
1491
+ all?: {
1492
+ fact: string;
1493
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1494
+ value?: unknown;
1495
+ }[] | undefined;
1496
+ any?: {
1497
+ fact: string;
1498
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1499
+ value?: unknown;
1500
+ }[] | undefined;
1501
+ }>;
1502
+ actions: z.ZodArray<z.ZodObject<{
1503
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
1504
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
1505
+ tool: z.ZodString;
1506
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1507
+ }, "strip", z.ZodTypeAny, {
1508
+ input: Record<string, unknown>;
1509
+ tool: string;
1510
+ }, {
1511
+ tool: string;
1512
+ input?: Record<string, unknown> | undefined;
1513
+ }>, "many">;
1514
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
1515
+ /** Shadow mode por regra (característica permanente, não só de rollout):
1516
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
1517
+ * regras novas convivendo com regras live no mesmo binding.
1518
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
1519
+ dry_run: z.ZodDefault<z.ZodBoolean>;
1520
+ /** Aborta sequência de ações no primeiro erro. */
1521
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1522
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1523
+ /** Identificador estável (auditoria, idempotência). */
1524
+ id: z.ZodString;
1525
+ /** Nome legível ("Paciente existente → Clínica"). */
1526
+ name: z.ZodString;
1527
+ active: z.ZodDefault<z.ZodBoolean>;
1528
+ /** Menor avalia primeiro (first-match). */
1529
+ priority: z.ZodDefault<z.ZodNumber>;
1530
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
1531
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
1532
+ scope: z.ZodOptional<z.ZodObject<{
1533
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
1534
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
1535
+ }, "strip", z.ZodTypeAny, {
1536
+ provider?: "chatbee" | "hub-waba" | undefined;
1537
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1538
+ }, {
1539
+ provider?: "chatbee" | "hub-waba" | undefined;
1540
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1541
+ }>>;
1542
+ conditions: z.ZodEffects<z.ZodObject<{
1543
+ all: z.ZodOptional<z.ZodArray<z.ZodObject<{
1544
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1545
+ fact: z.ZodString;
1546
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1547
+ value: z.ZodOptional<z.ZodUnknown>;
1548
+ }, "strip", z.ZodTypeAny, {
1549
+ fact: string;
1550
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1551
+ value?: unknown;
1552
+ }, {
1553
+ fact: string;
1554
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1555
+ value?: unknown;
1556
+ }>, "many">>;
1557
+ any: z.ZodOptional<z.ZodArray<z.ZodObject<{
1558
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1559
+ fact: z.ZodString;
1560
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1561
+ value: z.ZodOptional<z.ZodUnknown>;
1562
+ }, "strip", z.ZodTypeAny, {
1563
+ fact: string;
1564
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1565
+ value?: unknown;
1566
+ }, {
1567
+ fact: string;
1568
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1569
+ value?: unknown;
1570
+ }>, "many">>;
1571
+ }, "strip", z.ZodTypeAny, {
1572
+ all?: {
1573
+ fact: string;
1574
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1575
+ value?: unknown;
1576
+ }[] | undefined;
1577
+ any?: {
1578
+ fact: string;
1579
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1580
+ value?: unknown;
1581
+ }[] | undefined;
1582
+ }, {
1583
+ all?: {
1584
+ fact: string;
1585
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1586
+ value?: unknown;
1587
+ }[] | undefined;
1588
+ any?: {
1589
+ fact: string;
1590
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1591
+ value?: unknown;
1592
+ }[] | undefined;
1593
+ }>, {
1594
+ all?: {
1595
+ fact: string;
1596
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1597
+ value?: unknown;
1598
+ }[] | undefined;
1599
+ any?: {
1600
+ fact: string;
1601
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1602
+ value?: unknown;
1603
+ }[] | undefined;
1604
+ }, {
1605
+ all?: {
1606
+ fact: string;
1607
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1608
+ value?: unknown;
1609
+ }[] | undefined;
1610
+ any?: {
1611
+ fact: string;
1612
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1613
+ value?: unknown;
1614
+ }[] | undefined;
1615
+ }>;
1616
+ actions: z.ZodArray<z.ZodObject<{
1617
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
1618
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
1619
+ tool: z.ZodString;
1620
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1621
+ }, "strip", z.ZodTypeAny, {
1622
+ input: Record<string, unknown>;
1623
+ tool: string;
1624
+ }, {
1625
+ tool: string;
1626
+ input?: Record<string, unknown> | undefined;
1627
+ }>, "many">;
1628
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
1629
+ /** Shadow mode por regra (característica permanente, não só de rollout):
1630
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
1631
+ * regras novas convivendo com regras live no mesmo binding.
1632
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
1633
+ dry_run: z.ZodDefault<z.ZodBoolean>;
1634
+ /** Aborta sequência de ações no primeiro erro. */
1635
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1636
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1637
+ /** Identificador estável (auditoria, idempotência). */
1638
+ id: z.ZodString;
1639
+ /** Nome legível ("Paciente existente → Clínica"). */
1640
+ name: z.ZodString;
1641
+ active: z.ZodDefault<z.ZodBoolean>;
1642
+ /** Menor avalia primeiro (first-match). */
1643
+ priority: z.ZodDefault<z.ZodNumber>;
1644
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
1645
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
1646
+ scope: z.ZodOptional<z.ZodObject<{
1647
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
1648
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
1649
+ }, "strip", z.ZodTypeAny, {
1650
+ provider?: "chatbee" | "hub-waba" | undefined;
1651
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1652
+ }, {
1653
+ provider?: "chatbee" | "hub-waba" | undefined;
1654
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1655
+ }>>;
1656
+ conditions: z.ZodEffects<z.ZodObject<{
1657
+ all: z.ZodOptional<z.ZodArray<z.ZodObject<{
1658
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1659
+ fact: z.ZodString;
1660
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1661
+ value: z.ZodOptional<z.ZodUnknown>;
1662
+ }, "strip", z.ZodTypeAny, {
1663
+ fact: string;
1664
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1665
+ value?: unknown;
1666
+ }, {
1667
+ fact: string;
1668
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1669
+ value?: unknown;
1670
+ }>, "many">>;
1671
+ any: z.ZodOptional<z.ZodArray<z.ZodObject<{
1672
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1673
+ fact: z.ZodString;
1674
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1675
+ value: z.ZodOptional<z.ZodUnknown>;
1676
+ }, "strip", z.ZodTypeAny, {
1677
+ fact: string;
1678
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1679
+ value?: unknown;
1680
+ }, {
1681
+ fact: string;
1682
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1683
+ value?: unknown;
1684
+ }>, "many">>;
1685
+ }, "strip", z.ZodTypeAny, {
1686
+ all?: {
1687
+ fact: string;
1688
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1689
+ value?: unknown;
1690
+ }[] | undefined;
1691
+ any?: {
1692
+ fact: string;
1693
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1694
+ value?: unknown;
1695
+ }[] | undefined;
1696
+ }, {
1697
+ all?: {
1698
+ fact: string;
1699
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1700
+ value?: unknown;
1701
+ }[] | undefined;
1702
+ any?: {
1703
+ fact: string;
1704
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1705
+ value?: unknown;
1706
+ }[] | undefined;
1707
+ }>, {
1708
+ all?: {
1709
+ fact: string;
1710
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1711
+ value?: unknown;
1712
+ }[] | undefined;
1713
+ any?: {
1714
+ fact: string;
1715
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1716
+ value?: unknown;
1717
+ }[] | undefined;
1718
+ }, {
1719
+ all?: {
1720
+ fact: string;
1721
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1722
+ value?: unknown;
1723
+ }[] | undefined;
1724
+ any?: {
1725
+ fact: string;
1726
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1727
+ value?: unknown;
1728
+ }[] | undefined;
1729
+ }>;
1730
+ actions: z.ZodArray<z.ZodObject<{
1731
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
1732
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
1733
+ tool: z.ZodString;
1734
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1735
+ }, "strip", z.ZodTypeAny, {
1736
+ input: Record<string, unknown>;
1737
+ tool: string;
1738
+ }, {
1739
+ tool: string;
1740
+ input?: Record<string, unknown> | undefined;
1741
+ }>, "many">;
1742
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
1743
+ /** Shadow mode por regra (característica permanente, não só de rollout):
1744
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
1745
+ * regras novas convivendo com regras live no mesmo binding.
1746
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
1747
+ dry_run: z.ZodDefault<z.ZodBoolean>;
1748
+ /** Aborta sequência de ações no primeiro erro. */
1749
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1750
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
1751
+ /** Master switch do binding para a camada de regras.
1752
+ * `dry_run` força todas as regras deste binding a modo seco (sem executar
1753
+ * actions; apenas avalia e grava trace). Default runtime quando ausente: `live`. */
1754
+ rules_mode: z.ZodOptional<z.ZodEnum<["live", "dry_run"]>>;
584
1755
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
585
1756
  id: z.ZodString;
586
1757
  ref: z.ZodAny;
@@ -637,5 +1808,354 @@ export declare const zAiBindingSchema: z.ZodObject<{
637
1808
  routing?: string | undefined;
638
1809
  tool_usage?: string | undefined;
639
1810
  }>>;
1811
+ /** Camada de regras determinísticas avaliada antes do LLM (e, no futuro,
1812
+ * também depois). Ausente/vazio = camada off, comportamento atual (só LLM). */
1813
+ rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
1814
+ /** Identificador estável (auditoria, idempotência). */
1815
+ id: z.ZodString;
1816
+ /** Nome legível ("Paciente existente → Clínica"). */
1817
+ name: z.ZodString;
1818
+ active: z.ZodDefault<z.ZodBoolean>;
1819
+ /** Menor avalia primeiro (first-match). */
1820
+ priority: z.ZodDefault<z.ZodNumber>;
1821
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
1822
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
1823
+ scope: z.ZodOptional<z.ZodObject<{
1824
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
1825
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
1826
+ }, "strip", z.ZodTypeAny, {
1827
+ provider?: "chatbee" | "hub-waba" | undefined;
1828
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1829
+ }, {
1830
+ provider?: "chatbee" | "hub-waba" | undefined;
1831
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1832
+ }>>;
1833
+ conditions: z.ZodEffects<z.ZodObject<{
1834
+ all: z.ZodOptional<z.ZodArray<z.ZodObject<{
1835
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1836
+ fact: z.ZodString;
1837
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1838
+ value: z.ZodOptional<z.ZodUnknown>;
1839
+ }, "strip", z.ZodTypeAny, {
1840
+ fact: string;
1841
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1842
+ value?: unknown;
1843
+ }, {
1844
+ fact: string;
1845
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1846
+ value?: unknown;
1847
+ }>, "many">>;
1848
+ any: z.ZodOptional<z.ZodArray<z.ZodObject<{
1849
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1850
+ fact: z.ZodString;
1851
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1852
+ value: z.ZodOptional<z.ZodUnknown>;
1853
+ }, "strip", z.ZodTypeAny, {
1854
+ fact: string;
1855
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1856
+ value?: unknown;
1857
+ }, {
1858
+ fact: string;
1859
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1860
+ value?: unknown;
1861
+ }>, "many">>;
1862
+ }, "strip", z.ZodTypeAny, {
1863
+ all?: {
1864
+ fact: string;
1865
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1866
+ value?: unknown;
1867
+ }[] | undefined;
1868
+ any?: {
1869
+ fact: string;
1870
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1871
+ value?: unknown;
1872
+ }[] | undefined;
1873
+ }, {
1874
+ all?: {
1875
+ fact: string;
1876
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1877
+ value?: unknown;
1878
+ }[] | undefined;
1879
+ any?: {
1880
+ fact: string;
1881
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1882
+ value?: unknown;
1883
+ }[] | undefined;
1884
+ }>, {
1885
+ all?: {
1886
+ fact: string;
1887
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1888
+ value?: unknown;
1889
+ }[] | undefined;
1890
+ any?: {
1891
+ fact: string;
1892
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1893
+ value?: unknown;
1894
+ }[] | undefined;
1895
+ }, {
1896
+ all?: {
1897
+ fact: string;
1898
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1899
+ value?: unknown;
1900
+ }[] | undefined;
1901
+ any?: {
1902
+ fact: string;
1903
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1904
+ value?: unknown;
1905
+ }[] | undefined;
1906
+ }>;
1907
+ actions: z.ZodArray<z.ZodObject<{
1908
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
1909
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
1910
+ tool: z.ZodString;
1911
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1912
+ }, "strip", z.ZodTypeAny, {
1913
+ input: Record<string, unknown>;
1914
+ tool: string;
1915
+ }, {
1916
+ tool: string;
1917
+ input?: Record<string, unknown> | undefined;
1918
+ }>, "many">;
1919
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
1920
+ /** Shadow mode por regra (característica permanente, não só de rollout):
1921
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
1922
+ * regras novas convivendo com regras live no mesmo binding.
1923
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
1924
+ dry_run: z.ZodDefault<z.ZodBoolean>;
1925
+ /** Aborta sequência de ações no primeiro erro. */
1926
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1927
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1928
+ /** Identificador estável (auditoria, idempotência). */
1929
+ id: z.ZodString;
1930
+ /** Nome legível ("Paciente existente → Clínica"). */
1931
+ name: z.ZodString;
1932
+ active: z.ZodDefault<z.ZodBoolean>;
1933
+ /** Menor avalia primeiro (first-match). */
1934
+ priority: z.ZodDefault<z.ZodNumber>;
1935
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
1936
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
1937
+ scope: z.ZodOptional<z.ZodObject<{
1938
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
1939
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
1940
+ }, "strip", z.ZodTypeAny, {
1941
+ provider?: "chatbee" | "hub-waba" | undefined;
1942
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1943
+ }, {
1944
+ provider?: "chatbee" | "hub-waba" | undefined;
1945
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1946
+ }>>;
1947
+ conditions: z.ZodEffects<z.ZodObject<{
1948
+ all: z.ZodOptional<z.ZodArray<z.ZodObject<{
1949
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1950
+ fact: z.ZodString;
1951
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1952
+ value: z.ZodOptional<z.ZodUnknown>;
1953
+ }, "strip", z.ZodTypeAny, {
1954
+ fact: string;
1955
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1956
+ value?: unknown;
1957
+ }, {
1958
+ fact: string;
1959
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1960
+ value?: unknown;
1961
+ }>, "many">>;
1962
+ any: z.ZodOptional<z.ZodArray<z.ZodObject<{
1963
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
1964
+ fact: z.ZodString;
1965
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
1966
+ value: z.ZodOptional<z.ZodUnknown>;
1967
+ }, "strip", z.ZodTypeAny, {
1968
+ fact: string;
1969
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1970
+ value?: unknown;
1971
+ }, {
1972
+ fact: string;
1973
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1974
+ value?: unknown;
1975
+ }>, "many">>;
1976
+ }, "strip", z.ZodTypeAny, {
1977
+ all?: {
1978
+ fact: string;
1979
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1980
+ value?: unknown;
1981
+ }[] | undefined;
1982
+ any?: {
1983
+ fact: string;
1984
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1985
+ value?: unknown;
1986
+ }[] | undefined;
1987
+ }, {
1988
+ all?: {
1989
+ fact: string;
1990
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1991
+ value?: unknown;
1992
+ }[] | undefined;
1993
+ any?: {
1994
+ fact: string;
1995
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
1996
+ value?: unknown;
1997
+ }[] | undefined;
1998
+ }>, {
1999
+ all?: {
2000
+ fact: string;
2001
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2002
+ value?: unknown;
2003
+ }[] | undefined;
2004
+ any?: {
2005
+ fact: string;
2006
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2007
+ value?: unknown;
2008
+ }[] | undefined;
2009
+ }, {
2010
+ all?: {
2011
+ fact: string;
2012
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2013
+ value?: unknown;
2014
+ }[] | undefined;
2015
+ any?: {
2016
+ fact: string;
2017
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2018
+ value?: unknown;
2019
+ }[] | undefined;
2020
+ }>;
2021
+ actions: z.ZodArray<z.ZodObject<{
2022
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
2023
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
2024
+ tool: z.ZodString;
2025
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2026
+ }, "strip", z.ZodTypeAny, {
2027
+ input: Record<string, unknown>;
2028
+ tool: string;
2029
+ }, {
2030
+ tool: string;
2031
+ input?: Record<string, unknown> | undefined;
2032
+ }>, "many">;
2033
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
2034
+ /** Shadow mode por regra (característica permanente, não só de rollout):
2035
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
2036
+ * regras novas convivendo com regras live no mesmo binding.
2037
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
2038
+ dry_run: z.ZodDefault<z.ZodBoolean>;
2039
+ /** Aborta sequência de ações no primeiro erro. */
2040
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
2041
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2042
+ /** Identificador estável (auditoria, idempotência). */
2043
+ id: z.ZodString;
2044
+ /** Nome legível ("Paciente existente → Clínica"). */
2045
+ name: z.ZodString;
2046
+ active: z.ZodDefault<z.ZodBoolean>;
2047
+ /** Menor avalia primeiro (first-match). */
2048
+ priority: z.ZodDefault<z.ZodNumber>;
2049
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
2050
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
2051
+ scope: z.ZodOptional<z.ZodObject<{
2052
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
2053
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
2054
+ }, "strip", z.ZodTypeAny, {
2055
+ provider?: "chatbee" | "hub-waba" | undefined;
2056
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
2057
+ }, {
2058
+ provider?: "chatbee" | "hub-waba" | undefined;
2059
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
2060
+ }>>;
2061
+ conditions: z.ZodEffects<z.ZodObject<{
2062
+ all: z.ZodOptional<z.ZodArray<z.ZodObject<{
2063
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
2064
+ fact: z.ZodString;
2065
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
2066
+ value: z.ZodOptional<z.ZodUnknown>;
2067
+ }, "strip", z.ZodTypeAny, {
2068
+ fact: string;
2069
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2070
+ value?: unknown;
2071
+ }, {
2072
+ fact: string;
2073
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2074
+ value?: unknown;
2075
+ }>, "many">>;
2076
+ any: z.ZodOptional<z.ZodArray<z.ZodObject<{
2077
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead"). */
2078
+ fact: z.ZodString;
2079
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte"]>;
2080
+ value: z.ZodOptional<z.ZodUnknown>;
2081
+ }, "strip", z.ZodTypeAny, {
2082
+ fact: string;
2083
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2084
+ value?: unknown;
2085
+ }, {
2086
+ fact: string;
2087
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2088
+ value?: unknown;
2089
+ }>, "many">>;
2090
+ }, "strip", z.ZodTypeAny, {
2091
+ all?: {
2092
+ fact: string;
2093
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2094
+ value?: unknown;
2095
+ }[] | undefined;
2096
+ any?: {
2097
+ fact: string;
2098
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2099
+ value?: unknown;
2100
+ }[] | undefined;
2101
+ }, {
2102
+ all?: {
2103
+ fact: string;
2104
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2105
+ value?: unknown;
2106
+ }[] | undefined;
2107
+ any?: {
2108
+ fact: string;
2109
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2110
+ value?: unknown;
2111
+ }[] | undefined;
2112
+ }>, {
2113
+ all?: {
2114
+ fact: string;
2115
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2116
+ value?: unknown;
2117
+ }[] | undefined;
2118
+ any?: {
2119
+ fact: string;
2120
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2121
+ value?: unknown;
2122
+ }[] | undefined;
2123
+ }, {
2124
+ all?: {
2125
+ fact: string;
2126
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2127
+ value?: unknown;
2128
+ }[] | undefined;
2129
+ any?: {
2130
+ fact: string;
2131
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte";
2132
+ value?: unknown;
2133
+ }[] | undefined;
2134
+ }>;
2135
+ actions: z.ZodArray<z.ZodObject<{
2136
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
2137
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
2138
+ tool: z.ZodString;
2139
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2140
+ }, "strip", z.ZodTypeAny, {
2141
+ input: Record<string, unknown>;
2142
+ tool: string;
2143
+ }, {
2144
+ tool: string;
2145
+ input?: Record<string, unknown> | undefined;
2146
+ }>, "many">;
2147
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
2148
+ /** Shadow mode por regra (característica permanente, não só de rollout):
2149
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
2150
+ * regras novas convivendo com regras live no mesmo binding.
2151
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
2152
+ dry_run: z.ZodDefault<z.ZodBoolean>;
2153
+ /** Aborta sequência de ações no primeiro erro. */
2154
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
2155
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
2156
+ /** Master switch do binding para a camada de regras.
2157
+ * `dry_run` força todas as regras deste binding a modo seco (sem executar
2158
+ * actions; apenas avalia e grava trace). Default runtime quando ausente: `live`. */
2159
+ rules_mode: z.ZodOptional<z.ZodEnum<["live", "dry_run"]>>;
640
2160
  }, z.ZodTypeAny, "passthrough">>;
641
2161
  export type IAiBinding = z.infer<typeof zAiBindingSchema>;