evo360-types 1.3.353 → 1.3.355

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.
@@ -18,12 +18,90 @@ export declare const zHubiaV1ChannelConfigSchema: z.ZodObject<{
18
18
  llm_model: z.ZodDefault<z.ZodString>;
19
19
  llm_temperature: z.ZodDefault<z.ZodNumber>;
20
20
  llm_max_tokens: z.ZodDefault<z.ZodNumber>;
21
+ /** @deprecated Coleção `apps/evo-hubia-v1/prompts/{id}` virou histórico (Q5=B em decisions.md). Após a migração, runtime ignora este campo. */
21
22
  prompt_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
23
+ /** Prompts inline herdados pelos bindings que apontam para este canal.
24
+ * Identity/safety/channel_custom específicos do canal.
25
+ * Migrados a partir da coleção legada `apps/evo-hubia-v1/prompts/{id}` (Q5=B em decisions.md). */
26
+ prompts: z.ZodOptional<z.ZodObject<{
27
+ identity: z.ZodOptional<z.ZodObject<{
28
+ text: z.ZodOptional<z.ZodDefault<z.ZodString>>;
29
+ version: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
30
+ updated_at: z.ZodOptional<z.ZodOptional<z.ZodAny>>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ version?: number | undefined;
33
+ updated_at?: any;
34
+ text?: string | undefined;
35
+ }, {
36
+ version?: number | undefined;
37
+ updated_at?: any;
38
+ text?: string | undefined;
39
+ }>>;
40
+ safety: z.ZodOptional<z.ZodObject<{
41
+ text: z.ZodOptional<z.ZodDefault<z.ZodString>>;
42
+ version: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
43
+ updated_at: z.ZodOptional<z.ZodOptional<z.ZodAny>>;
44
+ }, "strip", z.ZodTypeAny, {
45
+ version?: number | undefined;
46
+ updated_at?: any;
47
+ text?: string | undefined;
48
+ }, {
49
+ version?: number | undefined;
50
+ updated_at?: any;
51
+ text?: string | undefined;
52
+ }>>;
53
+ channel_custom: z.ZodOptional<z.ZodObject<{
54
+ text: z.ZodOptional<z.ZodDefault<z.ZodString>>;
55
+ version: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
56
+ updated_at: z.ZodOptional<z.ZodOptional<z.ZodAny>>;
57
+ }, "strip", z.ZodTypeAny, {
58
+ version?: number | undefined;
59
+ updated_at?: any;
60
+ text?: string | undefined;
61
+ }, {
62
+ version?: number | undefined;
63
+ updated_at?: any;
64
+ text?: string | undefined;
65
+ }>>;
66
+ }, "strip", z.ZodTypeAny, {
67
+ identity?: {
68
+ version?: number | undefined;
69
+ updated_at?: any;
70
+ text?: string | undefined;
71
+ } | undefined;
72
+ safety?: {
73
+ version?: number | undefined;
74
+ updated_at?: any;
75
+ text?: string | undefined;
76
+ } | undefined;
77
+ channel_custom?: {
78
+ version?: number | undefined;
79
+ updated_at?: any;
80
+ text?: string | undefined;
81
+ } | undefined;
82
+ }, {
83
+ identity?: {
84
+ version?: number | undefined;
85
+ updated_at?: any;
86
+ text?: string | undefined;
87
+ } | undefined;
88
+ safety?: {
89
+ version?: number | undefined;
90
+ updated_at?: any;
91
+ text?: string | undefined;
92
+ } | undefined;
93
+ channel_custom?: {
94
+ version?: number | undefined;
95
+ updated_at?: any;
96
+ text?: string | undefined;
97
+ } | undefined;
98
+ }>>;
22
99
  toolkit_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
23
100
  max_rounds: z.ZodDefault<z.ZodNumber>;
24
101
  max_tool_calls: z.ZodDefault<z.ZodNumber>;
25
102
  execution_timeout_ms: z.ZodDefault<z.ZodNumber>;
26
- capabilities: z.ZodObject<{
103
+ /** @deprecated Movido para `binding.capabilities`. Permanece como fallback indefinido (Q2=C em decisions.md). Não deve ser editado pela nova UI. */
104
+ capabilities: z.ZodOptional<z.ZodObject<{
27
105
  can_schedule: z.ZodDefault<z.ZodBoolean>;
28
106
  can_reschedule: z.ZodDefault<z.ZodBoolean>;
29
107
  can_cancel: z.ZodDefault<z.ZodBoolean>;
@@ -41,8 +119,18 @@ export declare const zHubiaV1ChannelConfigSchema: z.ZodObject<{
41
119
  can_cancel?: boolean | undefined;
42
120
  can_handoff?: boolean | undefined;
43
121
  can_read_finops?: boolean | undefined;
44
- }>;
122
+ }>>;
45
123
  timezone: z.ZodDefault<z.ZodString>;
124
+ /** Provider que entrega mensagens deste canal. Quando ausente, runtime assume 'hub-waba' (back-compat). */
125
+ provider: z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>;
126
+ /** Para provider='chatbee': id do canal no Chatbee (numérico stringificado). */
127
+ chatbee_channel_id: z.ZodOptional<z.ZodString>;
128
+ /** Para provider='chatbee': company_id que resolve a API key do Chatbee. */
129
+ chatbee_company_id: z.ZodOptional<z.ZodNumber>;
130
+ /** Department padrão para AI router. Para Chatbee, único caminho (não há canal v3). Para hub-waba, fallback caso ticket não tenha department. */
131
+ default_department_id: z.ZodOptional<z.ZodString>;
132
+ /** Quantidade máxima de mensagens carregadas pela tool `get_conversation_history` (auto-injection). Default runtime: 30. */
133
+ history_size: z.ZodOptional<z.ZodNumber>;
46
134
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
47
135
  id: z.ZodString;
48
136
  ref: z.ZodAny;
@@ -60,12 +148,90 @@ export declare const zHubiaV1ChannelConfigSchema: z.ZodObject<{
60
148
  llm_model: z.ZodDefault<z.ZodString>;
61
149
  llm_temperature: z.ZodDefault<z.ZodNumber>;
62
150
  llm_max_tokens: z.ZodDefault<z.ZodNumber>;
151
+ /** @deprecated Coleção `apps/evo-hubia-v1/prompts/{id}` virou histórico (Q5=B em decisions.md). Após a migração, runtime ignora este campo. */
63
152
  prompt_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
153
+ /** Prompts inline herdados pelos bindings que apontam para este canal.
154
+ * Identity/safety/channel_custom específicos do canal.
155
+ * Migrados a partir da coleção legada `apps/evo-hubia-v1/prompts/{id}` (Q5=B em decisions.md). */
156
+ prompts: z.ZodOptional<z.ZodObject<{
157
+ identity: z.ZodOptional<z.ZodObject<{
158
+ text: z.ZodOptional<z.ZodDefault<z.ZodString>>;
159
+ version: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
160
+ updated_at: z.ZodOptional<z.ZodOptional<z.ZodAny>>;
161
+ }, "strip", z.ZodTypeAny, {
162
+ version?: number | undefined;
163
+ updated_at?: any;
164
+ text?: string | undefined;
165
+ }, {
166
+ version?: number | undefined;
167
+ updated_at?: any;
168
+ text?: string | undefined;
169
+ }>>;
170
+ safety: z.ZodOptional<z.ZodObject<{
171
+ text: z.ZodOptional<z.ZodDefault<z.ZodString>>;
172
+ version: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
173
+ updated_at: z.ZodOptional<z.ZodOptional<z.ZodAny>>;
174
+ }, "strip", z.ZodTypeAny, {
175
+ version?: number | undefined;
176
+ updated_at?: any;
177
+ text?: string | undefined;
178
+ }, {
179
+ version?: number | undefined;
180
+ updated_at?: any;
181
+ text?: string | undefined;
182
+ }>>;
183
+ channel_custom: z.ZodOptional<z.ZodObject<{
184
+ text: z.ZodOptional<z.ZodDefault<z.ZodString>>;
185
+ version: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
186
+ updated_at: z.ZodOptional<z.ZodOptional<z.ZodAny>>;
187
+ }, "strip", z.ZodTypeAny, {
188
+ version?: number | undefined;
189
+ updated_at?: any;
190
+ text?: string | undefined;
191
+ }, {
192
+ version?: number | undefined;
193
+ updated_at?: any;
194
+ text?: string | undefined;
195
+ }>>;
196
+ }, "strip", z.ZodTypeAny, {
197
+ identity?: {
198
+ version?: number | undefined;
199
+ updated_at?: any;
200
+ text?: string | undefined;
201
+ } | undefined;
202
+ safety?: {
203
+ version?: number | undefined;
204
+ updated_at?: any;
205
+ text?: string | undefined;
206
+ } | undefined;
207
+ channel_custom?: {
208
+ version?: number | undefined;
209
+ updated_at?: any;
210
+ text?: string | undefined;
211
+ } | undefined;
212
+ }, {
213
+ identity?: {
214
+ version?: number | undefined;
215
+ updated_at?: any;
216
+ text?: string | undefined;
217
+ } | undefined;
218
+ safety?: {
219
+ version?: number | undefined;
220
+ updated_at?: any;
221
+ text?: string | undefined;
222
+ } | undefined;
223
+ channel_custom?: {
224
+ version?: number | undefined;
225
+ updated_at?: any;
226
+ text?: string | undefined;
227
+ } | undefined;
228
+ }>>;
64
229
  toolkit_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
230
  max_rounds: z.ZodDefault<z.ZodNumber>;
66
231
  max_tool_calls: z.ZodDefault<z.ZodNumber>;
67
232
  execution_timeout_ms: z.ZodDefault<z.ZodNumber>;
68
- capabilities: z.ZodObject<{
233
+ /** @deprecated Movido para `binding.capabilities`. Permanece como fallback indefinido (Q2=C em decisions.md). Não deve ser editado pela nova UI. */
234
+ capabilities: z.ZodOptional<z.ZodObject<{
69
235
  can_schedule: z.ZodDefault<z.ZodBoolean>;
70
236
  can_reschedule: z.ZodDefault<z.ZodBoolean>;
71
237
  can_cancel: z.ZodDefault<z.ZodBoolean>;
@@ -83,8 +249,18 @@ export declare const zHubiaV1ChannelConfigSchema: z.ZodObject<{
83
249
  can_cancel?: boolean | undefined;
84
250
  can_handoff?: boolean | undefined;
85
251
  can_read_finops?: boolean | undefined;
86
- }>;
252
+ }>>;
87
253
  timezone: z.ZodDefault<z.ZodString>;
254
+ /** Provider que entrega mensagens deste canal. Quando ausente, runtime assume 'hub-waba' (back-compat). */
255
+ provider: z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>;
256
+ /** Para provider='chatbee': id do canal no Chatbee (numérico stringificado). */
257
+ chatbee_channel_id: z.ZodOptional<z.ZodString>;
258
+ /** Para provider='chatbee': company_id que resolve a API key do Chatbee. */
259
+ chatbee_company_id: z.ZodOptional<z.ZodNumber>;
260
+ /** Department padrão para AI router. Para Chatbee, único caminho (não há canal v3). Para hub-waba, fallback caso ticket não tenha department. */
261
+ default_department_id: z.ZodOptional<z.ZodString>;
262
+ /** Quantidade máxima de mensagens carregadas pela tool `get_conversation_history` (auto-injection). Default runtime: 30. */
263
+ history_size: z.ZodOptional<z.ZodNumber>;
88
264
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
89
265
  id: z.ZodString;
90
266
  ref: z.ZodAny;
@@ -102,12 +278,90 @@ export declare const zHubiaV1ChannelConfigSchema: z.ZodObject<{
102
278
  llm_model: z.ZodDefault<z.ZodString>;
103
279
  llm_temperature: z.ZodDefault<z.ZodNumber>;
104
280
  llm_max_tokens: z.ZodDefault<z.ZodNumber>;
281
+ /** @deprecated Coleção `apps/evo-hubia-v1/prompts/{id}` virou histórico (Q5=B em decisions.md). Após a migração, runtime ignora este campo. */
105
282
  prompt_ids: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
283
+ /** Prompts inline herdados pelos bindings que apontam para este canal.
284
+ * Identity/safety/channel_custom específicos do canal.
285
+ * Migrados a partir da coleção legada `apps/evo-hubia-v1/prompts/{id}` (Q5=B em decisions.md). */
286
+ prompts: z.ZodOptional<z.ZodObject<{
287
+ identity: z.ZodOptional<z.ZodObject<{
288
+ text: z.ZodOptional<z.ZodDefault<z.ZodString>>;
289
+ version: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
290
+ updated_at: z.ZodOptional<z.ZodOptional<z.ZodAny>>;
291
+ }, "strip", z.ZodTypeAny, {
292
+ version?: number | undefined;
293
+ updated_at?: any;
294
+ text?: string | undefined;
295
+ }, {
296
+ version?: number | undefined;
297
+ updated_at?: any;
298
+ text?: string | undefined;
299
+ }>>;
300
+ safety: z.ZodOptional<z.ZodObject<{
301
+ text: z.ZodOptional<z.ZodDefault<z.ZodString>>;
302
+ version: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
303
+ updated_at: z.ZodOptional<z.ZodOptional<z.ZodAny>>;
304
+ }, "strip", z.ZodTypeAny, {
305
+ version?: number | undefined;
306
+ updated_at?: any;
307
+ text?: string | undefined;
308
+ }, {
309
+ version?: number | undefined;
310
+ updated_at?: any;
311
+ text?: string | undefined;
312
+ }>>;
313
+ channel_custom: z.ZodOptional<z.ZodObject<{
314
+ text: z.ZodOptional<z.ZodDefault<z.ZodString>>;
315
+ version: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
316
+ updated_at: z.ZodOptional<z.ZodOptional<z.ZodAny>>;
317
+ }, "strip", z.ZodTypeAny, {
318
+ version?: number | undefined;
319
+ updated_at?: any;
320
+ text?: string | undefined;
321
+ }, {
322
+ version?: number | undefined;
323
+ updated_at?: any;
324
+ text?: string | undefined;
325
+ }>>;
326
+ }, "strip", z.ZodTypeAny, {
327
+ identity?: {
328
+ version?: number | undefined;
329
+ updated_at?: any;
330
+ text?: string | undefined;
331
+ } | undefined;
332
+ safety?: {
333
+ version?: number | undefined;
334
+ updated_at?: any;
335
+ text?: string | undefined;
336
+ } | undefined;
337
+ channel_custom?: {
338
+ version?: number | undefined;
339
+ updated_at?: any;
340
+ text?: string | undefined;
341
+ } | undefined;
342
+ }, {
343
+ identity?: {
344
+ version?: number | undefined;
345
+ updated_at?: any;
346
+ text?: string | undefined;
347
+ } | undefined;
348
+ safety?: {
349
+ version?: number | undefined;
350
+ updated_at?: any;
351
+ text?: string | undefined;
352
+ } | undefined;
353
+ channel_custom?: {
354
+ version?: number | undefined;
355
+ updated_at?: any;
356
+ text?: string | undefined;
357
+ } | undefined;
358
+ }>>;
106
359
  toolkit_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
107
360
  max_rounds: z.ZodDefault<z.ZodNumber>;
108
361
  max_tool_calls: z.ZodDefault<z.ZodNumber>;
109
362
  execution_timeout_ms: z.ZodDefault<z.ZodNumber>;
110
- capabilities: z.ZodObject<{
363
+ /** @deprecated Movido para `binding.capabilities`. Permanece como fallback indefinido (Q2=C em decisions.md). Não deve ser editado pela nova UI. */
364
+ capabilities: z.ZodOptional<z.ZodObject<{
111
365
  can_schedule: z.ZodDefault<z.ZodBoolean>;
112
366
  can_reschedule: z.ZodDefault<z.ZodBoolean>;
113
367
  can_cancel: z.ZodDefault<z.ZodBoolean>;
@@ -125,10 +379,94 @@ export declare const zHubiaV1ChannelConfigSchema: z.ZodObject<{
125
379
  can_cancel?: boolean | undefined;
126
380
  can_handoff?: boolean | undefined;
127
381
  can_read_finops?: boolean | undefined;
128
- }>;
382
+ }>>;
129
383
  timezone: z.ZodDefault<z.ZodString>;
384
+ /** Provider que entrega mensagens deste canal. Quando ausente, runtime assume 'hub-waba' (back-compat). */
385
+ provider: z.ZodOptional<z.ZodEnum<["chatbee", "hub-waba"]>>;
386
+ /** Para provider='chatbee': id do canal no Chatbee (numérico stringificado). */
387
+ chatbee_channel_id: z.ZodOptional<z.ZodString>;
388
+ /** Para provider='chatbee': company_id que resolve a API key do Chatbee. */
389
+ chatbee_company_id: z.ZodOptional<z.ZodNumber>;
390
+ /** Department padrão para AI router. Para Chatbee, único caminho (não há canal v3). Para hub-waba, fallback caso ticket não tenha department. */
391
+ default_department_id: z.ZodOptional<z.ZodString>;
392
+ /** Quantidade máxima de mensagens carregadas pela tool `get_conversation_history` (auto-injection). Default runtime: 30. */
393
+ history_size: z.ZodOptional<z.ZodNumber>;
130
394
  }, z.ZodTypeAny, "passthrough">>;
131
395
  export type IHubiaV1ChannelConfig = z.infer<typeof zHubiaV1ChannelConfigSchema>;
396
+ export declare const zHubiaConversationMessageSchema: z.ZodObject<{
397
+ id: z.ZodString;
398
+ direction: z.ZodEnum<["in", "out"]>;
399
+ /** Role pronto para LLM (Anthropic messages API). */
400
+ role: z.ZodEnum<["user", "assistant"]>;
401
+ text: z.ZodDefault<z.ZodString>;
402
+ type: z.ZodDefault<z.ZodEnum<["text", "audio", "image", "document", "event"]>>;
403
+ audio_transcript: z.ZodOptional<z.ZodString>;
404
+ source: z.ZodEnum<["patient", "ai", "operator", "n8n"]>;
405
+ provider: z.ZodEnum<["chatbee", "hub-waba"]>;
406
+ provider_message_id: z.ZodString;
407
+ execution_id: z.ZodOptional<z.ZodString>;
408
+ created_by: z.ZodOptional<z.ZodObject<{
409
+ user_id: z.ZodOptional<z.ZodString>;
410
+ agent: z.ZodOptional<z.ZodString>;
411
+ }, "strip", z.ZodTypeAny, {
412
+ agent?: string | undefined;
413
+ user_id?: string | undefined;
414
+ }, {
415
+ agent?: string | undefined;
416
+ user_id?: string | undefined;
417
+ }>>;
418
+ /** Timestamp do payload original — NÃO serverTimestamp (preserva ordem cronológica real). */
419
+ occurred_at: z.ZodAny;
420
+ }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
421
+ id: z.ZodString;
422
+ direction: z.ZodEnum<["in", "out"]>;
423
+ /** Role pronto para LLM (Anthropic messages API). */
424
+ role: z.ZodEnum<["user", "assistant"]>;
425
+ text: z.ZodDefault<z.ZodString>;
426
+ type: z.ZodDefault<z.ZodEnum<["text", "audio", "image", "document", "event"]>>;
427
+ audio_transcript: z.ZodOptional<z.ZodString>;
428
+ source: z.ZodEnum<["patient", "ai", "operator", "n8n"]>;
429
+ provider: z.ZodEnum<["chatbee", "hub-waba"]>;
430
+ provider_message_id: z.ZodString;
431
+ execution_id: z.ZodOptional<z.ZodString>;
432
+ created_by: z.ZodOptional<z.ZodObject<{
433
+ user_id: z.ZodOptional<z.ZodString>;
434
+ agent: z.ZodOptional<z.ZodString>;
435
+ }, "strip", z.ZodTypeAny, {
436
+ agent?: string | undefined;
437
+ user_id?: string | undefined;
438
+ }, {
439
+ agent?: string | undefined;
440
+ user_id?: string | undefined;
441
+ }>>;
442
+ /** Timestamp do payload original — NÃO serverTimestamp (preserva ordem cronológica real). */
443
+ occurred_at: z.ZodAny;
444
+ }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
445
+ id: z.ZodString;
446
+ direction: z.ZodEnum<["in", "out"]>;
447
+ /** Role pronto para LLM (Anthropic messages API). */
448
+ role: z.ZodEnum<["user", "assistant"]>;
449
+ text: z.ZodDefault<z.ZodString>;
450
+ type: z.ZodDefault<z.ZodEnum<["text", "audio", "image", "document", "event"]>>;
451
+ audio_transcript: z.ZodOptional<z.ZodString>;
452
+ source: z.ZodEnum<["patient", "ai", "operator", "n8n"]>;
453
+ provider: z.ZodEnum<["chatbee", "hub-waba"]>;
454
+ provider_message_id: z.ZodString;
455
+ execution_id: z.ZodOptional<z.ZodString>;
456
+ created_by: z.ZodOptional<z.ZodObject<{
457
+ user_id: z.ZodOptional<z.ZodString>;
458
+ agent: z.ZodOptional<z.ZodString>;
459
+ }, "strip", z.ZodTypeAny, {
460
+ agent?: string | undefined;
461
+ user_id?: string | undefined;
462
+ }, {
463
+ agent?: string | undefined;
464
+ user_id?: string | undefined;
465
+ }>>;
466
+ /** Timestamp do payload original — NÃO serverTimestamp (preserva ordem cronológica real). */
467
+ occurred_at: z.ZodAny;
468
+ }, z.ZodTypeAny, "passthrough">>;
469
+ export type IHubiaConversationMessage = z.infer<typeof zHubiaConversationMessageSchema>;
132
470
  export declare const zHubiaConversationModeSchema: z.ZodEnum<["ai_only", "hybrid_assist", "human_only", "blocked"]>;
133
471
  export type IHubiaConversationMode = z.infer<typeof zHubiaConversationModeSchema>;
134
472
  export declare const zAiBindingSchema: z.ZodObject<{
@@ -151,6 +489,42 @@ export declare const zAiBindingSchema: z.ZodObject<{
151
489
  * human_only — AI disabled, operator can switch to other modes
152
490
  * blocked — AI disabled, operator CANNOT change mode (admin lock) */
153
491
  default_mode: z.ZodDefault<z.ZodEnum<["ai_only", "hybrid_assist", "human_only", "blocked"]>>;
492
+ /** Capacidades efetivas para tools deste departamento.
493
+ * Quando ausente, runtime aplica `channel.capabilities` como fallback. */
494
+ capabilities: z.ZodOptional<z.ZodObject<{
495
+ can_schedule: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
496
+ can_reschedule: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
497
+ can_cancel: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
498
+ can_handoff: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
499
+ can_read_finops: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
500
+ }, "strip", z.ZodTypeAny, {
501
+ can_schedule?: boolean | undefined;
502
+ can_reschedule?: boolean | undefined;
503
+ can_cancel?: boolean | undefined;
504
+ can_handoff?: boolean | undefined;
505
+ can_read_finops?: boolean | undefined;
506
+ }, {
507
+ can_schedule?: boolean | undefined;
508
+ can_reschedule?: boolean | undefined;
509
+ can_cancel?: boolean | undefined;
510
+ can_handoff?: boolean | undefined;
511
+ can_read_finops?: boolean | undefined;
512
+ }>>;
513
+ /** Prompts específicos do fluxo do departamento (texto inline).
514
+ * Empilhados após identity/safety/channel_custom do canal. */
515
+ prompt_overrides: z.ZodOptional<z.ZodObject<{
516
+ behavior: z.ZodOptional<z.ZodString>;
517
+ routing: z.ZodOptional<z.ZodString>;
518
+ tool_usage: z.ZodOptional<z.ZodString>;
519
+ }, "strip", z.ZodTypeAny, {
520
+ behavior?: string | undefined;
521
+ routing?: string | undefined;
522
+ tool_usage?: string | undefined;
523
+ }, {
524
+ behavior?: string | undefined;
525
+ routing?: string | undefined;
526
+ tool_usage?: string | undefined;
527
+ }>>;
154
528
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
155
529
  id: z.ZodString;
156
530
  ref: z.ZodAny;
@@ -171,6 +545,42 @@ export declare const zAiBindingSchema: z.ZodObject<{
171
545
  * human_only — AI disabled, operator can switch to other modes
172
546
  * blocked — AI disabled, operator CANNOT change mode (admin lock) */
173
547
  default_mode: z.ZodDefault<z.ZodEnum<["ai_only", "hybrid_assist", "human_only", "blocked"]>>;
548
+ /** Capacidades efetivas para tools deste departamento.
549
+ * Quando ausente, runtime aplica `channel.capabilities` como fallback. */
550
+ capabilities: z.ZodOptional<z.ZodObject<{
551
+ can_schedule: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
552
+ can_reschedule: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
553
+ can_cancel: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
554
+ can_handoff: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
555
+ can_read_finops: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
556
+ }, "strip", z.ZodTypeAny, {
557
+ can_schedule?: boolean | undefined;
558
+ can_reschedule?: boolean | undefined;
559
+ can_cancel?: boolean | undefined;
560
+ can_handoff?: boolean | undefined;
561
+ can_read_finops?: boolean | undefined;
562
+ }, {
563
+ can_schedule?: boolean | undefined;
564
+ can_reschedule?: boolean | undefined;
565
+ can_cancel?: boolean | undefined;
566
+ can_handoff?: boolean | undefined;
567
+ can_read_finops?: boolean | undefined;
568
+ }>>;
569
+ /** Prompts específicos do fluxo do departamento (texto inline).
570
+ * Empilhados após identity/safety/channel_custom do canal. */
571
+ prompt_overrides: z.ZodOptional<z.ZodObject<{
572
+ behavior: z.ZodOptional<z.ZodString>;
573
+ routing: z.ZodOptional<z.ZodString>;
574
+ tool_usage: z.ZodOptional<z.ZodString>;
575
+ }, "strip", z.ZodTypeAny, {
576
+ behavior?: string | undefined;
577
+ routing?: string | undefined;
578
+ tool_usage?: string | undefined;
579
+ }, {
580
+ behavior?: string | undefined;
581
+ routing?: string | undefined;
582
+ tool_usage?: string | undefined;
583
+ }>>;
174
584
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
175
585
  id: z.ZodString;
176
586
  ref: z.ZodAny;
@@ -191,5 +601,41 @@ export declare const zAiBindingSchema: z.ZodObject<{
191
601
  * human_only — AI disabled, operator can switch to other modes
192
602
  * blocked — AI disabled, operator CANNOT change mode (admin lock) */
193
603
  default_mode: z.ZodDefault<z.ZodEnum<["ai_only", "hybrid_assist", "human_only", "blocked"]>>;
604
+ /** Capacidades efetivas para tools deste departamento.
605
+ * Quando ausente, runtime aplica `channel.capabilities` como fallback. */
606
+ capabilities: z.ZodOptional<z.ZodObject<{
607
+ can_schedule: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
608
+ can_reschedule: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
609
+ can_cancel: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
610
+ can_handoff: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
611
+ can_read_finops: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
612
+ }, "strip", z.ZodTypeAny, {
613
+ can_schedule?: boolean | undefined;
614
+ can_reschedule?: boolean | undefined;
615
+ can_cancel?: boolean | undefined;
616
+ can_handoff?: boolean | undefined;
617
+ can_read_finops?: boolean | undefined;
618
+ }, {
619
+ can_schedule?: boolean | undefined;
620
+ can_reschedule?: boolean | undefined;
621
+ can_cancel?: boolean | undefined;
622
+ can_handoff?: boolean | undefined;
623
+ can_read_finops?: boolean | undefined;
624
+ }>>;
625
+ /** Prompts específicos do fluxo do departamento (texto inline).
626
+ * Empilhados após identity/safety/channel_custom do canal. */
627
+ prompt_overrides: z.ZodOptional<z.ZodObject<{
628
+ behavior: z.ZodOptional<z.ZodString>;
629
+ routing: z.ZodOptional<z.ZodString>;
630
+ tool_usage: z.ZodOptional<z.ZodString>;
631
+ }, "strip", z.ZodTypeAny, {
632
+ behavior?: string | undefined;
633
+ routing?: string | undefined;
634
+ tool_usage?: string | undefined;
635
+ }, {
636
+ behavior?: string | undefined;
637
+ routing?: string | undefined;
638
+ tool_usage?: string | undefined;
639
+ }>>;
194
640
  }, z.ZodTypeAny, "passthrough">>;
195
641
  export type IAiBinding = z.infer<typeof zAiBindingSchema>;
@@ -1,11 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.zAiBindingSchema = exports.zHubiaConversationModeSchema = exports.zHubiaV1ChannelConfigSchema = exports.zHubiaAttendanceModeSchema = void 0;
3
+ exports.zAiBindingSchema = exports.zHubiaConversationModeSchema = exports.zHubiaConversationMessageSchema = exports.zHubiaV1ChannelConfigSchema = exports.zHubiaAttendanceModeSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const zod_schemas_1 = require("../../shared/zod-schemas");
6
6
  // ───────── Attendance Mode (how AI operates on this channel) ─────────
7
7
  exports.zHubiaAttendanceModeSchema = zod_1.z.enum(["ai_auto", "ai_suggest", "disabled"]);
8
8
  // ───────── Channel Config (evo-hubia-v1 automation config per channel) ─────────
9
+ const zHubiaInlinePromptSchema = zod_1.z.object({
10
+ text: zod_1.z.string().default(""),
11
+ version: zod_1.z.number().default(1),
12
+ updated_at: zod_1.z.any().optional(),
13
+ }).partial();
9
14
  exports.zHubiaV1ChannelConfigSchema = zod_schemas_1.zFireDocSchema.extend({
10
15
  evo_chat_channel_id: zod_1.z.string(),
11
16
  channel_name: zod_1.z.string(),
@@ -15,23 +20,80 @@ exports.zHubiaV1ChannelConfigSchema = zod_schemas_1.zFireDocSchema.extend({
15
20
  llm_model: zod_1.z.string().default("claude-sonnet-4-20250514"),
16
21
  llm_temperature: zod_1.z.number().min(0).max(1).default(0.3),
17
22
  llm_max_tokens: zod_1.z.number().default(2048),
23
+ /** @deprecated Coleção `apps/evo-hubia-v1/prompts/{id}` virou histórico (Q5=B em decisions.md). Após a migração, runtime ignora este campo. */
18
24
  prompt_ids: zod_1.z.array(zod_1.z.string()).default([]),
25
+ /** Prompts inline herdados pelos bindings que apontam para este canal.
26
+ * Identity/safety/channel_custom específicos do canal.
27
+ * Migrados a partir da coleção legada `apps/evo-hubia-v1/prompts/{id}` (Q5=B em decisions.md). */
28
+ prompts: zod_1.z.object({
29
+ identity: zHubiaInlinePromptSchema.optional(),
30
+ safety: zHubiaInlinePromptSchema.optional(),
31
+ channel_custom: zHubiaInlinePromptSchema.optional(),
32
+ }).optional(),
19
33
  toolkit_id: zod_1.z.string().nullable().optional(),
20
34
  max_rounds: zod_1.z.number().default(5),
21
35
  max_tool_calls: zod_1.z.number().default(10),
22
36
  execution_timeout_ms: zod_1.z.number().default(30000),
37
+ /** @deprecated Movido para `binding.capabilities`. Permanece como fallback indefinido (Q2=C em decisions.md). Não deve ser editado pela nova UI. */
23
38
  capabilities: zod_1.z.object({
24
39
  can_schedule: zod_1.z.boolean().default(false),
25
40
  can_reschedule: zod_1.z.boolean().default(false),
26
41
  can_cancel: zod_1.z.boolean().default(false),
27
42
  can_handoff: zod_1.z.boolean().default(true),
28
43
  can_read_finops: zod_1.z.boolean().default(false),
29
- }),
44
+ }).optional(),
30
45
  timezone: zod_1.z.string().default("America/Sao_Paulo"),
46
+ // ───── Multi-provider (chatbee adapter) ─────
47
+ /** Provider que entrega mensagens deste canal. Quando ausente, runtime assume 'hub-waba' (back-compat). */
48
+ provider: zod_1.z.enum(["chatbee", "hub-waba"]).optional(),
49
+ /** Para provider='chatbee': id do canal no Chatbee (numérico stringificado). */
50
+ chatbee_channel_id: zod_1.z.string().optional(),
51
+ /** Para provider='chatbee': company_id que resolve a API key do Chatbee. */
52
+ chatbee_company_id: zod_1.z.number().optional(),
53
+ /** Department padrão para AI router. Para Chatbee, único caminho (não há canal v3). Para hub-waba, fallback caso ticket não tenha department. */
54
+ default_department_id: zod_1.z.string().optional(),
55
+ /** Quantidade máxima de mensagens carregadas pela tool `get_conversation_history` (auto-injection). Default runtime: 30. */
56
+ history_size: zod_1.z.number().int().positive().optional(),
57
+ }).passthrough();
58
+ // ───────── Conversation Message (histórico provider-agnostic) ─────────
59
+ //
60
+ // Schema usado pela tool `get_conversation_history` (DA-7/DA-8).
61
+ // Hub-waba lê de `apps/evo-chat/threads/{tid}/messages` (v3 existente).
62
+ // Chatbee lê de `apps/evo-chatbee-adapter/conversations/{cb}/messages` (criada pelo adapter).
63
+ exports.zHubiaConversationMessageSchema = zod_1.z.object({
64
+ id: zod_1.z.string(),
65
+ direction: zod_1.z.enum(["in", "out"]),
66
+ /** Role pronto para LLM (Anthropic messages API). */
67
+ role: zod_1.z.enum(["user", "assistant"]),
68
+ text: zod_1.z.string().default(""),
69
+ type: zod_1.z.enum(["text", "audio", "image", "document", "event"]).default("text"),
70
+ audio_transcript: zod_1.z.string().optional(),
71
+ source: zod_1.z.enum(["patient", "ai", "operator", "n8n"]),
72
+ provider: zod_1.z.enum(["chatbee", "hub-waba"]),
73
+ provider_message_id: zod_1.z.string(),
74
+ execution_id: zod_1.z.string().optional(),
75
+ created_by: zod_1.z.object({
76
+ user_id: zod_1.z.string().optional(),
77
+ agent: zod_1.z.string().optional(),
78
+ }).optional(),
79
+ /** Timestamp do payload original — NÃO serverTimestamp (preserva ordem cronológica real). */
80
+ occurred_at: zod_1.z.any(),
31
81
  }).passthrough();
32
82
  // ───────── Conversation Mode ─────────
33
83
  exports.zHubiaConversationModeSchema = zod_1.z.enum(["ai_only", "hybrid_assist", "human_only", "blocked"]);
34
84
  // ───────── AI Binding (department → AI agent routing) ─────────
85
+ const zHubiaCapabilitiesSchema = zod_1.z.object({
86
+ can_schedule: zod_1.z.boolean().default(false),
87
+ can_reschedule: zod_1.z.boolean().default(false),
88
+ can_cancel: zod_1.z.boolean().default(false),
89
+ can_handoff: zod_1.z.boolean().default(true),
90
+ can_read_finops: zod_1.z.boolean().default(false),
91
+ }).partial();
92
+ const zHubiaPromptOverridesSchema = zod_1.z.object({
93
+ behavior: zod_1.z.string().optional(),
94
+ routing: zod_1.z.string().optional(),
95
+ tool_usage: zod_1.z.string().optional(),
96
+ });
35
97
  exports.zAiBindingSchema = zod_schemas_1.zFireDocSchema.extend({
36
98
  agent_type: zod_1.z.string(), // 'evo-hubia-v1', future: 'evo-hubia-v2', etc.
37
99
  agent_config_id: zod_1.z.string(), // ref to the agent's channel config doc
@@ -44,4 +106,10 @@ exports.zAiBindingSchema = zod_schemas_1.zFireDocSchema.extend({
44
106
  * human_only — AI disabled, operator can switch to other modes
45
107
  * blocked — AI disabled, operator CANNOT change mode (admin lock) */
46
108
  default_mode: exports.zHubiaConversationModeSchema.default("ai_only"),
109
+ /** Capacidades efetivas para tools deste departamento.
110
+ * Quando ausente, runtime aplica `channel.capabilities` como fallback. */
111
+ capabilities: zHubiaCapabilitiesSchema.optional(),
112
+ /** Prompts específicos do fluxo do departamento (texto inline).
113
+ * Empilhados após identity/safety/channel_custom do canal. */
114
+ prompt_overrides: zHubiaPromptOverridesSchema.optional(),
47
115
  }).passthrough();