@web42/w42 0.1.21 → 0.1.22

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.
@@ -73,7 +73,7 @@ intentCommand
73
73
  .command("propose")
74
74
  .description("Generate an intent creation URL for the user to authorize in the browser")
75
75
  .requiredOption("--nick <nick>", "Short identifier for the intent")
76
- .requiredOption("--agents <slugs>", "Comma-separated merchant agent slugs (e.g. @x~starbucks)")
76
+ .requiredOption("--agents <slugs>", "Comma-separated merchant agent slugs (e.g. w42/starbucks)")
77
77
  .requiredOption("--max-amount <dollars>", "Max amount per transaction in dollars")
78
78
  .requiredOption("--prompt-playback <text>", "Human-readable description of the intent")
79
79
  .option("--currency <code>", "Currency code", "USD")
@@ -3,7 +3,7 @@ import { Command } from "commander";
3
3
  import inquirer from "inquirer";
4
4
  import ora from "ora";
5
5
  import { apiGet, apiPost, hintForError } from "../utils/api.js";
6
- import { getConfig, isAuthenticated } from "../utils/config.js";
6
+ import { getConfig } from "../utils/config.js";
7
7
  function toSlugPart(name) {
8
8
  return name
9
9
  .toLowerCase()
@@ -46,7 +46,7 @@ export const registerCommand = new Command("register")
46
46
  const check = await apiGet(`/api/agents/check?url=${encodeURIComponent(url)}`);
47
47
  if (check.registered) {
48
48
  alreadyRegistered = true;
49
- const displaySlug = check.slug.replace("~", "/");
49
+ const displaySlug = check.slug;
50
50
  checkSpinner.warn(`Already registered as ${chalk.cyan(displaySlug)}`);
51
51
  }
52
52
  else {
@@ -68,16 +68,8 @@ export const registerCommand = new Command("register")
68
68
  if (!proceed)
69
69
  process.exit(0);
70
70
  }
71
- // ── Step 3: Auth gate ──────────────────────────────────────────────────
72
- if (!isAuthenticated()) {
73
- console.log();
74
- console.log(chalk.yellow("You must be logged in to register an agent."));
75
- console.log(chalk.dim("Run: ") + chalk.cyan("w42 auth login"));
76
- process.exit(0);
77
- }
71
+ // ── Step 3: Slug prompt + availability check ───────────────────────────
78
72
  const cfg = getConfig();
79
- const username = cfg.username;
80
- // ── Step 4: Slug prompt + availability check ───────────────────────────
81
73
  const defaultSlugPart = toSlugPart(agentCard.name ?? "my-agent") || "my-agent";
82
74
  console.log();
83
75
  if (agentCard.name)
@@ -91,7 +83,7 @@ export const registerCommand = new Command("register")
91
83
  {
92
84
  type: "input",
93
85
  name: "slugPart",
94
- message: `Agent slug ${chalk.dim(`(@${username}/`)}`,
86
+ message: `Agent slug ${chalk.dim("(w42/")}`,
95
87
  default: defaultSlugPart,
96
88
  validate: (input) => {
97
89
  if (!input)
@@ -103,12 +95,12 @@ export const registerCommand = new Command("register")
103
95
  },
104
96
  ]);
105
97
  slugPart = answer.slugPart;
106
- const fullSlug = `@${username}~${slugPart}`;
98
+ const fullSlug = "w42/" + slugPart;
107
99
  const slugSpinner = ora("Checking slug availability...").start();
108
100
  try {
109
101
  const check = await apiGet(`/api/agents/check?slug=${encodeURIComponent(fullSlug)}`);
110
102
  if (check.taken) {
111
- slugSpinner.fail(`${chalk.cyan(`@${username}/${slugPart}`)} is already taken — choose another`);
103
+ slugSpinner.fail(`${chalk.cyan(`w42/${slugPart}`)} is already taken — choose another`);
112
104
  continue;
113
105
  }
114
106
  slugSpinner.stop();
@@ -116,7 +108,7 @@ export const registerCommand = new Command("register")
116
108
  catch {
117
109
  slugSpinner.warn("Could not verify slug — proceeding anyway");
118
110
  }
119
- console.log(chalk.dim(` Full slug: @${username}/${slugPart}`));
111
+ console.log(chalk.dim(` Full slug: w42/${slugPart}`));
120
112
  break;
121
113
  }
122
114
  // ── Step 5: POST ───────────────────────────────────────────────────────
@@ -130,15 +122,14 @@ export const registerCommand = new Command("register")
130
122
  const data = await apiPost("/api/agents", body);
131
123
  const slug = data.agent?.slug ?? "unknown";
132
124
  const name = data.agent?.agent_card?.name ?? agentCard.name ?? slug;
133
- const displaySlug = slug.replace("~", "/");
134
125
  if (data.created) {
135
- registerSpinner.succeed(`Registered "${name}" (${displaySlug})`);
126
+ registerSpinner.succeed(`Registered "${name}" (${slug})`);
136
127
  }
137
128
  else {
138
- registerSpinner.succeed(`Updated "${name}" (${displaySlug})`);
129
+ registerSpinner.succeed(`Updated "${name}" (${slug})`);
139
130
  }
140
131
  console.log(chalk.dim(` Send: w42 send ${slug} "hello"`));
141
- console.log(chalk.dim(` View: ${cfg.apiUrl}/${displaySlug.replace("@", "")}`));
132
+ console.log(chalk.dim(` View: ${cfg.apiUrl}/${slug}`));
142
133
  }
143
134
  catch (err) {
144
135
  registerSpinner.fail("Registration failed");
@@ -84,7 +84,7 @@ export const searchCommand = new Command("search")
84
84
  const stars = agent.stars_count > 0 ? `★ ${agent.stars_count}` : "";
85
85
  const skills = formatSkills(agent.agent_card.skills);
86
86
  // Header: - <name (link)> | <slug> | <stars>
87
- const nameLink = chalk.bold.cyan(terminalLink(name, `${config.apiUrl}/${agent.slug.replace("~", "/").replace(/^@/, "")}`));
87
+ const nameLink = chalk.bold.cyan(terminalLink(name, `${config.apiUrl}/${agent.slug}`));
88
88
  const slugLabel = chalk.dim(agent.slug);
89
89
  const separator = chalk.dim(" | ");
90
90
  const headerParts = [nameLink, slugLabel];
@@ -131,10 +131,8 @@ export const sendCommand = new Command("send")
131
131
  .option("--task-id <id>", "Reply to a specific task (e.g. one in input-required state)")
132
132
  .option("--pay <tx_id>", "Attach PaymentMandate from a transaction (use tx ID from w42 cart list)")
133
133
  .action(async (rawAgent, userMessage, opts) => {
134
- // Normalize slug: @user/name @user~name (DB format)
135
- const agent = rawAgent.includes("/") && !isUrl(rawAgent)
136
- ? rawAgent.replace("/", "~")
137
- : rawAgent;
134
+ // Agent slug can be provided directly (no conversion needed)
135
+ const agent = rawAgent;
138
136
  const config = requireAuth();
139
137
  let agentUrl;
140
138
  let bearerToken;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const CLI_VERSION = "0.1.21";
1
+ export declare const CLI_VERSION = "0.1.22";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = "0.1.21";
1
+ export const CLI_VERSION = "0.1.22";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@web42/w42",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "CLI for the Web42 Agent Network — discover, register, and communicate with A2A agents",
5
5
  "type": "module",
6
6
  "bin": {