@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/opencode.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,88 @@ 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
+ }
23135
23235
  // src/index.ts
23136
23236
  class CNB extends CNBCore {
23137
23237
  workspace;
@@ -23143,6 +23243,7 @@ class CNB extends CNBCore {
23143
23243
  mission;
23144
23244
  ai;
23145
23245
  labels;
23246
+ packages;
23146
23247
  constructor(options) {
23147
23248
  super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
23148
23249
  this.init(options);
@@ -23165,6 +23266,10 @@ class CNB extends CNBCore {
23165
23266
  repoLabel: new RepoLabel(options),
23166
23267
  issueLabel: new IssueLabel(options)
23167
23268
  };
23269
+ this.packages = {
23270
+ registry: new RegistryPackage(options),
23271
+ package: new PackageManagement(options)
23272
+ };
23168
23273
  }
23169
23274
  setToken(token) {
23170
23275
  this.token = token;
@@ -23176,6 +23281,8 @@ class CNB extends CNBCore {
23176
23281
  this.mission.token = token;
23177
23282
  this.labels.repoLabel.token = token;
23178
23283
  this.labels.issueLabel.token = token;
23284
+ this.packages.registry.token = token;
23285
+ this.packages.package.token = token;
23179
23286
  }
23180
23287
  setCookie(cookie) {
23181
23288
  this.cookie = cookie;
@@ -23187,6 +23294,8 @@ class CNB extends CNBCore {
23187
23294
  this.mission.cookie = cookie;
23188
23295
  this.labels.repoLabel.cookie = cookie;
23189
23296
  this.labels.issueLabel.cookie = cookie;
23297
+ this.packages.registry.cookie = cookie;
23298
+ this.packages.package.cookie = cookie;
23190
23299
  }
23191
23300
  getCNBVersion = getCNBVersion;
23192
23301
  }
@@ -23554,7 +23663,7 @@ __export(exports_external2, {
23554
23663
  safeEncode: () => safeEncode5,
23555
23664
  safeDecodeAsync: () => safeDecodeAsync5,
23556
23665
  safeDecode: () => safeDecode5,
23557
- registry: () => registry2,
23666
+ registry: () => registry3,
23558
23667
  regexes: () => exports_regexes2,
23559
23668
  regex: () => _regex2,
23560
23669
  refine: () => refine2,
@@ -23764,7 +23873,7 @@ __export(exports_core3, {
23764
23873
  safeEncode: () => safeEncode3,
23765
23874
  safeDecodeAsync: () => safeDecodeAsync3,
23766
23875
  safeDecode: () => safeDecode3,
23767
- registry: () => registry2,
23876
+ registry: () => registry3,
23768
23877
  regexes: () => exports_regexes2,
23769
23878
  process: () => process3,
23770
23879
  prettifyError: () => prettifyError2,
@@ -33284,10 +33393,10 @@ class $ZodRegistry2 {
33284
33393
  return this._map.has(schema);
33285
33394
  }
33286
33395
  }
33287
- function registry2() {
33396
+ function registry3() {
33288
33397
  return new $ZodRegistry2;
33289
33398
  }
33290
- (_a15 = globalThis).__zod_globalRegistry ?? (_a15.__zod_globalRegistry = registry2());
33399
+ (_a15 = globalThis).__zod_globalRegistry ?? (_a15.__zod_globalRegistry = registry3());
33291
33400
  var globalRegistry2 = globalThis.__zod_globalRegistry;
33292
33401
  // ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
33293
33402
  function _string2(Class3, params) {
@@ -35067,21 +35176,21 @@ var allProcessors2 = {
35067
35176
  };
35068
35177
  function toJSONSchema4(input, params) {
35069
35178
  if ("_idmap" in input) {
35070
- const registry3 = input;
35179
+ const registry4 = input;
35071
35180
  const ctx2 = initializeContext2({ ...params, processors: allProcessors2 });
35072
35181
  const defs = {};
35073
- for (const entry of registry3._idmap.entries()) {
35182
+ for (const entry of registry4._idmap.entries()) {
35074
35183
  const [_, schema] = entry;
35075
35184
  process3(schema, ctx2);
35076
35185
  }
35077
35186
  const schemas = {};
35078
35187
  const external = {
35079
- registry: registry3,
35188
+ registry: registry4,
35080
35189
  uri: params?.uri,
35081
35190
  defs
35082
35191
  };
35083
35192
  ctx2.external = external;
35084
- for (const entry of registry3._idmap.entries()) {
35193
+ for (const entry of registry4._idmap.entries()) {
35085
35194
  const [key, schema] = entry;
35086
35195
  extractDefs2(ctx2, schema);
35087
35196
  schemas[key] = finalize2(ctx2, schema);
@@ -40967,7 +41076,7 @@ class EventSourceParserStream extends TransformStream {
40967
41076
  }
40968
41077
  }
40969
41078
 
40970
- // ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.19_zod@4.3.6/node_modules/@ai-sdk/provider-utils/dist/index.mjs
41079
+ // ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.21_zod@4.3.6/node_modules/@ai-sdk/provider-utils/dist/index.mjs
40971
41080
  function combineHeaders(...headers) {
40972
41081
  return headers.reduce((combinedHeaders, currentHeaders) => ({
40973
41082
  ...combinedHeaders,
@@ -41231,6 +41340,9 @@ async function downloadBlob(url4, options) {
41231
41340
  const response = await fetch(url4, {
41232
41341
  signal: options == null ? undefined : options.abortSignal
41233
41342
  });
41343
+ if (response.redirected) {
41344
+ validateDownloadUrl(response.url);
41345
+ }
41234
41346
  if (!response.ok) {
41235
41347
  throw new DownloadError({
41236
41348
  url: url4,
@@ -41387,7 +41499,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
41387
41499
  normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
41388
41500
  return Object.fromEntries(normalizedHeaders.entries());
41389
41501
  }
41390
- var VERSION = "4.0.19";
41502
+ var VERSION = "4.0.21";
41391
41503
  var getOriginalFetch = () => globalThis.fetch;
41392
41504
  var getFromApi = async ({
41393
41505
  url: url4,
@@ -41562,7 +41674,7 @@ function visit(def) {
41562
41674
  return def;
41563
41675
  return addAdditionalPropertiesToJsonSchema(def);
41564
41676
  }
41565
- var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
41677
+ var ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use");
41566
41678
  var defaultOptions = {
41567
41679
  name: undefined,
41568
41680
  $refStrategy: "root",
@@ -42555,7 +42667,7 @@ var zod3ToJsonSchema = (schema, options) => {
42555
42667
  combined.$schema = "http://json-schema.org/draft-07/schema#";
42556
42668
  return combined;
42557
42669
  };
42558
- var schemaSymbol = Symbol.for("vercel.ai.schema");
42670
+ var schemaSymbol = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
42559
42671
  function lazySchema(createSchema) {
42560
42672
  let schema;
42561
42673
  return () => {
@@ -42862,8 +42974,8 @@ var postToApi = async ({
42862
42974
  throw handleFetchError({ error: error49, url: url4, requestBodyValues: body.values });
42863
42975
  }
42864
42976
  };
42865
- function tool2(tool22) {
42866
- return tool22;
42977
+ function tool(tool2) {
42978
+ return tool2;
42867
42979
  }
42868
42980
  function createProviderToolFactoryWithOutputSchema({
42869
42981
  id,
@@ -42879,7 +42991,7 @@ function createProviderToolFactoryWithOutputSchema({
42879
42991
  onInputDelta,
42880
42992
  onInputAvailable,
42881
42993
  ...args
42882
- }) => tool2({
42994
+ }) => tool({
42883
42995
  type: "provider",
42884
42996
  id,
42885
42997
  args,
@@ -43015,7 +43127,7 @@ async function* executeTool({
43015
43127
  }
43016
43128
  }
43017
43129
 
43018
- // ../../node_modules/.pnpm/@ai-sdk+openai-compatible@2.0.35_zod@4.3.6/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
43130
+ // ../../node_modules/.pnpm/@ai-sdk+openai-compatible@2.0.37_zod@4.3.6/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
43019
43131
  var openaiCompatibleErrorDataSchema = exports_external2.object({
43020
43132
  error: exports_external2.object({
43021
43133
  message: exports_external2.string(),
@@ -43300,20 +43412,20 @@ function prepareTools({
43300
43412
  return { tools: undefined, toolChoice: undefined, toolWarnings };
43301
43413
  }
43302
43414
  const openaiCompatTools = [];
43303
- for (const tool3 of tools) {
43304
- if (tool3.type === "provider") {
43415
+ for (const tool2 of tools) {
43416
+ if (tool2.type === "provider") {
43305
43417
  toolWarnings.push({
43306
43418
  type: "unsupported",
43307
- feature: `provider-defined tool ${tool3.id}`
43419
+ feature: `provider-defined tool ${tool2.id}`
43308
43420
  });
43309
43421
  } else {
43310
43422
  openaiCompatTools.push({
43311
43423
  type: "function",
43312
43424
  function: {
43313
- name: tool3.name,
43314
- description: tool3.description,
43315
- parameters: tool3.inputSchema,
43316
- ...tool3.strict != null ? { strict: tool3.strict } : {}
43425
+ name: tool2.name,
43426
+ description: tool2.description,
43427
+ parameters: tool2.inputSchema,
43428
+ ...tool2.strict != null ? { strict: tool2.strict } : {}
43317
43429
  }
43318
43430
  });
43319
43431
  }
@@ -44462,7 +44574,7 @@ async function fileToBlob(file3) {
44462
44574
  function toCamelCase(str) {
44463
44575
  return str.replace(/[_-]([a-z])/g, (g) => g[1].toUpperCase());
44464
44576
  }
44465
- var VERSION2 = "2.0.35";
44577
+ var VERSION2 = "2.0.37";
44466
44578
  function createOpenAICompatible(options) {
44467
44579
  const baseURL = withoutTrailingSlash(options.baseURL);
44468
44580
  const providerName = options.name;
@@ -44710,10 +44822,10 @@ app.route({
44710
44822
  title: "列出cnb代码仓库",
44711
44823
  summary: "列出cnb代码仓库, 可选flags参数,如 KnowledgeBase",
44712
44824
  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")
44825
+ search: exports_external2.string().optional().describe("搜索关键词"),
44826
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
44827
+ pageSize: exports_external2.number().optional().describe("每页数量,默认99"),
44828
+ flags: exports_external2.string().optional().describe("仓库标记,如果是知识库则填写 KnowledgeBase")
44717
44829
  }
44718
44830
  })
44719
44831
  }
@@ -44758,9 +44870,9 @@ app.route({
44758
44870
  skill: "create-repo",
44759
44871
  title: "创建代码仓库",
44760
44872
  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("代码仓库描述")
44873
+ name: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
44874
+ visibility: exports_external2.string().describe("代码仓库可见性, public 或 private").default("public"),
44875
+ description: exports_external2.string().describe("代码仓库描述")
44764
44876
  },
44765
44877
  summary: "创建一个新的代码仓库"
44766
44878
  })
@@ -44792,7 +44904,7 @@ app.route({
44792
44904
  middleware: ["auth"],
44793
44905
  metadata: {
44794
44906
  args: {
44795
- name: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo")
44907
+ name: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo")
44796
44908
  }
44797
44909
  }
44798
44910
  }).define(async (ctx) => {
@@ -44816,10 +44928,10 @@ app.route({
44816
44928
  title: "在代码仓库中创建文件",
44817
44929
  summary: `在代码仓库中创建文件, encoding 可选,默认 raw`,
44818
44930
  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()
44931
+ repoName: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
44932
+ filePath: exports_external2.string().describe("文件路径, 如 src/index.ts"),
44933
+ content: exports_external2.string().describe("文本的字符串的内容"),
44934
+ encoding: exports_external2.string().describe("编码方式,如 raw").optional()
44823
44935
  }
44824
44936
  })
44825
44937
  }
@@ -44851,7 +44963,7 @@ app.route({
44851
44963
  skill: "delete-repo",
44852
44964
  title: "删除代码仓库",
44853
44965
  args: {
44854
- name: tool.schema.string().describe("代码仓库名称")
44966
+ name: exports_external2.string().describe("代码仓库名称")
44855
44967
  },
44856
44968
  summary: "删除一个代码仓库"
44857
44969
  })
@@ -44885,11 +44997,11 @@ app.route({
44885
44997
  skill: "update-repo-info",
44886
44998
  title: "更新代码仓库信息",
44887
44999
  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()
45000
+ name: exports_external2.string().describe("代码仓库名称"),
45001
+ description: exports_external2.string().describe("代码仓库描述"),
45002
+ license: exports_external2.string().describe("代码仓库许可证类型,如 MIT").optional(),
45003
+ site: exports_external2.string().describe("代码仓库主页链接").optional(),
45004
+ topics: exports_external2.array(exports_external2.string()).describe("代码仓库话题标签列表").optional()
44893
45005
  },
44894
45006
  summary: "更新代码仓库的信息"
44895
45007
  })
@@ -44917,8 +45029,8 @@ app.route({
44917
45029
  middleware: ["auth"],
44918
45030
  metadata: {
44919
45031
  args: {
44920
- name: tool.schema.string().describe("代码仓库名称"),
44921
- visibility: tool.schema.string().describe("代码仓库可见性, public 或 private 或 protected")
45032
+ name: exports_external2.string().describe("代码仓库名称"),
45033
+ visibility: exports_external2.string().describe("代码仓库可见性, public 或 private 或 protected")
44922
45034
  }
44923
45035
  }
44924
45036
  }).define(async (ctx) => {
@@ -44951,10 +45063,10 @@ app.route({
44951
45063
  title: "查询仓库标签列表",
44952
45064
  summary: "查询仓库的标签列表",
44953
45065
  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("标签搜索关键词")
45066
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
45067
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
45068
+ pageSize: exports_external2.number().optional().describe("分页每页大小,默认 30"),
45069
+ keyword: exports_external2.string().optional().describe("标签搜索关键词")
44958
45070
  }
44959
45071
  })
44960
45072
  }
@@ -44986,10 +45098,10 @@ app.route({
44986
45098
  title: "创建仓库标签",
44987
45099
  summary: "创建一个仓库标签",
44988
45100
  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("标签描述")
45101
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
45102
+ name: exports_external2.string().describe("标签名称"),
45103
+ color: exports_external2.string().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
45104
+ description: exports_external2.string().optional().describe("标签描述")
44993
45105
  }
44994
45106
  })
44995
45107
  }
@@ -45021,11 +45133,11 @@ app.route({
45021
45133
  title: "更新仓库标签",
45022
45134
  summary: "更新仓库标签信息",
45023
45135
  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("新标签名称")
45136
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
45137
+ name: exports_external2.string().describe("标签名称"),
45138
+ color: exports_external2.string().optional().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
45139
+ description: exports_external2.string().optional().describe("标签描述"),
45140
+ newName: exports_external2.string().optional().describe("新标签名称")
45029
45141
  }
45030
45142
  })
45031
45143
  }
@@ -45058,8 +45170,8 @@ app.route({
45058
45170
  title: "删除仓库标签",
45059
45171
  summary: "删除指定的仓库标签",
45060
45172
  args: {
45061
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
45062
- name: tool.schema.string().describe("标签名称")
45173
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
45174
+ name: exports_external2.string().describe("标签名称")
45063
45175
  }
45064
45176
  })
45065
45177
  }
@@ -45214,8 +45326,8 @@ app.route({
45214
45326
  tags: [],
45215
45327
  ...{
45216
45328
  args: {
45217
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
45218
- pipelineId: tool.schema.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
45329
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
45330
+ pipelineId: exports_external2.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
45219
45331
  }
45220
45332
  }
45221
45333
  }
@@ -45254,8 +45366,8 @@ app.route({
45254
45366
  tags: [],
45255
45367
  ...{
45256
45368
  args: {
45257
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
45258
- pipelineId: tool.schema.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
45369
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
45370
+ pipelineId: exports_external2.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
45259
45371
  }
45260
45372
  }
45261
45373
  }
@@ -45306,11 +45418,11 @@ app.route({
45306
45418
  title: "云端构建",
45307
45419
  summary: "在云端构建代码仓库,参数包括 event, repo, branch, ref, config, env",
45308
45420
  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")
45421
+ env: exports_external2.any().optional().describe('构建环境变量,格式为 { "KEY": "VALUE" }'),
45422
+ event: exports_external2.string().optional().describe("触发事件类型,例如 api_trigger_event"),
45423
+ branch: exports_external2.string().optional().describe("分支名称,默认主分支"),
45424
+ config: exports_external2.string().describe("构建config文件内容,例如 cloudbuild.yaml对应的yml的内容"),
45425
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo")
45314
45426
  }
45315
45427
  })
45316
45428
  }
@@ -45372,7 +45484,12 @@ app.route({
45372
45484
  const branch = item.branch || "main";
45373
45485
  const repo3 = item.slug;
45374
45486
  const sn = item.sn;
45375
- await cnb.workspace.stopWorkspace({ sn });
45487
+ const res2 = await cnb.workspace.stopWorkspace({ sn });
45488
+ if (res2.code !== 200) {
45489
+ ctx.throw(500, res2.message || "Failed to stop workspace");
45490
+ } else {
45491
+ console.log(`工作区 ${repo3} 停止成功,${res2.data?.buildLogUrl ? `构建日志链接: ${res2.data.buildLogUrl}` : ""}`);
45492
+ }
45376
45493
  if (config3) {
45377
45494
  await cnb.build.startBuild(repo3, { branch, config: config3, event });
45378
45495
  } else {
@@ -45397,9 +45514,9 @@ app.route({
45397
45514
  title: "启动cnb工作空间",
45398
45515
  summary: "启动cnb工作空间",
45399
45516
  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")
45517
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
45518
+ branch: exports_external2.string().optional().describe("分支名称,默认主分支"),
45519
+ ref: exports_external2.string().optional().describe("提交引用,例如 commit sha")
45403
45520
  }
45404
45521
  })
45405
45522
  }
@@ -45429,11 +45546,11 @@ app.route({
45429
45546
  title: "列出cnb工作空间",
45430
45547
  summary: "列出cnb工作空间列表,支持按状态过滤, status 可选值 running 或 closed",
45431
45548
  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("分支名称")
45549
+ status: exports_external2.string().optional().describe("开发环境状态,running: 运行中,closed: 已关闭和停止的"),
45550
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
45551
+ pageSize: exports_external2.number().optional().describe("分页大小,默认 20,最大 100"),
45552
+ slug: exports_external2.string().optional().describe("仓库路径,例如 groupname/reponame"),
45553
+ branch: exports_external2.string().optional().describe("分支名称")
45437
45554
  }
45438
45555
  })
45439
45556
  }
@@ -45459,8 +45576,8 @@ app.route({
45459
45576
  title: "获取工作空间详情",
45460
45577
  summary: "获取工作空间详细信息",
45461
45578
  args: {
45462
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
45463
- sn: tool.schema.string().describe("工作空间流水线的 sn")
45579
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
45580
+ sn: exports_external2.string().describe("工作空间流水线的 sn")
45464
45581
  }
45465
45582
  })
45466
45583
  }
@@ -45489,9 +45606,9 @@ app.route({
45489
45606
  title: "删除工作空间",
45490
45607
  summary: "删除工作空间,pipelineId 和 sn 二选一",
45491
45608
  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("批量流水线构建号")
45609
+ pipelineId: exports_external2.string().optional().describe("流水线 ID,优先使用"),
45610
+ sn: exports_external2.string().optional().describe("流水线构建号"),
45611
+ sns: exports_external2.array(exports_external2.string()).optional().describe("批量流水线构建号")
45495
45612
  }
45496
45613
  })
45497
45614
  }
@@ -45527,8 +45644,8 @@ app.route({
45527
45644
  title: "停止工作空间",
45528
45645
  summary: "停止运行中的工作空间",
45529
45646
  args: {
45530
- pipelineId: tool.schema.string().optional().describe("流水线 ID,优先使用"),
45531
- sn: tool.schema.string().optional().describe("流水线构建号")
45647
+ pipelineId: exports_external2.string().optional().describe("流水线 ID,优先使用"),
45648
+ sn: exports_external2.string().optional().describe("流水线构建号")
45532
45649
  }
45533
45650
  })
45534
45651
  }
@@ -45556,9 +45673,9 @@ app.route({
45556
45673
  title: "调用app应用",
45557
45674
  summary: "调用router的应用, 参数path, key, payload",
45558
45675
  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("调用参数")
45676
+ path: exports_external2.string().describe("应用路径,例如 cnb"),
45677
+ key: exports_external2.string().optional().describe("应用key,例如 list-repos"),
45678
+ payload: exports_external2.object({}).optional().describe("调用参数")
45562
45679
  }
45563
45680
  })
45564
45681
  }
@@ -45605,7 +45722,7 @@ app.route({
45605
45722
  title: "获取当前cnb工作空间的port代理uri",
45606
45723
  summary: "获取当前cnb工作空间的port代理uri,用于端口转发",
45607
45724
  args: {
45608
- port: tool.schema.number().optional().describe("端口号,默认为51515")
45725
+ port: exports_external2.number().optional().describe("端口号,默认为51515")
45609
45726
  }
45610
45727
  })
45611
45728
  }
@@ -45632,11 +45749,11 @@ app.route({
45632
45749
  title: "获取当前cnb工作空间的编辑器访问地址",
45633
45750
  summary: "获取当前cnb工作空间的vscode代理uri,用于在浏览器中访问vscode,包含多种访问方式,如web、vscode、codebuddy、cursor、ssh",
45634
45751
  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")
45752
+ web: exports_external2.boolean().optional().describe("是否获取vscode web的访问uri,默认为false"),
45753
+ vscode: exports_external2.boolean().optional().describe("是否获取vscode的代理uri,默认为true"),
45754
+ codebuddy: exports_external2.boolean().optional().describe("是否获取codebuddy的代理uri,默认为false"),
45755
+ cursor: exports_external2.boolean().optional().describe("是否获取cursor的代理uri,默认为false"),
45756
+ ssh: exports_external2.boolean().optional().describe("是否获取vscode remote ssh的连接字符串,默认为false")
45640
45757
  }
45641
45758
  })
45642
45759
  }
@@ -45695,7 +45812,7 @@ app.route({
45695
45812
  title: "设置当前cnb工作空间的cookie环境变量",
45696
45813
  summary: "设置当前cnb工作空间的cookie环境变量,用于界面操作定制模块功能,例子:CNBSESSION=xxxx;csrfkey=2222xxxx;",
45697
45814
  args: {
45698
- cookie: tool.schema.string().describe("cnb的cookie值")
45815
+ cookie: exports_external2.string().describe("cnb的cookie值")
45699
45816
  }
45700
45817
  })
45701
45818
  }
@@ -46032,8 +46149,8 @@ app.route({
46032
46149
  title: "调用cnb的知识库ai对话功能进行聊天",
46033
46150
  summary: "调用cnb的知识库ai对话功能进行聊天,基于cnb提供的ai能力",
46034
46151
  args: {
46035
- question: tool.schema.string().describe("用户输入的消息内容"),
46036
- repo: tool.schema.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
46152
+ question: exports_external2.string().describe("用户输入的消息内容"),
46153
+ repo: exports_external2.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
46037
46154
  }
46038
46155
  })
46039
46156
  }
@@ -46135,8 +46252,8 @@ app.route({
46135
46252
  title: "调用cnb的知识库RAG查询功能进行问答",
46136
46253
  summary: "调用cnb的知识库RAG查询功能进行问答,基于cnb提供的知识库能力",
46137
46254
  args: {
46138
- question: tool.schema.string().describe("用户输入的消息内容"),
46139
- repo: tool.schema.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
46255
+ question: exports_external2.string().describe("用户输入的消息内容"),
46256
+ repo: exports_external2.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
46140
46257
  }
46141
46258
  })
46142
46259
  }
@@ -46198,13 +46315,13 @@ app.route({
46198
46315
  skill: "list-issues",
46199
46316
  title: "查询 Issue 列表",
46200
46317
  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")
46318
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46319
+ state: exports_external2.string().optional().describe("Issue 状态:open 或 closed"),
46320
+ keyword: exports_external2.string().optional().describe("问题搜索关键词"),
46321
+ labels: exports_external2.string().optional().describe("问题标签,多个用逗号分隔"),
46322
+ page: exports_external2.number().optional().describe("分页页码,默认: 1"),
46323
+ page_size: exports_external2.number().optional().describe("分页每页大小,默认: 30"),
46324
+ order_by: exports_external2.string().optional().describe("排序方式,如 created_at, -updated_at")
46208
46325
  },
46209
46326
  summary: "查询 Issue 列表"
46210
46327
  })
@@ -46248,8 +46365,8 @@ app.route({
46248
46365
  skill: "getIssue",
46249
46366
  title: "获取 单个 Issue",
46250
46367
  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 编号")
46368
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46369
+ issueNumber: exports_external2.union([exports_external2.string(), exports_external2.number()]).describe("Issue 编号")
46253
46370
  },
46254
46371
  summary: "获取 单个 Issue"
46255
46372
  })
@@ -46280,12 +46397,12 @@ app.route({
46280
46397
  skill: "create-issue",
46281
46398
  title: "创建 Issue",
46282
46399
  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("优先级")
46400
+ repo: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
46401
+ title: exports_external2.string().describe("Issue 标题"),
46402
+ body: exports_external2.string().optional().describe("Issue 描述内容"),
46403
+ assignees: exports_external2.array(exports_external2.string()).optional().describe("指派人列表"),
46404
+ labels: exports_external2.array(exports_external2.string()).optional().describe("标签列表"),
46405
+ priority: exports_external2.string().optional().describe("优先级")
46289
46406
  },
46290
46407
  summary: "创建一个新的 Issue"
46291
46408
  })
@@ -46321,9 +46438,9 @@ app.route({
46321
46438
  skill: "complete-issue",
46322
46439
  title: "完成 CNB的任务Issue",
46323
46440
  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")
46441
+ repo: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
46442
+ issueNumber: exports_external2.union([exports_external2.string(), exports_external2.number()]).describe("Issue 编号"),
46443
+ state: exports_external2.string().optional().describe("Issue 状态,默认为 closed")
46327
46444
  },
46328
46445
  summary: "完成一个 Issue(将 state 改为 closed)"
46329
46446
  })
@@ -46356,10 +46473,10 @@ app.route({
46356
46473
  skill: "list-issue-comments",
46357
46474
  title: "查询 Issue 评论列表",
46358
46475
  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")
46476
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46477
+ issueNumber: exports_external2.number().describe("Issue 编号"),
46478
+ page: exports_external2.number().optional().describe("分页页码,默认: 1"),
46479
+ page_size: exports_external2.number().optional().describe("分页每页大小,默认: 30")
46363
46480
  },
46364
46481
  summary: "查询 Issue 评论列表"
46365
46482
  })
@@ -46395,10 +46512,10 @@ app.route({
46395
46512
  skill: "create-issue-comment",
46396
46513
  title: "创建 Issue 评论",
46397
46514
  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")
46515
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46516
+ issueNumber: exports_external2.number().describe("Issue 编号"),
46517
+ body: exports_external2.string().describe("评论内容"),
46518
+ clearAt: exports_external2.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
46402
46519
  },
46403
46520
  summary: "创建 Issue 评论"
46404
46521
  })
@@ -46435,9 +46552,9 @@ app.route({
46435
46552
  skill: "get-issue-comment",
46436
46553
  title: "获取 Issue 评论",
46437
46554
  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")
46555
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46556
+ issueNumber: exports_external2.number().describe("Issue 编号"),
46557
+ commentId: exports_external2.number().describe("评论 ID")
46441
46558
  },
46442
46559
  summary: "获取 Issue 评论"
46443
46560
  })
@@ -46470,11 +46587,11 @@ app.route({
46470
46587
  skill: "update-issue-comment",
46471
46588
  title: "修改 Issue 评论",
46472
46589
  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")
46590
+ repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46591
+ issueNumber: exports_external2.number().describe("Issue 编号"),
46592
+ commentId: exports_external2.number().describe("评论 ID"),
46593
+ body: exports_external2.string().describe("评论内容"),
46594
+ clearAt: exports_external2.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
46478
46595
  },
46479
46596
  summary: "修改 Issue 评论"
46480
46597
  })
@@ -47390,7 +47507,7 @@ app.route({
47390
47507
  };
47391
47508
  }).addTo(app);
47392
47509
 
47393
- // ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.66_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
47510
+ // ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.77_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
47394
47511
  var import_oidc = __toESM(require_dist(), 1);
47395
47512
  var import_oidc2 = __toESM(require_dist(), 1);
47396
47513
  var marker17 = "vercel.ai.gateway.error";
@@ -48456,7 +48573,7 @@ async function getVercelRequestId() {
48456
48573
  var _a92;
48457
48574
  return (_a92 = import_oidc.getContext().headers) == null ? undefined : _a92["x-vercel-id"];
48458
48575
  }
48459
- var VERSION3 = "3.0.66";
48576
+ var VERSION3 = "3.0.77";
48460
48577
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
48461
48578
  function createGatewayProvider(options = {}) {
48462
48579
  var _a92, _b92;
@@ -48612,7 +48729,7 @@ async function getGatewayAuthToken(options) {
48612
48729
  };
48613
48730
  }
48614
48731
 
48615
- // ../../node_modules/.pnpm/ai@6.0.116_zod@4.3.6/node_modules/ai/dist/index.mjs
48732
+ // ../../node_modules/.pnpm/ai@6.0.134_zod@4.3.6/node_modules/ai/dist/index.mjs
48616
48733
  var import_api = __toESM(require_src(), 1);
48617
48734
  var import_api2 = __toESM(require_src(), 1);
48618
48735
  var __defProp4 = Object.defineProperty;
@@ -49183,7 +49300,7 @@ function detectMediaType({
49183
49300
  }
49184
49301
  return;
49185
49302
  }
49186
- var VERSION4 = "6.0.116";
49303
+ var VERSION4 = "6.0.134";
49187
49304
  var download = async ({
49188
49305
  url: url4,
49189
49306
  maxBytes,
@@ -49197,6 +49314,9 @@ var download = async ({
49197
49314
  headers: withUserAgentSuffix({}, `ai-sdk/${VERSION4}`, getRuntimeEnvironmentUserAgent()),
49198
49315
  signal: abortSignal
49199
49316
  });
49317
+ if (response.redirected) {
49318
+ validateDownloadUrl(response.url);
49319
+ }
49200
49320
  if (!response.ok) {
49201
49321
  throw new DownloadError({
49202
49322
  url: urlText,
@@ -49600,7 +49720,7 @@ async function createToolModelOutput({
49600
49720
  toolCallId,
49601
49721
  input,
49602
49722
  output,
49603
- tool: tool22,
49723
+ tool: tool2,
49604
49724
  errorMode
49605
49725
  }) {
49606
49726
  if (errorMode === "text") {
@@ -49608,8 +49728,8 @@ async function createToolModelOutput({
49608
49728
  } else if (errorMode === "json") {
49609
49729
  return { type: "error-json", value: toJSONValue(output) };
49610
49730
  }
49611
- if (tool22 == null ? undefined : tool22.toModelOutput) {
49612
- return await tool22.toModelOutput({ toolCallId, input, output });
49731
+ if (tool2 == null ? undefined : tool2.toModelOutput) {
49732
+ return await tool2.toModelOutput({ toolCallId, input, output });
49613
49733
  }
49614
49734
  return typeof output === "string" ? { type: "text", value: output } : { type: "json", value: toJSONValue(output) };
49615
49735
  }
@@ -49723,8 +49843,8 @@ async function prepareToolsAndToolChoice({
49723
49843
  }
49724
49844
  const filteredTools = activeTools != null ? Object.entries(tools).filter(([name21]) => activeTools.includes(name21)) : Object.entries(tools);
49725
49845
  const languageModelTools = [];
49726
- for (const [name21, tool22] of filteredTools) {
49727
- const toolType = tool22.type;
49846
+ for (const [name21, tool2] of filteredTools) {
49847
+ const toolType = tool2.type;
49728
49848
  switch (toolType) {
49729
49849
  case undefined:
49730
49850
  case "dynamic":
@@ -49732,19 +49852,19 @@ async function prepareToolsAndToolChoice({
49732
49852
  languageModelTools.push({
49733
49853
  type: "function",
49734
49854
  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 } : {}
49855
+ description: tool2.description,
49856
+ inputSchema: await asSchema(tool2.inputSchema).jsonSchema,
49857
+ ...tool2.inputExamples != null ? { inputExamples: tool2.inputExamples } : {},
49858
+ providerOptions: tool2.providerOptions,
49859
+ ...tool2.strict != null ? { strict: tool2.strict } : {}
49740
49860
  });
49741
49861
  break;
49742
49862
  case "provider":
49743
49863
  languageModelTools.push({
49744
49864
  type: "provider",
49745
49865
  name: name21,
49746
- id: tool22.id,
49747
- args: tool22.args
49866
+ id: tool2.id,
49867
+ args: tool2.args
49748
49868
  });
49749
49869
  break;
49750
49870
  default: {
@@ -50510,8 +50630,8 @@ async function executeToolCall({
50510
50630
  onToolCallFinish
50511
50631
  }) {
50512
50632
  const { toolName, toolCallId, input } = toolCall;
50513
- const tool22 = tools == null ? undefined : tools[toolName];
50514
- if ((tool22 == null ? undefined : tool22.execute) == null) {
50633
+ const tool2 = tools == null ? undefined : tools[toolName];
50634
+ if ((tool2 == null ? undefined : tool2.execute) == null) {
50515
50635
  return;
50516
50636
  }
50517
50637
  const baseCallbackEvent = {
@@ -50547,7 +50667,7 @@ async function executeToolCall({
50547
50667
  const startTime = now();
50548
50668
  try {
50549
50669
  const stream = executeTool({
50550
- execute: tool22.execute.bind(tool22),
50670
+ execute: tool2.execute.bind(tool2),
50551
50671
  input,
50552
50672
  options: {
50553
50673
  toolCallId,
@@ -50586,7 +50706,7 @@ async function executeToolCall({
50586
50706
  toolName,
50587
50707
  input,
50588
50708
  error: error49,
50589
- dynamic: tool22.type === "dynamic",
50709
+ dynamic: tool2.type === "dynamic",
50590
50710
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
50591
50711
  };
50592
50712
  }
@@ -50616,7 +50736,7 @@ async function executeToolCall({
50616
50736
  toolName,
50617
50737
  input,
50618
50738
  output,
50619
- dynamic: tool22.type === "dynamic",
50739
+ dynamic: tool2.type === "dynamic",
50620
50740
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
50621
50741
  };
50622
50742
  }
@@ -50658,18 +50778,18 @@ var DefaultGeneratedFile = class {
50658
50778
  }
50659
50779
  };
50660
50780
  async function isApprovalNeeded({
50661
- tool: tool22,
50781
+ tool: tool2,
50662
50782
  toolCall,
50663
50783
  messages,
50664
50784
  experimental_context
50665
50785
  }) {
50666
- if (tool22.needsApproval == null) {
50786
+ if (tool2.needsApproval == null) {
50667
50787
  return false;
50668
50788
  }
50669
- if (typeof tool22.needsApproval === "boolean") {
50670
- return tool22.needsApproval;
50789
+ if (typeof tool2.needsApproval === "boolean") {
50790
+ return tool2.needsApproval;
50671
50791
  }
50672
- return await tool22.needsApproval(toolCall.input, {
50792
+ return await tool2.needsApproval(toolCall.input, {
50673
50793
  toolCallId: toolCall.toolCallId,
50674
50794
  messages,
50675
50795
  experimental_context
@@ -51404,8 +51524,8 @@ async function doParseToolCall({
51404
51524
  tools
51405
51525
  }) {
51406
51526
  const toolName = toolCall.toolName;
51407
- const tool22 = tools[toolName];
51408
- if (tool22 == null) {
51527
+ const tool2 = tools[toolName];
51528
+ if (tool2 == null) {
51409
51529
  if (toolCall.providerExecuted && toolCall.dynamic) {
51410
51530
  return await parseProviderExecutedDynamicToolCall(toolCall);
51411
51531
  }
@@ -51414,7 +51534,7 @@ async function doParseToolCall({
51414
51534
  availableTools: Object.keys(tools)
51415
51535
  });
51416
51536
  }
51417
- const schema = asSchema(tool22.inputSchema);
51537
+ const schema = asSchema(tool2.inputSchema);
51418
51538
  const parseResult = toolCall.input.trim() === "" ? await safeValidateTypes({ value: {}, schema }) : await safeParseJSON({ text: toolCall.input, schema });
51419
51539
  if (parseResult.success === false) {
51420
51540
  throw new InvalidToolInputError({
@@ -51423,7 +51543,7 @@ async function doParseToolCall({
51423
51543
  cause: parseResult.error
51424
51544
  });
51425
51545
  }
51426
- return tool22.type === "dynamic" ? {
51546
+ return tool2.type === "dynamic" ? {
51427
51547
  type: "tool-call",
51428
51548
  toolCallId: toolCall.toolCallId,
51429
51549
  toolName: toolCall.toolName,
@@ -51431,7 +51551,7 @@ async function doParseToolCall({
51431
51551
  providerExecuted: toolCall.providerExecuted,
51432
51552
  providerMetadata: toolCall.providerMetadata,
51433
51553
  dynamic: true,
51434
- title: tool22.title
51554
+ title: tool2.title
51435
51555
  } : {
51436
51556
  type: "tool-call",
51437
51557
  toolCallId: toolCall.toolCallId,
@@ -51439,7 +51559,7 @@ async function doParseToolCall({
51439
51559
  input: parseResult.value,
51440
51560
  providerExecuted: toolCall.providerExecuted,
51441
51561
  providerMetadata: toolCall.providerMetadata,
51442
- title: tool22.title
51562
+ title: tool2.title
51443
51563
  };
51444
51564
  }
51445
51565
  var DefaultStepResult = class {
@@ -51779,7 +51899,7 @@ async function generateText({
51779
51899
  }),
51780
51900
  tracer,
51781
51901
  fn: async (span) => {
51782
- var _a21, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
51902
+ var _a21, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
51783
51903
  const initialMessages = initialPrompt.messages;
51784
51904
  const responseMessages = [];
51785
51905
  const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
@@ -51943,7 +52063,7 @@ async function generateText({
51943
52063
  input: () => stringifyForTelemetry(promptMessages)
51944
52064
  },
51945
52065
  "ai.prompt.tools": {
51946
- input: () => stepTools == null ? undefined : stepTools.map((tool22) => JSON.stringify(tool22))
52066
+ input: () => stepTools == null ? undefined : stepTools.map((tool2) => JSON.stringify(tool2))
51947
52067
  },
51948
52068
  "ai.prompt.toolChoice": {
51949
52069
  input: () => stepToolChoice != null ? JSON.stringify(stepToolChoice) : undefined
@@ -51979,6 +52099,7 @@ async function generateText({
51979
52099
  headers: (_g2 = result.response) == null ? undefined : _g2.headers,
51980
52100
  body: (_h2 = result.response) == null ? undefined : _h2.body
51981
52101
  };
52102
+ const usage = asLanguageModelUsage(result.usage);
51982
52103
  span2.setAttributes(await selectTelemetryAttributes({
51983
52104
  telemetry,
51984
52105
  attributes: {
@@ -51999,8 +52120,16 @@ async function generateText({
51999
52120
  "ai.response.model": responseData.modelId,
52000
52121
  "ai.response.timestamp": responseData.timestamp.toISOString(),
52001
52122
  "ai.response.providerMetadata": JSON.stringify(result.providerMetadata),
52002
- "ai.usage.promptTokens": result.usage.inputTokens.total,
52003
- "ai.usage.completionTokens": result.usage.outputTokens.total,
52123
+ "ai.usage.inputTokens": result.usage.inputTokens.total,
52124
+ "ai.usage.inputTokenDetails.noCacheTokens": result.usage.inputTokens.noCache,
52125
+ "ai.usage.inputTokenDetails.cacheReadTokens": result.usage.inputTokens.cacheRead,
52126
+ "ai.usage.inputTokenDetails.cacheWriteTokens": result.usage.inputTokens.cacheWrite,
52127
+ "ai.usage.outputTokens": result.usage.outputTokens.total,
52128
+ "ai.usage.outputTokenDetails.textTokens": result.usage.outputTokens.text,
52129
+ "ai.usage.outputTokenDetails.reasoningTokens": result.usage.outputTokens.reasoning,
52130
+ "ai.usage.totalTokens": usage.totalTokens,
52131
+ "ai.usage.reasoningTokens": result.usage.outputTokens.reasoning,
52132
+ "ai.usage.cachedInputTokens": result.usage.inputTokens.cacheRead,
52004
52133
  "gen_ai.response.finish_reasons": [
52005
52134
  result.finishReason.unified
52006
52135
  ],
@@ -52026,12 +52155,12 @@ async function generateText({
52026
52155
  if (toolCall.invalid) {
52027
52156
  continue;
52028
52157
  }
52029
- const tool22 = tools == null ? undefined : tools[toolCall.toolName];
52030
- if (tool22 == null) {
52158
+ const tool2 = tools == null ? undefined : tools[toolCall.toolName];
52159
+ if (tool2 == null) {
52031
52160
  continue;
52032
52161
  }
52033
- if ((tool22 == null ? undefined : tool22.onInputAvailable) != null) {
52034
- await tool22.onInputAvailable({
52162
+ if ((tool2 == null ? undefined : tool2.onInputAvailable) != null) {
52163
+ await tool2.onInputAvailable({
52035
52164
  input: toolCall.input,
52036
52165
  toolCallId: toolCall.toolCallId,
52037
52166
  messages: stepInputMessages,
@@ -52040,7 +52169,7 @@ async function generateText({
52040
52169
  });
52041
52170
  }
52042
52171
  if (await isApprovalNeeded({
52043
- tool: tool22,
52172
+ tool: tool2,
52044
52173
  toolCall,
52045
52174
  messages: stepInputMessages,
52046
52175
  experimental_context
@@ -52089,8 +52218,8 @@ async function generateText({
52089
52218
  for (const toolCall of stepToolCalls) {
52090
52219
  if (!toolCall.providerExecuted)
52091
52220
  continue;
52092
- const tool22 = tools == null ? undefined : tools[toolCall.toolName];
52093
- if ((tool22 == null ? undefined : tool22.type) === "provider" && tool22.supportsDeferredResults) {
52221
+ const tool2 = tools == null ? undefined : tools[toolCall.toolName];
52222
+ if ((tool2 == null ? undefined : tool2.type) === "provider" && tool2.supportsDeferredResults) {
52094
52223
  const hasResultInResponse = currentModelResponse.content.some((part) => part.type === "tool-result" && part.toolCallId === toolCall.toolCallId);
52095
52224
  if (!hasResultInResponse) {
52096
52225
  pendingDeferredToolCalls.set(toolCall.toolCallId, {
@@ -52169,9 +52298,7 @@ async function generateText({
52169
52298
  return toolCalls == null ? undefined : JSON.stringify(toolCalls);
52170
52299
  }
52171
52300
  },
52172
- "ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata),
52173
- "ai.usage.promptTokens": currentModelResponse.usage.inputTokens.total,
52174
- "ai.usage.completionTokens": currentModelResponse.usage.outputTokens.total
52301
+ "ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata)
52175
52302
  }
52176
52303
  }));
52177
52304
  const lastStep = steps[steps.length - 1];
@@ -52184,6 +52311,21 @@ async function generateText({
52184
52311
  reasoningTokens: undefined,
52185
52312
  cachedInputTokens: undefined
52186
52313
  });
52314
+ span.setAttributes(await selectTelemetryAttributes({
52315
+ telemetry,
52316
+ attributes: {
52317
+ "ai.usage.inputTokens": totalUsage.inputTokens,
52318
+ "ai.usage.inputTokenDetails.noCacheTokens": (_n = totalUsage.inputTokenDetails) == null ? undefined : _n.noCacheTokens,
52319
+ "ai.usage.inputTokenDetails.cacheReadTokens": (_o = totalUsage.inputTokenDetails) == null ? undefined : _o.cacheReadTokens,
52320
+ "ai.usage.inputTokenDetails.cacheWriteTokens": (_p = totalUsage.inputTokenDetails) == null ? undefined : _p.cacheWriteTokens,
52321
+ "ai.usage.outputTokens": totalUsage.outputTokens,
52322
+ "ai.usage.outputTokenDetails.textTokens": (_q = totalUsage.outputTokenDetails) == null ? undefined : _q.textTokens,
52323
+ "ai.usage.outputTokenDetails.reasoningTokens": (_r = totalUsage.outputTokenDetails) == null ? undefined : _r.reasoningTokens,
52324
+ "ai.usage.totalTokens": totalUsage.totalTokens,
52325
+ "ai.usage.reasoningTokens": (_s = totalUsage.outputTokenDetails) == null ? undefined : _s.reasoningTokens,
52326
+ "ai.usage.cachedInputTokens": (_t = totalUsage.inputTokenDetails) == null ? undefined : _t.cacheReadTokens
52327
+ }
52328
+ }));
52187
52329
  await notify({
52188
52330
  event: {
52189
52331
  stepNumber: lastStep.stepNumber,
@@ -52383,8 +52525,8 @@ function asContent({
52383
52525
  case "tool-result": {
52384
52526
  const toolCall = toolCalls.find((toolCall2) => toolCall2.toolCallId === part.toolCallId);
52385
52527
  if (toolCall == null) {
52386
- const tool22 = tools == null ? undefined : tools[part.toolName];
52387
- const supportsDeferredResults = (tool22 == null ? undefined : tool22.type) === "provider" && tool22.supportsDeferredResults;
52528
+ const tool2 = tools == null ? undefined : tools[part.toolName];
52529
+ const supportsDeferredResults = (tool2 == null ? undefined : tool2.type) === "provider" && tool2.supportsDeferredResults;
52388
52530
  if (!supportsDeferredResults) {
52389
52531
  throw new Error(`Tool call ${part.toolCallId} not found.`);
52390
52532
  }
@@ -52396,7 +52538,8 @@ function asContent({
52396
52538
  input: undefined,
52397
52539
  error: part.result,
52398
52540
  providerExecuted: true,
52399
- dynamic: part.dynamic
52541
+ dynamic: part.dynamic,
52542
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
52400
52543
  });
52401
52544
  } else {
52402
52545
  contentParts.push({
@@ -52406,7 +52549,8 @@ function asContent({
52406
52549
  input: undefined,
52407
52550
  output: part.result,
52408
52551
  providerExecuted: true,
52409
- dynamic: part.dynamic
52552
+ dynamic: part.dynamic,
52553
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
52410
52554
  });
52411
52555
  }
52412
52556
  break;
@@ -52419,7 +52563,8 @@ function asContent({
52419
52563
  input: toolCall.input,
52420
52564
  error: part.result,
52421
52565
  providerExecuted: true,
52422
- dynamic: toolCall.dynamic
52566
+ dynamic: toolCall.dynamic,
52567
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
52423
52568
  });
52424
52569
  } else {
52425
52570
  contentParts.push({
@@ -52429,7 +52574,8 @@ function asContent({
52429
52574
  input: toolCall.input,
52430
52575
  output: part.result,
52431
52576
  providerExecuted: true,
52432
- dynamic: toolCall.dynamic
52577
+ dynamic: toolCall.dynamic,
52578
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
52433
52579
  });
52434
52580
  }
52435
52581
  break;
@@ -52535,6 +52681,7 @@ var uiMessageChunkSchema = lazySchema(() => zodSchema(exports_external2.union([
52535
52681
  toolCallId: exports_external2.string(),
52536
52682
  output: exports_external2.unknown(),
52537
52683
  providerExecuted: exports_external2.boolean().optional(),
52684
+ providerMetadata: providerMetadataSchema.optional(),
52538
52685
  dynamic: exports_external2.boolean().optional(),
52539
52686
  preliminary: exports_external2.boolean().optional()
52540
52687
  }),
@@ -52543,6 +52690,7 @@ var uiMessageChunkSchema = lazySchema(() => zodSchema(exports_external2.union([
52543
52690
  toolCallId: exports_external2.string(),
52544
52691
  errorText: exports_external2.string(),
52545
52692
  providerExecuted: exports_external2.boolean().optional(),
52693
+ providerMetadata: providerMetadataSchema.optional(),
52546
52694
  dynamic: exports_external2.boolean().optional()
52547
52695
  }),
52548
52696
  exports_external2.strictObject({
@@ -52741,6 +52889,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
52741
52889
  output: exports_external2.unknown(),
52742
52890
  errorText: exports_external2.never().optional(),
52743
52891
  callProviderMetadata: providerMetadataSchema.optional(),
52892
+ resultProviderMetadata: providerMetadataSchema.optional(),
52744
52893
  preliminary: exports_external2.boolean().optional(),
52745
52894
  approval: exports_external2.object({
52746
52895
  id: exports_external2.string(),
@@ -52759,6 +52908,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
52759
52908
  output: exports_external2.never().optional(),
52760
52909
  errorText: exports_external2.string(),
52761
52910
  callProviderMetadata: providerMetadataSchema.optional(),
52911
+ resultProviderMetadata: providerMetadataSchema.optional(),
52762
52912
  approval: exports_external2.object({
52763
52913
  id: exports_external2.string(),
52764
52914
  approved: exports_external2.literal(true),
@@ -52842,6 +52992,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
52842
52992
  output: exports_external2.unknown(),
52843
52993
  errorText: exports_external2.never().optional(),
52844
52994
  callProviderMetadata: providerMetadataSchema.optional(),
52995
+ resultProviderMetadata: providerMetadataSchema.optional(),
52845
52996
  preliminary: exports_external2.boolean().optional(),
52846
52997
  approval: exports_external2.object({
52847
52998
  id: exports_external2.string(),
@@ -52859,6 +53010,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
52859
53010
  output: exports_external2.never().optional(),
52860
53011
  errorText: exports_external2.string(),
52861
53012
  callProviderMetadata: providerMetadataSchema.optional(),
53013
+ resultProviderMetadata: providerMetadataSchema.optional(),
52862
53014
  approval: exports_external2.object({
52863
53015
  id: exports_external2.string(),
52864
53016
  approved: exports_external2.literal(true),
@@ -53245,7 +53397,7 @@ var createTool = async (app2, message) => {
53245
53397
  console.error(`未找到路径 ${message.path} 和 key ${message.key} 的路由`);
53246
53398
  return null;
53247
53399
  }
53248
- const _tool = tool2({
53400
+ const _tool = tool({
53249
53401
  description: route?.metadata?.summary || route?.description || "无描述",
53250
53402
  inputSchema: zod_default.object({
53251
53403
  ...route.metadata?.args
@@ -53391,10 +53543,10 @@ app.route({
53391
53543
  title: "查询 Issue 标签列表",
53392
53544
  summary: "查询 Issue 的标签列表",
53393
53545
  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")
53546
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53547
+ issueNumber: exports_external2.number().describe("Issue 编号"),
53548
+ page: exports_external2.number().optional().describe("分页页码,默认 1"),
53549
+ pageSize: exports_external2.number().optional().describe("分页每页大小,默认 30")
53398
53550
  }
53399
53551
  })
53400
53552
  }
@@ -53428,9 +53580,9 @@ app.route({
53428
53580
  title: "设置 Issue 标签",
53429
53581
  summary: "设置 Issue 标签(完全替换现有标签)",
53430
53582
  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("标签名称数组")
53583
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53584
+ issueNumber: exports_external2.number().describe("Issue 编号"),
53585
+ labels: exports_external2.array(exports_external2.string()).describe("标签名称数组")
53434
53586
  }
53435
53587
  })
53436
53588
  }
@@ -53463,9 +53615,9 @@ app.route({
53463
53615
  title: "新增 Issue 标签",
53464
53616
  summary: "新增 Issue 标签(追加到现有标签)",
53465
53617
  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("标签名称数组")
53618
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53619
+ issueNumber: exports_external2.number().describe("Issue 编号"),
53620
+ labels: exports_external2.array(exports_external2.string()).describe("标签名称数组")
53469
53621
  }
53470
53622
  })
53471
53623
  }
@@ -53498,8 +53650,8 @@ app.route({
53498
53650
  title: "清空 Issue 标签",
53499
53651
  summary: "清空 Issue 标签(移除所有标签)",
53500
53652
  args: {
53501
- repo: tool.schema.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53502
- issueNumber: tool.schema.number().describe("Issue 编号")
53653
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53654
+ issueNumber: exports_external2.number().describe("Issue 编号")
53503
53655
  }
53504
53656
  })
53505
53657
  }
@@ -53528,9 +53680,9 @@ app.route({
53528
53680
  title: "删除 Issue 标签",
53529
53681
  summary: "删除 Issue 指定标签",
53530
53682
  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("标签名称")
53683
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53684
+ issueNumber: exports_external2.number().describe("Issue 编号"),
53685
+ name: exports_external2.string().describe("标签名称")
53534
53686
  }
53535
53687
  })
53536
53688
  }
@@ -53552,6 +53704,330 @@ app.route({
53552
53704
  ctx.forward(res);
53553
53705
  }).addTo(app);
53554
53706
 
53707
+ // agent/routes/package/registry.ts
53708
+ app.route({
53709
+ path: "cnb",
53710
+ key: "list-group-registries",
53711
+ description: "查询组织下的制品库列表, 参数 slug",
53712
+ middleware: ["auth"],
53713
+ metadata: {
53714
+ tags: ["package"],
53715
+ ...createSkill({
53716
+ skill: "list-group-registries",
53717
+ title: "查询制品库列表",
53718
+ args: {
53719
+ slug: exports_external2.string().describe("组织 slug, 如 my-org"),
53720
+ page: exports_external2.number().describe("页码").optional(),
53721
+ page_size: exports_external2.number().describe("每页数量").optional(),
53722
+ registry_type: exports_external2.string().describe("制品仓库类型: npm, maven, ohpm").optional(),
53723
+ filter_type: exports_external2.string().describe("制品仓库可见性: private, public").optional(),
53724
+ order_by: exports_external2.string().describe("排序字段: created_at, name").optional()
53725
+ },
53726
+ summary: "查询组织下的制品库列表"
53727
+ })
53728
+ }
53729
+ }).define(async (ctx) => {
53730
+ const cnb = await cnbManager.getContext(ctx);
53731
+ const slug = ctx.query?.slug;
53732
+ const { page, page_size, registry_type, filter_type, order_by } = ctx.query || {};
53733
+ if (!slug) {
53734
+ ctx.throw(400, "缺少参数 slug");
53735
+ }
53736
+ const res = await cnb.packages.registry.listGroupRegistries(slug, {
53737
+ page,
53738
+ page_size,
53739
+ registry_type,
53740
+ filter_type,
53741
+ order_by
53742
+ });
53743
+ ctx.forward(res);
53744
+ }).addTo(app);
53745
+ app.route({
53746
+ path: "cnb",
53747
+ key: "set-registry-visibility",
53748
+ description: "设置制品库可见性, 参数 registry, visibility",
53749
+ middleware: ["auth"],
53750
+ metadata: {
53751
+ tags: ["package"],
53752
+ ...createSkill({
53753
+ skill: "set-registry-visibility",
53754
+ title: "设置制品库可见性",
53755
+ args: {
53756
+ registry: exports_external2.string().describe("制品库路径, 如 my-org/my-registry"),
53757
+ visibility: exports_external2.string().describe("可见性: private 或 public")
53758
+ },
53759
+ summary: "设置制品库的可见性"
53760
+ })
53761
+ }
53762
+ }).define(async (ctx) => {
53763
+ const cnb = await cnbManager.getContext(ctx);
53764
+ const registry4 = ctx.query?.registry;
53765
+ const visibility = ctx.query?.visibility;
53766
+ if (!registry4) {
53767
+ ctx.throw(400, "缺少参数 registry");
53768
+ }
53769
+ if (!visibility) {
53770
+ ctx.throw(400, "缺少参数 visibility");
53771
+ }
53772
+ const res = await cnb.packages.registry.setVisibility(registry4, { visibility });
53773
+ ctx.forward(res);
53774
+ }).addTo(app);
53775
+ app.route({
53776
+ path: "cnb",
53777
+ key: "delete-registry",
53778
+ description: "删除制品库, 参数 registry",
53779
+ middleware: ["auth"],
53780
+ metadata: {
53781
+ tags: ["package"],
53782
+ ...createSkill({
53783
+ skill: "delete-registry",
53784
+ title: "删除制品库",
53785
+ args: {
53786
+ registry: exports_external2.string().describe("制品库路径, 如 my-org/my-registry")
53787
+ },
53788
+ summary: "删除指定的制品库"
53789
+ })
53790
+ }
53791
+ }).define(async (ctx) => {
53792
+ const cnb = await cnbManager.getContext(ctx);
53793
+ const registry4 = ctx.query?.registry;
53794
+ if (!registry4) {
53795
+ ctx.throw(400, "缺少参数 registry");
53796
+ }
53797
+ const res = await cnb.packages.registry.remove(registry4);
53798
+ ctx.forward(res);
53799
+ }).addTo(app);
53800
+
53801
+ // agent/routes/package/package.ts
53802
+ app.route({
53803
+ path: "cnb",
53804
+ key: "list-packages",
53805
+ description: "查询制品列表, 参数 slug, type",
53806
+ middleware: ["auth"],
53807
+ metadata: {
53808
+ tags: ["package"],
53809
+ ...createSkill({
53810
+ skill: "list-packages",
53811
+ title: "查询制品列表",
53812
+ args: {
53813
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
53814
+ type: exports_external2.string().describe("制品类型: all, docker, helm, docker-model, maven, npm, ohpm, pypi, nuget, composer, conan, cargo"),
53815
+ ordering: exports_external2.string().describe("排序类型: pull_count, last_push_at, name_ascend, name_descend").optional(),
53816
+ name: exports_external2.string().describe("关键字,搜索制品名称").optional(),
53817
+ page: exports_external2.number().describe("页码").optional(),
53818
+ page_size: exports_external2.number().describe("每页数量").optional()
53819
+ },
53820
+ summary: "查询制品列表"
53821
+ })
53822
+ }
53823
+ }).define(async (ctx) => {
53824
+ const cnb = await cnbManager.getContext(ctx);
53825
+ const slug = ctx.query?.slug;
53826
+ const type = ctx.query?.type;
53827
+ const { ordering, name: name21, page, page_size } = ctx.query || {};
53828
+ if (!slug) {
53829
+ ctx.throw(400, "缺少参数 slug");
53830
+ }
53831
+ if (!type) {
53832
+ ctx.throw(400, "缺少参数 type");
53833
+ }
53834
+ const res = await cnb.packages.package.list(slug, type, {
53835
+ ordering,
53836
+ name: name21,
53837
+ page,
53838
+ page_size
53839
+ });
53840
+ ctx.forward(res);
53841
+ }).addTo(app);
53842
+ app.route({
53843
+ path: "cnb",
53844
+ key: "get-package",
53845
+ description: "获取制品详情, 参数 slug, type, name",
53846
+ middleware: ["auth"],
53847
+ metadata: {
53848
+ tags: ["package"],
53849
+ ...createSkill({
53850
+ skill: "get-package",
53851
+ title: "获取制品详情",
53852
+ args: {
53853
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
53854
+ type: exports_external2.string().describe("制品类型"),
53855
+ name: exports_external2.string().describe("制品名称")
53856
+ },
53857
+ summary: "获取指定制品的详细信息"
53858
+ })
53859
+ }
53860
+ }).define(async (ctx) => {
53861
+ const cnb = await cnbManager.getContext(ctx);
53862
+ const slug = ctx.query?.slug;
53863
+ const type = ctx.query?.type;
53864
+ const name21 = ctx.query?.name;
53865
+ if (!slug) {
53866
+ ctx.throw(400, "缺少参数 slug");
53867
+ }
53868
+ if (!type) {
53869
+ ctx.throw(400, "缺少参数 type");
53870
+ }
53871
+ if (!name21) {
53872
+ ctx.throw(400, "缺少参数 name");
53873
+ }
53874
+ const res = await cnb.packages.package.getOne(slug, type, name21);
53875
+ ctx.forward(res);
53876
+ }).addTo(app);
53877
+ app.route({
53878
+ path: "cnb",
53879
+ key: "delete-package",
53880
+ description: "删除制品, 参数 slug, type, name",
53881
+ middleware: ["auth"],
53882
+ metadata: {
53883
+ tags: ["package"],
53884
+ ...createSkill({
53885
+ skill: "delete-package",
53886
+ title: "删除制品",
53887
+ args: {
53888
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
53889
+ type: exports_external2.string().describe("制品类型"),
53890
+ name: exports_external2.string().describe("制品名称")
53891
+ },
53892
+ summary: "删除指定的制品"
53893
+ })
53894
+ }
53895
+ }).define(async (ctx) => {
53896
+ const cnb = await cnbManager.getContext(ctx);
53897
+ const slug = ctx.query?.slug;
53898
+ const type = ctx.query?.type;
53899
+ const name21 = ctx.query?.name;
53900
+ if (!slug) {
53901
+ ctx.throw(400, "缺少参数 slug");
53902
+ }
53903
+ if (!type) {
53904
+ ctx.throw(400, "缺少参数 type");
53905
+ }
53906
+ if (!name21) {
53907
+ ctx.throw(400, "缺少参数 name");
53908
+ }
53909
+ const res = await cnb.packages.package.remove(slug, type, name21);
53910
+ ctx.forward(res);
53911
+ }).addTo(app);
53912
+ app.route({
53913
+ path: "cnb",
53914
+ key: "list-package-tags",
53915
+ description: "获取制品标签列表, 参数 slug, type, name",
53916
+ middleware: ["auth"],
53917
+ metadata: {
53918
+ tags: ["package"],
53919
+ ...createSkill({
53920
+ skill: "list-package-tags",
53921
+ title: "获取制品标签列表",
53922
+ args: {
53923
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
53924
+ type: exports_external2.string().describe("制品类型"),
53925
+ name: exports_external2.string().describe("制品名称"),
53926
+ page: exports_external2.number().describe("页码").optional(),
53927
+ page_size: exports_external2.number().describe("每页数量").optional()
53928
+ },
53929
+ summary: "获取制品的标签列表"
53930
+ })
53931
+ }
53932
+ }).define(async (ctx) => {
53933
+ const cnb = await cnbManager.getContext(ctx);
53934
+ const slug = ctx.query?.slug;
53935
+ const type = ctx.query?.type;
53936
+ const name21 = ctx.query?.name;
53937
+ const { page, page_size } = ctx.query || {};
53938
+ if (!slug) {
53939
+ ctx.throw(400, "缺少参数 slug");
53940
+ }
53941
+ if (!type) {
53942
+ ctx.throw(400, "缺少参数 type");
53943
+ }
53944
+ if (!name21) {
53945
+ ctx.throw(400, "缺少参数 name");
53946
+ }
53947
+ const res = await cnb.packages.package.listTags(slug, type, name21, { page, page_size });
53948
+ ctx.forward(res);
53949
+ }).addTo(app);
53950
+ app.route({
53951
+ path: "cnb",
53952
+ key: "get-package-tag",
53953
+ description: "获取制品标签详情, 参数 slug, type, name, tag",
53954
+ middleware: ["auth"],
53955
+ metadata: {
53956
+ tags: ["package"],
53957
+ ...createSkill({
53958
+ skill: "get-package-tag",
53959
+ title: "获取制品标签详情",
53960
+ args: {
53961
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
53962
+ type: exports_external2.string().describe("制品类型"),
53963
+ name: exports_external2.string().describe("制品名称"),
53964
+ tag: exports_external2.string().describe("标签名称")
53965
+ },
53966
+ summary: "获取制品标签的详细信息"
53967
+ })
53968
+ }
53969
+ }).define(async (ctx) => {
53970
+ const cnb = await cnbManager.getContext(ctx);
53971
+ const slug = ctx.query?.slug;
53972
+ const type = ctx.query?.type;
53973
+ const name21 = ctx.query?.name;
53974
+ const tag = ctx.query?.tag;
53975
+ if (!slug) {
53976
+ ctx.throw(400, "缺少参数 slug");
53977
+ }
53978
+ if (!type) {
53979
+ ctx.throw(400, "缺少参数 type");
53980
+ }
53981
+ if (!name21) {
53982
+ ctx.throw(400, "缺少参数 name");
53983
+ }
53984
+ if (!tag) {
53985
+ ctx.throw(400, "缺少参数 tag");
53986
+ }
53987
+ const res = await cnb.packages.package.getTag(slug, type, name21, tag);
53988
+ ctx.forward(res);
53989
+ }).addTo(app);
53990
+ app.route({
53991
+ path: "cnb",
53992
+ key: "delete-package-tag",
53993
+ description: "删除制品标签, 参数 slug, type, name, tag",
53994
+ middleware: ["auth"],
53995
+ metadata: {
53996
+ tags: ["package"],
53997
+ ...createSkill({
53998
+ skill: "delete-package-tag",
53999
+ title: "删除制品标签",
54000
+ args: {
54001
+ slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
54002
+ type: exports_external2.string().describe("制品类型"),
54003
+ name: exports_external2.string().describe("制品名称"),
54004
+ tag: exports_external2.string().describe("标签名称")
54005
+ },
54006
+ summary: "删除制品的指定标签"
54007
+ })
54008
+ }
54009
+ }).define(async (ctx) => {
54010
+ const cnb = await cnbManager.getContext(ctx);
54011
+ const slug = ctx.query?.slug;
54012
+ const type = ctx.query?.type;
54013
+ const name21 = ctx.query?.name;
54014
+ const tag = ctx.query?.tag;
54015
+ if (!slug) {
54016
+ ctx.throw(400, "缺少参数 slug");
54017
+ }
54018
+ if (!type) {
54019
+ ctx.throw(400, "缺少参数 type");
54020
+ }
54021
+ if (!name21) {
54022
+ ctx.throw(400, "缺少参数 name");
54023
+ }
54024
+ if (!tag) {
54025
+ ctx.throw(400, "缺少参数 tag");
54026
+ }
54027
+ const res = await cnb.packages.package.removeTag(slug, type, name21, tag);
54028
+ ctx.forward(res);
54029
+ }).addTo(app);
54030
+
53555
54031
  // agent/routes/index.ts
53556
54032
  var checkAppId = (ctx, appId) => {
53557
54033
  const _appId = ctx?.app?.appId;
@@ -54866,7 +55342,7 @@ __export4(exports_external3, {
54866
55342
  safeEncode: () => safeEncode22,
54867
55343
  safeDecodeAsync: () => safeDecodeAsync22,
54868
55344
  safeDecode: () => safeDecode22,
54869
- registry: () => registry3,
55345
+ registry: () => registry4,
54870
55346
  regexes: () => exports_regexes3,
54871
55347
  regex: () => _regex3,
54872
55348
  refine: () => refine3,
@@ -55074,7 +55550,7 @@ __export4(exports_core22, {
55074
55550
  safeEncode: () => safeEncode6,
55075
55551
  safeDecodeAsync: () => safeDecodeAsync6,
55076
55552
  safeDecode: () => safeDecode6,
55077
- registry: () => registry3,
55553
+ registry: () => registry4,
55078
55554
  regexes: () => exports_regexes3,
55079
55555
  process: () => process5,
55080
55556
  prettifyError: () => prettifyError3,
@@ -64525,10 +65001,10 @@ class $ZodRegistry3 {
64525
65001
  return this._map.has(schema);
64526
65002
  }
64527
65003
  }
64528
- function registry3() {
65004
+ function registry4() {
64529
65005
  return new $ZodRegistry3;
64530
65006
  }
64531
- (_a21 = globalThis).__zod_globalRegistry ?? (_a21.__zod_globalRegistry = registry3());
65007
+ (_a21 = globalThis).__zod_globalRegistry ?? (_a21.__zod_globalRegistry = registry4());
64532
65008
  var globalRegistry3 = globalThis.__zod_globalRegistry;
64533
65009
  function _string3(Class22, params) {
64534
65010
  return new Class22({
@@ -68303,7 +68779,7 @@ function customAlphabet2(alphabet, size = 21) {
68303
68779
  }
68304
68780
  var import_md52 = __toESM4(require_md52(), 1);
68305
68781
  var nanoid32 = customAlphabet2("abcdefghijklmnopqrstuvwxyz", 16);
68306
- var tool4 = {
68782
+ var tool2 = {
68307
68783
  schema: exports_external3
68308
68784
  };
68309
68785
  var createSkill2 = (skill) => {
@@ -68677,9 +69153,9 @@ var addCallFn = (app3) => {
68677
69153
 
68678
69154
  `,
68679
69155
  args: {
68680
- path: tool4.schema.string().describe("应用路径,例如 cnb"),
68681
- key: tool4.schema.string().optional().describe("应用key,例如 list-repos"),
68682
- payload: tool4.schema.object({}).optional().describe('调用参数, 为对象, 例如 { "query": "javascript" }')
69156
+ path: tool2.schema.string().describe("应用路径,例如 cnb"),
69157
+ key: tool2.schema.string().optional().describe("应用key,例如 list-repos"),
69158
+ payload: tool2.schema.object({}).optional().describe('调用参数, 为对象, 例如 { "query": "javascript" }')
68683
69159
  }
68684
69160
  })
68685
69161
  }