@cloudbase/cli 2.7.3 → 2.7.5

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.
Binary file
@@ -704,6 +704,10 @@ let CloudRunRunCommand = class CloudRunRunCommand extends common_1.Command {
704
704
  示例:--extendedContext '{"a":1,"b":2}'
705
705
  环境变量:EXTENDED_CONTEXT
706
706
  `
707
+ },
708
+ {
709
+ flags: '--open-debug-panel <openDebugPanel>',
710
+ desc: `是否打开调试面板,默认为 'true'`
707
711
  }
708
712
  ],
709
713
  requiredEnvId: false,
@@ -713,7 +717,7 @@ let CloudRunRunCommand = class CloudRunRunCommand extends common_1.Command {
713
717
  execute(envId, logger, ctx, options) {
714
718
  return __awaiter(this, void 0, void 0, function* () {
715
719
  debugger;
716
- let { runMode = 'normal', agentId } = options;
720
+ let { runMode = 'normal', agentId, openDebugPanel = true } = options;
717
721
  const type = runMode;
718
722
  console.log(chalk_1.default.green(`当前运行模式: ${type}`));
719
723
  if (!process.argv.some((arg) => arg.includes('--dotEnvFilePath='))) {
@@ -738,7 +742,7 @@ let CloudRunRunCommand = class CloudRunRunCommand extends common_1.Command {
738
742
  {
739
743
  type: 'input',
740
744
  name: 'agentId',
741
- message: `请输入 Agent ID:`,
745
+ message: `请输入 Agent ID(如没有请填写任意值):`,
742
746
  validate: (val) => {
743
747
  return val.trim() ? true : 'Agent ID 不能为空';
744
748
  }
@@ -788,7 +792,7 @@ let CloudRunRunCommand = class CloudRunRunCommand extends common_1.Command {
788
792
  logger.info('Initializing server in watch mode. Changes in source files will trigger a restart.');
789
793
  if (!nodemonInstance._firstStartDone) {
790
794
  nodemonInstance._firstStartDone = true;
791
- this.openDebugApp(type, port, envId, agentId);
795
+ this.openDebugApp(type, port, envId, agentId, openDebugPanel !== 'false');
792
796
  }
793
797
  }))
794
798
  .on('quit', (e) => {
@@ -812,13 +816,13 @@ let CloudRunRunCommand = class CloudRunRunCommand extends common_1.Command {
812
816
  }
813
817
  else {
814
818
  (0, functions_framework_1.runCLI)();
815
- if (!process.env.FROM_NODEMON) {
816
- this.openDebugApp(type, port, envId, agentId);
819
+ if (!process.env.FROM_NODEMON && openDebugPanel) {
820
+ this.openDebugApp(type, port, envId, agentId, openDebugPanel !== 'false');
817
821
  }
818
822
  }
819
823
  });
820
824
  }
821
- openDebugApp(type, port, envId, agentId) {
825
+ openDebugApp(type, port, envId, agentId, isOpen = true) {
822
826
  setTimeout(() => {
823
827
  let url = `http://127.0.0.1:${port}/cloudrun-run-ui/index.html?type=${type}&envId=${envId}&port=${port}`;
824
828
  if (type === 'agent') {
@@ -828,7 +832,7 @@ let CloudRunRunCommand = class CloudRunRunCommand extends common_1.Command {
828
832
  else {
829
833
  console.log(chalk_1.default.green(`点击 [${url}] 可以打开函数调试面板`));
830
834
  }
831
- (0, open_1.default)(url, { wait: false });
835
+ isOpen && (0, open_1.default)(url, { wait: false });
832
836
  }, 3000);
833
837
  }
834
838
  };
@@ -37,6 +37,13 @@
37
37
  const envId = urlParams.get('envId'); // 获取 envId 参数
38
38
  const port = urlParams.get('port'); // 获取 port 参数
39
39
 
40
+ const EList = {
41
+ HTTP: 'HTTP',
42
+ WEBSOCKET: 'WebSocket',
43
+ SSE: 'Server-sent Event',
44
+ AGENT: 'AGENT',
45
+ };
46
+
40
47
  // 监听来自VSCode扩展的消息
41
48
  window.addEventListener('message', (event) => {
42
49
  const message = event.data;
@@ -54,12 +61,13 @@
54
61
  url: `http://127.0.0.1:${port}${type === 'agent' ? `/v1/aibot/bots/${agentId}/send-message` : ''}`,
55
62
  resourceType: 'FunctionV2',
56
63
  body: type === "agent" ? { botId: agentId, msg: 'hi', searchEnable: false, files: [] } : {},
57
- defaultType: type === 'agent' ? 'AGENT' : 'HTTP',
64
+ defaultType: type === 'agent' ? EList.AGENT : EList.HTTP,
58
65
  agentConfig: {
59
66
  uin: '',
60
67
  envId,
61
68
  ibotId: agentId,
62
69
  },
70
+ options: { showTabs: type === 'agent' ? [EList.AGENT, EList.SSE, EList.HTTP] : null },
63
71
  }
64
72
  });
65
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cli",
3
- "version": "2.7.3",
3
+ "version": "2.7.5",
4
4
  "description": "cli tool for cloudbase",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {