@erdoai/cli 0.112.0 → 0.115.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 +36 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ function describeRefreshWrites(strategy, mode, key, liveMode) {
32
32
  import { readFileSync as readFileSync4 } from "fs";
33
33
  import { basename } from "path";
34
34
  import { password, select } from "@inquirer/prompts";
35
- import { Command as Command2 } from "commander";
35
+ import { Command as Command2, Option as Option2 } from "commander";
36
36
 
37
37
  // src/config.ts
38
38
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -1165,6 +1165,9 @@ var ErdoClient = class {
1165
1165
  // separate program a human chose to run), which leaves the other carriers
1166
1166
  // alone.
1167
1167
  setDatasetPurpose(slug, input) {
1168
+ return this.updateDatasetSchema(slug, input);
1169
+ }
1170
+ updateDatasetSchema(slug, input) {
1168
1171
  return this.request("POST", `/v1/datasets/${encodeURIComponent(slug)}/schema`, input);
1169
1172
  }
1170
1173
  // The endpoint's field is `question` (QueryDataNaturalLanguageInput). Sending // The endpoint's field is `question` (QueryDataNaturalLanguageInput). Sending
@@ -6579,6 +6582,19 @@ datasetsCmd.command("ensure <purpose>").description(
6579
6582
  fail(e);
6580
6583
  }
6581
6584
  });
6585
+ 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) => {
6586
+ try {
6587
+ const input = JSON.parse(readFileSync4(opts.input, "utf8"));
6588
+ if (!input || typeof input !== "object" || Array.isArray(input)) {
6589
+ throw new Error("--input must contain a JSON object");
6590
+ }
6591
+ const result = await new ErdoClient().updateDatasetSchema(slug, input);
6592
+ console.log(JSON.stringify(result, null, 2));
6593
+ for (const warning of result.warnings ?? []) console.error(`warning: ${warning}`);
6594
+ } catch (e) {
6595
+ fail(e);
6596
+ }
6597
+ });
6582
6598
  datasetsCmd.command("set-purpose <slug> [purpose]").description(
6583
6599
  "Set (or with --clear, remove) the dataset's purpose \u2014 the org-vocabulary role `datasets purposes` reports. Use it to CORRECT a purpose that names the wrong dataset: one purpose maps to one dataset per org, so a purpose left on the wrong one points everything that resolves through the vocabulary at the wrong rows. Setting a purpose another dataset carries is an atomic MOVE: the old carrier is cleared in the same transaction, so one call on the right dataset lands it (the response says which dataset it moved from). Use --sibling only when deliberately running a parallel table for the same purpose."
6584
6600
  ).option("--clear", "remove the dataset's purpose instead of setting one").option(
@@ -7413,7 +7429,7 @@ unavailable: ${source} \u2014 ${reason}`);
7413
7429
  fail(e);
7414
7430
  }
7415
7431
  });
7416
- var leadNextActionsCmd = leadsCmd.command("next-actions").description("Read the suggested next action for each lead, hold or close a lead, and dry-run the playbook on one lead");
7432
+ var leadNextActionsCmd = leadsCmd.command("next-actions").description("Read the suggested next action for each lead, hold, close or start a lead, and dry-run the playbook on one lead");
7417
7433
  leadNextActionsCmd.command("list").description(
7418
7434
  "List each lead's current suggestion, highest priority first. --status pending_approval lists the cards waiting for a person."
7419
7435
  ).option("--dataset <slug>", "narrow to one lead dataset").option(
@@ -7526,6 +7542,22 @@ leadNextActionsCmd.command("close <dataset> <lead>").description(
7526
7542
  fail(e);
7527
7543
  }
7528
7544
  });
7545
+ leadNextActionsCmd.command("start <dataset> <lead>").description(
7546
+ "Have the follow-up engine work this lead now. By itself the engine only reaches leads captured after it was switched on, and never test traffic; this brings one of those in, and Erdo decides for it straight away. With --reset, start the lead over: anything open is withdrawn and Erdo reads the lead afresh from now, as if it had just been captured. Nothing is deleted, and opt-outs still apply. Refused when the engine is switched off, or (without --reset) when it already has the lead."
7547
+ ).option("--reset", "start the lead over: Erdo reads nothing from before now").option("--note <text>", "why, in the desk's words").option("--json", "print the raw JSON result instead of a summary").action(async (dataset, lead, opts) => {
7548
+ try {
7549
+ const res = await new ErdoClient().recordLeadNextAction(dataset, lead, { kind: "start", reset: opts.reset, note: opts.note });
7550
+ if (opts.json) {
7551
+ print(res);
7552
+ return;
7553
+ }
7554
+ console.log(
7555
+ opts.reset ? `Started lead ${res.lead_reference} over. Erdo is deciding its first step now.` : `Started follow-up on lead ${res.lead_reference}. Erdo is deciding its next step now.`
7556
+ );
7557
+ } catch (e) {
7558
+ fail(e);
7559
+ }
7560
+ });
7529
7561
  leadNextActionsCmd.command("resume <dataset> <lead>").description(
7530
7562
  "End the lead's hold or close now, so Erdo works the lead again. Nothing is sent from here: Erdo decides for the lead on its next pass, within about fifteen minutes. Refused when the lead is not held or closed."
7531
7563
  ).option("--json", "print the raw JSON result instead of a summary").action(async (dataset, lead, opts) => {
@@ -8141,7 +8173,7 @@ autoCmd.command("run <id>").description("Trigger an automation now").action(asyn
8141
8173
  fail(e);
8142
8174
  }
8143
8175
  });
8144
- autoCmd.command("update <id>").description("Edit an automation \u2014 rename, reschedule, or replace its script/instructions").option("--name <name>", "New name").option("--description <text>", "New description").option("--instructions <text>", "Replacement instructions (agent automation)").option("--script-js <js>", "Replacement script body (scripted automation)").option(
8176
+ autoCmd.command("update <id>").description("Edit an automation \u2014 rename, reschedule, or replace its script/instructions").option("--name <name>", "New name").option("--description <text>", "New description").option("--instructions <text>", "Replacement instructions (agent automation)").addOption(new Option2("--agent-key <key>", "Executor for an agent automation; omit to keep current").choices(["erdo.heartbeat-executor", "erdo.workflow-executor"])).option("--script-js <js>", "Replacement script body (scripted automation)").option(
8145
8177
  "--script-file <path>",
8146
8178
  "Read the replacement script body from a file (scripted automation)"
8147
8179
  ).option("--interval <minutes>", "New interval in minutes (minimum 5)", (v) => parseInt(v, 10)).option("--timezone <tz>", "New scheduling timezone, e.g. America/New_York").action(
@@ -8156,6 +8188,7 @@ autoCmd.command("update <id>").description("Edit an automation \u2014 rename, re
8156
8188
  name: opts.name,
8157
8189
  description: opts.description,
8158
8190
  instructions: opts.instructions,
8191
+ agent_key: opts.agentKey,
8159
8192
  script_js: scriptJs,
8160
8193
  interval_minutes: opts.interval,
8161
8194
  timezone: opts.timezone
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.112.0",
3
+ "version": "0.115.0",
4
4
  "description": "Erdo CLI — drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {