evo360-types 1.3.374 → 1.3.375

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 (28) hide show
  1. package/dist/apps/evo-hub-ia/v1/zod-schemas.d.ts +1191 -135
  2. package/dist/apps/evo-hub-ia/v1/zod-schemas.js +31 -4
  3. package/dist/apps/evo-hub-ia/v1/zod-schemas.ts +31 -4
  4. package/dist/types/evo-chat/call-session/index.d.ts +41 -0
  5. package/dist/types/evo-chat/call-session/index.js +2 -0
  6. package/dist/types/evo-chat/call-session/index.ts +81 -0
  7. package/dist/types/evo-chat/channel/index.d.ts +18 -0
  8. package/dist/types/evo-chat/channel/index.ts +20 -0
  9. package/dist/types/evo-chat/fb_collections.d.ts +1 -0
  10. package/dist/types/evo-chat/fb_collections.js +2 -1
  11. package/dist/types/evo-chat/fb_collections.ts +1 -0
  12. package/dist/types/evo-chat/index.d.ts +1 -0
  13. package/dist/types/evo-chat/index.js +1 -0
  14. package/dist/types/evo-chat/index.ts +1 -0
  15. package/dist/types/evo-chat/thread-message/index.d.ts +3 -1
  16. package/dist/types/evo-chat/thread-message/index.ts +6 -1
  17. package/dist/types/evo-finops/fb_collections.d.ts +1 -0
  18. package/dist/types/evo-finops/fb_collections.js +2 -1
  19. package/dist/types/evo-finops/fb_collections.ts +1 -0
  20. package/dist/types/evo-finops/payment-links/index.d.ts +12 -0
  21. package/dist/types/evo-finops/payment-links/index.js +12 -2
  22. package/dist/types/evo-finops/payment-links/index.ts +18 -1
  23. package/dist/types/evo-hub-ia/v1/index.d.ts +16 -7
  24. package/dist/types/evo-hub-ia/v1/index.js +1 -1
  25. package/dist/types/evo-hub-ia/v1/index.ts +17 -8
  26. package/dist/types/evo-med/appointment/index.d.ts +15 -0
  27. package/dist/types/evo-med/appointment/index.ts +16 -0
  28. package/package.json +1 -1
@@ -695,7 +695,7 @@ export declare const zHubiaRulesModeSchema: z.ZodEnum<["live", "dry_run"]>;
695
695
  /** Uma regra completa. Mora em `binding.rules[]`. Avaliada pelo motor
696
696
  * `evo-hubia-rules`. Reusa ToolRegistry para executar actions, herdando
697
697
  * as policies já existentes (mode, requiresLinkedLead, etc.). */
