relayax-cli 0.2.41 → 0.3.42

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 (62) hide show
  1. package/dist/commands/access.js +12 -12
  2. package/dist/commands/changelog.js +2 -2
  3. package/dist/commands/check-update.js +12 -12
  4. package/dist/commands/create.js +46 -19
  5. package/dist/commands/deploy-record.js +2 -2
  6. package/dist/commands/diff.d.ts +2 -0
  7. package/dist/commands/diff.js +72 -0
  8. package/dist/commands/grant.d.ts +33 -0
  9. package/dist/commands/grant.js +190 -0
  10. package/dist/commands/init.js +10 -10
  11. package/dist/commands/install.js +125 -256
  12. package/dist/commands/join.d.ts +3 -2
  13. package/dist/commands/join.js +18 -69
  14. package/dist/commands/list.js +23 -26
  15. package/dist/commands/login.js +10 -3
  16. package/dist/commands/orgs.d.ts +10 -0
  17. package/dist/commands/orgs.js +128 -0
  18. package/dist/commands/outdated.js +7 -7
  19. package/dist/commands/package.d.ts +18 -0
  20. package/dist/commands/package.js +355 -146
  21. package/dist/commands/ping.js +5 -5
  22. package/dist/commands/publish.d.ts +1 -1
  23. package/dist/commands/publish.js +105 -103
  24. package/dist/commands/search.js +2 -2
  25. package/dist/commands/status.js +11 -11
  26. package/dist/commands/uninstall.js +7 -7
  27. package/dist/commands/update.js +22 -22
  28. package/dist/commands/versions.d.ts +2 -0
  29. package/dist/commands/versions.js +44 -0
  30. package/dist/index.js +8 -2
  31. package/dist/lib/ai-tools.d.ts +15 -0
  32. package/dist/lib/ai-tools.js +48 -1
  33. package/dist/lib/api.d.ts +13 -12
  34. package/dist/lib/api.js +24 -39
  35. package/dist/lib/command-adapter.js +41 -693
  36. package/dist/lib/config.d.ts +10 -5
  37. package/dist/lib/config.js +106 -24
  38. package/dist/lib/guide.js +34 -79
  39. package/dist/lib/installer.d.ts +2 -2
  40. package/dist/lib/installer.js +4 -4
  41. package/dist/lib/preamble.d.ts +4 -4
  42. package/dist/lib/preamble.js +14 -15
  43. package/dist/lib/slug.d.ts +5 -1
  44. package/dist/lib/slug.js +52 -9
  45. package/dist/lib/update-cache.js +4 -4
  46. package/dist/lib/version-check.d.ts +3 -3
  47. package/dist/lib/version-check.js +13 -13
  48. package/dist/prompts/_business-card.md +41 -0
  49. package/dist/prompts/_error-handling.md +38 -0
  50. package/dist/prompts/_requirements-check.md +59 -0
  51. package/dist/prompts/_setup-cli.md +19 -0
  52. package/dist/prompts/_setup-login.md +7 -0
  53. package/dist/prompts/_setup-org.md +27 -0
  54. package/dist/prompts/business-card.md +41 -0
  55. package/dist/prompts/error-handling.md +38 -0
  56. package/dist/prompts/index.d.ts +7 -0
  57. package/dist/prompts/index.js +28 -0
  58. package/dist/prompts/install.md +187 -0
  59. package/dist/prompts/publish.md +444 -0
  60. package/dist/prompts/requirements-check.md +59 -0
  61. package/dist/types.d.ts +10 -10
  62. package/package.json +3 -3
