@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/routes.js CHANGED
@@ -19586,9 +19586,6 @@ var fromJSONSchema2 = (args = {}, opts) => {
19586
19586
  return resultArgs;
19587
19587
  };
19588
19588
  var pickValue = ["path", "key", "id", "description", "type", "middleware", "metadata"];
19589
- var tool = {
19590
- schema: exports_external
19591
- };
19592
19589
  var createSkill = (skill) => {
19593
19590
  if (skill.tags) {
19594
19591
  const hasOpencode = skill.tags.includes("opencode");
@@ -22515,10 +22512,7 @@ class KnowledgeBase extends CNBCore {
22515
22512
  }
22516
22513
  queryKnowledgeBase(repo, data) {
22517
22514
  const url3 = `/${repo}/-/knowledge/base/query`;
22518
- let postData = {
22519
- query: data.query
22520
- };
22521
- return this.post({ url: url3, data: postData });
22515
+ return this.post({ url: url3, data });
22522
22516
  }
22523
22517
  getEmbeddingModels(repo) {
22524
22518
  const url3 = `/${repo}/-/knowledge/embedding/models`;
@@ -22532,6 +22526,30 @@ class KnowledgeBase extends CNBCore {
22532
22526
  const url3 = `/${repo}/-/knowledge/base`;
22533
22527
  return this.request({ url: url3, method: "DELETE" });
22534
22528
  }
22529
+ createKnowledgeBase(repo, data) {
22530
+ const url3 = `/${repo}/-/knowledge/base`;
22531
+ return this.post({ url: url3, data });
22532
+ }
22533
+ updateKnowledgeBase(repo, data) {
22534
+ const url3 = `/${repo}/-/knowledge/base`;
22535
+ return this.put({ url: url3, data });
22536
+ }
22537
+ getEmbedding(repo, text) {
22538
+ const url3 = `/${repo}/-/knowledge/embedding`;
22539
+ return this.post({ url: url3, data: { text } });
22540
+ }
22541
+ addDocument(repo, chunksData) {
22542
+ const url3 = `/${repo}/-/knowledge/documents/upsert-document-with-chunks`;
22543
+ return this.post({ url: url3, data: chunksData });
22544
+ }
22545
+ deleteDocument(repo, paths) {
22546
+ const url3 = `/${repo}/-/knowledge/documents`;
22547
+ return this.delete({ url: url3, data: { paths } });
22548
+ }
22549
+ listDocument(repo, page = 1, page_size = 50) {
22550
+ const url3 = `/${repo}/-/knowledge/documents`;
22551
+ return this.get({ url: url3, params: { page, page_size } });
22552
+ }
22535
22553
  }
22536
22554
 
22537
22555
  // src/repo/index.ts
@@ -23132,6 +23150,165 @@ class IssueLabel extends CNBCore {
23132
23150
  return this.delete({ url: url3 });
23133
23151
  }
23134
23152
  }
23153
+ // src/package/registry.ts
23154
+ class RegistryPackage extends CNBCore {
23155
+ constructor(options) {
23156
+ super(options);
23157
+ }
23158
+ listGroupRegistries(slug, params) {
23159
+ const url3 = `/${slug}/-/registries`;
23160
+ return this.get({
23161
+ url: url3,
23162
+ params,
23163
+ headers: {
23164
+ Accept: "application/vnd.cnb.api+json"
23165
+ }
23166
+ });
23167
+ }
23168
+ setVisibility(registry2, data) {
23169
+ const url3 = `/${registry2}/-/settings/set_visibility`;
23170
+ return this.post({
23171
+ url: url3,
23172
+ data
23173
+ });
23174
+ }
23175
+ remove(registry2) {
23176
+ const url3 = `/${registry2}`;
23177
+ return this.delete({ url: url3 });
23178
+ }
23179
+ }
23180
+ // src/package/package.ts
23181
+ class PackageManagement extends CNBCore {
23182
+ constructor(options) {
23183
+ super(options);
23184
+ }
23185
+ list(slug, type, params) {
23186
+ const url3 = `/${slug}/-/packages`;
23187
+ return this.get({
23188
+ url: url3,
23189
+ params: {
23190
+ type,
23191
+ ...params
23192
+ },
23193
+ headers: {
23194
+ Accept: "application/vnd.cnb.api+json"
23195
+ }
23196
+ });
23197
+ }
23198
+ getOne(slug, type, name) {
23199
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}`;
23200
+ return this.get({
23201
+ url: url3,
23202
+ headers: {
23203
+ Accept: "application/vnd.cnb.api+json"
23204
+ }
23205
+ });
23206
+ }
23207
+ remove(slug, type, name) {
23208
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}`;
23209
+ return this.delete({ url: url3 });
23210
+ }
23211
+ getTag(slug, type, name, tag) {
23212
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}/tags/${encodeURIComponent(tag)}`;
23213
+ return this.get({
23214
+ url: url3,
23215
+ headers: {
23216
+ Accept: "application/vnd.cnb.api+json"
23217
+ }
23218
+ });
23219
+ }
23220
+ removeTag(slug, type, name, tag) {
23221
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}/tags/${encodeURIComponent(tag)}`;
23222
+ return this.delete({ url: url3 });
23223
+ }
23224
+ listTags(slug, type, name, params) {
23225
+ const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}/tags`;
23226
+ return this.get({
23227
+ url: url3,
23228
+ params,
23229
+ headers: {
23230
+ Accept: "application/vnd.cnb.api+json"
23231
+ }
23232
+ });
23233
+ }
23234
+ }
23235
+ // src/org/index.ts
23236
+ class Organization extends CNBCore {
23237
+ constructor(options) {
23238
+ super(options);
23239
+ }
23240
+ create(params) {
23241
+ return this.post({
23242
+ url: "/groups",
23243
+ data: params
23244
+ });
23245
+ }
23246
+ listTopGroups(params) {
23247
+ return this.get({
23248
+ url: "/user/groups",
23249
+ params
23250
+ });
23251
+ }
23252
+ listGroups(slug, params) {
23253
+ return this.get({
23254
+ url: `/user/groups/${slug}`,
23255
+ params
23256
+ });
23257
+ }
23258
+ getGroupsByUsername(username, params) {
23259
+ return this.get({
23260
+ url: `/users/${username}/groups`,
23261
+ params
23262
+ });
23263
+ }
23264
+ getGroup(group) {
23265
+ return this.get({
23266
+ url: `/${group}`
23267
+ });
23268
+ }
23269
+ updateGroup(group, params) {
23270
+ return this.put({
23271
+ url: `/${group}`,
23272
+ data: params
23273
+ });
23274
+ }
23275
+ deleteGroup(group, identityTicket) {
23276
+ return this.delete({
23277
+ url: `/${group}`,
23278
+ headers: identityTicket ? { "x-cnb-identity-ticket": identityTicket } : undefined
23279
+ });
23280
+ }
23281
+ transfer(group, params) {
23282
+ return this.post({
23283
+ url: `/${group}/-/transfer`,
23284
+ data: params
23285
+ });
23286
+ }
23287
+ uploadLogo(group, params) {
23288
+ return this.post({
23289
+ url: `/${group}/-/upload/logos`,
23290
+ data: params
23291
+ });
23292
+ }
23293
+ getSetting(slug) {
23294
+ return this.get({
23295
+ url: `/${slug}/-/settings`
23296
+ });
23297
+ }
23298
+ updateSetting(slug, params) {
23299
+ return this.put({
23300
+ url: `/${slug}/-/settings`,
23301
+ data: params
23302
+ });
23303
+ }
23304
+ listSubgroups(slug, params) {
23305
+ return this.get({
23306
+ url: `/${slug}/-/sub-groups`,
23307
+ params
23308
+ });
23309
+ }
23310
+ }
23311
+
23135
23312
  // src/index.ts
23136
23313
  class CNB extends CNBCore {
23137
23314
  workspace;
@@ -23143,6 +23320,8 @@ class CNB extends CNBCore {
23143
23320
  mission;
23144
23321
  ai;
23145
23322
  labels;
23323
+ packages;
23324
+ org;
23146
23325
  constructor(options) {
23147
23326
  super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
23148
23327
  this.init(options);
@@ -23165,6 +23344,11 @@ class CNB extends CNBCore {
23165
23344
  repoLabel: new RepoLabel(options),
23166
23345
  issueLabel: new IssueLabel(options)
23167
23346
  };
23347
+ this.packages = {
23348
+ registry: new RegistryPackage(options),
23349
+ package: new PackageManagement(options)
23350
+ };
23351
+ this.org = new Organization(options);
23168
23352
  }
23169
23353
  setToken(token) {
23170
23354
  this.token = token;
@@ -23176,6 +23360,9 @@ class CNB extends CNBCore {
23176
23360
  this.mission.token = token;
23177
23361
  this.labels.repoLabel.token = token;
23178
23362
  this.labels.issueLabel.token = token;
23363
+ this.packages.registry.token = token;
23364
+ this.packages.package.token = token;
23365
+ this.org.token = token;
23179
23366
  }
23180
23367
  setCookie(cookie) {
23181
23368
  this.cookie = cookie;
@@ -23187,6 +23374,9 @@ class CNB extends CNBCore {
23187
23374
  this.mission.cookie = cookie;
23188
23375
  this.labels.repoLabel.cookie = cookie;
23189
23376
  this.labels.issueLabel.cookie = cookie;
23377
+ this.packages.registry.cookie = cookie;
23378
+ this.packages.package.cookie = cookie;
23379
+ this.org.cookie = cookie;
23190
23380
  }
23191
23381
  getCNBVersion = getCNBVersion;
23192
23382
  }
@@ -23554,7 +23744,7 @@ __export(exports_external2, {
23554
23744
  safeEncode: () => safeEncode5,
23555
23745
  safeDecodeAsync: () => safeDecodeAsync5,
23556
23746
  safeDecode: () => safeDecode5,
23557
- registry: () => registry2,
23747
+ registry: () => registry3,
23558
23748
  regexes: () => exports_regexes2,
23559
23749
  regex: () => _regex2,
23560
23750
  refine: () => refine2,
@@ -23764,7 +23954,7 @@ __export(exports_core3, {
23764
23954
  safeEncode: () => safeEncode3,
23765
23955
  safeDecodeAsync: () => safeDecodeAsync3,
23766
23956
  safeDecode: () => safeDecode3,
23767
- registry: () => registry2,
23957
+ registry: () => registry3,
23768
23958
  regexes: () => exports_regexes2,
23769
23959
  process: () => process3,
23770
23960
  prettifyError: () => prettifyError2,
@@ -33284,10 +33474,10 @@ class $ZodRegistry2 {
33284
33474
  return this._map.has(schema);
33285
33475
  }
33286
33476
  }
33287
- function registry2() {
33477
+ function registry3() {
33288
33478
  return new $ZodRegistry2;
33289
33479
  }
33290
- (_a15 = globalThis).__zod_globalRegistry ?? (_a15.__zod_globalRegistry = registry2());
33480
+ (_a15 = globalThis).__zod_globalRegistry ?? (_a15.__zod_globalRegistry = registry3());
33291
33481
  var globalRegistry2 = globalThis.__zod_globalRegistry;
33292
33482
  // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
33293
33483
  function _string2(Class3, params) {
@@ -35067,21 +35257,21 @@ var allProcessors2 = {
35067
35257
  };
35068
35258
  function toJSONSchema4(input, params) {
35069
35259
  if ("_idmap" in input) {
35070
- const registry3 = input;
35260
+ const registry4 = input;
35071
35261
  const ctx2 = initializeContext2({ ...params, processors: allProcessors2 });
35072
35262
  const defs = {};
35073
- for (const entry of registry3._idmap.entries()) {
35263
+ for (const entry of registry4._idmap.entries()) {
35074
35264
  const [_, schema] = entry;
35075
35265
  process3(schema, ctx2);
35076
35266
  }
35077
35267
  const schemas = {};
35078
35268
  const external = {
35079
- registry: registry3,
35269
+ registry: registry4,
35080
35270
  uri: params?.uri,
35081
35271
  defs
35082
35272
  };
35083
35273
  ctx2.external = external;
35084
- for (const entry of registry3._idmap.entries()) {
35274
+ for (const entry of registry4._idmap.entries()) {
35085
35275
  const [key, schema] = entry;
35086
35276
  extractDefs2(ctx2, schema);
35087
35277
  schemas[key] = finalize2(ctx2, schema);
@@ -40967,7 +41157,7 @@ class EventSourceParserStream extends TransformStream {
40967
41157
  }
40968
41158
  }
40969
41159
 
40970
- // ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.19_zod@4.3.6/node_modules/@ai-sdk/provider-utils/dist/index.mjs
41160
+ // ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.21_zod@4.3.6/node_modules/@ai-sdk/provider-utils/dist/index.mjs
40971
41161
  function combineHeaders(...headers) {
40972
41162
  return headers.reduce((combinedHeaders, currentHeaders) => ({
40973
41163
  ...combinedHeaders,
@@ -41231,6 +41421,9 @@ async function downloadBlob(url4, options) {
41231
41421
  const response = await fetch(url4, {
41232
41422
  signal: options == null ? undefined : options.abortSignal
41233
41423
  });
41424
+ if (response.redirected) {
41425
+ validateDownloadUrl(response.url);
41426
+ }
41234
41427
  if (!response.ok) {
41235
41428
  throw new DownloadError({
41236
41429
  url: url4,
@@ -41387,7 +41580,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
41387
41580
  normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
41388
41581
  return Object.fromEntries(normalizedHeaders.entries());
41389
41582
  }
41390
- var VERSION = "4.0.19";
41583
+ var VERSION = "4.0.21";
41391
41584
  var getOriginalFetch = () => globalThis.fetch;
41392
41585
  var getFromApi = async ({
41393
41586
  url: url4,
@@ -41562,7 +41755,7 @@ function visit(def) {
41562
41755
  return def;
41563
41756
  return addAdditionalPropertiesToJsonSchema(def);
41564
41757
  }
41565
- var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
41758
+ var ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use");
41566
41759
  var defaultOptions = {
41567
41760
  name: undefined,
41568
41761
  $refStrategy: "root",
@@ -42555,7 +42748,7 @@ var zod3ToJsonSchema = (schema, options) => {
42555
42748
  combined.$schema = "http://json-schema.org/draft-07/schema#";
42556
42749
  return combined;
42557
42750
  };
42558
- var schemaSymbol = Symbol.for("vercel.ai.schema");
42751
+ var schemaSymbol = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
42559
42752
  function lazySchema(createSchema) {
42560
42753
  let schema;
42561
42754
  return () => {
@@ -42862,8 +43055,8 @@ var postToApi = async ({
42862
43055
  throw handleFetchError({ error: error49, url: url4, requestBodyValues: body.values });
42863
43056
  }
42864
43057
  };
42865
- function tool2(tool22) {
42866
- return tool22;
43058
+ function tool(tool2) {
43059
+ return tool2;
42867
43060
  }
42868
43061
  function createProviderToolFactoryWithOutputSchema({
42869
43062
  id,
@@ -42879,7 +43072,7 @@ function createProviderToolFactoryWithOutputSchema({
42879
43072
  onInputDelta,
42880
43073
  onInputAvailable,
42881
43074
  ...args
42882
- }) => tool2({
43075
+ }) => tool({
42883
43076
  type: "provider",
42884
43077
  id,
42885
43078
  args,
@@ -43015,7 +43208,7 @@ async function* executeTool({
43015
43208
  }
43016
43209
  }
43017
43210
 
43018
- // ../../node_modules/.pnpm/@ai-sdk+openai-compatible@2.0.35_zod@4.3.6/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
43211
+ // ../../node_modules/.pnpm/@ai-sdk+openai-compatible@2.0.37_zod@4.3.6/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
43019
43212
  var openaiCompatibleErrorDataSchema = exports_external2.object({
43020
43213
  error: exports_external2.object({
43021
43214
  message: exports_external2.string(),
@@ -43300,20 +43493,20 @@ function prepareTools({
43300
43493
  return { tools: undefined, toolChoice: undefined, toolWarnings };
43301
43494
  }
43302
43495
  const openaiCompatTools = [];
43303
- for (const tool3 of tools) {
43304
- if (tool3.type === "provider") {
43496
+ for (const tool2 of tools) {
43497
+ if (tool2.type === "provider") {
43305
43498
  toolWarnings.push({
43306
43499
  type: "unsupported",
43307
- feature: `provider-defined tool ${tool3.id}`
43500
+ feature: `provider-defined tool ${tool2.id}`
43308
43501
  });
43309
43502
  } else {
43310
43503
  openaiCompatTools.push({
43311
43504
  type: "function",
43312
43505
  function: {
43313
- name: tool3.name,
43314
- description: tool3.description,
43315
- parameters: tool3.inputSchema,
43316
- ...tool3.strict != null ? { strict: tool3.strict } : {}
43506
+ name: tool2.name,
43507
+ description: tool2.description,
43508
+ parameters: tool2.inputSchema,
43509
+ ...tool2.strict != null ? { strict: tool2.strict } : {}
43317
43510
  }
43318
43511
  });
43319
43512
  }
@@ -44462,7 +44655,7 @@ async function fileToBlob(file3) {
44462
44655
  function toCamelCase(str) {
44463
44656
  return str.replace(/[_-]([a-z])/g, (g) => g[1].toUpperCase());
44464
44657
  }
44465
- var VERSION2 = "2.0.35";
44658
+ var VERSION2 = "2.0.37";
44466
44659
  function createOpenAICompatible(options) {
44467
44660
  const baseURL = withoutTrailingSlash(options.baseURL);
44468
44661
  const providerName = options.name;
@@ -44710,10 +44903,10 @@ app.route({
44710
44903
  title: "列出cnb代码仓库",
44711
44904
  summary: "列出cnb代码仓库, 可选flags参数,如 KnowledgeBase",
44712
44905
  args: {
44713
- search: tool.schema.string().optional().describe("搜索关键词"),
44714
- page: tool.schema.number().optional().describe("分页页码,默认 1"),
44715
- pageSize: tool.schema.number().optional().describe("每页数量,默认99"),
44716
- flags: tool.schema.string().optional().describe("仓库标记,如果是知识库则填写 KnowledgeBase")
44906
+ search: exports_external2.string().optional().describe("搜索关键词"),
44907
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
44908
+ pageSize: exports_external2.number().optional().describe("每页数量,默认99"),
44909
+ flags: exports_external2.string().optional().describe("仓库标记,如果是知识库则填写 KnowledgeBase")
44717
44910
  }
44718
44911
  })
44719
44912
  }
@@ -44758,9 +44951,9 @@ app.route({
44758
44951
  skill: "create-repo",
44759
44952
  title: "创建代码仓库",
44760
44953
  args: {
44761
- name: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
44762
- visibility: tool.schema.string().describe("代码仓库可见性, public 或 private").default("public"),
44763
- description: tool.schema.string().describe("代码仓库描述")
44954
+ name: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
44955
+ visibility: exports_external2.string().describe("代码仓库可见性, public 或 private").default("public"),
44956
+ description: exports_external2.string().describe("代码仓库描述")
44764
44957
  },
44765
44958
  summary: "创建一个新的代码仓库"
44766
44959
  })
@@ -44792,7 +44985,7 @@ app.route({
44792
44985
  middleware: ["auth"],
44793
44986
  metadata: {
44794
44987
  args: {
44795
- name: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo")
44988
+ name: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo")
44796
44989
  }
44797
44990
  }
44798
44991
  }).define(async (ctx) => {
@@ -44816,10 +45009,10 @@ app.route({
44816
45009
  title: "在代码仓库中创建文件",
44817
45010
  summary: `在代码仓库中创建文件, encoding 可选,默认 raw`,
44818
45011
  args: {
44819
- repoName: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
44820
- filePath: tool.schema.string().describe("文件路径, 如 src/index.ts"),
44821
- content: tool.schema.string().describe("文本的字符串的内容"),
44822
- encoding: tool.schema.string().describe("编码方式,如 raw").optional()
45012
+ repoName: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
45013
+ filePath: exports_external2.string().describe("文件路径, 如 src/index.ts"),
45014
+ content: exports_external2.string().describe("文本的字符串的内容"),
45015
+ encoding: exports_external2.string().describe("编码方式,如 raw").optional()
44823
45016
  }
44824
45017
  })
44825
45018
  }
@@ -44851,7 +45044,7 @@ app.route({
44851
45044
  skill: "delete-repo",
44852
45045
  title: "删除代码仓库",
44853
45046
  args: {
44854
- name: tool.schema.string().describe("代码仓库名称")
45047
+ name: exports_external2.string().describe("代码仓库名称")
44855
45048
  },
44856
45049
  summary: "删除一个代码仓库"
44857
45050
  })
@@ -44885,11 +45078,11 @@ app.route({
44885
45078
  skill: "update-repo-info",
44886
45079
  title: "更新代码仓库信息",
44887
45080
  args: {
44888
- name: tool.schema.string().describe("代码仓库名称"),
44889
- description: tool.schema.string().describe("代码仓库描述"),
44890
- license: tool.schema.string().describe("代码仓库许可证类型,如 MIT").optional(),
44891
- site: tool.schema.string().describe("代码仓库主页链接").optional(),
44892
- topics: tool.schema.array(tool.schema.string()).describe("代码仓库话题标签列表").optional()
45081
+ name: exports_external2.string().describe("代码仓库名称"),
45082
+ description: exports_external2.string().describe("代码仓库描述"),
45083
+ license: exports_external2.string().describe("代码仓库许可证类型,如 MIT").optional(),
45084
+ site: exports_external2.string().describe("代码仓库主页链接").optional(),
45085
+ topics: exports_external2.array(exports_external2.string()).describe("代码仓库话题标签列表").optional()
44893
45086
  },
44894
45087
  summary: "更新代码仓库的信息"
44895
45088
  })
@@ -44917,8 +45110,8 @@ app.route({
44917
45110
  middleware: ["auth"],
44918
45111
  metadata: {
44919
45112
  args: {
44920
- name: tool.schema.string().describe("代码仓库名称"),
44921
- visibility: tool.schema.string().describe("代码仓库可见性, public 或 private 或 protected")
45113
+ name: exports_external2.string().describe("代码仓库名称"),
45114
+ visibility: exports_external2.string().describe("代码仓库可见性, public 或 private 或 protected")
44922
45115
  }
44923
45116
  }
44924
45117
  }).define(async (ctx) => {
@@ -44951,10 +45144,10 @@ app.route({
44951
45144
  title: "查询仓库标签列表",
44952
45145
  summary: "查询仓库的标签列表",
44953
45146
  args: {
44954
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
44955
- page: tool.schema.number().optional().describe("分页页码,默认 1"),
44956
- pageSize: tool.schema.number().optional().describe("分页每页大小,默认 30"),
44957
- keyword: tool.schema.string().optional().describe("标签搜索关键词")
45147
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
45148
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
45149
+ pageSize: exports_external2.number().optional().describe("分页每页大小,默认 30"),
45150
+ keyword: exports_external2.string().optional().describe("标签搜索关键词")
44958
45151
  }
44959
45152
  })
44960
45153
  }
@@ -44986,10 +45179,10 @@ app.route({
44986
45179
  title: "创建仓库标签",
44987
45180
  summary: "创建一个仓库标签",
44988
45181
  args: {
44989
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
44990
- name: tool.schema.string().describe("标签名称"),
44991
- color: tool.schema.string().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
44992
- description: tool.schema.string().optional().describe("标签描述")
45182
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
45183
+ name: exports_external2.string().describe("标签名称"),
45184
+ color: exports_external2.string().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
45185
+ description: exports_external2.string().optional().describe("标签描述")
44993
45186
  }
44994
45187
  })
44995
45188
  }
@@ -45021,11 +45214,11 @@ app.route({
45021
45214
  title: "更新仓库标签",
45022
45215
  summary: "更新仓库标签信息",
45023
45216
  args: {
45024
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
45025
- name: tool.schema.string().describe("标签名称"),
45026
- color: tool.schema.string().optional().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
45027
- description: tool.schema.string().optional().describe("标签描述"),
45028
- newName: tool.schema.string().optional().describe("新标签名称")
45217
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
45218
+ name: exports_external2.string().describe("标签名称"),
45219
+ color: exports_external2.string().optional().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
45220
+ description: exports_external2.string().optional().describe("标签描述"),
45221
+ newName: exports_external2.string().optional().describe("新标签名称")
45029
45222
  }
45030
45223
  })
45031
45224
  }
@@ -45058,8 +45251,8 @@ app.route({
45058
45251
  title: "删除仓库标签",
45059
45252
  summary: "删除指定的仓库标签",
45060
45253
  args: {
45061
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
45062
- name: tool.schema.string().describe("标签名称")
45254
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
45255
+ name: exports_external2.string().describe("标签名称")
45063
45256
  }
45064
45257
  })
45065
45258
  }
@@ -45214,8 +45407,8 @@ app.route({
45214
45407
  tags: [],
45215
45408
  ...{
45216
45409
  args: {
45217
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
45218
- pipelineId: tool.schema.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
45410
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
45411
+ pipelineId: exports_external2.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
45219
45412
  }
45220
45413
  }
45221
45414
  }
@@ -45254,8 +45447,8 @@ app.route({
45254
45447
  tags: [],
45255
45448
  ...{
45256
45449
  args: {
45257
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
45258
- pipelineId: tool.schema.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
45450
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
45451
+ pipelineId: exports_external2.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
45259
45452
  }
45260
45453
  }
45261
45454
  }
@@ -45306,11 +45499,11 @@ app.route({
45306
45499
  title: "云端构建",
45307
45500
  summary: "在云端构建代码仓库,参数包括 event, repo, branch, ref, config, env",
45308
45501
  args: {
45309
- env: tool.schema.any().optional().describe('构建环境变量,格式为 { "KEY": "VALUE" }'),
45310
- event: tool.schema.string().optional().describe("触发事件类型,例如 api_trigger_event"),
45311
- branch: tool.schema.string().optional().describe("分支名称,默认主分支"),
45312
- config: tool.schema.string().describe("构建config文件内容,例如 cloudbuild.yaml对应的yml的内容"),
45313
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo")
45502
+ env: exports_external2.any().optional().describe('构建环境变量,格式为 { "KEY": "VALUE" }'),
45503
+ event: exports_external2.string().optional().describe("触发事件类型,例如 api_trigger_event"),
45504
+ branch: exports_external2.string().optional().describe("分支名称,默认主分支"),
45505
+ config: exports_external2.string().describe("构建config文件内容,例如 cloudbuild.yaml对应的yml的内容"),
45506
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo")
45314
45507
  }
45315
45508
  })
45316
45509
  }
@@ -45372,7 +45565,12 @@ app.route({
45372
45565
  const branch = item.branch || "main";
45373
45566
  const repo3 = item.slug;
45374
45567
  const sn = item.sn;
45375
- await cnb.workspace.stopWorkspace({ sn });
45568
+ const res2 = await cnb.workspace.stopWorkspace({ sn });
45569
+ if (res2.code !== 200) {
45570
+ ctx.throw(500, res2.message || "Failed to stop workspace");
45571
+ } else {
45572
+ console.log(`工作区 ${repo3} 停止成功,${res2.data?.buildLogUrl ? `构建日志链接: ${res2.data.buildLogUrl}` : ""}`);
45573
+ }
45376
45574
  if (config3) {
45377
45575
  await cnb.build.startBuild(repo3, { branch, config: config3, event });
45378
45576
  } else {
@@ -45397,9 +45595,9 @@ app.route({
45397
45595
  title: "启动cnb工作空间",
45398
45596
  summary: "启动cnb工作空间",
45399
45597
  args: {
45400
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
45401
- branch: tool.schema.string().optional().describe("分支名称,默认主分支"),
45402
- ref: tool.schema.string().optional().describe("提交引用,例如 commit sha")
45598
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
45599
+ branch: exports_external2.string().optional().describe("分支名称,默认主分支"),
45600
+ ref: exports_external2.string().optional().describe("提交引用,例如 commit sha")
45403
45601
  }
45404
45602
  })
45405
45603
  }
@@ -45429,11 +45627,11 @@ app.route({
45429
45627
  title: "列出cnb工作空间",
45430
45628
  summary: "列出cnb工作空间列表,支持按状态过滤, status 可选值 running 或 closed",
45431
45629
  args: {
45432
- status: tool.schema.string().optional().describe("开发环境状态,running: 运行中,closed: 已关闭和停止的"),
45433
- page: tool.schema.number().optional().describe("分页页码,默认 1"),
45434
- pageSize: tool.schema.number().optional().describe("分页大小,默认 20,最大 100"),
45435
- slug: tool.schema.string().optional().describe("仓库路径,例如 groupname/reponame"),
45436
- branch: tool.schema.string().optional().describe("分支名称")
45630
+ status: exports_external2.string().optional().describe("开发环境状态,running: 运行中,closed: 已关闭和停止的"),
45631
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
45632
+ pageSize: exports_external2.number().optional().describe("分页大小,默认 20,最大 100"),
45633
+ slug: exports_external2.string().optional().describe("仓库路径,例如 groupname/reponame"),
45634
+ branch: exports_external2.string().optional().describe("分支名称")
45437
45635
  }
45438
45636
  })
45439
45637
  }
@@ -45459,8 +45657,8 @@ app.route({
45459
45657
  title: "获取工作空间详情",
45460
45658
  summary: "获取工作空间详细信息",
45461
45659
  args: {
45462
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
45463
- sn: tool.schema.string().describe("工作空间流水线的 sn")
45660
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
45661
+ sn: exports_external2.string().describe("工作空间流水线的 sn")
45464
45662
  }
45465
45663
  })
45466
45664
  }
@@ -45489,9 +45687,9 @@ app.route({
45489
45687
  title: "删除工作空间",
45490
45688
  summary: "删除工作空间,pipelineId 和 sn 二选一",
45491
45689
  args: {
45492
- pipelineId: tool.schema.string().optional().describe("流水线 ID,优先使用"),
45493
- sn: tool.schema.string().optional().describe("流水线构建号"),
45494
- sns: tool.schema.array(zod_default.string()).optional().describe("批量流水线构建号")
45690
+ pipelineId: exports_external2.string().optional().describe("流水线 ID,优先使用"),
45691
+ sn: exports_external2.string().optional().describe("流水线构建号"),
45692
+ sns: exports_external2.array(exports_external2.string()).optional().describe("批量流水线构建号")
45495
45693
  }
45496
45694
  })
45497
45695
  }
@@ -45527,8 +45725,8 @@ app.route({
45527
45725
  title: "停止工作空间",
45528
45726
  summary: "停止运行中的工作空间",
45529
45727
  args: {
45530
- pipelineId: tool.schema.string().optional().describe("流水线 ID,优先使用"),
45531
- sn: tool.schema.string().optional().describe("流水线构建号")
45728
+ pipelineId: exports_external2.string().optional().describe("流水线 ID,优先使用"),
45729
+ sn: exports_external2.string().optional().describe("流水线构建号")
45532
45730
  }
45533
45731
  })
45534
45732
  }
@@ -45556,9 +45754,9 @@ app.route({
45556
45754
  title: "调用app应用",
45557
45755
  summary: "调用router的应用, 参数path, key, payload",
45558
45756
  args: {
45559
- path: tool.schema.string().describe("应用路径,例如 cnb"),
45560
- key: tool.schema.string().optional().describe("应用key,例如 list-repos"),
45561
- payload: tool.schema.object({}).optional().describe("调用参数")
45757
+ path: exports_external2.string().describe("应用路径,例如 cnb"),
45758
+ key: exports_external2.string().optional().describe("应用key,例如 list-repos"),
45759
+ payload: exports_external2.object({}).optional().describe("调用参数")
45562
45760
  }
45563
45761
  })
45564
45762
  }
@@ -45605,7 +45803,7 @@ app.route({
45605
45803
  title: "获取当前cnb工作空间的port代理uri",
45606
45804
  summary: "获取当前cnb工作空间的port代理uri,用于端口转发",
45607
45805
  args: {
45608
- port: tool.schema.number().optional().describe("端口号,默认为51515")
45806
+ port: exports_external2.number().optional().describe("端口号,默认为51515")
45609
45807
  }
45610
45808
  })
45611
45809
  }
@@ -45632,11 +45830,11 @@ app.route({
45632
45830
  title: "获取当前cnb工作空间的编辑器访问地址",
45633
45831
  summary: "获取当前cnb工作空间的vscode代理uri,用于在浏览器中访问vscode,包含多种访问方式,如web、vscode、codebuddy、cursor、ssh",
45634
45832
  args: {
45635
- web: tool.schema.boolean().optional().describe("是否获取vscode web的访问uri,默认为false"),
45636
- vscode: tool.schema.boolean().optional().describe("是否获取vscode的代理uri,默认为true"),
45637
- codebuddy: tool.schema.boolean().optional().describe("是否获取codebuddy的代理uri,默认为false"),
45638
- cursor: tool.schema.boolean().optional().describe("是否获取cursor的代理uri,默认为false"),
45639
- ssh: tool.schema.boolean().optional().describe("是否获取vscode remote ssh的连接字符串,默认为false")
45833
+ web: exports_external2.boolean().optional().describe("是否获取vscode web的访问uri,默认为false"),
45834
+ vscode: exports_external2.boolean().optional().describe("是否获取vscode的代理uri,默认为true"),
45835
+ codebuddy: exports_external2.boolean().optional().describe("是否获取codebuddy的代理uri,默认为false"),
45836
+ cursor: exports_external2.boolean().optional().describe("是否获取cursor的代理uri,默认为false"),
45837
+ ssh: exports_external2.boolean().optional().describe("是否获取vscode remote ssh的连接字符串,默认为false")
45640
45838
  }
45641
45839
  })
45642
45840
  }
@@ -45695,7 +45893,7 @@ app.route({
45695
45893
  title: "设置当前cnb工作空间的cookie环境变量",
45696
45894
  summary: "设置当前cnb工作空间的cookie环境变量,用于界面操作定制模块功能,例子:CNBSESSION=xxxx;csrfkey=2222xxxx;",
45697
45895
  args: {
45698
- cookie: tool.schema.string().describe("cnb的cookie值")
45896
+ cookie: exports_external2.string().describe("cnb的cookie值")
45699
45897
  }
45700
45898
  })
45701
45899
  }
@@ -46032,8 +46230,8 @@ app.route({
46032
46230
  title: "调用cnb的知识库ai对话功能进行聊天",
46033
46231
  summary: "调用cnb的知识库ai对话功能进行聊天,基于cnb提供的ai能力",
46034
46232
  args: {
46035
- question: tool.schema.string().describe("用户输入的消息内容"),
46036
- repo: tool.schema.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
46233
+ question: exports_external2.string().describe("用户输入的消息内容"),
46234
+ repo: exports_external2.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
46037
46235
  }
46038
46236
  })
46039
46237
  }
@@ -46135,8 +46333,8 @@ app.route({
46135
46333
  title: "调用cnb的知识库RAG查询功能进行问答",
46136
46334
  summary: "调用cnb的知识库RAG查询功能进行问答,基于cnb提供的知识库能力",
46137
46335
  args: {
46138
- question: tool.schema.string().describe("用户输入的消息内容"),
46139
- repo: tool.schema.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
46336
+ question: exports_external2.string().describe("用户输入的消息内容"),
46337
+ repo: exports_external2.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
46140
46338
  }
46141
46339
  })
46142
46340
  }
@@ -46198,13 +46396,13 @@ app.route({
46198
46396
  skill: "list-issues",
46199
46397
  title: "查询 Issue 列表",
46200
46398
  args: {
46201
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46202
- state: tool.schema.string().optional().describe("Issue 状态:open 或 closed"),
46203
- keyword: tool.schema.string().optional().describe("问题搜索关键词"),
46204
- labels: tool.schema.string().optional().describe("问题标签,多个用逗号分隔"),
46205
- page: tool.schema.number().optional().describe("分页页码,默认: 1"),
46206
- page_size: tool.schema.number().optional().describe("分页每页大小,默认: 30"),
46207
- order_by: tool.schema.string().optional().describe("排序方式,如 created_at, -updated_at")
46399
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46400
+ state: exports_external2.string().optional().describe("Issue 状态:open 或 closed"),
46401
+ keyword: exports_external2.string().optional().describe("问题搜索关键词"),
46402
+ labels: exports_external2.string().optional().describe("问题标签,多个用逗号分隔"),
46403
+ page: exports_external2.number().optional().describe("分页页码,默认: 1"),
46404
+ page_size: exports_external2.number().optional().describe("分页每页大小,默认: 30"),
46405
+ order_by: exports_external2.string().optional().describe("排序方式,如 created_at, -updated_at")
46208
46406
  },
46209
46407
  summary: "查询 Issue 列表"
46210
46408
  })
@@ -46248,8 +46446,8 @@ app.route({
46248
46446
  skill: "getIssue",
46249
46447
  title: "获取 单个 Issue",
46250
46448
  args: {
46251
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46252
- issueNumber: tool.schema.union([tool.schema.string(), tool.schema.number()]).describe("Issue 编号")
46449
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46450
+ issueNumber: exports_external2.union([exports_external2.string(), exports_external2.number()]).describe("Issue 编号")
46253
46451
  },
46254
46452
  summary: "获取 单个 Issue"
46255
46453
  })
@@ -46280,12 +46478,12 @@ app.route({
46280
46478
  skill: "create-issue",
46281
46479
  title: "创建 Issue",
46282
46480
  args: {
46283
- repo: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
46284
- title: tool.schema.string().describe("Issue 标题"),
46285
- body: tool.schema.string().optional().describe("Issue 描述内容"),
46286
- assignees: tool.schema.array(tool.schema.string()).optional().describe("指派人列表"),
46287
- labels: tool.schema.array(tool.schema.string()).optional().describe("标签列表"),
46288
- priority: tool.schema.string().optional().describe("优先级")
46481
+ repo: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
46482
+ title: exports_external2.string().describe("Issue 标题"),
46483
+ body: exports_external2.string().optional().describe("Issue 描述内容"),
46484
+ assignees: exports_external2.array(exports_external2.string()).optional().describe("指派人列表"),
46485
+ labels: exports_external2.array(exports_external2.string()).optional().describe("标签列表"),
46486
+ priority: exports_external2.string().optional().describe("优先级")
46289
46487
  },
46290
46488
  summary: "创建一个新的 Issue"
46291
46489
  })
@@ -46321,9 +46519,9 @@ app.route({
46321
46519
  skill: "complete-issue",
46322
46520
  title: "完成 CNB的任务Issue",
46323
46521
  args: {
46324
- repo: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
46325
- issueNumber: tool.schema.union([tool.schema.string(), tool.schema.number()]).describe("Issue 编号"),
46326
- state: tool.schema.string().optional().describe("Issue 状态,默认为 closed")
46522
+ repo: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
46523
+ issueNumber: exports_external2.union([exports_external2.string(), exports_external2.number()]).describe("Issue 编号"),
46524
+ state: exports_external2.string().optional().describe("Issue 状态,默认为 closed")
46327
46525
  },
46328
46526
  summary: "完成一个 Issue(将 state 改为 closed)"
46329
46527
  })
@@ -46356,10 +46554,10 @@ app.route({
46356
46554
  skill: "list-issue-comments",
46357
46555
  title: "查询 Issue 评论列表",
46358
46556
  args: {
46359
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46360
- issueNumber: tool.schema.number().describe("Issue 编号"),
46361
- page: tool.schema.number().optional().describe("分页页码,默认: 1"),
46362
- page_size: tool.schema.number().optional().describe("分页每页大小,默认: 30")
46557
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46558
+ issueNumber: exports_external2.number().describe("Issue 编号"),
46559
+ page: exports_external2.number().optional().describe("分页页码,默认: 1"),
46560
+ page_size: exports_external2.number().optional().describe("分页每页大小,默认: 30")
46363
46561
  },
46364
46562
  summary: "查询 Issue 评论列表"
46365
46563
  })
@@ -46395,10 +46593,10 @@ app.route({
46395
46593
  skill: "create-issue-comment",
46396
46594
  title: "创建 Issue 评论",
46397
46595
  args: {
46398
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46399
- issueNumber: tool.schema.number().describe("Issue 编号"),
46400
- body: tool.schema.string().describe("评论内容"),
46401
- clearAt: tool.schema.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
46596
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46597
+ issueNumber: exports_external2.number().describe("Issue 编号"),
46598
+ body: exports_external2.string().describe("评论内容"),
46599
+ clearAt: exports_external2.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
46402
46600
  },
46403
46601
  summary: "创建 Issue 评论"
46404
46602
  })
@@ -46435,9 +46633,9 @@ app.route({
46435
46633
  skill: "get-issue-comment",
46436
46634
  title: "获取 Issue 评论",
46437
46635
  args: {
46438
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46439
- issueNumber: tool.schema.number().describe("Issue 编号"),
46440
- commentId: tool.schema.number().describe("评论 ID")
46636
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46637
+ issueNumber: exports_external2.number().describe("Issue 编号"),
46638
+ commentId: exports_external2.number().describe("评论 ID")
46441
46639
  },
46442
46640
  summary: "获取 Issue 评论"
46443
46641
  })
@@ -46470,11 +46668,11 @@ app.route({
46470
46668
  skill: "update-issue-comment",
46471
46669
  title: "修改 Issue 评论",
46472
46670
  args: {
46473
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46474
- issueNumber: tool.schema.number().describe("Issue 编号"),
46475
- commentId: tool.schema.number().describe("评论 ID"),
46476
- body: tool.schema.string().describe("评论内容"),
46477
- clearAt: tool.schema.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
46671
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46672
+ issueNumber: exports_external2.number().describe("Issue 编号"),
46673
+ commentId: exports_external2.number().describe("评论 ID"),
46674
+ body: exports_external2.string().describe("评论内容"),
46675
+ clearAt: exports_external2.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
46478
46676
  },
46479
46677
  summary: "修改 Issue 评论"
46480
46678
  })
@@ -47390,7 +47588,7 @@ app.route({
47390
47588
  };
47391
47589
  }).addTo(app);
47392
47590
 
47393
- // ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.66_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
47591
+ // ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.77_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
47394
47592
  var import_oidc = __toESM(require_dist(), 1);
47395
47593
  var import_oidc2 = __toESM(require_dist(), 1);
47396
47594
  var marker17 = "vercel.ai.gateway.error";
@@ -48456,7 +48654,7 @@ async function getVercelRequestId() {
48456
48654
  var _a92;
48457
48655
  return (_a92 = import_oidc.getContext().headers) == null ? undefined : _a92["x-vercel-id"];
48458
48656
  }
48459
- var VERSION3 = "3.0.66";
48657
+ var VERSION3 = "3.0.77";
48460
48658
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
48461
48659
  function createGatewayProvider(options = {}) {
48462
48660
  var _a92, _b92;
@@ -48612,7 +48810,7 @@ async function getGatewayAuthToken(options) {
48612
48810
  };
48613
48811
  }
48614
48812
 
48615
- // ../../node_modules/.pnpm/ai@6.0.116_zod@4.3.6/node_modules/ai/dist/index.mjs
48813
+ // ../../node_modules/.pnpm/ai@6.0.134_zod@4.3.6/node_modules/ai/dist/index.mjs
48616
48814
  var import_api = __toESM(require_src(), 1);
48617
48815
  var import_api2 = __toESM(require_src(), 1);
48618
48816
  var __defProp4 = Object.defineProperty;
@@ -49183,7 +49381,7 @@ function detectMediaType({
49183
49381
  }
49184
49382
  return;
49185
49383
  }
49186
- var VERSION4 = "6.0.116";
49384
+ var VERSION4 = "6.0.134";
49187
49385
  var download = async ({
49188
49386
  url: url4,
49189
49387
  maxBytes,
@@ -49197,6 +49395,9 @@ var download = async ({
49197
49395
  headers: withUserAgentSuffix({}, `ai-sdk/${VERSION4}`, getRuntimeEnvironmentUserAgent()),
49198
49396
  signal: abortSignal
49199
49397
  });
49398
+ if (response.redirected) {
49399
+ validateDownloadUrl(response.url);
49400
+ }
49200
49401
  if (!response.ok) {
49201
49402
  throw new DownloadError({
49202
49403
  url: urlText,
@@ -49600,7 +49801,7 @@ async function createToolModelOutput({
49600
49801
  toolCallId,
49601
49802
  input,
49602
49803
  output,
49603
- tool: tool22,
49804
+ tool: tool2,
49604
49805
  errorMode
49605
49806
  }) {
49606
49807
  if (errorMode === "text") {
@@ -49608,8 +49809,8 @@ async function createToolModelOutput({
49608
49809
  } else if (errorMode === "json") {
49609
49810
  return { type: "error-json", value: toJSONValue(output) };
49610
49811
  }
49611
- if (tool22 == null ? undefined : tool22.toModelOutput) {
49612
- return await tool22.toModelOutput({ toolCallId, input, output });
49812
+ if (tool2 == null ? undefined : tool2.toModelOutput) {
49813
+ return await tool2.toModelOutput({ toolCallId, input, output });
49613
49814
  }
49614
49815
  return typeof output === "string" ? { type: "text", value: output } : { type: "json", value: toJSONValue(output) };
49615
49816
  }
@@ -49723,8 +49924,8 @@ async function prepareToolsAndToolChoice({
49723
49924
  }
49724
49925
  const filteredTools = activeTools != null ? Object.entries(tools).filter(([name21]) => activeTools.includes(name21)) : Object.entries(tools);
49725
49926
  const languageModelTools = [];
49726
- for (const [name21, tool22] of filteredTools) {
49727
- const toolType = tool22.type;
49927
+ for (const [name21, tool2] of filteredTools) {
49928
+ const toolType = tool2.type;
49728
49929
  switch (toolType) {
49729
49930
  case undefined:
49730
49931
  case "dynamic":
@@ -49732,19 +49933,19 @@ async function prepareToolsAndToolChoice({
49732
49933
  languageModelTools.push({
49733
49934
  type: "function",
49734
49935
  name: name21,
49735
- description: tool22.description,
49736
- inputSchema: await asSchema(tool22.inputSchema).jsonSchema,
49737
- ...tool22.inputExamples != null ? { inputExamples: tool22.inputExamples } : {},
49738
- providerOptions: tool22.providerOptions,
49739
- ...tool22.strict != null ? { strict: tool22.strict } : {}
49936
+ description: tool2.description,
49937
+ inputSchema: await asSchema(tool2.inputSchema).jsonSchema,
49938
+ ...tool2.inputExamples != null ? { inputExamples: tool2.inputExamples } : {},
49939
+ providerOptions: tool2.providerOptions,
49940
+ ...tool2.strict != null ? { strict: tool2.strict } : {}
49740
49941
  });
49741
49942
  break;
49742
49943
  case "provider":
49743
49944
  languageModelTools.push({
49744
49945
  type: "provider",
49745
49946
  name: name21,
49746
- id: tool22.id,
49747
- args: tool22.args
49947
+ id: tool2.id,
49948
+ args: tool2.args
49748
49949
  });
49749
49950
  break;
49750
49951
  default: {
@@ -50510,8 +50711,8 @@ async function executeToolCall({
50510
50711
  onToolCallFinish
50511
50712
  }) {
50512
50713
  const { toolName, toolCallId, input } = toolCall;
50513
- const tool22 = tools == null ? undefined : tools[toolName];
50514
- if ((tool22 == null ? undefined : tool22.execute) == null) {
50714
+ const tool2 = tools == null ? undefined : tools[toolName];
50715
+ if ((tool2 == null ? undefined : tool2.execute) == null) {
50515
50716
  return;
50516
50717
  }
50517
50718
  const baseCallbackEvent = {
@@ -50547,7 +50748,7 @@ async function executeToolCall({
50547
50748
  const startTime = now();
50548
50749
  try {
50549
50750
  const stream = executeTool({
50550
- execute: tool22.execute.bind(tool22),
50751
+ execute: tool2.execute.bind(tool2),
50551
50752
  input,
50552
50753
  options: {
50553
50754
  toolCallId,
@@ -50586,7 +50787,7 @@ async function executeToolCall({
50586
50787
  toolName,
50587
50788
  input,
50588
50789
  error: error49,
50589
- dynamic: tool22.type === "dynamic",
50790
+ dynamic: tool2.type === "dynamic",
50590
50791
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
50591
50792
  };
50592
50793
  }
@@ -50616,7 +50817,7 @@ async function executeToolCall({
50616
50817
  toolName,
50617
50818
  input,
50618
50819
  output,
50619
- dynamic: tool22.type === "dynamic",
50820
+ dynamic: tool2.type === "dynamic",
50620
50821
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
50621
50822
  };
50622
50823
  }
@@ -50658,18 +50859,18 @@ var DefaultGeneratedFile = class {
50658
50859
  }
50659
50860
  };
50660
50861
  async function isApprovalNeeded({
50661
- tool: tool22,
50862
+ tool: tool2,
50662
50863
  toolCall,
50663
50864
  messages,
50664
50865
  experimental_context
50665
50866
  }) {
50666
- if (tool22.needsApproval == null) {
50867
+ if (tool2.needsApproval == null) {
50667
50868
  return false;
50668
50869
  }
50669
- if (typeof tool22.needsApproval === "boolean") {
50670
- return tool22.needsApproval;
50870
+ if (typeof tool2.needsApproval === "boolean") {
50871
+ return tool2.needsApproval;
50671
50872
  }
50672
- return await tool22.needsApproval(toolCall.input, {
50873
+ return await tool2.needsApproval(toolCall.input, {
50673
50874
  toolCallId: toolCall.toolCallId,
50674
50875
  messages,
50675
50876
  experimental_context
@@ -51404,8 +51605,8 @@ async function doParseToolCall({
51404
51605
  tools
51405
51606
  }) {
51406
51607
  const toolName = toolCall.toolName;
51407
- const tool22 = tools[toolName];
51408
- if (tool22 == null) {
51608
+ const tool2 = tools[toolName];
51609
+ if (tool2 == null) {
51409
51610
  if (toolCall.providerExecuted && toolCall.dynamic) {
51410
51611
  return await parseProviderExecutedDynamicToolCall(toolCall);
51411
51612
  }
@@ -51414,7 +51615,7 @@ async function doParseToolCall({
51414
51615
  availableTools: Object.keys(tools)
51415
51616
  });
51416
51617
  }
51417
- const schema = asSchema(tool22.inputSchema);
51618
+ const schema = asSchema(tool2.inputSchema);
51418
51619
  const parseResult = toolCall.input.trim() === "" ? await safeValidateTypes({ value: {}, schema }) : await safeParseJSON({ text: toolCall.input, schema });
51419
51620
  if (parseResult.success === false) {
51420
51621
  throw new InvalidToolInputError({
@@ -51423,7 +51624,7 @@ async function doParseToolCall({
51423
51624
  cause: parseResult.error
51424
51625
  });
51425
51626
  }
51426
- return tool22.type === "dynamic" ? {
51627
+ return tool2.type === "dynamic" ? {
51427
51628
  type: "tool-call",
51428
51629
  toolCallId: toolCall.toolCallId,
51429
51630
  toolName: toolCall.toolName,
@@ -51431,7 +51632,7 @@ async function doParseToolCall({
51431
51632
  providerExecuted: toolCall.providerExecuted,
51432
51633
  providerMetadata: toolCall.providerMetadata,
51433
51634
  dynamic: true,
51434
- title: tool22.title
51635
+ title: tool2.title
51435
51636
  } : {
51436
51637
  type: "tool-call",
51437
51638
  toolCallId: toolCall.toolCallId,
@@ -51439,7 +51640,7 @@ async function doParseToolCall({
51439
51640
  input: parseResult.value,
51440
51641
  providerExecuted: toolCall.providerExecuted,
51441
51642
  providerMetadata: toolCall.providerMetadata,
51442
- title: tool22.title
51643
+ title: tool2.title
51443
51644
  };
51444
51645
  }
51445
51646
  var DefaultStepResult = class {
@@ -51779,7 +51980,7 @@ async function generateText({
51779
51980
  }),
51780
51981
  tracer,
51781
51982
  fn: async (span) => {
51782
- var _a21, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
51983
+ var _a21, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
51783
51984
  const initialMessages = initialPrompt.messages;
51784
51985
  const responseMessages = [];
51785
51986
  const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
@@ -51943,7 +52144,7 @@ async function generateText({
51943
52144
  input: () => stringifyForTelemetry(promptMessages)
51944
52145
  },
51945
52146
  "ai.prompt.tools": {
51946
- input: () => stepTools == null ? undefined : stepTools.map((tool22) => JSON.stringify(tool22))
52147
+ input: () => stepTools == null ? undefined : stepTools.map((tool2) => JSON.stringify(tool2))
51947
52148
  },
51948
52149
  "ai.prompt.toolChoice": {
51949
52150
  input: () => stepToolChoice != null ? JSON.stringify(stepToolChoice) : undefined
@@ -51979,6 +52180,7 @@ async function generateText({
51979
52180
  headers: (_g2 = result.response) == null ? undefined : _g2.headers,
51980
52181
  body: (_h2 = result.response) == null ? undefined : _h2.body
51981
52182
  };
52183
+ const usage = asLanguageModelUsage(result.usage);
51982
52184
  span2.setAttributes(await selectTelemetryAttributes({
51983
52185
  telemetry,
51984
52186
  attributes: {
@@ -51999,8 +52201,16 @@ async function generateText({
51999
52201
  "ai.response.model": responseData.modelId,
52000
52202
  "ai.response.timestamp": responseData.timestamp.toISOString(),
52001
52203
  "ai.response.providerMetadata": JSON.stringify(result.providerMetadata),
52002
- "ai.usage.promptTokens": result.usage.inputTokens.total,
52003
- "ai.usage.completionTokens": result.usage.outputTokens.total,
52204
+ "ai.usage.inputTokens": result.usage.inputTokens.total,
52205
+ "ai.usage.inputTokenDetails.noCacheTokens": result.usage.inputTokens.noCache,
52206
+ "ai.usage.inputTokenDetails.cacheReadTokens": result.usage.inputTokens.cacheRead,
52207
+ "ai.usage.inputTokenDetails.cacheWriteTokens": result.usage.inputTokens.cacheWrite,
52208
+ "ai.usage.outputTokens": result.usage.outputTokens.total,
52209
+ "ai.usage.outputTokenDetails.textTokens": result.usage.outputTokens.text,
52210
+ "ai.usage.outputTokenDetails.reasoningTokens": result.usage.outputTokens.reasoning,
52211
+ "ai.usage.totalTokens": usage.totalTokens,
52212
+ "ai.usage.reasoningTokens": result.usage.outputTokens.reasoning,
52213
+ "ai.usage.cachedInputTokens": result.usage.inputTokens.cacheRead,
52004
52214
  "gen_ai.response.finish_reasons": [
52005
52215
  result.finishReason.unified
52006
52216
  ],
@@ -52026,12 +52236,12 @@ async function generateText({
52026
52236
  if (toolCall.invalid) {
52027
52237
  continue;
52028
52238
  }
52029
- const tool22 = tools == null ? undefined : tools[toolCall.toolName];
52030
- if (tool22 == null) {
52239
+ const tool2 = tools == null ? undefined : tools[toolCall.toolName];
52240
+ if (tool2 == null) {
52031
52241
  continue;
52032
52242
  }
52033
- if ((tool22 == null ? undefined : tool22.onInputAvailable) != null) {
52034
- await tool22.onInputAvailable({
52243
+ if ((tool2 == null ? undefined : tool2.onInputAvailable) != null) {
52244
+ await tool2.onInputAvailable({
52035
52245
  input: toolCall.input,
52036
52246
  toolCallId: toolCall.toolCallId,
52037
52247
  messages: stepInputMessages,
@@ -52040,7 +52250,7 @@ async function generateText({
52040
52250
  });
52041
52251
  }
52042
52252
  if (await isApprovalNeeded({
52043
- tool: tool22,
52253
+ tool: tool2,
52044
52254
  toolCall,
52045
52255
  messages: stepInputMessages,
52046
52256
  experimental_context
@@ -52089,8 +52299,8 @@ async function generateText({
52089
52299
  for (const toolCall of stepToolCalls) {
52090
52300
  if (!toolCall.providerExecuted)
52091
52301
  continue;
52092
- const tool22 = tools == null ? undefined : tools[toolCall.toolName];
52093
- if ((tool22 == null ? undefined : tool22.type) === "provider" && tool22.supportsDeferredResults) {
52302
+ const tool2 = tools == null ? undefined : tools[toolCall.toolName];
52303
+ if ((tool2 == null ? undefined : tool2.type) === "provider" && tool2.supportsDeferredResults) {
52094
52304
  const hasResultInResponse = currentModelResponse.content.some((part) => part.type === "tool-result" && part.toolCallId === toolCall.toolCallId);
52095
52305
  if (!hasResultInResponse) {
52096
52306
  pendingDeferredToolCalls.set(toolCall.toolCallId, {
@@ -52169,9 +52379,7 @@ async function generateText({
52169
52379
  return toolCalls == null ? undefined : JSON.stringify(toolCalls);
52170
52380
  }
52171
52381
  },
52172
- "ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata),
52173
- "ai.usage.promptTokens": currentModelResponse.usage.inputTokens.total,
52174
- "ai.usage.completionTokens": currentModelResponse.usage.outputTokens.total
52382
+ "ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata)
52175
52383
  }
52176
52384
  }));
52177
52385
  const lastStep = steps[steps.length - 1];
@@ -52184,6 +52392,21 @@ async function generateText({
52184
52392
  reasoningTokens: undefined,
52185
52393
  cachedInputTokens: undefined
52186
52394
  });
52395
+ span.setAttributes(await selectTelemetryAttributes({
52396
+ telemetry,
52397
+ attributes: {
52398
+ "ai.usage.inputTokens": totalUsage.inputTokens,
52399
+ "ai.usage.inputTokenDetails.noCacheTokens": (_n = totalUsage.inputTokenDetails) == null ? undefined : _n.noCacheTokens,
52400
+ "ai.usage.inputTokenDetails.cacheReadTokens": (_o = totalUsage.inputTokenDetails) == null ? undefined : _o.cacheReadTokens,
52401
+ "ai.usage.inputTokenDetails.cacheWriteTokens": (_p = totalUsage.inputTokenDetails) == null ? undefined : _p.cacheWriteTokens,
52402
+ "ai.usage.outputTokens": totalUsage.outputTokens,
52403
+ "ai.usage.outputTokenDetails.textTokens": (_q = totalUsage.outputTokenDetails) == null ? undefined : _q.textTokens,
52404
+ "ai.usage.outputTokenDetails.reasoningTokens": (_r = totalUsage.outputTokenDetails) == null ? undefined : _r.reasoningTokens,
52405
+ "ai.usage.totalTokens": totalUsage.totalTokens,
52406
+ "ai.usage.reasoningTokens": (_s = totalUsage.outputTokenDetails) == null ? undefined : _s.reasoningTokens,
52407
+ "ai.usage.cachedInputTokens": (_t = totalUsage.inputTokenDetails) == null ? undefined : _t.cacheReadTokens
52408
+ }
52409
+ }));
52187
52410
  await notify({
52188
52411
  event: {
52189
52412
  stepNumber: lastStep.stepNumber,
@@ -52383,8 +52606,8 @@ function asContent({
52383
52606
  case "tool-result": {
52384
52607
  const toolCall = toolCalls.find((toolCall2) => toolCall2.toolCallId === part.toolCallId);
52385
52608
  if (toolCall == null) {
52386
- const tool22 = tools == null ? undefined : tools[part.toolName];
52387
- const supportsDeferredResults = (tool22 == null ? undefined : tool22.type) === "provider" && tool22.supportsDeferredResults;
52609
+ const tool2 = tools == null ? undefined : tools[part.toolName];
52610
+ const supportsDeferredResults = (tool2 == null ? undefined : tool2.type) === "provider" && tool2.supportsDeferredResults;
52388
52611
  if (!supportsDeferredResults) {
52389
52612
  throw new Error(`Tool call ${part.toolCallId} not found.`);
52390
52613
  }
@@ -52396,7 +52619,8 @@ function asContent({
52396
52619
  input: undefined,
52397
52620
  error: part.result,
52398
52621
  providerExecuted: true,
52399
- dynamic: part.dynamic
52622
+ dynamic: part.dynamic,
52623
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
52400
52624
  });
52401
52625
  } else {
52402
52626
  contentParts.push({
@@ -52406,7 +52630,8 @@ function asContent({
52406
52630
  input: undefined,
52407
52631
  output: part.result,
52408
52632
  providerExecuted: true,
52409
- dynamic: part.dynamic
52633
+ dynamic: part.dynamic,
52634
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
52410
52635
  });
52411
52636
  }
52412
52637
  break;
@@ -52419,7 +52644,8 @@ function asContent({
52419
52644
  input: toolCall.input,
52420
52645
  error: part.result,
52421
52646
  providerExecuted: true,
52422
- dynamic: toolCall.dynamic
52647
+ dynamic: toolCall.dynamic,
52648
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
52423
52649
  });
52424
52650
  } else {
52425
52651
  contentParts.push({
@@ -52429,7 +52655,8 @@ function asContent({
52429
52655
  input: toolCall.input,
52430
52656
  output: part.result,
52431
52657
  providerExecuted: true,
52432
- dynamic: toolCall.dynamic
52658
+ dynamic: toolCall.dynamic,
52659
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
52433
52660
  });
52434
52661
  }
52435
52662
  break;
@@ -52535,6 +52762,7 @@ var uiMessageChunkSchema = lazySchema(() => zodSchema(exports_external2.union([
52535
52762
  toolCallId: exports_external2.string(),
52536
52763
  output: exports_external2.unknown(),
52537
52764
  providerExecuted: exports_external2.boolean().optional(),
52765
+ providerMetadata: providerMetadataSchema.optional(),
52538
52766
  dynamic: exports_external2.boolean().optional(),
52539
52767
  preliminary: exports_external2.boolean().optional()
52540
52768
  }),
@@ -52543,6 +52771,7 @@ var uiMessageChunkSchema = lazySchema(() => zodSchema(exports_external2.union([
52543
52771
  toolCallId: exports_external2.string(),
52544
52772
  errorText: exports_external2.string(),
52545
52773
  providerExecuted: exports_external2.boolean().optional(),
52774
+ providerMetadata: providerMetadataSchema.optional(),
52546
52775
  dynamic: exports_external2.boolean().optional()
52547
52776
  }),
52548
52777
  exports_external2.strictObject({
@@ -52741,6 +52970,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
52741
52970
  output: exports_external2.unknown(),
52742
52971
  errorText: exports_external2.never().optional(),
52743
52972
  callProviderMetadata: providerMetadataSchema.optional(),
52973
+ resultProviderMetadata: providerMetadataSchema.optional(),
52744
52974
  preliminary: exports_external2.boolean().optional(),
52745
52975
  approval: exports_external2.object({
52746
52976
  id: exports_external2.string(),
@@ -52759,6 +52989,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
52759
52989
  output: exports_external2.never().optional(),
52760
52990
  errorText: exports_external2.string(),
52761
52991
  callProviderMetadata: providerMetadataSchema.optional(),
52992
+ resultProviderMetadata: providerMetadataSchema.optional(),
52762
52993
  approval: exports_external2.object({
52763
52994
  id: exports_external2.string(),
52764
52995
  approved: exports_external2.literal(true),
@@ -52842,6 +53073,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
52842
53073
  output: exports_external2.unknown(),
52843
53074
  errorText: exports_external2.never().optional(),
52844
53075
  callProviderMetadata: providerMetadataSchema.optional(),
53076
+ resultProviderMetadata: providerMetadataSchema.optional(),
52845
53077
  preliminary: exports_external2.boolean().optional(),
52846
53078
  approval: exports_external2.object({
52847
53079
  id: exports_external2.string(),
@@ -52859,6 +53091,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
52859
53091
  output: exports_external2.never().optional(),
52860
53092
  errorText: exports_external2.string(),
52861
53093
  callProviderMetadata: providerMetadataSchema.optional(),
53094
+ resultProviderMetadata: providerMetadataSchema.optional(),
52862
53095
  approval: exports_external2.object({
52863
53096
  id: exports_external2.string(),
52864
53097
  approved: exports_external2.literal(true),
@@ -53245,7 +53478,7 @@ var createTool = async (app2, message) => {
53245
53478
  console.error(`未找到路径 ${message.path} 和 key ${message.key} 的路由`);
53246
53479
  return null;
53247
53480
  }
53248
- const _tool = tool2({
53481
+ const _tool = tool({
53249
53482
  description: route?.metadata?.summary || route?.description || "无描述",
53250
53483
  inputSchema: zod_default.object({
53251
53484
  ...route.metadata?.args
@@ -53391,10 +53624,10 @@ app.route({
53391
53624
  title: "查询 Issue 标签列表",
53392
53625
  summary: "查询 Issue 的标签列表",
53393
53626
  args: {
53394
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53395
- issueNumber: tool.schema.number().describe("Issue 编号"),
53396
- page: tool.schema.number().optional().describe("分页页码,默认 1"),
53397
- pageSize: tool.schema.number().optional().describe("分页每页大小,默认 30")
53627
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53628
+ issueNumber: exports_external2.number().describe("Issue 编号"),
53629
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
53630
+ pageSize: exports_external2.number().optional().describe("分页每页大小,默认 30")
53398
53631
  }
53399
53632
  })
53400
53633
  }
@@ -53428,9 +53661,9 @@ app.route({
53428
53661
  title: "设置 Issue 标签",
53429
53662
  summary: "设置 Issue 标签(完全替换现有标签)",
53430
53663
  args: {
53431
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53432
- issueNumber: tool.schema.number().describe("Issue 编号"),
53433
- labels: tool.schema.array(tool.schema.string()).describe("标签名称数组")
53664
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53665
+ issueNumber: exports_external2.number().describe("Issue 编号"),
53666
+ labels: exports_external2.array(exports_external2.string()).describe("标签名称数组")
53434
53667
  }
53435
53668
  })
53436
53669
  }
@@ -53463,9 +53696,9 @@ app.route({
53463
53696
  title: "新增 Issue 标签",
53464
53697
  summary: "新增 Issue 标签(追加到现有标签)",
53465
53698
  args: {
53466
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53467
- issueNumber: tool.schema.number().describe("Issue 编号"),
53468
- labels: tool.schema.array(tool.schema.string()).describe("标签名称数组")
53699
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53700
+ issueNumber: exports_external2.number().describe("Issue 编号"),
53701
+ labels: exports_external2.array(exports_external2.string()).describe("标签名称数组")
53469
53702
  }
53470
53703
  })
53471
53704
  }
@@ -53498,8 +53731,8 @@ app.route({
53498
53731
  title: "清空 Issue 标签",
53499
53732
  summary: "清空 Issue 标签(移除所有标签)",
53500
53733
  args: {
53501
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53502
- issueNumber: tool.schema.number().describe("Issue 编号")
53734
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53735
+ issueNumber: exports_external2.number().describe("Issue 编号")
53503
53736
  }
53504
53737
  })
53505
53738
  }
@@ -53528,9 +53761,9 @@ app.route({
53528
53761
  title: "删除 Issue 标签",
53529
53762
  summary: "删除 Issue 指定标签",
53530
53763
  args: {
53531
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53532
- issueNumber: tool.schema.number().describe("Issue 编号"),
53533
- name: tool.schema.string().describe("标签名称")
53764
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53765
+ issueNumber: exports_external2.number().describe("Issue 编号"),
53766
+ name: exports_external2.string().describe("标签名称")
53534
53767
  }
53535
53768
  })
53536
53769
  }
@@ -53552,6 +53785,330 @@ app.route({
53552
53785
  ctx.forward(res);
53553
53786
  }).addTo(app);
53554
53787
 
53788
+ // agent/routes/package/registry.ts
53789
+ app.route({
53790
+ path: "cnb",
53791
+ key: "list-group-registries",
53792
+ description: "查询组织下的制品库列表, 参数 slug",
53793
+ middleware: ["auth"],
53794
+ metadata: {
53795
+ tags: ["package"],
53796
+ ...createSkill({
53797
+ skill: "list-group-registries",
53798
+ title: "查询制品库列表",
53799
+ args: {
53800
+ slug: exports_external2.string().describe("组织 slug, 如 my-org"),
53801
+ page: exports_external2.number().describe("页码").optional(),
53802
+ page_size: exports_external2.number().describe("每页数量").optional(),
53803
+ registry_type: exports_external2.string().describe("制品仓库类型: npm, maven, ohpm").optional(),
53804
+ filter_type: exports_external2.string().describe("制品仓库可见性: private, public").optional(),
53805
+ order_by: exports_external2.string().describe("排序字段: created_at, name").optional()
53806
+ },
53807
+ summary: "查询组织下的制品库列表"
53808
+ })
53809
+ }
53810
+ }).define(async (ctx) => {
53811
+ const cnb = await cnbManager.getContext(ctx);
53812
+ const slug = ctx.query?.slug;
53813
+ const { page, page_size, registry_type, filter_type, order_by } = ctx.query || {};
53814
+ if (!slug) {
53815
+ ctx.throw(400, "缺少参数 slug");
53816
+ }
53817
+ const res = await cnb.packages.registry.listGroupRegistries(slug, {
53818
+ page,
53819
+ page_size,
53820
+ registry_type,
53821
+ filter_type,
53822
+ order_by
53823
+ });
53824
+ ctx.forward(res);
53825
+ }).addTo(app);
53826
+ app.route({
53827
+ path: "cnb",
53828
+ key: "set-registry-visibility",
53829
+ description: "设置制品库可见性, 参数 registry, visibility",
53830
+ middleware: ["auth"],
53831
+ metadata: {
53832
+ tags: ["package"],
53833
+ ...createSkill({
53834
+ skill: "set-registry-visibility",
53835
+ title: "设置制品库可见性",
53836
+ args: {
53837
+ registry: exports_external2.string().describe("制品库路径, 如 my-org/my-registry"),
53838
+ visibility: exports_external2.string().describe("可见性: private 或 public")
53839
+ },
53840
+ summary: "设置制品库的可见性"
53841
+ })
53842
+ }
53843
+ }).define(async (ctx) => {
53844
+ const cnb = await cnbManager.getContext(ctx);
53845
+ const registry4 = ctx.query?.registry;
53846
+ const visibility = ctx.query?.visibility;
53847
+ if (!registry4) {
53848
+ ctx.throw(400, "缺少参数 registry");
53849
+ }
53850
+ if (!visibility) {
53851
+ ctx.throw(400, "缺少参数 visibility");
53852
+ }
53853
+ const res = await cnb.packages.registry.setVisibility(registry4, { visibility });
53854
+ ctx.forward(res);
53855
+ }).addTo(app);
53856
+ app.route({
53857
+ path: "cnb",
53858
+ key: "delete-registry",
53859
+ description: "删除制品库, 参数 registry",
53860
+ middleware: ["auth"],
53861
+ metadata: {
53862
+ tags: ["package"],
53863
+ ...createSkill({
53864
+ skill: "delete-registry",
53865
+ title: "删除制品库",
53866
+ args: {
53867
+ registry: exports_external2.string().describe("制品库路径, 如 my-org/my-registry")
53868
+ },
53869
+ summary: "删除指定的制品库"
53870
+ })
53871
+ }
53872
+ }).define(async (ctx) => {
53873
+ const cnb = await cnbManager.getContext(ctx);
53874
+ const registry4 = ctx.query?.registry;
53875
+ if (!registry4) {
53876
+ ctx.throw(400, "缺少参数 registry");
53877
+ }
53878
+ const res = await cnb.packages.registry.remove(registry4);
53879
+ ctx.forward(res);
53880
+ }).addTo(app);
53881
+
53882
+ // agent/routes/package/package.ts
53883
+ app.route({
53884
+ path: "cnb",
53885
+ key: "list-packages",
53886
+ description: "查询制品列表, 参数 slug, type",
53887
+ middleware: ["auth"],
53888
+ metadata: {
53889
+ tags: ["package"],
53890
+ ...createSkill({
53891
+ skill: "list-packages",
53892
+ title: "查询制品列表",
53893
+ args: {
53894
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
53895
+ type: exports_external2.string().describe("制品类型: all, docker, helm, docker-model, maven, npm, ohpm, pypi, nuget, composer, conan, cargo"),
53896
+ ordering: exports_external2.string().describe("排序类型: pull_count, last_push_at, name_ascend, name_descend").optional(),
53897
+ name: exports_external2.string().describe("关键字,搜索制品名称").optional(),
53898
+ page: exports_external2.number().describe("页码").optional(),
53899
+ page_size: exports_external2.number().describe("每页数量").optional()
53900
+ },
53901
+ summary: "查询制品列表"
53902
+ })
53903
+ }
53904
+ }).define(async (ctx) => {
53905
+ const cnb = await cnbManager.getContext(ctx);
53906
+ const slug = ctx.query?.slug;
53907
+ const type = ctx.query?.type;
53908
+ const { ordering, name: name21, page, page_size } = ctx.query || {};
53909
+ if (!slug) {
53910
+ ctx.throw(400, "缺少参数 slug");
53911
+ }
53912
+ if (!type) {
53913
+ ctx.throw(400, "缺少参数 type");
53914
+ }
53915
+ const res = await cnb.packages.package.list(slug, type, {
53916
+ ordering,
53917
+ name: name21,
53918
+ page,
53919
+ page_size
53920
+ });
53921
+ ctx.forward(res);
53922
+ }).addTo(app);
53923
+ app.route({
53924
+ path: "cnb",
53925
+ key: "get-package",
53926
+ description: "获取制品详情, 参数 slug, type, name",
53927
+ middleware: ["auth"],
53928
+ metadata: {
53929
+ tags: ["package"],
53930
+ ...createSkill({
53931
+ skill: "get-package",
53932
+ title: "获取制品详情",
53933
+ args: {
53934
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
53935
+ type: exports_external2.string().describe("制品类型"),
53936
+ name: exports_external2.string().describe("制品名称")
53937
+ },
53938
+ summary: "获取指定制品的详细信息"
53939
+ })
53940
+ }
53941
+ }).define(async (ctx) => {
53942
+ const cnb = await cnbManager.getContext(ctx);
53943
+ const slug = ctx.query?.slug;
53944
+ const type = ctx.query?.type;
53945
+ const name21 = ctx.query?.name;
53946
+ if (!slug) {
53947
+ ctx.throw(400, "缺少参数 slug");
53948
+ }
53949
+ if (!type) {
53950
+ ctx.throw(400, "缺少参数 type");
53951
+ }
53952
+ if (!name21) {
53953
+ ctx.throw(400, "缺少参数 name");
53954
+ }
53955
+ const res = await cnb.packages.package.getOne(slug, type, name21);
53956
+ ctx.forward(res);
53957
+ }).addTo(app);
53958
+ app.route({
53959
+ path: "cnb",
53960
+ key: "delete-package",
53961
+ description: "删除制品, 参数 slug, type, name",
53962
+ middleware: ["auth"],
53963
+ metadata: {
53964
+ tags: ["package"],
53965
+ ...createSkill({
53966
+ skill: "delete-package",
53967
+ title: "删除制品",
53968
+ args: {
53969
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
53970
+ type: exports_external2.string().describe("制品类型"),
53971
+ name: exports_external2.string().describe("制品名称")
53972
+ },
53973
+ summary: "删除指定的制品"
53974
+ })
53975
+ }
53976
+ }).define(async (ctx) => {
53977
+ const cnb = await cnbManager.getContext(ctx);
53978
+ const slug = ctx.query?.slug;
53979
+ const type = ctx.query?.type;
53980
+ const name21 = ctx.query?.name;
53981
+ if (!slug) {
53982
+ ctx.throw(400, "缺少参数 slug");
53983
+ }
53984
+ if (!type) {
53985
+ ctx.throw(400, "缺少参数 type");
53986
+ }
53987
+ if (!name21) {
53988
+ ctx.throw(400, "缺少参数 name");
53989
+ }
53990
+ const res = await cnb.packages.package.remove(slug, type, name21);
53991
+ ctx.forward(res);
53992
+ }).addTo(app);
53993
+ app.route({
53994
+ path: "cnb",
53995
+ key: "list-package-tags",
53996
+ description: "获取制品标签列表, 参数 slug, type, name",
53997
+ middleware: ["auth"],
53998
+ metadata: {
53999
+ tags: ["package"],
54000
+ ...createSkill({
54001
+ skill: "list-package-tags",
54002
+ title: "获取制品标签列表",
54003
+ args: {
54004
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
54005
+ type: exports_external2.string().describe("制品类型"),
54006
+ name: exports_external2.string().describe("制品名称"),
54007
+ page: exports_external2.number().describe("页码").optional(),
54008
+ page_size: exports_external2.number().describe("每页数量").optional()
54009
+ },
54010
+ summary: "获取制品的标签列表"
54011
+ })
54012
+ }
54013
+ }).define(async (ctx) => {
54014
+ const cnb = await cnbManager.getContext(ctx);
54015
+ const slug = ctx.query?.slug;
54016
+ const type = ctx.query?.type;
54017
+ const name21 = ctx.query?.name;
54018
+ const { page, page_size } = ctx.query || {};
54019
+ if (!slug) {
54020
+ ctx.throw(400, "缺少参数 slug");
54021
+ }
54022
+ if (!type) {
54023
+ ctx.throw(400, "缺少参数 type");
54024
+ }
54025
+ if (!name21) {
54026
+ ctx.throw(400, "缺少参数 name");
54027
+ }
54028
+ const res = await cnb.packages.package.listTags(slug, type, name21, { page, page_size });
54029
+ ctx.forward(res);
54030
+ }).addTo(app);
54031
+ app.route({
54032
+ path: "cnb",
54033
+ key: "get-package-tag",
54034
+ description: "获取制品标签详情, 参数 slug, type, name, tag",
54035
+ middleware: ["auth"],
54036
+ metadata: {
54037
+ tags: ["package"],
54038
+ ...createSkill({
54039
+ skill: "get-package-tag",
54040
+ title: "获取制品标签详情",
54041
+ args: {
54042
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
54043
+ type: exports_external2.string().describe("制品类型"),
54044
+ name: exports_external2.string().describe("制品名称"),
54045
+ tag: exports_external2.string().describe("标签名称")
54046
+ },
54047
+ summary: "获取制品标签的详细信息"
54048
+ })
54049
+ }
54050
+ }).define(async (ctx) => {
54051
+ const cnb = await cnbManager.getContext(ctx);
54052
+ const slug = ctx.query?.slug;
54053
+ const type = ctx.query?.type;
54054
+ const name21 = ctx.query?.name;
54055
+ const tag = ctx.query?.tag;
54056
+ if (!slug) {
54057
+ ctx.throw(400, "缺少参数 slug");
54058
+ }
54059
+ if (!type) {
54060
+ ctx.throw(400, "缺少参数 type");
54061
+ }
54062
+ if (!name21) {
54063
+ ctx.throw(400, "缺少参数 name");
54064
+ }
54065
+ if (!tag) {
54066
+ ctx.throw(400, "缺少参数 tag");
54067
+ }
54068
+ const res = await cnb.packages.package.getTag(slug, type, name21, tag);
54069
+ ctx.forward(res);
54070
+ }).addTo(app);
54071
+ app.route({
54072
+ path: "cnb",
54073
+ key: "delete-package-tag",
54074
+ description: "删除制品标签, 参数 slug, type, name, tag",
54075
+ middleware: ["auth"],
54076
+ metadata: {
54077
+ tags: ["package"],
54078
+ ...createSkill({
54079
+ skill: "delete-package-tag",
54080
+ title: "删除制品标签",
54081
+ args: {
54082
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
54083
+ type: exports_external2.string().describe("制品类型"),
54084
+ name: exports_external2.string().describe("制品名称"),
54085
+ tag: exports_external2.string().describe("标签名称")
54086
+ },
54087
+ summary: "删除制品的指定标签"
54088
+ })
54089
+ }
54090
+ }).define(async (ctx) => {
54091
+ const cnb = await cnbManager.getContext(ctx);
54092
+ const slug = ctx.query?.slug;
54093
+ const type = ctx.query?.type;
54094
+ const name21 = ctx.query?.name;
54095
+ const tag = ctx.query?.tag;
54096
+ if (!slug) {
54097
+ ctx.throw(400, "缺少参数 slug");
54098
+ }
54099
+ if (!type) {
54100
+ ctx.throw(400, "缺少参数 type");
54101
+ }
54102
+ if (!name21) {
54103
+ ctx.throw(400, "缺少参数 name");
54104
+ }
54105
+ if (!tag) {
54106
+ ctx.throw(400, "缺少参数 tag");
54107
+ }
54108
+ const res = await cnb.packages.package.removeTag(slug, type, name21, tag);
54109
+ ctx.forward(res);
54110
+ }).addTo(app);
54111
+
53555
54112
  // agent/routes/index.ts
53556
54113
  var checkAppId = (ctx, appId) => {
53557
54114
  const _appId = ctx?.app?.appId;