698
- export declare const zHubiaRuleSchema: z.ZodObject<{
698
+ export declare const zHubiaRuleSchema: z.ZodEffects<z.ZodObject<{
699
699
  /** Identificador estável (auditoria, idempotência). */
700
700
  id: z.ZodString;
701
701
  /** Nome legível ("Paciente existente → Clínica"). */
@@ -1091,6 +1091,270 @@ export declare const zHubiaRuleSchema: z.ZodObject<{
1091
1091
  dry_run: z.ZodDefault<z.ZodBoolean>;
1092
1092
  /** Aborta sequência de ações no primeiro erro. */
1093
1093
  stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1094
+ }, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
1095
+ /** Identificador estável (auditoria, idempotência). */
1096
+ id: z.ZodString;
1097
+ /** Nome legível ("Paciente existente → Clínica"). */
1098
+ name: z.ZodString;
1099
+ active: z.ZodDefault<z.ZodBoolean>;
1100
+ /** Menor avalia primeiro (first-match). */
1101
+ priority: z.ZodDefault<z.ZodNumber>;
1102
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
1103
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
1104
+ scope: z.ZodOptional<z.ZodObject<{
1105
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
1106
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
1107
+ }, "strip", z.ZodTypeAny, {
1108
+ provider?: "chatbee" | "hub-waba" | undefined;
1109
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1110
+ }, {
1111
+ provider?: "chatbee" | "hub-waba" | undefined;
1112
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1113
+ }>>;
1114
+ conditions: z.ZodEffects<z.ZodObject<{
1115
+ all: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1116
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
1117
+ * "now.iso" — este último para operadores de schedule). */
1118
+ fact: z.ZodString;
1119
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
1120
+ value: z.ZodOptional<z.ZodUnknown>;
1121
+ }, "strip", z.ZodTypeAny, {
1122
+ fact: string;
1123
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1124
+ value?: unknown;
1125
+ }, {
1126
+ fact: string;
1127
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1128
+ value?: unknown;
1129
+ }>, {
1130
+ fact: string;
1131
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1132
+ value?: unknown;
1133
+ }, {
1134
+ fact: string;
1135
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1136
+ value?: unknown;
1137
+ }>, "many">>;
1138
+ any: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1139
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
1140
+ * "now.iso" — este último para operadores de schedule). */
1141
+ fact: z.ZodString;
1142
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
1143
+ value: z.ZodOptional<z.ZodUnknown>;
1144
+ }, "strip", z.ZodTypeAny, {
1145
+ fact: string;
1146
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1147
+ value?: unknown;
1148
+ }, {
1149
+ fact: string;
1150
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1151
+ value?: unknown;
1152
+ }>, {
1153
+ fact: string;
1154
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1155
+ value?: unknown;
1156
+ }, {
1157
+ fact: string;
1158
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1159
+ value?: unknown;
1160
+ }>, "many">>;
1161
+ }, "strip", z.ZodTypeAny, {
1162
+ all?: {
1163
+ fact: string;
1164
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1165
+ value?: unknown;
1166
+ }[] | undefined;
1167
+ any?: {
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" | "in_schedule" | "not_in_schedule";
1170
+ value?: unknown;
1171
+ }[] | undefined;
1172
+ }, {
1173
+ all?: {
1174
+ fact: string;
1175
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1176
+ value?: unknown;
1177
+ }[] | undefined;
1178
+ any?: {
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" | "in_schedule" | "not_in_schedule";
1181
+ value?: unknown;
1182
+ }[] | undefined;
1183
+ }>, {
1184
+ all?: {
1185
+ fact: string;
1186
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1187
+ value?: unknown;
1188
+ }[] | undefined;
1189
+ any?: {
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" | "in_schedule" | "not_in_schedule";
1192
+ value?: unknown;
1193
+ }[] | undefined;
1194
+ }, {
1195
+ all?: {
1196
+ fact: string;
1197
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1198
+ value?: unknown;
1199
+ }[] | undefined;
1200
+ any?: {
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" | "in_schedule" | "not_in_schedule";
1203
+ value?: unknown;
1204
+ }[] | undefined;
1205
+ }>;
1206
+ actions: z.ZodArray<z.ZodObject<{
1207
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
1208
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
1209
+ tool: z.ZodString;
1210
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1211
+ }, "strip", z.ZodTypeAny, {
1212
+ input: Record<string, unknown>;
1213
+ tool: string;
1214
+ }, {
1215
+ tool: string;
1216
+ input?: Record<string, unknown> | undefined;
1217
+ }>, "many">;
1218
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
1219
+ /** Shadow mode por regra (característica permanente, não só de rollout):
1220
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
1221
+ * regras novas convivendo com regras live no mesmo binding.
1222
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
1223
+ dry_run: z.ZodDefault<z.ZodBoolean>;
1224
+ /** Aborta sequência de ações no primeiro erro. */
1225
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1226
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1227
+ /** Identificador estável (auditoria, idempotência). */
1228
+ id: z.ZodString;
1229
+ /** Nome legível ("Paciente existente → Clínica"). */
1230
+ name: z.ZodString;
1231
+ active: z.ZodDefault<z.ZodBoolean>;
1232
+ /** Menor avalia primeiro (first-match). */
1233
+ priority: z.ZodDefault<z.ZodNumber>;
1234
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
1235
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
1236
+ scope: z.ZodOptional<z.ZodObject<{
1237
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
1238
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
1239
+ }, "strip", z.ZodTypeAny, {
1240
+ provider?: "chatbee" | "hub-waba" | undefined;
1241
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1242
+ }, {
1243
+ provider?: "chatbee" | "hub-waba" | undefined;
1244
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1245
+ }>>;
1246
+ conditions: z.ZodEffects<z.ZodObject<{
1247
+ all: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1248
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
1249
+ * "now.iso" — este último para operadores de schedule). */
1250
+ fact: z.ZodString;
1251
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
1252
+ value: z.ZodOptional<z.ZodUnknown>;
1253
+ }, "strip", z.ZodTypeAny, {
1254
+ fact: string;
1255
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1256
+ value?: unknown;
1257
+ }, {
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" | "in_schedule" | "not_in_schedule";
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" | "in_schedule" | "not_in_schedule";
1264
+ value?: unknown;
1265
+ }, {
1266
+ fact: string;
1267
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1268
+ value?: unknown;
1269
+ }>, "many">>;
1270
+ any: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1271
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
1272
+ * "now.iso" — este último para operadores de schedule). */
1273
+ fact: z.ZodString;
1274
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
1275
+ value: z.ZodOptional<z.ZodUnknown>;
1276
+ }, "strip", z.ZodTypeAny, {
1277
+ fact: string;
1278
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1279
+ value?: unknown;
1280
+ }, {
1281
+ fact: string;
1282
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1283
+ value?: unknown;
1284
+ }>, {
1285
+ fact: string;
1286
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1287
+ value?: unknown;
1288
+ }, {
1289
+ fact: string;
1290
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1291
+ value?: unknown;
1292
+ }>, "many">>;
1293
+ }, "strip", z.ZodTypeAny, {
1294
+ all?: {
1295
+ fact: string;
1296
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1297
+ value?: unknown;
1298
+ }[] | undefined;
1299
+ any?: {
1300
+ fact: string;
1301
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1302
+ value?: unknown;
1303
+ }[] | undefined;
1304
+ }, {
1305
+ all?: {
1306
+ fact: string;
1307
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1308
+ value?: unknown;
1309
+ }[] | undefined;
1310
+ any?: {
1311
+ fact: string;
1312
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1313
+ value?: unknown;
1314
+ }[] | undefined;
1315
+ }>, {
1316
+ all?: {
1317
+ fact: string;
1318
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1319
+ value?: unknown;
1320
+ }[] | undefined;
1321
+ any?: {
1322
+ fact: string;
1323
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1324
+ value?: unknown;
1325
+ }[] | undefined;
1326
+ }, {
1327
+ all?: {
1328
+ fact: string;
1329
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1330
+ value?: unknown;
1331
+ }[] | undefined;
1332
+ any?: {
1333
+ fact: string;
1334
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1335
+ value?: unknown;
1336
+ }[] | undefined;
1337
+ }>;
1338
+ actions: z.ZodArray<z.ZodObject<{
1339
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
1340
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
1341
+ tool: z.ZodString;
1342
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1343
+ }, "strip", z.ZodTypeAny, {
1344
+ input: Record<string, unknown>;
1345
+ tool: string;
1346
+ }, {
1347
+ tool: string;
1348
+ input?: Record<string, unknown> | undefined;
1349
+ }>, "many">;
1350
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
1351
+ /** Shadow mode por regra (característica permanente, não só de rollout):
1352
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
1353
+ * regras novas convivendo com regras live no mesmo binding.
1354
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
1355
+ dry_run: z.ZodDefault<z.ZodBoolean>;
1356
+ /** Aborta sequência de ações no primeiro erro. */
1357
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1094
1358
  }, z.ZodTypeAny, "passthrough">>;
