@kevisual/cnb 0.0.34 → 0.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/opencode.js CHANGED
@@ -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.85/node_modules/@kevisual/router/dist/router.js
319
+ // node_modules/.pnpm/@kevisual+router@0.0.88/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";
@@ -17597,6 +17597,10 @@ class QueryRouterServer extends QueryRouter {
17597
17597
  }
17598
17598
  return super.run(msg, ctx);
17599
17599
  }
17600
+ async runAction(api2, payload, ctx) {
17601
+ const { path, key, id } = api2;
17602
+ return this.run({ path, key, id, payload }, ctx);
17603
+ }
17600
17604
  }
17601
17605
  var isNode = typeof process !== "undefined" && process.versions != null && process.versions.node != null;
17602
17606
  var isBrowser = typeof window !== "undefined" && typeof document !== "undefined" && typeof document.createElement === "function";
@@ -33935,7 +33939,7 @@ config3(en_default2());
33935
33939
  // node_modules/.pnpm/zod@4.3.6/node_modules/zod/index.js
33936
33940
  var zod_default = exports_external2;
33937
33941
 
33938
- // node_modules/.pnpm/@opencode-ai+plugin@1.2.16/node_modules/@opencode-ai/plugin/dist/tool.js
33942
+ // node_modules/.pnpm/@opencode-ai+plugin@1.2.20/node_modules/@opencode-ai/plugin/dist/tool.js
33939
33943
  function tool2(input) {
33940
33944
  return input;
33941
33945
  }
