@erdoai/cli 0.200.0 → 0.201.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 +125 -37
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -81,8 +81,8 @@ function formatRefreshJobRow(r) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
// src/index.ts
|
|
84
|
-
import { readFileSync as
|
|
85
|
-
import { basename } from "path";
|
|
84
|
+
import { readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
|
|
85
|
+
import { basename as basename2 } from "path";
|
|
86
86
|
|
|
87
87
|
// src/csv.ts
|
|
88
88
|
function parseCSV(text) {
|
|
@@ -177,25 +177,89 @@ function compareEvalRuns(before, after, cases = []) {
|
|
|
177
177
|
return rows.sort((x, y) => (y.change ?? -Infinity) - (x.change ?? -Infinity));
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
+
// src/eval-candidate.ts
|
|
181
|
+
import { readdirSync, readFileSync, statSync } from "fs";
|
|
182
|
+
import { extname, join, basename } from "path";
|
|
183
|
+
var ANSWER_EXTENSIONS = /* @__PURE__ */ new Set([".md", ".txt"]);
|
|
184
|
+
var FILENAME_UNSAFE = /[\\/:*?"<>|]/g;
|
|
185
|
+
function caseKey(name) {
|
|
186
|
+
return name.trim().toLowerCase();
|
|
187
|
+
}
|
|
188
|
+
function fileSafeKey(name) {
|
|
189
|
+
return caseKey(name.replace(FILENAME_UNSAFE, "-"));
|
|
190
|
+
}
|
|
191
|
+
function loadCandidateOutputs(dir, caseNames, opts = {}) {
|
|
192
|
+
let entries;
|
|
193
|
+
try {
|
|
194
|
+
if (!statSync(dir).isDirectory()) throw new Error("not a directory");
|
|
195
|
+
entries = readdirSync(dir).sort();
|
|
196
|
+
} catch {
|
|
197
|
+
throw new Error(`--outputs must be a directory of answer files; cannot read "${dir}"`);
|
|
198
|
+
}
|
|
199
|
+
const byKey = /* @__PURE__ */ new Map();
|
|
200
|
+
const bySafeKey = /* @__PURE__ */ new Map();
|
|
201
|
+
for (const name of caseNames) {
|
|
202
|
+
byKey.set(caseKey(name), name);
|
|
203
|
+
bySafeKey.set(fileSafeKey(name), name);
|
|
204
|
+
}
|
|
205
|
+
const fileForCase = /* @__PURE__ */ new Map();
|
|
206
|
+
for (const entry of entries) {
|
|
207
|
+
const ext = extname(entry).toLowerCase();
|
|
208
|
+
if (entry.startsWith(".") || !ANSWER_EXTENSIONS.has(ext)) continue;
|
|
209
|
+
const stem = basename(entry, extname(entry));
|
|
210
|
+
const caseName = byKey.get(caseKey(stem)) ?? bySafeKey.get(fileSafeKey(stem));
|
|
211
|
+
if (caseName === void 0) {
|
|
212
|
+
throw new Error(
|
|
213
|
+
`"${entry}" matches no case in the suite. Name each file after its case (.md or .txt). Cases: ${caseNames.join(", ")}`
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
const existing = fileForCase.get(caseName);
|
|
217
|
+
if (existing !== void 0) {
|
|
218
|
+
throw new Error(`Case "${caseName}" has two answer files: "${existing}" and "${entry}". Keep one.`);
|
|
219
|
+
}
|
|
220
|
+
fileForCase.set(caseName, entry);
|
|
221
|
+
}
|
|
222
|
+
if (opts.requireAllCases) {
|
|
223
|
+
const missing = caseNames.filter((name) => !fileForCase.has(name));
|
|
224
|
+
if (missing.length > 0) {
|
|
225
|
+
throw new Error(
|
|
226
|
+
`No answer file for ${missing.length === 1 ? "case" : "cases"}: ${missing.map((n) => `"${n}"`).join(", ")} (expected "<case name>.md" or ".txt" in ${dir})`
|
|
227
|
+
);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
if (fileForCase.size === 0) {
|
|
231
|
+
throw new Error(`No answer files found in "${dir}". Add one "<case name>.md" or ".txt" per case. Cases: ${caseNames.join(", ")}`);
|
|
232
|
+
}
|
|
233
|
+
const outputs = [];
|
|
234
|
+
for (const caseName of caseNames) {
|
|
235
|
+
const file = fileForCase.get(caseName);
|
|
236
|
+
if (file === void 0) continue;
|
|
237
|
+
const output = readFileSync(join(dir, file), "utf8");
|
|
238
|
+
if (output.trim() === "") throw new Error(`Answer file "${file}" for case "${caseName}" is empty`);
|
|
239
|
+
outputs.push({ case_name: caseName, output });
|
|
240
|
+
}
|
|
241
|
+
return outputs;
|
|
242
|
+
}
|
|
243
|
+
|
|
180
244
|
// src/index.ts
|
|
181
245
|
import { password, select } from "@inquirer/prompts";
|
|
182
246
|
import { Argument, Command as Command2, Option as Option2 } from "commander";
|
|
183
247
|
|
|
184
248
|
// src/config.ts
|
|
185
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
249
|
+
import { existsSync, mkdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
186
250
|
import { homedir } from "os";
|
|
187
|
-
import { dirname, join } from "path";
|
|
251
|
+
import { dirname, join as join2 } from "path";
|
|
188
252
|
var DEFAULT_API_URL = "https://api.erdo.ai";
|
|
189
|
-
var CONFIG_DIR =
|
|
190
|
-
var CONFIG_PATH =
|
|
253
|
+
var CONFIG_DIR = join2(process.env.XDG_CONFIG_HOME || join2(homedir(), ".config"), "erdo");
|
|
254
|
+
var CONFIG_PATH = join2(CONFIG_DIR, "config.json");
|
|
191
255
|
var LEGACY_KEY = "default";
|
|
192
256
|
function configPath(name) {
|
|
193
|
-
return
|
|
257
|
+
return join2(CONFIG_DIR, name);
|
|
194
258
|
}
|
|
195
259
|
function loadConfigFile() {
|
|
196
260
|
if (!existsSync(CONFIG_PATH)) return null;
|
|
197
261
|
try {
|
|
198
|
-
const raw = JSON.parse(
|
|
262
|
+
const raw = JSON.parse(readFileSync2(CONFIG_PATH, "utf8"));
|
|
199
263
|
if (raw && raw.version === 2 && raw.accounts) return raw;
|
|
200
264
|
if (raw && typeof raw.token === "string") {
|
|
201
265
|
return { version: 2, activeAccount: LEGACY_KEY, accounts: { [LEGACY_KEY]: raw } };
|
|
@@ -1051,7 +1115,7 @@ var ErdoClient = class {
|
|
|
1051
1115
|
`/v1/evals/suites/${encodeURIComponent(slug)}/cases/${encodeURIComponent(caseName)}`
|
|
1052
1116
|
);
|
|
1053
1117
|
}
|
|
1054
|
-
runEvalSuite(slug, concurrency, commitSha, frontendCommitSha, backendCommitSha, source, modelOverride, rotateCases) {
|
|
1118
|
+
runEvalSuite(slug, concurrency, commitSha, frontendCommitSha, backendCommitSha, source, modelOverride, rotateCases, externalCandidate) {
|
|
1055
1119
|
return this.request(
|
|
1056
1120
|
"POST",
|
|
1057
1121
|
`/v1/evals/suites/${encodeURIComponent(slug)}/run`,
|
|
@@ -1062,7 +1126,8 @@ var ErdoClient = class {
|
|
|
1062
1126
|
backend_commit_sha: backendCommitSha,
|
|
1063
1127
|
source,
|
|
1064
1128
|
model_override: modelOverride,
|
|
1065
|
-
rotate_cases: rotateCases
|
|
1129
|
+
rotate_cases: rotateCases,
|
|
1130
|
+
external_candidate: externalCandidate
|
|
1066
1131
|
}
|
|
1067
1132
|
);
|
|
1068
1133
|
}
|
|
@@ -2564,11 +2629,11 @@ async function browserLogin() {
|
|
|
2564
2629
|
}
|
|
2565
2630
|
|
|
2566
2631
|
// src/input.ts
|
|
2567
|
-
import { readFileSync as
|
|
2632
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
2568
2633
|
function readMaybeFile(value) {
|
|
2569
2634
|
if (value === void 0) return void 0;
|
|
2570
2635
|
if (value.startsWith("@@")) return value.slice(1);
|
|
2571
|
-
return value.startsWith("@") ?
|
|
2636
|
+
return value.startsWith("@") ? readFileSync3(value.slice(1), "utf8") : value;
|
|
2572
2637
|
}
|
|
2573
2638
|
async function resolveSecretInput(options) {
|
|
2574
2639
|
if (options.fromStdin) {
|
|
@@ -2703,7 +2768,7 @@ function orgOption(description) {
|
|
|
2703
2768
|
|
|
2704
2769
|
// src/update.ts
|
|
2705
2770
|
import { spawn as spawn2, spawnSync } from "child_process";
|
|
2706
|
-
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as
|
|
2771
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync as readFileSync4, writeFileSync as writeFileSync2 } from "fs";
|
|
2707
2772
|
import { dirname as dirname2 } from "path";
|
|
2708
2773
|
var PKG = "@erdoai/cli";
|
|
2709
2774
|
var MANUAL_HINT = `npm install -g ${PKG}@latest`;
|
|
@@ -2741,7 +2806,7 @@ async function fetchLatestVersion(timeoutMs) {
|
|
|
2741
2806
|
function readVersionCache() {
|
|
2742
2807
|
try {
|
|
2743
2808
|
if (!existsSync2(CACHE_PATH)) return {};
|
|
2744
|
-
const raw = JSON.parse(
|
|
2809
|
+
const raw = JSON.parse(readFileSync4(CACHE_PATH, "utf8"));
|
|
2745
2810
|
return raw && typeof raw === "object" ? raw : {};
|
|
2746
2811
|
} catch {
|
|
2747
2812
|
return {};
|
|
@@ -2809,7 +2874,7 @@ async function update(current) {
|
|
|
2809
2874
|
}
|
|
2810
2875
|
|
|
2811
2876
|
// src/index.ts
|
|
2812
|
-
var pkg = JSON.parse(
|
|
2877
|
+
var pkg = JSON.parse(readFileSync5(new URL("../package.json", import.meta.url), "utf8"));
|
|
2813
2878
|
function fail(err) {
|
|
2814
2879
|
if (err instanceof ErdoApiError) {
|
|
2815
2880
|
console.error(`Error ${err.status}: ${err.message}`);
|
|
@@ -2893,7 +2958,7 @@ async function readAllStdin() {
|
|
|
2893
2958
|
function readJSONObject(file, label) {
|
|
2894
2959
|
let parsed;
|
|
2895
2960
|
try {
|
|
2896
|
-
parsed = JSON.parse(
|
|
2961
|
+
parsed = JSON.parse(readFileSync5(file, "utf8"));
|
|
2897
2962
|
} catch (error) {
|
|
2898
2963
|
throw new Error(`${label} must be a readable JSON file: ${error instanceof Error ? error.message : String(error)}`);
|
|
2899
2964
|
}
|
|
@@ -2971,6 +3036,7 @@ function summariseResults(results, cases = []) {
|
|
|
2971
3036
|
else status = "FAIL";
|
|
2972
3037
|
const name = nameByID.get(r.case_id) ?? r.case_id;
|
|
2973
3038
|
console.log(` [${status}] ${r.score.toFixed(2)} ${name}`);
|
|
3039
|
+
if (r.candidate_cost_usd) console.log(` candidate cost: $${r.candidate_cost_usd.toFixed(4)} (reported by the candidate, not judge cost)`);
|
|
2974
3040
|
if (r.agent_error) console.log(` agent error: ${r.agent_error}`);
|
|
2975
3041
|
for (const c of r.judge_criteria_scores || []) {
|
|
2976
3042
|
console.log(` - ${c.score} ${c.criterion}`);
|
|
@@ -4060,7 +4126,7 @@ evalCmd.command("suite <slug>").description("Show a suite and its cases").action
|
|
|
4060
4126
|
var investigationCmd = program.command("investigation").description("Assess a data question from evidence already collected");
|
|
4061
4127
|
investigationCmd.command("assess").description("Assess a question from a JSON file of definitions, observations, and claims").requiredOption("-f, --file <path>", "JSON assessment request").option("--json", "print the assessment JSON").action(async (opts) => {
|
|
4062
4128
|
try {
|
|
4063
|
-
const input = JSON.parse(
|
|
4129
|
+
const input = JSON.parse(readFileSync5(opts.file, "utf8"));
|
|
4064
4130
|
const result = await new ErdoClient().assessInvestigation(input);
|
|
4065
4131
|
if (opts.json) {
|
|
4066
4132
|
print(result);
|
|
@@ -4247,7 +4313,7 @@ wsCmd.command("recommendations <slug>").description("Read resolved recommendatio
|
|
|
4247
4313
|
try {
|
|
4248
4314
|
const client = new ErdoClient();
|
|
4249
4315
|
if (opts.inputFile) {
|
|
4250
|
-
const body = JSON.parse(
|
|
4316
|
+
const body = JSON.parse(readFileSync5(opts.inputFile, "utf8"));
|
|
4251
4317
|
if (body === null || typeof body !== "object" || Array.isArray(body)) {
|
|
4252
4318
|
throw new Error("--input-file must contain a JSON object");
|
|
4253
4319
|
}
|
|
@@ -4761,10 +4827,28 @@ evalCmd.command("run <slug>").description("Run a suite; --watch polls until it c
|
|
|
4761
4827
|
throw new Error(`--rotate-cases must be a non-negative integer, got "${v}"`);
|
|
4762
4828
|
}
|
|
4763
4829
|
return parsed;
|
|
4764
|
-
}).action(async (slug, opts) => {
|
|
4830
|
+
}).option("--candidate <label>", "score another system's answers instead of invoking the agent; the label becomes the leaderboard column external:<label> (staff only; needs --outputs)").option("--outputs <dir>", `directory of the candidate's answers, one "<case name>.md" or ".txt" file per case (with --candidate)`).option("--candidate-notes <text>", "how the candidate's answers were captured, stored with the run (with --candidate)").option("--all-cases", "with --candidate, fail unless every case in the suite has an answer file").action(async (slug, opts) => {
|
|
4765
4831
|
try {
|
|
4832
|
+
if (!opts.candidate && (opts.outputs || opts.candidateNotes || opts.allCases)) {
|
|
4833
|
+
throw new Error("--outputs, --candidate-notes and --all-cases need --candidate <label>");
|
|
4834
|
+
}
|
|
4835
|
+
if (opts.candidate && !opts.outputs) {
|
|
4836
|
+
throw new Error("--candidate needs --outputs <dir> holding one answer file per case");
|
|
4837
|
+
}
|
|
4838
|
+
if (opts.candidate && (opts.model || opts.rotateCases)) {
|
|
4839
|
+
throw new Error("--candidate cannot be combined with --model or --rotate-cases: the answers were not produced by an Erdo agent");
|
|
4840
|
+
}
|
|
4766
4841
|
const api = new ErdoClient();
|
|
4767
|
-
const { suite } = await api.getEvalSuite(slug);
|
|
4842
|
+
const { suite, cases: suiteCases } = await api.getEvalSuite(slug);
|
|
4843
|
+
const externalCandidate = opts.candidate ? {
|
|
4844
|
+
label: opts.candidate,
|
|
4845
|
+
outputs: loadCandidateOutputs(
|
|
4846
|
+
opts.outputs,
|
|
4847
|
+
suiteCases.map((c) => c.name),
|
|
4848
|
+
{ requireAllCases: opts.allCases }
|
|
4849
|
+
),
|
|
4850
|
+
notes: opts.candidateNotes
|
|
4851
|
+
} : void 0;
|
|
4768
4852
|
if (suite.evaluate_artifact && !process.env.ERDO_ORG) {
|
|
4769
4853
|
const resolved = resolveOrgId(activeAccount()) ?? "<org>";
|
|
4770
4854
|
console.error(
|
|
@@ -4785,9 +4869,13 @@ evalCmd.command("run <slug>").description("Run a suite; --watch polls until it c
|
|
|
4785
4869
|
opts.backendCommitSha,
|
|
4786
4870
|
opts.source,
|
|
4787
4871
|
opts.model,
|
|
4788
|
-
opts.rotateCases
|
|
4872
|
+
opts.rotateCases,
|
|
4873
|
+
externalCandidate
|
|
4789
4874
|
);
|
|
4790
4875
|
console.log(`run_id: ${run_id}`);
|
|
4876
|
+
if (externalCandidate) {
|
|
4877
|
+
console.log(`scoring ${externalCandidate.outputs.length} answer(s) from external:${externalCandidate.label}`);
|
|
4878
|
+
}
|
|
4791
4879
|
if (!opts.watch) return;
|
|
4792
4880
|
for (; ; ) {
|
|
4793
4881
|
await sleep2(5e3);
|
|
@@ -6564,7 +6652,7 @@ var pagesCmd = program.command("pages").description("Create and manage pages/art
|
|
|
6564
6652
|
var criticCmd = program.command("critic").description("Review campaign creative");
|
|
6565
6653
|
criticCmd.command("review").description("Review an ad creative request from a JSON file and print per-lens findings").requiredOption("-f, --file <path>", "JSON file containing the full critic review request envelope").option("--json", "print the complete raw JSON response").action(async (opts) => {
|
|
6566
6654
|
try {
|
|
6567
|
-
const input = JSON.parse(
|
|
6655
|
+
const input = JSON.parse(readFileSync5(opts.file, "utf8"));
|
|
6568
6656
|
const result = await new ErdoClient().reviewAd(input);
|
|
6569
6657
|
if (opts.json) {
|
|
6570
6658
|
print(result);
|
|
@@ -8053,7 +8141,7 @@ function describeLOASignature(sig) {
|
|
|
8053
8141
|
}
|
|
8054
8142
|
}
|
|
8055
8143
|
function fileAsBase64(path) {
|
|
8056
|
-
return path ?
|
|
8144
|
+
return path ? readFileSync5(path).toString("base64") : void 0;
|
|
8057
8145
|
}
|
|
8058
8146
|
voiceBrandedCallingCmd.command("get").description("Show the brand, what it still needs, and each number's part in it").option("--json", "print the raw JSON result instead of a table").action(async (opts) => {
|
|
8059
8147
|
try {
|
|
@@ -8328,7 +8416,7 @@ providerLeadSourcesCmd.command("import <name> <file>").description(
|
|
|
8328
8416
|
try {
|
|
8329
8417
|
if (opts.startFollowUp && !opts.commit) throw new Error("--start-follow-up needs --commit");
|
|
8330
8418
|
if (!file.toLowerCase().endsWith(".csv")) throw new Error("import reads CSV; export the sheet or workbook as CSV first");
|
|
8331
|
-
const records = parseCSV(
|
|
8419
|
+
const records = parseCSV(readFileSync5(file, "utf8"));
|
|
8332
8420
|
if (records.length === 0) throw new Error("the file is empty");
|
|
8333
8421
|
const [header, ...rows] = records;
|
|
8334
8422
|
const client = new ErdoClient();
|
|
@@ -8566,7 +8654,7 @@ datasetsCmd.command("write <slug>").description(
|
|
|
8566
8654
|
}
|
|
8567
8655
|
);
|
|
8568
8656
|
function readSchemaFile(path) {
|
|
8569
|
-
const parsed = JSON.parse(
|
|
8657
|
+
const parsed = JSON.parse(readFileSync5(path, "utf8"));
|
|
8570
8658
|
const schema = Array.isArray(parsed) ? { columns: parsed } : parsed;
|
|
8571
8659
|
if (!schema || !Array.isArray(schema.columns)) {
|
|
8572
8660
|
throw new Error('--schema must contain a JSON columns array or {"columns": [...]} object');
|
|
@@ -8630,7 +8718,7 @@ datasetsCmd.command("ensure <purpose>").description(
|
|
|
8630
8718
|
});
|
|
8631
8719
|
datasetsCmd.command("update-schema <slug>").description("Evolve an existing dataset's column contract. For populated lead-identity datasets, use add_column operations only; existing rows and lead ids are preserved.").requiredOption("--input <file>", "JSON request containing operations and optional class/purpose changes").action(async (slug, opts) => {
|
|
8632
8720
|
try {
|
|
8633
|
-
const input = JSON.parse(
|
|
8721
|
+
const input = JSON.parse(readFileSync5(opts.input, "utf8"));
|
|
8634
8722
|
if (!input || typeof input !== "object" || Array.isArray(input)) {
|
|
8635
8723
|
throw new Error("--input must contain a JSON object");
|
|
8636
8724
|
}
|
|
@@ -8880,7 +8968,7 @@ Fetch a selected table with: erdo datasets fetch ${slug} --sql "SELECT * FROM <t
|
|
|
8880
8968
|
var MAX_UPLOAD_BYTES = 20 * 1024 * 1024;
|
|
8881
8969
|
datasetsCmd.command("upload <file>").description("Upload a file (CSV, Excel, JSON, ...) and create a dataset from it").option("-n, --name <name>", "display name for the dataset (defaults to the filename)").option("-d, --description <text>", "description shown to agents analyzing the dataset").action(async (file, opts) => {
|
|
8882
8970
|
try {
|
|
8883
|
-
const content =
|
|
8971
|
+
const content = readFileSync5(file);
|
|
8884
8972
|
if (content.byteLength > MAX_UPLOAD_BYTES) {
|
|
8885
8973
|
fail(
|
|
8886
8974
|
new Error(
|
|
@@ -8888,7 +8976,7 @@ datasetsCmd.command("upload <file>").description("Upload a file (CSV, Excel, JSO
|
|
|
8888
8976
|
)
|
|
8889
8977
|
);
|
|
8890
8978
|
}
|
|
8891
|
-
const filename =
|
|
8979
|
+
const filename = basename2(file);
|
|
8892
8980
|
const res = await new ErdoClient().uploadDatasetFile({
|
|
8893
8981
|
filename,
|
|
8894
8982
|
content_base64: content.toString("base64"),
|
|
@@ -9439,7 +9527,7 @@ Review saved submission evidence with: erdo leads resolve-capture ${res.dataset_
|
|
|
9439
9527
|
});
|
|
9440
9528
|
leadsCmd.command("resolve-capture <dataset> <receipt>").description("Preview a refused submission against a candidate lead, or record an audited dismissal. Applying preserves the original receipt and does not merge identities, report a conversion, or replay arrival automations.").requiredOption("--input <file>", "JSON decision: action, target_lead_id for apply_to_lead, reason; applying also requires expected_snapshot and operation_key").option("--apply", "confirm the exact preview; without this flag the decision only previews").action(async (dataset, receipt, opts) => {
|
|
9441
9529
|
try {
|
|
9442
|
-
const input = JSON.parse(
|
|
9530
|
+
const input = JSON.parse(readFileSync5(opts.input, "utf8"));
|
|
9443
9531
|
if (!input || typeof input !== "object" || Array.isArray(input)) throw new Error("--input must contain a JSON object");
|
|
9444
9532
|
if (Object.hasOwn(input, "apply")) throw new Error("Use the explicit --apply flag; do not put apply in the decision file");
|
|
9445
9533
|
for (const key of Object.keys(input)) {
|
|
@@ -9558,7 +9646,7 @@ leadPlaybookCmd.command("set").description(
|
|
|
9558
9646
|
if (opts.dailyContactCap !== void 0 && !Number.isInteger(opts.dailyContactCap)) {
|
|
9559
9647
|
throw new Error("--daily-contact-cap must be a whole number");
|
|
9560
9648
|
}
|
|
9561
|
-
const body =
|
|
9649
|
+
const body = readFileSync5(opts.file, "utf8");
|
|
9562
9650
|
const res = await new ErdoClient().putLeadPlaybook({
|
|
9563
9651
|
body,
|
|
9564
9652
|
enabled: opts.enable ? true : opts.disable ? false : void 0,
|
|
@@ -9583,7 +9671,7 @@ leadPlaybookCmd.command("read-back").description(
|
|
|
9583
9671
|
"read the draft back as saving it with that concierge would; leave it off to read it back with none, which is what saving with none does"
|
|
9584
9672
|
).option("--json", "print the raw JSON result instead of a summary").action(async (opts) => {
|
|
9585
9673
|
try {
|
|
9586
|
-
const res = await new ErdoClient().readLeadPlaybook(
|
|
9674
|
+
const res = await new ErdoClient().readLeadPlaybook(readFileSync5(opts.file, "utf8"), opts.agentId);
|
|
9587
9675
|
if (opts.json) {
|
|
9588
9676
|
print(res);
|
|
9589
9677
|
return;
|
|
@@ -9898,7 +9986,7 @@ leadNextActionsCmd.command("evaluate <dataset> <lead>").description(
|
|
|
9898
9986
|
"Dry-run the playbook on one lead: show the decision Erdo would make now, with the email or handoff it would write, the rule it cites and why. Nothing is stored and nothing is sent. --file tries a draft playbook instead of the saved one."
|
|
9899
9987
|
).option("-f, --file <path>", "a draft playbook text to evaluate with instead of the saved one").option("--agent-id <id>", "try the draft as that concierge, from `erdo voice agents`; only read alongside --file").option("--json", "print the raw JSON result instead of a summary").action(async (dataset, lead, opts) => {
|
|
9900
9988
|
try {
|
|
9901
|
-
const body = opts.file ?
|
|
9989
|
+
const body = opts.file ? readFileSync5(opts.file, "utf8") : void 0;
|
|
9902
9990
|
const res = await new ErdoClient().evaluateLeadNextAction(dataset, lead, body, opts.agentId);
|
|
9903
9991
|
if (opts.json) {
|
|
9904
9992
|
print(res);
|
|
@@ -10593,9 +10681,9 @@ knowledgeCmd.command("attach <objectId> <file>").description(
|
|
|
10593
10681
|
).option("--media-type <mime>", "MIME type hint, e.g. image/jpeg; detected from the filename otherwise").action(
|
|
10594
10682
|
async (objectId, file, opts) => {
|
|
10595
10683
|
try {
|
|
10596
|
-
const body = opts.url ? { filename:
|
|
10597
|
-
filename:
|
|
10598
|
-
content_base64:
|
|
10684
|
+
const body = opts.url ? { filename: basename2(file), source_url: opts.url } : {
|
|
10685
|
+
filename: basename2(file),
|
|
10686
|
+
content_base64: readFileSync5(file).toString("base64")
|
|
10599
10687
|
};
|
|
10600
10688
|
print(
|
|
10601
10689
|
await new ErdoClient().attachKnowledgeAsset(objectId, {
|
|
@@ -10654,7 +10742,7 @@ autoCmd.command("create <name>").description(
|
|
|
10654
10742
|
fail(new Error("pass either --script-js or --script-file, not both"));
|
|
10655
10743
|
return;
|
|
10656
10744
|
}
|
|
10657
|
-
const scriptJs = opts.scriptFile ?
|
|
10745
|
+
const scriptJs = opts.scriptFile ? readFileSync5(opts.scriptFile, "utf8") : opts.scriptJs;
|
|
10658
10746
|
const h = await new ErdoClient().createHeartbeat({
|
|
10659
10747
|
name,
|
|
10660
10748
|
description: opts.description,
|
|
@@ -10724,7 +10812,7 @@ autoCmd.command("update <id>").description("Edit an automation \u2014 rename, re
|
|
|
10724
10812
|
fail(new Error("pass either --model or --clear-model, not both"));
|
|
10725
10813
|
return;
|
|
10726
10814
|
}
|
|
10727
|
-
const scriptJs = opts.scriptFile ?
|
|
10815
|
+
const scriptJs = opts.scriptFile ? readFileSync5(opts.scriptFile, "utf8") : opts.scriptJs;
|
|
10728
10816
|
if (opts.at !== void 0 && opts.clearAt) {
|
|
10729
10817
|
fail(new Error("pass either --at or --clear-at, not both"));
|
|
10730
10818
|
return;
|