@@ -11,9 +11,9 @@ const preamble_js_1 = require("../lib/preamble.js");
11
11
  function registerUpdate(program) {
12
12
  program
13
13
  .command('update <slug>')
14
- .description('설치된 에이전트 팀을 최신 버전으로 업데이트합니다')
14
+ .description('설치된 에이전트를 최신 버전으로 업데이트합니다')
15
15
  .option('--path <install_path>', '설치 경로 지정 (기본: ./.claude)')
16
- .option('--code <code>', '초대 코드 (비공개 업데이트 시 필요)')
16
+ .option('--code <code>', '초대 코드 (비공개 에이전트 업데이트 시 필요)')
17
17
  .action(async (slugInput, opts) => {
18
18
  const json = program.opts().json ?? false;
19
19
  const installPath = (0, config_js_1.getInstallPath)(opts.path);
@@ -32,9 +32,9 @@ function registerUpdate(program) {
32
32
  // Check installed.json for current version
33
33
  const currentEntry = installed[slug];
34
34
  const currentVersion = currentEntry?.version ?? null;
35
- // Fetch latest team metadata
36
- const team = await (0, api_js_1.fetchTeamInfo)(slug);
37
- const latestVersion = team.version;
35
+ // Fetch latest agent metadata
36
+ const agent = await (0, api_js_1.fetchAgentInfo)(slug);
37
+ const latestVersion = agent.version;
38
38
  if (currentVersion && currentVersion === latestVersion) {
39
39
  if (json) {
40
40
  console.log(JSON.stringify({ status: 'up-to-date', slug, version: latestVersion }));
@@ -45,29 +45,29 @@ function registerUpdate(program) {
45
45
  return;
46
46
  }
47
47
  // Visibility check
48
- const visibility = team.visibility ?? 'public';
49
- if (visibility === 'private') {
48
+ const visibility = agent.visibility ?? 'public';
49
+ if (visibility === 'internal') {
50
50
  const token = await (0, config_js_1.getValidToken)();
51
51
  if (!token) {
52
- console.error('이 팀은 Space 멤버만 업데이트할 수 있습니다. `relay login`을 먼저 실행하세요.');
52
+ console.error('이 에이전트는 Org 멤버만 업데이트할 수 있습니다. `relay login`을 먼저 실행하세요.');
53
53
  process.exit(1);
54
54
  }
55
55
  }
56
56
  // Download package
57
- const tarPath = await (0, storage_js_1.downloadPackage)(team.package_url, tempDir);
57
+ const tarPath = await (0, storage_js_1.downloadPackage)(agent.package_url, tempDir);
58
58
  // Extract
59
59
  const extractDir = `${tempDir}/extracted`;
60
60
  await (0, storage_js_1.extractPackage)(tarPath, extractDir);
61
61
  // Inject preamble (update check) before copying
62
- (0, preamble_js_1.injectPreambleToTeam)(extractDir, slug);
62
+ (0, preamble_js_1.injectPreambleToAgent)(extractDir, slug);
63
63
  // Copy files to install_path
64
- const files = (0, installer_js_1.installTeam)(extractDir, installPath);
64
+ const files = (0, installer_js_1.installAgent)(extractDir, installPath);
65
65
  // Preserve deploy info but clear deployed_files (agent needs to re-deploy)
66
66
  const previousDeployScope = currentEntry?.deploy_scope;
67
67
  const hadDeployedFiles = (currentEntry?.deployed_files?.length ?? 0) > 0;
68
68
  // Update installed.json with new version
69
69
  installed[slug] = {
70
- team_id: team.id,
70
+ agent_id: agent.id,
71
71
  version: latestVersion,
72
72
  installed_at: new Date().toISOString(),
73
73
  files,
@@ -76,8 +76,8 @@ function registerUpdate(program) {
76
76
  // Clear deployed_files — agent must re-deploy and call deploy-record
77
77
  };
78
78
  (0, config_js_1.saveInstalled)(installed);
79
- // Report install (non-blocking, team_id 기반)
80
- await (0, api_js_1.reportInstall)(team.id, slug, latestVersion);
79
+ // Report install (non-blocking, agent_id 기반)
80
+ await (0, api_js_1.reportInstall)(agent.id, slug, latestVersion);
81
81
  const result = {
82
82
  status: 'updated',
83
83
  slug,
@@ -92,17 +92,17 @@ function registerUpdate(program) {
92
92
  }
93
93
  else {
94
94
  const fromLabel = currentVersion ? `v${currentVersion} → ` : '';
95
- console.log(`\n\x1b[32m✓ ${team.name} ${fromLabel}v${latestVersion} 업데이트 완료\x1b[0m`);
95
+ console.log(`\n\x1b[32m✓ ${agent.name} ${fromLabel}v${latestVersion} 업데이트 완료\x1b[0m`);
96
96
  console.log(` 설치 위치: \x1b[36m${installPath}\x1b[0m`);
97
97
  console.log(` 파일 수: ${files.length}개`);
98
98
  // Builder business card
99
- const authorUsername = team.author?.username;
100
- const authorDisplayName = team.author?.display_name ?? authorUsername ?? '';
101
- const contactParts = (0, contact_format_js_1.formatContactParts)(team.author?.contact_links);
102
- const hasCard = team.welcome || contactParts.length > 0 || authorUsername;
99
+ const authorUsername = agent.author?.username;
100
+ const authorDisplayName = agent.author?.display_name ?? authorUsername ?? '';
101
+ const contactParts = (0, contact_format_js_1.formatContactParts)(agent.author?.contact_links);
102
+ const hasCard = agent.welcome || contactParts.length > 0 || authorUsername;
103
103
  // Show changelog for this version
104
104
  try {
105
- const versions = await (0, api_js_1.fetchTeamVersions)(slug);
105
+ const versions = await (0, api_js_1.fetchAgentVersions)(slug);
106
106
  const thisVersion = versions.find((v) => v.version === latestVersion);
107
107
  if (thisVersion?.changelog) {
108
108
  console.log(`\n \x1b[90m── Changelog ──────────────────────────────\x1b[0m`);
@@ -117,8 +117,8 @@ function registerUpdate(program) {
117
117
  }
118
118
  if (hasCard) {
119
119
  console.log(`\n \x1b[90m┌─ ${authorDisplayName || '빌더'}의 명함 ${'─'.repeat(Math.max(0, 34 - (authorDisplayName || '빌더').length))}┐\x1b[0m`);
120
- if (team.welcome) {
121
- const truncated = team.welcome.length > 45 ? team.welcome.slice(0, 45) + '...' : team.welcome;
120
+ if (agent.welcome) {
121
+ const truncated = agent.welcome.length > 45 ? agent.welcome.slice(0, 45) + '...' : agent.welcome;
122
122
  console.log(` \x1b[90m│\x1b[0m 💬 "${truncated}"`);
123
123
  }
124
124
  if (contactParts.length > 0) {
@@ -0,0 +1,2 @@
1
+ import { Command } from 'commander';
2
+ export declare function registerVersions(program: Command): void;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerVersions = registerVersions;
4
+ const api_js_1 = require("../lib/api.js");
5
+ const slug_js_1 = require("../lib/slug.js");
6
+ function registerVersions(program) {
7
+ program
8
+ .command('versions <slug>')
9
+ .description('에이전트 버전 목록과 릴리즈 노트를 확인합니다')
10
+ .action(async (slugInput) => {
11
+ const json = program.opts().json ?? false;
12
+ try {
13
+ const resolved = await (0, slug_js_1.resolveSlug)(slugInput);
14
+ const versions = await (0, api_js_1.fetchAgentVersions)(resolved.full);
15
+ if (json) {
16
+ console.log(JSON.stringify({ slug: resolved.full, versions }));
17
+ return;
18
+ }
19
+ if (versions.length === 0) {
20
+ console.log(`\n${resolved.full} 버전 이력이 없습니다.`);
21
+ return;
22
+ }
23
+ console.log(`\n\x1b[1m${resolved.full} 버전 이력\x1b[0m (${versions.length}개):\n`);
24
+ for (const v of versions) {
25
+ const date = new Date(v.created_at).toLocaleDateString('ko-KR');
26
+ console.log(` \x1b[36mv${v.version}\x1b[0m (${date})`);
27
+ if (v.changelog) {
28
+ console.log(` \x1b[90m${v.changelog}\x1b[0m`);
29
+ }
30
+ }
31
+ console.log(`\n\x1b[33m 특정 버전 설치: relay install ${resolved.full}@<version>\x1b[0m`);
32
+ }
33
+ catch (err) {
34
+ const message = err instanceof Error ? err.message : String(err);
35
+ if (json) {
36
+ console.error(JSON.stringify({ error: 'VERSIONS_FAILED', message }));
37
+ }
38
+ else {
39
+ console.error(`\x1b[31m오류: ${message}\x1b[0m`);
40
+ }
41
+ process.exit(1);
42
+ }
43
+ });
44
+ }
package/dist/index.js CHANGED
@@ -18,10 +18,13 @@ const check_update_js_1 = require("./commands/check-update.js");
18
18
  const follow_js_1 = require("./commands/follow.js");
19
19
  const changelog_js_1 = require("./commands/changelog.js");
20
20
  const join_js_1 = require("./commands/join.js");
21
- const spaces_js_1 = require("./commands/spaces.js");
21
+ const orgs_js_1 = require("./commands/orgs.js");
22
22
  const deploy_record_js_1 = require("./commands/deploy-record.js");
23
23
  const ping_js_1 = require("./commands/ping.js");
24
24
  const access_js_1 = require("./commands/access.js");
25
+ const grant_js_1 = require("./commands/grant.js");
26
+ const versions_js_1 = require("./commands/versions.js");
27
+ const diff_js_1 = require("./commands/diff.js");
25
28
  // eslint-disable-next-line @typescript-eslint/no-var-requires
26
29
  const pkg = require('../package.json');
27
30
  const program = new commander_1.Command();
@@ -46,8 +49,11 @@ program
46
49
  (0, follow_js_1.registerFollow)(program);
47
50
  (0, changelog_js_1.registerChangelog)(program);
48
51
  (0, join_js_1.registerJoin)(program);
49
- (0, spaces_js_1.registerSpaces)(program);
52
+ (0, orgs_js_1.registerOrgs)(program);
50
53
  (0, deploy_record_js_1.registerDeployRecord)(program);
51
54
  (0, ping_js_1.registerPing)(program);
52
55
  (0, access_js_1.registerAccess)(program);
56
+ (0, grant_js_1.registerGrant)(program);
57
+ (0, versions_js_1.registerVersions)(program);
58
+ (0, diff_js_1.registerDiff)(program);
53
59
  program.parse();
@@ -17,3 +17,18 @@ export declare function detectAgentCLIs(projectPath: string): AITool[];
17
17
  * ~/{skillsDir}/ 가 존재하는 CLI를 반환.
18
18
  */
19
19
  export declare function detectGlobalCLIs(): AITool[];
20
+ export type ContentType = 'skill' | 'agent' | 'command' | 'rule';
21
+ export interface ContentItem {
22
+ name: string;
23
+ type: ContentType;
24
+ /** 소스 디렉토리 기준 상대 경로 (예: skills/code-review) */
25
+ relativePath: string;
26
+ }
27
+ /**
28
+ * 프로젝트 로컬 소스의 개별 스킬/에이전트/커맨드/룰 항목을 반환한다.
29
+ */
30
+ export declare function scanLocalItems(projectPath: string, tool: AITool): ContentItem[];
31
+ /**
32
+ * 글로벌 홈 디렉토리 소스의 개별 스킬/에이전트/커맨드/룰 항목을 반환한다.
33
+ */
34
+ export declare function scanGlobalItems(tool: AITool): ContentItem[];
@@ -6,6 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.AI_TOOLS = void 0;
7
7
  exports.detectAgentCLIs = detectAgentCLIs;
8
8
  exports.detectGlobalCLIs = detectGlobalCLIs;
9
+ exports.scanLocalItems = scanLocalItems;
10
+ exports.scanGlobalItems = scanGlobalItems;
9
11
  const fs_1 = __importDefault(require("fs"));
10
12
  const os_1 = __importDefault(require("os"));
11
13
  const path_1 = __importDefault(require("path"));
@@ -50,6 +52,51 @@ function detectAgentCLIs(projectPath) {
50
52
  * ~/{skillsDir}/ 가 존재하는 CLI를 반환.
51
53
  */
52
54
  function detectGlobalCLIs() {
53
- const home = path_1.default.join(os_1.default.homedir());
55
+ const home = os_1.default.homedir();
54
56
  return exports.AI_TOOLS.filter((tool) => fs_1.default.existsSync(path_1.default.join(home, tool.skillsDir)));
55
57
  }
58
+ const CONTENT_DIRS = [
59
+ { dir: 'skills', type: 'skill' },
60
+ { dir: 'agents', type: 'agent' },
61
+ { dir: 'commands', type: 'command' },
62
+ { dir: 'rules', type: 'rule' },
63
+ ];
64
+ const EXCLUDE_SUBDIRS = ['relay'];
65
+ /**
66
+ * 소스 디렉토리(basePath) 안의 skills/, agents/, commands/, rules/에서
67
+ * 개별 항목을 스캔하여 반환한다.
68
+ */
69
+ function scanItemsIn(basePath) {
70
+ const items = [];
71
+ for (const { dir, type } of CONTENT_DIRS) {
72
+ const fullDir = path_1.default.join(basePath, dir);
73
+ if (!fs_1.default.existsSync(fullDir))
74
+ continue;
75
+ for (const entry of fs_1.default.readdirSync(fullDir, { withFileTypes: true })) {
76
+ if (entry.name.startsWith('.'))
77
+ continue;
78
+ if (entry.isDirectory() && EXCLUDE_SUBDIRS.includes(entry.name))
79
+ continue;
80
+ items.push({
81
+ name: entry.name.replace(/\.\w+$/, ''), // 파일이면 확장자 제거
82
+ type,
83
+ relativePath: path_1.default.join(dir, entry.name),
84
+ });
85
+ }
86
+ }
87
+ return items;
88
+ }
89
+ /**
90
+ * 프로젝트 로컬 소스의 개별 스킬/에이전트/커맨드/룰 항목을 반환한다.
91
+ */
92
+ function scanLocalItems(projectPath, tool) {
93
+ const basePath = path_1.default.join(projectPath, tool.skillsDir);
94
+ return scanItemsIn(basePath);
95
+ }
96
+ /**
97
+ * 글로벌 홈 디렉토리 소스의 개별 스킬/에이전트/커맨드/룰 항목을 반환한다.
98
+ */
99
+ function scanGlobalItems(tool) {
100
+ const basePath = path_1.default.join(os_1.default.homedir(), tool.skillsDir);
101
+ return scanItemsIn(basePath);
102
+ }
package/dist/lib/api.d.ts CHANGED
@@ -1,23 +1,24 @@
1
- import type { TeamRegistryInfo, SearchResult } from '../types.js';
2
- export declare function fetchTeamInfo(slug: string): Promise<TeamRegistryInfo>;
3
- export declare function searchTeams(query: string, tag?: string, space?: string): Promise<SearchResult[]>;
4
- export interface TeamVersionInfo {
1
+ import type { AgentRegistryInfo, SearchResult } from '../types.js';
2
+ export declare function fetchMyOrgs(): Promise<{
3
+ id: string;
4
+ slug: string;
5
+ name: string;
6
+ role: string;
7
+ }[]>;
8
+ export declare function fetchAgentInfo(slug: string): Promise<AgentRegistryInfo>;
9
+ export declare function searchAgents(query: string, tag?: string): Promise<SearchResult[]>;
10
+ export interface AgentVersionInfo {
5
11
  version: string;
6
12
  changelog: string | null;
7
13
  created_at: string;
8
14
  }
9
- export declare function fetchTeamVersions(slug: string): Promise<TeamVersionInfo[]>;
10
- export declare function reportInstall(teamId: string, slug: string, version?: string): Promise<void>;
11
- /**
12
- * Space 팀 설치: 멤버십 검증 + install count 증가 + 팀 메타데이터 반환을 한 번에 처리.
13
- * POST /api/spaces/{spaceSlug}/teams/{teamSlug}/install
14
- */
15
- export declare function installSpaceTeam(spaceSlug: string, teamSlug: string, version?: string): Promise<TeamRegistryInfo>;
15
+ export declare function fetchAgentVersions(slug: string): Promise<AgentVersionInfo[]>;
16
+ export declare function reportInstall(agentId: string, slug: string, version?: string): Promise<void>;
16
17
  export interface ResolvedSlug {
17
18
  owner: string;
18
19
  name: string;
19
20
  full: string;
20
21
  }
21
22
  export declare function resolveSlugFromServer(name: string): Promise<ResolvedSlug[]>;
22
- export declare function sendUsagePing(teamId: string, slug: string, version?: string): Promise<void>;
23
+ export declare function sendUsagePing(agentId: string, slug: string, version?: string): Promise<void>;
23
24
  export declare function followBuilder(username: string): Promise<void>;
package/dist/lib/api.js CHANGED
@@ -1,30 +1,40 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchTeamInfo = fetchTeamInfo;
4
- exports.searchTeams = searchTeams;
5
- exports.fetchTeamVersions = fetchTeamVersions;
3
+ exports.fetchMyOrgs = fetchMyOrgs;
4
+ exports.fetchAgentInfo = fetchAgentInfo;
5
+ exports.searchAgents = searchAgents;
6
+ exports.fetchAgentVersions = fetchAgentVersions;
6
7
  exports.reportInstall = reportInstall;
7
- exports.installSpaceTeam = installSpaceTeam;
8
8
  exports.resolveSlugFromServer = resolveSlugFromServer;
9
9
  exports.sendUsagePing = sendUsagePing;
10
10
  exports.followBuilder = followBuilder;
11
11
  const config_js_1 = require("./config.js");
12
- async function fetchTeamInfo(slug) {
12
+ async function fetchMyOrgs() {
13
+ const token = await (0, config_js_1.getValidToken)();
14
+ if (!token)
15
+ return [];
16
+ const res = await fetch(`${config_js_1.API_URL}/api/orgs`, {
17
+ headers: { Authorization: `Bearer ${token}` },
18
+ signal: AbortSignal.timeout(8000),
19
+ });
20
+ if (!res.ok)
21
+ return [];
22
+ return res.json();
23
+ }
24
+ async function fetchAgentInfo(slug) {
13
25
  const registrySlug = slug.startsWith('@') ? slug.slice(1) : slug;
14
26
  const url = `${config_js_1.API_URL}/api/registry/${registrySlug}`;
15
27
  const res = await fetch(url);
16
28
  if (!res.ok) {
17
29
  const body = await res.text();
18
- throw new Error(`팀 정보 조회 실패 (${res.status}): ${body}`);
30
+ throw new Error(`에이전트 정보 조회 실패 (${res.status}): ${body}`);
19
31
  }
20
32
  return res.json();
21
33
  }
22
- async function searchTeams(query, tag, space) {
34
+ async function searchAgents(query, tag) {
23
35
  const params = new URLSearchParams({ q: query });
24
36
  if (tag)
25
37
  params.set('tag', tag);
26
- if (space)
27
- params.set('space', space);
28
38
  const url = `${config_js_1.API_URL}/api/registry/search?${params.toString()}`;
29
39
  const res = await fetch(url);
30
40
  if (!res.ok) {
@@ -34,7 +44,7 @@ async function searchTeams(query, tag, space) {
34
44
  const data = (await res.json());
35
45
  return data.results;
36
46
  }
37
- async function fetchTeamVersions(slug) {
47
+ async function fetchAgentVersions(slug) {
38
48
  const registrySlug = slug.startsWith('@') ? slug.slice(1) : slug;
39
49
  const url = `${config_js_1.API_URL}/api/registry/${registrySlug}/versions`;
40
50
  const res = await fetch(url);
@@ -44,8 +54,8 @@ async function fetchTeamVersions(slug) {
44
54
  }
45
55
  return res.json();
46
56
  }
47
- async function reportInstall(teamId, slug, version) {
48
- const url = `${config_js_1.API_URL}/api/teams/${teamId}/install`;
57
+ async function reportInstall(agentId, slug, version) {
58
+ const url = `${config_js_1.API_URL}/api/agents/${agentId}/install`;
49
59
  const headers = { 'Content-Type': 'application/json' };
50
60
  const body = { slug };
51
61
  if (version)
@@ -69,31 +79,6 @@ async function reportInstall(teamId, slug, version) {
69
79
  // network error: ignore silently
70
80
  }
71
81
  }
72
- /**
73
- * Space 팀 설치: 멤버십 검증 + install count 증가 + 팀 메타데이터 반환을 한 번에 처리.
74
- * POST /api/spaces/{spaceSlug}/teams/{teamSlug}/install
75
- */
76
- async function installSpaceTeam(spaceSlug, teamSlug, version) {
77
- const url = `${config_js_1.API_URL}/api/spaces/${spaceSlug}/teams/${teamSlug}/install`;
78
- const headers = { 'Content-Type': 'application/json' };
79
- const token = await (0, config_js_1.getValidToken)();
80
- if (token) {
81
- headers['Authorization'] = `Bearer ${token}`;
82
- }
83
- const body = {};
84
- if (version)
85
- body.version = version;
86
- const res = await fetch(url, {
87
- method: 'POST',
88
- headers,
89
- body: JSON.stringify(body),
90
- });
91
- if (!res.ok) {
92
- const text = await res.text();
93
- throw new Error(`Space 팀 설치 실패 (${res.status}): ${text}`);
94
- }
95
- return res.json();
96
- }
97
82
  async function resolveSlugFromServer(name) {
98
83
  const url = `${config_js_1.API_URL}/api/registry/resolve?name=${encodeURIComponent(name)}`;
99
84
  const res = await fetch(url, { signal: AbortSignal.timeout(5000) });
@@ -103,13 +88,13 @@ async function resolveSlugFromServer(name) {
103
88
  const data = (await res.json());
104
89
  return data.results;
105
90
  }
106
- async function sendUsagePing(teamId, slug, version) {
91
+ async function sendUsagePing(agentId, slug, version) {
107
92
  const { createHash } = await import('crypto');
108
93
  const { hostname, userInfo } = await import('os');
109
94
  const deviceHash = createHash('sha256')
110
95
  .update(`${hostname()}:${userInfo().username}`)
111
96
  .digest('hex');
112
- const url = `${config_js_1.API_URL}/api/teams/${teamId}/ping`;
97
+ const url = `${config_js_1.API_URL}/api/agents/${agentId}/ping`;
113
98
  const payload = { device_hash: deviceHash, slug };
114
99
  if (version)
115
100
  payload.installed_version = version;