plazbot-cli 0.1.4 → 0.2.1

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.
@@ -76,9 +76,7 @@ exports.toolsCommand = new commander_1.Command('tools')
76
76
  if (action === 'toggle') {
77
77
  const toggleSpinner = (0, ui_1.createSpinner)('Actualizando...');
78
78
  toggleSpinner.start();
79
- const updatedConfig = { ...agentData, useToolCalling: !agentData.useToolCalling };
80
- delete updatedConfig.id;
81
- delete updatedConfig._id;
79
+ const { id: _i1, _id: _o1, ...updatedConfig } = { ...agentData, useToolCalling: !agentData.useToolCalling };
82
80
  await agent.updateAgent(agentId, updatedConfig);
83
81
  toggleSpinner.succeed(`Tool Calling ${!agentData.useToolCalling ? 'activado' : 'desactivado'}`);
84
82
  return;
@@ -105,9 +103,7 @@ exports.toolsCommand = new commander_1.Command('tools')
105
103
  responseConditions: [],
106
104
  };
107
105
  const updatedServices = [...services, newService];
108
- const updatedConfig = { ...agentData, services: updatedServices, useToolCalling: true };
109
- delete updatedConfig.id;
110
- delete updatedConfig._id;
106
+ const { id: _i2, _id: _o2, ...updatedConfig } = { ...agentData, services: updatedServices, useToolCalling: true };
111
107
  const updateSpinner = (0, ui_1.createSpinner)('Guardando servicio...');
112
108
  updateSpinner.start();
113
109
  await agent.updateAgent(agentId, updatedConfig);
@@ -144,9 +140,7 @@ exports.toolsCommand = new commander_1.Command('tools')
144
140
  action: [{ type: act.actionType, value: act.actionValue }],
145
141
  };
146
142
  const updatedActions = [...actions, newAction];
147
- const updatedConfig = { ...agentData, actions: updatedActions, useToolCalling: true };
148
- delete updatedConfig.id;
149
- delete updatedConfig._id;
143
+ const { id: _i3, _id: _o3, ...updatedConfig } = { ...agentData, actions: updatedActions, useToolCalling: true };
150
144
  const updateSpinner = (0, ui_1.createSpinner)('Guardando accion...');
151
145
  updateSpinner.start();
152
146
  await agent.updateAgent(agentId, updatedConfig);
@@ -34,11 +34,11 @@ exports.addAgentCommand = new commander_1.Command('add-agent-portal')
34
34
  logger_1.logger.info('\n📎 Detalles de la operación:');
35
35
  logger_1.logger.divider();
36
36
  logger_1.logger.info('Portal:');
37
- logger_1.logger.info(` ID: ${portalDetails.portal.id}`);
38
- logger_1.logger.info(` Nombre: ${portalDetails.portal.name}`);
37
+ logger_1.logger.info(` ID: ${portalDetails.portal?.id || options.portalId}`);
38
+ logger_1.logger.info(` Nombre: ${portalDetails.portal?.name || 'N/A'}`);
39
39
  logger_1.logger.info('\nAgente:');
40
- logger_1.logger.info(` ID: ${agentDetails.agent.id}`);
41
- logger_1.logger.info(` Nombre: ${agentDetails.agent.name}`);
40
+ logger_1.logger.info(` ID: ${agentDetails.id}`);
41
+ logger_1.logger.info(` Nombre: ${agentDetails.name}`);
42
42
  logger_1.logger.divider();
43
43
  logger_1.logger.info('\n🔄 Agregando agente al portal...');
44
44
  await portal.addAgentToPortal({
@@ -41,15 +41,16 @@ exports.listCommand = new commander_1.Command('list')
41
41
  logger_1.logger.info(`Logo (modo oscuro): ${portalDetails.logodark}`);
42
42
  }
43
43
  }
44
- if (portalDetails.links && portalDetails.links.length > 0) {
44
+ const portalAny = portalDetails;
45
+ if (portalAny.links && portalAny.links.length > 0) {
45
46
  logger_1.logger.info('\n🔗 Enlaces:');
46
- portalDetails.links.forEach((link) => {
47
+ portalAny.links.forEach((link) => {
47
48
  logger_1.logger.info(`- ${link.value}: ${link.url}`);
48
49
  });
49
50
  }
50
- if (portalDetails.agents && portalDetails.agents.length > 0) {
51
+ if (portalAny.agents && portalAny.agents.length > 0) {
51
52
  logger_1.logger.info('\n🤖 Agentes asociados:');
52
- portalDetails.agents.forEach((agent) => {
53
+ portalAny.agents.forEach((agent) => {
53
54
  logger_1.logger.info(`- ${agent.name} (${agent.id})`);
54
55
  });
55
56
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "plazbot-cli",
3
- "version": "0.1.4",
3
+ "version": "0.2.1",
4
4
  "description": "CLI para Plazbot SDK",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {
@@ -43,7 +43,7 @@
43
43
  "marked": "^12.0.2",
44
44
  "marked-terminal": "^7.2.1",
45
45
  "ora": "^5.4.1",
46
- "plazbot": "^1.1.7"
46
+ "plazbot": "^2.0.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/node": "^20.0.0",
@@ -61,9 +61,7 @@ export const aiConfigCommand = new Command('ai-config')
61
61
  if (action === 'exit') return;
62
62
 
63
63
  if (action === 'reset') {
64
- const resetConfig = { ...agentData, customAIConfig: false, aiProviders: [] };
65
- delete resetConfig.id;
66
- delete resetConfig._id;
64
+ const { id, _id, ...resetConfig } = { ...agentData, customAIConfig: false, aiProviders: [] };
67
65
  const resetSpinner = createSpinner('Reseteando configuracion...');
68
66
  resetSpinner.start();
69
67
  await agent.updateAgent(agentId, resetConfig);
@@ -85,7 +83,7 @@ export const aiConfigCommand = new Command('ai-config')
85
83
  { type: 'number', name: 'maxTokens', message: 'Max tokens (1024-16384):', default: 4096 },
86
84
  ]);
87
85
 
88
- const updatedConfig = {
86
+ const { id: _uid, _id: _oid, ...updatedConfig } = {
89
87
  ...agentData,
90
88
  customAIConfig: true,
91
89
  aiProviders: [{
@@ -97,8 +95,6 @@ export const aiConfigCommand = new Command('ai-config')
97
95
  isDefault: true,
98
96
  }],
99
97
  };
100
- delete updatedConfig.id;
101
- delete updatedConfig._id;
102
98
  const updateSpinner = createSpinner('Guardando configuracion...');
103
99
  updateSpinner.start();
104
100
  await agent.updateAgent(agentId, updatedConfig);
@@ -26,9 +26,9 @@ export const deleteCommand = new Command('delete')
26
26
 
27
27
  logger.warning('\nVas a eliminar el siguiente agente:');
28
28
  logger.divider();
29
- logger.info(`ID: ${agentDetails.agent.id}`);
30
- logger.info(`Nombre: ${agentDetails.agent.name}`);
31
- logger.info(`Descripción: ${agentDetails.agent.description}`);
29
+ logger.info(`ID: ${agentDetails.id}`);
30
+ logger.info(`Nombre: ${agentDetails.name}`);
31
+ logger.info(`Descripción: ${agentDetails.description}`);
32
32
  logger.divider();
33
33
 
34
34
  // Crear interfaz para confirmación
@@ -26,7 +26,7 @@ export const enableCommand = new Command('enable-widget')
26
26
 
27
27
  logger.info('\n🔧 Estado actual del widget:');
28
28
  logger.divider();
29
- logger.info(`Agente: ${agentDetails.agent.name}`);
29
+ logger.info(`Agente: ${agentDetails.name}`);
30
30
  logger.divider();
31
31
 
32
32
  // Cambiar estado
@@ -28,7 +28,7 @@ filesGroup.command('list')
28
28
  const agentData = await agent.getAgentById({ id: agentId });
29
29
  spinner.stop();
30
30
 
31
- const files = agentData.files || [];
31
+ const files = (agentData as any).files || [];
32
32
  console.log(section('Archivos - ' + (agentData.name || agentId)));
33
33
 
34
34
  if (files.length === 0) {
@@ -83,10 +83,10 @@ filesGroup.command('add')
83
83
 
84
84
  spinner.succeed('Archivo agregado');
85
85
 
86
- if (result?.fileId || result?.id) {
87
- logger.label('File ID', result.fileId || result.id);
86
+ if (result?.fileId) {
87
+ logger.label('File ID', result.fileId);
88
88
  logger.dim('El archivo esta siendo procesado. Verifica con:');
89
- logger.dim(`plazbot agent files status ${result.fileId || result.id}`);
89
+ logger.dim(`plazbot agent files status ${result.fileId}`);
90
90
  }
91
91
 
92
92
  } catch (error) {
@@ -118,7 +118,7 @@ filesGroup.command('status')
118
118
 
119
119
  logger.title('Estado del archivo');
120
120
  logger.label('File ID', fileId);
121
- logger.label('Estado', result?.status || result?.stateId === 2 ? 'Completado' : 'En proceso');
121
+ logger.label('Estado', result?.status ? 'Completado' : 'En proceso');
122
122
 
123
123
  } catch (error) {
124
124
  const message = error instanceof Error ? error.message : 'Error desconocido';
@@ -22,8 +22,7 @@ export const getCommand = new Command('get')
22
22
  });
23
23
 
24
24
  // Obtener detalles del agente
25
- const agentDetails = await agent.getAgentById({ id: agentId });
26
- const agentData = agentDetails.agent;
25
+ const agentData = await agent.getAgentById({ id: agentId });
27
26
 
28
27
  logger.info('\nDetalles del Agente:');
29
28
  logger.doubleDivider();
@@ -2,7 +2,7 @@ import { Command } from 'commander';
2
2
  import { Agent } from 'plazbot';
3
3
  import { getStoredCredentials } from '../../utils/credentials';
4
4
  import { logger } from '../../utils/logger';
5
- import { ListAgentsOptions, AgentListItem } from '../../types/agent';
5
+ import { ListAgentsOptions } from '../../types/agent';
6
6
 
7
7
  export const listCommand = new Command('list')
8
8
  .description('Lista todos los agentes del workspace')
@@ -31,12 +31,12 @@ export const listCommand = new Command('list')
31
31
  logger.info('\nLista de Agentes:');
32
32
  logger.doubleDivider();
33
33
 
34
- agents.forEach((agent: AgentListItem, index: number) => {
35
- logger.info(`${index + 1}. ID: ${agent.id}`);
36
- logger.info(` Nombre: ${agent.name}`);
37
- logger.info(` Estado: ${agent.enable ? '✅ Activo' : '❌ Inactivo'}`);
38
- logger.info(` Descripción: ${agent.description}`);
39
- logger.info(` Creado: ${new Date(agent.createdAt).toLocaleString()}`);
34
+ agents.forEach((a: any, index: number) => {
35
+ logger.info(`${index + 1}. ID: ${a.id}`);
36
+ logger.info(` Nombre: ${a.name}`);
37
+ logger.info(` Estado: ${a.enable ? '✅ Activo' : '❌ Inactivo'}`);
38
+ logger.info(` Descripción: ${a.description}`);
39
+ logger.info(` Creado: ${a.createdAt ? new Date(a.createdAt).toLocaleString() : 'N/A'}`);
40
40
  logger.divider();
41
41
  });
42
42
 
@@ -68,7 +68,7 @@ setGroup.command('instructions')
68
68
  { type: 'input', name: 'personality', message: 'Personalidad:', default: current.personality || '' },
69
69
  { type: 'input', name: 'objective', message: 'Objetivo:', default: current.objective || '' },
70
70
  { type: 'list', name: 'language', message: 'Idioma:', choices: ['Espanol', 'English', 'Portugues'], default: current.language || 'Espanol' },
71
- { type: 'confirm', name: 'useEmojis', message: 'Usar emojis?', default: current.useEmojis === 'si' },
71
+ { type: 'confirm', name: 'emojis', message: 'Usar emojis?', default: current.emojis === true },
72
72
  ]);
73
73
 
74
74
  const instructions = {
@@ -78,7 +78,7 @@ setGroup.command('instructions')
78
78
  personality: answers.personality,
79
79
  objective: answers.objective,
80
80
  language: answers.language,
81
- useEmojis: answers.useEmojis ? 'si' : 'no',
81
+ emojis: answers.emojis,
82
82
  };
83
83
 
84
84
  const spinner = createSpinner('Guardando instrucciones...');
@@ -119,7 +119,7 @@ setGroup.command('persona')
119
119
  const answers = await (inquirer as any).prompt([
120
120
  { type: 'input', name: 'name', message: 'Nombre del personaje:', default: current.name || '' },
121
121
  { type: 'input', name: 'role', message: 'Rol:', default: current.role || '' },
122
- { type: 'confirm', name: 'firstPerson', message: 'Hablar en primera persona?', default: current.firstPerson !== false },
122
+ { type: 'confirm', name: 'speaksInFirstPerson', message: 'Hablar en primera persona?', default: current.speaksInFirstPerson !== false },
123
123
  ]);
124
124
 
125
125
  const spinner = createSpinner('Guardando persona...');