@velaro/cli 1.4.152 → 1.4.154
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.
|
@@ -3,12 +3,12 @@ import { runCommand } from '../run.js';
|
|
|
3
3
|
|
|
4
4
|
const print = (data) => console.log(JSON.stringify(data, null, 2));
|
|
5
5
|
|
|
6
|
-
// velaro canned-learning <list|generate|approve|reject|rollback|edits|record-edit|teams> (REST: messaging /CannedLearning/*)
|
|
6
|
+
// velaro canned-learning <list|generate|approve|reject|rollback|edits|record-edit|teams|usage> (REST: messaging /CannedLearning/*)
|
|
7
7
|
export const cannedLearningCommand = {
|
|
8
8
|
command: 'canned-learning <action> [id]',
|
|
9
9
|
describe: 'AI canned message learning: list/generate suggestions, approve/reject/rollback (human review)',
|
|
10
10
|
builder: (y) => y
|
|
11
|
-
.positional('action', { choices: ['list', 'generate', 'approve', 'reject', 'rollback', 'edits', 'record-edit', 'teams'] })
|
|
11
|
+
.positional('action', { choices: ['list', 'generate', 'approve', 'reject', 'rollback', 'edits', 'record-edit', 'teams', 'usage'] })
|
|
12
12
|
.positional('id', { type: 'number' })
|
|
13
13
|
.option('team-id', { type: 'number', describe: 'list/edits: only this team; generate: run for this team (team managers must pass one they manage)' })
|
|
14
14
|
.option('state', { type: 'string', default: 'pending_review', describe: 'pending_review|approved|rejected|rolled_back|all' })
|
|
@@ -22,6 +22,7 @@ export const cannedLearningCommand = {
|
|
|
22
22
|
if (a.action === 'generate') return print(await messagingPost(`${base}/generate`, { teamId: a.teamId ?? null }));
|
|
23
23
|
if (a.action === 'edits') return print(await messagingGet(`${base}/edit-events${a.teamId != null ? `?teamId=${encodeURIComponent(a.teamId)}` : ''}`));
|
|
24
24
|
if (a.action === 'teams') return print(await messagingGet(`${base}/teams`));
|
|
25
|
+
if (a.action === 'usage') return print(await messagingGet(`${base}/usage`));
|
|
25
26
|
if (a.action === 'record-edit') {
|
|
26
27
|
if (a.id == null || !a.finalText) throw new Error('record-edit requires a canned response id and --final-text');
|
|
27
28
|
return print(await messagingPost(`${base}/edit-events`, { cannedResponseId: a.id, finalText: a.finalText }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { messagingGet, messagingPost } from '../api.js';
|
|
1
|
+
import { get as adminGet, messagingGet, messagingPost } from '../api.js';
|
|
2
2
|
import { runCommand } from '../run.js';
|
|
3
3
|
import { yearInReviewBody } from '../year-in-review-range.js';
|
|
4
4
|
|
|
@@ -24,10 +24,30 @@ const REPORTS = {
|
|
|
24
24
|
'bonus': 'Bonus insights, pick one with --name: ' + 'coverage_gap | next_best_fix | escalation_risk | skill_gap_matrix | handle_quality_outliers | abandon_causes' + ' (deterministic, no AI cost; assumptions are echoed in the result)',
|
|
25
25
|
'operations-briefing': 'One run of every package report from a single data load, plus one cached token-capped AI narrative (--no-narrative skips it); reports its own AI cost',
|
|
26
26
|
'entitled': 'Which Enterprise Reports items this site holds (includes Entry-point routing and Automatic tagging, which have no report of their own)',
|
|
27
|
+
'handoff-map': 'Who hands chats to whom: bot, agent, team and queue edges, initiators, reasons, bounce-backs, chain length',
|
|
28
|
+
'routing-performance': 'Routing rule and workflow decisions, misses, fallbacks, re-transfers and queue wait by rule, with a daily trend',
|
|
29
|
+
'skill-fit': 'Skill calls by theme and tool: success, error classes, and what happened to the chat afterward',
|
|
30
|
+
'contact-drivers-by-page': 'Chats by starting page and host: share, top themes, missed and transfer rate',
|
|
31
|
+
'lead-funnel': 'Lead stages captured, qualified, CRM pushed, followed up, converted: counts, rates and time between stages',
|
|
32
|
+
'revenue-at-risk': 'Abandoned cart value and order value linked to missed, abandoned or negative chats, by platform and currency',
|
|
33
|
+
'after-hours-gap': 'Chats inside vs outside scheduled hours: volume, missed rate, bot-handled share and wait for a human',
|
|
34
|
+
'ai-answer-grounding': 'Share of bot chats with a retrieved source, source mix, confidence, top articles and outcomes',
|
|
35
|
+
'ai-skills-actions': 'Skill and action calls: success, error classes, duration, who triggered them, by bot and day',
|
|
36
|
+
'refunds-discounts': 'Refunds, discounts, credits and coupons by kind, actor and platform, compared with configured caps',
|
|
37
|
+
'kb-effectiveness': 'Article views, bot use and helpful votes, with heavily used, poorly rated articles flagged',
|
|
38
|
+
'missed-call-recovery-ivr-funnel': 'Missed calls recovered by callback, chat or return call, and IVR step entries, timeouts, abandons and transitions',
|
|
39
|
+
'voice-intelligence': 'Call reasons by theme: sentiment, duration, missed share and transfers (no talk-to-silence ratio)',
|
|
40
|
+
'outreach-results': 'Email and SMS outreach delivery, failures by error code, replies, opt-outs and resulting chats',
|
|
41
|
+
'workload-balance': 'Chats per available hour by agent with over- and under-loaded flags',
|
|
42
|
+
'benchmarks': 'Your theme share against the industry vertical median and spread, vertical level only',
|
|
43
|
+
'commerce-sales-loss': 'Sales-loss themes by revenue affected, refund rate, repeat purchase after contact and abandoned carts, by platform',
|
|
27
44
|
'weekly-brief-send-test': 'Email this week\'s brief to the signed-in user',
|
|
28
45
|
'year-in-review': 'Build the 12-month Year in review document: --from/--to (default last 12 whole Pacific months) starts a build and prints its id; --id <id> checks status and the download link',
|
|
29
46
|
};
|
|
30
47
|
|
|
48
|
+
// Items 18-34 are hosted in velaro-admin (GET EnterpriseReports/<report>); everything above is hosted in velaro-messaging.
|
|
49
|
+
export const ADMIN_HOSTED_REPORTS = ['handoff-map', 'routing-performance', 'skill-fit', 'contact-drivers-by-page', 'lead-funnel', 'revenue-at-risk', 'after-hours-gap', 'ai-answer-grounding', 'ai-skills-actions', 'refunds-discounts', 'kb-effectiveness', 'missed-call-recovery-ivr-funnel', 'voice-intelligence', 'outreach-results', 'workload-balance', 'benchmarks', 'commerce-sales-loss'];
|
|
50
|
+
|
|
31
51
|
export const enterpriseReportsCommand = {
|
|
32
52
|
command: 'enterprise-reports <report>',
|
|
33
53
|
describe: 'Enterprise Reports package (enterprise-internal): ' + Object.keys(REPORTS).join(' | '),
|
|
@@ -48,6 +68,7 @@ export const enterpriseReportsCommand = {
|
|
|
48
68
|
.option('max-concurrent', { type: 'number', describe: 'demand-coverage: assumed chats an agent handles at once (1-10, default 3)' })
|
|
49
69
|
.option('time-zone', { type: 'string', describe: 'demand-coverage: IANA time zone (default America/Los_Angeles)' })
|
|
50
70
|
.option('low-score', { type: 'number', describe: 'bot-containment: QA score below which a handed-off chat counts as regret (1-100, default 60)' })
|
|
71
|
+
.option('platform', { type: 'string', describe: 'revenue-at-risk, refunds-discounts, commerce-sales-loss: narrow to one connected platform (shopify|bigcommerce|woocommerce|magento|square)' })
|
|
51
72
|
.option('include-demo', { type: 'boolean', describe: 'Show only the seeded sample (demo) data' })
|
|
52
73
|
.option('name', { type: 'string', describe: 'bonus: which analysis (coverage_gap|next_best_fix|escalation_risk|skill_gap_matrix|handle_quality_outliers|abandon_causes)' })
|
|
53
74
|
.option('narrative', { type: 'boolean', describe: 'operations-briefing: include the AI narrative (default true; --no-narrative to skip)' })
|
|
@@ -76,6 +97,14 @@ export const enterpriseReportsCommand = {
|
|
|
76
97
|
console.log(JSON.stringify(await messagingPost(`/api/enterprise-reports/promise-ledger/${encodeURIComponent(String(argv.id))}/dismiss`, {}), null, 2));
|
|
77
98
|
return;
|
|
78
99
|
}
|
|
100
|
+
if (ADMIN_HOSTED_REPORTS.includes(argv.report)) {
|
|
101
|
+
// Admin-hosted (items 18-34): the site comes from the credential; 403 names the Enterprise Reports package when the key is off.
|
|
102
|
+
const aq = new URLSearchParams();
|
|
103
|
+
for (const [arg, key] of Object.entries({ from: 'from', to: 'to', teamId: 'teamId', platform: 'platform' })) if (argv[arg] != null && argv[arg] !== '') aq.set(key, String(argv[arg]));
|
|
104
|
+
const qsText = aq.toString();
|
|
105
|
+
console.log(JSON.stringify(await adminGet(`/EnterpriseReports/${argv.report}${qsText ? `?${qsText}` : ''}`), null, 2));
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
79
108
|
let seg = argv.report;
|
|
80
109
|
if (argv.report === 'bonus') {
|
|
81
110
|
if (!argv.name) throw new Error('--name is required for bonus (coverage_gap|next_best_fix|escalation_risk|skill_gap_matrix|handle_quality_outliers|abandon_causes)');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The five novel Enterprise Reports (asks 11-15) must stay wired into the CLI with the exact messaging route segments.
|
|
2
2
|
import test from 'node:test';
|
|
3
3
|
import assert from 'node:assert/strict';
|
|
4
|
-
import { enterpriseReportsCommand } from './commands/enterprise-reports.js';
|
|
4
|
+
import { enterpriseReportsCommand, ADMIN_HOSTED_REPORTS } from './commands/enterprise-reports.js';
|
|
5
5
|
import { yearInReviewBody, lastTwelveWholeMonthsKeys } from './year-in-review-range.js';
|
|
6
6
|
|
|
7
7
|
test('describe lists the five novel reports and the promise dismiss action', () => {
|
|
@@ -44,3 +44,14 @@ test('year-in-review uses Pacific, not UTC, at a month boundary and honours expl
|
|
|
44
44
|
assert.throws(() => yearInReviewBody('2026-02-01', '2026-01-01'), /on or before/);
|
|
45
45
|
assert.throws(() => yearInReviewBody('01/01/2026', '2026-01-31'), /yyyy-MM-dd/);
|
|
46
46
|
});
|
|
47
|
+
|
|
48
|
+
// Items 18-34 are hosted in velaro-admin: each must be on the CLI and call GET /EnterpriseReports/<report> (admin, never messaging).
|
|
49
|
+
test('the 17 admin-hosted reports are listed in describe and routed to the admin API', async () => {
|
|
50
|
+
assert.equal(ADMIN_HOSTED_REPORTS.length, 17);
|
|
51
|
+
for (const r of ADMIN_HOSTED_REPORTS) assert.ok(enterpriseReportsCommand.describe.includes(r), `${r} missing from describe`);
|
|
52
|
+
const { readFileSync } = await import('node:fs');
|
|
53
|
+
const { fileURLToPath } = await import('node:url');
|
|
54
|
+
const cli = readFileSync(fileURLToPath(new URL('./commands/enterprise-reports.js', import.meta.url)), 'utf8');
|
|
55
|
+
assert.ok(cli.includes('`/EnterpriseReports/${argv.report}'), 'admin-hosted reports must call /EnterpriseReports/<report>');
|
|
56
|
+
assert.ok(cli.includes('ADMIN_HOSTED_REPORTS.includes(argv.report)'), 'admin branch must run before the messaging path');
|
|
57
|
+
});
|
package/package.json
CHANGED