retell-sync-cli 3.8.0 → 3.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/cli.js +92 -11
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -134762,8 +134762,12 @@ var retell = new retell_sdk_default({
|
|
|
134762
134762
|
});
|
|
134763
134763
|
async function getRemoteState({
|
|
134764
134764
|
draft = false,
|
|
134765
|
-
agentIds = null
|
|
134765
|
+
agentIds = null,
|
|
134766
|
+
version: version2
|
|
134766
134767
|
} = {}) {
|
|
134768
|
+
if (version2 != null && agentIds) {
|
|
134769
|
+
return getRemoteStateByVersion(agentIds, version2);
|
|
134770
|
+
}
|
|
134767
134771
|
const [allVoiceAgents, allChatAgents, llms, conversationFlows] = await Promise.all([
|
|
134768
134772
|
retellPagination((opts) => retell.agent.list(opts), "agent_id"),
|
|
134769
134773
|
retellPagination((opts) => retell.chatAgent.list(opts), "agent_id"),
|
|
@@ -134784,6 +134788,65 @@ async function getRemoteState({
|
|
|
134784
134788
|
conversationFlows
|
|
134785
134789
|
});
|
|
134786
134790
|
}
|
|
134791
|
+
async function getRemoteStateByVersion(agentIds, version2) {
|
|
134792
|
+
const results = await Promise.all(agentIds.map(async (id2) => {
|
|
134793
|
+
try {
|
|
134794
|
+
const agent = await retell.agent.retrieve(id2, {
|
|
134795
|
+
query: { version: version2 }
|
|
134796
|
+
});
|
|
134797
|
+
return { type: "voice", agent };
|
|
134798
|
+
} catch {
|
|
134799
|
+
try {
|
|
134800
|
+
const agent = await retell.chatAgent.retrieve(id2, {
|
|
134801
|
+
query: { version: version2 }
|
|
134802
|
+
});
|
|
134803
|
+
return { type: "chat", agent };
|
|
134804
|
+
} catch {
|
|
134805
|
+
throw new Error(`Agent ${id2} not found at version ${version2}. ` + `Use 'retell.agent.getVersions(id)' to see available versions.`);
|
|
134806
|
+
}
|
|
134807
|
+
}
|
|
134808
|
+
}));
|
|
134809
|
+
const voiceAgents = [];
|
|
134810
|
+
const chatAgents = [];
|
|
134811
|
+
for (const result of results) {
|
|
134812
|
+
if (result.type === "voice") {
|
|
134813
|
+
voiceAgents.push(result.agent);
|
|
134814
|
+
} else {
|
|
134815
|
+
chatAgents.push(result.agent);
|
|
134816
|
+
}
|
|
134817
|
+
}
|
|
134818
|
+
const llmIds = new Set;
|
|
134819
|
+
const llmVersions = new Map;
|
|
134820
|
+
const flowIds = new Set;
|
|
134821
|
+
const flowVersions = new Map;
|
|
134822
|
+
for (const agent of [...voiceAgents, ...chatAgents]) {
|
|
134823
|
+
if (agent.response_engine.type === "retell-llm") {
|
|
134824
|
+
llmIds.add(agent.response_engine.llm_id);
|
|
134825
|
+
if (agent.response_engine.version != null) {
|
|
134826
|
+
llmVersions.set(agent.response_engine.llm_id, agent.response_engine.version);
|
|
134827
|
+
}
|
|
134828
|
+
} else if (agent.response_engine.type === "conversation-flow") {
|
|
134829
|
+
flowIds.add(agent.response_engine.conversation_flow_id);
|
|
134830
|
+
if (agent.response_engine.version != null) {
|
|
134831
|
+
flowVersions.set(agent.response_engine.conversation_flow_id, agent.response_engine.version);
|
|
134832
|
+
}
|
|
134833
|
+
}
|
|
134834
|
+
}
|
|
134835
|
+
const [llms, conversationFlows] = await Promise.all([
|
|
134836
|
+
Promise.all([...llmIds].map((id2) => retell.llm.retrieve(id2, {
|
|
134837
|
+
query: { version: llmVersions.get(id2) }
|
|
134838
|
+
}))),
|
|
134839
|
+
Promise.all([...flowIds].map((id2) => retell.conversationFlow.retrieve(id2, {
|
|
134840
|
+
query: { version: flowVersions.get(id2) }
|
|
134841
|
+
})))
|
|
134842
|
+
]);
|
|
134843
|
+
return canonicalizeFromApi({
|
|
134844
|
+
voiceAgents,
|
|
134845
|
+
chatAgents,
|
|
134846
|
+
llms,
|
|
134847
|
+
conversationFlows
|
|
134848
|
+
});
|
|
134849
|
+
}
|
|
134787
134850
|
function canonicalizeFromApi({
|
|
134788
134851
|
voiceAgents: voiceAgentsList,
|
|
134789
134852
|
chatAgents: chatAgentsList,
|
|
@@ -135143,19 +135206,15 @@ async function canonicalizeFromFiles(files) {
|
|
|
135143
135206
|
var InputMatchRuleSchema = zod_default.discriminatedUnion("type", [
|
|
135144
135207
|
zod_default.object({ type: zod_default.literal("any") }),
|
|
135145
135208
|
zod_default.object({
|
|
135146
|
-
type: zod_default.literal("
|
|
135147
|
-
|
|
135148
|
-
}),
|
|
135149
|
-
zod_default.object({
|
|
135150
|
-
type: zod_default.literal("partial"),
|
|
135151
|
-
input: zod_default.record(zod_default.string(), zod_default.unknown())
|
|
135209
|
+
type: zod_default.literal("partial_match"),
|
|
135210
|
+
args: zod_default.record(zod_default.string(), zod_default.unknown())
|
|
135152
135211
|
})
|
|
135153
135212
|
]);
|
|
135154
135213
|
var ToolMockSchema = zod_default.object({
|
|
135155
135214
|
tool_name: zod_default.string(),
|
|
135156
135215
|
input_match_rule: InputMatchRuleSchema,
|
|
135157
135216
|
output: zod_default.string(),
|
|
135158
|
-
result: zod_default.boolean()
|
|
135217
|
+
result: zod_default.boolean().nullable().optional()
|
|
135159
135218
|
});
|
|
135160
135219
|
var TestCaseResponseEngineSchema = zod_default.discriminatedUnion("type", [
|
|
135161
135220
|
zod_default.object({
|
|
@@ -135764,16 +135823,36 @@ async function resolveAgentIds(args, { all = false, select = false } = {}) {
|
|
|
135764
135823
|
var {$: $10 } = globalThis.Bun;
|
|
135765
135824
|
async function pullCommand(agentIdArgs, opts, cmd) {
|
|
135766
135825
|
const globalOpts = cmd.optsWithGlobals();
|
|
135826
|
+
let version2;
|
|
135827
|
+
if (opts.version != null) {
|
|
135828
|
+
version2 = parseInt(opts.version, 10);
|
|
135829
|
+
if (Number.isNaN(version2) || version2 < 0) {
|
|
135830
|
+
console.log(source_default.red("Error: --version must be a non-negative integer"));
|
|
135831
|
+
process.exitCode = 1;
|
|
135832
|
+
return;
|
|
135833
|
+
}
|
|
135834
|
+
}
|
|
135835
|
+
if (version2 != null && opts.all) {
|
|
135836
|
+
console.log(source_default.red("Error: --version cannot be used with --all (must specify agent IDs)"));
|
|
135837
|
+
process.exitCode = 1;
|
|
135838
|
+
return;
|
|
135839
|
+
}
|
|
135767
135840
|
try {
|
|
135768
135841
|
const agentIds = await resolveAgentIds(agentIdArgs, {
|
|
135769
135842
|
all: opts.all,
|
|
135770
135843
|
select: opts.select
|
|
135771
135844
|
});
|
|
135845
|
+
if (version2 != null && !agentIds) {
|
|
135846
|
+
console.log(source_default.red("Error: --version requires specific agent IDs"));
|
|
135847
|
+
process.exitCode = 1;
|
|
135848
|
+
return;
|
|
135849
|
+
}
|
|
135772
135850
|
await pull({
|
|
135773
135851
|
agentsDir: globalOpts.agentsDir,
|
|
135774
135852
|
configFormat: globalOpts.configFormat,
|
|
135775
135853
|
agentIds,
|
|
135776
135854
|
yes: opts.yes,
|
|
135855
|
+
version: version2,
|
|
135777
135856
|
tests: opts.tests ?? true
|
|
135778
135857
|
});
|
|
135779
135858
|
} catch (err) {
|
|
@@ -135789,10 +135868,12 @@ async function pull({
|
|
|
135789
135868
|
configFormat = DEFAULT_CONFIG_FORMAT,
|
|
135790
135869
|
agentIds = null,
|
|
135791
135870
|
yes = false,
|
|
135871
|
+
version: version2,
|
|
135792
135872
|
tests = true
|
|
135793
135873
|
} = {}) {
|
|
135794
135874
|
const scopeLabel = agentIds ? `${agentIds.length} agent(s)` : "all agents";
|
|
135795
|
-
|
|
135875
|
+
const versionLabel = version2 != null ? ` (version ${version2})` : "";
|
|
135876
|
+
console.log(source_default.bold(`Pulling ${scopeLabel}${versionLabel} from Retell...`));
|
|
135796
135877
|
if (!yes) {
|
|
135797
135878
|
const { stdout } = await $10`git status --porcelain -- ${agentsDir}`.nothrow().quiet();
|
|
135798
135879
|
const hasChanges = stdout.toString().trim().length > 0;
|
|
@@ -135809,7 +135890,7 @@ async function pull({
|
|
|
135809
135890
|
}
|
|
135810
135891
|
}
|
|
135811
135892
|
const spinner = createSpinner("Fetching from Retell API...");
|
|
135812
|
-
const remoteState = await getRemoteState({ draft: true, agentIds });
|
|
135893
|
+
const remoteState = await getRemoteState({ draft: true, agentIds, version: version2 });
|
|
135813
135894
|
const totalAgents = remoteState.voiceAgents.length + remoteState.chatAgents.length;
|
|
135814
135895
|
spinner.stop(source_default.dim(`${pluralize("agent", totalAgents, true)} (${remoteState.voiceAgents.length} voice, ${remoteState.chatAgents.length} chat), ${pluralize("LLM", remoteState.llms.length, true)}, ${pluralize("flow", remoteState.conversationFlows.length, true)}`));
|
|
135815
135896
|
const writeSpinner = createSpinner("Writing files...");
|
|
@@ -136527,7 +136608,7 @@ async function updatePhoneNumberVersions(publishedAgentIds, agentNames) {
|
|
|
136527
136608
|
// src/cli.ts
|
|
136528
136609
|
var program2 = new Command;
|
|
136529
136610
|
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);
|
|
136530
|
-
program2.command("pull [agentIds...]").description("Pull agents from Retell API (
|
|
136611
|
+
program2.command("pull [agentIds...]").description("Pull agents from Retell API (pulls latest draft state by default)").option("-a, --all", "Pull all agents in the account").option("-s, --select", "Force interactive agent selection").option("-y, --yes", "Skip confirmation prompts").option("-v, --version <number>", "Pull a specific version (requires agent IDs)").option("--no-tests", "Skip pulling test case definitions").action(pullCommand);
|
|
136531
136612
|
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);
|
|
136532
136613
|
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);
|
|
136533
136614
|
program2.parse();
|