rapida-partner 3.6.0 → 3.7.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": "3.6.0",
3
+ "version": "3.7.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "index.ts",
6
6
  "files": [
@@ -39,7 +39,15 @@ export interface IAiAgentConfig {
39
39
  // request but does not process incoming messages yet. Prefer
40
40
  // "whatsapp"/"telegram" until it is implemented.
41
41
  messengers: ("whatsapp" | "instagram" | "telegram")[];
42
+ // The provider key comes from the project integrations, always with
43
+ // service "chat": deepseekIntegration, geminiIntegration or
44
+ // openaiIntegration. The code generator warns when it is missing (the
45
+ // generated .env would ship an empty key).
42
46
  aiProvider: "deepseek" | "gemini" | "openai";
47
+ // Model name sent to the provider. Known values (the generator warns on
48
+ // anything else): deepseek → "deepseek-chat", "deepseek-reasoner";
49
+ // gemini → "gemini-2.0-flash", "gemini-2.5-flash", "gemini-2.5-pro";
50
+ // openai → "gpt-4o-mini", "gpt-4o", "gpt-4.1-mini", "gpt-4.1".
43
51
  model: string;
44
52
  };
45
53
 
@@ -70,6 +78,12 @@ export interface IAiAgentConfig {
70
78
  // generic required "id" tool parameter — do not add your own id/_id
71
79
  // entry to formFields, it will create a duplicate, unused parameter.
72
80
  //
81
+ // Besides the fixed tools, the agent itself stores and reads the
82
+ // conversation history at /whatsapp-chat-histories: some module of the
83
+ // project (or of targetBackendDefinitionFile) must expose that endpoint —
84
+ // usually whatsappModule from rapida-projects. Code generation fails
85
+ // without it.
86
+ //
73
87
  // The target backend also needs a dedicated user account for the bot to
74
88
  // authenticate against (see botCredentials below) — this is separate from
75
89
  // flows.invitation.mainUserEmail and must be provisioned manually on the
@@ -100,7 +114,9 @@ export interface IAiAgentConfig {
100
114
  };
101
115
 
102
116
  // Optional limits for incoming audio messages (transcribed through the
103
- // project's openaiIntegration with service "transcription").
117
+ // project's openaiIntegration with service "transcription"). Without that
118
+ // key audio stays off: the agent answers that it cannot process audio, and
119
+ // the code generator warns.
104
120
  audio?: {
105
121
  // Longer audios are rejected before download/transcription.
106
122
  // Defaults to 300.
@@ -64,6 +64,13 @@ export interface IProject {
64
64
  apiKey: string;
65
65
  service: "embedding" | "chat" | "custom" | "cost";
66
66
  }[];
67
+ // Chave do Gemini (Google AI). Hoje só o agente de IA usa, quando
68
+ // aiAgentConfig.infrastructure.aiProvider é "gemini" (GEMINI_API_KEY do
69
+ // .env gerado).
70
+ geminiIntegration?: {
71
+ apiKey: string;
72
+ service: "chat";
73
+ }[];
67
74
  openaiIntegration?: {
68
75
  apiKey: string;
69
76
  // "transcription": speech-to-text (Whisper) used by aiAgent projects to
@@ -17,6 +17,11 @@ export interface IStoreOrdersModuleOptions {
17
17
 
18
18
  const ENTITY = "storeOrders";
19
19
 
20
+ // Um pedido por storeOrderId em cada workspace. Fica no contrato interno do
21
+ // form, de onde o gerador cria o índice único, e não no público: o reenvio do
22
+ // mesmo pedido pela loja é recusado em vez de duplicar.
23
+ const UNIQUE_STORE_ORDER = [{ identificator: "storeOrderIdPerWorkspace", fields: ["storeOrderId"] }];
24
+
20
25
  export const getStoreOrderForm = (options: IStoreOrdersModuleOptions = {}): IForm => ({
21
26
  componentType: "form",
22
27
  id: "storeOrderForm",
@@ -39,7 +44,7 @@ export const getStoreOrderForm = (options: IStoreOrdersModuleOptions = {}): IFor
39
44
  id: ENTITY,
40
45
  endpoint: STORE_ORDERS_ENDPOINT,
41
46
  actions: ["get", "getById", "update"],
42
- request: { entity: ENTITY, fields: [] },
47
+ request: { entity: ENTITY, fields: [], uniqueConstraints: UNIQUE_STORE_ORDER },
43
48
  },
44
49
  ],
45
50
  publicContracts: [
@@ -49,11 +54,7 @@ export const getStoreOrderForm = (options: IStoreOrdersModuleOptions = {}): IFor
49
54
  actions: ["create", "get", "update"],
50
55
  access: options.publicAccess ?? "trustedCallers",
51
56
  ...(options.allowedOrigins ? { allowedOrigins: options.allowedOrigins } : {}),
52
- request: {
53
- entity: ENTITY,
54
- fields: [],
55
- uniqueConstraints: [{ identificator: "storeOrderIdPerWorkspace", fields: ["storeOrderId"] }],
56
- },
57
+ request: { entity: ENTITY, fields: [] },
57
58
  },
58
59
  ],
59
60
  });
@@ -112,6 +112,23 @@
112
112
  "required": ["apiKey", "service"]
113
113
  }
114
114
  },
115
+ "geminiIntegration": {
116
+ "type": "array",
117
+ "items": {
118
+ "type": "object",
119
+ "properties": {
120
+ "apiKey": {
121
+ "type": "string"
122
+ },
123
+ "service": {
124
+ "type": "string",
125
+ "enum": ["chat"]
126
+ }
127
+ },
128
+ "required": ["apiKey", "service"],
129
+ "additionalProperties": false
130
+ }
131
+ },
115
132
  "openaiIntegration": {
116
133
  "type": "array",
117
134
  "items": {