@velaro/cli 1.4.109 → 1.4.111

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
@@ -40,6 +40,7 @@ import { signatureCommand } from '../lib/commands/signature.js';
40
40
  import { articleCommand } from '../lib/commands/article.js';
41
41
  import { sharepointCommand } from '../lib/commands/sharepoint.js';
42
42
  import { calendlyCommand } from '../lib/commands/calendly.js';
43
+ import { imageCommand } from '../lib/commands/image.js';
43
44
  import { copilotStudioCommand } from '../lib/commands/copilotstudio.js';
44
45
  import { acuityCommand } from '../lib/commands/acuity.js';
45
46
  import { avatarCommand } from '../lib/commands/avatar.js';
@@ -122,6 +123,7 @@ import { emailInboxCommand } from '../lib/commands/email-inbox.js';
122
123
  import { callbackCommand } from '../lib/commands/callback.js';
123
124
  import { caseCommand } from '../lib/commands/case.js';
124
125
  import { pickupCommand } from '../lib/commands/pickup.js';
126
+ import { siteSaleCommand } from '../lib/commands/site-sale.js';
125
127
  import { visitorMonitorCommand } from '../lib/commands/visitor-monitor.js';
126
128
  import { visitorLinkCommand } from '../lib/commands/visitor-link.js';
127
129
  import { applePayCommand } from '../lib/commands/apple-pay.js';
@@ -200,6 +202,7 @@ await yargs(hideBin(process.argv))
200
202
  .command(articleCommand)
201
203
  .command(sharepointCommand)
202
204
  .command(calendlyCommand)
205
+ .command(imageCommand)
203
206
  .command(copilotStudioCommand)
204
207
  .command(acuityCommand)
205
208
  .command(avatarCommand)
@@ -284,6 +287,7 @@ await yargs(hideBin(process.argv))
284
287
  .command(callbackCommand)
285
288
  .command(caseCommand)
286
289
  .command(pickupCommand)
290
+ .command(siteSaleCommand)
287
291
  .command(visitorMonitorCommand)
288
292
  .command(visitorLinkCommand)
289
293
  .command(applePayCommand)
