@cloudbase/cli 2.7.7 → 2.7.8
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/.yarn/cache/{@cloudbase-manager-node-npm-4.3.2-91c22bb573-054b334bea.zip → @cloudbase-manager-node-npm-4.3.3-e38f029bbe-adb51d54ca.zip} +0 -0
- package/.yarn/install-state.gz +0 -0
- package/lib/commands/cloudrun/base.js +61 -4
- package/package.json +2 -2
- package/types/commands/cloudrun/base.d.ts +2 -0
|
Binary file
|
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
|
@@ -47,7 +47,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
47
47
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
48
|
};
|
|
49
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
-
exports.CloudRunRunCommand = exports.CloudRunDeployCommand = exports.CloudRunDeleteCommand = exports.CloudRunDownloadCommand = exports.CloudRunListCommand = exports.CloudRunInitCommand = exports.getCloudrunService = void 0;
|
|
50
|
+
exports.CloudRunRunCommand = exports.CloudRunDeployCommand = exports.CloudRunDeleteCommand = exports.CloudRunDownloadCommand = exports.CloudRunListCommand = exports.CloudRunInitCommand = exports.getAgentService = exports.getCloudrunService = void 0;
|
|
51
51
|
const functions_framework_1 = require("@cloudbase/functions-framework");
|
|
52
52
|
const iac_core_1 = require("@cloudbase/iac-core");
|
|
53
53
|
const manager_node_1 = __importDefault(require("@cloudbase/manager-node"));
|
|
@@ -90,6 +90,22 @@ function getCloudrunService(envId) {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
exports.getCloudrunService = getCloudrunService;
|
|
93
|
+
function getAgentService(envId) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
95
|
+
const region = yield (0, toolbox_1.getRegion)();
|
|
96
|
+
const { secretId, secretKey, token } = yield (0, utils_1.checkAndGetCredential)(true);
|
|
97
|
+
const app = new manager_node_1.default({
|
|
98
|
+
region,
|
|
99
|
+
token,
|
|
100
|
+
envId,
|
|
101
|
+
secretId,
|
|
102
|
+
secretKey,
|
|
103
|
+
proxy: (0, utils_1.getProxy)()
|
|
104
|
+
});
|
|
105
|
+
return app.agent;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
exports.getAgentService = getAgentService;
|
|
93
109
|
let CloudRunInitCommand = class CloudRunInitCommand extends common_1.Command {
|
|
94
110
|
get options() {
|
|
95
111
|
return {
|
|
@@ -283,7 +299,7 @@ let CloudRunDownloadCommand = class CloudRunDownloadCommand extends common_1.Com
|
|
|
283
299
|
desc: '环境 ID'
|
|
284
300
|
},
|
|
285
301
|
{
|
|
286
|
-
flags: '--serviceName <serviceName>',
|
|
302
|
+
flags: '-s, --serviceName <serviceName>',
|
|
287
303
|
desc: '服务名称',
|
|
288
304
|
required: true
|
|
289
305
|
},
|
|
@@ -399,7 +415,7 @@ let CloudRunDeleteCommand = class CloudRunDeleteCommand extends common_1.Command
|
|
|
399
415
|
desc: '环境 ID'
|
|
400
416
|
},
|
|
401
417
|
{
|
|
402
|
-
flags: '--serviceName <serviceName>',
|
|
418
|
+
flags: '-s, --serviceName <serviceName>',
|
|
403
419
|
desc: '服务名称',
|
|
404
420
|
required: true
|
|
405
421
|
},
|
|
@@ -498,6 +514,10 @@ let CloudRunDeployCommand = class CloudRunDeployCommand extends common_1.Command
|
|
|
498
514
|
flags: '--source <source>',
|
|
499
515
|
desc: '部署代码所在目录路径(绝对路径或相对路径,默认: 当前目录)'
|
|
500
516
|
},
|
|
517
|
+
{
|
|
518
|
+
flags: '--createAgent',
|
|
519
|
+
desc: '创建函数型 Agent'
|
|
520
|
+
},
|
|
501
521
|
{
|
|
502
522
|
flags: '--force',
|
|
503
523
|
desc: '强制部署,跳过所有确认提示',
|
|
@@ -512,7 +532,7 @@ let CloudRunDeployCommand = class CloudRunDeployCommand extends common_1.Command
|
|
|
512
532
|
execute(ctx, envId, log, options) {
|
|
513
533
|
var _a, _b;
|
|
514
534
|
return __awaiter(this, void 0, void 0, function* () {
|
|
515
|
-
let { serviceName, source, force, port } = options;
|
|
535
|
+
let { serviceName, source, force, port, createAgent } = options;
|
|
516
536
|
const targetDir = path_1.default.resolve(source || process.cwd());
|
|
517
537
|
if (!envId) {
|
|
518
538
|
const envConfig = (0, camelcase_keys_1.default)(yield iac_core_1.utils.loadEnv(targetDir));
|
|
@@ -524,6 +544,43 @@ let CloudRunDeployCommand = class CloudRunDeployCommand extends common_1.Command
|
|
|
524
544
|
}
|
|
525
545
|
}
|
|
526
546
|
log.info(`当前环境 Id:${envId}`);
|
|
547
|
+
if (createAgent) {
|
|
548
|
+
const questions = [
|
|
549
|
+
{
|
|
550
|
+
type: 'input',
|
|
551
|
+
name: 'Name',
|
|
552
|
+
message: '请输入函数式 Agent 名称:',
|
|
553
|
+
validate: (input) => {
|
|
554
|
+
if (!input.trim()) {
|
|
555
|
+
return '名称不能为空';
|
|
556
|
+
}
|
|
557
|
+
return true;
|
|
558
|
+
}
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
type: 'input',
|
|
562
|
+
name: 'BotId',
|
|
563
|
+
message: '请输入括号内的标识 ibot-(服务名-BotTag)。示例:agent-chat:',
|
|
564
|
+
validate: (input) => {
|
|
565
|
+
if (!/^[a-z0-9_]+-[a-z0-9_]+$/.test(input)) {
|
|
566
|
+
return '标识格式错误,应为"xxx-xxx"';
|
|
567
|
+
}
|
|
568
|
+
return true;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
];
|
|
572
|
+
const { Name, BotId } = yield inquirer_1.default.prompt(questions);
|
|
573
|
+
const botId = `ibot-${BotId}`;
|
|
574
|
+
const agentService = yield getAgentService(envId);
|
|
575
|
+
yield agentService.createFunctionAgent(source, {
|
|
576
|
+
Name: Name,
|
|
577
|
+
BotId: botId
|
|
578
|
+
});
|
|
579
|
+
(0, utils_2.trackCallback)({
|
|
580
|
+
details: `请打开链接查看部署状态: https://tcb.cloud.tencent.com/dev?envId=${envId}#/ai?tab=agent&agent=${botId}`
|
|
581
|
+
}, log);
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
527
584
|
if (!serviceName) {
|
|
528
585
|
let defaultName = '';
|
|
529
586
|
const config = yield (0, utils_2.getCloudbaserc)(targetDir);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cli",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.8",
|
|
4
4
|
"description": "cli tool for cloudbase",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"@cloudbase/functions-framework": "1.16.0",
|
|
37
37
|
"@cloudbase/iac-core": "0.0.3-alpha.11",
|
|
38
38
|
"@cloudbase/lowcode-cli": "^0.22.2",
|
|
39
|
-
"@cloudbase/manager-node": "4.3.
|
|
39
|
+
"@cloudbase/manager-node": "4.3.3",
|
|
40
40
|
"@cloudbase/toolbox": "^0.7.5",
|
|
41
41
|
"address": "^1.1.2",
|
|
42
42
|
"camelcase-keys": "^7.0.2",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Logger } from '../../decorators';
|
|
2
2
|
import { Command } from '../common';
|
|
3
3
|
export declare function getCloudrunService(envId: string): Promise<import("@cloudbase/manager-node/types/cloudrun").CloudRunService>;
|
|
4
|
+
export declare function getAgentService(envId: string): Promise<import("@cloudbase/manager-node/types/agent").AgentService>;
|
|
4
5
|
export declare class CloudRunInitCommand extends Command {
|
|
5
6
|
get options(): {
|
|
6
7
|
cmd: string;
|
|
@@ -136,6 +137,7 @@ export declare class CloudRunDeployCommand extends Command {
|
|
|
136
137
|
source?: string;
|
|
137
138
|
force?: boolean;
|
|
138
139
|
port?: number;
|
|
140
|
+
createAgent?: boolean;
|
|
139
141
|
}): Promise<void>;
|
|
140
142
|
}
|
|
141
143
|
export declare class CloudRunRunCommand extends Command {
|