evo360-types 1.3.709 → 1.3.713

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.
package/dist/index.js CHANGED
@@ -57,6 +57,7 @@ __exportStar(require("./types/evo-modules"), exports);
57
57
  // zod schemas
58
58
  __exportStar(require("./apps/shared/zod-schemas"), exports);
59
59
  __exportStar(require("./apps/evo-core/zod-schemas"), exports);
60
+ __exportStar(require("./apps/evo-core/nexus-claims"), exports);
60
61
  __exportStar(require("./apps/evo-tenant/zod-schemas"), exports);
61
62
  __exportStar(require("./apps/evo-activity/zod-schemas"), exports);
62
63
  __exportStar(require("./apps/evo-people/zod-schemas"), exports);
package/dist/index.ts CHANGED
@@ -42,6 +42,7 @@ export * from "./types/evo-modules";
42
42
  // zod schemas
43
43
  export * from "./apps/shared/zod-schemas";
44
44
  export * from "./apps/evo-core/zod-schemas";
45
+ export * from "./apps/evo-core/nexus-claims";
45
46
  export * from "./apps/evo-tenant/zod-schemas";
46
47
  export * from "./apps/evo-activity/zod-schemas";
47
48
  export * from "./apps/evo-people/zod-schemas";
@@ -51,6 +51,9 @@ export interface INexusModuleChatPermissions {
51
51
  supervision?: boolean;
52
52
  /** Supervisão 2.0 (CSQ). Gate da fila e do laudo do evo-csq no Nexus. */
53
53
  csq?: boolean;
54
+ /** feat-280: administração do CSQ (config de LLM da plataforma e
55
+ * reavaliação sob demanda). Só reconhecida pelo MCP do Nexus. */
56
+ csq_admin?: boolean;
54
57
  }
55
58
  export interface INexusReports {
56
59
  }
@@ -62,6 +62,9 @@ export interface INexusModuleChatPermissions {
62
62
  supervision?: boolean;
63
63
  /** Supervisão 2.0 (CSQ). Gate da fila e do laudo do evo-csq no Nexus. */
64
64
  csq?: boolean;
65
+ /** feat-280: administração do CSQ (config de LLM da plataforma e
66
+ * reavaliação sob demanda). Só reconhecida pelo MCP do Nexus. */
67
+ csq_admin?: boolean;
65
68
  }
66
69
 
67
70
  export interface INexusReports {}
@@ -55,6 +55,11 @@ export type CsqRunStatus = "running" | "done" | "failed" | "quarantined";
55
55
  export type CsqCriterionScore = 0 | 50 | 100 | "NA";
56
56
  /** Veredito humano sobre o laudo (adendo §D / Q9=A). */
57
57
  export type CsqReviewVerdict = "agree" | "disagree";
58
+ /** feat-280 (Q6): por onde a revisao entrou. `nexus` = tela Supervisao 2.0;
59
+ * `mcp` = conector MCP do Nexus (claude.ai/ChatGPT). Ausente = `nexus` legado.
60
+ * A calibracao do juiz pode filtrar por origem. */
61
+ export declare const CSQ_REVIEW_SOURCES: readonly ["nexus", "mcp"];
62
+ export type CsqReviewSource = (typeof CSQ_REVIEW_SOURCES)[number];
58
63
  /** Fase do pipeline: `f0` = so indicadores + alertas deterministicos;
59
64
  * `f1` = com o juiz LLM. */
60
65
  export type CsqPhase = "f0" | "f1";
@@ -462,6 +467,10 @@ export interface ICsqReview {
462
467
  criteria_disagreements?: ICsqReviewCriterionDisagreement[];
463
468
  reviewer_login_id: string;
464
469
  reviewed_at: Date;
470
+ /** feat-280: origem da revisao. Ausente = `nexus` (revisoes anteriores). */
471
+ source?: CsqReviewSource;
472
+ /** feat-280: `client_id` OAuth do cliente MCP quando `source = 'mcp'`. */
473
+ client_id?: string;
465
474
  }
466
475
  /** Alerta que faltou no laudo, segundo o supervisor (feat-206 F5). */
