@velaro/cli 1.4.212 → 1.4.214
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 +2 -0
- package/lib/commands/translation.js +51 -0
- package/package.json +1 -1
package/bin/velaro.js
CHANGED
|
@@ -61,6 +61,7 @@ import { sentimentCommand, qualityCommand, chatIntelligenceThemesCommand } from
|
|
|
61
61
|
import { cannedLearningCommand } from '../lib/commands/canned-learning.js';
|
|
62
62
|
import { csatOverrideUnapproveCommand } from '../lib/commands/csat-override.js';
|
|
63
63
|
import { moshkyWriteAccessCommand } from '../lib/commands/moshky-write-access.js';
|
|
64
|
+
import { translationCommand } from '../lib/commands/translation.js';
|
|
64
65
|
import { chatIntelligenceTopicsCommand } from '../lib/commands/chat-intelligence-topics.js';
|
|
65
66
|
import { focusCommand } from '../lib/commands/focus.js';
|
|
66
67
|
import { automationDraftCommand } from '../lib/commands/automation-draft.js';
|
|
@@ -234,6 +235,7 @@ await (registerStaffCommands ? registerStaffCommands(baseYargs) : baseYargs)
|
|
|
234
235
|
.command(chatIntelligenceTopicsCommand)
|
|
235
236
|
.command(csatOverrideUnapproveCommand)
|
|
236
237
|
.command(moshkyWriteAccessCommand)
|
|
238
|
+
.command(translationCommand)
|
|
237
239
|
.command(focusCommand)
|
|
238
240
|
.command(automationDraftCommand)
|
|
239
241
|
.command(serviceStateCommand)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { post as adminPost } from '../api.js';
|
|
2
|
+
import { runCommand } from '../run.js';
|
|
3
|
+
|
|
4
|
+
// velaro translation show the chat translation switch, agent languages and what agents see
|
|
5
|
+
// velaro translation --on | --off preview the change (nothing saved)
|
|
6
|
+
// velaro translation --on|--off --confirm save it (needs "Moshky can make changes" on; audit-logged)
|
|
7
|
+
// velaro translation --conversation <id> explain why messages in one conversation are or are not translated
|
|
8
|
+
// velaro translation --allowance staff: monthly allowance, override and usage; --set-allowance N / --remove-allowance-override [--confirm]
|
|
9
|
+
// REST: admin POST /mcp/copilot (tools/call: get_translation_settings, propose_/update_translation_settings, diagnose_conversation_translation)
|
|
10
|
+
export async function callCopilotTool(name, args) {
|
|
11
|
+
const res = await adminPost('/mcp/copilot', { jsonrpc: '2.0', id: 1, method: 'tools/call', params: { name, arguments: args } });
|
|
12
|
+
if (res?.error) throw new Error(res.error.message || 'Moshky tool call failed');
|
|
13
|
+
const text = res?.result?.content?.[0]?.text;
|
|
14
|
+
return text ? JSON.parse(text) : res;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const translationCommand = {
|
|
18
|
+
command: 'translation',
|
|
19
|
+
describe: 'Show or change chat translation for agents, or diagnose one conversation',
|
|
20
|
+
builder: (y) => y
|
|
21
|
+
.option('on', { type: 'boolean', describe: 'Turn chat translation on (preview unless --confirm)' })
|
|
22
|
+
.option('off', { type: 'boolean', describe: 'Turn chat translation off (preview unless --confirm)' })
|
|
23
|
+
.option('confirm', { type: 'boolean', describe: 'Save the previewed change' })
|
|
24
|
+
.option('conversation', { type: 'number', describe: 'Conversation id to diagnose' })
|
|
25
|
+
.option('allowance', { type: 'boolean', describe: 'Staff: show the monthly translation allowance (cap, override, used)' })
|
|
26
|
+
.option('set-allowance', { type: 'number', describe: 'Staff: preview a per-site monthly character cap (add --confirm to save)' })
|
|
27
|
+
.option('remove-allowance-override', { type: 'boolean', describe: 'Staff: preview removing the per-site override (add --confirm to save)' })
|
|
28
|
+
.option('reason', { type: 'string', describe: 'Reason recorded with an allowance override' }),
|
|
29
|
+
handler: runCommand(async (a) => {
|
|
30
|
+
if (a.on && a.off) throw new Error('choose --on or --off, not both');
|
|
31
|
+
let out;
|
|
32
|
+
if (a.allowance) {
|
|
33
|
+
out = await callCopilotTool('get_translation_allowance', {});
|
|
34
|
+
} else if (a.setAllowance || a.removeAllowanceOverride) {
|
|
35
|
+
const args = a.removeAllowanceOverride ? { remove_override: true } : { characters_per_month: a.setAllowance };
|
|
36
|
+
out = a.confirm
|
|
37
|
+
? await callCopilotTool('update_translation_allowance_override', { ...args, reason: a.reason, confirmed: true })
|
|
38
|
+
: await callCopilotTool('propose_translation_allowance_override', args);
|
|
39
|
+
} else if (a.conversation) {
|
|
40
|
+
out = await callCopilotTool('diagnose_conversation_translation', { conversation_id: a.conversation });
|
|
41
|
+
} else if (a.on || a.off) {
|
|
42
|
+
const args = { chat_translations_enabled: !!a.on };
|
|
43
|
+
out = a.confirm
|
|
44
|
+
? await callCopilotTool('update_translation_settings', { ...args, confirmed: true })
|
|
45
|
+
: await callCopilotTool('propose_translation_settings', args);
|
|
46
|
+
} else {
|
|
47
|
+
out = await callCopilotTool('get_translation_settings', {});
|
|
48
|
+
}
|
|
49
|
+
console.log(JSON.stringify(out, null, 2));
|
|
50
|
+
}),
|
|
51
|
+
};
|
package/package.json
CHANGED