@erdoai/cli 0.234.0 → 0.236.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/index.js +66 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1132,6 +1132,20 @@ var ErdoClient = class {
|
|
|
1132
1132
|
{ enabled }
|
|
1133
1133
|
);
|
|
1134
1134
|
}
|
|
1135
|
+
getVoiceAgentInstructions(slug) {
|
|
1136
|
+
return this.request(
|
|
1137
|
+
"GET",
|
|
1138
|
+
`/v1/voice/agents/${encodeURIComponent(slug)}/instructions`
|
|
1139
|
+
);
|
|
1140
|
+
}
|
|
1141
|
+
// Replaces the whole text; the agent's profile keeps a version of the old one.
|
|
1142
|
+
setVoiceAgentInstructions(slug, instructions) {
|
|
1143
|
+
return this.request(
|
|
1144
|
+
"PUT",
|
|
1145
|
+
`/v1/voice/agents/${encodeURIComponent(slug)}/instructions`,
|
|
1146
|
+
{ instructions }
|
|
1147
|
+
);
|
|
1148
|
+
}
|
|
1135
1149
|
setVoiceAgentRealtimeModel(slug, model) {
|
|
1136
1150
|
return this.request(
|
|
1137
1151
|
"POST",
|
|
@@ -6788,6 +6802,9 @@ pagesCmd.command("deploy").description("Deploy a page (HTML/React); --html/--js/
|
|
|
6788
6802
|
).option(
|
|
6789
6803
|
"--meta-image-asset <attachmentId>",
|
|
6790
6804
|
"public share image: a Brand Style attachment id (og-image / hero photo) for the link-preview card"
|
|
6805
|
+
).option(
|
|
6806
|
+
"--required-modules <csv>",
|
|
6807
|
+
"runtime modules the page needs (erdoui, landing); a page using the landing components renders blank without landing"
|
|
6791
6808
|
).option("--datasets <csv>", "dataset slugs the page reads").option("--writable-datasets <csv>", "dataset slugs the page may write via erdo.insertRows").option("--kv <csv>", "named KV-store slugs the page reads").option("--writable-kv <csv>", "named KV-store slugs the page may write").option("--public", "make the page publicly viewable").action(
|
|
6792
6809
|
async (opts) => {
|
|
6793
6810
|
try {
|
|
@@ -6798,6 +6815,7 @@ pagesCmd.command("deploy").description("Deploy a page (HTML/React); --html/--js/
|
|
|
6798
6815
|
js: readMaybeFile(opts.js),
|
|
6799
6816
|
css: readMaybeFile(opts.css),
|
|
6800
6817
|
runtime: opts.runtime,
|
|
6818
|
+
required_modules: grantList(opts.requiredModules),
|
|
6801
6819
|
meta_title: opts.metaTitle,
|
|
6802
6820
|
meta_description: opts.metaDescription,
|
|
6803
6821
|
meta_icon_asset_id: opts.metaIconAsset,
|
|
@@ -6870,7 +6888,7 @@ pagesCmd.command("update <id>").description(
|
|
|
6870
6888
|
}
|
|
6871
6889
|
}
|
|
6872
6890
|
);
|
|
6873
|
-
pagesCmd.command("validate").description("Validate page content without deploying").requiredOption("--html <htmlOr@file>", "HTML (or @path)").option("--js <jsOr@file>", "JS/JSX (or @path)").option("--css <cssOr@file>", "CSS (or @path)").option("--runtime <runtime>", "react-tailwind (default) or none").option("--datasets <csv>", "read-dataset slugs referenced by this page (comma-separated)").action(async (opts) => {
|
|
6891
|
+
pagesCmd.command("validate").description("Validate page content without deploying").requiredOption("--html <htmlOr@file>", "HTML (or @path)").option("--js <jsOr@file>", "JS/JSX (or @path)").option("--css <cssOr@file>", "CSS (or @path)").option("--runtime <runtime>", "react-tailwind (default) or none").option("--datasets <csv>", "read-dataset slugs referenced by this page (comma-separated)").option("--required-modules <csv>", 'runtime modules the page will declare (erdoui, landing; "[]" for none)').action(async (opts) => {
|
|
6874
6892
|
try {
|
|
6875
6893
|
print(
|
|
6876
6894
|
await new ErdoClient().validatePage({
|
|
@@ -6878,7 +6896,8 @@ pagesCmd.command("validate").description("Validate page content without deployin
|
|
|
6878
6896
|
js: readMaybeFile(opts.js),
|
|
6879
6897
|
css: readMaybeFile(opts.css),
|
|
6880
6898
|
runtime: opts.runtime,
|
|
6881
|
-
dataset_slugs: grantList(opts.datasets)
|
|
6899
|
+
dataset_slugs: grantList(opts.datasets),
|
|
6900
|
+
required_modules: grantList(opts.requiredModules)
|
|
6882
6901
|
})
|
|
6883
6902
|
);
|
|
6884
6903
|
} catch (e) {
|
|
@@ -8397,6 +8416,51 @@ voiceAgentsCmd.command("whatsapp-replies <slug>").description("Turn a voice agen
|
|
|
8397
8416
|
fail(e);
|
|
8398
8417
|
}
|
|
8399
8418
|
});
|
|
8419
|
+
var voiceAgentInstructionsCmd = voiceAgentsCmd.command("instructions").description("Read or replace a concierge's instructions: the text that tells it how to behave");
|
|
8420
|
+
voiceAgentInstructionsCmd.command("get <slug>").description("Print a concierge's instructions; whether the live agent carries them goes to stderr").option("--json", "print the raw JSON result instead of the text").action(async (slug, opts) => {
|
|
8421
|
+
try {
|
|
8422
|
+
const res = await new ErdoClient().getVoiceAgentInstructions(slug);
|
|
8423
|
+
if (opts.json) {
|
|
8424
|
+
print(res);
|
|
8425
|
+
return;
|
|
8426
|
+
}
|
|
8427
|
+
process.stdout.write(res.instructions.endsWith("\n") ? res.instructions : `${res.instructions}
|
|
8428
|
+
`);
|
|
8429
|
+
process.stderr.write(describeLiveAgent(res));
|
|
8430
|
+
} catch (e) {
|
|
8431
|
+
fail(e);
|
|
8432
|
+
}
|
|
8433
|
+
});
|
|
8434
|
+
voiceAgentInstructionsCmd.command("set <slug>").description(
|
|
8435
|
+
"Replace a concierge's instructions with the contents of a file. The whole text is replaced; the agent's page keeps the previous version. Organization admins with edit access to the agent only."
|
|
8436
|
+
).requiredOption("-f, --file <path>", "file holding the full new instructions").option("--json", "print the raw JSON result instead of a summary").action(async (slug, opts) => {
|
|
8437
|
+
try {
|
|
8438
|
+
const instructions = readFileSync5(opts.file, "utf8");
|
|
8439
|
+
if (!instructions.trim()) {
|
|
8440
|
+
throw new Error(`${opts.file} is empty \u2014 instructions cannot be blank`);
|
|
8441
|
+
}
|
|
8442
|
+
const res = await new ErdoClient().setVoiceAgentInstructions(slug, instructions);
|
|
8443
|
+
if (opts.json) {
|
|
8444
|
+
print(res);
|
|
8445
|
+
return;
|
|
8446
|
+
}
|
|
8447
|
+
console.log(`Saved instructions for ${res.slug} (${res.name}), ${res.instructions.length} characters.`);
|
|
8448
|
+
process.stderr.write(describeLiveAgent(res));
|
|
8449
|
+
} catch (e) {
|
|
8450
|
+
fail(e);
|
|
8451
|
+
}
|
|
8452
|
+
});
|
|
8453
|
+
function describeLiveAgent(res) {
|
|
8454
|
+
if (res.push_pending_since) {
|
|
8455
|
+
return `the last push to the live agent failed (pending since ${res.push_pending_since}); it is retried automatically
|
|
8456
|
+
`;
|
|
8457
|
+
}
|
|
8458
|
+
if (!res.live_agent_synced) {
|
|
8459
|
+
return `the live agent picks this up within seconds \u2014 check with: erdo voice agents instructions get ${res.slug}
|
|
8460
|
+
`;
|
|
8461
|
+
}
|
|
8462
|
+
return "the live agent carries these instructions\n";
|
|
8463
|
+
}
|
|
8400
8464
|
function parseVoiceRealtimeModel(value) {
|
|
8401
8465
|
if (value === "off" || value === "mini" || value === "max") return value;
|
|
8402
8466
|
throw new Error("realtime model must be one of: off, mini, max");
|