@erdoai/cli 0.233.0 → 0.235.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.
Files changed (2) hide show
  1. package/dist/index.js +91 -1
  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",
@@ -2383,6 +2397,9 @@ var ErdoClient = class {
2383
2397
  const query = params.toString();
2384
2398
  return this.request("GET", `/v1/heartbeats${query ? `?${query}` : ""}`);
2385
2399
  }
2400
+ getHeartbeat(id) {
2401
+ return this.request("GET", `/v1/heartbeats/${encodeURIComponent(id)}`);
2402
+ }
2386
2403
  createHeartbeat(body) {
2387
2404
  return this.request("POST", "/v1/heartbeats", body);
2388
2405
  }
@@ -5141,6 +5158,9 @@ var agentCmd = program.command("agent").description("Run agents");
5141
5158
  agentCmd.command("ask <question>").description("Ask the data-question agent (one-shot); question accepts @path to a UTF-8 file").option("-d, --datasets <csv>", "dataset slugs to scope to").option("--allow-writes", "let this question create datasets, write declarations, schedule syncs, and persist other changes. A question is read-only without it").option(
5142
5159
  "--sync",
5143
5160
  "hold one long HTTP request open until the run finishes, instead of polling. Faster for quick questions; a proxy will time it out on any run over ~100s, losing the thread id while the run continues server-side"
5161
+ ).option(
5162
+ "--timezone <iana>",
5163
+ "the timezone the agent should assume for dates and schedules, e.g. Europe/London; defaults to this machine's, as the app sends the browser's"
5144
5164
  ).action(async (question, opts) => {
5145
5165
  try {
5146
5166
  const client = new ErdoClient();
@@ -5148,6 +5168,7 @@ agentCmd.command("ask <question>").description("Ask the data-question agent (one
5148
5168
  question: readMaybeFile(question) ?? "",
5149
5169
  dataset_slugs: opts.datasets ? opts.datasets.split(",").map((s) => s.trim()) : void 0,
5150
5170
  allow_writes: opts.allowWrites ? true : void 0,
5171
+ timezone: opts.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone,
5151
5172
  async: !opts.sync
5152
5173
  });
5153
5174
  if (opts.sync) {
@@ -5178,7 +5199,10 @@ agentCmd.command("send <threadId> <message>").description("Send a message to a t
5178
5199
  ).option(
5179
5200
  "--sync",
5180
5201
  "hold one long HTTP request open until the run finishes, instead of polling. Faster for quick questions; a proxy will time it out on any run over ~100s while the run continues server-side"
5181
- ).option("--read-only", "restrict the default data-question-answerer turn to read-only tools").action(async (threadId, message, opts) => {
5202
+ ).option("--read-only", "restrict the default data-question-answerer turn to read-only tools").option(
5203
+ "--timezone <iana>",
5204
+ "the timezone the agent should assume for dates and schedules, e.g. Europe/London; defaults to this machine's, as the app sends the browser's"
5205
+ ).action(async (threadId, message, opts) => {
5182
5206
  try {
5183
5207
  const client = new ErdoClient();
5184
5208
  const baselineRunID = opts.sync ? void 0 : await client.latestRunID(threadId);
@@ -5187,6 +5211,7 @@ agentCmd.command("send <threadId> <message>").description("Send a message to a t
5187
5211
  context: readMaybeFile(opts.context),
5188
5212
  agent_key: opts.agent,
5189
5213
  model: opts.model,
5214
+ timezone: opts.timezone || Intl.DateTimeFormat().resolvedOptions().timeZone,
5190
5215
  async: !opts.sync,
5191
5216
  read_only: opts.readOnly
5192
5217
  });
@@ -8386,6 +8411,51 @@ voiceAgentsCmd.command("whatsapp-replies <slug>").description("Turn a voice agen
8386
8411
  fail(e);
8387
8412
  }
8388
8413
  });
8414
+ var voiceAgentInstructionsCmd = voiceAgentsCmd.command("instructions").description("Read or replace a concierge's instructions: the text that tells it how to behave");
8415
+ 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) => {
8416
+ try {
8417
+ const res = await new ErdoClient().getVoiceAgentInstructions(slug);
8418
+ if (opts.json) {
8419
+ print(res);
8420
+ return;
8421
+ }
8422
+ process.stdout.write(res.instructions.endsWith("\n") ? res.instructions : `${res.instructions}
8423
+ `);
8424
+ process.stderr.write(describeLiveAgent(res));
8425
+ } catch (e) {
8426
+ fail(e);
8427
+ }
8428
+ });
8429
+ voiceAgentInstructionsCmd.command("set <slug>").description(
8430
+ "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."
8431
+ ).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) => {
8432
+ try {
8433
+ const instructions = readFileSync5(opts.file, "utf8");
8434
+ if (!instructions.trim()) {
8435
+ throw new Error(`${opts.file} is empty \u2014 instructions cannot be blank`);
8436
+ }
8437
+ const res = await new ErdoClient().setVoiceAgentInstructions(slug, instructions);
8438
+ if (opts.json) {
8439
+ print(res);
8440
+ return;
8441
+ }
8442
+ console.log(`Saved instructions for ${res.slug} (${res.name}), ${res.instructions.length} characters.`);
8443
+ process.stderr.write(describeLiveAgent(res));
8444
+ } catch (e) {
8445
+ fail(e);
8446
+ }
8447
+ });
8448
+ function describeLiveAgent(res) {
8449
+ if (res.push_pending_since) {
8450
+ return `the last push to the live agent failed (pending since ${res.push_pending_since}); it is retried automatically
8451
+ `;
8452
+ }
8453
+ if (!res.live_agent_synced) {
8454
+ return `the live agent picks this up within seconds \u2014 check with: erdo voice agents instructions get ${res.slug}
8455
+ `;
8456
+ }
8457
+ return "the live agent carries these instructions\n";
8458
+ }
8389
8459
  function parseVoiceRealtimeModel(value) {
8390
8460
  if (value === "off" || value === "mini" || value === "max") return value;
8391
8461
  throw new Error("realtime model must be one of: off, mini, max");
@@ -11341,6 +11411,26 @@ autoCmd.command("list").description("List automations").option("--include-refres
11341
11411
  fail(e);
11342
11412
  }
11343
11413
  });
11414
+ autoCmd.command("show <id>").description("Show one automation's state, schedule, next run, and latest execution").option("--json", "print the raw JSON result").action(async (id, opts) => {
11415
+ try {
11416
+ const h = await new ErdoClient().getHeartbeat(id);
11417
+ if (opts.json) {
11418
+ print(h);
11419
+ return;
11420
+ }
11421
+ console.log(`id: ${h.id}`);
11422
+ console.log(`name: ${h.name}`);
11423
+ console.log(`state: ${h.state}`);
11424
+ const cron = h.schedule_triggers?.[0];
11425
+ const schedule = h.run_at ? `once at ${h.run_at}` : cron ? `cron ${cron.cron_expression} (${cron.timezone})` : h.interval_minutes ? `interval ${h.interval_minutes} minutes${h.timezone ? ` (${h.timezone})` : ""}` : "none";
11426
+ console.log(`schedule: ${schedule}`);
11427
+ console.log(`next run: ${h.next_run_at ?? cron?.next_run_at ?? "none"}`);
11428
+ const latest = h.latest_execution;
11429
+ console.log(`latest run: ${latest ? `${latest.status} at ${latest.started_at}${latest.error_message ? `; error: ${latest.error_message}` : ""}` : "none"}`);
11430
+ } catch (e) {
11431
+ fail(e);
11432
+ }
11433
+ });
11344
11434
  autoCmd.command("executions <id>").description("Read recent execution history for one automation or refresh job").option("--limit <n>", "Number of executions (integer 1\u2013100)", "10").action(async (id, opts) => {
11345
11435
  try {
11346
11436
  const limit = Number(opts.limit);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.233.0",
3
+ "version": "0.235.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {