@kevisual/cnb 0.0.55 → 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,22 +44822,27 @@ app.route({
44710
44822
  title: "列出cnb代码仓库",
44711
44823
  summary: "列出cnb代码仓库, 可选flags参数,如 KnowledgeBase",
44712
44824
  args: {
44713
- search: tool.schema.string().optional().describe("搜索关键词"),
44714
- pageSize: tool.schema.number().optional().describe("每页数量,默认999"),
44715
- 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")
44716
44829
  }
44717
44830
  })
44718
44831
  }
44719
44832
  }).define(async (ctx) => {
44720
44833
  const cnb = await cnbManager.getContext(ctx);
44721
44834
  const search = ctx.query?.search;
44722
- const pageSize = ctx.query?.pageSize || 9999;
44835
+ const page = ctx.query?.page || 1;
44836
+ let pageSize = ctx.query?.pageSize || 99;
44723
44837
  const flags = ctx.query?.flags;
44724
44838
  const params = {};
44725
44839
  if (flags) {
44726
44840
  params.flags = flags;
44727
44841
  }
44728
- const res = await cnb.repo.getRepoList({ search, page_size: pageSize, role: "developer", ...params });
44842
+ if (pageSize > 99) {
44843
+ pageSize = 99;
44844
+ }
44845
+ const res = await cnb.repo.getRepoList({ search, page, page_size: pageSize + 1, role: "developer", ...params });
44729
44846
  if (res.code === 200) {
44730
44847
  const repos = res.data.map((item) => ({
44731
44848
  name: item.name,
@@ -44733,7 +44850,9 @@ app.route({
44733
44850
  description: item.description,
44734
44851
  web_url: item.web_url
44735
44852
  }));
44736
- ctx.body = { content: JSON.stringify(repos), list: res.data };
44853
+ const list = repos.slice(0, pageSize);
44854
+ const hasMore = repos.length > pageSize;
44855
+ ctx.body = { content: JSON.stringify(repos), list, hasMore, page, pageSize };
44737
44856
  } else {
44738
44857
  ctx.throw(500, "获取仓库列表失败");
44739
44858
  }
@@ -44751,9 +44870,9 @@ app.route({
44751
44870
  skill: "create-repo",
44752
44871
  title: "创建代码仓库",
44753
44872
  args: {
44754
- name: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
44755
- visibility: tool.schema.string().describe("代码仓库可见性, public 或 private").default("public"),
44756
- 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("代码仓库描述")
44757
44876
  },
44758
44877
  summary: "创建一个新的代码仓库"
44759
44878
  })
@@ -44785,7 +44904,7 @@ app.route({
44785
44904
  middleware: ["auth"],
44786
44905
  metadata: {
44787
44906
  args: {
44788
- name: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo")
44907
+ name: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo")
44789
44908
  }
44790
44909
  }
44791
44910
  }).define(async (ctx) => {
@@ -44809,10 +44928,10 @@ app.route({
44809
44928
  title: "在代码仓库中创建文件",
44810
44929
  summary: `在代码仓库中创建文件, encoding 可选,默认 raw`,
44811
44930
  args: {
44812
- repoName: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
44813
- filePath: tool.schema.string().describe("文件路径, 如 src/index.ts"),
44814
- content: tool.schema.string().describe("文本的字符串的内容"),
44815
- 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()
44816
44935
  }
44817
44936
  })
44818
44937
  }
@@ -44844,7 +44963,7 @@ app.route({
44844
44963
  skill: "delete-repo",
44845
44964
  title: "删除代码仓库",
44846
44965
  args: {
44847
- name: tool.schema.string().describe("代码仓库名称")
44966
+ name: exports_external2.string().describe("代码仓库名称")
44848
44967
  },
44849
44968
  summary: "删除一个代码仓库"
44850
44969
  })
@@ -44878,11 +44997,11 @@ app.route({
44878
44997
  skill: "update-repo-info",
44879
44998
  title: "更新代码仓库信息",
44880
44999
  args: {
44881
- name: tool.schema.string().describe("代码仓库名称"),
44882
- description: tool.schema.string().describe("代码仓库描述"),
44883
- license: tool.schema.string().describe("代码仓库许可证类型,如 MIT").optional(),
44884
- site: tool.schema.string().describe("代码仓库主页链接").optional(),
44885
- 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()
44886
45005
  },
44887
45006
  summary: "更新代码仓库的信息"
44888
45007
  })
@@ -44910,8 +45029,8 @@ app.route({
44910
45029
  middleware: ["auth"],
44911
45030
  metadata: {
44912
45031
  args: {
44913
- name: tool.schema.string().describe("代码仓库名称"),
44914
- visibility: tool.schema.string().describe("代码仓库可见性, public 或 private 或 protected")
45032
+ name: exports_external2.string().describe("代码仓库名称"),
45033
+ visibility: exports_external2.string().describe("代码仓库可见性, public 或 private 或 protected")
44915
45034
  }
44916
45035
  }
44917
45036
  }).define(async (ctx) => {
@@ -44944,10 +45063,10 @@ app.route({
44944
45063
  title: "查询仓库标签列表",
44945
45064
  summary: "查询仓库的标签列表",
44946
45065
  args: {
44947
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
44948
- page: tool.schema.number().optional().describe("分页页码,默认 1"),
44949
- pageSize: tool.schema.number().optional().describe("分页每页大小,默认 30"),
44950
- 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("标签搜索关键词")
44951
45070
  }
44952
45071
  })
44953
45072
  }
@@ -44979,10 +45098,10 @@ app.route({
44979
45098
  title: "创建仓库标签",
44980
45099
  summary: "创建一个仓库标签",
44981
45100
  args: {
44982
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
44983
- name: tool.schema.string().describe("标签名称"),
44984
- color: tool.schema.string().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
44985
- 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("标签描述")
44986
45105
  }
44987
45106
  })
44988
45107
  }
@@ -45014,11 +45133,11 @@ app.route({
45014
45133
  title: "更新仓库标签",
45015
45134
  summary: "更新仓库标签信息",
45016
45135
  args: {
45017
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
45018
- name: tool.schema.string().describe("标签名称"),
45019
- color: tool.schema.string().optional().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
45020
- description: tool.schema.string().optional().describe("标签描述"),
45021
- 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("新标签名称")
45022
45141
  }
45023
45142
  })
45024
45143
  }
@@ -45051,8 +45170,8 @@ app.route({
45051
45170
  title: "删除仓库标签",
45052
45171
  summary: "删除指定的仓库标签",
45053
45172
  args: {
45054
- repo: tool.schema.string().describe("仓库路径, 如 my-user/my-repo"),
45055
- name: tool.schema.string().describe("标签名称")
45173
+ repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
45174
+ name: exports_external2.string().describe("标签名称")
45056
45175
  }
45057
45176
  })
45058
45177
  }
@@ -45207,8 +45326,8 @@ app.route({
45207
45326
  tags: [],
45208
45327
  ...{
45209
45328
  args: {
45210
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
45211
- 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")
45212
45331
  }
45213
45332
  }
45214
45333
  }
@@ -45247,8 +45366,8 @@ app.route({
45247
45366
  tags: [],
45248
45367
  ...{
45249
45368
  args: {
45250
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
45251
- 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")
45252
45371
  }
45253
45372
  }
45254
45373
  }
@@ -45299,11 +45418,11 @@ app.route({
45299
45418
  title: "云端构建",
45300
45419
  summary: "在云端构建代码仓库,参数包括 event, repo, branch, ref, config, env",
45301
45420
  args: {
45302
- env: tool.schema.any().optional().describe('构建环境变量,格式为 { "KEY": "VALUE" }'),
45303
- event: tool.schema.string().optional().describe("触发事件类型,例如 api_trigger_event"),
45304
- branch: tool.schema.string().optional().describe("分支名称,默认主分支"),
45305
- config: tool.schema.string().describe("构建config文件内容,例如 cloudbuild.yaml对应的yml的内容"),
45306
- 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")
45307
45426
  }
45308
45427
  })
45309
45428
  }
@@ -45326,6 +45445,62 @@ app.route({
45326
45445
  ctx.forward(res);
45327
45446
  }).addTo(app);
45328
45447
 
45448
+ // agent/routes/workspace/rerun.ts
45449
+ app.route({
45450
+ path: "cnb",
45451
+ key: "rerun",
45452
+ description: "重新启动工作区,定时任务",
45453
+ middleware: ["auth"],
45454
+ metadata: {
45455
+ args: {
45456
+ repo: zod_default.string().optional().describe("仓库名称,例如:owner/repo"),
45457
+ config: zod_default.string().optional().describe("工作区配置"),
45458
+ event: zod_default.string().optional().describe("触发事件来源,api_trigger_event")
45459
+ }
45460
+ }
45461
+ }).define(async (ctx) => {
45462
+ const cnb = await cnbManager.getContext(ctx);
45463
+ const repo2 = ctx.args.repo;
45464
+ const config3 = ctx.args.config;
45465
+ const event = ctx.args.event || "api_trigger_event";
45466
+ const res = await cnb.workspace.list({ status: "running" });
45467
+ if (res.code !== 200) {
45468
+ ctx.throw(500, res.message || "Failed to list workspaces");
45469
+ }
45470
+ const list = res.data?.list || [];
45471
+ const _list = list.filter((item) => {
45472
+ if (repo2) {
45473
+ if (item.slug === repo2) {
45474
+ return true;
45475
+ }
45476
+ } else {
45477
+ if (item.slug.includes("/dev")) {
45478
+ return true;
45479
+ }
45480
+ }
45481
+ return false;
45482
+ });
45483
+ for (const item of _list) {
45484
+ const branch = item.branch || "main";
45485
+ const repo3 = item.slug;
45486
+ const sn = item.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
+ }
45493
+ if (config3) {
45494
+ await cnb.build.startBuild(repo3, { branch, config: config3, event });
45495
+ } else {
45496
+ await cnb.workspace.startWorkspace(repo3, { branch });
45497
+ }
45498
+ }
45499
+ ctx.body = {
45500
+ content: "工作区重新启动中"
45501
+ };
45502
+ }).addTo(app);
45503
+
45329
45504
  // agent/routes/workspace/index.ts
45330
45505
  app.route({
45331
45506
  path: "cnb",
@@ -45339,9 +45514,9 @@ app.route({
45339
45514
  title: "启动cnb工作空间",
45340
45515
  summary: "启动cnb工作空间",
45341
45516
  args: {
45342
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
45343
- branch: tool.schema.string().optional().describe("分支名称,默认主分支"),
45344
- 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")
45345
45520
  }
45346
45521
  })
45347
45522
  }
@@ -45371,11 +45546,11 @@ app.route({
45371
45546
  title: "列出cnb工作空间",
45372
45547
  summary: "列出cnb工作空间列表,支持按状态过滤, status 可选值 running 或 closed",
45373
45548
  args: {
45374
- status: tool.schema.string().optional().describe("开发环境状态,running: 运行中,closed: 已关闭和停止的"),
45375
- page: tool.schema.number().optional().describe("分页页码,默认 1"),
45376
- pageSize: tool.schema.number().optional().describe("分页大小,默认 20,最大 100"),
45377
- slug: tool.schema.string().optional().describe("仓库路径,例如 groupname/reponame"),
45378
- 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("分支名称")
45379
45554
  }
45380
45555
  })
45381
45556
  }
@@ -45401,8 +45576,8 @@ app.route({
45401
45576
  title: "获取工作空间详情",
45402
45577
  summary: "获取工作空间详细信息",
45403
45578
  args: {
45404
- repo: tool.schema.string().describe("代码仓库路径,例如 user/repo"),
45405
- sn: tool.schema.string().describe("工作空间流水线的 sn")
45579
+ repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
45580
+ sn: exports_external2.string().describe("工作空间流水线的 sn")
45406
45581
  }
45407
45582
  })
45408
45583
  }
@@ -45431,9 +45606,9 @@ app.route({
45431
45606
  title: "删除工作空间",
45432
45607
  summary: "删除工作空间,pipelineId 和 sn 二选一",
45433
45608
  args: {
45434
- pipelineId: tool.schema.string().optional().describe("流水线 ID,优先使用"),
45435
- sn: tool.schema.string().optional().describe("流水线构建号"),
45436
- 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("批量流水线构建号")
45437
45612
  }
45438
45613
  })
45439
45614
  }
@@ -45469,8 +45644,8 @@ app.route({
45469
45644
  title: "停止工作空间",
45470
45645
  summary: "停止运行中的工作空间",
45471
45646
  args: {
45472
- pipelineId: tool.schema.string().optional().describe("流水线 ID,优先使用"),
45473
- sn: tool.schema.string().optional().describe("流水线构建号")
45647
+ pipelineId: exports_external2.string().optional().describe("流水线 ID,优先使用"),
45648
+ sn: exports_external2.string().optional().describe("流水线构建号")
45474
45649
  }
45475
45650
  })
45476
45651
  }
