@erdoai/cli 0.215.0 → 0.217.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 +66 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2123,6 +2123,16 @@ var ErdoClient = class {
|
|
|
2123
2123
|
const qs = schemaName ? `?schema_name=${encodeURIComponent(schemaName)}` : "";
|
|
2124
2124
|
return this.request("GET", `/v1/integrations/${encodeURIComponent(integration)}/tables${qs}`);
|
|
2125
2125
|
}
|
|
2126
|
+
searchIntegrationActions(query, app, limit) {
|
|
2127
|
+
const params = new URLSearchParams();
|
|
2128
|
+
if (query) params.set("query", query);
|
|
2129
|
+
if (app) params.set("app", app);
|
|
2130
|
+
if (limit !== void 0) params.set("limit", String(limit));
|
|
2131
|
+
return this.request("GET", `/v1/integration-actions?${params}`);
|
|
2132
|
+
}
|
|
2133
|
+
runIntegrationAction(app, key, input) {
|
|
2134
|
+
return this.request("POST", "/v1/integration-actions/run", { app, key, input });
|
|
2135
|
+
}
|
|
2126
2136
|
// `provided_by_organization_slug` marks a connection your manager
|
|
2127
2137
|
// organization lends to you rather than one this org connected. It is usable
|
|
2128
2138
|
// exactly like your own for as long as the management link lives, and is not
|
|
@@ -2299,14 +2309,15 @@ var ErdoClient = class {
|
|
|
2299
2309
|
listKnowledgeAssets(objectID) {
|
|
2300
2310
|
return this.request("GET", `/v1/knowledge/${encodeURIComponent(objectID)}/attachments`);
|
|
2301
2311
|
}
|
|
2302
|
-
// --- automations
|
|
2312
|
+
// --- automations ---
|
|
2303
2313
|
listHeartbeats(opts = {}) {
|
|
2304
|
-
const
|
|
2305
|
-
if (opts.includeRefresh)
|
|
2306
|
-
if (opts.
|
|
2307
|
-
if (opts.
|
|
2308
|
-
|
|
2309
|
-
|
|
2314
|
+
const params = new URLSearchParams();
|
|
2315
|
+
if (opts.includeRefresh) params.set("include_refresh", "true");
|
|
2316
|
+
if (opts.includeRetired) params.set("include_retired", "true");
|
|
2317
|
+
if (opts.limit !== void 0) params.set("limit", String(opts.limit));
|
|
2318
|
+
if (opts.offset !== void 0) params.set("offset", String(opts.offset));
|
|
2319
|
+
const query = params.toString();
|
|
2320
|
+
return this.request("GET", `/v1/heartbeats${query ? `?${query}` : ""}`);
|
|
2310
2321
|
}
|
|
2311
2322
|
createHeartbeat(body) {
|
|
2312
2323
|
return this.request("POST", "/v1/heartbeats", body);
|
|
@@ -10492,6 +10503,28 @@ function printLead(lead) {
|
|
|
10492
10503
|
}
|
|
10493
10504
|
}
|
|
10494
10505
|
var integrationsCmd = program.command("integrations").description("Connect and inspect integrations");
|
|
10506
|
+
var integrationActionsCmd = integrationsCmd.command("actions").description("Search and run registered integration actions");
|
|
10507
|
+
integrationActionsCmd.command("search [query]").description("Find actions and their input schemas in your organization's integrations").option("--app <slug>", "limit search to an integration").option("--limit <number>", "maximum results (1\u2013100)").action(async (query, opts) => {
|
|
10508
|
+
try {
|
|
10509
|
+
const limit = opts.limit === void 0 ? void 0 : Number(opts.limit);
|
|
10510
|
+
if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > 100)) throw new Error("--limit must be an integer from 1 to 100");
|
|
10511
|
+
console.log(JSON.stringify(await new ErdoClient().searchIntegrationActions(query, opts.app, limit), null, 2));
|
|
10512
|
+
} catch (e) {
|
|
10513
|
+
fail(e);
|
|
10514
|
+
}
|
|
10515
|
+
});
|
|
10516
|
+
integrationActionsCmd.command("run <app> <key>").description("Run an action through the same approval and spend gates as an agent").option("--input <json>", "action input as a JSON object").option("--input-file <path>", "read the action input JSON object from a file").action(async (app, key, opts) => {
|
|
10517
|
+
try {
|
|
10518
|
+
if (opts.input === void 0 === (opts.inputFile === void 0)) throw new Error("provide exactly one of --input or --input-file");
|
|
10519
|
+
const input = JSON.parse(opts.input ?? readFileSync5(opts.inputFile, "utf8"));
|
|
10520
|
+
if (input === null || typeof input !== "object" || Array.isArray(input)) throw new Error("action input must be a JSON object");
|
|
10521
|
+
const result = await new ErdoClient().runIntegrationAction(app, key, input);
|
|
10522
|
+
console.log(JSON.stringify(result, null, 2));
|
|
10523
|
+
if (result.status !== "succeeded") process.exitCode = 1;
|
|
10524
|
+
} catch (e) {
|
|
10525
|
+
fail(e);
|
|
10526
|
+
}
|
|
10527
|
+
});
|
|
10495
10528
|
integrationsCmd.command("list").description("List connected integrations \u2014 app, status, auth type, name, then the connection's id (what --from-connection takes) and connector_account_id when available").action(async () => {
|
|
10496
10529
|
try {
|
|
10497
10530
|
const { integrations } = await new ErdoClient().listIntegrations();
|
|
@@ -10981,7 +11014,7 @@ knowledgeAssetsCmd.command("list <objectId>").description("List files attached t
|
|
|
10981
11014
|
fail(e);
|
|
10982
11015
|
}
|
|
10983
11016
|
});
|
|
10984
|
-
var autoCmd = program.command("automations").description("
|
|
11017
|
+
var autoCmd = program.command("automations").description("All scheduled and event-triggered automations");
|
|
10985
11018
|
function heartbeatBounds(h) {
|
|
10986
11019
|
const at = h.anchor_time ? ` at:${h.anchor_time}${h.timezone ? ` ${h.timezone}` : ""}` : "";
|
|
10987
11020
|
const after = h.run_after_id ? ` after:${h.run_after_id}` : "";
|
|
@@ -11045,16 +11078,31 @@ autoCmd.command("create <name>").description(
|
|
|
11045
11078
|
}
|
|
11046
11079
|
}
|
|
11047
11080
|
);
|
|
11048
|
-
autoCmd.command("list").description("List automations").option("--include-refresh", "Also list dataset refresh jobs with their state, including auto-paused ones and any that will pause soon").option("--
|
|
11049
|
-
try {
|
|
11050
|
-
const
|
|
11051
|
-
const
|
|
11052
|
-
const
|
|
11053
|
-
|
|
11054
|
-
|
|
11055
|
-
|
|
11056
|
-
|
|
11081
|
+
autoCmd.command("list").description("List automations").option("--include-refresh", "Also list dataset refresh jobs with their state, including auto-paused ones and any that will pause soon").option("--include-retired", "Also list retired automations").action(async (opts) => {
|
|
11082
|
+
try {
|
|
11083
|
+
const client = new ErdoClient();
|
|
11084
|
+
const heartbeats = [];
|
|
11085
|
+
const jobs = /* @__PURE__ */ new Map();
|
|
11086
|
+
let offset = 0;
|
|
11087
|
+
let refreshes;
|
|
11088
|
+
let jobsTruncated = false;
|
|
11089
|
+
for (; ; ) {
|
|
11090
|
+
const page = await client.listHeartbeats({ includeRefresh: opts.includeRefresh, includeRetired: opts.includeRetired, limit: 100, offset });
|
|
11091
|
+
heartbeats.push(...page.heartbeats);
|
|
11092
|
+
for (const job of page.jobs ?? []) jobs.set(job.id, job);
|
|
11093
|
+
refreshes ??= page.refreshes;
|
|
11094
|
+
jobsTruncated ||= !!page.jobs_truncated;
|
|
11095
|
+
if (!page.has_more) break;
|
|
11096
|
+
offset += page.heartbeats.length;
|
|
11097
|
+
}
|
|
11057
11098
|
for (const h of heartbeats) console.log(`${h.id} ${h.state} ${h.name} ${h.kind === "script" ? "script" : h.thread_id ? `thread:${h.thread_id}` : h.conversation ?? "new"}${h.persona_id ? ` persona:${h.persona_id}` : ""}${h.model ? ` model:${h.model}` : ""}${heartbeatBounds(h)}`);
|
|
11099
|
+
for (const job of jobs.values()) {
|
|
11100
|
+
const triggers = job.trigger_summary.map((trigger) => trigger.type === "cron" ? `cron:${trigger.cron_expression}${trigger.timezone ? ` ${trigger.timezone}` : ""}` : trigger.type === "heartbeat" ? `every:${trigger.interval_minutes}m${trigger.timezone ? ` ${trigger.timezone}` : ""}` : trigger.type).join(",");
|
|
11101
|
+
console.log(`${job.id} ${job.state} ${job.name} job:${job.type} ${job.kind} ${triggers}`);
|
|
11102
|
+
}
|
|
11103
|
+
if (jobsTruncated) {
|
|
11104
|
+
console.error(`Listed the first ${jobs.size} scheduled and event automations; this organization has more than one listing reads.`);
|
|
11105
|
+
}
|
|
11058
11106
|
if (opts.includeRefresh) {
|
|
11059
11107
|
for (const r of refreshes ?? []) console.log(formatRefreshJobRow(r));
|
|
11060
11108
|
}
|
|
@@ -11080,7 +11128,7 @@ autoCmd.command("run <id>").description("Trigger an automation now").option("--m
|
|
|
11080
11128
|
fail(e);
|
|
11081
11129
|
}
|
|
11082
11130
|
});
|
|
11083
|
-
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(
|
|
11131
|
+
autoCmd.command("update <id>").description("Edit an automation \u2014 rename, reschedule (--cron for a scheduled job, --interval/--at for a heartbeat), 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(
|
|
11084
11132
|
"--script-file <path>",
|
|
11085
11133
|
"Read the replacement script body from a file (scripted automation)"
|
|
11086
11134
|
).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(
|