1095
1359
  export declare const zAiBindingSchema: z.ZodObject<{
1096
1360
  id: z.ZodString;
@@ -1150,7 +1414,862 @@ export declare const zAiBindingSchema: z.ZodObject<{
1150
1414
  }>>;
1151
1415
  /** Camada de regras determinísticas avaliada antes do LLM (e, no futuro,
1152
1416
  * também depois). Ausente/vazio = camada off, comportamento atual (só LLM). */
1153
- rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
1417
+ rules: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1418
+ /** Identificador estável (auditoria, idempotência). */
1419
+ id: z.ZodString;
1420
+ /** Nome legível ("Paciente existente → Clínica"). */
1421
+ name: z.ZodString;
1422
+ active: z.ZodDefault<z.ZodBoolean>;
1423
+ /** Menor avalia primeiro (first-match). */
1424
+ priority: z.ZodDefault<z.ZodNumber>;
1425
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
1426
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
1427
+ scope: z.ZodOptional<z.ZodObject<{
1428
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
1429
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
1430
+ }, "strip", z.ZodTypeAny, {
1431
+ provider?: "chatbee" | "hub-waba" | undefined;
1432
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1433
+ }, {
1434
+ provider?: "chatbee" | "hub-waba" | undefined;
1435
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1436
+ }>>;
1437
+ conditions: z.ZodEffects<z.ZodObject<{
1438
+ all: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1439
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
1440
+ * "now.iso" — este último para operadores de schedule). */
1441
+ fact: z.ZodString;
1442
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
1443
+ value: z.ZodOptional<z.ZodUnknown>;
1444
+ }, "strip", z.ZodTypeAny, {
1445
+ fact: string;
1446
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1447
+ value?: unknown;
1448
+ }, {
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" | "in_schedule" | "not_in_schedule";
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" | "in_schedule" | "not_in_schedule";
1455
+ value?: unknown;
1456
+ }, {
1457
+ fact: string;
1458
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1459
+ value?: unknown;
1460
+ }>, "many">>;
1461
+ any: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1462
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
1463
+ * "now.iso" — este último para operadores de schedule). */
1464
+ fact: z.ZodString;
1465
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
1466
+ value: z.ZodOptional<z.ZodUnknown>;
1467
+ }, "strip", z.ZodTypeAny, {
1468
+ fact: string;
1469
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1470
+ value?: unknown;
1471
+ }, {
1472
+ fact: string;
1473
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1474
+ value?: unknown;
1475
+ }>, {
1476
+ fact: string;
1477
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1478
+ value?: unknown;
1479
+ }, {
1480
+ fact: string;
1481
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1482
+ value?: unknown;
1483
+ }>, "many">>;
1484
+ }, "strip", z.ZodTypeAny, {
1485
+ all?: {
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" | "in_schedule" | "not_in_schedule";
1488
+ value?: unknown;
1489
+ }[] | undefined;
1490
+ any?: {
1491
+ fact: string;
1492
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1493
+ value?: unknown;
1494
+ }[] | undefined;
1495
+ }, {
1496
+ all?: {
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" | "in_schedule" | "not_in_schedule";
1499
+ value?: unknown;
1500
+ }[] | undefined;
1501
+ any?: {
1502
+ fact: string;
1503
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1504
+ value?: unknown;
1505
+ }[] | undefined;
1506
+ }>, {
1507
+ all?: {
1508
+ fact: string;
1509
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1510
+ value?: unknown;
1511
+ }[] | undefined;
1512
+ any?: {
1513
+ fact: string;
1514
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1515
+ value?: unknown;
1516
+ }[] | undefined;
1517
+ }, {
1518
+ all?: {
1519
+ fact: string;
1520
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1521
+ value?: unknown;
1522
+ }[] | undefined;
1523
+ any?: {
1524
+ fact: string;
1525
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1526
+ value?: unknown;
1527
+ }[] | undefined;
1528
+ }>;
1529
+ actions: z.ZodArray<z.ZodObject<{
1530
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
1531
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
1532
+ tool: z.ZodString;
1533
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1534
+ }, "strip", z.ZodTypeAny, {
1535
+ input: Record<string, unknown>;
1536
+ tool: string;
1537
+ }, {
1538
+ tool: string;
1539
+ input?: Record<string, unknown> | undefined;
1540
+ }>, "many">;
1541
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
1542
+ /** Shadow mode por regra (característica permanente, não só de rollout):
1543
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
1544
+ * regras novas convivendo com regras live no mesmo binding.
1545
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
1546
+ dry_run: z.ZodDefault<z.ZodBoolean>;
1547
+ /** Aborta sequência de ações no primeiro erro. */
1548
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1549
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1550
+ /** Identificador estável (auditoria, idempotência). */
1551
+ id: z.ZodString;
1552
+ /** Nome legível ("Paciente existente → Clínica"). */
1553
+ name: z.ZodString;
1554
+ active: z.ZodDefault<z.ZodBoolean>;
1555
+ /** Menor avalia primeiro (first-match). */
1556
+ priority: z.ZodDefault<z.ZodNumber>;
1557
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
1558
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
1559
+ scope: z.ZodOptional<z.ZodObject<{
1560
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
1561
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
1562
+ }, "strip", z.ZodTypeAny, {
1563
+ provider?: "chatbee" | "hub-waba" | undefined;
1564
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1565
+ }, {
1566
+ provider?: "chatbee" | "hub-waba" | undefined;
1567
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1568
+ }>>;
1569
+ conditions: z.ZodEffects<z.ZodObject<{
1570
+ all: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1571
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
1572
+ * "now.iso" — este último para operadores de schedule). */
1573
+ fact: z.ZodString;
1574
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
1575
+ value: z.ZodOptional<z.ZodUnknown>;
1576
+ }, "strip", z.ZodTypeAny, {
1577
+ fact: string;
1578
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1579
+ value?: unknown;
1580
+ }, {
1581
+ fact: string;
1582
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1583
+ value?: unknown;
1584
+ }>, {
1585
+ fact: string;
1586
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1587
+ value?: unknown;
1588
+ }, {
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" | "in_schedule" | "not_in_schedule";
1591
+ value?: unknown;
1592
+ }>, "many">>;
1593
+ any: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1594
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
1595
+ * "now.iso" — este último para operadores de schedule). */
1596
+ fact: z.ZodString;
1597
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
1598
+ value: z.ZodOptional<z.ZodUnknown>;
1599
+ }, "strip", z.ZodTypeAny, {
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" | "in_schedule" | "not_in_schedule";
1602
+ value?: unknown;
1603
+ }, {
1604
+ fact: string;
1605
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1606
+ value?: unknown;
1607
+ }>, {
1608
+ fact: string;
1609
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1610
+ value?: unknown;
1611
+ }, {
1612
+ fact: string;
1613
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1614
+ value?: unknown;
1615
+ }>, "many">>;
1616
+ }, "strip", z.ZodTypeAny, {
1617
+ all?: {
1618
+ fact: string;
1619
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1620
+ value?: unknown;
1621
+ }[] | undefined;
1622
+ any?: {
1623
+ fact: string;
1624
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1625
+ value?: unknown;
1626
+ }[] | undefined;
1627
+ }, {
1628
+ all?: {
1629
+ fact: string;
1630
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1631
+ value?: unknown;
1632
+ }[] | undefined;
1633
+ any?: {
1634
+ fact: string;
1635
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1636
+ value?: unknown;
1637
+ }[] | undefined;
1638
+ }>, {
1639
+ all?: {
1640
+ fact: string;
1641
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1642
+ value?: unknown;
1643
+ }[] | undefined;
1644
+ any?: {
1645
+ fact: string;
1646
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1647
+ value?: unknown;
1648
+ }[] | undefined;
1649
+ }, {
1650
+ all?: {
1651
+ fact: string;
1652
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1653
+ value?: unknown;
1654
+ }[] | undefined;
1655
+ any?: {
1656
+ fact: string;
1657
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1658
+ value?: unknown;
1659
+ }[] | undefined;
1660
+ }>;
1661
+ actions: z.ZodArray<z.ZodObject<{
1662
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
1663
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
1664
+ tool: z.ZodString;
1665
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1666
+ }, "strip", z.ZodTypeAny, {
1667
+ input: Record<string, unknown>;
1668
+ tool: string;
1669
+ }, {
1670
+ tool: string;
1671
+ input?: Record<string, unknown> | undefined;
1672
+ }>, "many">;
1673
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
1674
+ /** Shadow mode por regra (característica permanente, não só de rollout):
1675
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
1676
+ * regras novas convivendo com regras live no mesmo binding.
1677
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
1678
+ dry_run: z.ZodDefault<z.ZodBoolean>;
1679
+ /** Aborta sequência de ações no primeiro erro. */
1680
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1681
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1682
+ /** Identificador estável (auditoria, idempotência). */
1683
+ id: z.ZodString;
1684
+ /** Nome legível ("Paciente existente → Clínica"). */
1685
+ name: z.ZodString;
1686
+ active: z.ZodDefault<z.ZodBoolean>;
1687
+ /** Menor avalia primeiro (first-match). */
1688
+ priority: z.ZodDefault<z.ZodNumber>;
1689
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
1690
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
1691
+ scope: z.ZodOptional<z.ZodObject<{
1692
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
1693
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
1694
+ }, "strip", z.ZodTypeAny, {
1695
+ provider?: "chatbee" | "hub-waba" | undefined;
1696
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1697
+ }, {
1698
+ provider?: "chatbee" | "hub-waba" | undefined;
1699
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1700
+ }>>;
1701
+ conditions: z.ZodEffects<z.ZodObject<{
1702
+ all: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1703
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
1704
+ * "now.iso" — este último para operadores de schedule). */
1705
+ fact: z.ZodString;
1706
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
1707
+ value: z.ZodOptional<z.ZodUnknown>;
1708
+ }, "strip", z.ZodTypeAny, {
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" | "in_schedule" | "not_in_schedule";
1711
+ value?: unknown;
1712
+ }, {
1713
+ fact: string;
1714
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1715
+ value?: unknown;
1716
+ }>, {
1717
+ fact: string;
1718
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1719
+ value?: unknown;
1720
+ }, {
1721
+ fact: string;
1722
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1723
+ value?: unknown;
1724
+ }>, "many">>;
1725
+ any: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1726
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
1727
+ * "now.iso" — este último para operadores de schedule). */
1728
+ fact: z.ZodString;
1729
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
1730
+ value: z.ZodOptional<z.ZodUnknown>;
1731
+ }, "strip", z.ZodTypeAny, {
1732
+ fact: string;
1733
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1734
+ value?: unknown;
1735
+ }, {
1736
+ fact: string;
1737
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1738
+ value?: unknown;
1739
+ }>, {
1740
+ fact: string;
1741
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1742
+ value?: unknown;
1743
+ }, {
1744
+ fact: string;
1745
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1746
+ value?: unknown;
1747
+ }>, "many">>;
1748
+ }, "strip", z.ZodTypeAny, {
1749
+ all?: {
1750
+ fact: string;
1751
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1752
+ value?: unknown;
1753
+ }[] | undefined;
1754
+ any?: {
1755
+ fact: string;
1756
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1757
+ value?: unknown;
1758
+ }[] | undefined;
1759
+ }, {
1760
+ all?: {
1761
+ fact: string;
1762
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1763
+ value?: unknown;
1764
+ }[] | undefined;
1765
+ any?: {
1766
+ fact: string;
1767
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1768
+ value?: unknown;
1769
+ }[] | undefined;
1770
+ }>, {
1771
+ all?: {
1772
+ fact: string;
1773
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1774
+ value?: unknown;
1775
+ }[] | undefined;
1776
+ any?: {
1777
+ fact: string;
1778
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1779
+ value?: unknown;
1780
+ }[] | undefined;
1781
+ }, {
1782
+ all?: {
1783
+ fact: string;
1784
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1785
+ value?: unknown;
1786
+ }[] | undefined;
1787
+ any?: {
1788
+ fact: string;
1789
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1790
+ value?: unknown;
1791
+ }[] | undefined;
1792
+ }>;
1793
+ actions: z.ZodArray<z.ZodObject<{
1794
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
1795
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
1796
+ tool: z.ZodString;
1797
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1798
+ }, "strip", z.ZodTypeAny, {
1799
+ input: Record<string, unknown>;
1800
+ tool: string;
1801
+ }, {
1802
+ tool: string;
1803
+ input?: Record<string, unknown> | undefined;
1804
+ }>, "many">;
1805
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
1806
+ /** Shadow mode por regra (característica permanente, não só de rollout):
1807
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
1808
+ * regras novas convivendo com regras live no mesmo binding.
1809
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
1810
+ dry_run: z.ZodDefault<z.ZodBoolean>;
1811
+ /** Aborta sequência de ações no primeiro erro. */
1812
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1813
+ }, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
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.ZodEffects<z.ZodObject<{
1835
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
1836
+ * "now.iso" — este último para operadores de schedule). */
1837
+ fact: z.ZodString;
1838
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
1839
+ value: z.ZodOptional<z.ZodUnknown>;
1840
+ }, "strip", z.ZodTypeAny, {
1841
+ fact: string;
1842
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1843
+ value?: unknown;
1844
+ }, {
1845
+ fact: string;
1846
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1847
+ value?: unknown;
1848
+ }>, {
1849
+ fact: string;
1850
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1851
+ value?: unknown;
1852
+ }, {
1853
+ fact: string;
1854
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1855
+ value?: unknown;
1856
+ }>, "many">>;
1857
+ any: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1858
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
1859
+ * "now.iso" — este último para operadores de schedule). */
1860
+ fact: z.ZodString;
1861
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
1862
+ value: z.ZodOptional<z.ZodUnknown>;
1863
+ }, "strip", z.ZodTypeAny, {
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" | "in_schedule" | "not_in_schedule";
1866
+ value?: unknown;
1867
+ }, {
1868
+ fact: string;
1869
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1870
+ value?: unknown;
1871
+ }>, {
1872
+ fact: string;
1873
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1874
+ value?: unknown;
1875
+ }, {
1876
+ fact: string;
1877
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1878
+ value?: unknown;
1879
+ }>, "many">>;
1880
+ }, "strip", z.ZodTypeAny, {
1881
+ all?: {
1882
+ fact: string;
1883
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1884
+ value?: unknown;
1885
+ }[] | undefined;
1886
+ any?: {
1887
+ fact: string;
1888
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1889
+ value?: unknown;
1890
+ }[] | undefined;
1891
+ }, {
1892
+ all?: {
1893
+ fact: string;
1894
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1895
+ value?: unknown;
1896
+ }[] | undefined;
1897
+ any?: {
1898
+ fact: string;
1899
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1900
+ value?: unknown;
1901
+ }[] | undefined;
1902
+ }>, {
1903
+ all?: {
1904
+ fact: string;
1905
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1906
+ value?: unknown;
1907
+ }[] | undefined;
1908
+ any?: {
1909
+ fact: string;
1910
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1911
+ value?: unknown;
1912
+ }[] | undefined;
1913
+ }, {
1914
+ all?: {
1915
+ fact: string;
1916
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1917
+ value?: unknown;
1918
+ }[] | undefined;
1919
+ any?: {
1920
+ fact: string;
1921
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1922
+ value?: unknown;
1923
+ }[] | undefined;
1924
+ }>;
1925
+ actions: z.ZodArray<z.ZodObject<{
1926
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
1927
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
1928
+ tool: z.ZodString;
1929
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
1930
+ }, "strip", z.ZodTypeAny, {
1931
+ input: Record<string, unknown>;
1932
+ tool: string;
1933
+ }, {
1934
+ tool: string;
1935
+ input?: Record<string, unknown> | undefined;
1936
+ }>, "many">;
1937
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
1938
+ /** Shadow mode por regra (característica permanente, não só de rollout):
1939
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
1940
+ * regras novas convivendo com regras live no mesmo binding.
1941
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
1942
+ dry_run: z.ZodDefault<z.ZodBoolean>;
1943
+ /** Aborta sequência de ações no primeiro erro. */
1944
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1945
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1946
+ /** Identificador estável (auditoria, idempotência). */
1947
+ id: z.ZodString;
1948
+ /** Nome legível ("Paciente existente → Clínica"). */
1949
+ name: z.ZodString;
1950
+ active: z.ZodDefault<z.ZodBoolean>;
1951
+ /** Menor avalia primeiro (first-match). */
1952
+ priority: z.ZodDefault<z.ZodNumber>;
1953
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
1954
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
1955
+ scope: z.ZodOptional<z.ZodObject<{
1956
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
1957
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
1958
+ }, "strip", z.ZodTypeAny, {
1959
+ provider?: "chatbee" | "hub-waba" | undefined;
1960
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1961
+ }, {
1962
+ provider?: "chatbee" | "hub-waba" | undefined;
1963
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
1964
+ }>>;
1965
+ conditions: z.ZodEffects<z.ZodObject<{
1966
+ all: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1967
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
1968
+ * "now.iso" — este último para operadores de schedule). */
1969
+ fact: z.ZodString;
1970
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
1971
+ value: z.ZodOptional<z.ZodUnknown>;
1972
+ }, "strip", z.ZodTypeAny, {
1973
+ fact: string;
1974
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1975
+ value?: unknown;
1976
+ }, {
1977
+ fact: string;
1978
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1979
+ value?: unknown;
1980
+ }>, {
1981
+ fact: string;
1982
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1983
+ value?: unknown;
1984
+ }, {
1985
+ fact: string;
1986
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1987
+ value?: unknown;
1988
+ }>, "many">>;
1989
+ any: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1990
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
1991
+ * "now.iso" — este último para operadores de schedule). */
1992
+ fact: z.ZodString;
1993
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
1994
+ value: z.ZodOptional<z.ZodUnknown>;
1995
+ }, "strip", z.ZodTypeAny, {
1996
+ fact: string;
1997
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
1998
+ value?: unknown;
1999
+ }, {
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" | "in_schedule" | "not_in_schedule";
2002
+ value?: unknown;
2003
+ }>, {
2004
+ fact: string;
2005
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2006
+ value?: unknown;
2007
+ }, {
2008
+ fact: string;
2009
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2010
+ value?: unknown;
2011
+ }>, "many">>;
2012
+ }, "strip", z.ZodTypeAny, {
2013
+ all?: {
2014
+ fact: string;
2015
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2016
+ value?: unknown;
2017
+ }[] | undefined;
2018
+ any?: {
2019
+ fact: string;
2020
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2021
+ value?: unknown;
2022
+ }[] | undefined;
2023
+ }, {
2024
+ all?: {
2025
+ fact: string;
2026
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2027
+ value?: unknown;
2028
+ }[] | undefined;
2029
+ any?: {
2030
+ fact: string;
2031
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2032
+ value?: unknown;
2033
+ }[] | undefined;
2034
+ }>, {
2035
+ all?: {
2036
+ fact: string;
2037
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2038
+ value?: unknown;
2039
+ }[] | undefined;
2040
+ any?: {
2041
+ fact: string;
2042
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2043
+ value?: unknown;
2044
+ }[] | undefined;
2045
+ }, {
2046
+ all?: {
2047
+ fact: string;
2048
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2049
+ value?: unknown;
2050
+ }[] | undefined;
2051
+ any?: {
2052
+ fact: string;
2053
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2054
+ value?: unknown;
2055
+ }[] | undefined;
2056
+ }>;
2057
+ actions: z.ZodArray<z.ZodObject<{
2058
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
2059
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
2060
+ tool: z.ZodString;
2061
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2062
+ }, "strip", z.ZodTypeAny, {
2063
+ input: Record<string, unknown>;
2064
+ tool: string;
2065
+ }, {
2066
+ tool: string;
2067
+ input?: Record<string, unknown> | undefined;
2068
+ }>, "many">;
2069
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
2070
+ /** Shadow mode por regra (característica permanente, não só de rollout):
2071
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
2072
+ * regras novas convivendo com regras live no mesmo binding.
2073
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
2074
+ dry_run: z.ZodDefault<z.ZodBoolean>;
2075
+ /** Aborta sequência de ações no primeiro erro. */
2076
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
2077
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
2078
+ /** Master switch do binding para a camada de regras.
2079
+ * `dry_run` força todas as regras deste binding a modo seco (sem executar
2080
+ * actions; apenas avalia e grava trace). Default runtime quando ausente: `live`. */
2081
+ rules_mode: z.ZodOptional<z.ZodEnum<["live", "dry_run"]>>;
2082
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2083
+ id: z.ZodString;
2084
+ ref: z.ZodAny;
2085
+ tenant: z.ZodString;
2086
+ model_ver: z.ZodDefault<z.ZodNumber>;
2087
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
2088
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
2089
+ deleted_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
2090
+ } & {
2091
+ agent_type: z.ZodString;
2092
+ agent_config_id: z.ZodString;
2093
+ topic: z.ZodString;
2094
+ active: z.ZodDefault<z.ZodBoolean>;
2095
+ priority: z.ZodDefault<z.ZodNumber>;
2096
+ /** Default conversation mode for new threads in this department.
2097
+ * ai_only — AI responds directly to patient
2098
+ * hybrid_assist — AI generates suggestions for operator
2099
+ * human_only — AI disabled, operator can switch to other modes
2100
+ * blocked — AI disabled, operator CANNOT change mode (admin lock) */
2101
+ default_mode: z.ZodDefault<z.ZodEnum<["ai_only", "hybrid_assist", "human_only", "blocked"]>>;
2102
+ /** Capacidades efetivas para tools deste departamento.
2103
+ * Quando ausente, runtime aplica `channel.capabilities` como fallback. */
2104
+ capabilities: z.ZodOptional<z.ZodObject<{
2105
+ can_schedule: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2106
+ can_reschedule: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2107
+ can_cancel: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2108
+ can_handoff: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2109
+ can_read_finops: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2110
+ }, "strip", z.ZodTypeAny, {
2111
+ can_schedule?: boolean | undefined;
2112
+ can_reschedule?: boolean | undefined;
2113
+ can_cancel?: boolean | undefined;
2114
+ can_handoff?: boolean | undefined;
2115
+ can_read_finops?: boolean | undefined;
2116
+ }, {
2117
+ can_schedule?: boolean | undefined;
2118
+ can_reschedule?: boolean | undefined;
2119
+ can_cancel?: boolean | undefined;
2120
+ can_handoff?: boolean | undefined;
2121
+ can_read_finops?: boolean | undefined;
2122
+ }>>;
2123
+ /** Prompts específicos do fluxo do departamento (texto inline).
2124
+ * Empilhados após identity/safety/channel_custom do canal. */
2125
+ prompt_overrides: z.ZodOptional<z.ZodObject<{
2126
+ behavior: z.ZodOptional<z.ZodString>;
2127
+ routing: z.ZodOptional<z.ZodString>;
2128
+ tool_usage: z.ZodOptional<z.ZodString>;
2129
+ }, "strip", z.ZodTypeAny, {
2130
+ behavior?: string | undefined;
2131
+ routing?: string | undefined;
2132
+ tool_usage?: string | undefined;
2133
+ }, {
2134
+ behavior?: string | undefined;
2135
+ routing?: string | undefined;
2136
+ tool_usage?: string | undefined;
2137
+ }>>;
2138
+ /** Camada de regras determinísticas avaliada antes do LLM (e, no futuro,
2139
+ * também depois). Ausente/vazio = camada off, comportamento atual (só LLM). */
2140
+ rules: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
2141
+ /** Identificador estável (auditoria, idempotência). */
2142
+ id: z.ZodString;
2143
+ /** Nome legível ("Paciente existente → Clínica"). */
2144
+ name: z.ZodString;
2145
+ active: z.ZodDefault<z.ZodBoolean>;
2146
+ /** Menor avalia primeiro (first-match). */
2147
+ priority: z.ZodDefault<z.ZodNumber>;
2148
+ phase: z.ZodDefault<z.ZodEnum<["pre_llm", "post_llm"]>>;
2149
+ when: z.ZodDefault<z.ZodEnum<["inbound_message", "llm_completed"]>>;
2150
+ scope: z.ZodOptional<z.ZodObject<{
2151
+ applies_to: z.ZodOptional<z.ZodOptional<z.ZodEnum<["real_message", "kickoff", "any"]>>>;
2152
+ provider: z.ZodOptional<z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>>;
2153
+ }, "strip", z.ZodTypeAny, {
2154
+ provider?: "chatbee" | "hub-waba" | undefined;
2155
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
2156
+ }, {
2157
+ provider?: "chatbee" | "hub-waba" | undefined;
2158
+ applies_to?: "real_message" | "kickoff" | "any" | undefined;
2159
+ }>>;
2160
+ conditions: z.ZodEffects<z.ZodObject<{
2161
+ all: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
2162
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
2163
+ * "now.iso" — este último para operadores de schedule). */
2164
+ fact: z.ZodString;
2165
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
2166
+ value: z.ZodOptional<z.ZodUnknown>;
2167
+ }, "strip", z.ZodTypeAny, {
2168
+ fact: string;
2169
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2170
+ value?: unknown;
2171
+ }, {
2172
+ fact: string;
2173
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2174
+ value?: unknown;
2175
+ }>, {
2176
+ fact: string;
2177
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2178
+ value?: unknown;
2179
+ }, {
2180
+ fact: string;
2181
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2182
+ value?: unknown;
2183
+ }>, "many">>;
2184
+ any: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
2185
+ /** Dot-path no namespace de facts (ex: "lead.tag_names", "contact.has_lead",
2186
+ * "now.iso" — este último para operadores de schedule). */
2187
+ fact: z.ZodString;
2188
+ op: z.ZodEnum<["exists", "not_exists", "is_empty", "is_not_empty", "eq", "neq", "in", "not_in", "contains", "not_contains", "matches", "gt", "gte", "lt", "lte", "in_schedule", "not_in_schedule"]>;
2189
+ value: z.ZodOptional<z.ZodUnknown>;
2190
+ }, "strip", z.ZodTypeAny, {
2191
+ fact: string;
2192
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2193
+ value?: unknown;
2194
+ }, {
2195
+ fact: string;
2196
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2197
+ value?: unknown;
2198
+ }>, {
2199
+ fact: string;
2200
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2201
+ value?: unknown;
2202
+ }, {
2203
+ fact: string;
2204
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2205
+ value?: unknown;
2206
+ }>, "many">>;
2207
+ }, "strip", z.ZodTypeAny, {
2208
+ all?: {
2209
+ fact: string;
2210
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2211
+ value?: unknown;
2212
+ }[] | undefined;
2213
+ any?: {
2214
+ fact: string;
2215
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2216
+ value?: unknown;
2217
+ }[] | undefined;
2218
+ }, {
2219
+ all?: {
2220
+ fact: string;
2221
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2222
+ value?: unknown;
2223
+ }[] | undefined;
2224
+ any?: {
2225
+ fact: string;
2226
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2227
+ value?: unknown;
2228
+ }[] | undefined;
2229
+ }>, {
2230
+ all?: {
2231
+ fact: string;
2232
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2233
+ value?: unknown;
2234
+ }[] | undefined;
2235
+ any?: {
2236
+ fact: string;
2237
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2238
+ value?: unknown;
2239
+ }[] | undefined;
2240
+ }, {
2241
+ all?: {
2242
+ fact: string;
2243
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2244
+ value?: unknown;
2245
+ }[] | undefined;
2246
+ any?: {
2247
+ fact: string;
2248
+ op: "in" | "exists" | "not_exists" | "is_empty" | "is_not_empty" | "eq" | "neq" | "not_in" | "contains" | "not_contains" | "matches" | "gt" | "gte" | "lt" | "lte" | "in_schedule" | "not_in_schedule";
2249
+ value?: unknown;
2250
+ }[] | undefined;
2251
+ }>;
2252
+ actions: z.ZodArray<z.ZodObject<{
2253
+ /** Nome de uma tool `category: 'action'` do evo-hubia-tools
2254
+ * (transfer_to_department, close_attendance, handoff_to_human, update_lead_tags, …). */
2255
+ tool: z.ZodString;
2256
+ input: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
2257
+ }, "strip", z.ZodTypeAny, {
2258
+ input: Record<string, unknown>;
2259
+ tool: string;
2260
+ }, {
2261
+ tool: string;
2262
+ input?: Record<string, unknown> | undefined;
2263
+ }>, "many">;
2264
+ outcome: z.ZodEnum<["stop", "to_llm", "to_llm_with_context"]>;
2265
+ /** Shadow mode por regra (característica permanente, não só de rollout):
2266
+ * avalia + grava trace, mas NÃO executa as actions. Permite canário de
2267
+ * regras novas convivendo com regras live no mesmo binding.
2268
+ * Efetivo: `binding.rules_mode === 'dry_run' || rule.dry_run === true`. */
2269
+ dry_run: z.ZodDefault<z.ZodBoolean>;
2270
+ /** Aborta sequência de ações no primeiro erro. */
2271
+ stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
2272
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1154
2273
  /** Identificador estável (auditoria, idempotência). */
