@kevisual/cnb 0.0.37 → 0.0.40
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/app.ts +30 -12
- package/agent/main.ts +18 -0
- package/agent/modules/cnb-manager.ts +119 -0
- package/agent/opencode.ts +1 -1
- package/agent/routes/cnb-board/cnb-dev-env.ts +5 -15
- package/agent/routes/cnb-board/index.ts +3 -2
- package/agent/routes/cnb-env/check.ts +3 -2
- package/agent/routes/cnb-env/env.ts +5 -3
- package/agent/routes/cnb-env/vscode.ts +5 -3
- package/agent/routes/cnb-manager/index.ts +48 -0
- package/agent/routes/index.ts +8 -0
- package/agent/routes/issues/issue.ts +5 -3
- package/agent/routes/issues/list.ts +3 -2
- package/agent/routes/knowledge/ai.ts +5 -3
- package/agent/routes/repo/list.ts +3 -2
- package/agent/routes/repo/repo.ts +79 -6
- package/agent/routes/share/index.ts +1 -1
- package/agent/routes/workspace/build.ts +43 -0
- package/agent/routes/workspace/index.ts +16 -9
- package/agent/routes/workspace/keep.ts +9 -5
- package/agent/routes/workspace/skills.ts +3 -2
- package/dist/cli.js +409 -118
- package/dist/opencode.js +417 -127
- package/dist/routes.d.ts +29 -54
- package/dist/routes.js +399 -108
- package/package.json +14 -6
- package/mod.ts +0 -1
- /package/agent/{command.ts → commander.ts} +0 -0
package/dist/routes.js
CHANGED
|
@@ -316,7 +316,7 @@ var require_dayjs_min = __commonJS((exports, module) => {
|
|
|
316
316
|
});
|
|
317
317
|
});
|
|
318
318
|
|
|
319
|
-
// node_modules/.pnpm/@kevisual+router@0.0.
|
|
319
|
+
// node_modules/.pnpm/@kevisual+router@0.0.90/node_modules/@kevisual/router/dist/router.js
|
|
320
320
|
import { createRequire } from "node:module";
|
|
321
321
|
import { webcrypto as crypto2 } from "node:crypto";
|
|
322
322
|
import url2 from "node:url";
|
|
@@ -17198,6 +17198,9 @@ var toJSONSchemaRoute = (route) => {
|
|
|
17198
17198
|
if (pickValues?.metadata?.args) {
|
|
17199
17199
|
pickValues.metadata.args = toJSONSchema3(pickValues?.metadata?.args, { mergeObject: false });
|
|
17200
17200
|
}
|
|
17201
|
+
if (pickValues?.metadata?.returns) {
|
|
17202
|
+
pickValues.metadata.returns = toJSONSchema3(pickValues?.metadata?.returns, { mergeObject: false });
|
|
17203
|
+
}
|
|
17201
17204
|
return pickValues;
|
|
17202
17205
|
};
|
|
17203
17206
|
var toJSONSchema3 = toJSONSchema2;
|
|
@@ -20394,16 +20397,129 @@ class CNB extends CNBCore {
|
|
|
20394
20397
|
}
|
|
20395
20398
|
}
|
|
20396
20399
|
|
|
20400
|
+
// agent/modules/cnb-manager.ts
|
|
20401
|
+
var getConfig2 = async (opts) => {
|
|
20402
|
+
const kevisualEnv = useKey("KEVISUAL_ENV");
|
|
20403
|
+
const baseUrl = kevisualEnv === "production" ? "https://kevisual.cn/api/router" : "https://kevisual.xiongxiao.me/api/router";
|
|
20404
|
+
const res = await fetch(baseUrl, {
|
|
20405
|
+
method: "POST",
|
|
20406
|
+
body: JSON.stringify({
|
|
20407
|
+
path: "config",
|
|
20408
|
+
key: "get",
|
|
20409
|
+
data: {
|
|
20410
|
+
key: "cnb_center_config.json"
|
|
20411
|
+
}
|
|
20412
|
+
}),
|
|
20413
|
+
headers: {
|
|
20414
|
+
"Content-Type": "application/json",
|
|
20415
|
+
Authorization: `Bearer ${opts.token}`
|
|
20416
|
+
}
|
|
20417
|
+
}).then((res2) => res2.json());
|
|
20418
|
+
return res;
|
|
20419
|
+
};
|
|
20420
|
+
|
|
20421
|
+
class CNBManager {
|
|
20422
|
+
cnbMap = new Map;
|
|
20423
|
+
constructor() {
|
|
20424
|
+
setInterval(() => {
|
|
20425
|
+
this.clearExpiredCNB();
|
|
20426
|
+
}, 1000 * 60 * 30);
|
|
20427
|
+
}
|
|
20428
|
+
getDefaultCNB() {
|
|
20429
|
+
const cnbItem = this.cnbMap.get("default");
|
|
20430
|
+
if (!cnbItem) {
|
|
20431
|
+
throw new Error("Default CNB not found");
|
|
20432
|
+
}
|
|
20433
|
+
return cnbItem;
|
|
20434
|
+
}
|
|
20435
|
+
async getCNB(opts) {
|
|
20436
|
+
const username = opts?.username;
|
|
20437
|
+
const cnbItem = this.cnbMap.get(username);
|
|
20438
|
+
if (cnbItem) {
|
|
20439
|
+
cnbItem.runAt = Date.now();
|
|
20440
|
+
return cnbItem;
|
|
20441
|
+
}
|
|
20442
|
+
const res = await getConfig2({ token: opts?.kevisualToken });
|
|
20443
|
+
if (res.code === 200) {
|
|
20444
|
+
const cookie = res.data?.data?.CNB_COOKIE;
|
|
20445
|
+
const token = res.data?.data?.CNB_API_KEY;
|
|
20446
|
+
if (token) {
|
|
20447
|
+
return this.addCNB({ username, token, cookie });
|
|
20448
|
+
}
|
|
20449
|
+
}
|
|
20450
|
+
return null;
|
|
20451
|
+
}
|
|
20452
|
+
async getContext(ctx) {
|
|
20453
|
+
const tokenUser = ctx?.state?.tokenUser;
|
|
20454
|
+
const username = tokenUser?.username;
|
|
20455
|
+
if (!username) {
|
|
20456
|
+
ctx.throw(403, "Unauthorized");
|
|
20457
|
+
}
|
|
20458
|
+
if (username === "default") {
|
|
20459
|
+
return this.getDefaultCNB().cnb;
|
|
20460
|
+
}
|
|
20461
|
+
const kevisualToken = ctx.query?.token;
|
|
20462
|
+
const item = await this.getCNB({ username, kevisualToken });
|
|
20463
|
+
if (!item) {
|
|
20464
|
+
ctx.throw(400, "不存在的 CNB 配置项,请检查 登录 Token 是否正确,或添加 CNB 配置");
|
|
20465
|
+
}
|
|
20466
|
+
return item.cnb;
|
|
20467
|
+
}
|
|
20468
|
+
addCNB(opts) {
|
|
20469
|
+
if (!opts.username || !opts.token) {
|
|
20470
|
+
throw new Error("username and token are required");
|
|
20471
|
+
}
|
|
20472
|
+
const exist = this.cnbMap.get(opts.username);
|
|
20473
|
+
if (exist) {
|
|
20474
|
+
exist.runAt = Date.now();
|
|
20475
|
+
return exist;
|
|
20476
|
+
}
|
|
20477
|
+
const cnb = opts?.cnb || new CNB({ token: opts.token, cookie: opts.cookie });
|
|
20478
|
+
opts.cnb = cnb;
|
|
20479
|
+
opts.runAt = Date.now();
|
|
20480
|
+
this.cnbMap.set(opts.username, opts);
|
|
20481
|
+
return opts;
|
|
20482
|
+
}
|
|
20483
|
+
clearExpiredCNB(expireTime = 1000 * 60 * 60) {
|
|
20484
|
+
const now = Date.now();
|
|
20485
|
+
for (const [username, item] of this.cnbMap.entries()) {
|
|
20486
|
+
if (username === "default") {
|
|
20487
|
+
continue;
|
|
20488
|
+
}
|
|
20489
|
+
if (item.runAt && now - item.runAt > expireTime) {
|
|
20490
|
+
this.cnbMap.delete(username);
|
|
20491
|
+
}
|
|
20492
|
+
}
|
|
20493
|
+
}
|
|
20494
|
+
clearUsername(username) {
|
|
20495
|
+
this.cnbMap.delete(username);
|
|
20496
|
+
}
|
|
20497
|
+
}
|
|
20498
|
+
|
|
20397
20499
|
// agent/app.ts
|
|
20398
|
-
var
|
|
20399
|
-
var
|
|
20400
|
-
|
|
20401
|
-
|
|
20402
|
-
|
|
20403
|
-
|
|
20404
|
-
|
|
20500
|
+
var cnbManager = new CNBManager;
|
|
20501
|
+
var token = useKey2("CNB_API_KEY") || useKey2("CNB_TOKEN");
|
|
20502
|
+
var cookie = useKey2("CNB_COOKIE");
|
|
20503
|
+
try {
|
|
20504
|
+
cnbManager.addCNB({
|
|
20505
|
+
username: "default",
|
|
20506
|
+
token,
|
|
20507
|
+
cookie,
|
|
20508
|
+
cnb: new CNB({ token, cookie })
|
|
20509
|
+
});
|
|
20510
|
+
} catch (error48) {}
|
|
20511
|
+
var cnb = (await cnbManager.getCNB({ username: "default" })).cnb;
|
|
20512
|
+
var app = await useContextKey("app", () => {
|
|
20405
20513
|
return new QueryRouterServer({});
|
|
20406
20514
|
});
|
|
20515
|
+
var notCNBCheck = (ctx) => {
|
|
20516
|
+
const isCNB = useKey2("CNB");
|
|
20517
|
+
if (!isCNB) {
|
|
20518
|
+
ctx.throw(400, "当前环境非 cnb-board 环境,无法获取 live 内容");
|
|
20519
|
+
return true;
|
|
20520
|
+
}
|
|
20521
|
+
return false;
|
|
20522
|
+
};
|
|
20407
20523
|
// node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
20408
20524
|
var exports_external2 = {};
|
|
20409
20525
|
__export(exports_external2, {
|
|
@@ -20545,7 +20661,7 @@ __export(exports_external2, {
|
|
|
20545
20661
|
cuid2: () => cuid25,
|
|
20546
20662
|
cuid: () => cuid6,
|
|
20547
20663
|
core: () => exports_core3,
|
|
20548
|
-
config: () =>
|
|
20664
|
+
config: () => config2,
|
|
20549
20665
|
coerce: () => exports_coerce2,
|
|
20550
20666
|
codec: () => codec2,
|
|
20551
20667
|
clone: () => clone2,
|
|
@@ -20684,7 +20800,7 @@ __export(exports_core3, {
|
|
|
20684
20800
|
decode: () => decode4,
|
|
20685
20801
|
createToJSONSchemaMethod: () => createToJSONSchemaMethod2,
|
|
20686
20802
|
createStandardJSONSchemaMethod: () => createStandardJSONSchemaMethod2,
|
|
20687
|
-
config: () =>
|
|
20803
|
+
config: () => config2,
|
|
20688
20804
|
clone: () => clone2,
|
|
20689
20805
|
_xor: () => _xor2,
|
|
20690
20806
|
_xid: () => _xid2,
|
|
@@ -20994,7 +21110,7 @@ class $ZodEncodeError2 extends Error {
|
|
|
20994
21110
|
}
|
|
20995
21111
|
}
|
|
20996
21112
|
var globalConfig2 = {};
|
|
20997
|
-
function
|
|
21113
|
+
function config2(newConfig) {
|
|
20998
21114
|
if (newConfig)
|
|
20999
21115
|
Object.assign(globalConfig2, newConfig);
|
|
21000
21116
|
return globalConfig2;
|
|
@@ -21564,10 +21680,10 @@ function prefixIssues2(path2, issues) {
|
|
|
21564
21680
|
function unwrapMessage2(message) {
|
|
21565
21681
|
return typeof message === "string" ? message : message?.message;
|
|
21566
21682
|
}
|
|
21567
|
-
function finalizeIssue2(iss, ctx,
|
|
21683
|
+
function finalizeIssue2(iss, ctx, config3) {
|
|
21568
21684
|
const full = { ...iss, path: iss.path ?? [] };
|
|
21569
21685
|
if (!iss.message) {
|
|
21570
|
-
const message = unwrapMessage2(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage2(ctx?.error?.(iss)) ?? unwrapMessage2(
|
|
21686
|
+
const message = unwrapMessage2(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage2(ctx?.error?.(iss)) ?? unwrapMessage2(config3.customError?.(iss)) ?? unwrapMessage2(config3.localeError?.(iss)) ?? "Invalid input";
|
|
21571
21687
|
full.message = message;
|
|
21572
21688
|
}
|
|
21573
21689
|
delete full.inst;
|
|
@@ -21818,7 +21934,7 @@ var _parse2 = (_Err) => (schema, value, _ctx, _params) => {
|
|
|
21818
21934
|
throw new $ZodAsyncError2;
|
|
21819
21935
|
}
|
|
21820
21936
|
if (result.issues.length) {
|
|
21821
|
-
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue2(iss, ctx,
|
|
21937
|
+
const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())));
|
|
21822
21938
|
captureStackTrace2(e, _params?.callee);
|
|
21823
21939
|
throw e;
|
|
21824
21940
|
}
|
|
@@ -21831,7 +21947,7 @@ var _parseAsync2 = (_Err) => async (schema, value, _ctx, params) => {
|
|
|
21831
21947
|
if (result instanceof Promise)
|
|
21832
21948
|
result = await result;
|
|
21833
21949
|
if (result.issues.length) {
|
|
21834
|
-
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue2(iss, ctx,
|
|
21950
|
+
const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())));
|
|
21835
21951
|
captureStackTrace2(e, params?.callee);
|
|
21836
21952
|
throw e;
|
|
21837
21953
|
}
|
|
@@ -21846,7 +21962,7 @@ var _safeParse2 = (_Err) => (schema, value, _ctx) => {
|
|
|
21846
21962
|
}
|
|
21847
21963
|
return result.issues.length ? {
|
|
21848
21964
|
success: false,
|
|
21849
|
-
error: new (_Err ?? $ZodError2)(result.issues.map((iss) => finalizeIssue2(iss, ctx,
|
|
21965
|
+
error: new (_Err ?? $ZodError2)(result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())))
|
|
21850
21966
|
} : { success: true, data: result.value };
|
|
21851
21967
|
};
|
|
21852
21968
|
var safeParse3 = /* @__PURE__ */ _safeParse2($ZodRealError2);
|
|
@@ -21857,7 +21973,7 @@ var _safeParseAsync2 = (_Err) => async (schema, value, _ctx) => {
|
|
|
21857
21973
|
result = await result;
|
|
21858
21974
|
return result.issues.length ? {
|
|
21859
21975
|
success: false,
|
|
21860
|
-
error: new _Err(result.issues.map((iss) => finalizeIssue2(iss, ctx,
|
|
21976
|
+
error: new _Err(result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())))
|
|
21861
21977
|
} : { success: true, data: result.value };
|
|
21862
21978
|
};
|
|
21863
21979
|
var safeParseAsync3 = /* @__PURE__ */ _safeParseAsync2($ZodRealError2);
|
|
@@ -23017,9 +23133,9 @@ var $ZodE1642 = /* @__PURE__ */ $constructor2("$ZodE164", (inst, def) => {
|
|
|
23017
23133
|
def.pattern ?? (def.pattern = e1643);
|
|
23018
23134
|
$ZodStringFormat2.init(inst, def);
|
|
23019
23135
|
});
|
|
23020
|
-
function isValidJWT2(
|
|
23136
|
+
function isValidJWT2(token2, algorithm = null) {
|
|
23021
23137
|
try {
|
|
23022
|
-
const tokensParts =
|
|
23138
|
+
const tokensParts = token2.split(".");
|
|
23023
23139
|
if (tokensParts.length !== 3)
|
|
23024
23140
|
return false;
|
|
23025
23141
|
const [header] = tokensParts;
|
|
@@ -23526,7 +23642,7 @@ function handleUnionResults2(results, final, inst, ctx) {
|
|
|
23526
23642
|
code: "invalid_union",
|
|
23527
23643
|
input: final.value,
|
|
23528
23644
|
inst,
|
|
23529
|
-
errors: results.map((result) => result.issues.map((iss) => finalizeIssue2(iss, ctx,
|
|
23645
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())))
|
|
23530
23646
|
});
|
|
23531
23647
|
return final;
|
|
23532
23648
|
}
|
|
@@ -23587,7 +23703,7 @@ function handleExclusiveUnionResults2(results, final, inst, ctx) {
|
|
|
23587
23703
|
code: "invalid_union",
|
|
23588
23704
|
input: final.value,
|
|
23589
23705
|
inst,
|
|
23590
|
-
errors: results.map((result) => result.issues.map((iss) => finalizeIssue2(iss, ctx,
|
|
23706
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue2(iss, ctx, config2())))
|
|
23591
23707
|
});
|
|
23592
23708
|
} else {
|
|
23593
23709
|
final.issues.push({
|
|
@@ -23946,7 +24062,7 @@ var $ZodRecord2 = /* @__PURE__ */ $constructor2("$ZodRecord", (inst, def) => {
|
|
|
23946
24062
|
payload.issues.push({
|
|
23947
24063
|
code: "invalid_key",
|
|
23948
24064
|
origin: "record",
|
|
23949
|
-
issues: keyResult.issues.map((iss) => finalizeIssue2(iss, ctx,
|
|
24065
|
+
issues: keyResult.issues.map((iss) => finalizeIssue2(iss, ctx, config2())),
|
|
23950
24066
|
input: key,
|
|
23951
24067
|
path: [key],
|
|
23952
24068
|
inst
|
|
@@ -24017,7 +24133,7 @@ function handleMapResult2(keyResult, valueResult, final, key, input, inst, ctx)
|
|
|
24017
24133
|
origin: "map",
|
|
24018
24134
|
input,
|
|
24019
24135
|
inst,
|
|
24020
|
-
issues: keyResult.issues.map((iss) => finalizeIssue2(iss, ctx,
|
|
24136
|
+
issues: keyResult.issues.map((iss) => finalizeIssue2(iss, ctx, config2()))
|
|
24021
24137
|
});
|
|
24022
24138
|
}
|
|
24023
24139
|
}
|
|
@@ -24031,7 +24147,7 @@ function handleMapResult2(keyResult, valueResult, final, key, input, inst, ctx)
|
|
|
24031
24147
|
input,
|
|
24032
24148
|
inst,
|
|
24033
24149
|
key,
|
|
24034
|
-
issues: valueResult.issues.map((iss) => finalizeIssue2(iss, ctx,
|
|
24150
|
+
issues: valueResult.issues.map((iss) => finalizeIssue2(iss, ctx, config2()))
|
|
24035
24151
|
});
|
|
24036
24152
|
}
|
|
24037
24153
|
}
|
|
@@ -24301,7 +24417,7 @@ var $ZodCatch2 = /* @__PURE__ */ $constructor2("$ZodCatch", (inst, def) => {
|
|
|
24301
24417
|
payload.value = def.catchValue({
|
|
24302
24418
|
...payload,
|
|
24303
24419
|
error: {
|
|
24304
|
-
issues: result2.issues.map((iss) => finalizeIssue2(iss, ctx,
|
|
24420
|
+
issues: result2.issues.map((iss) => finalizeIssue2(iss, ctx, config2()))
|
|
24305
24421
|
},
|
|
24306
24422
|
input: payload.value
|
|
24307
24423
|
});
|
|
@@ -24315,7 +24431,7 @@ var $ZodCatch2 = /* @__PURE__ */ $constructor2("$ZodCatch", (inst, def) => {
|
|
|
24315
24431
|
payload.value = def.catchValue({
|
|
24316
24432
|
...payload,
|
|
24317
24433
|
error: {
|
|
24318
|
-
issues: result.issues.map((iss) => finalizeIssue2(iss, ctx,
|
|
24434
|
+
issues: result.issues.map((iss) => finalizeIssue2(iss, ctx, config2()))
|
|
24319
24435
|
},
|
|
24320
24436
|
input: payload.value
|
|
24321
24437
|
});
|
|
@@ -33439,12 +33555,12 @@ var ZodIssueCode2 = {
|
|
|
33439
33555
|
custom: "custom"
|
|
33440
33556
|
};
|
|
33441
33557
|
function setErrorMap2(map3) {
|
|
33442
|
-
|
|
33558
|
+
config2({
|
|
33443
33559
|
customError: map3
|
|
33444
33560
|
});
|
|
33445
33561
|
}
|
|
33446
33562
|
function getErrorMap2() {
|
|
33447
|
-
return
|
|
33563
|
+
return config2().customError;
|
|
33448
33564
|
}
|
|
33449
33565
|
var ZodFirstPartyTypeKind2;
|
|
33450
33566
|
(function(ZodFirstPartyTypeKind3) {})(ZodFirstPartyTypeKind2 || (ZodFirstPartyTypeKind2 = {}));
|
|
@@ -33935,11 +34051,11 @@ function date9(params) {
|
|
|
33935
34051
|
}
|
|
33936
34052
|
|
|
33937
34053
|
// node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/classic/external.js
|
|
33938
|
-
|
|
34054
|
+
config2(en_default2());
|
|
33939
34055
|
// node_modules/.pnpm/zod@4.3.6/node_modules/zod/index.js
|
|
33940
34056
|
var zod_default = exports_external2;
|
|
33941
34057
|
|
|
33942
|
-
// node_modules/.pnpm/@opencode-ai+plugin@1.2.
|
|
34058
|
+
// node_modules/.pnpm/@opencode-ai+plugin@1.2.23/node_modules/@opencode-ai/plugin/dist/tool.js
|
|
33943
34059
|
function tool2(input) {
|
|
33944
34060
|
return input;
|
|
33945
34061
|
}
|
|
@@ -33950,7 +34066,7 @@ app.route({
|
|
|
33950
34066
|
path: "cnb",
|
|
33951
34067
|
key: "user-check",
|
|
33952
34068
|
description: "检查用户登录状态,参数checkToken,default true; checkCookie, default false",
|
|
33953
|
-
middleware: ["auth
|
|
34069
|
+
middleware: ["auth"],
|
|
33954
34070
|
metadata: {
|
|
33955
34071
|
tags: ["opencode"],
|
|
33956
34072
|
...createSkill({
|
|
@@ -33967,8 +34083,9 @@ app.route({
|
|
|
33967
34083
|
const checkToken = ctx.query?.checkToken ?? true;
|
|
33968
34084
|
const checkCookie = ctx.query?.checkCookie ?? false;
|
|
33969
34085
|
let content = "";
|
|
34086
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
33970
34087
|
if (checkToken) {
|
|
33971
|
-
const res = await
|
|
34088
|
+
const res = await cnb2.user.getUser();
|
|
33972
34089
|
if (res?.code !== 200) {
|
|
33973
34090
|
content += `Token 无效,请检查 CNB_TOKEN 配置。
|
|
33974
34091
|
`;
|
|
@@ -33978,7 +34095,7 @@ app.route({
|
|
|
33978
34095
|
}
|
|
33979
34096
|
}
|
|
33980
34097
|
if (checkCookie) {
|
|
33981
|
-
const res = await
|
|
34098
|
+
const res = await cnb2.user.getCurrentUser();
|
|
33982
34099
|
if (res?.code !== 200) {
|
|
33983
34100
|
content += `Cookie 无效,请检查 CNB_COOKIE 配置。
|
|
33984
34101
|
`;
|
|
@@ -33995,7 +34112,7 @@ app.route({
|
|
|
33995
34112
|
path: "cnb",
|
|
33996
34113
|
key: "list-repos",
|
|
33997
34114
|
description: "列出我的代码仓库",
|
|
33998
|
-
middleware: ["auth
|
|
34115
|
+
middleware: ["auth"],
|
|
33999
34116
|
metadata: {
|
|
34000
34117
|
tags: ["opencode"],
|
|
34001
34118
|
...createSkill({
|
|
@@ -34010,6 +34127,7 @@ app.route({
|
|
|
34010
34127
|
})
|
|
34011
34128
|
}
|
|
34012
34129
|
}).define(async (ctx) => {
|
|
34130
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34013
34131
|
const search = ctx.query?.search;
|
|
34014
34132
|
const pageSize = ctx.query?.pageSize || 9999;
|
|
34015
34133
|
const flags = ctx.query?.flags;
|
|
@@ -34017,7 +34135,7 @@ app.route({
|
|
|
34017
34135
|
if (flags) {
|
|
34018
34136
|
params.flags = flags;
|
|
34019
34137
|
}
|
|
34020
|
-
const res = await
|
|
34138
|
+
const res = await cnb2.repo.getRepoList({ search, page_size: pageSize, role: "developer", ...params });
|
|
34021
34139
|
if (res.code === 200) {
|
|
34022
34140
|
const repos = res.data.map((item) => ({
|
|
34023
34141
|
name: item.name,
|
|
@@ -34036,7 +34154,7 @@ app.route({
|
|
|
34036
34154
|
path: "cnb",
|
|
34037
34155
|
key: "create-repo",
|
|
34038
34156
|
description: "创建代码仓库, 参数name, visibility, description",
|
|
34039
|
-
middleware: ["auth
|
|
34157
|
+
middleware: ["auth"],
|
|
34040
34158
|
metadata: {
|
|
34041
34159
|
tags: ["opencode"],
|
|
34042
34160
|
...createSkill({
|
|
@@ -34051,6 +34169,7 @@ app.route({
|
|
|
34051
34169
|
})
|
|
34052
34170
|
}
|
|
34053
34171
|
}).define(async (ctx) => {
|
|
34172
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34054
34173
|
const name = ctx.query?.name;
|
|
34055
34174
|
const visibility = ctx.query?.visibility ?? "public";
|
|
34056
34175
|
const description = ctx.query?.description ?? "";
|
|
@@ -34058,7 +34177,7 @@ app.route({
|
|
|
34058
34177
|
ctx.throw(400, "缺少参数 name");
|
|
34059
34178
|
}
|
|
34060
34179
|
try {
|
|
34061
|
-
const res = await
|
|
34180
|
+
const res = await cnb2.repo.createRepo({
|
|
34062
34181
|
name,
|
|
34063
34182
|
visibility,
|
|
34064
34183
|
description
|
|
@@ -34069,11 +34188,30 @@ app.route({
|
|
|
34069
34188
|
ctx.body = { content: "JS仓库可能已存在" };
|
|
34070
34189
|
}
|
|
34071
34190
|
}).addTo(app);
|
|
34191
|
+
app.route({
|
|
34192
|
+
path: "cnb",
|
|
34193
|
+
key: "get-repo",
|
|
34194
|
+
description: "获取代码仓库详情, 参数name",
|
|
34195
|
+
middleware: ["auth"],
|
|
34196
|
+
metadata: {
|
|
34197
|
+
args: {
|
|
34198
|
+
name: tool.schema.string().describe("代码仓库名称, 如 my-user/my-repo")
|
|
34199
|
+
}
|
|
34200
|
+
}
|
|
34201
|
+
}).define(async (ctx) => {
|
|
34202
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34203
|
+
const name = ctx.query?.name;
|
|
34204
|
+
if (!name) {
|
|
34205
|
+
ctx.throw(400, "缺少参数 name");
|
|
34206
|
+
}
|
|
34207
|
+
const res = await cnb2.repo.getRepo(name);
|
|
34208
|
+
ctx.forward(res);
|
|
34209
|
+
}).addTo(app);
|
|
34072
34210
|
app.route({
|
|
34073
34211
|
path: "cnb",
|
|
34074
34212
|
key: "create-repo-file",
|
|
34075
34213
|
description: "在代码仓库中创建文件, repoName, filePath, content, encoding。使用CNB_COOKIE进行鉴权",
|
|
34076
|
-
middleware: ["auth
|
|
34214
|
+
middleware: ["auth"],
|
|
34077
34215
|
metadata: {
|
|
34078
34216
|
tags: ["opencode"],
|
|
34079
34217
|
...createSkill({
|
|
@@ -34089,6 +34227,7 @@ app.route({
|
|
|
34089
34227
|
})
|
|
34090
34228
|
}
|
|
34091
34229
|
}).define(async (ctx) => {
|
|
34230
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34092
34231
|
const repoName = ctx.query?.repoName;
|
|
34093
34232
|
const filePath = ctx.query?.filePath;
|
|
34094
34233
|
const content = ctx.query?.content;
|
|
@@ -34096,7 +34235,7 @@ app.route({
|
|
|
34096
34235
|
if (!repoName || !filePath || !content) {
|
|
34097
34236
|
ctx.throw(400, "缺少参数 repoName, filePath 或 content");
|
|
34098
34237
|
}
|
|
34099
|
-
const res = await
|
|
34238
|
+
const res = await cnb2.repo.createCommit(repoName, {
|
|
34100
34239
|
message: `添加文件 ${filePath} 通过 API `,
|
|
34101
34240
|
files: [
|
|
34102
34241
|
{ path: filePath, content, encoding }
|
|
@@ -34108,7 +34247,7 @@ app.route({
|
|
|
34108
34247
|
path: "cnb",
|
|
34109
34248
|
key: "delete-repo",
|
|
34110
34249
|
description: "删除代码仓库, 参数name",
|
|
34111
|
-
middleware: ["auth
|
|
34250
|
+
middleware: ["auth"],
|
|
34112
34251
|
metadata: {
|
|
34113
34252
|
tags: ["opencode"],
|
|
34114
34253
|
...createSkill({
|
|
@@ -34121,11 +34260,57 @@ app.route({
|
|
|
34121
34260
|
})
|
|
34122
34261
|
}
|
|
34123
34262
|
}).define(async (ctx) => {
|
|
34263
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34264
|
+
const name = ctx.query?.name;
|
|
34265
|
+
if (!name) {
|
|
34266
|
+
ctx.throw(400, "缺少参数 name");
|
|
34267
|
+
}
|
|
34268
|
+
try {
|
|
34269
|
+
const resCookie = await cnb2.user.checkCookieValid();
|
|
34270
|
+
if (resCookie.code !== 200) {
|
|
34271
|
+
ctx.throw(401, "Cookie 无效或已过期");
|
|
34272
|
+
}
|
|
34273
|
+
const res = await cnb2.repo.deleteRepoCookie(name);
|
|
34274
|
+
ctx.forward(res);
|
|
34275
|
+
} catch (error49) {
|
|
34276
|
+
ctx.code = 200;
|
|
34277
|
+
ctx.body = { content: "已经删除" };
|
|
34278
|
+
}
|
|
34279
|
+
}).addTo(app);
|
|
34280
|
+
app.route({
|
|
34281
|
+
path: "cnb",
|
|
34282
|
+
key: "update-repo-info",
|
|
34283
|
+
description: "更新代码仓库信息, 参数name, description",
|
|
34284
|
+
middleware: ["auth"],
|
|
34285
|
+
metadata: {
|
|
34286
|
+
tags: ["opencode"],
|
|
34287
|
+
...createSkill({
|
|
34288
|
+
skill: "update-repo-info",
|
|
34289
|
+
title: "更新代码仓库信息",
|
|
34290
|
+
args: {
|
|
34291
|
+
name: tool.schema.string().describe("代码仓库名称"),
|
|
34292
|
+
description: tool.schema.string().describe("代码仓库描述"),
|
|
34293
|
+
license: tool.schema.string().describe("代码仓库许可证类型,如 MIT").optional(),
|
|
34294
|
+
site: tool.schema.string().describe("代码仓库主页链接").optional(),
|
|
34295
|
+
topics: tool.schema.array(tool.schema.string()).describe("代码仓库话题标签列表").optional()
|
|
34296
|
+
},
|
|
34297
|
+
summary: "更新代码仓库的信息"
|
|
34298
|
+
})
|
|
34299
|
+
}
|
|
34300
|
+
}).define(async (ctx) => {
|
|
34301
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34124
34302
|
const name = ctx.query?.name;
|
|
34303
|
+
const description = ctx.query?.description;
|
|
34304
|
+
const license = ctx.query?.license;
|
|
34305
|
+
const site = ctx.query?.site;
|
|
34306
|
+
const topics = ctx.query?.topics;
|
|
34125
34307
|
if (!name) {
|
|
34126
34308
|
ctx.throw(400, "缺少参数 name");
|
|
34127
34309
|
}
|
|
34128
|
-
|
|
34310
|
+
if (!description) {
|
|
34311
|
+
ctx.throw(400, "缺少参数 description");
|
|
34312
|
+
}
|
|
34313
|
+
const res = await cnb2.repo.updateRepoInfo(name, { description, license, site, topics });
|
|
34129
34314
|
ctx.forward(res);
|
|
34130
34315
|
}).addTo(app);
|
|
34131
34316
|
|
|
@@ -34134,7 +34319,7 @@ app.route({
|
|
|
34134
34319
|
path: "cnb",
|
|
34135
34320
|
key: "clean-closed-workspace",
|
|
34136
34321
|
description: "批量删除已停止的cnb工作空间",
|
|
34137
|
-
middleware: ["auth
|
|
34322
|
+
middleware: ["auth"],
|
|
34138
34323
|
metadata: {
|
|
34139
34324
|
tags: ["opencode"],
|
|
34140
34325
|
...createSkill({
|
|
@@ -34144,7 +34329,8 @@ app.route({
|
|
|
34144
34329
|
})
|
|
34145
34330
|
}
|
|
34146
34331
|
}).define(async (ctx) => {
|
|
34147
|
-
const
|
|
34332
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34333
|
+
const closedWorkspaces = await cnb2.workspace.list({ status: "closed", pageSize: 100 });
|
|
34148
34334
|
if (closedWorkspaces.code !== 200) {
|
|
34149
34335
|
ctx.throw(500, "获取已关闭工作空间列表失败");
|
|
34150
34336
|
}
|
|
@@ -34156,7 +34342,7 @@ app.route({
|
|
|
34156
34342
|
const sns = list.map((ws) => ws.sn);
|
|
34157
34343
|
const results = [];
|
|
34158
34344
|
for (const sn of sns) {
|
|
34159
|
-
const res = await
|
|
34345
|
+
const res = await cnb2.workspace.deleteWorkspace({ sn });
|
|
34160
34346
|
results.push(res);
|
|
34161
34347
|
}
|
|
34162
34348
|
ctx.forward({ code: 200, message: "已关闭的工作空间删除完成", data: results });
|
|
@@ -34245,12 +34431,12 @@ function removeKeepAliveData(repo2, pipelineId) {
|
|
|
34245
34431
|
}
|
|
34246
34432
|
}
|
|
34247
34433
|
var createLiveData = (data) => {
|
|
34248
|
-
const { cookie, repo: repo2, pipelineId } = data;
|
|
34434
|
+
const { cookie: cookie2, repo: repo2, pipelineId } = data;
|
|
34249
34435
|
const createdTime = Date.now();
|
|
34250
34436
|
const wsUrl = `wss://${pipelineId}.cnb.space:443?skipWebSocketFrames=false`;
|
|
34251
34437
|
const pm2Name = `keep_${repo2}__${pipelineId}`.replace(/\//g, "__");
|
|
34252
34438
|
const filePath = path2.join(baseDir, `${pm2Name}.json`);
|
|
34253
|
-
const _newData = { wss: wsUrl, wsUrl, cookie, repo: repo2, pipelineId, createdTime, filePath, pm2Name };
|
|
34439
|
+
const _newData = { wss: wsUrl, wsUrl, cookie: cookie2, repo: repo2, pipelineId, createdTime, filePath, pm2Name };
|
|
34254
34440
|
if (!fs2.existsSync(path2.dirname(filePath))) {
|
|
34255
34441
|
fs2.mkdirSync(path2.dirname(filePath), { recursive: true });
|
|
34256
34442
|
}
|
|
@@ -34263,7 +34449,7 @@ app.route({
|
|
|
34263
34449
|
path: "cnb",
|
|
34264
34450
|
key: "keep-workspace-alive",
|
|
34265
34451
|
description: "保持工作空间存活技能,参数repo:代码仓库路径,例如 user/repo,pipelineId:流水线ID,例如 cnb-708-1ji9sog7o-001",
|
|
34266
|
-
middleware: ["auth
|
|
34452
|
+
middleware: ["auth"],
|
|
34267
34453
|
metadata: {
|
|
34268
34454
|
tags: [],
|
|
34269
34455
|
...{
|
|
@@ -34274,16 +34460,19 @@ app.route({
|
|
|
34274
34460
|
}
|
|
34275
34461
|
}
|
|
34276
34462
|
}).define(async (ctx) => {
|
|
34463
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34277
34464
|
const repo2 = ctx.query?.repo;
|
|
34278
34465
|
const pipelineId = ctx.query?.pipelineId;
|
|
34466
|
+
if (notCNBCheck(ctx))
|
|
34467
|
+
return;
|
|
34279
34468
|
if (!repo2 || !pipelineId) {
|
|
34280
34469
|
ctx.throw(400, "缺少参数 repo 或 pipelineId");
|
|
34281
34470
|
}
|
|
34282
|
-
const validCookie = await
|
|
34471
|
+
const validCookie = await cnb2.user.checkCookieValid();
|
|
34283
34472
|
if (validCookie.code !== 200) {
|
|
34284
34473
|
ctx.throw(401, "CNB_COOKIE 环境变量无效或已过期,请重新登录获取新的cookie");
|
|
34285
34474
|
}
|
|
34286
|
-
const res = await
|
|
34475
|
+
const res = await cnb2.workspace.getWorkspaceCookie(repo2, pipelineId);
|
|
34287
34476
|
if (res.code !== 200 || !res.data?.cookie) {
|
|
34288
34477
|
ctx.throw(500, `获取工作空间 Cookie 失败: ${res.message}`);
|
|
34289
34478
|
}
|
|
@@ -34300,7 +34489,7 @@ app.route({
|
|
|
34300
34489
|
path: "cnb",
|
|
34301
34490
|
key: "stop-keep-workspace-alive",
|
|
34302
34491
|
description: "停止保持工作空间存活技能, 参数repo:代码仓库路径,例如 user/repo,pipelineId:流水线ID,例如 cnb-708-1ji9sog7o-001",
|
|
34303
|
-
middleware: ["auth
|
|
34492
|
+
middleware: ["auth"],
|
|
34304
34493
|
metadata: {
|
|
34305
34494
|
tags: [],
|
|
34306
34495
|
...{
|
|
@@ -34311,6 +34500,8 @@ app.route({
|
|
|
34311
34500
|
}
|
|
34312
34501
|
}
|
|
34313
34502
|
}).define(async (ctx) => {
|
|
34503
|
+
if (notCNBCheck(ctx))
|
|
34504
|
+
return;
|
|
34314
34505
|
const repo2 = ctx.query?.repo;
|
|
34315
34506
|
const pipelineId = ctx.query?.pipelineId;
|
|
34316
34507
|
if (!repo2 || !pipelineId) {
|
|
@@ -34323,7 +34514,7 @@ app.route({
|
|
|
34323
34514
|
path: "cnb",
|
|
34324
34515
|
key: "keep-alive-current-workspace",
|
|
34325
34516
|
description: "保持当前工作空间存活技能",
|
|
34326
|
-
middleware: ["auth
|
|
34517
|
+
middleware: ["auth"],
|
|
34327
34518
|
metadata: {
|
|
34328
34519
|
tags: ["opencode"],
|
|
34329
34520
|
skill: "keep-alive-current-workspace",
|
|
@@ -34331,6 +34522,8 @@ app.route({
|
|
|
34331
34522
|
summary: "保持当前工作空间存活,防止被关闭或释放资源"
|
|
34332
34523
|
}
|
|
34333
34524
|
}).define(async (ctx) => {
|
|
34525
|
+
if (notCNBCheck(ctx))
|
|
34526
|
+
return;
|
|
34334
34527
|
const pipelineId = useKey("CNB_PIPELINE_ID");
|
|
34335
34528
|
const repo2 = useKey("CNB_REPO_SLUG_LOWERCASE");
|
|
34336
34529
|
if (!pipelineId || !repo2) {
|
|
@@ -34340,12 +34533,52 @@ app.route({
|
|
|
34340
34533
|
ctx.forward(res);
|
|
34341
34534
|
}).addTo(app);
|
|
34342
34535
|
|
|
34536
|
+
// agent/routes/workspace/build.ts
|
|
34537
|
+
app.route({
|
|
34538
|
+
path: "cnb",
|
|
34539
|
+
key: "cloud-build",
|
|
34540
|
+
description: "云端构建,参数 event, repo, branch, ref, config, env",
|
|
34541
|
+
middleware: ["auth"],
|
|
34542
|
+
metadata: {
|
|
34543
|
+
tags: ["opencode"],
|
|
34544
|
+
...createSkill({
|
|
34545
|
+
skill: "cloud-build",
|
|
34546
|
+
title: "云端构建",
|
|
34547
|
+
summary: "在云端构建代码仓库,参数包括 event, repo, branch, ref, config, env",
|
|
34548
|
+
args: {
|
|
34549
|
+
env: tool.schema.any().optional().describe('构建环境变量,格式为 { "KEY": "VALUE" }'),
|
|
34550
|
+
event: tool.schema.string().optional().describe("触发事件类型,例如 api_trigger_event"),
|
|
34551
|
+
branch: tool.schema.string().optional().describe("分支名称,默认主分支"),
|
|
34552
|
+
config: tool.schema.string().describe("构建config文件内容,例如 cloudbuild.yaml对应的yml的内容"),
|
|
34553
|
+
repo: tool.schema.string().describe("代码仓库路径,例如 user/repo")
|
|
34554
|
+
}
|
|
34555
|
+
})
|
|
34556
|
+
}
|
|
34557
|
+
}).define(async (ctx) => {
|
|
34558
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34559
|
+
const repo2 = ctx.query?.repo;
|
|
34560
|
+
const branch = ctx.query?.branch || "main";
|
|
34561
|
+
const config3 = ctx.query?.config;
|
|
34562
|
+
const event = ctx.query?.event || "api_trigger_event";
|
|
34563
|
+
const env = ctx.query?.env ?? {};
|
|
34564
|
+
if (!repo2) {
|
|
34565
|
+
ctx.throw(400, "缺少参数 repo");
|
|
34566
|
+
}
|
|
34567
|
+
const res = await cnb2.build.startBuild(repo2, {
|
|
34568
|
+
branch,
|
|
34569
|
+
config: config3,
|
|
34570
|
+
event,
|
|
34571
|
+
env
|
|
34572
|
+
});
|
|
34573
|
+
ctx.forward(res);
|
|
34574
|
+
}).addTo(app);
|
|
34575
|
+
|
|
34343
34576
|
// agent/routes/workspace/index.ts
|
|
34344
34577
|
app.route({
|
|
34345
34578
|
path: "cnb",
|
|
34346
34579
|
key: "start-workspace",
|
|
34347
34580
|
description: "启动开发工作空间, 参数 repo",
|
|
34348
|
-
middleware: ["auth
|
|
34581
|
+
middleware: ["auth"],
|
|
34349
34582
|
metadata: {
|
|
34350
34583
|
tags: ["opencode"],
|
|
34351
34584
|
...createSkill({
|
|
@@ -34360,13 +34593,14 @@ app.route({
|
|
|
34360
34593
|
})
|
|
34361
34594
|
}
|
|
34362
34595
|
}).define(async (ctx) => {
|
|
34596
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34363
34597
|
const repo2 = ctx.query?.repo;
|
|
34364
34598
|
const branch = ctx.query?.branch;
|
|
34365
34599
|
const ref = ctx.query?.ref;
|
|
34366
34600
|
if (!repo2) {
|
|
34367
34601
|
ctx.throw(400, "缺少参数 repo");
|
|
34368
34602
|
}
|
|
34369
|
-
const res = await
|
|
34603
|
+
const res = await cnb2.workspace.startWorkspace(repo2, {
|
|
34370
34604
|
branch,
|
|
34371
34605
|
ref
|
|
34372
34606
|
});
|
|
@@ -34376,7 +34610,7 @@ app.route({
|
|
|
34376
34610
|
path: "cnb",
|
|
34377
34611
|
key: "list-workspace",
|
|
34378
34612
|
description: "获取cnb开发工作空间列表,可选参数 status=running 获取运行中的环境",
|
|
34379
|
-
middleware: ["auth
|
|
34613
|
+
middleware: ["auth"],
|
|
34380
34614
|
metadata: {
|
|
34381
34615
|
tags: ["opencode"],
|
|
34382
34616
|
...createSkill({
|
|
@@ -34393,19 +34627,20 @@ app.route({
|
|
|
34393
34627
|
})
|
|
34394
34628
|
}
|
|
34395
34629
|
}).define(async (ctx) => {
|
|
34630
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34396
34631
|
const { status = "running", page, pageSize, slug, branch } = ctx.query || {};
|
|
34397
|
-
const res = await
|
|
34632
|
+
const res = await cnb2.workspace.list({
|
|
34398
34633
|
status,
|
|
34399
34634
|
page: page ?? 1,
|
|
34400
34635
|
pageSize: pageSize ?? 100
|
|
34401
34636
|
});
|
|
34402
|
-
ctx.forward(
|
|
34637
|
+
ctx.forward(res);
|
|
34403
34638
|
}).addTo(app);
|
|
34404
34639
|
app.route({
|
|
34405
34640
|
path: "cnb",
|
|
34406
34641
|
key: "get-workspace",
|
|
34407
34642
|
description: "获取工作空间详情,通过 repo 和 sn 获取",
|
|
34408
|
-
middleware: ["auth
|
|
34643
|
+
middleware: ["auth"],
|
|
34409
34644
|
metadata: {
|
|
34410
34645
|
tags: ["opencode"],
|
|
34411
34646
|
...createSkill({
|
|
@@ -34419,6 +34654,7 @@ app.route({
|
|
|
34419
34654
|
})
|
|
34420
34655
|
}
|
|
34421
34656
|
}).define(async (ctx) => {
|
|
34657
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34422
34658
|
const repo2 = ctx.query?.repo;
|
|
34423
34659
|
const sn = ctx.query?.sn;
|
|
34424
34660
|
if (!repo2) {
|
|
@@ -34427,14 +34663,14 @@ app.route({
|
|
|
34427
34663
|
if (!sn) {
|
|
34428
34664
|
ctx.throw(400, "缺少参数 sn");
|
|
34429
34665
|
}
|
|
34430
|
-
const res = await
|
|
34431
|
-
ctx.forward(
|
|
34666
|
+
const res = await cnb2.workspace.getDetail(repo2, sn);
|
|
34667
|
+
ctx.forward(res);
|
|
34432
34668
|
}).addTo(app);
|
|
34433
34669
|
app.route({
|
|
34434
34670
|
path: "cnb",
|
|
34435
34671
|
key: "delete-workspace",
|
|
34436
34672
|
description: "删除工作空间,通过 pipelineId 或 sn",
|
|
34437
|
-
middleware: ["auth
|
|
34673
|
+
middleware: ["auth"],
|
|
34438
34674
|
metadata: {
|
|
34439
34675
|
tags: ["opencode"],
|
|
34440
34676
|
...createSkill({
|
|
@@ -34449,6 +34685,7 @@ app.route({
|
|
|
34449
34685
|
})
|
|
34450
34686
|
}
|
|
34451
34687
|
}).define(async (ctx) => {
|
|
34688
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34452
34689
|
const pipelineId = ctx.query?.pipelineId;
|
|
34453
34690
|
const sn = ctx.query?.sn;
|
|
34454
34691
|
const sns = ctx.query?.sns;
|
|
@@ -34458,20 +34695,20 @@ app.route({
|
|
|
34458
34695
|
if (sns && sns.length > 0) {
|
|
34459
34696
|
const results = [];
|
|
34460
34697
|
for (const snItem of sns) {
|
|
34461
|
-
const res2 = await
|
|
34698
|
+
const res2 = await cnb2.workspace.deleteWorkspace({ sn: snItem });
|
|
34462
34699
|
results.push(res2);
|
|
34463
34700
|
}
|
|
34464
34701
|
ctx.forward({ code: 200, message: "success", data: results });
|
|
34465
34702
|
return;
|
|
34466
34703
|
}
|
|
34467
|
-
const res = await
|
|
34704
|
+
const res = await cnb2.workspace.deleteWorkspace({ pipelineId, sn });
|
|
34468
34705
|
ctx.forward(res);
|
|
34469
34706
|
}).addTo(app);
|
|
34470
34707
|
app.route({
|
|
34471
34708
|
path: "cnb",
|
|
34472
34709
|
key: "stop-workspace",
|
|
34473
34710
|
description: "停止工作空间,通过 pipelineId 或 sn",
|
|
34474
|
-
middleware: ["auth
|
|
34711
|
+
middleware: ["auth"],
|
|
34475
34712
|
metadata: {
|
|
34476
34713
|
tags: ["opencode"],
|
|
34477
34714
|
...createSkill({
|
|
@@ -34485,13 +34722,14 @@ app.route({
|
|
|
34485
34722
|
})
|
|
34486
34723
|
}
|
|
34487
34724
|
}).define(async (ctx) => {
|
|
34725
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34488
34726
|
const pipelineId = ctx.query?.pipelineId;
|
|
34489
34727
|
const sn = ctx.query?.sn;
|
|
34490
34728
|
if (!pipelineId && !sn) {
|
|
34491
34729
|
ctx.throw(400, "pipelineId 和 sn 必须提供其中一个");
|
|
34492
34730
|
}
|
|
34493
|
-
const res = await
|
|
34494
|
-
ctx.forward(
|
|
34731
|
+
const res = await cnb2.workspace.stopWorkspace({ pipelineId, sn });
|
|
34732
|
+
ctx.forward(res);
|
|
34495
34733
|
}).addTo(app);
|
|
34496
34734
|
|
|
34497
34735
|
// agent/routes/call/index.ts
|
|
@@ -34548,7 +34786,7 @@ app.route({
|
|
|
34548
34786
|
path: "cnb",
|
|
34549
34787
|
key: "get-cnb-port-uri",
|
|
34550
34788
|
description: "获取当前cnb工作空间的port代理uri",
|
|
34551
|
-
middleware: ["auth
|
|
34789
|
+
middleware: ["auth"],
|
|
34552
34790
|
metadata: {
|
|
34553
34791
|
tags: ["opencode"],
|
|
34554
34792
|
...createSkill({
|
|
@@ -34561,6 +34799,8 @@ app.route({
|
|
|
34561
34799
|
})
|
|
34562
34800
|
}
|
|
34563
34801
|
}).define(async (ctx) => {
|
|
34802
|
+
if (notCNBCheck(ctx))
|
|
34803
|
+
return;
|
|
34564
34804
|
const port = ctx.query?.port || 51515;
|
|
34565
34805
|
const uri = CNB_ENV?.CNB_VSCODE_PROXY_URI || "";
|
|
34566
34806
|
const finalUri = uri.replace("{{port}}", port.toString());
|
|
@@ -34573,7 +34813,7 @@ app.route({
|
|
|
34573
34813
|
path: "cnb",
|
|
34574
34814
|
key: "get-cnb-vscode-uri",
|
|
34575
34815
|
description: "获取当前cnb工作空间的vscode代理uri, 包括多种访问方式, 如web、vscode、codebuddy、cursor、ssh",
|
|
34576
|
-
middleware: ["auth
|
|
34816
|
+
middleware: ["auth"],
|
|
34577
34817
|
metadata: {
|
|
34578
34818
|
tags: ["opencode"],
|
|
34579
34819
|
...createSkill({
|
|
@@ -34590,6 +34830,8 @@ app.route({
|
|
|
34590
34830
|
})
|
|
34591
34831
|
}
|
|
34592
34832
|
}).define(async (ctx) => {
|
|
34833
|
+
if (notCNBCheck(ctx))
|
|
34834
|
+
return;
|
|
34593
34835
|
const web = ctx.query?.web ?? false;
|
|
34594
34836
|
const vscode = ctx.query?.vscode ?? true;
|
|
34595
34837
|
const codebuddy = ctx.query?.codebuddy ?? false;
|
|
@@ -34634,7 +34876,7 @@ app.route({
|
|
|
34634
34876
|
path: "cnb",
|
|
34635
34877
|
key: "set-cnb-cookie",
|
|
34636
34878
|
description: "设置当前cnb工作空间的cookie环境变量",
|
|
34637
|
-
middleware: ["auth
|
|
34879
|
+
middleware: ["auth"],
|
|
34638
34880
|
metadata: {
|
|
34639
34881
|
tags: ["opencode"],
|
|
34640
34882
|
...createSkill({
|
|
@@ -34647,19 +34889,20 @@ app.route({
|
|
|
34647
34889
|
})
|
|
34648
34890
|
}
|
|
34649
34891
|
}).define(async (ctx) => {
|
|
34650
|
-
const
|
|
34651
|
-
|
|
34892
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34893
|
+
const cookie2 = ctx.query?.cookie;
|
|
34894
|
+
if (!cookie2) {
|
|
34652
34895
|
ctx.body = { content: "请提供有效的cookie值" };
|
|
34653
34896
|
return;
|
|
34654
34897
|
}
|
|
34655
|
-
|
|
34898
|
+
cnb2.cookie = cookie2;
|
|
34656
34899
|
ctx.body = { content: "已成功设置cnb的cookie环境变量" };
|
|
34657
34900
|
}).addTo(app);
|
|
34658
34901
|
app.route({
|
|
34659
34902
|
path: "cnb",
|
|
34660
34903
|
key: "get-cnb-cookie",
|
|
34661
34904
|
description: "获取当前cnb工作空间的cookie环境变量",
|
|
34662
|
-
middleware: ["auth
|
|
34905
|
+
middleware: ["auth"],
|
|
34663
34906
|
metadata: {
|
|
34664
34907
|
tags: ["opencode"],
|
|
34665
34908
|
...createSkill({
|
|
@@ -34669,8 +34912,9 @@ app.route({
|
|
|
34669
34912
|
})
|
|
34670
34913
|
}
|
|
34671
34914
|
}).define(async (ctx) => {
|
|
34672
|
-
const
|
|
34673
|
-
|
|
34915
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
34916
|
+
const cookie2 = cnb2.cookie || "未设置cookie环境变量";
|
|
34917
|
+
ctx.body = { content: `当前cnb工作空间的cookie环境变量为:${cookie2}` };
|
|
34674
34918
|
}).addTo(app);
|
|
34675
34919
|
|
|
34676
34920
|
// node_modules/.pnpm/@kevisual+ai@0.0.26/node_modules/@kevisual/ai/dist/ai-provider-browser.js
|
|
@@ -54528,7 +54772,7 @@ app.route({
|
|
|
54528
54772
|
path: "cnb",
|
|
54529
54773
|
key: "cnb-ai-chat",
|
|
54530
54774
|
description: "调用cnb的知识库ai对话功能进行聊天",
|
|
54531
|
-
middleware: ["auth
|
|
54775
|
+
middleware: ["auth"],
|
|
54532
54776
|
metadata: {
|
|
54533
54777
|
tags: ["opencode"],
|
|
54534
54778
|
...createSkill({
|
|
@@ -54542,6 +54786,7 @@ app.route({
|
|
|
54542
54786
|
})
|
|
54543
54787
|
}
|
|
54544
54788
|
}).define(async (ctx) => {
|
|
54789
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
54545
54790
|
const question = ctx.query?.question;
|
|
54546
54791
|
if (!question) {
|
|
54547
54792
|
ctx.body = { content: "请提供有效的消息内容" };
|
|
@@ -54549,13 +54794,13 @@ app.route({
|
|
|
54549
54794
|
}
|
|
54550
54795
|
let repo2 = ctx.query?.repo;
|
|
54551
54796
|
if (!repo2) {
|
|
54552
|
-
const res = await
|
|
54797
|
+
const res = await cnb2.repo.getRepoList({ flags: "KnowledgeBase" });
|
|
54553
54798
|
if (res.code === 200 && res.data.length > 0) {
|
|
54554
54799
|
repo2 = res.data[0].path;
|
|
54555
54800
|
}
|
|
54556
54801
|
}
|
|
54557
54802
|
console.log("Using knowledge base repo:", repo2);
|
|
54558
|
-
const ragRes = await
|
|
54803
|
+
const ragRes = await cnb2.knowledgeBase.queryKnowledgeBase(repo2 || "", {
|
|
54559
54804
|
query: question,
|
|
54560
54805
|
score_threshold: 0.62,
|
|
54561
54806
|
top_k: 10
|
|
@@ -54580,7 +54825,7 @@ ${item.chunk}
|
|
|
54580
54825
|
`);
|
|
54581
54826
|
const chat = new CNBChat({
|
|
54582
54827
|
repo: repo2,
|
|
54583
|
-
token:
|
|
54828
|
+
token: cnb2.token,
|
|
54584
54829
|
model: "hunyuan-a13b"
|
|
54585
54830
|
});
|
|
54586
54831
|
const messages = [
|
|
@@ -54630,7 +54875,7 @@ app.route({
|
|
|
54630
54875
|
path: "cnb",
|
|
54631
54876
|
key: "cnb-rag-query",
|
|
54632
54877
|
description: "调用cnb的知识库RAG查询功能进行问答",
|
|
54633
|
-
middleware: ["auth
|
|
54878
|
+
middleware: ["auth"],
|
|
54634
54879
|
metadata: {
|
|
54635
54880
|
tags: ["opencode"],
|
|
54636
54881
|
...createSkill({
|
|
@@ -54644,6 +54889,7 @@ app.route({
|
|
|
54644
54889
|
})
|
|
54645
54890
|
}
|
|
54646
54891
|
}).define(async (ctx) => {
|
|
54892
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
54647
54893
|
const question = ctx.query?.question;
|
|
54648
54894
|
if (!question) {
|
|
54649
54895
|
ctx.body = { content: "请提供有效的消息内容" };
|
|
@@ -54651,13 +54897,13 @@ app.route({
|
|
|
54651
54897
|
}
|
|
54652
54898
|
let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
|
|
54653
54899
|
if (!repo2) {
|
|
54654
|
-
const res = await
|
|
54900
|
+
const res = await cnb2.repo.getRepoList({ flags: "KnowledgeBase" });
|
|
54655
54901
|
if (res.code === 200 && res.data.length > 0) {
|
|
54656
54902
|
repo2 = res.data[0].path;
|
|
54657
54903
|
}
|
|
54658
54904
|
}
|
|
54659
54905
|
console.log("Using knowledge base repo:", repo2);
|
|
54660
|
-
const ragRes = await
|
|
54906
|
+
const ragRes = await cnb2.knowledgeBase.queryKnowledgeBase(repo2 || "", {
|
|
54661
54907
|
query: question,
|
|
54662
54908
|
score_threshold: 0.62,
|
|
54663
54909
|
top_k: 10
|
|
@@ -54693,7 +54939,7 @@ app.route({
|
|
|
54693
54939
|
path: "cnb",
|
|
54694
54940
|
key: "list-issues",
|
|
54695
54941
|
description: "查询 Issue 列表, 参数 repo, state, keyword, labels, page, page_size 等",
|
|
54696
|
-
middleware: ["auth
|
|
54942
|
+
middleware: ["auth"],
|
|
54697
54943
|
metadata: {
|
|
54698
54944
|
tags: ["opencode"],
|
|
54699
54945
|
...createSkill({
|
|
@@ -54712,6 +54958,7 @@ app.route({
|
|
|
54712
54958
|
})
|
|
54713
54959
|
}
|
|
54714
54960
|
}).define(async (ctx) => {
|
|
54961
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
54715
54962
|
const repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
|
|
54716
54963
|
const state = ctx.query?.state;
|
|
54717
54964
|
const keyword = ctx.query?.keyword;
|
|
@@ -54735,7 +54982,7 @@ app.route({
|
|
|
54735
54982
|
params.page_size = page_size;
|
|
54736
54983
|
if (order_by)
|
|
54737
54984
|
params.order_by = order_by;
|
|
54738
|
-
const res = await
|
|
54985
|
+
const res = await cnb2.issue.getList(repo2, params);
|
|
54739
54986
|
ctx.forward(res);
|
|
54740
54987
|
}).addTo(app);
|
|
54741
54988
|
|
|
@@ -54744,7 +54991,7 @@ app.route({
|
|
|
54744
54991
|
path: "cnb",
|
|
54745
54992
|
key: "create-issue",
|
|
54746
54993
|
description: "创建 Issue, 参数 repo, title, body, assignees, labels, priority",
|
|
54747
|
-
middleware: ["auth
|
|
54994
|
+
middleware: ["auth"],
|
|
54748
54995
|
metadata: {
|
|
54749
54996
|
tags: ["opencode"],
|
|
54750
54997
|
...createSkill({
|
|
@@ -54762,6 +55009,7 @@ app.route({
|
|
|
54762
55009
|
})
|
|
54763
55010
|
}
|
|
54764
55011
|
}).define(async (ctx) => {
|
|
55012
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
54765
55013
|
const repo2 = ctx.query?.repo;
|
|
54766
55014
|
const title = ctx.query?.title;
|
|
54767
55015
|
const body = ctx.query?.body;
|
|
@@ -54771,7 +55019,7 @@ app.route({
|
|
|
54771
55019
|
if (!repo2 || !title) {
|
|
54772
55020
|
ctx.throw(400, "缺少参数 repo 或 title");
|
|
54773
55021
|
}
|
|
54774
|
-
const res = await
|
|
55022
|
+
const res = await cnb2.issue.createIssue(repo2, {
|
|
54775
55023
|
title,
|
|
54776
55024
|
body,
|
|
54777
55025
|
assignees,
|
|
@@ -54784,7 +55032,7 @@ app.route({
|
|
|
54784
55032
|
path: "cnb",
|
|
54785
55033
|
key: "complete-issue",
|
|
54786
55034
|
description: "完成 Issue, 参数 repo, issueNumber",
|
|
54787
|
-
middleware: ["auth
|
|
55035
|
+
middleware: ["auth"],
|
|
54788
55036
|
metadata: {
|
|
54789
55037
|
tags: ["opencode"],
|
|
54790
55038
|
...createSkill({
|
|
@@ -54799,6 +55047,7 @@ app.route({
|
|
|
54799
55047
|
})
|
|
54800
55048
|
}
|
|
54801
55049
|
}).define(async (ctx) => {
|
|
55050
|
+
const cnb2 = await cnbManager.getContext(ctx);
|
|
54802
55051
|
const repo2 = ctx.query?.repo;
|
|
54803
55052
|
const issueNumber = ctx.query?.issueNumber;
|
|
54804
55053
|
const state = ctx.query?.state ?? "closed";
|
|
@@ -54809,7 +55058,7 @@ app.route({
|
|
|
54809
55058
|
if (iss.state === "closed") {
|
|
54810
55059
|
iss.state_reason = "completed";
|
|
54811
55060
|
}
|
|
54812
|
-
const res = await
|
|
55061
|
+
const res = await cnb2.issue.updateIssue(repo2, issueNumber, iss);
|
|
54813
55062
|
ctx.forward(res);
|
|
54814
55063
|
}).addTo(app);
|
|
54815
55064
|
|
|
@@ -54820,15 +55069,15 @@ import { execSync as execSync2 } from "node:child_process";
|
|
|
54820
55069
|
var getLiveMdContent = (opts) => {
|
|
54821
55070
|
const more = opts?.more ?? false;
|
|
54822
55071
|
const url4 = useKey("CNB_VSCODE_PROXY_URI") || "";
|
|
54823
|
-
const
|
|
55072
|
+
const token2 = useKey("CNB_TOKEN") || "";
|
|
54824
55073
|
const openclawPort = useKey("OPENCLAW_PORT") || "80";
|
|
54825
55074
|
const openclawUrl = url4.replace("{{port}}", openclawPort);
|
|
54826
|
-
const openclawUrlSecret = openclawUrl + "/openclaw?token=" +
|
|
55075
|
+
const openclawUrlSecret = openclawUrl + "/openclaw?token=" + token2;
|
|
54827
55076
|
const opencodePort = useKey("OPENCODE_PORT") || "100";
|
|
54828
55077
|
const opencodeUrl = url4.replace("{{port}}", opencodePort);
|
|
54829
55078
|
const _opencodeURL = new URL(opencodeUrl);
|
|
54830
55079
|
_opencodeURL.username = "root";
|
|
54831
|
-
_opencodeURL.password =
|
|
55080
|
+
_opencodeURL.password = token2;
|
|
54832
55081
|
const opencodeUrlSecret = _opencodeURL.toString();
|
|
54833
55082
|
const kevisualUrl = url4.replace("{{port}}", "51515");
|
|
54834
55083
|
const openWebUrl = url4.replace("{{port}}", "200");
|
|
@@ -54848,7 +55097,7 @@ var getLiveMdContent = (opts) => {
|
|
|
54848
55097
|
- OpenCode: ${opencodeUrlSecret}
|
|
54849
55098
|
|
|
54850
55099
|
### 环境变量
|
|
54851
|
-
- CNB_TOKEN: ${
|
|
55100
|
+
- CNB_TOKEN: ${token2}
|
|
54852
55101
|
|
|
54853
55102
|
### 其他说明
|
|
54854
55103
|
|
|
@@ -54886,7 +55135,7 @@ Opencode打开web地址,需要在浏览器输入用户名和密码,用户名
|
|
|
54886
55135
|
{
|
|
54887
55136
|
key: "cnbTempToken",
|
|
54888
55137
|
title: "CNB Token",
|
|
54889
|
-
value:
|
|
55138
|
+
value: token2,
|
|
54890
55139
|
description: "CNB 临时 Token,保持和环境变量 CNB_TOKEN 一致"
|
|
54891
55140
|
},
|
|
54892
55141
|
{
|
|
@@ -55109,22 +55358,11 @@ var createOSInfo = (more = false) => {
|
|
|
55109
55358
|
};
|
|
55110
55359
|
|
|
55111
55360
|
// agent/routes/cnb-board/cnb-dev-env.ts
|
|
55112
|
-
var notCNBCheck = (ctx) => {
|
|
55113
|
-
const isCNB = useKey("CNB");
|
|
55114
|
-
if (!isCNB) {
|
|
55115
|
-
ctx.body = {
|
|
55116
|
-
title: "非 cnb-board 环境",
|
|
55117
|
-
list: []
|
|
55118
|
-
};
|
|
55119
|
-
return true;
|
|
55120
|
-
}
|
|
55121
|
-
return false;
|
|
55122
|
-
};
|
|
55123
55361
|
app.route({
|
|
55124
55362
|
path: "cnb_board",
|
|
55125
55363
|
key: "live",
|
|
55126
55364
|
description: "获取cnb-board live的mdContent内容",
|
|
55127
|
-
middleware: ["auth
|
|
55365
|
+
middleware: ["auth"],
|
|
55128
55366
|
metadata: {
|
|
55129
55367
|
args: {
|
|
55130
55368
|
more: zod_default.boolean().optional().describe("是否获取更多系统信息,默认false")
|
|
@@ -55144,7 +55382,7 @@ app.route({
|
|
|
55144
55382
|
path: "cnb_board",
|
|
55145
55383
|
key: "live_repo_info",
|
|
55146
55384
|
description: "获取cnb-board live的repo信息",
|
|
55147
|
-
middleware: ["auth
|
|
55385
|
+
middleware: ["auth"]
|
|
55148
55386
|
}).define(async (ctx) => {
|
|
55149
55387
|
const repoSlug = useKey("CNB_REPO_SLUG") || "";
|
|
55150
55388
|
const repoName = useKey("CNB_REPO_NAME") || "";
|
|
@@ -55194,7 +55432,7 @@ app.route({
|
|
|
55194
55432
|
path: "cnb_board",
|
|
55195
55433
|
key: "live_build_info",
|
|
55196
55434
|
description: "获取cnb-board live的构建信息",
|
|
55197
|
-
middleware: ["auth
|
|
55435
|
+
middleware: ["auth"]
|
|
55198
55436
|
}).define(async (ctx) => {
|
|
55199
55437
|
if (notCNBCheck(ctx))
|
|
55200
55438
|
return;
|
|
@@ -55550,8 +55788,10 @@ app.route({
|
|
|
55550
55788
|
path: "cnb_board",
|
|
55551
55789
|
key: "exit",
|
|
55552
55790
|
description: "cnb的工作环境退出程序",
|
|
55553
|
-
middleware: ["auth
|
|
55791
|
+
middleware: ["auth"]
|
|
55554
55792
|
}).define(async (ctx) => {
|
|
55793
|
+
if (notCNBCheck(ctx))
|
|
55794
|
+
return;
|
|
55555
55795
|
const cmd = "kill 1";
|
|
55556
55796
|
execCommand(cmd);
|
|
55557
55797
|
}).addTo(app);
|
|
@@ -55601,6 +55841,50 @@ app.route({
|
|
|
55601
55841
|
};
|
|
55602
55842
|
}).addTo(app);
|
|
55603
55843
|
|
|
55844
|
+
// agent/routes/cnb-manager/index.ts
|
|
55845
|
+
app.route({
|
|
55846
|
+
path: "cnb",
|
|
55847
|
+
key: "clear-me-manager",
|
|
55848
|
+
description: "清理我的cnb-manager记录",
|
|
55849
|
+
middleware: ["auth"]
|
|
55850
|
+
}).define(async (ctx) => {
|
|
55851
|
+
const tokenUser = ctx.tokenUser;
|
|
55852
|
+
if (!tokenUser) {
|
|
55853
|
+
ctx.throw(401, "未授权");
|
|
55854
|
+
}
|
|
55855
|
+
const username = tokenUser.username;
|
|
55856
|
+
if (!username) {
|
|
55857
|
+
ctx.throw(400, "无效的用户信息");
|
|
55858
|
+
}
|
|
55859
|
+
if (username !== "default") {
|
|
55860
|
+
cnbManager.clearUsername(username);
|
|
55861
|
+
}
|
|
55862
|
+
ctx.body = { content: "已清理cnb-manager记录" };
|
|
55863
|
+
}).addTo(app);
|
|
55864
|
+
app.route({
|
|
55865
|
+
path: "cnb",
|
|
55866
|
+
key: "get-my-config",
|
|
55867
|
+
description: "获取我的cnb配置",
|
|
55868
|
+
middleware: ["auth"]
|
|
55869
|
+
}).define(async (ctx) => {
|
|
55870
|
+
const username = ctx.tokenUser?.username;
|
|
55871
|
+
const token2 = ctx.query?.token;
|
|
55872
|
+
if (!username) {
|
|
55873
|
+
ctx.throw(400, "未授权");
|
|
55874
|
+
}
|
|
55875
|
+
if (!token2) {
|
|
55876
|
+
ctx.throw(400, "缺少token参数");
|
|
55877
|
+
}
|
|
55878
|
+
const cnbItem = await cnbManager.getCNB({ username, kevisualToken: token2 });
|
|
55879
|
+
if (!cnbItem) {
|
|
55880
|
+
ctx.throw(404, "未找到cnb-manager记录");
|
|
55881
|
+
}
|
|
55882
|
+
ctx.body = {
|
|
55883
|
+
token: cnbItem.token,
|
|
55884
|
+
cookie: cnbItem.cookie
|
|
55885
|
+
};
|
|
55886
|
+
}).addTo(app);
|
|
55887
|
+
|
|
55604
55888
|
// agent/routes/index.ts
|
|
55605
55889
|
var checkAppId = (ctx, appId) => {
|
|
55606
55890
|
const _appId = ctx?.app?.appId;
|
|
@@ -55617,6 +55901,9 @@ app.route({
|
|
|
55617
55901
|
path: "auth"
|
|
55618
55902
|
}).define(async (ctx) => {
|
|
55619
55903
|
if (checkAppId(ctx, app.appId)) {
|
|
55904
|
+
ctx.state.tokenUser = {
|
|
55905
|
+
username: "default"
|
|
55906
|
+
};
|
|
55620
55907
|
return;
|
|
55621
55908
|
}
|
|
55622
55909
|
}).addTo(app, { overwrite: false });
|
|
@@ -55626,11 +55913,15 @@ app.route({
|
|
|
55626
55913
|
middleware: ["auth"]
|
|
55627
55914
|
}).define(async (ctx) => {
|
|
55628
55915
|
if (checkAppId(ctx, app.appId)) {
|
|
55916
|
+
ctx.state.tokenUser = {
|
|
55917
|
+
username: "default"
|
|
55918
|
+
};
|
|
55629
55919
|
return;
|
|
55630
55920
|
}
|
|
55631
55921
|
}).addTo(app, { overwrite: false });
|
|
55632
55922
|
export {
|
|
55633
|
-
|
|
55923
|
+
notCNBCheck,
|
|
55924
|
+
cnbManager,
|
|
55634
55925
|
cnb,
|
|
55635
55926
|
app
|
|
55636
55927
|
};
|