relayax-cli 0.2.18 → 0.2.19

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.
@@ -75,7 +75,7 @@ function registerInstall(program) {
75
75
  };
76
76
  (0, config_js_1.saveInstalled)(installed);
77
77
  // 7. Report install (non-blocking)
78
- await (0, api_js_1.reportInstall)(slug);
78
+ await (0, api_js_1.reportInstall)(slug, team.version);
79
79
  const result = {
80
80
  status: 'ok',
81
81
  team: team.name,
package/dist/lib/api.d.ts CHANGED
@@ -7,12 +7,12 @@ export interface TeamVersionInfo {
7
7
  created_at: string;
8
8
  }
9
9
  export declare function fetchTeamVersions(slug: string): Promise<TeamVersionInfo[]>;
10
- export declare function reportInstall(slug: string): Promise<void>;
10
+ export declare function reportInstall(slug: string, version?: string): Promise<void>;
11
11
  export interface ResolvedSlug {
12
12
  owner: string;
13
13
  name: string;
14
14
  full: string;
15
15
  }
16
16
  export declare function resolveSlugFromServer(name: string): Promise<ResolvedSlug[]>;
17
- export declare function sendUsagePing(slug: string): Promise<void>;
17
+ export declare function sendUsagePing(slug: string, version?: string): Promise<void>;
18
18
  export declare function followBuilder(username: string): Promise<void>;
package/dist/lib/api.js CHANGED
@@ -41,10 +41,24 @@ async function fetchTeamVersions(slug) {
41
41
  }
42
42
  return res.json();
43
43
  }
44
- async function reportInstall(slug) {
44
+ async function reportInstall(slug, version) {
45
45
  const registrySlug = slug.startsWith('@') ? slug.slice(1) : slug;
46
46
  const url = `${config_js_1.API_URL}/api/registry/${registrySlug}/install`;
47
- await fetch(url, { method: 'POST' }).catch(() => {
47
+ const headers = {};
48
+ const body = {};
49
+ if (version) {
50
+ headers['Content-Type'] = 'application/json';
51
+ body.version = version;
52
+ }
53
+ const token = await (0, config_js_1.getValidToken)();
54
+ if (token) {
55
+ headers['Authorization'] = `Bearer ${token}`;
56
+ }
57
+ await fetch(url, {
58
+ method: 'POST',
59
+ headers: Object.keys(headers).length > 0 ? headers : undefined,
60
+ body: Object.keys(body).length > 0 ? JSON.stringify(body) : undefined,
61
+ }).catch(() => {
48
62
  // non-critical: ignore errors
49
63
  });
50
64
  }
@@ -57,7 +71,7 @@ async function resolveSlugFromServer(name) {
57
71
  const data = (await res.json());
58
72
  return data.results;
59
73
  }
60
- async function sendUsagePing(slug) {
74
+ async function sendUsagePing(slug, version) {
61
75
  const registrySlug = slug.startsWith('@') ? slug.slice(1) : slug;
62
76
  const { createHash } = await import('crypto');
63
77
  const { hostname, userInfo } = await import('os');
@@ -65,10 +79,17 @@ async function sendUsagePing(slug) {
65
79
  .update(`${hostname()}:${userInfo().username}`)
66
80
  .digest('hex');
67
81
  const url = `${config_js_1.API_URL}/api/registry/${registrySlug}/ping`;
82
+ const payload = { device_hash: deviceHash };
83
+ if (version)
84
+ payload.installed_version = version;
85
+ const headers = { 'Content-Type': 'application/json' };
86
+ const token = await (0, config_js_1.getValidToken)();
87
+ if (token)
88
+ headers['Authorization'] = `Bearer ${token}`;
68
89
  await fetch(url, {
69
90
  method: 'POST',
70
- headers: { 'Content-Type': 'application/json' },
71
- body: JSON.stringify({ device_hash: deviceHash }),
91
+ headers,
92
+ body: JSON.stringify(payload),
72
93
  }).catch(() => {
73
94
  // fire-and-forget: ignore errors
74
95
  });
@@ -43,7 +43,7 @@ async function checkTeamVersion(slug, force) {
43
43
  const team = await (0, api_js_1.fetchTeamInfo)(slug);
44
44
  (0, update_cache_js_1.updateCacheTimestamp)(slug);
45
45
  // Fire-and-forget usage ping (only when cache expired = actual API call happened)
46
- (0, api_js_1.sendUsagePing)(slug);
46
+ (0, api_js_1.sendUsagePing)(slug, entry.version);
47
47
  if (team.version !== entry.version) {
48
48
  return {
49
49
  type: 'team',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "relayax-cli",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
4
4
  "description": "RelayAX Agent Team Marketplace CLI - Install and manage agent teams",
5
5
  "main": "dist/index.js",
6
6
  "bin": {