@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/npc.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
@@ -25259,6 +25277,165 @@ class IssueLabel extends CNBCore {
25259
25277
  return this.delete({ url: url3 });
25260
25278
  }
25261
25279
  }
25280
+ // src/package/registry.ts
25281
+ class RegistryPackage extends CNBCore {
25282
+ constructor(options) {
25283
+ super(options);
25284
+ }
25285
+ listGroupRegistries(slug, params) {
25286
+ const url3 = `/${slug}/-/registries`;
25287
+ return this.get({
25288
+ url: url3,
25289
+ params,
25290
+ headers: {
25291
+ Accept: "application/vnd.cnb.api+json"
25292
+ }
25293
+ });
25294
+ }
25295
+ setVisibility(registry2, data) {
25296
+ const url3 = `/${registry2}/-/settings/set_visibility`;
25297
+ return this.post({
25298
+ url: url3,
25299
+ data
25300
+ });
25301
+ }
25302
+ remove(registry2) {
25303
+ const url3 = `/${registry2}`;
25304
+ return this.delete({ url: url3 });
25305
+ }
25306
+ }
25307
+ // src/package/package.ts
25308
+ class PackageManagement extends CNBCore {
25309
+ constructor(options) {
25310
+ super(options);
25311
+ }
25312
+ list(slug, type, params) {
25313
+ const url3 = `/${slug}/-/packages`;
25314
+ return this.get({
25315
+ url: url3,
25316
+ params: {
25317
+ type,
25318
+ ...params
25319
+ },
25320
+ headers: {
25321
+ Accept: "application/vnd.cnb.api+json"
25322
+ }
25323
+ });
25324
+ }
25325
+ getOne(slug, type, name) {
25326
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}`;
25327
+ return this.get({
25328
+ url: url3,
25329
+ headers: {
25330
+ Accept: "application/vnd.cnb.api+json"
25331
+ }
25332
+ });
25333
+ }
25334
+ remove(slug, type, name) {
25335
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}`;
25336
+ return this.delete({ url: url3 });
25337
+ }
25338
+ getTag(slug, type, name, tag) {
25339
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}/tags/${encodeURIComponent(tag)}`;
25340
+ return this.get({
25341
+ url: url3,
25342
+ headers: {
25343
+ Accept: "application/vnd.cnb.api+json"
25344
+ }
25345
+ });
25346
+ }
25347
+ removeTag(slug, type, name, tag) {
25348
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}/tags/${encodeURIComponent(tag)}`;
25349
+ return this.delete({ url: url3 });
25350
+ }
25351
+ listTags(slug, type, name, params) {
25352
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}/tags`;
25353
+ return this.get({
25354
+ url: url3,
25355
+ params,
25356
+ headers: {
25357
+ Accept: "application/vnd.cnb.api+json"
25358
+ }
25359
+ });
25360
+ }
25361
+ }
25362
+ // src/org/index.ts
25363
+ class Organization extends CNBCore {
25364
+ constructor(options) {
25365
+ super(options);
25366
+ }
25367
+ create(params) {
25368
+ return this.post({
25369
+ url: "/groups",
25370
+ data: params
25371
+ });
25372
+ }
25373
+ listTopGroups(params) {
25374
+ return this.get({
25375
+ url: "/user/groups",
25376
+ params
25377
+ });
25378
+ }
25379
+ listGroups(slug, params) {
25380
+ return this.get({
25381
+ url: `/user/groups/${slug}`,
25382
+ params
25383
+ });
25384
+ }
25385
+ getGroupsByUsername(username, params) {
25386
+ return this.get({
25387
+ url: `/users/${username}/groups`,
25388
+ params
25389
+ });
25390
+ }
25391
+ getGroup(group) {
25392
+ return this.get({
25393
+ url: `/${group}`
25394
+ });
25395
+ }
25396
+ updateGroup(group, params) {
25397
+ return this.put({
25398
+ url: `/${group}`,
25399
+ data: params
25400
+ });
25401
+ }
25402
+ deleteGroup(group, identityTicket) {
25403
+ return this.delete({
25404
+ url: `/${group}`,
25405
+ headers: identityTicket ? { "x-cnb-identity-ticket": identityTicket } : undefined
25406
+ });
25407
+ }
25408
+ transfer(group, params) {
25409
+ return this.post({
25410
+ url: `/${group}/-/transfer`,
25411
+ data: params
25412
+ });
25413
+ }
25414
+ uploadLogo(group, params) {
25415
+ return this.post({
25416
+ url: `/${group}/-/upload/logos`,
25417
+ data: params
25418
+ });
25419
+ }
25420
+ getSetting(slug) {
25421
+ return this.get({
25422
+ url: `/${slug}/-/settings`
25423
+ });
25424
+ }
25425
+ updateSetting(slug, params) {
25426
+ return this.put({
25427
+ url: `/${slug}/-/settings`,
25428
+ data: params
25429
+ });
25430
+ }
25431
+ listSubgroups(slug, params) {
25432
+ return this.get({
25433
+ url: `/${slug}/-/sub-groups`,
25434
+ params
25435
+ });
25436
+ }
25437
+ }
25438
+
25262
25439
  // src/index.ts
25263
25440
  class CNB extends CNBCore {
25264
25441
  workspace;
@@ -25270,6 +25447,8 @@ class CNB extends CNBCore {
25270
25447
  mission;
25271
25448
  ai;
25272
25449
  labels;
25450
+ packages;
25451
+ org;
25273
25452
  constructor(options) {
25274
25453
  super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
25275
25454
  this.init(options);
@@ -25292,6 +25471,11 @@ class CNB extends CNBCore {
25292
25471
  repoLabel: new RepoLabel(options),
25293
25472
  issueLabel: new IssueLabel(options)
25294
25473
  };
25474
+ this.packages = {
25475
+ registry: new RegistryPackage(options),
25476
+ package: new PackageManagement(options)
25477
+ };
25478
+ this.org = new Organization(options);
25295
25479
  }
25296
25480
  setToken(token) {
25297
25481
  this.token = token;
@@ -25303,6 +25487,9 @@ class CNB extends CNBCore {
25303
25487
  this.mission.token = token;
25304
25488
  this.labels.repoLabel.token = token;
25305
25489
  this.labels.issueLabel.token = token;
25490
+ this.packages.registry.token = token;
25491
+ this.packages.package.token = token;
25492
+ this.org.token = token;
25306
25493
  }
25307
25494
  setCookie(cookie) {
25308
25495
  this.cookie = cookie;
@@ -25314,6 +25501,9 @@ class CNB extends CNBCore {
25314
25501
  this.mission.cookie = cookie;
25315
25502
  this.labels.repoLabel.cookie = cookie;
25316
25503
  this.labels.issueLabel.cookie = cookie;
25504
+ this.packages.registry.cookie = cookie;
25505
+ this.packages.package.cookie = cookie;
25506
+ this.org.cookie = cookie;
25317
25507
  }
25318
25508
  getCNBVersion = getCNBVersion;
25319
25509
  }
@@ -25681,7 +25871,7 @@ __export(exports_external2, {
25681
25871
  safeEncode: () => safeEncode5,
25682
25872
  safeDecodeAsync: () => safeDecodeAsync5,
25683
25873
  safeDecode: () => safeDecode5,
25684
- registry: () => registry2,
25874
+ registry: () => registry3,
25685
25875
  regexes: () => exports_regexes2,
25686
25876
  regex: () => _regex2,
25687
25877
  refine: () => refine2,
@@ -25891,7 +26081,7 @@ __export(exports_core3, {
25891
26081
  safeEncode: () => safeEncode3,
25892
26082
  safeDecodeAsync: () => safeDecodeAsync3,
25893
26083
  safeDecode: () => safeDecode3,
25894
- registry: () => registry2,
26084
+ registry: () => registry3,
25895
26085
  regexes: () => exports_regexes2,
25896
26086
  process: () => process3,
25897
26087
  prettifyError: () => prettifyError2,
@@ -35411,10 +35601,10 @@ class $ZodRegistry2 {
35411
35601
  return this._map.has(schema);
35412
35602
  }
35413
35603
  }
35414
- function registry2() {
35604
+ function registry3() {
35415
35605
  return new $ZodRegistry2;
35416
35606
  }
35417
- (_a15 = globalThis).__zod_globalRegistry ?? (_a15.__zod_globalRegistry = registry2());
35607
+ (_a15 = globalThis).__zod_globalRegistry ?? (_a15.__zod_globalRegistry = registry3());
35418
35608
  var globalRegistry2 = globalThis.__zod_globalRegistry;
35419
35609
  // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
35420
35610
  function _string2(Class3, params) {
@@ -37194,21 +37384,21 @@ var allProcessors2 = {
37194
37384
  };
37195
37385
  function toJSONSchema4(input, params) {
37196
37386
  if ("_idmap" in input) {
37197
- const registry3 = input;
37387
+ const registry4 = input;
37198
37388
  const ctx2 = initializeContext2({ ...params, processors: allProcessors2 });
37199
37389
  const defs = {};
37200
- for (const entry of registry3._idmap.entries()) {
37390
+ for (const entry of registry4._idmap.entries()) {
37201
37391
  const [_, schema] = entry;
37202
37392
  process3(schema, ctx2);
37203
37393
  }
37204
37394
  const schemas = {};
37205
37395
  const external = {
37206
- registry: registry3,
37396
+ registry: registry4,
37207
37397
  uri: params?.uri,
37208
37398
  defs
37209
37399
  };
37210
37400
  ctx2.external = external;
37211
- for (const entry of registry3._idmap.entries()) {
37401
+ for (const entry of registry4._idmap.entries()) {
37212
37402
  const [key, schema] = entry;
37213
37403
  extractDefs2(ctx2, schema);
37214
37404
  schemas[key] = finalize2(ctx2, schema);
@@ -43094,7 +43284,7 @@ class EventSourceParserStream extends TransformStream {
43094
43284
  }
43095
43285
  }
43096
43286
 
43097
- // ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.19_zod@4.3.6/node_modules/@ai-sdk/provider-utils/dist/index.mjs
43287
+ // ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.21_zod@4.3.6/node_modules/@ai-sdk/provider-utils/dist/index.mjs
43098
43288
  function combineHeaders(...headers) {
43099
43289
  return headers.reduce((combinedHeaders, currentHeaders) => ({
43100
43290
  ...combinedHeaders,
@@ -43358,6 +43548,9 @@ async function downloadBlob(url4, options) {
43358
43548
  const response = await fetch(url4, {
43359
43549
  signal: options == null ? undefined : options.abortSignal
43360
43550
  });
43551
+ if (response.redirected) {
43552
+ validateDownloadUrl(response.url);
43553
+ }
43361
43554
  if (!response.ok) {
43362
43555
  throw new DownloadError({
43363
43556
  url: url4,
@@ -43514,7 +43707,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
43514
43707
  normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
43515
43708
  return Object.fromEntries(normalizedHeaders.entries());
43516
43709
  }
43517
- var VERSION = "4.0.19";
43710
+ var VERSION = "4.0.21";
43518
43711
  var getOriginalFetch = () => globalThis.fetch;
43519
43712
  var getFromApi = async ({
43520
43713
  url: url4,
@@ -43689,7 +43882,7 @@ function visit(def) {
43689
43882
  return def;
43690
43883
  return addAdditionalPropertiesToJsonSchema(def);
43691
43884
  }
43692
- var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
43885
+ var ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use");
43693
43886
  var defaultOptions = {
43694
43887
  name: undefined,
43695
43888
  $refStrategy: "root",
@@ -44682,7 +44875,7 @@ var zod3ToJsonSchema = (schema, options) => {
44682
44875
  combined.$schema = "http://json-schema.org/draft-07/schema#";
44683
44876
  return combined;
44684
44877
  };
44685
- var schemaSymbol = Symbol.for("vercel.ai.schema");
44878
+ var schemaSymbol = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
44686
44879
  function lazySchema(createSchema) {
44687
44880
  let schema;
44688
44881
  return () => {
@@ -44989,8 +45182,8 @@ var postToApi = async ({
44989
45182
  throw handleFetchError({ error: error49, url: url4, requestBodyValues: body.values });
44990
45183
  }
44991
45184
  };
44992
- function tool2(tool22) {
44993
- return tool22;
45185
+ function tool(tool2) {
45186
+ return tool2;
44994
45187
  }
44995
45188
  function createProviderToolFactoryWithOutputSchema({
44996
45189
  id,
@@ -45006,7 +45199,7 @@ function createProviderToolFactoryWithOutputSchema({
45006
45199
  onInputDelta,
45007
45200
  onInputAvailable,
45008
45201
  ...args
45009
- }) => tool2({
45202
+ }) => tool({
45010
45203
  type: "provider",
45011
45204
  id,
45012
45205
  args,
@@ -45142,7 +45335,7 @@ async function* executeTool({
45142
45335
  }
45143
45336
  }
45144
45337
 
45145
- // ../../node_modules/.pnpm/@ai-sdk+openai-compatible@2.0.35_zod@4.3.6/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
45338
+ // ../../node_modules/.pnpm/@ai-sdk+openai-compatible@2.0.37_zod@4.3.6/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
45146
45339
  var openaiCompatibleErrorDataSchema = exports_external2.object({
45147
45340
  error: exports_external2.object({
45148
45341
  message: exports_external2.string(),
@@ -45427,20 +45620,20 @@ function prepareTools({
45427
45620
  return { tools: undefined, toolChoice: undefined, toolWarnings };
45428
45621
  }
45429
45622
  const openaiCompatTools = [];
45430
- for (const tool3 of tools) {
45431
- if (tool3.type === "provider") {
45623
+ for (const tool2 of tools) {
45624
+ if (tool2.type === "provider") {
45432
45625
  toolWarnings.push({
45433
45626
  type: "unsupported",
45434
- feature: `provider-defined tool ${tool3.id}`
45627
+ feature: `provider-defined tool ${tool2.id}`
45435
45628
  });
45436
45629
  } else {
45437
45630
  openaiCompatTools.push({
45438
45631
  type: "function",
45439
45632
  function: {
45440
- name: tool3.name,
45441
- description: tool3.description,
45442
- parameters: tool3.inputSchema,
45443
- ...tool3.strict != null ? { strict: tool3.strict } : {}
45633
+ name: tool2.name,
45634
+ description: tool2.description,
45635
+ parameters: tool2.inputSchema,
45636
+ ...tool2.strict != null ? { strict: tool2.strict } : {}
45444
45637
  }
45445
45638
  });
45446
45639
  }
@@ -46589,7 +46782,7 @@ async function fileToBlob(file3) {
46589
46782
  function toCamelCase(str) {
46590
46783
  return str.replace(/[_-]([a-z])/g, (g) => g[1].toUpperCase());
46591
46784
  }
46592
- var VERSION2 = "2.0.35";
46785
+ var VERSION2 = "2.0.37";
46593
46786
  function createOpenAICompatible(options) {
46594
46787
  const baseURL = withoutTrailingSlash(options.baseURL);
46595
46788
  const providerName = options.name;
@@ -46837,10 +47030,10 @@ app.route({
46837
47030
  title: "列出cnb代码仓库",
46838
47031
  summary: "列出cnb代码仓库, 可选flags参数,如 KnowledgeBase",
46839
47032
  args: {
46840
- search: tool.schema.string().optional().describe("搜索关键词"),
46841
- page: tool.schema.number().optional().describe("分页页码,默认 1"),
46842
- pageSize: tool.schema.number().optional().describe("每页数量,默认99"),
46843
- flags: tool.schema.string().optional().describe("仓库标记,如果是知识库则填写 KnowledgeBase")
47033
+ search: exports_external2.string().optional().describe("搜索关键词"),
47034
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
47035
+ pageSize: exports_external2.number().optional().describe("每页数量,默认99"),
47036
+ flags: exports_external2.string().optional().describe("仓库标记,如果是知识库则填写 KnowledgeBase")
46844
47037
  }
46845
47038
  })
46846
47039
  }
@@ -46885,9 +47078,9 @@ app.route({
46885
47078
  skill: "create-repo",
46886
47079
  title: "创建代码仓库",
46887
47080
  args: {
46888
- name: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
46889
- visibility: tool.schema.string().describe("代码仓库可见性, public 或 private").default("public"),
46890
- description: tool.schema.string().describe("代码仓库描述")
47081
+ name: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
47082
+ visibility: exports_external2.string().describe("代码仓库可见性, public 或 private").default("public"),
47083
+ description: exports_external2.string().describe("代码仓库描述")
46891
47084
  },
46892
47085
  summary: "创建一个新的代码仓库"
46893
47086
  })
@@ -46919,7 +47112,7 @@ app.route({
46919
47112
  middleware: ["auth"],
46920
47113
  metadata: {
46921
47114
  args: {
46922
- name: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo")
47115
+ name: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo")
46923
47116
  }
46924
47117
  }
46925
47118
  }).define(async (ctx) => {
@@ -46943,10 +47136,10 @@ app.route({
46943
47136
  title: "在代码仓库中创建文件",
46944
47137
  summary: `在代码仓库中创建文件, encoding 可选,默认 raw`,
46945
47138
  args: {
46946
- repoName: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
46947
- filePath: tool.schema.string().describe("文件路径, 如 src/index.ts"),
46948
- content: tool.schema.string().describe("文本的字符串的内容"),
46949
- encoding: tool.schema.string().describe("编码方式,如 raw").optional()
47139
+ repoName: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
47140
+ filePath: exports_external2.string().describe("文件路径, 如 src/index.ts"),
47141
+ content: exports_external2.string().describe("文本的字符串的内容"),
47142
+ encoding: exports_external2.string().describe("编码方式,如 raw").optional()
46950
47143
  }
46951
47144
  })
46952
47145
  }
@@ -46978,7 +47171,7 @@ app.route({
46978
47171
  skill: "delete-repo",
46979
47172
  title: "删除代码仓库",
46980
47173
  args: {
46981
- name: tool.schema.string().describe("代码仓库名称")
47174
+ name: exports_external2.string().describe("代码仓库名称")
46982
47175
  },
46983
47176
  summary: "删除一个代码仓库"
46984
47177
  })
@@ -47012,11 +47205,11 @@ app.route({
47012
47205
  skill: "update-repo-info",
47013
47206
  title: "更新代码仓库信息",
47014
47207
  args: {
47015
- name: tool.schema.string().describe("代码仓库名称"),
47016
- description: tool.schema.string().describe("代码仓库描述"),
47017
- license: tool.schema.string().describe("代码仓库许可证类型,如 MIT").optional(),
47018
- site: tool.schema.string().describe("代码仓库主页链接").optional(),
47019
- topics: tool.schema.array(tool.schema.string()).describe("代码仓库话题标签列表").optional()
47208
+ name: exports_external2.string().describe("代码仓库名称"),
47209
+ description: exports_external2.string().describe("代码仓库描述"),
47210
+ license: exports_external2.string().describe("代码仓库许可证类型,如 MIT").optional(),
47211
+ site: exports_external2.string().describe("代码仓库主页链接").optional(),
47212
+ topics: exports_external2.array(exports_external2.string()).describe("代码仓库话题标签列表").optional()
47020
47213
  },
47021
47214
  summary: "更新代码仓库的信息"
47022
47215
  })
@@ -47044,8 +47237,8 @@ app.route({
47044
47237
  middleware: ["auth"],
47045
47238
  metadata: {
47046
47239
  args: {
47047
- name: tool.schema.string().describe("代码仓库名称"),
47048
- visibility: tool.schema.string().describe("代码仓库可见性, public 或 private 或 protected")
47240
+ name: exports_external2.string().describe("代码仓库名称"),
47241
+ visibility: exports_external2.string().describe("代码仓库可见性, public 或 private 或 protected")
47049
47242
  }
47050
47243
  }
47051
47244
  }).define(async (ctx) => {
@@ -47078,10 +47271,10 @@ app.route({
47078
47271
  title: "查询仓库标签列表",
47079
47272
  summary: "查询仓库的标签列表",
47080
47273
  args: {
47081
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
47082
- page: tool.schema.number().optional().describe("分页页码,默认 1"),
47083
- pageSize: tool.schema.number().optional().describe("分页每页大小,默认 30"),
47084
- keyword: tool.schema.string().optional().describe("标签搜索关键词")
47274
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
47275
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
47276
+ pageSize: exports_external2.number().optional().describe("分页每页大小,默认 30"),
47277
+ keyword: exports_external2.string().optional().describe("标签搜索关键词")
47085
47278
  }
47086
47279
  })
47087
47280
  }
@@ -47113,10 +47306,10 @@ app.route({
47113
47306
  title: "创建仓库标签",
47114
47307
  summary: "创建一个仓库标签",
47115
47308
  args: {
47116
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
47117
- name: tool.schema.string().describe("标签名称"),
47118
- color: tool.schema.string().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
47119
- description: tool.schema.string().optional().describe("标签描述")
47309
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
47310
+ name: exports_external2.string().describe("标签名称"),
47311
+ color: exports_external2.string().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
47312
+ description: exports_external2.string().optional().describe("标签描述")
47120
47313
  }
47121
47314
  })
47122
47315
  }
@@ -47148,11 +47341,11 @@ app.route({
47148
47341
  title: "更新仓库标签",
47149
47342
  summary: "更新仓库标签信息",
47150
47343
  args: {
47151
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
47152
- name: tool.schema.string().describe("标签名称"),
47153
- color: tool.schema.string().optional().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
47154
- description: tool.schema.string().optional().describe("标签描述"),
47155
- newName: tool.schema.string().optional().describe("新标签名称")
47344
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
47345
+ name: exports_external2.string().describe("标签名称"),
47346
+ color: exports_external2.string().optional().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
47347
+ description: exports_external2.string().optional().describe("标签描述"),
47348
+ newName: exports_external2.string().optional().describe("新标签名称")
47156
47349
  }
47157
47350
  })
47158
47351
  }
@@ -47185,8 +47378,8 @@ app.route({
47185
47378
  title: "删除仓库标签",
47186
47379
  summary: "删除指定的仓库标签",
47187
47380
  args: {
47188
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
47189
- name: tool.schema.string().describe("标签名称")
47381
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
47382
+ name: exports_external2.string().describe("标签名称")
47190
47383
  }
47191
47384
  })
47192
47385
  }
@@ -47341,8 +47534,8 @@ app.route({
47341
47534
  tags: [],
47342
47535
  ...{
47343
47536
  args: {
47344
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
47345
- pipelineId: tool.schema.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
47537
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
47538
+ pipelineId: exports_external2.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
47346
47539
  }
47347
47540
  }
47348
47541
  }
@@ -47381,8 +47574,8 @@ app.route({
47381
47574
  tags: [],
47382
47575
  ...{
47383
47576
  args: {
47384
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
47385
- pipelineId: tool.schema.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
47577
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
47578
+ pipelineId: exports_external2.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
47386
47579
  }
47387
47580
  }
47388
47581
  }
@@ -47433,11 +47626,11 @@ app.route({
47433
47626
  title: "云端构建",
47434
47627
  summary: "在云端构建代码仓库,参数包括 event, repo, branch, ref, config, env",
47435
47628
  args: {
47436
- env: tool.schema.any().optional().describe('构建环境变量,格式为 { "KEY": "VALUE" }'),
47437
- event: tool.schema.string().optional().describe("触发事件类型,例如 api_trigger_event"),
47438
- branch: tool.schema.string().optional().describe("分支名称,默认主分支"),
47439
- config: tool.schema.string().describe("构建config文件内容,例如 cloudbuild.yaml对应的yml的内容"),
47440
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo")
47629
+ env: exports_external2.any().optional().describe('构建环境变量,格式为 { "KEY": "VALUE" }'),
47630
+ event: exports_external2.string().optional().describe("触发事件类型,例如 api_trigger_event"),
47631
+ branch: exports_external2.string().optional().describe("分支名称,默认主分支"),
47632
+ config: exports_external2.string().describe("构建config文件内容,例如 cloudbuild.yaml对应的yml的内容"),
47633
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo")
47441
47634
  }
47442
47635
  })
47443
47636
  }
@@ -47499,7 +47692,12 @@ app.route({
47499
47692
  const branch = item.branch || "main";
47500
47693
  const repo3 = item.slug;
47501
47694
  const sn = item.sn;
47502
- await cnb.workspace.stopWorkspace({ sn });
47695
+ const res2 = await cnb.workspace.stopWorkspace({ sn });
47696
+ if (res2.code !== 200) {
47697
+ ctx.throw(500, res2.message || "Failed to stop workspace");
47698
+ } else {
47699
+ console.log(`工作区 ${repo3} 停止成功,${res2.data?.buildLogUrl ? `构建日志链接: ${res2.data.buildLogUrl}` : ""}`);
47700
+ }
47503
47701
  if (config3) {
47504
47702
  await cnb.build.startBuild(repo3, { branch, config: config3, event });
47505
47703
  } else {
@@ -47524,9 +47722,9 @@ app.route({
47524
47722
  title: "启动cnb工作空间",
47525
47723
  summary: "启动cnb工作空间",
47526
47724
  args: {
47527
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
47528
- branch: tool.schema.string().optional().describe("分支名称,默认主分支"),
47529
- ref: tool.schema.string().optional().describe("提交引用,例如 commit sha")
47725
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
47726
+ branch: exports_external2.string().optional().describe("分支名称,默认主分支"),
47727
+ ref: exports_external2.string().optional().describe("提交引用,例如 commit sha")
47530
47728
  }
47531
47729
  })
47532
47730
  }
@@ -47556,11 +47754,11 @@ app.route({
47556
47754
  title: "列出cnb工作空间",
47557
47755
  summary: "列出cnb工作空间列表,支持按状态过滤, status 可选值 running 或 closed",
47558
47756
  args: {
47559
- status: tool.schema.string().optional().describe("开发环境状态,running: 运行中,closed: 已关闭和停止的"),
47560
- page: tool.schema.number().optional().describe("分页页码,默认 1"),
47561
- pageSize: tool.schema.number().optional().describe("分页大小,默认 20,最大 100"),
47562
- slug: tool.schema.string().optional().describe("仓库路径,例如 groupname/reponame"),
47563
- branch: tool.schema.string().optional().describe("分支名称")
47757
+ status: exports_external2.string().optional().describe("开发环境状态,running: 运行中,closed: 已关闭和停止的"),
47758
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
47759
+ pageSize: exports_external2.number().optional().describe("分页大小,默认 20,最大 100"),
47760
+ slug: exports_external2.string().optional().describe("仓库路径,例如 groupname/reponame"),
47761
+ branch: exports_external2.string().optional().describe("分支名称")
47564
47762
  }
47565
47763
  })
47566
47764
  }
@@ -47586,8 +47784,8 @@ app.route({
47586
47784
  title: "获取工作空间详情",
47587
47785
  summary: "获取工作空间详细信息",
47588
47786
  args: {
47589
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
47590
- sn: tool.schema.string().describe("工作空间流水线的 sn")
47787
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
47788
+ sn: exports_external2.string().describe("工作空间流水线的 sn")
47591
47789
  }
47592
47790
  })
47593
47791
  }
@@ -47616,9 +47814,9 @@ app.route({
47616
47814
  title: "删除工作空间",
47617
47815
  summary: "删除工作空间,pipelineId 和 sn 二选一",
47618
47816
  args: {
47619
- pipelineId: tool.schema.string().optional().describe("流水线 ID,优先使用"),
47620
- sn: tool.schema.string().optional().describe("流水线构建号"),
47621
- sns: tool.schema.array(zod_default.string()).optional().describe("批量流水线构建号")
47817
+ pipelineId: exports_external2.string().optional().describe("流水线 ID,优先使用"),
47818
+ sn: exports_external2.string().optional().describe("流水线构建号"),
47819
+ sns: exports_external2.array(exports_external2.string()).optional().describe("批量流水线构建号")
47622
47820
  }
47623
47821
  })
47624
47822
  }
@@ -47654,8 +47852,8 @@ app.route({
47654
47852
  title: "停止工作空间",
47655
47853
  summary: "停止运行中的工作空间",
47656
47854
  args: {
47657
- pipelineId: tool.schema.string().optional().describe("流水线 ID,优先使用"),
47658
- sn: tool.schema.string().optional().describe("流水线构建号")
47855
+ pipelineId: exports_external2.string().optional().describe("流水线 ID,优先使用"),
47856
+ sn: exports_external2.string().optional().describe("流水线构建号")
47659
47857
  }
47660
47858
  })
47661
47859
  }
@@ -47683,9 +47881,9 @@ app.route({
47683
47881
  title: "调用app应用",
47684
47882
  summary: "调用router的应用, 参数path, key, payload",
47685
47883
  args: {
47686
- path: tool.schema.string().describe("应用路径,例如 cnb"),
47687
- key: tool.schema.string().optional().describe("应用key,例如 list-repos"),
47688
- payload: tool.schema.object({}).optional().describe("调用参数")
47884
+ path: exports_external2.string().describe("应用路径,例如 cnb"),
47885
+ key: exports_external2.string().optional().describe("应用key,例如 list-repos"),
47886
+ payload: exports_external2.object({}).optional().describe("调用参数")
47689
47887
  }
47690
47888
  })
47691
47889
  }
@@ -47732,7 +47930,7 @@ app.route({
47732
47930
  title: "获取当前cnb工作空间的port代理uri",
47733
47931
  summary: "获取当前cnb工作空间的port代理uri,用于端口转发",
47734
47932
  args: {
47735
- port: tool.schema.number().optional().describe("端口号,默认为51515")
47933
+ port: exports_external2.number().optional().describe("端口号,默认为51515")
47736
47934
  }
47737
47935
  })
47738
47936
  }
@@ -47759,11 +47957,11 @@ app.route({
47759
47957
  title: "获取当前cnb工作空间的编辑器访问地址",
47760
47958
  summary: "获取当前cnb工作空间的vscode代理uri,用于在浏览器中访问vscode,包含多种访问方式,如web、vscode、codebuddy、cursor、ssh",
47761
47959
  args: {
47762
- web: tool.schema.boolean().optional().describe("是否获取vscode web的访问uri,默认为false"),
47763
- vscode: tool.schema.boolean().optional().describe("是否获取vscode的代理uri,默认为true"),
47764
- codebuddy: tool.schema.boolean().optional().describe("是否获取codebuddy的代理uri,默认为false"),
47765
- cursor: tool.schema.boolean().optional().describe("是否获取cursor的代理uri,默认为false"),
47766
- ssh: tool.schema.boolean().optional().describe("是否获取vscode remote ssh的连接字符串,默认为false")
47960
+ web: exports_external2.boolean().optional().describe("是否获取vscode web的访问uri,默认为false"),
47961
+ vscode: exports_external2.boolean().optional().describe("是否获取vscode的代理uri,默认为true"),
47962
+ codebuddy: exports_external2.boolean().optional().describe("是否获取codebuddy的代理uri,默认为false"),
47963
+ cursor: exports_external2.boolean().optional().describe("是否获取cursor的代理uri,默认为false"),
47964
+ ssh: exports_external2.boolean().optional().describe("是否获取vscode remote ssh的连接字符串,默认为false")
47767
47965
  }
47768
47966
  })
47769
47967
  }
@@ -47822,7 +48020,7 @@ app.route({
47822
48020
  title: "设置当前cnb工作空间的cookie环境变量",
47823
48021
  summary: "设置当前cnb工作空间的cookie环境变量,用于界面操作定制模块功能,例子:CNBSESSION=xxxx;csrfkey=2222xxxx;",
47824
48022
  args: {
47825
- cookie: tool.schema.string().describe("cnb的cookie值")
48023
+ cookie: exports_external2.string().describe("cnb的cookie值")
47826
48024
  }
47827
48025
  })
47828
48026
  }
@@ -48159,8 +48357,8 @@ app.route({
48159
48357
  title: "调用cnb的知识库ai对话功能进行聊天",
48160
48358
  summary: "调用cnb的知识库ai对话功能进行聊天,基于cnb提供的ai能力",
48161
48359
  args: {
48162
- question: tool.schema.string().describe("用户输入的消息内容"),
48163
- repo: tool.schema.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
48360
+ question: exports_external2.string().describe("用户输入的消息内容"),
48361
+ repo: exports_external2.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
48164
48362
  }
48165
48363
  })
48166
48364
  }
@@ -48262,8 +48460,8 @@ app.route({
48262
48460
  title: "调用cnb的知识库RAG查询功能进行问答",
48263
48461
  summary: "调用cnb的知识库RAG查询功能进行问答,基于cnb提供的知识库能力",
48264
48462
  args: {
48265
- question: tool.schema.string().describe("用户输入的消息内容"),
48266
- repo: tool.schema.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
48463
+ question: exports_external2.string().describe("用户输入的消息内容"),
48464
+ repo: exports_external2.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
48267
48465
  }
48268
48466
  })
48269
48467
  }
@@ -48325,13 +48523,13 @@ app.route({
48325
48523
  skill: "list-issues",
48326
48524
  title: "查询 Issue 列表",
48327
48525
  args: {
48328
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48329
- state: tool.schema.string().optional().describe("Issue 状态:open 或 closed"),
48330
- keyword: tool.schema.string().optional().describe("问题搜索关键词"),
48331
- labels: tool.schema.string().optional().describe("问题标签,多个用逗号分隔"),
48332
- page: tool.schema.number().optional().describe("分页页码,默认: 1"),
48333
- page_size: tool.schema.number().optional().describe("分页每页大小,默认: 30"),
48334
- order_by: tool.schema.string().optional().describe("排序方式,如 created_at, -updated_at")
48526
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48527
+ state: exports_external2.string().optional().describe("Issue 状态:open 或 closed"),
48528
+ keyword: exports_external2.string().optional().describe("问题搜索关键词"),
48529
+ labels: exports_external2.string().optional().describe("问题标签,多个用逗号分隔"),
48530
+ page: exports_external2.number().optional().describe("分页页码,默认: 1"),
48531
+ page_size: exports_external2.number().optional().describe("分页每页大小,默认: 30"),
48532
+ order_by: exports_external2.string().optional().describe("排序方式,如 created_at, -updated_at")
48335
48533
  },
48336
48534
  summary: "查询 Issue 列表"
48337
48535
  })
@@ -48375,8 +48573,8 @@ app.route({
48375
48573
  skill: "getIssue",
48376
48574
  title: "获取 单个 Issue",
48377
48575
  args: {
48378
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48379
- issueNumber: tool.schema.union([tool.schema.string(), tool.schema.number()]).describe("Issue 编号")
48576
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48577
+ issueNumber: exports_external2.union([exports_external2.string(), exports_external2.number()]).describe("Issue 编号")
48380
48578
  },
48381
48579
  summary: "获取 单个 Issue"
48382
48580
  })
@@ -48407,12 +48605,12 @@ app.route({
48407
48605
  skill: "create-issue",
48408
48606
  title: "创建 Issue",
48409
48607
  args: {
48410
- repo: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
48411
- title: tool.schema.string().describe("Issue 标题"),
48412
- body: tool.schema.string().optional().describe("Issue 描述内容"),
48413
- assignees: tool.schema.array(tool.schema.string()).optional().describe("指派人列表"),
48414
- labels: tool.schema.array(tool.schema.string()).optional().describe("标签列表"),
48415
- priority: tool.schema.string().optional().describe("优先级")
48608
+ repo: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
48609
+ title: exports_external2.string().describe("Issue 标题"),
48610
+ body: exports_external2.string().optional().describe("Issue 描述内容"),
48611
+ assignees: exports_external2.array(exports_external2.string()).optional().describe("指派人列表"),
48612
+ labels: exports_external2.array(exports_external2.string()).optional().describe("标签列表"),
48613
+ priority: exports_external2.string().optional().describe("优先级")
48416
48614
  },
48417
48615
  summary: "创建一个新的 Issue"
48418
48616
  })
@@ -48448,9 +48646,9 @@ app.route({
48448
48646
  skill: "complete-issue",
48449
48647
  title: "完成 CNB的任务Issue",
48450
48648
  args: {
48451
- repo: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
48452
- issueNumber: tool.schema.union([tool.schema.string(), tool.schema.number()]).describe("Issue 编号"),
48453
- state: tool.schema.string().optional().describe("Issue 状态,默认为 closed")
48649
+ repo: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
48650
+ issueNumber: exports_external2.union([exports_external2.string(), exports_external2.number()]).describe("Issue 编号"),
48651
+ state: exports_external2.string().optional().describe("Issue 状态,默认为 closed")
48454
48652
  },
48455
48653
  summary: "完成一个 Issue(将 state 改为 closed)"
48456
48654
  })
@@ -48483,10 +48681,10 @@ app.route({
48483
48681
  skill: "list-issue-comments",
48484
48682
  title: "查询 Issue 评论列表",
48485
48683
  args: {
48486
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48487
- issueNumber: tool.schema.number().describe("Issue 编号"),
48488
- page: tool.schema.number().optional().describe("分页页码,默认: 1"),
48489
- page_size: tool.schema.number().optional().describe("分页每页大小,默认: 30")
48684
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48685
+ issueNumber: exports_external2.number().describe("Issue 编号"),
48686
+ page: exports_external2.number().optional().describe("分页页码,默认: 1"),
48687
+ page_size: exports_external2.number().optional().describe("分页每页大小,默认: 30")
48490
48688
  },
48491
48689
  summary: "查询 Issue 评论列表"
48492
48690
  })
@@ -48522,10 +48720,10 @@ app.route({
48522
48720
  skill: "create-issue-comment",
48523
48721
  title: "创建 Issue 评论",
48524
48722
  args: {
48525
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48526
- issueNumber: tool.schema.number().describe("Issue 编号"),
48527
- body: tool.schema.string().describe("评论内容"),
48528
- clearAt: tool.schema.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
48723
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48724
+ issueNumber: exports_external2.number().describe("Issue 编号"),
48725
+ body: exports_external2.string().describe("评论内容"),
48726
+ clearAt: exports_external2.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
48529
48727
  },
48530
48728
  summary: "创建 Issue 评论"
48531
48729
  })
@@ -48562,9 +48760,9 @@ app.route({
48562
48760
  skill: "get-issue-comment",
48563
48761
  title: "获取 Issue 评论",
48564
48762
  args: {
48565
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48566
- issueNumber: tool.schema.number().describe("Issue 编号"),
48567
- commentId: tool.schema.number().describe("评论 ID")
48763
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48764
+ issueNumber: exports_external2.number().describe("Issue 编号"),
48765
+ commentId: exports_external2.number().describe("评论 ID")
48568
48766
  },
48569
48767
  summary: "获取 Issue 评论"
48570
48768
  })
@@ -48597,11 +48795,11 @@ app.route({
48597
48795
  skill: "update-issue-comment",
48598
48796
  title: "修改 Issue 评论",
48599
48797
  args: {
48600
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48601
- issueNumber: tool.schema.number().describe("Issue 编号"),
48602
- commentId: tool.schema.number().describe("评论 ID"),
48603
- body: tool.schema.string().describe("评论内容"),
48604
- clearAt: tool.schema.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
48798
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48799
+ issueNumber: exports_external2.number().describe("Issue 编号"),
48800
+ commentId: exports_external2.number().describe("评论 ID"),
48801
+ body: exports_external2.string().describe("评论内容"),
48802
+ clearAt: exports_external2.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
48605
48803
  },
48606
48804
  summary: "修改 Issue 评论"
48607
48805
  })
@@ -49517,7 +49715,7 @@ app.route({
49517
49715
  };
49518
49716
  }).addTo(app);
49519
49717
 
49520
- // ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.66_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
49718
+ // ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.77_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
49521
49719
  var import_oidc = __toESM(require_dist(), 1);
49522
49720
  var import_oidc2 = __toESM(require_dist(), 1);
49523
49721
  var marker17 = "vercel.ai.gateway.error";
@@ -50583,7 +50781,7 @@ async function getVercelRequestId() {
50583
50781
  var _a92;
50584
50782
  return (_a92 = import_oidc.getContext().headers) == null ? undefined : _a92["x-vercel-id"];
50585
50783
  }
50586
- var VERSION3 = "3.0.66";
50784
+ var VERSION3 = "3.0.77";
50587
50785
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
50588
50786
  function createGatewayProvider(options = {}) {
50589
50787
  var _a92, _b92;
@@ -50739,7 +50937,7 @@ async function getGatewayAuthToken(options) {
50739
50937
  };
50740
50938
  }
50741
50939
 
50742
- // ../../node_modules/.pnpm/ai@6.0.116_zod@4.3.6/node_modules/ai/dist/index.mjs
50940
+ // ../../node_modules/.pnpm/ai@6.0.134_zod@4.3.6/node_modules/ai/dist/index.mjs
50743
50941
  var import_api = __toESM(require_src(), 1);
50744
50942
  var import_api2 = __toESM(require_src(), 1);
50745
50943
  var __defProp4 = Object.defineProperty;
@@ -51310,7 +51508,7 @@ function detectMediaType({
51310
51508
  }
51311
51509
  return;
51312
51510
  }
51313
- var VERSION4 = "6.0.116";
51511
+ var VERSION4 = "6.0.134";
51314
51512
  var download = async ({
51315
51513
  url: url4,
51316
51514
  maxBytes,
@@ -51324,6 +51522,9 @@ var download = async ({
51324
51522
  headers: withUserAgentSuffix({}, `ai-sdk/${VERSION4}`, getRuntimeEnvironmentUserAgent()),
51325
51523
  signal: abortSignal
51326
51524
  });
51525
+ if (response.redirected) {
51526
+ validateDownloadUrl(response.url);
51527
+ }
51327
51528
  if (!response.ok) {
51328
51529
  throw new DownloadError({
51329
51530
  url: urlText,
@@ -51727,7 +51928,7 @@ async function createToolModelOutput({
51727
51928
  toolCallId,
51728
51929
  input,
51729
51930
  output,
51730
- tool: tool22,
51931
+ tool: tool2,
51731
51932
  errorMode
51732
51933
  }) {
51733
51934
  if (errorMode === "text") {
@@ -51735,8 +51936,8 @@ async function createToolModelOutput({
51735
51936
  } else if (errorMode === "json") {
51736
51937
  return { type: "error-json", value: toJSONValue(output) };
51737
51938
  }
51738
- if (tool22 == null ? undefined : tool22.toModelOutput) {
51739
- return await tool22.toModelOutput({ toolCallId, input, output });
51939
+ if (tool2 == null ? undefined : tool2.toModelOutput) {
51940
+ return await tool2.toModelOutput({ toolCallId, input, output });
51740
51941
  }
51741
51942
  return typeof output === "string" ? { type: "text", value: output } : { type: "json", value: toJSONValue(output) };
51742
51943
  }
@@ -51850,8 +52051,8 @@ async function prepareToolsAndToolChoice({
51850
52051
  }
51851
52052
  const filteredTools = activeTools != null ? Object.entries(tools).filter(([name21]) => activeTools.includes(name21)) : Object.entries(tools);
51852
52053
  const languageModelTools = [];
51853
- for (const [name21, tool22] of filteredTools) {
51854
- const toolType = tool22.type;
52054
+ for (const [name21, tool2] of filteredTools) {
52055
+ const toolType = tool2.type;
51855
52056
  switch (toolType) {
51856
52057
  case undefined:
51857
52058
  case "dynamic":
@@ -51859,19 +52060,19 @@ async function prepareToolsAndToolChoice({
51859
52060
  languageModelTools.push({
51860
52061
  type: "function",
51861
52062
  name: name21,
51862
- description: tool22.description,
51863
- inputSchema: await asSchema(tool22.inputSchema).jsonSchema,
51864
- ...tool22.inputExamples != null ? { inputExamples: tool22.inputExamples } : {},
51865
- providerOptions: tool22.providerOptions,
51866
- ...tool22.strict != null ? { strict: tool22.strict } : {}
52063
+ description: tool2.description,
52064
+ inputSchema: await asSchema(tool2.inputSchema).jsonSchema,
52065
+ ...tool2.inputExamples != null ? { inputExamples: tool2.inputExamples } : {},
52066
+ providerOptions: tool2.providerOptions,
52067
+ ...tool2.strict != null ? { strict: tool2.strict } : {}
51867
52068
  });
51868
52069
  break;
51869
52070
  case "provider":
51870
52071
  languageModelTools.push({
51871
52072
  type: "provider",
51872
52073
  name: name21,
51873
- id: tool22.id,
51874
- args: tool22.args
52074
+ id: tool2.id,
52075
+ args: tool2.args
51875
52076
  });
51876
52077
  break;
51877
52078
  default: {
@@ -52637,8 +52838,8 @@ async function executeToolCall({
52637
52838
  onToolCallFinish
52638
52839
  }) {
52639
52840
  const { toolName, toolCallId, input } = toolCall;
52640
- const tool22 = tools == null ? undefined : tools[toolName];
52641
- if ((tool22 == null ? undefined : tool22.execute) == null) {
52841
+ const tool2 = tools == null ? undefined : tools[toolName];
52842
+ if ((tool2 == null ? undefined : tool2.execute) == null) {
52642
52843
  return;
52643
52844
  }
52644
52845
  const baseCallbackEvent = {
@@ -52674,7 +52875,7 @@ async function executeToolCall({
52674
52875
  const startTime = now();
52675
52876
  try {
52676
52877
  const stream = executeTool({
52677
- execute: tool22.execute.bind(tool22),
52878
+ execute: tool2.execute.bind(tool2),
52678
52879
  input,
52679
52880
  options: {
52680
52881
  toolCallId,
@@ -52713,7 +52914,7 @@ async function executeToolCall({
52713
52914
  toolName,
52714
52915
  input,
52715
52916
  error: error49,
52716
- dynamic: tool22.type === "dynamic",
52917
+ dynamic: tool2.type === "dynamic",
52717
52918
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
52718
52919
  };
52719
52920
  }
@@ -52743,7 +52944,7 @@ async function executeToolCall({
52743
52944
  toolName,
52744
52945
  input,
52745
52946
  output,
52746
- dynamic: tool22.type === "dynamic",
52947
+ dynamic: tool2.type === "dynamic",
52747
52948
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
52748
52949
  };
52749
52950
  }
@@ -52785,18 +52986,18 @@ var DefaultGeneratedFile = class {
52785
52986
  }
52786
52987
  };
52787
52988
  async function isApprovalNeeded({
52788
- tool: tool22,
52989
+ tool: tool2,
52789
52990
  toolCall,
52790
52991
  messages,
52791
52992
  experimental_context
52792
52993
  }) {
52793
- if (tool22.needsApproval == null) {
52994
+ if (tool2.needsApproval == null) {
52794
52995
  return false;
52795
52996
  }
52796
- if (typeof tool22.needsApproval === "boolean") {
52797
- return tool22.needsApproval;
52997
+ if (typeof tool2.needsApproval === "boolean") {
52998
+ return tool2.needsApproval;
52798
52999
  }
52799
- return await tool22.needsApproval(toolCall.input, {
53000
+ return await tool2.needsApproval(toolCall.input, {
52800
53001
  toolCallId: toolCall.toolCallId,
52801
53002
  messages,
52802
53003
  experimental_context
@@ -53531,8 +53732,8 @@ async function doParseToolCall({
53531
53732
  tools
53532
53733
  }) {
53533
53734
  const toolName = toolCall.toolName;
53534
- const tool22 = tools[toolName];
53535
- if (tool22 == null) {
53735
+ const tool2 = tools[toolName];
53736
+ if (tool2 == null) {
53536
53737
  if (toolCall.providerExecuted && toolCall.dynamic) {
53537
53738
  return await parseProviderExecutedDynamicToolCall(toolCall);
53538
53739
  }
@@ -53541,7 +53742,7 @@ async function doParseToolCall({
53541
53742
  availableTools: Object.keys(tools)
53542
53743
  });
53543
53744
  }
53544
- const schema = asSchema(tool22.inputSchema);
53745
+ const schema = asSchema(tool2.inputSchema);
53545
53746
  const parseResult = toolCall.input.trim() === "" ? await safeValidateTypes({ value: {}, schema }) : await safeParseJSON({ text: toolCall.input, schema });
53546
53747
  if (parseResult.success === false) {
53547
53748
  throw new InvalidToolInputError({
@@ -53550,7 +53751,7 @@ async function doParseToolCall({
53550
53751
  cause: parseResult.error
53551
53752
  });
53552
53753
  }
53553
- return tool22.type === "dynamic" ? {
53754
+ return tool2.type === "dynamic" ? {
53554
53755
  type: "tool-call",
53555
53756
  toolCallId: toolCall.toolCallId,
53556
53757
  toolName: toolCall.toolName,
@@ -53558,7 +53759,7 @@ async function doParseToolCall({
53558
53759
  providerExecuted: toolCall.providerExecuted,
53559
53760
  providerMetadata: toolCall.providerMetadata,
53560
53761
  dynamic: true,
53561
- title: tool22.title
53762
+ title: tool2.title
53562
53763
  } : {
53563
53764
  type: "tool-call",
53564
53765
  toolCallId: toolCall.toolCallId,
@@ -53566,7 +53767,7 @@ async function doParseToolCall({
53566
53767
  input: parseResult.value,
53567
53768
  providerExecuted: toolCall.providerExecuted,
53568
53769
  providerMetadata: toolCall.providerMetadata,
53569
- title: tool22.title
53770
+ title: tool2.title
53570
53771
  };
53571
53772
  }
53572
53773
  var DefaultStepResult = class {
@@ -53906,7 +54107,7 @@ async function generateText({
53906
54107
  }),
53907
54108
  tracer,
53908
54109
  fn: async (span) => {
53909
- var _a21, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
54110
+ var _a21, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
53910
54111
  const initialMessages = initialPrompt.messages;
53911
54112
  const responseMessages = [];
53912
54113
  const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
@@ -54070,7 +54271,7 @@ async function generateText({
54070
54271
  input: () => stringifyForTelemetry(promptMessages)
54071
54272
  },
54072
54273
  "ai.prompt.tools": {
54073
- input: () => stepTools == null ? undefined : stepTools.map((tool22) => JSON.stringify(tool22))
54274
+ input: () => stepTools == null ? undefined : stepTools.map((tool2) => JSON.stringify(tool2))
54074
54275
  },
54075
54276
  "ai.prompt.toolChoice": {
54076
54277
  input: () => stepToolChoice != null ? JSON.stringify(stepToolChoice) : undefined
@@ -54106,6 +54307,7 @@ async function generateText({
54106
54307
  headers: (_g2 = result.response) == null ? undefined : _g2.headers,
54107
54308
  body: (_h2 = result.response) == null ? undefined : _h2.body
54108
54309
  };
54310
+ const usage = asLanguageModelUsage(result.usage);
54109
54311
  span2.setAttributes(await selectTelemetryAttributes({
54110
54312
  telemetry,
54111
54313
  attributes: {
@@ -54126,8 +54328,16 @@ async function generateText({
54126
54328
  "ai.response.model": responseData.modelId,
54127
54329
  "ai.response.timestamp": responseData.timestamp.toISOString(),
54128
54330
  "ai.response.providerMetadata": JSON.stringify(result.providerMetadata),
54129
- "ai.usage.promptTokens": result.usage.inputTokens.total,
54130
- "ai.usage.completionTokens": result.usage.outputTokens.total,
54331
+ "ai.usage.inputTokens": result.usage.inputTokens.total,
54332
+ "ai.usage.inputTokenDetails.noCacheTokens": result.usage.inputTokens.noCache,
54333
+ "ai.usage.inputTokenDetails.cacheReadTokens": result.usage.inputTokens.cacheRead,
54334
+ "ai.usage.inputTokenDetails.cacheWriteTokens": result.usage.inputTokens.cacheWrite,
54335
+ "ai.usage.outputTokens": result.usage.outputTokens.total,
54336
+ "ai.usage.outputTokenDetails.textTokens": result.usage.outputTokens.text,
54337
+ "ai.usage.outputTokenDetails.reasoningTokens": result.usage.outputTokens.reasoning,
54338
+ "ai.usage.totalTokens": usage.totalTokens,
54339
+ "ai.usage.reasoningTokens": result.usage.outputTokens.reasoning,
54340
+ "ai.usage.cachedInputTokens": result.usage.inputTokens.cacheRead,
54131
54341
  "gen_ai.response.finish_reasons": [
54132
54342
  result.finishReason.unified
54133
54343
  ],
@@ -54153,12 +54363,12 @@ async function generateText({
54153
54363
  if (toolCall.invalid) {
54154
54364
  continue;
54155
54365
  }
54156
- const tool22 = tools == null ? undefined : tools[toolCall.toolName];
54157
- if (tool22 == null) {
54366
+ const tool2 = tools == null ? undefined : tools[toolCall.toolName];
54367
+ if (tool2 == null) {
54158
54368
  continue;
54159
54369
  }
54160
- if ((tool22 == null ? undefined : tool22.onInputAvailable) != null) {
54161
- await tool22.onInputAvailable({
54370
+ if ((tool2 == null ? undefined : tool2.onInputAvailable) != null) {
54371
+ await tool2.onInputAvailable({
54162
54372
  input: toolCall.input,
54163
54373
  toolCallId: toolCall.toolCallId,
54164
54374
  messages: stepInputMessages,
@@ -54167,7 +54377,7 @@ async function generateText({
54167
54377
  });
54168
54378
  }
54169
54379
  if (await isApprovalNeeded({
54170
- tool: tool22,
54380
+ tool: tool2,
54171
54381
  toolCall,
54172
54382
  messages: stepInputMessages,
54173
54383
  experimental_context
@@ -54216,8 +54426,8 @@ async function generateText({
54216
54426
  for (const toolCall of stepToolCalls) {
54217
54427
  if (!toolCall.providerExecuted)
54218
54428
  continue;
54219
- const tool22 = tools == null ? undefined : tools[toolCall.toolName];
54220
- if ((tool22 == null ? undefined : tool22.type) === "provider" && tool22.supportsDeferredResults) {
54429
+ const tool2 = tools == null ? undefined : tools[toolCall.toolName];
54430
+ if ((tool2 == null ? undefined : tool2.type) === "provider" && tool2.supportsDeferredResults) {
54221
54431
  const hasResultInResponse = currentModelResponse.content.some((part) => part.type === "tool-result" && part.toolCallId === toolCall.toolCallId);
54222
54432
  if (!hasResultInResponse) {
54223
54433
  pendingDeferredToolCalls.set(toolCall.toolCallId, {
@@ -54296,9 +54506,7 @@ async function generateText({
54296
54506
  return toolCalls == null ? undefined : JSON.stringify(toolCalls);
54297
54507
  }
54298
54508
  },
54299
- "ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata),
54300
- "ai.usage.promptTokens": currentModelResponse.usage.inputTokens.total,
54301
- "ai.usage.completionTokens": currentModelResponse.usage.outputTokens.total
54509
+ "ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata)
54302
54510
  }
54303
54511
  }));
54304
54512
  const lastStep = steps[steps.length - 1];
@@ -54311,6 +54519,21 @@ async function generateText({
54311
54519
  reasoningTokens: undefined,
54312
54520
  cachedInputTokens: undefined
54313
54521
  });
54522
+ span.setAttributes(await selectTelemetryAttributes({
54523
+ telemetry,
54524
+ attributes: {
54525
+ "ai.usage.inputTokens": totalUsage.inputTokens,
54526
+ "ai.usage.inputTokenDetails.noCacheTokens": (_n = totalUsage.inputTokenDetails) == null ? undefined : _n.noCacheTokens,
54527
+ "ai.usage.inputTokenDetails.cacheReadTokens": (_o = totalUsage.inputTokenDetails) == null ? undefined : _o.cacheReadTokens,
54528
+ "ai.usage.inputTokenDetails.cacheWriteTokens": (_p = totalUsage.inputTokenDetails) == null ? undefined : _p.cacheWriteTokens,
54529
+ "ai.usage.outputTokens": totalUsage.outputTokens,
54530
+ "ai.usage.outputTokenDetails.textTokens": (_q = totalUsage.outputTokenDetails) == null ? undefined : _q.textTokens,
54531
+ "ai.usage.outputTokenDetails.reasoningTokens": (_r = totalUsage.outputTokenDetails) == null ? undefined : _r.reasoningTokens,
54532
+ "ai.usage.totalTokens": totalUsage.totalTokens,
54533
+ "ai.usage.reasoningTokens": (_s = totalUsage.outputTokenDetails) == null ? undefined : _s.reasoningTokens,
54534
+ "ai.usage.cachedInputTokens": (_t = totalUsage.inputTokenDetails) == null ? undefined : _t.cacheReadTokens
54535
+ }
54536
+ }));
54314
54537
  await notify({
54315
54538
  event: {
54316
54539
  stepNumber: lastStep.stepNumber,
@@ -54510,8 +54733,8 @@ function asContent({
54510
54733
  case "tool-result": {
54511
54734
  const toolCall = toolCalls.find((toolCall2) => toolCall2.toolCallId === part.toolCallId);
54512
54735
  if (toolCall == null) {
54513
- const tool22 = tools == null ? undefined : tools[part.toolName];
54514
- const supportsDeferredResults = (tool22 == null ? undefined : tool22.type) === "provider" && tool22.supportsDeferredResults;
54736
+ const tool2 = tools == null ? undefined : tools[part.toolName];
54737
+ const supportsDeferredResults = (tool2 == null ? undefined : tool2.type) === "provider" && tool2.supportsDeferredResults;
54515
54738
  if (!supportsDeferredResults) {
54516
54739
  throw new Error(`Tool call ${part.toolCallId} not found.`);
54517
54740
  }
@@ -54523,7 +54746,8 @@ function asContent({
54523
54746
  input: undefined,
54524
54747
  error: part.result,
54525
54748
  providerExecuted: true,
54526
- dynamic: part.dynamic
54749
+ dynamic: part.dynamic,
54750
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
54527
54751
  });
54528
54752
  } else {
54529
54753
  contentParts.push({
@@ -54533,7 +54757,8 @@ function asContent({
54533
54757
  input: undefined,
54534
54758
  output: part.result,
54535
54759
  providerExecuted: true,
54536
- dynamic: part.dynamic
54760
+ dynamic: part.dynamic,
54761
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
54537
54762
  });
54538
54763
  }
54539
54764
  break;
@@ -54546,7 +54771,8 @@ function asContent({
54546
54771
  input: toolCall.input,
54547
54772
  error: part.result,
54548
54773
  providerExecuted: true,
54549
- dynamic: toolCall.dynamic
54774
+ dynamic: toolCall.dynamic,
54775
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
54550
54776
  });
54551
54777
  } else {
54552
54778
  contentParts.push({
@@ -54556,7 +54782,8 @@ function asContent({
54556
54782
  input: toolCall.input,
54557
54783
  output: part.result,
54558
54784
  providerExecuted: true,
54559
- dynamic: toolCall.dynamic
54785
+ dynamic: toolCall.dynamic,
54786
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
54560
54787
  });
54561
54788
  }
54562
54789
  break;
@@ -54662,6 +54889,7 @@ var uiMessageChunkSchema = lazySchema(() => zodSchema(exports_external2.union([
54662
54889
  toolCallId: exports_external2.string(),
54663
54890
  output: exports_external2.unknown(),
54664
54891
  providerExecuted: exports_external2.boolean().optional(),
54892
+ providerMetadata: providerMetadataSchema.optional(),
54665
54893
  dynamic: exports_external2.boolean().optional(),
54666
54894
  preliminary: exports_external2.boolean().optional()
54667
54895
  }),
@@ -54670,6 +54898,7 @@ var uiMessageChunkSchema = lazySchema(() => zodSchema(exports_external2.union([
54670
54898
  toolCallId: exports_external2.string(),
54671
54899
  errorText: exports_external2.string(),
54672
54900
  providerExecuted: exports_external2.boolean().optional(),
54901
+ providerMetadata: providerMetadataSchema.optional(),
54673
54902
  dynamic: exports_external2.boolean().optional()
54674
54903
  }),
54675
54904
  exports_external2.strictObject({
@@ -54868,6 +55097,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
54868
55097
  output: exports_external2.unknown(),
54869
55098
  errorText: exports_external2.never().optional(),
54870
55099
  callProviderMetadata: providerMetadataSchema.optional(),
55100
+ resultProviderMetadata: providerMetadataSchema.optional(),
54871
55101
  preliminary: exports_external2.boolean().optional(),
54872
55102
  approval: exports_external2.object({
54873
55103
  id: exports_external2.string(),
@@ -54886,6 +55116,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
54886
55116
  output: exports_external2.never().optional(),
54887
55117
  errorText: exports_external2.string(),
54888
55118
  callProviderMetadata: providerMetadataSchema.optional(),
55119
+ resultProviderMetadata: providerMetadataSchema.optional(),
54889
55120
  approval: exports_external2.object({
54890
55121
  id: exports_external2.string(),
54891
55122
  approved: exports_external2.literal(true),
@@ -54969,6 +55200,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
54969
55200
  output: exports_external2.unknown(),
54970
55201
  errorText: exports_external2.never().optional(),
54971
55202
  callProviderMetadata: providerMetadataSchema.optional(),
55203
+ resultProviderMetadata: providerMetadataSchema.optional(),
54972
55204
  preliminary: exports_external2.boolean().optional(),
54973
55205
  approval: exports_external2.object({
54974
55206
  id: exports_external2.string(),
@@ -54986,6 +55218,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
54986
55218
  output: exports_external2.never().optional(),
54987
55219
  errorText: exports_external2.string(),
54988
55220
  callProviderMetadata: providerMetadataSchema.optional(),
55221
+ resultProviderMetadata: providerMetadataSchema.optional(),
54989
55222
  approval: exports_external2.object({
54990
55223
  id: exports_external2.string(),
54991
55224
  approved: exports_external2.literal(true),
@@ -55372,7 +55605,7 @@ var createTool = async (app2, message) => {
55372
55605
  console.error(`未找到路径 ${message.path} 和 key ${message.key} 的路由`);
55373
55606
  return null;
55374
55607
  }
55375
- const _tool = tool2({
55608
+ const _tool = tool({
55376
55609
  description: route?.metadata?.summary || route?.description || "无描述",
55377
55610
  inputSchema: zod_default.object({
55378
55611
  ...route.metadata?.args
@@ -55518,10 +55751,10 @@ app.route({
55518
55751
  title: "查询 Issue 标签列表",
55519
55752
  summary: "查询 Issue 的标签列表",
55520
55753
  args: {
55521
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55522
- issueNumber: tool.schema.number().describe("Issue 编号"),
55523
- page: tool.schema.number().optional().describe("分页页码,默认 1"),
55524
- pageSize: tool.schema.number().optional().describe("分页每页大小,默认 30")
55754
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55755
+ issueNumber: exports_external2.number().describe("Issue 编号"),
55756
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
55757
+ pageSize: exports_external2.number().optional().describe("分页每页大小,默认 30")
55525
55758
  }
55526
55759
  })
55527
55760
  }
@@ -55555,9 +55788,9 @@ app.route({
55555
55788
  title: "设置 Issue 标签",
55556
55789
  summary: "设置 Issue 标签(完全替换现有标签)",
55557
55790
  args: {
55558
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55559
- issueNumber: tool.schema.number().describe("Issue 编号"),
55560
- labels: tool.schema.array(tool.schema.string()).describe("标签名称数组")
55791
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55792
+ issueNumber: exports_external2.number().describe("Issue 编号"),
55793
+ labels: exports_external2.array(exports_external2.string()).describe("标签名称数组")
55561
55794
  }
55562
55795
  })
55563
55796
  }
@@ -55590,9 +55823,9 @@ app.route({
55590
55823
  title: "新增 Issue 标签",
55591
55824
  summary: "新增 Issue 标签(追加到现有标签)",
55592
55825
  args: {
55593
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55594
- issueNumber: tool.schema.number().describe("Issue 编号"),
55595
- labels: tool.schema.array(tool.schema.string()).describe("标签名称数组")
55826
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55827
+ issueNumber: exports_external2.number().describe("Issue 编号"),
55828
+ labels: exports_external2.array(exports_external2.string()).describe("标签名称数组")
55596
55829
  }
55597
55830
  })
55598
55831
  }
@@ -55625,8 +55858,8 @@ app.route({
55625
55858
  title: "清空 Issue 标签",
55626
55859
  summary: "清空 Issue 标签(移除所有标签)",
55627
55860
  args: {
55628
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55629
- issueNumber: tool.schema.number().describe("Issue 编号")
55861
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55862
+ issueNumber: exports_external2.number().describe("Issue 编号")
55630
55863
  }
55631
55864
  })
55632
55865
  }
@@ -55655,9 +55888,9 @@ app.route({
55655
55888
  title: "删除 Issue 标签",
55656
55889
  summary: "删除 Issue 指定标签",
55657
55890
  args: {
55658
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55659
- issueNumber: tool.schema.number().describe("Issue 编号"),
55660
- name: tool.schema.string().describe("标签名称")
55891
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55892
+ issueNumber: exports_external2.number().describe("Issue 编号"),
55893
+ name: exports_external2.string().describe("标签名称")
55661
55894
  }
55662
55895
  })
55663
55896
  }
@@ -55679,6 +55912,330 @@ app.route({
55679
55912
  ctx.forward(res);
55680
55913
  }).addTo(app);
55681
55914
 
55915
+ // agent/routes/package/registry.ts
55916
+ app.route({
55917
+ path: "cnb",
55918
+ key: "list-group-registries",
55919
+ description: "查询组织下的制品库列表, 参数 slug",
55920
+ middleware: ["auth"],
55921
+ metadata: {
55922
+ tags: ["package"],
55923
+ ...createSkill({
55924
+ skill: "list-group-registries",
55925
+ title: "查询制品库列表",
55926
+ args: {
55927
+ slug: exports_external2.string().describe("组织 slug, 如 my-org"),
55928
+ page: exports_external2.number().describe("页码").optional(),
55929
+ page_size: exports_external2.number().describe("每页数量").optional(),
55930
+ registry_type: exports_external2.string().describe("制品仓库类型: npm, maven, ohpm").optional(),
55931
+ filter_type: exports_external2.string().describe("制品仓库可见性: private, public").optional(),
55932
+ order_by: exports_external2.string().describe("排序字段: created_at, name").optional()
55933
+ },
55934
+ summary: "查询组织下的制品库列表"
55935
+ })
55936
+ }
55937
+ }).define(async (ctx) => {
55938
+ const cnb = await cnbManager.getContext(ctx);
55939
+ const slug = ctx.query?.slug;
55940
+ const { page, page_size, registry_type, filter_type, order_by } = ctx.query || {};
55941
+ if (!slug) {
55942
+ ctx.throw(400, "缺少参数 slug");
55943
+ }
55944
+ const res = await cnb.packages.registry.listGroupRegistries(slug, {
55945
+ page,
55946
+ page_size,
55947
+ registry_type,
55948
+ filter_type,
55949
+ order_by
55950
+ });
55951
+ ctx.forward(res);
55952
+ }).addTo(app);
55953
+ app.route({
55954
+ path: "cnb",
55955
+ key: "set-registry-visibility",
55956
+ description: "设置制品库可见性, 参数 registry, visibility",
55957
+ middleware: ["auth"],
55958
+ metadata: {
55959
+ tags: ["package"],
55960
+ ...createSkill({
55961
+ skill: "set-registry-visibility",
55962
+ title: "设置制品库可见性",
55963
+ args: {
55964
+ registry: exports_external2.string().describe("制品库路径, 如 my-org/my-registry"),
55965
+ visibility: exports_external2.string().describe("可见性: private 或 public")
55966
+ },
55967
+ summary: "设置制品库的可见性"
55968
+ })
55969
+ }
55970
+ }).define(async (ctx) => {
55971
+ const cnb = await cnbManager.getContext(ctx);
55972
+ const registry4 = ctx.query?.registry;
55973
+ const visibility = ctx.query?.visibility;
55974
+ if (!registry4) {
55975
+ ctx.throw(400, "缺少参数 registry");
55976
+ }
55977
+ if (!visibility) {
55978
+ ctx.throw(400, "缺少参数 visibility");
55979
+ }
55980
+ const res = await cnb.packages.registry.setVisibility(registry4, { visibility });
55981
+ ctx.forward(res);
55982
+ }).addTo(app);
55983
+ app.route({
55984
+ path: "cnb",
55985
+ key: "delete-registry",
55986
+ description: "删除制品库, 参数 registry",
55987
+ middleware: ["auth"],
55988
+ metadata: {
55989
+ tags: ["package"],
55990
+ ...createSkill({
55991
+ skill: "delete-registry",
55992
+ title: "删除制品库",
55993
+ args: {
55994
+ registry: exports_external2.string().describe("制品库路径, 如 my-org/my-registry")
55995
+ },
55996
+ summary: "删除指定的制品库"
55997
+ })
55998
+ }
55999
+ }).define(async (ctx) => {
56000
+ const cnb = await cnbManager.getContext(ctx);
56001
+ const registry4 = ctx.query?.registry;
56002
+ if (!registry4) {
56003
+ ctx.throw(400, "缺少参数 registry");
56004
+ }
56005
+ const res = await cnb.packages.registry.remove(registry4);
56006
+ ctx.forward(res);
56007
+ }).addTo(app);
56008
+
56009
+ // agent/routes/package/package.ts
56010
+ app.route({
56011
+ path: "cnb",
56012
+ key: "list-packages",
56013
+ description: "查询制品列表, 参数 slug, type",
56014
+ middleware: ["auth"],
56015
+ metadata: {
56016
+ tags: ["package"],
56017
+ ...createSkill({
56018
+ skill: "list-packages",
56019
+ title: "查询制品列表",
56020
+ args: {
56021
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56022
+ type: exports_external2.string().describe("制品类型: all, docker, helm, docker-model, maven, npm, ohpm, pypi, nuget, composer, conan, cargo"),
56023
+ ordering: exports_external2.string().describe("排序类型: pull_count, last_push_at, name_ascend, name_descend").optional(),
56024
+ name: exports_external2.string().describe("关键字,搜索制品名称").optional(),
56025
+ page: exports_external2.number().describe("页码").optional(),
56026
+ page_size: exports_external2.number().describe("每页数量").optional()
56027
+ },
56028
+ summary: "查询制品列表"
56029
+ })
56030
+ }
56031
+ }).define(async (ctx) => {
56032
+ const cnb = await cnbManager.getContext(ctx);
56033
+ const slug = ctx.query?.slug;
56034
+ const type = ctx.query?.type;
56035
+ const { ordering, name: name21, page, page_size } = ctx.query || {};
56036
+ if (!slug) {
56037
+ ctx.throw(400, "缺少参数 slug");
56038
+ }
56039
+ if (!type) {
56040
+ ctx.throw(400, "缺少参数 type");
56041
+ }
56042
+ const res = await cnb.packages.package.list(slug, type, {
56043
+ ordering,
56044
+ name: name21,
56045
+ page,
56046
+ page_size
56047
+ });
56048
+ ctx.forward(res);
56049
+ }).addTo(app);
56050
+ app.route({
56051
+ path: "cnb",
56052
+ key: "get-package",
56053
+ description: "获取制品详情, 参数 slug, type, name",
56054
+ middleware: ["auth"],
56055
+ metadata: {
56056
+ tags: ["package"],
56057
+ ...createSkill({
56058
+ skill: "get-package",
56059
+ title: "获取制品详情",
56060
+ args: {
56061
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56062
+ type: exports_external2.string().describe("制品类型"),
56063
+ name: exports_external2.string().describe("制品名称")
56064
+ },
56065
+ summary: "获取指定制品的详细信息"
56066
+ })
56067
+ }
56068
+ }).define(async (ctx) => {
56069
+ const cnb = await cnbManager.getContext(ctx);
56070
+ const slug = ctx.query?.slug;
56071
+ const type = ctx.query?.type;
56072
+ const name21 = ctx.query?.name;
56073
+ if (!slug) {
56074
+ ctx.throw(400, "缺少参数 slug");
56075
+ }
56076
+ if (!type) {
56077
+ ctx.throw(400, "缺少参数 type");
56078
+ }
56079
+ if (!name21) {
56080
+ ctx.throw(400, "缺少参数 name");
56081
+ }
56082
+ const res = await cnb.packages.package.getOne(slug, type, name21);
56083
+ ctx.forward(res);
56084
+ }).addTo(app);
56085
+ app.route({
56086
+ path: "cnb",
56087
+ key: "delete-package",
56088
+ description: "删除制品, 参数 slug, type, name",
56089
+ middleware: ["auth"],
56090
+ metadata: {
56091
+ tags: ["package"],
56092
+ ...createSkill({
56093
+ skill: "delete-package",
56094
+ title: "删除制品",
56095
+ args: {
56096
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56097
+ type: exports_external2.string().describe("制品类型"),
56098
+ name: exports_external2.string().describe("制品名称")
56099
+ },
56100
+ summary: "删除指定的制品"
56101
+ })
56102
+ }
56103
+ }).define(async (ctx) => {
56104
+ const cnb = await cnbManager.getContext(ctx);
56105
+ const slug = ctx.query?.slug;
56106
+ const type = ctx.query?.type;
56107
+ const name21 = ctx.query?.name;
56108
+ if (!slug) {
56109
+ ctx.throw(400, "缺少参数 slug");
56110
+ }
56111
+ if (!type) {
56112
+ ctx.throw(400, "缺少参数 type");
56113
+ }
56114
+ if (!name21) {
56115
+ ctx.throw(400, "缺少参数 name");
56116
+ }
56117
+ const res = await cnb.packages.package.remove(slug, type, name21);
56118
+ ctx.forward(res);
56119
+ }).addTo(app);
56120
+ app.route({
56121
+ path: "cnb",
56122
+ key: "list-package-tags",
56123
+ description: "获取制品标签列表, 参数 slug, type, name",
56124
+ middleware: ["auth"],
56125
+ metadata: {
56126
+ tags: ["package"],
56127
+ ...createSkill({
56128
+ skill: "list-package-tags",
56129
+ title: "获取制品标签列表",
56130
+ args: {
56131
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56132
+ type: exports_external2.string().describe("制品类型"),
56133
+ name: exports_external2.string().describe("制品名称"),
56134
+ page: exports_external2.number().describe("页码").optional(),
56135
+ page_size: exports_external2.number().describe("每页数量").optional()
56136
+ },
56137
+ summary: "获取制品的标签列表"
56138
+ })
56139
+ }
56140
+ }).define(async (ctx) => {
56141
+ const cnb = await cnbManager.getContext(ctx);
56142
+ const slug = ctx.query?.slug;
56143
+ const type = ctx.query?.type;
56144
+ const name21 = ctx.query?.name;
56145
+ const { page, page_size } = ctx.query || {};
56146
+ if (!slug) {
56147
+ ctx.throw(400, "缺少参数 slug");
56148
+ }
56149
+ if (!type) {
56150
+ ctx.throw(400, "缺少参数 type");
56151
+ }
56152
+ if (!name21) {
56153
+ ctx.throw(400, "缺少参数 name");
56154
+ }
56155
+ const res = await cnb.packages.package.listTags(slug, type, name21, { page, page_size });
56156
+ ctx.forward(res);
56157
+ }).addTo(app);
56158
+ app.route({
56159
+ path: "cnb",
56160
+ key: "get-package-tag",
56161
+ description: "获取制品标签详情, 参数 slug, type, name, tag",
56162
+ middleware: ["auth"],
56163
+ metadata: {
56164
+ tags: ["package"],
56165
+ ...createSkill({
56166
+ skill: "get-package-tag",
56167
+ title: "获取制品标签详情",
56168
+ args: {
56169
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56170
+ type: exports_external2.string().describe("制品类型"),
56171
+ name: exports_external2.string().describe("制品名称"),
56172
+ tag: exports_external2.string().describe("标签名称")
56173
+ },
56174
+ summary: "获取制品标签的详细信息"
56175
+ })
56176
+ }
56177
+ }).define(async (ctx) => {
56178
+ const cnb = await cnbManager.getContext(ctx);
56179
+ const slug = ctx.query?.slug;
56180
+ const type = ctx.query?.type;
56181
+ const name21 = ctx.query?.name;
56182
+ const tag = ctx.query?.tag;
56183
+ if (!slug) {
56184
+ ctx.throw(400, "缺少参数 slug");
56185
+ }
56186
+ if (!type) {
56187
+ ctx.throw(400, "缺少参数 type");
56188
+ }
56189
+ if (!name21) {
56190
+ ctx.throw(400, "缺少参数 name");
56191
+ }
56192
+ if (!tag) {
56193
+ ctx.throw(400, "缺少参数 tag");
56194
+ }
56195
+ const res = await cnb.packages.package.getTag(slug, type, name21, tag);
56196
+ ctx.forward(res);
56197
+ }).addTo(app);
56198
+ app.route({
56199
+ path: "cnb",
56200
+ key: "delete-package-tag",
56201
+ description: "删除制品标签, 参数 slug, type, name, tag",
56202
+ middleware: ["auth"],
56203
+ metadata: {
56204
+ tags: ["package"],
56205
+ ...createSkill({
56206
+ skill: "delete-package-tag",
56207
+ title: "删除制品标签",
56208
+ args: {
56209
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56210
+ type: exports_external2.string().describe("制品类型"),
56211
+ name: exports_external2.string().describe("制品名称"),
56212
+ tag: exports_external2.string().describe("标签名称")
56213
+ },
56214
+ summary: "删除制品的指定标签"
56215
+ })
56216
+ }
56217
+ }).define(async (ctx) => {
56218
+ const cnb = await cnbManager.getContext(ctx);
56219
+ const slug = ctx.query?.slug;
56220
+ const type = ctx.query?.type;
56221
+ const name21 = ctx.query?.name;
56222
+ const tag = ctx.query?.tag;
56223
+ if (!slug) {
56224
+ ctx.throw(400, "缺少参数 slug");
56225
+ }
56226
+ if (!type) {
56227
+ ctx.throw(400, "缺少参数 type");
56228
+ }
56229
+ if (!name21) {
56230
+ ctx.throw(400, "缺少参数 name");
56231
+ }
56232
+ if (!tag) {
56233
+ ctx.throw(400, "缺少参数 tag");
56234
+ }
56235
+ const res = await cnb.packages.package.removeTag(slug, type, name21, tag);
56236
+ ctx.forward(res);
56237
+ }).addTo(app);
56238
+
55682
56239
  // agent/routes/index.ts
55683
56240
  var checkAppId = (ctx, appId) => {
55684
56241
  const _appId = ctx?.app?.appId;