467
476
  export interface ICsqReviewMissedAlert {
@@ -530,6 +539,25 @@ export interface ICsqAppointmentEvent {
530
539
  /** `off`: nao roda; `shadow`: roda e registra em `report.detector`, sem mexer
531
540
  * nos claims; `on`: os claims do detector entram na verificacao. */
532
541
  export type CsqDetectorMode = "off" | "shadow" | "on";
542
+ /** Transporte forcado do juiz (`/platform/evo-csq.llm.transport_kill_switch`). */
543
+ export type CsqTransportKillSwitch = "vertex" | "anthropic_direct";
544
+ /**
545
+ * Config de LLM da plataforma: `/platform/evo-csq` -> campo `llm` (feat-191,
546
+ * feat-206 F3). Espelho de `CsqPlatformLlmConfig` do `@evo/csq`. Campo ausente
547
+ * ou `null` = constante do pacote (conexao) / `off` (detector) / ADC (SA).
548
+ * feat-280: gravavel pelo MCP do Nexus (claim `chat.csq_admin`), exceto
549
+ * `service_account` (so leitura).
550
+ */
551
+ export interface ICsqPlatformLlmConfig {
552
+ default_connection_id?: string | null;
553
+ extractor_connection_id?: string | null;
554
+ detector_mode?: CsqDetectorMode | null;
555
+ transport_kill_switch?: CsqTransportKillSwitch | null;
556
+ /** SA que a SA de runtime impersona no Vertex. So leitura pelo MCP. */
557
+ service_account?: string | null;
558
+ }
559
+ /** Campos de `ICsqPlatformLlmConfig` que o MCP pode gravar. */
560
+ export type ICsqPlatformLlmConfigPatch = Partial<Omit<ICsqPlatformLlmConfig, "service_account">>;
533
561
  /** Como terminou a extracao por LLM do detector. */
534
562
  export type CsqDetectorOutcome = "no_signal" | "ok" | "failed" | "skipped";
535
563
  /** Uso do LLM do extrator (so quando houve chamada). */
@@ -896,3 +924,44 @@ export interface ICsqLeadReport extends IFireDoc {
896
924
  * Ausente quando o detector esta `off` ou o laudo e anterior a F3. */
897
925
  detector?: ICsqDetectorReport;
898
926
  }
927
+ /**
928
+ * Pedido de reavaliacao (dry-run) do nex-mcp para o `hubia_csq_dry_run`.
929
+ * Roda o pipeline com o juiz REAL e grava NADA (laudo, runs, BQ, evo_log do
930
+ * pipeline, notificacao, rechecagem, `ticket.csq`).
931
+ */
932
+ export interface ICsqDryRunRequest {
933
+ tenant: string;
934
+ ticket_id: string;
935
+ /** Canal evo-chat do ticket. Ausente = `channel_id` do laudo atual do lead. */
936
+ channel_id?: string | null;
937
+ /** Ausente = `lead_id` do ticket. */
938
+ lead_id?: string | null;
939
+ /** Conexao do juiz (`llm-connections/{id}`). Ausente = resolucao da producao. */
940
+ connection_id?: string | null;
941
+ /** Ignora a triagem sem LLM (`full_review` com motivo `forced`). Default true. */
942
+ force_review?: boolean;
943
+ /** Quem pediu (so log/auditoria do lado do hubia). */
944
+ requested_by?: {
945
+ login_id: string;
946
+ client_id?: string | null;
947
+ } | null;
948
+ }
949
+ /** Resposta do dry-run. `report` vem serializado (datas em ISO). */
950
+ export interface ICsqDryRunResult {
951
+ /** `CsqRunResult.outcome` do pipeline (ex.: `evaluated`, `skipped_*`). */
952
+ outcome: string;
953
+ detail: string | null;
954
+ evaluation_id: string | null;
955
+ lead_id: string | null;
956
+ channel_id: string;
957
+ /** Laudo capturado (NAO gravado); null quando o pipeline nao chegou a montar. */
958
+ report: Record<string, unknown> | null;
959
+ detector: ICsqDetectorReport | null;
960
+ model: string | null;
961
+ llm_provider: string | null;
962
+ llm_connection_id: string | null;
963
+ llm_connection_source: CsqLlmConnectionSource | null;
964
+ triage_mode: CsqTriageMode | null;
965
+ cost_usd_est: number | null;
966
+ duration_ms: number;
967
+ }
@@ -22,7 +22,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
22
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
23
23
  };
24
24
  Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.CSQ_REVIEW_LIMITS = exports.CSQ_DEFAULTS = exports.CSQ_RUBRIC_V1 = exports.CSQ_AUTO_FAIL_POLICY_SUBTYPES = exports.CSQ_AUTO_FAIL_ALERT_CODES = exports.CSQ_SALES_FLOW_SUBTYPES = exports.CSQ_POLICY_VIOLATION_SUBTYPES = exports.CSQ_ALERT_CODES = exports.CSQ_RUBRIC_VERSION = void 0;
25
+ exports.CSQ_REVIEW_LIMITS = exports.CSQ_DEFAULTS = exports.CSQ_RUBRIC_V1 = exports.CSQ_AUTO_FAIL_POLICY_SUBTYPES = exports.CSQ_AUTO_FAIL_ALERT_CODES = exports.CSQ_SALES_FLOW_SUBTYPES = exports.CSQ_POLICY_VIOLATION_SUBTYPES = exports.CSQ_ALERT_CODES = exports.CSQ_REVIEW_SOURCES = exports.CSQ_RUBRIC_VERSION = void 0;
26
26
  __exportStar(require("./fb_collections"), exports);
27
27
  // ───────── Versao da rubrica ─────────
28
28
  /** Versao da rubrica da plataforma gravada em cada avaliacao. Pesos e criterios
@@ -39,6 +39,10 @@ __exportStar(require("./fb_collections"), exports);
39
39
  * regra generica; familia em horarios vizinhos e esperada; `retorno_apos_vou_verificar` e
40
40
  * `nomes_corretos` com ponderacao) e a SAIDA do juiz ganha `revalidations` e `resolved_alerts`. */
41
41
  exports.CSQ_RUBRIC_VERSION = "v1.3";
42
+ /** feat-280 (Q6): por onde a revisao entrou. `nexus` = tela Supervisao 2.0;
43
+ * `mcp` = conector MCP do Nexus (claude.ai/ChatGPT). Ausente = `nexus` legado.
44
+ * A calibracao do juiz pode filtrar por origem. */
45
+ exports.CSQ_REVIEW_SOURCES = ["nexus", "mcp"];
42
46
  // ───────── Catalogo de alertas (report-spec §6) ─────────
43
47
  /** Codigos de alerta v1. Os subtipos de `POLITICA_VIOLADA` e
44
48
  * `FLUXO_VENDA_NAO_SEGUIDO` vivem em `ICsqAlert.subtype`, nao como codigos. */
@@ -98,6 +98,12 @@ export type CsqCriterionScore = 0 | 50 | 100 | "NA";
98
98
  /** Veredito humano sobre o laudo (adendo §D / Q9=A). */
99
99
  export type CsqReviewVerdict = "agree" | "disagree";
100
100
 
101
+ /** feat-280 (Q6): por onde a revisao entrou. `nexus` = tela Supervisao 2.0;
102
+ * `mcp` = conector MCP do Nexus (claude.ai/ChatGPT). Ausente = `nexus` legado.
103
+ * A calibracao do juiz pode filtrar por origem. */
104
+ export const CSQ_REVIEW_SOURCES = ["nexus", "mcp"] as const;
105
+ export type CsqReviewSource = (typeof CSQ_REVIEW_SOURCES)[number];
106
+
101
107
  /** Fase do pipeline: `f0` = so indicadores + alertas deterministicos;
102
108
  * `f1` = com o juiz LLM. */
103
109
  export type CsqPhase = "f0" | "f1";
@@ -717,6 +723,10 @@ export interface ICsqReview {
717
723
  criteria_disagreements?: ICsqReviewCriterionDisagreement[];
718
724
  reviewer_login_id: string;
719
725
  reviewed_at: Date;
726
+ /** feat-280: origem da revisao. Ausente = `nexus` (revisoes anteriores). */
727
+ source?: CsqReviewSource;
728
+ /** feat-280: `client_id` OAuth do cliente MCP quando `source = 'mcp'`. */
729
+ client_id?: string;
720
730
  }
721
731
 
722
732
  /** Alerta que faltou no laudo, segundo o supervisor (feat-206 F5). */
@@ -813,6 +823,30 @@ export interface ICsqAppointmentEvent {
813
823
  * nos claims; `on`: os claims do detector entram na verificacao. */
814
824
  export type CsqDetectorMode = "off" | "shadow" | "on";
815
825
 
826
+ /** Transporte forcado do juiz (`/platform/evo-csq.llm.transport_kill_switch`). */
827
+ export type CsqTransportKillSwitch = "vertex" | "anthropic_direct";
828
+
829
+ /**
830
+ * Config de LLM da plataforma: `/platform/evo-csq` -> campo `llm` (feat-191,
831
+ * feat-206 F3). Espelho de `CsqPlatformLlmConfig` do `@evo/csq`. Campo ausente
832
+ * ou `null` = constante do pacote (conexao) / `off` (detector) / ADC (SA).
833
+ * feat-280: gravavel pelo MCP do Nexus (claim `chat.csq_admin`), exceto
834
+ * `service_account` (so leitura).
835
+ */
836
+ export interface ICsqPlatformLlmConfig {
837
+ default_connection_id?: string | null;
838
+ extractor_connection_id?: string | null;
839
+ detector_mode?: CsqDetectorMode | null;
840
+ transport_kill_switch?: CsqTransportKillSwitch | null;
841
+ /** SA que a SA de runtime impersona no Vertex. So leitura pelo MCP. */
842
+ service_account?: string | null;
843
+ }
844
+
845
+ /** Campos de `ICsqPlatformLlmConfig` que o MCP pode gravar. */
846
+ export type ICsqPlatformLlmConfigPatch = Partial<
847
+ Omit<ICsqPlatformLlmConfig, "service_account">
848
+ >;
849
+
816
850
  /** Como terminou a extracao por LLM do detector. */
817
851
  export type CsqDetectorOutcome = "no_signal" | "ok" | "failed" | "skipped";
818
852
 
@@ -1220,3 +1254,45 @@ export interface ICsqLeadReport extends IFireDoc {
1220
1254
  * Ausente quando o detector esta `off` ou o laudo e anterior a F3. */
1221
1255
  detector?: ICsqDetectorReport;
1222
1256
  }
1257
+
1258
+ // ───────── Reavaliacao sob demanda (feat-280 F4) ─────────
1259
+
1260
+ /**
1261
+ * Pedido de reavaliacao (dry-run) do nex-mcp para o `hubia_csq_dry_run`.
1262
+ * Roda o pipeline com o juiz REAL e grava NADA (laudo, runs, BQ, evo_log do
1263
+ * pipeline, notificacao, rechecagem, `ticket.csq`).
1264
+ */
1265
+ export interface ICsqDryRunRequest {
1266
+ tenant: string;
1267
+ ticket_id: string;
1268
+ /** Canal evo-chat do ticket. Ausente = `channel_id` do laudo atual do lead. */
1269
+ channel_id?: string | null;
1270
+ /** Ausente = `lead_id` do ticket. */
1271
+ lead_id?: string | null;
1272
+ /** Conexao do juiz (`llm-connections/{id}`). Ausente = resolucao da producao. */
1273
+ connection_id?: string | null;
1274
+ /** Ignora a triagem sem LLM (`full_review` com motivo `forced`). Default true. */
1275
+ force_review?: boolean;
1276
+ /** Quem pediu (so log/auditoria do lado do hubia). */
1277
+ requested_by?: { login_id: string; client_id?: string | null } | null;
1278
+ }
1279
+
1280
+ /** Resposta do dry-run. `report` vem serializado (datas em ISO). */
1281
+ export interface ICsqDryRunResult {
1282
+ /** `CsqRunResult.outcome` do pipeline (ex.: `evaluated`, `skipped_*`). */
1283
+ outcome: string;
1284
+ detail: string | null;
1285
+ evaluation_id: string | null;
1286
+ lead_id: string | null;
1287
+ channel_id: string;
1288
+ /** Laudo capturado (NAO gravado); null quando o pipeline nao chegou a montar. */
1289
+ report: Record<string, unknown> | null;
1290
+ detector: ICsqDetectorReport | null;
1291
+ model: string | null;
1292
+ llm_provider: string | null;
1293
+ llm_connection_id: string | null;
1294
+ llm_connection_source: CsqLlmConnectionSource | null;
1295
+ triage_mode: CsqTriageMode | null;
1296
+ cost_usd_est: number | null;
1297
+ duration_ms: number;
1298
+ }
@@ -137,6 +137,28 @@ export interface INotificationAttachment {
137
137
  /** Conteúdo em base64. <= 64 KB já codificado. */
138
138
  content_base64: string;
139
139
  }
140
+ /**
141
+ * feat-254 B1 — anexo de e-mail por referência a um objeto já no storage.
142
+ *
143
+ * O front sobe o arquivo por `POST /media/upload` (hub-waba, devolve
144
+ * `gcs_uri`) e manda só a referência. O backend aceita apenas
145
+ * `gs://<bucket de mídia>/tenants/<tenant do envio>/...`, valida tipo/extensão
146
+ * contra a allowlist do e-mail (a mesma dos anexos recebidos) e aplica
147
+ * 10 arquivos, 10 MiB por arquivo e o total do canal. Falha vira envio
148
+ * `failed_final` com `attachment_invalid` ou `attachment_limit_exceeded`.
149
+ */
150
+ export interface INotificationAttachmentRef {
151
+ /** Nome apresentado ao destinatário; a extensão precisa casar com `content_type`. */
152
+ filename: string;
153
+ /** MIME da allowlist do e-mail. Ex.: 'application/pdf'. */
154
+ content_type: string;
155
+ /** Tamanho informado pelo front (o backend confere o tamanho real do objeto). */
156
+ size_bytes?: number;
157
+ /** `gs://<bucket>/tenants/<tenant>/...` devolvido pelo upload de mídia. */
158
+ gcs_uri: string;
159
+ }
160
+ /** Item de `attachments[]` do envio: inline legado OU referência (discriminado por `gcs_uri`). */
161
+ export type INotificationAttachmentInput = INotificationAttachment | INotificationAttachmentRef;
140
162
  /** Campos compartilhados pelo conteúdo de email novo e de resposta. */
141
163
  interface INotificationEmailContentBase {
142
164
  /** Versões textuais do corpo livre. */
@@ -185,9 +207,11 @@ export interface INotificationSendPayload {
185
207
  quick_reply_actions?: IQuickReplyActionIntent[];
186
208
  /**
187
209
  * Anexos (feat-160 R6 / F31). Honrado SÓ no canal de e-mail; ignorado pelos
188
- * demais providers. 1 anexo, <= 64 KB em base64 — ver `INotificationAttachment`.
210
+ * demais providers. Inline: 1 anexo, <= 64 KB em base64 — ver
211
+ * `INotificationAttachment`. feat-254 B1: no e-mail, até 10 itens por
212
+ * referência (`INotificationAttachmentRef`, 10 MiB cada, total do canal).
189
213
  */
190
- attachments?: INotificationAttachment[];
214
+ attachments?: INotificationAttachmentInput[];
191
215
  routine?: {
192
216
  id: string;
193
217
  version?: number | string;
@@ -222,6 +222,30 @@ export interface INotificationAttachment {
222
222
  content_base64: string;
223
223
  }
224
224
 
225
+ /**
226
+ * feat-254 B1 — anexo de e-mail por referência a um objeto já no storage.
227
+ *
228
+ * O front sobe o arquivo por `POST /media/upload` (hub-waba, devolve
229
+ * `gcs_uri`) e manda só a referência. O backend aceita apenas
230
+ * `gs://<bucket de mídia>/tenants/<tenant do envio>/...`, valida tipo/extensão
231
+ * contra a allowlist do e-mail (a mesma dos anexos recebidos) e aplica
232
+ * 10 arquivos, 10 MiB por arquivo e o total do canal. Falha vira envio
233
+ * `failed_final` com `attachment_invalid` ou `attachment_limit_exceeded`.
234
+ */
235
+ export interface INotificationAttachmentRef {
236
+ /** Nome apresentado ao destinatário; a extensão precisa casar com `content_type`. */
237
+ filename: string;
238
+ /** MIME da allowlist do e-mail. Ex.: 'application/pdf'. */
239
+ content_type: string;
240
+ /** Tamanho informado pelo front (o backend confere o tamanho real do objeto). */
241
+ size_bytes?: number;
242
+ /** `gs://<bucket>/tenants/<tenant>/...` devolvido pelo upload de mídia. */
243
+ gcs_uri: string;
244
+ }
245
+
246
+ /** Item de `attachments[]` do envio: inline legado OU referência (discriminado por `gcs_uri`). */
247
+ export type INotificationAttachmentInput = INotificationAttachment | INotificationAttachmentRef;
248
+
225
249
  /** Campos compartilhados pelo conteúdo de email novo e de resposta. */
226
250
  interface INotificationEmailContentBase {
227
251
  /** Versões textuais do corpo livre. */
@@ -285,9 +309,11 @@ export interface INotificationSendPayload {
285
309
 
286
310
  /**
287
311
  * Anexos (feat-160 R6 / F31). Honrado SÓ no canal de e-mail; ignorado pelos
288
- * demais providers. 1 anexo, <= 64 KB em base64 — ver `INotificationAttachment`.
312
+ * demais providers. Inline: 1 anexo, <= 64 KB em base64 — ver
313
+ * `INotificationAttachment`. feat-254 B1: no e-mail, até 10 itens por
314
+ * referência (`INotificationAttachmentRef`, 10 MiB cada, total do canal).
289
315
  */
290
- attachments?: INotificationAttachment[];
316
+ attachments?: INotificationAttachmentInput[];
291
317
 
292
318
  // Optional business context
293
319
  routine?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evo360-types",
3
- "version": "1.3.709",
3
+ "version": "1.3.713",
4
4
  "description": "HREVO360 Shared Types",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",