@@ -45498,9 +45673,9 @@ app.route({
45498
45673
  title: "调用app应用",
45499
45674
  summary: "调用router的应用, 参数path, key, payload",
45500
45675
  args: {
45501
- path: tool.schema.string().describe("应用路径,例如 cnb"),
45502
- key: tool.schema.string().optional().describe("应用key,例如 list-repos"),
45503
- 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("调用参数")
45504
45679
  }
45505
45680
  })
45506
45681
  }
@@ -45547,7 +45722,7 @@ app.route({
45547
45722
  title: "获取当前cnb工作空间的port代理uri",
45548
45723
  summary: "获取当前cnb工作空间的port代理uri,用于端口转发",
45549
45724
  args: {
45550
- port: tool.schema.number().optional().describe("端口号,默认为51515")
45725
+ port: exports_external2.number().optional().describe("端口号,默认为51515")
45551
45726
  }
45552
45727
  })
45553
45728
  }
@@ -45574,11 +45749,11 @@ app.route({
45574
45749
  title: "获取当前cnb工作空间的编辑器访问地址",
45575
45750
  summary: "获取当前cnb工作空间的vscode代理uri,用于在浏览器中访问vscode,包含多种访问方式,如web、vscode、codebuddy、cursor、ssh",
45576
45751
  args: {
45577
- web: tool.schema.boolean().optional().describe("是否获取vscode web的访问uri,默认为false"),
45578
- vscode: tool.schema.boolean().optional().describe("是否获取vscode的代理uri,默认为true"),
45579
- codebuddy: tool.schema.boolean().optional().describe("是否获取codebuddy的代理uri,默认为false"),
45580
- cursor: tool.schema.boolean().optional().describe("是否获取cursor的代理uri,默认为false"),
45581
- 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")
45582
45757
  }
45583
45758
  })
