@cloudbase/cloudbase-mcp 2.34.5 → 2.34.6

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/index.js CHANGED
@@ -4986,8 +4986,8 @@ const types_js_1 = __webpack_require__(9921);
4986
4986
  exports.functions = (0, types_js_1.defineModule)({
4987
4987
  // ---- 工具 meta ----
4988
4988
  queryTitle: "查询 CloudBase 云函数",
4989
- queryDescription: "CloudBase 云函数统一只读入口。通过更自解释的 action 查询 CloudBase 云函数列表、函数详情、执行日志、层、触发器和代码下载地址。" +
4990
- "\n\n**分页说明**:`listFunctions`、`listLayers` 支持 `limit` 和 `offset` 参数。" +
4989
+ queryDescription: "CloudBase 云函数统一只读入口。通过更自解释的 action 查询 CloudBase 云函数列表、函数详情、执行日志、层、触发器、代码下载地址、已发布版本与流量别名。" +
4990
+ "\n\n**分页说明**:`listFunctions`、`listLayers`、`listVersionByFunction` 支持 `limit` 和 `offset` 参数。" +
4991
4991
  "\n- `limit`: 分页数量,默认值由后端决定" +
4992
4992
  "\n- `offset`: 分页偏移,从 0 开始" +
4993
4993
  "\n- 示例:`queryFunctions(action=\"listFunctions\", offset=10, limit=10)`" +
@@ -4995,6 +4995,7 @@ exports.functions = (0, types_js_1.defineModule)({
4995
4995
  "\n- 示例:`queryFunctions(action=\"listFunctionLogs\", functionName=\"my-function\")`" +
4996
4996
  "\n- 如需查看日志详情:`queryFunctions(action=\"getFunctionLogDetail\", requestId=\"xxx\")`" +
4997
4997
  "\n\n**定时任务 / cron / 定时跑**:使用 `listFunctionTriggers` 查询函数的 timer 触发器配置。" +
4998
+ "\n\n**版本与流量路由**:`listVersionByFunction` 列出已发布版本(对齐 tcb fn list-function-versions);`getFunctionAlias` 查看别名/灰度配置(对齐 tcb fn get-route,aliasName 默认 `$DEFAULT`)。" +
4998
4999
  "\n\n**层(Layer)说明**:" +
4999
5000
  "\n- 层为 SCF 账号级共享命名空间:不同环境创建同名层会共享同一层的版本序列;删除某版本会影响所有绑定该版本的环境的函数" +
5000
5001
  "\n- 创建层必须用带环境标识的唯一层名,固定格式:`{layerName}_{当前envId}`(如 `common_cloud1-d9ghadgak3edf6b36`)。不要在不同环境使用相同裸层名,创建前先 `listLayers` 查重" +
@@ -5003,8 +5004,9 @@ exports.functions = (0, types_js_1.defineModule)({
5003
5004
  "\n- 本工具用于查询特定 CloudBase 云函数的执行日志" +
5004
5005
  "\n- `queryLogs` 工具用于搜索 CLS 日志服务(跨服务日志聚合)",
5005
5006
  manageTitle: "管理 CloudBase 云函数",
5006
- manageDescription: "CloudBase 云函数统一写入口。支持创建函数、更新代码、更新配置、调用函数、管理定时跑 / 定时任务 / scheduled job 的 timer 触发器和层绑定。" +
5007
+ manageDescription: "CloudBase 云函数统一写入口。支持创建函数、更新代码、更新配置、调用函数、发布版本、配置流量别名、管理定时跑 / 定时任务 / scheduled job 的 timer 触发器和层绑定。" +
5007
5008
  "如果要创建 cron 定时任务,先用 createFunction 创建函数,再用 createFunctionTrigger 创建 timer 触发器(支持7段cron表达式),deleteFunctionTrigger 删除触发器。" +
5009
+ "版本发布:`publishVersion` 对齐 tcb fn publish-version / SDK publishVersion;灰度/切流:`updateFunctionAliasConfig` 对齐 tcb fn config-route / SDK updateFunctionAliasConfig(aliasName 默认 `$DEFAULT`)。" +
5008
5010
  "HTTP 云函数镜像构建部署:createFunction / updateFunctionCode 通过 func.buildStrategy 区分。" +
5009
5011
  "func.buildStrategy=image(已有镜像,填 func.imageConfig.imageUri)直接创建/更新 HTTP 函数;" +
5010
5012
  "func.buildStrategy=local(本地 Docker 构建推送)、cloud(CloudApp 云端构建)走镜像构建部署编排(需要 func.imageConfig;build 非必填,缺省仓库坐标自动补齐:namespace 默认 envId、repository 默认函数名)," +
@@ -5107,6 +5109,12 @@ exports.functions = (0, types_js_1.defineModule)({
5107
5109
  "reason.imageNextIteration": "后续迭代只需用新镜像 tag 调用 updateFunctionCode 更新镜像",
5108
5110
  "reason.imageGatewayRoute": "如需通过 URL 访问镜像 HTTP 函数,显式创建 Domain/Route 访问入口并传 type=\"HTTP\"(映射 WEB_SCF)",
5109
5111
  "reason.latestConfig": "确认最新函数配置",
5112
+ "reason.publishVersion": "发布函数新版本(对齐 tcb fn publish-version)",
5113
+ "reason.getFunctionAlias": "查看函数流量别名配置(对齐 tcb fn get-route)",
5114
+ "reason.updateFunctionAlias": "更新函数流量别名/灰度路由(对齐 tcb fn config-route)",
5115
+ "reason.listVersions": "查看函数已发布版本列表(对齐 tcb fn list-function-versions)",
5116
+ "reason.routeTraffic": "将流量切到新版本或配置灰度权重",
5117
+ "reason.confirmAlias": "确认别名与流量配置已生效",
5110
5118
  // ---- 成功 message ----
5111
5119
  listedFunctions: "已获取 {count} 个云函数",
5112
5120
  gotFunctionDetail: "已获取函数 {fnName} 的详情",
@@ -5118,6 +5126,10 @@ exports.functions = (0, types_js_1.defineModule)({
5118
5126
  gotLayerVersionDetail: "已获取层 {layerName} 版本 {layerVersion} 的详情",
5119
5127
  gotFunctionTriggers: "已获取函数 {fnName} 的触发器列表",
5120
5128
  gotDownloadUrl: "已获取函数 {fnName} 的代码下载链接",
5129
+ gotFunctionVersions: "已获取函数 {fnName} 的版本列表",
5130
+ gotFunctionAlias: "已获取函数 {fnName} 的别名 {aliasName}",
5131
+ publishedVersion: "已发布函数 {fnName} 的新版本 {version}",
5132
+ updatedFunctionAlias: "已更新函数 {fnName} 别名 {aliasName}(主版本 {version})",
5121
5133
  createdHttpFunctionMessage: "已创建 HTTP 函数 {fnName}。如果后续需要通过 URL 访问,请显式调用 manageGateway(action=\"createRoute\"),并把 upstreamResourceType=\"WEB_SCF\" 一起传入,再按实际路径和鉴权需求创建访问入口。评测或其他外部调用方可能会以匿名身份访问,而且失败后不一定会把 EXCEED_AUTHORITY 再反馈给 AI;交付前请主动确认访问路径和函数安全规则,若已出现 EXCEED_AUTHORITY,请先调用 queryPermissions(action=\"getResourcePermission\", resourceType=\"function\", resourceId=\"{fnName}\") 查看当前规则,再按需要使用 managePermissions(action=\"updateResourcePermission\") 调整权限。",
5122
5134
  createdFunction: "已创建函数 {fnName}",
5123
5135
  imageCreatedMessage: "已基于镜像 {imageUri} 创建 HTTP 函数 {fnName}。请确认 TCR、SCF 与构建管道处于同一地域;如需通过 URL 访问,请显式调用 manageGateway(action=\"createRoute\", upstreamResourceType=\"WEB_SCF\") 并按需调整函数安全规则。部署后可用 queryFunctions(action=\"getFunctionDetail\") 确认函数已就绪。",
@@ -5185,8 +5197,8 @@ exports.functions = (0, types_js_1.defineModule)({
5185
5197
  "schema.create.layers": "Layer 配置",
5186
5198
  "schema.manageLayer.name": "层名称",
5187
5199
  "schema.manageLayer.version": "层版本号",
5188
- "schema.query.action": "只读操作类型:\n- `listFunctions`: 列出所有 CloudBase 云函数\n- `getFunctionDetail`: 获取 CloudBase 云函数详情(需要 functionName)\n- `listFunctionLogs`: 查询 CloudBase 云函数执行日志(需要 functionName)\n- `getFunctionLogDetail`: 获取日志详情(需要 requestId)\n- `listFunctionLayers`: 列出函数绑定的层\n- `listLayers`: 列出所有层(账号级视图,含其他环境创建的层)\n- `listLayerVersions`: 列出层的版本(注意:是 Versions 不是 Version;账号级视图)\n- `getLayerVersionDetail`: 获取层版本详情(账号级视图)\n- `listFunctionTriggers`: 列出函数触发器(用于查看定时任务 / cron / timer 配置)\n- `getFunctionDownloadUrl`: 获取函数代码下载地址\n- `getFunctionDeployStatus`: 按 taskId 查询异步部署状态、阶段进度和最终结果。返回 data.build(构建子状态)、data.deploy(部署子状态)、data.progress(阶段事件);status=running 时 data.result 与 data.error 一律为 null,不得报告部署完成。调用方必须持续轮询直到 status=succeeded/failed;status=expired 表示任务超过最长保留时间(2 小时)被终结,云端可能仍在部署,需用 getFunctionDetail 确认。任务只保存在 MCP 进程内存中,过期或 MCP Server 重启后返回 errorCode=DEPLOY_TASK_NOT_FOUND;任务按环境隔离,只能查到当前环境自己发起的部署。cloud mode 下本 action 不可用:异步任务只由 buildStrategy=cloud/local 的真实部署创建,而这两种策略在 cloud mode 下都不支持真实执行,image 策略则走同步部署不产生 taskId。",
5189
- "schema.query.functionName": "CloudBase 云函数名称。`getFunctionDetail`、`listFunctionLogs`、`listFunctionLayers`、`listFunctionTriggers`、`getFunctionDownloadUrl` 时必填",
5200
+ "schema.query.action": "只读操作类型:\n- `listFunctions`: 列出所有 CloudBase 云函数\n- `getFunctionDetail`: 获取 CloudBase 云函数详情(需要 functionName)\n- `listFunctionLogs`: 查询 CloudBase 云函数执行日志(需要 functionName)\n- `getFunctionLogDetail`: 获取日志详情(需要 requestId)\n- `listFunctionLayers`: 列出函数绑定的层\n- `listLayers`: 列出所有层(账号级视图,含其他环境创建的层)\n- `listLayerVersions`: 列出层的版本(注意:是 Versions 不是 Version;账号级视图)\n- `getLayerVersionDetail`: 获取层版本详情(账号级视图)\n- `listFunctionTriggers`: 列出函数触发器(用于查看定时任务 / cron / timer 配置)\n- `getFunctionDownloadUrl`: 获取函数代码下载地址\n- `getFunctionDeployStatus`: 按 taskId 查询异步部署状态、阶段进度和最终结果。返回 data.build(构建子状态)、data.deploy(部署子状态)、data.progress(阶段事件);status=running 时 data.result 与 data.error 一律为 null,不得报告部署完成。调用方必须持续轮询直到 status=succeeded/failed;status=expired 表示任务超过最长保留时间(2 小时)被终结,云端可能仍在部署,需用 getFunctionDetail 确认。任务只保存在 MCP 进程内存中,过期或 MCP Server 重启后返回 errorCode=DEPLOY_TASK_NOT_FOUND;任务按环境隔离,只能查到当前环境自己发起的部署。cloud mode 下本 action 不可用:异步任务只由 buildStrategy=cloud/local 的真实部署创建,而这两种策略在 cloud mode 下都不支持真实执行,image 策略则走同步部署不产生 taskId。\n- `listVersionByFunction`: 列出函数已发布版本(对齐 tcb fn list-function-versions / SDK listVersionByFunction;需要 functionName)\n- `getFunctionAlias`: 查询函数别名与流量路由(对齐 tcb fn get-route / SDK getFunctionAlias;需要 functionName;aliasName 默认 $DEFAULT)",
5201
+ "schema.query.functionName": "CloudBase 云函数名称。`getFunctionDetail`、`listFunctionLogs`、`listFunctionLayers`、`listFunctionTriggers`、`getFunctionDownloadUrl`、`listVersionByFunction`、`getFunctionAlias` 时必填",
5190
5202
  "schema.query.limit": "分页数量(limit)。列表类 action 可选,默认值由后端决定",
5191
5203
  "schema.query.offset": "分页偏移(offset)。列表类 action 可选,默认 0",
5192
5204
  "schema.query.codeSecret": "代码保护密钥,用于解密函数代码",
@@ -5200,11 +5212,14 @@ exports.functions = (0, types_js_1.defineModule)({
5200
5212
  "schema.query.layerName": "层名称。`listLayerVersions`、`getLayerVersionDetail` 操作必填。层为账号级共享命名空间;推荐固定格式 `{layerName}_{当前envId}`(如 common_cloud1-d9ghadgak3edf6b36)",
5201
5213
  "schema.query.layerVersion": "层版本号。`getLayerVersionDetail` 操作必填",
5202
5214
  "schema.query.taskId": "`getFunctionDeployStatus` 操作时的异步部署任务 ID(由 manageFunctions 的 wait=false 返回)。任务仅保存在当前 MCP 进程内存中:终态任务保留约 30 分钟,运行中任务最长保留 2 小时。",
5203
- "schema.manage.action": "写操作类型,例如 createFunction、updateFunctionCode、incrementalDeployFunction、invokeFunction、deleteFunction、createFunctionTrigger(定时任务 / cron / timer)、deleteFunctionTrigger、createLayerVersion、deleteLayerVersion、attachLayer、detachLayer、updateFunctionLayers。层名推荐固定格式 `{layerName}_{当前envId}`(如 common_cloud1-d9ghadgak3edf6b36)",
5215
+ "schema.query.order": "`listVersionByFunction` 排序方向,如 ASC / DESC",
5216
+ "schema.query.orderBy": "`listVersionByFunction` 排序字段,如 AddTime / ModTime",
5217
+ "schema.query.aliasName": "`getFunctionAlias` 的别名名称。省略时默认 `$DEFAULT`(与 tcb fn get-route 一致)",
5218
+ "schema.manage.action": "写操作类型,例如 createFunction、updateFunctionCode、incrementalDeployFunction、invokeFunction、deleteFunction、createFunctionTrigger(定时任务 / cron / timer)、deleteFunctionTrigger、createLayerVersion、deleteLayerVersion、attachLayer、detachLayer、updateFunctionLayers、publishVersion(发布新版本,对齐 tcb fn publish-version)、updateFunctionAliasConfig(更新别名/流量路由,对齐 tcb fn config-route)。层名推荐固定格式 `{layerName}_{当前envId}`(如 common_cloud1-d9ghadgak3edf6b36)",
5204
5219
  "schema.manage.func": "createFunction / updateFunctionCode 的函数配置。镜像/构建部署通过 func.buildStrategy(zip/cloud/local/image)区分,镜像相关字段收敛在 func.imageConfig 命名空间下。",
5205
5220
  "schema.manage.functionRootPath": "创建或更新函数代码时默认推荐的本地目录方式。必须是直接包含函数文件夹的目录绝对路径(如 /abs/path/cloudfunctions 或 /abs/path/functions),不要传项目根目录(如 /abs/path),也不要传到函数名子目录(如 /abs/path/cloudfunctions/hello)。本地应按 cloudfunctions/<functionName>/index.js 或 functions/<functionName>/index.js 布局,此参数传 cloudfunctions 或 functions 目录的绝对路径。SDK 会自动拼接函数名子目录,无需预先压缩 zip 或 base64 编码。",
5206
5221
  "schema.manage.force": "createFunction 时是否覆盖",
5207
- "schema.manage.functionName": "目标函数名称(顶层)。updateFunctionCode / updateFunctionConfig / invokeFunction 等 action 使用此字段。不要只写在 func.name:createFunction 用 func.name,其它 action 用顶层 functionName。若误传 func.name,也会被识别为 functionName。",
5222
+ "schema.manage.functionName": "目标函数名称(顶层)。updateFunctionCode / updateFunctionConfig / invokeFunction / publishVersion / updateFunctionAliasConfig 等 action 使用此字段。不要只写在 func.name:createFunction 用 func.name,其它 action 用顶层 functionName。若误传 func.name,也会被识别为 functionName。",
5208
5223
  "schema.manage.zipFile": "仅兼容特殊场景:预先准备好的代码包 base64 编码。普通 createFunction/updateFunctionCode 默认不要先压缩 zip,优先使用 functionRootPath。",
5209
5224
  "schema.manage.handler": "函数入口",
5210
5225
  "schema.manage.timeout": "配置更新时的超时时间",
@@ -5218,7 +5233,7 @@ exports.functions = (0, types_js_1.defineModule)({
5218
5233
  "schema.manage.contentPath": "层内容路径,可为目录或 ZIP 文件",
5219
5234
  "schema.manage.base64Content": "层内容的 base64 编码",
5220
5235
  "schema.manage.runtimes": "层适用的运行时列表",
5221
- "schema.manage.description": "层版本描述",
5236
+ "schema.manage.description": "描述信息。createLayerVersion 时为层版本描述;publishVersion / updateFunctionAliasConfig 时为版本或别名描述",
5222
5237
  "schema.manage.licenseInfo": "层许可证信息",
5223
5238
  "schema.manage.layers": "updateFunctionLayers 的目标层列表,顺序即最终顺序",
5224
5239
  "schema.manage.codeSecret": "层绑定时的代码保护密钥",
@@ -5227,11 +5242,22 @@ exports.functions = (0, types_js_1.defineModule)({
5227
5242
  "schema.manage.autoGrant": "镜像部署是否允许 manager-node 自动补齐固定白名单 CAM 策略。默认 false;仅在明确确认权限变更时设为 true。",
5228
5243
  "schema.manage.confirm": "危险操作确认开关。deleteFunction、deleteFunctionTrigger、deleteLayerVersion、detachLayer 等删除类操作以及镜像构建部署(func.buildStrategy=cloud/local)真实执行需要显式传入 confirm=true",
5229
5244
  "schema.manage.incrementalFile": "incrementalDeployFunction 增量部署时的变更文件路径",
5245
+ "schema.manage.aliasName": "`updateFunctionAliasConfig` 的别名名称。省略时默认 `$DEFAULT`(与 tcb fn config-route 一致)",
5246
+ "schema.manage.functionVersion": "`updateFunctionAliasConfig` 的主版本。可为具体版本号或 `$LATEST`",
5247
+ "schema.manage.routingConfig": "`updateFunctionAliasConfig` 的流量路由配置。AdditionalVersionWeights 用于灰度权重;AddtionVersionMatchs 为 SCF/SDK 历史字段名(含拼写)",
5248
+ "schema.routing.version": "附加流量版本号",
5249
+ "schema.routing.weight": "附加流量权重(0-1 或百分比,按 SCF 约定)",
5250
+ "schema.routing.matchVersion": "匹配规则指向的版本号",
5251
+ "schema.routing.matchKey": "匹配规则的 Header/Query Key",
5252
+ "schema.routing.matchMethod": "匹配方法,如 Exact / Regex",
5253
+ "schema.routing.matchExpression": "匹配表达式",
5254
+ "schema.routing.additionalWeights": "附加版本权重列表(灰度发布)",
5255
+ "schema.routing.additionalMatches": "附加版本匹配规则列表(字段名保持 SCF AddtionVersionMatchs)",
5230
5256
  }, {
5231
5257
  // ---- Tool meta ----
5232
5258
  queryTitle: "Query CloudBase Cloud Functions",
5233
- queryDescription: "Unified read-only entry for CloudBase cloud functions. Query function lists, function details, execution logs, layers, triggers, and code download URLs through self-explanatory actions." +
5234
- "\n\n**Pagination**: `listFunctions` and `listLayers` support `limit` and `offset` parameters." +
5259
+ queryDescription: "Unified read-only entry for CloudBase cloud functions. Query function lists, function details, execution logs, layers, triggers, code download URLs, published versions, and traffic aliases through self-explanatory actions." +
5260
+ "\n\n**Pagination**: `listFunctions`, `listLayers`, and `listVersionByFunction` support `limit` and `offset` parameters." +
5235
5261
  "\n- `limit`: page size, the default is decided by the backend" +
5236
5262
  "\n- `offset`: pagination offset, starting from 0" +
5237
5263
  "\n- Example: `queryFunctions(action=\"listFunctions\", offset=10, limit=10)`" +
@@ -5239,6 +5265,7 @@ exports.functions = (0, types_js_1.defineModule)({
5239
5265
  "\n- Example: `queryFunctions(action=\"listFunctionLogs\", functionName=\"my-function\")`" +
5240
5266
  "\n- To view log details: `queryFunctions(action=\"getFunctionLogDetail\", requestId=\"xxx\")`" +
5241
5267
  "\n\n**Scheduled tasks / cron / timers**: use `listFunctionTriggers` to query a function's timer trigger configuration." +
5268
+ "\n\n**Versions and traffic routing**: `listVersionByFunction` lists published versions (aligns with tcb fn list-function-versions); `getFunctionAlias` views alias / canary config (aligns with tcb fn get-route; aliasName defaults to `$DEFAULT`)." +
5242
5269
  "\n\n**Layers**:" +
5243
5270
  "\n- Layers are account-level shared namespaces in SCF: same-named layers created in different environments share one version sequence; deleting a version affects functions in every environment bound to it" +
5244
5271
  "\n- When creating a layer, use a unique name with the environment suffix, in the fixed format `{layerName}_{current envId}` (e.g. `common_cloud1-d9ghadgak3edf6b36`). Do not reuse the same bare layer name across environments; check with `listLayers` before creating" +
@@ -5247,8 +5274,9 @@ exports.functions = (0, types_js_1.defineModule)({
5247
5274
  "\n- This tool queries execution logs of a specific CloudBase cloud function" +
5248
5275
  "\n- The `queryLogs` tool searches the CLS log service (cross-service log aggregation)",
5249
5276
  manageTitle: "Manage CloudBase Cloud Functions",
5250
- manageDescription: "Unified write entry for CloudBase cloud functions. Supports creating functions, updating code, updating configuration, invoking functions, and managing timer triggers (scheduled jobs / cron) and layer bindings." +
5277
+ manageDescription: "Unified write entry for CloudBase cloud functions. Supports creating functions, updating code, updating configuration, invoking functions, publishing versions, configuring traffic aliases, and managing timer triggers (scheduled jobs / cron) and layer bindings." +
5251
5278
  " To create a cron scheduled task, first create the function with createFunction, then create the timer trigger with createFunctionTrigger (7-field cron expression supported), and delete triggers with deleteFunctionTrigger." +
5279
+ " Version publish: `publishVersion` aligns with tcb fn publish-version / SDK publishVersion; canary / traffic shift: `updateFunctionAliasConfig` aligns with tcb fn config-route / SDK updateFunctionAliasConfig (aliasName defaults to `$DEFAULT`)." +
5252
5280
  " HTTP function image build & deploy: createFunction / updateFunctionCode distinguish via func.buildStrategy." +
5253
5281
  " func.buildStrategy=image (existing image, set func.imageConfig.imageUri) creates/updates the HTTP function directly;" +
5254
5282
  " func.buildStrategy=local (local Docker build & push) and cloud (CloudApp cloud build) go through the image build/deploy orchestration (func.imageConfig required; build optional — missing registry coordinates are auto-filled: namespace defaults to envId, repository defaults to the function name)," +
@@ -5351,6 +5379,12 @@ exports.functions = (0, types_js_1.defineModule)({
5351
5379
  "reason.imageNextIteration": "For later iterations, just call updateFunctionCode with the new image tag to update the image",
5352
5380
  "reason.imageGatewayRoute": "To access the image HTTP function via URL, explicitly create a Domain/Route access entry and pass type=\"HTTP\" (mapped to WEB_SCF)",
5353
5381
  "reason.latestConfig": "Confirm the latest function configuration",
5382
+ "reason.publishVersion": "Publish a new function version (aligns with tcb fn publish-version)",
5383
+ "reason.getFunctionAlias": "View function traffic alias config (aligns with tcb fn get-route)",
5384
+ "reason.updateFunctionAlias": "Update function traffic alias / canary routing (aligns with tcb fn config-route)",
5385
+ "reason.listVersions": "List published function versions (aligns with tcb fn list-function-versions)",
5386
+ "reason.routeTraffic": "Shift traffic to the new version or configure canary weights",
5387
+ "reason.confirmAlias": "Confirm the alias and traffic config have taken effect",
5354
5388
  // ---- Success messages ----
5355
5389
  listedFunctions: "Retrieved {count} cloud functions",
5356
5390
  gotFunctionDetail: "Retrieved details of function {fnName}",
@@ -5362,6 +5396,10 @@ exports.functions = (0, types_js_1.defineModule)({
5362
5396
  gotLayerVersionDetail: "Retrieved details of layer {layerName} version {layerVersion}",
5363
5397
  gotFunctionTriggers: "Retrieved the trigger list of function {fnName}",
5364
5398
  gotDownloadUrl: "Retrieved the code download URL of function {fnName}",
5399
+ gotFunctionVersions: "Retrieved the version list of function {fnName}",
5400
+ gotFunctionAlias: "Retrieved alias {aliasName} of function {fnName}",
5401
+ publishedVersion: "Published new version {version} of function {fnName}",
5402
+ updatedFunctionAlias: "Updated alias {aliasName} of function {fnName} (primary version {version})",
5365
5403
  createdHttpFunctionMessage: "Created HTTP function {fnName} from the image. If URL access is needed later, explicitly call manageGateway(action=\"createRoute\") with upstreamResourceType=\"WEB_SCF\", then create the access entry according to the actual path and auth requirements. Evaluators or other external callers may access anonymously, and failures may not feed EXCEED_AUTHORITY back to the AI; before delivery, proactively confirm the access path and the function security rules. If EXCEED_AUTHORITY has already appeared, first call queryPermissions(action=\"getResourcePermission\", resourceType=\"function\", resourceId=\"{fnName}\") to view the current rules, then adjust permissions with managePermissions(action=\"updateResourcePermission\") as needed.",
5366
5404
  createdFunction: "Created function {fnName}",
5367
5405
  imageCreatedMessage: "Created HTTP function {fnName} from image {imageUri}. Please confirm TCR, SCF, and the build pipeline are in the same region; for URL access, explicitly call manageGateway(action=\"createRoute\", upstreamResourceType=\"WEB_SCF\") and adjust the function security rules as needed. After deployment, use queryFunctions(action=\"getFunctionDetail\") to confirm the function is ready.",
@@ -5429,8 +5467,8 @@ exports.functions = (0, types_js_1.defineModule)({
5429
5467
  "schema.create.layers": "Layer configuration",
5430
5468
  "schema.manageLayer.name": "Layer name",
5431
5469
  "schema.manageLayer.version": "Layer version number",
5432
- "schema.query.action": "Read-only action type:\n- `listFunctions`: list all CloudBase cloud functions\n- `getFunctionDetail`: get function details (requires functionName)\n- `listFunctionLogs`: query function execution logs (requires functionName)\n- `getFunctionLogDetail`: get log details (requires requestId)\n- `listFunctionLayers`: list layers bound to a function\n- `listLayers`: list all layers (account-level view, including layers from other environments)\n- `listLayerVersions`: list layer versions (Versions, not Version; account-level view)\n- `getLayerVersionDetail`: get layer version details (account-level view)\n- `listFunctionTriggers`: list function triggers (scheduled task / cron / timer configuration)\n- `getFunctionDownloadUrl`: get the function code download URL\n- `getFunctionDeployStatus`: query async deployment status, stage progress, and final result by taskId. Returns data.build, data.deploy, and data.progress. While status=running, data.result and data.error are null and deployment must not be reported as complete. Keep polling until status=succeeded/failed. status=expired means the task exceeded the 2-hour retention limit; cloud deployment may still be running, so confirm with getFunctionDetail. Tasks exist only in MCP process memory; expired tasks or a restarted MCP Server return errorCode=DEPLOY_TASK_NOT_FOUND. Tasks are isolated by environment. This action is unavailable in cloud mode because real cloud/local builds cannot run there, while image deployment is synchronous and creates no taskId.",
5433
- "schema.query.functionName": "CloudBase cloud function name. Required for `getFunctionDetail`, `listFunctionLogs`, `listFunctionLayers`, `listFunctionTriggers`, and `getFunctionDownloadUrl`.",
5470
+ "schema.query.action": "Read-only action type:\n- `listFunctions`: list all CloudBase cloud functions\n- `getFunctionDetail`: get function details (requires functionName)\n- `listFunctionLogs`: query function execution logs (requires functionName)\n- `getFunctionLogDetail`: get log details (requires requestId)\n- `listFunctionLayers`: list layers bound to a function\n- `listLayers`: list all layers (account-level view, including layers from other environments)\n- `listLayerVersions`: list layer versions (Versions, not Version; account-level view)\n- `getLayerVersionDetail`: get layer version details (account-level view)\n- `listFunctionTriggers`: list function triggers (scheduled task / cron / timer configuration)\n- `getFunctionDownloadUrl`: get the function code download URL\n- `getFunctionDeployStatus`: query async deployment status, stage progress, and final result by taskId. Returns data.build, data.deploy, and data.progress. While status=running, data.result and data.error are null and deployment must not be reported as complete. Keep polling until status=succeeded/failed. status=expired means the task exceeded the 2-hour retention limit; cloud deployment may still be running, so confirm with getFunctionDetail. Tasks exist only in MCP process memory; expired tasks or a restarted MCP Server return errorCode=DEPLOY_TASK_NOT_FOUND. Tasks are isolated by environment. This action is unavailable in cloud mode because real cloud/local builds cannot run there, while image deployment is synchronous and creates no taskId.\n- `listVersionByFunction`: list published function versions (aligns with tcb fn list-function-versions / SDK listVersionByFunction; requires functionName)\n- `getFunctionAlias`: get function alias and traffic routing (aligns with tcb fn get-route / SDK getFunctionAlias; requires functionName; aliasName defaults to $DEFAULT)",
5471
+ "schema.query.functionName": "CloudBase cloud function name. Required for `getFunctionDetail`, `listFunctionLogs`, `listFunctionLayers`, `listFunctionTriggers`, `getFunctionDownloadUrl`, `listVersionByFunction`, and `getFunctionAlias`.",
5434
5472
  "schema.query.limit": "Page size (limit). Optional for list actions; the backend determines the default.",
5435
5473
  "schema.query.offset": "Pagination offset. Optional for list actions; defaults to 0.",
5436
5474
  "schema.query.codeSecret": "Code protection secret used to decrypt function code.",
@@ -5444,11 +5482,14 @@ exports.functions = (0, types_js_1.defineModule)({
5444
5482
  "schema.query.layerName": "Layer name. Required for `listLayerVersions` and `getLayerVersionDetail`. Layers use an account-level shared namespace; use the fixed format `{layerName}_{current envId}` (for example, common_cloud1-d9ghadgak3edf6b36).",
5445
5483
  "schema.query.layerVersion": "Layer version number. Required for `getLayerVersionDetail`.",
5446
5484
  "schema.query.taskId": "Async deployment task ID for `getFunctionDeployStatus` (returned by manageFunctions with wait=false). Tasks exist only in current MCP process memory: terminal tasks are retained for about 30 minutes and running tasks for at most 2 hours.",
5447
- "schema.manage.action": "Write action type, such as createFunction, updateFunctionCode, incrementalDeployFunction, invokeFunction, deleteFunction, createFunctionTrigger (scheduled task / cron / timer), deleteFunctionTrigger, createLayerVersion, deleteLayerVersion, attachLayer, detachLayer, or updateFunctionLayers. Use the fixed layer naming format `{layerName}_{current envId}` (for example, common_cloud1-d9ghadgak3edf6b36).",
5485
+ "schema.query.order": "Sort direction for `listVersionByFunction`, such as ASC / DESC.",
5486
+ "schema.query.orderBy": "Sort field for `listVersionByFunction`, such as AddTime / ModTime.",
5487
+ "schema.query.aliasName": "Alias name for `getFunctionAlias`. Defaults to `$DEFAULT` when omitted (same as tcb fn get-route).",
5488
+ "schema.manage.action": "Write action type, such as createFunction, updateFunctionCode, incrementalDeployFunction, invokeFunction, deleteFunction, createFunctionTrigger (scheduled task / cron / timer), deleteFunctionTrigger, createLayerVersion, deleteLayerVersion, attachLayer, detachLayer, updateFunctionLayers, publishVersion (publish a new version; aligns with tcb fn publish-version), or updateFunctionAliasConfig (update alias / traffic routing; aligns with tcb fn config-route). Use the fixed layer naming format `{layerName}_{current envId}` (for example, common_cloud1-d9ghadgak3edf6b36).",
5448
5489
  "schema.manage.func": "Function configuration for createFunction / updateFunctionCode. Image/build deployment is selected by func.buildStrategy (zip/cloud/local/image), with image fields under func.imageConfig.",
5449
5490
  "schema.manage.functionRootPath": "Recommended local-directory input for creating or updating function code. It must be the absolute directory that directly contains function folders (for example, /abs/path/cloudfunctions or /abs/path/functions), not the project root or the function subdirectory. Local layout should be cloudfunctions/<functionName>/index.js or functions/<functionName>/index.js. Pass the absolute cloudfunctions/functions directory; the SDK appends the function subdirectory. Do not precompress ZIP or base64 content.",
5450
5491
  "schema.manage.force": "Whether createFunction overwrites an existing function.",
5451
- "schema.manage.functionName": "Target function name at the top level. Used by updateFunctionCode, updateFunctionConfig, invokeFunction, and similar actions. createFunction uses func.name; other actions use top-level functionName. A mistakenly supplied func.name is also recognized as functionName.",
5492
+ "schema.manage.functionName": "Target function name at the top level. Used by updateFunctionCode, updateFunctionConfig, invokeFunction, publishVersion, updateFunctionAliasConfig, and similar actions. createFunction uses func.name; other actions use top-level functionName. A mistakenly supplied func.name is also recognized as functionName.",
5452
5493
  "schema.manage.zipFile": "Compatibility only: base64-encoded prebuilt code package. For ordinary createFunction/updateFunctionCode, do not create a ZIP first; prefer functionRootPath.",
5453
5494
  "schema.manage.handler": "Function entry point",
5454
5495
  "schema.manage.timeout": "Timeout used for configuration updates.",
@@ -5462,7 +5503,7 @@ exports.functions = (0, types_js_1.defineModule)({
5462
5503
  "schema.manage.contentPath": "Layer content path, either a directory or ZIP file.",
5463
5504
  "schema.manage.base64Content": "Base64-encoded layer content.",
5464
5505
  "schema.manage.runtimes": "Runtimes supported by the layer.",
5465
- "schema.manage.description": "Layer version description.",
5506
+ "schema.manage.description": "Description. Layer version description for createLayerVersion; version or alias description for publishVersion / updateFunctionAliasConfig.",
5466
5507
  "schema.manage.licenseInfo": "Layer license information.",
5467
5508
  "schema.manage.layers": "Target layer list for updateFunctionLayers; array order becomes final order.",
5468
5509
  "schema.manage.codeSecret": "Code protection secret used when binding a layer.",
@@ -5471,6 +5512,17 @@ exports.functions = (0, types_js_1.defineModule)({
5471
5512
  "schema.manage.autoGrant": "Whether manager-node may automatically add the fixed allowlist of CAM policies for image deployment. Defaults to false; set true only after explicitly confirming permission changes.",
5472
5513
  "schema.manage.confirm": "Dangerous-operation confirmation. deleteFunction, deleteFunctionTrigger, deleteLayerVersion, detachLayer, other delete actions, and real image build deployment (func.buildStrategy=cloud/local) require confirm=true.",
5473
5514
  "schema.manage.incrementalFile": "Changed-file path for incrementalDeployFunction incremental deployment.",
5515
+ "schema.manage.aliasName": "Alias name for `updateFunctionAliasConfig`. Defaults to `$DEFAULT` when omitted (same as tcb fn config-route).",
5516
+ "schema.manage.functionVersion": "Primary version for `updateFunctionAliasConfig`. May be a concrete version number or `$LATEST`.",
5517
+ "schema.manage.routingConfig": "Traffic routing config for `updateFunctionAliasConfig`. AdditionalVersionWeights is used for canary weights; AddtionVersionMatchs keeps the SCF/SDK historical field name (including the typo).",
5518
+ "schema.routing.version": "Additional traffic version number",
5519
+ "schema.routing.weight": "Additional traffic weight (0-1 or percentage per SCF convention)",
5520
+ "schema.routing.matchVersion": "Version targeted by a match rule",
5521
+ "schema.routing.matchKey": "Header/Query key for a match rule",
5522
+ "schema.routing.matchMethod": "Match method, such as Exact / Regex",
5523
+ "schema.routing.matchExpression": "Match expression",
5524
+ "schema.routing.additionalWeights": "Additional version weight list (canary release)",
5525
+ "schema.routing.additionalMatches": "Additional version match rules (field name keeps SCF AddtionVersionMatchs)",
5474
5526
  });
5475
5527
 
5476
5528
 
@@ -5804,10 +5856,11 @@ exports.hosting = (0, types_js_1.defineModule)({
5804
5856
  queryDescription: "查询 CloudBase 静态托管的只读信息。适合 AI 先做发现再决定下一步:action=websiteConfig 查询首页/错误页/路由规则与站点域名信息;action=status 查询托管服务状态;action=findFiles 按前缀查找文件;action=listFiles 列出全部托管文件;action=domainStatus 查询自定义域名的当前状态与配置。该工具不会产生任何副作用。",
5805
5857
  manageTitle: "管理 CloudBase 静态托管",
5806
5858
  manageDescription: "管理 CloudBase 静态托管的变更操作。action=upload 上传本地构建产物到共享域名(域名格式:<envId>-<appId>.tcloudbaseapp.com/<cloudPath>);action=delete 删除托管文件或目录(必须 confirm=true);action=setWebsiteDocument 设置首页/错误页/路由规则;action=enableService 开通静态托管;action=bindDomain / unbindDomain / updateDomain 管理自定义域名;action=downloadFile / downloadDirectory 下载托管内容到本地。⚠️ 底层每次托管操作都会请求 DescribeStaticStore 管控接口(20 次/秒 QPS 限制):批量删除多个文件请逐次调用并保持间隔(建议每秒不超过 10 次),同一目录下多个文件可优先用 isDir=true 一次删除整个目录;若报错含 \"frequency limit\" 说明触发了限流,请等待 1-2 秒后重试,不要连续快速重试。⚠️ 本工具没有关闭默认域名(*.tcloudbaseapp.com)的 action;要禁用该默认公网域名,请用 manageGateway(action=\"disableRoute\", domain=该 STATIC_STORE IsDefault 域名, path=\"/\")(底层 ModifyHTTPServiceRoute,不是 ModifyGatewayRoute)。⚠️ 新项目部署优先使用 manageApps(部署到独立子域名),本工具适合已有老项目继续使用或作为 manageApps 的 fallback。manageApps 与 manageHosting 域名不同,切换会导致老链接失效。若任务只是查看配置、文件或域名状态,请改用 queryHosting。",
5859
+ manageDescriptionCloud: "管理 CloudBase 静态托管的变更操作(cloud mode 版本)。⚠️ 依赖本地文件路径的 action 在 cloud mode 下不可用:action=upload / downloadFile / downloadDirectory 会直接报错,请勿调用。部署静态站点请改用 manageApps 云端链路:queryApps(action=\"getUploadUrl\", serviceName=\"<应用名>\") 获取预签名上传 URL → 将代码 zip PUT 上传到 uploadUrl(带 uploadHeaders 与 Content-Type: application/zip)→ manageApps(action=\"deployApp\", serviceName, cosTimestamp=<返回的 unixTimestamp>) 触发部署。可正常使用的远端管理操作:action=delete 删除托管文件或目录(必须 confirm=true);action=setWebsiteDocument 设置首页/错误页/路由规则;action=enableService 开通静态托管;action=bindDomain / unbindDomain / updateDomain 管理自定义域名。⚠️ 底层每次托管操作都会请求 DescribeStaticStore 管控接口(20 次/秒 QPS 限制):批量删除多个文件请逐次调用并保持间隔(建议每秒不超过 10 次);若报错含 \"frequency limit\" 说明触发了限流,请等待 1-2 秒后重试。若任务只是查看配置、文件或域名状态,请改用 queryHosting。",
5807
5860
  commonServiceUnsupported: "当前 CloudBase Manager 实例不支持 commonService.call,无法执行 {action}。",
5808
5861
  managerUnavailable: "CloudBase Manager 实例不可用。",
5809
5862
  hostingStoreMissing: "当前环境 {envId} 未发现静态托管资源配置,无法上传文件。请先确认 MCP 已绑定到已开通静态托管的 CloudBase 环境;如需切换环境,请调用 auth(action=\"set_env\", envId=\"目标环境ID\") 后重试。",
5810
- cloudModeLocalActionUnavailable: "manageHosting(action=\"{action}\") 在 cloud mode 下不可用,因为该操作依赖本地文件路径。请改用本地模式执行;若只需要远端管理静态托管,可继续使用 delete / setWebsiteDocument / enableService / bindDomain / unbindDomain / updateDomain。",
5863
+ cloudModeLocalActionUnavailable: "manageHosting(action=\"{action}\") 在 cloud mode 下不可用,因为该操作依赖本地文件路径。若需要部署静态站点,请改用 manageApps 云端链路:queryApps(action=\"getUploadUrl\", serviceName=\"<应用名>\") 获取预签名上传 URL → 将代码 zip PUT 上传到 uploadUrl(带 uploadHeaders 与 Content-Type: application/zip)→ manageApps(action=\"deployApp\", serviceName, cosTimestamp=<返回的 unixTimestamp>) 触发部署;若只是要上传/下载已有托管文件且无本地文件系统,该操作在云端没有替代路径,请改用本地模式执行。远端管理操作(delete / setWebsiteDocument / enableService / bindDomain / unbindDomain / updateDomain)不受影响,可继续使用。",
5811
5864
  uploadArgsRequired: "manageHosting(action=\"upload\") 需要提供 localPath + cloudPath,或提供 files 多文件上传列表。",
5812
5865
  uploadSuccess: "静态托管文件上传成功。若需要校验上传结果,请继续调用 queryHosting(action=\"findFiles\") 或 queryHosting(action=\"listFiles\")。",
5813
5866
  uploadRouteDisabledWithFallback: "静态托管文件上传成功。默认静态托管域名的网关路由已禁用(访问会返回 GATEWAY_ROUTE_DISABLED),已改用其他可达域名作为 accessUrl。可用 manageGateway(action=\"updateRoute\", route.enable=true) 重新启用默认域路由。",
@@ -5907,10 +5960,11 @@ exports.hosting = (0, types_js_1.defineModule)({
5907
5960
  queryDescription: "Read-only information about CloudBase static hosting. Lets the AI discover state first and then decide the next step: action=websiteConfig queries the index/error document, routing rules, and site domain info; action=status queries the hosting service status; action=findFiles finds files by prefix; action=listFiles lists all hosted files; action=domainStatus queries the current status and configuration of custom domains. This tool has no side effects.",
5908
5961
  manageTitle: "Manage CloudBase static hosting",
5909
5962
  manageDescription: "Mutation operations for CloudBase static hosting. action=upload uploads local build artifacts to the shared domain (domain format: <envId>-<appId>.tcloudbaseapp.com/<cloudPath>); action=delete deletes hosted files or directories (confirm=true required); action=setWebsiteDocument sets the index/error document and routing rules; action=enableService enables static hosting; action=bindDomain / unbindDomain / updateDomain manage custom domains; action=downloadFile / downloadDirectory download hosted content to local disk. ⚠️ Every hosting operation calls the DescribeStaticStore control-plane API underneath (20 req/s QPS limit): when deleting multiple files, call sequentially with intervals (no more than 10 calls per second recommended); for multiple files in the same directory, prefer isDir=true to delete the whole directory in one call. If the error contains \"frequency limit\", rate limiting was triggered — wait 1-2 seconds and retry; do not retry in rapid succession. ⚠️ This tool has no action to disable the default domain (*.tcloudbaseapp.com); to disable that default public domain, use manageGateway(action=\"disableRoute\", domain=the STATIC_STORE IsDefault domain, path=\"/\") (backed by ModifyHTTPServiceRoute, not ModifyGatewayRoute). ⚠️ For new projects prefer manageApps (deploys to a dedicated subdomain); this tool suits existing legacy projects or as a fallback for manageApps. manageApps and manageHosting use different domains, so switching invalidates old links. If the task is only inspecting config, files, or domain status, use queryHosting instead.",
5963
+ manageDescriptionCloud: "Mutation operations for CloudBase static hosting (cloud mode variant). ⚠️ Actions that depend on local file paths are unavailable in cloud mode: action=upload / downloadFile / downloadDirectory will fail immediately — do not call them. To deploy a static site, use the manageApps cloud path instead: queryApps(action=\"getUploadUrl\", serviceName=\"<app name>\") to get a presigned upload URL → PUT the code zip to uploadUrl (with uploadHeaders and Content-Type: application/zip) → manageApps(action=\"deployApp\", serviceName, cosTimestamp=<returned unixTimestamp>) to trigger deployment. Remote-only management actions remain available: action=delete deletes hosted files or directories (confirm=true required); action=setWebsiteDocument sets the index/error document and routing rules; action=enableService enables static hosting; action=bindDomain / unbindDomain / updateDomain manage custom domains. ⚠️ Every hosting operation calls the DescribeStaticStore control-plane API underneath (20 req/s QPS limit): when deleting multiple files, call sequentially with intervals (no more than 10 calls per second recommended); if the error contains \"frequency limit\", rate limiting was triggered — wait 1-2 seconds and retry. If the task is only inspecting config, files, or domain status, use queryHosting instead.",
5910
5964
  commonServiceUnsupported: "The current CloudBase Manager instance does not support commonService.call; cannot execute {action}.",
5911
5965
  managerUnavailable: "CloudBase manager is unavailable.",
5912
5966
  hostingStoreMissing: "No static hosting storage config found for environment {envId}; cannot upload files. Make sure MCP is bound to a CloudBase environment with static hosting enabled; to switch environments, call auth(action=\"set_env\", envId=\"<target env ID>\") and retry.",
5913
- cloudModeLocalActionUnavailable: "manageHosting(action=\"{action}\") is unavailable in cloud mode because the operation depends on local file paths. Run MCP in local mode instead; for remote-only static hosting management, you can still use delete / setWebsiteDocument / enableService / bindDomain / unbindDomain / updateDomain.",
5967
+ cloudModeLocalActionUnavailable: "manageHosting(action=\"{action}\") is unavailable in cloud mode because the operation depends on local file paths. To deploy a static site, use the manageApps cloud path instead: queryApps(action=\"getUploadUrl\", serviceName=\"<app name>\") to get a presigned upload URL → PUT the code zip to uploadUrl (with uploadHeaders and Content-Type: application/zip) → manageApps(action=\"deployApp\", serviceName, cosTimestamp=<returned unixTimestamp>) to trigger deployment. If you only need to upload/download existing hosted files and there is no local filesystem, there is no cloud alternative for this action — run MCP in local mode instead. Remote-only management actions (delete / setWebsiteDocument / enableService / bindDomain / unbindDomain / updateDomain) are unaffected and remain available.",
5914
5968
  uploadArgsRequired: "manageHosting(action=\"upload\") requires localPath + cloudPath, or a files list for multi-file upload.",
5915
5969
  uploadSuccess: "Static hosting files uploaded. To verify the upload result, call queryHosting(action=\"findFiles\") or queryHosting(action=\"listFiles\").",
5916
5970
  uploadRouteDisabledWithFallback: "Static hosting files uploaded. The gateway route for the default static hosting domain is disabled (access returns GATEWAY_ROUTE_DISABLED); another reachable domain is used as accessUrl. Use manageGateway(action=\"updateRoute\", route.enable=true) to re-enable the default domain route.",
@@ -6639,6 +6693,8 @@ exports.rag = (0, types_js_1.defineModule)({
6639
6693
  findByNameSuccess: "CloudBase 文档查找成功",
6640
6694
  readDocSuccess: "CloudBase 文档读取成功",
6641
6695
  readDocNotMarkdown: "文档 {docPath} 没有可用的 Markdown 版本(站点对该路径返回了 HTML 页面)。请用 action=searchDocs 或 action=findByName 确认正确地址后重试;也可以直接抓取网页版:{pageUrl}",
6696
+ readDocUrlNotAllowed: "readDoc 只读取 CloudBase 官方文档站({host})上的文档,不接受其他主机的地址:{docPath}。请改传站内相对路径(如 /quick-start),或该文档站上的地址。",
6697
+ readDocPathEmpty: "readDoc 需要一个具体文档路径,{docPath} 里没有路径部分。例如传 /quick-start,或传 action=findByName / action=searchDocs 返回的文档地址。",
6642
6698
  searchDocsSuccess: "CloudBase 文档搜索成功",
6643
6699
  skillNotFound: "未找到技能文档 \"{skillName}\"。可用技能文档:{available}。{remoteHint}",
6644
6700
  skillRemoteHint: " 你也可以直接从这个地址获取技能文档:{url}",
@@ -6659,7 +6715,7 @@ exports.rag = (0, types_js_1.defineModule)({
6659
6715
  "schema.action": "仅 mode=docs 时指定;mode=openapi 不要传 action。CloudBase 文档操作类型:listModules=列出所有文档模块,listModuleDocs=获取指定模块的目录结构,findByName=按名称/路径/URL 智能查找,readDoc=读取指定文档 Markdown,searchDocs=全文搜索官方文档。",
6660
6716
  "schema.moduleName": "mode=docs 且 action=listModuleDocs 时指定。模块名称。",
6661
6717
  "schema.input": "mode=docs 且 action=findByName 时指定。支持模块名、文档标题、层级路径或 URL。",
6662
- "schema.docPath": "mode=docs 且 action=readDoc 时指定。文档相对路径或完整 URL。",
6718
+ "schema.docPath": "mode=docs 且 action=readDoc 时指定。站内相对路径(如 /quick-start),或 action=findByName / action=searchDocs 返回的文档地址 —— 传地址时只取其中的路径,主机部分一律忽略。",
6663
6719
  "schema.query": "mode=docs 且 action=searchDocs 时指定。全文检索关键词。",
6664
6720
  }, {
6665
6721
  title: "CloudBase knowledge base search",
@@ -6695,6 +6751,8 @@ exports.rag = (0, types_js_1.defineModule)({
6695
6751
  findByNameSuccess: "CloudBase doc lookup succeeded",
6696
6752
  readDocSuccess: "CloudBase doc read successfully",
6697
6753
  readDocNotMarkdown: "No Markdown version is available for {docPath} (the site returned an HTML page for it). Use action=searchDocs or action=findByName to confirm the correct address and retry; you can also fetch the rendered page directly: {pageUrl}",
6754
+ readDocUrlNotAllowed: "readDoc only reads documents on the official CloudBase docs site ({host}); other hosts are not accepted: {docPath}. Pass a site-relative path such as /quick-start, or an address on that docs site.",
6755
+ readDocPathEmpty: "readDoc needs a concrete document path; {docPath} carries no path. For example pass /quick-start, or a document address returned by action=findByName / action=searchDocs.",
6698
6756
  searchDocsSuccess: "CloudBase doc search succeeded",
6699
6757
  skillNotFound: "Skill document \"{skillName}\" not found. Available skill docs: {available}.{remoteHint}",
6700
6758
  skillRemoteHint: " You can also try fetching the skill doc directly from: {url}",
@@ -6715,7 +6773,7 @@ exports.rag = (0, types_js_1.defineModule)({
6715
6773
  "schema.action": "Only for mode=docs; do not pass action with mode=openapi. CloudBase documentation action: listModules lists all documentation modules; listModuleDocs gets the catalog for a module; findByName searches intelligently by name, path, or URL; readDoc reads document Markdown; searchDocs performs a full-text search of the official documentation.",
6716
6774
  "schema.moduleName": "Required when mode=docs and action=listModuleDocs. The module name.",
6717
6775
  "schema.input": "Required when mode=docs and action=findByName. Accepts a module name, document title, hierarchical path, or URL.",
6718
- "schema.docPath": "Required when mode=docs and action=readDoc. A relative document path or full URL.",
6776
+ "schema.docPath": "Required when mode=docs and action=readDoc. A site-relative path such as /quick-start, or a document address returned by action=findByName / action=searchDocs — only the path is used; any host is ignored.",
6719
6777
  "schema.query": "Required when mode=docs and action=searchDocs. Full-text search keywords.",
6720
6778
  });
6721
6779
 
@@ -9117,6 +9175,8 @@ exports.MZ = {
9117
9175
  tag: ["2018-08-13"],
9118
9176
  billing: ["2018-07-09"],
9119
9177
  region: ["2022-06-27"],
9178
+ // 备案
9179
+ ba: ["2020-07-20"],
9120
9180
  // 计算 / 容器 / 存储
9121
9181
  cvm: ["2017-03-12"],
9122
9182
  lighthouse: ["2020-03-24"],
@@ -23844,7 +23904,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
23844
23904
  return (mod && mod.__esModule) ? mod : { "default": mod };
23845
23905
  };
23846
23906
  Object.defineProperty(exports, "__esModule", ({ value: true }));
23847
- exports.CUSTOM_IMAGE_RUNTIME = exports.MASKED_ENV_VALUE = exports.LAYER_SOFT_WARN = exports.MANAGE_FUNCTION_ACTIONS = exports.QUERY_FUNCTION_ACTIONS = exports.TRIGGER_CONFIG_EXAMPLES = exports.SUPPORTED_TRIGGER_TYPES = exports.DEFAULT_NODEJS_RUNTIME = exports.SUPPORTED_NODEJS_RUNTIMES = exports.RECOMMENDED_RUNTIMES = exports.DEFAULT_RUNTIME = exports.ALL_SUPPORTED_RUNTIMES = exports.SUPPORTED_RUNTIMES = void 0;
23907
+ exports.CUSTOM_IMAGE_RUNTIME = exports.MASKED_ENV_VALUE = exports.LAYER_SOFT_WARN = exports.DEFAULT_FUNCTION_ALIAS = exports.MANAGE_FUNCTION_ACTIONS = exports.QUERY_FUNCTION_ACTIONS = exports.TRIGGER_CONFIG_EXAMPLES = exports.SUPPORTED_TRIGGER_TYPES = exports.DEFAULT_NODEJS_RUNTIME = exports.SUPPORTED_NODEJS_RUNTIMES = exports.RECOMMENDED_RUNTIMES = exports.DEFAULT_RUNTIME = exports.ALL_SUPPORTED_RUNTIMES = exports.SUPPORTED_RUNTIMES = void 0;
23848
23908
  exports.formatRuntimeList = formatRuntimeList;
23849
23909
  exports.layerNameIncludesEnvId = layerNameIncludesEnvId;
23850
23910
  exports.buildCreateLayerNameWarning = buildCreateLayerNameWarning;
@@ -23943,6 +24003,8 @@ exports.QUERY_FUNCTION_ACTIONS = [
23943
24003
  "listFunctionTriggers",
23944
24004
  "getFunctionDownloadUrl",
23945
24005
  "getFunctionDeployStatus",
24006
+ "listVersionByFunction",
24007
+ "getFunctionAlias",
23946
24008
  ];
23947
24009
  exports.MANAGE_FUNCTION_ACTIONS = [
23948
24010
  "createFunction",
@@ -23957,8 +24019,12 @@ exports.MANAGE_FUNCTION_ACTIONS = [
23957
24019
  "attachLayer",
23958
24020
  "detachLayer",
23959
24021
  "updateFunctionLayers",
24022
+ "publishVersion",
24023
+ "updateFunctionAliasConfig",
23960
24024
  "incrementalDeployFunction", // 增量部署,需通过 pluginOptions.functions 注入实现
23961
24025
  ];
24026
+ /** Default SCF traffic alias used by CloudBase CLI `fn get-route` / `fn config-route`. */
24027
+ exports.DEFAULT_FUNCTION_ALIAS = "$DEFAULT";
23962
24028
  /** Layer soft-warn copy — account-scoped SCF LayerName guidance (no hard fail). */
23963
24029
  exports.LAYER_SOFT_WARN = {
23964
24030
  createNameFormat: (envId) => (0, index_js_1.t)("functions.layerWarn.createNameFormat", { envId }),
@@ -24118,6 +24184,27 @@ const MANAGE_LAYER_SCHEMA = zod_1.z.object({
24118
24184
  layerName: zod_1.z.string().describe("functions.schema.manageLayer.name"),
24119
24185
  layerVersion: zod_1.z.number().describe("functions.schema.manageLayer.version"),
24120
24186
  });
24187
+ const FUNCTION_VERSION_WEIGHT_SCHEMA = zod_1.z.object({
24188
+ Version: zod_1.z.string().describe("functions.schema.routing.version"),
24189
+ Weight: zod_1.z.number().describe("functions.schema.routing.weight"),
24190
+ });
24191
+ const FUNCTION_VERSION_MATCH_SCHEMA = zod_1.z.object({
24192
+ Version: zod_1.z.string().describe("functions.schema.routing.matchVersion"),
24193
+ Key: zod_1.z.string().describe("functions.schema.routing.matchKey"),
24194
+ Method: zod_1.z.string().describe("functions.schema.routing.matchMethod"),
24195
+ Expression: zod_1.z.string().describe("functions.schema.routing.matchExpression"),
24196
+ });
24197
+ const FUNCTION_ROUTING_CONFIG_SCHEMA = zod_1.z.object({
24198
+ AdditionalVersionWeights: zod_1.z
24199
+ .array(FUNCTION_VERSION_WEIGHT_SCHEMA)
24200
+ .optional()
24201
+ .describe("functions.schema.routing.additionalWeights"),
24202
+ // Keep SCF/SDK historical field name (typo included) as the public contract.
24203
+ AddtionVersionMatchs: zod_1.z
24204
+ .array(FUNCTION_VERSION_MATCH_SCHEMA)
24205
+ .optional()
24206
+ .describe("functions.schema.routing.additionalMatches"),
24207
+ });
24121
24208
  /**
24122
24209
  * Prefer top-level functionName; fall back to func.name for the common
24123
24210
  * mistake of nesting the target name under func (createFunction shape).
@@ -24684,6 +24771,78 @@ function registerFunctionTools(server) {
24684
24771
  raw: result,
24685
24772
  }, (0, index_js_1.t)("functions.gotDownloadUrl", { fnName: input.functionName }));
24686
24773
  }
24774
+ case "listVersionByFunction": {
24775
+ if (!input.functionName) {
24776
+ throw new Error((0, index_js_1.t)("functions.paramRequired", { action: input.action, param: "functionName" }));
24777
+ }
24778
+ const cloudbase = await getManager();
24779
+ const result = await cloudbase.functions.listVersionByFunction({
24780
+ functionName: input.functionName,
24781
+ offset: input.offset,
24782
+ limit: input.limit,
24783
+ order: input.order,
24784
+ orderBy: input.orderBy,
24785
+ });
24786
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
24787
+ return buildEnvelope({
24788
+ action: input.action,
24789
+ functionName: input.functionName,
24790
+ functionVersions: result.FunctionVersion || [],
24791
+ versions: result.Versions || [],
24792
+ totalCount: result.TotalCount,
24793
+ requestId: result.RequestId,
24794
+ raw: result,
24795
+ }, (0, index_js_1.t)("functions.gotFunctionVersions", { fnName: input.functionName }), [
24796
+ {
24797
+ tool: "manageFunctions",
24798
+ action: "publishVersion",
24799
+ reason: (0, index_js_1.t)("functions.reason.publishVersion"),
24800
+ },
24801
+ {
24802
+ tool: "queryFunctions",
24803
+ action: "getFunctionAlias",
24804
+ reason: (0, index_js_1.t)("functions.reason.getFunctionAlias"),
24805
+ },
24806
+ ]);
24807
+ }
24808
+ case "getFunctionAlias": {
24809
+ if (!input.functionName) {
24810
+ throw new Error((0, index_js_1.t)("functions.paramRequired", { action: input.action, param: "functionName" }));
24811
+ }
24812
+ const aliasName = input.aliasName || exports.DEFAULT_FUNCTION_ALIAS;
24813
+ const cloudbase = await getManager();
24814
+ const result = await cloudbase.functions.getFunctionAlias({
24815
+ functionName: input.functionName,
24816
+ name: aliasName,
24817
+ });
24818
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
24819
+ return buildEnvelope({
24820
+ action: input.action,
24821
+ functionName: input.functionName,
24822
+ aliasName,
24823
+ functionVersion: result.FunctionVersion,
24824
+ routingConfig: result.RoutingConfig,
24825
+ description: result.Description,
24826
+ addTime: result.AddTime,
24827
+ modTime: result.ModTime,
24828
+ requestId: result.RequestId,
24829
+ raw: result,
24830
+ }, (0, index_js_1.t)("functions.gotFunctionAlias", {
24831
+ fnName: input.functionName,
24832
+ aliasName,
24833
+ }), [
24834
+ {
24835
+ tool: "manageFunctions",
24836
+ action: "updateFunctionAliasConfig",
24837
+ reason: (0, index_js_1.t)("functions.reason.updateFunctionAlias"),
24838
+ },
24839
+ {
24840
+ tool: "queryFunctions",
24841
+ action: "listVersionByFunction",
24842
+ reason: (0, index_js_1.t)("functions.reason.listVersions"),
24843
+ },
24844
+ ]);
24845
+ }
24687
24846
  default:
24688
24847
  throw new Error((0, index_js_1.t)("functions.unsupportedAction", { action: input.action }));
24689
24848
  }
@@ -25522,6 +25681,94 @@ function registerFunctionTools(server) {
25522
25681
  },
25523
25682
  ], bindWarnings);
25524
25683
  }
25684
+ case "publishVersion": {
25685
+ if (!input.functionName) {
25686
+ throw new Error((0, index_js_1.t)("functions.paramRequired", { action: input.action, param: "functionName" }));
25687
+ }
25688
+ const cloudbase = await getManager();
25689
+ const result = await cloudbase.functions.publishVersion({
25690
+ functionName: input.functionName,
25691
+ description: input.description,
25692
+ });
25693
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
25694
+ return buildEnvelope({
25695
+ action: input.action,
25696
+ functionName: input.functionName,
25697
+ functionVersion: result.FunctionVersion,
25698
+ description: result.Description,
25699
+ codeSize: result.CodeSize,
25700
+ memorySize: result.MemorySize,
25701
+ handler: result.Handler,
25702
+ timeout: result.Timeout,
25703
+ runtime: result.Runtime,
25704
+ namespace: result.Namespace,
25705
+ requestId: result.RequestId,
25706
+ raw: result,
25707
+ }, (0, index_js_1.t)("functions.publishedVersion", {
25708
+ fnName: input.functionName,
25709
+ version: result.FunctionVersion,
25710
+ }), [
25711
+ {
25712
+ tool: "queryFunctions",
25713
+ action: "listVersionByFunction",
25714
+ reason: (0, index_js_1.t)("functions.reason.listVersions"),
25715
+ },
25716
+ {
25717
+ tool: "manageFunctions",
25718
+ action: "updateFunctionAliasConfig",
25719
+ reason: (0, index_js_1.t)("functions.reason.routeTraffic"),
25720
+ suggested_args: {
25721
+ functionName: input.functionName,
25722
+ functionVersion: result.FunctionVersion,
25723
+ aliasName: exports.DEFAULT_FUNCTION_ALIAS,
25724
+ },
25725
+ },
25726
+ ]);
25727
+ }
25728
+ case "updateFunctionAliasConfig": {
25729
+ if (!input.functionName) {
25730
+ throw new Error((0, index_js_1.t)("functions.paramRequired", { action: input.action, param: "functionName" }));
25731
+ }
25732
+ if (!input.functionVersion) {
25733
+ throw new Error((0, index_js_1.t)("functions.paramRequired", {
25734
+ action: input.action,
25735
+ param: "functionVersion",
25736
+ }));
25737
+ }
25738
+ const aliasName = input.aliasName || exports.DEFAULT_FUNCTION_ALIAS;
25739
+ const cloudbase = await getManager();
25740
+ const result = await cloudbase.functions.updateFunctionAliasConfig({
25741
+ functionName: input.functionName,
25742
+ name: aliasName,
25743
+ functionVersion: input.functionVersion,
25744
+ description: input.description,
25745
+ routingConfig: input.routingConfig,
25746
+ });
25747
+ (0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
25748
+ return buildEnvelope({
25749
+ action: input.action,
25750
+ functionName: input.functionName,
25751
+ aliasName,
25752
+ functionVersion: input.functionVersion,
25753
+ routingConfig: input.routingConfig,
25754
+ requestId: result.RequestId,
25755
+ raw: result,
25756
+ }, (0, index_js_1.t)("functions.updatedFunctionAlias", {
25757
+ fnName: input.functionName,
25758
+ aliasName,
25759
+ version: input.functionVersion,
25760
+ }), [
25761
+ {
25762
+ tool: "queryFunctions",
25763
+ action: "getFunctionAlias",
25764
+ reason: (0, index_js_1.t)("functions.reason.confirmAlias"),
25765
+ suggested_args: {
25766
+ functionName: input.functionName,
25767
+ aliasName,
25768
+ },
25769
+ },
25770
+ ]);
25771
+ }
25525
25772
  default:
25526
25773
  // incrementalDeployFunction:无默认实现,必须通过 pluginOptions 注入
25527
25774
  if (input.action === 'incrementalDeployFunction') {
@@ -25581,6 +25828,12 @@ function registerFunctionTools(server) {
25581
25828
  .string()
25582
25829
  .optional()
25583
25830
  .describe("functions.schema.query.taskId"),
25831
+ order: zod_1.z.string().optional().describe("functions.schema.query.order"),
25832
+ orderBy: zod_1.z.string().optional().describe("functions.schema.query.orderBy"),
25833
+ aliasName: zod_1.z
25834
+ .string()
25835
+ .optional()
25836
+ .describe("functions.schema.query.aliasName"),
25584
25837
  },
25585
25838
  annotations: {
25586
25839
  readOnlyHint: true,
@@ -25649,6 +25902,15 @@ function registerFunctionTools(server) {
25649
25902
  .describe("functions.schema.manage.autoGrant"),
25650
25903
  confirm: zod_1.z.boolean().optional().describe("functions.schema.manage.confirm"),
25651
25904
  incrementalFile: zod_1.z.string().optional().describe("functions.schema.manage.incrementalFile"),
25905
+ aliasName: zod_1.z
25906
+ .string()
25907
+ .optional()
25908
+ .describe("functions.schema.manage.aliasName"),
25909
+ functionVersion: zod_1.z
25910
+ .string()
25911
+ .optional()
25912
+ .describe("functions.schema.manage.functionVersion"),
25913
+ routingConfig: FUNCTION_ROUTING_CONFIG_SCHEMA.optional().describe("functions.schema.manage.routingConfig"),
25652
25914
  },
25653
25915
  annotations: {
25654
25916
  readOnlyHint: false,
@@ -27787,7 +28049,12 @@ function registerHostingTools(server) {
27787
28049
  });
27788
28050
  server.registerTool('manageHosting', {
27789
28051
  title: 'hosting.manageTitle',
27790
- description: 'hosting.manageDescription',
28052
+ // cloud mode 下注册期即切换描述:upload/download 系 action 不可用、部署引导走
28053
+ // manageApps 云端链路(getUploadUrl → PUT zip → deployApp(cosTimestamp)),
28054
+ // 让 agent 在 tools/list 阶段就避开必败调用,而不是等报错后浪费一轮。
28055
+ description: (0, cloud_mode_js_1.isCloudMode)()
28056
+ ? 'hosting.manageDescriptionCloud'
28057
+ : 'hosting.manageDescription',
27791
28058
  inputSchema: manageHostingInputSchema,
27792
28059
  annotations: {
27793
28060
  readOnlyHint: false,
@@ -30308,9 +30575,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
30308
30575
  return (mod && mod.__esModule) ? mod : { "default": mod };
30309
30576
  };
30310
30577
  Object.defineProperty(exports, "__esModule", ({ value: true }));
30311
- exports.SKILL_REMOTE_BASE_URL = void 0;
30578
+ exports.DOCS_BASE_HOST = exports.SKILL_REMOTE_BASE_URL = void 0;
30312
30579
  exports.resolveSkillSearchRoots = resolveSkillSearchRoots;
30313
30580
  exports.resolveDocsMarkdownPath = resolveDocsMarkdownPath;
30581
+ exports.toSiteRelativeDocPath = toSiteRelativeDocPath;
30582
+ exports.assertNoHostInDocPath = assertNoHostInDocPath;
30314
30583
  exports.isDocsHtmlFallback = isDocsHtmlFallback;
30315
30584
  exports.registerRagTools = registerRagTools;
30316
30585
  exports.buildSkillRawUrl = buildSkillRawUrl;
@@ -30739,6 +31008,74 @@ function resolveDocsMarkdownPath(docPath) {
30739
31008
  : `${base.replace(/\/index$/i, "")}.md`;
30740
31009
  return `${normalized}${hash}`;
30741
31010
  }
31011
+ /**
31012
+ * 交给 `DocsService.readDoc()` 的地址**永远不含 host**。
31013
+ *
31014
+ * Manager SDK 的 `DocsService.readDoc()` 见到 `http` 前缀就把入参原样 fetch、并把整段响应体
31015
+ * 回显给调用方(`@cloudbase/manager-node/lib/docs/index.js:101`)。等于 docPath 是一条「由服务端
31016
+ * 发起任意 HTTP 请求、把响应交给调用方」的通路:只要入参能带主机,`http://127.0.0.1/...`、
31017
+ * `http://169.254.169.254/...`(云主机元数据)就能把工具变成 SSRF 原语。
31018
+ *
31019
+ * 而 docPath 收到完整 URL 是**主线用法**,不能靠「拒绝一切 URL」收口:`findByName` /
31020
+ * `listModuleDocs` 的数据源 `category.json` 里 1016 个文档值全部是
31021
+ * `https://docs.cloudbase.net/...` 形态,`searchDocs`(Algolia)返回的 `url` 也是完整地址,
31022
+ * AI 拿到之后自然是原样喂回 readDoc。
31023
+ *
31024
+ * 所以这里的做法是**剥掉主机**:官方文档站的地址只取 pathname(+ 锚点),其余主机直接拒绝。
31025
+ * 效果比白名单更强 —— 不是「允许的 host 恰好只有一个」,而是**没有任何 host 能走到 fetch**,
31026
+ * 请求目标恒为 SDK 里的 `DOCS_BASE_URL`;顺带也让 `resolveDocsMarkdownPath` 的 `.md` 后缀
31027
+ * 拼接不再可能作用在主机上(旧实现里裸主机名会被拼成 `docs.cloudbase.net.md`——`.md` 是
31028
+ * 可被第三方注册的国家顶级域)。
31029
+ */
31030
+ exports.DOCS_BASE_HOST = "docs.cloudbase.net";
31031
+ /** 带 scheme 的绝对地址(`//host/path` 这类 protocol-relative 也算「指定了主机」)。 */
31032
+ const ABSOLUTE_DOC_URL_PATTERN = /^[a-z][a-z0-9+.-]*:\/\//i;
31033
+ function parseAbsoluteDocUrl(value) {
31034
+ const candidate = value.startsWith("//") ? `https:${value}` : value;
31035
+ if (!ABSOLUTE_DOC_URL_PATTERN.test(candidate)) {
31036
+ return null;
31037
+ }
31038
+ try {
31039
+ return new URL(candidate);
31040
+ }
31041
+ catch {
31042
+ return null;
31043
+ }
31044
+ }
31045
+ /**
31046
+ * 把 docPath 折成站内相对路径:官方文档站地址**丢掉 host**只留路径,非首方主机直接拒绝。
31047
+ *
31048
+ * 查询串一并丢弃:站点用 `<路径>.md` 寻址,query 不属于寻址的一部分,留着只会拼出
31049
+ * `.../x.md?foo` 这种畸形地址。锚点保留(`resolveDocsMarkdownPath` 本就支持 `#`)。
31050
+ */
31051
+ function toSiteRelativeDocPath(docPath) {
31052
+ const raw = docPath.trim();
31053
+ const parsed = parseAbsoluteDocUrl(raw);
31054
+ if (!parsed) {
31055
+ return raw;
31056
+ }
31057
+ const host = parsed.hostname.toLowerCase().replace(/\.$/, "");
31058
+ const isAllowedProtocol = parsed.protocol === "http:" || parsed.protocol === "https:";
31059
+ if (!isAllowedProtocol || host !== exports.DOCS_BASE_HOST) {
31060
+ throw new Error((0, index_js_1.t)("rag.readDocUrlNotAllowed", { docPath: raw, host: exports.DOCS_BASE_HOST }));
31061
+ }
31062
+ const sitePath = `${parsed.pathname}${parsed.hash}`;
31063
+ if (!sitePath.replace(/^\/+|\/+$/g, "")) {
31064
+ throw new Error((0, index_js_1.t)("rag.readDocPathEmpty", { docPath: raw }));
31065
+ }
31066
+ return sitePath;
31067
+ }
31068
+ /**
31069
+ * invariant:走到 SDK 的地址不能含 host。
31070
+ *
31071
+ * 归一化之后再过一次,保证「fetch 目标恒为首方基址」这条性质不依赖
31072
+ * `resolveDocsMarkdownPath` 的实现细节 —— 它以后改动了也漏不掉。
31073
+ */
31074
+ function assertNoHostInDocPath(sitePath) {
31075
+ if (parseAbsoluteDocUrl(sitePath.trim())) {
31076
+ throw new Error((0, index_js_1.t)("rag.readDocUrlNotAllowed", { docPath: sitePath, host: exports.DOCS_BASE_HOST }));
31077
+ }
31078
+ }
30742
31079
  /**
30743
31080
  * 识别 SPA 兜底页:站点对不存在的 markdown 路径同样返回 200,正文是站点 HTML 外壳。
30744
31081
  * 用于把「静默返回一坨 HTML」换成明确的失败信息。
@@ -30859,14 +31196,22 @@ async function registerRagTools(server) {
30859
31196
  }
30860
31197
  if (resolvedAction === "readDoc") {
30861
31198
  const resolvedDocPath = requireStringParam(docPath, "docPath", resolvedAction);
30862
- const markdownPath = resolveDocsMarkdownPath(resolvedDocPath);
31199
+ // 先剥掉 host(非首方主机直接拒绝),再做 `.md` 归一化,最后复核一遍不含 host。
31200
+ // 三者顺序不能换:归一化会给路径补后缀,若让它作用在主机上就会把
31201
+ // `docs.cloudbase.net` 拼成 `docs.cloudbase.net.md`(`.md` 是第三方可注册的 TLD)。
31202
+ const siteDocPath = toSiteRelativeDocPath(resolvedDocPath);
31203
+ const markdownPath = resolveDocsMarkdownPath(siteDocPath);
31204
+ assertNoHostInDocPath(markdownPath);
30863
31205
  const markdown = await docsManager.readDoc(markdownPath);
30864
31206
  // 站点对没有 markdown 的路径也返回 200 + HTML 外壳,必须显式判失败,
30865
31207
  // 否则会把整页 HTML 当成文档正文交给模型(旧行为就是这样静默出错的)。
30866
31208
  if (isDocsHtmlFallback(markdown)) {
31209
+ // 「网页版」退路必须是绝对地址:走到这里 markdownPath 已不含 host,只给路径
31210
+ // 调用方没法直接抓。
31211
+ const pageUrl = `https://${exports.DOCS_BASE_HOST}${markdownPath.replace(/\.md(?=#|$)/i, "")}`;
30867
31212
  throw new Error((0, index_js_1.t)("rag.readDocNotMarkdown", {
30868
31213
  docPath: markdownPath,
30869
- pageUrl: markdownPath.replace(/\.md(?=#|$)/i, ""),
31214
+ pageUrl,
30870
31215
  }));
30871
31216
  }
30872
31217
  return (0, json_content_js_1.jsonContent)(buildDocsEnvelope(resolvedAction, { docPath: resolvedDocPath, markdownPath, content: markdown }, (0, index_js_1.t)("rag.readDocSuccess")));
@@ -34254,7 +34599,7 @@ class TelemetryReporter {
34254
34599
  const arch = os_1.default.arch(); // 系统架构
34255
34600
  // Build-time injected version; guard for vitest / non-webpack runtimes.
34256
34601
  const mcpVersion = process.env.npm_package_version ||
34257
- ( true ? "2.34.5" : 0);
34602
+ ( true ? "2.34.6" : 0);
34258
34603
  return {
34259
34604
  userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
34260
34605
  deviceId: this.deviceId,
@@ -34976,7 +35321,7 @@ ${envIdSection}
34976
35321
  ## 环境信息
34977
35322
  - 操作系统: ${os_1.default.type()} ${os_1.default.release()}
34978
35323
  - Node.js版本: ${process.version}
34979
- - MCP 版本:${( true ? "2.34.5" : 0) || 0 || 0}
35324
+ - MCP 版本:${( true ? "2.34.6" : 0) || 0 || 0}
34980
35325
  - 系统架构: ${os_1.default.arch()}
34981
35326
  - 时间: ${new Date().toISOString()}
34982
35327
  - 请求ID: ${requestId}
@@ -35065,7 +35410,7 @@ function createWrappedHandler(name, handler, server) {
35065
35410
  requestId,
35066
35411
  ide: server.ide || process.env.INTEGRATION_IDE || ''
35067
35412
  });
35068
- const mcpVersion = true ? "2.34.5" : 0;
35413
+ const mcpVersion = true ? "2.34.6" : 0;
35069
35414
  const requestIdSuffix = requestId ? `\n🆔 RequestId: ${requestId}` : '';
35070
35415
  const enhancedErrorMessage = `${errorMessage}${requestIdSuffix}\n\n📦 CloudBase MCP v${mcpVersion}\n🔗 遇到问题?请复制以下链接到浏览器打开\n即可自动携带错误详情快速创建 GitHub Issue:\n${issueLink}`;
35071
35416
  // 创建新的错误对象,保持原有的错误类型但更新消息