@erdoai/cli 0.179.0 → 0.182.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 +155 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -365,6 +365,27 @@ var ErdoClient = class {
365
365
  input
366
366
  );
367
367
  }
368
+ setPaidMediaCampaignBidding(campaignId, input) {
369
+ return this.request(
370
+ "POST",
371
+ `/v1/paid-media/campaigns/${encodeURIComponent(campaignId)}/bidding`,
372
+ input
373
+ );
374
+ }
375
+ setPaidMediaCampaignNetworkSettings(campaignId, input) {
376
+ return this.request(
377
+ "POST",
378
+ `/v1/paid-media/campaigns/${encodeURIComponent(campaignId)}/network-settings`,
379
+ input
380
+ );
381
+ }
382
+ setPaidMediaNegativeKeywords(campaignId, input) {
383
+ return this.request(
384
+ "POST",
385
+ `/v1/paid-media/campaigns/${encodeURIComponent(campaignId)}/negative-keywords`,
386
+ input
387
+ );
388
+ }
368
389
  setPaidMediaCampaignConversionGoals(campaignId, input) {
369
390
  return this.request(
370
391
  "POST",
@@ -407,6 +428,15 @@ var ErdoClient = class {
407
428
  creditBalance() {
408
429
  return this.request("GET", "/v1/credits/balance");
409
430
  }
431
+ listMCPToolsets() {
432
+ return this.request("GET", "/v1/mcp/toolsets");
433
+ }
434
+ searchMCPTools(query, toolset, limit) {
435
+ const params = new URLSearchParams({ query });
436
+ if (toolset) params.set("toolset", toolset);
437
+ if (limit !== void 0) params.set("limit", String(limit));
438
+ return this.request("GET", `/v1/mcp/tools?${params.toString()}`);
439
+ }
410
440
  async grantCredits(organization, amount, reason) {
411
441
  try {
412
442
  const result = await this.request(
@@ -794,6 +824,11 @@ var ErdoClient = class {
794
824
  listVoicePhoneNumbers() {
795
825
  return this.request("GET", "/v1/voice/phone-numbers");
796
826
  }
827
+ // Where email, WhatsApp, SMS and voice each stand. Read from the database the
828
+ // registration crons maintain; nothing here reaches a provider.
829
+ getChannelStatus() {
830
+ return this.request("GET", "/v1/channels/status");
831
+ }
797
832
  getVoicePhoneNumberSMS(number) {
798
833
  return this.request(
799
834
  "GET",
@@ -2839,6 +2874,30 @@ function compactEvalRunAttribution(run) {
2839
2874
  var program = new Command2();
2840
2875
  program.name("erdo").description("Erdo CLI").version(pkg.version);
2841
2876
  bindScopeFlags(program);
2877
+ var mcpCatalog = program.command("mcp").description("Inspect the MCP tool catalog AI clients load");
2878
+ mcpCatalog.command("toolsets").description("List MCP toolsets and how many tools each one contains").action(async () => {
2879
+ try {
2880
+ print(await new ErdoClient().listMCPToolsets());
2881
+ } catch (error) {
2882
+ fail(error);
2883
+ }
2884
+ });
2885
+ mcpCatalog.command("tools").description("Search registered MCP tools").command("search <query...>").description("Find MCP tools by words in the name or description").option("--toolset <id>", "Limit the search to one toolset").option("--limit <n>", "Maximum matches, from 1 to 20").action(async (query, options) => {
2886
+ try {
2887
+ const text = query.join(" ").trim();
2888
+ if (!text) throw new Error("query is required");
2889
+ let limit;
2890
+ if (options.limit !== void 0) {
2891
+ if (!/^[0-9]+$/.test(options.limit) || Number(options.limit) < 1 || Number(options.limit) > 20) {
2892
+ throw new Error("--limit must be an integer from 1 to 20");
2893
+ }
2894
+ limit = Number(options.limit);
2895
+ }
2896
+ print(await new ErdoClient().searchMCPTools(text, options.toolset, limit));
2897
+ } catch (error) {
2898
+ fail(error);
2899
+ }
2900
+ });
2842
2901
  var credits = program.command("credits").description("Read organization credits");
2843
2902
  credits.command("balance").description("Read the current organization's credit balance (use --org to select)").action(async () => {
2844
2903
  try {
@@ -3036,6 +3095,66 @@ paidMediaCampaigns.command("list").description("List the organization's owned Go
3036
3095
  fail(e);
3037
3096
  }
3038
3097
  });
3098
+ function parsePaidMediaBool(value, name) {
3099
+ if (value === "true") return true;
3100
+ if (value === "false") return false;
3101
+ throw new Error(`${name} must be true or false`);
3102
+ }
3103
+ function parsePaidMediaKeyword(value) {
3104
+ const split = value.lastIndexOf(":");
3105
+ const text = split > 0 ? value.slice(0, split).trim() : "";
3106
+ const match = (split > 0 ? value.slice(split + 1) : "").trim().toUpperCase();
3107
+ if (!text || match !== "EXACT" && match !== "PHRASE" && match !== "BROAD") {
3108
+ throw new Error(`keyword ${JSON.stringify(value)} must be text:EXACT, text:PHRASE, or text:BROAD`);
3109
+ }
3110
+ return { text, match_type: match };
3111
+ }
3112
+ paidMediaCampaigns.command("bidding <campaignId>").description("Set a campaign's bidding strategy, including clearing a target CPA (approval-gated)").requiredOption("--customer-id <id>", "Google Ads customer ID").requiredOption("--strategy <strategy>", "MAXIMIZE_CONVERSIONS, TARGET_CPA, MAXIMIZE_CONVERSION_VALUE, TARGET_ROAS, or MAXIMIZE_CLICKS").option("--target-cpa-micros <micros>", "target CPA in micros").option("--clear-target-cpa", "clear Maximize Conversions target CPA").option("--target-roas <roas>", "target ROAS").option("--cpc-bid-ceiling-micros <micros>", "CPC ceiling in micros for MAXIMIZE_CLICKS").option("--confirm-detach-portfolio", "detach a portfolio bidding strategy").option("--reason <text>", "reason shown on the approval card").action(async (campaignId, opts) => {
3113
+ try {
3114
+ print(await new ErdoClient().setPaidMediaCampaignBidding(campaignId, {
3115
+ provider: "google_ads",
3116
+ customer_id: opts.customerId,
3117
+ bidding_strategy_type: opts.strategy,
3118
+ target_cpa_micros: opts.targetCpaMicros === void 0 ? void 0 : Number(opts.targetCpaMicros),
3119
+ clear_target_cpa: opts.clearTargetCpa || void 0,
3120
+ target_roas: opts.targetRoas === void 0 ? void 0 : Number(opts.targetRoas),
3121
+ cpc_bid_ceiling_micros: opts.cpcBidCeilingMicros === void 0 ? void 0 : Number(opts.cpcBidCeilingMicros),
3122
+ confirm_detach_portfolio: opts.confirmDetachPortfolio || void 0,
3123
+ reason: opts.reason
3124
+ }));
3125
+ } catch (e) {
3126
+ fail(e);
3127
+ }
3128
+ });
3129
+ paidMediaCampaigns.command("network-settings <campaignId>").description("Set Search Partners and Display on a Search campaign (approval-gated)").requiredOption("--customer-id <id>", "Google Ads customer ID").option("--search-partners <true|false>", "target_search_network, Search Partners").option("--display <true|false>", "target_content_network, Display").option("--confirm-network-expansion", "required to enable Search Partners or Display").option("--reason <text>", "reason shown on the approval card").action(async (campaignId, opts) => {
3130
+ try {
3131
+ if (opts.searchPartners === void 0 && opts.display === void 0) throw new Error("set --search-partners or --display");
3132
+ print(await new ErdoClient().setPaidMediaCampaignNetworkSettings(campaignId, {
3133
+ provider: "google_ads",
3134
+ customer_id: opts.customerId,
3135
+ target_search_network: opts.searchPartners === void 0 ? void 0 : parsePaidMediaBool(opts.searchPartners, "--search-partners"),
3136
+ target_content_network: opts.display === void 0 ? void 0 : parsePaidMediaBool(opts.display, "--display"),
3137
+ confirm_network_expansion: opts.confirmNetworkExpansion || void 0,
3138
+ reason: opts.reason
3139
+ }));
3140
+ } catch (e) {
3141
+ fail(e);
3142
+ }
3143
+ });
3144
+ paidMediaCampaigns.command("negative-keywords <campaignId>").description("Add or remove campaign or ad-group negative keywords (approval-gated)").requiredOption("--customer-id <id>", "Google Ads customer ID").option("--adgroup-id <id>", "edit this ad group's negatives").option("--add <text:MATCH>", "keyword to add, repeatable", (value, previous) => previous.concat(value), []).option("--remove <text:MATCH>", "keyword to remove, repeatable", (value, previous) => previous.concat(value), []).option("--reason <text>", "reason shown on the approval card").action(async (campaignId, opts) => {
3145
+ try {
3146
+ print(await new ErdoClient().setPaidMediaNegativeKeywords(campaignId, {
3147
+ provider: "google_ads",
3148
+ customer_id: opts.customerId,
3149
+ adgroup_id: opts.adgroupId,
3150
+ add: opts.add.map(parsePaidMediaKeyword),
3151
+ remove: opts.remove.map(parsePaidMediaKeyword),
3152
+ reason: opts.reason
3153
+ }));
3154
+ } catch (e) {
3155
+ fail(e);
3156
+ }
3157
+ });
3039
3158
  paidMediaCampaigns.command("conversion-goals <campaignId>").description("Set a campaign's custom conversion goal to exactly these conversion action ids").requiredOption("--actions <ids>", "comma-separated conversion action ids").option("--customer-id <id>", "Google Ads customer id (defaults to the selected account)").option("--json", "print the raw JSON result").action(async (campaignId, opts) => {
3040
3159
  try {
3041
3160
  const ids = opts.actions.split(",").map((id) => id.trim()).filter(Boolean);
@@ -3052,6 +3171,10 @@ paidMediaCampaigns.command("conversion-goals <campaignId>").description("Set a c
3052
3171
  if (result.status === "ready") {
3053
3172
  console.log("status: ready");
3054
3173
  if (result.goal_config_level) console.log(`goal config level: ${result.goal_config_level}`);
3174
+ } else if (result.status === "in_progress") {
3175
+ console.log("status: in progress (already approved; no decision pending)");
3176
+ console.log(`execution phase: ${result.execution_phase}`);
3177
+ console.log(`approval request id: ${result.approval_request_id}`);
3055
3178
  } else {
3056
3179
  console.log("status: pending approval");
3057
3180
  console.log(`approval request id: ${result.approval_request_id}`);
@@ -3081,6 +3204,10 @@ paidMedia.command("conversion-actions").command("ensure").description("Find or a
3081
3204
  if (result.status === "ready") {
3082
3205
  console.log(`status: ready`);
3083
3206
  if (result.conversion_action_id) console.log(`conversion action id: ${result.conversion_action_id}`);
3207
+ } else if (result.status === "in_progress") {
3208
+ console.log("status: in progress (already approved; no decision pending)");
3209
+ console.log(`execution phase: ${result.execution_phase}`);
3210
+ console.log(`approval request id: ${result.approval_request_id}`);
3084
3211
  } else {
3085
3212
  console.log(`status: pending approval`);
3086
3213
  console.log(`approval request id: ${result.approval_request_id}`);
@@ -7239,6 +7366,34 @@ function printProfileDriftNote(numbers) {
7239
7366
  "Re-send it with: erdo voice numbers provision-sms <number>. It re-opens carrier review, which takes days."
7240
7367
  );
7241
7368
  }
7369
+ var channelsCmd = program.command("channels").description("Where the organization's email, WhatsApp, SMS and voice channels stand");
7370
+ channelsCmd.command("status").description("Show each channel's state (active, registering, needs_dns, rejected, ...) and what it is waiting on").option("--json", "print the raw JSON result instead of a table").action(async (opts) => {
7371
+ try {
7372
+ const res = await new ErdoClient().getChannelStatus();
7373
+ if (opts.json) {
7374
+ print(res);
7375
+ return;
7376
+ }
7377
+ const rows = [];
7378
+ for (const [name, ch] of [
7379
+ ["email", res.email],
7380
+ ["whatsapp", res.whatsapp],
7381
+ ["sms", res.sms],
7382
+ ["voice", res.voice]
7383
+ ]) {
7384
+ rows.push([name, ch.state, ch.remediation?.action ?? "", ch.reason ?? ""]);
7385
+ for (const item of ch.items ?? []) {
7386
+ rows.push([` ${item.kind}${item.address ? ` ${item.address}` : ""}`, item.state, item.remediation?.action ?? "", item.reason ?? ""]);
7387
+ }
7388
+ }
7389
+ printAlignedTable(["channel", "state", "next action", "reason"], rows);
7390
+ if (!res.business_profile_complete) {
7391
+ console.log(`Business profile is incomplete: ${(res.missing_profile_fields ?? []).join(", ")}`);
7392
+ }
7393
+ } catch (e) {
7394
+ fail(e);
7395
+ }
7396
+ });
7242
7397
  voiceNumbersCmd.command("list").description("List the organization's numbers with what each one's SMS registration is waiting on").option("--json", "print the raw JSON result instead of a table").action(async (opts) => {
7243
7398
  try {
7244
7399
  const res = await new ErdoClient().listVoicePhoneNumbers();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.179.0",
3
+ "version": "0.182.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {