plazbot-cli 0.2.26 → 0.3.2
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/CLAUDE.md +34 -5
- package/README.md +21 -0
- package/dist/cli.js +32 -20
- package/dist/commands/agent/ai-config.js +98 -50
- package/dist/commands/agent/chat.js +80 -74
- package/dist/commands/agent/copy.js +23 -21
- package/dist/commands/agent/create.js +42 -72
- package/dist/commands/agent/delete.js +29 -30
- package/dist/commands/agent/enable-widget.js +30 -26
- package/dist/commands/agent/export.js +90 -77
- package/dist/commands/agent/files.js +68 -60
- package/dist/commands/agent/get.js +101 -87
- package/dist/commands/agent/index.js +53 -39
- package/dist/commands/agent/list.js +26 -24
- package/dist/commands/agent/monitor.js +91 -86
- package/dist/commands/agent/on-message.js +40 -37
- package/dist/commands/agent/set.js +62 -59
- package/dist/commands/agent/templates.js +109 -108
- package/dist/commands/agent/tools.js +64 -65
- package/dist/commands/agent/update.js +28 -27
- package/dist/commands/agent/validate.js +127 -0
- package/dist/commands/agent/wizard.js +152 -159
- package/dist/commands/auth/index.js +7 -10
- package/dist/commands/auth/login.js +50 -37
- package/dist/commands/auth/logout.js +16 -14
- package/dist/commands/auth/status.js +19 -16
- package/dist/commands/portal/add-agent.js +26 -24
- package/dist/commands/portal/add-link.js +21 -17
- package/dist/commands/portal/clear-links.js +17 -15
- package/dist/commands/portal/create.js +25 -21
- package/dist/commands/portal/delete.js +31 -30
- package/dist/commands/portal/get.js +33 -31
- package/dist/commands/portal/index.js +30 -22
- package/dist/commands/portal/list.js +34 -30
- package/dist/commands/portal/update.js +41 -33
- package/dist/commands/whatsapp/broadcast.js +40 -37
- package/dist/commands/whatsapp/channels.js +40 -34
- package/dist/commands/whatsapp/chat.js +33 -32
- package/dist/commands/whatsapp/connect.js +53 -52
- package/dist/commands/whatsapp/delete-webhook.js +19 -17
- package/dist/commands/whatsapp/index.js +35 -25
- package/dist/commands/whatsapp/register-webhook.js +21 -19
- package/dist/commands/whatsapp/send-template.js +39 -31
- package/dist/commands/whatsapp/send.js +27 -23
- package/dist/commands/whatsapp/widget.js +35 -31
- package/dist/commands/workers/deploy.js +49 -44
- package/dist/commands/workers/index.js +28 -18
- package/dist/commands/workers/list.js +43 -35
- package/dist/commands/workers/logs.js +38 -32
- package/dist/commands/workers/remove.js +38 -37
- package/dist/commands/workers/secret.js +63 -58
- package/dist/commands/workers/test.js +44 -36
- package/dist/schemas/agent.config.schema.json +569 -0
- package/dist/studio/api/sseClient.js +97 -0
- package/dist/studio/api/studioApi.js +25 -0
- package/dist/studio/api/types.js +16 -0
- package/dist/studio/components/AgentPanel.js +35 -0
- package/dist/studio/components/App.js +214 -0
- package/dist/studio/components/ChatLog.js +59 -0
- package/dist/studio/components/Footer.js +11 -0
- package/dist/studio/components/Header.js +8 -0
- package/dist/studio/components/Input.js +15 -0
- package/dist/studio/components/Message.js +56 -0
- package/dist/studio/components/Suggestions.js +11 -0
- package/dist/studio/components/ToolCall.js +33 -0
- package/dist/studio/components/WhatsappConnectCard.js +57 -0
- package/dist/studio/index.js +42 -0
- package/dist/studio/render/json.js +16 -0
- package/dist/studio/render/markdown.js +86 -0
- package/dist/studio/render/steps.js +58 -0
- package/dist/studio/runOneShot.js +96 -0
- package/dist/studio/runRepl.js +52 -0
- package/dist/studio/slash/handlers.js +199 -0
- package/dist/studio/slash/parser.js +46 -0
- package/dist/studio/slash/registry.js +16 -0
- package/dist/studio/state/store.js +181 -0
- package/dist/studio/whatsapp/api.js +63 -0
- package/dist/studio/whatsapp/polling.js +77 -0
- package/dist/studio/whatsapp/types.js +31 -0
- package/dist/types/agent.js +1 -2
- package/dist/types/auth.js +1 -2
- package/dist/types/common.js +1 -2
- package/dist/types/message.js +1 -2
- package/dist/types/portal.js +1 -2
- package/dist/types/workers.js +1 -2
- package/dist/utils/agent-errors.js +46 -0
- package/dist/utils/api.js +8 -9
- package/dist/utils/banner.js +33 -34
- package/dist/utils/credentials.js +12 -20
- package/dist/utils/help.js +44 -0
- package/dist/utils/logger.js +13 -19
- package/dist/utils/ui.js +35 -49
- package/package.json +22 -10
- package/src/cli.ts +24 -8
- package/src/commands/agent/ai-config.ts +89 -34
- package/src/commands/agent/chat.ts +49 -37
- package/src/commands/agent/copy.ts +19 -13
- package/src/commands/agent/create.ts +32 -22
- package/src/commands/agent/delete.ts +24 -18
- package/src/commands/agent/enable-widget.ts +31 -23
- package/src/commands/agent/export.ts +72 -51
- package/src/commands/agent/files.ts +51 -39
- package/src/commands/agent/get.ts +86 -66
- package/src/commands/agent/index.ts +36 -18
- package/src/commands/agent/list.ts +22 -16
- package/src/commands/agent/monitor.ts +67 -56
- package/src/commands/agent/on-message.ts +36 -27
- package/src/commands/agent/set.ts +47 -37
- package/src/commands/agent/templates.ts +90 -82
- package/src/commands/agent/tools.ts +53 -47
- package/src/commands/agent/update.ts +28 -20
- package/src/commands/agent/validate.ts +135 -0
- package/src/commands/agent/wizard.ts +114 -114
- package/src/commands/auth/index.ts +3 -3
- package/src/commands/auth/login.ts +44 -29
- package/src/commands/auth/logout.ts +16 -10
- package/src/commands/auth/status.ts +14 -8
- package/src/commands/portal/add-agent.ts +23 -17
- package/src/commands/portal/add-link.ts +17 -9
- package/src/commands/portal/clear-links.ts +13 -7
- package/src/commands/portal/create.ts +20 -12
- package/src/commands/portal/delete.ts +28 -20
- package/src/commands/portal/get.ts +25 -19
- package/src/commands/portal/index.ts +22 -10
- package/src/commands/portal/list.ts +27 -19
- package/src/commands/portal/update.ts +38 -26
- package/src/commands/whatsapp/broadcast.ts +28 -18
- package/src/commands/whatsapp/channels.ts +31 -20
- package/src/commands/whatsapp/chat.ts +20 -12
- package/src/commands/whatsapp/connect.ts +39 -31
- package/src/commands/whatsapp/delete-webhook.ts +15 -9
- package/src/commands/whatsapp/index.ts +24 -10
- package/src/commands/whatsapp/register-webhook.ts +16 -10
- package/src/commands/whatsapp/send-template.ts +33 -21
- package/src/commands/whatsapp/send.ts +23 -15
- package/src/commands/whatsapp/widget.ts +25 -17
- package/src/commands/workers/deploy.ts +34 -22
- package/src/commands/workers/index.ts +21 -7
- package/src/commands/workers/list.ts +31 -19
- package/src/commands/workers/logs.ts +30 -20
- package/src/commands/workers/remove.ts +30 -22
- package/src/commands/workers/secret.ts +46 -34
- package/src/commands/workers/test.ts +34 -22
- package/src/schemas/agent.config.schema.json +569 -0
- package/src/studio/api/sseClient.ts +91 -0
- package/src/studio/api/studioApi.ts +27 -0
- package/src/studio/api/types.ts +96 -0
- package/src/studio/components/App.tsx +266 -0
- package/src/studio/components/ChatLog.tsx +95 -0
- package/src/studio/components/Footer.tsx +38 -0
- package/src/studio/components/Header.tsx +39 -0
- package/src/studio/components/Input.tsx +32 -0
- package/src/studio/components/Message.tsx +87 -0
- package/src/studio/components/Suggestions.tsx +26 -0
- package/src/studio/components/ToolCall.tsx +58 -0
- package/src/studio/components/WhatsappConnectCard.tsx +139 -0
- package/src/studio/index.ts +58 -0
- package/src/studio/render/markdown.ts +93 -0
- package/src/studio/render/steps.ts +57 -0
- package/src/studio/runOneShot.ts +114 -0
- package/src/studio/runRepl.tsx +76 -0
- package/src/studio/slash/handlers.ts +226 -0
- package/src/studio/slash/parser.ts +41 -0
- package/src/studio/slash/registry.ts +54 -0
- package/src/studio/state/store.ts +273 -0
- package/src/studio/whatsapp/api.ts +96 -0
- package/src/studio/whatsapp/polling.ts +93 -0
- package/src/studio/whatsapp/types.ts +80 -0
- package/src/types/agent.ts +1 -1
- package/src/types/auth.ts +4 -3
- package/src/types/portal.ts +1 -1
- package/src/types/workers.ts +1 -1
- package/src/utils/agent-errors.ts +67 -0
- package/src/utils/api.ts +6 -0
- package/src/utils/banner.ts +14 -9
- package/src/utils/credentials.ts +6 -5
- package/src/utils/help.ts +51 -0
- package/tsconfig.json +9 -6
|
@@ -1,30 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.
|
|
14
|
-
.
|
|
15
|
-
.option('-w, --workspace <id>', 'Workspace ID (sobreescribe config local)')
|
|
16
|
-
.option('-z, --zone <zone>', 'Zona LA o EU (sobreescribe config local)')
|
|
17
|
-
.option('--raw', 'Mostrar el JSON completo sin formatear', false)
|
|
18
|
-
.option('--dev', 'Usar ambiente de desarrollo', false)
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Agent } from 'plazbot';
|
|
3
|
+
import { getStoredCredentials } from '../../utils/credentials.js';
|
|
4
|
+
import { logger } from '../../utils/logger.js';
|
|
5
|
+
import { addExamples } from '../../utils/help.js';
|
|
6
|
+
import { describeAgentLoadError } from '../../utils/agent-errors.js';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
export const getCommand = new Command('get')
|
|
9
|
+
.description('Get detailed information about a specific agent')
|
|
10
|
+
.argument('<agentId>', 'Agent ID to fetch')
|
|
11
|
+
.option('-w, --workspace <id>', 'Workspace ID (overrides local config)')
|
|
12
|
+
.option('-z, --zone <zone>', 'Zone LA or EU (overrides local config)')
|
|
13
|
+
.option('--raw', 'Show full unformatted JSON', false)
|
|
14
|
+
.option('--dev', 'Use development environment', false)
|
|
19
15
|
.action(async (agentId, options) => {
|
|
20
16
|
try {
|
|
21
|
-
const credentials = await
|
|
17
|
+
const credentials = await getStoredCredentials();
|
|
22
18
|
const effectiveWorkspace = options.workspace || credentials.workspace;
|
|
23
19
|
const effectiveZone = (options.zone?.toUpperCase() === 'EU' ? 'EU' : options.zone?.toUpperCase() === 'LA' ? 'LA' : credentials.zone);
|
|
24
20
|
if (options.workspace || options.zone) {
|
|
25
|
-
console.log(
|
|
21
|
+
console.log(chalk.hex('#FFA726')(`\n Support mode: workspace=${effectiveWorkspace} zone=${effectiveZone}`));
|
|
26
22
|
}
|
|
27
|
-
const agent = new
|
|
23
|
+
const agent = new Agent({
|
|
28
24
|
workspaceId: effectiveWorkspace,
|
|
29
25
|
apiKey: credentials.apiKey,
|
|
30
26
|
zone: effectiveZone,
|
|
@@ -39,32 +35,32 @@ exports.getCommand = new commander_1.Command('get')
|
|
|
39
35
|
return;
|
|
40
36
|
}
|
|
41
37
|
const label = (key, value) => {
|
|
42
|
-
const v = value !== undefined && value !== null && value !== '' ? String(value) :
|
|
43
|
-
console.log(` ${
|
|
38
|
+
const v = value !== undefined && value !== null && value !== '' ? String(value) : chalk.gray('—');
|
|
39
|
+
console.log(` ${chalk.gray(key + ':')} ${chalk.white(v)}`);
|
|
44
40
|
};
|
|
45
41
|
const sectionHeader = (title) => {
|
|
46
42
|
console.log();
|
|
47
|
-
console.log(
|
|
48
|
-
console.log(
|
|
43
|
+
console.log(chalk.bold.hex('#4CAF50')(` ${title}`));
|
|
44
|
+
console.log(chalk.gray(' ' + '─'.repeat(40)));
|
|
49
45
|
};
|
|
50
46
|
console.log();
|
|
51
|
-
console.log(
|
|
52
|
-
console.log(
|
|
53
|
-
console.log(
|
|
54
|
-
console.log(
|
|
47
|
+
console.log(chalk.hex('#4CAF50')(' ┌' + '─'.repeat(58) + '┐'));
|
|
48
|
+
console.log(chalk.hex('#4CAF50')(' │') + chalk.bold(` ${agentData.name || 'Agent'}`).padEnd(68) + chalk.hex('#4CAF50')('│'));
|
|
49
|
+
console.log(chalk.hex('#4CAF50')(' │') + chalk.gray(` ${agentId}`).padEnd(68) + chalk.hex('#4CAF50')('│'));
|
|
50
|
+
console.log(chalk.hex('#4CAF50')(' └' + '─'.repeat(58) + '┘'));
|
|
55
51
|
// Informacion basica
|
|
56
|
-
sectionHeader('
|
|
52
|
+
sectionHeader('Basic Information');
|
|
57
53
|
label('ID', agentData.id);
|
|
58
|
-
label('
|
|
59
|
-
label('
|
|
60
|
-
label('
|
|
61
|
-
label('
|
|
54
|
+
label('Name', agentData.name);
|
|
55
|
+
label('Description', agentData.description);
|
|
56
|
+
label('Status', agentData.enable ? chalk.hex('#66BB6A')('Active') : chalk.hex('#EF5350')('Inactive'));
|
|
57
|
+
label('Zone', agentData.zone);
|
|
62
58
|
label('Buffer', agentData.buffer);
|
|
63
59
|
label('Color', agentData.color);
|
|
64
|
-
label('
|
|
65
|
-
label('
|
|
66
|
-
label('
|
|
67
|
-
label('Tool Calling', agentData.useToolCalling ? '
|
|
60
|
+
label('Initial question', agentData.question);
|
|
61
|
+
label('Timezone', agentData.timezone);
|
|
62
|
+
label('Show in chat', agentData.showInChat ? 'Yes' : 'No');
|
|
63
|
+
label('Tool Calling', agentData.useToolCalling ? 'Enabled' : 'Disabled');
|
|
68
64
|
// Tags
|
|
69
65
|
if (agentData.tags && agentData.tags.length > 0) {
|
|
70
66
|
label('Tags', agentData.tags.join(', '));
|
|
@@ -75,121 +71,139 @@ exports.getCommand = new commander_1.Command('get')
|
|
|
75
71
|
const promptPreview = agentData.prompt.length > 200
|
|
76
72
|
? agentData.prompt.substring(0, 200) + '...'
|
|
77
73
|
: agentData.prompt;
|
|
78
|
-
console.log(
|
|
74
|
+
console.log(chalk.white(' ' + promptPreview.split('\n').join('\n ')));
|
|
79
75
|
}
|
|
80
76
|
// Ejemplos
|
|
81
77
|
if (agentData.examples && agentData.examples.length > 0) {
|
|
82
|
-
sectionHeader('
|
|
78
|
+
sectionHeader('Examples');
|
|
83
79
|
agentData.examples.forEach((example) => {
|
|
84
|
-
console.log(
|
|
80
|
+
console.log(chalk.white(` - ${example.value || example}`));
|
|
85
81
|
});
|
|
86
82
|
}
|
|
87
83
|
// Instrucciones
|
|
88
84
|
if (agentData.instructions) {
|
|
89
|
-
sectionHeader('
|
|
85
|
+
sectionHeader('Instructions');
|
|
90
86
|
const inst = agentData.instructions;
|
|
91
|
-
label('
|
|
92
|
-
label('
|
|
93
|
-
label('
|
|
94
|
-
label('
|
|
95
|
-
label('
|
|
96
|
-
label('Emojis', inst.emojis ? '
|
|
97
|
-
label('
|
|
98
|
-
label('Max
|
|
87
|
+
label('Tone', inst.tone);
|
|
88
|
+
label('Style', inst.style);
|
|
89
|
+
label('Personality', inst.personality);
|
|
90
|
+
label('Objective', inst.objective);
|
|
91
|
+
label('Language', inst.language);
|
|
92
|
+
label('Emojis', inst.emojis ? 'Yes' : 'No');
|
|
93
|
+
label('Preferred format', inst.preferredFormat);
|
|
94
|
+
label('Max words', inst.maxWords);
|
|
99
95
|
if (inst.avoidTopics && inst.avoidTopics.length > 0) {
|
|
100
|
-
label('
|
|
96
|
+
label('Topics to avoid', inst.avoidTopics.join(', '));
|
|
101
97
|
}
|
|
102
|
-
label('
|
|
103
|
-
label('
|
|
98
|
+
label('Only respond if known', inst.respondOnlyIfKnows ? 'Yes' : 'No');
|
|
99
|
+
label('Greeting', inst.greeting);
|
|
104
100
|
}
|
|
105
101
|
// Persona
|
|
106
102
|
if (agentData.person) {
|
|
107
103
|
sectionHeader('Persona');
|
|
108
104
|
const p = agentData.person;
|
|
109
|
-
label('
|
|
110
|
-
label('
|
|
111
|
-
label('
|
|
112
|
-
label('
|
|
105
|
+
label('Name', p.name);
|
|
106
|
+
label('Role', p.role);
|
|
107
|
+
label('First person', p.speaksInFirstPerson ? 'Yes' : 'No');
|
|
108
|
+
label('Is human', p.isHuman ? 'Yes' : 'No');
|
|
113
109
|
}
|
|
114
110
|
// Fallbacks
|
|
115
111
|
if (agentData.fallbacks) {
|
|
116
112
|
sectionHeader('Fallbacks');
|
|
117
113
|
const fb = agentData.fallbacks;
|
|
118
|
-
label('
|
|
119
|
-
label('
|
|
120
|
-
label('
|
|
114
|
+
label('No answer', fb.noAnswer);
|
|
115
|
+
label('Service error', fb.serviceError);
|
|
116
|
+
label('Does not understand', fb.doNotUnderstand);
|
|
121
117
|
}
|
|
122
118
|
// Reglas
|
|
123
119
|
if (agentData.rules) {
|
|
124
|
-
sectionHeader('
|
|
120
|
+
sectionHeader('Rules');
|
|
125
121
|
const r = agentData.rules;
|
|
126
|
-
label('
|
|
127
|
-
label('
|
|
122
|
+
label('Do not mention prices', r.doNotMentionPrices ? 'Yes' : 'No');
|
|
123
|
+
label('Do not diagnose', r.doNotDiagnose ? 'Yes' : 'No');
|
|
128
124
|
if (r.doNotRespondOutsideHours) {
|
|
129
|
-
label('
|
|
125
|
+
label('Out of hours', r.doNotRespondOutsideHours);
|
|
130
126
|
}
|
|
131
127
|
}
|
|
132
128
|
// Servicios
|
|
133
129
|
if (agentData.services && agentData.services.length > 0) {
|
|
134
|
-
sectionHeader(`
|
|
130
|
+
sectionHeader(`Services (${agentData.services.length})`);
|
|
135
131
|
agentData.services.forEach((svc, i) => {
|
|
136
|
-
console.log(
|
|
137
|
-
label('
|
|
138
|
-
label('
|
|
139
|
-
label('
|
|
132
|
+
console.log(chalk.hex('#2196F3')(` ${i + 1}. ${svc.intent || svc.reference || 'Service'}`));
|
|
133
|
+
label(' Reference', svc.reference);
|
|
134
|
+
label(' Enabled', svc.enabled ? 'Yes' : 'No');
|
|
135
|
+
label(' Method', svc.method);
|
|
140
136
|
label(' Endpoint', svc.endpoint);
|
|
141
137
|
if (svc.requiredFields && svc.requiredFields.length > 0) {
|
|
142
|
-
console.log(
|
|
138
|
+
console.log(chalk.gray(' Fields:'));
|
|
143
139
|
svc.requiredFields.forEach((f) => {
|
|
144
|
-
console.log(
|
|
140
|
+
console.log(chalk.white(` - ${f.name} (${f.type}): ${f.description || ''}`));
|
|
145
141
|
});
|
|
146
142
|
}
|
|
147
143
|
});
|
|
148
144
|
}
|
|
149
145
|
// Acciones
|
|
150
146
|
if (agentData.actions && agentData.actions.length > 0) {
|
|
151
|
-
sectionHeader(`
|
|
147
|
+
sectionHeader(`Actions (${agentData.actions.length})`);
|
|
152
148
|
agentData.actions.forEach((act, i) => {
|
|
153
|
-
console.log(
|
|
154
|
-
label('
|
|
155
|
-
label('
|
|
149
|
+
console.log(chalk.hex('#FFA726')(` ${i + 1}. ${act.intent || act.reference || 'Action'}`));
|
|
150
|
+
label(' Reference', act.reference);
|
|
151
|
+
label(' Enabled', act.enabled ? 'Yes' : 'No');
|
|
156
152
|
if (act.tags && act.tags.length > 0) {
|
|
157
153
|
label(' Tags', act.tags.join(', '));
|
|
158
154
|
}
|
|
159
|
-
label('
|
|
155
|
+
label(' Response', act.responseMessage);
|
|
160
156
|
if (act.action && act.action.length > 0) {
|
|
161
|
-
console.log(
|
|
157
|
+
console.log(chalk.gray(' Sub-actions:'));
|
|
162
158
|
act.action.forEach((sa) => {
|
|
163
|
-
console.log(
|
|
159
|
+
console.log(chalk.white(` - ${sa.type}: ${sa.value || ''}`));
|
|
164
160
|
});
|
|
165
161
|
}
|
|
166
162
|
});
|
|
167
163
|
}
|
|
168
164
|
// Canales
|
|
169
165
|
if (agentData.channels && agentData.channels.length > 0) {
|
|
170
|
-
sectionHeader(`
|
|
166
|
+
sectionHeader(`Channels (${agentData.channels.length})`);
|
|
171
167
|
agentData.channels.forEach((ch) => {
|
|
172
|
-
console.log(
|
|
168
|
+
console.log(chalk.white(` ${chalk.hex('#22d3ee')(ch.channel || 'channel')}: ${ch.key || ''}`));
|
|
173
169
|
});
|
|
174
170
|
}
|
|
175
171
|
// AI Config
|
|
176
172
|
if (agentData.customAIConfig && agentData.aiProviders && agentData.aiProviders.length > 0) {
|
|
177
|
-
sectionHeader('
|
|
173
|
+
sectionHeader('AI Model');
|
|
178
174
|
agentData.aiProviders.forEach((ai) => {
|
|
179
|
-
label('
|
|
180
|
-
label('
|
|
175
|
+
label('Provider', ai.provider);
|
|
176
|
+
label('Model', ai.model);
|
|
181
177
|
});
|
|
182
178
|
}
|
|
183
179
|
console.log();
|
|
184
|
-
console.log(
|
|
180
|
+
console.log(chalk.gray(' Use --raw to see the full JSON'));
|
|
185
181
|
console.log();
|
|
186
182
|
if (options.dev) {
|
|
187
|
-
|
|
183
|
+
logger.warning('Environment: development');
|
|
188
184
|
}
|
|
189
185
|
}
|
|
190
186
|
catch (error) {
|
|
191
|
-
const
|
|
192
|
-
|
|
187
|
+
const credentials = await getStoredCredentials().catch(() => null);
|
|
188
|
+
if (credentials) {
|
|
189
|
+
logger.error(describeAgentLoadError(error, agentId, credentials, {
|
|
190
|
+
dev: options.dev,
|
|
191
|
+
workspaceOverride: options.workspace,
|
|
192
|
+
zoneOverride: options.zone,
|
|
193
|
+
}));
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
const message = error instanceof Error ? error.message : 'Unknown error while fetching the agent';
|
|
197
|
+
logger.error(message);
|
|
198
|
+
}
|
|
193
199
|
process.exit(1);
|
|
194
200
|
}
|
|
195
201
|
});
|
|
202
|
+
addExamples(getCommand, [
|
|
203
|
+
{ description: 'Show the agent in a human-friendly layout',
|
|
204
|
+
command: 'plazbot agent get agt_AbcDef123' },
|
|
205
|
+
{ description: 'Dump the full raw JSON (useful for piping to jq)',
|
|
206
|
+
command: 'plazbot agent get agt_AbcDef123 --raw' },
|
|
207
|
+
{ description: 'Inspect an agent from another workspace (support mode)',
|
|
208
|
+
command: 'plazbot agent get agt_AbcDef123 -w wok_Other123 -z LA' },
|
|
209
|
+
]);
|
|
@@ -1,39 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
.
|
|
23
|
-
.addCommand(
|
|
24
|
-
.addCommand(
|
|
25
|
-
.addCommand(
|
|
26
|
-
.addCommand(
|
|
27
|
-
.addCommand(
|
|
28
|
-
.addCommand(
|
|
29
|
-
.addCommand(
|
|
30
|
-
.addCommand(
|
|
31
|
-
.addCommand(
|
|
32
|
-
.addCommand(
|
|
33
|
-
.addCommand(
|
|
34
|
-
.addCommand(
|
|
35
|
-
.addCommand(
|
|
36
|
-
.addCommand(
|
|
37
|
-
.addCommand(
|
|
38
|
-
.addCommand(
|
|
39
|
-
.addCommand(
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { addExamples } from '../../utils/help.js';
|
|
3
|
+
import { listCommand } from './list.js';
|
|
4
|
+
import { getCommand } from './get.js';
|
|
5
|
+
import { deleteCommand } from './delete.js';
|
|
6
|
+
import { createCommand } from './create.js';
|
|
7
|
+
import { updateCommand } from './update.js';
|
|
8
|
+
import { enableCommand } from './enable-widget.js';
|
|
9
|
+
import { chatCommand } from './chat.js';
|
|
10
|
+
import { messageCommand } from './on-message.js';
|
|
11
|
+
import { toolsCommand } from './tools.js';
|
|
12
|
+
import { aiConfigCommand } from './ai-config.js';
|
|
13
|
+
import { templatesCommand } from './templates.js';
|
|
14
|
+
import { copyCommand } from './copy.js';
|
|
15
|
+
import { filesCommand } from './files.js';
|
|
16
|
+
import { setCommand } from './set.js';
|
|
17
|
+
import { monitorCommand } from './monitor.js';
|
|
18
|
+
import { exportCommand, crossCopyCommand } from './export.js';
|
|
19
|
+
import { validateCommand } from './validate.js';
|
|
20
|
+
export const agentCommands = new Command('agent')
|
|
21
|
+
.description('Commands related to AI agents')
|
|
22
|
+
.addCommand(listCommand)
|
|
23
|
+
.addCommand(getCommand)
|
|
24
|
+
.addCommand(deleteCommand)
|
|
25
|
+
.addCommand(createCommand)
|
|
26
|
+
.addCommand(updateCommand)
|
|
27
|
+
.addCommand(enableCommand)
|
|
28
|
+
.addCommand(chatCommand)
|
|
29
|
+
.addCommand(messageCommand)
|
|
30
|
+
.addCommand(toolsCommand)
|
|
31
|
+
.addCommand(aiConfigCommand)
|
|
32
|
+
.addCommand(templatesCommand)
|
|
33
|
+
.addCommand(copyCommand)
|
|
34
|
+
.addCommand(filesCommand)
|
|
35
|
+
.addCommand(setCommand)
|
|
36
|
+
.addCommand(monitorCommand)
|
|
37
|
+
.addCommand(exportCommand)
|
|
38
|
+
.addCommand(crossCopyCommand)
|
|
39
|
+
.addCommand(validateCommand);
|
|
40
|
+
addExamples(agentCommands, [
|
|
41
|
+
{ description: 'List agents in the active workspace',
|
|
42
|
+
command: 'plazbot agent list' },
|
|
43
|
+
{ description: 'Chat interactively with an agent',
|
|
44
|
+
command: 'plazbot agent chat agt_AbcDef123' },
|
|
45
|
+
{ description: 'Create an agent from a JSON template',
|
|
46
|
+
command: 'plazbot agent create ./agent.json' },
|
|
47
|
+
{ description: 'Export an agent and copy it to another workspace',
|
|
48
|
+
command: 'plazbot agent cross-copy agt_AbcDef123 --from-workspace wok_Source --to-workspace wok_Target' },
|
|
49
|
+
{ description: 'Monitor activity of an agent in real time',
|
|
50
|
+
command: 'plazbot agent monitor agt_AbcDef123' },
|
|
51
|
+
{ description: 'Validate a local agent JSON file against the schema',
|
|
52
|
+
command: 'plazbot agent validate ./agent.json' },
|
|
53
|
+
]);
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
.description('Lista todos los agentes del workspace')
|
|
10
|
-
.option('--dev', 'Usar ambiente de desarrollo', false)
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { Agent } from 'plazbot';
|
|
3
|
+
import { getStoredCredentials } from '../../utils/credentials.js';
|
|
4
|
+
import { logger } from '../../utils/logger.js';
|
|
5
|
+
import { addExamples } from '../../utils/help.js';
|
|
6
|
+
export const listCommand = new Command('list')
|
|
7
|
+
.description('List all agents in the workspace')
|
|
8
|
+
.option('--dev', 'Use development environment (localhost:5090)', false)
|
|
11
9
|
.action(async (options) => {
|
|
12
10
|
try {
|
|
13
11
|
// Obtener credenciales guardadas
|
|
14
|
-
const credentials = await
|
|
12
|
+
const credentials = await getStoredCredentials();
|
|
15
13
|
// Crear instancia del agente con las credenciales guardadas
|
|
16
|
-
const agent = new
|
|
14
|
+
const agent = new Agent({
|
|
17
15
|
workspaceId: credentials.workspace,
|
|
18
16
|
apiKey: credentials.apiKey,
|
|
19
17
|
zone: credentials.zone,
|
|
@@ -22,26 +20,30 @@ exports.listCommand = new commander_1.Command('list')
|
|
|
22
20
|
// Obtener lista de agentes
|
|
23
21
|
const agents = await agent.getAgents();
|
|
24
22
|
if (agents.length === 0) {
|
|
25
|
-
|
|
23
|
+
logger.info('No agents found in this workspace');
|
|
26
24
|
return;
|
|
27
25
|
}
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
logger.info('\nAgents:');
|
|
27
|
+
logger.doubleDivider();
|
|
30
28
|
agents.forEach((a, index) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
logger.info(`${index + 1}. ID: ${a.id}`);
|
|
30
|
+
logger.info(` Name: ${a.name}`);
|
|
31
|
+
logger.info(` Status: ${a.enable ? 'Active' : 'Inactive'}`);
|
|
32
|
+
logger.info(` Description: ${a.description}`);
|
|
33
|
+
logger.info(` Created: ${a.createdAt ? new Date(a.createdAt).toLocaleString() : 'N/A'}`);
|
|
34
|
+
logger.divider();
|
|
37
35
|
});
|
|
38
36
|
if (options.dev) {
|
|
39
|
-
|
|
37
|
+
logger.warning('Environment: development');
|
|
40
38
|
}
|
|
41
39
|
}
|
|
42
40
|
catch (error) {
|
|
43
|
-
const message = error instanceof Error ? error.message : '
|
|
44
|
-
|
|
41
|
+
const message = error instanceof Error ? error.message : 'Unknown error while listing agents';
|
|
42
|
+
logger.error(message);
|
|
45
43
|
process.exit(1);
|
|
46
44
|
}
|
|
47
45
|
});
|
|
46
|
+
addExamples(listCommand, [
|
|
47
|
+
{ description: 'List every agent in the active workspace', command: 'plazbot agent list' },
|
|
48
|
+
{ description: 'List against a local backend (dev mode)', command: 'plazbot agent list --dev' },
|
|
49
|
+
]);
|