plazbot-cli 0.3.5 → 0.3.7

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.
@@ -9,7 +9,11 @@
9
9
  "Bash(npm run build:*)",
10
10
  "Bash(node /Users/kristian/Source/plazbot-v2/Plazbot-CLI-v2.0/dist/cli.js:*)",
11
11
  "Bash(npm ls:*)",
12
- "Bash(python3:*)"
12
+ "Bash(python3:*)",
13
+ "WebFetch(domain:www.plazbot.com)",
14
+ "Bash(npx tsc:*)",
15
+ "Bash(ls:*)",
16
+ "Bash(xargs:*)"
13
17
  ]
14
18
  }
15
19
  }
@@ -13,7 +13,7 @@ const VALID_AGENT_FIELDS = new Set([
13
13
  'name', 'description', 'prompt', 'zone', 'timezone', 'buffer',
14
14
  'color', 'question', 'enable', 'tags', 'showInChat',
15
15
  'instructions', 'person', 'fallbacks', 'rules',
16
- 'examples', 'channels', 'services', 'actions',
16
+ 'examples', 'channels', 'services', 'actions', 'variables',
17
17
  'useToolCalling', 'customAIConfig', 'aiProviders',
18
18
  'responseMode', 'batchWaitSeconds',
19
19
  'enableWidget', 'enableWhatsappWidget', 'urlWhatsappWidget',
@@ -29,7 +29,7 @@ const STRING_FIELDS = new Set([
29
29
  ]);
30
30
  // Campos que el schema espera como array (no pueden ser null)
31
31
  const ARRAY_FIELDS = new Set([
32
- 'tags', 'examples', 'channels', 'services', 'actions', 'aiProviders',
32
+ 'tags', 'examples', 'channels', 'services', 'actions', 'aiProviders', 'variables',
33
33
  ]);
34
34
  function cleanRequiredFields(fields) {
35
35
  if (!fields || !Array.isArray(fields))
@@ -117,6 +117,26 @@ function cleanActions(actions) {
117
117
  return clean;
118
118
  });
119
119
  }
120
+ function cleanVariables(variables) {
121
+ if (!variables || !Array.isArray(variables))
122
+ return [];
123
+ return variables
124
+ .filter((v) => v && v.code && v.name && v.type)
125
+ .map((v) => {
126
+ const clean = {
127
+ code: v.code,
128
+ name: v.name,
129
+ type: v.type,
130
+ };
131
+ if (v.defaultValue !== undefined && v.defaultValue !== null && v.defaultValue !== '') {
132
+ clean.defaultValue = String(v.defaultValue);
133
+ }
134
+ if (v.description !== undefined && v.description !== null && v.description !== '') {
135
+ clean.description = v.description;
136
+ }
137
+ return clean;
138
+ });
139
+ }
120
140
  function cleanAgentForExport(agentData) {
121
141
  const cleaned = {};
122
142
  for (const key of Object.keys(agentData)) {
@@ -138,6 +158,9 @@ function cleanAgentForExport(agentData) {
138
158
  else if (key === 'actions') {
139
159
  cleaned[key] = cleanActions(value);
140
160
  }
161
+ else if (key === 'variables') {
162
+ cleaned[key] = cleanVariables(value);
163
+ }
141
164
  else if (Array.isArray(value)) {
142
165
  cleaned[key] = value;
143
166
  }
@@ -59,14 +59,14 @@ export function findNewIntegrationForChannel(channel, integrations, knownIds) {
59
59
  return b > a ? current : latest;
60
60
  });
61
61
  }
62
- /** Etiqueta humana del item recien conectado (numero, alias de pagina, etc.). */
62
+ /** Etiqueta humana del item recien conectado (numero, nombre de pagina, etc.). */
63
63
  export function describeIntegration(channel, i) {
64
64
  switch (channel) {
65
65
  case 'whatsapp':
66
- return i.cellphoneNumberFormat || i.cellphoneNumber || '';
66
+ return i.cellphoneNumberFormat || i.cellphoneNumber || i.srcName || '';
67
67
  case 'instagram':
68
- return i.aliasName || i.instagramPageId || '';
68
+ return i.srcName || i.aliasName || i.instagramPageId || '';
69
69
  case 'messenger':
70
- return i.aliasName || i.facebookPageId || '';
70
+ return i.srcName || i.aliasName || i.facebookPageId || '';
71
71
  }
72
72
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plazbot-cli",
3
- "version": "0.3.5",
3
+ "version": "0.3.7",
4
4
  "description": "CLI para Plazbot SDK",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",
@@ -14,7 +14,7 @@ const VALID_AGENT_FIELDS = new Set([
14
14
  'name', 'description', 'prompt', 'zone', 'timezone', 'buffer',
15
15
  'color', 'question', 'enable', 'tags', 'showInChat',
16
16
  'instructions', 'person', 'fallbacks', 'rules',
17
- 'examples', 'channels', 'services', 'actions',
17
+ 'examples', 'channels', 'services', 'actions', 'variables',
18
18
  'useToolCalling', 'customAIConfig', 'aiProviders',
19
19
  'responseMode', 'batchWaitSeconds',
20
20
  'enableWidget', 'enableWhatsappWidget', 'urlWhatsappWidget',
@@ -32,7 +32,7 @@ const STRING_FIELDS = new Set([
32
32
 
33
33
  // Campos que el schema espera como array (no pueden ser null)
34
34
  const ARRAY_FIELDS = new Set([
35
- 'tags', 'examples', 'channels', 'services', 'actions', 'aiProviders',
35
+ 'tags', 'examples', 'channels', 'services', 'actions', 'aiProviders', 'variables',
36
36
  ]);
37
37
 
38
38
  function cleanRequiredFields(fields: any): any[] {
@@ -105,6 +105,26 @@ function cleanActions(actions: any): any[] {
105
105
  });
106
106
  }
107
107
 
108
+ function cleanVariables(variables: any): any[] {
109
+ if (!variables || !Array.isArray(variables)) return [];
110
+ return variables
111
+ .filter((v: any) => v && v.code && v.name && v.type)
112
+ .map((v: any) => {
113
+ const clean: any = {
114
+ code: v.code,
115
+ name: v.name,
116
+ type: v.type,
117
+ };
118
+ if (v.defaultValue !== undefined && v.defaultValue !== null && v.defaultValue !== '') {
119
+ clean.defaultValue = String(v.defaultValue);
120
+ }
121
+ if (v.description !== undefined && v.description !== null && v.description !== '') {
122
+ clean.description = v.description;
123
+ }
124
+ return clean;
125
+ });
126
+ }
127
+
108
128
  function cleanAgentForExport(agentData: any): any {
109
129
  const cleaned: any = {};
110
130
 
@@ -127,6 +147,8 @@ function cleanAgentForExport(agentData: any): any {
127
147
  cleaned[key] = cleanServices(value);
128
148
  } else if (key === 'actions') {
129
149
  cleaned[key] = cleanActions(value);
150
+ } else if (key === 'variables') {
151
+ cleaned[key] = cleanVariables(value);
130
152
  } else if (Array.isArray(value)) {
131
153
  cleaned[key] = value;
132
154
  } else {
@@ -52,8 +52,8 @@ export interface ChannelLinkData {
52
52
  alreadyConnected?: boolean;
53
53
  /** Snapshot WhatsApp (legacy, mantenido por compat con la tool de WA). */
54
54
  connectedNumbers?: Array<{ id?: string; number?: string; alias?: string }>;
55
- /** Snapshot IG/Messenger (pageId + alias). */
56
- connectedItems?: Array<{ id?: string; pageId?: string; alias?: string }>;
55
+ /** Snapshot IG/Messenger (pageId + nombre legible + alias). */
56
+ connectedItems?: Array<{ id?: string; pageId?: string; name?: string; alias?: string }>;
57
57
  existingIntegrationIds?: string[];
58
58
  }
59
59
 
@@ -90,7 +90,9 @@ export interface WorkspaceIntegrationItem {
90
90
  facebookPageId?: string;
91
91
  /** instagram */
92
92
  instagramPageId?: string;
93
- /** comun: alias humano */
93
+ /** comun: nombre legible (display name de Meta) */
94
+ srcName?: string;
95
+ /** comun: alias humano puesto manualmente */
94
96
  aliasName?: string;
95
97
  creationDate?: string;
96
98
  isActive?: number | boolean;
@@ -123,17 +125,17 @@ export function findNewIntegrationForChannel(
123
125
  });
124
126
  }
125
127
 
126
- /** Etiqueta humana del item recien conectado (numero, alias de pagina, etc.). */
128
+ /** Etiqueta humana del item recien conectado (numero, nombre de pagina, etc.). */
127
129
  export function describeIntegration(
128
130
  channel: ConnectChannel,
129
131
  i: WorkspaceIntegrationItem,
130
132
  ): string {
131
133
  switch (channel) {
132
134
  case 'whatsapp':
133
- return i.cellphoneNumberFormat || i.cellphoneNumber || '';
135
+ return i.cellphoneNumberFormat || i.cellphoneNumber || i.srcName || '';
134
136
  case 'instagram':
135
- return i.aliasName || i.instagramPageId || '';
137
+ return i.srcName || i.aliasName || i.instagramPageId || '';
136
138
  case 'messenger':
137
- return i.aliasName || i.facebookPageId || '';
139
+ return i.srcName || i.aliasName || i.facebookPageId || '';
138
140
  }
139
141
  }