@kevisual/cnb 0.0.73 → 0.0.74

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  import { QueryRouterServer as App } from '@kevisual/router'
2
- import { use, useContextKey } from '@kevisual/context'
2
+ import { useTrimKey, useContextKey } from '@kevisual/context'
3
3
  import { useKey } from '@kevisual/use-config'
4
4
  import { CNB } from '../src/index.ts';
5
5
  import { CNBManager } from './modules/cnb-manager.ts'
@@ -10,7 +10,7 @@ export const cnbManager = new CNBManager()
10
10
  // CNB_TOKEN 是流水线自己就有的变量,但是权限比较小
11
11
  const token = useKey('CNB_API_KEY') as string || useKey('CNB_TOKEN') as string
12
12
  // cookie 变量是可选的
13
- const cookie = useKey('CNB_COOKIE') as string
13
+ const cookie = useTrimKey(useKey('CNB_COOKIE') as string) as string
14
14
  const aiRepo = useKey('CNB_AI_REPO') as string || useKey('CNB_REPO_SLUG_LOWERCASE') as string
15
15
  try {
16
16
  cnbManager.addCNB({
package/dist/cli.js CHANGED
@@ -38346,7 +38346,7 @@ var import_sender = __toESM2(require_sender(), 1);
38346
38346
  var import_websocket = __toESM2(require_websocket(), 1);
38347
38347
  var import_websocket_server = __toESM2(require_websocket_server(), 1);
38348
38348
 
38349
- // ../../node_modules/.pnpm/@kevisual+context@0.0.8/node_modules/@kevisual/context/dist/app.js
38349
+ // ../../node_modules/.pnpm/@kevisual+context@0.0.10/node_modules/@kevisual/context/dist/app.js
38350
38350
  var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
38351
38351
  var isBrowser22 = typeof window !== "undefined" && typeof window.document !== "undefined";
38352
38352
  function getDefaultExportFromCjs(x) {
@@ -38927,6 +38927,30 @@ var useKey = (envKey, initKey = "context") => {
38927
38927
  }
38928
38928
  return null;
38929
38929
  };
38930
+ var useTrimKey = (value, opts) => {
38931
+ if (!value)
38932
+ return value;
38933
+ const trimed = value.trim();
38934
+ const trimQuotes = opts?.trimQuotes ?? true;
38935
+ const boolean4 = opts?.boolean ?? true;
38936
+ const number4 = opts?.number ?? true;
38937
+ if (trimQuotes && trimed.startsWith('"') && trimed.endsWith('"')) {
38938
+ value = trimed.slice(1, -1);
38939
+ }
38940
+ if (trimQuotes && trimed.startsWith("'") && trimed.endsWith("'")) {
38941
+ value = trimed.slice(1, -1);
38942
+ }
38943
+ if (boolean4 && trimed.toLowerCase() === "true") {
38944
+ return true;
38945
+ }
38946
+ if (boolean4 && trimed.toLowerCase() === "false") {
38947
+ return false;
38948
+ }
38949
+ if (number4 && !isNaN(Number(trimed))) {
38950
+ return Number(trimed);
38951
+ }
38952
+ return value;
38953
+ };
38930
38954
 
38931
38955
  // ../../node_modules/.pnpm/@kevisual+use-config@1.0.30_dotenv@17.4.1/node_modules/@kevisual/use-config/dist/app.js
38932
38956
  import { createRequire as createRequire3 } from "node:module";
@@ -62647,7 +62671,7 @@ class CNBManager {
62647
62671
  // agent/app.ts
62648
62672
  var cnbManager = new CNBManager;
62649
62673
  var token = useKey2("CNB_API_KEY") || useKey2("CNB_TOKEN");
62650
- var cookie = useKey2("CNB_COOKIE");
62674
+ var cookie = useTrimKey(useKey2("CNB_COOKIE"));
62651
62675
  var aiRepo = useKey2("CNB_AI_REPO") || useKey2("CNB_REPO_SLUG_LOWERCASE");
62652
62676
  try {
62653
62677
  cnbManager.addCNB({
package/dist/npc.js CHANGED
@@ -36253,7 +36253,7 @@ var import_sender = __toESM2(require_sender(), 1);
36253
36253
  var import_websocket = __toESM2(require_websocket(), 1);
36254
36254
  var import_websocket_server = __toESM2(require_websocket_server(), 1);
36255
36255
 
36256
- // ../../node_modules/.pnpm/@kevisual+context@0.0.8/node_modules/@kevisual/context/dist/app.js
36256
+ // ../../node_modules/.pnpm/@kevisual+context@0.0.10/node_modules/@kevisual/context/dist/app.js
36257
36257
  var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
36258
36258
  var isBrowser22 = typeof window !== "undefined" && typeof window.document !== "undefined";
36259
36259
  function getDefaultExportFromCjs(x) {
@@ -36834,6 +36834,30 @@ var useKey = (envKey, initKey = "context") => {
36834
36834
  }
36835
36835
  return null;
36836
36836
  };
36837
+ var useTrimKey = (value, opts) => {
36838
+ if (!value)
36839
+ return value;
36840
+ const trimed = value.trim();
36841
+ const trimQuotes = opts?.trimQuotes ?? true;
36842
+ const boolean4 = opts?.boolean ?? true;
36843
+ const number4 = opts?.number ?? true;
36844
+ if (trimQuotes && trimed.startsWith('"') && trimed.endsWith('"')) {
36845
+ value = trimed.slice(1, -1);
36846
+ }
36847
+ if (trimQuotes && trimed.startsWith("'") && trimed.endsWith("'")) {
36848
+ value = trimed.slice(1, -1);
36849
+ }
36850
+ if (boolean4 && trimed.toLowerCase() === "true") {
36851
+ return true;
36852
+ }
36853
+ if (boolean4 && trimed.toLowerCase() === "false") {
36854
+ return false;
36855
+ }
36856
+ if (number4 && !isNaN(Number(trimed))) {
36857
+ return Number(trimed);
36858
+ }
36859
+ return value;
36860
+ };
36837
36861
 
36838
36862
  // ../../node_modules/.pnpm/@kevisual+use-config@1.0.30_dotenv@17.4.1/node_modules/@kevisual/use-config/dist/app.js
36839
36863
  import { createRequire as createRequire3 } from "node:module";
@@ -60588,7 +60612,7 @@ class CNBManager {
60588
60612
  // agent/app.ts
60589
60613
  var cnbManager = new CNBManager;
60590
60614
  var token = useKey2("CNB_API_KEY") || useKey2("CNB_TOKEN");
60591
- var cookie = useKey2("CNB_COOKIE");
60615
+ var cookie = useTrimKey(useKey2("CNB_COOKIE"));
60592
60616
  var aiRepo = useKey2("CNB_AI_REPO") || useKey2("CNB_REPO_SLUG_LOWERCASE");
60593
60617
  try {
60594
60618
  cnbManager.addCNB({
package/dist/opencode.js CHANGED
@@ -36253,7 +36253,7 @@ var import_sender = __toESM2(require_sender(), 1);
36253
36253
  var import_websocket = __toESM2(require_websocket(), 1);
36254
36254
  var import_websocket_server = __toESM2(require_websocket_server(), 1);
36255
36255
 
36256
- // ../../node_modules/.pnpm/@kevisual+context@0.0.8/node_modules/@kevisual/context/dist/app.js
36256
+ // ../../node_modules/.pnpm/@kevisual+context@0.0.10/node_modules/@kevisual/context/dist/app.js
36257
36257
  var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
36258
36258
  var isBrowser22 = typeof window !== "undefined" && typeof window.document !== "undefined";
36259
36259
  function getDefaultExportFromCjs(x) {
@@ -36834,6 +36834,30 @@ var useKey = (envKey, initKey = "context") => {
36834
36834
  }
36835
36835
  return null;
36836
36836
  };
36837
+ var useTrimKey = (value, opts) => {
36838
+ if (!value)
36839
+ return value;
36840
+ const trimed = value.trim();
36841
+ const trimQuotes = opts?.trimQuotes ?? true;
36842
+ const boolean4 = opts?.boolean ?? true;
36843
+ const number4 = opts?.number ?? true;
36844
+ if (trimQuotes && trimed.startsWith('"') && trimed.endsWith('"')) {
36845
+ value = trimed.slice(1, -1);
36846
+ }
36847
+ if (trimQuotes && trimed.startsWith("'") && trimed.endsWith("'")) {
36848
+ value = trimed.slice(1, -1);
36849
+ }
36850
+ if (boolean4 && trimed.toLowerCase() === "true") {
36851
+ return true;
36852
+ }
36853
+ if (boolean4 && trimed.toLowerCase() === "false") {
36854
+ return false;
36855
+ }
36856
+ if (number4 && !isNaN(Number(trimed))) {
36857
+ return Number(trimed);
36858
+ }
36859
+ return value;
36860
+ };
36837
36861
 
36838
36862
  // ../../node_modules/.pnpm/@kevisual+use-config@1.0.30_dotenv@17.4.1/node_modules/@kevisual/use-config/dist/app.js
36839
36863
  import { createRequire as createRequire3 } from "node:module";
@@ -60554,7 +60578,7 @@ class CNBManager {
60554
60578
  // agent/app.ts
60555
60579
  var cnbManager = new CNBManager;
60556
60580
  var token = useKey2("CNB_API_KEY") || useKey2("CNB_TOKEN");
60557
- var cookie = useKey2("CNB_COOKIE");
60581
+ var cookie = useTrimKey(useKey2("CNB_COOKIE"));
60558
60582
  var aiRepo = useKey2("CNB_AI_REPO") || useKey2("CNB_REPO_SLUG_LOWERCASE");
60559
60583
  try {
60560
60584
  cnbManager.addCNB({
@@ -71692,7 +71716,7 @@ var useContextKey3 = (key, init, opts) => {
71692
71716
  }
71693
71717
  return useEnvKey3(key, init, "context", opts);
71694
71718
  };
71695
- var use4 = useContextKey3;
71719
+ var use3 = useContextKey3;
71696
71720
  var useConfigKey3 = (key, init, opts) => {
71697
71721
  if (opts?.isNew) {
71698
71722
  return useEnvKeyNew3(key, "config", { getNew: true, init, ...opts });
@@ -71710,8 +71734,8 @@ class InitEnv3 {
71710
71734
  InitEnv3.isInit = true;
71711
71735
  gt3.useConfigKey = useConfigKey3;
71712
71736
  gt3.useContextKey = useContextKey3;
71713
- gt3.use = use4;
71714
- gt3.webEnv = { useConfigKey: useConfigKey3, useContextKey: useContextKey3, use: use4 };
71737
+ gt3.use = use3;
71738
+ gt3.webEnv = { useConfigKey: useConfigKey3, useContextKey: useContextKey3, use: use3 };
71715
71739
  load && (gt3.Load = BaseLoad3);
71716
71740
  }
71717
71741
  }
package/dist/routes.js CHANGED
@@ -36253,7 +36253,7 @@ var import_sender = __toESM2(require_sender(), 1);
36253
36253
  var import_websocket = __toESM2(require_websocket(), 1);
36254
36254
  var import_websocket_server = __toESM2(require_websocket_server(), 1);
36255
36255
 
36256
- // ../../node_modules/.pnpm/@kevisual+context@0.0.8/node_modules/@kevisual/context/dist/app.js
36256
+ // ../../node_modules/.pnpm/@kevisual+context@0.0.10/node_modules/@kevisual/context/dist/app.js
36257
36257
  var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
36258
36258
  var isBrowser22 = typeof window !== "undefined" && typeof window.document !== "undefined";
36259
36259
  function getDefaultExportFromCjs(x) {
@@ -36834,6 +36834,30 @@ var useKey = (envKey, initKey = "context") => {
36834
36834
  }
36835
36835
  return null;
36836
36836
  };
36837
+ var useTrimKey = (value, opts) => {
36838
+ if (!value)
36839
+ return value;
36840
+ const trimed = value.trim();
36841
+ const trimQuotes = opts?.trimQuotes ?? true;
36842
+ const boolean4 = opts?.boolean ?? true;
36843
+ const number4 = opts?.number ?? true;
36844
+ if (trimQuotes && trimed.startsWith('"') && trimed.endsWith('"')) {
36845
+ value = trimed.slice(1, -1);
36846
+ }
36847
+ if (trimQuotes && trimed.startsWith("'") && trimed.endsWith("'")) {
36848
+ value = trimed.slice(1, -1);
36849
+ }
36850
+ if (boolean4 && trimed.toLowerCase() === "true") {
36851
+ return true;
36852
+ }
36853
+ if (boolean4 && trimed.toLowerCase() === "false") {
36854
+ return false;
36855
+ }
36856
+ if (number4 && !isNaN(Number(trimed))) {
36857
+ return Number(trimed);
36858
+ }
36859
+ return value;
36860
+ };
36837
36861
 
36838
36862
  // ../../node_modules/.pnpm/@kevisual+use-config@1.0.30_dotenv@17.4.1/node_modules/@kevisual/use-config/dist/app.js
36839
36863
  import { createRequire as createRequire3 } from "node:module";
@@ -60554,7 +60578,7 @@ class CNBManager {
60554
60578
  // agent/app.ts
60555
60579
  var cnbManager = new CNBManager;
60556
60580
  var token = useKey2("CNB_API_KEY") || useKey2("CNB_TOKEN");
60557
- var cookie = useKey2("CNB_COOKIE");
60581
+ var cookie = useTrimKey(useKey2("CNB_COOKIE"));
60558
60582
  var aiRepo = useKey2("CNB_AI_REPO") || useKey2("CNB_REPO_SLUG_LOWERCASE");
60559
60583
  try {
60560
60584
  cnbManager.addCNB({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kevisual/cnb",
3
- "version": "0.0.73",
3
+ "version": "0.0.74",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "basename": "/root/cnb",
@@ -37,15 +37,15 @@
37
37
  "@kevisual/ai": "^0.0.30",
38
38
  "@kevisual/api": "^0.0.67",
39
39
  "@kevisual/code-builder": "^0.0.7",
40
- "@kevisual/context": "^0.0.8",
40
+ "@kevisual/context": "^0.0.10",
41
41
  "@kevisual/dts": "^0.0.4",
42
42
  "@kevisual/remote-app": "^0.0.7",
43
43
  "@kevisual/types": "^0.0.14",
44
44
  "@opencode-ai/plugin": "^1.4.3",
45
- "@types/bun": "^1.3.11",
45
+ "@types/bun": "^1.3.12",
46
46
  "@types/node": "^25.6.0",
47
47
  "@types/ws": "^8.18.1",
48
- "ai": "^6.0.156",
48
+ "ai": "^6.0.158",
49
49
  "commander": "^14.0.3",
50
50
  "dayjs": "^1.11.20",
51
51
  "dotenv": "^17.4.1",