@kevisual/cnb 0.0.56 → 0.0.58

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 CHANGED
@@ -21679,9 +21679,6 @@ var fromJSONSchema2 = (args = {}, opts) => {
21679
21679
  return resultArgs;
21680
21680
  };
21681
21681
  var pickValue = ["path", "key", "id", "description", "type", "middleware", "metadata"];
21682
- var tool = {
21683
- schema: exports_external
21684
- };
21685
21682
  var createSkill = (skill) => {
21686
21683
  if (skill.tags) {
21687
21684
  const hasOpencode = skill.tags.includes("opencode");
@@ -24608,10 +24605,7 @@ class KnowledgeBase extends CNBCore {
24608
24605
  }
24609
24606
  queryKnowledgeBase(repo, data) {
24610
24607
  const url3 = `/${repo}/-/knowledge/base/query`;
24611
- let postData = {
24612
- query: data.query
24613
- };
24614
- return this.post({ url: url3, data: postData });
24608
+ return this.post({ url: url3, data });
24615
24609
  }
24616
24610
  getEmbeddingModels(repo) {
24617
24611
  const url3 = `/${repo}/-/knowledge/embedding/models`;
@@ -24625,6 +24619,30 @@ class KnowledgeBase extends CNBCore {
24625
24619
  const url3 = `/${repo}/-/knowledge/base`;
24626
24620
  return this.request({ url: url3, method: "DELETE" });
24627
24621
  }
24622
+ createKnowledgeBase(repo, data) {
24623
+ const url3 = `/${repo}/-/knowledge/base`;
24624
+ return this.post({ url: url3, data });
24625
+ }
24626
+ updateKnowledgeBase(repo, data) {
24627
+ const url3 = `/${repo}/-/knowledge/base`;
24628
+ return this.put({ url: url3, data });
24629
+ }
24630
+ getEmbedding(repo, text) {
24631
+ const url3 = `/${repo}/-/knowledge/embedding`;
24632
+ return this.post({ url: url3, data: { text } });
24633
+ }
24634
+ addDocument(repo, chunksData) {
24635
+ const url3 = `/${repo}/-/knowledge/documents/upsert-document-with-chunks`;
24636
+ return this.post({ url: url3, data: chunksData });
24637
+ }
24638
+ deleteDocument(repo, paths) {
24639
+ const url3 = `/${repo}/-/knowledge/documents`;
24640
+ return this.delete({ url: url3, data: { paths } });
24641
+ }
24642
+ listDocument(repo, page = 1, page_size = 50) {
24643
+ const url3 = `/${repo}/-/knowledge/documents`;
24644
+ return this.get({ url: url3, params: { page, page_size } });
24645
+ }
24628
24646
  }
24629
24647
 
24630
24648
  // src/repo/index.ts
@@ -25225,6 +25243,165 @@ class IssueLabel extends CNBCore {
25225
25243
  return this.delete({ url: url3 });
25226
25244
  }
25227
25245
  }
25246
+ // src/package/registry.ts
25247
+ class RegistryPackage extends CNBCore {
25248
+ constructor(options) {
25249
+ super(options);
25250
+ }
25251
+ listGroupRegistries(slug, params) {
25252
+ const url3 = `/${slug}/-/registries`;
25253
+ return this.get({
25254
+ url: url3,
25255
+ params,
25256
+ headers: {
25257
+ Accept: "application/vnd.cnb.api+json"
25258
+ }
25259
+ });
25260
+ }
25261
+ setVisibility(registry2, data) {
25262
+ const url3 = `/${registry2}/-/settings/set_visibility`;
25263
+ return this.post({
25264
+ url: url3,
25265
+ data
25266
+ });
25267
+ }
25268
+ remove(registry2) {
25269
+ const url3 = `/${registry2}`;
25270
+ return this.delete({ url: url3 });
25271
+ }
25272
+ }
25273
+ // src/package/package.ts
25274
+ class PackageManagement extends CNBCore {
25275
+ constructor(options) {
25276
+ super(options);
25277
+ }
25278
+ list(slug, type, params) {
25279
+ const url3 = `/${slug}/-/packages`;
25280
+ return this.get({
25281
+ url: url3,
25282
+ params: {
25283
+ type,
25284
+ ...params
25285
+ },
25286
+ headers: {
25287
+ Accept: "application/vnd.cnb.api+json"
25288
+ }
25289
+ });
25290
+ }
25291
+ getOne(slug, type, name) {
25292
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}`;
25293
+ return this.get({
25294
+ url: url3,
25295
+ headers: {
25296
+ Accept: "application/vnd.cnb.api+json"
25297
+ }
25298
+ });
25299
+ }
25300
+ remove(slug, type, name) {
25301
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}`;
25302
+ return this.delete({ url: url3 });
25303
+ }
25304
+ getTag(slug, type, name, tag) {
25305
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}/tags/${encodeURIComponent(tag)}`;
25306
+ return this.get({
25307
+ url: url3,
25308
+ headers: {
25309
+ Accept: "application/vnd.cnb.api+json"
25310
+ }
25311
+ });
25312
+ }
25313
+ removeTag(slug, type, name, tag) {
25314
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}/tags/${encodeURIComponent(tag)}`;
25315
+ return this.delete({ url: url3 });
25316
+ }
25317
+ listTags(slug, type, name, params) {
25318
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}/tags`;
25319
+ return this.get({
25320
+ url: url3,
25321
+ params,
25322
+ headers: {
25323
+ Accept: "application/vnd.cnb.api+json"
25324
+ }
25325
+ });
25326
+ }
25327
+ }
25328
+ // src/org/index.ts
25329
+ class Organization extends CNBCore {
25330
+ constructor(options) {
25331
+ super(options);
25332
+ }
25333
+ create(params) {
25334
+ return this.post({
25335
+ url: "/groups",
25336
+ data: params
25337
+ });
25338
+ }
25339
+ listTopGroups(params) {
25340
+ return this.get({
25341
+ url: "/user/groups",
25342
+ params
25343
+ });
25344
+ }
25345
+ listGroups(slug, params) {
25346
+ return this.get({
25347
+ url: `/user/groups/${slug}`,
25348
+ params
25349
+ });
25350
+ }
25351
+ getGroupsByUsername(username, params) {
25352
+ return this.get({
25353
+ url: `/users/${username}/groups`,
25354
+ params
25355
+ });
25356
+ }
25357
+ getGroup(group) {
25358
+ return this.get({
25359
+ url: `/${group}`
25360
+ });
25361
+ }
25362
+ updateGroup(group, params) {
25363
+ return this.put({
25364
+ url: `/${group}`,
25365
+ data: params
25366
+ });
25367
+ }
25368
+ deleteGroup(group, identityTicket) {
25369
+ return this.delete({
25370
+ url: `/${group}`,
25371
+ headers: identityTicket ? { "x-cnb-identity-ticket": identityTicket } : undefined
25372
+ });
25373
+ }
25374
+ transfer(group, params) {
25375
+ return this.post({
25376
+ url: `/${group}/-/transfer`,
25377
+ data: params
25378
+ });
25379
+ }
25380
+ uploadLogo(group, params) {
25381
+ return this.post({
25382
+ url: `/${group}/-/upload/logos`,
25383
+ data: params
25384
+ });
25385
+ }
25386
+ getSetting(slug) {
25387
+ return this.get({
25388
+ url: `/${slug}/-/settings`
25389
+ });
25390
+ }
25391
+ updateSetting(slug, params) {
25392
+ return this.put({
25393
+ url: `/${slug}/-/settings`,
25394
+ data: params
25395
+ });
25396
+ }
25397
+ listSubgroups(slug, params) {
25398
+ return this.get({
25399
+ url: `/${slug}/-/sub-groups`,
25400
+ params
25401
+ });
25402
+ }
25403
+ }
25404
+
25228
25405
  // src/index.ts
25229
25406
  class CNB extends CNBCore {
25230
25407
  workspace;
@@ -25236,6 +25413,8 @@ class CNB extends CNBCore {
25236
25413
  mission;
25237
25414
  ai;
25238
25415
  labels;
25416
+ packages;
25417
+ org;
25239
25418
  constructor(options) {
25240
25419
  super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
25241
25420
  this.init(options);
@@ -25258,6 +25437,11 @@ class CNB extends CNBCore {
25258
25437
  repoLabel: new RepoLabel(options),
25259
25438
  issueLabel: new IssueLabel(options)
25260
25439
  };
25440
+ this.packages = {
25441
+ registry: new RegistryPackage(options),
25442
+ package: new PackageManagement(options)
25443
+ };
25444
+ this.org = new Organization(options);
25261
25445
  }
25262
25446
  setToken(token) {
25263
25447
  this.token = token;
@@ -25269,6 +25453,9 @@ class CNB extends CNBCore {
25269
25453
  this.mission.token = token;
25270
25454
  this.labels.repoLabel.token = token;
25271
25455
  this.labels.issueLabel.token = token;
25456
+ this.packages.registry.token = token;
25457
+ this.packages.package.token = token;
25458
+ this.org.token = token;
25272
25459
  }
25273
25460
  setCookie(cookie) {
25274
25461
  this.cookie = cookie;
@@ -25280,6 +25467,9 @@ class CNB extends CNBCore {
25280
25467
  this.mission.cookie = cookie;
25281
25468
  this.labels.repoLabel.cookie = cookie;
25282
25469
  this.labels.issueLabel.cookie = cookie;
25470
+ this.packages.registry.cookie = cookie;
25471
+ this.packages.package.cookie = cookie;
25472
+ this.org.cookie = cookie;
25283
25473
  }
25284
25474
  getCNBVersion = getCNBVersion;
25285
25475
  }
@@ -25647,7 +25837,7 @@ __export(exports_external2, {
25647
25837
  safeEncode: () => safeEncode5,
25648
25838
  safeDecodeAsync: () => safeDecodeAsync5,
25649
25839
  safeDecode: () => safeDecode5,
25650
- registry: () => registry2,
25840
+ registry: () => registry3,
25651
25841
  regexes: () => exports_regexes2,
25652
25842
  regex: () => _regex2,
25653
25843
  refine: () => refine2,
@@ -25857,7 +26047,7 @@ __export(exports_core3, {
25857
26047
  safeEncode: () => safeEncode3,
25858
26048
  safeDecodeAsync: () => safeDecodeAsync3,
25859
26049
  safeDecode: () => safeDecode3,
25860
- registry: () => registry2,
26050
+ registry: () => registry3,
25861
26051
  regexes: () => exports_regexes2,
25862
26052
  process: () => process3,
25863
26053
  prettifyError: () => prettifyError2,
@@ -35377,10 +35567,10 @@ class $ZodRegistry2 {
35377
35567
  return this._map.has(schema);
35378
35568
  }
35379
35569
  }
35380
- function registry2() {
35570
+ function registry3() {
35381
35571
  return new $ZodRegistry2;
35382
35572
  }
35383
- (_a15 = globalThis).__zod_globalRegistry ?? (_a15.__zod_globalRegistry = registry2());
35573
+ (_a15 = globalThis).__zod_globalRegistry ?? (_a15.__zod_globalRegistry = registry3());
35384
35574
  var globalRegistry2 = globalThis.__zod_globalRegistry;
35385
35575
  // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
35386
35576
  function _string2(Class3, params) {
@@ -37160,21 +37350,21 @@ var allProcessors2 = {
37160
37350
  };
37161
37351
  function toJSONSchema4(input, params) {
37162
37352
  if ("_idmap" in input) {
37163
- const registry3 = input;
37353
+ const registry4 = input;
37164
37354
  const ctx2 = initializeContext2({ ...params, processors: allProcessors2 });
37165
37355
  const defs = {};
37166
- for (const entry of registry3._idmap.entries()) {
37356
+ for (const entry of registry4._idmap.entries()) {
37167
37357
  const [_, schema] = entry;
37168
37358
  process3(schema, ctx2);
37169
37359
  }
37170
37360
  const schemas = {};
37171
37361
  const external = {
37172
- registry: registry3,
37362
+ registry: registry4,
37173
37363
  uri: params?.uri,
37174
37364
  defs
37175
37365
  };
37176
37366
  ctx2.external = external;
37177
- for (const entry of registry3._idmap.entries()) {
37367
+ for (const entry of registry4._idmap.entries()) {
37178
37368
  const [key, schema] = entry;
37179
37369
  extractDefs2(ctx2, schema);
37180
37370
  schemas[key] = finalize2(ctx2, schema);
@@ -43060,7 +43250,7 @@ class EventSourceParserStream extends TransformStream {
43060
43250
  }
43061
43251
  }
43062
43252
 
43063
- // ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.19_zod@4.3.6/node_modules/@ai-sdk/provider-utils/dist/index.mjs
43253
+ // ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.21_zod@4.3.6/node_modules/@ai-sdk/provider-utils/dist/index.mjs
43064
43254
  function combineHeaders(...headers) {
43065
43255
  return headers.reduce((combinedHeaders, currentHeaders) => ({
43066
43256
  ...combinedHeaders,
@@ -43324,6 +43514,9 @@ async function downloadBlob(url4, options) {
43324
43514
  const response = await fetch(url4, {
43325
43515
  signal: options == null ? undefined : options.abortSignal
43326
43516
  });
43517
+ if (response.redirected) {
43518
+ validateDownloadUrl(response.url);
43519
+ }
43327
43520
  if (!response.ok) {
43328
43521
  throw new DownloadError({
43329
43522
  url: url4,
@@ -43480,7 +43673,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
43480
43673
  normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
43481
43674
  return Object.fromEntries(normalizedHeaders.entries());
43482
43675
  }
43483
- var VERSION = "4.0.19";
43676
+ var VERSION = "4.0.21";
43484
43677
  var getOriginalFetch = () => globalThis.fetch;
43485
43678
  var getFromApi = async ({
43486
43679
  url: url4,
@@ -43655,7 +43848,7 @@ function visit(def) {
43655
43848
  return def;
43656
43849
  return addAdditionalPropertiesToJsonSchema(def);
43657
43850
  }
43658
- var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
43851
+ var ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use");
43659
43852
  var defaultOptions = {
43660
43853
  name: undefined,
43661
43854
  $refStrategy: "root",
@@ -44648,7 +44841,7 @@ var zod3ToJsonSchema = (schema, options) => {
44648
44841
  combined.$schema = "http://json-schema.org/draft-07/schema#";
44649
44842
  return combined;
44650
44843
  };
44651
- var schemaSymbol = Symbol.for("vercel.ai.schema");
44844
+ var schemaSymbol = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
44652
44845
  function lazySchema(createSchema) {
44653
44846
  let schema;
44654
44847
  return () => {
@@ -44955,8 +45148,8 @@ var postToApi = async ({
44955
45148
  throw handleFetchError({ error: error49, url: url4, requestBodyValues: body.values });
44956
45149
  }
44957
45150
  };
44958
- function tool2(tool22) {
44959
- return tool22;
45151
+ function tool(tool2) {
45152
+ return tool2;
44960
45153
  }
44961
45154
  function createProviderToolFactoryWithOutputSchema({
44962
45155
  id,
@@ -44972,7 +45165,7 @@ function createProviderToolFactoryWithOutputSchema({
44972
45165
  onInputDelta,
44973
45166
  onInputAvailable,
44974
45167
  ...args
44975
- }) => tool2({
45168
+ }) => tool({
44976
45169
  type: "provider",
44977
45170
  id,
44978
45171
  args,
@@ -45108,7 +45301,7 @@ async function* executeTool({
45108
45301
  }
45109
45302
  }
45110
45303
 
45111
- // ../../node_modules/.pnpm/@ai-sdk+openai-compatible@2.0.35_zod@4.3.6/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
45304
+ // ../../node_modules/.pnpm/@ai-sdk+openai-compatible@2.0.37_zod@4.3.6/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
45112
45305
  var openaiCompatibleErrorDataSchema = exports_external2.object({
45113
45306
  error: exports_external2.object({
45114
45307
  message: exports_external2.string(),
@@ -45393,20 +45586,20 @@ function prepareTools({
45393
45586
  return { tools: undefined, toolChoice: undefined, toolWarnings };
45394
45587
  }
45395
45588
  const openaiCompatTools = [];
45396
- for (const tool3 of tools) {
45397
- if (tool3.type === "provider") {
45589
+ for (const tool2 of tools) {
45590
+ if (tool2.type === "provider") {
45398
45591
  toolWarnings.push({
45399
45592
  type: "unsupported",
45400
- feature: `provider-defined tool ${tool3.id}`
45593
+ feature: `provider-defined tool ${tool2.id}`
45401
45594
  });
45402
45595
  } else {
45403
45596
  openaiCompatTools.push({
45404
45597
  type: "function",
45405
45598
  function: {
45406
- name: tool3.name,
45407
- description: tool3.description,
45408
- parameters: tool3.inputSchema,
45409
- ...tool3.strict != null ? { strict: tool3.strict } : {}
45599
+ name: tool2.name,
45600
+ description: tool2.description,
45601
+ parameters: tool2.inputSchema,
45602
+ ...tool2.strict != null ? { strict: tool2.strict } : {}
45410
45603
  }
45411
45604
  });
45412
45605
  }
@@ -46555,7 +46748,7 @@ async function fileToBlob(file3) {
46555
46748
  function toCamelCase(str) {
46556
46749
  return str.replace(/[_-]([a-z])/g, (g) => g[1].toUpperCase());
46557
46750
  }
46558
- var VERSION2 = "2.0.35";
46751
+ var VERSION2 = "2.0.37";
46559
46752
  function createOpenAICompatible(options) {
46560
46753
  const baseURL = withoutTrailingSlash(options.baseURL);
46561
46754
  const providerName = options.name;
@@ -46803,10 +46996,10 @@ app.route({
46803
46996
  title: "列出cnb代码仓库",
46804
46997
  summary: "列出cnb代码仓库, 可选flags参数,如 KnowledgeBase",
46805
46998
  args: {
46806
- search: tool.schema.string().optional().describe("搜索关键词"),
46807
- page: tool.schema.number().optional().describe("分页页码,默认 1"),
46808
- pageSize: tool.schema.number().optional().describe("每页数量,默认99"),
46809
- flags: tool.schema.string().optional().describe("仓库标记,如果是知识库则填写 KnowledgeBase")
46999
+ search: exports_external2.string().optional().describe("搜索关键词"),
47000
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
47001
+ pageSize: exports_external2.number().optional().describe("每页数量,默认99"),
47002
+ flags: exports_external2.string().optional().describe("仓库标记,如果是知识库则填写 KnowledgeBase")
46810
47003
  }
46811
47004
  })
46812
47005
  }
@@ -46851,9 +47044,9 @@ app.route({
46851
47044
  skill: "create-repo",
46852
47045
  title: "创建代码仓库",
46853
47046
  args: {
46854
- name: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
46855
- visibility: tool.schema.string().describe("代码仓库可见性, public 或 private").default("public"),
46856
- description: tool.schema.string().describe("代码仓库描述")
47047
+ name: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
47048
+ visibility: exports_external2.string().describe("代码仓库可见性, public 或 private").default("public"),
47049
+ description: exports_external2.string().describe("代码仓库描述")
46857
47050
  },
46858
47051
  summary: "创建一个新的代码仓库"
46859
47052
  })
@@ -46885,7 +47078,7 @@ app.route({
46885
47078
  middleware: ["auth"],
46886
47079
  metadata: {
46887
47080
  args: {
46888
- name: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo")
47081
+ name: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo")
46889
47082
  }
46890
47083
  }
46891
47084
  }).define(async (ctx) => {
@@ -46909,10 +47102,10 @@ app.route({
46909
47102
  title: "在代码仓库中创建文件",
46910
47103
  summary: `在代码仓库中创建文件, encoding 可选,默认 raw`,
46911
47104
  args: {
46912
- repoName: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
46913
- filePath: tool.schema.string().describe("文件路径, 如 src/index.ts"),
46914
- content: tool.schema.string().describe("文本的字符串的内容"),
46915
- encoding: tool.schema.string().describe("编码方式,如 raw").optional()
47105
+ repoName: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
47106
+ filePath: exports_external2.string().describe("文件路径, 如 src/index.ts"),
47107
+ content: exports_external2.string().describe("文本的字符串的内容"),
47108
+ encoding: exports_external2.string().describe("编码方式,如 raw").optional()
46916
47109
  }
46917
47110
  })
46918
47111
  }
@@ -46944,7 +47137,7 @@ app.route({
46944
47137
  skill: "delete-repo",
46945
47138
  title: "删除代码仓库",
46946
47139
  args: {
46947
- name: tool.schema.string().describe("代码仓库名称")
47140
+ name: exports_external2.string().describe("代码仓库名称")
46948
47141
  },
46949
47142
  summary: "删除一个代码仓库"
46950
47143
  })
@@ -46978,11 +47171,11 @@ app.route({
46978
47171
  skill: "update-repo-info",
46979
47172
  title: "更新代码仓库信息",
46980
47173
  args: {
46981
- name: tool.schema.string().describe("代码仓库名称"),
46982
- description: tool.schema.string().describe("代码仓库描述"),
46983
- license: tool.schema.string().describe("代码仓库许可证类型,如 MIT").optional(),
46984
- site: tool.schema.string().describe("代码仓库主页链接").optional(),
46985
- topics: tool.schema.array(tool.schema.string()).describe("代码仓库话题标签列表").optional()
47174
+ name: exports_external2.string().describe("代码仓库名称"),
47175
+ description: exports_external2.string().describe("代码仓库描述"),
47176
+ license: exports_external2.string().describe("代码仓库许可证类型,如 MIT").optional(),
47177
+ site: exports_external2.string().describe("代码仓库主页链接").optional(),
47178
+ topics: exports_external2.array(exports_external2.string()).describe("代码仓库话题标签列表").optional()
46986
47179
  },
46987
47180
  summary: "更新代码仓库的信息"
46988
47181
  })
@@ -47010,8 +47203,8 @@ app.route({
47010
47203
  middleware: ["auth"],
47011
47204
  metadata: {
47012
47205
  args: {
47013
- name: tool.schema.string().describe("代码仓库名称"),
47014
- visibility: tool.schema.string().describe("代码仓库可见性, public 或 private 或 protected")
47206
+ name: exports_external2.string().describe("代码仓库名称"),
47207
+ visibility: exports_external2.string().describe("代码仓库可见性, public 或 private 或 protected")
47015
47208
  }
47016
47209
  }
47017
47210
  }).define(async (ctx) => {
@@ -47044,10 +47237,10 @@ app.route({
47044
47237
  title: "查询仓库标签列表",
47045
47238
  summary: "查询仓库的标签列表",
47046
47239
  args: {
47047
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
47048
- page: tool.schema.number().optional().describe("分页页码,默认 1"),
47049
- pageSize: tool.schema.number().optional().describe("分页每页大小,默认 30"),
47050
- keyword: tool.schema.string().optional().describe("标签搜索关键词")
47240
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
47241
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
47242
+ pageSize: exports_external2.number().optional().describe("分页每页大小,默认 30"),
47243
+ keyword: exports_external2.string().optional().describe("标签搜索关键词")
47051
47244
  }
47052
47245
  })
47053
47246
  }
@@ -47079,10 +47272,10 @@ app.route({
47079
47272
  title: "创建仓库标签",
47080
47273
  summary: "创建一个仓库标签",
47081
47274
  args: {
47082
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
47083
- name: tool.schema.string().describe("标签名称"),
47084
- color: tool.schema.string().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
47085
- description: tool.schema.string().optional().describe("标签描述")
47275
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
47276
+ name: exports_external2.string().describe("标签名称"),
47277
+ color: exports_external2.string().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
47278
+ description: exports_external2.string().optional().describe("标签描述")
47086
47279
  }
47087
47280
  })
47088
47281
  }
@@ -47114,11 +47307,11 @@ app.route({
47114
47307
  title: "更新仓库标签",
47115
47308
  summary: "更新仓库标签信息",
47116
47309
  args: {
47117
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
47118
- name: tool.schema.string().describe("标签名称"),
47119
- color: tool.schema.string().optional().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
47120
- description: tool.schema.string().optional().describe("标签描述"),
47121
- newName: tool.schema.string().optional().describe("新标签名称")
47310
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
47311
+ name: exports_external2.string().describe("标签名称"),
47312
+ color: exports_external2.string().optional().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
47313
+ description: exports_external2.string().optional().describe("标签描述"),
47314
+ newName: exports_external2.string().optional().describe("新标签名称")
47122
47315
  }
47123
47316
  })
47124
47317
  }
@@ -47151,8 +47344,8 @@ app.route({
47151
47344
  title: "删除仓库标签",
47152
47345
  summary: "删除指定的仓库标签",
47153
47346
  args: {
47154
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
47155
- name: tool.schema.string().describe("标签名称")
47347
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
47348
+ name: exports_external2.string().describe("标签名称")
47156
47349
  }
47157
47350
  })
47158
47351
  }
@@ -47307,8 +47500,8 @@ app.route({
47307
47500
  tags: [],
47308
47501
  ...{
47309
47502
  args: {
47310
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
47311
- pipelineId: tool.schema.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
47503
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
47504
+ pipelineId: exports_external2.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
47312
47505
  }
47313
47506
  }
47314
47507
  }
@@ -47347,8 +47540,8 @@ app.route({
47347
47540
  tags: [],
47348
47541
  ...{
47349
47542
  args: {
47350
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
47351
- pipelineId: tool.schema.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
47543
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
47544
+ pipelineId: exports_external2.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
47352
47545
  }
47353
47546
  }
47354
47547
  }
@@ -47399,11 +47592,11 @@ app.route({
47399
47592
  title: "云端构建",
47400
47593
  summary: "在云端构建代码仓库,参数包括 event, repo, branch, ref, config, env",
47401
47594
  args: {
47402
- env: tool.schema.any().optional().describe('构建环境变量,格式为 { "KEY": "VALUE" }'),
47403
- event: tool.schema.string().optional().describe("触发事件类型,例如 api_trigger_event"),
47404
- branch: tool.schema.string().optional().describe("分支名称,默认主分支"),
47405
- config: tool.schema.string().describe("构建config文件内容,例如 cloudbuild.yaml对应的yml的内容"),
47406
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo")
47595
+ env: exports_external2.any().optional().describe('构建环境变量,格式为 { "KEY": "VALUE" }'),
47596
+ event: exports_external2.string().optional().describe("触发事件类型,例如 api_trigger_event"),
47597
+ branch: exports_external2.string().optional().describe("分支名称,默认主分支"),
47598
+ config: exports_external2.string().describe("构建config文件内容,例如 cloudbuild.yaml对应的yml的内容"),
47599
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo")
47407
47600
  }
47408
47601
  })
47409
47602
  }
@@ -47465,7 +47658,12 @@ app.route({
47465
47658
  const branch = item.branch || "main";
47466
47659
  const repo3 = item.slug;
47467
47660
  const sn = item.sn;
47468
- await cnb.workspace.stopWorkspace({ sn });
47661
+ const res2 = await cnb.workspace.stopWorkspace({ sn });
47662
+ if (res2.code !== 200) {
47663
+ ctx.throw(500, res2.message || "Failed to stop workspace");
47664
+ } else {
47665
+ console.log(`工作区 ${repo3} 停止成功,${res2.data?.buildLogUrl ? `构建日志链接: ${res2.data.buildLogUrl}` : ""}`);
47666
+ }
47469
47667
  if (config3) {
47470
47668
  await cnb.build.startBuild(repo3, { branch, config: config3, event });
47471
47669
  } else {
@@ -47490,9 +47688,9 @@ app.route({
47490
47688
  title: "启动cnb工作空间",
47491
47689
  summary: "启动cnb工作空间",
47492
47690
  args: {
47493
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
47494
- branch: tool.schema.string().optional().describe("分支名称,默认主分支"),
47495
- ref: tool.schema.string().optional().describe("提交引用,例如 commit sha")
47691
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
47692
+ branch: exports_external2.string().optional().describe("分支名称,默认主分支"),
47693
+ ref: exports_external2.string().optional().describe("提交引用,例如 commit sha")
47496
47694
  }
47497
47695
  })
47498
47696
  }
@@ -47522,11 +47720,11 @@ app.route({
47522
47720
  title: "列出cnb工作空间",
47523
47721
  summary: "列出cnb工作空间列表,支持按状态过滤, status 可选值 running 或 closed",
47524
47722
  args: {
47525
- status: tool.schema.string().optional().describe("开发环境状态,running: 运行中,closed: 已关闭和停止的"),
47526
- page: tool.schema.number().optional().describe("分页页码,默认 1"),
47527
- pageSize: tool.schema.number().optional().describe("分页大小,默认 20,最大 100"),
47528
- slug: tool.schema.string().optional().describe("仓库路径,例如 groupname/reponame"),
47529
- branch: tool.schema.string().optional().describe("分支名称")
47723
+ status: exports_external2.string().optional().describe("开发环境状态,running: 运行中,closed: 已关闭和停止的"),
47724
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
47725
+ pageSize: exports_external2.number().optional().describe("分页大小,默认 20,最大 100"),
47726
+ slug: exports_external2.string().optional().describe("仓库路径,例如 groupname/reponame"),
47727
+ branch: exports_external2.string().optional().describe("分支名称")
47530
47728
  }
47531
47729
  })
47532
47730
  }
@@ -47552,8 +47750,8 @@ app.route({
47552
47750
  title: "获取工作空间详情",
47553
47751
  summary: "获取工作空间详细信息",
47554
47752
  args: {
47555
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
47556
- sn: tool.schema.string().describe("工作空间流水线的 sn")
47753
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
47754
+ sn: exports_external2.string().describe("工作空间流水线的 sn")
47557
47755
  }
47558
47756
  })
47559
47757
  }
@@ -47582,9 +47780,9 @@ app.route({
47582
47780
  title: "删除工作空间",
47583
47781
  summary: "删除工作空间,pipelineId 和 sn 二选一",
47584
47782
  args: {
47585
- pipelineId: tool.schema.string().optional().describe("流水线 ID,优先使用"),
47586
- sn: tool.schema.string().optional().describe("流水线构建号"),
47587
- sns: tool.schema.array(zod_default.string()).optional().describe("批量流水线构建号")
47783
+ pipelineId: exports_external2.string().optional().describe("流水线 ID,优先使用"),
47784
+ sn: exports_external2.string().optional().describe("流水线构建号"),
47785
+ sns: exports_external2.array(exports_external2.string()).optional().describe("批量流水线构建号")
47588
47786
  }
47589
47787
  })
47590
47788
  }
@@ -47620,8 +47818,8 @@ app.route({
47620
47818
  title: "停止工作空间",
47621
47819
  summary: "停止运行中的工作空间",
47622
47820
  args: {
47623
- pipelineId: tool.schema.string().optional().describe("流水线 ID,优先使用"),
47624
- sn: tool.schema.string().optional().describe("流水线构建号")
47821
+ pipelineId: exports_external2.string().optional().describe("流水线 ID,优先使用"),
47822
+ sn: exports_external2.string().optional().describe("流水线构建号")
47625
47823
  }
47626
47824
  })
47627
47825
  }
@@ -47649,9 +47847,9 @@ app.route({
47649
47847
  title: "调用app应用",
47650
47848
  summary: "调用router的应用, 参数path, key, payload",
47651
47849
  args: {
47652
- path: tool.schema.string().describe("应用路径,例如 cnb"),
47653
- key: tool.schema.string().optional().describe("应用key,例如 list-repos"),
47654
- payload: tool.schema.object({}).optional().describe("调用参数")
47850
+ path: exports_external2.string().describe("应用路径,例如 cnb"),
47851
+ key: exports_external2.string().optional().describe("应用key,例如 list-repos"),
47852
+ payload: exports_external2.object({}).optional().describe("调用参数")
47655
47853
  }
47656
47854
  })
47657
47855
  }
@@ -47698,7 +47896,7 @@ app.route({
47698
47896
  title: "获取当前cnb工作空间的port代理uri",
47699
47897
  summary: "获取当前cnb工作空间的port代理uri,用于端口转发",
47700
47898
  args: {
47701
- port: tool.schema.number().optional().describe("端口号,默认为51515")
47899
+ port: exports_external2.number().optional().describe("端口号,默认为51515")
47702
47900
  }
47703
47901
  })
47704
47902
  }
@@ -47725,11 +47923,11 @@ app.route({
47725
47923
  title: "获取当前cnb工作空间的编辑器访问地址",
47726
47924
  summary: "获取当前cnb工作空间的vscode代理uri,用于在浏览器中访问vscode,包含多种访问方式,如web、vscode、codebuddy、cursor、ssh",
47727
47925
  args: {
47728
- web: tool.schema.boolean().optional().describe("是否获取vscode web的访问uri,默认为false"),
47729
- vscode: tool.schema.boolean().optional().describe("是否获取vscode的代理uri,默认为true"),
47730
- codebuddy: tool.schema.boolean().optional().describe("是否获取codebuddy的代理uri,默认为false"),
47731
- cursor: tool.schema.boolean().optional().describe("是否获取cursor的代理uri,默认为false"),
47732
- ssh: tool.schema.boolean().optional().describe("是否获取vscode remote ssh的连接字符串,默认为false")
47926
+ web: exports_external2.boolean().optional().describe("是否获取vscode web的访问uri,默认为false"),
47927
+ vscode: exports_external2.boolean().optional().describe("是否获取vscode的代理uri,默认为true"),
47928
+ codebuddy: exports_external2.boolean().optional().describe("是否获取codebuddy的代理uri,默认为false"),
47929
+ cursor: exports_external2.boolean().optional().describe("是否获取cursor的代理uri,默认为false"),
47930
+ ssh: exports_external2.boolean().optional().describe("是否获取vscode remote ssh的连接字符串,默认为false")
47733
47931
  }
47734
47932
  })
47735
47933
  }
@@ -47788,7 +47986,7 @@ app.route({
47788
47986
  title: "设置当前cnb工作空间的cookie环境变量",
47789
47987
  summary: "设置当前cnb工作空间的cookie环境变量,用于界面操作定制模块功能,例子:CNBSESSION=xxxx;csrfkey=2222xxxx;",
47790
47988
  args: {
47791
- cookie: tool.schema.string().describe("cnb的cookie值")
47989
+ cookie: exports_external2.string().describe("cnb的cookie值")
47792
47990
  }
47793
47991
  })
47794
47992
  }
@@ -48125,8 +48323,8 @@ app.route({
48125
48323
  title: "调用cnb的知识库ai对话功能进行聊天",
48126
48324
  summary: "调用cnb的知识库ai对话功能进行聊天,基于cnb提供的ai能力",
48127
48325
  args: {
48128
- question: tool.schema.string().describe("用户输入的消息内容"),
48129
- repo: tool.schema.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
48326
+ question: exports_external2.string().describe("用户输入的消息内容"),
48327
+ repo: exports_external2.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
48130
48328
  }
48131
48329
  })
48132
48330
  }
@@ -48228,8 +48426,8 @@ app.route({
48228
48426
  title: "调用cnb的知识库RAG查询功能进行问答",
48229
48427
  summary: "调用cnb的知识库RAG查询功能进行问答,基于cnb提供的知识库能力",
48230
48428
  args: {
48231
- question: tool.schema.string().describe("用户输入的消息内容"),
48232
- repo: tool.schema.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
48429
+ question: exports_external2.string().describe("用户输入的消息内容"),
48430
+ repo: exports_external2.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
48233
48431
  }
48234
48432
  })
48235
48433
  }
@@ -48291,13 +48489,13 @@ app.route({
48291
48489
  skill: "list-issues",
48292
48490
  title: "查询 Issue 列表",
48293
48491
  args: {
48294
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48295
- state: tool.schema.string().optional().describe("Issue 状态:open 或 closed"),
48296
- keyword: tool.schema.string().optional().describe("问题搜索关键词"),
48297
- labels: tool.schema.string().optional().describe("问题标签,多个用逗号分隔"),
48298
- page: tool.schema.number().optional().describe("分页页码,默认: 1"),
48299
- page_size: tool.schema.number().optional().describe("分页每页大小,默认: 30"),
48300
- order_by: tool.schema.string().optional().describe("排序方式,如 created_at, -updated_at")
48492
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48493
+ state: exports_external2.string().optional().describe("Issue 状态:open 或 closed"),
48494
+ keyword: exports_external2.string().optional().describe("问题搜索关键词"),
48495
+ labels: exports_external2.string().optional().describe("问题标签,多个用逗号分隔"),
48496
+ page: exports_external2.number().optional().describe("分页页码,默认: 1"),
48497
+ page_size: exports_external2.number().optional().describe("分页每页大小,默认: 30"),
48498
+ order_by: exports_external2.string().optional().describe("排序方式,如 created_at, -updated_at")
48301
48499
  },
48302
48500
  summary: "查询 Issue 列表"
48303
48501
  })
@@ -48341,8 +48539,8 @@ app.route({
48341
48539
  skill: "getIssue",
48342
48540
  title: "获取 单个 Issue",
48343
48541
  args: {
48344
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48345
- issueNumber: tool.schema.union([tool.schema.string(), tool.schema.number()]).describe("Issue 编号")
48542
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48543
+ issueNumber: exports_external2.union([exports_external2.string(), exports_external2.number()]).describe("Issue 编号")
48346
48544
  },
48347
48545
  summary: "获取 单个 Issue"
48348
48546
  })
@@ -48373,12 +48571,12 @@ app.route({
48373
48571
  skill: "create-issue",
48374
48572
  title: "创建 Issue",
48375
48573
  args: {
48376
- repo: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
48377
- title: tool.schema.string().describe("Issue 标题"),
48378
- body: tool.schema.string().optional().describe("Issue 描述内容"),
48379
- assignees: tool.schema.array(tool.schema.string()).optional().describe("指派人列表"),
48380
- labels: tool.schema.array(tool.schema.string()).optional().describe("标签列表"),
48381
- priority: tool.schema.string().optional().describe("优先级")
48574
+ repo: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
48575
+ title: exports_external2.string().describe("Issue 标题"),
48576
+ body: exports_external2.string().optional().describe("Issue 描述内容"),
48577
+ assignees: exports_external2.array(exports_external2.string()).optional().describe("指派人列表"),
48578
+ labels: exports_external2.array(exports_external2.string()).optional().describe("标签列表"),
48579
+ priority: exports_external2.string().optional().describe("优先级")
48382
48580
  },
48383
48581
  summary: "创建一个新的 Issue"
48384
48582
  })
@@ -48414,9 +48612,9 @@ app.route({
48414
48612
  skill: "complete-issue",
48415
48613
  title: "完成 CNB的任务Issue",
48416
48614
  args: {
48417
- repo: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
48418
- issueNumber: tool.schema.union([tool.schema.string(), tool.schema.number()]).describe("Issue 编号"),
48419
- state: tool.schema.string().optional().describe("Issue 状态,默认为 closed")
48615
+ repo: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
48616
+ issueNumber: exports_external2.union([exports_external2.string(), exports_external2.number()]).describe("Issue 编号"),
48617
+ state: exports_external2.string().optional().describe("Issue 状态,默认为 closed")
48420
48618
  },
48421
48619
  summary: "完成一个 Issue(将 state 改为 closed)"
48422
48620
  })
@@ -48449,10 +48647,10 @@ app.route({
48449
48647
  skill: "list-issue-comments",
48450
48648
  title: "查询 Issue 评论列表",
48451
48649
  args: {
48452
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48453
- issueNumber: tool.schema.number().describe("Issue 编号"),
48454
- page: tool.schema.number().optional().describe("分页页码,默认: 1"),
48455
- page_size: tool.schema.number().optional().describe("分页每页大小,默认: 30")
48650
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48651
+ issueNumber: exports_external2.number().describe("Issue 编号"),
48652
+ page: exports_external2.number().optional().describe("分页页码,默认: 1"),
48653
+ page_size: exports_external2.number().optional().describe("分页每页大小,默认: 30")
48456
48654
  },
48457
48655
  summary: "查询 Issue 评论列表"
48458
48656
  })
@@ -48488,10 +48686,10 @@ app.route({
48488
48686
  skill: "create-issue-comment",
48489
48687
  title: "创建 Issue 评论",
48490
48688
  args: {
48491
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48492
- issueNumber: tool.schema.number().describe("Issue 编号"),
48493
- body: tool.schema.string().describe("评论内容"),
48494
- clearAt: tool.schema.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
48689
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48690
+ issueNumber: exports_external2.number().describe("Issue 编号"),
48691
+ body: exports_external2.string().describe("评论内容"),
48692
+ clearAt: exports_external2.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
48495
48693
  },
48496
48694
  summary: "创建 Issue 评论"
48497
48695
  })
@@ -48528,9 +48726,9 @@ app.route({
48528
48726
  skill: "get-issue-comment",
48529
48727
  title: "获取 Issue 评论",
48530
48728
  args: {
48531
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48532
- issueNumber: tool.schema.number().describe("Issue 编号"),
48533
- commentId: tool.schema.number().describe("评论 ID")
48729
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48730
+ issueNumber: exports_external2.number().describe("Issue 编号"),
48731
+ commentId: exports_external2.number().describe("评论 ID")
48534
48732
  },
48535
48733
  summary: "获取 Issue 评论"
48536
48734
  })
@@ -48563,11 +48761,11 @@ app.route({
48563
48761
  skill: "update-issue-comment",
48564
48762
  title: "修改 Issue 评论",
48565
48763
  args: {
48566
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48567
- issueNumber: tool.schema.number().describe("Issue 编号"),
48568
- commentId: tool.schema.number().describe("评论 ID"),
48569
- body: tool.schema.string().describe("评论内容"),
48570
- clearAt: tool.schema.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
48764
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48765
+ issueNumber: exports_external2.number().describe("Issue 编号"),
48766
+ commentId: exports_external2.number().describe("评论 ID"),
48767
+ body: exports_external2.string().describe("评论内容"),
48768
+ clearAt: exports_external2.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
48571
48769
  },
48572
48770
  summary: "修改 Issue 评论"
48573
48771
  })
@@ -49483,7 +49681,7 @@ app.route({
49483
49681
  };
49484
49682
  }).addTo(app);
49485
49683
 
49486
- // ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.66_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
49684
+ // ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.77_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
49487
49685
  var import_oidc = __toESM(require_dist(), 1);
49488
49686
  var import_oidc2 = __toESM(require_dist(), 1);
49489
49687
  var marker17 = "vercel.ai.gateway.error";
@@ -50549,7 +50747,7 @@ async function getVercelRequestId() {
50549
50747
  var _a92;
50550
50748
  return (_a92 = import_oidc.getContext().headers) == null ? undefined : _a92["x-vercel-id"];
50551
50749
  }
50552
- var VERSION3 = "3.0.66";
50750
+ var VERSION3 = "3.0.77";
50553
50751
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
50554
50752
  function createGatewayProvider(options = {}) {
50555
50753
  var _a92, _b92;
@@ -50705,7 +50903,7 @@ async function getGatewayAuthToken(options) {
50705
50903
  };
50706
50904
  }
50707
50905
 
50708
- // ../../node_modules/.pnpm/ai@6.0.116_zod@4.3.6/node_modules/ai/dist/index.mjs
50906
+ // ../../node_modules/.pnpm/ai@6.0.134_zod@4.3.6/node_modules/ai/dist/index.mjs
50709
50907
  var import_api = __toESM(require_src(), 1);
50710
50908
  var import_api2 = __toESM(require_src(), 1);
50711
50909
  var __defProp4 = Object.defineProperty;
@@ -51276,7 +51474,7 @@ function detectMediaType({
51276
51474
  }
51277
51475
  return;
51278
51476
  }
51279
- var VERSION4 = "6.0.116";
51477
+ var VERSION4 = "6.0.134";
51280
51478
  var download = async ({
51281
51479
  url: url4,
51282
51480
  maxBytes,
@@ -51290,6 +51488,9 @@ var download = async ({
51290
51488
  headers: withUserAgentSuffix({}, `ai-sdk/${VERSION4}`, getRuntimeEnvironmentUserAgent()),
51291
51489
  signal: abortSignal
51292
51490
  });
51491
+ if (response.redirected) {
51492
+ validateDownloadUrl(response.url);
51493
+ }
51293
51494
  if (!response.ok) {
51294
51495
  throw new DownloadError({
51295
51496
  url: urlText,
@@ -51693,7 +51894,7 @@ async function createToolModelOutput({
51693
51894
  toolCallId,
51694
51895
  input,
51695
51896
  output,
51696
- tool: tool22,
51897
+ tool: tool2,
51697
51898
  errorMode
51698
51899
  }) {
51699
51900
  if (errorMode === "text") {
@@ -51701,8 +51902,8 @@ async function createToolModelOutput({
51701
51902
  } else if (errorMode === "json") {
51702
51903
  return { type: "error-json", value: toJSONValue(output) };
51703
51904
  }
51704
- if (tool22 == null ? undefined : tool22.toModelOutput) {
51705
- return await tool22.toModelOutput({ toolCallId, input, output });
51905
+ if (tool2 == null ? undefined : tool2.toModelOutput) {
51906
+ return await tool2.toModelOutput({ toolCallId, input, output });
51706
51907
  }
51707
51908
  return typeof output === "string" ? { type: "text", value: output } : { type: "json", value: toJSONValue(output) };
51708
51909
  }
@@ -51816,8 +52017,8 @@ async function prepareToolsAndToolChoice({
51816
52017
  }
51817
52018
  const filteredTools = activeTools != null ? Object.entries(tools).filter(([name21]) => activeTools.includes(name21)) : Object.entries(tools);
51818
52019
  const languageModelTools = [];
51819
- for (const [name21, tool22] of filteredTools) {
51820
- const toolType = tool22.type;
52020
+ for (const [name21, tool2] of filteredTools) {
52021
+ const toolType = tool2.type;
51821
52022
  switch (toolType) {
51822
52023
  case undefined:
51823
52024
  case "dynamic":
@@ -51825,19 +52026,19 @@ async function prepareToolsAndToolChoice({
51825
52026
  languageModelTools.push({
51826
52027
  type: "function",
51827
52028
  name: name21,
51828
- description: tool22.description,
51829
- inputSchema: await asSchema(tool22.inputSchema).jsonSchema,
51830
- ...tool22.inputExamples != null ? { inputExamples: tool22.inputExamples } : {},
51831
- providerOptions: tool22.providerOptions,
51832
- ...tool22.strict != null ? { strict: tool22.strict } : {}
52029
+ description: tool2.description,
52030
+ inputSchema: await asSchema(tool2.inputSchema).jsonSchema,
52031
+ ...tool2.inputExamples != null ? { inputExamples: tool2.inputExamples } : {},
52032
+ providerOptions: tool2.providerOptions,
52033
+ ...tool2.strict != null ? { strict: tool2.strict } : {}
51833
52034
  });
51834
52035
  break;
51835
52036
  case "provider":
51836
52037
  languageModelTools.push({
51837
52038
  type: "provider",
51838
52039
  name: name21,
51839
- id: tool22.id,
51840
- args: tool22.args
52040
+ id: tool2.id,
52041
+ args: tool2.args
51841
52042
  });
51842
52043
  break;
51843
52044
  default: {
@@ -52603,8 +52804,8 @@ async function executeToolCall({
52603
52804
  onToolCallFinish
52604
52805
  }) {
52605
52806
  const { toolName, toolCallId, input } = toolCall;
52606
- const tool22 = tools == null ? undefined : tools[toolName];
52607
- if ((tool22 == null ? undefined : tool22.execute) == null) {
52807
+ const tool2 = tools == null ? undefined : tools[toolName];
52808
+ if ((tool2 == null ? undefined : tool2.execute) == null) {
52608
52809
  return;
52609
52810
  }
52610
52811
  const baseCallbackEvent = {
@@ -52640,7 +52841,7 @@ async function executeToolCall({
52640
52841
  const startTime = now();
52641
52842
  try {
52642
52843
  const stream = executeTool({
52643
- execute: tool22.execute.bind(tool22),
52844
+ execute: tool2.execute.bind(tool2),
52644
52845
  input,
52645
52846
  options: {
52646
52847
  toolCallId,
@@ -52679,7 +52880,7 @@ async function executeToolCall({
52679
52880
  toolName,
52680
52881
  input,
52681
52882
  error: error49,
52682
- dynamic: tool22.type === "dynamic",
52883
+ dynamic: tool2.type === "dynamic",
52683
52884
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
52684
52885
  };
52685
52886
  }
@@ -52709,7 +52910,7 @@ async function executeToolCall({
52709
52910
  toolName,
52710
52911
  input,
52711
52912
  output,
52712
- dynamic: tool22.type === "dynamic",
52913
+ dynamic: tool2.type === "dynamic",
52713
52914
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
52714
52915
  };
52715
52916
  }
@@ -52751,18 +52952,18 @@ var DefaultGeneratedFile = class {
52751
52952
  }
52752
52953
  };
52753
52954
  async function isApprovalNeeded({
52754
- tool: tool22,
52955
+ tool: tool2,
52755
52956
  toolCall,
52756
52957
  messages,
52757
52958
  experimental_context
52758
52959
  }) {
52759
- if (tool22.needsApproval == null) {
52960
+ if (tool2.needsApproval == null) {
52760
52961
  return false;
52761
52962
  }
52762
- if (typeof tool22.needsApproval === "boolean") {
52763
- return tool22.needsApproval;
52963
+ if (typeof tool2.needsApproval === "boolean") {
52964
+ return tool2.needsApproval;
52764
52965
  }
52765
- return await tool22.needsApproval(toolCall.input, {
52966
+ return await tool2.needsApproval(toolCall.input, {
52766
52967
  toolCallId: toolCall.toolCallId,
52767
52968
  messages,
52768
52969
  experimental_context
@@ -53497,8 +53698,8 @@ async function doParseToolCall({
53497
53698
  tools
53498
53699
  }) {
53499
53700
  const toolName = toolCall.toolName;
53500
- const tool22 = tools[toolName];
53501
- if (tool22 == null) {
53701
+ const tool2 = tools[toolName];
53702
+ if (tool2 == null) {
53502
53703
  if (toolCall.providerExecuted && toolCall.dynamic) {
53503
53704
  return await parseProviderExecutedDynamicToolCall(toolCall);
53504
53705
  }
@@ -53507,7 +53708,7 @@ async function doParseToolCall({
53507
53708
  availableTools: Object.keys(tools)
53508
53709
  });
53509
53710
  }
53510
- const schema = asSchema(tool22.inputSchema);
53711
+ const schema = asSchema(tool2.inputSchema);
53511
53712
  const parseResult = toolCall.input.trim() === "" ? await safeValidateTypes({ value: {}, schema }) : await safeParseJSON({ text: toolCall.input, schema });
53512
53713
  if (parseResult.success === false) {
53513
53714
  throw new InvalidToolInputError({
@@ -53516,7 +53717,7 @@ async function doParseToolCall({
53516
53717
  cause: parseResult.error
53517
53718
  });
53518
53719
  }
53519
- return tool22.type === "dynamic" ? {
53720
+ return tool2.type === "dynamic" ? {
53520
53721
  type: "tool-call",
53521
53722
  toolCallId: toolCall.toolCallId,
53522
53723
  toolName: toolCall.toolName,
@@ -53524,7 +53725,7 @@ async function doParseToolCall({
53524
53725
  providerExecuted: toolCall.providerExecuted,
53525
53726
  providerMetadata: toolCall.providerMetadata,
53526
53727
  dynamic: true,
53527
- title: tool22.title
53728
+ title: tool2.title
53528
53729
  } : {
53529
53730
  type: "tool-call",
53530
53731
  toolCallId: toolCall.toolCallId,
@@ -53532,7 +53733,7 @@ async function doParseToolCall({
53532
53733
  input: parseResult.value,
53533
53734
  providerExecuted: toolCall.providerExecuted,
53534
53735
  providerMetadata: toolCall.providerMetadata,
53535
- title: tool22.title
53736
+ title: tool2.title
53536
53737
  };
53537
53738
  }
53538
53739
  var DefaultStepResult = class {
@@ -53872,7 +54073,7 @@ async function generateText({
53872
54073
  }),
53873
54074
  tracer,
53874
54075
  fn: async (span) => {
53875
- var _a21, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
54076
+ var _a21, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
53876
54077
  const initialMessages = initialPrompt.messages;
53877
54078
  const responseMessages = [];
53878
54079
  const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
@@ -54036,7 +54237,7 @@ async function generateText({
54036
54237
  input: () => stringifyForTelemetry(promptMessages)
54037
54238
  },
54038
54239
  "ai.prompt.tools": {
54039
- input: () => stepTools == null ? undefined : stepTools.map((tool22) => JSON.stringify(tool22))
54240
+ input: () => stepTools == null ? undefined : stepTools.map((tool2) => JSON.stringify(tool2))
54040
54241
  },
54041
54242
  "ai.prompt.toolChoice": {
54042
54243
  input: () => stepToolChoice != null ? JSON.stringify(stepToolChoice) : undefined
@@ -54072,6 +54273,7 @@ async function generateText({
54072
54273
  headers: (_g2 = result.response) == null ? undefined : _g2.headers,
54073
54274
  body: (_h2 = result.response) == null ? undefined : _h2.body
54074
54275
  };
54276
+ const usage = asLanguageModelUsage(result.usage);
54075
54277
  span2.setAttributes(await selectTelemetryAttributes({
54076
54278
  telemetry,
54077
54279
  attributes: {
@@ -54092,8 +54294,16 @@ async function generateText({
54092
54294
  "ai.response.model": responseData.modelId,
54093
54295
  "ai.response.timestamp": responseData.timestamp.toISOString(),
54094
54296
  "ai.response.providerMetadata": JSON.stringify(result.providerMetadata),
54095
- "ai.usage.promptTokens": result.usage.inputTokens.total,
54096
- "ai.usage.completionTokens": result.usage.outputTokens.total,
54297
+ "ai.usage.inputTokens": result.usage.inputTokens.total,
54298
+ "ai.usage.inputTokenDetails.noCacheTokens": result.usage.inputTokens.noCache,
54299
+ "ai.usage.inputTokenDetails.cacheReadTokens": result.usage.inputTokens.cacheRead,
54300
+ "ai.usage.inputTokenDetails.cacheWriteTokens": result.usage.inputTokens.cacheWrite,
54301
+ "ai.usage.outputTokens": result.usage.outputTokens.total,
54302
+ "ai.usage.outputTokenDetails.textTokens": result.usage.outputTokens.text,
54303
+ "ai.usage.outputTokenDetails.reasoningTokens": result.usage.outputTokens.reasoning,
54304
+ "ai.usage.totalTokens": usage.totalTokens,
54305
+ "ai.usage.reasoningTokens": result.usage.outputTokens.reasoning,
54306
+ "ai.usage.cachedInputTokens": result.usage.inputTokens.cacheRead,
54097
54307
  "gen_ai.response.finish_reasons": [
54098
54308
  result.finishReason.unified
54099
54309
  ],
@@ -54119,12 +54329,12 @@ async function generateText({
54119
54329
  if (toolCall.invalid) {
54120
54330
  continue;
54121
54331
  }
54122
- const tool22 = tools == null ? undefined : tools[toolCall.toolName];
54123
- if (tool22 == null) {
54332
+ const tool2 = tools == null ? undefined : tools[toolCall.toolName];
54333
+ if (tool2 == null) {
54124
54334
  continue;
54125
54335
  }
54126
- if ((tool22 == null ? undefined : tool22.onInputAvailable) != null) {
54127
- await tool22.onInputAvailable({
54336
+ if ((tool2 == null ? undefined : tool2.onInputAvailable) != null) {
54337
+ await tool2.onInputAvailable({
54128
54338
  input: toolCall.input,
54129
54339
  toolCallId: toolCall.toolCallId,
54130
54340
  messages: stepInputMessages,
@@ -54133,7 +54343,7 @@ async function generateText({
54133
54343
  });
54134
54344
  }
54135
54345
  if (await isApprovalNeeded({
54136
- tool: tool22,
54346
+ tool: tool2,
54137
54347
  toolCall,
54138
54348
  messages: stepInputMessages,
54139
54349
  experimental_context
@@ -54182,8 +54392,8 @@ async function generateText({
54182
54392
  for (const toolCall of stepToolCalls) {
54183
54393
  if (!toolCall.providerExecuted)
54184
54394
  continue;
54185
- const tool22 = tools == null ? undefined : tools[toolCall.toolName];
54186
- if ((tool22 == null ? undefined : tool22.type) === "provider" && tool22.supportsDeferredResults) {
54395
+ const tool2 = tools == null ? undefined : tools[toolCall.toolName];
54396
+ if ((tool2 == null ? undefined : tool2.type) === "provider" && tool2.supportsDeferredResults) {
54187
54397
  const hasResultInResponse = currentModelResponse.content.some((part) => part.type === "tool-result" && part.toolCallId === toolCall.toolCallId);
54188
54398
  if (!hasResultInResponse) {
54189
54399
  pendingDeferredToolCalls.set(toolCall.toolCallId, {
@@ -54262,9 +54472,7 @@ async function generateText({
54262
54472
  return toolCalls == null ? undefined : JSON.stringify(toolCalls);
54263
54473
  }
54264
54474
  },
54265
- "ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata),
54266
- "ai.usage.promptTokens": currentModelResponse.usage.inputTokens.total,
54267
- "ai.usage.completionTokens": currentModelResponse.usage.outputTokens.total
54475
+ "ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata)
54268
54476
  }
54269
54477
  }));
54270
54478
  const lastStep = steps[steps.length - 1];
@@ -54277,6 +54485,21 @@ async function generateText({
54277
54485
  reasoningTokens: undefined,
54278
54486
  cachedInputTokens: undefined
54279
54487
  });
54488
+ span.setAttributes(await selectTelemetryAttributes({
54489
+ telemetry,
54490
+ attributes: {
54491
+ "ai.usage.inputTokens": totalUsage.inputTokens,
54492
+ "ai.usage.inputTokenDetails.noCacheTokens": (_n = totalUsage.inputTokenDetails) == null ? undefined : _n.noCacheTokens,
54493
+ "ai.usage.inputTokenDetails.cacheReadTokens": (_o = totalUsage.inputTokenDetails) == null ? undefined : _o.cacheReadTokens,
54494
+ "ai.usage.inputTokenDetails.cacheWriteTokens": (_p = totalUsage.inputTokenDetails) == null ? undefined : _p.cacheWriteTokens,
54495
+ "ai.usage.outputTokens": totalUsage.outputTokens,
54496
+ "ai.usage.outputTokenDetails.textTokens": (_q = totalUsage.outputTokenDetails) == null ? undefined : _q.textTokens,
54497
+ "ai.usage.outputTokenDetails.reasoningTokens": (_r = totalUsage.outputTokenDetails) == null ? undefined : _r.reasoningTokens,
54498
+ "ai.usage.totalTokens": totalUsage.totalTokens,
54499
+ "ai.usage.reasoningTokens": (_s = totalUsage.outputTokenDetails) == null ? undefined : _s.reasoningTokens,
54500
+ "ai.usage.cachedInputTokens": (_t = totalUsage.inputTokenDetails) == null ? undefined : _t.cacheReadTokens
54501
+ }
54502
+ }));
54280
54503
  await notify({
54281
54504
  event: {
54282
54505
  stepNumber: lastStep.stepNumber,
@@ -54476,8 +54699,8 @@ function asContent({
54476
54699
  case "tool-result": {
54477
54700
  const toolCall = toolCalls.find((toolCall2) => toolCall2.toolCallId === part.toolCallId);
54478
54701
  if (toolCall == null) {
54479
- const tool22 = tools == null ? undefined : tools[part.toolName];
54480
- const supportsDeferredResults = (tool22 == null ? undefined : tool22.type) === "provider" && tool22.supportsDeferredResults;
54702
+ const tool2 = tools == null ? undefined : tools[part.toolName];
54703
+ const supportsDeferredResults = (tool2 == null ? undefined : tool2.type) === "provider" && tool2.supportsDeferredResults;
54481
54704
  if (!supportsDeferredResults) {
54482
54705
  throw new Error(`Tool call ${part.toolCallId} not found.`);
54483
54706
  }
@@ -54489,7 +54712,8 @@ function asContent({
54489
54712
  input: undefined,
54490
54713
  error: part.result,
54491
54714
  providerExecuted: true,
54492
- dynamic: part.dynamic
54715
+ dynamic: part.dynamic,
54716
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
54493
54717
  });
54494
54718
  } else {
54495
54719
  contentParts.push({
@@ -54499,7 +54723,8 @@ function asContent({
54499
54723
  input: undefined,
54500
54724
  output: part.result,
54501
54725
  providerExecuted: true,
54502
- dynamic: part.dynamic
54726
+ dynamic: part.dynamic,
54727
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
54503
54728
  });
54504
54729
  }
54505
54730
  break;
@@ -54512,7 +54737,8 @@ function asContent({
54512
54737
  input: toolCall.input,
54513
54738
  error: part.result,
54514
54739
  providerExecuted: true,
54515
- dynamic: toolCall.dynamic
54740
+ dynamic: toolCall.dynamic,
54741
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
54516
54742
  });
54517
54743
  } else {
54518
54744
  contentParts.push({
@@ -54522,7 +54748,8 @@ function asContent({
54522
54748
  input: toolCall.input,
54523
54749
  output: part.result,
54524
54750
  providerExecuted: true,
54525
- dynamic: toolCall.dynamic
54751
+ dynamic: toolCall.dynamic,
54752
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
54526
54753
  });
54527
54754
  }
54528
54755
  break;
@@ -54628,6 +54855,7 @@ var uiMessageChunkSchema = lazySchema(() => zodSchema(exports_external2.union([
54628
54855
  toolCallId: exports_external2.string(),
54629
54856
  output: exports_external2.unknown(),
54630
54857
  providerExecuted: exports_external2.boolean().optional(),
54858
+ providerMetadata: providerMetadataSchema.optional(),
54631
54859
  dynamic: exports_external2.boolean().optional(),
54632
54860
  preliminary: exports_external2.boolean().optional()
54633
54861
  }),
@@ -54636,6 +54864,7 @@ var uiMessageChunkSchema = lazySchema(() => zodSchema(exports_external2.union([
54636
54864
  toolCallId: exports_external2.string(),
54637
54865
  errorText: exports_external2.string(),
54638
54866
  providerExecuted: exports_external2.boolean().optional(),
54867
+ providerMetadata: providerMetadataSchema.optional(),
54639
54868
  dynamic: exports_external2.boolean().optional()
54640
54869
  }),
54641
54870
  exports_external2.strictObject({
@@ -54834,6 +55063,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
54834
55063
  output: exports_external2.unknown(),
54835
55064
  errorText: exports_external2.never().optional(),
54836
55065
  callProviderMetadata: providerMetadataSchema.optional(),
55066
+ resultProviderMetadata: providerMetadataSchema.optional(),
54837
55067
  preliminary: exports_external2.boolean().optional(),
54838
55068
  approval: exports_external2.object({
54839
55069
  id: exports_external2.string(),
@@ -54852,6 +55082,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
54852
55082
  output: exports_external2.never().optional(),
54853
55083
  errorText: exports_external2.string(),
54854
55084
  callProviderMetadata: providerMetadataSchema.optional(),
55085
+ resultProviderMetadata: providerMetadataSchema.optional(),
54855
55086
  approval: exports_external2.object({
54856
55087
  id: exports_external2.string(),
54857
55088
  approved: exports_external2.literal(true),
@@ -54935,6 +55166,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
54935
55166
  output: exports_external2.unknown(),
54936
55167
  errorText: exports_external2.never().optional(),
54937
55168
  callProviderMetadata: providerMetadataSchema.optional(),
55169
+ resultProviderMetadata: providerMetadataSchema.optional(),
54938
55170
  preliminary: exports_external2.boolean().optional(),
54939
55171
  approval: exports_external2.object({
54940
55172
  id: exports_external2.string(),
@@ -54952,6 +55184,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
54952
55184
  output: exports_external2.never().optional(),
54953
55185
  errorText: exports_external2.string(),
54954
55186
  callProviderMetadata: providerMetadataSchema.optional(),
55187
+ resultProviderMetadata: providerMetadataSchema.optional(),
54955
55188
  approval: exports_external2.object({
54956
55189
  id: exports_external2.string(),
54957
55190
  approved: exports_external2.literal(true),
@@ -55338,7 +55571,7 @@ var createTool = async (app2, message) => {
55338
55571
  console.error(`未找到路径 ${message.path} 和 key ${message.key} 的路由`);
55339
55572
  return null;
55340
55573
  }
55341
- const _tool = tool2({
55574
+ const _tool = tool({
55342
55575
  description: route?.metadata?.summary || route?.description || "无描述",
55343
55576
  inputSchema: zod_default.object({
55344
55577
  ...route.metadata?.args
@@ -55484,10 +55717,10 @@ app.route({
55484
55717
  title: "查询 Issue 标签列表",
55485
55718
  summary: "查询 Issue 的标签列表",
55486
55719
  args: {
55487
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55488
- issueNumber: tool.schema.number().describe("Issue 编号"),
55489
- page: tool.schema.number().optional().describe("分页页码,默认 1"),
55490
- pageSize: tool.schema.number().optional().describe("分页每页大小,默认 30")
55720
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55721
+ issueNumber: exports_external2.number().describe("Issue 编号"),
55722
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
55723
+ pageSize: exports_external2.number().optional().describe("分页每页大小,默认 30")
55491
55724
  }
55492
55725
  })
55493
55726
  }
@@ -55521,9 +55754,9 @@ app.route({
55521
55754
  title: "设置 Issue 标签",
55522
55755
  summary: "设置 Issue 标签(完全替换现有标签)",
55523
55756
  args: {
55524
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55525
- issueNumber: tool.schema.number().describe("Issue 编号"),
55526
- labels: tool.schema.array(tool.schema.string()).describe("标签名称数组")
55757
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55758
+ issueNumber: exports_external2.number().describe("Issue 编号"),
55759
+ labels: exports_external2.array(exports_external2.string()).describe("标签名称数组")
55527
55760
  }
55528
55761
  })
55529
55762
  }
@@ -55556,9 +55789,9 @@ app.route({
55556
55789
  title: "新增 Issue 标签",
55557
55790
  summary: "新增 Issue 标签(追加到现有标签)",
55558
55791
  args: {
55559
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55560
- issueNumber: tool.schema.number().describe("Issue 编号"),
55561
- labels: tool.schema.array(tool.schema.string()).describe("标签名称数组")
55792
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55793
+ issueNumber: exports_external2.number().describe("Issue 编号"),
55794
+ labels: exports_external2.array(exports_external2.string()).describe("标签名称数组")
55562
55795
  }
55563
55796
  })
55564
55797
  }
@@ -55591,8 +55824,8 @@ app.route({
55591
55824
  title: "清空 Issue 标签",
55592
55825
  summary: "清空 Issue 标签(移除所有标签)",
55593
55826
  args: {
55594
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55595
- issueNumber: tool.schema.number().describe("Issue 编号")
55827
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55828
+ issueNumber: exports_external2.number().describe("Issue 编号")
55596
55829
  }
55597
55830
  })
55598
55831
  }
@@ -55621,9 +55854,9 @@ app.route({
55621
55854
  title: "删除 Issue 标签",
55622
55855
  summary: "删除 Issue 指定标签",
55623
55856
  args: {
55624
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55625
- issueNumber: tool.schema.number().describe("Issue 编号"),
55626
- name: tool.schema.string().describe("标签名称")
55857
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55858
+ issueNumber: exports_external2.number().describe("Issue 编号"),
55859
+ name: exports_external2.string().describe("标签名称")
55627
55860
  }
55628
55861
  })
55629
55862
  }
@@ -55645,6 +55878,330 @@ app.route({
55645
55878
  ctx.forward(res);
55646
55879
  }).addTo(app);
55647
55880
 
55881
+ // agent/routes/package/registry.ts
55882
+ app.route({
55883
+ path: "cnb",
55884
+ key: "list-group-registries",
55885
+ description: "查询组织下的制品库列表, 参数 slug",
55886
+ middleware: ["auth"],
55887
+ metadata: {
55888
+ tags: ["package"],
55889
+ ...createSkill({
55890
+ skill: "list-group-registries",
55891
+ title: "查询制品库列表",
55892
+ args: {
55893
+ slug: exports_external2.string().describe("组织 slug, 如 my-org"),
55894
+ page: exports_external2.number().describe("页码").optional(),
55895
+ page_size: exports_external2.number().describe("每页数量").optional(),
55896
+ registry_type: exports_external2.string().describe("制品仓库类型: npm, maven, ohpm").optional(),
55897
+ filter_type: exports_external2.string().describe("制品仓库可见性: private, public").optional(),
55898
+ order_by: exports_external2.string().describe("排序字段: created_at, name").optional()
55899
+ },
55900
+ summary: "查询组织下的制品库列表"
55901
+ })
55902
+ }
55903
+ }).define(async (ctx) => {
55904
+ const cnb = await cnbManager.getContext(ctx);
55905
+ const slug = ctx.query?.slug;
55906
+ const { page, page_size, registry_type, filter_type, order_by } = ctx.query || {};
55907
+ if (!slug) {
55908
+ ctx.throw(400, "缺少参数 slug");
55909
+ }
55910
+ const res = await cnb.packages.registry.listGroupRegistries(slug, {
55911
+ page,
55912
+ page_size,
55913
+ registry_type,
55914
+ filter_type,
55915
+ order_by
55916
+ });
55917
+ ctx.forward(res);
55918
+ }).addTo(app);
55919
+ app.route({
55920
+ path: "cnb",
55921
+ key: "set-registry-visibility",
55922
+ description: "设置制品库可见性, 参数 registry, visibility",
55923
+ middleware: ["auth"],
55924
+ metadata: {
55925
+ tags: ["package"],
55926
+ ...createSkill({
55927
+ skill: "set-registry-visibility",
55928
+ title: "设置制品库可见性",
55929
+ args: {
55930
+ registry: exports_external2.string().describe("制品库路径, 如 my-org/my-registry"),
55931
+ visibility: exports_external2.string().describe("可见性: private 或 public")
55932
+ },
55933
+ summary: "设置制品库的可见性"
55934
+ })
55935
+ }
55936
+ }).define(async (ctx) => {
55937
+ const cnb = await cnbManager.getContext(ctx);
55938
+ const registry4 = ctx.query?.registry;
55939
+ const visibility = ctx.query?.visibility;
55940
+ if (!registry4) {
55941
+ ctx.throw(400, "缺少参数 registry");
55942
+ }
55943
+ if (!visibility) {
55944
+ ctx.throw(400, "缺少参数 visibility");
55945
+ }
55946
+ const res = await cnb.packages.registry.setVisibility(registry4, { visibility });
55947
+ ctx.forward(res);
55948
+ }).addTo(app);
55949
+ app.route({
55950
+ path: "cnb",
55951
+ key: "delete-registry",
55952
+ description: "删除制品库, 参数 registry",
55953
+ middleware: ["auth"],
55954
+ metadata: {
55955
+ tags: ["package"],
55956
+ ...createSkill({
55957
+ skill: "delete-registry",
55958
+ title: "删除制品库",
55959
+ args: {
55960
+ registry: exports_external2.string().describe("制品库路径, 如 my-org/my-registry")
55961
+ },
55962
+ summary: "删除指定的制品库"
55963
+ })
55964
+ }
55965
+ }).define(async (ctx) => {
55966
+ const cnb = await cnbManager.getContext(ctx);
55967
+ const registry4 = ctx.query?.registry;
55968
+ if (!registry4) {
55969
+ ctx.throw(400, "缺少参数 registry");
55970
+ }
55971
+ const res = await cnb.packages.registry.remove(registry4);
55972
+ ctx.forward(res);
55973
+ }).addTo(app);
55974
+
55975
+ // agent/routes/package/package.ts
55976
+ app.route({
55977
+ path: "cnb",
55978
+ key: "list-packages",
55979
+ description: "查询制品列表, 参数 slug, type",
55980
+ middleware: ["auth"],
55981
+ metadata: {
55982
+ tags: ["package"],
55983
+ ...createSkill({
55984
+ skill: "list-packages",
55985
+ title: "查询制品列表",
55986
+ args: {
55987
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
55988
+ type: exports_external2.string().describe("制品类型: all, docker, helm, docker-model, maven, npm, ohpm, pypi, nuget, composer, conan, cargo"),
55989
+ ordering: exports_external2.string().describe("排序类型: pull_count, last_push_at, name_ascend, name_descend").optional(),
55990
+ name: exports_external2.string().describe("关键字,搜索制品名称").optional(),
55991
+ page: exports_external2.number().describe("页码").optional(),
55992
+ page_size: exports_external2.number().describe("每页数量").optional()
55993
+ },
55994
+ summary: "查询制品列表"
55995
+ })
55996
+ }
55997
+ }).define(async (ctx) => {
55998
+ const cnb = await cnbManager.getContext(ctx);
55999
+ const slug = ctx.query?.slug;
56000
+ const type = ctx.query?.type;
56001
+ const { ordering, name: name21, page, page_size } = ctx.query || {};
56002
+ if (!slug) {
56003
+ ctx.throw(400, "缺少参数 slug");
56004
+ }
56005
+ if (!type) {
56006
+ ctx.throw(400, "缺少参数 type");
56007
+ }
56008
+ const res = await cnb.packages.package.list(slug, type, {
56009
+ ordering,
56010
+ name: name21,
56011
+ page,
56012
+ page_size
56013
+ });
56014
+ ctx.forward(res);
56015
+ }).addTo(app);
56016
+ app.route({
56017
+ path: "cnb",
56018
+ key: "get-package",
56019
+ description: "获取制品详情, 参数 slug, type, name",
56020
+ middleware: ["auth"],
56021
+ metadata: {
56022
+ tags: ["package"],
56023
+ ...createSkill({
56024
+ skill: "get-package",
56025
+ title: "获取制品详情",
56026
+ args: {
56027
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56028
+ type: exports_external2.string().describe("制品类型"),
56029
+ name: exports_external2.string().describe("制品名称")
56030
+ },
56031
+ summary: "获取指定制品的详细信息"
56032
+ })
56033
+ }
56034
+ }).define(async (ctx) => {
56035
+ const cnb = await cnbManager.getContext(ctx);
56036
+ const slug = ctx.query?.slug;
56037
+ const type = ctx.query?.type;
56038
+ const name21 = ctx.query?.name;
56039
+ if (!slug) {
56040
+ ctx.throw(400, "缺少参数 slug");
56041
+ }
56042
+ if (!type) {
56043
+ ctx.throw(400, "缺少参数 type");
56044
+ }
56045
+ if (!name21) {
56046
+ ctx.throw(400, "缺少参数 name");
56047
+ }
56048
+ const res = await cnb.packages.package.getOne(slug, type, name21);
56049
+ ctx.forward(res);
56050
+ }).addTo(app);
56051
+ app.route({
56052
+ path: "cnb",
56053
+ key: "delete-package",
56054
+ description: "删除制品, 参数 slug, type, name",
56055
+ middleware: ["auth"],
56056
+ metadata: {
56057
+ tags: ["package"],
56058
+ ...createSkill({
56059
+ skill: "delete-package",
56060
+ title: "删除制品",
56061
+ args: {
56062
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56063
+ type: exports_external2.string().describe("制品类型"),
56064
+ name: exports_external2.string().describe("制品名称")
56065
+ },
56066
+ summary: "删除指定的制品"
56067
+ })
56068
+ }
56069
+ }).define(async (ctx) => {
56070
+ const cnb = await cnbManager.getContext(ctx);
56071
+ const slug = ctx.query?.slug;
56072
+ const type = ctx.query?.type;
56073
+ const name21 = ctx.query?.name;
56074
+ if (!slug) {
56075
+ ctx.throw(400, "缺少参数 slug");
56076
+ }
56077
+ if (!type) {
56078
+ ctx.throw(400, "缺少参数 type");
56079
+ }
56080
+ if (!name21) {
56081
+ ctx.throw(400, "缺少参数 name");
56082
+ }
56083
+ const res = await cnb.packages.package.remove(slug, type, name21);
56084
+ ctx.forward(res);
56085
+ }).addTo(app);
56086
+ app.route({
56087
+ path: "cnb",
56088
+ key: "list-package-tags",
56089
+ description: "获取制品标签列表, 参数 slug, type, name",
56090
+ middleware: ["auth"],
56091
+ metadata: {
56092
+ tags: ["package"],
56093
+ ...createSkill({
56094
+ skill: "list-package-tags",
56095
+ title: "获取制品标签列表",
56096
+ args: {
56097
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56098
+ type: exports_external2.string().describe("制品类型"),
56099
+ name: exports_external2.string().describe("制品名称"),
56100
+ page: exports_external2.number().describe("页码").optional(),
56101
+ page_size: exports_external2.number().describe("每页数量").optional()
56102
+ },
56103
+ summary: "获取制品的标签列表"
56104
+ })
56105
+ }
56106
+ }).define(async (ctx) => {
56107
+ const cnb = await cnbManager.getContext(ctx);
56108
+ const slug = ctx.query?.slug;
56109
+ const type = ctx.query?.type;
56110
+ const name21 = ctx.query?.name;
56111
+ const { page, page_size } = ctx.query || {};
56112
+ if (!slug) {
56113
+ ctx.throw(400, "缺少参数 slug");
56114
+ }
56115
+ if (!type) {
56116
+ ctx.throw(400, "缺少参数 type");
56117
+ }
56118
+ if (!name21) {
56119
+ ctx.throw(400, "缺少参数 name");
56120
+ }
56121
+ const res = await cnb.packages.package.listTags(slug, type, name21, { page, page_size });
56122
+ ctx.forward(res);
56123
+ }).addTo(app);
56124
+ app.route({
56125
+ path: "cnb",
56126
+ key: "get-package-tag",
56127
+ description: "获取制品标签详情, 参数 slug, type, name, tag",
56128
+ middleware: ["auth"],
56129
+ metadata: {
56130
+ tags: ["package"],
56131
+ ...createSkill({
56132
+ skill: "get-package-tag",
56133
+ title: "获取制品标签详情",
56134
+ args: {
56135
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56136
+ type: exports_external2.string().describe("制品类型"),
56137
+ name: exports_external2.string().describe("制品名称"),
56138
+ tag: exports_external2.string().describe("标签名称")
56139
+ },
56140
+ summary: "获取制品标签的详细信息"
56141
+ })
56142
+ }
56143
+ }).define(async (ctx) => {
56144
+ const cnb = await cnbManager.getContext(ctx);
56145
+ const slug = ctx.query?.slug;
56146
+ const type = ctx.query?.type;
56147
+ const name21 = ctx.query?.name;
56148
+ const tag = ctx.query?.tag;
56149
+ if (!slug) {
56150
+ ctx.throw(400, "缺少参数 slug");
56151
+ }
56152
+ if (!type) {
56153
+ ctx.throw(400, "缺少参数 type");
56154
+ }
56155
+ if (!name21) {
56156
+ ctx.throw(400, "缺少参数 name");
56157
+ }
56158
+ if (!tag) {
56159
+ ctx.throw(400, "缺少参数 tag");
56160
+ }
56161
+ const res = await cnb.packages.package.getTag(slug, type, name21, tag);
56162
+ ctx.forward(res);
56163
+ }).addTo(app);
56164
+ app.route({
56165
+ path: "cnb",
56166
+ key: "delete-package-tag",
56167
+ description: "删除制品标签, 参数 slug, type, name, tag",
56168
+ middleware: ["auth"],
56169
+ metadata: {
56170
+ tags: ["package"],
56171
+ ...createSkill({
56172
+ skill: "delete-package-tag",
56173
+ title: "删除制品标签",
56174
+ args: {
56175
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56176
+ type: exports_external2.string().describe("制品类型"),
56177
+ name: exports_external2.string().describe("制品名称"),
56178
+ tag: exports_external2.string().describe("标签名称")
56179
+ },
56180
+ summary: "删除制品的指定标签"
56181
+ })
56182
+ }
56183
+ }).define(async (ctx) => {
56184
+ const cnb = await cnbManager.getContext(ctx);
56185
+ const slug = ctx.query?.slug;
56186
+ const type = ctx.query?.type;
56187
+ const name21 = ctx.query?.name;
56188
+ const tag = ctx.query?.tag;
56189
+ if (!slug) {
56190
+ ctx.throw(400, "缺少参数 slug");
56191
+ }
56192
+ if (!type) {
56193
+ ctx.throw(400, "缺少参数 type");
56194
+ }
56195
+ if (!name21) {
56196
+ ctx.throw(400, "缺少参数 name");
56197
+ }
56198
+ if (!tag) {
56199
+ ctx.throw(400, "缺少参数 tag");
56200
+ }
56201
+ const res = await cnb.packages.package.removeTag(slug, type, name21, tag);
56202
+ ctx.forward(res);
56203
+ }).addTo(app);
56204
+
55648
56205
  // agent/routes/index.ts
55649
56206
  var checkAppId = (ctx, appId) => {
55650
56207
  const _appId = ctx?.app?.appId;