@kevisual/cnb 0.0.56 → 0.0.57

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,88 @@ 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
+ }
25262
25362
  // src/index.ts
25263
25363
  class CNB extends CNBCore {
25264
25364
  workspace;
@@ -25270,6 +25370,7 @@ class CNB extends CNBCore {
25270
25370
  mission;
25271
25371
  ai;
25272
25372
  labels;
25373
+ packages;
25273
25374
  constructor(options) {
25274
25375
  super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
25275
25376
  this.init(options);
@@ -25292,6 +25393,10 @@ class CNB extends CNBCore {
25292
25393
  repoLabel: new RepoLabel(options),
25293
25394
  issueLabel: new IssueLabel(options)
25294
25395
  };
25396
+ this.packages = {
25397
+ registry: new RegistryPackage(options),
25398
+ package: new PackageManagement(options)
25399
+ };
25295
25400
  }
25296
25401
  setToken(token) {
25297
25402
  this.token = token;
@@ -25303,6 +25408,8 @@ class CNB extends CNBCore {
25303
25408
  this.mission.token = token;
25304
25409
  this.labels.repoLabel.token = token;
25305
25410
  this.labels.issueLabel.token = token;
25411
+ this.packages.registry.token = token;
25412
+ this.packages.package.token = token;
25306
25413
  }
25307
25414
  setCookie(cookie) {
25308
25415
  this.cookie = cookie;
@@ -25314,6 +25421,8 @@ class CNB extends CNBCore {
25314
25421
  this.mission.cookie = cookie;
25315
25422
  this.labels.repoLabel.cookie = cookie;
25316
25423
  this.labels.issueLabel.cookie = cookie;
25424
+ this.packages.registry.cookie = cookie;
25425
+ this.packages.package.cookie = cookie;
25317
25426
  }
25318
25427
  getCNBVersion = getCNBVersion;
25319
25428
  }
@@ -25681,7 +25790,7 @@ __export(exports_external2, {
25681
25790
  safeEncode: () => safeEncode5,
25682
25791
  safeDecodeAsync: () => safeDecodeAsync5,
25683
25792
  safeDecode: () => safeDecode5,
25684
- registry: () => registry2,
25793
+ registry: () => registry3,
25685
25794
  regexes: () => exports_regexes2,
25686
25795
  regex: () => _regex2,
25687
25796
  refine: () => refine2,
@@ -25891,7 +26000,7 @@ __export(exports_core3, {
25891
26000
  safeEncode: () => safeEncode3,
25892
26001
  safeDecodeAsync: () => safeDecodeAsync3,
25893
26002
  safeDecode: () => safeDecode3,
25894
- registry: () => registry2,
26003
+ registry: () => registry3,
25895
26004
  regexes: () => exports_regexes2,
25896
26005
  process: () => process3,
25897
26006
  prettifyError: () => prettifyError2,
@@ -35411,10 +35520,10 @@ class $ZodRegistry2 {
35411
35520
  return this._map.has(schema);
35412
35521
  }
35413
35522
  }
35414
- function registry2() {
35523
+ function registry3() {
35415
35524
  return new $ZodRegistry2;
35416
35525
  }
35417
- (_a15 = globalThis).__zod_globalRegistry ?? (_a15.__zod_globalRegistry = registry2());
35526
+ (_a15 = globalThis).__zod_globalRegistry ?? (_a15.__zod_globalRegistry = registry3());
35418
35527
  var globalRegistry2 = globalThis.__zod_globalRegistry;
35419
35528
  // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
35420
35529
  function _string2(Class3, params) {
@@ -37194,21 +37303,21 @@ var allProcessors2 = {
37194
37303
  };
37195
37304
  function toJSONSchema4(input, params) {
37196
37305
  if ("_idmap" in input) {
37197
- const registry3 = input;
37306
+ const registry4 = input;
37198
37307
  const ctx2 = initializeContext2({ ...params, processors: allProcessors2 });
37199
37308
  const defs = {};
37200
- for (const entry of registry3._idmap.entries()) {
37309
+ for (const entry of registry4._idmap.entries()) {
37201
37310
  const [_, schema] = entry;
37202
37311
  process3(schema, ctx2);
37203
37312
  }
37204
37313
  const schemas = {};
37205
37314
  const external = {
37206
- registry: registry3,
37315
+ registry: registry4,
37207
37316
  uri: params?.uri,
37208
37317
  defs
37209
37318
  };
37210
37319
  ctx2.external = external;
37211
- for (const entry of registry3._idmap.entries()) {
37320
+ for (const entry of registry4._idmap.entries()) {
37212
37321
  const [key, schema] = entry;
37213
37322
  extractDefs2(ctx2, schema);
37214
37323
  schemas[key] = finalize2(ctx2, schema);
@@ -43094,7 +43203,7 @@ class EventSourceParserStream extends TransformStream {
43094
43203
  }
43095
43204
  }
43096
43205
 
43097
- // ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.19_zod@4.3.6/node_modules/@ai-sdk/provider-utils/dist/index.mjs
43206
+ // ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.21_zod@4.3.6/node_modules/@ai-sdk/provider-utils/dist/index.mjs
43098
43207
  function combineHeaders(...headers) {
43099
43208
  return headers.reduce((combinedHeaders, currentHeaders) => ({
43100
43209
  ...combinedHeaders,
@@ -43358,6 +43467,9 @@ async function downloadBlob(url4, options) {
43358
43467
  const response = await fetch(url4, {
43359
43468
  signal: options == null ? undefined : options.abortSignal
43360
43469
  });
43470
+ if (response.redirected) {
43471
+ validateDownloadUrl(response.url);
43472
+ }
43361
43473
  if (!response.ok) {
43362
43474
  throw new DownloadError({
43363
43475
  url: url4,
@@ -43514,7 +43626,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
43514
43626
  normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
43515
43627
  return Object.fromEntries(normalizedHeaders.entries());
43516
43628
  }
43517
- var VERSION = "4.0.19";
43629
+ var VERSION = "4.0.21";
43518
43630
  var getOriginalFetch = () => globalThis.fetch;
43519
43631
  var getFromApi = async ({
43520
43632
  url: url4,
@@ -43689,7 +43801,7 @@ function visit(def) {
43689
43801
  return def;
43690
43802
  return addAdditionalPropertiesToJsonSchema(def);
43691
43803
  }
43692
- var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
43804
+ var ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use");
43693
43805
  var defaultOptions = {
43694
43806
  name: undefined,
43695
43807
  $refStrategy: "root",
@@ -44682,7 +44794,7 @@ var zod3ToJsonSchema = (schema, options) => {
44682
44794
  combined.$schema = "http://json-schema.org/draft-07/schema#";
44683
44795
  return combined;
44684
44796
  };
44685
- var schemaSymbol = Symbol.for("vercel.ai.schema");
44797
+ var schemaSymbol = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
44686
44798
  function lazySchema(createSchema) {
44687
44799
  let schema;
44688
44800
  return () => {
@@ -44989,8 +45101,8 @@ var postToApi = async ({
44989
45101
  throw handleFetchError({ error: error49, url: url4, requestBodyValues: body.values });
44990
45102
  }
44991
45103
  };
44992
- function tool2(tool22) {
44993
- return tool22;
45104
+ function tool(tool2) {
45105
+ return tool2;
44994
45106
  }
44995
45107
  function createProviderToolFactoryWithOutputSchema({
44996
45108
  id,
@@ -45006,7 +45118,7 @@ function createProviderToolFactoryWithOutputSchema({
45006
45118
  onInputDelta,
45007
45119
  onInputAvailable,
45008
45120
  ...args
45009
- }) => tool2({
45121
+ }) => tool({
45010
45122
  type: "provider",
45011
45123
  id,
45012
45124
  args,
@@ -45142,7 +45254,7 @@ async function* executeTool({
45142
45254
  }
45143
45255
  }
45144
45256
 
45145
- // ../../node_modules/.pnpm/@ai-sdk+openai-compatible@2.0.35_zod@4.3.6/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
45257
+ // ../../node_modules/.pnpm/@ai-sdk+openai-compatible@2.0.37_zod@4.3.6/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
45146
45258
  var openaiCompatibleErrorDataSchema = exports_external2.object({
45147
45259
  error: exports_external2.object({
45148
45260
  message: exports_external2.string(),
@@ -45427,20 +45539,20 @@ function prepareTools({
45427
45539
  return { tools: undefined, toolChoice: undefined, toolWarnings };
45428
45540
  }
45429
45541
  const openaiCompatTools = [];
45430
- for (const tool3 of tools) {
45431
- if (tool3.type === "provider") {
45542
+ for (const tool2 of tools) {
45543
+ if (tool2.type === "provider") {
45432
45544
  toolWarnings.push({
45433
45545
  type: "unsupported",
45434
- feature: `provider-defined tool ${tool3.id}`
45546
+ feature: `provider-defined tool ${tool2.id}`
45435
45547
  });
45436
45548
  } else {
45437
45549
  openaiCompatTools.push({
45438
45550
  type: "function",
45439
45551
  function: {
45440
- name: tool3.name,
45441
- description: tool3.description,
45442
- parameters: tool3.inputSchema,
45443
- ...tool3.strict != null ? { strict: tool3.strict } : {}
45552
+ name: tool2.name,
45553
+ description: tool2.description,
45554
+ parameters: tool2.inputSchema,
45555
+ ...tool2.strict != null ? { strict: tool2.strict } : {}
45444
45556
  }
45445
45557
  });
45446
45558
  }
@@ -46589,7 +46701,7 @@ async function fileToBlob(file3) {
46589
46701
  function toCamelCase(str) {
46590
46702
  return str.replace(/[_-]([a-z])/g, (g) => g[1].toUpperCase());
46591
46703
  }
46592
- var VERSION2 = "2.0.35";
46704
+ var VERSION2 = "2.0.37";
46593
46705
  function createOpenAICompatible(options) {
46594
46706
  const baseURL = withoutTrailingSlash(options.baseURL);
46595
46707
  const providerName = options.name;
@@ -46837,10 +46949,10 @@ app.route({
46837
46949
  title: "列出cnb代码仓库",
46838
46950
  summary: "列出cnb代码仓库, 可选flags参数,如 KnowledgeBase",
46839
46951
  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")
46952
+ search: exports_external2.string().optional().describe("搜索关键词"),
46953
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
46954
+ pageSize: exports_external2.number().optional().describe("每页数量,默认99"),
46955
+ flags: exports_external2.string().optional().describe("仓库标记,如果是知识库则填写 KnowledgeBase")
46844
46956
  }
46845
46957
  })
46846
46958
  }
@@ -46885,9 +46997,9 @@ app.route({
46885
46997
  skill: "create-repo",
46886
46998
  title: "创建代码仓库",
46887
46999
  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("代码仓库描述")
47000
+ name: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
47001
+ visibility: exports_external2.string().describe("代码仓库可见性, public 或 private").default("public"),
47002
+ description: exports_external2.string().describe("代码仓库描述")
46891
47003
  },
46892
47004
  summary: "创建一个新的代码仓库"
46893
47005
  })
@@ -46919,7 +47031,7 @@ app.route({
46919
47031
  middleware: ["auth"],
46920
47032
  metadata: {
46921
47033
  args: {
46922
- name: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo")
47034
+ name: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo")
46923
47035
  }
46924
47036
  }
46925
47037
  }).define(async (ctx) => {
@@ -46943,10 +47055,10 @@ app.route({
46943
47055
  title: "在代码仓库中创建文件",
46944
47056
  summary: `在代码仓库中创建文件, encoding 可选,默认 raw`,
46945
47057
  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()
47058
+ repoName: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
47059
+ filePath: exports_external2.string().describe("文件路径, 如 src/index.ts"),
47060
+ content: exports_external2.string().describe("文本的字符串的内容"),
47061
+ encoding: exports_external2.string().describe("编码方式,如 raw").optional()
46950
47062
  }
46951
47063
  })
46952
47064
  }
@@ -46978,7 +47090,7 @@ app.route({
46978
47090
  skill: "delete-repo",
46979
47091
  title: "删除代码仓库",
46980
47092
  args: {
46981
- name: tool.schema.string().describe("代码仓库名称")
47093
+ name: exports_external2.string().describe("代码仓库名称")
46982
47094
  },
46983
47095
  summary: "删除一个代码仓库"
46984
47096
  })
@@ -47012,11 +47124,11 @@ app.route({
47012
47124
  skill: "update-repo-info",
47013
47125
  title: "更新代码仓库信息",
47014
47126
  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()
47127
+ name: exports_external2.string().describe("代码仓库名称"),
47128
+ description: exports_external2.string().describe("代码仓库描述"),
47129
+ license: exports_external2.string().describe("代码仓库许可证类型,如 MIT").optional(),
47130
+ site: exports_external2.string().describe("代码仓库主页链接").optional(),
47131
+ topics: exports_external2.array(exports_external2.string()).describe("代码仓库话题标签列表").optional()
47020
47132
  },
47021
47133
  summary: "更新代码仓库的信息"
47022
47134
  })
@@ -47044,8 +47156,8 @@ app.route({
47044
47156
  middleware: ["auth"],
47045
47157
  metadata: {
47046
47158
  args: {
47047
- name: tool.schema.string().describe("代码仓库名称"),
47048
- visibility: tool.schema.string().describe("代码仓库可见性, public 或 private 或 protected")
47159
+ name: exports_external2.string().describe("代码仓库名称"),
47160
+ visibility: exports_external2.string().describe("代码仓库可见性, public 或 private 或 protected")
47049
47161
  }
47050
47162
  }
47051
47163
  }).define(async (ctx) => {
@@ -47078,10 +47190,10 @@ app.route({
47078
47190
  title: "查询仓库标签列表",
47079
47191
  summary: "查询仓库的标签列表",
47080
47192
  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("标签搜索关键词")
47193
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
47194
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
47195
+ pageSize: exports_external2.number().optional().describe("分页每页大小,默认 30"),
47196
+ keyword: exports_external2.string().optional().describe("标签搜索关键词")
47085
47197
  }
47086
47198
  })
47087
47199
  }
@@ -47113,10 +47225,10 @@ app.route({
47113
47225
  title: "创建仓库标签",
47114
47226
  summary: "创建一个仓库标签",
47115
47227
  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("标签描述")
47228
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
47229
+ name: exports_external2.string().describe("标签名称"),
47230
+ color: exports_external2.string().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
47231
+ description: exports_external2.string().optional().describe("标签描述")
47120
47232
  }
47121
47233
  })
47122
47234
  }
@@ -47148,11 +47260,11 @@ app.route({
47148
47260
  title: "更新仓库标签",
47149
47261
  summary: "更新仓库标签信息",
47150
47262
  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("新标签名称")
47263
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
47264
+ name: exports_external2.string().describe("标签名称"),
47265
+ color: exports_external2.string().optional().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
47266
+ description: exports_external2.string().optional().describe("标签描述"),
47267
+ newName: exports_external2.string().optional().describe("新标签名称")
47156
47268
  }
47157
47269
  })
47158
47270
  }
@@ -47185,8 +47297,8 @@ app.route({
47185
47297
  title: "删除仓库标签",
47186
47298
  summary: "删除指定的仓库标签",
47187
47299
  args: {
47188
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
47189
- name: tool.schema.string().describe("标签名称")
47300
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
47301
+ name: exports_external2.string().describe("标签名称")
47190
47302
  }
47191
47303
  })
47192
47304
  }
@@ -47341,8 +47453,8 @@ app.route({
47341
47453
  tags: [],
47342
47454
  ...{
47343
47455
  args: {
47344
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
47345
- pipelineId: tool.schema.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
47456
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
47457
+ pipelineId: exports_external2.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
47346
47458
  }
47347
47459
  }
47348
47460
  }
@@ -47381,8 +47493,8 @@ app.route({
47381
47493
  tags: [],
47382
47494
  ...{
47383
47495
  args: {
47384
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
47385
- pipelineId: tool.schema.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
47496
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
47497
+ pipelineId: exports_external2.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
47386
47498
  }
47387
47499
  }
47388
47500
  }
@@ -47433,11 +47545,11 @@ app.route({
47433
47545
  title: "云端构建",
47434
47546
  summary: "在云端构建代码仓库,参数包括 event, repo, branch, ref, config, env",
47435
47547
  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")
47548
+ env: exports_external2.any().optional().describe('构建环境变量,格式为 { "KEY": "VALUE" }'),
47549
+ event: exports_external2.string().optional().describe("触发事件类型,例如 api_trigger_event"),
47550
+ branch: exports_external2.string().optional().describe("分支名称,默认主分支"),
47551
+ config: exports_external2.string().describe("构建config文件内容,例如 cloudbuild.yaml对应的yml的内容"),
47552
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo")
47441
47553
  }
47442
47554
  })
47443
47555
  }
@@ -47499,7 +47611,12 @@ app.route({
47499
47611
  const branch = item.branch || "main";
47500
47612
  const repo3 = item.slug;
47501
47613
  const sn = item.sn;
47502
- await cnb.workspace.stopWorkspace({ sn });
47614
+ const res2 = await cnb.workspace.stopWorkspace({ sn });
47615
+ if (res2.code !== 200) {
47616
+ ctx.throw(500, res2.message || "Failed to stop workspace");
47617
+ } else {
47618
+ console.log(`工作区 ${repo3} 停止成功,${res2.data?.buildLogUrl ? `构建日志链接: ${res2.data.buildLogUrl}` : ""}`);
47619
+ }
47503
47620
  if (config3) {
47504
47621
  await cnb.build.startBuild(repo3, { branch, config: config3, event });
47505
47622
  } else {
@@ -47524,9 +47641,9 @@ app.route({
47524
47641
  title: "启动cnb工作空间",
47525
47642
  summary: "启动cnb工作空间",
47526
47643
  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")
47644
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
47645
+ branch: exports_external2.string().optional().describe("分支名称,默认主分支"),
47646
+ ref: exports_external2.string().optional().describe("提交引用,例如 commit sha")
47530
47647
  }
47531
47648
  })
47532
47649
  }
@@ -47556,11 +47673,11 @@ app.route({
47556
47673
  title: "列出cnb工作空间",
47557
47674
  summary: "列出cnb工作空间列表,支持按状态过滤, status 可选值 running 或 closed",
47558
47675
  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("分支名称")
47676
+ status: exports_external2.string().optional().describe("开发环境状态,running: 运行中,closed: 已关闭和停止的"),
47677
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
47678
+ pageSize: exports_external2.number().optional().describe("分页大小,默认 20,最大 100"),
47679
+ slug: exports_external2.string().optional().describe("仓库路径,例如 groupname/reponame"),
47680
+ branch: exports_external2.string().optional().describe("分支名称")
47564
47681
  }
47565
47682
  })
47566
47683
  }
@@ -47586,8 +47703,8 @@ app.route({
47586
47703
  title: "获取工作空间详情",
47587
47704
  summary: "获取工作空间详细信息",
47588
47705
  args: {
47589
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
47590
- sn: tool.schema.string().describe("工作空间流水线的 sn")
47706
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
47707
+ sn: exports_external2.string().describe("工作空间流水线的 sn")
47591
47708
  }
47592
47709
  })
47593
47710
  }
@@ -47616,9 +47733,9 @@ app.route({
47616
47733
  title: "删除工作空间",
47617
47734
  summary: "删除工作空间,pipelineId 和 sn 二选一",
47618
47735
  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("批量流水线构建号")
47736
+ pipelineId: exports_external2.string().optional().describe("流水线 ID,优先使用"),
47737
+ sn: exports_external2.string().optional().describe("流水线构建号"),
47738
+ sns: exports_external2.array(exports_external2.string()).optional().describe("批量流水线构建号")
47622
47739
  }
47623
47740
  })
47624
47741
  }
@@ -47654,8 +47771,8 @@ app.route({
47654
47771
  title: "停止工作空间",
47655
47772
  summary: "停止运行中的工作空间",
47656
47773
  args: {
47657
- pipelineId: tool.schema.string().optional().describe("流水线 ID,优先使用"),
47658
- sn: tool.schema.string().optional().describe("流水线构建号")
47774
+ pipelineId: exports_external2.string().optional().describe("流水线 ID,优先使用"),
47775
+ sn: exports_external2.string().optional().describe("流水线构建号")
47659
47776
  }
47660
47777
  })
47661
47778
  }
@@ -47683,9 +47800,9 @@ app.route({
47683
47800
  title: "调用app应用",
47684
47801
  summary: "调用router的应用, 参数path, key, payload",
47685
47802
  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("调用参数")
47803
+ path: exports_external2.string().describe("应用路径,例如 cnb"),
47804
+ key: exports_external2.string().optional().describe("应用key,例如 list-repos"),
47805
+ payload: exports_external2.object({}).optional().describe("调用参数")
47689
47806
  }
47690
47807
  })
47691
47808
  }
@@ -47732,7 +47849,7 @@ app.route({
47732
47849
  title: "获取当前cnb工作空间的port代理uri",
47733
47850
  summary: "获取当前cnb工作空间的port代理uri,用于端口转发",
47734
47851
  args: {
47735
- port: tool.schema.number().optional().describe("端口号,默认为51515")
47852
+ port: exports_external2.number().optional().describe("端口号,默认为51515")
47736
47853
  }
47737
47854
  })
47738
47855
  }
@@ -47759,11 +47876,11 @@ app.route({
47759
47876
  title: "获取当前cnb工作空间的编辑器访问地址",
47760
47877
  summary: "获取当前cnb工作空间的vscode代理uri,用于在浏览器中访问vscode,包含多种访问方式,如web、vscode、codebuddy、cursor、ssh",
47761
47878
  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")
47879
+ web: exports_external2.boolean().optional().describe("是否获取vscode web的访问uri,默认为false"),
47880
+ vscode: exports_external2.boolean().optional().describe("是否获取vscode的代理uri,默认为true"),
47881
+ codebuddy: exports_external2.boolean().optional().describe("是否获取codebuddy的代理uri,默认为false"),
47882
+ cursor: exports_external2.boolean().optional().describe("是否获取cursor的代理uri,默认为false"),
47883
+ ssh: exports_external2.boolean().optional().describe("是否获取vscode remote ssh的连接字符串,默认为false")
47767
47884
  }
47768
47885
  })
47769
47886
  }
@@ -47822,7 +47939,7 @@ app.route({
47822
47939
  title: "设置当前cnb工作空间的cookie环境变量",
47823
47940
  summary: "设置当前cnb工作空间的cookie环境变量,用于界面操作定制模块功能,例子:CNBSESSION=xxxx;csrfkey=2222xxxx;",
47824
47941
  args: {
47825
- cookie: tool.schema.string().describe("cnb的cookie值")
47942
+ cookie: exports_external2.string().describe("cnb的cookie值")
47826
47943
  }
47827
47944
  })
47828
47945
  }
@@ -48159,8 +48276,8 @@ app.route({
48159
48276
  title: "调用cnb的知识库ai对话功能进行聊天",
48160
48277
  summary: "调用cnb的知识库ai对话功能进行聊天,基于cnb提供的ai能力",
48161
48278
  args: {
48162
- question: tool.schema.string().describe("用户输入的消息内容"),
48163
- repo: tool.schema.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
48279
+ question: exports_external2.string().describe("用户输入的消息内容"),
48280
+ repo: exports_external2.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
48164
48281
  }
48165
48282
  })
48166
48283
  }
@@ -48262,8 +48379,8 @@ app.route({
48262
48379
  title: "调用cnb的知识库RAG查询功能进行问答",
48263
48380
  summary: "调用cnb的知识库RAG查询功能进行问答,基于cnb提供的知识库能力",
48264
48381
  args: {
48265
- question: tool.schema.string().describe("用户输入的消息内容"),
48266
- repo: tool.schema.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
48382
+ question: exports_external2.string().describe("用户输入的消息内容"),
48383
+ repo: exports_external2.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
48267
48384
  }
48268
48385
  })
48269
48386
  }
@@ -48325,13 +48442,13 @@ app.route({
48325
48442
  skill: "list-issues",
48326
48443
  title: "查询 Issue 列表",
48327
48444
  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")
48445
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48446
+ state: exports_external2.string().optional().describe("Issue 状态:open 或 closed"),
48447
+ keyword: exports_external2.string().optional().describe("问题搜索关键词"),
48448
+ labels: exports_external2.string().optional().describe("问题标签,多个用逗号分隔"),
48449
+ page: exports_external2.number().optional().describe("分页页码,默认: 1"),
48450
+ page_size: exports_external2.number().optional().describe("分页每页大小,默认: 30"),
48451
+ order_by: exports_external2.string().optional().describe("排序方式,如 created_at, -updated_at")
48335
48452
  },
48336
48453
  summary: "查询 Issue 列表"
48337
48454
  })
@@ -48375,8 +48492,8 @@ app.route({
48375
48492
  skill: "getIssue",
48376
48493
  title: "获取 单个 Issue",
48377
48494
  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 编号")
48495
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48496
+ issueNumber: exports_external2.union([exports_external2.string(), exports_external2.number()]).describe("Issue 编号")
48380
48497
  },
48381
48498
  summary: "获取 单个 Issue"
48382
48499
  })
@@ -48407,12 +48524,12 @@ app.route({
48407
48524
  skill: "create-issue",
48408
48525
  title: "创建 Issue",
48409
48526
  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("优先级")
48527
+ repo: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
48528
+ title: exports_external2.string().describe("Issue 标题"),
48529
+ body: exports_external2.string().optional().describe("Issue 描述内容"),
48530
+ assignees: exports_external2.array(exports_external2.string()).optional().describe("指派人列表"),
48531
+ labels: exports_external2.array(exports_external2.string()).optional().describe("标签列表"),
48532
+ priority: exports_external2.string().optional().describe("优先级")
48416
48533
  },
48417
48534
  summary: "创建一个新的 Issue"
48418
48535
  })
@@ -48448,9 +48565,9 @@ app.route({
48448
48565
  skill: "complete-issue",
48449
48566
  title: "完成 CNB的任务Issue",
48450
48567
  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")
48568
+ repo: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
48569
+ issueNumber: exports_external2.union([exports_external2.string(), exports_external2.number()]).describe("Issue 编号"),
48570
+ state: exports_external2.string().optional().describe("Issue 状态,默认为 closed")
48454
48571
  },
48455
48572
  summary: "完成一个 Issue(将 state 改为 closed)"
48456
48573
  })
@@ -48483,10 +48600,10 @@ app.route({
48483
48600
  skill: "list-issue-comments",
48484
48601
  title: "查询 Issue 评论列表",
48485
48602
  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")
48603
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48604
+ issueNumber: exports_external2.number().describe("Issue 编号"),
48605
+ page: exports_external2.number().optional().describe("分页页码,默认: 1"),
48606
+ page_size: exports_external2.number().optional().describe("分页每页大小,默认: 30")
48490
48607
  },
48491
48608
  summary: "查询 Issue 评论列表"
48492
48609
  })
@@ -48522,10 +48639,10 @@ app.route({
48522
48639
  skill: "create-issue-comment",
48523
48640
  title: "创建 Issue 评论",
48524
48641
  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")
48642
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48643
+ issueNumber: exports_external2.number().describe("Issue 编号"),
48644
+ body: exports_external2.string().describe("评论内容"),
48645
+ clearAt: exports_external2.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
48529
48646
  },
48530
48647
  summary: "创建 Issue 评论"
48531
48648
  })
@@ -48562,9 +48679,9 @@ app.route({
48562
48679
  skill: "get-issue-comment",
48563
48680
  title: "获取 Issue 评论",
48564
48681
  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")
48682
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48683
+ issueNumber: exports_external2.number().describe("Issue 编号"),
48684
+ commentId: exports_external2.number().describe("评论 ID")
48568
48685
  },
48569
48686
  summary: "获取 Issue 评论"
48570
48687
  })
@@ -48597,11 +48714,11 @@ app.route({
48597
48714
  skill: "update-issue-comment",
48598
48715
  title: "修改 Issue 评论",
48599
48716
  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")
48717
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
48718
+ issueNumber: exports_external2.number().describe("Issue 编号"),
48719
+ commentId: exports_external2.number().describe("评论 ID"),
48720
+ body: exports_external2.string().describe("评论内容"),
48721
+ clearAt: exports_external2.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
48605
48722
  },
48606
48723
  summary: "修改 Issue 评论"
48607
48724
  })
@@ -49517,7 +49634,7 @@ app.route({
49517
49634
  };
49518
49635
  }).addTo(app);
49519
49636
 
49520
- // ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.66_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
49637
+ // ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.77_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
49521
49638
  var import_oidc = __toESM(require_dist(), 1);
49522
49639
  var import_oidc2 = __toESM(require_dist(), 1);
49523
49640
  var marker17 = "vercel.ai.gateway.error";
@@ -50583,7 +50700,7 @@ async function getVercelRequestId() {
50583
50700
  var _a92;
50584
50701
  return (_a92 = import_oidc.getContext().headers) == null ? undefined : _a92["x-vercel-id"];
50585
50702
  }
50586
- var VERSION3 = "3.0.66";
50703
+ var VERSION3 = "3.0.77";
50587
50704
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
50588
50705
  function createGatewayProvider(options = {}) {
50589
50706
  var _a92, _b92;
@@ -50739,7 +50856,7 @@ async function getGatewayAuthToken(options) {
50739
50856
  };
50740
50857
  }
50741
50858
 
50742
- // ../../node_modules/.pnpm/ai@6.0.116_zod@4.3.6/node_modules/ai/dist/index.mjs
50859
+ // ../../node_modules/.pnpm/ai@6.0.134_zod@4.3.6/node_modules/ai/dist/index.mjs
50743
50860
  var import_api = __toESM(require_src(), 1);
50744
50861
  var import_api2 = __toESM(require_src(), 1);
50745
50862
  var __defProp4 = Object.defineProperty;
@@ -51310,7 +51427,7 @@ function detectMediaType({
51310
51427
  }
51311
51428
  return;
51312
51429
  }
51313
- var VERSION4 = "6.0.116";
51430
+ var VERSION4 = "6.0.134";
51314
51431
  var download = async ({
51315
51432
  url: url4,
51316
51433
  maxBytes,
@@ -51324,6 +51441,9 @@ var download = async ({
51324
51441
  headers: withUserAgentSuffix({}, `ai-sdk/${VERSION4}`, getRuntimeEnvironmentUserAgent()),
51325
51442
  signal: abortSignal
51326
51443
  });
51444
+ if (response.redirected) {
51445
+ validateDownloadUrl(response.url);
51446
+ }
51327
51447
  if (!response.ok) {
51328
51448
  throw new DownloadError({
51329
51449
  url: urlText,
@@ -51727,7 +51847,7 @@ async function createToolModelOutput({
51727
51847
  toolCallId,
51728
51848
  input,
51729
51849
  output,
51730
- tool: tool22,
51850
+ tool: tool2,
51731
51851
  errorMode
51732
51852
  }) {
51733
51853
  if (errorMode === "text") {
@@ -51735,8 +51855,8 @@ async function createToolModelOutput({
51735
51855
  } else if (errorMode === "json") {
51736
51856
  return { type: "error-json", value: toJSONValue(output) };
51737
51857
  }
51738
- if (tool22 == null ? undefined : tool22.toModelOutput) {
51739
- return await tool22.toModelOutput({ toolCallId, input, output });
51858
+ if (tool2 == null ? undefined : tool2.toModelOutput) {
51859
+ return await tool2.toModelOutput({ toolCallId, input, output });
51740
51860
  }
51741
51861
  return typeof output === "string" ? { type: "text", value: output } : { type: "json", value: toJSONValue(output) };
51742
51862
  }
@@ -51850,8 +51970,8 @@ async function prepareToolsAndToolChoice({
51850
51970
  }
51851
51971
  const filteredTools = activeTools != null ? Object.entries(tools).filter(([name21]) => activeTools.includes(name21)) : Object.entries(tools);
51852
51972
  const languageModelTools = [];
51853
- for (const [name21, tool22] of filteredTools) {
51854
- const toolType = tool22.type;
51973
+ for (const [name21, tool2] of filteredTools) {
51974
+ const toolType = tool2.type;
51855
51975
  switch (toolType) {
51856
51976
  case undefined:
51857
51977
  case "dynamic":
@@ -51859,19 +51979,19 @@ async function prepareToolsAndToolChoice({
51859
51979
  languageModelTools.push({
51860
51980
  type: "function",
51861
51981
  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 } : {}
51982
+ description: tool2.description,
51983
+ inputSchema: await asSchema(tool2.inputSchema).jsonSchema,
51984
+ ...tool2.inputExamples != null ? { inputExamples: tool2.inputExamples } : {},
51985
+ providerOptions: tool2.providerOptions,
51986
+ ...tool2.strict != null ? { strict: tool2.strict } : {}
51867
51987
  });
51868
51988
  break;
51869
51989
  case "provider":
51870
51990
  languageModelTools.push({
51871
51991
  type: "provider",
51872
51992
  name: name21,
51873
- id: tool22.id,
51874
- args: tool22.args
51993
+ id: tool2.id,
51994
+ args: tool2.args
51875
51995
  });
51876
51996
  break;
51877
51997
  default: {
@@ -52637,8 +52757,8 @@ async function executeToolCall({
52637
52757
  onToolCallFinish
52638
52758
  }) {
52639
52759
  const { toolName, toolCallId, input } = toolCall;
52640
- const tool22 = tools == null ? undefined : tools[toolName];
52641
- if ((tool22 == null ? undefined : tool22.execute) == null) {
52760
+ const tool2 = tools == null ? undefined : tools[toolName];
52761
+ if ((tool2 == null ? undefined : tool2.execute) == null) {
52642
52762
  return;
52643
52763
  }
52644
52764
  const baseCallbackEvent = {
@@ -52674,7 +52794,7 @@ async function executeToolCall({
52674
52794
  const startTime = now();
52675
52795
  try {
52676
52796
  const stream = executeTool({
52677
- execute: tool22.execute.bind(tool22),
52797
+ execute: tool2.execute.bind(tool2),
52678
52798
  input,
52679
52799
  options: {
52680
52800
  toolCallId,
@@ -52713,7 +52833,7 @@ async function executeToolCall({
52713
52833
  toolName,
52714
52834
  input,
52715
52835
  error: error49,
52716
- dynamic: tool22.type === "dynamic",
52836
+ dynamic: tool2.type === "dynamic",
52717
52837
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
52718
52838
  };
52719
52839
  }
@@ -52743,7 +52863,7 @@ async function executeToolCall({
52743
52863
  toolName,
52744
52864
  input,
52745
52865
  output,
52746
- dynamic: tool22.type === "dynamic",
52866
+ dynamic: tool2.type === "dynamic",
52747
52867
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
52748
52868
  };
52749
52869
  }
@@ -52785,18 +52905,18 @@ var DefaultGeneratedFile = class {
52785
52905
  }
52786
52906
  };
52787
52907
  async function isApprovalNeeded({
52788
- tool: tool22,
52908
+ tool: tool2,
52789
52909
  toolCall,
52790
52910
  messages,
52791
52911
  experimental_context
52792
52912
  }) {
52793
- if (tool22.needsApproval == null) {
52913
+ if (tool2.needsApproval == null) {
52794
52914
  return false;
52795
52915
  }
52796
- if (typeof tool22.needsApproval === "boolean") {
52797
- return tool22.needsApproval;
52916
+ if (typeof tool2.needsApproval === "boolean") {
52917
+ return tool2.needsApproval;
52798
52918
  }
52799
- return await tool22.needsApproval(toolCall.input, {
52919
+ return await tool2.needsApproval(toolCall.input, {
52800
52920
  toolCallId: toolCall.toolCallId,
52801
52921
  messages,
52802
52922
  experimental_context
@@ -53531,8 +53651,8 @@ async function doParseToolCall({
53531
53651
  tools
53532
53652
  }) {
53533
53653
  const toolName = toolCall.toolName;
53534
- const tool22 = tools[toolName];
53535
- if (tool22 == null) {
53654
+ const tool2 = tools[toolName];
53655
+ if (tool2 == null) {
53536
53656
  if (toolCall.providerExecuted && toolCall.dynamic) {
53537
53657
  return await parseProviderExecutedDynamicToolCall(toolCall);
53538
53658
  }
@@ -53541,7 +53661,7 @@ async function doParseToolCall({
53541
53661
  availableTools: Object.keys(tools)
53542
53662
  });
53543
53663
  }
53544
- const schema = asSchema(tool22.inputSchema);
53664
+ const schema = asSchema(tool2.inputSchema);
53545
53665
  const parseResult = toolCall.input.trim() === "" ? await safeValidateTypes({ value: {}, schema }) : await safeParseJSON({ text: toolCall.input, schema });
53546
53666
  if (parseResult.success === false) {
53547
53667
  throw new InvalidToolInputError({
@@ -53550,7 +53670,7 @@ async function doParseToolCall({
53550
53670
  cause: parseResult.error
53551
53671
  });
53552
53672
  }
53553
- return tool22.type === "dynamic" ? {
53673
+ return tool2.type === "dynamic" ? {
53554
53674
  type: "tool-call",
53555
53675
  toolCallId: toolCall.toolCallId,
53556
53676
  toolName: toolCall.toolName,
@@ -53558,7 +53678,7 @@ async function doParseToolCall({
53558
53678
  providerExecuted: toolCall.providerExecuted,
53559
53679
  providerMetadata: toolCall.providerMetadata,
53560
53680
  dynamic: true,
53561
- title: tool22.title
53681
+ title: tool2.title
53562
53682
  } : {
53563
53683
  type: "tool-call",
53564
53684
  toolCallId: toolCall.toolCallId,
@@ -53566,7 +53686,7 @@ async function doParseToolCall({
53566
53686
  input: parseResult.value,
53567
53687
  providerExecuted: toolCall.providerExecuted,
53568
53688
  providerMetadata: toolCall.providerMetadata,
53569
- title: tool22.title
53689
+ title: tool2.title
53570
53690
  };
53571
53691
  }
53572
53692
  var DefaultStepResult = class {
@@ -53906,7 +54026,7 @@ async function generateText({
53906
54026
  }),
53907
54027
  tracer,
53908
54028
  fn: async (span) => {
53909
- var _a21, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
54029
+ var _a21, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
53910
54030
  const initialMessages = initialPrompt.messages;
53911
54031
  const responseMessages = [];
53912
54032
  const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
@@ -54070,7 +54190,7 @@ async function generateText({
54070
54190
  input: () => stringifyForTelemetry(promptMessages)
54071
54191
  },
54072
54192
  "ai.prompt.tools": {
54073
- input: () => stepTools == null ? undefined : stepTools.map((tool22) => JSON.stringify(tool22))
54193
+ input: () => stepTools == null ? undefined : stepTools.map((tool2) => JSON.stringify(tool2))
54074
54194
  },
54075
54195
  "ai.prompt.toolChoice": {
54076
54196
  input: () => stepToolChoice != null ? JSON.stringify(stepToolChoice) : undefined
@@ -54106,6 +54226,7 @@ async function generateText({
54106
54226
  headers: (_g2 = result.response) == null ? undefined : _g2.headers,
54107
54227
  body: (_h2 = result.response) == null ? undefined : _h2.body
54108
54228
  };
54229
+ const usage = asLanguageModelUsage(result.usage);
54109
54230
  span2.setAttributes(await selectTelemetryAttributes({
54110
54231
  telemetry,
54111
54232
  attributes: {
@@ -54126,8 +54247,16 @@ async function generateText({
54126
54247
  "ai.response.model": responseData.modelId,
54127
54248
  "ai.response.timestamp": responseData.timestamp.toISOString(),
54128
54249
  "ai.response.providerMetadata": JSON.stringify(result.providerMetadata),
54129
- "ai.usage.promptTokens": result.usage.inputTokens.total,
54130
- "ai.usage.completionTokens": result.usage.outputTokens.total,
54250
+ "ai.usage.inputTokens": result.usage.inputTokens.total,
54251
+ "ai.usage.inputTokenDetails.noCacheTokens": result.usage.inputTokens.noCache,
54252
+ "ai.usage.inputTokenDetails.cacheReadTokens": result.usage.inputTokens.cacheRead,
54253
+ "ai.usage.inputTokenDetails.cacheWriteTokens": result.usage.inputTokens.cacheWrite,
54254
+ "ai.usage.outputTokens": result.usage.outputTokens.total,
54255
+ "ai.usage.outputTokenDetails.textTokens": result.usage.outputTokens.text,
54256
+ "ai.usage.outputTokenDetails.reasoningTokens": result.usage.outputTokens.reasoning,
54257
+ "ai.usage.totalTokens": usage.totalTokens,
54258
+ "ai.usage.reasoningTokens": result.usage.outputTokens.reasoning,
54259
+ "ai.usage.cachedInputTokens": result.usage.inputTokens.cacheRead,
54131
54260
  "gen_ai.response.finish_reasons": [
54132
54261
  result.finishReason.unified
54133
54262
  ],
@@ -54153,12 +54282,12 @@ async function generateText({
54153
54282
  if (toolCall.invalid) {
54154
54283
  continue;
54155
54284
  }
54156
- const tool22 = tools == null ? undefined : tools[toolCall.toolName];
54157
- if (tool22 == null) {
54285
+ const tool2 = tools == null ? undefined : tools[toolCall.toolName];
54286
+ if (tool2 == null) {
54158
54287
  continue;
54159
54288
  }
54160
- if ((tool22 == null ? undefined : tool22.onInputAvailable) != null) {
54161
- await tool22.onInputAvailable({
54289
+ if ((tool2 == null ? undefined : tool2.onInputAvailable) != null) {
54290
+ await tool2.onInputAvailable({
54162
54291
  input: toolCall.input,
54163
54292
  toolCallId: toolCall.toolCallId,
54164
54293
  messages: stepInputMessages,
@@ -54167,7 +54296,7 @@ async function generateText({
54167
54296
  });
54168
54297
  }
54169
54298
  if (await isApprovalNeeded({
54170
- tool: tool22,
54299
+ tool: tool2,
54171
54300
  toolCall,
54172
54301
  messages: stepInputMessages,
54173
54302
  experimental_context
@@ -54216,8 +54345,8 @@ async function generateText({
54216
54345
  for (const toolCall of stepToolCalls) {
54217
54346
  if (!toolCall.providerExecuted)
54218
54347
  continue;
54219
- const tool22 = tools == null ? undefined : tools[toolCall.toolName];
54220
- if ((tool22 == null ? undefined : tool22.type) === "provider" && tool22.supportsDeferredResults) {
54348
+ const tool2 = tools == null ? undefined : tools[toolCall.toolName];
54349
+ if ((tool2 == null ? undefined : tool2.type) === "provider" && tool2.supportsDeferredResults) {
54221
54350
  const hasResultInResponse = currentModelResponse.content.some((part) => part.type === "tool-result" && part.toolCallId === toolCall.toolCallId);
54222
54351
  if (!hasResultInResponse) {
54223
54352
  pendingDeferredToolCalls.set(toolCall.toolCallId, {
@@ -54296,9 +54425,7 @@ async function generateText({
54296
54425
  return toolCalls == null ? undefined : JSON.stringify(toolCalls);
54297
54426
  }
54298
54427
  },
54299
- "ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata),
54300
- "ai.usage.promptTokens": currentModelResponse.usage.inputTokens.total,
54301
- "ai.usage.completionTokens": currentModelResponse.usage.outputTokens.total
54428
+ "ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata)
54302
54429
  }
54303
54430
  }));
54304
54431
  const lastStep = steps[steps.length - 1];
@@ -54311,6 +54438,21 @@ async function generateText({
54311
54438
  reasoningTokens: undefined,
54312
54439
  cachedInputTokens: undefined
54313
54440
  });
54441
+ span.setAttributes(await selectTelemetryAttributes({
54442
+ telemetry,
54443
+ attributes: {
54444
+ "ai.usage.inputTokens": totalUsage.inputTokens,
54445
+ "ai.usage.inputTokenDetails.noCacheTokens": (_n = totalUsage.inputTokenDetails) == null ? undefined : _n.noCacheTokens,
54446
+ "ai.usage.inputTokenDetails.cacheReadTokens": (_o = totalUsage.inputTokenDetails) == null ? undefined : _o.cacheReadTokens,
54447
+ "ai.usage.inputTokenDetails.cacheWriteTokens": (_p = totalUsage.inputTokenDetails) == null ? undefined : _p.cacheWriteTokens,
54448
+ "ai.usage.outputTokens": totalUsage.outputTokens,
54449
+ "ai.usage.outputTokenDetails.textTokens": (_q = totalUsage.outputTokenDetails) == null ? undefined : _q.textTokens,
54450
+ "ai.usage.outputTokenDetails.reasoningTokens": (_r = totalUsage.outputTokenDetails) == null ? undefined : _r.reasoningTokens,
54451
+ "ai.usage.totalTokens": totalUsage.totalTokens,
54452
+ "ai.usage.reasoningTokens": (_s = totalUsage.outputTokenDetails) == null ? undefined : _s.reasoningTokens,
54453
+ "ai.usage.cachedInputTokens": (_t = totalUsage.inputTokenDetails) == null ? undefined : _t.cacheReadTokens
54454
+ }
54455
+ }));
54314
54456
  await notify({
54315
54457
  event: {
54316
54458
  stepNumber: lastStep.stepNumber,
@@ -54510,8 +54652,8 @@ function asContent({
54510
54652
  case "tool-result": {
54511
54653
  const toolCall = toolCalls.find((toolCall2) => toolCall2.toolCallId === part.toolCallId);
54512
54654
  if (toolCall == null) {
54513
- const tool22 = tools == null ? undefined : tools[part.toolName];
54514
- const supportsDeferredResults = (tool22 == null ? undefined : tool22.type) === "provider" && tool22.supportsDeferredResults;
54655
+ const tool2 = tools == null ? undefined : tools[part.toolName];
54656
+ const supportsDeferredResults = (tool2 == null ? undefined : tool2.type) === "provider" && tool2.supportsDeferredResults;
54515
54657
  if (!supportsDeferredResults) {
54516
54658
  throw new Error(`Tool call ${part.toolCallId} not found.`);
54517
54659
  }
@@ -54523,7 +54665,8 @@ function asContent({
54523
54665
  input: undefined,
54524
54666
  error: part.result,
54525
54667
  providerExecuted: true,
54526
- dynamic: part.dynamic
54668
+ dynamic: part.dynamic,
54669
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
54527
54670
  });
54528
54671
  } else {
54529
54672
  contentParts.push({
@@ -54533,7 +54676,8 @@ function asContent({
54533
54676
  input: undefined,
54534
54677
  output: part.result,
54535
54678
  providerExecuted: true,
54536
- dynamic: part.dynamic
54679
+ dynamic: part.dynamic,
54680
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
54537
54681
  });
54538
54682
  }
54539
54683
  break;
@@ -54546,7 +54690,8 @@ function asContent({
54546
54690
  input: toolCall.input,
54547
54691
  error: part.result,
54548
54692
  providerExecuted: true,
54549
- dynamic: toolCall.dynamic
54693
+ dynamic: toolCall.dynamic,
54694
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
54550
54695
  });
54551
54696
  } else {
54552
54697
  contentParts.push({
@@ -54556,7 +54701,8 @@ function asContent({
54556
54701
  input: toolCall.input,
54557
54702
  output: part.result,
54558
54703
  providerExecuted: true,
54559
- dynamic: toolCall.dynamic
54704
+ dynamic: toolCall.dynamic,
54705
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
54560
54706
  });
54561
54707
  }
54562
54708
  break;
@@ -54662,6 +54808,7 @@ var uiMessageChunkSchema = lazySchema(() => zodSchema(exports_external2.union([
54662
54808
  toolCallId: exports_external2.string(),
54663
54809
  output: exports_external2.unknown(),
54664
54810
  providerExecuted: exports_external2.boolean().optional(),
54811
+ providerMetadata: providerMetadataSchema.optional(),
54665
54812
  dynamic: exports_external2.boolean().optional(),
54666
54813
  preliminary: exports_external2.boolean().optional()
54667
54814
  }),
@@ -54670,6 +54817,7 @@ var uiMessageChunkSchema = lazySchema(() => zodSchema(exports_external2.union([
54670
54817
  toolCallId: exports_external2.string(),
54671
54818
  errorText: exports_external2.string(),
54672
54819
  providerExecuted: exports_external2.boolean().optional(),
54820
+ providerMetadata: providerMetadataSchema.optional(),
54673
54821
  dynamic: exports_external2.boolean().optional()
54674
54822
  }),
54675
54823
  exports_external2.strictObject({
@@ -54868,6 +55016,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
54868
55016
  output: exports_external2.unknown(),
54869
55017
  errorText: exports_external2.never().optional(),
54870
55018
  callProviderMetadata: providerMetadataSchema.optional(),
55019
+ resultProviderMetadata: providerMetadataSchema.optional(),
54871
55020
  preliminary: exports_external2.boolean().optional(),
54872
55021
  approval: exports_external2.object({
54873
55022
  id: exports_external2.string(),
@@ -54886,6 +55035,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
54886
55035
  output: exports_external2.never().optional(),
54887
55036
  errorText: exports_external2.string(),
54888
55037
  callProviderMetadata: providerMetadataSchema.optional(),
55038
+ resultProviderMetadata: providerMetadataSchema.optional(),
54889
55039
  approval: exports_external2.object({
54890
55040
  id: exports_external2.string(),
54891
55041
  approved: exports_external2.literal(true),
@@ -54969,6 +55119,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
54969
55119
  output: exports_external2.unknown(),
54970
55120
  errorText: exports_external2.never().optional(),
54971
55121
  callProviderMetadata: providerMetadataSchema.optional(),
55122
+ resultProviderMetadata: providerMetadataSchema.optional(),
54972
55123
  preliminary: exports_external2.boolean().optional(),
54973
55124
  approval: exports_external2.object({
54974
55125
  id: exports_external2.string(),
@@ -54986,6 +55137,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
54986
55137
  output: exports_external2.never().optional(),
54987
55138
  errorText: exports_external2.string(),
54988
55139
  callProviderMetadata: providerMetadataSchema.optional(),
55140
+ resultProviderMetadata: providerMetadataSchema.optional(),
54989
55141
  approval: exports_external2.object({
54990
55142
  id: exports_external2.string(),
54991
55143
  approved: exports_external2.literal(true),
@@ -55372,7 +55524,7 @@ var createTool = async (app2, message) => {
55372
55524
  console.error(`未找到路径 ${message.path} 和 key ${message.key} 的路由`);
55373
55525
  return null;
55374
55526
  }
55375
- const _tool = tool2({
55527
+ const _tool = tool({
55376
55528
  description: route?.metadata?.summary || route?.description || "无描述",
55377
55529
  inputSchema: zod_default.object({
55378
55530
  ...route.metadata?.args
@@ -55518,10 +55670,10 @@ app.route({
55518
55670
  title: "查询 Issue 标签列表",
55519
55671
  summary: "查询 Issue 的标签列表",
55520
55672
  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")
55673
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55674
+ issueNumber: exports_external2.number().describe("Issue 编号"),
55675
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
55676
+ pageSize: exports_external2.number().optional().describe("分页每页大小,默认 30")
55525
55677
  }
55526
55678
  })
55527
55679
  }
@@ -55555,9 +55707,9 @@ app.route({
55555
55707
  title: "设置 Issue 标签",
55556
55708
  summary: "设置 Issue 标签(完全替换现有标签)",
55557
55709
  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("标签名称数组")
55710
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55711
+ issueNumber: exports_external2.number().describe("Issue 编号"),
55712
+ labels: exports_external2.array(exports_external2.string()).describe("标签名称数组")
55561
55713
  }
55562
55714
  })
55563
55715
  }
@@ -55590,9 +55742,9 @@ app.route({
55590
55742
  title: "新增 Issue 标签",
55591
55743
  summary: "新增 Issue 标签(追加到现有标签)",
55592
55744
  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("标签名称数组")
55745
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55746
+ issueNumber: exports_external2.number().describe("Issue 编号"),
55747
+ labels: exports_external2.array(exports_external2.string()).describe("标签名称数组")
55596
55748
  }
55597
55749
  })
55598
55750
  }
@@ -55625,8 +55777,8 @@ app.route({
55625
55777
  title: "清空 Issue 标签",
55626
55778
  summary: "清空 Issue 标签(移除所有标签)",
55627
55779
  args: {
55628
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55629
- issueNumber: tool.schema.number().describe("Issue 编号")
55780
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55781
+ issueNumber: exports_external2.number().describe("Issue 编号")
55630
55782
  }
55631
55783
  })
55632
55784
  }
@@ -55655,9 +55807,9 @@ app.route({
55655
55807
  title: "删除 Issue 标签",
55656
55808
  summary: "删除 Issue 指定标签",
55657
55809
  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("标签名称")
55810
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
55811
+ issueNumber: exports_external2.number().describe("Issue 编号"),
55812
+ name: exports_external2.string().describe("标签名称")
55661
55813
  }
55662
55814
  })
55663
55815
  }
@@ -55679,6 +55831,330 @@ app.route({
55679
55831
  ctx.forward(res);
55680
55832
  }).addTo(app);
55681
55833
 
55834
+ // agent/routes/package/registry.ts
55835
+ app.route({
55836
+ path: "cnb",
55837
+ key: "list-group-registries",
55838
+ description: "查询组织下的制品库列表, 参数 slug",
55839
+ middleware: ["auth"],
55840
+ metadata: {
55841
+ tags: ["package"],
55842
+ ...createSkill({
55843
+ skill: "list-group-registries",
55844
+ title: "查询制品库列表",
55845
+ args: {
55846
+ slug: exports_external2.string().describe("组织 slug, 如 my-org"),
55847
+ page: exports_external2.number().describe("页码").optional(),
55848
+ page_size: exports_external2.number().describe("每页数量").optional(),
55849
+ registry_type: exports_external2.string().describe("制品仓库类型: npm, maven, ohpm").optional(),
55850
+ filter_type: exports_external2.string().describe("制品仓库可见性: private, public").optional(),
55851
+ order_by: exports_external2.string().describe("排序字段: created_at, name").optional()
55852
+ },
55853
+ summary: "查询组织下的制品库列表"
55854
+ })
55855
+ }
55856
+ }).define(async (ctx) => {
55857
+ const cnb = await cnbManager.getContext(ctx);
55858
+ const slug = ctx.query?.slug;
55859
+ const { page, page_size, registry_type, filter_type, order_by } = ctx.query || {};
55860
+ if (!slug) {
55861
+ ctx.throw(400, "缺少参数 slug");
55862
+ }
55863
+ const res = await cnb.packages.registry.listGroupRegistries(slug, {
55864
+ page,
55865
+ page_size,
55866
+ registry_type,
55867
+ filter_type,
55868
+ order_by
55869
+ });
55870
+ ctx.forward(res);
55871
+ }).addTo(app);
55872
+ app.route({
55873
+ path: "cnb",
55874
+ key: "set-registry-visibility",
55875
+ description: "设置制品库可见性, 参数 registry, visibility",
55876
+ middleware: ["auth"],
55877
+ metadata: {
55878
+ tags: ["package"],
55879
+ ...createSkill({
55880
+ skill: "set-registry-visibility",
55881
+ title: "设置制品库可见性",
55882
+ args: {
55883
+ registry: exports_external2.string().describe("制品库路径, 如 my-org/my-registry"),
55884
+ visibility: exports_external2.string().describe("可见性: private 或 public")
55885
+ },
55886
+ summary: "设置制品库的可见性"
55887
+ })
55888
+ }
55889
+ }).define(async (ctx) => {
55890
+ const cnb = await cnbManager.getContext(ctx);
55891
+ const registry4 = ctx.query?.registry;
55892
+ const visibility = ctx.query?.visibility;
55893
+ if (!registry4) {
55894
+ ctx.throw(400, "缺少参数 registry");
55895
+ }
55896
+ if (!visibility) {
55897
+ ctx.throw(400, "缺少参数 visibility");
55898
+ }
55899
+ const res = await cnb.packages.registry.setVisibility(registry4, { visibility });
55900
+ ctx.forward(res);
55901
+ }).addTo(app);
55902
+ app.route({
55903
+ path: "cnb",
55904
+ key: "delete-registry",
55905
+ description: "删除制品库, 参数 registry",
55906
+ middleware: ["auth"],
55907
+ metadata: {
55908
+ tags: ["package"],
55909
+ ...createSkill({
55910
+ skill: "delete-registry",
55911
+ title: "删除制品库",
55912
+ args: {
55913
+ registry: exports_external2.string().describe("制品库路径, 如 my-org/my-registry")
55914
+ },
55915
+ summary: "删除指定的制品库"
55916
+ })
55917
+ }
55918
+ }).define(async (ctx) => {
55919
+ const cnb = await cnbManager.getContext(ctx);
55920
+ const registry4 = ctx.query?.registry;
55921
+ if (!registry4) {
55922
+ ctx.throw(400, "缺少参数 registry");
55923
+ }
55924
+ const res = await cnb.packages.registry.remove(registry4);
55925
+ ctx.forward(res);
55926
+ }).addTo(app);
55927
+
55928
+ // agent/routes/package/package.ts
55929
+ app.route({
55930
+ path: "cnb",
55931
+ key: "list-packages",
55932
+ description: "查询制品列表, 参数 slug, type",
55933
+ middleware: ["auth"],
55934
+ metadata: {
55935
+ tags: ["package"],
55936
+ ...createSkill({
55937
+ skill: "list-packages",
55938
+ title: "查询制品列表",
55939
+ args: {
55940
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
55941
+ type: exports_external2.string().describe("制品类型: all, docker, helm, docker-model, maven, npm, ohpm, pypi, nuget, composer, conan, cargo"),
55942
+ ordering: exports_external2.string().describe("排序类型: pull_count, last_push_at, name_ascend, name_descend").optional(),
55943
+ name: exports_external2.string().describe("关键字,搜索制品名称").optional(),
55944
+ page: exports_external2.number().describe("页码").optional(),
55945
+ page_size: exports_external2.number().describe("每页数量").optional()
55946
+ },
55947
+ summary: "查询制品列表"
55948
+ })
55949
+ }
55950
+ }).define(async (ctx) => {
55951
+ const cnb = await cnbManager.getContext(ctx);
55952
+ const slug = ctx.query?.slug;
55953
+ const type = ctx.query?.type;
55954
+ const { ordering, name: name21, page, page_size } = ctx.query || {};
55955
+ if (!slug) {
55956
+ ctx.throw(400, "缺少参数 slug");
55957
+ }
55958
+ if (!type) {
55959
+ ctx.throw(400, "缺少参数 type");
55960
+ }
55961
+ const res = await cnb.packages.package.list(slug, type, {
55962
+ ordering,
55963
+ name: name21,
55964
+ page,
55965
+ page_size
55966
+ });
55967
+ ctx.forward(res);
55968
+ }).addTo(app);
55969
+ app.route({
55970
+ path: "cnb",
55971
+ key: "get-package",
55972
+ description: "获取制品详情, 参数 slug, type, name",
55973
+ middleware: ["auth"],
55974
+ metadata: {
55975
+ tags: ["package"],
55976
+ ...createSkill({
55977
+ skill: "get-package",
55978
+ title: "获取制品详情",
55979
+ args: {
55980
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
55981
+ type: exports_external2.string().describe("制品类型"),
55982
+ name: exports_external2.string().describe("制品名称")
55983
+ },
55984
+ summary: "获取指定制品的详细信息"
55985
+ })
55986
+ }
55987
+ }).define(async (ctx) => {
55988
+ const cnb = await cnbManager.getContext(ctx);
55989
+ const slug = ctx.query?.slug;
55990
+ const type = ctx.query?.type;
55991
+ const name21 = ctx.query?.name;
55992
+ if (!slug) {
55993
+ ctx.throw(400, "缺少参数 slug");
55994
+ }
55995
+ if (!type) {
55996
+ ctx.throw(400, "缺少参数 type");
55997
+ }
55998
+ if (!name21) {
55999
+ ctx.throw(400, "缺少参数 name");
56000
+ }
56001
+ const res = await cnb.packages.package.getOne(slug, type, name21);
56002
+ ctx.forward(res);
56003
+ }).addTo(app);
56004
+ app.route({
56005
+ path: "cnb",
56006
+ key: "delete-package",
56007
+ description: "删除制品, 参数 slug, type, name",
56008
+ middleware: ["auth"],
56009
+ metadata: {
56010
+ tags: ["package"],
56011
+ ...createSkill({
56012
+ skill: "delete-package",
56013
+ title: "删除制品",
56014
+ args: {
56015
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56016
+ type: exports_external2.string().describe("制品类型"),
56017
+ name: exports_external2.string().describe("制品名称")
56018
+ },
56019
+ summary: "删除指定的制品"
56020
+ })
56021
+ }
56022
+ }).define(async (ctx) => {
56023
+ const cnb = await cnbManager.getContext(ctx);
56024
+ const slug = ctx.query?.slug;
56025
+ const type = ctx.query?.type;
56026
+ const name21 = ctx.query?.name;
56027
+ if (!slug) {
56028
+ ctx.throw(400, "缺少参数 slug");
56029
+ }
56030
+ if (!type) {
56031
+ ctx.throw(400, "缺少参数 type");
56032
+ }
56033
+ if (!name21) {
56034
+ ctx.throw(400, "缺少参数 name");
56035
+ }
56036
+ const res = await cnb.packages.package.remove(slug, type, name21);
56037
+ ctx.forward(res);
56038
+ }).addTo(app);
56039
+ app.route({
56040
+ path: "cnb",
56041
+ key: "list-package-tags",
56042
+ description: "获取制品标签列表, 参数 slug, type, name",
56043
+ middleware: ["auth"],
56044
+ metadata: {
56045
+ tags: ["package"],
56046
+ ...createSkill({
56047
+ skill: "list-package-tags",
56048
+ title: "获取制品标签列表",
56049
+ args: {
56050
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56051
+ type: exports_external2.string().describe("制品类型"),
56052
+ name: exports_external2.string().describe("制品名称"),
56053
+ page: exports_external2.number().describe("页码").optional(),
56054
+ page_size: exports_external2.number().describe("每页数量").optional()
56055
+ },
56056
+ summary: "获取制品的标签列表"
56057
+ })
56058
+ }
56059
+ }).define(async (ctx) => {
56060
+ const cnb = await cnbManager.getContext(ctx);
56061
+ const slug = ctx.query?.slug;
56062
+ const type = ctx.query?.type;
56063
+ const name21 = ctx.query?.name;
56064
+ const { page, page_size } = ctx.query || {};
56065
+ if (!slug) {
56066
+ ctx.throw(400, "缺少参数 slug");
56067
+ }
56068
+ if (!type) {
56069
+ ctx.throw(400, "缺少参数 type");
56070
+ }
56071
+ if (!name21) {
56072
+ ctx.throw(400, "缺少参数 name");
56073
+ }
56074
+ const res = await cnb.packages.package.listTags(slug, type, name21, { page, page_size });
56075
+ ctx.forward(res);
56076
+ }).addTo(app);
56077
+ app.route({
56078
+ path: "cnb",
56079
+ key: "get-package-tag",
56080
+ description: "获取制品标签详情, 参数 slug, type, name, tag",
56081
+ middleware: ["auth"],
56082
+ metadata: {
56083
+ tags: ["package"],
56084
+ ...createSkill({
56085
+ skill: "get-package-tag",
56086
+ title: "获取制品标签详情",
56087
+ args: {
56088
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56089
+ type: exports_external2.string().describe("制品类型"),
56090
+ name: exports_external2.string().describe("制品名称"),
56091
+ tag: exports_external2.string().describe("标签名称")
56092
+ },
56093
+ summary: "获取制品标签的详细信息"
56094
+ })
56095
+ }
56096
+ }).define(async (ctx) => {
56097
+ const cnb = await cnbManager.getContext(ctx);
56098
+ const slug = ctx.query?.slug;
56099
+ const type = ctx.query?.type;
56100
+ const name21 = ctx.query?.name;
56101
+ const tag = ctx.query?.tag;
56102
+ if (!slug) {
56103
+ ctx.throw(400, "缺少参数 slug");
56104
+ }
56105
+ if (!type) {
56106
+ ctx.throw(400, "缺少参数 type");
56107
+ }
56108
+ if (!name21) {
56109
+ ctx.throw(400, "缺少参数 name");
56110
+ }
56111
+ if (!tag) {
56112
+ ctx.throw(400, "缺少参数 tag");
56113
+ }
56114
+ const res = await cnb.packages.package.getTag(slug, type, name21, tag);
56115
+ ctx.forward(res);
56116
+ }).addTo(app);
56117
+ app.route({
56118
+ path: "cnb",
56119
+ key: "delete-package-tag",
56120
+ description: "删除制品标签, 参数 slug, type, name, tag",
56121
+ middleware: ["auth"],
56122
+ metadata: {
56123
+ tags: ["package"],
56124
+ ...createSkill({
56125
+ skill: "delete-package-tag",
56126
+ title: "删除制品标签",
56127
+ args: {
56128
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
56129
+ type: exports_external2.string().describe("制品类型"),
56130
+ name: exports_external2.string().describe("制品名称"),
56131
+ tag: exports_external2.string().describe("标签名称")
56132
+ },
56133
+ summary: "删除制品的指定标签"
56134
+ })
56135
+ }
56136
+ }).define(async (ctx) => {
56137
+ const cnb = await cnbManager.getContext(ctx);
56138
+ const slug = ctx.query?.slug;
56139
+ const type = ctx.query?.type;
56140
+ const name21 = ctx.query?.name;
56141
+ const tag = ctx.query?.tag;
56142
+ if (!slug) {
56143
+ ctx.throw(400, "缺少参数 slug");
56144
+ }
56145
+ if (!type) {
56146
+ ctx.throw(400, "缺少参数 type");
56147
+ }
56148
+ if (!name21) {
56149
+ ctx.throw(400, "缺少参数 name");
56150
+ }
56151
+ if (!tag) {
56152
+ ctx.throw(400, "缺少参数 tag");
56153
+ }
56154
+ const res = await cnb.packages.package.removeTag(slug, type, name21, tag);
56155
+ ctx.forward(res);
56156
+ }).addTo(app);
56157
+
55682
56158
  // agent/routes/index.ts
55683
56159
  var checkAppId = (ctx, appId) => {
55684
56160
  const _appId = ctx?.app?.appId;