@erdoai/cli 0.207.0 → 0.211.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 +41 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -192,6 +192,24 @@ function parseCSV(text) {
|
|
|
192
192
|
return rows;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
+
// src/knowledge-freshness.ts
|
|
196
|
+
function knowledgeFreshnessFromOptions(opts) {
|
|
197
|
+
const out = {};
|
|
198
|
+
const set = (key, value) => {
|
|
199
|
+
if (value !== void 0 && value.trim() !== "") out[key] = value.trim();
|
|
200
|
+
};
|
|
201
|
+
set("provider", opts.provider);
|
|
202
|
+
set("api_family", opts.apiFamily);
|
|
203
|
+
set("version", opts.providerVersion);
|
|
204
|
+
set("source_url", opts.sourceUrl);
|
|
205
|
+
set("verified_at", opts.verifiedAt);
|
|
206
|
+
set("stale_after", opts.staleAfter);
|
|
207
|
+
set("stale_when", opts.staleWhen);
|
|
208
|
+
set("superseded_by", opts.supersededBy);
|
|
209
|
+
if (opts.deprecated) out.deprecated = true;
|
|
210
|
+
return out;
|
|
211
|
+
}
|
|
212
|
+
|
|
195
213
|
// src/eval-compare.ts
|
|
196
214
|
function evalResultScored(r) {
|
|
197
215
|
return !r.agent_error && r.failure_classification !== "judge_error" && r.scoring_status !== "awaiting_truth";
|
|
@@ -10814,9 +10832,14 @@ declarationsCmd.command("upsert").description("Write one declaration. The same n
|
|
|
10814
10832
|
}
|
|
10815
10833
|
});
|
|
10816
10834
|
var knowledgeCmd = program.command("knowledge").description("Knowledge objects");
|
|
10817
|
-
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(
|
|
10835
|
+
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(
|
|
10836
|
+
"--type <type>",
|
|
10837
|
+
"snippet (durable context), skill (reusable instructions), dataset_note, or integration_model (a dated provider/API fact: needs --provider, --source-url, --verified-at and --stale-after)",
|
|
10838
|
+
"snippet"
|
|
10839
|
+
).option("--category <category>", "category").option("--tags <tags>", "comma-separated tags").option("--agent <name>", "name of the agent making the write").option("--provider <name>", "provider a volatile fact is about, e.g. sec_edgar").option("--api-family <name>", "API family or surface the fact covers").option("--provider-version <version>", "provider API or schema version the fact applies to").option("--source-url <url>", "official source that verified the fact").option("--verified-at <date>", "when the fact was verified (YYYY-MM-DD or RFC 3339)").option("--stale-after <date>", "when the fact must be re-verified (YYYY-MM-DD or RFC 3339)").option("--stale-when <text>", "condition that makes the fact stale sooner").action(async (opts) => {
|
|
10818
10840
|
try {
|
|
10819
10841
|
const body = readMaybeFile(opts.body) ?? "";
|
|
10842
|
+
const freshness = knowledgeFreshnessFromOptions(opts);
|
|
10820
10843
|
print(await new ErdoClient().createKnowledge({
|
|
10821
10844
|
title: opts.title,
|
|
10822
10845
|
content: body,
|
|
@@ -10824,7 +10847,8 @@ knowledgeCmd.command("create").description("Create a Knowledge object").required
|
|
|
10824
10847
|
type: opts.type,
|
|
10825
10848
|
category: opts.category,
|
|
10826
10849
|
tags: opts.tags?.split(",").map((tag) => tag.trim()).filter(Boolean),
|
|
10827
|
-
agent: opts.agent
|
|
10850
|
+
agent: opts.agent,
|
|
10851
|
+
...Object.keys(freshness).length > 0 ? { freshness } : {}
|
|
10828
10852
|
}));
|
|
10829
10853
|
} catch (e) {
|
|
10830
10854
|
fail(e);
|
|
@@ -10837,10 +10861,15 @@ knowledgeCmd.command("get <id>").description("Get one full typed Knowledge objec
|
|
|
10837
10861
|
fail(e);
|
|
10838
10862
|
}
|
|
10839
10863
|
});
|
|
10840
|
-
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) => {
|
|
10864
|
+
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").option("--verified-at <date>", "re-verification date for a dated fact (YYYY-MM-DD or RFC 3339)").option("--stale-after <date>", "new re-check date for a dated fact (YYYY-MM-DD or RFC 3339)").option("--source-url <url>", "replacement verifying source").option("--deprecated", "mark a dated fact deprecated").option("--superseded-by <ref>", "id, slug or title of the Knowledge object that replaces this fact").action(async (id, opts) => {
|
|
10841
10865
|
try {
|
|
10842
|
-
|
|
10843
|
-
|
|
10866
|
+
const freshness = knowledgeFreshnessFromOptions(opts);
|
|
10867
|
+
const hasFreshness = Object.keys(freshness).length > 0;
|
|
10868
|
+
if (opts.title === void 0 && opts.body === void 0 && opts.config === void 0 && !hasFreshness) {
|
|
10869
|
+
throw new Error("provide at least one of --title, --body, --config, or a freshness option");
|
|
10870
|
+
}
|
|
10871
|
+
if (hasFreshness && opts.config !== void 0) {
|
|
10872
|
+
throw new Error("--config replaces the whole config; put freshness fields in that file instead of passing freshness options");
|
|
10844
10873
|
}
|
|
10845
10874
|
if (opts.title !== void 0 && !opts.title.trim()) {
|
|
10846
10875
|
throw new Error("title must not be empty");
|
|
@@ -10854,6 +10883,9 @@ knowledgeCmd.command("update <id>").description("Update a Knowledge object while
|
|
|
10854
10883
|
title: opts.title ?? object.title,
|
|
10855
10884
|
body_markdown: replacementBody ?? object.body_markdown,
|
|
10856
10885
|
config_json: replacementConfig ?? object.config_json,
|
|
10886
|
+
// Sent as its own field so the Knowledge service merges it and checks
|
|
10887
|
+
// the merged dates, rather than this command editing config blindly.
|
|
10888
|
+
...hasFreshness ? { freshness } : {},
|
|
10857
10889
|
expected_updated_at: object.updated_at,
|
|
10858
10890
|
agent: opts.agent
|
|
10859
10891
|
}));
|
|
@@ -11019,7 +11051,7 @@ autoCmd.command("run <id>").description("Trigger an automation now").option("--m
|
|
|
11019
11051
|
autoCmd.command("update <id>").description("Edit an automation \u2014 rename, reschedule, or replace its script/instructions").option("--name <name>", "New name").option("--description <text>", "New description").option("--instructions <text>", "Replacement instructions (agent automation)").addOption(new Option2("--agent-key <key>", "Executor for an agent automation; omit to keep current").choices(["erdo.heartbeat-executor", "erdo.workflow-executor"])).option("--model <id>", "Pin the LLM for later runs. Omit to keep the current pin").option("--clear-model", "Remove the model pin so later runs use the skill model, then the executor default").option("--script-js <js>", "Replacement script body (scripted automation)").option(
|
|
11020
11052
|
"--script-file <path>",
|
|
11021
11053
|
"Read the replacement script body from a file (scripted automation)"
|
|
11022
|
-
).addOption(new Option2("--conversation <target>", "Target 'new' (fresh thread) or 'direct' conversation").choices(["new", "direct"])).option("--thread-id <id>", "Post each run into an existing conversation UUID").option("--persona-id <id>", "Org-enabled persona UUID to speak as").addOption(new Option2("--clear-persona", "Remove the explicit persona binding; template attribution may still apply").conflicts("personaId")).option("--interval <minutes>", "New interval in minutes (minimum 5)", (v) => parseInt(v, 10)).option("--timezone <tz>", "New scheduling timezone, e.g. America/New_York").option("--at <HH:MM>", "Clock time of each run in the automation timezone, e.g. 21:02").option("--clear-at", "Clear the clock time so the next run is one interval after this save").option("--run-after <id>", "Start when this automation finishes").option("--clear-run-after", "Stop following another automation").option("--after-when <when>", "success or finished").option("--after-delay <minutes>", "Wait this many minutes after the predecessor finishes", (v) => parseInt(v, 10)).option("--instead-of-schedule", "Run only from the chain, with no clock").option("--keep-schedule", "Keep the clock as well as the chain").option("--run-at <rfc3339>", "New one-off fire time: runs once at or after it, then stops permanently (omit to keep)").option("--ends-at <rfc3339>", "New end time after which it never runs (omit to keep)").action(
|
|
11054
|
+
).addOption(new Option2("--conversation <target>", "Target 'new' (fresh thread) or 'direct' conversation").choices(["new", "direct"])).option("--thread-id <id>", "Post each run into an existing conversation UUID").option("--persona-id <id>", "Org-enabled persona UUID to speak as").addOption(new Option2("--clear-persona", "Remove the explicit persona binding; template attribution may still apply").conflicts("personaId")).option("--interval <minutes>", "New interval in minutes (minimum 5)", (v) => parseInt(v, 10)).option("--timezone <tz>", "New scheduling timezone, e.g. America/New_York").option("--at <HH:MM>", "Clock time of each run in the automation timezone, e.g. 21:02").option("--clear-at", "Clear the clock time so the next run is one interval after this save").option("--run-after <id>", "Start when this automation finishes").option("--clear-run-after", "Stop following another automation").option("--after-when <when>", "success or finished").option("--after-delay <minutes>", "Wait this many minutes after the predecessor finishes", (v) => parseInt(v, 10)).option("--instead-of-schedule", "Run only from the chain, with no clock").option("--keep-schedule", "Keep the clock as well as the chain").option("--run-at <rfc3339>", "New one-off fire time: runs once at or after it, then stops permanently (omit to keep)").option("--ends-at <rfc3339>", "New end time after which it never runs (omit to keep)").option("--cron <expr>", 'New schedule for a cron-scheduled automation, read in --timezone (or its saved one), e.g. "0 17 * * 5" for Fridays at 17:00. Edits the same automation in place').option("--cron-trigger <id>", "Which cron trigger to change, when the automation has more than one (see list)").action(
|
|
11023
11055
|
async (id, opts) => {
|
|
11024
11056
|
try {
|
|
11025
11057
|
if (opts.scriptJs && opts.scriptFile) {
|
|
@@ -11063,7 +11095,9 @@ autoCmd.command("update <id>").description("Edit an automation \u2014 rename, re
|
|
|
11063
11095
|
conversation: opts.conversation,
|
|
11064
11096
|
thread_id: opts.threadId,
|
|
11065
11097
|
persona_id: opts.personaId,
|
|
11066
|
-
clear_persona: opts.clearPersona
|
|
11098
|
+
clear_persona: opts.clearPersona,
|
|
11099
|
+
cron_expression: opts.cron?.trim() || void 0,
|
|
11100
|
+
trigger_id: opts.cronTrigger
|
|
11067
11101
|
};
|
|
11068
11102
|
if (Object.values(body).every((v) => v === void 0)) {
|
|
11069
11103
|
fail(new Error("nothing to update \u2014 pass at least one field to change"));
|