rapida-partner 6.1.1 → 7.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapida-partner",
3
- "version": "6.1.1",
3
+ "version": "7.1.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "index.ts",
6
6
  "files": [
@@ -6,125 +6,122 @@ export type TAgentSchemaType =
6
6
  | "array"
7
7
  | "object";
8
8
 
9
+ // Agente de IA (Kunlatalk) do projeto: persona, canal, motor, o que ele pode
10
+ // fazer no backend e rotinas. O gerador cria o agente sempre que este bloco
11
+ // existe, em qualquer skeleton (IProject.aiAgentConfig).
9
12
  export interface IAiAgentConfig {
10
13
  agentIdentity: {
11
14
  name: string;
12
15
 
13
- // LITERAL markdown content of the system prompt — NOT a file path.
14
- // Example: "## Identidade\n\nVocê é a ...". When non-empty it is
15
- // written verbatim to prompts/system.template.md. When empty (""), the
16
- // code generator emits a default prompt scaffold including a tools
17
- // table built from the active fixed tools and the exposedContracts.
16
+ // Conteúdo LITERAL do system prompt em markdown, não um caminho de
17
+ // arquivo. Exemplo: "## Identidade\n\nVocê é a ...". Preenchido, vai tal
18
+ // qual para prompts/system.template.md. Vazio (""), o gerador monta um
19
+ // prompt padrão com a tabela das tools fixas ativas e de exposedContracts.
18
20
  //
19
- // Placeholders (plain text, not JS interpolation):
20
- // - {{ASSISTANT_NAME}}: agentIdentity.name, replaced at runtime;
21
- // - {{CURRENT_DATE}}: current date/time (pt-BR), replaced at runtime;
22
- // - {{USER_NAME}}: the user's name from the session, replaced at runtime;
23
- // - {{TOOLS_TABLE}}: replaced at generation time by the table of the
24
- // tools actually generated (active fixed tools + exposedContracts).
25
- // Prefer it over a hand-written tool list, which goes stale silently.
26
- // The generator warns when a literal prompt cites a tool that does not
27
- // exist, or (without {{TOOLS_TABLE}}) omits a generated tool.
21
+ // Placeholders (texto simples, não interpolação JS):
22
+ // - {{ASSISTANT_NAME}}: agentIdentity.name, trocado em runtime;
23
+ // - {{CURRENT_DATE}}: data e hora atuais (pt-BR), trocado em runtime;
24
+ // - {{USER_NAME}}: nome do usuário na sessão, trocado em runtime;
25
+ // - {{TOOLS_TABLE}}: trocado na geração pela tabela das tools realmente
26
+ // geradas (fixas ativas + exposedContracts). Prefira a uma lista
27
+ // escrita à mão, que fica desatualizada sem aviso.
28
+ // O gerador avisa quando um prompt literal cita uma tool que não existe
29
+ // ou, sem {{TOOLS_TABLE}}, deixa de citar uma tool gerada.
28
30
  systemPromptTemplate: string;
29
31
 
30
- // Relative path (inside the generated agent) where the knowledge
31
- // base markdown file is written and read from. Defaults to
32
- // "data/knowledge.md".
32
+ // Caminho relativo (dentro do agente gerado) do arquivo markdown da base
33
+ // de conhecimento. Padrão: "data/knowledge.md".
33
34
  knowledgeBaseFile?: string;
34
35
 
35
- // Optional brand/company name used by the default prompt scaffold.
36
- // Falls back to the project title when omitted.
36
+ // Nome da marca/empresa usado pelo prompt padrão. Sem ele, vale o título
37
+ // do projeto.
37
38
  companyName?: string;
38
39
 
39
- // Optional mission statement used by the default prompt scaffold.
40
+ // Missão usada pelo prompt padrão.
40
41
  mission?: string;
41
42
 
42
- // Optional initial content for the knowledge base file. When
43
- // omitted, a fill-in skeleton is generated.
43
+ // Conteúdo inicial da base de conhecimento. Sem ele, sai um esqueleto
44
+ // para preencher.
44
45
  knowledgeBaseContent?: string;
45
46
  };
46
47
 
47
48
  infrastructure: {
48
- // At least one. "whatsapp" uses backend[].whatsapp (Meta Cloud API);
49
- // "telegram" uses backend[].telegram.telegramBotToken and is not yet
50
- // validated in a real conversation.
49
+ // Ao menos um. "whatsapp" usa backend[].aiAgentWhatsapp (Meta Cloud API);
50
+ // "telegram" usa backend[].telegram.telegramBotToken e ainda não foi
51
+ // validado em conversa real.
51
52
  messengers: ("whatsapp" | "telegram")[];
52
- // The provider key comes from the project integrations, always with
53
- // service "chat": deepseekIntegration, geminiIntegration or
54
- // openaiIntegration. The code generator warns when it is missing (the
55
- // generated .env would ship an empty key).
53
+ // A chave do provedor vem das integrações do projeto, sempre com
54
+ // service "chat": deepseekIntegration, geminiIntegration ou
55
+ // openaiIntegration. Sem ela a geração falha.
56
56
  aiProvider: "deepseek" | "gemini" | "openai";
57
- // Model name sent to the provider. Known values (the generator warns on
58
- // anything else): deepseek → "deepseek-chat", "deepseek-reasoner";
57
+ // Nome do modelo enviado ao provedor. Valores conhecidos (o gerador
58
+ // avisa para outros): deepseek → "deepseek-chat", "deepseek-reasoner";
59
59
  // gemini → "gemini-2.0-flash", "gemini-2.5-flash", "gemini-2.5-pro";
60
60
  // openai → "gpt-4o-mini", "gpt-4o", "gpt-4.1-mini", "gpt-4.1".
61
61
  model: string;
62
62
  };
63
63
 
64
64
  businessContext: {
65
- // Not used by the code generator today (kept only for compatibility).
66
- // Contracts come from this project's modules and, optionally, from
67
- // targetBackendDefinitionFile.
68
- targetBackendProjectId?: string;
69
-
70
- // Optional path to an ALREADY COMPILED rapidaObject.json of the target
71
- // backend project (NOT the .ts source — the loader parses it as JSON),
72
- // resolved relative to the directory of this agent's own
73
- // rapidaObject.json. When provided, the code generator loads this file
74
- // and resolves contract bindings against it in addition to the current
75
- // project. When omitted, contracts are resolved only from the current
76
- // project's modules — the simplest and only end-to-end tested setup
77
- // today is embedding the same modules directly in this project (see
78
- // katia.ts), rather than pointing at an external compiled file.
79
- targetBackendDefinitionFile?: string;
65
+ // Backend em OUTRO projeto Rapida (ex.: um ERP separado). Sem ele, o
66
+ // agente conversa com o backend do próprio projeto (backend[] e modules).
67
+ // Com ele, o agente chama só o backend alvo:
68
+ // - definitionFile: rapidaObject.json JÁ COMPILADO do projeto alvo (não o
69
+ // .ts), relativo ao diretório do rapidaObject.json deste agente.
70
+ // Contratos, endpoints das tools fixas e histórico vêm só dele.
71
+ // - baseUrl: URL do backend alvo (com ou sem /api/v1), gravada em
72
+ // BOT_API_BASE_URL.
73
+ // O usuário do bot (botCredentials) precisa existir no backend alvo: o
74
+ // backend deste projeto não o cria quando há targetBackend.
75
+ targetBackend?: {
76
+ definitionFile: string;
77
+ baseUrl: string;
78
+ };
80
79
 
81
- // exposedContracts only covers *additional* domain actions. The agent
82
- // ships fixed tools according to `capabilities` (identity → /people,
83
- // scheduling → /appointments and /availability-schedules, knowledge base,
84
- // media) plus the handoff tool when humanHandoff has contacts. Their names
85
- // are reserved — a binding with one of them fails code generation, as does
86
- // a toolName repeated between bindings: cadastrar_usuario,
87
- // atualizar_status_usuario, atualizar_telefone_usuario,
80
+ // exposedContracts cobre só as ações de domínio *adicionais*. O agente
81
+ // traz tools fixas conforme `capabilities` (identity → /people,
82
+ // scheduling → /appointments e /availability-schedules, base de
83
+ // conhecimento, mídia) e a tool de escalada quando humanHandoff tem
84
+ // contatos. Os nomes são reservados — um binding com um deles falha a
85
+ // geração, assim como um toolName repetido entre bindings:
86
+ // cadastrar_usuario, atualizar_status_usuario, atualizar_telefone_usuario,
88
87
  // atualizar_email_usuario, atualizar_genero_usuario,
89
88
  // checar_disponibilidade, criar_evento, meus_agendamentos,
90
89
  // cancelar_agendamento, consultar_base_conhecimento, mostrar_imagem,
91
- // escalar_para_humano. Also note: for "update"/"getById"/
92
- // "softDelete"/"hardDelete" actions the generator already injects a
93
- // generic required "id" tool parameter — do not add your own id/_id
94
- // entry to formFields, it will create a duplicate, unused parameter.
90
+ // escalar_para_humano. Nas ações "update"/"getById"/"softDelete"/
91
+ // "hardDelete" o gerador já injeta o parâmetro obrigatório "id" (descrito
92
+ // por idPrompt): não repita id/_id em formFields.
95
93
  //
96
- // Besides the fixed tools, the agent itself stores and reads the
97
- // conversation history at /whatsapp-chat-histories: some module of the
98
- // project (or of targetBackendDefinitionFile) must expose that endpoint —
99
- // usually whatsappModule from rapida-projects. Code generation fails
100
- // without it.
94
+ // Além das tools fixas, o próprio agente grava e lê o histórico de
95
+ // conversa em /whatsapp-chat-histories: algum módulo do projeto (ou do
96
+ // targetBackend) precisa expor esse endpoint — normalmente o
97
+ // whatsappModule do rapida-projects. Sem ele a geração falha.
101
98
  //
102
- // The agent authenticates on the backend with a dedicated service user
103
- // (botCredentials below), separate from flows.invitation.mainUserEmail.
99
+ // O agente se autentica no backend com um usuário de serviço próprio
100
+ // (botCredentials, abaixo), separado de flows.invitation.mainUserEmail.
104
101
  exposedContracts: IAgentContractBinding[];
105
102
 
106
- // Credentials of the agent's service user (BOT_API_EMAIL/BOT_API_PASSWORD
107
- // in the generated agent and backend .env). The generated Nest backend
108
- // creates this user on startup — idempotently, aligning the password with
109
- // the .env — inside the workspace of flows.invitation.mainUserEmail, with
110
- // an "aiAgent" role limited to the entities the agent's tools use. Import
111
- // the values from constants/secrets — never write them literally.
103
+ // Credenciais do usuário de serviço do agente (BOT_API_EMAIL/
104
+ // BOT_API_PASSWORD no .env do agente e do backend). O backend Nest gerado
105
+ // cria esse usuário ao subir — de forma idempotente, alinhando a senha com
106
+ // o .env — no workspace de flows.invitation.mainUserEmail, com o papel
107
+ // "aiAgent" limitado às entidades que as tools usam. Importe os valores
108
+ // de constants/secrets; nunca escreva literalmente.
112
109
  botCredentials: {
113
110
  email: string;
114
111
  password: string;
115
112
  };
116
113
  };
117
114
 
118
- // Groups of fixed tools the agent ships. Each one defaults to true when
119
- // omitted, so leaving the block out keeps every fixed tool. A disabled
120
- // group is not generated, not offered to the LLM, left out of the default
121
- // prompt and of the endpoint check.
122
- // - identity: cadastrar_usuario and atualizar_*_usuario (/people), plus
123
- // recognizing a returning user by WhatsApp id;
115
+ // Grupos de tools fixas do agente. Cada um vale true quando omitido; sem o
116
+ // bloco, todas as tools fixas são geradas. Um grupo desligado não é
117
+ // gerado, não é oferecido ao LLM e sai do prompt padrão e da conferência
118
+ // de endpoints.
119
+ // - identity: cadastrar_usuario e atualizar_*_usuario (/people), e o
120
+ // reconhecimento de quem volta a falar pelo id do WhatsApp;
124
121
  // - scheduling: checar_disponibilidade, criar_evento, meus_agendamentos,
125
- // cancelar_agendamento (/appointments, /availability-schedules) and the
126
- // appointment reminder job (needs identity);
127
- // - knowledgeBase: consultar_base_conhecimento and the knowledge file;
122
+ // cancelar_agendamento (/appointments, /availability-schedules) e o
123
+ // lembrete de agendamento (precisa de identity);
124
+ // - knowledgeBase: consultar_base_conhecimento e o arquivo da base;
128
125
  // - media: mostrar_imagem.
129
126
  capabilities?: {
130
127
  identity?: boolean;
@@ -133,67 +130,62 @@ export interface IAiAgentConfig {
133
130
  media?: boolean;
134
131
  };
135
132
 
136
- // Optional human handoff: when present with at least one contact, the
137
- // code generator adds a fixed tool ("escalar_para_humano") that sends a
138
- // WhatsApp text message (summary generated by the LLM itself + the name/
139
- // contact of who it was talking to, taken from the current session —
140
- // never asked as a tool argument, to avoid the LLM guessing/inventing a
141
- // phone number) to one of the configured contacts' whatsappPhoneNumber.
142
- // The agent keeps responding the original user normally after the
143
- // handoff — this is a parallel notification to a human, not a channel
144
- // switch/handover of the conversation itself. The notification always goes
145
- // through the WhatsApp messenger (it must be active), whatever channel the
146
- // conversation came from. Meta only delivers it if the contact messaged the
147
- // agent's number in the last 24 h (same rule as the reminder; a template is
148
- // not supported here yet).
133
+ // Escalada para humano: com ao menos um contato, o gerador acrescenta a
134
+ // tool fixa "escalar_para_humano", que manda uma mensagem de texto no
135
+ // WhatsApp (resumo escrito pelo LLM + nome e contato de quem estava na
136
+ // conversa, tirados da sessão — nunca pedidos como argumento, para o LLM
137
+ // não inventar telefone) para o whatsappPhoneNumber do contato escolhido.
138
+ // O agente continua atendendo normalmente: é um aviso paralelo a uma
139
+ // pessoa, não uma passagem da conversa. O aviso sai sempre pelo mensageiro
140
+ // WhatsApp (que precisa estar ativo), qualquer que seja o canal da
141
+ // conversa. A Meta só entrega se o contato tiver escrito para o número do
142
+ // agente nas últimas 24 h (mesma regra do lembrete; modelo aprovado ainda
143
+ // não é suportado aqui).
149
144
  humanHandoff?: {
150
145
  contacts: IHumanHandoffContact[];
151
146
  };
152
147
 
153
- // Optional limits for incoming audio messages (transcribed through the
154
- // project's openaiIntegration with service "transcription"). Without that
155
- // key audio stays off: the agent answers that it cannot process audio, and
156
- // the code generator warns.
148
+ // Limites para áudios recebidos (transcritos pela openaiIntegration do
149
+ // projeto com service "transcription"). Sem essa chave o áudio fica
150
+ // desligado: o agente responde que não consegue processar áudios, e o
151
+ // gerador avisa.
157
152
  audio?: {
158
- // Longer audios are rejected before download/transcription.
159
- // Defaults to 300.
153
+ // Áudios mais longos são recusados antes do download e da transcrição.
154
+ // Padrão: 300.
160
155
  maxDurationSeconds?: number;
161
- // Minimum interval between two audios from the same user.
162
- // Defaults to 10.
156
+ // Intervalo mínimo entre dois áudios do mesmo usuário. Padrão: 10.
163
157
  rateLimitIntervalSeconds?: number;
164
158
  };
165
159
 
166
- // Optional background jobs configuration. Values become the generated
167
- // defaults of the agent's job services and can still be overridden at
168
- // runtime through config/rules.json.
160
+ // Rotinas em segundo plano. Os valores viram os padrões do agente gerado e
161
+ // ainda podem ser trocados em runtime por config/rules.json.
169
162
  jobs?: {
170
- // Appointment reminder sent through WhatsApp. Frequency and timezone live
171
- // in IBackend.scheduledJobs (id "aiAgentAppointmentReminder"), per
172
- // environment; the timezone is also the one appointment times are stored
173
- // in.
163
+ // Lembrete de agendamento pelo WhatsApp. Frequência e fuso ficam em
164
+ // IBackend.scheduledJobs (id "aiAgentAppointmentReminder"), por ambiente;
165
+ // o fuso também é o dos horários gravados nos agendamentos.
174
166
  reminder?: {
175
- // Defaults to true. The reminder job is only generated when the
176
- // whatsapp messenger is active.
167
+ // Padrão: true. O lembrete só é gerado com o mensageiro whatsapp e
168
+ // capabilities.scheduling.
177
169
  enabled?: boolean;
178
- // How many minutes ahead of the appointment the reminder fires.
179
- // Defaults to 1440 (24 hours).
170
+ // Quantos minutos antes do agendamento o lembrete sai. Padrão: 1440
171
+ // (24 horas).
180
172
  minutesAhead?: number;
181
- // Who gets the reminder: the person who booked ("client",
182
- // appointment.personId) and/or the professional ("professional",
183
- // first of appointment.involvedPeopleId). Defaults to both.
173
+ // Quem recebe: quem agendou ("client", appointment.personId) e/ou o
174
+ // profissional ("professional", o primeiro de
175
+ // appointment.involvedPeopleId). Padrão: os dois.
184
176
  recipients?: TAppointmentReminderRecipient[];
185
- // WhatsApp message templates approved in Meta's WhatsApp Manager, one
186
- // per recipient. Meta only delivers free text up to 24 h after the
187
- // recipient's last message to this number; outside that window only an
188
- // approved template is delivered. Without a template the agent sends
189
- // free text (and the code generator warns).
177
+ // Modelos de mensagem aprovados no WhatsApp Manager da Meta, um por
178
+ // destinatário. A Meta só entrega texto livre até 24 h depois da
179
+ // última mensagem do destinatário para este número; fora dessa janela,
180
+ // só modelo aprovado. Sem modelo, o agente manda texto livre (e o
181
+ // gerador avisa).
190
182
  whatsappTemplates?: {
191
- // Body parameters, in order: {{1}} client name, {{2}} date
192
- // (dd/mm/aaaa), {{3}} time (HH:mm), {{4}} professional name.
183
+ // Parâmetros do corpo, em ordem: {{1}} nome do cliente, {{2}} data
184
+ // (dd/mm/aaaa), {{3}} hora (HH:mm), {{4}} nome do profissional.
193
185
  client?: IWhatsappMessageTemplate;
194
- // Body parameters, in order: {{1}} professional name, {{2}} date
195
- // (dd/mm/aaaa), {{3}} time (HH:mm), {{4}} client name, {{5}} client
196
- // phone.
186
+ // Parâmetros do corpo, em ordem: {{1}} nome do profissional, {{2}}
187
+ // data (dd/mm/aaaa), {{3}} hora (HH:mm), {{4}} nome do cliente, {{5}}
188
+ // telefone do cliente.
197
189
  professional?: IWhatsappMessageTemplate;
198
190
  };
199
191
  };
@@ -203,9 +195,9 @@ export interface IAiAgentConfig {
203
195
  export type TAppointmentReminderRecipient = "client" | "professional";
204
196
 
205
197
  export interface IWhatsappMessageTemplate {
206
- // Template name exactly as approved in WhatsApp Manager.
198
+ // Nome do modelo exatamente como aprovado no WhatsApp Manager.
207
199
  name: string;
208
- // Template language code. Defaults to "pt_BR".
200
+ // Código de idioma do modelo. Padrão: "pt_BR".
209
201
  languageCode?: string;
210
202
  }
211
203
 
@@ -214,13 +206,14 @@ export interface IAgentContractBinding {
214
206
 
215
207
  toolName: string;
216
208
 
217
- // Text the LLM reads to decide when to call this tool. Takes precedence
218
- // over the contract's userStory; the generator warns when neither exists.
209
+ // Texto que o LLM lê para decidir quando chamar a tool. Tem precedência
210
+ // sobre o userStory do contrato; o gerador avisa quando não há nenhum dos
211
+ // dois.
219
212
  description?: string;
220
213
 
221
- // For getById/update/softDelete/hardDelete: where the LLM gets the record
222
- // id from (e.g. "use o id retornado por consultar_reserva, nunca o CPF").
223
- // Without it the tool only says "Identificador único do registro alvo".
214
+ // Em getById/update/softDelete/hardDelete: de onde o LLM tira o id do
215
+ // registro (ex.: "use o id retornado por consultar_reserva, nunca o CPF").
216
+ // Sem ele, a tool só diz "Identificador único do registro alvo".
224
217
  idPrompt?: string;
225
218
 
226
219
  action: "create" | "get" | "getById" | "update" | "softDelete" | "hardDelete";
@@ -233,10 +226,9 @@ export interface IAgentContractBinding {
233
226
 
234
227
  validationHint?: string;
235
228
 
236
- // Optional explicit JSON-Schema type for the generated tool
237
- // parameter. When provided it takes precedence over the code
238
- // generator's defensive EDataType-to-schema mapping, making the
239
- // tool parameter typing independent from the enum values.
229
+ // Tipo JSON Schema explícito do parâmetro gerado. Tem precedência
230
+ // sobre o mapeamento defensivo de EDataType feito pelo gerador, e
231
+ // deixa a tipagem do parâmetro independente dos valores do enum.
240
232
  schemaType?: TAgentSchemaType;
241
233
  }[];
242
234
 
@@ -250,18 +242,17 @@ export interface IAgentContractBinding {
250
242
  }
251
243
 
252
244
  export interface IHumanHandoffContact {
253
- // Human-readable identifier the LLM uses to pick this contact
254
- // (e.g. "Júlia"). Must be unique within humanHandoff.contacts.
245
+ // Nome que o LLM usa para escolher o contato (ex.: "Júlia"). Único dentro
246
+ // de humanHandoff.contacts.
255
247
  name: string;
256
248
 
257
- // Free text describing when/why this contact should receive the
258
- // handoff (e.g. "fecha reservas quando o hóspede confirma uma data
259
- // disponível"). The LLM matches the escalation reason against this
260
- // text to pick the right contact — same spirit as triggerKeywords
261
- // above, not a fixed enum of categories.
249
+ // Texto livre dizendo quando/por que este contato recebe a escalada (ex.:
250
+ // "fecha reservas quando o hóspede confirma uma data disponível"). O LLM
251
+ // compara o motivo da escalada com este texto para escolher o contato —
252
+ // mesmo espírito de triggerKeywords, não uma lista fixa de categorias.
262
253
  useCase: string;
263
254
 
264
- // E.164 phone number (e.g. "+558296539080") that receives the
265
- // WhatsApp text message on handoff. Validated by the schema.
255
+ // Telefone em E.164 (ex.: "+558296539080") que recebe a mensagem de
256
+ // escalada no WhatsApp. Validado pelo schema.
266
257
  whatsappPhoneNumber: string;
267
258
  }
@@ -160,7 +160,15 @@ export interface IBackend {
160
160
  trustedCallers?: ITrustedCaller[];
161
161
  storage?: IStorage;
162
162
  logging?: ILogging;
163
+ // Liga os fluxos de WhatsApp do backend Nest (webhooks, envio, grupos,
164
+ // permissão whatsapp-flows) e o monitoramento de custo. Não use para o
165
+ // agente de IA: as credenciais dele vão em aiAgentWhatsapp.
163
166
  whatsapp?: IWhatsapp;
167
+ // Credenciais do WhatsApp que o agente de IA usa (aiAgentConfig com o
168
+ // mensageiro "whatsapp"). Não geram os fluxos de WhatsApp do backend, só o
169
+ // monitoramento de custo. Sem este campo, o agente ainda lê backend.whatsapp
170
+ // (com aviso), o que também liga os fluxos do backend.
171
+ aiAgentWhatsapp?: IWhatsapp;
164
172
  // Só para o agente de IA com o mensageiro "telegram"
165
173
  // (aiAgentConfig.infrastructure.messengers). Vai para TELEGRAM_BOT_TOKEN do
166
174
  // .env do agente; o backend Nest não usa.
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "systemPromptTemplate": {
13
13
  "type": "string",
14
- "description": "Literal markdown content of the system prompt (NOT a file path). Empty string triggers the generator's default prompt scaffold."
14
+ "description": "Conteúdo literal do system prompt em markdown (não um caminho de arquivo). Vazio, o gerador monta o prompt padrão."
15
15
  },
16
16
  "knowledgeBaseFile": {
17
17
  "type": "string"
@@ -55,12 +55,15 @@
55
55
  "businessContext": {
56
56
  "type": "object",
57
57
  "properties": {
58
- "targetBackendProjectId": {
59
- "type": "string"
60
- },
61
- "targetBackendDefinitionFile": {
62
- "type": "string",
63
- "description": "Path to an ALREADY COMPILED rapidaObject.json of the target backend (not the .ts source), resolved relative to the directory of this agent's own rapidaObject.json."
58
+ "targetBackend": {
59
+ "type": "object",
60
+ "description": "Backend em outro projeto Rapida: rapidaObject.json compilado (relativo ao rapidaObject.json deste agente) e a URL dele.",
61
+ "properties": {
62
+ "definitionFile": { "type": "string", "minLength": 1 },
63
+ "baseUrl": { "type": "string", "minLength": 1 }
64
+ },
65
+ "required": ["definitionFile", "baseUrl"],
66
+ "additionalProperties": false
64
67
  },
65
68
  "exposedContracts": {
66
69
  "type": "array",
@@ -155,7 +158,7 @@
155
158
  },
156
159
  "botCredentials": {
157
160
  "type": "object",
158
- "description": "Credentials of the dedicated bot user on the target backend (BOT_API_EMAIL/BOT_API_PASSWORD in the generated agent .env).",
161
+ "description": "Usuário de serviço do agente (BOT_API_EMAIL/BOT_API_PASSWORD no .env do agente e do backend); o backend gerado cria esse usuário ao subir.",
159
162
  "properties": {
160
163
  "email": {
161
164
  "type": "string",
@@ -89,6 +89,17 @@
89
89
  "whatsappVerifyToken": { "type": "string" }
90
90
  }
91
91
  },
92
+ "aiAgentWhatsapp": {
93
+ "type": "object",
94
+ "properties": {
95
+ "whatsappToken": { "type": "string" },
96
+ "whatsappPhoneNumberId": { "type": "string" },
97
+ "whatsappVerifyToken": { "type": "string" },
98
+ "whatsappBusinessAccountId": { "type": "string" },
99
+ "whatsappAppSecret": { "type": "string" }
100
+ },
101
+ "required": ["whatsappToken", "whatsappPhoneNumberId", "whatsappVerifyToken"]
102
+ },
92
103
  "telegram": {
93
104
  "type": "object",
94
105
  "properties": {