45584
45759
  }
@@ -45637,7 +45812,7 @@ app.route({
45637
45812
  title: "设置当前cnb工作空间的cookie环境变量",
45638
45813
  summary: "设置当前cnb工作空间的cookie环境变量,用于界面操作定制模块功能,例子:CNBSESSION=xxxx;csrfkey=2222xxxx;",
45639
45814
  args: {
45640
- cookie: tool.schema.string().describe("cnb的cookie值")
45815
+ cookie: exports_external2.string().describe("cnb的cookie值")
45641
45816
  }
45642
45817
  })
45643
45818
  }
@@ -45974,8 +46149,8 @@ app.route({
45974
46149
  title: "调用cnb的知识库ai对话功能进行聊天",
45975
46150
  summary: "调用cnb的知识库ai对话功能进行聊天,基于cnb提供的ai能力",
45976
46151
  args: {
45977
- question: tool.schema.string().describe("用户输入的消息内容"),
45978
- repo: tool.schema.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
46152
+ question: exports_external2.string().describe("用户输入的消息内容"),
46153
+ repo: exports_external2.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
45979
46154
  }
45980
46155
  })
45981
46156
  }
@@ -46077,8 +46252,8 @@ app.route({
46077
46252
  title: "调用cnb的知识库RAG查询功能进行问答",
46078
46253
  summary: "调用cnb的知识库RAG查询功能进行问答,基于cnb提供的知识库能力",
46079
46254
  args: {
46080
- question: tool.schema.string().describe("用户输入的消息内容"),
46081
- repo: tool.schema.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
46255
+ question: exports_external2.string().describe("用户输入的消息内容"),
46256
+ repo: exports_external2.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
46082
46257
  }
46083
46258
  })
46084
46259
  }
@@ -46140,13 +46315,13 @@ app.route({
46140
46315
  skill: "list-issues",
46141
46316
  title: "查询 Issue 列表",
46142
46317
  args: {
46143
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46144
- state: tool.schema.string().optional().describe("Issue 状态:open 或 closed"),
46145
- keyword: tool.schema.string().optional().describe("问题搜索关键词"),
46146
- labels: tool.schema.string().optional().describe("问题标签,多个用逗号分隔"),
46147
- page: tool.schema.number().optional().describe("分页页码,默认: 1"),
46148
- page_size: tool.schema.number().optional().describe("分页每页大小,默认: 30"),
46149
- 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")
46150
46325
  },
46151
46326
  summary: "查询 Issue 列表"
46152
46327
  })
@@ -46190,8 +46365,8 @@ app.route({
46190
46365
  skill: "getIssue",
46191
46366
  title: "获取 单个 Issue",
46192
46367
  args: {
46193
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46194
- 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 编号")
46195
46370
  },
46196
46371
  summary: "获取 单个 Issue"
46197
46372
  })
@@ -46222,12 +46397,12 @@ app.route({
46222
46397
  skill: "create-issue",
46223
46398
  title: "创建 Issue",
46224
46399
  args: {
46225
- repo: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
46226
- title: tool.schema.string().describe("Issue 标题"),
46227
- body: tool.schema.string().optional().describe("Issue 描述内容"),
46228
- assignees: tool.schema.array(tool.schema.string()).optional().describe("指派人列表"),
46229
- labels: tool.schema.array(tool.schema.string()).optional().describe("标签列表"),
46230
- 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("优先级")
46231
46406
  },
46232
46407
  summary: "创建一个新的 Issue"
46233
46408
  })
@@ -46263,9 +46438,9 @@ app.route({
46263
46438
  skill: "complete-issue",
46264
46439
  title: "完成 CNB的任务Issue",
46265
46440
  args: {
46266
- repo: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo"),
46267
- issueNumber: tool.schema.union([tool.schema.string(), tool.schema.number()]).describe("Issue 编号"),
46268
- 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")
46269
46444
  },
46270
46445
  summary: "完成一个 Issue(将 state 改为 closed)"
46271
46446
  })
