@uwa4d/openapi-mcp 0.2.0-beta.11 → 0.2.0-beta.13
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/cli.js +3 -3
- package/dist/composite/index.js +2 -0
- package/dist/composite/mcp-version.d.ts +2 -0
- package/dist/composite/mcp-version.js +46 -0
- package/dist/package-version.d.ts +2 -0
- package/dist/package-version.js +15 -0
- package/dist/presets.js +1 -0
- package/dist/server-instructions.js +1 -0
- package/dist/server.d.ts +3 -2
- package/dist/server.js +20 -18
- package/dist/version-check.d.ts +29 -2
- package/dist/version-check.js +76 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ import { compositeFilterKeys, selectCompositeTools, COMPOSITE_TOOLS } from './co
|
|
|
6
6
|
import { filterKeys, selectOperations } from './presets.js';
|
|
7
7
|
import { DEFAULT_MAX_CHARS, DEFAULT_MAX_ROWS, toolName } from './tools.js';
|
|
8
8
|
import { PACKAGE_VERSION, startStdio } from './server.js';
|
|
9
|
-
import { checkForUpdate,
|
|
9
|
+
import { checkForUpdate, describeReleaseChannel, formatUpdateNotice } from './version-check.js';
|
|
10
10
|
const DEFAULT_BASE_URL = 'https://secure-api.uwa4d.com';
|
|
11
11
|
const SANDBOX_BASE_URL = 'https://sandbox-api.uwa4d.com';
|
|
12
12
|
function splitList(value) {
|
|
@@ -134,14 +134,14 @@ program
|
|
|
134
134
|
console.log('\n凭证有效,接口连通。');
|
|
135
135
|
if (typeof total === 'number')
|
|
136
136
|
console.log(`最近 7 天有 ${total} 份报告。`);
|
|
137
|
-
console.log(`\nMCP 包版本:${PACKAGE_VERSION}(${
|
|
137
|
+
console.log(`\nMCP 包版本:${PACKAGE_VERSION}(${describeReleaseChannel(PACKAGE_VERSION).releaseLabel})`);
|
|
138
138
|
if (process.env['UWA_MCP_SKIP_UPDATE_CHECK'] !== '1') {
|
|
139
139
|
const update = await checkForUpdate(PACKAGE_VERSION);
|
|
140
140
|
if (update) {
|
|
141
141
|
console.log(formatUpdateNotice(update));
|
|
142
142
|
}
|
|
143
143
|
else {
|
|
144
|
-
console.log('
|
|
144
|
+
console.log('已是最新同 release 线版本(或暂时无法连接 npm registry)。');
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
console.log('\n可以按 README 配置 MCP 客户端了。');
|
package/dist/composite/index.js
CHANGED
|
@@ -2,8 +2,10 @@ import { toolName } from '../tools.js';
|
|
|
2
2
|
import { topResourcesTool } from './top-resources.js';
|
|
3
3
|
import { topFunctionsTool } from './top-functions.js';
|
|
4
4
|
import { reportDiagnosisTool } from './report-diagnosis.js';
|
|
5
|
+
import { mcpVersionTool } from './mcp-version.js';
|
|
5
6
|
/** 全部手写复合工具(不进 uwa-openapi.json)。 */
|
|
6
7
|
export const COMPOSITE_TOOLS = [
|
|
8
|
+
mcpVersionTool,
|
|
7
9
|
topResourcesTool,
|
|
8
10
|
topFunctionsTool,
|
|
9
11
|
reportDiagnosisTool,
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { PACKAGE_VERSION } from '../package-version.js';
|
|
2
|
+
import { buildMcpVersionInfo, describeReleaseChannel } from '../version-check.js';
|
|
3
|
+
import { errorResult, jsonToolResult } from './helpers.js';
|
|
4
|
+
const release = describeReleaseChannel(PACKAGE_VERSION);
|
|
5
|
+
const STABLE_DESCRIPTION = [
|
|
6
|
+
'查询当前 UWA OpenAPI MCP 正式版版本,并与 npm 最新稳定版对比(仅正式版↔正式版,不与内部测试版交叉)。',
|
|
7
|
+
'适用:Unity / UE|复合工具|无需 dataKey',
|
|
8
|
+
'若 updateAvailable=true,请用 userNotice 主动转告客户重启 MCP 升级。',
|
|
9
|
+
'用户问「MCP 什么版本」「有没有新版本」时优先调用本工具,不要臆测版本号。',
|
|
10
|
+
].join('\n');
|
|
11
|
+
const INTERNAL_DESCRIPTION = [
|
|
12
|
+
'查询当前 UWA OpenAPI MCP 内部测试版版本,并与 npm @beta 最新测试版对比(仅测试↔测试,不与正式版交叉)。',
|
|
13
|
+
'适用:Unity / UE|复合工具|无需 dataKey|仅 UWA 内部 sandbox 联调',
|
|
14
|
+
'若 updateAvailable=true,请用 userNotice 主动转告测试人员重启 MCP 升级。',
|
|
15
|
+
'用户问「MCP 什么版本」「有没有新版本」时优先调用本工具,不要臆测版本号。',
|
|
16
|
+
].join('\n');
|
|
17
|
+
export const mcpVersionTool = {
|
|
18
|
+
id: 'uwa_mcp_version',
|
|
19
|
+
title: release.releaseLine === 'stable' ? 'MCP 正式版与升级提示' : 'MCP 内部测试版与升级提示',
|
|
20
|
+
engines: ['unity', 'unreal'],
|
|
21
|
+
filterKeys: ['uwa_mcp_version', 'composite', 'preset.default', 'common'],
|
|
22
|
+
description: release.releaseLine === 'stable' ? STABLE_DESCRIPTION : INTERNAL_DESCRIPTION,
|
|
23
|
+
inputSchema: {},
|
|
24
|
+
async handler(_args, ctx) {
|
|
25
|
+
try {
|
|
26
|
+
if (process.env['UWA_MCP_SKIP_UPDATE_CHECK'] === '1') {
|
|
27
|
+
return jsonToolResult({
|
|
28
|
+
package: '@uwa4d/openapi-mcp',
|
|
29
|
+
currentVersion: PACKAGE_VERSION,
|
|
30
|
+
releaseLine: release.releaseLine,
|
|
31
|
+
releaseLabel: release.releaseLabel,
|
|
32
|
+
updateCheckSkipped: true,
|
|
33
|
+
userNotice: `当前 MCP ${release.releaseLabel} ${PACKAGE_VERSION}(已设置 UWA_MCP_SKIP_UPDATE_CHECK,未核对 npm 最新版)。`,
|
|
34
|
+
}, ctx.maxChars);
|
|
35
|
+
}
|
|
36
|
+
const info = await buildMcpVersionInfo(PACKAGE_VERSION);
|
|
37
|
+
return jsonToolResult({
|
|
38
|
+
...info,
|
|
39
|
+
suggestTellUser: info.updateAvailable,
|
|
40
|
+
}, ctx.maxChars);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
return errorResult(err);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
function readPackageVersion() {
|
|
5
|
+
try {
|
|
6
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
const pkg = JSON.parse(readFileSync(join(here, '..', 'package.json'), 'utf8'));
|
|
8
|
+
return pkg.version ?? '0.0.0';
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return '0.0.0';
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
/** 与 package.json 同步,避免 MCP 握手版本和 npm 包不一致。 */
|
|
15
|
+
export const PACKAGE_VERSION = readPackageVersion();
|
package/dist/presets.js
CHANGED
|
@@ -12,6 +12,7 @@ export const SERVER_INSTRUCTIONS = [
|
|
|
12
12
|
'5. 非法面板名要纠正(fps_mean→fps_avg;android_pss_max→android_memory_pss@max);数值带单位。PSS 优先读 pss_peak_kb/mb/frame。',
|
|
13
13
|
'6. 接口失败时说明原因:运行日志 80108 — Unity 无 LG file_meta 表示未解析、无可用日志;UE 无 meta 只能说「暂不支持获取当前报告的运行日志」(方案切换过),勿断定报告本身无日志。其它失败勿把瞬时错误说成「一定没有数据」。',
|
|
14
14
|
'7. 接口限流 31004(API_RATE_LIMIT):UWA 服务端保护,预期行为,不是 Bug。稍等重试或减少并行/批量(如 top_resources 缩小 assetTypes)。若返回含 _partialErrors 且 _rateLimitHint,部分类型限流时已有 Top 仍可用,需说明可能不完整,勿当成报告无资源。',
|
|
15
|
+
'8. MCP 版本:用户问版本或升级时调用 uwa_mcp_version(正式版只对比正式版最新稳定版,内部测试版只对比测试版,互不交叉)。若 instructions 含「MCP 正式版/内部测试版有新版本」,必须用 userNotice 主动转告并说明重启 MCP 升级。',
|
|
15
16
|
'',
|
|
16
17
|
'体检优先调用 report_diagnosis;细节再按 _apisUsed 深挖。对比多份报告时说明场景/时长/目标帧是否可比(见 comparability_note)。',
|
|
17
18
|
].join('\n');
|
package/dist/server.d.ts
CHANGED
|
@@ -16,9 +16,10 @@ export interface ServerOptions {
|
|
|
16
16
|
maxChars: number;
|
|
17
17
|
timeoutMs: number;
|
|
18
18
|
specPath?: string;
|
|
19
|
+
/** 覆盖默认 server instructions(用于启动时注入版本升级提醒)。 */
|
|
20
|
+
instructions?: string;
|
|
19
21
|
}
|
|
20
|
-
|
|
21
|
-
export declare const PACKAGE_VERSION: string;
|
|
22
|
+
export { PACKAGE_VERSION } from './package-version.js';
|
|
22
23
|
export declare function createServer(opts: ServerOptions): {
|
|
23
24
|
server: McpServer;
|
|
24
25
|
toolCount: number;
|
package/dist/server.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
2
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
6
3
|
import { UwaClient } from './client.js';
|
|
@@ -9,19 +6,9 @@ import { selectOperations } from './presets.js';
|
|
|
9
6
|
import { loadSpec } from './spec.js';
|
|
10
7
|
import { makeHandler, toolConfig, toolName } from './tools.js';
|
|
11
8
|
import { SERVER_INSTRUCTIONS } from './server-instructions.js';
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
16
|
-
const pkg = JSON.parse(readFileSync(join(here, '..', 'package.json'), 'utf8'));
|
|
17
|
-
return pkg.version ?? '0.0.0';
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
return '0.0.0';
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/** 与 package.json 同步,避免 MCP 握手版本和 npm 包不一致。 */
|
|
24
|
-
export const PACKAGE_VERSION = readPackageVersion();
|
|
9
|
+
import { PACKAGE_VERSION } from './package-version.js';
|
|
10
|
+
import { buildMcpVersionInfo, buildUpdateInstructionAppendix, scheduleUpdateNotice, } from './version-check.js';
|
|
11
|
+
export { PACKAGE_VERSION } from './package-version.js';
|
|
25
12
|
export function createServer(opts) {
|
|
26
13
|
const spec = loadSpec(opts.specPath);
|
|
27
14
|
const operations = selectOperations(spec.operations, { tools: opts.tools, engine: opts.engine });
|
|
@@ -30,7 +17,7 @@ export function createServer(opts) {
|
|
|
30
17
|
credentials: { appId: opts.appId, appSecret: opts.appSecret },
|
|
31
18
|
timeoutMs: opts.timeoutMs,
|
|
32
19
|
});
|
|
33
|
-
const server = new McpServer({ name: 'uwa-openapi-mcp', version: PACKAGE_VERSION }, { instructions: SERVER_INSTRUCTIONS });
|
|
20
|
+
const server = new McpServer({ name: 'uwa-openapi-mcp', version: PACKAGE_VERSION }, { instructions: opts.instructions ?? SERVER_INSTRUCTIONS });
|
|
34
21
|
for (const op of operations) {
|
|
35
22
|
server.registerTool(toolName(op.id, opts.nameCase, opts.namePrefix), toolConfig(op), makeHandler(op, client, opts.maxRows, opts.maxChars));
|
|
36
23
|
}
|
|
@@ -46,7 +33,22 @@ export function createServer(opts) {
|
|
|
46
33
|
return { server, toolCount, total, atomicCount: operations.length, compositeCount };
|
|
47
34
|
}
|
|
48
35
|
export async function startStdio(opts) {
|
|
49
|
-
|
|
36
|
+
let instructions = SERVER_INSTRUCTIONS;
|
|
37
|
+
if (process.env['UWA_MCP_SKIP_UPDATE_CHECK'] !== '1') {
|
|
38
|
+
try {
|
|
39
|
+
const info = await buildMcpVersionInfo(PACKAGE_VERSION);
|
|
40
|
+
const appendix = buildUpdateInstructionAppendix(info);
|
|
41
|
+
if (appendix)
|
|
42
|
+
instructions = `${SERVER_INSTRUCTIONS}\n\n${appendix}`;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
/* 版本检查失败不阻塞启动 */
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
const { server, toolCount, total, atomicCount, compositeCount } = createServer({
|
|
49
|
+
...opts,
|
|
50
|
+
instructions,
|
|
51
|
+
});
|
|
50
52
|
// stdout 是 MCP 协议通道,任何日志都必须走 stderr
|
|
51
53
|
console.error(`[uwa-openapi-mcp] v${PACKAGE_VERSION} 已加载 ${toolCount}/${total} 个工具(原子 ${atomicCount} + 复合 ${compositeCount}),接口地址 ${opts.baseUrl}`);
|
|
52
54
|
scheduleUpdateNotice(PACKAGE_VERSION);
|
package/dist/version-check.d.ts
CHANGED
|
@@ -3,12 +3,39 @@ export declare const PACKAGE_NAME = "@uwa4d/openapi-mcp";
|
|
|
3
3
|
export interface UpdateCheckResult {
|
|
4
4
|
current: string;
|
|
5
5
|
latest: string;
|
|
6
|
-
|
|
6
|
+
/** npm dist-tag,仅作逻辑区分 */
|
|
7
|
+
registryTag: 'beta' | 'latest';
|
|
7
8
|
}
|
|
8
|
-
/**
|
|
9
|
+
/** uwa_mcp_version 工具与启动 instructions 用的结构化版本信息。 */
|
|
10
|
+
export interface McpVersionInfo {
|
|
11
|
+
package: string;
|
|
12
|
+
currentVersion: string;
|
|
13
|
+
/** stable=正式版(客户) / internal=内部测试版;与 npm dist-tag 一一对应,互不交叉比对 */
|
|
14
|
+
releaseLine: 'stable' | 'internal';
|
|
15
|
+
/** 对用户/模型可见的通道名,正式版不说 beta */
|
|
16
|
+
releaseLabel: string;
|
|
17
|
+
latestOnChannel: string | null;
|
|
18
|
+
registryReachable: boolean;
|
|
19
|
+
updateAvailable: boolean;
|
|
20
|
+
userNotice: string;
|
|
21
|
+
upgradeHint: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ReleaseChannelPresentation {
|
|
24
|
+
registryTag: 'beta' | 'latest';
|
|
25
|
+
releaseLine: 'stable' | 'internal';
|
|
26
|
+
releaseLabel: string;
|
|
27
|
+
packageInstallRef: string;
|
|
28
|
+
}
|
|
29
|
+
/** 当前运行版本应跟哪个 npm dist-tag 比对新版(正式↔latest,测试↔beta,不交叉)。 */
|
|
9
30
|
export declare function resolveUpdateChannel(version: string): 'beta' | 'latest';
|
|
31
|
+
/** 正式版与内部测试版的分发呈现(客户侧不出现 beta 字样)。 */
|
|
32
|
+
export declare function describeReleaseChannel(version: string): ReleaseChannelPresentation;
|
|
10
33
|
/** 查询 registry 是否有比 current 更新的同通道版本;失败时返回 null。 */
|
|
11
34
|
export declare function checkForUpdate(current: string): Promise<UpdateCheckResult | null>;
|
|
35
|
+
/** 拉取完整版本信息(工具返回 + 启动 instructions)。 */
|
|
36
|
+
export declare function buildMcpVersionInfo(current: string): Promise<McpVersionInfo>;
|
|
37
|
+
/** 有新版本时追加到 server instructions,让模型在对话里主动提醒用户。 */
|
|
38
|
+
export declare function buildUpdateInstructionAppendix(info: McpVersionInfo): string | null;
|
|
12
39
|
export declare function formatUpdateNotice(result: UpdateCheckResult): string;
|
|
13
40
|
/** 启动时异步检查;仅写 stderr,不阻塞 MCP 握手。 */
|
|
14
41
|
export declare function scheduleUpdateNotice(current: string): void;
|
package/dist/version-check.js
CHANGED
|
@@ -2,10 +2,28 @@
|
|
|
2
2
|
export const PACKAGE_NAME = '@uwa4d/openapi-mcp';
|
|
3
3
|
const REGISTRY_URL = 'https://registry.npmjs.org/@uwa4d%2Fopenapi-mcp';
|
|
4
4
|
const CHECK_TIMEOUT_MS = 8_000;
|
|
5
|
-
/** 当前运行版本应跟哪个 dist-tag
|
|
5
|
+
/** 当前运行版本应跟哪个 npm dist-tag 比对新版(正式↔latest,测试↔beta,不交叉)。 */
|
|
6
6
|
export function resolveUpdateChannel(version) {
|
|
7
7
|
return version.includes('-') ? 'beta' : 'latest';
|
|
8
8
|
}
|
|
9
|
+
/** 正式版与内部测试版的分发呈现(客户侧不出现 beta 字样)。 */
|
|
10
|
+
export function describeReleaseChannel(version) {
|
|
11
|
+
const registryTag = resolveUpdateChannel(version);
|
|
12
|
+
if (registryTag === 'beta') {
|
|
13
|
+
return {
|
|
14
|
+
registryTag: 'beta',
|
|
15
|
+
releaseLine: 'internal',
|
|
16
|
+
releaseLabel: '内部测试版',
|
|
17
|
+
packageInstallRef: `${PACKAGE_NAME}@beta`,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
registryTag: 'latest',
|
|
22
|
+
releaseLine: 'stable',
|
|
23
|
+
releaseLabel: '正式版',
|
|
24
|
+
packageInstallRef: PACKAGE_NAME,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
9
27
|
/** 简易 semver 比较:a > b 返回 1,相等 0,a < b 返回 -1。 */
|
|
10
28
|
function compareVersions(a, b) {
|
|
11
29
|
if (a === b)
|
|
@@ -71,17 +89,66 @@ async function fetchDistTagVersion(channel) {
|
|
|
71
89
|
}
|
|
72
90
|
/** 查询 registry 是否有比 current 更新的同通道版本;失败时返回 null。 */
|
|
73
91
|
export async function checkForUpdate(current) {
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
92
|
+
const info = await buildMcpVersionInfo(current);
|
|
93
|
+
if (!info.updateAvailable || !info.latestOnChannel)
|
|
94
|
+
return null;
|
|
95
|
+
return { current: info.currentVersion, latest: info.latestOnChannel, registryTag: describeReleaseChannel(current).registryTag };
|
|
96
|
+
}
|
|
97
|
+
function buildUpgradeHint(presentation) {
|
|
98
|
+
return (`若 MCP 配置未锁定具体版本号,请在您使用的 AI 客户端中重启 MCP 服务以升级(重载 MCP 配置或重启客户端均可);` +
|
|
99
|
+
`终端核对:npx --yes --prefer-online ${presentation.packageInstallRef} --version`);
|
|
100
|
+
}
|
|
101
|
+
/** 拉取完整版本信息(工具返回 + 启动 instructions)。 */
|
|
102
|
+
export async function buildMcpVersionInfo(current) {
|
|
103
|
+
const presentation = describeReleaseChannel(current);
|
|
104
|
+
const latestOnChannel = await fetchDistTagVersion(presentation.registryTag);
|
|
105
|
+
const registryReachable = latestOnChannel !== null;
|
|
106
|
+
const updateAvailable = registryReachable && latestOnChannel !== null && compareVersions(latestOnChannel, current) > 0;
|
|
107
|
+
const upgradeHint = buildUpgradeHint(presentation);
|
|
108
|
+
if (updateAvailable && latestOnChannel) {
|
|
109
|
+
return {
|
|
110
|
+
package: PACKAGE_NAME,
|
|
111
|
+
currentVersion: current,
|
|
112
|
+
releaseLine: presentation.releaseLine,
|
|
113
|
+
releaseLabel: presentation.releaseLabel,
|
|
114
|
+
latestOnChannel,
|
|
115
|
+
registryReachable,
|
|
116
|
+
updateAvailable: true,
|
|
117
|
+
userNotice: `UWA OpenAPI MCP(${presentation.releaseLabel})有新版本:当前 ${current},${presentation.releaseLabel}最新 ${latestOnChannel}。` +
|
|
118
|
+
upgradeHint,
|
|
119
|
+
upgradeHint,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
const latestLabel = latestOnChannel ?? '(暂时无法连接 npm 核对最新版)';
|
|
123
|
+
return {
|
|
124
|
+
package: PACKAGE_NAME,
|
|
125
|
+
currentVersion: current,
|
|
126
|
+
releaseLine: presentation.releaseLine,
|
|
127
|
+
releaseLabel: presentation.releaseLabel,
|
|
128
|
+
latestOnChannel,
|
|
129
|
+
registryReachable,
|
|
130
|
+
updateAvailable: false,
|
|
131
|
+
userNotice: registryReachable
|
|
132
|
+
? `UWA OpenAPI MCP(${presentation.releaseLabel})已是最新:当前 ${current},${presentation.releaseLabel}最新 ${latestLabel}。`
|
|
133
|
+
: `UWA OpenAPI MCP(${presentation.releaseLabel})当前版本 ${current};暂时无法连接 npm 核对最新版。`,
|
|
134
|
+
upgradeHint,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
/** 有新版本时追加到 server instructions,让模型在对话里主动提醒用户。 */
|
|
138
|
+
export function buildUpdateInstructionAppendix(info) {
|
|
139
|
+
if (!info.updateAvailable || !info.latestOnChannel)
|
|
77
140
|
return null;
|
|
78
|
-
|
|
141
|
+
const headline = info.releaseLine === 'stable'
|
|
142
|
+
? '【MCP 正式版有新版本 — 请主动告知用户】'
|
|
143
|
+
: '【MCP 内部测试版有新版本 — 请主动告知内部测试人员】';
|
|
144
|
+
return (`${headline}当前运行 ${info.currentVersion},${info.releaseLabel}最新 ${info.latestOnChannel}。` +
|
|
145
|
+
`请用自然语言转告用户重启 MCP 升级(勿只写 stderr 日志)。详情可调工具 uwa_mcp_version。` +
|
|
146
|
+
` ${info.upgradeHint}`);
|
|
79
147
|
}
|
|
80
148
|
export function formatUpdateNotice(result) {
|
|
81
|
-
const
|
|
82
|
-
return (`[uwa-openapi-mcp] 有新版本 ${result.latest}(当前 ${result.current}
|
|
83
|
-
|
|
84
|
-
`也可在终端核对:npx --yes --prefer-online ${pkgRef} --version`);
|
|
149
|
+
const presentation = describeReleaseChannel(result.current);
|
|
150
|
+
return (`[uwa-openapi-mcp] ${presentation.releaseLabel}有新版本 ${result.latest}(当前 ${result.current})。` +
|
|
151
|
+
buildUpgradeHint(presentation));
|
|
85
152
|
}
|
|
86
153
|
/** 启动时异步检查;仅写 stderr,不阻塞 MCP 握手。 */
|
|
87
154
|
export function scheduleUpdateNotice(current) {
|