@annals/agent-mesh 0.13.1 → 0.14.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.
Files changed (2) hide show
  1. package/dist/index.js +90 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2611,7 +2611,8 @@ var ERROR_HINTS = {
2611
2611
  github_required: "GitHub account required. Visit https://agents.hot/settings to link one.",
2612
2612
  validation_error: "Invalid input. Check your skill.json or command flags.",
2613
2613
  permission_denied: "You don't have permission to modify this skill.",
2614
- file_too_large: "Package file exceeds the 50MB limit."
2614
+ file_too_large: "Package file exceeds the 50MB limit.",
2615
+ subscription_required: "This is a private agent. Subscribe first: agent-mesh subscribe <author-login>"
2615
2616
  };
2616
2617
  var PlatformClient = class {
2617
2618
  token;
@@ -3807,7 +3808,10 @@ function registerDiscoverCommand(program2) {
3807
3808
  params.set("limit", opts.limit);
3808
3809
  params.set("offset", opts.offset);
3809
3810
  const url = `${BASE_URL}/api/agents/discover?${params}`;
3810
- const res = await fetch(url);
3811
+ const token = loadToken();
3812
+ const headers = {};
3813
+ if (token) headers["Authorization"] = `Bearer ${token}`;
3814
+ const res = await fetch(url, { headers });
3811
3815
  if (!res.ok) {
3812
3816
  const body = await res.json().catch(() => ({}));
3813
3817
  console.error(` Error: ${body.message ?? `HTTP ${res.status}`}`);
@@ -3894,12 +3898,20 @@ ${content}`;
3894
3898
  clearTimeout(timer);
3895
3899
  if (!res.ok) {
3896
3900
  let msg = `HTTP ${res.status}`;
3901
+ let errorCode = "";
3897
3902
  try {
3898
3903
  const body = await res.json();
3904
+ errorCode = body.error || "";
3899
3905
  msg = body.message || body.error || msg;
3900
3906
  } catch {
3901
3907
  }
3902
- log.error(msg);
3908
+ if (errorCode === "subscription_required") {
3909
+ log.error("This is a private agent.");
3910
+ console.error(` Subscribe first: agent-mesh subscribe <author-login>`);
3911
+ console.error(` Then retry: agent-mesh call ${agentInput} --task "..."`);
3912
+ } else {
3913
+ log.error(msg);
3914
+ }
3903
3915
  process.exit(1);
3904
3916
  }
3905
3917
  const contentType = res.headers.get("Content-Type") || "";
@@ -4164,6 +4176,80 @@ function printAgentStats(name, stats) {
4164
4176
  console.log("");
4165
4177
  }
4166
4178
 
4179
+ // src/commands/subscribe.ts
4180
+ var BASE_URL2 = "https://agents.hot";
4181
+ function handleError5(err) {
4182
+ if (err instanceof PlatformApiError) {
4183
+ log.error(err.message);
4184
+ } else {
4185
+ log.error(err.message);
4186
+ }
4187
+ process.exit(1);
4188
+ }
4189
+ async function resolveAuthorLogin(login) {
4190
+ const res = await fetch(`${BASE_URL2}/api/authors/resolve?login=${encodeURIComponent(login)}`);
4191
+ if (!res.ok) {
4192
+ if (res.status === 404) {
4193
+ throw new PlatformApiError(404, "not_found", `Author not found: ${login}`);
4194
+ }
4195
+ throw new PlatformApiError(res.status, "unknown", `Failed to resolve author: HTTP ${res.status}`);
4196
+ }
4197
+ return res.json();
4198
+ }
4199
+ function registerSubscribeCommand(program2) {
4200
+ program2.command("subscribe <author-login>").description("Subscribe to an author to access their private agents").action(async (authorLogin) => {
4201
+ try {
4202
+ const client = createClient();
4203
+ const author = await resolveAuthorLogin(authorLogin);
4204
+ await client.post(`/api/authors/${author.id}/subscribe`);
4205
+ log.success(`Subscribed to ${author.github_login}${author.name ? ` (${author.name})` : ""}`);
4206
+ } catch (err) {
4207
+ handleError5(err);
4208
+ }
4209
+ });
4210
+ program2.command("unsubscribe <author-login>").description("Unsubscribe from an author").action(async (authorLogin) => {
4211
+ try {
4212
+ const client = createClient();
4213
+ const author = await resolveAuthorLogin(authorLogin);
4214
+ await client.del(`/api/authors/${author.id}/subscribe`);
4215
+ log.success(`Unsubscribed from ${author.github_login}`);
4216
+ } catch (err) {
4217
+ handleError5(err);
4218
+ }
4219
+ });
4220
+ program2.command("subscriptions").description("List your author subscriptions").option("--json", "Output raw JSON").action(async (opts) => {
4221
+ try {
4222
+ const client = createClient();
4223
+ const data = await client.get("/api/user/subscriptions");
4224
+ if (opts.json) {
4225
+ console.log(JSON.stringify(data, null, 2));
4226
+ return;
4227
+ }
4228
+ if (data.subscriptions.length === 0) {
4229
+ console.log(" No subscriptions yet.");
4230
+ return;
4231
+ }
4232
+ const table = renderTable(
4233
+ [
4234
+ { key: "login", label: "AUTHOR", width: 24 },
4235
+ { key: "name", label: "NAME", width: 24 },
4236
+ { key: "since", label: "SINCE", width: 20 }
4237
+ ],
4238
+ data.subscriptions.map((s) => ({
4239
+ login: s.author.github_login,
4240
+ name: s.author.name || `${GRAY}\u2014${RESET}`,
4241
+ since: new Date(s.created_at).toLocaleDateString()
4242
+ }))
4243
+ );
4244
+ console.log(table);
4245
+ console.log(`
4246
+ ${GRAY}${data.subscriptions.length} subscription(s)${RESET}`);
4247
+ } catch (err) {
4248
+ handleError5(err);
4249
+ }
4250
+ });
4251
+ }
4252
+
4167
4253
  // src/index.ts
4168
4254
  var require2 = createRequire(import.meta.url);
4169
4255
  var { version } = require2("../package.json");
@@ -4190,4 +4276,5 @@ registerDiscoverCommand(program);
4190
4276
  registerCallCommand(program);
4191
4277
  registerConfigCommand(program);
4192
4278
  registerStatsCommand(program);
4279
+ registerSubscribeCommand(program);
4193
4280
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@annals/agent-mesh",
3
- "version": "0.13.1",
3
+ "version": "0.14.0",
4
4
  "description": "CLI bridge connecting local AI agents to the Agents.Hot platform",
5
5
  "type": "module",
6
6
  "bin": {