@web42/w42 0.1.13 โ 0.1.15
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/commands/search.js +4 -12
- package/dist/commands/serve.js +8 -41
- package/dist/utils/banner.js +1 -18
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/commands/search.js
CHANGED
|
@@ -10,12 +10,6 @@ function getCardName(card) {
|
|
|
10
10
|
function getCardDescription(card) {
|
|
11
11
|
return card?.description ?? "";
|
|
12
12
|
}
|
|
13
|
-
function getSecurityLevel(gatewayStatus) {
|
|
14
|
-
if (gatewayStatus === "live") {
|
|
15
|
-
return "๐ W42 Auth";
|
|
16
|
-
}
|
|
17
|
-
return "โ ๏ธ Offline";
|
|
18
|
-
}
|
|
19
13
|
function terminalLink(text, url) {
|
|
20
14
|
return `\x1b]8;;${url}\x07${text}\x1b]8;;\x07`;
|
|
21
15
|
}
|
|
@@ -86,15 +80,13 @@ export const searchCommand = new Command("search")
|
|
|
86
80
|
for (const agent of results) {
|
|
87
81
|
const name = getCardName(agent.agent_card);
|
|
88
82
|
const description = getCardDescription(agent.agent_card);
|
|
89
|
-
const username = agent.owner.username;
|
|
90
|
-
const security = getSecurityLevel(agent.gateway_status);
|
|
91
83
|
const stars = agent.stars_count > 0 ? `โ
${agent.stars_count}` : "";
|
|
92
84
|
const skills = formatSkills(agent.agent_card.skills);
|
|
93
|
-
// Header: - <name (link)> |
|
|
94
|
-
const nameLink = chalk.bold.cyan(terminalLink(name, `${config.apiUrl}/${
|
|
95
|
-
const
|
|
85
|
+
// Header: - <name (link)> | <slug> | <stars>
|
|
86
|
+
const nameLink = chalk.bold.cyan(terminalLink(name, `${config.apiUrl}/${agent.slug.replace("~", "/").replace(/^@/, "")}`));
|
|
87
|
+
const slugLabel = chalk.dim(agent.slug);
|
|
96
88
|
const separator = chalk.dim(" | ");
|
|
97
|
-
const headerParts = [nameLink,
|
|
89
|
+
const headerParts = [nameLink, slugLabel];
|
|
98
90
|
if (stars)
|
|
99
91
|
headerParts.push(chalk.yellow(stars));
|
|
100
92
|
console.log(`- ${headerParts.join(separator)}`);
|
package/dist/commands/serve.js
CHANGED
|
@@ -68,30 +68,15 @@ class OpenClawAgentExecutor {
|
|
|
68
68
|
// ---------------------------------------------------------------------------
|
|
69
69
|
// Helpers
|
|
70
70
|
// ---------------------------------------------------------------------------
|
|
71
|
-
async function
|
|
71
|
+
async function unregisterAgent({ apiUrl, token, slug, }) {
|
|
72
72
|
try {
|
|
73
|
-
|
|
74
|
-
method: "
|
|
75
|
-
headers: {
|
|
76
|
-
Authorization: `Bearer ${token}`,
|
|
77
|
-
"Content-Type": "application/json",
|
|
78
|
-
},
|
|
79
|
-
body: JSON.stringify({
|
|
80
|
-
a2a_url: a2aUrl,
|
|
81
|
-
a2a_enabled: enabled,
|
|
82
|
-
gateway_status: gatewayStatus,
|
|
83
|
-
}),
|
|
73
|
+
await fetch(`${apiUrl}/api/agents?slug=${encodeURIComponent(slug)}`, {
|
|
74
|
+
method: "DELETE",
|
|
75
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
84
76
|
});
|
|
85
|
-
if (!res.ok) {
|
|
86
|
-
const errBody = (await res.json().catch(() => ({})));
|
|
87
|
-
console.warn(chalk.yellow(` Could not register URL with marketplace: ${errBody.error ?? res.status}`));
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
console.log(chalk.dim(" Registered with marketplace"));
|
|
91
|
-
}
|
|
92
77
|
}
|
|
93
|
-
catch
|
|
94
|
-
|
|
78
|
+
catch {
|
|
79
|
+
// best-effort
|
|
95
80
|
}
|
|
96
81
|
}
|
|
97
82
|
// ---------------------------------------------------------------------------
|
|
@@ -233,33 +218,15 @@ export const serveCommand = new Command("serve")
|
|
|
233
218
|
catch (err) {
|
|
234
219
|
console.warn(chalk.yellow(` Could not register with marketplace: ${String(err)}`));
|
|
235
220
|
}
|
|
236
|
-
// Publish live A2A URL
|
|
237
|
-
if (registeredSlug) {
|
|
238
|
-
await publishLiveUrl({
|
|
239
|
-
apiUrl: web42ApiUrl,
|
|
240
|
-
token,
|
|
241
|
-
slug: registeredSlug,
|
|
242
|
-
a2aUrl,
|
|
243
|
-
enabled: true,
|
|
244
|
-
gatewayStatus: "live",
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
221
|
if (!publicUrl) {
|
|
248
222
|
console.log(chalk.yellow(" No --url provided. Registered localhost URL is not publicly reachable."));
|
|
249
223
|
}
|
|
250
224
|
console.log(chalk.dim("\nWaiting for requests... (Ctrl+C to stop)\n"));
|
|
251
|
-
// Graceful shutdown
|
|
225
|
+
// Graceful shutdown โ unregister from the network on exit
|
|
252
226
|
process.on("SIGINT", async () => {
|
|
253
227
|
console.log(chalk.dim("\nShutting down..."));
|
|
254
228
|
if (registeredSlug) {
|
|
255
|
-
await
|
|
256
|
-
apiUrl: web42ApiUrl,
|
|
257
|
-
token,
|
|
258
|
-
slug: registeredSlug,
|
|
259
|
-
a2aUrl: null,
|
|
260
|
-
enabled: false,
|
|
261
|
-
gatewayStatus: "offline",
|
|
262
|
-
}).catch(() => { });
|
|
229
|
+
await unregisterAgent({ apiUrl: web42ApiUrl, token, slug: registeredSlug });
|
|
263
230
|
}
|
|
264
231
|
process.exit(0);
|
|
265
232
|
});
|
package/dist/utils/banner.js
CHANGED
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
-
const LOGO = [
|
|
3
|
-
"$$$$$$$$ $$$$$$$ $$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
|
4
|
-
"$$$$$$$$ $$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
|
|
5
|
-
"$$$$$$$$ $$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$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",
|
|
15
|
-
" $$$$$$$$",
|
|
16
|
-
" $$$$$$$$",
|
|
17
|
-
" $$$$$$$$",
|
|
18
|
-
].join("\n");
|
|
19
2
|
export function printBanner() {
|
|
20
|
-
console.log(chalk.bold.yellow(
|
|
3
|
+
console.log(chalk.bold.yellow("web42") + chalk.dim(" ยท agent network"));
|
|
21
4
|
console.log();
|
|
22
5
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CLI_VERSION = "0.1.
|
|
1
|
+
export declare const CLI_VERSION = "0.1.15";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = "0.1.
|
|
1
|
+
export const CLI_VERSION = "0.1.15";
|