@velaro/cli 1.4.153 → 1.4.155
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 }));
|
package/lib/commands/report.js
CHANGED
|
@@ -706,6 +706,41 @@ const countryGetCommand = {
|
|
|
706
706
|
for (const a of r.agents ?? []) {
|
|
707
707
|
fmtRow(a.agentName ?? '', `${a.bucket} eng ${a.engagements} handled ${a.handled} csat ${fmtNum(a.csatAvg)}${a.agentCountryNotSet ? ' [country not set]' : ''}`);
|
|
708
708
|
}
|
|
709
|
+
if (r.concordance) {
|
|
710
|
+
const c = r.concordance;
|
|
711
|
+
const who = c.handledBasis === 'agentCountry' ? 'agent' : 'team';
|
|
712
|
+
section(`Concordance (visitor country vs ${who} country)`);
|
|
713
|
+
// Rates may arrive as 0-1 fractions or 0-100 percents; the exact counts decide which. A null rate prints a dash, never an estimate.
|
|
714
|
+
const frac = c.matchRate != null && c.totalEngagements ? Math.abs(c.matchRate - c.matchedEngagements / c.totalEngagements) < 0.005 : (c.matchRate != null && c.matchRate <= 1);
|
|
715
|
+
const p = (v) => (v == null ? '-' : `${Math.round((frac ? v * 100 : v) * 10) / 10}%`);
|
|
716
|
+
const pctTxt = c.matchRate == null || !c.totalEngagements ? '-' : p(c.matchRate);
|
|
717
|
+
const range = c.matchRateCi && pctTxt !== '-' ? ` (95% range ${p(c.matchRateCi.low)} to ${p(c.matchRateCi.high)})` : '';
|
|
718
|
+
console.log(` ${pctTxt} matched${range} (${c.matchedEngagements} of ${c.totalEngagements})`);
|
|
719
|
+
if (c.lowSample) console.log(' Small sample, treat as a rough guide.');
|
|
720
|
+
if (c.unassigned > 0) console.log(` Not assigned to anyone: ${c.unassigned} chats (not counted).${Array.isArray(c.unassignedByVisitorBucket) && c.unassignedByVisitorBucket.some((u) => u.engagements > 0) ? ` By visitor region: ${c.unassignedByVisitorBucket.filter((u) => u.engagements > 0).map((u) => `${u.visitorBucket} ${u.engagements}`).join(', ')}.` : ''}`);
|
|
721
|
+
if (c.unknownLocation > 0) console.log(` No location detected: ${c.unknownLocation} chats (not counted).`);
|
|
722
|
+
for (const row of c.rows ?? []) {
|
|
723
|
+
fmtRow(`${row.visitorBucket} visitor -> ${row.handledBucket} ${who}`, String(row.engagements));
|
|
724
|
+
}
|
|
725
|
+
if (Array.isArray(c.byHandledGroup) && c.byHandledGroup.length) {
|
|
726
|
+
section('Concordance by handling group');
|
|
727
|
+
for (const g of c.byHandledGroup) {
|
|
728
|
+
fmtRow(g.group ?? '', `${g.bucket ?? '-'} chats ${g.total} matched ${g.matched} rate ${p(g.matchRate)}${g.ci ? ` range ${p(g.ci.low)} to ${p(g.ci.high)}` : ''}`);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
if (Array.isArray(c.trend) && c.trend.length) {
|
|
732
|
+
section('Concordance daily match rate');
|
|
733
|
+
for (const d of c.trend) fmtRow(String(d.date).slice(0, 10), `${p(d.matchRate)} (${d.matched} of ${d.total})`);
|
|
734
|
+
}
|
|
735
|
+
if (c.comparison) {
|
|
736
|
+
section('Matched vs mismatched chats');
|
|
737
|
+
const f = (v, s = '') => (v == null ? '-' : `${v}${s}`);
|
|
738
|
+
for (const [label, side] of [['matched', c.comparison.matched], ['mismatched', c.comparison.mismatched]]) {
|
|
739
|
+
if (!side) continue;
|
|
740
|
+
fmtRow(label, `chats ${f(side.engagements)} 1st resp ${f(side.avgFirstResponseSeconds, 's')} handle ${f(side.avgHandleTimeSeconds, 's')} transfers ${f(side.transfers)} csat ${f(side.csatAvg)} (${side.csatCount ?? 0})`);
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
}
|
|
709
744
|
}),
|
|
710
745
|
};
|
|
711
746
|
|
package/package.json
CHANGED