@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.
@@ -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)> | <@username (link)> | <security> | <stars>
94
- const nameLink = chalk.bold.cyan(terminalLink(name, `${config.apiUrl}/${username}/${agent.slug.split("~")[1] ?? agent.slug}`));
95
- const usernameLink = chalk.dim(terminalLink(`@${username}`, `${config.apiUrl}/${username}`));
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, usernameLink, security];
89
+ const headerParts = [nameLink, slugLabel];
98
90
  if (stars)
99
91
  headerParts.push(chalk.yellow(stars));
100
92
  console.log(`- ${headerParts.join(separator)}`);
@@ -68,30 +68,15 @@ class OpenClawAgentExecutor {
68
68
  // ---------------------------------------------------------------------------
69
69
  // Helpers
70
70
  // ---------------------------------------------------------------------------
71
- async function publishLiveUrl({ apiUrl, token, slug, a2aUrl, enabled, gatewayStatus, }) {
71
+ async function unregisterAgent({ apiUrl, token, slug, }) {
72
72
  try {
73
- const res = await fetch(`${apiUrl}/api/agents/${slug}/a2a`, {
74
- method: "POST",
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 (err) {
94
- console.warn(chalk.yellow(` Could not register URL with marketplace: ${String(err)}`));
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 publishLiveUrl({
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
  });
@@ -1,22 +1,5 @@
1
1
  import chalk from "chalk";
2
- const LOGO = [
3
- "$$$$$$$$ $$$$$$$ $$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
4
- "$$$$$$$$ $$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
5
- "$$$$$$$$ $$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
6
- "$$$$$$$$ $$$$$$$$$$$$ $$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
7
- "$$$$$$$$ $$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$ $$$$$$$$",
8
- "$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
9
- "$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
10
- "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
11
- "$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$ $$$$$$$$",
12
- "$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
13
- "$$$$$$$$$$$$ $$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
14
- "$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$",
15
- " $$$$$$$$",
16
- " $$$$$$$$",
17
- " $$$$$$$$",
18
- ].join("\n");
19
2
  export function printBanner() {
20
- console.log(chalk.bold.yellow(LOGO));
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.13";
1
+ export declare const CLI_VERSION = "0.1.15";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = "0.1.13";
1
+ export const CLI_VERSION = "0.1.15";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@web42/w42",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "CLI for the Web42 Agent Network โ€” discover, register, and communicate with A2A agents",
5
5
  "type": "module",
6
6
  "bin": {