@@ -128,20 +128,45 @@ export const avatarCommand = {
128
128
  .option('site', { type: 'number', demandOption: true, describe: 'Site ID' })
129
129
  .option('max-minutes', { type: 'number', describe: 'Monthly avatar video minutes cap (whole number 1-100000)' })
130
130
  .option('max-tts-chars', { type: 'number', describe: 'Monthly avatar TTS character cap (whole number 1-100000000)' })
131
+ .option('voice-stability', { type: 'number', describe: 'ElevenLabs stability 0-1 (lower = livelier, default 0.35)' })
132
+ .option('voice-similarity', { type: 'number', describe: 'ElevenLabs similarity boost 0-1 (default 0.8)' })
133
+ .option('voice-style', { type: 'number', describe: 'ElevenLabs style 0-1 (higher = more animated, default 0.45)' })
134
+ .option('voice-speed', { type: 'number', describe: 'ElevenLabs speed 0.7-1.2 (default 1.05)' })
135
+ .option('background-mode', { type: 'string', describe: 'Backdrop frame: none | color | gradient | image' })
136
+ .option('background-value', { type: 'string', describe: 'color #1e293b | gradient "#1e293b,#7c3aed" | https image URL' })
137
+ .option('regular-chat', { type: 'boolean', describe: 'Allow the avatar in the regular chat on pages matching --url-rules' })
138
+ .option('zoom', { type: 'number', describe: 'Camera closeness: zoom 100-250 percent (160 = head and shoulders)' })
139
+ .option('focal-x', { type: 'number', describe: 'Framing focal X 0-100 (default 50)' })
140
+ .option('focal-y', { type: 'number', describe: 'Framing focal Y 0-100 (default 35)' })
141
+ .option('shape', { type: 'string', describe: 'rounded | circle | square' })
142
+ .option('corner-radius', { type: 'number', describe: 'Corner radius 0-48 px (rounded shape)' })
143
+ .option('mirror', { type: 'boolean', describe: 'Mirror the video horizontally' })
144
+ .option('speaking-ring', { type: 'boolean', describe: 'Ring around the avatar while active' })
145
+ .option('muted', { type: 'boolean', describe: 'Start muted' })
146
+ .option('volume', { type: 'number', describe: 'Volume 0-100' })
147
+ .option('align', { type: 'string', describe: 'left | center | right' })
148
+ .option('greeting', { type: 'string', describe: 'Line spoken at session start (empty clears)' })
149
+ .option('voice-map', { type: 'string', describe: 'JSON map of language code to ElevenLabs voice id, e.g. {"es":"id"} (empty clears)' })
150
+ .option('url-rules', { type: 'string', describe: 'Pages for regular-chat avatar, separated by \\n or commas: plain = URL contains, re:<regex>. Empty string clears.' })
131
151
  .option('motion-level', { type: 'string', describe: 'Body motion: off | subtle | natural | expressive. Empty string resets to the default.' })
132
152
  .option('motion-intensity', { type: 'number', describe: 'Body motion strength percent (25-150).' }),
133
153
  handler: runCommand(async argv => {
134
154
  const body = {};
135
155
  applyMotionArgs(body, argv);
156
+ for (const [opt, key] of [['voice-stability', 'voiceStability'], ['voice-similarity', 'voiceSimilarity'], ['voice-style', 'voiceStyle'], ['voice-speed', 'voiceSpeed'], ['background-mode', 'backgroundMode'], ['background-value', 'backgroundValue'], ['regular-chat', 'regularChatEnabled'], ['zoom', 'zoomPercent'], ['focal-x', 'focalX'], ['focal-y', 'focalY'], ['shape', 'shape'], ['corner-radius', 'cornerRadiusPx'], ['mirror', 'mirror'], ['speaking-ring', 'speakingRing'], ['muted', 'mutedByDefault'], ['volume', 'volume'], ['align', 'align'], ['greeting', 'greetingLine'], ['voice-map', 'voiceIdByLanguage']]) {
157
+ if (argv[opt] !== undefined) body[key] = argv[opt];
158
+ }
159
+ if (argv['url-rules'] !== undefined) body.regularChatUrlRules = String(argv['url-rules']).replace(/\\n|,/g, '\n');
136
160
  for (const [opt, key, max] of [['max-minutes', 'maxAvatarMinutesPerMonth', 100000], ['max-tts-chars', 'maxAvatarTtsChars', 100000000]]) {
137
161
  if (argv[opt] === undefined) continue;
138
162
  if (!Number.isInteger(argv[opt]) || argv[opt] < 1 || argv[opt] > max) throw new Error(`--${opt} must be a whole number between 1 and ${max} (never unlimited)`);
139
163
  body[key] = argv[opt];
140
164
  }
141
- if (!Object.keys(body).length) throw new Error('Provide --max-minutes, --max-tts-chars, --motion-level and/or --motion-intensity');
165
+ if (!Object.keys(body).length) throw new Error('Provide at least one setting (--max-minutes, --voice-style, --background-mode, --regular-chat, --motion-level, ...)');
142
166
  const data = await request('POST', `/Avatar/superadmin/config?siteId=${argv.site}`, body);
143
167
  if (!data.success) throw new Error(data.error || 'Set avatar caps failed');
144
- console.log(`\n✓ Avatar settings updated for site ${argv.site}`);
168
+ console.log(`
169
+ ✓ Avatar settings updated for site ${argv.site}`);
145
170
  console.log(` Body motion: ${data.motionLevel || '(default: natural)'} @ ${data.motionIntensityPercent ?? 100}%`);
146
171
  console.log(` Max minutes/mo: ${data.maxAvatarMinutesPerMonth}`);
147
172
  console.log(` Max TTS chars/mo: ${data.maxAvatarTtsChars}\n`);
@@ -0,0 +1,39 @@
1
+ import { spawnSync } from 'node:child_process';
2
+ import { validateImageArgs, buildBrandImageArgs } from '../image.js';
3
+
4
+ // velaro image generate|composite
5
+ // Logos are NEVER AI-generated: the real SVG from the official asset library is composited after generation.
6
+ function run(sub, argv) {
7
+ const v = validateImageArgs({ prompt: argv.prompt, logo: argv.logo, logoPlacement: argv.logoPlacement });
8
+ if (!v.ok) { console.error(v.error); process.exit(2); }
9
+ const r = spawnSync(process.execPath, buildBrandImageArgs(sub, argv), { stdio: 'inherit' });
10
+ process.exit(r.status ?? 1);
11
+ }
12
+
13
+ const logoOpts = y => y
14
+ .option('logo', { type: 'string', describe: 'Official logo asset: lockup, lockup-white, lockup-black, icon, icon-white or an official SVG file name' })
15
+ .option('logo-placement', { type: 'string', describe: 'cx,cy,width in pixels of the image (required with --logo)' })
16
+ .option('curvature', { type: 'number', describe: 'Cylinder wrap 0-0.9 (default 0.55)' })
17
+ .option('out', { type: 'string', demandOption: true, describe: 'Output PNG path' });
18
+
19
+ export const imageCommand = {
20
+ command: 'image <subcommand>',
21
+ describe: 'Brand images: generate via Studio and composite the REAL logo (never AI-generated)',
22
+ builder: yargs => yargs
23
+ .command({
24
+ command: 'generate',
25
+ describe: 'Generate an image via Studio; with --logo the prompt gets "no logo, no text" and the real SVG is composited',
26
+ builder: y => logoOpts(y)
27
+ .option('prompt', { type: 'string', demandOption: true })
28
+ .option('size', { type: 'string', default: '1024x1024' }),
29
+ handler: argv => run('generate', argv),
30
+ })
31
+ .command({
32
+ command: 'composite',
33
+ describe: 'Composite the real logo onto an existing image',
34
+ builder: y => logoOpts(y).option('base', { type: 'string', demandOption: true }).demandOption('logo'),
35
+ handler: argv => run('composite', argv),
36
+ })
37
+ .demandCommand(1),
38
+ handler: () => {},
39
+ };
@@ -0,0 +1,118 @@
1
+ import { messagingGet, messagingPost, messagingPut, messagingDel } from '../api.js';
2
+ import { runCommand } from '../run.js';
3
+
4
+ // ── velaro site-sale ───────────────────────────────────────────────────────────
5
+ // CLI surface for "Current Sales": a time-boxed override Q&A. While a sale is active
6
+ // the bot answers sales/discount/coupon questions deterministically and can issue
7
+ // per-customer coupons; it stops at the end time. siteId is applied server-side from
8
+ // the vmsg-siteId header (see cli/lib/api.js messagingRequest) -- never a CLI arg.
9
+ //
10
+ // Backend contract: velaro-messaging SiteSalesController
11
+ // GET SiteSales
12
+ // POST SiteSales
13
+ // PUT SiteSales/{id}
14
+ // POST SiteSales/{id}/end
15
+ // DELETE SiteSales/{id}
16
+
17
+ const BOLD = '\x1b[1m';
18
+ const DIM = '\x1b[2m';
19
+ const GRN = '\x1b[32m';
20
+ const RST = '\x1b[0m';
21
+
22
+ export function buildSaleBody(argv) {
23
+ return {
24
+ name: argv.name,
25
+ description: argv.description,
26
+ appliesTo: argv.appliesTo,
27
+ appliesToValue: argv.appliesToValue,
28
+ discountType: argv.discountType,
29
+ discountValue: argv.discountValue,
30
+ startsAtUtc: argv.startsAtUtc,
31
+ endsAtUtc: argv.endsAtUtc,
32
+ couponCode: argv.couponCode,
33
+ autoGenerateCoupons: argv.autoGenerateCoupons,
34
+ maxCouponsPerCustomer: argv.maxCouponsPerCustomer,
35
+ couponUsageLimit: argv.couponUsageLimit,
36
+ couponExpiresHours: argv.couponExpiresHours,
37
+ };
38
+ }
39
+
40
+ function addSaleOptions(y, { creating }) {
41
+ return y
42
+ .option('name', { describe: 'Sale name', type: 'string', demandOption: creating })
43
+ .option('description', { describe: 'Short description the bot can quote', type: 'string' })
44
+ .option('applies-to', { describe: 'Scope: all | category | products', type: 'string', choices: ['all', 'category', 'products'] })
45
+ .option('applies-to-value', { describe: 'Category name or comma-separated products', type: 'string' })
46
+ .option('discount-type', { describe: 'percentage | fixed_amount | free_shipping', type: 'string', choices: ['percentage', 'fixed_amount', 'free_shipping'], demandOption: creating })
47
+ .option('discount-value', { describe: 'Percent or fixed amount', type: 'number' })
48
+ .option('starts-at-utc', { describe: 'ISO 8601 start (UTC)', type: 'string', demandOption: creating })
49
+ .option('ends-at-utc', { describe: 'ISO 8601 end (UTC); the bot stops answering at this time', type: 'string', demandOption: creating })
50
+ .option('coupon-code', { describe: 'Optional shared coupon code', type: 'string' })
51
+ .option('auto-generate-coupons', { describe: 'Issue a unique coupon per customer', type: 'boolean' })
52
+ .option('max-coupons-per-customer',{ describe: 'Max coupons issued to one customer', type: 'number' })
53
+ .option('coupon-usage-limit', { describe: 'Uses allowed per coupon', type: 'number' })
54
+ .option('coupon-expires-hours', { describe: 'Hours before an issued coupon expires', type: 'number' });
55
+ }
56
+
57
+ async function listHandler() {
58
+ const sales = await messagingGet('/SiteSales');
59
+ if (!Array.isArray(sales) || !sales.length) {
60
+ console.log('\n No current sales for this site.\n');
61
+ return;
62
+ }
63
+ console.log(`\n${BOLD}Current Sales${RST}\n`);
64
+ for (const s of sales) {
65
+ console.log(` #${s.id} ${s.name} ${DIM}${s.discountType ?? ''} ${s.discountValue ?? ''} ${s.startsAtUtc ?? '-'} -> ${s.endsAtUtc ?? '-'}${RST}`);
66
+ }
67
+ console.log('');
68
+ }
69
+
70
+ async function createHandler(argv) {
71
+ const sale = await messagingPost('/SiteSales', buildSaleBody(argv));
72
+ console.log(`\n${GRN}✓${RST} Sale created${sale && sale.id != null ? ` (#${sale.id})` : ''}.\n`);
73
+ }
74
+
75
+ async function updateHandler(argv) {
76
+ await messagingPut(`/SiteSales/${encodeURIComponent(argv.id)}`, buildSaleBody(argv));
77
+ console.log(`\n${GRN}✓${RST} Sale ${argv.id} updated.\n`);
78
+ }
79
+
80
+ async function endHandler(argv) {
81
+ await messagingPost(`/SiteSales/${encodeURIComponent(argv.id)}/end`, {});
82
+ console.log(`\n${GRN}✓${RST} Sale ${argv.id} ended.\n`);
83
+ }
84
+
85
+ async function deleteHandler(argv) {
86
+ await messagingDel(`/SiteSales/${encodeURIComponent(argv.id)}`);
87
+ console.log(`\n${GRN}✓${RST} Sale ${argv.id} deleted.\n`);
88
+ }
89
+
90
+ export const siteSaleCommand = {
91
+ command: 'site-sale <subcommand>',
92
+ describe: 'Current Sales -- temporary sales or discounts the bot answers about and can issue coupons for',
93
+ builder: (y) => y
94
+ .command({ command: 'list', describe: 'List current sales', handler: runCommand(listHandler) })
95
+ .command({
96
+ command: 'create', describe: 'Create a sale',
97
+ builder: (y2) => addSaleOptions(y2, { creating: true }),
98
+ handler: runCommand(createHandler),
99
+ })
100
+ .command({
101
+ command: 'update <id>', describe: 'Update a sale (omit a flag to leave it unchanged)',
102
+ builder: (y2) => addSaleOptions(y2.positional('id', { describe: 'Sale ID', type: 'number' }), { creating: false }),
103
+ handler: runCommand(updateHandler),
104
+ })
105
+ .command({
106
+ command: 'end <id>', describe: 'End a sale now',
107
+ builder: (y2) => y2.positional('id', { describe: 'Sale ID', type: 'number' }),
108
+ handler: runCommand(endHandler),
109
+ })
110
+ .command({
111
+ command: 'delete <id>', describe: 'Delete a sale',
112
+ builder: (y2) => y2.positional('id', { describe: 'Sale ID', type: 'number' }),
113
+ handler: runCommand(deleteHandler),
114
+ })
115
+ .demandCommand(1, 'Specify a site-sale subcommand: list | create | update | end | delete')
116
+ .strict(),
117
+ handler: () => {},
118
+ };
@@ -181,6 +181,13 @@ async function connectionEvidence(args) {
181
181
  console.log(JSON.stringify(result, null, 2));
182
182
  }
183
183
 
184
+ async function hubspotCalls(args) {
185
+ // velaro-messaging SupportToolsController.GetHubSpotCallLoggingAsync (staff-only, read-only).
186
+ const take = args.take ? `?take=${encodeURIComponent(args.take)}` : '';
187
+ const result = await messagingGet(`SupportTools/sites/${args.site}/hubspot/calls${take}`);
188
+ console.log(JSON.stringify(result, null, 2));
189
+ }
190
+
184
191
  export function supportCommand(yargs) {
185
192
  return yargs
186
193
  .command('connection-timeline', 'Raw ordered agent connection events (connect/disconnect/reconnect) for one agent in a time window (Velaro staff, read-only)', y => y
@@ -190,6 +197,10 @@ export function supportCommand(yargs) {
190
197
  .option('to', { type: 'string', desc: 'ISO end (default: now)' })
191
198
  .option('limit', { type: 'number', default: 2000, desc: 'Max events (1-5000)' })
192
199
  , a => connectionTimeline(a))
200
+ .command('hubspot-calls', 'HubSpot call-logging snapshot for a site: connection state and the last N calls with their HubSpot log row (Velaro staff, read-only)', y => y
201
+ .option('site', { type: 'number', demandOption: true, desc: 'Site ID' })
202
+ .option('take', { type: 'number', desc: 'Number of recent calls (default 20)' })
203
+ , a => hubspotCalls(a))
193
204
  .command('connection-evidence', 'Dispute-grade connection evidence for a site: Velaro probe uptime, incidents (incl. excluded, with reason), per-agent disconnects and client-vs-server reconciliation (Velaro staff, read-only)', y => y
194
205
  .option('site', { type: 'number', demandOption: true, desc: 'Site ID' })
195
206
  .option('from', { type: 'string', desc: 'ISO start (default: 30 days before --to)' })
package/lib/image.js ADDED
@@ -0,0 +1,32 @@
1
+ // Brand image helper for `velaro image`. RULE: Velaro logos are NEVER AI-generated.
2
+ // Generate WITHOUT a logo, then composite the real SVG from the official asset library
3
+ // (velaro-marketing/assets/brand/logos-2026/SVG) via velaro-marketing/scripts/brand-image.cjs.
4
+ import path from 'node:path';
5
+ import os from 'node:os';
6
+
7
+ const LOGO_WORDS = /\b(logo|wordmark|monogram|brand mark|emblem)\b/i;
8
+
9
+ export function marketingRepo(env = process.env) {
10
+ return env.VELARO_MARKETING_REPO || path.join(os.homedir(), 'source', 'repos', 'velaro-marketing');
11
+ }
12
+
13
+ // Guard: a prompt asking the model to draw a logo must use --logo instead.
14
+ export function validateImageArgs({ prompt, logo, logoPlacement }) {
15
+ if (!logo && prompt && LOGO_WORDS.test(prompt) && !/no logo/i.test(prompt)) {
16
+ return { ok: false, error: 'Prompt asks the image model for a logo/brand text. Logos are NEVER AI-generated: pass --logo <asset-name> (lockup, lockup-white, lockup-black, icon, icon-white, or an official SVG file name) and --logo-placement cx,cy,width.' };
17
+ }
18
+ if (logo && !/^\s*-?\d+(\.\d+)?\s*,\s*-?\d+(\.\d+)?\s*,\s*\d+(\.\d+)?\s*$/.test(String(logoPlacement || ''))) {
19
+ return { ok: false, error: '--logo requires --logo-placement cx,cy,width (pixels in the generated image).' };
20
+ }
21
+ return { ok: true };
22
+ }
23
+
24
+ // Builds the argv for scripts/brand-image.cjs.
25
+ export function buildBrandImageArgs(sub, a, env = process.env) {
26
+ const script = path.join(marketingRepo(env), 'scripts', 'brand-image.cjs');
27
+ const args = [script, sub];
28
+ const add = (k, v) => { if (v !== undefined && v !== null && v !== '') args.push(`--${k}`, String(v)); };
29
+ add('prompt', a.prompt); add('base', a.base); add('out', a.out); add('size', a.size);
30
+ add('logo', a.logo); add('logo-placement', a.logoPlacement); add('curvature', a.curvature);
31
+ return args;
32
+ }
@@ -0,0 +1,19 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { validateImageArgs, buildBrandImageArgs } from './image.js';
4
+
5
+ test('rejects a prompt that asks the model to draw a logo without --logo', () => {
6
+ assert.equal(validateImageArgs({ prompt: 'white mug with a Velaro logo' }).ok, false);
7
+ assert.equal(validateImageArgs({ prompt: 'white mug, no logo' }).ok, true);
8
+ });
9
+
10
+ test('--logo requires a cx,cy,width placement', () => {
11
+ assert.equal(validateImageArgs({ prompt: 'mug', logo: 'lockup' }).ok, false);
12
+ assert.equal(validateImageArgs({ prompt: 'mug', logo: 'lockup', logoPlacement: '510,600,250' }).ok, true);
13
+ });
14
+
15
+ test('builds argv for the marketing brand-image script', () => {
16
+ const a = buildBrandImageArgs('generate', { prompt: 'mug', out: 'x.png', logo: 'lockup', logoPlacement: '1,2,3' }, { VELARO_MARKETING_REPO: '/m' });
17
+ assert.ok(a[0].replace(/\\/g, '/').endsWith('/m/scripts/brand-image.cjs'));
18
+ assert.deepEqual(a.slice(1), ['generate', '--prompt', 'mug', '--out', 'x.png', '--logo', 'lockup', '--logo-placement', '1,2,3']);
19
+ });
@@ -0,0 +1,25 @@
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ import { readFileSync } from 'node:fs';
4
+ import { dirname, join } from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { buildSaleBody, siteSaleCommand } from './commands/site-sale.js';
7
+
8
+ const here = dirname(fileURLToPath(import.meta.url));
9
+
10
+ test('sale body carries only the SiteSales contract fields and never a site id', () => {
11
+ const body = buildSaleBody({ name: 'n', discountType: 'percentage', discountValue: 20, siteId: 5, startsAtUtc: 'a', endsAtUtc: 'b' });
12
+ assert.deepEqual(Object.keys(body).sort(), [
13
+ 'appliesTo', 'appliesToValue', 'autoGenerateCoupons', 'couponCode', 'couponExpiresHours', 'couponUsageLimit',
14
+ 'description', 'discountType', 'discountValue', 'endsAtUtc', 'maxCouponsPerCustomer', 'name', 'startsAtUtc',
15
+ ]);
16
+ assert.equal(body.discountValue, 20);
17
+ });
18
+
19
+ test('site-sale command registered in velaro.js with all five subcommands', () => {
20
+ assert.equal(siteSaleCommand.command, 'site-sale <subcommand>');
21
+ const src = readFileSync(join(here, '..', 'bin', 'velaro.js'), 'utf8');
22
+ assert.match(src, /\.command\(siteSaleCommand\)/);
23
+ const cmdSrc = readFileSync(join(here, 'commands', 'site-sale.js'), 'utf8');
24
+ for (const c of ["'list'", "'create'", "'update <id>'", "'end <id>'", "'delete <id>'"]) assert.ok(cmdSrc.includes(c), c);
25
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@velaro/cli",
3
- "version": "1.4.109",
3
+ "version": "1.4.111",
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": {