@erdoai/cli 0.51.0 → 0.53.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 +23 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -103,6 +103,10 @@ function resolveOrgId(account, override) {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
// src/client.ts
|
|
106
|
+
function formatOrg(name, slug) {
|
|
107
|
+
if (name && slug) return `${name} (${slug})`;
|
|
108
|
+
return name || slug || "";
|
|
109
|
+
}
|
|
106
110
|
var TERMINAL_RUN_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "cancelled", "error"]);
|
|
107
111
|
var POLL_STOP_STATUSES = /* @__PURE__ */ new Set([...TERMINAL_RUN_STATUSES, "awaiting_approval"]);
|
|
108
112
|
var ErdoApiError = class extends Error {
|
|
@@ -1455,7 +1459,8 @@ program.command("logout [account]").description("Log out an account (default: th
|
|
|
1455
1459
|
program.command("whoami").description("Show the active account and org").action(async () => {
|
|
1456
1460
|
try {
|
|
1457
1461
|
const me = await new ErdoClient().me();
|
|
1458
|
-
|
|
1462
|
+
const org2 = formatOrg(me.organization_name, me.organization_slug) || me.organization_id;
|
|
1463
|
+
console.log(`${me.email || me.user_id} \u2014 org: ${org2}`);
|
|
1459
1464
|
} catch (e) {
|
|
1460
1465
|
fail(e);
|
|
1461
1466
|
}
|
|
@@ -2458,15 +2463,22 @@ agentCmd.command("threads").description("List your threads").action(async () =>
|
|
|
2458
2463
|
fail(e);
|
|
2459
2464
|
}
|
|
2460
2465
|
});
|
|
2461
|
-
agentCmd.command("messages <threadId>").description("Show a thread's messages (role + text)").action(async (threadId) => {
|
|
2466
|
+
agentCmd.command("messages <threadId>").description("Show a thread's messages (role + text)").option("-v, --verbose", "print full content for non-text entries (tool calls, results, etc.) instead of a placeholder").action(async (threadId, opts) => {
|
|
2462
2467
|
try {
|
|
2463
2468
|
const { messages } = await new ErdoClient().getThreadMessages(threadId);
|
|
2469
|
+
if (messages.length === 0) {
|
|
2470
|
+
console.log("No visible messages in this thread.");
|
|
2471
|
+
return;
|
|
2472
|
+
}
|
|
2464
2473
|
for (const m of messages) {
|
|
2465
2474
|
const role = m.message.author_entity_type === "app" ? "agent" : m.message.author_name || m.message.author_id || m.message.author_entity_type;
|
|
2466
2475
|
console.log(`\u2014 ${role} \xB7 ${m.message.created_at} \u2014`);
|
|
2467
2476
|
for (const c of m.contents) {
|
|
2468
2477
|
if (c.content_type === "text") {
|
|
2469
2478
|
console.log(c.content);
|
|
2479
|
+
} else if (opts.verbose) {
|
|
2480
|
+
console.log(`\x1B[2m[${c.content_type}]\x1B[0m`);
|
|
2481
|
+
console.log(typeof c.content === "string" ? c.content : JSON.stringify(c.content, null, 2));
|
|
2470
2482
|
} else {
|
|
2471
2483
|
console.log(`\x1B[2m[${c.content_type}]\x1B[0m`);
|
|
2472
2484
|
}
|
|
@@ -3622,10 +3634,14 @@ integrationsCmd.command("connect <app>").description("Connect an app \u2014 pass
|
|
|
3622
3634
|
}
|
|
3623
3635
|
const res = await new ErdoClient().connectIntegration({ app, name: opts.name, credentials });
|
|
3624
3636
|
print(res);
|
|
3637
|
+
const notes = [];
|
|
3638
|
+
const org2 = formatOrg(res.organization_name, res.organization_slug);
|
|
3639
|
+
if (org2) notes.push(`This connection belongs to ${org2}.`);
|
|
3625
3640
|
if (res.connect_url) {
|
|
3626
|
-
|
|
3627
|
-
Open this URL in a browser to authorize, then run: erdo integrations status ${app}`);
|
|
3641
|
+
notes.push(`Open this URL in a browser to authorize, then run: erdo integrations status ${app}`);
|
|
3628
3642
|
}
|
|
3643
|
+
if (notes.length) console.error(`
|
|
3644
|
+
${notes.join("\n")}`);
|
|
3629
3645
|
} catch (e) {
|
|
3630
3646
|
fail(e);
|
|
3631
3647
|
}
|
|
@@ -3703,10 +3719,12 @@ connectLinksCmd.command("create <app>").description("Mint a shareable connect li
|
|
|
3703
3719
|
integration_id: opts.integrationId
|
|
3704
3720
|
});
|
|
3705
3721
|
print(res);
|
|
3722
|
+
const linkOrg = formatOrg(res.organization_name, res.organization_slug);
|
|
3706
3723
|
process.stderr.write(
|
|
3707
3724
|
`
|
|
3708
3725
|
Share link_url with the person who holds the credentials. It expires ${res.expires_at} and completes once. Treat it as a secret \u2014 anyone with it can finish the connection.
|
|
3709
|
-
`
|
|
3726
|
+
` + (linkOrg ? `The connection they make will belong to ${linkOrg}.
|
|
3727
|
+
` : "")
|
|
3710
3728
|
);
|
|
3711
3729
|
} catch (e) {
|
|
3712
3730
|
fail(e);
|