1155
2274
  id: z.ZodString;
1156
2275
  /** Nome legível ("Paciente existente → Clínica"). */
@@ -1282,7 +2401,7 @@ export declare const zAiBindingSchema: z.ZodObject<{
1282
2401
  dry_run: z.ZodDefault<z.ZodBoolean>;
1283
2402
  /** Aborta sequência de ações no primeiro erro. */
1284
2403
  stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1285
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2404
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1286
2405
  /** Identificador estável (auditoria, idempotência). */
1287
2406
  id: z.ZodString;
1288
2407
  /** Nome legível ("Paciente existente → Clínica"). */
@@ -1414,7 +2533,7 @@ export declare const zAiBindingSchema: z.ZodObject<{
1414
2533
  dry_run: z.ZodDefault<z.ZodBoolean>;
1415
2534
  /** Aborta sequência de ações no primeiro erro. */
1416
2535
  stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1417
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2536
+ }, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
1418
2537
  /** Identificador estável (auditoria, idempotência). */
1419
2538
  id: z.ZodString;
1420
2539
  /** Nome legível ("Paciente existente → Clínica"). */
@@ -1546,70 +2665,7 @@ export declare const zAiBindingSchema: z.ZodObject<{
1546
2665
  dry_run: z.ZodDefault<z.ZodBoolean>;
1547
2666
  /** Aborta sequência de ações no primeiro erro. */
1548
2667
  stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1549
- }, z.ZodTypeAny, "passthrough">>, "many">>;
1550
- /** Master switch do binding para a camada de regras.
1551
- * `dry_run` força todas as regras deste binding a modo seco (sem executar
1552
- * actions; apenas avalia e grava trace). Default runtime quando ausente: `live`. */
1553
- rules_mode: z.ZodOptional<z.ZodEnum<["live", "dry_run"]>>;
1554
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1555
- id: z.ZodString;
1556
- ref: z.ZodAny;
1557
- tenant: z.ZodString;
1558
- model_ver: z.ZodDefault<z.ZodNumber>;
1559
- created_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
1560
- updated_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
1561
- deleted_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
1562
- } & {
1563
- agent_type: z.ZodString;
1564
- agent_config_id: z.ZodString;
1565
- topic: z.ZodString;
1566
- active: z.ZodDefault<z.ZodBoolean>;
1567
- priority: z.ZodDefault<z.ZodNumber>;
1568
- /** Default conversation mode for new threads in this department.
1569
- * ai_only — AI responds directly to patient
1570
- * hybrid_assist — AI generates suggestions for operator
1571
- * human_only — AI disabled, operator can switch to other modes
1572
- * blocked — AI disabled, operator CANNOT change mode (admin lock) */
1573
- default_mode: z.ZodDefault<z.ZodEnum<["ai_only", "hybrid_assist", "human_only", "blocked"]>>;
1574
- /** Capacidades efetivas para tools deste departamento.
1575
- * Quando ausente, runtime aplica `channel.capabilities` como fallback. */
1576
- capabilities: z.ZodOptional<z.ZodObject<{
1577
- can_schedule: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1578
- can_reschedule: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1579
- can_cancel: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1580
- can_handoff: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1581
- can_read_finops: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
1582
- }, "strip", z.ZodTypeAny, {
1583
- can_schedule?: boolean | undefined;
1584
- can_reschedule?: boolean | undefined;
1585
- can_cancel?: boolean | undefined;
1586
- can_handoff?: boolean | undefined;
1587
- can_read_finops?: boolean | undefined;
1588
- }, {
1589
- can_schedule?: boolean | undefined;
1590
- can_reschedule?: boolean | undefined;
1591
- can_cancel?: boolean | undefined;
1592
- can_handoff?: boolean | undefined;
1593
- can_read_finops?: boolean | undefined;
1594
- }>>;
1595
- /** Prompts específicos do fluxo do departamento (texto inline).
1596
- * Empilhados após identity/safety/channel_custom do canal. */
1597
- prompt_overrides: z.ZodOptional<z.ZodObject<{
1598
- behavior: z.ZodOptional<z.ZodString>;
1599
- routing: z.ZodOptional<z.ZodString>;
1600
- tool_usage: z.ZodOptional<z.ZodString>;
1601
- }, "strip", z.ZodTypeAny, {
1602
- behavior?: string | undefined;
1603
- routing?: string | undefined;
1604
- tool_usage?: string | undefined;
1605
- }, {
1606
- behavior?: string | undefined;
1607
- routing?: string | undefined;
1608
- tool_usage?: string | undefined;
1609
- }>>;
1610
- /** Camada de regras determinísticas avaliada antes do LLM (e, no futuro,
1611
- * também depois). Ausente/vazio = camada off, comportamento atual (só LLM). */
1612
- rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
2668
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
1613
2669
  /** Identificador estável (auditoria, idempotência). */
1614
2670
  id: z.ZodString;
1615
2671
  /** Nome legível ("Paciente existente → Clínica"). */
@@ -1741,7 +2797,70 @@ export declare const zAiBindingSchema: z.ZodObject<{
1741
2797
  dry_run: z.ZodDefault<z.ZodBoolean>;
1742
2798
  /** Aborta sequência de ações no primeiro erro. */
1743
2799
  stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1744
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
2800
+ }, z.ZodTypeAny, "passthrough">>, "many">>;
2801
+ /** Master switch do binding para a camada de regras.
2802
+ * `dry_run` força todas as regras deste binding a modo seco (sem executar
2803
+ * actions; apenas avalia e grava trace). Default runtime quando ausente: `live`. */
2804
+ rules_mode: z.ZodOptional<z.ZodEnum<["live", "dry_run"]>>;
2805
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2806
+ id: z.ZodString;
2807
+ ref: z.ZodAny;
2808
+ tenant: z.ZodString;
2809
+ model_ver: z.ZodDefault<z.ZodNumber>;
2810
+ created_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
2811
+ updated_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
2812
+ deleted_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
2813
+ } & {
2814
+ agent_type: z.ZodString;
2815
+ agent_config_id: z.ZodString;
2816
+ topic: z.ZodString;
2817
+ active: z.ZodDefault<z.ZodBoolean>;
2818
+ priority: z.ZodDefault<z.ZodNumber>;
2819
+ /** Default conversation mode for new threads in this department.
2820
+ * ai_only — AI responds directly to patient
2821
+ * hybrid_assist — AI generates suggestions for operator
2822
+ * human_only — AI disabled, operator can switch to other modes
2823
+ * blocked — AI disabled, operator CANNOT change mode (admin lock) */
2824
+ default_mode: z.ZodDefault<z.ZodEnum<["ai_only", "hybrid_assist", "human_only", "blocked"]>>;
2825
+ /** Capacidades efetivas para tools deste departamento.
2826
+ * Quando ausente, runtime aplica `channel.capabilities` como fallback. */
2827
+ capabilities: z.ZodOptional<z.ZodObject<{
2828
+ can_schedule: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2829
+ can_reschedule: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2830
+ can_cancel: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2831
+ can_handoff: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2832
+ can_read_finops: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2833
+ }, "strip", z.ZodTypeAny, {
2834
+ can_schedule?: boolean | undefined;
2835
+ can_reschedule?: boolean | undefined;
2836
+ can_cancel?: boolean | undefined;
2837
+ can_handoff?: boolean | undefined;
2838
+ can_read_finops?: boolean | undefined;
2839
+ }, {
2840
+ can_schedule?: boolean | undefined;
2841
+ can_reschedule?: boolean | undefined;
2842
+ can_cancel?: boolean | undefined;
2843
+ can_handoff?: boolean | undefined;
2844
+ can_read_finops?: boolean | undefined;
2845
+ }>>;
2846
+ /** Prompts específicos do fluxo do departamento (texto inline).
2847
+ * Empilhados após identity/safety/channel_custom do canal. */
2848
+ prompt_overrides: z.ZodOptional<z.ZodObject<{
2849
+ behavior: z.ZodOptional<z.ZodString>;
2850
+ routing: z.ZodOptional<z.ZodString>;
2851
+ tool_usage: z.ZodOptional<z.ZodString>;
2852
+ }, "strip", z.ZodTypeAny, {
2853
+ behavior?: string | undefined;
2854
+ routing?: string | undefined;
2855
+ tool_usage?: string | undefined;
2856
+ }, {
2857
+ behavior?: string | undefined;
2858
+ routing?: string | undefined;
2859
+ tool_usage?: string | undefined;
2860
+ }>>;
2861
+ /** Camada de regras determinísticas avaliada antes do LLM (e, no futuro,
2862
+ * também depois). Ausente/vazio = camada off, comportamento atual (só LLM). */
2863
+ rules: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
1745
2864
  /** Identificador estável (auditoria, idempotência). */
1746
2865
  id: z.ZodString;
1747
2866
  /** Nome legível ("Paciente existente → Clínica"). */
@@ -1873,7 +2992,7 @@ export declare const zAiBindingSchema: z.ZodObject<{
1873
2992
  dry_run: z.ZodDefault<z.ZodBoolean>;
1874
2993
  /** Aborta sequência de ações no primeiro erro. */
1875
2994
  stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
1876
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2995
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
1877
2996
  /** Identificador estável (auditoria, idempotência). */
1878
2997
  id: z.ZodString;
1879
2998
  /** Nome legível ("Paciente existente → Clínica"). */
@@ -2005,70 +3124,7 @@ export declare const zAiBindingSchema: z.ZodObject<{
2005
3124
  dry_run: z.ZodDefault<z.ZodBoolean>;
2006
3125
  /** Aborta sequência de ações no primeiro erro. */
2007
3126
  stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
2008
- }, z.ZodTypeAny, "passthrough">>, "many">>;
2009
- /** Master switch do binding para a camada de regras.
2010
- * `dry_run` força todas as regras deste binding a modo seco (sem executar
2011
- * actions; apenas avalia e grava trace). Default runtime quando ausente: `live`. */
2012
- rules_mode: z.ZodOptional<z.ZodEnum<["live", "dry_run"]>>;
2013
- }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2014
- id: z.ZodString;
2015
- ref: z.ZodAny;
2016
- tenant: z.ZodString;
2017
- model_ver: z.ZodDefault<z.ZodNumber>;
2018
- created_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
2019
- updated_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
2020
- deleted_at: z.ZodOptional<z.ZodNullable<z.ZodDate>>;
2021
- } & {
2022
- agent_type: z.ZodString;
2023
- agent_config_id: z.ZodString;
2024
- topic: z.ZodString;
2025
- active: z.ZodDefault<z.ZodBoolean>;
2026
- priority: z.ZodDefault<z.ZodNumber>;
2027
- /** Default conversation mode for new threads in this department.
2028
- * ai_only — AI responds directly to patient
2029
- * hybrid_assist — AI generates suggestions for operator
2030
- * human_only — AI disabled, operator can switch to other modes
2031
- * blocked — AI disabled, operator CANNOT change mode (admin lock) */
2032
- default_mode: z.ZodDefault<z.ZodEnum<["ai_only", "hybrid_assist", "human_only", "blocked"]>>;
2033
- /** Capacidades efetivas para tools deste departamento.
2034
- * Quando ausente, runtime aplica `channel.capabilities` como fallback. */
2035
- capabilities: z.ZodOptional<z.ZodObject<{
2036
- can_schedule: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2037
- can_reschedule: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2038
- can_cancel: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2039
- can_handoff: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2040
- can_read_finops: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
2041
- }, "strip", z.ZodTypeAny, {
2042
- can_schedule?: boolean | undefined;
2043
- can_reschedule?: boolean | undefined;
2044
- can_cancel?: boolean | undefined;
2045
- can_handoff?: boolean | undefined;
2046
- can_read_finops?: boolean | undefined;
2047
- }, {
2048
- can_schedule?: boolean | undefined;
2049
- can_reschedule?: boolean | undefined;
2050
- can_cancel?: boolean | undefined;
2051
- can_handoff?: boolean | undefined;
2052
- can_read_finops?: boolean | undefined;
2053
- }>>;
2054
- /** Prompts específicos do fluxo do departamento (texto inline).
2055
- * Empilhados após identity/safety/channel_custom do canal. */
2056
- prompt_overrides: z.ZodOptional<z.ZodObject<{
2057
- behavior: z.ZodOptional<z.ZodString>;
2058
- routing: z.ZodOptional<z.ZodString>;
2059
- tool_usage: z.ZodOptional<z.ZodString>;
2060
- }, "strip", z.ZodTypeAny, {
2061
- behavior?: string | undefined;
2062
- routing?: string | undefined;
2063
- tool_usage?: string | undefined;
2064
- }, {
2065
- behavior?: string | undefined;
2066
- routing?: string | undefined;
2067
- tool_usage?: string | undefined;
2068
- }>>;
2069
- /** Camada de regras determinísticas avaliada antes do LLM (e, no futuro,
2070
- * também depois). Ausente/vazio = camada off, comportamento atual (só LLM). */
2071
- rules: z.ZodOptional<z.ZodArray<z.ZodObject<{
3127
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
2072
3128
  /** Identificador estável (auditoria, idempotência). */
2073
3129
  id: z.ZodString;
2074
3130
  /** Nome legível ("Paciente existente → Clínica"). */
@@ -2200,7 +3256,7 @@ export declare const zAiBindingSchema: z.ZodObject<{
2200
3256
  dry_run: z.ZodDefault<z.ZodBoolean>;
2201
3257
  /** Aborta sequência de ações no primeiro erro. */
2202
3258
  stop_actions_on_error: z.ZodDefault<z.ZodBoolean>;
2203
- }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
3259
+ }, z.ZodTypeAny, "passthrough">>, z.objectOutputType<{
2204
3260
  /** Identificador estável (auditoria, idempotência). */
2205
3261
  id: z.ZodString;
2206
3262
  /** Nome legível ("Paciente existente → Clínica"). */