@aigne/cli 1.47.1 → 1.48.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/CHANGELOG.md +12 -0
- package/dist/commands/app.d.ts +4 -0
- package/dist/commands/app.js +27 -6
- package/dist/commands/hub.js +19 -20
- package/dist/utils/aigne-hub-user.js +1 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.48.0](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.47.1...cli-v1.48.0) (2025-09-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **cli:** support using beta apps with environments ([#511](https://github.com/AIGNE-io/aigne-framework/issues/511)) ([141b11a](https://github.com/AIGNE-io/aigne-framework/commit/141b11a7757f8a441489c9e7ab5e10df1fafe26f))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **cli:** tune aigne hub status and deprecate aigne hub info ([#513](https://github.com/AIGNE-io/aigne-framework/issues/513)) ([25ca2a9](https://github.com/AIGNE-io/aigne-framework/commit/25ca2a9c402e9cb2d895737c32e25e957fdefd91))
|
|
14
|
+
|
|
3
15
|
## [1.47.1](https://github.com/AIGNE-io/aigne-framework/compare/cli-v1.47.0...cli-v1.47.1) (2025-09-16)
|
|
4
16
|
|
|
5
17
|
|
package/dist/commands/app.d.ts
CHANGED
package/dist/commands/app.js
CHANGED
|
@@ -13,6 +13,13 @@ import { safeLoadAIGNE } from "../utils/workers/load-aigne.js";
|
|
|
13
13
|
import { parseAgentInput, withAgentInputSchema, } from "../utils/yargs.js";
|
|
14
14
|
import { serveMCPServerFromDir } from "./serve-mcp.js";
|
|
15
15
|
const NPM_PACKAGE_CACHE_TIME_MS = 1000 * 60 * 60 * 24; // 1 day
|
|
16
|
+
/**
|
|
17
|
+
* Check if beta applications should be used based on environment variables
|
|
18
|
+
*/
|
|
19
|
+
function shouldUseBetaApps() {
|
|
20
|
+
const envVar = process.env.AIGNE_USE_BETA_APPS;
|
|
21
|
+
return envVar === "true" || envVar === "1";
|
|
22
|
+
}
|
|
16
23
|
const builtinApps = [
|
|
17
24
|
{
|
|
18
25
|
name: "doc-smith",
|
|
@@ -159,15 +166,20 @@ export async function loadApplication({ name, dir, forceUpgrade = false, }) {
|
|
|
159
166
|
const result = await new Listr([
|
|
160
167
|
{
|
|
161
168
|
title: `Fetching ${name} metadata`,
|
|
162
|
-
task: async (ctx) => {
|
|
169
|
+
task: async (ctx, task) => {
|
|
163
170
|
const info = await getNpmTgzInfo(name);
|
|
164
171
|
Object.assign(ctx, info);
|
|
172
|
+
const useBeta = shouldUseBetaApps();
|
|
173
|
+
if (useBeta && ctx.version.includes("beta")) {
|
|
174
|
+
task.title = `Fetching ${name} metadata (using beta version)`;
|
|
175
|
+
}
|
|
165
176
|
},
|
|
166
177
|
},
|
|
167
178
|
{
|
|
168
179
|
title: `Downloading ${name}`,
|
|
169
180
|
skip: (ctx) => ctx.version === check?.version,
|
|
170
|
-
task: async (ctx) => {
|
|
181
|
+
task: async (ctx, task) => {
|
|
182
|
+
task.title = `Downloading ${name}(v${ctx.version})`;
|
|
171
183
|
await rm(dir, { force: true, recursive: true });
|
|
172
184
|
await mkdir(dir, { recursive: true });
|
|
173
185
|
await downloadAndExtract(ctx.url, dir, { strip: 1 });
|
|
@@ -240,15 +252,24 @@ async function installDependencies(dir, { log } = {}) {
|
|
|
240
252
|
});
|
|
241
253
|
await writeFile(join(dir, ".aigne-cli.json"), JSON.stringify({ installedAt: Date.now() }, null, 2));
|
|
242
254
|
}
|
|
243
|
-
async function getNpmTgzInfo(name) {
|
|
255
|
+
export async function getNpmTgzInfo(name) {
|
|
244
256
|
const res = await fetch(joinURL("https://registry.npmjs.org", name));
|
|
245
257
|
if (!res.ok)
|
|
246
258
|
throw new Error(`Failed to fetch package info for ${name}: ${res.statusText}`);
|
|
247
259
|
const data = await res.json();
|
|
248
|
-
const
|
|
249
|
-
|
|
260
|
+
const useBeta = shouldUseBetaApps();
|
|
261
|
+
let targetVersion;
|
|
262
|
+
if (useBeta && data["dist-tags"].beta) {
|
|
263
|
+
// Use beta version if available and beta flag is set
|
|
264
|
+
targetVersion = data["dist-tags"].beta;
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
// Fall back to latest version
|
|
268
|
+
targetVersion = data["dist-tags"].latest;
|
|
269
|
+
}
|
|
270
|
+
const url = data.versions[targetVersion].dist.tarball;
|
|
250
271
|
return {
|
|
251
|
-
version:
|
|
272
|
+
version: targetVersion,
|
|
252
273
|
url,
|
|
253
274
|
};
|
|
254
275
|
}
|
package/dist/commands/hub.js
CHANGED
|
@@ -13,6 +13,9 @@ const formatNumber = (balance) => {
|
|
|
13
13
|
const balanceNum = String(balance).split(".")[0];
|
|
14
14
|
return chalk.yellow((balanceNum || "").replace(/\B(?=(\d{3})+(?!\d))/g, ","));
|
|
15
15
|
};
|
|
16
|
+
function formatHubInfoName(name) {
|
|
17
|
+
return chalk.bold(`${name}:`.padEnd(10));
|
|
18
|
+
}
|
|
16
19
|
function printHubStatus(data) {
|
|
17
20
|
const divider = "─".repeat(46);
|
|
18
21
|
console.log(chalk.bold("AIGNE Hub Connection"));
|
|
@@ -23,21 +26,22 @@ function printHubStatus(data) {
|
|
|
23
26
|
: chalk.red(`${data.status} ❌`)}`);
|
|
24
27
|
console.log("");
|
|
25
28
|
console.log(chalk.bold("User:"));
|
|
26
|
-
console.log(` ${
|
|
27
|
-
console.log(` ${
|
|
28
|
-
console.log(` ${
|
|
29
|
+
console.log(` ${formatHubInfoName("Name")} ${data.user.name}`);
|
|
30
|
+
console.log(` ${formatHubInfoName("DID")} ${data.user.did}`);
|
|
31
|
+
console.log(` ${formatHubInfoName("Email")} ${data.user.email}`);
|
|
29
32
|
console.log("");
|
|
30
33
|
if (data.enableCredit) {
|
|
31
34
|
console.log(chalk.bold("Credits:"));
|
|
32
|
-
console.log(` ${
|
|
33
|
-
console.log(` ${
|
|
35
|
+
console.log(` ${formatHubInfoName("Total")} ${formatNumber(data.credits.total)}`);
|
|
36
|
+
console.log(` ${formatHubInfoName("Used")} ${formatNumber(data.credits.used)}`);
|
|
37
|
+
console.log(` ${formatHubInfoName("Available")} ${formatNumber(data.credits.available)}`);
|
|
34
38
|
console.log("");
|
|
35
39
|
console.log(chalk.bold("Links:"));
|
|
36
40
|
if (data.links.payment) {
|
|
37
|
-
console.log(` ${
|
|
41
|
+
console.log(` ${formatHubInfoName("Payment")} ${data.links.payment}`);
|
|
38
42
|
}
|
|
39
43
|
if (data.links.profile) {
|
|
40
|
-
console.log(` ${
|
|
44
|
+
console.log(` ${formatHubInfoName("Credits")} ${data.links.profile}`);
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
47
|
}
|
|
@@ -115,9 +119,8 @@ export function createHubCommand() {
|
|
|
115
119
|
},
|
|
116
120
|
})
|
|
117
121
|
.command("use", "Switch to a different AIGNE Hub", useHub)
|
|
118
|
-
.command(["status", "st"], "Show
|
|
122
|
+
.command(["status", "st"], "Show details of a connected hub", showInfo)
|
|
119
123
|
.command(["remove", "rm"], "Remove a connected hub", removeHub)
|
|
120
|
-
.command(["info", "i"], "Show details of a connected hub", showInfo)
|
|
121
124
|
.demandCommand(1, "Please provide a valid hub command"),
|
|
122
125
|
handler: () => { },
|
|
123
126
|
};
|
|
@@ -167,14 +170,6 @@ async function useHub() {
|
|
|
167
170
|
});
|
|
168
171
|
await setDefaultHub(hubApiKey);
|
|
169
172
|
}
|
|
170
|
-
async function showStatus() {
|
|
171
|
-
const active = await getDefaultHub();
|
|
172
|
-
if (!active) {
|
|
173
|
-
console.log(chalk.red("No active hub."));
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
console.log(`Active hub: ${getUrlOrigin(active)} - online`);
|
|
177
|
-
}
|
|
178
173
|
async function removeHub() {
|
|
179
174
|
const hubs = await getHubs();
|
|
180
175
|
if (!hubs.length) {
|
|
@@ -198,12 +193,14 @@ async function showInfo() {
|
|
|
198
193
|
console.log(chalk.yellow("No AIGNE Hub connected."));
|
|
199
194
|
return;
|
|
200
195
|
}
|
|
196
|
+
const defaultHub = await getDefaultHub();
|
|
197
|
+
const defaultHubIndex = hubs.findIndex((h) => getUrlOrigin(h.apiUrl) === getUrlOrigin(defaultHub));
|
|
201
198
|
const { hubApiKey } = await inquirer.prompt({
|
|
202
199
|
type: "select",
|
|
203
200
|
name: "hubApiKey",
|
|
204
201
|
message: `Choose a hub to view info:`,
|
|
205
|
-
choices: hubs.map((h) => ({
|
|
206
|
-
name: getUrlOrigin(h.apiUrl)
|
|
202
|
+
choices: hubs.map((h, index) => ({
|
|
203
|
+
name: `${getUrlOrigin(h.apiUrl)} ${defaultHubIndex === index ? "(connected)" : ""}`,
|
|
207
204
|
value: h.apiUrl,
|
|
208
205
|
})),
|
|
209
206
|
});
|
|
@@ -285,8 +282,10 @@ async function printHubDetails(url) {
|
|
|
285
282
|
email: userInfo?.user.email || "",
|
|
286
283
|
},
|
|
287
284
|
credits: {
|
|
288
|
-
|
|
285
|
+
available: formatNumber(userInfo?.creditBalance?.balance || "0"),
|
|
289
286
|
total: formatNumber(userInfo?.creditBalance?.total || "0"),
|
|
287
|
+
used: formatNumber(String(parseFloat(userInfo?.creditBalance?.total || "0") -
|
|
288
|
+
parseFloat(userInfo?.creditBalance?.balance || "0"))),
|
|
290
289
|
},
|
|
291
290
|
links: {
|
|
292
291
|
payment: userInfo?.paymentLink || "",
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { joinURL } from "ufo";
|
|
2
2
|
export async function getUserInfo({ baseUrl, apiKey, }) {
|
|
3
3
|
const response = await fetch(joinURL(baseUrl, "/api/user/info"), {
|
|
4
|
-
headers: {
|
|
5
|
-
Authorization: `Bearer ${apiKey}`,
|
|
6
|
-
},
|
|
4
|
+
headers: { Authorization: `Bearer ${apiKey}` },
|
|
7
5
|
});
|
|
8
6
|
if (!response.ok)
|
|
9
7
|
throw new Error(`Failed to fetch user info: ${response.statusText}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.48.0",
|
|
4
4
|
"description": "Your command center for agent development",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -84,9 +84,9 @@
|
|
|
84
84
|
"@aigne/agent-library": "^1.21.44",
|
|
85
85
|
"@aigne/agentic-memory": "^1.0.44",
|
|
86
86
|
"@aigne/core": "^1.60.2",
|
|
87
|
+
"@aigne/default-memory": "^1.2.7",
|
|
87
88
|
"@aigne/aigne-hub": "^0.9.4",
|
|
88
89
|
"@aigne/observability-api": "^0.10.4",
|
|
89
|
-
"@aigne/default-memory": "^1.2.7",
|
|
90
90
|
"@aigne/openai": "^0.15.3"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|