relayax-cli 0.3.54 → 0.3.55
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.
package/dist/mcp/server.js
CHANGED
|
@@ -52,6 +52,33 @@ function countFiles(dir) {
|
|
|
52
52
|
function jsonText(obj) {
|
|
53
53
|
return { type: 'text', text: JSON.stringify(obj) };
|
|
54
54
|
}
|
|
55
|
+
// 주요 도구 응답에 CLI 업데이트 경고를 병합하는 헬퍼
|
|
56
|
+
// MCP 서버 프로세스는 Claude 재시작 전까지 유지되므로, 응답에 버전 정보를 포함시켜
|
|
57
|
+
// 에이전트가 사용자에게 재시작을 안내할 수 있도록 한다.
|
|
58
|
+
let _cachedCliUpdate;
|
|
59
|
+
async function getCliUpdateWarning() {
|
|
60
|
+
if (_cachedCliUpdate === undefined) {
|
|
61
|
+
try {
|
|
62
|
+
const { checkCliVersion } = await import('../lib/version-check.js');
|
|
63
|
+
_cachedCliUpdate = await checkCliVersion(true);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
_cachedCliUpdate = null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (!_cachedCliUpdate)
|
|
70
|
+
return null;
|
|
71
|
+
return {
|
|
72
|
+
cli_update: {
|
|
73
|
+
current: pkg.version,
|
|
74
|
+
latest: _cachedCliUpdate.latest,
|
|
75
|
+
message: `relay v${_cachedCliUpdate.latest}이 있습니다. npm update -g relayax-cli 후 Claude를 재시작해주세요.`,
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
function jsonTextWithUpdate(obj, update) {
|
|
80
|
+
return jsonText(update ? { ...obj, ...update } : obj);
|
|
81
|
+
}
|
|
55
82
|
// ─── Server ───
|
|
56
83
|
function createMcpServer() {
|
|
57
84
|
const server = new mcp_js_1.McpServer({ name: 'relay', version: pkg.version }, { capabilities: { tools: {}, prompts: {} } });
|
|
@@ -97,7 +124,8 @@ function createMcpServer() {
|
|
|
97
124
|
(0, config_js_1.saveInstalled)(installed);
|
|
98
125
|
await (0, api_js_1.reportInstall)(agent.id, fullSlug, agent.version);
|
|
99
126
|
(0, api_js_1.sendUsagePing)(agent.id, fullSlug, agent.version);
|
|
100
|
-
|
|
127
|
+
const cliUpdate = await getCliUpdateWarning();
|
|
128
|
+
return { content: [jsonTextWithUpdate({ status: 'ok', agent: agent.name, slug: fullSlug, version: agent.version, files: countFiles(agentDir), install_path: agentDir }, cliUpdate)] };
|
|
101
129
|
}
|
|
102
130
|
finally {
|
|
103
131
|
(0, storage_js_1.removeTempDir)(tempDir);
|
|
@@ -264,7 +292,8 @@ function createMcpServer() {
|
|
|
264
292
|
cli_version: pkg.version,
|
|
265
293
|
};
|
|
266
294
|
const result = await publishToApi(token, tarPath, metadata);
|
|
267
|
-
|
|
295
|
+
const cliUpdate = await getCliUpdateWarning();
|
|
296
|
+
return { content: [jsonTextWithUpdate(result, cliUpdate)] };
|
|
268
297
|
}
|
|
269
298
|
finally {
|
|
270
299
|
fs_1.default.unlinkSync(tarPath);
|