@@ -46298,10 +46473,10 @@ app.route({
46298
46473
  skill: "list-issue-comments",
46299
46474
  title: "查询 Issue 评论列表",
46300
46475
  args: {
46301
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46302
- issueNumber: tool.schema.number().describe("Issue 编号"),
46303
- page: tool.schema.number().optional().describe("分页页码,默认: 1"),
46304
- 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")
46305
46480
  },
46306
46481
  summary: "查询 Issue 评论列表"
46307
46482
  })
@@ -46310,8 +46485,8 @@ app.route({
46310
46485
  const cnb = await cnbManager.getContext(ctx);
46311
46486
  let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
46312
46487
  const issueNumber = ctx.query?.issueNumber;
46313
- const page = ctx.query?.page ? Number(ctx.query.page) : undefined;
46314
- const page_size = ctx.query?.page_size ? Number(ctx.query.page_size) : undefined;
46488
+ const page = ctx.query?.page ?? 1;
46489
+ const page_size = ctx.query?.page_size ?? 100;
46315
46490
  if (!repo2) {
46316
46491
  ctx.throw(400, "缺少参数 repo");
46317
46492
  }
@@ -46337,10 +46512,10 @@ app.route({
46337
46512
  skill: "create-issue-comment",
46338
46513
  title: "创建 Issue 评论",
46339
46514
  args: {
46340
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46341
- issueNumber: tool.schema.number().describe("Issue 编号"),
46342
- body: tool.schema.string().describe("评论内容"),
46343
- 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")
46344
46519
  },
46345
46520
  summary: "创建 Issue 评论"
46346
46521
  })
@@ -46377,9 +46552,9 @@ app.route({
46377
46552
  skill: "get-issue-comment",
46378
46553
  title: "获取 Issue 评论",
46379
46554
  args: {
46380
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46381
- issueNumber: tool.schema.number().describe("Issue 编号"),
46382
- 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")
46383
46558
  },
46384
46559
  summary: "获取 Issue 评论"
46385
46560
  })
@@ -46412,11 +46587,11 @@ app.route({
46412
46587
  skill: "update-issue-comment",
46413
46588
  title: "修改 Issue 评论",
46414
46589
  args: {
46415
- repo: tool.schema.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
46416
- issueNumber: tool.schema.number().describe("Issue 编号"),
46417
- commentId: tool.schema.number().describe("评论 ID"),
46418
- body: tool.schema.string().describe("评论内容"),
46419
- 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")
46420
46595
  },
46421
46596
  summary: "修改 Issue 评论"
46422
46597
  })
@@ -47332,7 +47507,7 @@ app.route({
47332
47507
  };
47333
47508
  }).addTo(app);
47334
47509
 
47335
- // ../../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
47336
47511
  var import_oidc = __toESM(require_dist(), 1);
47337
47512
  var import_oidc2 = __toESM(require_dist(), 1);
47338
47513
  var marker17 = "vercel.ai.gateway.error";
@@ -48398,7 +48573,7 @@ async function getVercelRequestId() {
48398
48573
  var _a92;
48399
48574
  return (_a92 = import_oidc.getContext().headers) == null ? undefined : _a92["x-vercel-id"];
48400
48575
  }
48401
- var VERSION3 = "3.0.66";
48576
+ var VERSION3 = "3.0.77";
48402
48577
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
48403
48578
  function createGatewayProvider(options = {}) {
48404
48579
  var _a92, _b92;
@@ -48554,7 +48729,7 @@ async function getGatewayAuthToken(options) {
48554
48729
  };
48555
48730
  }
48556
48731
 
48557
- // ../../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
48558
48733
  var import_api = __toESM(require_src(), 1);
48559
48734
  var import_api2 = __toESM(require_src(), 1);
48560
48735
  var __defProp4 = Object.defineProperty;
@@ -49125,7 +49300,7 @@ function detectMediaType({
49125
49300
  }
49126
49301
  return;
49127
49302
  }
49128
- var VERSION4 = "6.0.116";
49303
+ var VERSION4 = "6.0.134";
49129
49304
  var download = async ({
49130
49305
  url: url4,
49131
49306
  maxBytes,
@@ -49139,6 +49314,9 @@ var download = async ({
49139
49314
  headers: withUserAgentSuffix({}, `ai-sdk/${VERSION4}`, getRuntimeEnvironmentUserAgent()),
49140
49315
  signal: abortSignal
49141
49316
  });
49317
+ if (response.redirected) {
49318
+ validateDownloadUrl(response.url);
49319
+ }
49142
49320
  if (!response.ok) {
49143
49321
  throw new DownloadError({
49144
49322
  url: urlText,
@@ -49542,7 +49720,7 @@ async function createToolModelOutput({
49542
49720
  toolCallId,
49543
49721
  input,
49544
49722
  output,
49545
- tool: tool22,
49723
+ tool: tool2,
49546
49724
  errorMode
49547
49725
  }) {
49548
49726
  if (errorMode === "text") {
@@ -49550,8 +49728,8 @@ async function createToolModelOutput({
49550
49728
  } else if (errorMode === "json") {
49551
49729
  return { type: "error-json", value: toJSONValue(output) };
49552
49730
  }
49553
- if (tool22 == null ? undefined : tool22.toModelOutput) {
49554
- return await tool22.toModelOutput({ toolCallId, input, output });
49731
+ if (tool2 == null ? undefined : tool2.toModelOutput) {
49732
+ return await tool2.toModelOutput({ toolCallId, input, output });
49555
49733
  }
49556
49734
  return typeof output === "string" ? { type: "text", value: output } : { type: "json", value: toJSONValue(output) };
49557
49735
  }
@@ -49665,8 +49843,8 @@ async function prepareToolsAndToolChoice({
49665
49843
  }
49666
49844
  const filteredTools = activeTools != null ? Object.entries(tools).filter(([name21]) => activeTools.includes(name21)) : Object.entries(tools);
49667
49845
  const languageModelTools = [];
49668
- for (const [name21, tool22] of filteredTools) {
49669
- const toolType = tool22.type;
49846
+ for (const [name21, tool2] of filteredTools) {
49847
+ const toolType = tool2.type;
49670
49848
  switch (toolType) {
49671
49849
  case undefined:
49672
49850
  case "dynamic":
@@ -49674,19 +49852,19 @@ async function prepareToolsAndToolChoice({
49674
49852
  languageModelTools.push({
49675
49853
  type: "function",
49676
49854
  name: name21,
49677
- description: tool22.description,
49678
- inputSchema: await asSchema(tool22.inputSchema).jsonSchema,
49679
- ...tool22.inputExamples != null ? { inputExamples: tool22.inputExamples } : {},
49680
- providerOptions: tool22.providerOptions,
49681
- ...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 } : {}
49682
49860
  });
49683
49861
  break;
49684
49862
  case "provider":
49685
49863
  languageModelTools.push({
49686
49864
  type: "provider",
49687
49865
  name: name21,
49688
- id: tool22.id,
49689
- args: tool22.args
49866
+ id: tool2.id,
49867
+ args: tool2.args
49690
49868
  });
49691
49869
  break;
49692
49870
  default: {
@@ -50452,8 +50630,8 @@ async function executeToolCall({
50452
50630
  onToolCallFinish
50453
50631
  }) {
50454
50632
  const { toolName, toolCallId, input } = toolCall;
50455
- const tool22 = tools == null ? undefined : tools[toolName];
50456
- if ((tool22 == null ? undefined : tool22.execute) == null) {
50633
+ const tool2 = tools == null ? undefined : tools[toolName];
50634
+ if ((tool2 == null ? undefined : tool2.execute) == null) {
50457
50635
  return;
50458
50636
  }
50459
50637
  const baseCallbackEvent = {
@@ -50489,7 +50667,7 @@ async function executeToolCall({
50489
50667
  const startTime = now();
50490
50668
  try {
50491
50669
  const stream = executeTool({
50492
- execute: tool22.execute.bind(tool22),
50670
+ execute: tool2.execute.bind(tool2),
50493
50671
  input,
50494
50672
  options: {
50495
50673
  toolCallId,
@@ -50528,7 +50706,7 @@ async function executeToolCall({
50528
50706
  toolName,
50529
50707
  input,
50530
50708
  error: error49,
50531
- dynamic: tool22.type === "dynamic",
50709
+ dynamic: tool2.type === "dynamic",
50532
50710
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
50533
50711
  };
50534
50712
  }
@@ -50558,7 +50736,7 @@ async function executeToolCall({
50558
50736
  toolName,
50559
50737
  input,
50560
50738
  output,
50561
- dynamic: tool22.type === "dynamic",
50739
+ dynamic: tool2.type === "dynamic",
50562
50740
  ...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
50563
50741
  };
50564
50742
  }
@@ -50600,18 +50778,18 @@ var DefaultGeneratedFile = class {
50600
50778
  }
50601
50779
  };
50602
50780
  async function isApprovalNeeded({
50603
- tool: tool22,
50781
+ tool: tool2,
50604
50782
  toolCall,
50605
50783
  messages,
50606
50784
  experimental_context
50607
50785
  }) {
50608
- if (tool22.needsApproval == null) {
50786
+ if (tool2.needsApproval == null) {
50609
50787
  return false;
50610
50788
  }
50611
- if (typeof tool22.needsApproval === "boolean") {
50612
- return tool22.needsApproval;
50789
+ if (typeof tool2.needsApproval === "boolean") {
50790
+ return tool2.needsApproval;
50613
50791
  }
50614
- return await tool22.needsApproval(toolCall.input, {
50792
+ return await tool2.needsApproval(toolCall.input, {
50615
50793
  toolCallId: toolCall.toolCallId,
50616
50794
  messages,
50617
50795
  experimental_context
@@ -51346,8 +51524,8 @@ async function doParseToolCall({
51346
51524
  tools
51347
51525
  }) {
51348
51526
  const toolName = toolCall.toolName;
51349
- const tool22 = tools[toolName];
51350
- if (tool22 == null) {
51527
+ const tool2 = tools[toolName];
51528
+ if (tool2 == null) {
51351
51529
  if (toolCall.providerExecuted && toolCall.dynamic) {
51352
51530
  return await parseProviderExecutedDynamicToolCall(toolCall);
51353
51531
  }
@@ -51356,7 +51534,7 @@ async function doParseToolCall({
51356
51534
  availableTools: Object.keys(tools)
51357
51535
  });
51358
51536
  }
51359
- const schema = asSchema(tool22.inputSchema);
51537
+ const schema = asSchema(tool2.inputSchema);
51360
51538
  const parseResult = toolCall.input.trim() === "" ? await safeValidateTypes({ value: {}, schema }) : await safeParseJSON({ text: toolCall.input, schema });
51361
51539
  if (parseResult.success === false) {
51362
51540
  throw new InvalidToolInputError({
@@ -51365,7 +51543,7 @@ async function doParseToolCall({
51365
51543
  cause: parseResult.error
51366
51544
  });
51367
51545
  }
51368
- return tool22.type === "dynamic" ? {
51546
+ return tool2.type === "dynamic" ? {
51369
51547
  type: "tool-call",
51370
51548
  toolCallId: toolCall.toolCallId,
51371
51549
  toolName: toolCall.toolName,
@@ -51373,7 +51551,7 @@ async function doParseToolCall({
51373
51551
  providerExecuted: toolCall.providerExecuted,
51374
51552
  providerMetadata: toolCall.providerMetadata,
51375
51553
  dynamic: true,
51376
- title: tool22.title
51554
+ title: tool2.title
51377
51555
  } : {
51378
51556
  type: "tool-call",
51379
51557
  toolCallId: toolCall.toolCallId,
@@ -51381,7 +51559,7 @@ async function doParseToolCall({
51381
51559
  input: parseResult.value,
51382
51560
  providerExecuted: toolCall.providerExecuted,
51383
51561
  providerMetadata: toolCall.providerMetadata,
51384
- title: tool22.title
51562
+ title: tool2.title
51385
51563
  };
51386
51564
  }
51387
51565
  var DefaultStepResult = class {
@@ -51721,7 +51899,7 @@ async function generateText({
51721
51899
  }),
51722
51900
  tracer,
51723
51901
  fn: async (span) => {
51724
- 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;
51725
51903
  const initialMessages = initialPrompt.messages;
51726
51904
  const responseMessages = [];
51727
51905
  const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
@@ -51885,7 +52063,7 @@ async function generateText({
51885
52063
  input: () => stringifyForTelemetry(promptMessages)
51886
52064
  },
51887
52065
  "ai.prompt.tools": {
51888
- input: () => stepTools == null ? undefined : stepTools.map((tool22) => JSON.stringify(tool22))
52066
+ input: () => stepTools == null ? undefined : stepTools.map((tool2) => JSON.stringify(tool2))
51889
52067
  },
51890
52068
  "ai.prompt.toolChoice": {
51891
52069
  input: () => stepToolChoice != null ? JSON.stringify(stepToolChoice) : undefined
@@ -51921,6 +52099,7 @@ async function generateText({
51921
52099
  headers: (_g2 = result.response) == null ? undefined : _g2.headers,
51922
52100
  body: (_h2 = result.response) == null ? undefined : _h2.body
51923
52101
  };
52102
+ const usage = asLanguageModelUsage(result.usage);
51924
52103
  span2.setAttributes(await selectTelemetryAttributes({
51925
52104
  telemetry,
51926
52105
  attributes: {
@@ -51941,8 +52120,16 @@ async function generateText({
51941
52120
  "ai.response.model": responseData.modelId,
51942
52121
  "ai.response.timestamp": responseData.timestamp.toISOString(),
51943
52122
  "ai.response.providerMetadata": JSON.stringify(result.providerMetadata),
51944
- "ai.usage.promptTokens": result.usage.inputTokens.total,
51945
- "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,
51946
52133
  "gen_ai.response.finish_reasons": [
51947
52134
  result.finishReason.unified
51948
52135
  ],
@@ -51968,12 +52155,12 @@ async function generateText({
51968
52155
  if (toolCall.invalid) {
51969
52156
  continue;
51970
52157
  }
51971
- const tool22 = tools == null ? undefined : tools[toolCall.toolName];
51972
- if (tool22 == null) {
52158
+ const tool2 = tools == null ? undefined : tools[toolCall.toolName];
52159
+ if (tool2 == null) {
51973
52160
  continue;
51974
52161
  }
51975
- if ((tool22 == null ? undefined : tool22.onInputAvailable) != null) {
51976
- await tool22.onInputAvailable({
52162
+ if ((tool2 == null ? undefined : tool2.onInputAvailable) != null) {
52163
+ await tool2.onInputAvailable({
51977
52164
  input: toolCall.input,
51978
52165
  toolCallId: toolCall.toolCallId,
51979
52166
  messages: stepInputMessages,
@@ -51982,7 +52169,7 @@ async function generateText({
51982
52169
  });
51983
52170
  }
51984
52171
  if (await isApprovalNeeded({
51985
- tool: tool22,
52172
+ tool: tool2,
51986
52173
  toolCall,
51987
52174
  messages: stepInputMessages,
51988
52175
  experimental_context
@@ -52031,8 +52218,8 @@ async function generateText({
52031
52218
  for (const toolCall of stepToolCalls) {
52032
52219
  if (!toolCall.providerExecuted)
52033
52220
  continue;
52034
- const tool22 = tools == null ? undefined : tools[toolCall.toolName];
52035
- 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) {
52036
52223
  const hasResultInResponse = currentModelResponse.content.some((part) => part.type === "tool-result" && part.toolCallId === toolCall.toolCallId);
52037
52224
  if (!hasResultInResponse) {
52038
52225
  pendingDeferredToolCalls.set(toolCall.toolCallId, {
@@ -52111,9 +52298,7 @@ async function generateText({
52111
52298
  return toolCalls == null ? undefined : JSON.stringify(toolCalls);
52112
52299
  }
52113
52300
  },
52114
- "ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata),
52115
- "ai.usage.promptTokens": currentModelResponse.usage.inputTokens.total,
52116
- "ai.usage.completionTokens": currentModelResponse.usage.outputTokens.total
52301
+ "ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata)
52117
52302
  }
52118
52303
  }));
52119
52304
  const lastStep = steps[steps.length - 1];
@@ -52126,6 +52311,21 @@ async function generateText({
52126
52311
  reasoningTokens: undefined,
52127
52312
  cachedInputTokens: undefined
52128
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
+ }));
52129
52329
  await notify({
52130
52330
  event: {
52131
52331
  stepNumber: lastStep.stepNumber,
@@ -52325,8 +52525,8 @@ function asContent({
52325
52525
  case "tool-result": {
52326
52526
  const toolCall = toolCalls.find((toolCall2) => toolCall2.toolCallId === part.toolCallId);
52327
52527
  if (toolCall == null) {
52328
- const tool22 = tools == null ? undefined : tools[part.toolName];
52329
- 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;
52330
52530
  if (!supportsDeferredResults) {
52331
52531
  throw new Error(`Tool call ${part.toolCallId} not found.`);
52332
52532
  }
@@ -52338,7 +52538,8 @@ function asContent({
52338
52538
  input: undefined,
52339
52539
  error: part.result,
52340
52540
  providerExecuted: true,
52341
- dynamic: part.dynamic
52541
+ dynamic: part.dynamic,
52542
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
52342
52543
  });
52343
52544
  } else {
52344
52545
  contentParts.push({
@@ -52348,7 +52549,8 @@ function asContent({
52348
52549
  input: undefined,
52349
52550
  output: part.result,
52350
52551
  providerExecuted: true,
52351
- dynamic: part.dynamic
52552
+ dynamic: part.dynamic,
52553
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
52352
52554
  });
52353
52555
  }
52354
52556
  break;
@@ -52361,7 +52563,8 @@ function asContent({
52361
52563
  input: toolCall.input,
52362
52564
  error: part.result,
52363
52565
  providerExecuted: true,
52364
- dynamic: toolCall.dynamic
52566
+ dynamic: toolCall.dynamic,
52567
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
52365
52568
  });
52366
52569
  } else {
52367
52570
  contentParts.push({
@@ -52371,7 +52574,8 @@ function asContent({
52371
52574
  input: toolCall.input,
52372
52575
  output: part.result,
52373
52576
  providerExecuted: true,
52374
- dynamic: toolCall.dynamic
52577
+ dynamic: toolCall.dynamic,
52578
+ ...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
52375
52579
  });
52376
52580
  }
52377
52581
  break;
@@ -52477,6 +52681,7 @@ var uiMessageChunkSchema = lazySchema(() => zodSchema(exports_external2.union([
52477
52681
  toolCallId: exports_external2.string(),
52478
52682
  output: exports_external2.unknown(),
52479
52683
  providerExecuted: exports_external2.boolean().optional(),
52684
+ providerMetadata: providerMetadataSchema.optional(),
52480
52685
  dynamic: exports_external2.boolean().optional(),
52481
52686
  preliminary: exports_external2.boolean().optional()
52482
52687
  }),
@@ -52485,6 +52690,7 @@ var uiMessageChunkSchema = lazySchema(() => zodSchema(exports_external2.union([
52485
52690
  toolCallId: exports_external2.string(),
52486
52691
  errorText: exports_external2.string(),
52487
52692
  providerExecuted: exports_external2.boolean().optional(),
52693
+ providerMetadata: providerMetadataSchema.optional(),
52488
52694
  dynamic: exports_external2.boolean().optional()
52489
52695
  }),
52490
52696
  exports_external2.strictObject({
@@ -52683,6 +52889,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
52683
52889
  output: exports_external2.unknown(),
52684
52890
  errorText: exports_external2.never().optional(),
52685
52891
  callProviderMetadata: providerMetadataSchema.optional(),
52892
+ resultProviderMetadata: providerMetadataSchema.optional(),
52686
52893
  preliminary: exports_external2.boolean().optional(),
52687
52894
  approval: exports_external2.object({
52688
52895
  id: exports_external2.string(),
@@ -52701,6 +52908,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
52701
52908
  output: exports_external2.never().optional(),
52702
52909
  errorText: exports_external2.string(),
52703
52910
  callProviderMetadata: providerMetadataSchema.optional(),
52911
+ resultProviderMetadata: providerMetadataSchema.optional(),
52704
52912
  approval: exports_external2.object({
52705
52913
  id: exports_external2.string(),
52706
52914
  approved: exports_external2.literal(true),
@@ -52784,6 +52992,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
52784
52992
  output: exports_external2.unknown(),
52785
52993
  errorText: exports_external2.never().optional(),
52786
52994
  callProviderMetadata: providerMetadataSchema.optional(),
52995
+ resultProviderMetadata: providerMetadataSchema.optional(),
52787
52996
  preliminary: exports_external2.boolean().optional(),
52788
52997
  approval: exports_external2.object({
52789
52998
  id: exports_external2.string(),
@@ -52801,6 +53010,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
52801
53010
  output: exports_external2.never().optional(),
52802
53011
  errorText: exports_external2.string(),
52803
53012
  callProviderMetadata: providerMetadataSchema.optional(),
53013
+ resultProviderMetadata: providerMetadataSchema.optional(),
52804
53014
  approval: exports_external2.object({
52805
53015
  id: exports_external2.string(),
52806
53016
  approved: exports_external2.literal(true),
@@ -53187,7 +53397,7 @@ var createTool = async (app2, message) => {
53187
53397
  console.error(`未找到路径 ${message.path} 和 key ${message.key} 的路由`);
53188
53398
  return null;
53189
53399
  }
53190
- const _tool = tool2({
53400
+ const _tool = tool({
53191
53401
  description: route?.metadata?.summary || route?.description || "无描述",
53192
53402
  inputSchema: zod_default.object({
53193
53403
  ...route.metadata?.args
@@ -53320,6 +53530,504 @@ app.route({
53320
53530
  ctx.forward(res);
53321
53531
  }).addTo(app);
53322
53532
 
53533
+ // agent/routes/labels/issue-label.ts
53534
+ app.route({
53535
+ path: "cnb",
53536
+ key: "list-issue-labels",
53537
+ description: "查询 Issue 的标签列表",
53538
+ middleware: ["auth"],
53539
+ metadata: {
53540
+ tags: ["opencode"],
53541
+ ...createSkill({
53542
+ skill: "list-issue-labels",
53543
+ title: "查询 Issue 标签列表",
53544
+ summary: "查询 Issue 的标签列表",
53545
+ args: {
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")
53550
+ }
53551
+ })
53552
+ }
53553
+ }).define(async (ctx) => {
53554
+ const cnb = await cnbManager.getContext(ctx);
53555
+ let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
53556
+ const issueNumber = ctx.query?.issueNumber;
53557
+ const page = ctx.query?.page;
53558
+ const pageSize = ctx.query?.pageSize;
53559
+ if (!repo2) {
53560
+ ctx.throw(400, "缺少参数 repo");
53561
+ }
53562
+ if (!issueNumber) {
53563
+ ctx.throw(400, "缺少参数 issueNumber");
53564
+ }
53565
+ const res = await cnb.labels.issueLabel.list(repo2, issueNumber, {
53566
+ page,
53567
+ page_size: pageSize
53568
+ });
53569
+ ctx.forward(res);
53570
+ }).addTo(app);
53571
+ app.route({
53572
+ path: "cnb",
53573
+ key: "set-issue-labels",
53574
+ description: "设置 Issue 标签(完全替换现有标签)",
53575
+ middleware: ["auth"],
53576
+ metadata: {
53577
+ tags: ["opencode"],
53578
+ ...createSkill({
53579
+ skill: "set-issue-labels",
53580
+ title: "设置 Issue 标签",
53581
+ summary: "设置 Issue 标签(完全替换现有标签)",
53582
+ args: {
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("标签名称数组")
53586
+ }
53587
+ })
53588
+ }
53589
+ }).define(async (ctx) => {
53590
+ const cnb = await cnbManager.getContext(ctx);
53591
+ let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
53592
+ const issueNumber = ctx.query?.issueNumber;
53593
+ const labels2 = ctx.query?.labels;
53594
+ if (!repo2) {
53595
+ ctx.throw(400, "缺少参数 repo");
53596
+ }
53597
+ if (!issueNumber) {
53598
+ ctx.throw(400, "缺少参数 issueNumber");
53599
+ }
53600
+ if (!labels2 || !Array.isArray(labels2)) {
53601
+ ctx.throw(400, "缺少参数 labels");
53602
+ }
53603
+ const res = await cnb.labels.issueLabel.set(repo2, issueNumber, { labels: labels2 });
53604
+ ctx.forward(res);
53605
+ }).addTo(app);
53606
+ app.route({
53607
+ path: "cnb",
53608
+ key: "add-issue-labels",
53609
+ description: "新增 Issue 标签(追加到现有标签)",
53610
+ middleware: ["auth"],
53611
+ metadata: {
53612
+ tags: ["opencode"],
53613
+ ...createSkill({
53614
+ skill: "add-issue-labels",
53615
+ title: "新增 Issue 标签",
53616
+ summary: "新增 Issue 标签(追加到现有标签)",
53617
+ args: {
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("标签名称数组")
53621
+ }
53622
+ })
53623
+ }
53624
+ }).define(async (ctx) => {
53625
+ const cnb = await cnbManager.getContext(ctx);
53626
+ let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
53627
+ const issueNumber = ctx.query?.issueNumber;
53628
+ const labels2 = ctx.query?.labels;
53629
+ if (!repo2) {
53630
+ ctx.throw(400, "缺少参数 repo");
53631
+ }
53632
+ if (!issueNumber) {
53633
+ ctx.throw(400, "缺少参数 issueNumber");
53634
+ }
53635
+ if (!labels2 || !Array.isArray(labels2)) {
53636
+ ctx.throw(400, "缺少参数 labels");
53637
+ }
53638
+ const res = await cnb.labels.issueLabel.add(repo2, issueNumber, { labels: labels2 });
53639
+ ctx.forward(res);
53640
+ }).addTo(app);
53641
+ app.route({
53642
+ path: "cnb",
53643
+ key: "clear-issue-labels",
53644
+ description: "清空 Issue 标签(移除所有标签)",
53645
+ middleware: ["auth"],
53646
+ metadata: {
53647
+ tags: ["opencode"],
53648
+ ...createSkill({
53649
+ skill: "clear-issue-labels",
53650
+ title: "清空 Issue 标签",
53651
+ summary: "清空 Issue 标签(移除所有标签)",
53652
+ args: {
53653
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53654
+ issueNumber: exports_external2.number().describe("Issue 编号")
53655
+ }
53656
+ })
53657
+ }
53658
+ }).define(async (ctx) => {
53659
+ const cnb = await cnbManager.getContext(ctx);
53660
+ let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
53661
+ const issueNumber = ctx.query?.issueNumber;
53662
+ if (!repo2) {
53663
+ ctx.throw(400, "缺少参数 repo");
53664
+ }
53665
+ if (!issueNumber) {
53666
+ ctx.throw(400, "缺少参数 issueNumber");
53667
+ }
53668
+ const res = await cnb.labels.issueLabel.clear(repo2, issueNumber);
53669
+ ctx.forward(res);
53670
+ }).addTo(app);
53671
+ app.route({
53672
+ path: "cnb",
53673
+ key: "remove-issue-label",
53674
+ description: "删除 Issue 指定标签",
53675
+ middleware: ["auth"],
53676
+ metadata: {
53677
+ tags: ["opencode"],
53678
+ ...createSkill({
53679
+ skill: "remove-issue-label",
53680
+ title: "删除 Issue 标签",
53681
+ summary: "删除 Issue 指定标签",
53682
+ args: {
53683
+ repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
53684
+ issueNumber: exports_external2.number().describe("Issue 编号"),
53685
+ name: exports_external2.string().describe("标签名称")
53686
+ }
53687
+ })
53688
+ }
53689
+ }).define(async (ctx) => {
53690
+ const cnb = await cnbManager.getContext(ctx);
53691
+ let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
53692
+ const issueNumber = ctx.query?.issueNumber;
53693
+ const name21 = ctx.query?.name;
53694
+ if (!repo2) {
53695
+ ctx.throw(400, "缺少参数 repo");
53696
+ }
53697
+ if (!issueNumber) {
53698
+ ctx.throw(400, "缺少参数 issueNumber");
53699
+ }
53700
+ if (!name21) {
53701
+ ctx.throw(400, "缺少参数 name");
53702
+ }
53703
+ const res = await cnb.labels.issueLabel.remove(repo2, issueNumber, name21);
53704
+ ctx.forward(res);
53705
+ }).addTo(app);
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
+
53323
54031
  // agent/routes/index.ts
53324
54032
  var checkAppId = (ctx, appId) => {
53325
54033
  const _appId = ctx?.app?.appId;
@@ -54634,7 +55342,7 @@ __export4(exports_external3, {
54634
55342
  safeEncode: () => safeEncode22,
54635
55343
  safeDecodeAsync: () => safeDecodeAsync22,
54636
55344
  safeDecode: () => safeDecode22,
54637
- registry: () => registry3,
55345
+ registry: () => registry4,
54638
55346
  regexes: () => exports_regexes3,
54639
55347
  regex: () => _regex3,
54640
55348
  refine: () => refine3,
@@ -54842,7 +55550,7 @@ __export4(exports_core22, {
54842
55550
  safeEncode: () => safeEncode6,
54843
55551
  safeDecodeAsync: () => safeDecodeAsync6,
54844
55552
  safeDecode: () => safeDecode6,
54845
- registry: () => registry3,
55553
+ registry: () => registry4,
54846
55554
  regexes: () => exports_regexes3,
54847
55555
  process: () => process5,
54848
55556
  prettifyError: () => prettifyError3,
@@ -64293,10 +65001,10 @@ class $ZodRegistry3 {
64293
65001
  return this._map.has(schema);
64294
65002
  }
64295
65003
  }
64296
- function registry3() {
65004
+ function registry4() {
64297
65005
  return new $ZodRegistry3;
64298
65006
  }
64299
- (_a21 = globalThis).__zod_globalRegistry ?? (_a21.__zod_globalRegistry = registry3());
65007
+ (_a21 = globalThis).__zod_globalRegistry ?? (_a21.__zod_globalRegistry = registry4());
64300
65008
  var globalRegistry3 = globalThis.__zod_globalRegistry;
64301
65009
  function _string3(Class22, params) {
64302
65010
  return new Class22({
@@ -68071,7 +68779,7 @@ function customAlphabet2(alphabet, size = 21) {
68071
68779
  }
68072
68780
  var import_md52 = __toESM4(require_md52(), 1);
68073
68781
  var nanoid32 = customAlphabet2("abcdefghijklmnopqrstuvwxyz", 16);
68074
- var tool4 = {
68782
+ var tool2 = {
68075
68783
  schema: exports_external3
68076
68784
  };
68077
68785
  var createSkill2 = (skill) => {
@@ -68445,9 +69153,9 @@ var addCallFn = (app3) => {
68445
69153
 
68446
69154
  `,
68447
69155
  args: {
68448
- path: tool4.schema.string().describe("应用路径,例如 cnb"),
68449
- key: tool4.schema.string().optional().describe("应用key,例如 list-repos"),
68450
- 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" }')
68451
69159
  }
68452
69160
  })
68453
69161
  }