@erdoai/cli 0.118.0 → 0.119.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/README.md CHANGED
@@ -11,7 +11,7 @@ npx @erdoai/cli --help # or run without installing
11
11
  erdo update # self-update to the latest published version
12
12
  ```
13
13
 
14
- Requires Node.js 18+. User-facing install docs: https://docs.erdo.ai/cli
14
+ Requires Node.js 22.13+. User-facing install docs: https://docs.erdo.ai/cli
15
15
 
16
16
  When a newer version is published, every command prints one line on **stderr**
17
17
  naming the installed version and `erdo update`. It is on stderr so stdout stays
package/dist/index.js CHANGED
@@ -1075,6 +1075,25 @@ var ErdoClient = class {
1075
1075
  throw err;
1076
1076
  }
1077
1077
  }
1078
+ // The thread owns the current invocation identity. Approval resumes create a
1079
+ // new invocation while deliberately reusing the original agent run, so the
1080
+ // run list is not an authoritative source for cancellation.
1081
+ getThreadCompletionStatus(threadID) {
1082
+ return this.request(
1083
+ "GET",
1084
+ `/v1/threads/${encodeURIComponent(threadID)}/completion-status`
1085
+ );
1086
+ }
1087
+ // cancelThreadInvocation names the invocation being stopped. The thread
1088
+ // service refuses (HTTP 400, "the run already changed") when the thread has
1089
+ // moved on to another invocation, so a replacement run is never cancelled.
1090
+ cancelThreadInvocation(threadID, invocationID) {
1091
+ return this.request(
1092
+ "POST",
1093
+ `/v1/threads/${encodeURIComponent(threadID)}/cancel-invocation`,
1094
+ { invocation_id: invocationID }
1095
+ );
1096
+ }
1078
1097
  sendMessage(threadID, input) {
1079
1098
  return this.request(
1080
1099
  "POST",
@@ -3991,6 +4010,24 @@ agentCmd.command("send <threadId> <message>").description("Send a message to a t
3991
4010
  fail(e);
3992
4011
  }
3993
4012
  });
4013
+ agentCmd.command("cancel <threadId>").description("Request cancellation of a thread's active invocation; read the run to confirm it has stopped").option("--invocation <id>", "invocation to cancel (default: the thread's current invocation)").action(async (threadId, opts) => {
4014
+ try {
4015
+ const client = new ErdoClient();
4016
+ let invocationID = opts.invocation;
4017
+ if (!invocationID) {
4018
+ const current = await client.getThreadCompletionStatus(threadId);
4019
+ invocationID = current.invocation_id;
4020
+ if (!invocationID) throw new Error(`thread ${threadId} has no invocation to cancel`);
4021
+ }
4022
+ const result = await client.cancelThreadInvocation(threadId, invocationID);
4023
+ if (!result.success) {
4024
+ throw new Error("cancellation could not be confirmed; inspect the thread's latest run and retry");
4025
+ }
4026
+ console.log(JSON.stringify(result, null, 2));
4027
+ } catch (e) {
4028
+ fail(e);
4029
+ }
4030
+ });
3994
4031
  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) => {
3995
4032
  try {
3996
4033
  const client = new ErdoClient();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erdoai/cli",
3
- "version": "0.118.0",
3
+ "version": "0.119.0",
4
4
  "description": "Erdo CLI — drive datasets, pages, and evals from the terminal or CI",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,7 +11,7 @@
11
11
  "scripts/postinstall.mjs"
12
12
  ],
13
13
  "engines": {
14
- "node": ">=18"
14
+ "node": "^22.13.0 || >=23.5.0"
15
15
  },
16
16
  "publishConfig": {
17
17
  "access": "public",
@@ -41,14 +41,14 @@
41
41
  "prepublishOnly": "npm run build"
42
42
  },
43
43
  "dependencies": {
44
- "@inquirer/prompts": "^7.5.0",
45
- "commander": "^12.1.0"
44
+ "@inquirer/prompts": "^8.7.3",
45
+ "commander": "^15.0.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@types/node": "^22.0.0",
49
- "tsup": "^8.0.0",
50
- "tsx": "^4.0.0",
51
- "typescript": "^5.7.0"
48
+ "@types/node": "^26.6.4",
49
+ "tsup": "^8.5.1",
50
+ "tsx": "^4.23.15",
51
+ "typescript": "^7.0.2"
52
52
  },
53
53
  "overrides": {
54
54
  "esbuild": "^0.28.1"