@erdoai/cli 0.184.0 → 0.184.1

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 +38 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -428,6 +428,12 @@ var ErdoClient = class {
428
428
  creditBalance() {
429
429
  return this.request("GET", "/v1/credits/balance");
430
430
  }
431
+ getManagerCreditFunding() {
432
+ return this.request("GET", "/v1/credits/manager-funding");
433
+ }
434
+ setManagerCreditFunding(enabled) {
435
+ return this.request("PATCH", "/v1/credits/manager-funding", { enabled });
436
+ }
431
437
  listMCPToolsets() {
432
438
  return this.request("GET", "/v1/mcp/toolsets");
433
439
  }
@@ -2914,6 +2920,20 @@ credits.command("balance").description("Read the current organization's credit b
2914
2920
  fail(error);
2915
2921
  }
2916
2922
  });
2923
+ credits.command("manager-funding").description("Read or change manager execution-credit funding for the current organization").option("--enabled <true|false>", "Set whether this organization funds managed organizations").action(async (options) => {
2924
+ try {
2925
+ if (options.enabled === void 0) {
2926
+ print(await new ErdoClient().getManagerCreditFunding());
2927
+ return;
2928
+ }
2929
+ if (options.enabled !== "true" && options.enabled !== "false") {
2930
+ throw new Error("--enabled must be exactly true or false");
2931
+ }
2932
+ print(await new ErdoClient().setManagerCreditFunding(options.enabled === "true"));
2933
+ } catch (error) {
2934
+ fail(error);
2935
+ }
2936
+ });
2917
2937
  var admin = program.command("admin").description("Erdo staff administration");
2918
2938
  admin.command("credits").description("Staff-only manual credit grants").command("grant <orgSlugOrId>").description("Grant non-expiring credits without payment; requires an authenticated staff user").requiredOption("--amount <integer>", "Positive integer credits to grant").requiredOption("--reason <text>", "Audit reason").action(async (organization, options) => {
2919
2939
  try {
@@ -8017,6 +8037,21 @@ providerLeadSourcesCmd.command("set").description(
8017
8037
  fail(e);
8018
8038
  }
8019
8039
  });
8040
+ var leadSourcePreviewSample = 5;
8041
+ function newestLeadSample(batches) {
8042
+ const ts = (lead) => typeof lead.ts === "string" ? lead.ts : "";
8043
+ const seen = /* @__PURE__ */ new Set();
8044
+ const kept = batches.map(
8045
+ (sample) => sample.filter((lead) => {
8046
+ const id = typeof lead.provider_lead_id === "string" ? lead.provider_lead_id : "";
8047
+ if (id === "") return true;
8048
+ if (seen.has(id)) return false;
8049
+ seen.add(id);
8050
+ return true;
8051
+ })
8052
+ );
8053
+ return kept.reverse().flat().sort((a, b) => ts(a) < ts(b) ? 1 : ts(a) > ts(b) ? -1 : 0).slice(0, leadSourcePreviewSample);
8054
+ }
8020
8055
  providerLeadSourcesCmd.command("import <name> <file>").description(
8021
8056
  "Import a CSV file into an import lead source. Every row is written as history: never alerted on, billed or followed up until started. Without --commit this is a dry run that previews the file and writes nothing."
8022
8057
  ).option("--commit", "write the rows (without it, only a preview)").option("--default-submitted-at <date>", "when these people got in touch, for rows the file does not date (YYYY-MM-DD or RFC 3339)").option("--start-follow-up", "after writing, start follow-up on each lead the import created (with --commit)").action(async (name, file, opts) => {
@@ -8032,6 +8067,7 @@ providerLeadSourcesCmd.command("import <name> <file>").description(
8032
8067
  const skipped = {};
8033
8068
  const created = /* @__PURE__ */ new Set();
8034
8069
  let preview;
8070
+ const samples = [];
8035
8071
  for (let start = 0; start < rows.length || start === 0; start += batch) {
8036
8072
  const result = await client.importLeadSourceRows({
8037
8073
  name,
@@ -8042,6 +8078,7 @@ providerLeadSourcesCmd.command("import <name> <file>").description(
8042
8078
  });
8043
8079
  if (result.preview) {
8044
8080
  preview ??= result.preview;
8081
+ samples.push(result.preview.sample);
8045
8082
  totals.history += result.preview.history;
8046
8083
  totals.already_written += result.preview.already_written;
8047
8084
  totals.test += result.preview.test;
@@ -8058,7 +8095,7 @@ providerLeadSourcesCmd.command("import <name> <file>").description(
8058
8095
  if (rows.length === 0) break;
8059
8096
  }
8060
8097
  if (!opts.commit) {
8061
- print({ dry_run: true, rows: totals.rows, history: totals.history, already_written: totals.already_written, test: totals.test, skipped, not_read: preview?.not_read ?? [], missing_fields: preview?.missing_fields ?? [], sample: preview?.sample ?? [] });
8098
+ print({ dry_run: true, rows: totals.rows, history: totals.history, already_written: totals.already_written, test: totals.test, skipped, not_read: preview?.not_read ?? [], missing_fields: preview?.missing_fields ?? [], sample: newestLeadSample(samples) });
8062
8099
  process.stderr.write(`Dry run: nothing written. ${totals.history} rows would be written as history. Run again with --commit to write them.
8063
8100
  `);
8064
8101
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.184.0",
3
+ "version": "0.184.1",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {