@velaro/cli 1.4.214 → 1.4.216

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/bin/velaro.js CHANGED
@@ -17,6 +17,7 @@ import { partFinderCommand } from '../lib/commands/part-finder.js';
17
17
  import { knowledgeCommand } from '../lib/commands/knowledge.js';
18
18
  import { productCommand } from '../lib/commands/product.js';
19
19
  import { apiUsageCommand } from '../lib/commands/api-usage.js';
20
+ import { conversationActionCommand } from '../lib/commands/conversation-action.js';
20
21
  import { mcpKeyCommand } from '../lib/commands/mcp-key.js';
21
22
  import { deployStateCommand } from '../lib/commands/deploy-state.js';
22
23
  import { checkCommand } from '../lib/commands/check.js';
@@ -189,6 +190,7 @@ await (registerStaffCommands ? registerStaffCommands(baseYargs) : baseYargs)
189
190
  .command(productCommand)
190
191
  .command(mcpKeyCommand)
191
192
  .command(apiUsageCommand)
193
+ .command(conversationActionCommand)
192
194
  .command(deployStateCommand)
193
195
  .command(checkCommand)
194
196
  .command(siteCommand)
@@ -171,6 +171,12 @@ async function addTagHandler(argv) {
171
171
  console.log(result.success ? `\n✅ Tag ${argv.tagId} added to contact #${argv.id}.\n` : '\nFailed to add tag.\n');
172
172
  }
173
173
 
174
+ // DELETE Contacts/{id}/Tags/{tagId} -> ContactsController.RemoveTag
175
+ async function removeTagHandler(argv) {
176
+ const result = await request('DELETE', `Contacts/${argv.id}/Tags/${argv.tagId}`);
177
+ console.log(result && result.success ? `\nTag ${argv.tagId} removed from contact #${argv.id}.\n` : '\nFailed to remove tag.\n');
178
+ }
179
+
174
180
  const tagsCommand = {
175
181
  command: 'tags <subcommand>',
176
182
  describe: 'Manage contact tags',
@@ -182,7 +188,13 @@ const tagsCommand = {
182
188
  builder: (y2) => y2.positional('id', { type: 'number' }).positional('tagId', { type: 'number' }),
183
189
  handler: runCommand(addTagHandler),
184
190
  })
185
- .demandCommand(1, 'Specify a tags subcommand: list | add'),
191
+ .command({
192
+ command: 'remove <id> <tagId>',
193
+ describe: 'Remove a tag from a contact',
194
+ builder: (y2) => y2.positional('id', { type: 'number' }).positional('tagId', { type: 'number' }),
195
+ handler: runCommand(removeTagHandler),
196
+ })
197
+ .demandCommand(1, 'Specify a tags subcommand: list | add | remove'),
186
198
  handler: () => {},
187
199
  };
188
200
 
@@ -0,0 +1,24 @@
1
+ import { get, post } from '../api.js';
2
+ import { runCommand } from '../run.js';
3
+
4
+ // velaro conversation-action: REST actions on a conversation. Mirrors the conversation_action_send_message,
5
+ // conversation_action_resolve, conversation_action_assign and conversation_action_notes MCP tools.
6
+ export const conversationActionCommand = {
7
+ command: 'conversation-action <action> <id>',
8
+ describe: 'send | resolve | assign | notes on a conversation',
9
+ builder: y => y
10
+ .positional('action', { choices: ['send', 'resolve', 'assign', 'notes'] })
11
+ .positional('id', { type: 'number' })
12
+ .option('text', { type: 'string', describe: 'Message text (send)' })
13
+ .option('agent-id', { type: 'number', describe: 'Agent id (assign, optional for send/resolve)' })
14
+ .option('topic', { type: 'string', describe: 'Topic (resolve)' }),
15
+ handler: runCommand(async argv => {
16
+ const base = `/api/v1/conversations/${argv.id}`;
17
+ let d;
18
+ if (argv.action === 'send') d = await post(`${base}/messages`, { text: argv.text, agentId: argv.agentId });
19
+ else if (argv.action === 'resolve') d = await post(`${base}/resolve`, { topic: argv.topic, agentId: argv.agentId });
20
+ else if (argv.action === 'assign') d = await post(`${base}/assign`, { agentId: argv.agentId });
21
+ else d = await get(`${base}/notes`);
22
+ console.log(JSON.stringify(d, null, 2));
23
+ }),
24
+ };
@@ -42,7 +42,10 @@ export const publicApiCommand = {
42
42
  page: { type: 'number' }, 'page-size': { type: 'number' },
43
43
  }, (a) => show(a.id ? `/api/v1/appointments/${a.id}` : `/api/v1/appointments${qs({ status: a.status, from: a.from, to: a.to, page: a.page, pageSize: a['page-size'] })}`))
44
44
  .command('agents', 'List the site agents', {}, () => show('/api/v1/agents'))
45
- .command('teams', 'List the site teams', {}, () => show('/api/v1/teams'))
45
+ .command('agent-availability', 'Agent availability with a count per status', { team: { type: 'number', describe: 'limit to one team id' } }, (a) => show(`/api/v1/agents/availability${qs({ teamId: a.team })}`))
46
+ .command('teams [id]', 'List the site teams or fetch one with its members', {}, (a) => show(a.id ? `/api/v1/teams/${a.id}` : '/api/v1/teams'))
47
+ .command('webhook-events', 'List webhook event types and the signature scheme', {}, () => show('/api/v1/webhooks/events'))
48
+ .command('webhook-test <id>', 'Queue a signed test delivery to a webhook', {}, (a) => send('POST', `/api/v1/webhooks/${a.id}/test`, {}))
46
49
  .command('webhooks', 'List outbound webhook subscriptions', {}, () => show('/api/v1/webhooks'))
47
50
  .command('webhook-create <url>', 'Create a webhook (secret is shown once)', { events: { type: 'string', describe: 'comma separated: contact_tag_added,conversation_started,conversation_closed' } },
48
51
  (a) => send('POST', '/api/v1/webhooks', { url: a.url, events: a.events ? a.events.split(',') : undefined }))
@@ -50,6 +53,6 @@ export const publicApiCommand = {
50
53
  .command('note <contactId> <text>', 'Add a note to a contact', {}, (a) => send('POST', `/api/v1/contacts/${a.contactId}/notes`, { note: a.text }))
51
54
  .command('contact-update <id>', 'Partially update a contact (only the flags you pass change)', { email: { type: 'string' }, 'first-name': { type: 'string' }, 'last-name': { type: 'string' }, phone: { type: 'string' }, mobile: { type: 'string' }, company: { type: 'string' }, 'job-title': { type: 'string' } },
52
55
  (a) => send('PATCH', `/api/v1/contacts/${a.id}`, Object.fromEntries(Object.entries({ email: a.email, firstName: a['first-name'], lastName: a['last-name'], phone: a.phone, mobile: a.mobile, company: a.company, jobTitle: a['job-title'] }).filter(([, v]) => v !== undefined))))
53
- .demandCommand(1, 'Specify: conversations | appointments | agents | teams | webhooks | webhook-create | webhook-delete | note | contact-update'),
56
+ .demandCommand(1, 'Specify: conversations | appointments | agents | agent-availability | teams | webhooks | webhook-events | webhook-test | webhook-create | webhook-delete | note | contact-update'),
54
57
  handler: () => {},
55
58
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/cli",
3
- "version": "1.4.214",
3
+ "version": "1.4.216",
4
4
  "description": "Velaro Workspace v20 — command-line interface for managing bots, knowledge base ingestion, MCP API keys, search indexes, and ops health.",
5
5
  "type": "module",
6
6
  "bin": {