@erdoai/cli 0.23.1 → 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.
- package/dist/index.js +18 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -922,13 +922,13 @@ function awaitingApprovalMessage(threadID) {
|
|
|
922
922
|
"the run paused for approval.",
|
|
923
923
|
" erdo approvals list --status pending",
|
|
924
924
|
" erdo approvals decide <id> --approve",
|
|
925
|
-
` erdo agent
|
|
925
|
+
` erdo agent wait ${threadID}`
|
|
926
926
|
].join("\n");
|
|
927
927
|
}
|
|
928
928
|
function timedOutMessage(threadID) {
|
|
929
929
|
return [
|
|
930
930
|
"timed out waiting for the run to finish \u2014 it is still running on its thread.",
|
|
931
|
-
` erdo agent
|
|
931
|
+
` erdo agent wait ${threadID}`,
|
|
932
932
|
` erdo runs list --thread ${threadID}`
|
|
933
933
|
].join("\n");
|
|
934
934
|
}
|
|
@@ -1831,6 +1831,22 @@ agentCmd.command("send <threadId> <message>").description("Send a message to a t
|
|
|
1831
1831
|
fail(e);
|
|
1832
1832
|
}
|
|
1833
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
|
+
});
|
|
1834
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) => {
|
|
1835
1851
|
try {
|
|
1836
1852
|
const res = await new ErdoClient().createThread({
|