@kevisual/cnb 0.0.33 → 0.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/routes.js CHANGED
@@ -1,4 +1,20 @@
1
+ var __create = Object.create;
2
+ var __getProtoOf = Object.getPrototypeOf;
1
3
  var __defProp = Object.defineProperty;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __toESM = (mod, isNodeMode, target) => {
7
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
8
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
9
+ for (let key of __getOwnPropNames(mod))
10
+ if (!__hasOwnProp.call(to, key))
11
+ __defProp(to, key, {
12
+ get: () => mod[key],
13
+ enumerable: true
14
+ });
15
+ return to;
16
+ };
17
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
2
18
  var __export = (target, all) => {
3
19
  for (var name in all)
4
20
  __defProp(target, name, {
@@ -9,27 +25,318 @@ var __export = (target, all) => {
9
25
  });
10
26
  };
11
27
 
12
- // node_modules/.pnpm/@kevisual+router@0.0.84/node_modules/@kevisual/router/dist/router.js
28
+ // node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/dayjs.min.js
29
+ var require_dayjs_min = __commonJS((exports, module) => {
30
+ (function(t, e) {
31
+ typeof exports == "object" && typeof module != "undefined" ? module.exports = e() : typeof define == "function" && define.amd ? define(e) : (t = typeof globalThis != "undefined" ? globalThis : t || self).dayjs = e();
32
+ })(exports, function() {
33
+ var t = 1000, e = 60000, n = 3600000, r = "millisecond", i2 = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
34
+ var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
35
+ return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
36
+ } }, m = function(t2, e2, n2) {
37
+ var r2 = String(t2);
38
+ return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
39
+ }, v = { s: m, z: function(t2) {
40
+ var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i3 = n2 % 60;
41
+ return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i3, 2, "0");
42
+ }, m: function t2(e2, n2) {
43
+ if (e2.date() < n2.date())
44
+ return -t2(n2, e2);
45
+ var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i3 = e2.clone().add(r2, c), s2 = n2 - i3 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
46
+ return +(-(r2 + (n2 - i3) / (s2 ? i3 - u2 : u2 - i3)) || 0);
47
+ }, a: function(t2) {
48
+ return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
49
+ }, p: function(t2) {
50
+ return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i2, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
51
+ }, u: function(t2) {
52
+ return t2 === undefined;
53
+ } }, g = "en", D = {};
54
+ D[g] = M;
55
+ var p = "$isDayjsObject", S = function(t2) {
56
+ return t2 instanceof _ || !(!t2 || !t2[p]);
57
+ }, w = function t2(e2, n2, r2) {
58
+ var i3;
59
+ if (!e2)
60
+ return g;
61
+ if (typeof e2 == "string") {
62
+ var s2 = e2.toLowerCase();
63
+ D[s2] && (i3 = s2), n2 && (D[s2] = n2, i3 = s2);
64
+ var u2 = e2.split("-");
65
+ if (!i3 && u2.length > 1)
66
+ return t2(u2[0]);
67
+ } else {
68
+ var a2 = e2.name;
69
+ D[a2] = e2, i3 = a2;
70
+ }
71
+ return !r2 && i3 && (g = i3), i3 || !r2 && g;
72
+ }, O = function(t2, e2) {
73
+ if (S(t2))
74
+ return t2.clone();
75
+ var n2 = typeof e2 == "object" ? e2 : {};
76
+ return n2.date = t2, n2.args = arguments, new _(n2);
77
+ }, b = v;
78
+ b.l = w, b.i = S, b.w = function(t2, e2) {
79
+ return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
80
+ };
81
+ var _ = function() {
82
+ function M2(t2) {
83
+ this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
84
+ }
85
+ var m2 = M2.prototype;
86
+ return m2.parse = function(t2) {
87
+ this.$d = function(t3) {
88
+ var { date: e2, utc: n2 } = t3;
89
+ if (e2 === null)
90
+ return new Date(NaN);
91
+ if (b.u(e2))
92
+ return new Date;
93
+ if (e2 instanceof Date)
94
+ return new Date(e2);
95
+ if (typeof e2 == "string" && !/Z$/i.test(e2)) {
96
+ var r2 = e2.match($);
97
+ if (r2) {
98
+ var i3 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
99
+ return n2 ? new Date(Date.UTC(r2[1], i3, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i3, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
100
+ }
101
+ }
102
+ return new Date(e2);
103
+ }(t2), this.init();
104
+ }, m2.init = function() {
105
+ var t2 = this.$d;
106
+ this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
107
+ }, m2.$utils = function() {
108
+ return b;
109
+ }, m2.isValid = function() {
110
+ return !(this.$d.toString() === l);
111
+ }, m2.isSame = function(t2, e2) {
112
+ var n2 = O(t2);
113
+ return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
114
+ }, m2.isAfter = function(t2, e2) {
115
+ return O(t2) < this.startOf(e2);
116
+ }, m2.isBefore = function(t2, e2) {
117
+ return this.endOf(e2) < O(t2);
118
+ }, m2.$g = function(t2, e2, n2) {
119
+ return b.u(t2) ? this[e2] : this.set(n2, t2);
120
+ }, m2.unix = function() {
121
+ return Math.floor(this.valueOf() / 1000);
122
+ }, m2.valueOf = function() {
123
+ return this.$d.getTime();
124
+ }, m2.startOf = function(t2, e2) {
125
+ var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
126
+ var i3 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
127
+ return r2 ? i3 : i3.endOf(a);
128
+ }, $2 = function(t3, e3) {
129
+ return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
130
+ }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
131
+ switch (f2) {
132
+ case h:
133
+ return r2 ? l2(1, 0) : l2(31, 11);
134
+ case c:
135
+ return r2 ? l2(1, M3) : l2(0, M3 + 1);
136
+ case o:
137
+ var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
138
+ return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
139
+ case a:
140
+ case d:
141
+ return $2(v2 + "Hours", 0);
142
+ case u:
143
+ return $2(v2 + "Minutes", 1);
144
+ case s:
145
+ return $2(v2 + "Seconds", 2);
146
+ case i2:
147
+ return $2(v2 + "Milliseconds", 3);
148
+ default:
149
+ return this.clone();
150
+ }
151
+ }, m2.endOf = function(t2) {
152
+ return this.startOf(t2, false);
153
+ }, m2.$set = function(t2, e2) {
154
+ var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i2] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
155
+ if (o2 === c || o2 === h) {
156
+ var y2 = this.clone().set(d, 1);
157
+ y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
158
+ } else
159
+ l2 && this.$d[l2]($2);
160
+ return this.init(), this;
161
+ }, m2.set = function(t2, e2) {
162
+ return this.clone().$set(t2, e2);
163
+ }, m2.get = function(t2) {
164
+ return this[b.p(t2)]();
165
+ }, m2.add = function(r2, f2) {
166
+ var d2, l2 = this;
167
+ r2 = Number(r2);
168
+ var $2 = b.p(f2), y2 = function(t2) {
169
+ var e2 = O(l2);
170
+ return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
171
+ };
172
+ if ($2 === c)
173
+ return this.set(c, this.$M + r2);
174
+ if ($2 === h)
175
+ return this.set(h, this.$y + r2);
176
+ if ($2 === a)
177
+ return y2(1);
178
+ if ($2 === o)
179
+ return y2(7);
180
+ var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i2] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
181
+ return b.w(m3, this);
182
+ }, m2.subtract = function(t2, e2) {
183
+ return this.add(-1 * t2, e2);
184
+ }, m2.format = function(t2) {
185
+ var e2 = this, n2 = this.$locale();
186
+ if (!this.isValid())
187
+ return n2.invalidDate || l;
188
+ var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i3 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i4, s3) {
189
+ return t3 && (t3[n3] || t3(e2, r2)) || i4[n3].slice(0, s3);
190
+ }, d2 = function(t3) {
191
+ return b.s(s2 % 12 || 12, t3, "0");
192
+ }, $2 = f2 || function(t3, e3, n3) {
193
+ var r3 = t3 < 12 ? "AM" : "PM";
194
+ return n3 ? r3.toLowerCase() : r3;
195
+ };
196
+ return r2.replace(y, function(t3, r3) {
197
+ return r3 || function(t4) {
198
+ switch (t4) {
199
+ case "YY":
200
+ return String(e2.$y).slice(-2);
201
+ case "YYYY":
202
+ return b.s(e2.$y, 4, "0");
203
+ case "M":
204
+ return a2 + 1;
205
+ case "MM":
206
+ return b.s(a2 + 1, 2, "0");
207
+ case "MMM":
208
+ return h2(n2.monthsShort, a2, c2, 3);
209
+ case "MMMM":
210
+ return h2(c2, a2);
211
+ case "D":
212
+ return e2.$D;
213
+ case "DD":
214
+ return b.s(e2.$D, 2, "0");
215
+ case "d":
216
+ return String(e2.$W);
217
+ case "dd":
218
+ return h2(n2.weekdaysMin, e2.$W, o2, 2);
219
+ case "ddd":
220
+ return h2(n2.weekdaysShort, e2.$W, o2, 3);
221
+ case "dddd":
222
+ return o2[e2.$W];
223
+ case "H":
224
+ return String(s2);
225
+ case "HH":
226
+ return b.s(s2, 2, "0");
227
+ case "h":
228
+ return d2(1);
229
+ case "hh":
230
+ return d2(2);
231
+ case "a":
232
+ return $2(s2, u2, true);
233
+ case "A":
234
+ return $2(s2, u2, false);
235
+ case "m":
236
+ return String(u2);
237
+ case "mm":
238
+ return b.s(u2, 2, "0");
239
+ case "s":
240
+ return String(e2.$s);
241
+ case "ss":
242
+ return b.s(e2.$s, 2, "0");
243
+ case "SSS":
244
+ return b.s(e2.$ms, 3, "0");
245
+ case "Z":
246
+ return i3;
247
+ }
248
+ return null;
249
+ }(t3) || i3.replace(":", "");
250
+ });
251
+ }, m2.utcOffset = function() {
252
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
253
+ }, m2.diff = function(r2, d2, l2) {
254
+ var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
255
+ return b.m(y2, m3);
256
+ };
257
+ switch (M3) {
258
+ case h:
259
+ $2 = D2() / 12;
260
+ break;
261
+ case c:
262
+ $2 = D2();
263
+ break;
264
+ case f:
265
+ $2 = D2() / 3;
266
+ break;
267
+ case o:
268
+ $2 = (g2 - v2) / 604800000;
269
+ break;
270
+ case a:
271
+ $2 = (g2 - v2) / 86400000;
272
+ break;
273
+ case u:
274
+ $2 = g2 / n;
275
+ break;
276
+ case s:
277
+ $2 = g2 / e;
278
+ break;
279
+ case i2:
280
+ $2 = g2 / t;
281
+ break;
282
+ default:
283
+ $2 = g2;
284
+ }
285
+ return l2 ? $2 : b.a($2);
286
+ }, m2.daysInMonth = function() {
287
+ return this.endOf(c).$D;
288
+ }, m2.$locale = function() {
289
+ return D[this.$L];
290
+ }, m2.locale = function(t2, e2) {
291
+ if (!t2)
292
+ return this.$L;
293
+ var n2 = this.clone(), r2 = w(t2, e2, true);
294
+ return r2 && (n2.$L = r2), n2;
295
+ }, m2.clone = function() {
296
+ return b.w(this.$d, this);
297
+ }, m2.toDate = function() {
298
+ return new Date(this.valueOf());
299
+ }, m2.toJSON = function() {
300
+ return this.isValid() ? this.toISOString() : null;
301
+ }, m2.toISOString = function() {
302
+ return this.$d.toISOString();
303
+ }, m2.toString = function() {
304
+ return this.$d.toUTCString();
305
+ }, M2;
306
+ }(), k = _.prototype;
307
+ return O.prototype = k, [["$ms", r], ["$s", i2], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
308
+ k[t2[1]] = function(e2) {
309
+ return this.$g(e2, t2[0], t2[1]);
310
+ };
311
+ }), O.extend = function(t2, e2) {
312
+ return t2.$i || (t2(e2, _, O), t2.$i = true), O;
313
+ }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
314
+ return O(1000 * t2);
315
+ }, O.en = D[g], O.Ls = D, O.p = {}, O;
316
+ });
317
+ });
318
+
319
+ // node_modules/.pnpm/@kevisual+router@0.0.85/node_modules/@kevisual/router/dist/router.js
13
320
  import { createRequire } from "node:module";
14
321
  import { webcrypto as crypto2 } from "node:crypto";
15
322
  import url2 from "node:url";
16
- var __create = Object.create;
17
- var __getProtoOf = Object.getPrototypeOf;
323
+ var __create2 = Object.create;
324
+ var __getProtoOf2 = Object.getPrototypeOf;
18
325
  var __defProp2 = Object.defineProperty;
19
- var __getOwnPropNames = Object.getOwnPropertyNames;
20
- var __hasOwnProp = Object.prototype.hasOwnProperty;
21
- var __toESM = (mod, isNodeMode, target) => {
22
- target = mod != null ? __create(__getProtoOf(mod)) : {};
326
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
327
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
328
+ var __toESM2 = (mod, isNodeMode, target) => {
329
+ target = mod != null ? __create2(__getProtoOf2(mod)) : {};
23
330
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target;
24
- for (let key of __getOwnPropNames(mod))
25
- if (!__hasOwnProp.call(to, key))
331
+ for (let key of __getOwnPropNames2(mod))
332
+ if (!__hasOwnProp2.call(to, key))
26
333
  __defProp2(to, key, {
27
334
  get: () => mod[key],
28
335
  enumerable: true
29
336
  });
30
337
  return to;
31
338
  };
32
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
339
+ var __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
340
  var __export2 = (target, all) => {
34
341
  for (var name in all)
35
342
  __defProp2(target, name, {
@@ -40,7 +347,7 @@ var __export2 = (target, all) => {
40
347
  });
41
348
  };
42
349
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
43
- var require_eventemitter3 = __commonJS((exports, module) => {
350
+ var require_eventemitter3 = __commonJS2((exports, module) => {
44
351
  var has = Object.prototype.hasOwnProperty;
45
352
  var prefix = "~";
46
353
  function Events() {}
@@ -216,7 +523,7 @@ var require_eventemitter3 = __commonJS((exports, module) => {
216
523
  module.exports = EventEmitter;
217
524
  }
218
525
  });
219
- var require_constants = __commonJS((exports, module) => {
526
+ var require_constants = __commonJS2((exports, module) => {
220
527
  var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
221
528
  var hasBlob = typeof Blob !== "undefined";
222
529
  if (hasBlob)
@@ -233,7 +540,7 @@ var require_constants = __commonJS((exports, module) => {
233
540
  NOOP: () => {}
234
541
  };
235
542
  });
236
- var require_buffer_util = __commonJS((exports, module) => {
543
+ var require_buffer_util = __commonJS2((exports, module) => {
237
544
  var { EMPTY_BUFFER } = require_constants();
238
545
  var FastBuffer = Buffer[Symbol.species];
239
546
  function concat(list, totalLength) {
@@ -292,7 +599,7 @@ var require_buffer_util = __commonJS((exports, module) => {
292
599
  unmask: _unmask
293
600
  };
294
601
  });
295
- var require_limiter = __commonJS((exports, module) => {
602
+ var require_limiter = __commonJS2((exports, module) => {
296
603
  var kDone = Symbol("kDone");
297
604
  var kRun = Symbol("kRun");
298
605
 
@@ -322,7 +629,7 @@ var require_limiter = __commonJS((exports, module) => {
322
629
  }
323
630
  module.exports = Limiter;
324
631
  });
325
- var require_permessage_deflate = __commonJS((exports, module) => {
632
+ var require_permessage_deflate = __commonJS2((exports, module) => {
326
633
  var zlib = __require("zlib");
327
634
  var bufferUtil = require_buffer_util();
328
635
  var Limiter = require_limiter();
@@ -580,7 +887,7 @@ var require_permessage_deflate = __commonJS((exports, module) => {
580
887
  this[kCallback](err);
581
888
  }
582
889
  });
583
- var require_validation = __commonJS((exports, module) => {
890
+ var require_validation = __commonJS2((exports, module) => {
584
891
  var { isUtf8 } = __require("buffer");
585
892
  var { hasBlob } = require_constants();
586
893
  var tokenChars = [
@@ -758,7 +1065,7 @@ var require_validation = __commonJS((exports, module) => {
758
1065
  };
759
1066
  }
760
1067
  });
761
- var require_receiver = __commonJS((exports, module) => {
1068
+ var require_receiver = __commonJS2((exports, module) => {
762
1069
  var { Writable } = __require("stream");
763
1070
  var PerMessageDeflate = require_permessage_deflate();
764
1071
  var {
@@ -1137,7 +1444,7 @@ var require_receiver = __commonJS((exports, module) => {
1137
1444
  }
1138
1445
  module.exports = Receiver;
1139
1446
  });
1140
- var require_sender = __commonJS((exports, module) => {
1447
+ var require_sender = __commonJS2((exports, module) => {
1141
1448
  var { Duplex } = __require("stream");
1142
1449
  var { randomFillSync } = __require("crypto");
1143
1450
  var PerMessageDeflate = require_permessage_deflate();
@@ -1489,7 +1796,7 @@ var require_sender = __commonJS((exports, module) => {
1489
1796
  sender.onerror(err);
1490
1797
  }
1491
1798
  });
1492
- var require_event_target = __commonJS((exports, module) => {
1799
+ var require_event_target = __commonJS2((exports, module) => {
1493
1800
  var { kForOnEventAttribute, kListener } = require_constants();
1494
1801
  var kCode = Symbol("kCode");
1495
1802
  var kData = Symbol("kData");
@@ -1638,7 +1945,7 @@ var require_event_target = __commonJS((exports, module) => {
1638
1945
  }
1639
1946
  }
1640
1947
  });
1641
- var require_extension = __commonJS((exports, module) => {
1948
+ var require_extension = __commonJS2((exports, module) => {
1642
1949
  var { tokenChars } = require_validation();
1643
1950
  function push(dest, name, elem) {
1644
1951
  if (dest[name] === undefined)
@@ -1801,7 +2108,7 @@ var require_extension = __commonJS((exports, module) => {
1801
2108
  }
1802
2109
  module.exports = { format, parse: parse5 };
1803
2110
  });
1804
- var require_websocket = __commonJS((exports, module) => {
2111
+ var require_websocket = __commonJS2((exports, module) => {
1805
2112
  var EventEmitter2 = __require("events");
1806
2113
  var https = __require("https");
1807
2114
  var http = __require("http");
@@ -2558,7 +2865,7 @@ var require_websocket = __commonJS((exports, module) => {
2558
2865
  }
2559
2866
  }
2560
2867
  });
2561
- var require_stream = __commonJS((exports, module) => {
2868
+ var require_stream = __commonJS2((exports, module) => {
2562
2869
  var WebSocket = require_websocket();
2563
2870
  var { Duplex } = __require("stream");
2564
2871
  function emitClose(stream) {
@@ -2659,7 +2966,7 @@ var require_stream = __commonJS((exports, module) => {
2659
2966
  }
2660
2967
  module.exports = createWebSocketStream;
2661
2968
  });
2662
- var require_subprotocol = __commonJS((exports, module) => {
2969
+ var require_subprotocol = __commonJS2((exports, module) => {
2663
2970
  var { tokenChars } = require_validation();
2664
2971
  function parse5(header) {
2665
2972
  const protocols = new Set;
@@ -2702,7 +3009,7 @@ var require_subprotocol = __commonJS((exports, module) => {
2702
3009
  }
2703
3010
  module.exports = { parse: parse5 };
2704
3011
  });
2705
- var require_websocket_server = __commonJS((exports, module) => {
3012
+ var require_websocket_server = __commonJS2((exports, module) => {
2706
3013
  var EventEmitter2 = __require("events");
2707
3014
  var http = __require("http");
2708
3015
  var { Duplex } = __require("stream");
@@ -3070,7 +3377,7 @@ function pick(obj, keys) {
3070
3377
  });
3071
3378
  return result;
3072
3379
  }
3073
- var import__ = __toESM(require_eventemitter3(), 1);
3380
+ var import__ = __toESM2(require_eventemitter3(), 1);
3074
3381
  function isPlainObject(value) {
3075
3382
  if (!value || typeof value !== "object") {
3076
3383
  return false;
@@ -16803,7 +17110,7 @@ class Route {
16803
17110
  if (opts) {
16804
17111
  this.id = opts.id || randomId(12, "rand-");
16805
17112
  if (!opts.id && opts.idUsePath) {
16806
- const delimiter = opts.delimiter ?? "$#$";
17113
+ const delimiter = opts.delimiter ?? "$$";
16807
17114
  this.id = path + delimiter + key;
16808
17115
  }
16809
17116
  this.run = opts.run;
@@ -17767,7 +18074,7 @@ class ServerBase {
17767
18074
  }
17768
18075
  }
17769
18076
  async onWsClose(ws) {
17770
- const id = ws?.data?.id || "";
18077
+ const id = ws?.wsId || "";
17771
18078
  if (id) {
17772
18079
  this.emitter.emit("close--" + id, { type: "close", ws, id });
17773
18080
  setTimeout(() => {
@@ -17780,15 +18087,19 @@ class ServerBase {
17780
18087
  if (this.showConnected)
17781
18088
  ws.send(JSON.stringify({ type: "connected" }));
17782
18089
  }
18090
+ createId() {
18091
+ return Math.random().toString(36).substring(2, 15);
18092
+ }
17783
18093
  }
17784
- var import_stream = __toESM(require_stream(), 1);
17785
- var import_receiver = __toESM(require_receiver(), 1);
17786
- var import_sender = __toESM(require_sender(), 1);
17787
- var import_websocket = __toESM(require_websocket(), 1);
17788
- var import_websocket_server = __toESM(require_websocket_server(), 1);
18094
+ var import_stream = __toESM2(require_stream(), 1);
18095
+ var import_receiver = __toESM2(require_receiver(), 1);
18096
+ var import_sender = __toESM2(require_sender(), 1);
18097
+ var import_websocket = __toESM2(require_websocket(), 1);
18098
+ var import_websocket_server = __toESM2(require_websocket_server(), 1);
17789
18099
 
17790
18100
  // node_modules/.pnpm/@kevisual+context@0.0.8/node_modules/@kevisual/context/dist/app.js
17791
- var isBrowser2 = typeof window !== "undefined" && typeof window.document !== "undefined";
18101
+ var isBrowser2 = typeof window !== "undefined" && typeof document !== "undefined";
18102
+ var isBrowser22 = typeof window !== "undefined" && typeof window.document !== "undefined";
17792
18103
  function getDefaultExportFromCjs(x) {
17793
18104
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
17794
18105
  }
@@ -18340,30 +18651,57 @@ class InitEnv {
18340
18651
  }
18341
18652
  }
18342
18653
  InitEnv.init();
18654
+ var useKey = (envKey, initKey = "context") => {
18655
+ let key = envKey;
18656
+ if (!key)
18657
+ return null;
18658
+ const _env = useEnv({}, initKey);
18659
+ if (typeof _env[key] !== "undefined") {
18660
+ return _env[key];
18661
+ }
18662
+ if (!isBrowser2) {
18663
+ const nodeEev = gt?.process?.env;
18664
+ if (typeof nodeEev !== "undefined") {
18665
+ const value = nodeEev[key];
18666
+ if (typeof value !== "undefined") {
18667
+ return value;
18668
+ }
18669
+ }
18670
+ } else {
18671
+ const storage = gt?.localStorage;
18672
+ if (typeof storage !== "undefined") {
18673
+ const value = storage.getItem(key);
18674
+ if (typeof value !== "undefined") {
18675
+ return value;
18676
+ }
18677
+ }
18678
+ }
18679
+ return null;
18680
+ };
18343
18681
 
18344
18682
  // node_modules/.pnpm/@kevisual+use-config@1.0.30_dotenv@17.3.1/node_modules/@kevisual/use-config/dist/app.js
18345
18683
  import { createRequire as createRequire2 } from "node:module";
18346
18684
  import fs from "node:fs";
18347
18685
  import path from "node:path";
18348
- var __create2 = Object.create;
18349
- var __getProtoOf2 = Object.getPrototypeOf;
18686
+ var __create3 = Object.create;
18687
+ var __getProtoOf3 = Object.getPrototypeOf;
18350
18688
  var __defProp3 = Object.defineProperty;
18351
- var __getOwnPropNames2 = Object.getOwnPropertyNames;
18352
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
18353
- var __toESM2 = (mod, isNodeMode, target) => {
18354
- target = mod != null ? __create2(__getProtoOf2(mod)) : {};
18689
+ var __getOwnPropNames3 = Object.getOwnPropertyNames;
18690
+ var __hasOwnProp3 = Object.prototype.hasOwnProperty;
18691
+ var __toESM3 = (mod, isNodeMode, target) => {
18692
+ target = mod != null ? __create3(__getProtoOf3(mod)) : {};
18355
18693
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target;
18356
- for (let key of __getOwnPropNames2(mod))
18357
- if (!__hasOwnProp2.call(to, key))
18694
+ for (let key of __getOwnPropNames3(mod))
18695
+ if (!__hasOwnProp3.call(to, key))
18358
18696
  __defProp3(to, key, {
18359
18697
  get: () => mod[key],
18360
18698
  enumerable: true
18361
18699
  });
18362
18700
  return to;
18363
18701
  };
18364
- var __commonJS2 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
18702
+ var __commonJS3 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
18365
18703
  var __require2 = /* @__PURE__ */ createRequire2(import.meta.url);
18366
- var require_package = __commonJS2((exports, module) => {
18704
+ var require_package = __commonJS3((exports, module) => {
18367
18705
  module.exports = {
18368
18706
  name: "dotenv",
18369
18707
  version: "17.2.3",
@@ -18427,7 +18765,7 @@ var require_package = __commonJS2((exports, module) => {
18427
18765
  }
18428
18766
  };
18429
18767
  });
18430
- var require_main = __commonJS2((exports, module) => {
18768
+ var require_main = __commonJS3((exports, module) => {
18431
18769
  var fs2 = __require2("fs");
18432
18770
  var path2 = __require2("path");
18433
18771
  var os = __require2("os");
@@ -18754,7 +19092,7 @@ var require_main = __commonJS2((exports, module) => {
18754
19092
  exports.populate = DotenvModule.populate;
18755
19093
  module.exports = DotenvModule;
18756
19094
  });
18757
- var import_dotenv = __toESM2(require_main(), 1);
19095
+ var import_dotenv = __toESM3(require_main(), 1);
18758
19096
  var fileIsExist = (path2) => {
18759
19097
  try {
18760
19098
  fs.accessSync(path2, fs.constants.F_OK);
@@ -18838,7 +19176,7 @@ var mergeConfig = (config2) => {
18838
19176
  global.config = _config;
18839
19177
  return _config;
18840
19178
  };
18841
- var useKey = (key, opts) => {
19179
+ var useKey2 = (key, opts) => {
18842
19180
  let v = useConfig()[key];
18843
19181
  if (!v) {
18844
19182
  v = process.env[key];
@@ -20055,8 +20393,8 @@ class CNB extends CNBCore {
20055
20393
  // agent/app.ts
20056
20394
  var config2 = useConfig();
20057
20395
  var cnb = useContextKey("cnb", () => {
20058
- const token = useKey("CNB_API_KEY") || useKey("CNB_TOKEN");
20059
- const cookie = useKey("CNB_COOKIE");
20396
+ const token = useKey2("CNB_API_KEY") || useKey2("CNB_TOKEN");
20397
+ const cookie = useKey2("CNB_COOKIE");
20060
20398
  return new CNB({ token, cookie });
20061
20399
  });
20062
20400
  var app = useContextKey("app", () => {
@@ -33597,7 +33935,7 @@ config3(en_default2());
33597
33935
  // node_modules/.pnpm/zod@4.3.6/node_modules/zod/index.js
33598
33936
  var zod_default = exports_external2;
33599
33937
 
33600
- // node_modules/.pnpm/@opencode-ai+plugin@1.2.15/node_modules/@opencode-ai/plugin/dist/tool.js
33938
+ // node_modules/.pnpm/@opencode-ai+plugin@1.2.16/node_modules/@opencode-ai/plugin/dist/tool.js
33601
33939
  function tool2(input) {
33602
33940
  return input;
33603
33941
  }
@@ -33608,7 +33946,7 @@ app.route({
33608
33946
  path: "cnb",
33609
33947
  key: "user-check",
33610
33948
  description: "检查用户登录状态,参数checkToken,default true; checkCookie, default false",
33611
- middleware: ["admin-auth"],
33949
+ middleware: ["auth-admin"],
33612
33950
  metadata: {
33613
33951
  tags: ["opencode"],
33614
33952
  ...createSkill({
@@ -33653,7 +33991,7 @@ app.route({
33653
33991
  path: "cnb",
33654
33992
  key: "list-repos",
33655
33993
  description: "列出我的代码仓库",
33656
- middleware: ["admin-auth"],
33994
+ middleware: ["auth-admin"],
33657
33995
  metadata: {
33658
33996
  tags: ["opencode"],
33659
33997
  ...createSkill({
@@ -33694,7 +34032,7 @@ app.route({
33694
34032
  path: "cnb",
33695
34033
  key: "create-repo",
33696
34034
  description: "创建代码仓库, 参数name, visibility, description",
33697
- middleware: ["admin-auth"],
34035
+ middleware: ["auth-admin"],
33698
34036
  metadata: {
33699
34037
  tags: ["opencode"],
33700
34038
  ...createSkill({
@@ -33730,8 +34068,8 @@ app.route({
33730
34068
  app.route({
33731
34069
  path: "cnb",
33732
34070
  key: "create-repo-file",
33733
- description: "在代码仓库中创建文件, repoName, filePath, content, encoding",
33734
- middleware: ["admin-auth"],
34071
+ description: "在代码仓库中创建文件, repoName, filePath, content, encoding。使用CNB_COOKIE进行鉴权",
34072
+ middleware: ["auth-admin"],
33735
34073
  metadata: {
33736
34074
  tags: ["opencode"],
33737
34075
  ...createSkill({
@@ -33766,7 +34104,7 @@ app.route({
33766
34104
  path: "cnb",
33767
34105
  key: "delete-repo",
33768
34106
  description: "删除代码仓库, 参数name",
33769
- middleware: ["admin-auth"],
34107
+ middleware: ["auth-admin"],
33770
34108
  metadata: {
33771
34109
  tags: ["opencode"],
33772
34110
  ...createSkill({
@@ -33792,7 +34130,7 @@ app.route({
33792
34130
  path: "cnb",
33793
34131
  key: "clean-closed-workspace",
33794
34132
  description: "批量删除已停止的cnb工作空间",
33795
- middleware: ["admin-auth"],
34133
+ middleware: ["auth-admin"],
33796
34134
  metadata: {
33797
34135
  tags: ["opencode"],
33798
34136
  ...createSkill({
@@ -33802,7 +34140,7 @@ app.route({
33802
34140
  })
33803
34141
  }
33804
34142
  }).define(async (ctx) => {
33805
- const closedWorkspaces = await cnb.workspace.list({ status: "closed" });
34143
+ const closedWorkspaces = await cnb.workspace.list({ status: "closed", pageSize: 100 });
33806
34144
  if (closedWorkspaces.code !== 200) {
33807
34145
  ctx.throw(500, "获取已关闭工作空间列表失败");
33808
34146
  }
@@ -33921,7 +34259,7 @@ app.route({
33921
34259
  path: "cnb",
33922
34260
  key: "keep-workspace-alive",
33923
34261
  description: "保持工作空间存活技能,参数repo:代码仓库路径,例如 user/repo,pipelineId:流水线ID,例如 cnb-708-1ji9sog7o-001",
33924
- middleware: ["admin-auth"],
34262
+ middleware: ["auth-admin"],
33925
34263
  metadata: {
33926
34264
  tags: [],
33927
34265
  ...{
@@ -33959,7 +34297,7 @@ app.route({
33959
34297
  path: "cnb",
33960
34298
  key: "stop-keep-workspace-alive",
33961
34299
  description: "停止保持工作空间存活技能, 参数repo:代码仓库路径,例如 user/repo,pipelineId:流水线ID,例如 cnb-708-1ji9sog7o-001",
33962
- middleware: ["admin-auth"],
34300
+ middleware: ["auth-admin"],
33963
34301
  metadata: {
33964
34302
  tags: [],
33965
34303
  ...{
@@ -33978,13 +34316,33 @@ app.route({
33978
34316
  removeKeepAliveData(repo2, pipelineId);
33979
34317
  ctx.body = { content: `已停止保持工作空间 ${repo2}/${pipelineId} 存活的任务` };
33980
34318
  }).addTo(app);
34319
+ app.route({
34320
+ path: "cnb",
34321
+ key: "keep-alive-current-workspace",
34322
+ description: "保持当前工作空间存活技能",
34323
+ middleware: ["auth-admin"],
34324
+ metadata: {
34325
+ tags: ["opencode"],
34326
+ skill: "keep-alive-current-workspace",
34327
+ title: "保持当前工作空间存活",
34328
+ summary: "保持当前工作空间存活,防止被关闭或释放资源"
34329
+ }
34330
+ }).define(async (ctx) => {
34331
+ const pipelineId = useKey("CNB_PIPELINE_ID");
34332
+ const repo2 = useKey("CNB_REPO_SLUG_LOWERCASE");
34333
+ if (!pipelineId || !repo2) {
34334
+ ctx.throw(400, "当前环境缺少 CNB_PIPELINE_ID 或 CNB_REPO_SLUG_LOWERCASE 环境变量,无法保持工作空间存活");
34335
+ }
34336
+ const res = await app.run({ path: "cnb", key: "keep-workspace-alive", payload: { repo: repo2, pipelineId } }, ctx);
34337
+ ctx.forward(res);
34338
+ }).addTo(app);
33981
34339
 
33982
34340
  // agent/routes/workspace/index.ts
33983
34341
  app.route({
33984
34342
  path: "cnb",
33985
34343
  key: "start-workspace",
33986
34344
  description: "启动开发工作空间, 参数 repo",
33987
- middleware: ["admin-auth"],
34345
+ middleware: ["auth-admin"],
33988
34346
  metadata: {
33989
34347
  tags: ["opencode"],
33990
34348
  ...createSkill({
@@ -34015,7 +34373,7 @@ app.route({
34015
34373
  path: "cnb",
34016
34374
  key: "list-workspace",
34017
34375
  description: "获取cnb开发工作空间列表,可选参数 status=running 获取运行中的环境",
34018
- middleware: ["admin-auth"],
34376
+ middleware: ["auth-admin"],
34019
34377
  metadata: {
34020
34378
  tags: ["opencode"],
34021
34379
  ...createSkill({
@@ -34044,7 +34402,7 @@ app.route({
34044
34402
  path: "cnb",
34045
34403
  key: "get-workspace",
34046
34404
  description: "获取工作空间详情,通过 repo 和 sn 获取",
34047
- middleware: ["admin-auth"],
34405
+ middleware: ["auth-admin"],
34048
34406
  metadata: {
34049
34407
  tags: ["opencode"],
34050
34408
  ...createSkill({
@@ -34073,7 +34431,7 @@ app.route({
34073
34431
  path: "cnb",
34074
34432
  key: "delete-workspace",
34075
34433
  description: "删除工作空间,通过 pipelineId 或 sn",
34076
- middleware: ["admin-auth"],
34434
+ middleware: ["auth-admin"],
34077
34435
  metadata: {
34078
34436
  tags: ["opencode"],
34079
34437
  ...createSkill({
@@ -34110,7 +34468,7 @@ app.route({
34110
34468
  path: "cnb",
34111
34469
  key: "stop-workspace",
34112
34470
  description: "停止工作空间,通过 pipelineId 或 sn",
34113
- middleware: ["admin-auth"],
34471
+ middleware: ["auth-admin"],
34114
34472
  metadata: {
34115
34473
  tags: ["opencode"],
34116
34474
  ...createSkill({
@@ -34134,54 +34492,52 @@ app.route({
34134
34492
  }).addTo(app);
34135
34493
 
34136
34494
  // agent/routes/call/index.ts
34137
- if (!app.hasRoute("call")) {
34138
- app.route({
34139
- path: "call",
34140
- key: "",
34141
- description: "调用",
34142
- middleware: ["admin-auth"],
34143
- metadata: {
34144
- tags: ["opencode"],
34145
- ...createSkill({
34146
- skill: "call-app",
34147
- title: "调用app应用",
34148
- summary: "调用router的应用, 参数path, key, payload",
34149
- args: {
34150
- path: tool.schema.string().describe("应用路径,例如 cnb"),
34151
- key: tool.schema.string().optional().describe("应用key,例如 list-repos"),
34152
- payload: tool.schema.object({}).optional().describe("调用参数")
34153
- }
34154
- })
34155
- }
34156
- }).define(async (ctx) => {
34157
- const { path: path3, key } = ctx.query;
34158
- console.log("call app", ctx.query);
34159
- if (!path3) {
34160
- ctx.throw("路径path不能为空");
34161
- }
34162
- const res = await ctx.run({ path: path3, key, payload: ctx.query.payload || {} });
34163
- ctx.forward(res);
34164
- }).addTo(app);
34165
- }
34495
+ app.route({
34496
+ path: "call",
34497
+ key: "",
34498
+ description: "调用",
34499
+ middleware: ["auth-admin"],
34500
+ metadata: {
34501
+ tags: ["opencode"],
34502
+ ...createSkill({
34503
+ skill: "call-app",
34504
+ title: "调用app应用",
34505
+ summary: "调用router的应用, 参数path, key, payload",
34506
+ args: {
34507
+ path: tool.schema.string().describe("应用路径,例如 cnb"),
34508
+ key: tool.schema.string().optional().describe("应用key,例如 list-repos"),
34509
+ payload: tool.schema.object({}).optional().describe("调用参数")
34510
+ }
34511
+ })
34512
+ }
34513
+ }).define(async (ctx) => {
34514
+ const { path: path3, key } = ctx.query;
34515
+ console.log("call app", ctx.query);
34516
+ if (!path3) {
34517
+ ctx.throw("路径path不能为空");
34518
+ }
34519
+ const res = await ctx.run({ path: path3, key, payload: ctx.query.payload || {} });
34520
+ ctx.forward(res);
34521
+ }).addTo(app, { overwrite: false });
34166
34522
 
34167
34523
  // src/common/cnb-env.ts
34168
34524
  var CNB_ENV = {
34169
- CNB_REPO_URL_HTTPS: useKey("CNB_REPO_URL_HTTPS"),
34170
- CNB_PIPELINE_ID: useKey("CNB_PIPELINE_ID"),
34171
- CNB_BUILD_ID: useKey("CNB_BUILD_ID"),
34172
- CNB_BUILD_START_TIME: useKey("CNB_BUILD_START_TIME"),
34173
- CNB_BUILD_WEB_URL: useKey("CNB_BUILD_WEB_URL"),
34174
- CNB_EVENT: useKey("CNB_EVENT"),
34175
- CNB_COMMIT: useKey("CNB_COMMIT"),
34176
- CNB_VSCODE_WEB_URL: useKey("CNB_VSCODE_WEB_URL"),
34177
- CNB_VSCODE_PROXY_URI: useKey("CNB_VSCODE_PROXY_URI"),
34178
- CNB_VSCODE_REMOTE_SSH_SCHEMA: useKey("CNB_VSCODE_REMOTE_SSH_SCHEMA"),
34179
- CNB_VSCODE_SSH_TOKEN: useKey("CNB_VSCODE_SSH_TOKEN"),
34180
- CNB_REPO_SLUG: useKey("CNB_REPO_SLUG"),
34181
- CNB_GROUP_SLUG: useKey("CNB_GROUP_SLUG"),
34182
- CNB_CPUS: useKey("CNB_CPUS"),
34183
- CNB_MEMORY: useKey("CNB_MEMORY"),
34184
- CNB_RUNNER_IP: useKey("CNB_RUNNER_IP")
34525
+ CNB_REPO_URL_HTTPS: useKey2("CNB_REPO_URL_HTTPS"),
34526
+ CNB_PIPELINE_ID: useKey2("CNB_PIPELINE_ID"),
34527
+ CNB_BUILD_ID: useKey2("CNB_BUILD_ID"),
34528
+ CNB_BUILD_START_TIME: useKey2("CNB_BUILD_START_TIME"),
34529
+ CNB_BUILD_WEB_URL: useKey2("CNB_BUILD_WEB_URL"),
34530
+ CNB_EVENT: useKey2("CNB_EVENT"),
34531
+ CNB_COMMIT: useKey2("CNB_COMMIT"),
34532
+ CNB_VSCODE_WEB_URL: useKey2("CNB_VSCODE_WEB_URL"),
34533
+ CNB_VSCODE_PROXY_URI: useKey2("CNB_VSCODE_PROXY_URI"),
34534
+ CNB_VSCODE_REMOTE_SSH_SCHEMA: useKey2("CNB_VSCODE_REMOTE_SSH_SCHEMA"),
34535
+ CNB_VSCODE_SSH_TOKEN: useKey2("CNB_VSCODE_SSH_TOKEN"),
34536
+ CNB_REPO_SLUG: useKey2("CNB_REPO_SLUG"),
34537
+ CNB_GROUP_SLUG: useKey2("CNB_GROUP_SLUG"),
34538
+ CNB_CPUS: useKey2("CNB_CPUS"),
34539
+ CNB_MEMORY: useKey2("CNB_MEMORY"),
34540
+ CNB_RUNNER_IP: useKey2("CNB_RUNNER_IP")
34185
34541
  };
34186
34542
 
34187
34543
  // agent/routes/cnb-env/vscode.ts
@@ -34189,7 +34545,7 @@ app.route({
34189
34545
  path: "cnb",
34190
34546
  key: "get-cnb-port-uri",
34191
34547
  description: "获取当前cnb工作空间的port代理uri",
34192
- middleware: ["admin-auth"],
34548
+ middleware: ["auth-admin"],
34193
34549
  metadata: {
34194
34550
  tags: ["opencode"],
34195
34551
  ...createSkill({
@@ -34197,12 +34553,12 @@ app.route({
34197
34553
  title: "获取当前cnb工作空间的port代理uri",
34198
34554
  summary: "获取当前cnb工作空间的port代理uri,用于端口转发",
34199
34555
  args: {
34200
- port: tool.schema.number().optional().describe("端口号,默认为4096")
34556
+ port: tool.schema.number().optional().describe("端口号,默认为51515")
34201
34557
  }
34202
34558
  })
34203
34559
  }
34204
34560
  }).define(async (ctx) => {
34205
- const port = ctx.query?.port || 4096;
34561
+ const port = ctx.query?.port || 51515;
34206
34562
  const uri = CNB_ENV?.CNB_VSCODE_PROXY_URI || "";
34207
34563
  const finalUri = uri.replace("{{port}}", port.toString());
34208
34564
  let content = `
@@ -34214,7 +34570,7 @@ app.route({
34214
34570
  path: "cnb",
34215
34571
  key: "get-cnb-vscode-uri",
34216
34572
  description: "获取当前cnb工作空间的vscode代理uri, 包括多种访问方式, 如web、vscode、codebuddy、cursor、ssh",
34217
- middleware: ["admin-auth"],
34573
+ middleware: ["auth-admin"],
34218
34574
  metadata: {
34219
34575
  tags: ["opencode"],
34220
34576
  ...createSkill({
@@ -34275,7 +34631,7 @@ app.route({
34275
34631
  path: "cnb",
34276
34632
  key: "set-cnb-cookie",
34277
34633
  description: "设置当前cnb工作空间的cookie环境变量",
34278
- middleware: ["admin-auth"],
34634
+ middleware: ["auth-admin"],
34279
34635
  metadata: {
34280
34636
  tags: ["opencode"],
34281
34637
  ...createSkill({
@@ -34300,7 +34656,7 @@ app.route({
34300
34656
  path: "cnb",
34301
34657
  key: "get-cnb-cookie",
34302
34658
  description: "获取当前cnb工作空间的cookie环境变量",
34303
- middleware: ["admin-auth"],
34659
+ middleware: ["auth-admin"],
34304
34660
  metadata: {
34305
34661
  tags: ["opencode"],
34306
34662
  ...createSkill({
@@ -34314,18 +34670,18 @@ app.route({
34314
34670
  ctx.body = { content: `当前cnb工作空间的cookie环境变量为:${cookie}` };
34315
34671
  }).addTo(app);
34316
34672
 
34317
- // node_modules/.pnpm/@kevisual+ai@0.0.24/node_modules/@kevisual/ai/dist/ai-provider-browser.js
34318
- var __create3 = Object.create;
34319
- var __getProtoOf3 = Object.getPrototypeOf;
34673
+ // node_modules/.pnpm/@kevisual+ai@0.0.26/node_modules/@kevisual/ai/dist/ai-provider-browser.js
34674
+ var __create4 = Object.create;
34675
+ var __getProtoOf4 = Object.getPrototypeOf;
34320
34676
  var __defProp4 = Object.defineProperty;
34321
- var __getOwnPropNames3 = Object.getOwnPropertyNames;
34677
+ var __getOwnPropNames4 = Object.getOwnPropertyNames;
34322
34678
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
34323
- var __hasOwnProp3 = Object.prototype.hasOwnProperty;
34324
- var __toESM3 = (mod, isNodeMode, target) => {
34325
- target = mod != null ? __create3(__getProtoOf3(mod)) : {};
34679
+ var __hasOwnProp4 = Object.prototype.hasOwnProperty;
34680
+ var __toESM4 = (mod, isNodeMode, target) => {
34681
+ target = mod != null ? __create4(__getProtoOf4(mod)) : {};
34326
34682
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp4(target, "default", { value: mod, enumerable: true }) : target;
34327
- for (let key of __getOwnPropNames3(mod))
34328
- if (!__hasOwnProp3.call(to, key))
34683
+ for (let key of __getOwnPropNames4(mod))
34684
+ if (!__hasOwnProp4.call(to, key))
34329
34685
  __defProp4(to, key, {
34330
34686
  get: () => mod[key],
34331
34687
  enumerable: true
@@ -34339,14 +34695,14 @@ var __toCommonJS = (from) => {
34339
34695
  return entry;
34340
34696
  entry = __defProp4({}, "__esModule", { value: true });
34341
34697
  if (from && typeof from === "object" || typeof from === "function")
34342
- __getOwnPropNames3(from).map((key) => !__hasOwnProp3.call(entry, key) && __defProp4(entry, key, {
34698
+ __getOwnPropNames4(from).map((key) => !__hasOwnProp4.call(entry, key) && __defProp4(entry, key, {
34343
34699
  get: () => from[key],
34344
34700
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
34345
34701
  }));
34346
34702
  __moduleCache.set(from, entry);
34347
34703
  return entry;
34348
34704
  };
34349
- var __commonJS3 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34705
+ var __commonJS4 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34350
34706
  var __export3 = (target, all) => {
34351
34707
  for (var name in all)
34352
34708
  __defProp4(target, name, {
@@ -36516,7 +36872,7 @@ var init_events = __esm(() => {
36516
36872
  Object.assign(EventEmitter3, { once: once2, getEventListeners, getMaxListeners: getMaxListeners2, setMaxListeners: setMaxListeners2, EventEmitter: EventEmitter3, usingDomains: false, captureRejectionSymbol, errorMonitor: kErrorMonitor, addAbortListener, init: EventEmitter3, listenerCount: listenerCount2 });
36517
36873
  events_default = EventEmitter3;
36518
36874
  });
36519
- var require_stream2 = __commonJS3((exports, module) => {
36875
+ var require_stream2 = __commonJS4((exports, module) => {
36520
36876
  var __commonJS22 = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
36521
36877
  var require_primordials = __commonJS22((exports2, module2) => {
36522
36878
 
@@ -52671,7 +53027,7 @@ https://github.com/browserify/crypto-browserify`);
52671
53027
  webcrypto = crypto;
52672
53028
  crypto_default = crypto;
52673
53029
  });
52674
- var require_core = __commonJS3((exports, module) => {
53030
+ var require_core = __commonJS4((exports, module) => {
52675
53031
  (function(root, factory) {
52676
53032
  if (typeof exports === "object") {
52677
53033
  module.exports = exports = factory();
@@ -52954,7 +53310,7 @@ var require_core = __commonJS3((exports, module) => {
52954
53310
  return CryptoJS;
52955
53311
  });
52956
53312
  });
52957
- var require_enc_base64 = __commonJS3((exports, module) => {
53313
+ var require_enc_base64 = __commonJS4((exports, module) => {
52958
53314
  (function(root, factory) {
52959
53315
  if (typeof exports === "object") {
52960
53316
  module.exports = exports = factory(require_core());
@@ -53032,7 +53388,7 @@ var require_enc_base64 = __commonJS3((exports, module) => {
53032
53388
  return CryptoJS.enc.Base64;
53033
53389
  });
53034
53390
  });
53035
- var require_md52 = __commonJS3((exports, module) => {
53391
+ var require_md52 = __commonJS4((exports, module) => {
53036
53392
  (function(root, factory) {
53037
53393
  if (typeof exports === "object") {
53038
53394
  module.exports = exports = factory(require_core());
@@ -53207,7 +53563,7 @@ var require_md52 = __commonJS3((exports, module) => {
53207
53563
  return CryptoJS.MD5;
53208
53564
  });
53209
53565
  });
53210
- var require_sha1 = __commonJS3((exports, module) => {
53566
+ var require_sha1 = __commonJS4((exports, module) => {
53211
53567
  (function(root, factory) {
53212
53568
  if (typeof exports === "object") {
53213
53569
  module.exports = exports = factory(require_core());
@@ -53294,7 +53650,7 @@ var require_sha1 = __commonJS3((exports, module) => {
53294
53650
  return CryptoJS.SHA1;
53295
53651
  });
53296
53652
  });
53297
- var require_hmac2 = __commonJS3((exports, module) => {
53653
+ var require_hmac2 = __commonJS4((exports, module) => {
53298
53654
  (function(root, factory) {
53299
53655
  if (typeof exports === "object") {
53300
53656
  module.exports = exports = factory(require_core());
@@ -53354,7 +53710,7 @@ var require_hmac2 = __commonJS3((exports, module) => {
53354
53710
  })();
53355
53711
  });
53356
53712
  });
53357
- var require_evpkdf = __commonJS3((exports, module) => {
53713
+ var require_evpkdf = __commonJS4((exports, module) => {
53358
53714
  (function(root, factory, undef) {
53359
53715
  if (typeof exports === "object") {
53360
53716
  module.exports = exports = factory(require_core(), require_sha1(), require_hmac2());
@@ -53411,7 +53767,7 @@ var require_evpkdf = __commonJS3((exports, module) => {
53411
53767
  return CryptoJS.EvpKDF;
53412
53768
  });
53413
53769
  });
53414
- var require_cipher_core = __commonJS3((exports, module) => {
53770
+ var require_cipher_core = __commonJS4((exports, module) => {
53415
53771
  (function(root, factory, undef) {
53416
53772
  if (typeof exports === "object") {
53417
53773
  module.exports = exports = factory(require_core(), require_evpkdf());
@@ -53707,7 +54063,7 @@ var require_cipher_core = __commonJS3((exports, module) => {
53707
54063
  }();
53708
54064
  });
53709
54065
  });
53710
- var require_aes = __commonJS3((exports, module) => {
54066
+ var require_aes = __commonJS4((exports, module) => {
53711
54067
  (function(root, factory, undef) {
53712
54068
  if (typeof exports === "object") {
53713
54069
  module.exports = exports = factory(require_core(), require_enc_base64(), require_md52(), require_evpkdf(), require_cipher_core());
@@ -53857,7 +54213,7 @@ var require_aes = __commonJS3((exports, module) => {
53857
54213
  return CryptoJS.AES;
53858
54214
  });
53859
54215
  });
53860
- var require_enc_utf8 = __commonJS3((exports, module) => {
54216
+ var require_enc_utf8 = __commonJS4((exports, module) => {
53861
54217
  (function(root, factory) {
53862
54218
  if (typeof exports === "object") {
53863
54219
  module.exports = exports = factory(require_core());
@@ -54160,8 +54516,8 @@ class CNBChat extends BaseChat {
54160
54516
  };
54161
54517
  }
54162
54518
  }
54163
- var import_aes = __toESM3(require_aes(), 1);
54164
- var import_enc_utf8 = __toESM3(require_enc_utf8(), 1);
54519
+ var import_aes = __toESM4(require_aes(), 1);
54520
+ var import_enc_utf8 = __toESM4(require_enc_utf8(), 1);
54165
54521
  var CryptoJS = { AES: import_aes.default, enc: { Utf8: import_enc_utf8.default } };
54166
54522
 
54167
54523
  // agent/routes/knowledge/ai.ts
@@ -54169,7 +54525,7 @@ app.route({
54169
54525
  path: "cnb",
54170
54526
  key: "cnb-ai-chat",
54171
54527
  description: "调用cnb的知识库ai对话功能进行聊天",
54172
- middleware: ["admin-auth"],
54528
+ middleware: ["auth-admin"],
54173
54529
  metadata: {
54174
54530
  tags: ["opencode"],
54175
54531
  ...createSkill({
@@ -54271,7 +54627,7 @@ app.route({
54271
54627
  path: "cnb",
54272
54628
  key: "cnb-rag-query",
54273
54629
  description: "调用cnb的知识库RAG查询功能进行问答",
54274
- middleware: ["admin-auth"],
54630
+ middleware: ["auth-admin"],
54275
54631
  metadata: {
54276
54632
  tags: ["opencode"],
54277
54633
  ...createSkill({
@@ -54290,7 +54646,7 @@ app.route({
54290
54646
  ctx.body = { content: "请提供有效的消息内容" };
54291
54647
  return;
54292
54648
  }
54293
- let repo2 = ctx.query?.repo;
54649
+ let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
54294
54650
  if (!repo2) {
54295
54651
  const res = await cnb.repo.getRepoList({ flags: "KnowledgeBase" });
54296
54652
  if (res.code === 200 && res.data.length > 0) {
@@ -54334,7 +54690,7 @@ app.route({
54334
54690
  path: "cnb",
54335
54691
  key: "list-issues",
54336
54692
  description: "查询 Issue 列表, 参数 repo, state, keyword, labels, page, page_size 等",
54337
- middleware: ["admin-auth"],
54693
+ middleware: ["auth-admin"],
54338
54694
  metadata: {
54339
54695
  tags: ["opencode"],
54340
54696
  ...createSkill({
@@ -54353,7 +54709,7 @@ app.route({
54353
54709
  })
54354
54710
  }
54355
54711
  }).define(async (ctx) => {
54356
- const repo2 = ctx.query?.repo;
54712
+ const repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
54357
54713
  const state = ctx.query?.state;
54358
54714
  const keyword = ctx.query?.keyword;
54359
54715
  const labels = ctx.query?.labels;
@@ -54385,7 +54741,7 @@ app.route({
54385
54741
  path: "cnb",
54386
54742
  key: "create-issue",
54387
54743
  description: "创建 Issue, 参数 repo, title, body, assignees, labels, priority",
54388
- middleware: ["admin-auth"],
54744
+ middleware: ["auth-admin"],
54389
54745
  metadata: {
54390
54746
  tags: ["opencode"],
54391
54747
  ...createSkill({
@@ -54425,7 +54781,7 @@ app.route({
54425
54781
  path: "cnb",
54426
54782
  key: "complete-issue",
54427
54783
  description: "完成 Issue, 参数 repo, issueNumber",
54428
- middleware: ["admin-auth"],
54784
+ middleware: ["auth-admin"],
54429
54785
  metadata: {
54430
54786
  tags: ["opencode"],
54431
54787
  ...createSkill({
@@ -54454,6 +54810,749 @@ app.route({
54454
54810
  ctx.forward(res);
54455
54811
  }).addTo(app);
54456
54812
 
54813
+ // agent/routes/cnb-board/live/live-content.ts
54814
+ var import_dayjs = __toESM(require_dayjs_min(), 1);
54815
+ import os2 from "node:os";
54816
+ import { execSync as execSync2 } from "node:child_process";
54817
+ var getLiveMdContent = (opts) => {
54818
+ const more = opts?.more ?? false;
54819
+ const url4 = useKey("CNB_VSCODE_PROXY_URI") || "";
54820
+ const token = useKey("CNB_TOKEN") || "";
54821
+ const openclawPort = useKey("OPENCLAW_PORT") || "80";
54822
+ const openclawUrl = url4.replace("{{port}}", openclawPort);
54823
+ const openclawUrlSecret = openclawUrl + "/openclaw?token=" + token;
54824
+ const opencodePort = useKey("OPENCODE_PORT") || "100";
54825
+ const opencodeUrl = url4.replace("{{port}}", opencodePort);
54826
+ const _opencodeURL = new URL(opencodeUrl);
54827
+ _opencodeURL.username = "root";
54828
+ _opencodeURL.password = token;
54829
+ const opencodeUrlSecret = _opencodeURL.toString();
54830
+ const kevisualUrl = url4.replace("{{port}}", "51515");
54831
+ const openWebUrl = url4.replace("{{port}}", "200");
54832
+ const vscodeWebUrl = useKey("CNB_VSCODE_WEB_URL") || "";
54833
+ const TEMPLATE = `# 开发环境模式配置
54834
+
54835
+ ### 服务访问地址
54836
+ #### nginx 反向代理访问(推荐)
54837
+ - OpenClaw: ${openclawUrl + "/openclaw"}
54838
+ - OpenCode: ${opencodeUrl}
54839
+ - VSCode Web: ${vscodeWebUrl}
54840
+ - OpenWebUI: ${openWebUrl}
54841
+ - Kevisual: ${kevisualUrl}
54842
+
54843
+ ### 密码访问
54844
+ - OpenClaw: ${openclawUrlSecret}
54845
+ - OpenCode: ${opencodeUrlSecret}
54846
+
54847
+ ### 环境变量
54848
+ - CNB_TOKEN: ${token}
54849
+
54850
+ ### 其他说明
54851
+
54852
+ 1. 保活说明
54853
+ 使用插件访问vscode web获取wss进行保活,避免长时间不操作导致的自动断开连接。
54854
+
54855
+ 方法1: 使用插件访问vscode web获取wss进行保活,避免长时间不操作导致的自动断开连接。
54856
+
54857
+ 1. 安装插件[CNB LIVE](https://chromewebstore.google.com/detail/cnb-live/iajpiophkcdghonpijkcgpjafbcjhkko?pli=1)
54858
+ 2. 打开vscode web获取,点击插件,获取json数据,替换keep.json中的数据,保持在线状态。
54859
+ 3. keep.json中的数据结构说明:
54860
+ - wss: vscode web的websocket地址
54861
+ - cookie: vscode web的cookie,保持和浏览器一致
54862
+ - url: vscode web的访问地址,可以直接访问vscode web
54863
+ 4. 运行cli命令,ev cnb live -c /workspace/live/keep.json.(直接对话opencode或者openclaw调用cnb-live技能即可)
54864
+
54865
+ 方法2:环境变量设置CNB_COOKIE,直接opencode或者openclaw的ui界面对话说,cnb-keep-live保活,他会自动调用保活,同时不需要点cnb-lie插件获取配置。
54866
+
54867
+ 2. Opencode web访问说明
54868
+ Opencode打开web地址,需要在浏览器输入用户名和密码,用户名固定为root,密码为CNB_TOKEN的值. 纯连接打开包含账号密码,第一次点击后,需要把账号密码清理掉才能访问,opencode的bug导致的。
54869
+ `;
54870
+ const labels = [
54871
+ {
54872
+ key: "vscodeWebUrl",
54873
+ title: "VSCode Web 地址",
54874
+ value: vscodeWebUrl,
54875
+ description: "VSCode Web 的访问地址"
54876
+ },
54877
+ {
54878
+ key: "kevisualUrl",
54879
+ title: "Kevisual 地址",
54880
+ value: kevisualUrl,
54881
+ description: "Kevisual 的访问地址,可以通过该地址访问 Kevisual 服务"
54882
+ },
54883
+ {
54884
+ key: "cnbTempToken",
54885
+ title: "CNB Token",
54886
+ value: token,
54887
+ description: "CNB 临时 Token,保持和环境变量 CNB_TOKEN 一致"
54888
+ },
54889
+ {
54890
+ key: "openWebUrl",
54891
+ title: "OpenWebUI 地址",
54892
+ value: openWebUrl,
54893
+ description: "OpenWebUI 的访问地址,可以通过该地址访问 OpenWebUI 服务"
54894
+ },
54895
+ {
54896
+ key: "openclawUrl",
54897
+ title: "OpenClaw 地址",
54898
+ value: openclawUrl + "/openclaw",
54899
+ description: "OpenClaw 的访问地址,可以通过该地址访问 OpenClaw 服务"
54900
+ },
54901
+ {
54902
+ key: "openclawUrlSecret",
54903
+ title: "OpenClaw 访问地址(含 Token)",
54904
+ value: openclawUrlSecret,
54905
+ description: "OpenClaw 的访问地址,包含 token 参数,可以直接访问 OpenClaw 服务"
54906
+ },
54907
+ {
54908
+ key: "opencodeUrl",
54909
+ title: "OpenCode 地址",
54910
+ value: opencodeUrl,
54911
+ description: "OpenCode 的访问地址,可以通过该地址访问 OpenCode 服务"
54912
+ },
54913
+ {
54914
+ key: "opencodeUrlSecret",
54915
+ title: "OpenCode 访问地址(含 Token)",
54916
+ value: opencodeUrlSecret,
54917
+ description: "OpenCode 的访问地址,包含 token 参数,可以直接访问 OpenCode 服务"
54918
+ },
54919
+ {
54920
+ key: "docs",
54921
+ title: "配置说明文档",
54922
+ value: TEMPLATE,
54923
+ description: "开发环境模式配置说明文档"
54924
+ }
54925
+ ];
54926
+ const osInfoList = createOSInfo(more);
54927
+ labels.push(...osInfoList);
54928
+ return labels;
54929
+ };
54930
+ var createOSInfo = (more = false) => {
54931
+ const labels = [];
54932
+ const startTimer = useKey("CNB_BUILD_START_TIME") || "";
54933
+ const cpus = os2.cpus();
54934
+ let totalIdle = 0;
54935
+ let totalTick = 0;
54936
+ cpus.forEach((cpu) => {
54937
+ for (const type in cpu.times) {
54938
+ totalTick += cpu.times[type];
54939
+ }
54940
+ totalIdle += cpu.times.idle;
54941
+ });
54942
+ const cpuUsage = ((1 - totalIdle / totalTick) * 100).toFixed(2);
54943
+ let memUsed = 0;
54944
+ let memTotal = 0;
54945
+ let memFree = 0;
54946
+ try {
54947
+ const freeOutput = execSync2("free -b", { encoding: "utf-8" });
54948
+ const lines = freeOutput.trim().split(`
54949
+ `);
54950
+ const memLine = lines.find((line) => line.startsWith("Mem:"));
54951
+ if (memLine) {
54952
+ const parts = memLine.split(/\s+/);
54953
+ memTotal = parseInt(parts[1]);
54954
+ memUsed = parseInt(parts[2]);
54955
+ memFree = parseInt(parts[3]);
54956
+ }
54957
+ } catch (e) {
54958
+ memTotal = os2.totalmem();
54959
+ memFree = os2.freemem();
54960
+ memUsed = memTotal - memFree;
54961
+ }
54962
+ const memUsage = memTotal > 0 ? (memUsed / memTotal * 100).toFixed(2) : "0.00";
54963
+ const formatBytes = (bytes) => {
54964
+ const sizes = ["B", "KB", "MB", "GB", "TB"];
54965
+ if (bytes === 0)
54966
+ return "0 B";
54967
+ const i2 = Math.floor(Math.log(bytes) / Math.log(1024));
54968
+ return (bytes / Math.pow(1024, i2)).toFixed(2) + " " + sizes[i2];
54969
+ };
54970
+ const formatUptime = (seconds) => {
54971
+ const days = Math.floor(seconds / 86400);
54972
+ const hours = Math.floor(seconds % 86400 / 3600);
54973
+ const minutes = Math.floor(seconds % 3600 / 60);
54974
+ const secs = Math.floor(seconds % 60);
54975
+ let uptimeStr = "";
54976
+ if (days > 0)
54977
+ uptimeStr += `${days}天 `;
54978
+ if (hours > 0)
54979
+ uptimeStr += `${hours}小时 `;
54980
+ if (minutes > 0)
54981
+ uptimeStr += `${minutes}分钟 `;
54982
+ return `${uptimeStr}${secs}秒`;
54983
+ };
54984
+ let diskUsage = "";
54985
+ try {
54986
+ const duOutput = execSync2("du -sh .", { encoding: "utf-8" });
54987
+ diskUsage = duOutput.trim().split("\t")[0];
54988
+ } catch (e) {
54989
+ diskUsage = "获取失败";
54990
+ }
54991
+ labels.push({
54992
+ key: "cpuUsage",
54993
+ title: "CPU 使用率",
54994
+ value: `${cpuUsage}%`,
54995
+ description: "CPU 使用率"
54996
+ }, {
54997
+ key: "cpuCores",
54998
+ title: "CPU 核心数",
54999
+ value: cpus.length,
55000
+ description: "CPU 核心数"
55001
+ }, {
55002
+ key: "memoryUsed",
55003
+ title: "已使用内存",
55004
+ value: formatBytes(memUsed),
55005
+ description: "已使用内存"
55006
+ }, {
55007
+ key: "memoryTotal",
55008
+ title: "总内存",
55009
+ value: formatBytes(memTotal),
55010
+ description: "总内存"
55011
+ }, {
55012
+ key: "memoryFree",
55013
+ title: "空闲内存",
55014
+ value: formatBytes(memFree),
55015
+ description: "空闲内存"
55016
+ }, {
55017
+ key: "memoryUsage",
55018
+ title: "内存使用率",
55019
+ value: `${memUsage}%`,
55020
+ description: "内存使用率"
55021
+ }, {
55022
+ key: "diskUsage",
55023
+ title: "磁盘使用",
55024
+ value: diskUsage,
55025
+ description: "当前目录磁盘使用情况"
55026
+ });
55027
+ if (startTimer) {
55028
+ const buildStartTime = import_dayjs.default(startTimer).format("YYYY-MM-DD HH:mm:ss");
55029
+ const buildStartTimestamp = import_dayjs.default(startTimer).valueOf();
55030
+ const buildUptime = Date.now() - buildStartTimestamp;
55031
+ const buildUptimeStr = formatUptime(Math.floor(buildUptime / 1000));
55032
+ const maxRunTime = useKey("CNB_PIPELINE_MAX_RUN_TIME") || 0;
55033
+ labels.push({
55034
+ key: "buildStartTime",
55035
+ title: "构建启动时间",
55036
+ value: buildStartTime,
55037
+ description: "构建启动时间"
55038
+ }, {
55039
+ key: "buildUptime",
55040
+ title: "构建已运行时间",
55041
+ value: buildUptime,
55042
+ description: `构建已运行时间: ${buildUptimeStr}`
55043
+ });
55044
+ if (maxRunTime > 0) {
55045
+ const now = import_dayjs.default();
55046
+ const today4am = now.hour(4).minute(0).second(0).millisecond(0);
55047
+ let timeTo4 = today4am.valueOf() - now.valueOf();
55048
+ if (timeTo4 < 0) {
55049
+ timeTo4 = today4am.add(1, "day").valueOf() - now.valueOf();
55050
+ }
55051
+ const timeTo4Str = `[距离晚上4点重启时间: ${formatUptime(Math.floor(timeTo4 / 1000))}]`;
55052
+ labels.push({
55053
+ key: "buildMaxRunTime",
55054
+ title: "最大运行时间",
55055
+ value: formatUptime(Math.floor(maxRunTime / 1000)),
55056
+ description: "构建最大运行时间(限制时间)"
55057
+ });
55058
+ labels.unshift({
55059
+ key: "remainingTime",
55060
+ title: "剩余时间",
55061
+ value: maxRunTime - buildUptime,
55062
+ description: "构建剩余时间" + formatUptime(Math.floor((maxRunTime - buildUptime) / 1000)) + " " + timeTo4Str
55063
+ });
55064
+ }
55065
+ }
55066
+ if (more) {
55067
+ const loadavg = os2.loadavg();
55068
+ labels.push({
55069
+ key: "hostname",
55070
+ title: "主机名",
55071
+ value: os2.hostname(),
55072
+ description: "主机名"
55073
+ }, {
55074
+ key: "platform",
55075
+ title: "运行平台",
55076
+ value: os2.platform(),
55077
+ description: "运行平台"
55078
+ }, {
55079
+ key: "arch",
55080
+ title: "系统架构",
55081
+ value: os2.arch(),
55082
+ description: "系统架构"
55083
+ }, {
55084
+ key: "osType",
55085
+ title: "操作系统类型",
55086
+ value: os2.type(),
55087
+ description: "操作系统类型"
55088
+ }, {
55089
+ key: "loadavg1m",
55090
+ title: "系统负载 (1分钟)",
55091
+ value: loadavg[0].toFixed(2),
55092
+ description: "系统负载 (1分钟)"
55093
+ }, {
55094
+ key: "loadavg5m",
55095
+ title: "系统负载 (5分钟)",
55096
+ value: loadavg[1].toFixed(2),
55097
+ description: "系统负载 (5分钟)"
55098
+ }, {
55099
+ key: "loadavg15m",
55100
+ title: "系统负载 (15分钟)",
55101
+ value: loadavg[2].toFixed(2),
55102
+ description: "系统负载 (15分钟)"
55103
+ });
55104
+ }
55105
+ return labels;
55106
+ };
55107
+
55108
+ // agent/routes/cnb-board/cnb-dev-env.ts
55109
+ var notCNBCheck = (ctx) => {
55110
+ const isCNB = useKey("CNB");
55111
+ if (!isCNB) {
55112
+ ctx.body = {
55113
+ title: "非 cnb-board 环境",
55114
+ list: []
55115
+ };
55116
+ return true;
55117
+ }
55118
+ return false;
55119
+ };
55120
+ app.route({
55121
+ path: "cnb_board",
55122
+ key: "live",
55123
+ description: "获取cnb-board live的mdContent内容",
55124
+ middleware: ["auth-admin"],
55125
+ metadata: {
55126
+ args: {
55127
+ more: zod_default.boolean().optional().describe("是否获取更多系统信息,默认false")
55128
+ }
55129
+ }
55130
+ }).define(async (ctx) => {
55131
+ const more = ctx.query?.more ?? false;
55132
+ if (notCNBCheck(ctx))
55133
+ return;
55134
+ const list = getLiveMdContent({ more });
55135
+ ctx.body = {
55136
+ title: "开发环境模式配置",
55137
+ list
55138
+ };
55139
+ }).addTo(app);
55140
+ app.route({
55141
+ path: "cnb_board",
55142
+ key: "live_repo_info",
55143
+ description: "获取cnb-board live的repo信息",
55144
+ middleware: ["auth-admin"]
55145
+ }).define(async (ctx) => {
55146
+ const repoSlug = useKey("CNB_REPO_SLUG") || "";
55147
+ const repoName = useKey("CNB_REPO_NAME") || "";
55148
+ const repoId = useKey("CNB_REPO_ID") || "";
55149
+ const repoUrlHttps = useKey("CNB_REPO_UR if (notCNBCheck(ctx)) return;L_HTTPS") || "";
55150
+ if (notCNBCheck(ctx))
55151
+ return;
55152
+ const repoNameFromSlug = repoSlug.split("/").pop() || "";
55153
+ const labels = [
55154
+ {
55155
+ title: "CNB_REPO_SLUG",
55156
+ value: repoSlug,
55157
+ description: "目标仓库路径,格式为 group_slug / repo_name,group_slug / sub_gourp_slug /.../repo_name"
55158
+ },
55159
+ {
55160
+ title: "CNB_REPO_SLUG_LOWERCASE",
55161
+ value: repoSlug.toLowerCase(),
55162
+ description: "目标仓库路径小写格式"
55163
+ },
55164
+ {
55165
+ title: "CNB_REPO_NAME",
55166
+ value: repoName || repoNameFromSlug,
55167
+ description: "目标仓库名称"
55168
+ },
55169
+ {
55170
+ title: "CNB_REPO_NAME_LOWERCASE",
55171
+ value: (repoName || repoNameFromSlug).toLowerCase(),
55172
+ description: "目标仓库名称小写格式"
55173
+ },
55174
+ {
55175
+ title: "CNB_REPO_ID",
55176
+ value: repoId,
55177
+ description: "目标仓库的 id"
55178
+ },
55179
+ {
55180
+ title: "CNB_REPO_URL_HTTPS",
55181
+ value: repoUrlHttps,
55182
+ description: "目标仓库 https 地址"
55183
+ }
55184
+ ];
55185
+ ctx.body = {
55186
+ title: "CNB_BOARD_LIVE_REPO_INFO",
55187
+ list: labels
55188
+ };
55189
+ }).addTo(app);
55190
+ app.route({
55191
+ path: "cnb_board",
55192
+ key: "live_build_info",
55193
+ description: "获取cnb-board live的构建信息",
55194
+ middleware: ["auth-admin"]
55195
+ }).define(async (ctx) => {
55196
+ if (notCNBCheck(ctx))
55197
+ return;
55198
+ const labels = [
55199
+ {
55200
+ title: "CNB_BUILD_ID",
55201
+ value: useKey("CNB_BUILD_ID") || "",
55202
+ description: "当前构建的流水号,全局唯一"
55203
+ },
55204
+ {
55205
+ title: "CNB_BUILD_WEB_URL",
55206
+ value: useKey("CNB_BUILD_WEB_URL") || "",
55207
+ description: "当前构建的日志地址"
55208
+ },
55209
+ {
55210
+ title: "CNB_BUILD_START_TIME",
55211
+ value: useKey("CNB_BUILD_START_TIME") || "",
55212
+ description: "当前构建的开始时间,UTC 格式,示例 2025-08-21T09:13:45.803Z"
55213
+ },
55214
+ {
55215
+ title: "CNB_BUILD_USER",
55216
+ value: useKey("CNB_BUILD_USER") || "",
55217
+ description: "当前构建的触发者用户名"
55218
+ },
55219
+ {
55220
+ title: "CNB_BUILD_USER_NICKNAME",
55221
+ value: useKey("CNB_BUILD_USER_NICKNAME") || "",
55222
+ description: "当前构建的触发者昵称"
55223
+ },
55224
+ {
55225
+ title: "CNB_BUILD_USER_EMAIL",
55226
+ value: useKey("CNB_BUILD_USER_EMAIL") || "",
55227
+ description: "当前构建的触发者邮箱"
55228
+ },
55229
+ {
55230
+ title: "CNB_BUILD_USER_ID",
55231
+ value: useKey("CNB_BUILD_USER_ID") || "",
55232
+ description: "当前构建的触发者 id"
55233
+ },
55234
+ {
55235
+ title: "CNB_BUILD_USER_NPC_SLUG",
55236
+ value: useKey("CNB_BUILD_USER_NPC_SLUG") || "",
55237
+ description: "当前构建若为 NPC 触发,则为 NPC 所属仓库的路径"
55238
+ },
55239
+ {
55240
+ title: "CNB_BUILD_USER_NPC_NAME",
55241
+ value: useKey("CNB_BUILD_USER_NPC_NAME") || "",
55242
+ description: "当前构建若为 NPC 触发,则为 NPC 角色名"
55243
+ },
55244
+ {
55245
+ title: "CNB_BUILD_STAGE_NAME",
55246
+ value: useKey("CNB_BUILD_STAGE_NAME") || "",
55247
+ description: "当前构建的 stage 名称"
55248
+ },
55249
+ {
55250
+ title: "CNB_BUILD_JOB_NAME",
55251
+ value: useKey("CNB_BUILD_JOB_NAME") || "",
55252
+ description: "当前构建的 job 名称"
55253
+ },
55254
+ {
55255
+ title: "CNB_BUILD_JOB_KEY",
55256
+ value: useKey("CNB_BUILD_JOB_KEY") || "",
55257
+ description: "当前构建的 job key,同 stage 下唯一"
55258
+ },
55259
+ {
55260
+ title: "CNB_BUILD_WORKSPACE",
55261
+ value: useKey("CNB_BUILD_WORKSPACE") || "",
55262
+ description: "自定义 shell 脚本执行的工作空间根目录"
55263
+ },
55264
+ {
55265
+ title: "CNB_BUILD_FAILED_MSG",
55266
+ value: useKey("CNB_BUILD_FAILED_MSG") || "",
55267
+ description: "流水线构建失败的错误信息,可在 failStages 中使用"
55268
+ },
55269
+ {
55270
+ title: "CNB_BUILD_FAILED_STAGE_NAME",
55271
+ value: useKey("CNB_BUILD_FAILED_STAGE_NAME") || "",
55272
+ description: "流水线构建失败的 stage 的名称,可在 failStages 中使用"
55273
+ },
55274
+ {
55275
+ title: "CNB_PIPELINE_NAME",
55276
+ value: useKey("CNB_PIPELINE_NAME") || "",
55277
+ description: "当前 pipeline 的 name,没声明时为空"
55278
+ },
55279
+ {
55280
+ title: "CNB_PIPELINE_KEY",
55281
+ value: useKey("CNB_PIPELINE_KEY") || "",
55282
+ description: "当前 pipeline 的索引 key,例如 pipeline-0"
55283
+ },
55284
+ {
55285
+ title: "CNB_PIPELINE_ID",
55286
+ value: useKey("CNB_PIPELINE_ID") || "",
55287
+ description: "当前 pipeline 的 id,全局唯一字符串"
55288
+ },
55289
+ {
55290
+ title: "CNB_PIPELINE_DOCKER_IMAGE",
55291
+ value: useKey("CNB_PIPELINE_DOCKER_IMAGE") || "",
55292
+ description: "当前 pipeline 所使用的 docker image,如:alpine:latest"
55293
+ },
55294
+ {
55295
+ title: "CNB_PIPELINE_STATUS",
55296
+ value: useKey("CNB_PIPELINE_STATUS") || "",
55297
+ description: "当前流水线的构建状态,可在 endStages 中查看,其可能的值包括:success、error、cancel"
55298
+ },
55299
+ {
55300
+ title: "CNB_PIPELINE_MAX_RUN_TIME",
55301
+ value: useKey("CNB_PIPELINE_MAX_RUN_TIME") || "",
55302
+ description: "流水线最大运行时间,单位为毫秒"
55303
+ },
55304
+ {
55305
+ title: "CNB_RUNNER_IP",
55306
+ value: useKey("CNB_RUNNER_IP") || "",
55307
+ description: "当前 pipeline 所在 Runner 的 ip"
55308
+ },
55309
+ {
55310
+ title: "CNB_CPUS",
55311
+ value: useKey("CNB_CPUS") || "",
55312
+ description: "当前构建流水线可以使用的最大 CPU 核数"
55313
+ },
55314
+ {
55315
+ title: "CNB_MEMORY",
55316
+ value: useKey("CNB_MEMORY") || "",
55317
+ description: "当前构建流水线可以使用的最大内存大小,单位为 GiB"
55318
+ },
55319
+ {
55320
+ title: "CNB_IS_RETRY",
55321
+ value: useKey("CNB_IS_RETRY") || "",
55322
+ description: "当前构建是否由 rebuild 触发"
55323
+ },
55324
+ {
55325
+ title: "HUSKY_SKIP_INSTALL",
55326
+ value: useKey("HUSKY_SKIP_INSTALL") || "",
55327
+ description: "兼容 ci 环境下 husky"
55328
+ }
55329
+ ];
55330
+ ctx.body = {
55331
+ title: "CNB_BOARD_LIVE_BUILD_INFO",
55332
+ list: labels
55333
+ };
55334
+ }).addTo(app);
55335
+ app.route({
55336
+ path: "cnb_board",
55337
+ key: "live_pull_info",
55338
+ description: "获取cnb-board live的PR信息",
55339
+ middleware: ["auth-admin"]
55340
+ }).define(async (ctx) => {
55341
+ const labels = [
55342
+ {
55343
+ title: "CNB_PULL_REQUEST",
55344
+ value: useKey("CNB_PULL_REQUEST") || "",
55345
+ description: "对于由 pull_request、pull_request.update、pull_request.target 触发的构建,值为 true,否则为 false"
55346
+ },
55347
+ {
55348
+ title: "CNB_PULL_REQUEST_LIKE",
55349
+ value: useKey("CNB_PULL_REQUEST_LIKE") || "",
55350
+ description: "对于由 合并类事件 触发的构建,值为 true,否则为 false"
55351
+ },
55352
+ {
55353
+ title: "CNB_PULL_REQUEST_PROPOSER",
55354
+ value: useKey("CNB_PULL_REQUEST_PROPOSER") || "",
55355
+ description: "对于由 合并类事件 触发的构建,值为提出 PR 者名称,否则为空字符串"
55356
+ },
55357
+ {
55358
+ title: "CNB_PULL_REQUEST_TITLE",
55359
+ value: useKey("CNB_PULL_REQUEST_TITLE") || "",
55360
+ description: "对于由 合并类事件 触发的构建,值为提 PR 时候填写的标题,否则为空字符串"
55361
+ },
55362
+ {
55363
+ title: "CNB_PULL_REQUEST_BRANCH",
55364
+ value: useKey("CNB_PULL_REQUEST_BRANCH") || "",
55365
+ description: "对于由 合并类事件 触发的构建,值为发起 PR 的源分支名称,否则为空字符串"
55366
+ },
55367
+ {
55368
+ title: "CNB_PULL_REQUEST_SHA",
55369
+ value: useKey("CNB_PULL_REQUEST_SHA") || "",
55370
+ description: "对于由 合并类事件 触发的构建,值为当前 PR 源分支最新的提交 sha,否则为空字符串"
55371
+ },
55372
+ {
55373
+ title: "CNB_PULL_REQUEST_TARGET_SHA",
55374
+ value: useKey("CNB_PULL_REQUEST_TARGET_SHA") || "",
55375
+ description: "对于由 合并类事件 触发的构建,值为当前 PR 目标分支最新的提交 sha,否则为空字符串"
55376
+ },
55377
+ {
55378
+ title: "CNB_PULL_REQUEST_MERGE_SHA",
55379
+ value: useKey("CNB_PULL_REQUEST_MERGE_SHA") || "",
55380
+ description: "对于由 pull_request.merged 触发的构建,值为合并后的 sha;对于 pull_request 等触发的构建,值为预合并后的 sha,否则为空字符串"
55381
+ },
55382
+ {
55383
+ title: "CNB_PULL_REQUEST_SLUG",
55384
+ value: useKey("CNB_PULL_REQUEST_SLUG") || "",
55385
+ description: "对于由 合并类事件 触发的构建,值为源仓库的仓库 slug,如 group_slug/repo_name,否则为空字符串"
55386
+ },
55387
+ {
55388
+ title: "CNB_PULL_REQUEST_ACTION",
55389
+ value: useKey("CNB_PULL_REQUEST_ACTION") || "",
55390
+ description: "对于由 合并类事件 触发的构建,可能的值有:created(新建PR)、code_update(源分支push)、status_update(评审通过或CI状态变更),否则为空字符串"
55391
+ },
55392
+ {
55393
+ title: "CNB_PULL_REQUEST_ID",
55394
+ value: useKey("CNB_PULL_REQUEST_ID") || "",
55395
+ description: "对于由 合并类事件 触发的构建,值为当前或者关联 PR 的全局唯一 id,否则为空字符串"
55396
+ },
55397
+ {
55398
+ title: "CNB_PULL_REQUEST_IID",
55399
+ value: useKey("CNB_PULL_REQUEST_IID") || "",
55400
+ description: "对于由 合并类事件 触发的构建,值为当前或者关联 PR 在仓库中的编号 iid,否则为空字符串"
55401
+ },
55402
+ {
55403
+ title: "CNB_PULL_REQUEST_REVIEWERS",
55404
+ value: useKey("CNB_PULL_REQUEST_REVIEWERS") || "",
55405
+ description: "对于由 合并类事件 触发的构建,值为评审人列表,多个以 , 分隔,否则为空字符串"
55406
+ },
55407
+ {
55408
+ title: "CNB_PULL_REQUEST_REVIEW_STATE",
55409
+ value: useKey("CNB_PULL_REQUEST_REVIEW_STATE") || "",
55410
+ description: "对于由 合并类事件 触发的构建,有评审者且有人通过评审为 approve,有评审者但无人通过评审为 unapprove,否则为空字符串"
55411
+ },
55412
+ {
55413
+ title: "CNB_REVIEW_REVIEWED_BY",
55414
+ value: useKey("CNB_REVIEW_REVIEWED_BY") || "",
55415
+ description: "对于由 合并类事件 触发的构建,值为同意评审的评审人列表,多个以 , 分隔,否则为空字符串"
55416
+ },
55417
+ {
55418
+ title: "CNB_REVIEW_LAST_REVIEWED_BY",
55419
+ value: useKey("CNB_REVIEW_LAST_REVIEWED_BY") || "",
55420
+ description: "对于由 合并类事件 触发的构建,值为最后一个同意评审的评审人,否则为空字符串"
55421
+ },
55422
+ {
55423
+ title: "CNB_PULL_REQUEST_IS_WIP",
55424
+ value: useKey("CNB_PULL_REQUEST_IS_WIP") || "",
55425
+ description: "对于由 合并类事件 触发的构建,值为 true、false,表示 PR 是否被设置为 [WIP],否则为空字符串"
55426
+ }
55427
+ ];
55428
+ ctx.body = {
55429
+ title: "CNB_BOARD_LIVE_PULL_INFO",
55430
+ list: labels
55431
+ };
55432
+ }).addTo(app);
55433
+ app.route({
55434
+ path: "cnb_board",
55435
+ key: "live_npc_info",
55436
+ description: "获取cnb-board live的NPC信息",
55437
+ middleware: ["auth-admin"]
55438
+ }).define(async (ctx) => {
55439
+ if (notCNBCheck(ctx))
55440
+ return;
55441
+ const labels = [
55442
+ {
55443
+ title: "CNB_NPC_SLUG",
55444
+ value: useKey("CNB_NPC_SLUG") || "",
55445
+ description: "对于 @ 知识库角色触发的 NPC 事件,值为 NPC 所属仓库路径,否则为空字符串"
55446
+ },
55447
+ {
55448
+ title: "CNB_NPC_NAME",
55449
+ value: useKey("CNB_NPC_NAME") || "",
55450
+ description: "对于 NPC 事件触发的构建,值为 NPC 角色名,否则为空字符串"
55451
+ },
55452
+ {
55453
+ title: "CNB_NPC_SHA",
55454
+ value: useKey("CNB_NPC_SHA") || "",
55455
+ description: "对于 @ 知识库角色触发的 NPC 事件,值为 NPC 所属仓库默认分支最新提交的 sha,否则为空字符串"
55456
+ },
55457
+ {
55458
+ title: "CNB_NPC_PROMPT",
55459
+ value: useKey("CNB_NPC_PROMPT") || "",
55460
+ description: "对于 @ 知识库角色触发的 NPC 事件,值为 NPC 角色 Prompt,否则为空字符串"
55461
+ },
55462
+ {
55463
+ title: "CNB_NPC_AVATAR",
55464
+ value: useKey("CNB_NPC_AVATAR") || "",
55465
+ description: "对于 @ 知识库角色触发的 NPC 事件,值为 NPC 角色头像,否则为空字符串"
55466
+ },
55467
+ {
55468
+ title: "CNB_NPC_ENABLE_THINKING",
55469
+ value: useKey("CNB_NPC_ENABLE_THINKING") || "",
55470
+ description: "对于 @npc 事件触发的构建,值为 NPC 角色是否开启思考,否则为空字符串"
55471
+ }
55472
+ ];
55473
+ ctx.body = {
55474
+ title: "CNB_BOARD_LIVE_NPC_INFO",
55475
+ list: labels
55476
+ };
55477
+ }).addTo(app);
55478
+ app.route({
55479
+ path: "cnb_board",
55480
+ key: "live_comment_info",
55481
+ description: "获取cnb-board live的评论信息",
55482
+ middleware: ["auth-admin"]
55483
+ }).define(async (ctx) => {
55484
+ if (notCNBCheck(ctx))
55485
+ return;
55486
+ const labels = [
55487
+ {
55488
+ title: "CNB_COMMENT_ID",
55489
+ value: useKey("CNB_COMMENT_ID") || "",
55490
+ description: "对于评论事件触发的构建,值为评论全局唯一 ID,否则为空字符串"
55491
+ },
55492
+ {
55493
+ title: "CNB_COMMENT_BODY",
55494
+ value: useKey("CNB_COMMENT_BODY") || "",
55495
+ description: "对于评论事件触发的构建,值为评论内容,否则为空字符串"
55496
+ },
55497
+ {
55498
+ title: "CNB_COMMENT_TYPE",
55499
+ value: useKey("CNB_COMMENT_TYPE") || "",
55500
+ description: "对于 PR 代码评审评论,值为 diff_note;对于 PR 非代码评审评论以及 Issue 评论,值为 note;否则为空字符串"
55501
+ },
55502
+ {
55503
+ title: "CNB_COMMENT_FILE_PATH",
55504
+ value: useKey("CNB_COMMENT_FILE_PATH") || "",
55505
+ description: "对于 PR 代码评审评论,值为评论所在文件,否则为空字符串"
55506
+ },
55507
+ {
55508
+ title: "CNB_COMMENT_RANGE",
55509
+ value: useKey("CNB_COMMENT_RANGE") || "",
55510
+ description: "对于 PR 代码评审评论,值为评论所在代码行。如,单行为 L12,多行为 L13-L16,否则为空字符串"
55511
+ },
55512
+ {
55513
+ title: "CNB_REVIEW_ID",
55514
+ value: useKey("CNB_REVIEW_ID") || "",
55515
+ description: "对于 PR 代码评审,值为评审 ID,否则为空字符串"
55516
+ }
55517
+ ];
55518
+ ctx.body = {
55519
+ title: "CNB_BOARD_LIVE_COMMENT_INFO",
55520
+ list: labels
55521
+ };
55522
+ }).addTo(app);
55523
+
55524
+ // agent/routes/cnb-board/index.ts
55525
+ import { spawnSync } from "node:child_process";
55526
+ var execCommand = (command, options = {}) => {
55527
+ const { cwd } = options;
55528
+ return spawnSync(command, {
55529
+ stdio: "inherit",
55530
+ shell: true,
55531
+ cwd,
55532
+ env: process.env
55533
+ });
55534
+ };
55535
+ app.route({
55536
+ path: "cnb-board",
55537
+ key: "is-cnb-board",
55538
+ description: "检查是否是 cnb-board 环境",
55539
+ middleware: ["auth-admin"]
55540
+ }).define(async (ctx) => {
55541
+ const isCNB = useKey("CNB");
55542
+ ctx.body = {
55543
+ isCNB: !!isCNB
55544
+ };
55545
+ }).addTo(app);
55546
+ app.route({
55547
+ path: "cnb-board",
55548
+ key: "exit",
55549
+ description: "cnb的工作环境退出程序",
55550
+ middleware: ["auth-admin"]
55551
+ }).define(async (ctx) => {
55552
+ const cmd = "kill 1";
55553
+ execCommand(cmd);
55554
+ }).addTo(app);
55555
+
54457
55556
  // agent/routes/index.ts
54458
55557
  var checkAppId = (ctx, appId) => {
54459
55558
  const _appId = ctx?.app?.appId;
@@ -54465,25 +55564,23 @@ var checkAppId = (ctx, appId) => {
54465
55564
  }
54466
55565
  return false;
54467
55566
  };
54468
- if (!app.hasRoute("auth")) {
54469
- app.route({
54470
- id: "auth",
54471
- path: "auth"
54472
- }).define(async (ctx) => {
54473
- if (checkAppId(ctx, app.appId)) {
54474
- return;
54475
- }
54476
- }).addTo(app);
54477
- app.route({
54478
- id: "admin-auth",
54479
- path: "admin-auth",
54480
- middleware: ["auth"]
54481
- }).define(async (ctx) => {
54482
- if (checkAppId(ctx, app.appId)) {
54483
- return;
54484
- }
54485
- }).addTo(app);
54486
- }
55567
+ app.route({
55568
+ id: "auth",
55569
+ path: "auth"
55570
+ }).define(async (ctx) => {
55571
+ if (checkAppId(ctx, app.appId)) {
55572
+ return;
55573
+ }
55574
+ }).addTo(app, { overwrite: false });
55575
+ app.route({
55576
+ id: "auth-admin",
55577
+ path: "auth-admin",
55578
+ middleware: ["auth"]
55579
+ }).define(async (ctx) => {
55580
+ if (checkAppId(ctx, app.appId)) {
55581
+ return;
55582
+ }
55583
+ }).addTo(app, { overwrite: false });
54487
55584
  export {
54488
55585
  config2 as config,
54489
55586
  cnb,