openanima 0.4.1 → 0.5.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.
Files changed (2) hide show
  1. package/dist/bin/index.js +66 -5
  2. package/package.json +1 -1
package/dist/bin/index.js CHANGED
@@ -7795,7 +7795,7 @@ async function goCommand(options) {
7795
7795
 
7796
7796
  // src/bin/index.ts
7797
7797
  var program = new Command();
7798
- program.name("openanima").description(`${APP_NAME} CLI \u2014 Register, assess, and manage your AI agent's behavioral style`).version("0.4.0");
7798
+ program.name("openanima").description(`${APP_NAME} CLI \u2014 Register, assess, and manage your AI agent's behavioral style`).version("0.5.0");
7799
7799
  program.command("register").description("[deprecated] Use 'openanima go' instead").action(registerCommand);
7800
7800
  program.command("test").description("[deprecated] Use 'openanima go' instead").action(testCommand);
7801
7801
  program.command("profile").description("View your agent's behavioral style profile").option("--agent-id <id>", "Agent ID (uses saved config if omitted)").action(profileCommand);
@@ -7804,17 +7804,18 @@ program.command("rename").description("Change your agent's display name").argume
7804
7804
  const { readConfig: readConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
7805
7805
  const { createApiClient: createApiClient2 } = await Promise.resolve().then(() => (init_api_client(), api_client_exports));
7806
7806
  const chalk5 = (await import("chalk")).default;
7807
- const config = readConfig2();
7808
- if (!config?.agentId || !config?.token) {
7807
+ const config = await readConfig2();
7808
+ const agentToken = config?.token ?? config?.apiKey;
7809
+ if (!config?.agentId || !agentToken) {
7809
7810
  console.log(chalk5.red(" No agent registered. Run 'openanima go' first."));
7810
7811
  process.exit(1);
7811
7812
  }
7812
7813
  const api = createApiClient2();
7813
- api.setToken(config.token);
7814
+ api.setToken(agentToken);
7814
7815
  try {
7815
7816
  const res = await fetch(`${api.baseUrl}/agent/${config.agentId}/name`, {
7816
7817
  method: "PATCH",
7817
- headers: { "Content-Type": "application/json", Authorization: `Bearer ${config.token}` },
7818
+ headers: { "Content-Type": "application/json", Authorization: `Bearer ${agentToken}` },
7818
7819
  body: JSON.stringify({ displayName: newName.trim() })
7819
7820
  });
7820
7821
  const data = await res.json();
@@ -7827,6 +7828,66 @@ program.command("rename").description("Change your agent's display name").argume
7827
7828
  console.log(chalk5.red(" Could not connect to API."));
7828
7829
  }
7829
7830
  });
7831
+ program.command("auth").description("Authenticate with the OpenAnima web dashboard").argument("<code>", "6-character auth code from the web dashboard").action(async (code) => {
7832
+ const { readConfig: readConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
7833
+ const chalk5 = (await import("chalk")).default;
7834
+ const config = await readConfig2();
7835
+ const token = config.token ?? config.apiKey;
7836
+ if (!config.agentId || !token) {
7837
+ console.log(chalk5.red(" No agent registered. Run 'openanima go' first."));
7838
+ process.exit(1);
7839
+ }
7840
+ const apiUrl = process.env.OPENANIMA_API_URL ?? "https://api-production-843a.up.railway.app";
7841
+ try {
7842
+ const res = await fetch(`${apiUrl}/auth/confirm`, {
7843
+ method: "POST",
7844
+ headers: { "Content-Type": "application/json" },
7845
+ body: JSON.stringify({ code: code.trim().toUpperCase(), agentToken: token })
7846
+ });
7847
+ const data = await res.json();
7848
+ if (data.confirmed) {
7849
+ console.log(chalk5.green(" Logged in to OpenAnima web dashboard"));
7850
+ } else {
7851
+ console.log(chalk5.red(` ${data.error ?? "Authentication failed"}`));
7852
+ process.exit(1);
7853
+ }
7854
+ } catch {
7855
+ console.log(chalk5.red(" Could not connect to API."));
7856
+ process.exit(1);
7857
+ }
7858
+ });
7859
+ program.command("bind-email").description("Bind an email address to your agent account").argument("<email>", "Email address to bind").action(async (email) => {
7860
+ const { readConfig: readConfig2 } = await Promise.resolve().then(() => (init_config(), config_exports));
7861
+ const chalk5 = (await import("chalk")).default;
7862
+ const config = await readConfig2();
7863
+ const token = config.token ?? config.apiKey;
7864
+ if (!config.agentId || !token) {
7865
+ console.log(chalk5.red(" No agent registered. Run 'openanima go' first."));
7866
+ process.exit(1);
7867
+ }
7868
+ if (!email.includes("@")) {
7869
+ console.log(chalk5.red(" Please provide a valid email address."));
7870
+ process.exit(1);
7871
+ }
7872
+ const apiUrl = process.env.OPENANIMA_API_URL ?? "https://api-production-843a.up.railway.app";
7873
+ try {
7874
+ const res = await fetch(`${apiUrl}/auth/bind-email`, {
7875
+ method: "POST",
7876
+ headers: { "Content-Type": "application/json" },
7877
+ body: JSON.stringify({ email: email.trim(), agentToken: token })
7878
+ });
7879
+ const data = await res.json();
7880
+ if (data.bound) {
7881
+ console.log(chalk5.green(` Email bound: ${data.email}`));
7882
+ } else {
7883
+ console.log(chalk5.red(` ${data.error ?? "Failed to bind email"}`));
7884
+ process.exit(1);
7885
+ }
7886
+ } catch {
7887
+ console.log(chalk5.red(" Could not connect to API."));
7888
+ process.exit(1);
7889
+ }
7890
+ });
7830
7891
  program.parse();
7831
7892
  /*! Bundled license information:
7832
7893
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openanima",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "OpenAnima CLI — Register, assess, and join your AI agent in one command",
5
5
  "bin": {
6
6
  "openanima": "./dist/bin/index.js"