callkaro-cli-unofficial 0.8.0 → 0.9.0
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/dist/commands/admin.js +144 -0
- package/dist/commands/agentVersions.js +39 -0
- package/dist/commands/analyzers.js +50 -0
- package/dist/commands/chatAgents.js +22 -0
- package/dist/commands/chatAuditStrategies.js +20 -0
- package/dist/commands/dashboardApiCmd.js +7 -1
- package/dist/commands/folders.js +75 -0
- package/dist/commands/platformExtras.js +374 -0
- package/dist/commands/voices.js +29 -0
- package/dist/index.js +187 -0
- package/dist/lib/adminApi.js +50 -3
- package/dist/lib/dashboardApi.js +223 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
38
|
};
|
|
@@ -28,6 +61,8 @@ const calls_1 = require("./commands/calls");
|
|
|
28
61
|
const ongoing_1 = require("./commands/ongoing");
|
|
29
62
|
const transcribers_1 = require("./commands/transcribers");
|
|
30
63
|
const voices_1 = require("./commands/voices");
|
|
64
|
+
const px = __importStar(require("./commands/platformExtras"));
|
|
65
|
+
const folders_1 = require("./commands/folders");
|
|
31
66
|
const secrets_1 = require("./commands/secrets");
|
|
32
67
|
const workflows_1 = require("./commands/workflows");
|
|
33
68
|
const contacts_1 = require("./commands/contacts");
|
|
@@ -260,6 +295,41 @@ admin
|
|
|
260
295
|
.description('clear the console-wide voice cache')
|
|
261
296
|
.option('--yes', 'skip the confirmation')
|
|
262
297
|
.action(admin_1.adminVoiceCacheCommand);
|
|
298
|
+
admin
|
|
299
|
+
.command('bot-failures <agentId>')
|
|
300
|
+
.description('failed LLM/TTS responses (or --api: failed external API calls) for a bot')
|
|
301
|
+
.option('--api', 'show failed external API responses instead')
|
|
302
|
+
.option('--response <text>', 'drill into one failed response: list its call ids')
|
|
303
|
+
.option('--endpoint <url>', 'with --api --response: narrow to one endpoint')
|
|
304
|
+
.option('--version <id>', 'limit to one agent version')
|
|
305
|
+
.option('--start <YYYY-MM-DD>', 'window start (default: a month ago)')
|
|
306
|
+
.option('--end <YYYY-MM-DD>', 'window end (default: today)')
|
|
307
|
+
.option('--limit <n>', 'max call ids with --response', '20')
|
|
308
|
+
.option('--json', 'raw JSON')
|
|
309
|
+
.action(admin_1.adminBotFailuresCommand);
|
|
310
|
+
admin.command('client-agents <clientId>').description("list a client account's agents")
|
|
311
|
+
.option('--json', 'raw JSON').action(admin_1.adminClientAgentsCommand);
|
|
312
|
+
admin.command('client-versions <agentId>').description("list an agent's versions via the console")
|
|
313
|
+
.option('--json', 'raw JSON').action(admin_1.adminClientAgentVersionsCommand);
|
|
314
|
+
const adminContext = admin.command('context').description('FDE reference agent library & semantic search (fde-api.callkaro.ai)');
|
|
315
|
+
adminContext.command('list').description('list indexed reference versions')
|
|
316
|
+
.option('--search <text>', 'filter by version id, use case, description or tags').option('--json', 'raw JSON')
|
|
317
|
+
.action(admin_1.adminContextListCommand);
|
|
318
|
+
adminContext.command('search <query>').description('semantic search over reference versions')
|
|
319
|
+
.option('--top-k <n>', 'max results', '3').option('--min-score <n>', 'minimum score', '0.5').option('--json', 'raw JSON')
|
|
320
|
+
.action(admin_1.adminContextSearchCommand);
|
|
321
|
+
for (const [name, update] of [['add', false], ['update', true]]) {
|
|
322
|
+
adminContext.command(`${name} <versionId>`).description(`${update ? 'update' : 'index'} a reference version`)
|
|
323
|
+
.option('--description <text>', 'what the agent does (required)')
|
|
324
|
+
.option('--use-case <text>', 'use case label')
|
|
325
|
+
.option('--tags <csv>', 'comma-separated tags')
|
|
326
|
+
.option('--set <json|@file>', 'JSON with description/useCase/tags/metadata')
|
|
327
|
+
.option('--json', 'raw JSON')
|
|
328
|
+
.action((versionId, opts) => (0, admin_1.adminContextSetCommand)(versionId, { ...opts, update }));
|
|
329
|
+
}
|
|
330
|
+
adminContext.command('remove <versionId>').description('remove a reference version from the index')
|
|
331
|
+
.option('--yes', 'skip the confirmation').option('--json', 'raw JSON')
|
|
332
|
+
.action(admin_1.adminContextRemoveCommand);
|
|
263
333
|
admin
|
|
264
334
|
.command('api <method> <path>')
|
|
265
335
|
.description('call any admin route with the stored session (the token never leaves the CLI)')
|
|
@@ -560,6 +630,12 @@ analyzers
|
|
|
560
630
|
.description('per-strategy audit rollup')
|
|
561
631
|
.option('--json', 'output raw JSON')
|
|
562
632
|
.action(analyzers_1.analyzersAuditStrategiesCommand);
|
|
633
|
+
analyzers.command('batches').description('list batch analysis runs').option('--json', 'raw JSON').action(analyzers_1.analyzersBatchListCommand);
|
|
634
|
+
analyzers.command('batch-create').description('start a batch analysis run')
|
|
635
|
+
.requiredOption('--set <json|@file>', 'request body').option('--json', 'raw JSON').action(analyzers_1.analyzersBatchCreateCommand);
|
|
636
|
+
analyzers.command('batch-calls <batchId>').description('calls in a batch analysis run')
|
|
637
|
+
.option('--page <n>', 'page number', '1').option('--export', 'export mode').option('--json', 'raw JSON')
|
|
638
|
+
.action(analyzers_1.analyzersBatchCallsCommand);
|
|
563
639
|
analyzers.command('summary <id>').description('analyzer summary rollup')
|
|
564
640
|
.option('--batch', 'id is a batch audit, not a call analyzer')
|
|
565
641
|
.option('--severity <sev>', 'filter by severity')
|
|
@@ -820,6 +896,12 @@ agents.command('set-whatsapp-outbound <agentId>').description("set/clear an agen
|
|
|
820
896
|
.option('--clear', 'clear the outbound number')
|
|
821
897
|
.action(agentPhone_1.setWhatsappOutboundCommand);
|
|
822
898
|
// Version management: clone, publish, activate, A/B testing
|
|
899
|
+
agents.command('set-languages <agentId>').description('set switchable languages on several versions at once (dashboard session)')
|
|
900
|
+
.requiredOption('--languages <csv>', 'language codes, e.g. en,hi')
|
|
901
|
+
.requiredOption('--versions <ids>', 'comma-separated version ids')
|
|
902
|
+
.option('--json', 'raw JSON').action(agentVersions_1.agentsSetLanguagesCommand);
|
|
903
|
+
agents.command('postcall-info <agentId>').description('post-call variables and drop-off reasons (dashboard session)')
|
|
904
|
+
.option('--json', 'raw JSON').action(agentVersions_1.agentsPostcallInfoCommand);
|
|
823
905
|
agents.command('clone-version <agentId>').description('clone a version with a required target prompt mode and language')
|
|
824
906
|
.option('--versions <id>', 'source version id')
|
|
825
907
|
.option('--name <name>', 'name for the new version')
|
|
@@ -879,6 +961,9 @@ agents.command('duplicate <agentId>').description('duplicate an agent under a ne
|
|
|
879
961
|
.action(agentVersions_1.agentsDuplicateCommand);
|
|
880
962
|
// --- chat agents -----------------------------------------------------------
|
|
881
963
|
const chatAgents = program.command('chat-agents').description('manage chat agents');
|
|
964
|
+
chatAgents.command('diff <chatAgentId>').description('compare two versions or two commits of a chat agent (dashboard session)')
|
|
965
|
+
.option('--versions <vA,vB>', 'two version ids').option('--commits <cA,cB>', 'two commit ids').option('--json', 'raw JSON')
|
|
966
|
+
.action(chatAgents_1.chatAgentsDiffCommand);
|
|
882
967
|
chatAgents.command('models').description('list models available for chat agents')
|
|
883
968
|
.option('--json', 'output raw JSON').option('--file <path>', 'save JSON to a file')
|
|
884
969
|
.action(chatAgents_1.chatAgentsModelsCommand);
|
|
@@ -1016,6 +1101,105 @@ program
|
|
|
1016
1101
|
.option('--fields', 'show the voice_configuration keys a provider takes (needs --provider)')
|
|
1017
1102
|
.option('--json', 'raw JSON')
|
|
1018
1103
|
.action(voices_1.voicesCommand);
|
|
1104
|
+
program
|
|
1105
|
+
.command('voice-preview')
|
|
1106
|
+
.description('synthesize TTS preview audio to a file (POST /v2/agents/voice-preview)')
|
|
1107
|
+
.requiredOption('--text <text>', 'text to speak')
|
|
1108
|
+
.option('--agent <agentId>', 'read voice_configuration from this agent')
|
|
1109
|
+
.option('--versions <versionId>', 'version of --agent')
|
|
1110
|
+
.option('--set <json|@file>', 'voice_configuration JSON object')
|
|
1111
|
+
.option('--file <path>', 'output audio file (default: voice_preview.mp3)')
|
|
1112
|
+
.action(voices_1.voicesPreviewCommand);
|
|
1113
|
+
const folders = program.command('folders').description('manage agent folders (dashboard session)');
|
|
1114
|
+
folders.command('list').description('list folders with agent counts').option('--json', 'raw JSON').action(folders_1.foldersListCommand);
|
|
1115
|
+
folders.command('create <name>').description('create a folder').option('--json', 'raw JSON').action(folders_1.foldersCreateCommand);
|
|
1116
|
+
folders.command('rename <folderId> <name>').description('rename a folder').option('--json', 'raw JSON').action(folders_1.foldersRenameCommand);
|
|
1117
|
+
folders.command('delete <folderId>').description('delete a folder').option('--yes', 'skip the confirmation').option('--json', 'raw JSON').action(folders_1.foldersDeleteCommand);
|
|
1118
|
+
folders.command('move <folderId>').description('move agents into a folder')
|
|
1119
|
+
.requiredOption('--agents <ids>', 'comma-separated agent ids').option('--json', 'raw JSON').action(folders_1.foldersMoveCommand);
|
|
1120
|
+
// --- Platform extras (dashboard session): inbox, wa-campaigns, finetune, team, compliance, verified-numbers, integrations ---
|
|
1121
|
+
const J = '--json';
|
|
1122
|
+
const JD = 'raw JSON';
|
|
1123
|
+
const YD = 'skip the confirmation';
|
|
1124
|
+
const inbox = program.command('inbox').description('WhatsApp/voice inbox and human handoff (dashboard session)');
|
|
1125
|
+
inbox.command('list').description('list inbox threads')
|
|
1126
|
+
.option('--page <n>', 'page').option('--channel <c>', 'channel filter').option('--search <q>', 'search text')
|
|
1127
|
+
.option('--number <agentPhone>', 'agent phone number').option('--since <date>', 'from date').option('--until <date>', 'to date')
|
|
1128
|
+
.option(J, JD).action(px.inboxListCommand);
|
|
1129
|
+
inbox.command('unread').description('contacts with unread messages').option(J, JD).action(px.inboxUnreadCommand);
|
|
1130
|
+
inbox.command('handoffs').description('chats currently handed to a human')
|
|
1131
|
+
.option('--channel <c>', 'channel filter').option(J, JD).action(px.inboxHandoffsCommand);
|
|
1132
|
+
inbox.command('release <fromId>').description('release a human handoff back to the agent')
|
|
1133
|
+
.requiredOption('--channel <c>', 'channel of the handoff').option('--to-id <id>', 'hand to this id instead').option(J, JD).action(px.inboxReleaseHandoffCommand);
|
|
1134
|
+
inbox.command('contact <phone>').description('message history for one contact')
|
|
1135
|
+
.option('--page <n>', 'page').option('--limit <n>', 'page size (default 25)')
|
|
1136
|
+
.option('--number <agentPhone>', 'agent phone number').option('--channel <c>', 'channel').option(J, JD).action(px.inboxContactCommand);
|
|
1137
|
+
inbox.command('clear <phone>').description('delete a contact\'s chat history')
|
|
1138
|
+
.option('--number <agentPhone>', 'agent phone number').option('--yes', YD).option(J, JD).action(px.inboxClearCommand);
|
|
1139
|
+
inbox.command('deassign <phone>').description('deassign a chat from its agent')
|
|
1140
|
+
.option('--number <agentPhone>', 'agent phone number').option(J, JD).action(px.inboxDeassignCommand);
|
|
1141
|
+
const waCampaigns = program.command('wa-campaigns').description('WhatsApp campaigns (dashboard session)');
|
|
1142
|
+
waCampaigns.command('list').description('list campaigns').option(J, JD).action(px.waCampaignsListCommand);
|
|
1143
|
+
waCampaigns.command('analytics <id>').description('campaign analytics').option(J, JD).action(px.waCampaignAnalyticsCommand);
|
|
1144
|
+
waCampaigns.command('timeseries <id>').description('campaign timeseries')
|
|
1145
|
+
.option('--start <date>', 'from date').option('--end <date>', 'to date').option(J, JD).action(px.waCampaignTimeseriesCommand);
|
|
1146
|
+
waCampaigns.command('export <id>').description('export campaign contacts to CSV')
|
|
1147
|
+
.option('--fields <csv>', 'export_fields').option('--include-chat', 'include chat transcripts')
|
|
1148
|
+
.option('--file <path>', 'output file (default wa_campaign_<id>.csv)').action(px.waCampaignExportCommand);
|
|
1149
|
+
waCampaigns.command('send').description('send a bulk template message')
|
|
1150
|
+
.requiredOption('--set <json|@file>', 'request body').option(J, JD).action(px.waCampaignSendCommand);
|
|
1151
|
+
const finetune = program.command('finetune').description('fine-tuning records, buckets and jobs (dashboard session)');
|
|
1152
|
+
finetune.command('list').description('list fine-tune records').option('--page <n>', 'page').option(J, JD).action(px.finetuneListCommand);
|
|
1153
|
+
finetune.command('buckets').description('list buckets').option(J, JD).action(px.finetuneBucketsCommand);
|
|
1154
|
+
finetune.command('create-bucket <name>').description('create a bucket').option(J, JD).action(px.finetuneCreateBucketCommand);
|
|
1155
|
+
finetune.command('jobs').description('list jobs').option('--page <n>', 'page').option('--limit <n>', 'page size (default 100)').option(J, JD).action(px.finetuneJobsCommand);
|
|
1156
|
+
finetune.command('status <jobId>').description('job status').option(J, JD).action(px.finetuneStatusCommand);
|
|
1157
|
+
finetune.command('start').description('start a fine-tune job')
|
|
1158
|
+
.requiredOption('--set <json|@file>', 'request body').option(J, JD).action(px.finetuneStartCommand);
|
|
1159
|
+
finetune.command('add-model <jobId>').description('register a finished job\'s model').option(J, JD).action(px.finetuneAddModelCommand);
|
|
1160
|
+
finetune.command('cancel <jobId>').description('cancel a job').option(J, JD).action(px.finetuneCancelCommand);
|
|
1161
|
+
finetune.command('delete-record <callId>').description('delete a fine-tune record')
|
|
1162
|
+
.option('--yes', YD).option(J, JD).action(px.finetuneDeleteRecordCommand);
|
|
1163
|
+
const team = program.command('team').description('team members, roles and webhooks (dashboard session)');
|
|
1164
|
+
team.command('members').description('list members').option(J, JD).action(px.teamMembersCommand);
|
|
1165
|
+
team.command('roles').description('list roles').option(J, JD).action(px.teamRolesCommand);
|
|
1166
|
+
team.command('create-role <name>').description('create a role')
|
|
1167
|
+
.requiredOption('--permissions <csv>', 'comma-separated permissions').option(J, JD).action(px.teamCreateRoleCommand);
|
|
1168
|
+
team.command('add-member').description('add a member')
|
|
1169
|
+
.requiredOption('--name <name>', 'name').requiredOption('--email <email>', 'email')
|
|
1170
|
+
.option('--password <pw>', 'password').option('--permissions <csv>', 'comma-separated permissions').option(J, JD).action(px.teamAddMemberCommand);
|
|
1171
|
+
team.command('update-member <id>').description('update a member')
|
|
1172
|
+
.option('--name <name>', 'name').option('--email <email>', 'email').option('--password <pw>', 'password')
|
|
1173
|
+
.option('--permissions <csv>', 'comma-separated permissions').option(J, JD).action(px.teamUpdateMemberCommand);
|
|
1174
|
+
team.command('remove-member <id>').description('remove a member').option('--yes', YD).option(J, JD).action(px.teamRemoveMemberCommand);
|
|
1175
|
+
team.command('set-webhook').description('set the team webhook and/or call-analysis webhook')
|
|
1176
|
+
.option('--url <url>', 'team webhook URL').option('--analysis-url <url>', 'call analysis webhook URL')
|
|
1177
|
+
.option('--headers <k:v,...>', 'webhook headers as Key:Value pairs').option('--events <csv>', 'webhook events').option(J, JD).action(px.teamSetWebhookCommand);
|
|
1178
|
+
const compliance = program.command('compliance').description('compliance records (dashboard session)');
|
|
1179
|
+
compliance.command('list').description('list records').option(J, JD).action(px.complianceListCommand);
|
|
1180
|
+
compliance.command('create').description('create a record')
|
|
1181
|
+
.requiredOption('--gst <number>', 'GST number').requiredOption('--username <name>', 'username').requiredOption('--company <name>', 'company name')
|
|
1182
|
+
.option('--gst-url <url>', 'GST file URL').option('--cin-url <url>', 'CIN file URL').option(J, JD).action(px.complianceCreateCommand);
|
|
1183
|
+
compliance.command('delete <id>').description('delete a record').option('--yes', YD).option(J, JD).action(px.complianceDeleteCommand);
|
|
1184
|
+
const verified = program.command('verified-numbers').description('verified phone numbers (dashboard session)');
|
|
1185
|
+
verified.command('list').description('list numbers').option(J, JD).action(px.verifiedNumbersListCommand);
|
|
1186
|
+
verified.command('add <phoneNumber>').description('add a number (sends an OTP)').option(J, JD).action(px.verifiedNumbersAddCommand);
|
|
1187
|
+
verified.command('verify <phoneNumber>').description('confirm a number with its OTP')
|
|
1188
|
+
.requiredOption('--otp <code>', 'OTP received').option(J, JD).action(px.verifiedNumbersVerifyCommand);
|
|
1189
|
+
verified.command('delete <id>').description('delete a number').option('--yes', YD).option(J, JD).action(px.verifiedNumbersDeleteCommand);
|
|
1190
|
+
const integrations = program.command('integrations').description('third-party integrations (dashboard session)');
|
|
1191
|
+
integrations.command('list').description('list integrations').option(J, JD).action(px.integrationsListCommand);
|
|
1192
|
+
integrations.command('create').description('create an integration')
|
|
1193
|
+
.requiredOption('--type <type>', 'integration type').option('--set <json|@file>', 'credentials JSON').option('--tag <tag>', 'tag').option(J, JD).action(px.integrationsCreateCommand);
|
|
1194
|
+
integrations.command('update <id>').description('update an integration')
|
|
1195
|
+
.option('--type <type>', 'integration type').option('--set <json|@file>', 'credentials JSON').option('--tag <tag>', 'tag').option(J, JD).action(px.integrationsUpdateCommand);
|
|
1196
|
+
integrations.command('delete <id>').description('delete an integration').option('--yes', YD).option(J, JD).action(px.integrationsDeleteCommand);
|
|
1197
|
+
integrations.command('sip').description('list SIP trunks').option(J, JD).action(px.integrationsSipCommand);
|
|
1198
|
+
integrations.command('aisensy').description('list AiSensy campaigns, or link an agent with --agent')
|
|
1199
|
+
.option('--agent <agentId>', 'link this agent').option('--campaigns', 'list campaigns (default)').option(J, JD).action(px.integrationsAisensyCommand);
|
|
1200
|
+
integrations.command('hubspot <agentId>').description('link HubSpot to an agent').option(J, JD).action(px.integrationsHubspotCommand);
|
|
1201
|
+
integrations.command('shopify').description('save Shopify config')
|
|
1202
|
+
.requiredOption('--set <json|@file>', 'config JSON').option(J, JD).action(px.integrationsShopifyCommand);
|
|
1019
1203
|
program
|
|
1020
1204
|
.command('transcribers')
|
|
1021
1205
|
.description('list transcriber providers, models and languages')
|
|
@@ -1282,6 +1466,9 @@ chatAudit.command('update <agentId> <strategyId>').description('update a chat au
|
|
|
1282
1466
|
.option('--min-messages <n>', 'skip conversations with fewer total messages')
|
|
1283
1467
|
.option('--set <json|@file>', 'JSON for audit_filters/extra_variables/llms; each replaces the stored value')
|
|
1284
1468
|
.action(chatAuditStrategies_1.chatAuditUpdateCommand);
|
|
1469
|
+
chatAudit.command('reports').description('list chat audit report batches (dashboard session)')
|
|
1470
|
+
.option('--agent <id>', 'chat agent id').option('--page <n>', 'page number').option('--json', 'raw JSON')
|
|
1471
|
+
.action(chatAuditStrategies_1.chatAuditReportsCommand);
|
|
1285
1472
|
chatAudit.command('delete <strategyId>').description('delete a chat audit strategy').action(chatAuditStrategies_1.chatAuditDeleteCommand);
|
|
1286
1473
|
chatAudit.command('batch <agentId> <strategyId>')
|
|
1287
1474
|
.description('audit up to N conversations now (uses credits; only messages since each last audit)')
|
package/dist/lib/adminApi.js
CHANGED
|
@@ -42,6 +42,7 @@ const adminAuth_1 = require("./adminAuth");
|
|
|
42
42
|
* `err.status` the same way on every surface. Extends Error so existing
|
|
43
43
|
* `handleError` paths and message-based assertions keep working.
|
|
44
44
|
*/
|
|
45
|
+
const FDE_URL = process.env.CK_FDE_URL || 'https://fde-api.callkaro.ai';
|
|
45
46
|
class AdminError extends Error {
|
|
46
47
|
status;
|
|
47
48
|
data;
|
|
@@ -68,7 +69,8 @@ class AdminApi {
|
|
|
68
69
|
* per request rather than once at construction: it is what proves the stored
|
|
69
70
|
* 24h session is still valid, and a long-lived client must not outlive it.
|
|
70
71
|
*/
|
|
71
|
-
async request(method, path, body) {
|
|
72
|
+
async request(method, path, body, hostOverride) {
|
|
73
|
+
const base = hostOverride || this.baseUrl;
|
|
72
74
|
// baseUrl + path is the whole URL, so a path that does not start with "/"
|
|
73
75
|
// can rewrite the host ("https://backend.callkaro.ai" + "@evil.com/x") and
|
|
74
76
|
// carry the session cookie with it.
|
|
@@ -81,7 +83,7 @@ class AdminApi {
|
|
|
81
83
|
};
|
|
82
84
|
let res;
|
|
83
85
|
try {
|
|
84
|
-
res = await fetch(`${
|
|
86
|
+
res = await fetch(`${base}${path}`, {
|
|
85
87
|
method,
|
|
86
88
|
headers,
|
|
87
89
|
body: body === undefined ? undefined : JSON.stringify(body),
|
|
@@ -91,7 +93,7 @@ class AdminApi {
|
|
|
91
93
|
});
|
|
92
94
|
}
|
|
93
95
|
catch (err) {
|
|
94
|
-
throw new Error(`Cannot reach ${
|
|
96
|
+
throw new Error(`Cannot reach ${base} (${err.message})`);
|
|
95
97
|
}
|
|
96
98
|
const text = await res.text();
|
|
97
99
|
let data;
|
|
@@ -196,6 +198,51 @@ class AdminApi {
|
|
|
196
198
|
botFunctions(query = {}) {
|
|
197
199
|
return this.request('GET', `/monitor/bots/functions${qs(query)}`);
|
|
198
200
|
}
|
|
201
|
+
/** List agents belonging to one or more client user_ids (`GET /monitor/agents?user_ids=`). */
|
|
202
|
+
clientAgents(userIds) {
|
|
203
|
+
return this.request('GET', `/monitor/agents${qs({ user_ids: userIds })}`);
|
|
204
|
+
}
|
|
205
|
+
/** List versions of an agent from monitor (`GET /monitor/agents/:agentId/versions`). */
|
|
206
|
+
clientAgentVersions(agentId) {
|
|
207
|
+
return this.request('GET', `/monitor/agents/${encodeURIComponent(agentId)}/versions`);
|
|
208
|
+
}
|
|
209
|
+
/** Failed LLM/TTS response buckets for a bot (`GET /monitor/bots/:agentId/failed-responses`). */
|
|
210
|
+
botFailedResponses(agentId, query = {}) {
|
|
211
|
+
return this.request('GET', `/monitor/bots/${encodeURIComponent(agentId)}/failed-responses${qs(query)}`);
|
|
212
|
+
}
|
|
213
|
+
/** Call ids that hit a specific failed response (`GET /monitor/bots/:agentId/failed-response-calls`). */
|
|
214
|
+
botFailedResponseCalls(agentId, query) {
|
|
215
|
+
return this.request('GET', `/monitor/bots/${encodeURIComponent(agentId)}/failed-response-calls${qs(query)}`);
|
|
216
|
+
}
|
|
217
|
+
/** Failed external API endpoints for a bot (`GET /monitor/bots/:agentId/failed-api-responses`). */
|
|
218
|
+
botFailedApiResponses(agentId, query = {}) {
|
|
219
|
+
return this.request('GET', `/monitor/bots/${encodeURIComponent(agentId)}/failed-api-responses${qs(query)}`);
|
|
220
|
+
}
|
|
221
|
+
/** Call ids that hit a failed API response (`GET /monitor/bots/:agentId/failed-api-response-calls`). */
|
|
222
|
+
botFailedApiResponseCalls(agentId, query) {
|
|
223
|
+
return this.request('GET', `/monitor/bots/${encodeURIComponent(agentId)}/failed-api-response-calls${qs(query)}`);
|
|
224
|
+
}
|
|
225
|
+
// --- FDE reference library (`https://fde-api.callkaro.ai/monitor/agent-context`) ---
|
|
226
|
+
/** List all curated reference agent versions in the FDE library. */
|
|
227
|
+
listAgentContext() {
|
|
228
|
+
return this.request('GET', '/monitor/agent-context', undefined, FDE_URL);
|
|
229
|
+
}
|
|
230
|
+
/** Semantic search over reference agent versions (`GET .../monitor/agent-context/search`). */
|
|
231
|
+
searchAgentContext(query) {
|
|
232
|
+
return this.request('GET', `/monitor/agent-context/search${qs(query)}`, undefined, FDE_URL);
|
|
233
|
+
}
|
|
234
|
+
/** Index a new reference agent version (`POST .../monitor/agent-context`). */
|
|
235
|
+
createAgentContext(body) {
|
|
236
|
+
return this.request('POST', '/monitor/agent-context', body, FDE_URL);
|
|
237
|
+
}
|
|
238
|
+
/** Update an indexed reference agent version (`PUT .../monitor/agent-context/:versionId`). */
|
|
239
|
+
updateAgentContext(versionId, body) {
|
|
240
|
+
return this.request('PUT', `/monitor/agent-context/${encodeURIComponent(versionId)}`, body, FDE_URL);
|
|
241
|
+
}
|
|
242
|
+
/** Remove a reference agent version from the index (`DELETE .../monitor/agent-context/:versionId`). */
|
|
243
|
+
deleteAgentContext(versionId) {
|
|
244
|
+
return this.request('DELETE', `/monitor/agent-context/${encodeURIComponent(versionId)}`, undefined, FDE_URL);
|
|
245
|
+
}
|
|
199
246
|
// --- observability --------------------------------------------------------
|
|
200
247
|
/** Sentry transactions over the last 24h. */
|
|
201
248
|
sentryTransactions(query = {}) {
|
package/dist/lib/dashboardApi.js
CHANGED
|
@@ -487,6 +487,222 @@ class DashboardApi {
|
|
|
487
487
|
generateWorkflowCode(body) {
|
|
488
488
|
return this.request('POST', '/openai-tools/generate-workflow-code', body);
|
|
489
489
|
}
|
|
490
|
+
// --- Voice preview, folders, bulk languages & postcall drop-off ------------
|
|
491
|
+
/** Render TTS audio preview (`POST /v2/agents/voice-preview`). */
|
|
492
|
+
voicePreview(voiceConfiguration, text) {
|
|
493
|
+
return this.requestBinary('POST', '/v2/agents/voice-preview', {
|
|
494
|
+
voice_configuration: voiceConfiguration,
|
|
495
|
+
text,
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
/** Create an agent folder (`POST /agent-folders`). */
|
|
499
|
+
createAgentFolder(name) {
|
|
500
|
+
return this.request('POST', '/agent-folders', { name });
|
|
501
|
+
}
|
|
502
|
+
/** Rename an agent folder (`PUT /agent-folders/:id`). */
|
|
503
|
+
renameAgentFolder(folderId, name) {
|
|
504
|
+
return this.request('PUT', `/agent-folders/${encodeURIComponent(folderId)}`, { _id: folderId, name });
|
|
505
|
+
}
|
|
506
|
+
/** Delete an agent folder (`DELETE /agent-folders/:id`). */
|
|
507
|
+
deleteAgentFolder(folderId) {
|
|
508
|
+
return this.request('DELETE', `/agent-folders/${encodeURIComponent(folderId)}`);
|
|
509
|
+
}
|
|
510
|
+
/** Move agents into a folder (`POST /agent-folders/move`). */
|
|
511
|
+
moveAgentsToFolder(agentIds, folderId) {
|
|
512
|
+
return this.request('POST', '/agent-folders/move', { agentIds, folderId });
|
|
513
|
+
}
|
|
514
|
+
/** Bulk-update switchable languages across versions (`PUT /v2/agents/:agentId/update-all-switchable-language`). */
|
|
515
|
+
updateAllSwitchableLanguage(agentId, switchableLanguages, versionIds) {
|
|
516
|
+
return this.request('PUT', `/v2/agents/${encodeURIComponent(agentId)}/update-all-switchable-language`, {
|
|
517
|
+
switchableLanguages,
|
|
518
|
+
versionIds,
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
/** Post-call variables, drop-off reasons, and versions for an agent (`GET /v2/agents/postcall/:agentId`). */
|
|
522
|
+
agentPostcallInfo(agentId) {
|
|
523
|
+
return this.request('GET', `/v2/agents/postcall/${encodeURIComponent(agentId)}`);
|
|
524
|
+
}
|
|
525
|
+
/** Get or set a custom drop-off reason description (`GET/POST /v2/agents/postcall/:agentId/other-droff-reason`). */
|
|
526
|
+
getOtherDropOffReason(agentId, versionId, dropOffReason) {
|
|
527
|
+
return this.request('GET', `/v2/agents/postcall/${encodeURIComponent(agentId)}/other-droff-reason${qs({ versionId, drop_off_reason: dropOffReason })}`);
|
|
528
|
+
}
|
|
529
|
+
setOtherDropOffReason(agentId, versionId, body) {
|
|
530
|
+
return this.request('POST', `/v2/agents/postcall/${encodeURIComponent(agentId)}/other-droff-reason${qs({ versionId })}`, body);
|
|
531
|
+
}
|
|
532
|
+
// --- Call analyzer batch runs (`/v1/batch-analysis/*`) ---------------------
|
|
533
|
+
/** List batch analysis runs (`GET /v1/batch-analysis/list`). */
|
|
534
|
+
listBatchAnalyses() {
|
|
535
|
+
return this.request('GET', '/v1/batch-analysis/list');
|
|
536
|
+
}
|
|
537
|
+
/** Create a batch analysis run (`POST /v1/batch-analysis/create`). */
|
|
538
|
+
createBatchAnalysis(body) {
|
|
539
|
+
return this.request('POST', '/v1/batch-analysis/create', body);
|
|
540
|
+
}
|
|
541
|
+
/** Calls in a batch analysis run (`GET /v1/batch-analysis/:batchId/calls`). */
|
|
542
|
+
batchAnalysisCalls(batchId, query = {}) {
|
|
543
|
+
return this.request('GET', `/v1/batch-analysis/${encodeURIComponent(batchId)}/calls${qs(query)}`);
|
|
544
|
+
}
|
|
545
|
+
// --- Chat agent commits, compare & chat audit reports ----------------------
|
|
546
|
+
/** Compare two chat agent versions (`POST /v3/chat-agents/compareVersions`). */
|
|
547
|
+
compareChatAgentVersions(versionIds) {
|
|
548
|
+
return this.request('POST', '/v3/chat-agents/compareVersions', { versionIds });
|
|
549
|
+
}
|
|
550
|
+
/** Compare two chat agent commits (`GET /v3/chat-commits/:agentId/compare?commitA=&commitB=`). */
|
|
551
|
+
compareChatAgentCommits(agentId, commitA, commitB) {
|
|
552
|
+
return this.request('GET', `/v3/chat-commits/${encodeURIComponent(agentId)}/compare${qs({ commitA, commitB })}`);
|
|
553
|
+
}
|
|
554
|
+
/** List WhatsApp chat audit report batches (`GET /v1/chat-audit-reports/batches`). */
|
|
555
|
+
chatAuditReportBatches(query = {}) {
|
|
556
|
+
return this.request('GET', `/v1/chat-audit-reports/batches${qs(query)}`);
|
|
557
|
+
}
|
|
558
|
+
// --- Inbox & Human Handoff (`/inbox/*`) ------------------------------------
|
|
559
|
+
inbox(query = {}) {
|
|
560
|
+
return this.request('GET', `/inbox${qs(query)}`);
|
|
561
|
+
}
|
|
562
|
+
inboxUnreadContacts() {
|
|
563
|
+
return this.request('GET', '/inbox/unread-contacts');
|
|
564
|
+
}
|
|
565
|
+
inboxHumanHandoffs(channel) {
|
|
566
|
+
return this.request('GET', `/inbox/human-handoffs${qs({ channel })}`);
|
|
567
|
+
}
|
|
568
|
+
inboxReleaseHandoff(body) {
|
|
569
|
+
return this.request('DELETE', '/inbox/human-handoffs', body);
|
|
570
|
+
}
|
|
571
|
+
inboxContact(phone, query = {}) {
|
|
572
|
+
return this.request('GET', `/inbox/contact/${encodeURIComponent(phone)}${qs(query)}`);
|
|
573
|
+
}
|
|
574
|
+
inboxClearContact(phone, agentPhoneNumber) {
|
|
575
|
+
return this.request('DELETE', `/inbox/contact/${encodeURIComponent(phone)}${qs({ agentPhoneNumber })}`);
|
|
576
|
+
}
|
|
577
|
+
inboxDeassignChat(body) {
|
|
578
|
+
return this.request('POST', '/inbox/deassign-chat', body);
|
|
579
|
+
}
|
|
580
|
+
inboxExport(query = {}) {
|
|
581
|
+
return this.request('GET', `/inbox/export${qs(query)}`);
|
|
582
|
+
}
|
|
583
|
+
inboxTestThreads(agentPhoneNumber) {
|
|
584
|
+
return this.request('GET', `/inbox/test-threads${qs({ agentPhoneNumber })}`);
|
|
585
|
+
}
|
|
586
|
+
// --- WhatsApp Campaigns (`/wa-campaign/*`) ---------------------------------
|
|
587
|
+
listWaCampaigns() {
|
|
588
|
+
return this.request('GET', '/wa-campaign/getWACampaign');
|
|
589
|
+
}
|
|
590
|
+
waCampaignAnalytics(id) {
|
|
591
|
+
return this.request('GET', `/wa-campaign/getWACampaignAnalytics/${encodeURIComponent(id)}`);
|
|
592
|
+
}
|
|
593
|
+
waCampaignTimeseries(id, query = {}) {
|
|
594
|
+
return this.request('GET', `/wa-campaign/getWACampaignTimeseries/${encodeURIComponent(id)}${qs(query)}`);
|
|
595
|
+
}
|
|
596
|
+
exportWaCampaignContacts(id, query = {}) {
|
|
597
|
+
return this.requestBinary('GET', `/wa-campaign/exportWACampaignContacts/${encodeURIComponent(id)}${qs(query)}`);
|
|
598
|
+
}
|
|
599
|
+
sendWaCampaign(body) {
|
|
600
|
+
return this.request('POST', '/wa-campaign/send-bulk-template-message', body);
|
|
601
|
+
}
|
|
602
|
+
// --- Fine-Tuning (`/finetune/*`) -------------------------------------------
|
|
603
|
+
listFinetuneRecords(query = {}) {
|
|
604
|
+
return this.request('GET', `/finetune/list${qs(query)}`);
|
|
605
|
+
}
|
|
606
|
+
listFinetuneBuckets() {
|
|
607
|
+
return this.request('GET', '/finetune/buckets');
|
|
608
|
+
}
|
|
609
|
+
createFinetuneBucket(name) {
|
|
610
|
+
return this.request('POST', '/finetune/buckets', { name });
|
|
611
|
+
}
|
|
612
|
+
listFinetuneJobs(query = {}) {
|
|
613
|
+
return this.request('GET', `/finetune/jobs${qs({ page: query.page || 1, pageSize: query.pageSize || 100 })}`);
|
|
614
|
+
}
|
|
615
|
+
finetuneJobStatus(jobId) {
|
|
616
|
+
return this.request('POST', '/finetune/status', { job_id: jobId });
|
|
617
|
+
}
|
|
618
|
+
startFinetuneProcess(body) {
|
|
619
|
+
return this.request('POST', '/finetune/process', body);
|
|
620
|
+
}
|
|
621
|
+
addFinetunedModel(jobId) {
|
|
622
|
+
return this.request('POST', '/finetune/add-model', { job_id: jobId });
|
|
623
|
+
}
|
|
624
|
+
cancelFinetuneJob(jobId) {
|
|
625
|
+
return this.request('POST', '/finetune/cancel', { job_id: jobId });
|
|
626
|
+
}
|
|
627
|
+
deleteFinetuneRecord(callId) {
|
|
628
|
+
return this.request('DELETE', `/finetune/delete/${encodeURIComponent(callId)}`);
|
|
629
|
+
}
|
|
630
|
+
// --- Team Management (`/team-management/*`) --------------------------------
|
|
631
|
+
listTeamMembers() {
|
|
632
|
+
return this.request('GET', '/team-management/get-members');
|
|
633
|
+
}
|
|
634
|
+
listTeamRoles() {
|
|
635
|
+
return this.request('GET', '/team-management/roles');
|
|
636
|
+
}
|
|
637
|
+
createTeamRole(body) {
|
|
638
|
+
return this.request('POST', '/team-management/roles', body);
|
|
639
|
+
}
|
|
640
|
+
addTeamMember(body) {
|
|
641
|
+
return this.request('POST', '/team-management/add-member', body);
|
|
642
|
+
}
|
|
643
|
+
updateTeamMember(id, body) {
|
|
644
|
+
return this.request('PUT', `/team-management/update-member/${encodeURIComponent(id)}`, body);
|
|
645
|
+
}
|
|
646
|
+
removeTeamMember(id) {
|
|
647
|
+
return this.request('DELETE', `/team-management/remove-member/${encodeURIComponent(id)}`);
|
|
648
|
+
}
|
|
649
|
+
updateTeamWebhook(body) {
|
|
650
|
+
return this.request('PUT', '/team-management/update-webhook', body);
|
|
651
|
+
}
|
|
652
|
+
/** Server typo: body field is `callAalysisWebhook` (missing 'n'). */
|
|
653
|
+
updateCallAnalysisWebhook(callAalysisWebhook) {
|
|
654
|
+
return this.request('PUT', '/team-management/update-call-analysis-webhook', { callAalysisWebhook });
|
|
655
|
+
}
|
|
656
|
+
// --- Compliance & Verified Phone Numbers -----------------------------------
|
|
657
|
+
listCompliance() {
|
|
658
|
+
return this.request('GET', '/compliance');
|
|
659
|
+
}
|
|
660
|
+
createCompliance(body) {
|
|
661
|
+
return this.request('POST', '/compliance', body);
|
|
662
|
+
}
|
|
663
|
+
deleteCompliance(id) {
|
|
664
|
+
return this.request('DELETE', `/compliance/${encodeURIComponent(id)}`);
|
|
665
|
+
}
|
|
666
|
+
listVerifiedNumbers() {
|
|
667
|
+
return this.request('GET', '/verified-phone-numbers');
|
|
668
|
+
}
|
|
669
|
+
addVerifiedNumber(phoneNumber) {
|
|
670
|
+
return this.request('POST', '/verified-phone-numbers/add', { phoneNumber });
|
|
671
|
+
}
|
|
672
|
+
verifyPhoneNumberOtp(phoneNumber, otp) {
|
|
673
|
+
return this.request('POST', '/verified-phone-numbers/verify', { phoneNumber, otp });
|
|
674
|
+
}
|
|
675
|
+
deleteVerifiedNumber(id) {
|
|
676
|
+
return this.request('DELETE', `/verified-phone-numbers/${encodeURIComponent(id)}`);
|
|
677
|
+
}
|
|
678
|
+
// --- Integrations (`/integrations/*`, `/shopify/*`) ------------------------
|
|
679
|
+
listIntegrations() {
|
|
680
|
+
return this.request('GET', '/integrations');
|
|
681
|
+
}
|
|
682
|
+
createIntegration(body) {
|
|
683
|
+
return this.request('POST', '/integrations', body);
|
|
684
|
+
}
|
|
685
|
+
updateIntegration(id, body) {
|
|
686
|
+
return this.request('PUT', `/integrations/${encodeURIComponent(id)}`, body);
|
|
687
|
+
}
|
|
688
|
+
deleteIntegration(id) {
|
|
689
|
+
return this.request('DELETE', `/integrations/${encodeURIComponent(id)}`);
|
|
690
|
+
}
|
|
691
|
+
listSipTrunks() {
|
|
692
|
+
return this.request('GET', '/integrations/sip');
|
|
693
|
+
}
|
|
694
|
+
setAisensyConfig(agentId) {
|
|
695
|
+
return this.request('PUT', '/integrations/aisensy/config', { agentId });
|
|
696
|
+
}
|
|
697
|
+
listAisensyCampaigns() {
|
|
698
|
+
return this.request('GET', '/integrations/aisensy/pro/campaigns');
|
|
699
|
+
}
|
|
700
|
+
setHubspotConfig(agentId) {
|
|
701
|
+
return this.request('PUT', '/integrations/hubspot-plus/config', { agentId });
|
|
702
|
+
}
|
|
703
|
+
setShopifyConfig(body) {
|
|
704
|
+
return this.request('PUT', '/shopify/config', body);
|
|
705
|
+
}
|
|
490
706
|
// --- Call analyzers -------------------------------------------------------
|
|
491
707
|
listAnalyzers() { return this.request('GET', '/v1/call-analyzers'); }
|
|
492
708
|
// --- Audit reports (dashboard side) ---------------------------------------
|
|
@@ -516,7 +732,13 @@ function usesCookieAuth(path) {
|
|
|
516
732
|
// version save `PUT /v2/agents/:id?version=` — takes the cookie and answers
|
|
517
733
|
// the bearer with 401 (probed 21 October 2026 with getAgentVersions).
|
|
518
734
|
const route = path.split('?')[0];
|
|
519
|
-
|
|
735
|
+
if (route === '/v2/agents/' || route === '/v2/agents')
|
|
736
|
+
return false;
|
|
737
|
+
// /knowledge/user takes the cookie, but /knowledge and DELETE /knowledge/:id
|
|
738
|
+
// take the auth-token bearer (probed live: cookie -> 401, bearer -> 200/404).
|
|
739
|
+
if (route === '/knowledge' || (route.startsWith('/knowledge/') && route !== '/knowledge/user'))
|
|
740
|
+
return false;
|
|
741
|
+
return true;
|
|
520
742
|
}
|
|
521
743
|
/** `?a=1&b=2`, skipping undefined and empty. Mirrors the one in api.ts. */
|
|
522
744
|
function qs(params) {
|