@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/agent/routes/call/index.ts +5 -4
- package/agent/routes/cnb-env/env.ts +3 -2
- package/agent/routes/cnb-env/vscode.ts +9 -8
- package/agent/routes/index.ts +1 -0
- package/agent/routes/issues/comments.ts +18 -17
- package/agent/routes/issues/issue.ts +11 -10
- package/agent/routes/issues/list.ts +11 -10
- package/agent/routes/knowledge/ai.ts +6 -5
- package/agent/routes/labels/issue-label.ts +17 -16
- package/agent/routes/package/index.ts +2 -0
- package/agent/routes/package/package.ts +255 -0
- package/agent/routes/package/registry.ts +107 -0
- package/agent/routes/repo/list.ts +6 -5
- package/agent/routes/repo/repo-label.ts +17 -16
- package/agent/routes/repo/repo.ts +18 -17
- package/agent/routes/workspace/build.ts +7 -6
- package/agent/routes/workspace/index.ts +18 -17
- package/agent/routes/workspace/keep.ts +5 -5
- package/agent/routes/workspace/rerun.ts +60 -0
- package/agent/routes/workspace/skills.ts +2 -2
- package/dist/cli.js +927 -197
- package/dist/npc.js +981 -205
- package/dist/opencode.js +911 -203
- package/dist/routes.d.ts +235 -3
- package/dist/routes.js +903 -195
- package/package.json +1 -1
- package/src/index.ts +15 -1
- package/src/issue/index.ts +5 -2
- package/src/knowledge/index.ts +92 -5
- package/src/package/index.ts +2 -0
- package/src/package/package.ts +134 -0
- package/src/package/registry.ts +145 -0
package/dist/npc.js
CHANGED
|
@@ -21679,9 +21679,6 @@ var fromJSONSchema2 = (args = {}, opts) => {
|
|
|
21679
21679
|
return resultArgs;
|
|
21680
21680
|
};
|
|
21681
21681
|
var pickValue = ["path", "key", "id", "description", "type", "middleware", "metadata"];
|
|
21682
|
-
var tool = {
|
|
21683
|
-
schema: exports_external
|
|
21684
|
-
};
|
|
21685
21682
|
var createSkill = (skill) => {
|
|
21686
21683
|
if (skill.tags) {
|
|
21687
21684
|
const hasOpencode = skill.tags.includes("opencode");
|
|
@@ -24608,10 +24605,7 @@ class KnowledgeBase extends CNBCore {
|
|
|
24608
24605
|
}
|
|
24609
24606
|
queryKnowledgeBase(repo, data) {
|
|
24610
24607
|
const url3 = `/${repo}/-/knowledge/base/query`;
|
|
24611
|
-
|
|
24612
|
-
query: data.query
|
|
24613
|
-
};
|
|
24614
|
-
return this.post({ url: url3, data: postData });
|
|
24608
|
+
return this.post({ url: url3, data });
|
|
24615
24609
|
}
|
|
24616
24610
|
getEmbeddingModels(repo) {
|
|
24617
24611
|
const url3 = `/${repo}/-/knowledge/embedding/models`;
|
|
@@ -24625,6 +24619,30 @@ class KnowledgeBase extends CNBCore {
|
|
|
24625
24619
|
const url3 = `/${repo}/-/knowledge/base`;
|
|
24626
24620
|
return this.request({ url: url3, method: "DELETE" });
|
|
24627
24621
|
}
|
|
24622
|
+
createKnowledgeBase(repo, data) {
|
|
24623
|
+
const url3 = `/${repo}/-/knowledge/base`;
|
|
24624
|
+
return this.post({ url: url3, data });
|
|
24625
|
+
}
|
|
24626
|
+
updateKnowledgeBase(repo, data) {
|
|
24627
|
+
const url3 = `/${repo}/-/knowledge/base`;
|
|
24628
|
+
return this.put({ url: url3, data });
|
|
24629
|
+
}
|
|
24630
|
+
getEmbedding(repo, text) {
|
|
24631
|
+
const url3 = `/${repo}/-/knowledge/embedding`;
|
|
24632
|
+
return this.post({ url: url3, data: { text } });
|
|
24633
|
+
}
|
|
24634
|
+
addDocument(repo, chunksData) {
|
|
24635
|
+
const url3 = `/${repo}/-/knowledge/documents/upsert-document-with-chunks`;
|
|
24636
|
+
return this.post({ url: url3, data: chunksData });
|
|
24637
|
+
}
|
|
24638
|
+
deleteDocument(repo, paths) {
|
|
24639
|
+
const url3 = `/${repo}/-/knowledge/documents`;
|
|
24640
|
+
return this.delete({ url: url3, data: { paths } });
|
|
24641
|
+
}
|
|
24642
|
+
listDocument(repo, page = 1, page_size = 50) {
|
|
24643
|
+
const url3 = `/${repo}/-/knowledge/documents`;
|
|
24644
|
+
return this.get({ url: url3, params: { page, page_size } });
|
|
24645
|
+
}
|
|
24628
24646
|
}
|
|
24629
24647
|
|
|
24630
24648
|
// src/repo/index.ts
|
|
@@ -25259,6 +25277,88 @@ class IssueLabel extends CNBCore {
|
|
|
25259
25277
|
return this.delete({ url: url3 });
|
|
25260
25278
|
}
|
|
25261
25279
|
}
|
|
25280
|
+
// src/package/registry.ts
|
|
25281
|
+
class RegistryPackage extends CNBCore {
|
|
25282
|
+
constructor(options) {
|
|
25283
|
+
super(options);
|
|
25284
|
+
}
|
|
25285
|
+
listGroupRegistries(slug, params) {
|
|
25286
|
+
const url3 = `/${slug}/-/registries`;
|
|
25287
|
+
return this.get({
|
|
25288
|
+
url: url3,
|
|
25289
|
+
params,
|
|
25290
|
+
headers: {
|
|
25291
|
+
Accept: "application/vnd.cnb.api+json"
|
|
25292
|
+
}
|
|
25293
|
+
});
|
|
25294
|
+
}
|
|
25295
|
+
setVisibility(registry2, data) {
|
|
25296
|
+
const url3 = `/${registry2}/-/settings/set_visibility`;
|
|
25297
|
+
return this.post({
|
|
25298
|
+
url: url3,
|
|
25299
|
+
data
|
|
25300
|
+
});
|
|
25301
|
+
}
|
|
25302
|
+
remove(registry2) {
|
|
25303
|
+
const url3 = `/${registry2}`;
|
|
25304
|
+
return this.delete({ url: url3 });
|
|
25305
|
+
}
|
|
25306
|
+
}
|
|
25307
|
+
// src/package/package.ts
|
|
25308
|
+
class PackageManagement extends CNBCore {
|
|
25309
|
+
constructor(options) {
|
|
25310
|
+
super(options);
|
|
25311
|
+
}
|
|
25312
|
+
list(slug, type, params) {
|
|
25313
|
+
const url3 = `/${slug}/-/packages`;
|
|
25314
|
+
return this.get({
|
|
25315
|
+
url: url3,
|
|
25316
|
+
params: {
|
|
25317
|
+
type,
|
|
25318
|
+
...params
|
|
25319
|
+
},
|
|
25320
|
+
headers: {
|
|
25321
|
+
Accept: "application/vnd.cnb.api+json"
|
|
25322
|
+
}
|
|
25323
|
+
});
|
|
25324
|
+
}
|
|
25325
|
+
getOne(slug, type, name) {
|
|
25326
|
+
const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}`;
|
|
25327
|
+
return this.get({
|
|
25328
|
+
url: url3,
|
|
25329
|
+
headers: {
|
|
25330
|
+
Accept: "application/vnd.cnb.api+json"
|
|
25331
|
+
}
|
|
25332
|
+
});
|
|
25333
|
+
}
|
|
25334
|
+
remove(slug, type, name) {
|
|
25335
|
+
const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}`;
|
|
25336
|
+
return this.delete({ url: url3 });
|
|
25337
|
+
}
|
|
25338
|
+
getTag(slug, type, name, tag) {
|
|
25339
|
+
const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}/tags/${encodeURIComponent(tag)}`;
|
|
25340
|
+
return this.get({
|
|
25341
|
+
url: url3,
|
|
25342
|
+
headers: {
|
|
25343
|
+
Accept: "application/vnd.cnb.api+json"
|
|
25344
|
+
}
|
|
25345
|
+
});
|
|
25346
|
+
}
|
|
25347
|
+
removeTag(slug, type, name, tag) {
|
|
25348
|
+
const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}/tags/${encodeURIComponent(tag)}`;
|
|
25349
|
+
return this.delete({ url: url3 });
|
|
25350
|
+
}
|
|
25351
|
+
listTags(slug, type, name, params) {
|
|
25352
|
+
const url3 = `/${slug}/-/packages/${type}/${encodeURIComponent(name)}/tags`;
|
|
25353
|
+
return this.get({
|
|
25354
|
+
url: url3,
|
|
25355
|
+
params,
|
|
25356
|
+
headers: {
|
|
25357
|
+
Accept: "application/vnd.cnb.api+json"
|
|
25358
|
+
}
|
|
25359
|
+
});
|
|
25360
|
+
}
|
|
25361
|
+
}
|
|
25262
25362
|
// src/index.ts
|
|
25263
25363
|
class CNB extends CNBCore {
|
|
25264
25364
|
workspace;
|
|
@@ -25270,6 +25370,7 @@ class CNB extends CNBCore {
|
|
|
25270
25370
|
mission;
|
|
25271
25371
|
ai;
|
|
25272
25372
|
labels;
|
|
25373
|
+
packages;
|
|
25273
25374
|
constructor(options) {
|
|
25274
25375
|
super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
|
|
25275
25376
|
this.init(options);
|
|
@@ -25292,6 +25393,10 @@ class CNB extends CNBCore {
|
|
|
25292
25393
|
repoLabel: new RepoLabel(options),
|
|
25293
25394
|
issueLabel: new IssueLabel(options)
|
|
25294
25395
|
};
|
|
25396
|
+
this.packages = {
|
|
25397
|
+
registry: new RegistryPackage(options),
|
|
25398
|
+
package: new PackageManagement(options)
|
|
25399
|
+
};
|
|
25295
25400
|
}
|
|
25296
25401
|
setToken(token) {
|
|
25297
25402
|
this.token = token;
|
|
@@ -25303,6 +25408,8 @@ class CNB extends CNBCore {
|
|
|
25303
25408
|
this.mission.token = token;
|
|
25304
25409
|
this.labels.repoLabel.token = token;
|
|
25305
25410
|
this.labels.issueLabel.token = token;
|
|
25411
|
+
this.packages.registry.token = token;
|
|
25412
|
+
this.packages.package.token = token;
|
|
25306
25413
|
}
|
|
25307
25414
|
setCookie(cookie) {
|
|
25308
25415
|
this.cookie = cookie;
|
|
@@ -25314,6 +25421,8 @@ class CNB extends CNBCore {
|
|
|
25314
25421
|
this.mission.cookie = cookie;
|
|
25315
25422
|
this.labels.repoLabel.cookie = cookie;
|
|
25316
25423
|
this.labels.issueLabel.cookie = cookie;
|
|
25424
|
+
this.packages.registry.cookie = cookie;
|
|
25425
|
+
this.packages.package.cookie = cookie;
|
|
25317
25426
|
}
|
|
25318
25427
|
getCNBVersion = getCNBVersion;
|
|
25319
25428
|
}
|
|
@@ -25681,7 +25790,7 @@ __export(exports_external2, {
|
|
|
25681
25790
|
safeEncode: () => safeEncode5,
|
|
25682
25791
|
safeDecodeAsync: () => safeDecodeAsync5,
|
|
25683
25792
|
safeDecode: () => safeDecode5,
|
|
25684
|
-
registry: () =>
|
|
25793
|
+
registry: () => registry3,
|
|
25685
25794
|
regexes: () => exports_regexes2,
|
|
25686
25795
|
regex: () => _regex2,
|
|
25687
25796
|
refine: () => refine2,
|
|
@@ -25891,7 +26000,7 @@ __export(exports_core3, {
|
|
|
25891
26000
|
safeEncode: () => safeEncode3,
|
|
25892
26001
|
safeDecodeAsync: () => safeDecodeAsync3,
|
|
25893
26002
|
safeDecode: () => safeDecode3,
|
|
25894
|
-
registry: () =>
|
|
26003
|
+
registry: () => registry3,
|
|
25895
26004
|
regexes: () => exports_regexes2,
|
|
25896
26005
|
process: () => process3,
|
|
25897
26006
|
prettifyError: () => prettifyError2,
|
|
@@ -35411,10 +35520,10 @@ class $ZodRegistry2 {
|
|
|
35411
35520
|
return this._map.has(schema);
|
|
35412
35521
|
}
|
|
35413
35522
|
}
|
|
35414
|
-
function
|
|
35523
|
+
function registry3() {
|
|
35415
35524
|
return new $ZodRegistry2;
|
|
35416
35525
|
}
|
|
35417
|
-
(_a15 = globalThis).__zod_globalRegistry ?? (_a15.__zod_globalRegistry =
|
|
35526
|
+
(_a15 = globalThis).__zod_globalRegistry ?? (_a15.__zod_globalRegistry = registry3());
|
|
35418
35527
|
var globalRegistry2 = globalThis.__zod_globalRegistry;
|
|
35419
35528
|
// ../../node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/api.js
|
|
35420
35529
|
function _string2(Class3, params) {
|
|
@@ -37194,21 +37303,21 @@ var allProcessors2 = {
|
|
|
37194
37303
|
};
|
|
37195
37304
|
function toJSONSchema4(input, params) {
|
|
37196
37305
|
if ("_idmap" in input) {
|
|
37197
|
-
const
|
|
37306
|
+
const registry4 = input;
|
|
37198
37307
|
const ctx2 = initializeContext2({ ...params, processors: allProcessors2 });
|
|
37199
37308
|
const defs = {};
|
|
37200
|
-
for (const entry of
|
|
37309
|
+
for (const entry of registry4._idmap.entries()) {
|
|
37201
37310
|
const [_, schema] = entry;
|
|
37202
37311
|
process3(schema, ctx2);
|
|
37203
37312
|
}
|
|
37204
37313
|
const schemas = {};
|
|
37205
37314
|
const external = {
|
|
37206
|
-
registry:
|
|
37315
|
+
registry: registry4,
|
|
37207
37316
|
uri: params?.uri,
|
|
37208
37317
|
defs
|
|
37209
37318
|
};
|
|
37210
37319
|
ctx2.external = external;
|
|
37211
|
-
for (const entry of
|
|
37320
|
+
for (const entry of registry4._idmap.entries()) {
|
|
37212
37321
|
const [key, schema] = entry;
|
|
37213
37322
|
extractDefs2(ctx2, schema);
|
|
37214
37323
|
schemas[key] = finalize2(ctx2, schema);
|
|
@@ -43094,7 +43203,7 @@ class EventSourceParserStream extends TransformStream {
|
|
|
43094
43203
|
}
|
|
43095
43204
|
}
|
|
43096
43205
|
|
|
43097
|
-
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.
|
|
43206
|
+
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@4.0.21_zod@4.3.6/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
43098
43207
|
function combineHeaders(...headers) {
|
|
43099
43208
|
return headers.reduce((combinedHeaders, currentHeaders) => ({
|
|
43100
43209
|
...combinedHeaders,
|
|
@@ -43358,6 +43467,9 @@ async function downloadBlob(url4, options) {
|
|
|
43358
43467
|
const response = await fetch(url4, {
|
|
43359
43468
|
signal: options == null ? undefined : options.abortSignal
|
|
43360
43469
|
});
|
|
43470
|
+
if (response.redirected) {
|
|
43471
|
+
validateDownloadUrl(response.url);
|
|
43472
|
+
}
|
|
43361
43473
|
if (!response.ok) {
|
|
43362
43474
|
throw new DownloadError({
|
|
43363
43475
|
url: url4,
|
|
@@ -43514,7 +43626,7 @@ function withUserAgentSuffix(headers, ...userAgentSuffixParts) {
|
|
|
43514
43626
|
normalizedHeaders.set("user-agent", [currentUserAgentHeader, ...userAgentSuffixParts].filter(Boolean).join(" "));
|
|
43515
43627
|
return Object.fromEntries(normalizedHeaders.entries());
|
|
43516
43628
|
}
|
|
43517
|
-
var VERSION = "4.0.
|
|
43629
|
+
var VERSION = "4.0.21";
|
|
43518
43630
|
var getOriginalFetch = () => globalThis.fetch;
|
|
43519
43631
|
var getFromApi = async ({
|
|
43520
43632
|
url: url4,
|
|
@@ -43689,7 +43801,7 @@ function visit(def) {
|
|
|
43689
43801
|
return def;
|
|
43690
43802
|
return addAdditionalPropertiesToJsonSchema(def);
|
|
43691
43803
|
}
|
|
43692
|
-
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
43804
|
+
var ignoreOverride = /* @__PURE__ */ Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
43693
43805
|
var defaultOptions = {
|
|
43694
43806
|
name: undefined,
|
|
43695
43807
|
$refStrategy: "root",
|
|
@@ -44682,7 +44794,7 @@ var zod3ToJsonSchema = (schema, options) => {
|
|
|
44682
44794
|
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
44683
44795
|
return combined;
|
|
44684
44796
|
};
|
|
44685
|
-
var schemaSymbol = Symbol.for("vercel.ai.schema");
|
|
44797
|
+
var schemaSymbol = /* @__PURE__ */ Symbol.for("vercel.ai.schema");
|
|
44686
44798
|
function lazySchema(createSchema) {
|
|
44687
44799
|
let schema;
|
|
44688
44800
|
return () => {
|
|
@@ -44989,8 +45101,8 @@ var postToApi = async ({
|
|
|
44989
45101
|
throw handleFetchError({ error: error49, url: url4, requestBodyValues: body.values });
|
|
44990
45102
|
}
|
|
44991
45103
|
};
|
|
44992
|
-
function tool2
|
|
44993
|
-
return
|
|
45104
|
+
function tool(tool2) {
|
|
45105
|
+
return tool2;
|
|
44994
45106
|
}
|
|
44995
45107
|
function createProviderToolFactoryWithOutputSchema({
|
|
44996
45108
|
id,
|
|
@@ -45006,7 +45118,7 @@ function createProviderToolFactoryWithOutputSchema({
|
|
|
45006
45118
|
onInputDelta,
|
|
45007
45119
|
onInputAvailable,
|
|
45008
45120
|
...args
|
|
45009
|
-
}) =>
|
|
45121
|
+
}) => tool({
|
|
45010
45122
|
type: "provider",
|
|
45011
45123
|
id,
|
|
45012
45124
|
args,
|
|
@@ -45142,7 +45254,7 @@ async function* executeTool({
|
|
|
45142
45254
|
}
|
|
45143
45255
|
}
|
|
45144
45256
|
|
|
45145
|
-
// ../../node_modules/.pnpm/@ai-sdk+openai-compatible@2.0.
|
|
45257
|
+
// ../../node_modules/.pnpm/@ai-sdk+openai-compatible@2.0.37_zod@4.3.6/node_modules/@ai-sdk/openai-compatible/dist/index.mjs
|
|
45146
45258
|
var openaiCompatibleErrorDataSchema = exports_external2.object({
|
|
45147
45259
|
error: exports_external2.object({
|
|
45148
45260
|
message: exports_external2.string(),
|
|
@@ -45427,20 +45539,20 @@ function prepareTools({
|
|
|
45427
45539
|
return { tools: undefined, toolChoice: undefined, toolWarnings };
|
|
45428
45540
|
}
|
|
45429
45541
|
const openaiCompatTools = [];
|
|
45430
|
-
for (const
|
|
45431
|
-
if (
|
|
45542
|
+
for (const tool2 of tools) {
|
|
45543
|
+
if (tool2.type === "provider") {
|
|
45432
45544
|
toolWarnings.push({
|
|
45433
45545
|
type: "unsupported",
|
|
45434
|
-
feature: `provider-defined tool ${
|
|
45546
|
+
feature: `provider-defined tool ${tool2.id}`
|
|
45435
45547
|
});
|
|
45436
45548
|
} else {
|
|
45437
45549
|
openaiCompatTools.push({
|
|
45438
45550
|
type: "function",
|
|
45439
45551
|
function: {
|
|
45440
|
-
name:
|
|
45441
|
-
description:
|
|
45442
|
-
parameters:
|
|
45443
|
-
...
|
|
45552
|
+
name: tool2.name,
|
|
45553
|
+
description: tool2.description,
|
|
45554
|
+
parameters: tool2.inputSchema,
|
|
45555
|
+
...tool2.strict != null ? { strict: tool2.strict } : {}
|
|
45444
45556
|
}
|
|
45445
45557
|
});
|
|
45446
45558
|
}
|
|
@@ -46589,7 +46701,7 @@ async function fileToBlob(file3) {
|
|
|
46589
46701
|
function toCamelCase(str) {
|
|
46590
46702
|
return str.replace(/[_-]([a-z])/g, (g) => g[1].toUpperCase());
|
|
46591
46703
|
}
|
|
46592
|
-
var VERSION2 = "2.0.
|
|
46704
|
+
var VERSION2 = "2.0.37";
|
|
46593
46705
|
function createOpenAICompatible(options) {
|
|
46594
46706
|
const baseURL = withoutTrailingSlash(options.baseURL);
|
|
46595
46707
|
const providerName = options.name;
|
|
@@ -46837,22 +46949,27 @@ app.route({
|
|
|
46837
46949
|
title: "列出cnb代码仓库",
|
|
46838
46950
|
summary: "列出cnb代码仓库, 可选flags参数,如 KnowledgeBase",
|
|
46839
46951
|
args: {
|
|
46840
|
-
search:
|
|
46841
|
-
|
|
46842
|
-
|
|
46952
|
+
search: exports_external2.string().optional().describe("搜索关键词"),
|
|
46953
|
+
page: exports_external2.number().optional().describe("分页页码,默认 1"),
|
|
46954
|
+
pageSize: exports_external2.number().optional().describe("每页数量,默认99"),
|
|
46955
|
+
flags: exports_external2.string().optional().describe("仓库标记,如果是知识库则填写 KnowledgeBase")
|
|
46843
46956
|
}
|
|
46844
46957
|
})
|
|
46845
46958
|
}
|
|
46846
46959
|
}).define(async (ctx) => {
|
|
46847
46960
|
const cnb = await cnbManager.getContext(ctx);
|
|
46848
46961
|
const search = ctx.query?.search;
|
|
46849
|
-
const
|
|
46962
|
+
const page = ctx.query?.page || 1;
|
|
46963
|
+
let pageSize = ctx.query?.pageSize || 99;
|
|
46850
46964
|
const flags = ctx.query?.flags;
|
|
46851
46965
|
const params = {};
|
|
46852
46966
|
if (flags) {
|
|
46853
46967
|
params.flags = flags;
|
|
46854
46968
|
}
|
|
46855
|
-
|
|
46969
|
+
if (pageSize > 99) {
|
|
46970
|
+
pageSize = 99;
|
|
46971
|
+
}
|
|
46972
|
+
const res = await cnb.repo.getRepoList({ search, page, page_size: pageSize + 1, role: "developer", ...params });
|
|
46856
46973
|
if (res.code === 200) {
|
|
46857
46974
|
const repos = res.data.map((item) => ({
|
|
46858
46975
|
name: item.name,
|
|
@@ -46860,7 +46977,9 @@ app.route({
|
|
|
46860
46977
|
description: item.description,
|
|
46861
46978
|
web_url: item.web_url
|
|
46862
46979
|
}));
|
|
46863
|
-
|
|
46980
|
+
const list = repos.slice(0, pageSize);
|
|
46981
|
+
const hasMore = repos.length > pageSize;
|
|
46982
|
+
ctx.body = { content: JSON.stringify(repos), list, hasMore, page, pageSize };
|
|
46864
46983
|
} else {
|
|
46865
46984
|
ctx.throw(500, "获取仓库列表失败");
|
|
46866
46985
|
}
|
|
@@ -46878,9 +46997,9 @@ app.route({
|
|
|
46878
46997
|
skill: "create-repo",
|
|
46879
46998
|
title: "创建代码仓库",
|
|
46880
46999
|
args: {
|
|
46881
|
-
name:
|
|
46882
|
-
visibility:
|
|
46883
|
-
description:
|
|
47000
|
+
name: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
|
|
47001
|
+
visibility: exports_external2.string().describe("代码仓库可见性, public 或 private").default("public"),
|
|
47002
|
+
description: exports_external2.string().describe("代码仓库描述")
|
|
46884
47003
|
},
|
|
46885
47004
|
summary: "创建一个新的代码仓库"
|
|
46886
47005
|
})
|
|
@@ -46912,7 +47031,7 @@ app.route({
|
|
|
46912
47031
|
middleware: ["auth"],
|
|
46913
47032
|
metadata: {
|
|
46914
47033
|
args: {
|
|
46915
|
-
name:
|
|
47034
|
+
name: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo")
|
|
46916
47035
|
}
|
|
46917
47036
|
}
|
|
46918
47037
|
}).define(async (ctx) => {
|
|
@@ -46936,10 +47055,10 @@ app.route({
|
|
|
46936
47055
|
title: "在代码仓库中创建文件",
|
|
46937
47056
|
summary: `在代码仓库中创建文件, encoding 可选,默认 raw`,
|
|
46938
47057
|
args: {
|
|
46939
|
-
repoName:
|
|
46940
|
-
filePath:
|
|
46941
|
-
content:
|
|
46942
|
-
encoding:
|
|
47058
|
+
repoName: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
|
|
47059
|
+
filePath: exports_external2.string().describe("文件路径, 如 src/index.ts"),
|
|
47060
|
+
content: exports_external2.string().describe("文本的字符串的内容"),
|
|
47061
|
+
encoding: exports_external2.string().describe("编码方式,如 raw").optional()
|
|
46943
47062
|
}
|
|
46944
47063
|
})
|
|
46945
47064
|
}
|
|
@@ -46971,7 +47090,7 @@ app.route({
|
|
|
46971
47090
|
skill: "delete-repo",
|
|
46972
47091
|
title: "删除代码仓库",
|
|
46973
47092
|
args: {
|
|
46974
|
-
name:
|
|
47093
|
+
name: exports_external2.string().describe("代码仓库名称")
|
|
46975
47094
|
},
|
|
46976
47095
|
summary: "删除一个代码仓库"
|
|
46977
47096
|
})
|
|
@@ -47005,11 +47124,11 @@ app.route({
|
|
|
47005
47124
|
skill: "update-repo-info",
|
|
47006
47125
|
title: "更新代码仓库信息",
|
|
47007
47126
|
args: {
|
|
47008
|
-
name:
|
|
47009
|
-
description:
|
|
47010
|
-
license:
|
|
47011
|
-
site:
|
|
47012
|
-
topics:
|
|
47127
|
+
name: exports_external2.string().describe("代码仓库名称"),
|
|
47128
|
+
description: exports_external2.string().describe("代码仓库描述"),
|
|
47129
|
+
license: exports_external2.string().describe("代码仓库许可证类型,如 MIT").optional(),
|
|
47130
|
+
site: exports_external2.string().describe("代码仓库主页链接").optional(),
|
|
47131
|
+
topics: exports_external2.array(exports_external2.string()).describe("代码仓库话题标签列表").optional()
|
|
47013
47132
|
},
|
|
47014
47133
|
summary: "更新代码仓库的信息"
|
|
47015
47134
|
})
|
|
@@ -47037,8 +47156,8 @@ app.route({
|
|
|
47037
47156
|
middleware: ["auth"],
|
|
47038
47157
|
metadata: {
|
|
47039
47158
|
args: {
|
|
47040
|
-
name:
|
|
47041
|
-
visibility:
|
|
47159
|
+
name: exports_external2.string().describe("代码仓库名称"),
|
|
47160
|
+
visibility: exports_external2.string().describe("代码仓库可见性, public 或 private 或 protected")
|
|
47042
47161
|
}
|
|
47043
47162
|
}
|
|
47044
47163
|
}).define(async (ctx) => {
|
|
@@ -47071,10 +47190,10 @@ app.route({
|
|
|
47071
47190
|
title: "查询仓库标签列表",
|
|
47072
47191
|
summary: "查询仓库的标签列表",
|
|
47073
47192
|
args: {
|
|
47074
|
-
repo:
|
|
47075
|
-
page:
|
|
47076
|
-
pageSize:
|
|
47077
|
-
keyword:
|
|
47193
|
+
repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
|
|
47194
|
+
page: exports_external2.number().optional().describe("分页页码,默认 1"),
|
|
47195
|
+
pageSize: exports_external2.number().optional().describe("分页每页大小,默认 30"),
|
|
47196
|
+
keyword: exports_external2.string().optional().describe("标签搜索关键词")
|
|
47078
47197
|
}
|
|
47079
47198
|
})
|
|
47080
47199
|
}
|
|
@@ -47106,10 +47225,10 @@ app.route({
|
|
|
47106
47225
|
title: "创建仓库标签",
|
|
47107
47226
|
summary: "创建一个仓库标签",
|
|
47108
47227
|
args: {
|
|
47109
|
-
repo:
|
|
47110
|
-
name:
|
|
47111
|
-
color:
|
|
47112
|
-
description:
|
|
47228
|
+
repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
|
|
47229
|
+
name: exports_external2.string().describe("标签名称"),
|
|
47230
|
+
color: exports_external2.string().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
|
|
47231
|
+
description: exports_external2.string().optional().describe("标签描述")
|
|
47113
47232
|
}
|
|
47114
47233
|
})
|
|
47115
47234
|
}
|
|
@@ -47141,11 +47260,11 @@ app.route({
|
|
|
47141
47260
|
title: "更新仓库标签",
|
|
47142
47261
|
summary: "更新仓库标签信息",
|
|
47143
47262
|
args: {
|
|
47144
|
-
repo:
|
|
47145
|
-
name:
|
|
47146
|
-
color:
|
|
47147
|
-
description:
|
|
47148
|
-
newName:
|
|
47263
|
+
repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
|
|
47264
|
+
name: exports_external2.string().describe("标签名称"),
|
|
47265
|
+
color: exports_external2.string().optional().describe("标签颜色,十六进制颜色码,不含 # 前缀"),
|
|
47266
|
+
description: exports_external2.string().optional().describe("标签描述"),
|
|
47267
|
+
newName: exports_external2.string().optional().describe("新标签名称")
|
|
47149
47268
|
}
|
|
47150
47269
|
})
|
|
47151
47270
|
}
|
|
@@ -47178,8 +47297,8 @@ app.route({
|
|
|
47178
47297
|
title: "删除仓库标签",
|
|
47179
47298
|
summary: "删除指定的仓库标签",
|
|
47180
47299
|
args: {
|
|
47181
|
-
repo:
|
|
47182
|
-
name:
|
|
47300
|
+
repo: exports_external2.string().describe("仓库路径, 如 my-user/my-repo"),
|
|
47301
|
+
name: exports_external2.string().describe("标签名称")
|
|
47183
47302
|
}
|
|
47184
47303
|
})
|
|
47185
47304
|
}
|
|
@@ -47334,8 +47453,8 @@ app.route({
|
|
|
47334
47453
|
tags: [],
|
|
47335
47454
|
...{
|
|
47336
47455
|
args: {
|
|
47337
|
-
repo:
|
|
47338
|
-
pipelineId:
|
|
47456
|
+
repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
|
|
47457
|
+
pipelineId: exports_external2.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
|
|
47339
47458
|
}
|
|
47340
47459
|
}
|
|
47341
47460
|
}
|
|
@@ -47374,8 +47493,8 @@ app.route({
|
|
|
47374
47493
|
tags: [],
|
|
47375
47494
|
...{
|
|
47376
47495
|
args: {
|
|
47377
|
-
repo:
|
|
47378
|
-
pipelineId:
|
|
47496
|
+
repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
|
|
47497
|
+
pipelineId: exports_external2.string().describe("流水线ID,例如 cnb-708-1ji9sog7o-001")
|
|
47379
47498
|
}
|
|
47380
47499
|
}
|
|
47381
47500
|
}
|
|
@@ -47426,11 +47545,11 @@ app.route({
|
|
|
47426
47545
|
title: "云端构建",
|
|
47427
47546
|
summary: "在云端构建代码仓库,参数包括 event, repo, branch, ref, config, env",
|
|
47428
47547
|
args: {
|
|
47429
|
-
env:
|
|
47430
|
-
event:
|
|
47431
|
-
branch:
|
|
47432
|
-
config:
|
|
47433
|
-
repo:
|
|
47548
|
+
env: exports_external2.any().optional().describe('构建环境变量,格式为 { "KEY": "VALUE" }'),
|
|
47549
|
+
event: exports_external2.string().optional().describe("触发事件类型,例如 api_trigger_event"),
|
|
47550
|
+
branch: exports_external2.string().optional().describe("分支名称,默认主分支"),
|
|
47551
|
+
config: exports_external2.string().describe("构建config文件内容,例如 cloudbuild.yaml对应的yml的内容"),
|
|
47552
|
+
repo: exports_external2.string().describe("代码仓库路径,例如 user/repo")
|
|
47434
47553
|
}
|
|
47435
47554
|
})
|
|
47436
47555
|
}
|
|
@@ -47453,6 +47572,62 @@ app.route({
|
|
|
47453
47572
|
ctx.forward(res);
|
|
47454
47573
|
}).addTo(app);
|
|
47455
47574
|
|
|
47575
|
+
// agent/routes/workspace/rerun.ts
|
|
47576
|
+
app.route({
|
|
47577
|
+
path: "cnb",
|
|
47578
|
+
key: "rerun",
|
|
47579
|
+
description: "重新启动工作区,定时任务",
|
|
47580
|
+
middleware: ["auth"],
|
|
47581
|
+
metadata: {
|
|
47582
|
+
args: {
|
|
47583
|
+
repo: zod_default.string().optional().describe("仓库名称,例如:owner/repo"),
|
|
47584
|
+
config: zod_default.string().optional().describe("工作区配置"),
|
|
47585
|
+
event: zod_default.string().optional().describe("触发事件来源,api_trigger_event")
|
|
47586
|
+
}
|
|
47587
|
+
}
|
|
47588
|
+
}).define(async (ctx) => {
|
|
47589
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
47590
|
+
const repo2 = ctx.args.repo;
|
|
47591
|
+
const config3 = ctx.args.config;
|
|
47592
|
+
const event = ctx.args.event || "api_trigger_event";
|
|
47593
|
+
const res = await cnb.workspace.list({ status: "running" });
|
|
47594
|
+
if (res.code !== 200) {
|
|
47595
|
+
ctx.throw(500, res.message || "Failed to list workspaces");
|
|
47596
|
+
}
|
|
47597
|
+
const list = res.data?.list || [];
|
|
47598
|
+
const _list = list.filter((item) => {
|
|
47599
|
+
if (repo2) {
|
|
47600
|
+
if (item.slug === repo2) {
|
|
47601
|
+
return true;
|
|
47602
|
+
}
|
|
47603
|
+
} else {
|
|
47604
|
+
if (item.slug.includes("/dev")) {
|
|
47605
|
+
return true;
|
|
47606
|
+
}
|
|
47607
|
+
}
|
|
47608
|
+
return false;
|
|
47609
|
+
});
|
|
47610
|
+
for (const item of _list) {
|
|
47611
|
+
const branch = item.branch || "main";
|
|
47612
|
+
const repo3 = item.slug;
|
|
47613
|
+
const sn = item.sn;
|
|
47614
|
+
const res2 = await cnb.workspace.stopWorkspace({ sn });
|
|
47615
|
+
if (res2.code !== 200) {
|
|
47616
|
+
ctx.throw(500, res2.message || "Failed to stop workspace");
|
|
47617
|
+
} else {
|
|
47618
|
+
console.log(`工作区 ${repo3} 停止成功,${res2.data?.buildLogUrl ? `构建日志链接: ${res2.data.buildLogUrl}` : ""}`);
|
|
47619
|
+
}
|
|
47620
|
+
if (config3) {
|
|
47621
|
+
await cnb.build.startBuild(repo3, { branch, config: config3, event });
|
|
47622
|
+
} else {
|
|
47623
|
+
await cnb.workspace.startWorkspace(repo3, { branch });
|
|
47624
|
+
}
|
|
47625
|
+
}
|
|
47626
|
+
ctx.body = {
|
|
47627
|
+
content: "工作区重新启动中"
|
|
47628
|
+
};
|
|
47629
|
+
}).addTo(app);
|
|
47630
|
+
|
|
47456
47631
|
// agent/routes/workspace/index.ts
|
|
47457
47632
|
app.route({
|
|
47458
47633
|
path: "cnb",
|
|
@@ -47466,9 +47641,9 @@ app.route({
|
|
|
47466
47641
|
title: "启动cnb工作空间",
|
|
47467
47642
|
summary: "启动cnb工作空间",
|
|
47468
47643
|
args: {
|
|
47469
|
-
repo:
|
|
47470
|
-
branch:
|
|
47471
|
-
ref:
|
|
47644
|
+
repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
|
|
47645
|
+
branch: exports_external2.string().optional().describe("分支名称,默认主分支"),
|
|
47646
|
+
ref: exports_external2.string().optional().describe("提交引用,例如 commit sha")
|
|
47472
47647
|
}
|
|
47473
47648
|
})
|
|
47474
47649
|
}
|
|
@@ -47498,11 +47673,11 @@ app.route({
|
|
|
47498
47673
|
title: "列出cnb工作空间",
|
|
47499
47674
|
summary: "列出cnb工作空间列表,支持按状态过滤, status 可选值 running 或 closed",
|
|
47500
47675
|
args: {
|
|
47501
|
-
status:
|
|
47502
|
-
page:
|
|
47503
|
-
pageSize:
|
|
47504
|
-
slug:
|
|
47505
|
-
branch:
|
|
47676
|
+
status: exports_external2.string().optional().describe("开发环境状态,running: 运行中,closed: 已关闭和停止的"),
|
|
47677
|
+
page: exports_external2.number().optional().describe("分页页码,默认 1"),
|
|
47678
|
+
pageSize: exports_external2.number().optional().describe("分页大小,默认 20,最大 100"),
|
|
47679
|
+
slug: exports_external2.string().optional().describe("仓库路径,例如 groupname/reponame"),
|
|
47680
|
+
branch: exports_external2.string().optional().describe("分支名称")
|
|
47506
47681
|
}
|
|
47507
47682
|
})
|
|
47508
47683
|
}
|
|
@@ -47528,8 +47703,8 @@ app.route({
|
|
|
47528
47703
|
title: "获取工作空间详情",
|
|
47529
47704
|
summary: "获取工作空间详细信息",
|
|
47530
47705
|
args: {
|
|
47531
|
-
repo:
|
|
47532
|
-
sn:
|
|
47706
|
+
repo: exports_external2.string().describe("代码仓库路径,例如 user/repo"),
|
|
47707
|
+
sn: exports_external2.string().describe("工作空间流水线的 sn")
|
|
47533
47708
|
}
|
|
47534
47709
|
})
|
|
47535
47710
|
}
|
|
@@ -47558,9 +47733,9 @@ app.route({
|
|
|
47558
47733
|
title: "删除工作空间",
|
|
47559
47734
|
summary: "删除工作空间,pipelineId 和 sn 二选一",
|
|
47560
47735
|
args: {
|
|
47561
|
-
pipelineId:
|
|
47562
|
-
sn:
|
|
47563
|
-
sns:
|
|
47736
|
+
pipelineId: exports_external2.string().optional().describe("流水线 ID,优先使用"),
|
|
47737
|
+
sn: exports_external2.string().optional().describe("流水线构建号"),
|
|
47738
|
+
sns: exports_external2.array(exports_external2.string()).optional().describe("批量流水线构建号")
|
|
47564
47739
|
}
|
|
47565
47740
|
})
|
|
47566
47741
|
}
|
|
@@ -47596,8 +47771,8 @@ app.route({
|
|
|
47596
47771
|
title: "停止工作空间",
|
|
47597
47772
|
summary: "停止运行中的工作空间",
|
|
47598
47773
|
args: {
|
|
47599
|
-
pipelineId:
|
|
47600
|
-
sn:
|
|
47774
|
+
pipelineId: exports_external2.string().optional().describe("流水线 ID,优先使用"),
|
|
47775
|
+
sn: exports_external2.string().optional().describe("流水线构建号")
|
|
47601
47776
|
}
|
|
47602
47777
|
})
|
|
47603
47778
|
}
|
|
@@ -47625,9 +47800,9 @@ app.route({
|
|
|
47625
47800
|
title: "调用app应用",
|
|
47626
47801
|
summary: "调用router的应用, 参数path, key, payload",
|
|
47627
47802
|
args: {
|
|
47628
|
-
path:
|
|
47629
|
-
key:
|
|
47630
|
-
payload:
|
|
47803
|
+
path: exports_external2.string().describe("应用路径,例如 cnb"),
|
|
47804
|
+
key: exports_external2.string().optional().describe("应用key,例如 list-repos"),
|
|
47805
|
+
payload: exports_external2.object({}).optional().describe("调用参数")
|
|
47631
47806
|
}
|
|
47632
47807
|
})
|
|
47633
47808
|
}
|
|
@@ -47674,7 +47849,7 @@ app.route({
|
|
|
47674
47849
|
title: "获取当前cnb工作空间的port代理uri",
|
|
47675
47850
|
summary: "获取当前cnb工作空间的port代理uri,用于端口转发",
|
|
47676
47851
|
args: {
|
|
47677
|
-
port:
|
|
47852
|
+
port: exports_external2.number().optional().describe("端口号,默认为51515")
|
|
47678
47853
|
}
|
|
47679
47854
|
})
|
|
47680
47855
|
}
|
|
@@ -47701,11 +47876,11 @@ app.route({
|
|
|
47701
47876
|
title: "获取当前cnb工作空间的编辑器访问地址",
|
|
47702
47877
|
summary: "获取当前cnb工作空间的vscode代理uri,用于在浏览器中访问vscode,包含多种访问方式,如web、vscode、codebuddy、cursor、ssh",
|
|
47703
47878
|
args: {
|
|
47704
|
-
web:
|
|
47705
|
-
vscode:
|
|
47706
|
-
codebuddy:
|
|
47707
|
-
cursor:
|
|
47708
|
-
ssh:
|
|
47879
|
+
web: exports_external2.boolean().optional().describe("是否获取vscode web的访问uri,默认为false"),
|
|
47880
|
+
vscode: exports_external2.boolean().optional().describe("是否获取vscode的代理uri,默认为true"),
|
|
47881
|
+
codebuddy: exports_external2.boolean().optional().describe("是否获取codebuddy的代理uri,默认为false"),
|
|
47882
|
+
cursor: exports_external2.boolean().optional().describe("是否获取cursor的代理uri,默认为false"),
|
|
47883
|
+
ssh: exports_external2.boolean().optional().describe("是否获取vscode remote ssh的连接字符串,默认为false")
|
|
47709
47884
|
}
|
|
47710
47885
|
})
|
|
47711
47886
|
}
|
|
@@ -47764,7 +47939,7 @@ app.route({
|
|
|
47764
47939
|
title: "设置当前cnb工作空间的cookie环境变量",
|
|
47765
47940
|
summary: "设置当前cnb工作空间的cookie环境变量,用于界面操作定制模块功能,例子:CNBSESSION=xxxx;csrfkey=2222xxxx;",
|
|
47766
47941
|
args: {
|
|
47767
|
-
cookie:
|
|
47942
|
+
cookie: exports_external2.string().describe("cnb的cookie值")
|
|
47768
47943
|
}
|
|
47769
47944
|
})
|
|
47770
47945
|
}
|
|
@@ -48101,8 +48276,8 @@ app.route({
|
|
|
48101
48276
|
title: "调用cnb的知识库ai对话功能进行聊天",
|
|
48102
48277
|
summary: "调用cnb的知识库ai对话功能进行聊天,基于cnb提供的ai能力",
|
|
48103
48278
|
args: {
|
|
48104
|
-
question:
|
|
48105
|
-
repo:
|
|
48279
|
+
question: exports_external2.string().describe("用户输入的消息内容"),
|
|
48280
|
+
repo: exports_external2.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
|
|
48106
48281
|
}
|
|
48107
48282
|
})
|
|
48108
48283
|
}
|
|
@@ -48204,8 +48379,8 @@ app.route({
|
|
|
48204
48379
|
title: "调用cnb的知识库RAG查询功能进行问答",
|
|
48205
48380
|
summary: "调用cnb的知识库RAG查询功能进行问答,基于cnb提供的知识库能力",
|
|
48206
48381
|
args: {
|
|
48207
|
-
question:
|
|
48208
|
-
repo:
|
|
48382
|
+
question: exports_external2.string().describe("用户输入的消息内容"),
|
|
48383
|
+
repo: exports_external2.string().optional().describe("知识库仓库ID,默认为空表示使用默认知识库")
|
|
48209
48384
|
}
|
|
48210
48385
|
})
|
|
48211
48386
|
}
|
|
@@ -48267,13 +48442,13 @@ app.route({
|
|
|
48267
48442
|
skill: "list-issues",
|
|
48268
48443
|
title: "查询 Issue 列表",
|
|
48269
48444
|
args: {
|
|
48270
|
-
repo:
|
|
48271
|
-
state:
|
|
48272
|
-
keyword:
|
|
48273
|
-
labels:
|
|
48274
|
-
page:
|
|
48275
|
-
page_size:
|
|
48276
|
-
order_by:
|
|
48445
|
+
repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
|
|
48446
|
+
state: exports_external2.string().optional().describe("Issue 状态:open 或 closed"),
|
|
48447
|
+
keyword: exports_external2.string().optional().describe("问题搜索关键词"),
|
|
48448
|
+
labels: exports_external2.string().optional().describe("问题标签,多个用逗号分隔"),
|
|
48449
|
+
page: exports_external2.number().optional().describe("分页页码,默认: 1"),
|
|
48450
|
+
page_size: exports_external2.number().optional().describe("分页每页大小,默认: 30"),
|
|
48451
|
+
order_by: exports_external2.string().optional().describe("排序方式,如 created_at, -updated_at")
|
|
48277
48452
|
},
|
|
48278
48453
|
summary: "查询 Issue 列表"
|
|
48279
48454
|
})
|
|
@@ -48317,8 +48492,8 @@ app.route({
|
|
|
48317
48492
|
skill: "getIssue",
|
|
48318
48493
|
title: "获取 单个 Issue",
|
|
48319
48494
|
args: {
|
|
48320
|
-
repo:
|
|
48321
|
-
issueNumber:
|
|
48495
|
+
repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
|
|
48496
|
+
issueNumber: exports_external2.union([exports_external2.string(), exports_external2.number()]).describe("Issue 编号")
|
|
48322
48497
|
},
|
|
48323
48498
|
summary: "获取 单个 Issue"
|
|
48324
48499
|
})
|
|
@@ -48349,12 +48524,12 @@ app.route({
|
|
|
48349
48524
|
skill: "create-issue",
|
|
48350
48525
|
title: "创建 Issue",
|
|
48351
48526
|
args: {
|
|
48352
|
-
repo:
|
|
48353
|
-
title:
|
|
48354
|
-
body:
|
|
48355
|
-
assignees:
|
|
48356
|
-
labels:
|
|
48357
|
-
priority:
|
|
48527
|
+
repo: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
|
|
48528
|
+
title: exports_external2.string().describe("Issue 标题"),
|
|
48529
|
+
body: exports_external2.string().optional().describe("Issue 描述内容"),
|
|
48530
|
+
assignees: exports_external2.array(exports_external2.string()).optional().describe("指派人列表"),
|
|
48531
|
+
labels: exports_external2.array(exports_external2.string()).optional().describe("标签列表"),
|
|
48532
|
+
priority: exports_external2.string().optional().describe("优先级")
|
|
48358
48533
|
},
|
|
48359
48534
|
summary: "创建一个新的 Issue"
|
|
48360
48535
|
})
|
|
@@ -48390,9 +48565,9 @@ app.route({
|
|
|
48390
48565
|
skill: "complete-issue",
|
|
48391
48566
|
title: "完成 CNB的任务Issue",
|
|
48392
48567
|
args: {
|
|
48393
|
-
repo:
|
|
48394
|
-
issueNumber:
|
|
48395
|
-
state:
|
|
48568
|
+
repo: exports_external2.string().describe("代码仓库名称, 如 my-user/my-repo"),
|
|
48569
|
+
issueNumber: exports_external2.union([exports_external2.string(), exports_external2.number()]).describe("Issue 编号"),
|
|
48570
|
+
state: exports_external2.string().optional().describe("Issue 状态,默认为 closed")
|
|
48396
48571
|
},
|
|
48397
48572
|
summary: "完成一个 Issue(将 state 改为 closed)"
|
|
48398
48573
|
})
|
|
@@ -48425,10 +48600,10 @@ app.route({
|
|
|
48425
48600
|
skill: "list-issue-comments",
|
|
48426
48601
|
title: "查询 Issue 评论列表",
|
|
48427
48602
|
args: {
|
|
48428
|
-
repo:
|
|
48429
|
-
issueNumber:
|
|
48430
|
-
page:
|
|
48431
|
-
page_size:
|
|
48603
|
+
repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
|
|
48604
|
+
issueNumber: exports_external2.number().describe("Issue 编号"),
|
|
48605
|
+
page: exports_external2.number().optional().describe("分页页码,默认: 1"),
|
|
48606
|
+
page_size: exports_external2.number().optional().describe("分页每页大小,默认: 30")
|
|
48432
48607
|
},
|
|
48433
48608
|
summary: "查询 Issue 评论列表"
|
|
48434
48609
|
})
|
|
@@ -48437,8 +48612,8 @@ app.route({
|
|
|
48437
48612
|
const cnb = await cnbManager.getContext(ctx);
|
|
48438
48613
|
let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
|
|
48439
48614
|
const issueNumber = ctx.query?.issueNumber;
|
|
48440
|
-
const page = ctx.query?.page
|
|
48441
|
-
const page_size = ctx.query?.page_size
|
|
48615
|
+
const page = ctx.query?.page ?? 1;
|
|
48616
|
+
const page_size = ctx.query?.page_size ?? 100;
|
|
48442
48617
|
if (!repo2) {
|
|
48443
48618
|
ctx.throw(400, "缺少参数 repo");
|
|
48444
48619
|
}
|
|
@@ -48464,10 +48639,10 @@ app.route({
|
|
|
48464
48639
|
skill: "create-issue-comment",
|
|
48465
48640
|
title: "创建 Issue 评论",
|
|
48466
48641
|
args: {
|
|
48467
|
-
repo:
|
|
48468
|
-
issueNumber:
|
|
48469
|
-
body:
|
|
48470
|
-
clearAt:
|
|
48642
|
+
repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
|
|
48643
|
+
issueNumber: exports_external2.number().describe("Issue 编号"),
|
|
48644
|
+
body: exports_external2.string().describe("评论内容"),
|
|
48645
|
+
clearAt: exports_external2.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
|
|
48471
48646
|
},
|
|
48472
48647
|
summary: "创建 Issue 评论"
|
|
48473
48648
|
})
|
|
@@ -48504,9 +48679,9 @@ app.route({
|
|
|
48504
48679
|
skill: "get-issue-comment",
|
|
48505
48680
|
title: "获取 Issue 评论",
|
|
48506
48681
|
args: {
|
|
48507
|
-
repo:
|
|
48508
|
-
issueNumber:
|
|
48509
|
-
commentId:
|
|
48682
|
+
repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
|
|
48683
|
+
issueNumber: exports_external2.number().describe("Issue 编号"),
|
|
48684
|
+
commentId: exports_external2.number().describe("评论 ID")
|
|
48510
48685
|
},
|
|
48511
48686
|
summary: "获取 Issue 评论"
|
|
48512
48687
|
})
|
|
@@ -48539,11 +48714,11 @@ app.route({
|
|
|
48539
48714
|
skill: "update-issue-comment",
|
|
48540
48715
|
title: "修改 Issue 评论",
|
|
48541
48716
|
args: {
|
|
48542
|
-
repo:
|
|
48543
|
-
issueNumber:
|
|
48544
|
-
commentId:
|
|
48545
|
-
body:
|
|
48546
|
-
clearAt:
|
|
48717
|
+
repo: exports_external2.string().optional().describe("代码仓库名称, 如 my-user/my-repo"),
|
|
48718
|
+
issueNumber: exports_external2.number().describe("Issue 编号"),
|
|
48719
|
+
commentId: exports_external2.number().describe("评论 ID"),
|
|
48720
|
+
body: exports_external2.string().describe("评论内容"),
|
|
48721
|
+
clearAt: exports_external2.boolean().optional().describe("是否清除评论内容中的 @ 提及,默认: true")
|
|
48547
48722
|
},
|
|
48548
48723
|
summary: "修改 Issue 评论"
|
|
48549
48724
|
})
|
|
@@ -49459,7 +49634,7 @@ app.route({
|
|
|
49459
49634
|
};
|
|
49460
49635
|
}).addTo(app);
|
|
49461
49636
|
|
|
49462
|
-
// ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.
|
|
49637
|
+
// ../../node_modules/.pnpm/@ai-sdk+gateway@3.0.77_zod@4.3.6/node_modules/@ai-sdk/gateway/dist/index.mjs
|
|
49463
49638
|
var import_oidc = __toESM(require_dist(), 1);
|
|
49464
49639
|
var import_oidc2 = __toESM(require_dist(), 1);
|
|
49465
49640
|
var marker17 = "vercel.ai.gateway.error";
|
|
@@ -50525,7 +50700,7 @@ async function getVercelRequestId() {
|
|
|
50525
50700
|
var _a92;
|
|
50526
50701
|
return (_a92 = import_oidc.getContext().headers) == null ? undefined : _a92["x-vercel-id"];
|
|
50527
50702
|
}
|
|
50528
|
-
var VERSION3 = "3.0.
|
|
50703
|
+
var VERSION3 = "3.0.77";
|
|
50529
50704
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
50530
50705
|
function createGatewayProvider(options = {}) {
|
|
50531
50706
|
var _a92, _b92;
|
|
@@ -50681,7 +50856,7 @@ async function getGatewayAuthToken(options) {
|
|
|
50681
50856
|
};
|
|
50682
50857
|
}
|
|
50683
50858
|
|
|
50684
|
-
// ../../node_modules/.pnpm/ai@6.0.
|
|
50859
|
+
// ../../node_modules/.pnpm/ai@6.0.134_zod@4.3.6/node_modules/ai/dist/index.mjs
|
|
50685
50860
|
var import_api = __toESM(require_src(), 1);
|
|
50686
50861
|
var import_api2 = __toESM(require_src(), 1);
|
|
50687
50862
|
var __defProp4 = Object.defineProperty;
|
|
@@ -51252,7 +51427,7 @@ function detectMediaType({
|
|
|
51252
51427
|
}
|
|
51253
51428
|
return;
|
|
51254
51429
|
}
|
|
51255
|
-
var VERSION4 = "6.0.
|
|
51430
|
+
var VERSION4 = "6.0.134";
|
|
51256
51431
|
var download = async ({
|
|
51257
51432
|
url: url4,
|
|
51258
51433
|
maxBytes,
|
|
@@ -51266,6 +51441,9 @@ var download = async ({
|
|
|
51266
51441
|
headers: withUserAgentSuffix({}, `ai-sdk/${VERSION4}`, getRuntimeEnvironmentUserAgent()),
|
|
51267
51442
|
signal: abortSignal
|
|
51268
51443
|
});
|
|
51444
|
+
if (response.redirected) {
|
|
51445
|
+
validateDownloadUrl(response.url);
|
|
51446
|
+
}
|
|
51269
51447
|
if (!response.ok) {
|
|
51270
51448
|
throw new DownloadError({
|
|
51271
51449
|
url: urlText,
|
|
@@ -51669,7 +51847,7 @@ async function createToolModelOutput({
|
|
|
51669
51847
|
toolCallId,
|
|
51670
51848
|
input,
|
|
51671
51849
|
output,
|
|
51672
|
-
tool:
|
|
51850
|
+
tool: tool2,
|
|
51673
51851
|
errorMode
|
|
51674
51852
|
}) {
|
|
51675
51853
|
if (errorMode === "text") {
|
|
@@ -51677,8 +51855,8 @@ async function createToolModelOutput({
|
|
|
51677
51855
|
} else if (errorMode === "json") {
|
|
51678
51856
|
return { type: "error-json", value: toJSONValue(output) };
|
|
51679
51857
|
}
|
|
51680
|
-
if (
|
|
51681
|
-
return await
|
|
51858
|
+
if (tool2 == null ? undefined : tool2.toModelOutput) {
|
|
51859
|
+
return await tool2.toModelOutput({ toolCallId, input, output });
|
|
51682
51860
|
}
|
|
51683
51861
|
return typeof output === "string" ? { type: "text", value: output } : { type: "json", value: toJSONValue(output) };
|
|
51684
51862
|
}
|
|
@@ -51792,8 +51970,8 @@ async function prepareToolsAndToolChoice({
|
|
|
51792
51970
|
}
|
|
51793
51971
|
const filteredTools = activeTools != null ? Object.entries(tools).filter(([name21]) => activeTools.includes(name21)) : Object.entries(tools);
|
|
51794
51972
|
const languageModelTools = [];
|
|
51795
|
-
for (const [name21,
|
|
51796
|
-
const toolType =
|
|
51973
|
+
for (const [name21, tool2] of filteredTools) {
|
|
51974
|
+
const toolType = tool2.type;
|
|
51797
51975
|
switch (toolType) {
|
|
51798
51976
|
case undefined:
|
|
51799
51977
|
case "dynamic":
|
|
@@ -51801,19 +51979,19 @@ async function prepareToolsAndToolChoice({
|
|
|
51801
51979
|
languageModelTools.push({
|
|
51802
51980
|
type: "function",
|
|
51803
51981
|
name: name21,
|
|
51804
|
-
description:
|
|
51805
|
-
inputSchema: await asSchema(
|
|
51806
|
-
...
|
|
51807
|
-
providerOptions:
|
|
51808
|
-
...
|
|
51982
|
+
description: tool2.description,
|
|
51983
|
+
inputSchema: await asSchema(tool2.inputSchema).jsonSchema,
|
|
51984
|
+
...tool2.inputExamples != null ? { inputExamples: tool2.inputExamples } : {},
|
|
51985
|
+
providerOptions: tool2.providerOptions,
|
|
51986
|
+
...tool2.strict != null ? { strict: tool2.strict } : {}
|
|
51809
51987
|
});
|
|
51810
51988
|
break;
|
|
51811
51989
|
case "provider":
|
|
51812
51990
|
languageModelTools.push({
|
|
51813
51991
|
type: "provider",
|
|
51814
51992
|
name: name21,
|
|
51815
|
-
id:
|
|
51816
|
-
args:
|
|
51993
|
+
id: tool2.id,
|
|
51994
|
+
args: tool2.args
|
|
51817
51995
|
});
|
|
51818
51996
|
break;
|
|
51819
51997
|
default: {
|
|
@@ -52579,8 +52757,8 @@ async function executeToolCall({
|
|
|
52579
52757
|
onToolCallFinish
|
|
52580
52758
|
}) {
|
|
52581
52759
|
const { toolName, toolCallId, input } = toolCall;
|
|
52582
|
-
const
|
|
52583
|
-
if ((
|
|
52760
|
+
const tool2 = tools == null ? undefined : tools[toolName];
|
|
52761
|
+
if ((tool2 == null ? undefined : tool2.execute) == null) {
|
|
52584
52762
|
return;
|
|
52585
52763
|
}
|
|
52586
52764
|
const baseCallbackEvent = {
|
|
@@ -52616,7 +52794,7 @@ async function executeToolCall({
|
|
|
52616
52794
|
const startTime = now();
|
|
52617
52795
|
try {
|
|
52618
52796
|
const stream = executeTool({
|
|
52619
|
-
execute:
|
|
52797
|
+
execute: tool2.execute.bind(tool2),
|
|
52620
52798
|
input,
|
|
52621
52799
|
options: {
|
|
52622
52800
|
toolCallId,
|
|
@@ -52655,7 +52833,7 @@ async function executeToolCall({
|
|
|
52655
52833
|
toolName,
|
|
52656
52834
|
input,
|
|
52657
52835
|
error: error49,
|
|
52658
|
-
dynamic:
|
|
52836
|
+
dynamic: tool2.type === "dynamic",
|
|
52659
52837
|
...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
|
|
52660
52838
|
};
|
|
52661
52839
|
}
|
|
@@ -52685,7 +52863,7 @@ async function executeToolCall({
|
|
|
52685
52863
|
toolName,
|
|
52686
52864
|
input,
|
|
52687
52865
|
output,
|
|
52688
|
-
dynamic:
|
|
52866
|
+
dynamic: tool2.type === "dynamic",
|
|
52689
52867
|
...toolCall.providerMetadata != null ? { providerMetadata: toolCall.providerMetadata } : {}
|
|
52690
52868
|
};
|
|
52691
52869
|
}
|
|
@@ -52727,18 +52905,18 @@ var DefaultGeneratedFile = class {
|
|
|
52727
52905
|
}
|
|
52728
52906
|
};
|
|
52729
52907
|
async function isApprovalNeeded({
|
|
52730
|
-
tool:
|
|
52908
|
+
tool: tool2,
|
|
52731
52909
|
toolCall,
|
|
52732
52910
|
messages,
|
|
52733
52911
|
experimental_context
|
|
52734
52912
|
}) {
|
|
52735
|
-
if (
|
|
52913
|
+
if (tool2.needsApproval == null) {
|
|
52736
52914
|
return false;
|
|
52737
52915
|
}
|
|
52738
|
-
if (typeof
|
|
52739
|
-
return
|
|
52916
|
+
if (typeof tool2.needsApproval === "boolean") {
|
|
52917
|
+
return tool2.needsApproval;
|
|
52740
52918
|
}
|
|
52741
|
-
return await
|
|
52919
|
+
return await tool2.needsApproval(toolCall.input, {
|
|
52742
52920
|
toolCallId: toolCall.toolCallId,
|
|
52743
52921
|
messages,
|
|
52744
52922
|
experimental_context
|
|
@@ -53473,8 +53651,8 @@ async function doParseToolCall({
|
|
|
53473
53651
|
tools
|
|
53474
53652
|
}) {
|
|
53475
53653
|
const toolName = toolCall.toolName;
|
|
53476
|
-
const
|
|
53477
|
-
if (
|
|
53654
|
+
const tool2 = tools[toolName];
|
|
53655
|
+
if (tool2 == null) {
|
|
53478
53656
|
if (toolCall.providerExecuted && toolCall.dynamic) {
|
|
53479
53657
|
return await parseProviderExecutedDynamicToolCall(toolCall);
|
|
53480
53658
|
}
|
|
@@ -53483,7 +53661,7 @@ async function doParseToolCall({
|
|
|
53483
53661
|
availableTools: Object.keys(tools)
|
|
53484
53662
|
});
|
|
53485
53663
|
}
|
|
53486
|
-
const schema = asSchema(
|
|
53664
|
+
const schema = asSchema(tool2.inputSchema);
|
|
53487
53665
|
const parseResult = toolCall.input.trim() === "" ? await safeValidateTypes({ value: {}, schema }) : await safeParseJSON({ text: toolCall.input, schema });
|
|
53488
53666
|
if (parseResult.success === false) {
|
|
53489
53667
|
throw new InvalidToolInputError({
|
|
@@ -53492,7 +53670,7 @@ async function doParseToolCall({
|
|
|
53492
53670
|
cause: parseResult.error
|
|
53493
53671
|
});
|
|
53494
53672
|
}
|
|
53495
|
-
return
|
|
53673
|
+
return tool2.type === "dynamic" ? {
|
|
53496
53674
|
type: "tool-call",
|
|
53497
53675
|
toolCallId: toolCall.toolCallId,
|
|
53498
53676
|
toolName: toolCall.toolName,
|
|
@@ -53500,7 +53678,7 @@ async function doParseToolCall({
|
|
|
53500
53678
|
providerExecuted: toolCall.providerExecuted,
|
|
53501
53679
|
providerMetadata: toolCall.providerMetadata,
|
|
53502
53680
|
dynamic: true,
|
|
53503
|
-
title:
|
|
53681
|
+
title: tool2.title
|
|
53504
53682
|
} : {
|
|
53505
53683
|
type: "tool-call",
|
|
53506
53684
|
toolCallId: toolCall.toolCallId,
|
|
@@ -53508,7 +53686,7 @@ async function doParseToolCall({
|
|
|
53508
53686
|
input: parseResult.value,
|
|
53509
53687
|
providerExecuted: toolCall.providerExecuted,
|
|
53510
53688
|
providerMetadata: toolCall.providerMetadata,
|
|
53511
|
-
title:
|
|
53689
|
+
title: tool2.title
|
|
53512
53690
|
};
|
|
53513
53691
|
}
|
|
53514
53692
|
var DefaultStepResult = class {
|
|
@@ -53848,7 +54026,7 @@ async function generateText({
|
|
|
53848
54026
|
}),
|
|
53849
54027
|
tracer,
|
|
53850
54028
|
fn: async (span) => {
|
|
53851
|
-
var _a21, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
54029
|
+
var _a21, _b16, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
53852
54030
|
const initialMessages = initialPrompt.messages;
|
|
53853
54031
|
const responseMessages = [];
|
|
53854
54032
|
const { approvedToolApprovals, deniedToolApprovals } = collectToolApprovals({ messages: initialMessages });
|
|
@@ -54012,7 +54190,7 @@ async function generateText({
|
|
|
54012
54190
|
input: () => stringifyForTelemetry(promptMessages)
|
|
54013
54191
|
},
|
|
54014
54192
|
"ai.prompt.tools": {
|
|
54015
|
-
input: () => stepTools == null ? undefined : stepTools.map((
|
|
54193
|
+
input: () => stepTools == null ? undefined : stepTools.map((tool2) => JSON.stringify(tool2))
|
|
54016
54194
|
},
|
|
54017
54195
|
"ai.prompt.toolChoice": {
|
|
54018
54196
|
input: () => stepToolChoice != null ? JSON.stringify(stepToolChoice) : undefined
|
|
@@ -54048,6 +54226,7 @@ async function generateText({
|
|
|
54048
54226
|
headers: (_g2 = result.response) == null ? undefined : _g2.headers,
|
|
54049
54227
|
body: (_h2 = result.response) == null ? undefined : _h2.body
|
|
54050
54228
|
};
|
|
54229
|
+
const usage = asLanguageModelUsage(result.usage);
|
|
54051
54230
|
span2.setAttributes(await selectTelemetryAttributes({
|
|
54052
54231
|
telemetry,
|
|
54053
54232
|
attributes: {
|
|
@@ -54068,8 +54247,16 @@ async function generateText({
|
|
|
54068
54247
|
"ai.response.model": responseData.modelId,
|
|
54069
54248
|
"ai.response.timestamp": responseData.timestamp.toISOString(),
|
|
54070
54249
|
"ai.response.providerMetadata": JSON.stringify(result.providerMetadata),
|
|
54071
|
-
"ai.usage.
|
|
54072
|
-
"ai.usage.
|
|
54250
|
+
"ai.usage.inputTokens": result.usage.inputTokens.total,
|
|
54251
|
+
"ai.usage.inputTokenDetails.noCacheTokens": result.usage.inputTokens.noCache,
|
|
54252
|
+
"ai.usage.inputTokenDetails.cacheReadTokens": result.usage.inputTokens.cacheRead,
|
|
54253
|
+
"ai.usage.inputTokenDetails.cacheWriteTokens": result.usage.inputTokens.cacheWrite,
|
|
54254
|
+
"ai.usage.outputTokens": result.usage.outputTokens.total,
|
|
54255
|
+
"ai.usage.outputTokenDetails.textTokens": result.usage.outputTokens.text,
|
|
54256
|
+
"ai.usage.outputTokenDetails.reasoningTokens": result.usage.outputTokens.reasoning,
|
|
54257
|
+
"ai.usage.totalTokens": usage.totalTokens,
|
|
54258
|
+
"ai.usage.reasoningTokens": result.usage.outputTokens.reasoning,
|
|
54259
|
+
"ai.usage.cachedInputTokens": result.usage.inputTokens.cacheRead,
|
|
54073
54260
|
"gen_ai.response.finish_reasons": [
|
|
54074
54261
|
result.finishReason.unified
|
|
54075
54262
|
],
|
|
@@ -54095,12 +54282,12 @@ async function generateText({
|
|
|
54095
54282
|
if (toolCall.invalid) {
|
|
54096
54283
|
continue;
|
|
54097
54284
|
}
|
|
54098
|
-
const
|
|
54099
|
-
if (
|
|
54285
|
+
const tool2 = tools == null ? undefined : tools[toolCall.toolName];
|
|
54286
|
+
if (tool2 == null) {
|
|
54100
54287
|
continue;
|
|
54101
54288
|
}
|
|
54102
|
-
if ((
|
|
54103
|
-
await
|
|
54289
|
+
if ((tool2 == null ? undefined : tool2.onInputAvailable) != null) {
|
|
54290
|
+
await tool2.onInputAvailable({
|
|
54104
54291
|
input: toolCall.input,
|
|
54105
54292
|
toolCallId: toolCall.toolCallId,
|
|
54106
54293
|
messages: stepInputMessages,
|
|
@@ -54109,7 +54296,7 @@ async function generateText({
|
|
|
54109
54296
|
});
|
|
54110
54297
|
}
|
|
54111
54298
|
if (await isApprovalNeeded({
|
|
54112
|
-
tool:
|
|
54299
|
+
tool: tool2,
|
|
54113
54300
|
toolCall,
|
|
54114
54301
|
messages: stepInputMessages,
|
|
54115
54302
|
experimental_context
|
|
@@ -54158,8 +54345,8 @@ async function generateText({
|
|
|
54158
54345
|
for (const toolCall of stepToolCalls) {
|
|
54159
54346
|
if (!toolCall.providerExecuted)
|
|
54160
54347
|
continue;
|
|
54161
|
-
const
|
|
54162
|
-
if ((
|
|
54348
|
+
const tool2 = tools == null ? undefined : tools[toolCall.toolName];
|
|
54349
|
+
if ((tool2 == null ? undefined : tool2.type) === "provider" && tool2.supportsDeferredResults) {
|
|
54163
54350
|
const hasResultInResponse = currentModelResponse.content.some((part) => part.type === "tool-result" && part.toolCallId === toolCall.toolCallId);
|
|
54164
54351
|
if (!hasResultInResponse) {
|
|
54165
54352
|
pendingDeferredToolCalls.set(toolCall.toolCallId, {
|
|
@@ -54238,9 +54425,7 @@ async function generateText({
|
|
|
54238
54425
|
return toolCalls == null ? undefined : JSON.stringify(toolCalls);
|
|
54239
54426
|
}
|
|
54240
54427
|
},
|
|
54241
|
-
"ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata)
|
|
54242
|
-
"ai.usage.promptTokens": currentModelResponse.usage.inputTokens.total,
|
|
54243
|
-
"ai.usage.completionTokens": currentModelResponse.usage.outputTokens.total
|
|
54428
|
+
"ai.response.providerMetadata": JSON.stringify(currentModelResponse.providerMetadata)
|
|
54244
54429
|
}
|
|
54245
54430
|
}));
|
|
54246
54431
|
const lastStep = steps[steps.length - 1];
|
|
@@ -54253,6 +54438,21 @@ async function generateText({
|
|
|
54253
54438
|
reasoningTokens: undefined,
|
|
54254
54439
|
cachedInputTokens: undefined
|
|
54255
54440
|
});
|
|
54441
|
+
span.setAttributes(await selectTelemetryAttributes({
|
|
54442
|
+
telemetry,
|
|
54443
|
+
attributes: {
|
|
54444
|
+
"ai.usage.inputTokens": totalUsage.inputTokens,
|
|
54445
|
+
"ai.usage.inputTokenDetails.noCacheTokens": (_n = totalUsage.inputTokenDetails) == null ? undefined : _n.noCacheTokens,
|
|
54446
|
+
"ai.usage.inputTokenDetails.cacheReadTokens": (_o = totalUsage.inputTokenDetails) == null ? undefined : _o.cacheReadTokens,
|
|
54447
|
+
"ai.usage.inputTokenDetails.cacheWriteTokens": (_p = totalUsage.inputTokenDetails) == null ? undefined : _p.cacheWriteTokens,
|
|
54448
|
+
"ai.usage.outputTokens": totalUsage.outputTokens,
|
|
54449
|
+
"ai.usage.outputTokenDetails.textTokens": (_q = totalUsage.outputTokenDetails) == null ? undefined : _q.textTokens,
|
|
54450
|
+
"ai.usage.outputTokenDetails.reasoningTokens": (_r = totalUsage.outputTokenDetails) == null ? undefined : _r.reasoningTokens,
|
|
54451
|
+
"ai.usage.totalTokens": totalUsage.totalTokens,
|
|
54452
|
+
"ai.usage.reasoningTokens": (_s = totalUsage.outputTokenDetails) == null ? undefined : _s.reasoningTokens,
|
|
54453
|
+
"ai.usage.cachedInputTokens": (_t = totalUsage.inputTokenDetails) == null ? undefined : _t.cacheReadTokens
|
|
54454
|
+
}
|
|
54455
|
+
}));
|
|
54256
54456
|
await notify({
|
|
54257
54457
|
event: {
|
|
54258
54458
|
stepNumber: lastStep.stepNumber,
|
|
@@ -54452,8 +54652,8 @@ function asContent({
|
|
|
54452
54652
|
case "tool-result": {
|
|
54453
54653
|
const toolCall = toolCalls.find((toolCall2) => toolCall2.toolCallId === part.toolCallId);
|
|
54454
54654
|
if (toolCall == null) {
|
|
54455
|
-
const
|
|
54456
|
-
const supportsDeferredResults = (
|
|
54655
|
+
const tool2 = tools == null ? undefined : tools[part.toolName];
|
|
54656
|
+
const supportsDeferredResults = (tool2 == null ? undefined : tool2.type) === "provider" && tool2.supportsDeferredResults;
|
|
54457
54657
|
if (!supportsDeferredResults) {
|
|
54458
54658
|
throw new Error(`Tool call ${part.toolCallId} not found.`);
|
|
54459
54659
|
}
|
|
@@ -54465,7 +54665,8 @@ function asContent({
|
|
|
54465
54665
|
input: undefined,
|
|
54466
54666
|
error: part.result,
|
|
54467
54667
|
providerExecuted: true,
|
|
54468
|
-
dynamic: part.dynamic
|
|
54668
|
+
dynamic: part.dynamic,
|
|
54669
|
+
...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
|
|
54469
54670
|
});
|
|
54470
54671
|
} else {
|
|
54471
54672
|
contentParts.push({
|
|
@@ -54475,7 +54676,8 @@ function asContent({
|
|
|
54475
54676
|
input: undefined,
|
|
54476
54677
|
output: part.result,
|
|
54477
54678
|
providerExecuted: true,
|
|
54478
|
-
dynamic: part.dynamic
|
|
54679
|
+
dynamic: part.dynamic,
|
|
54680
|
+
...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
|
|
54479
54681
|
});
|
|
54480
54682
|
}
|
|
54481
54683
|
break;
|
|
@@ -54488,7 +54690,8 @@ function asContent({
|
|
|
54488
54690
|
input: toolCall.input,
|
|
54489
54691
|
error: part.result,
|
|
54490
54692
|
providerExecuted: true,
|
|
54491
|
-
dynamic: toolCall.dynamic
|
|
54693
|
+
dynamic: toolCall.dynamic,
|
|
54694
|
+
...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
|
|
54492
54695
|
});
|
|
54493
54696
|
} else {
|
|
54494
54697
|
contentParts.push({
|
|
@@ -54498,7 +54701,8 @@ function asContent({
|
|
|
54498
54701
|
input: toolCall.input,
|
|
54499
54702
|
output: part.result,
|
|
54500
54703
|
providerExecuted: true,
|
|
54501
|
-
dynamic: toolCall.dynamic
|
|
54704
|
+
dynamic: toolCall.dynamic,
|
|
54705
|
+
...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
|
|
54502
54706
|
});
|
|
54503
54707
|
}
|
|
54504
54708
|
break;
|
|
@@ -54604,6 +54808,7 @@ var uiMessageChunkSchema = lazySchema(() => zodSchema(exports_external2.union([
|
|
|
54604
54808
|
toolCallId: exports_external2.string(),
|
|
54605
54809
|
output: exports_external2.unknown(),
|
|
54606
54810
|
providerExecuted: exports_external2.boolean().optional(),
|
|
54811
|
+
providerMetadata: providerMetadataSchema.optional(),
|
|
54607
54812
|
dynamic: exports_external2.boolean().optional(),
|
|
54608
54813
|
preliminary: exports_external2.boolean().optional()
|
|
54609
54814
|
}),
|
|
@@ -54612,6 +54817,7 @@ var uiMessageChunkSchema = lazySchema(() => zodSchema(exports_external2.union([
|
|
|
54612
54817
|
toolCallId: exports_external2.string(),
|
|
54613
54818
|
errorText: exports_external2.string(),
|
|
54614
54819
|
providerExecuted: exports_external2.boolean().optional(),
|
|
54820
|
+
providerMetadata: providerMetadataSchema.optional(),
|
|
54615
54821
|
dynamic: exports_external2.boolean().optional()
|
|
54616
54822
|
}),
|
|
54617
54823
|
exports_external2.strictObject({
|
|
@@ -54810,6 +55016,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
|
|
|
54810
55016
|
output: exports_external2.unknown(),
|
|
54811
55017
|
errorText: exports_external2.never().optional(),
|
|
54812
55018
|
callProviderMetadata: providerMetadataSchema.optional(),
|
|
55019
|
+
resultProviderMetadata: providerMetadataSchema.optional(),
|
|
54813
55020
|
preliminary: exports_external2.boolean().optional(),
|
|
54814
55021
|
approval: exports_external2.object({
|
|
54815
55022
|
id: exports_external2.string(),
|
|
@@ -54828,6 +55035,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
|
|
|
54828
55035
|
output: exports_external2.never().optional(),
|
|
54829
55036
|
errorText: exports_external2.string(),
|
|
54830
55037
|
callProviderMetadata: providerMetadataSchema.optional(),
|
|
55038
|
+
resultProviderMetadata: providerMetadataSchema.optional(),
|
|
54831
55039
|
approval: exports_external2.object({
|
|
54832
55040
|
id: exports_external2.string(),
|
|
54833
55041
|
approved: exports_external2.literal(true),
|
|
@@ -54911,6 +55119,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
|
|
|
54911
55119
|
output: exports_external2.unknown(),
|
|
54912
55120
|
errorText: exports_external2.never().optional(),
|
|
54913
55121
|
callProviderMetadata: providerMetadataSchema.optional(),
|
|
55122
|
+
resultProviderMetadata: providerMetadataSchema.optional(),
|
|
54914
55123
|
preliminary: exports_external2.boolean().optional(),
|
|
54915
55124
|
approval: exports_external2.object({
|
|
54916
55125
|
id: exports_external2.string(),
|
|
@@ -54928,6 +55137,7 @@ var uiMessagesSchema = lazySchema(() => zodSchema(exports_external2.array(export
|
|
|
54928
55137
|
output: exports_external2.never().optional(),
|
|
54929
55138
|
errorText: exports_external2.string(),
|
|
54930
55139
|
callProviderMetadata: providerMetadataSchema.optional(),
|
|
55140
|
+
resultProviderMetadata: providerMetadataSchema.optional(),
|
|
54931
55141
|
approval: exports_external2.object({
|
|
54932
55142
|
id: exports_external2.string(),
|
|
54933
55143
|
approved: exports_external2.literal(true),
|
|
@@ -55314,7 +55524,7 @@ var createTool = async (app2, message) => {
|
|
|
55314
55524
|
console.error(`未找到路径 ${message.path} 和 key ${message.key} 的路由`);
|
|
55315
55525
|
return null;
|
|
55316
55526
|
}
|
|
55317
|
-
const _tool =
|
|
55527
|
+
const _tool = tool({
|
|
55318
55528
|
description: route?.metadata?.summary || route?.description || "无描述",
|
|
55319
55529
|
inputSchema: zod_default.object({
|
|
55320
55530
|
...route.metadata?.args
|
|
@@ -55447,6 +55657,504 @@ app.route({
|
|
|
55447
55657
|
ctx.forward(res);
|
|
55448
55658
|
}).addTo(app);
|
|
55449
55659
|
|
|
55660
|
+
// agent/routes/labels/issue-label.ts
|
|
55661
|
+
app.route({
|
|
55662
|
+
path: "cnb",
|
|
55663
|
+
key: "list-issue-labels",
|
|
55664
|
+
description: "查询 Issue 的标签列表",
|
|
55665
|
+
middleware: ["auth"],
|
|
55666
|
+
metadata: {
|
|
55667
|
+
tags: ["opencode"],
|
|
55668
|
+
...createSkill({
|
|
55669
|
+
skill: "list-issue-labels",
|
|
55670
|
+
title: "查询 Issue 标签列表",
|
|
55671
|
+
summary: "查询 Issue 的标签列表",
|
|
55672
|
+
args: {
|
|
55673
|
+
repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
|
|
55674
|
+
issueNumber: exports_external2.number().describe("Issue 编号"),
|
|
55675
|
+
page: exports_external2.number().optional().describe("分页页码,默认 1"),
|
|
55676
|
+
pageSize: exports_external2.number().optional().describe("分页每页大小,默认 30")
|
|
55677
|
+
}
|
|
55678
|
+
})
|
|
55679
|
+
}
|
|
55680
|
+
}).define(async (ctx) => {
|
|
55681
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
55682
|
+
let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
|
|
55683
|
+
const issueNumber = ctx.query?.issueNumber;
|
|
55684
|
+
const page = ctx.query?.page;
|
|
55685
|
+
const pageSize = ctx.query?.pageSize;
|
|
55686
|
+
if (!repo2) {
|
|
55687
|
+
ctx.throw(400, "缺少参数 repo");
|
|
55688
|
+
}
|
|
55689
|
+
if (!issueNumber) {
|
|
55690
|
+
ctx.throw(400, "缺少参数 issueNumber");
|
|
55691
|
+
}
|
|
55692
|
+
const res = await cnb.labels.issueLabel.list(repo2, issueNumber, {
|
|
55693
|
+
page,
|
|
55694
|
+
page_size: pageSize
|
|
55695
|
+
});
|
|
55696
|
+
ctx.forward(res);
|
|
55697
|
+
}).addTo(app);
|
|
55698
|
+
app.route({
|
|
55699
|
+
path: "cnb",
|
|
55700
|
+
key: "set-issue-labels",
|
|
55701
|
+
description: "设置 Issue 标签(完全替换现有标签)",
|
|
55702
|
+
middleware: ["auth"],
|
|
55703
|
+
metadata: {
|
|
55704
|
+
tags: ["opencode"],
|
|
55705
|
+
...createSkill({
|
|
55706
|
+
skill: "set-issue-labels",
|
|
55707
|
+
title: "设置 Issue 标签",
|
|
55708
|
+
summary: "设置 Issue 标签(完全替换现有标签)",
|
|
55709
|
+
args: {
|
|
55710
|
+
repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
|
|
55711
|
+
issueNumber: exports_external2.number().describe("Issue 编号"),
|
|
55712
|
+
labels: exports_external2.array(exports_external2.string()).describe("标签名称数组")
|
|
55713
|
+
}
|
|
55714
|
+
})
|
|
55715
|
+
}
|
|
55716
|
+
}).define(async (ctx) => {
|
|
55717
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
55718
|
+
let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
|
|
55719
|
+
const issueNumber = ctx.query?.issueNumber;
|
|
55720
|
+
const labels2 = ctx.query?.labels;
|
|
55721
|
+
if (!repo2) {
|
|
55722
|
+
ctx.throw(400, "缺少参数 repo");
|
|
55723
|
+
}
|
|
55724
|
+
if (!issueNumber) {
|
|
55725
|
+
ctx.throw(400, "缺少参数 issueNumber");
|
|
55726
|
+
}
|
|
55727
|
+
if (!labels2 || !Array.isArray(labels2)) {
|
|
55728
|
+
ctx.throw(400, "缺少参数 labels");
|
|
55729
|
+
}
|
|
55730
|
+
const res = await cnb.labels.issueLabel.set(repo2, issueNumber, { labels: labels2 });
|
|
55731
|
+
ctx.forward(res);
|
|
55732
|
+
}).addTo(app);
|
|
55733
|
+
app.route({
|
|
55734
|
+
path: "cnb",
|
|
55735
|
+
key: "add-issue-labels",
|
|
55736
|
+
description: "新增 Issue 标签(追加到现有标签)",
|
|
55737
|
+
middleware: ["auth"],
|
|
55738
|
+
metadata: {
|
|
55739
|
+
tags: ["opencode"],
|
|
55740
|
+
...createSkill({
|
|
55741
|
+
skill: "add-issue-labels",
|
|
55742
|
+
title: "新增 Issue 标签",
|
|
55743
|
+
summary: "新增 Issue 标签(追加到现有标签)",
|
|
55744
|
+
args: {
|
|
55745
|
+
repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
|
|
55746
|
+
issueNumber: exports_external2.number().describe("Issue 编号"),
|
|
55747
|
+
labels: exports_external2.array(exports_external2.string()).describe("标签名称数组")
|
|
55748
|
+
}
|
|
55749
|
+
})
|
|
55750
|
+
}
|
|
55751
|
+
}).define(async (ctx) => {
|
|
55752
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
55753
|
+
let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
|
|
55754
|
+
const issueNumber = ctx.query?.issueNumber;
|
|
55755
|
+
const labels2 = ctx.query?.labels;
|
|
55756
|
+
if (!repo2) {
|
|
55757
|
+
ctx.throw(400, "缺少参数 repo");
|
|
55758
|
+
}
|
|
55759
|
+
if (!issueNumber) {
|
|
55760
|
+
ctx.throw(400, "缺少参数 issueNumber");
|
|
55761
|
+
}
|
|
55762
|
+
if (!labels2 || !Array.isArray(labels2)) {
|
|
55763
|
+
ctx.throw(400, "缺少参数 labels");
|
|
55764
|
+
}
|
|
55765
|
+
const res = await cnb.labels.issueLabel.add(repo2, issueNumber, { labels: labels2 });
|
|
55766
|
+
ctx.forward(res);
|
|
55767
|
+
}).addTo(app);
|
|
55768
|
+
app.route({
|
|
55769
|
+
path: "cnb",
|
|
55770
|
+
key: "clear-issue-labels",
|
|
55771
|
+
description: "清空 Issue 标签(移除所有标签)",
|
|
55772
|
+
middleware: ["auth"],
|
|
55773
|
+
metadata: {
|
|
55774
|
+
tags: ["opencode"],
|
|
55775
|
+
...createSkill({
|
|
55776
|
+
skill: "clear-issue-labels",
|
|
55777
|
+
title: "清空 Issue 标签",
|
|
55778
|
+
summary: "清空 Issue 标签(移除所有标签)",
|
|
55779
|
+
args: {
|
|
55780
|
+
repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
|
|
55781
|
+
issueNumber: exports_external2.number().describe("Issue 编号")
|
|
55782
|
+
}
|
|
55783
|
+
})
|
|
55784
|
+
}
|
|
55785
|
+
}).define(async (ctx) => {
|
|
55786
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
55787
|
+
let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
|
|
55788
|
+
const issueNumber = ctx.query?.issueNumber;
|
|
55789
|
+
if (!repo2) {
|
|
55790
|
+
ctx.throw(400, "缺少参数 repo");
|
|
55791
|
+
}
|
|
55792
|
+
if (!issueNumber) {
|
|
55793
|
+
ctx.throw(400, "缺少参数 issueNumber");
|
|
55794
|
+
}
|
|
55795
|
+
const res = await cnb.labels.issueLabel.clear(repo2, issueNumber);
|
|
55796
|
+
ctx.forward(res);
|
|
55797
|
+
}).addTo(app);
|
|
55798
|
+
app.route({
|
|
55799
|
+
path: "cnb",
|
|
55800
|
+
key: "remove-issue-label",
|
|
55801
|
+
description: "删除 Issue 指定标签",
|
|
55802
|
+
middleware: ["auth"],
|
|
55803
|
+
metadata: {
|
|
55804
|
+
tags: ["opencode"],
|
|
55805
|
+
...createSkill({
|
|
55806
|
+
skill: "remove-issue-label",
|
|
55807
|
+
title: "删除 Issue 标签",
|
|
55808
|
+
summary: "删除 Issue 指定标签",
|
|
55809
|
+
args: {
|
|
55810
|
+
repo: exports_external2.string().optional().describe("仓库路径, 如 my-user/my-repo"),
|
|
55811
|
+
issueNumber: exports_external2.number().describe("Issue 编号"),
|
|
55812
|
+
name: exports_external2.string().describe("标签名称")
|
|
55813
|
+
}
|
|
55814
|
+
})
|
|
55815
|
+
}
|
|
55816
|
+
}).define(async (ctx) => {
|
|
55817
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
55818
|
+
let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
|
|
55819
|
+
const issueNumber = ctx.query?.issueNumber;
|
|
55820
|
+
const name21 = ctx.query?.name;
|
|
55821
|
+
if (!repo2) {
|
|
55822
|
+
ctx.throw(400, "缺少参数 repo");
|
|
55823
|
+
}
|
|
55824
|
+
if (!issueNumber) {
|
|
55825
|
+
ctx.throw(400, "缺少参数 issueNumber");
|
|
55826
|
+
}
|
|
55827
|
+
if (!name21) {
|
|
55828
|
+
ctx.throw(400, "缺少参数 name");
|
|
55829
|
+
}
|
|
55830
|
+
const res = await cnb.labels.issueLabel.remove(repo2, issueNumber, name21);
|
|
55831
|
+
ctx.forward(res);
|
|
55832
|
+
}).addTo(app);
|
|
55833
|
+
|
|
55834
|
+
// agent/routes/package/registry.ts
|
|
55835
|
+
app.route({
|
|
55836
|
+
path: "cnb",
|
|
55837
|
+
key: "list-group-registries",
|
|
55838
|
+
description: "查询组织下的制品库列表, 参数 slug",
|
|
55839
|
+
middleware: ["auth"],
|
|
55840
|
+
metadata: {
|
|
55841
|
+
tags: ["package"],
|
|
55842
|
+
...createSkill({
|
|
55843
|
+
skill: "list-group-registries",
|
|
55844
|
+
title: "查询制品库列表",
|
|
55845
|
+
args: {
|
|
55846
|
+
slug: exports_external2.string().describe("组织 slug, 如 my-org"),
|
|
55847
|
+
page: exports_external2.number().describe("页码").optional(),
|
|
55848
|
+
page_size: exports_external2.number().describe("每页数量").optional(),
|
|
55849
|
+
registry_type: exports_external2.string().describe("制品仓库类型: npm, maven, ohpm").optional(),
|
|
55850
|
+
filter_type: exports_external2.string().describe("制品仓库可见性: private, public").optional(),
|
|
55851
|
+
order_by: exports_external2.string().describe("排序字段: created_at, name").optional()
|
|
55852
|
+
},
|
|
55853
|
+
summary: "查询组织下的制品库列表"
|
|
55854
|
+
})
|
|
55855
|
+
}
|
|
55856
|
+
}).define(async (ctx) => {
|
|
55857
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
55858
|
+
const slug = ctx.query?.slug;
|
|
55859
|
+
const { page, page_size, registry_type, filter_type, order_by } = ctx.query || {};
|
|
55860
|
+
if (!slug) {
|
|
55861
|
+
ctx.throw(400, "缺少参数 slug");
|
|
55862
|
+
}
|
|
55863
|
+
const res = await cnb.packages.registry.listGroupRegistries(slug, {
|
|
55864
|
+
page,
|
|
55865
|
+
page_size,
|
|
55866
|
+
registry_type,
|
|
55867
|
+
filter_type,
|
|
55868
|
+
order_by
|
|
55869
|
+
});
|
|
55870
|
+
ctx.forward(res);
|
|
55871
|
+
}).addTo(app);
|
|
55872
|
+
app.route({
|
|
55873
|
+
path: "cnb",
|
|
55874
|
+
key: "set-registry-visibility",
|
|
55875
|
+
description: "设置制品库可见性, 参数 registry, visibility",
|
|
55876
|
+
middleware: ["auth"],
|
|
55877
|
+
metadata: {
|
|
55878
|
+
tags: ["package"],
|
|
55879
|
+
...createSkill({
|
|
55880
|
+
skill: "set-registry-visibility",
|
|
55881
|
+
title: "设置制品库可见性",
|
|
55882
|
+
args: {
|
|
55883
|
+
registry: exports_external2.string().describe("制品库路径, 如 my-org/my-registry"),
|
|
55884
|
+
visibility: exports_external2.string().describe("可见性: private 或 public")
|
|
55885
|
+
},
|
|
55886
|
+
summary: "设置制品库的可见性"
|
|
55887
|
+
})
|
|
55888
|
+
}
|
|
55889
|
+
}).define(async (ctx) => {
|
|
55890
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
55891
|
+
const registry4 = ctx.query?.registry;
|
|
55892
|
+
const visibility = ctx.query?.visibility;
|
|
55893
|
+
if (!registry4) {
|
|
55894
|
+
ctx.throw(400, "缺少参数 registry");
|
|
55895
|
+
}
|
|
55896
|
+
if (!visibility) {
|
|
55897
|
+
ctx.throw(400, "缺少参数 visibility");
|
|
55898
|
+
}
|
|
55899
|
+
const res = await cnb.packages.registry.setVisibility(registry4, { visibility });
|
|
55900
|
+
ctx.forward(res);
|
|
55901
|
+
}).addTo(app);
|
|
55902
|
+
app.route({
|
|
55903
|
+
path: "cnb",
|
|
55904
|
+
key: "delete-registry",
|
|
55905
|
+
description: "删除制品库, 参数 registry",
|
|
55906
|
+
middleware: ["auth"],
|
|
55907
|
+
metadata: {
|
|
55908
|
+
tags: ["package"],
|
|
55909
|
+
...createSkill({
|
|
55910
|
+
skill: "delete-registry",
|
|
55911
|
+
title: "删除制品库",
|
|
55912
|
+
args: {
|
|
55913
|
+
registry: exports_external2.string().describe("制品库路径, 如 my-org/my-registry")
|
|
55914
|
+
},
|
|
55915
|
+
summary: "删除指定的制品库"
|
|
55916
|
+
})
|
|
55917
|
+
}
|
|
55918
|
+
}).define(async (ctx) => {
|
|
55919
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
55920
|
+
const registry4 = ctx.query?.registry;
|
|
55921
|
+
if (!registry4) {
|
|
55922
|
+
ctx.throw(400, "缺少参数 registry");
|
|
55923
|
+
}
|
|
55924
|
+
const res = await cnb.packages.registry.remove(registry4);
|
|
55925
|
+
ctx.forward(res);
|
|
55926
|
+
}).addTo(app);
|
|
55927
|
+
|
|
55928
|
+
// agent/routes/package/package.ts
|
|
55929
|
+
app.route({
|
|
55930
|
+
path: "cnb",
|
|
55931
|
+
key: "list-packages",
|
|
55932
|
+
description: "查询制品列表, 参数 slug, type",
|
|
55933
|
+
middleware: ["auth"],
|
|
55934
|
+
metadata: {
|
|
55935
|
+
tags: ["package"],
|
|
55936
|
+
...createSkill({
|
|
55937
|
+
skill: "list-packages",
|
|
55938
|
+
title: "查询制品列表",
|
|
55939
|
+
args: {
|
|
55940
|
+
slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
|
|
55941
|
+
type: exports_external2.string().describe("制品类型: all, docker, helm, docker-model, maven, npm, ohpm, pypi, nuget, composer, conan, cargo"),
|
|
55942
|
+
ordering: exports_external2.string().describe("排序类型: pull_count, last_push_at, name_ascend, name_descend").optional(),
|
|
55943
|
+
name: exports_external2.string().describe("关键字,搜索制品名称").optional(),
|
|
55944
|
+
page: exports_external2.number().describe("页码").optional(),
|
|
55945
|
+
page_size: exports_external2.number().describe("每页数量").optional()
|
|
55946
|
+
},
|
|
55947
|
+
summary: "查询制品列表"
|
|
55948
|
+
})
|
|
55949
|
+
}
|
|
55950
|
+
}).define(async (ctx) => {
|
|
55951
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
55952
|
+
const slug = ctx.query?.slug;
|
|
55953
|
+
const type = ctx.query?.type;
|
|
55954
|
+
const { ordering, name: name21, page, page_size } = ctx.query || {};
|
|
55955
|
+
if (!slug) {
|
|
55956
|
+
ctx.throw(400, "缺少参数 slug");
|
|
55957
|
+
}
|
|
55958
|
+
if (!type) {
|
|
55959
|
+
ctx.throw(400, "缺少参数 type");
|
|
55960
|
+
}
|
|
55961
|
+
const res = await cnb.packages.package.list(slug, type, {
|
|
55962
|
+
ordering,
|
|
55963
|
+
name: name21,
|
|
55964
|
+
page,
|
|
55965
|
+
page_size
|
|
55966
|
+
});
|
|
55967
|
+
ctx.forward(res);
|
|
55968
|
+
}).addTo(app);
|
|
55969
|
+
app.route({
|
|
55970
|
+
path: "cnb",
|
|
55971
|
+
key: "get-package",
|
|
55972
|
+
description: "获取制品详情, 参数 slug, type, name",
|
|
55973
|
+
middleware: ["auth"],
|
|
55974
|
+
metadata: {
|
|
55975
|
+
tags: ["package"],
|
|
55976
|
+
...createSkill({
|
|
55977
|
+
skill: "get-package",
|
|
55978
|
+
title: "获取制品详情",
|
|
55979
|
+
args: {
|
|
55980
|
+
slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
|
|
55981
|
+
type: exports_external2.string().describe("制品类型"),
|
|
55982
|
+
name: exports_external2.string().describe("制品名称")
|
|
55983
|
+
},
|
|
55984
|
+
summary: "获取指定制品的详细信息"
|
|
55985
|
+
})
|
|
55986
|
+
}
|
|
55987
|
+
}).define(async (ctx) => {
|
|
55988
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
55989
|
+
const slug = ctx.query?.slug;
|
|
55990
|
+
const type = ctx.query?.type;
|
|
55991
|
+
const name21 = ctx.query?.name;
|
|
55992
|
+
if (!slug) {
|
|
55993
|
+
ctx.throw(400, "缺少参数 slug");
|
|
55994
|
+
}
|
|
55995
|
+
if (!type) {
|
|
55996
|
+
ctx.throw(400, "缺少参数 type");
|
|
55997
|
+
}
|
|
55998
|
+
if (!name21) {
|
|
55999
|
+
ctx.throw(400, "缺少参数 name");
|
|
56000
|
+
}
|
|
56001
|
+
const res = await cnb.packages.package.getOne(slug, type, name21);
|
|
56002
|
+
ctx.forward(res);
|
|
56003
|
+
}).addTo(app);
|
|
56004
|
+
app.route({
|
|
56005
|
+
path: "cnb",
|
|
56006
|
+
key: "delete-package",
|
|
56007
|
+
description: "删除制品, 参数 slug, type, name",
|
|
56008
|
+
middleware: ["auth"],
|
|
56009
|
+
metadata: {
|
|
56010
|
+
tags: ["package"],
|
|
56011
|
+
...createSkill({
|
|
56012
|
+
skill: "delete-package",
|
|
56013
|
+
title: "删除制品",
|
|
56014
|
+
args: {
|
|
56015
|
+
slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
|
|
56016
|
+
type: exports_external2.string().describe("制品类型"),
|
|
56017
|
+
name: exports_external2.string().describe("制品名称")
|
|
56018
|
+
},
|
|
56019
|
+
summary: "删除指定的制品"
|
|
56020
|
+
})
|
|
56021
|
+
}
|
|
56022
|
+
}).define(async (ctx) => {
|
|
56023
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
56024
|
+
const slug = ctx.query?.slug;
|
|
56025
|
+
const type = ctx.query?.type;
|
|
56026
|
+
const name21 = ctx.query?.name;
|
|
56027
|
+
if (!slug) {
|
|
56028
|
+
ctx.throw(400, "缺少参数 slug");
|
|
56029
|
+
}
|
|
56030
|
+
if (!type) {
|
|
56031
|
+
ctx.throw(400, "缺少参数 type");
|
|
56032
|
+
}
|
|
56033
|
+
if (!name21) {
|
|
56034
|
+
ctx.throw(400, "缺少参数 name");
|
|
56035
|
+
}
|
|
56036
|
+
const res = await cnb.packages.package.remove(slug, type, name21);
|
|
56037
|
+
ctx.forward(res);
|
|
56038
|
+
}).addTo(app);
|
|
56039
|
+
app.route({
|
|
56040
|
+
path: "cnb",
|
|
56041
|
+
key: "list-package-tags",
|
|
56042
|
+
description: "获取制品标签列表, 参数 slug, type, name",
|
|
56043
|
+
middleware: ["auth"],
|
|
56044
|
+
metadata: {
|
|
56045
|
+
tags: ["package"],
|
|
56046
|
+
...createSkill({
|
|
56047
|
+
skill: "list-package-tags",
|
|
56048
|
+
title: "获取制品标签列表",
|
|
56049
|
+
args: {
|
|
56050
|
+
slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
|
|
56051
|
+
type: exports_external2.string().describe("制品类型"),
|
|
56052
|
+
name: exports_external2.string().describe("制品名称"),
|
|
56053
|
+
page: exports_external2.number().describe("页码").optional(),
|
|
56054
|
+
page_size: exports_external2.number().describe("每页数量").optional()
|
|
56055
|
+
},
|
|
56056
|
+
summary: "获取制品的标签列表"
|
|
56057
|
+
})
|
|
56058
|
+
}
|
|
56059
|
+
}).define(async (ctx) => {
|
|
56060
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
56061
|
+
const slug = ctx.query?.slug;
|
|
56062
|
+
const type = ctx.query?.type;
|
|
56063
|
+
const name21 = ctx.query?.name;
|
|
56064
|
+
const { page, page_size } = ctx.query || {};
|
|
56065
|
+
if (!slug) {
|
|
56066
|
+
ctx.throw(400, "缺少参数 slug");
|
|
56067
|
+
}
|
|
56068
|
+
if (!type) {
|
|
56069
|
+
ctx.throw(400, "缺少参数 type");
|
|
56070
|
+
}
|
|
56071
|
+
if (!name21) {
|
|
56072
|
+
ctx.throw(400, "缺少参数 name");
|
|
56073
|
+
}
|
|
56074
|
+
const res = await cnb.packages.package.listTags(slug, type, name21, { page, page_size });
|
|
56075
|
+
ctx.forward(res);
|
|
56076
|
+
}).addTo(app);
|
|
56077
|
+
app.route({
|
|
56078
|
+
path: "cnb",
|
|
56079
|
+
key: "get-package-tag",
|
|
56080
|
+
description: "获取制品标签详情, 参数 slug, type, name, tag",
|
|
56081
|
+
middleware: ["auth"],
|
|
56082
|
+
metadata: {
|
|
56083
|
+
tags: ["package"],
|
|
56084
|
+
...createSkill({
|
|
56085
|
+
skill: "get-package-tag",
|
|
56086
|
+
title: "获取制品标签详情",
|
|
56087
|
+
args: {
|
|
56088
|
+
slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
|
|
56089
|
+
type: exports_external2.string().describe("制品类型"),
|
|
56090
|
+
name: exports_external2.string().describe("制品名称"),
|
|
56091
|
+
tag: exports_external2.string().describe("标签名称")
|
|
56092
|
+
},
|
|
56093
|
+
summary: "获取制品标签的详细信息"
|
|
56094
|
+
})
|
|
56095
|
+
}
|
|
56096
|
+
}).define(async (ctx) => {
|
|
56097
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
56098
|
+
const slug = ctx.query?.slug;
|
|
56099
|
+
const type = ctx.query?.type;
|
|
56100
|
+
const name21 = ctx.query?.name;
|
|
56101
|
+
const tag = ctx.query?.tag;
|
|
56102
|
+
if (!slug) {
|
|
56103
|
+
ctx.throw(400, "缺少参数 slug");
|
|
56104
|
+
}
|
|
56105
|
+
if (!type) {
|
|
56106
|
+
ctx.throw(400, "缺少参数 type");
|
|
56107
|
+
}
|
|
56108
|
+
if (!name21) {
|
|
56109
|
+
ctx.throw(400, "缺少参数 name");
|
|
56110
|
+
}
|
|
56111
|
+
if (!tag) {
|
|
56112
|
+
ctx.throw(400, "缺少参数 tag");
|
|
56113
|
+
}
|
|
56114
|
+
const res = await cnb.packages.package.getTag(slug, type, name21, tag);
|
|
56115
|
+
ctx.forward(res);
|
|
56116
|
+
}).addTo(app);
|
|
56117
|
+
app.route({
|
|
56118
|
+
path: "cnb",
|
|
56119
|
+
key: "delete-package-tag",
|
|
56120
|
+
description: "删除制品标签, 参数 slug, type, name, tag",
|
|
56121
|
+
middleware: ["auth"],
|
|
56122
|
+
metadata: {
|
|
56123
|
+
tags: ["package"],
|
|
56124
|
+
...createSkill({
|
|
56125
|
+
skill: "delete-package-tag",
|
|
56126
|
+
title: "删除制品标签",
|
|
56127
|
+
args: {
|
|
56128
|
+
slug: exports_external2.string().describe("资源路径, 如 my-org/my-registry"),
|
|
56129
|
+
type: exports_external2.string().describe("制品类型"),
|
|
56130
|
+
name: exports_external2.string().describe("制品名称"),
|
|
56131
|
+
tag: exports_external2.string().describe("标签名称")
|
|
56132
|
+
},
|
|
56133
|
+
summary: "删除制品的指定标签"
|
|
56134
|
+
})
|
|
56135
|
+
}
|
|
56136
|
+
}).define(async (ctx) => {
|
|
56137
|
+
const cnb = await cnbManager.getContext(ctx);
|
|
56138
|
+
const slug = ctx.query?.slug;
|
|
56139
|
+
const type = ctx.query?.type;
|
|
56140
|
+
const name21 = ctx.query?.name;
|
|
56141
|
+
const tag = ctx.query?.tag;
|
|
56142
|
+
if (!slug) {
|
|
56143
|
+
ctx.throw(400, "缺少参数 slug");
|
|
56144
|
+
}
|
|
56145
|
+
if (!type) {
|
|
56146
|
+
ctx.throw(400, "缺少参数 type");
|
|
56147
|
+
}
|
|
56148
|
+
if (!name21) {
|
|
56149
|
+
ctx.throw(400, "缺少参数 name");
|
|
56150
|
+
}
|
|
56151
|
+
if (!tag) {
|
|
56152
|
+
ctx.throw(400, "缺少参数 tag");
|
|
56153
|
+
}
|
|
56154
|
+
const res = await cnb.packages.package.removeTag(slug, type, name21, tag);
|
|
56155
|
+
ctx.forward(res);
|
|
56156
|
+
}).addTo(app);
|
|
56157
|
+
|
|
55450
56158
|
// agent/routes/index.ts
|
|
55451
56159
|
var checkAppId = (ctx, appId) => {
|
|
55452
56160
|
const _appId = ctx?.app?.appId;
|
|
@@ -55498,7 +56206,7 @@ var {
|
|
|
55498
56206
|
Help
|
|
55499
56207
|
} = import__3.default;
|
|
55500
56208
|
|
|
55501
|
-
// ../../node_modules/.pnpm/@kevisual+remote-app@0.0.
|
|
56209
|
+
// ../../node_modules/.pnpm/@kevisual+remote-app@0.0.7/node_modules/@kevisual/remote-app/dist/app.js
|
|
55502
56210
|
var __create4 = Object.create;
|
|
55503
56211
|
var __getProtoOf4 = Object.getPrototypeOf;
|
|
55504
56212
|
var __defProp5 = Object.defineProperty;
|
|
@@ -55713,10 +56421,12 @@ class RemoteApp {
|
|
|
55713
56421
|
reconnectAttempts = 0;
|
|
55714
56422
|
reconnectTimer = null;
|
|
55715
56423
|
isManuallyClosed = false;
|
|
56424
|
+
isInitializing = false;
|
|
56425
|
+
initId = 0;
|
|
55716
56426
|
constructor(opts) {
|
|
55717
56427
|
this.mainApp = opts?.app;
|
|
55718
56428
|
const token2 = opts.token;
|
|
55719
|
-
const url4 = opts.url;
|
|
56429
|
+
const url4 = opts.url || "https://kevisual.cn/ws/proxy";
|
|
55720
56430
|
const id = opts.id;
|
|
55721
56431
|
const username = opts.username;
|
|
55722
56432
|
this.username = username;
|
|
@@ -55782,10 +56492,17 @@ class RemoteApp {
|
|
|
55782
56492
|
return wsURL;
|
|
55783
56493
|
}
|
|
55784
56494
|
async init() {
|
|
56495
|
+
if (this.isInitializing) {
|
|
56496
|
+
return;
|
|
56497
|
+
}
|
|
56498
|
+
this.isInitializing = true;
|
|
56499
|
+
const currentInitId = ++this.initId;
|
|
55785
56500
|
if (!this.url) {
|
|
56501
|
+
this.isInitializing = false;
|
|
55786
56502
|
throw new Error("No url provided for remote app");
|
|
55787
56503
|
}
|
|
55788
56504
|
if (!this.id) {
|
|
56505
|
+
this.isInitializing = false;
|
|
55789
56506
|
throw new Error("No id provided for remote app");
|
|
55790
56507
|
}
|
|
55791
56508
|
this.isError = false;
|
|
@@ -55795,11 +56512,20 @@ class RemoteApp {
|
|
|
55795
56512
|
const ws = new WebSocket(this.getWsURL(this.url));
|
|
55796
56513
|
const that = this;
|
|
55797
56514
|
ws.onopen = function() {
|
|
56515
|
+
if (currentInitId !== that.initId) {
|
|
56516
|
+
ws.close();
|
|
56517
|
+
return;
|
|
56518
|
+
}
|
|
55798
56519
|
that.isConnected = true;
|
|
56520
|
+
that.isInitializing = false;
|
|
55799
56521
|
that.onOpen();
|
|
55800
56522
|
console.log("[remote-app] WebSocket connection opened");
|
|
55801
56523
|
};
|
|
55802
56524
|
ws.onclose = function() {
|
|
56525
|
+
if (currentInitId !== that.initId) {
|
|
56526
|
+
return;
|
|
56527
|
+
}
|
|
56528
|
+
that.isInitializing = false;
|
|
55803
56529
|
that.isConnected = false;
|
|
55804
56530
|
that.onClose();
|
|
55805
56531
|
};
|
|
@@ -55807,6 +56533,10 @@ class RemoteApp {
|
|
|
55807
56533
|
that.onMessage(event.data);
|
|
55808
56534
|
};
|
|
55809
56535
|
ws.onerror = function(error49) {
|
|
56536
|
+
if (currentInitId !== that.initId) {
|
|
56537
|
+
return;
|
|
56538
|
+
}
|
|
56539
|
+
that.isInitializing = false;
|
|
55810
56540
|
that.onError(error49);
|
|
55811
56541
|
};
|
|
55812
56542
|
this.ws = ws;
|
|
@@ -56201,9 +56931,9 @@ var writeToProcess = (message) => {
|
|
|
56201
56931
|
var getIssuesLabels = async () => {
|
|
56202
56932
|
const issueEnv = useIssueEnv();
|
|
56203
56933
|
const repoInfoEnv = useRepoInfoEnv();
|
|
56204
|
-
const
|
|
56934
|
+
const issueIid = issueEnv.issueIid;
|
|
56205
56935
|
const repoSlug = repoInfoEnv.repoSlug;
|
|
56206
|
-
if (!
|
|
56936
|
+
if (!issueIid || !repoSlug) {
|
|
56207
56937
|
return [];
|
|
56208
56938
|
}
|
|
56209
56939
|
const res = await app.run({
|
|
@@ -56211,7 +56941,7 @@ var getIssuesLabels = async () => {
|
|
|
56211
56941
|
key: "getIssue",
|
|
56212
56942
|
payload: {
|
|
56213
56943
|
repo: repoSlug,
|
|
56214
|
-
issueNumber:
|
|
56944
|
+
issueNumber: issueIid
|
|
56215
56945
|
}
|
|
56216
56946
|
});
|
|
56217
56947
|
if (res.code === 200) {
|
|
@@ -56222,12 +56952,32 @@ var getIssuesLabels = async () => {
|
|
|
56222
56952
|
console.error("获取 Issue 详情失败", res);
|
|
56223
56953
|
return [];
|
|
56224
56954
|
};
|
|
56225
|
-
var
|
|
56955
|
+
var getIssueComment = async (opts) => {
|
|
56956
|
+
const res = await app.run({
|
|
56957
|
+
path: "cnb",
|
|
56958
|
+
key: "list-issue-comments",
|
|
56959
|
+
payload: {
|
|
56960
|
+
repo: opts.repo,
|
|
56961
|
+
issueNumber: opts.issueNumber
|
|
56962
|
+
}
|
|
56963
|
+
});
|
|
56964
|
+
let comments = [];
|
|
56965
|
+
if (res.code === 200) {
|
|
56966
|
+
const data = res.data;
|
|
56967
|
+
comments = data.map((item) => ({
|
|
56968
|
+
commentId: item.id,
|
|
56969
|
+
body: item.body,
|
|
56970
|
+
author: item.author?.nickname || item.author?.username || "unknown"
|
|
56971
|
+
}));
|
|
56972
|
+
}
|
|
56973
|
+
return comments;
|
|
56974
|
+
};
|
|
56975
|
+
var main = async ({ exit, question, admins }) => {
|
|
56226
56976
|
const repoInfoEnv = useRepoInfoEnv();
|
|
56227
56977
|
const commentEnv = useCommentEnv();
|
|
56228
56978
|
const issueEnv = useIssueEnv();
|
|
56229
56979
|
const pickCommentEnv = pick4(commentEnv, ["commentId", "commentIdLabel"]);
|
|
56230
|
-
const pickIssueEnv = pick4(issueEnv, ["
|
|
56980
|
+
const pickIssueEnv = pick4(issueEnv, ["issueIid", "issueIidLabel", "issueTitle", "issueTitleLabel", "issueDescription", "issueDescriptionLabel"]);
|
|
56231
56981
|
const pickRepoInfoEnv = pick4(repoInfoEnv, ["repoId", "repoIdLabel", "repoName", "repoNameLabel", "repoSlug", "repoSlugLabel"]);
|
|
56232
56982
|
const isComment = !!commentEnv.commentId;
|
|
56233
56983
|
const envList = [
|
|
@@ -56243,15 +56993,41 @@ var main = async ({ exit, question }) => {
|
|
|
56243
56993
|
writeToProcess("当前 Issue 不包含 Run 标签,跳过执行");
|
|
56244
56994
|
return exit(0);
|
|
56245
56995
|
}
|
|
56996
|
+
const issueComments = await getIssueComment({ repo: repoInfoEnv.repoSlug || "", issueNumber: Number(issueEnv.issueIid) });
|
|
56997
|
+
if (issueComments.length > 0) {
|
|
56998
|
+
const lastComment = issueComments[issueComments.length - 1];
|
|
56999
|
+
if (admins.length > 0 && !admins.includes(lastComment.author)) {
|
|
57000
|
+
writeToProcess(`当前 Issue 最新的评论由 ${lastComment.author} 创建,不是管理员 ${admins.join(", ")},跳过执行`);
|
|
57001
|
+
const helperKey = ["帮", "做", "执行", "处理", "解决", "回复", "评论"];
|
|
57002
|
+
const hasHelper = helperKey.some((key) => question?.includes(key));
|
|
57003
|
+
if (!hasHelper) {
|
|
57004
|
+
await app.run({
|
|
57005
|
+
path: "cnb",
|
|
57006
|
+
key: "create-issue-comment",
|
|
57007
|
+
payload: {
|
|
57008
|
+
repo: repoInfoEnv.repoSlug || "",
|
|
57009
|
+
issueNumber: Number(issueEnv.issueIid),
|
|
57010
|
+
body: `当前 Issue 最新的评论由 ${lastComment.author} 创建,不是管理员,不允许执行喵~`
|
|
57011
|
+
}
|
|
57012
|
+
});
|
|
57013
|
+
}
|
|
57014
|
+
return exit(0);
|
|
57015
|
+
}
|
|
57016
|
+
}
|
|
57017
|
+
const botName = "kevisual/cnb(router) ";
|
|
56246
57018
|
const messages = [
|
|
56247
57019
|
{
|
|
56248
57020
|
role: "system",
|
|
56249
|
-
content:
|
|
57021
|
+
content: `你是一个智能的代码助手叫${botName}, 根据用户提供的上下文信息,提供有用的建议和帮助, 如果用户的要求和执行工具不一致,请说出你不能这么做。并把最后的结果提交一个评论到对应的issue中,提交的内容必须不能包含 @ 提及。如果你有些决定不能决定,需要咨询,需要任何交互的,也把对应的需求评论到对应的issue。用户提供的上下文信息如下:`
|
|
56250
57022
|
},
|
|
56251
57023
|
{
|
|
56252
57024
|
role: "system",
|
|
56253
57025
|
content: `相关变量:${JSON.stringify({ ...pickCommentEnv, ...pickIssueEnv, ...pickRepoInfoEnv })}`
|
|
56254
57026
|
},
|
|
57027
|
+
{
|
|
57028
|
+
role: "assistant",
|
|
57029
|
+
content: "历史评论:" + JSON.stringify(issueComments)
|
|
57030
|
+
},
|
|
56255
57031
|
{
|
|
56256
57032
|
role: "user",
|
|
56257
57033
|
content: question || commentEnv.commentBody || pickIssueEnv.issueDescription || "无"
|
|
@@ -56298,9 +57074,9 @@ app.route({
|
|
|
56298
57074
|
const buildUserNickName = useKey("CNB_BUILD_USER_NICKNAME");
|
|
56299
57075
|
let admins = owner.split(",").map((item) => item.trim());
|
|
56300
57076
|
if (owner && admins.includes(buildUserNickName)) {
|
|
56301
|
-
await main({ exit });
|
|
57077
|
+
await main({ exit, admins });
|
|
56302
57078
|
} else {
|
|
56303
|
-
await main({ exit, question: `你是${owner}的专属助手,请生成一条评论,说明你不具备其他用户能访问的能力。同时你需要提示说明,fork当前仓库后,即可成为你的专属助手` });
|
|
57079
|
+
await main({ exit, admins, question: `你是${owner}的专属助手,请生成一条评论,说明你不具备其他用户能访问的能力。同时你需要提示说明,fork当前仓库后,即可成为你的专属助手` });
|
|
56304
57080
|
}
|
|
56305
57081
|
}).addTo(app);
|
|
56306
57082
|
parse8({ app, description: "CNB控制台命令行工具", parse: true });
|