plazbot-cli 0.3.6 → 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
|
}
|
package/package.json
CHANGED
|
@@ -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 {
|