@erdoai/cli 0.244.1 → 0.247.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 +32 -14
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -125,7 +125,7 @@ function describeFreshnessTarget(state) {
125
125
  }
126
126
 
127
127
  // src/index.ts
128
- import { readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "fs";
128
+ import { readFileSync as readFileSync5, statSync as statSync2, writeFileSync as writeFileSync3 } from "fs";
129
129
 
130
130
  // src/script-edits.ts
131
131
  function parseScriptEdits(text) {
@@ -1510,6 +1510,7 @@ var ErdoClient = class {
1510
1510
  const q = new URLSearchParams();
1511
1511
  if (params?.status !== void 0) q.set("status", params.status);
1512
1512
  if (params?.type) q.set("type", params.type);
1513
+ if (params?.filter) q.set("filter", params.filter);
1513
1514
  if (params?.limit) q.set("limit", String(params.limit));
1514
1515
  if (params?.offset) q.set("offset", String(params.offset));
1515
1516
  const qs = q.toString();
@@ -6731,15 +6732,16 @@ webhooksCmd.command("retry <id> <delivery-id>").description("Retry a failed webh
6731
6732
  }
6732
6733
  });
6733
6734
  var reviewsCmd = program.command("reviews").description(
6734
- "The Knowledge Review queue \u2014 knowledge patches the critic proposes, investigations, and deduplicated failure signals awaiting a human decision"
6735
+ "Changes Erdo applied or that need you, plus investigations and failure signals"
6735
6736
  );
6736
- reviewsCmd.command("list").description("List review items (decision items rank above failure signals)").option("--status <status>", "open (default) | snoozed | resolved | rejected | '' for all").option("--type <type>", "filter by type, e.g. knowledge_patch, eval_failure, failed_run").option("-n, --limit <n>", "max items", (v) => parseInt(v, 10)).option("--offset <n>", "pagination offset", (v) => parseInt(v, 10)).action(
6737
+ reviewsCmd.command("list").description("List Changes that need you or were applied by Erdo").option("--status <status>", "open (default) | snoozed | applied | undone | resolved | rejected").option("--type <type>", "filter by type, e.g. knowledge_patch, eval_failure, failed_run").option("--filter <view>", "needs_you (open items) | changed_by_erdo (applied or undone Knowledge changes)").option("-n, --limit <n>", "max items", (v) => parseInt(v, 10)).option("--offset <n>", "pagination offset", (v) => parseInt(v, 10)).action(
6737
6738
  async (opts) => {
6738
6739
  try {
6739
6740
  print(
6740
6741
  await new ErdoClient().listReviewItems({
6741
6742
  status: opts.status,
6742
6743
  type: opts.type,
6744
+ filter: opts.filter,
6743
6745
  limit: opts.limit,
6744
6746
  offset: opts.offset
6745
6747
  })
@@ -6749,7 +6751,7 @@ reviewsCmd.command("list").description("List review items (decision items rank a
6749
6751
  }
6750
6752
  }
6751
6753
  );
6752
- reviewsCmd.command("show <id>").description("Show one review item with its full payload (the proposed patch body for a knowledge_patch)").action(async (id) => {
6754
+ reviewsCmd.command("show <id>").description("Show one change with its full payload and Knowledge diff fields when applicable").action(async (id) => {
6753
6755
  try {
6754
6756
  print(await new ErdoClient().getReviewItem(id));
6755
6757
  } catch (e) {
@@ -6757,18 +6759,19 @@ reviewsCmd.command("show <id>").description("Show one review item with its full
6757
6759
  }
6758
6760
  });
6759
6761
  reviewsCmd.command("decide <id>").description(
6760
- "Decide a review item: --apply a knowledge patch (mutates Knowledge, then resolves), --resolve, --reject, or --snooze [minutes]"
6761
- ).option("--apply", "apply a knowledge_patch: create/update the proposed Knowledge object, then resolve").option("--resolve", "close as handled").option("--reject", "close as declined").option("--snooze [minutes]", "hide the item for [minutes] (default 7 days)").option("--note <note>", "resolution note recorded on the item").action(
6762
+ "Act on a change: --apply a held Knowledge patch against the current version, --undo an applied change, --resolve, --reject, or --snooze [minutes]"
6763
+ ).option("--apply", "apply a held knowledge_patch against the current Knowledge version").option("--undo", "restore the previous revision of an applied Knowledge change").option("--resolve", "close as handled").option("--reject", "close as declined").option("--snooze [minutes]", "hide the item for [minutes] (default 7 days)").option("--note <note>", "resolution note recorded on the item").action(
6762
6764
  async (id, opts) => {
6763
6765
  try {
6764
6766
  const chosen = [
6765
6767
  opts.apply ? "apply" : null,
6768
+ opts.undo ? "undo" : null,
6766
6769
  opts.resolve ? "resolve" : null,
6767
6770
  opts.reject ? "reject" : null,
6768
6771
  opts.snooze === void 0 ? null : "snooze"
6769
6772
  ].filter(Boolean);
6770
6773
  if (chosen.length !== 1) {
6771
- fail(new Error("provide exactly one of --apply, --resolve, --reject, or --snooze"));
6774
+ fail(new Error("provide exactly one of --apply, --undo, --resolve, --reject, or --snooze"));
6772
6775
  }
6773
6776
  const action = chosen[0];
6774
6777
  let minutes;
@@ -8556,7 +8559,7 @@ providerLeadSourcesCmd.command("forms").description("List the lead forms a conne
8556
8559
  }
8557
8560
  });
8558
8561
  providerLeadSourcesCmd.command("set").description(
8559
- "Save a lead source from JSON or flags. A LinkedIn or Meta (meta_ads) source names a connection, ad account and forms; a google_sheets, webhook or import source names itself and carries a column mapping (use --file). --dry-run previews what it would write and saves nothing."
8562
+ "Save a lead source from JSON or flags. A LinkedIn or Meta (meta_ads) source names a connection, ad account and forms; a google_sheets, webhook or import source names itself and carries a column mapping (use --file). A meta_ads source may add a budget ({question, currency, options}) in --file so each lead's choice is recorded as their budget. --dry-run previews what it would write and saves nothing."
8560
8563
  ).option("-f, --file <path>", "one JSON declaration object; use - to read from stdin").option("--dataset <slug>", "lead dataset slug").option("--provider <provider>", "linkedin_ads, meta_ads, google_sheets, webhook or import", "linkedin_ads").option("--connection-id <id>", "native integration id from erdo integrations status linkedin_ads_sync (or meta_ads) or GET /v1/integrations").option("--account-id <id>", "numeric ad account id (a Meta id with or without act_)").option("--form <id>", "LinkedIn lead gen form or Meta Instant Form id (repeatable)", collect, []).option("--name <name>", "a google_sheets, webhook or import source's name").option("--sheet-url <url>", "a google_sheets source's tab, as its address in the browser (open to anyone with the link)").option("--dry-run", "preview what the source would write; save nothing").option("--rotate-secret", "issue a webhook source a new secret").option("--disabled", "save the declaration disabled").option("--create-only", "refuse the save if a source with this name already exists").action(async (opts) => {
8561
8564
  try {
8562
8565
  let input;
@@ -11473,22 +11476,37 @@ knowledgeCmd.command("delete <id>").description("Delete a Knowledge object you c
11473
11476
  fail(e);
11474
11477
  }
11475
11478
  });
11476
- knowledgeCmd.command("attach <objectId> <file>").description(
11479
+ knowledgeCmd.command("attach <objectId> [file]").description(
11477
11480
  "Attach an image or other small binary to a knowledge object as an org-hosted asset, and print its asset id \u2014 the value a page's assetId field takes. Pass a local path, or --url to have the service download it (the only path for video)."
11478
- ).option("--url <sourceUrl>", "download from this URL instead of reading a local file").option(
11481
+ ).option("--url <sourceUrl>", "download from this URL instead of reading a local file").addOption(new Option2("--caption <text>", "caption describing the attachment").conflicts("description")).option("--role <prefix>", "filename role prefix, e.g. customer-logo; already prefixed names are preserved").option(
11479
11482
  "-d, --description <text>",
11480
11483
  "caption for the asset; for an image this is the only text search can match, so describe what is in the picture"
11481
11484
  ).option("--media-type <mime>", "MIME type hint, e.g. image/jpeg; detected from the filename otherwise").action(
11482
11485
  async (objectId, file, opts) => {
11483
11486
  try {
11484
- const body = opts.url ? { filename: basename2(file), source_url: opts.url } : {
11485
- filename: basename2(file),
11486
- content_base64: readFileSync5(file).toString("base64")
11487
- };
11487
+ let body;
11488
+ if (opts.url) {
11489
+ const source = new URL(opts.url);
11490
+ if (!["http:", "https:"].includes(source.protocol) || source.username || source.password) {
11491
+ throw new Error("--url must be an HTTP(S) URL without credentials");
11492
+ }
11493
+ const filename = file ? basename2(file) : basename2(decodeURIComponent(source.pathname));
11494
+ if (!filename || filename === "/") throw new Error("provide a filename for this download URL");
11495
+ body = { filename, source_url: opts.url };
11496
+ } else {
11497
+ if (!file) throw new Error("provide a local file or --url URL");
11498
+ if (statSync2(file).size > 20 * 1024 * 1024) throw new Error("file exceeds the 20 MiB limit; use --url for larger files");
11499
+ const content = readFileSync5(file);
11500
+ if (!content.length) throw new Error("attachment file is empty");
11501
+ if (content.length > 20 * 1024 * 1024) throw new Error("file exceeds the 20 MiB limit; use --url for larger files");
11502
+ body = { filename: basename2(file), content_base64: content.toString("base64") };
11503
+ }
11488
11504
  print(
11489
11505
  await new ErdoClient().attachKnowledgeAsset(objectId, {
11490
11506
  ...body,
11491
11507
  description: opts.description,
11508
+ caption: opts.caption,
11509
+ role: opts.role,
11492
11510
  media_type: opts.mediaType
11493
11511
  })
11494
11512
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.244.1",
3
+ "version": "0.247.0",
4
4
  "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {