retell-sync-cli 3.0.0 → 3.2.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/cli.js +185 -57
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -98673,10 +98673,6 @@ function diff(obj, newObj, options = { cyclesFix: true }, _stack = []) {
|
|
|
98673
98673
|
return diffs;
|
|
98674
98674
|
}
|
|
98675
98675
|
|
|
98676
|
-
// src/lib/agents.ts
|
|
98677
|
-
import fs8 from "fs/promises";
|
|
98678
|
-
import path15 from "path";
|
|
98679
|
-
|
|
98680
98676
|
// node_modules/remeda/dist/lazyDataLastImpl-BDhrIOwR.js
|
|
98681
98677
|
function e(e2, t, n) {
|
|
98682
98678
|
let r = (n2) => e2(n2, ...t);
|
|
@@ -98893,6 +98889,10 @@ function t11(...t12) {
|
|
|
98893
98889
|
return t(Object.values, t12);
|
|
98894
98890
|
}
|
|
98895
98891
|
|
|
98892
|
+
// src/lib/agents.ts
|
|
98893
|
+
import fs8 from "fs/promises";
|
|
98894
|
+
import path15 from "path";
|
|
98895
|
+
|
|
98896
98896
|
// node_modules/retell-sdk/version.mjs
|
|
98897
98897
|
var VERSION = "4.66.0";
|
|
98898
98898
|
|
|
@@ -135003,6 +135003,67 @@ async function canonicalizeFromFiles(files) {
|
|
|
135003
135003
|
};
|
|
135004
135004
|
}
|
|
135005
135005
|
|
|
135006
|
+
// src/lib/logger.ts
|
|
135007
|
+
var quietMode = false;
|
|
135008
|
+
function setQuiet(quiet) {
|
|
135009
|
+
quietMode = quiet;
|
|
135010
|
+
}
|
|
135011
|
+
function isQuiet() {
|
|
135012
|
+
return quietMode;
|
|
135013
|
+
}
|
|
135014
|
+
function log(...args) {
|
|
135015
|
+
if (!quietMode) {
|
|
135016
|
+
console.log(...args);
|
|
135017
|
+
}
|
|
135018
|
+
}
|
|
135019
|
+
function dim(message) {
|
|
135020
|
+
if (!quietMode) {
|
|
135021
|
+
console.log(source_default.dim(message));
|
|
135022
|
+
}
|
|
135023
|
+
}
|
|
135024
|
+
function bold(message) {
|
|
135025
|
+
if (!quietMode) {
|
|
135026
|
+
console.log(source_default.bold(message));
|
|
135027
|
+
}
|
|
135028
|
+
}
|
|
135029
|
+
function success2(message) {
|
|
135030
|
+
if (!quietMode) {
|
|
135031
|
+
console.log(source_default.green(message));
|
|
135032
|
+
}
|
|
135033
|
+
}
|
|
135034
|
+
function warn(message) {
|
|
135035
|
+
if (!quietMode) {
|
|
135036
|
+
console.log(source_default.yellow(message));
|
|
135037
|
+
}
|
|
135038
|
+
}
|
|
135039
|
+
function error46(message) {
|
|
135040
|
+
if (!quietMode) {
|
|
135041
|
+
console.log(source_default.red(message));
|
|
135042
|
+
}
|
|
135043
|
+
}
|
|
135044
|
+
function createSpinner2(text) {
|
|
135045
|
+
if (quietMode) {
|
|
135046
|
+
return { stop: () => {} };
|
|
135047
|
+
}
|
|
135048
|
+
const spinner = cli_spinners_default.dots;
|
|
135049
|
+
let frameIndex = 0;
|
|
135050
|
+
let currentText = text;
|
|
135051
|
+
const interval = setInterval(() => {
|
|
135052
|
+
const frame = spinner.frames[frameIndex % spinner.frames.length];
|
|
135053
|
+
process.stdout.write(`\r${source_default.cyan(frame)} ${currentText}`);
|
|
135054
|
+
frameIndex++;
|
|
135055
|
+
}, spinner.interval);
|
|
135056
|
+
return {
|
|
135057
|
+
stop: (message) => {
|
|
135058
|
+
clearInterval(interval);
|
|
135059
|
+
process.stdout.write("\r" + " ".repeat(currentText.length + 10) + "\r");
|
|
135060
|
+
if (message) {
|
|
135061
|
+
console.log(message);
|
|
135062
|
+
}
|
|
135063
|
+
}
|
|
135064
|
+
};
|
|
135065
|
+
}
|
|
135066
|
+
|
|
135006
135067
|
// node_modules/@inquirer/checkbox/dist/index.js
|
|
135007
135068
|
import { styleText as styleText3 } from "util";
|
|
135008
135069
|
var checkboxTheme = {
|
|
@@ -135234,7 +135295,7 @@ async function readSyncConfig() {
|
|
|
135234
135295
|
const content = await file2.text();
|
|
135235
135296
|
const parsed = syncConfigSchema.safeParse(JSON.parse(content));
|
|
135236
135297
|
if (!parsed.success) {
|
|
135237
|
-
|
|
135298
|
+
warn(`Warning: Invalid ${SYNC_CONFIG_FILE} format, ignoring`);
|
|
135238
135299
|
return null;
|
|
135239
135300
|
}
|
|
135240
135301
|
return parsed.data;
|
|
@@ -135254,7 +135315,7 @@ async function selectAgentsInteractive() {
|
|
|
135254
135315
|
}
|
|
135255
135316
|
const uniqueAgents = [...agentMap.values()].sort((a7, b7) => (a7.agent_name ?? a7.agent_id).localeCompare(b7.agent_name ?? b7.agent_id));
|
|
135256
135317
|
if (uniqueAgents.length === 0) {
|
|
135257
|
-
|
|
135318
|
+
warn("No agents found in the account");
|
|
135258
135319
|
return [];
|
|
135259
135320
|
}
|
|
135260
135321
|
const selected = await dist_default3({
|
|
@@ -135265,7 +135326,7 @@ async function selectAgentsInteractive() {
|
|
|
135265
135326
|
}))
|
|
135266
135327
|
});
|
|
135267
135328
|
if (selected.length === 0) {
|
|
135268
|
-
|
|
135329
|
+
warn("No agents selected");
|
|
135269
135330
|
return [];
|
|
135270
135331
|
}
|
|
135271
135332
|
const save = await dist_default4({
|
|
@@ -135274,7 +135335,7 @@ async function selectAgentsInteractive() {
|
|
|
135274
135335
|
});
|
|
135275
135336
|
if (save) {
|
|
135276
135337
|
await writeSyncConfig({ agents: selected });
|
|
135277
|
-
|
|
135338
|
+
dim(`Saved to ${SYNC_CONFIG_FILE}`);
|
|
135278
135339
|
}
|
|
135279
135340
|
return selected;
|
|
135280
135341
|
}
|
|
@@ -135290,7 +135351,7 @@ async function resolveAgentIds(args, { all = false, select = false } = {}) {
|
|
|
135290
135351
|
}
|
|
135291
135352
|
const config2 = await readSyncConfig();
|
|
135292
135353
|
if (config2?.agents && config2.agents.length > 0) {
|
|
135293
|
-
|
|
135354
|
+
dim(`Using ${config2.agents.length} agent(s) from ${SYNC_CONFIG_FILE}`);
|
|
135294
135355
|
return config2.agents;
|
|
135295
135356
|
}
|
|
135296
135357
|
return selectAgentsInteractive();
|
|
@@ -135354,21 +135415,26 @@ async function pull({
|
|
|
135354
135415
|
// src/commands/deploy.ts
|
|
135355
135416
|
async function deployCommand(agentIdArgs, opts, cmd) {
|
|
135356
135417
|
const globalOpts = cmd.optsWithGlobals();
|
|
135418
|
+
if (opts.quiet)
|
|
135419
|
+
setQuiet(true);
|
|
135357
135420
|
try {
|
|
135358
135421
|
const agentIds = await resolveAgentIds(agentIdArgs, {
|
|
135359
135422
|
all: opts.all,
|
|
135360
135423
|
select: opts.select
|
|
135361
135424
|
});
|
|
135362
|
-
await deploy({
|
|
135425
|
+
const affectedIds = await deploy({
|
|
135363
135426
|
agentsDir: globalOpts.agentsDir,
|
|
135364
135427
|
configFormat: globalOpts.configFormat,
|
|
135365
135428
|
agentIds,
|
|
135366
135429
|
dryRun: opts.dryRun,
|
|
135367
135430
|
verbose: opts.verbose
|
|
135368
135431
|
});
|
|
135432
|
+
if (opts.quiet && affectedIds.length > 0) {
|
|
135433
|
+
console.log(affectedIds.join(" "));
|
|
135434
|
+
}
|
|
135369
135435
|
} catch (err) {
|
|
135370
135436
|
if (err instanceof ExitPromptError) {
|
|
135371
|
-
|
|
135437
|
+
dim("Aborted");
|
|
135372
135438
|
return;
|
|
135373
135439
|
}
|
|
135374
135440
|
throw err;
|
|
@@ -135382,29 +135448,44 @@ async function deploy({
|
|
|
135382
135448
|
verbose = false
|
|
135383
135449
|
} = {}) {
|
|
135384
135450
|
const scopeLabel = agentIds ? `${agentIds.length} agent(s)` : "all agents";
|
|
135385
|
-
|
|
135386
|
-
|
|
135387
|
-
let spinner =
|
|
135451
|
+
bold(`Deploying ${scopeLabel} to Retell draft...`);
|
|
135452
|
+
bold("Analyzing changes...");
|
|
135453
|
+
let spinner = createSpinner2("Reading local and remote state...");
|
|
135388
135454
|
const [localState, remoteState] = await Promise.all([
|
|
135389
135455
|
getLocalState({ agentsDir, agentIds }),
|
|
135390
135456
|
getRemoteState({ draft: true, agentIds })
|
|
135391
135457
|
]);
|
|
135392
135458
|
spinner.stop(source_default.dim(`Local: ${localState.voiceAgents.length} agents | Remote: ${remoteState.voiceAgents.length} agents`));
|
|
135393
|
-
spinner =
|
|
135459
|
+
spinner = createSpinner2("Computing differences...");
|
|
135394
135460
|
const changes = computeChanges(localState, remoteState);
|
|
135395
135461
|
spinner.stop(source_default.dim(`Found ${source_default.white(changes.agents.length)} agent changes, ${source_default.white(changes.llms.length)} LLM changes, ${source_default.white(changes.flows.length)} flow changes`));
|
|
135396
135462
|
const totalChanges = changes.agents.length + changes.llms.length + changes.flows.length;
|
|
135463
|
+
const affectedAgentIds = new Set;
|
|
135464
|
+
for (const change of changes.agents) {
|
|
135465
|
+
affectedAgentIds.add(change.id);
|
|
135466
|
+
}
|
|
135467
|
+
const changedLlmIds = new Set(changes.llms.map((c7) => c7.id));
|
|
135468
|
+
const changedFlowIds = new Set(changes.flows.map((c7) => c7.id));
|
|
135469
|
+
for (const agent of localState.voiceAgents) {
|
|
135470
|
+
if (agent.response_engine.type === "retell-llm" && changedLlmIds.has(agent.response_engine.llm_id)) {
|
|
135471
|
+
affectedAgentIds.add(agent._id);
|
|
135472
|
+
}
|
|
135473
|
+
if (agent.response_engine.type === "conversation-flow" && changedFlowIds.has(agent.response_engine.conversation_flow_id)) {
|
|
135474
|
+
affectedAgentIds.add(agent._id);
|
|
135475
|
+
}
|
|
135476
|
+
}
|
|
135397
135477
|
if (totalChanges === 0) {
|
|
135398
|
-
|
|
135399
|
-
return;
|
|
135478
|
+
success2("No changes to deploy");
|
|
135479
|
+
return [];
|
|
135400
135480
|
}
|
|
135401
135481
|
if (dryRun) {
|
|
135402
|
-
|
|
135403
|
-
|
|
135404
|
-
|
|
135482
|
+
warn("Dry run mode - no changes will be made");
|
|
135483
|
+
if (!isQuiet())
|
|
135484
|
+
printChangeSummary(changes, { verbose });
|
|
135485
|
+
return [...affectedAgentIds];
|
|
135405
135486
|
}
|
|
135406
|
-
|
|
135407
|
-
spinner =
|
|
135487
|
+
bold("Deploying changes to draft...");
|
|
135488
|
+
spinner = createSpinner2(`Deploying ${totalChanges} changes...`);
|
|
135408
135489
|
const updateResults = await Promise.allSettled([
|
|
135409
135490
|
...changes.agents.map(async (change) => {
|
|
135410
135491
|
const {
|
|
@@ -135431,14 +135512,17 @@ async function deploy({
|
|
|
135431
135512
|
for (const result of updateResults) {
|
|
135432
135513
|
if (result.status === "fulfilled") {
|
|
135433
135514
|
const { type, name } = result.value;
|
|
135434
|
-
|
|
135515
|
+
log(source_default.green(`Updated ${type} ${source_default.bold(name)}`));
|
|
135435
135516
|
} else {
|
|
135436
|
-
|
|
135517
|
+
error46(`Failed to update: ${result.reason}`);
|
|
135437
135518
|
}
|
|
135438
135519
|
}
|
|
135439
|
-
|
|
135440
|
-
|
|
135441
|
-
|
|
135520
|
+
success2(`Deployed ${pluralize("change", totalChanges, true)}`);
|
|
135521
|
+
if (!isQuiet()) {
|
|
135522
|
+
bold("Syncing latest state...");
|
|
135523
|
+
await pull({ agentsDir, configFormat, agentIds });
|
|
135524
|
+
}
|
|
135525
|
+
return [...affectedAgentIds];
|
|
135442
135526
|
}
|
|
135443
135527
|
function computeChanges(local, remote) {
|
|
135444
135528
|
const changes = {
|
|
@@ -135453,8 +135537,16 @@ function computeChanges(local, remote) {
|
|
|
135453
135537
|
const remoteAgent = remoteAgents.get(agent._id);
|
|
135454
135538
|
if (!remoteAgent)
|
|
135455
135539
|
continue;
|
|
135456
|
-
const
|
|
135457
|
-
|
|
135540
|
+
const localComparable = n9(agent, [
|
|
135541
|
+
"_id",
|
|
135542
|
+
"_version",
|
|
135543
|
+
"response_engine"
|
|
135544
|
+
]);
|
|
135545
|
+
const remoteComparable = n9(remoteAgent, [
|
|
135546
|
+
"_id",
|
|
135547
|
+
"_version",
|
|
135548
|
+
"response_engine"
|
|
135549
|
+
]);
|
|
135458
135550
|
const differences = diff(remoteComparable, localComparable);
|
|
135459
135551
|
if (differences.length > 0) {
|
|
135460
135552
|
changes.agents.push({
|
|
@@ -135469,7 +135561,9 @@ function computeChanges(local, remote) {
|
|
|
135469
135561
|
const remoteLLM = remoteLLMs.get(llm._id);
|
|
135470
135562
|
if (!remoteLLM)
|
|
135471
135563
|
continue;
|
|
135472
|
-
const
|
|
135564
|
+
const localComparable = n9(llm, ["_id", "_version"]);
|
|
135565
|
+
const remoteComparable = n9(remoteLLM, ["_id", "_version"]);
|
|
135566
|
+
const differences = diff(remoteComparable, localComparable);
|
|
135473
135567
|
if (differences.length > 0) {
|
|
135474
135568
|
changes.llms.push({
|
|
135475
135569
|
id: llm._id,
|
|
@@ -135483,7 +135577,9 @@ function computeChanges(local, remote) {
|
|
|
135483
135577
|
const remoteFlow = remoteFlows.get(flow._id);
|
|
135484
135578
|
if (!remoteFlow)
|
|
135485
135579
|
continue;
|
|
135486
|
-
const
|
|
135580
|
+
const localComparable = n9(flow, ["_id", "_version"]);
|
|
135581
|
+
const remoteComparable = n9(remoteFlow, ["_id", "_version"]);
|
|
135582
|
+
const differences = diff(remoteComparable, localComparable);
|
|
135487
135583
|
if (differences.length > 0) {
|
|
135488
135584
|
changes.flows.push({
|
|
135489
135585
|
id: flow._id,
|
|
@@ -135582,19 +135678,25 @@ Flows to update:`));
|
|
|
135582
135678
|
// src/commands/publish.ts
|
|
135583
135679
|
async function publishCommand(agentIdArgs, opts, cmd) {
|
|
135584
135680
|
const globalOpts = cmd.optsWithGlobals();
|
|
135681
|
+
if (opts.quiet)
|
|
135682
|
+
setQuiet(true);
|
|
135585
135683
|
try {
|
|
135586
135684
|
const agentIds = await resolveAgentIds(agentIdArgs, {
|
|
135587
135685
|
all: opts.all,
|
|
135588
135686
|
select: opts.select
|
|
135589
135687
|
});
|
|
135590
|
-
await publish({
|
|
135688
|
+
const publishedIds = await publish({
|
|
135591
135689
|
agentsDir: globalOpts.agentsDir,
|
|
135592
135690
|
configFormat: globalOpts.configFormat,
|
|
135593
|
-
agentIds
|
|
135691
|
+
agentIds,
|
|
135692
|
+
dryRun: opts.dryRun
|
|
135594
135693
|
});
|
|
135694
|
+
if (opts.quiet && publishedIds.length > 0) {
|
|
135695
|
+
console.log(publishedIds.join(" "));
|
|
135696
|
+
}
|
|
135595
135697
|
} catch (err) {
|
|
135596
135698
|
if (err instanceof ExitPromptError) {
|
|
135597
|
-
|
|
135699
|
+
dim("Aborted");
|
|
135598
135700
|
return;
|
|
135599
135701
|
}
|
|
135600
135702
|
throw err;
|
|
@@ -135603,18 +135705,19 @@ async function publishCommand(agentIdArgs, opts, cmd) {
|
|
|
135603
135705
|
async function publish({
|
|
135604
135706
|
agentsDir = DEFAULT_AGENTS_DIR,
|
|
135605
135707
|
configFormat = DEFAULT_CONFIG_FORMAT,
|
|
135606
|
-
agentIds = null
|
|
135708
|
+
agentIds = null,
|
|
135709
|
+
dryRun = false
|
|
135607
135710
|
} = {}) {
|
|
135608
135711
|
const scopeLabel = agentIds ? `${agentIds.length} agent(s)` : "all agents";
|
|
135609
|
-
|
|
135610
|
-
let spinner =
|
|
135712
|
+
bold(`Checking ${scopeLabel} for unpublished changes...`);
|
|
135713
|
+
let spinner = createSpinner2("Fetching draft and published states...");
|
|
135611
135714
|
const [draftState, publishedState] = await Promise.all([
|
|
135612
135715
|
getLocalState({ agentsDir, agentIds }),
|
|
135613
135716
|
getRemoteState({ draft: false, agentIds })
|
|
135614
135717
|
]);
|
|
135615
135718
|
spinner.stop(source_default.dim("Done"));
|
|
135616
135719
|
const agentNames = new Map(draftState.voiceAgents.map((a7) => [a7._id, a7.agent_name ?? a7._id]));
|
|
135617
|
-
spinner =
|
|
135720
|
+
spinner = createSpinner2("Comparing draft vs published...");
|
|
135618
135721
|
const changes = computeChanges2(draftState, publishedState);
|
|
135619
135722
|
spinner.stop(source_default.dim(`Found ${source_default.white(changes.agents.length)} agent changes, ${source_default.white(changes.llms.length)} LLM changes, ${source_default.white(changes.flows.length)} flow changes`));
|
|
135620
135723
|
const agentIdsToPublish = new Set;
|
|
@@ -135634,11 +135737,21 @@ async function publish({
|
|
|
135634
135737
|
}
|
|
135635
135738
|
}
|
|
135636
135739
|
if (agentIdsToPublish.size === 0) {
|
|
135637
|
-
|
|
135638
|
-
return;
|
|
135740
|
+
success2("All agents are already up to date");
|
|
135741
|
+
return [];
|
|
135742
|
+
}
|
|
135743
|
+
if (dryRun) {
|
|
135744
|
+
warn("Dry run mode - no changes will be made");
|
|
135745
|
+
log(source_default.cyan(`
|
|
135746
|
+
Would publish ${pluralize("agent", agentIdsToPublish.size, true)}:`));
|
|
135747
|
+
for (const id2 of agentIdsToPublish) {
|
|
135748
|
+
const name = agentNames.get(id2) ?? id2;
|
|
135749
|
+
log(` ${source_default.bold(name)} ${source_default.dim(`(${id2})`)}`);
|
|
135750
|
+
}
|
|
135751
|
+
return [...agentIdsToPublish];
|
|
135639
135752
|
}
|
|
135640
|
-
|
|
135641
|
-
spinner =
|
|
135753
|
+
bold(`Publishing ${pluralize("agent", agentIdsToPublish.size, true)}...`);
|
|
135754
|
+
spinner = createSpinner2(`Publishing ${agentIdsToPublish.size} agents...`);
|
|
135642
135755
|
const publishResults = await Promise.allSettled([...agentIdsToPublish].map(async (id2) => {
|
|
135643
135756
|
await retell.agent.publish(id2);
|
|
135644
135757
|
return { id: id2, name: agentNames.get(id2) ?? id2 };
|
|
@@ -135647,18 +135760,21 @@ async function publish({
|
|
|
135647
135760
|
const publishedAgentIds = [];
|
|
135648
135761
|
for (const result of publishResults) {
|
|
135649
135762
|
if (result.status === "fulfilled") {
|
|
135650
|
-
|
|
135763
|
+
log(source_default.green(`Published ${source_default.bold(result.value.name)}`));
|
|
135651
135764
|
publishedAgentIds.push(result.value.id);
|
|
135652
135765
|
} else {
|
|
135653
|
-
|
|
135766
|
+
error46(`Failed to publish: ${result.reason}`);
|
|
135654
135767
|
}
|
|
135655
135768
|
}
|
|
135656
|
-
|
|
135769
|
+
success2(`Published ${pluralize("agent", publishedAgentIds.length, true)}`);
|
|
135657
135770
|
if (publishedAgentIds.length > 0) {
|
|
135658
135771
|
await updatePhoneNumberVersions(publishedAgentIds, agentNames);
|
|
135659
135772
|
}
|
|
135660
|
-
|
|
135661
|
-
|
|
135773
|
+
if (!isQuiet()) {
|
|
135774
|
+
bold("Syncing latest state...");
|
|
135775
|
+
await pull({ agentsDir, configFormat, agentIds });
|
|
135776
|
+
}
|
|
135777
|
+
return publishedAgentIds;
|
|
135662
135778
|
}
|
|
135663
135779
|
function computeChanges2(draft, published) {
|
|
135664
135780
|
const changes = {
|
|
@@ -135680,8 +135796,16 @@ function computeChanges2(draft, published) {
|
|
|
135680
135796
|
});
|
|
135681
135797
|
continue;
|
|
135682
135798
|
}
|
|
135683
|
-
const
|
|
135684
|
-
|
|
135799
|
+
const draftComparable = n9(agent, [
|
|
135800
|
+
"_id",
|
|
135801
|
+
"_version",
|
|
135802
|
+
"response_engine"
|
|
135803
|
+
]);
|
|
135804
|
+
const publishedComparable = n9(publishedAgent, [
|
|
135805
|
+
"_id",
|
|
135806
|
+
"_version",
|
|
135807
|
+
"response_engine"
|
|
135808
|
+
]);
|
|
135685
135809
|
const differences = diff(publishedComparable, draftComparable);
|
|
135686
135810
|
if (differences.length > 0) {
|
|
135687
135811
|
changes.agents.push({
|
|
@@ -135703,7 +135827,9 @@ function computeChanges2(draft, published) {
|
|
|
135703
135827
|
});
|
|
135704
135828
|
continue;
|
|
135705
135829
|
}
|
|
135706
|
-
const
|
|
135830
|
+
const draftComparable = n9(llm, ["_id", "_version"]);
|
|
135831
|
+
const publishedComparable = n9(publishedLLM, ["_id", "_version"]);
|
|
135832
|
+
const differences = diff(publishedComparable, draftComparable);
|
|
135707
135833
|
if (differences.length > 0) {
|
|
135708
135834
|
changes.llms.push({
|
|
135709
135835
|
id: llm._id,
|
|
@@ -135724,7 +135850,9 @@ function computeChanges2(draft, published) {
|
|
|
135724
135850
|
});
|
|
135725
135851
|
continue;
|
|
135726
135852
|
}
|
|
135727
|
-
const
|
|
135853
|
+
const draftComparable = n9(flow, ["_id", "_version"]);
|
|
135854
|
+
const publishedComparable = n9(publishedFlow, ["_id", "_version"]);
|
|
135855
|
+
const differences = diff(publishedComparable, draftComparable);
|
|
135728
135856
|
if (differences.length > 0) {
|
|
135729
135857
|
changes.flows.push({
|
|
135730
135858
|
id: flow._id,
|
|
@@ -135737,7 +135865,7 @@ function computeChanges2(draft, published) {
|
|
|
135737
135865
|
return changes;
|
|
135738
135866
|
}
|
|
135739
135867
|
async function updatePhoneNumberVersions(publishedAgentIds, agentNames) {
|
|
135740
|
-
const spinner =
|
|
135868
|
+
const spinner = createSpinner2("Updating phone numbers...");
|
|
135741
135869
|
const [phoneNumbers, ...agentVersionLists] = await Promise.all([
|
|
135742
135870
|
retell.phoneNumber.list(),
|
|
135743
135871
|
...publishedAgentIds.map((id2) => retell.agent.getVersions(id2))
|
|
@@ -135798,19 +135926,19 @@ async function updatePhoneNumberVersions(publishedAgentIds, agentNames) {
|
|
|
135798
135926
|
const name = agentId ? agentNames.get(agentId) ?? agentId : "unknown";
|
|
135799
135927
|
agentInfo.push(`outbound: ${name} v${phone.outboundVersion}`);
|
|
135800
135928
|
}
|
|
135801
|
-
|
|
135929
|
+
log(source_default.green(`Updated ${source_default.bold(result.value)} (${agentInfo.join(", ")})`));
|
|
135802
135930
|
updatedCount++;
|
|
135803
135931
|
} else {
|
|
135804
|
-
|
|
135932
|
+
error46(`Failed to update phone number: ${result.reason}`);
|
|
135805
135933
|
}
|
|
135806
135934
|
}
|
|
135807
|
-
|
|
135935
|
+
success2(`Updated ${pluralize("phone number", updatedCount, true)}`);
|
|
135808
135936
|
}
|
|
135809
135937
|
|
|
135810
135938
|
// src/cli.ts
|
|
135811
135939
|
var program2 = new Command;
|
|
135812
135940
|
program2.name("retell").description("Retell AI agent management CLI").option("-w, --agents-dir <dir>", "Directory for agent files", DEFAULT_AGENTS_DIR).option("-f, --config-format <format>", `Config file format (${CONFIG_FORMATS.join(", ")})`, DEFAULT_CONFIG_FORMAT);
|
|
135813
135941
|
program2.command("pull [agentIds...]").description("Pull agents from Retell API (always pulls latest draft state)").option("-a, --all", "Pull all agents in the account").option("-s, --select", "Force interactive agent selection").option("-y, --yes", "Skip confirmation prompts").action(pullCommand);
|
|
135814
|
-
program2.command("deploy [agentIds...]").description("Deploy local changes to Retell draft").option("-a, --all", "Deploy all agents in the account").option("-s, --select", "Force interactive agent selection").option("-n, --dry-run", "Show changes without applying").option("-v, --verbose", "Show full diff details (use with --dry-run)").action(deployCommand);
|
|
135815
|
-
program2.command("publish [agentIds...]").description("Publish agents with unpublished draft changes").option("-a, --all", "Publish all agents in the account").option("-s, --select", "Force interactive agent selection").action(publishCommand);
|
|
135942
|
+
program2.command("deploy [agentIds...]").description("Deploy local changes to Retell draft").option("-a, --all", "Deploy all agents in the account").option("-s, --select", "Force interactive agent selection").option("-n, --dry-run", "Show changes without applying").option("-v, --verbose", "Show full diff details (use with --dry-run)").option("-q, --quiet", "Output only affected agent IDs (for piping)").action(deployCommand);
|
|
135943
|
+
program2.command("publish [agentIds...]").description("Publish agents with unpublished draft changes").option("-a, --all", "Publish all agents in the account").option("-s, --select", "Force interactive agent selection").option("-n, --dry-run", "Show what would be published without publishing").option("-q, --quiet", "Output only published agent IDs (for piping)").action(publishCommand);
|
|
135816
135944
|
program2.parse();
|