@erdoai/cli 0.23.0 → 0.24.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 +22 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -490,9 +490,11 @@ var ErdoClient = class {
490
490
  "/v1/datasets"
491
491
  );
492
492
  }
493
- queryDataset(slug, query, timezone) {
493
+ // The endpoint's field is `question` (QueryDataNaturalLanguageInput). Sending
494
+ // `query` made every `erdo datasets query` fail with "question is required".
495
+ queryDataset(slug, question, timezone) {
494
496
  return this.request("POST", `/v1/datasets/${encodeURIComponent(slug)}/query-nl`, {
495
- query,
497
+ question,
496
498
  timezone
497
499
  });
498
500
  }
@@ -920,13 +922,13 @@ function awaitingApprovalMessage(threadID) {
920
922
  "the run paused for approval.",
921
923
  " erdo approvals list --status pending",
922
924
  " erdo approvals decide <id> --approve",
923
- ` erdo agent messages ${threadID}`
925
+ ` erdo agent wait ${threadID}`
924
926
  ].join("\n");
925
927
  }
926
928
  function timedOutMessage(threadID) {
927
929
  return [
928
930
  "timed out waiting for the run to finish \u2014 it is still running on its thread.",
929
- ` erdo agent messages ${threadID}`,
931
+ ` erdo agent wait ${threadID}`,
930
932
  ` erdo runs list --thread ${threadID}`
931
933
  ].join("\n");
932
934
  }
@@ -1829,6 +1831,22 @@ agentCmd.command("send <threadId> <message>").description("Send a message to a t
1829
1831
  fail(e);
1830
1832
  }
1831
1833
  });
1834
+ agentCmd.command("wait <threadId>").description("Re-attach to a thread's latest run and wait for it to finish; prints the answer").action(async (threadId) => {
1835
+ try {
1836
+ const client = new ErdoClient();
1837
+ process.stderr.write("waiting\u2026");
1838
+ const run = await client.waitForThreadRun(threadId, {
1839
+ onTick: () => process.stderr.write(".")
1840
+ });
1841
+ process.stderr.write("\n");
1842
+ if (!run) throw new Error(timedOutMessage(threadId));
1843
+ if (run.status === "awaiting_approval") throw new Error(awaitingApprovalMessage(threadId));
1844
+ if (run.error) throw new Error(run.error);
1845
+ console.log(run.output || `(status: ${run.status})`);
1846
+ } catch (e) {
1847
+ fail(e);
1848
+ }
1849
+ });
1832
1850
  agentCmd.command("thread").description("Create a thread; prints its id").option("-n, --name <name>", "thread name").option("-d, --datasets <csv>", "dataset UUIDs to attach").action(async (opts) => {
1833
1851
  try {
1834
1852
  const res = await new ErdoClient().createThread({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.23.0",
4
- "description": "Erdo CLI drive datasets, pages, and evals from the terminal or CI",
3
+ "version": "0.24.0",
4
+ "description": "Erdo CLI \u2014 drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "erdo": "dist/index.js"