@erdoai/cli 0.190.0 → 0.193.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 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10417,7 +10417,23 @@ knowledgeAssetsCmd.command("list <objectId>").description("List files attached t
|
|
|
10417
10417
|
});
|
|
10418
10418
|
var autoCmd = program.command("automations").description("Scheduled automations (heartbeats)");
|
|
10419
10419
|
function heartbeatBounds(h) {
|
|
10420
|
-
|
|
10420
|
+
const at = h.anchor_time ? ` at:${h.anchor_time}${h.timezone ? ` ${h.timezone}` : ""}` : "";
|
|
10421
|
+
const after = h.run_after_id ? ` after:${h.run_after_id}` : "";
|
|
10422
|
+
return `${at}${after}${h.run_at ? ` run_at:${h.run_at}` : ""}${h.ends_at ? ` ends_at:${h.ends_at}` : ""}`;
|
|
10423
|
+
}
|
|
10424
|
+
function clockTime(flag, v) {
|
|
10425
|
+
if (v === void 0) return void 0;
|
|
10426
|
+
const value = v.trim();
|
|
10427
|
+
if (!/^([01]\d|2[0-3]):[0-5]\d$/.test(value)) {
|
|
10428
|
+
throw new Error(`${flag} must be a 24-hour clock time such as 21:02 \u2014 got ${JSON.stringify(v)}`);
|
|
10429
|
+
}
|
|
10430
|
+
return value;
|
|
10431
|
+
}
|
|
10432
|
+
function afterWhenFlag(v) {
|
|
10433
|
+
if (v === void 0) return void 0;
|
|
10434
|
+
if (v === "success") return true;
|
|
10435
|
+
if (v === "finished") return false;
|
|
10436
|
+
throw new Error(`--after-when must be "success" or "finished" \u2014 got ${JSON.stringify(v)}`);
|
|
10421
10437
|
}
|
|
10422
10438
|
function scheduleBound(flag, v) {
|
|
10423
10439
|
if (v === void 0) return void 0;
|
|
@@ -10429,7 +10445,7 @@ function scheduleBound(flag, v) {
|
|
|
10429
10445
|
}
|
|
10430
10446
|
autoCmd.command("create <name>").description(
|
|
10431
10447
|
"Create an automation. Pass --run-at for one-off work at a date (it runs once, then stops for good) instead of a recurring automation that checks the date"
|
|
10432
|
-
).option("--description <text>", "What the automation does").option("--instructions <text>", "Instructions for each run (agent automation)").option("--script-js <js>", "Deterministic script body (scripted automation, no LLM)").option("--script-file <path>", "Read the script body from a file (scripted automation)").requiredOption("--interval <minutes>", "Interval in minutes (minimum 5)", (v) => parseInt(v, 10)).option("--timezone <tz>", "Scheduling timezone, e.g. America/New_York (default UTC)").option("--run-at <rfc3339>", "Run once at or after this instant, then stop permanently").option("--ends-at <rfc3339>", "Never run after this instant").addOption(new Option2("--agent-key <key>", "Executor for an agent automation").choices(["erdo.heartbeat-executor", "erdo.workflow-executor"])).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").action(
|
|
10448
|
+
).option("--description <text>", "What the automation does").option("--instructions <text>", "Instructions for each run (agent automation)").option("--script-js <js>", "Deterministic script body (scripted automation, no LLM)").option("--script-file <path>", "Read the script body from a file (scripted automation)").requiredOption("--interval <minutes>", "Interval in minutes (minimum 5)", (v) => parseInt(v, 10)).option("--timezone <tz>", "Scheduling timezone, e.g. America/New_York (default UTC)").option("--at <HH:MM>", "Clock time of each run in --timezone, e.g. 21:02").option("--run-after <id>", "Also start when this automation finishes").option("--after-when <when>", "success or finished (default finished)").option("--after-delay <minutes>", "Wait this many minutes after the predecessor finishes", (v) => parseInt(v, 10)).option("--instead-of-schedule", "Run only after --run-after, with no clock of its own").option("--run-at <rfc3339>", "Run once at or after this instant, then stop permanently").option("--ends-at <rfc3339>", "Never run after this instant").addOption(new Option2("--agent-key <key>", "Executor for an agent automation").choices(["erdo.heartbeat-executor", "erdo.workflow-executor"])).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").action(
|
|
10433
10449
|
async (name, opts) => {
|
|
10434
10450
|
try {
|
|
10435
10451
|
if (opts.scriptJs && opts.scriptFile) {
|
|
@@ -10444,6 +10460,11 @@ autoCmd.command("create <name>").description(
|
|
|
10444
10460
|
script_js: scriptJs,
|
|
10445
10461
|
interval_minutes: opts.interval,
|
|
10446
10462
|
timezone: opts.timezone,
|
|
10463
|
+
anchor_time: clockTime("--at", opts.at),
|
|
10464
|
+
run_after_id: opts.runAfter,
|
|
10465
|
+
run_after_on_success: afterWhenFlag(opts.afterWhen),
|
|
10466
|
+
run_after_delay_minutes: opts.afterDelay,
|
|
10467
|
+
run_after_replaces_schedule: opts.insteadOfSchedule ? true : void 0,
|
|
10447
10468
|
run_at: scheduleBound("--run-at", opts.runAt),
|
|
10448
10469
|
ends_at: scheduleBound("--ends-at", opts.endsAt),
|
|
10449
10470
|
agent_key: opts.agentKey,
|
|
@@ -10486,7 +10507,7 @@ autoCmd.command("run <id>").description("Trigger an automation now").action(asyn
|
|
|
10486
10507
|
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("--script-js <js>", "Replacement script body (scripted automation)").option(
|
|
10487
10508
|
"--script-file <path>",
|
|
10488
10509
|
"Read the replacement script body from a file (scripted automation)"
|
|
10489
|
-
).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").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("--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(
|
|
10510
|
+
).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").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(
|
|
10490
10511
|
async (id, opts) => {
|
|
10491
10512
|
try {
|
|
10492
10513
|
if (opts.scriptJs && opts.scriptFile) {
|
|
@@ -10494,6 +10515,18 @@ autoCmd.command("update <id>").description("Edit an automation \u2014 rename, re
|
|
|
10494
10515
|
return;
|
|
10495
10516
|
}
|
|
10496
10517
|
const scriptJs = opts.scriptFile ? readFileSync4(opts.scriptFile, "utf8") : opts.scriptJs;
|
|
10518
|
+
if (opts.at !== void 0 && opts.clearAt) {
|
|
10519
|
+
fail(new Error("pass either --at or --clear-at, not both"));
|
|
10520
|
+
return;
|
|
10521
|
+
}
|
|
10522
|
+
if (opts.runAfter && opts.clearRunAfter) {
|
|
10523
|
+
fail(new Error("pass either --run-after or --clear-run-after, not both"));
|
|
10524
|
+
return;
|
|
10525
|
+
}
|
|
10526
|
+
if (opts.insteadOfSchedule && opts.keepSchedule) {
|
|
10527
|
+
fail(new Error("pass either --instead-of-schedule or --keep-schedule, not both"));
|
|
10528
|
+
return;
|
|
10529
|
+
}
|
|
10497
10530
|
const body = {
|
|
10498
10531
|
name: opts.name,
|
|
10499
10532
|
description: opts.description,
|
|
@@ -10502,6 +10535,11 @@ autoCmd.command("update <id>").description("Edit an automation \u2014 rename, re
|
|
|
10502
10535
|
script_js: scriptJs,
|
|
10503
10536
|
interval_minutes: opts.interval,
|
|
10504
10537
|
timezone: opts.timezone,
|
|
10538
|
+
anchor_time: opts.clearAt ? "" : clockTime("--at", opts.at),
|
|
10539
|
+
run_after_id: opts.clearRunAfter ? "" : opts.runAfter,
|
|
10540
|
+
run_after_on_success: afterWhenFlag(opts.afterWhen),
|
|
10541
|
+
run_after_delay_minutes: opts.afterDelay,
|
|
10542
|
+
run_after_replaces_schedule: opts.insteadOfSchedule ? true : opts.keepSchedule ? false : void 0,
|
|
10505
10543
|
run_at: scheduleBound("--run-at", opts.runAt),
|
|
10506
10544
|
ends_at: scheduleBound("--ends-at", opts.endsAt),
|
|
10507
10545
|
conversation: opts.conversation,
|