@@ -33946,7 +33950,7 @@ app.route({
33946
33950
  path: "cnb",
33947
33951
  key: "user-check",
33948
33952
  description: "检查用户登录状态,参数checkToken,default true; checkCookie, default false",
33949
- middleware: ["admin-auth"],
33953
+ middleware: ["auth-admin"],
33950
33954
  metadata: {
33951
33955
  tags: ["opencode"],
33952
33956
  ...createSkill({
@@ -33991,7 +33995,7 @@ app.route({
33991
33995
  path: "cnb",
33992
33996
  key: "list-repos",
33993
33997
  description: "列出我的代码仓库",
33994
- middleware: ["admin-auth"],
33998
+ middleware: ["auth-admin"],
33995
33999
  metadata: {
33996
34000
  tags: ["opencode"],
33997
34001
  ...createSkill({
@@ -34032,7 +34036,7 @@ app.route({
34032
34036
  path: "cnb",
34033
34037
  key: "create-repo",
34034
34038
  description: "创建代码仓库, 参数name, visibility, description",
34035
- middleware: ["admin-auth"],
34039
+ middleware: ["auth-admin"],
34036
34040
  metadata: {
34037
34041
  tags: ["opencode"],
34038
34042
  ...createSkill({
@@ -34068,8 +34072,8 @@ app.route({
34068
34072
  app.route({
34069
34073
  path: "cnb",
34070
34074
  key: "create-repo-file",
34071
- description: "在代码仓库中创建文件, repoName, filePath, content, encoding",
34072
- middleware: ["admin-auth"],
34075
+ description: "在代码仓库中创建文件, repoName, filePath, content, encoding。使用CNB_COOKIE进行鉴权",
34076
+ middleware: ["auth-admin"],
34073
34077
  metadata: {
34074
34078
  tags: ["opencode"],
34075
34079
  ...createSkill({
@@ -34104,7 +34108,7 @@ app.route({
34104
34108
  path: "cnb",
34105
34109
  key: "delete-repo",
34106
34110
  description: "删除代码仓库, 参数name",
34107
- middleware: ["admin-auth"],
34111
+ middleware: ["auth-admin"],
34108
34112
  metadata: {
34109
34113
  tags: ["opencode"],
34110
34114
  ...createSkill({
@@ -34130,7 +34134,7 @@ app.route({
34130
34134
  path: "cnb",
34131
34135
  key: "clean-closed-workspace",
34132
34136
  description: "批量删除已停止的cnb工作空间",
34133
- middleware: ["admin-auth"],
34137
+ middleware: ["auth-admin"],
34134
34138
  metadata: {
34135
34139
  tags: ["opencode"],
34136
34140
  ...createSkill({
@@ -34140,7 +34144,7 @@ app.route({
34140
34144
  })
34141
34145
  }
34142
34146
  }).define(async (ctx) => {
34143
- const closedWorkspaces = await cnb.workspace.list({ status: "closed" });
34147
+ const closedWorkspaces = await cnb.workspace.list({ status: "closed", pageSize: 100 });
34144
34148
  if (closedWorkspaces.code !== 200) {
34145
34149
  ctx.throw(500, "获取已关闭工作空间列表失败");
34146
34150
  }
@@ -34259,7 +34263,7 @@ app.route({
34259
34263
  path: "cnb",
34260
34264
  key: "keep-workspace-alive",
34261
34265
  description: "保持工作空间存活技能,参数repo:代码仓库路径,例如 user/repo,pipelineId:流水线ID,例如 cnb-708-1ji9sog7o-001",
34262
- middleware: ["admin-auth"],
34266
+ middleware: ["auth-admin"],
34263
34267
  metadata: {
34264
34268
  tags: [],
34265
34269
  ...{
@@ -34297,7 +34301,7 @@ app.route({
34297
34301
  path: "cnb",
34298
34302
  key: "stop-keep-workspace-alive",
34299
34303
  description: "停止保持工作空间存活技能, 参数repo:代码仓库路径,例如 user/repo,pipelineId:流水线ID,例如 cnb-708-1ji9sog7o-001",
34300
- middleware: ["admin-auth"],
34304
+ middleware: ["auth-admin"],
34301
34305
  metadata: {
34302
34306
  tags: [],
34303
34307
  ...{
@@ -34320,7 +34324,7 @@ app.route({
34320
34324
  path: "cnb",
34321
34325
  key: "keep-alive-current-workspace",
34322
34326
  description: "保持当前工作空间存活技能",
34323
- middleware: ["admin-auth"],
34327
+ middleware: ["auth-admin"],
34324
34328
  metadata: {
34325
34329
  tags: ["opencode"],
34326
34330
  skill: "keep-alive-current-workspace",
@@ -34342,7 +34346,7 @@ app.route({
34342
34346
  path: "cnb",
34343
34347
  key: "start-workspace",
34344
34348
  description: "启动开发工作空间, 参数 repo",
34345
- middleware: ["admin-auth"],
34349
+ middleware: ["auth-admin"],
34346
34350
  metadata: {
34347
34351
  tags: ["opencode"],
34348
34352
  ...createSkill({
@@ -34373,7 +34377,7 @@ app.route({
34373
34377
  path: "cnb",
34374
34378
  key: "list-workspace",
34375
34379
  description: "获取cnb开发工作空间列表,可选参数 status=running 获取运行中的环境",
34376
- middleware: ["admin-auth"],
34380
+ middleware: ["auth-admin"],
34377
34381
  metadata: {
34378
34382
  tags: ["opencode"],
34379
34383
  ...createSkill({
@@ -34402,7 +34406,7 @@ app.route({
34402
34406
  path: "cnb",
34403
34407
  key: "get-workspace",
34404
34408
  description: "获取工作空间详情,通过 repo 和 sn 获取",
34405
- middleware: ["admin-auth"],
34409
+ middleware: ["auth-admin"],
34406
34410
  metadata: {
34407
34411
  tags: ["opencode"],
34408
34412
  ...createSkill({
@@ -34431,7 +34435,7 @@ app.route({
34431
34435
  path: "cnb",
34432
34436
  key: "delete-workspace",
34433
34437
  description: "删除工作空间,通过 pipelineId 或 sn",
34434
- middleware: ["admin-auth"],
34438
+ middleware: ["auth-admin"],
34435
34439
  metadata: {
34436
34440
  tags: ["opencode"],
34437
34441
  ...createSkill({
@@ -34468,7 +34472,7 @@ app.route({
34468
34472
  path: "cnb",
34469
34473
  key: "stop-workspace",
34470
34474
  description: "停止工作空间,通过 pipelineId 或 sn",
34471
- middleware: ["admin-auth"],
34475
+ middleware: ["auth-admin"],
34472
34476
  metadata: {
34473
34477
  tags: ["opencode"],
34474
34478
  ...createSkill({
@@ -34496,7 +34500,7 @@ app.route({
34496
34500
  path: "call",
34497
34501
  key: "",
34498
34502
  description: "调用",
34499
- middleware: ["admin-auth"],
34503
+ middleware: ["auth-admin"],
34500
34504
  metadata: {
34501
34505
  tags: ["opencode"],
34502
34506
  ...createSkill({
@@ -34545,7 +34549,7 @@ app.route({
34545
34549
  path: "cnb",
34546
34550
  key: "get-cnb-port-uri",
34547
34551
  description: "获取当前cnb工作空间的port代理uri",
34548
- middleware: ["admin-auth"],
34552
+ middleware: ["auth-admin"],
34549
34553
  metadata: {
34550
34554
  tags: ["opencode"],
34551
34555
  ...createSkill({
@@ -34553,12 +34557,12 @@ app.route({
34553
34557
  title: "获取当前cnb工作空间的port代理uri",
34554
34558
  summary: "获取当前cnb工作空间的port代理uri,用于端口转发",
34555
34559
  args: {
34556
- port: tool.schema.number().optional().describe("端口号,默认为4096")
34560
+ port: tool.schema.number().optional().describe("端口号,默认为51515")
34557
34561
  }
34558
34562
  })
34559
34563
  }
34560
34564
  }).define(async (ctx) => {
34561
- const port = ctx.query?.port || 4096;
34565
+ const port = ctx.query?.port || 51515;
34562
34566
  const uri = CNB_ENV?.CNB_VSCODE_PROXY_URI || "";
34563
34567
  const finalUri = uri.replace("{{port}}", port.toString());
34564
34568
  let content = `
@@ -34570,7 +34574,7 @@ app.route({
34570
34574
  path: "cnb",
34571
34575
  key: "get-cnb-vscode-uri",
34572
34576
  description: "获取当前cnb工作空间的vscode代理uri, 包括多种访问方式, 如web、vscode、codebuddy、cursor、ssh",
34573
- middleware: ["admin-auth"],
34577
+ middleware: ["auth-admin"],
34574
34578
  metadata: {
34575
34579
  tags: ["opencode"],
34576
34580
  ...createSkill({
@@ -34631,7 +34635,7 @@ app.route({
34631
34635
  path: "cnb",
34632
34636
  key: "set-cnb-cookie",
34633
34637
  description: "设置当前cnb工作空间的cookie环境变量",
34634
- middleware: ["admin-auth"],
34638
+ middleware: ["auth-admin"],
34635
34639
  metadata: {
34636
34640
  tags: ["opencode"],
34637
34641
  ...createSkill({
@@ -34656,7 +34660,7 @@ app.route({
34656
34660
  path: "cnb",
34657
34661
  key: "get-cnb-cookie",
34658
34662
  description: "获取当前cnb工作空间的cookie环境变量",
34659
- middleware: ["admin-auth"],
34663
+ middleware: ["auth-admin"],
34660
34664
  metadata: {
34661
34665
  tags: ["opencode"],
34662
34666
  ...createSkill({
@@ -54525,7 +54529,7 @@ app.route({
54525
54529
  path: "cnb",
54526
54530
  key: "cnb-ai-chat",
54527
54531
  description: "调用cnb的知识库ai对话功能进行聊天",
54528
- middleware: ["admin-auth"],
54532
+ middleware: ["auth-admin"],
54529
54533
  metadata: {
54530
54534
  tags: ["opencode"],
54531
54535
  ...createSkill({
@@ -54627,7 +54631,7 @@ app.route({
54627
54631
  path: "cnb",
54628
54632
  key: "cnb-rag-query",
54629
54633
  description: "调用cnb的知识库RAG查询功能进行问答",
54630
- middleware: ["admin-auth"],
54634
+ middleware: ["auth-admin"],
54631
54635
  metadata: {
54632
54636
  tags: ["opencode"],
54633
54637
  ...createSkill({
@@ -54646,7 +54650,7 @@ app.route({
54646
54650
  ctx.body = { content: "请提供有效的消息内容" };
54647
54651
  return;
54648
54652
  }
54649
- let repo2 = ctx.query?.repo;
54653
+ let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
54650
54654
  if (!repo2) {
54651
54655
  const res = await cnb.repo.getRepoList({ flags: "KnowledgeBase" });
54652
54656
  if (res.code === 200 && res.data.length > 0) {
@@ -54690,7 +54694,7 @@ app.route({
54690
54694
  path: "cnb",
54691
54695
  key: "list-issues",
54692
54696
  description: "查询 Issue 列表, 参数 repo, state, keyword, labels, page, page_size 等",
54693
- middleware: ["admin-auth"],
54697
+ middleware: ["auth-admin"],
54694
54698
  metadata: {
54695
54699
  tags: ["opencode"],
54696
54700
  ...createSkill({
@@ -54709,7 +54713,7 @@ app.route({
54709
54713
  })
54710
54714
  }
54711
54715
  }).define(async (ctx) => {
54712
- const repo2 = ctx.query?.repo;
54716
+ const repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
54713
54717
  const state = ctx.query?.state;
54714
54718
  const keyword = ctx.query?.keyword;
54715
54719
  const labels = ctx.query?.labels;
@@ -54741,7 +54745,7 @@ app.route({
54741
54745
  path: "cnb",
54742
54746
  key: "create-issue",
54743
54747
  description: "创建 Issue, 参数 repo, title, body, assignees, labels, priority",
54744
- middleware: ["admin-auth"],
54748
+ middleware: ["auth-admin"],
54745
54749
  metadata: {
54746
54750
  tags: ["opencode"],
54747
54751
  ...createSkill({
@@ -54781,7 +54785,7 @@ app.route({
54781
54785
  path: "cnb",
54782
54786
  key: "complete-issue",
54783
54787
  description: "完成 Issue, 参数 repo, issueNumber",
54784
- middleware: ["admin-auth"],
54788
+ middleware: ["auth-admin"],
54785
54789
  metadata: {
54786
54790
  tags: ["opencode"],
54787
54791
  ...createSkill({
@@ -55533,7 +55537,7 @@ var execCommand = (command, options = {}) => {
55533
55537
  });
55534
55538
  };
55535
55539
  app.route({
55536
- path: "cnb-board",
55540
+ path: "cnb_board",
55537
55541
  key: "is-cnb-board",
55538
55542
  description: "检查是否是 cnb-board 环境",
55539
55543
  middleware: ["auth-admin"]
@@ -55544,7 +55548,7 @@ app.route({
55544
55548
  };
55545
55549
  }).addTo(app);
55546
55550
  app.route({
55547
- path: "cnb-board",
55551
+ path: "cnb_board",
55548
55552
  key: "exit",
55549
55553
  description: "cnb的工作环境退出程序",
55550
55554
  middleware: ["auth-admin"]
@@ -55553,6 +55557,51 @@ app.route({
55553
55557
  execCommand(cmd);
55554
55558
  }).addTo(app);
55555
55559
 
55560
+ // agent/routes/share/index.ts
55561
+ app.route({
55562
+ path: "cnb",
55563
+ key: "get-assistant-url",
55564
+ description: "获取cnb工作空间中部署的各个助手的访问地址",
55565
+ middleware: ["auth"],
55566
+ metadata: {
55567
+ args: {
55568
+ more: zod_default.boolean().describe("需要更多信息")
55569
+ }
55570
+ }
55571
+ }).define(async (ctx) => {
55572
+ const uri = useKey("CNB_VSCODE_PROXY_URI") || "";
55573
+ const base = {
55574
+ base: uri,
55575
+ link: uri.replace("{{port}}", "51515"),
55576
+ kevisual: uri.replace("{{port}}", "51515"),
55577
+ openclaw: uri.replace("{{port}}", "80"),
55578
+ opencode: uri.replace("{{port}}", "100"),
55579
+ openwebui: uri.replace("{{port}}", "200"),
55580
+ note: uri.replace("{{port}}", "3000"),
55581
+ uptime: uri.replace("{{port}}", "3001"),
55582
+ immich: uri.replace("{{port}}", "2283"),
55583
+ nocodb: uri.replace("{{port}}", "4000"),
55584
+ openlist: uri.replace("{{port}}", "5244"),
55585
+ xiaoyao: uri.replace("{{port}}", "5678"),
55586
+ meilisearch: uri.replace("{{port}}", "7700"),
55587
+ bark: uri.replace("{{port}}", "9111"),
55588
+ vaultwarden: uri.replace("{{port}}", "8180"),
55589
+ music: uri.replace("{{port}}", "8096"),
55590
+ jellyfin: uri.replace("{{port}}", "8096"),
55591
+ homeassistant: uri.replace("{{port}}", "8123"),
55592
+ cloudreve: uri.replace("{{port}}", "5212"),
55593
+ filebrowser: uri.replace("{{port}}", "8081"),
55594
+ vscode: useKey("CNB_VSCODE_PROXY_URI") || "",
55595
+ codeServer: uri.replace("{{port}}", "10000"),
55596
+ gitea: uri.replace("{{port}}", "3000"),
55597
+ calibre: uri.replace("{{port}}", "8083"),
55598
+ searXNG: uri.replace("{{port}}", "8888")
55599
+ };
55600
+ ctx.body = {
55601
+ ...base
55602
+ };
55603
+ }).addTo(app);
55604
+
55556
55605
  // agent/routes/index.ts
55557
55606
  var checkAppId = (ctx, appId) => {
55558
55607
  const _appId = ctx?.app?.appId;
@@ -55573,8 +55622,8 @@ app.route({
55573
55622
  }
55574
55623
  }).addTo(app, { overwrite: false });
55575
55624
  app.route({
55576
- id: "admin-auth",
55577
- path: "admin-auth",
55625
+ id: "auth-admin",
55626
+ path: "auth-admin",
55578
55627
  middleware: ["auth"]
55579
55628
  }).define(async (ctx) => {
55580
55629
  if (checkAppId(ctx, app.appId)) {
@@ -55582,7 +55631,7 @@ app.route({
55582
55631
  }
55583
55632
  }).addTo(app, { overwrite: false });
55584
55633
 
55585
- // node_modules/.pnpm/@kevisual+router@0.0.85/node_modules/@kevisual/router/dist/opencode.js
55634
+ // node_modules/.pnpm/@kevisual+router@0.0.88/node_modules/@kevisual/router/dist/opencode.js
55586
55635
  import { webcrypto as crypto3 } from "node:crypto";
55587
55636
  var __create5 = Object.create;
55588
55637
  var __getProtoOf5 = Object.getPrototypeOf;