@erdoai/cli 0.124.0 → 0.126.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 +39 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1622,6 +1622,9 @@ var ErdoClient = class {
|
|
|
1622
1622
|
getKnowledge(id) {
|
|
1623
1623
|
return this.request("GET", `/v1/knowledge/${encodeURIComponent(id)}`);
|
|
1624
1624
|
}
|
|
1625
|
+
createKnowledge(input) {
|
|
1626
|
+
return this.request("POST", "/v1/knowledge", input);
|
|
1627
|
+
}
|
|
1625
1628
|
updateKnowledge(id, input) {
|
|
1626
1629
|
return this.request("POST", `/v1/knowledge/${encodeURIComponent(id)}/actions`, {
|
|
1627
1630
|
action: "update",
|
|
@@ -1660,6 +1663,12 @@ var ErdoClient = class {
|
|
|
1660
1663
|
runHeartbeat(id) {
|
|
1661
1664
|
return this.request("POST", `/v1/heartbeats/${encodeURIComponent(id)}/run`, {});
|
|
1662
1665
|
}
|
|
1666
|
+
listHeartbeatExecutions(id, limit = 10) {
|
|
1667
|
+
if (!Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
1668
|
+
throw new Error("limit must be an integer between 1 and 100");
|
|
1669
|
+
}
|
|
1670
|
+
return this.request("GET", `/v1/heartbeats/${encodeURIComponent(id)}/executions?limit=${limit}`);
|
|
1671
|
+
}
|
|
1663
1672
|
updateHeartbeat(id, body) {
|
|
1664
1673
|
return this.request(
|
|
1665
1674
|
"PATCH",
|
|
@@ -8350,6 +8359,22 @@ pipelinesCmd.command("executions <slug>").description("Show an event pipeline's
|
|
|
8350
8359
|
}
|
|
8351
8360
|
});
|
|
8352
8361
|
var knowledgeCmd = program.command("knowledge").description("Knowledge objects");
|
|
8362
|
+
knowledgeCmd.command("create").description("Create a Knowledge object").requiredOption("--title <title>", "title").requiredOption("--body <body>", "body text, or @file").option("--description <description>", "short description").option("--type <type>", "snippet or skill", "snippet").option("--category <category>", "category").option("--tags <tags>", "comma-separated tags").option("--agent <name>", "name of the agent making the write").action(async (opts) => {
|
|
8363
|
+
try {
|
|
8364
|
+
const body = readMaybeFile(opts.body) ?? "";
|
|
8365
|
+
print(await new ErdoClient().createKnowledge({
|
|
8366
|
+
title: opts.title,
|
|
8367
|
+
content: body,
|
|
8368
|
+
description: opts.description ?? opts.title,
|
|
8369
|
+
type: opts.type,
|
|
8370
|
+
category: opts.category,
|
|
8371
|
+
tags: opts.tags?.split(",").map((tag) => tag.trim()).filter(Boolean),
|
|
8372
|
+
agent: opts.agent
|
|
8373
|
+
}));
|
|
8374
|
+
} catch (e) {
|
|
8375
|
+
fail(e);
|
|
8376
|
+
}
|
|
8377
|
+
});
|
|
8353
8378
|
knowledgeCmd.command("get <id>").description("Get one full typed Knowledge object, including links and related objects").action(async (id) => {
|
|
8354
8379
|
try {
|
|
8355
8380
|
print(await new ErdoClient().getKnowledge(id));
|
|
@@ -8357,7 +8382,7 @@ knowledgeCmd.command("get <id>").description("Get one full typed Knowledge objec
|
|
|
8357
8382
|
fail(e);
|
|
8358
8383
|
}
|
|
8359
8384
|
});
|
|
8360
|
-
knowledgeCmd.command("update <id>").description("Update a Knowledge object while preserving fields omitted from the command").option("--body <value>", "new body text, or @file; pass an empty value to clear the body").option("--config <file>", "JSON object file containing the complete replacement config, or @file").option("--title <title>", "new title").action(async (id, opts) => {
|
|
8385
|
+
knowledgeCmd.command("update <id>").description("Update a Knowledge object while preserving fields omitted from the command").option("--body <value>", "new body text, or @file; pass an empty value to clear the body").option("--config <file>", "JSON object file containing the complete replacement config, or @file").option("--title <title>", "new title").option("--agent <name>", "name of the agent making the write").action(async (id, opts) => {
|
|
8361
8386
|
try {
|
|
8362
8387
|
if (opts.title === void 0 && opts.body === void 0 && opts.config === void 0) {
|
|
8363
8388
|
throw new Error("provide at least one of --title, --body, or --config");
|
|
@@ -8374,7 +8399,8 @@ knowledgeCmd.command("update <id>").description("Update a Knowledge object while
|
|
|
8374
8399
|
title: opts.title ?? object.title,
|
|
8375
8400
|
body_markdown: replacementBody ?? object.body_markdown,
|
|
8376
8401
|
config_json: replacementConfig ?? object.config_json,
|
|
8377
|
-
expected_updated_at: object.updated_at
|
|
8402
|
+
expected_updated_at: object.updated_at,
|
|
8403
|
+
agent: opts.agent
|
|
8378
8404
|
}));
|
|
8379
8405
|
} catch (e) {
|
|
8380
8406
|
fail(e);
|
|
@@ -8451,6 +8477,17 @@ autoCmd.command("list").description("List automations").action(async () => {
|
|
|
8451
8477
|
fail(e);
|
|
8452
8478
|
}
|
|
8453
8479
|
});
|
|
8480
|
+
autoCmd.command("executions <id>").description("Read recent execution history for one automation or refresh job").option("--limit <n>", "Number of executions (integer 1\u2013100)", "10").action(async (id, opts) => {
|
|
8481
|
+
try {
|
|
8482
|
+
const limit = Number(opts.limit);
|
|
8483
|
+
if (!/^\d+$/.test(opts.limit) || !Number.isInteger(limit) || limit < 1 || limit > 100) {
|
|
8484
|
+
throw new Error("limit must be an integer between 1 and 100");
|
|
8485
|
+
}
|
|
8486
|
+
print(await new ErdoClient().listHeartbeatExecutions(id, limit));
|
|
8487
|
+
} catch (e) {
|
|
8488
|
+
fail(e);
|
|
8489
|
+
}
|
|
8490
|
+
});
|
|
8454
8491
|
autoCmd.command("run <id>").description("Trigger an automation now").action(async (id) => {
|
|
8455
8492
|
try {
|
|
8456
8493
|
print(await new ErdoClient().runHeartbeat(id));
|