@astra-cli/cli 1.2.4 → 1.2.6
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/astra.js +32 -18
- 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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
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)
|
|
@@ -1059,7 +1062,7 @@ async function registerAgent() {
|
|
|
1059
1062
|
const result = await apiCall("POST", "/api/v1/agents/register", {
|
|
1060
1063
|
name: agentName,
|
|
1061
1064
|
description
|
|
1062
|
-
});
|
|
1065
|
+
}, void 0, false);
|
|
1063
1066
|
if (!result.ok) {
|
|
1064
1067
|
spinner5.stop("Registration failed.");
|
|
1065
1068
|
if (result.status === 409) {
|
|
@@ -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
|
|
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,
|
|
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
|
|
1140
|
+
return { agentName, verificationCode };
|
|
1128
1141
|
}
|
|
1129
1142
|
}
|
|
1130
1143
|
function buildTweetSuggestions(agentName, code) {
|
|
@@ -2873,7 +2886,7 @@ var registerAgentTool = tool6({
|
|
|
2873
2886
|
error: "Invalid agent name. Must be 2-32 chars, lowercase letters, numbers, hyphens, or underscores."
|
|
2874
2887
|
};
|
|
2875
2888
|
}
|
|
2876
|
-
const result = await apiCall("POST", "/api/v1/agents/register", { name, description });
|
|
2889
|
+
const result = await apiCall("POST", "/api/v1/agents/register", { name, description }, void 0, false);
|
|
2877
2890
|
if (!result.ok) {
|
|
2878
2891
|
return {
|
|
2879
2892
|
error: result.error,
|
|
@@ -2883,7 +2896,8 @@ var registerAgentTool = tool6({
|
|
|
2883
2896
|
};
|
|
2884
2897
|
}
|
|
2885
2898
|
const data = result.data;
|
|
2886
|
-
|
|
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:
|
|
2909
|
+
api_key: apiKey,
|
|
2896
2910
|
api_base: getActiveManifest().apiBase
|
|
2897
2911
|
});
|
|
2898
2912
|
setActiveAgent(name);
|