@astra-cli/cli 1.2.3 → 1.2.5

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/astra.js +30 -16
  2. package/package.json +1 -1
package/dist/astra.js CHANGED
@@ -198,16 +198,19 @@ var WalletSchema = z2.object({
198
198
  var RegisterResponseSchema = z2.object({
199
199
  success: z2.boolean(),
200
200
  agent: z2.object({
201
- id: z2.string(),
202
201
  name: z2.string(),
203
- displayName: z2.string().nullable(),
204
- role: z2.string(),
205
- status: z2.string(),
206
- simBalance: z2.number()
207
- }),
208
- api_key: z2.string(),
209
- verification_code: z2.string()
210
- });
202
+ id: z2.string().optional(),
203
+ displayName: z2.string().nullable().optional(),
204
+ role: z2.string().optional(),
205
+ status: z2.string().optional(),
206
+ simBalance: z2.number().optional(),
207
+ api_key: z2.string().optional(),
208
+ verification_code: z2.string().optional(),
209
+ claim_url: z2.string().optional()
210
+ }).passthrough(),
211
+ api_key: z2.string().optional(),
212
+ verification_code: z2.string().optional()
213
+ }).passthrough();
211
214
  var AgentAutopilotSchema = z2.object({
212
215
  mode: z2.enum(["off", "semi", "full"]).default("off"),
213
216
  intervalMs: z2.number().min(6e4).max(36e5).default(3e5)
@@ -1080,10 +1083,17 @@ async function registerAgent() {
1080
1083
  clack2.log.error("Unexpected response from API. Please try again.");
1081
1084
  continue;
1082
1085
  }
1083
- const { agent, api_key, verification_code } = parsed.data;
1086
+ const { agent } = parsed.data;
1087
+ const apiKey = parsed.data.api_key ?? agent.api_key;
1088
+ const verificationCode = parsed.data.verification_code ?? agent.verification_code ?? "";
1089
+ if (!apiKey) {
1090
+ spinner5.stop("Registration failed.");
1091
+ clack2.log.error("Registration response missing API key. Please try again.");
1092
+ continue;
1093
+ }
1084
1094
  saveCredentials(agentName, {
1085
1095
  agent_name: agentName,
1086
- api_key,
1096
+ api_key: apiKey,
1087
1097
  api_base: manifest.apiBase
1088
1098
  });
1089
1099
  setActiveAgent(agentName);
@@ -1093,14 +1103,14 @@ async function registerAgent() {
1093
1103
  [
1094
1104
  `Agent: ${agent.name}`,
1095
1105
  `Status: ${agent.status}`,
1096
- `Starting balance: ${agent.simBalance.toLocaleString()} $SIM`,
1106
+ `Starting balance: ${(agent.simBalance ?? 0).toLocaleString()} $SIM`,
1097
1107
  "",
1098
1108
  `Your API key has been saved securely to your local machine.`,
1099
1109
  `It will not be displayed again \u2014 it is stored with restricted`,
1100
1110
  `permissions (chmod 600) and is never sent to the LLM.`
1101
1111
  ].join("\n")
1102
1112
  );
1103
- const tweetSuggestions = buildTweetSuggestions(agent.name, verification_code);
1113
+ const tweetSuggestions = buildTweetSuggestions(agent.name, verificationCode);
1104
1114
  clack2.log.info(
1105
1115
  [
1106
1116
  "To verify your agent, post a tweet tagging @astranova_live with your code.",
@@ -1123,8 +1133,11 @@ async function registerAgent() {
1123
1133
  `permissions (chmod 600) and is never sent to the LLM.`
1124
1134
  ].join("\n")
1125
1135
  );
1136
+ if (agent.claim_url) {
1137
+ clack2.log.info(`Claim your agent: ${agent.claim_url}`);
1138
+ }
1126
1139
  }
1127
- return { agentName, verificationCode: verification_code };
1140
+ return { agentName, verificationCode };
1128
1141
  }
1129
1142
  }
1130
1143
  function buildTweetSuggestions(agentName, code) {
@@ -2883,7 +2896,8 @@ var registerAgentTool = tool6({
2883
2896
  };
2884
2897
  }
2885
2898
  const data = result.data;
2886
- if (!data.api_key) {
2899
+ const apiKey = data.api_key ?? data.agent?.api_key;
2900
+ if (!apiKey) {
2887
2901
  return { error: "Registration response missing api_key. Something went wrong." };
2888
2902
  }
2889
2903
  const currentAgent = getActiveAgent();
@@ -2892,7 +2906,7 @@ var registerAgentTool = tool6({
2892
2906
  }
2893
2907
  saveCredentials(name, {
2894
2908
  agent_name: name,
2895
- api_key: data.api_key,
2909
+ api_key: apiKey,
2896
2910
  api_base: getActiveManifest().apiBase
2897
2911
  });
2898
2912
  setActiveAgent(name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astra-cli/cli",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "The terminal for autonomous agents. Powered by AstraNova.",
5
5
  "type": "module",
6
6
  "bin": {