@vectorx/xhs-cloud-cli 0.0.0-beta-20260108133839 → 0.0.0-beta-20260320063305
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/bin/rcb.js +47 -157
- package/lib/commands/agent/dev.js +42 -7
- package/lib/commands/agent/index.js +2 -0
- package/lib/commands/agent/info.js +107 -0
- package/lib/commands/agent/list.js +95 -0
- package/lib/commands/agent/new.js +32 -6
- package/lib/commands/auth/login.js +63 -35
- package/lib/commands/env/create.js +156 -0
- package/lib/commands/env/index.js +20 -0
- package/lib/commands/env/info.js +108 -0
- package/lib/commands/env/list.js +93 -0
- package/lib/commands/env/set.js +131 -0
- package/lib/commands/fun/deploy.js +184 -0
- package/lib/commands/fun/dev.js +189 -0
- package/lib/commands/fun/index.js +20 -0
- package/lib/commands/fun/list.js +77 -0
- package/lib/commands/fun/new.js +151 -0
- package/lib/commands/index.js +2 -0
- package/lib/constants/cmd.js +9 -9
- package/lib/core/base.js +83 -1
- package/lib/decorators/auth.js +8 -1
- package/lib/decorators/captureError.js +1 -0
- package/lib/main.js +8 -0
- package/lib/utils/agent-check.js +158 -0
- package/lib/utils/templates.js +75 -0
- package/package.json +12 -9
- package/templates/cloud-agents/agent-base-template/project.config.json +6 -0
- package/templates/{chatbox-agent → cloud-agents/agent-base-template}/src/index.js +0 -1
- package/templates/cloud-agents/agent-doc-template/.env.template +1 -0
- package/templates/cloud-agents/agent-doc-template/agent-cloudbase-functions.json +11 -0
- package/templates/cloud-agents/agent-doc-template/package.json +11 -0
- package/templates/cloud-agents/agent-doc-template/project.config.json +6 -0
- package/templates/cloud-agents/agent-doc-template/src/index.js +68 -0
- package/templates/cloud-agents/agent-image-template/.env.template +1 -0
- package/templates/cloud-agents/agent-image-template/agent-cloudbase-functions.json +11 -0
- package/templates/cloud-agents/agent-image-template/package.json +11 -0
- package/templates/cloud-agents/agent-image-template/project.config.json +6 -0
- package/templates/cloud-agents/agent-image-template/src/index.js +56 -0
- package/templates/cloud-agents/agent-text-template/.env.template +1 -0
- package/templates/cloud-agents/agent-text-template/agent-cloudbase-functions.json +11 -0
- package/templates/cloud-agents/agent-text-template/package.json +11 -0
- package/templates/cloud-agents/agent-text-template/project.config.json +6 -0
- package/templates/cloud-agents/agent-text-template/src/index.js +38 -0
- package/templates/cloud-agents/agent-voice-template/.env.template +1 -0
- package/templates/cloud-agents/agent-voice-template/agent-cloudbase-functions.json +11 -0
- package/templates/cloud-agents/agent-voice-template/package.json +11 -0
- package/templates/cloud-agents/agent-voice-template/project.config.json +6 -0
- package/templates/cloud-agents/agent-voice-template/src/index.js +81 -0
- package/templates/cloud-agents/templates.json +9 -0
- package/templates/cloud-dev/cloudfunction-route-template/.env.template +1 -0
- package/templates/cloud-dev/cloudfunction-route-template/README.md +277 -0
- package/templates/cloud-dev/cloudfunction-route-template/agent-cloudbase-functions.json +83 -0
- package/templates/cloud-dev/cloudfunction-route-template/package.json +10 -0
- package/templates/cloud-dev/cloudfunction-route-template/src/binary/index.js +207 -0
- package/templates/cloud-dev/cloudfunction-route-template/src/context/context-service.js +94 -0
- package/templates/cloud-dev/cloudfunction-route-template/src/context/index.js +57 -0
- package/templates/cloud-dev/cloudfunction-route-template/src/env/index.js +264 -0
- package/templates/cloud-dev/cloudfunction-route-template/src/form/index.js +138 -0
- package/templates/cloud-dev/cloudfunction-route-template/src/index.js +0 -0
- package/templates/cloud-dev/cloudfunction-route-template/src/json/index.js +194 -0
- package/templates/cloud-dev/cloudfunction-route-template/src/multipart/index.js +189 -0
- package/templates/cloud-dev/cloudfunction-route-template/src/text/index.js +319 -0
- package/templates/cloud-dev/cloudfunction-route-template/src/user/index.js +82 -0
- package/templates/cloud-dev/cloudfunction-template/.env.template +2 -0
- package/templates/cloud-dev/cloudfunction-template/agent-cloudbase-functions.json +17 -0
- package/templates/cloud-dev/cloudfunction-template/package.json +11 -0
- package/templates/cloud-dev/cloudfunction-template/src/echo.js +27 -0
- package/templates/cloud-dev/cloudfunction-template/src/index.js +34 -0
- package/templates/cloud-dev/templates.json +6 -0
- package/types/commands/agent/index.d.ts +2 -0
- package/types/commands/agent/info.d.ts +14 -0
- package/types/commands/agent/list.d.ts +14 -0
- package/types/commands/auth/login.d.ts +2 -0
- package/types/commands/env/create.d.ts +19 -0
- package/types/commands/env/index.d.ts +4 -0
- package/types/commands/env/info.d.ts +14 -0
- package/types/commands/env/list.d.ts +11 -0
- package/types/commands/env/set.d.ts +14 -0
- package/types/commands/fun/deploy.d.ts +14 -0
- package/types/commands/fun/dev.d.ts +14 -0
- package/types/commands/fun/index.d.ts +4 -0
- package/types/commands/fun/list.d.ts +14 -0
- package/types/commands/fun/new.d.ts +16 -0
- package/types/commands/index.d.ts +2 -0
- package/types/utils/agent-check.d.ts +1 -0
- package/types/utils/templates.d.ts +17 -0
- package/templates/weather-agent/index.js +0 -92
- package/templates/weather-agent/project.config.json +0 -4
- /package/templates/{chatbox-agent → cloud-agents/agent-base-template}/.env.template +0 -0
- /package/templates/{chatbox-agent → cloud-agents/agent-base-template}/agent-cloudbase-functions.json +0 -0
- /package/templates/{chatbox-agent → cloud-agents/agent-base-template}/package.json +0 -0
- /package/templates/{chatbox-agent → cloud-dev/cloudfunction-template}/project.config.json +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Logger } from "@vectorx/cloud-toolkit";
|
|
2
|
+
import { Command } from "../../core/base";
|
|
3
|
+
export declare class AgentInfoCommand extends Command {
|
|
4
|
+
execute(options: any, log: Logger): Promise<void>;
|
|
5
|
+
get options(): {
|
|
6
|
+
cmd: string;
|
|
7
|
+
childCmd: string;
|
|
8
|
+
desc: string;
|
|
9
|
+
options: {
|
|
10
|
+
flags: string;
|
|
11
|
+
desc: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Logger } from "@vectorx/cloud-toolkit";
|
|
2
|
+
import { Command } from "../../core/base";
|
|
3
|
+
export declare class AgentListCommand extends Command {
|
|
4
|
+
execute(options: any, log: Logger): Promise<void>;
|
|
5
|
+
get options(): {
|
|
6
|
+
cmd: string;
|
|
7
|
+
childCmd: string;
|
|
8
|
+
desc: string;
|
|
9
|
+
options: {
|
|
10
|
+
flags: string;
|
|
11
|
+
desc: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { Command, type ICommandOptions } from "../../core/base";
|
|
2
2
|
export declare class LoginCommand extends Command {
|
|
3
3
|
private authService;
|
|
4
|
+
private cloudDevService;
|
|
4
5
|
constructor();
|
|
5
6
|
execute(ctx: any): Promise<void>;
|
|
6
7
|
get options(): ICommandOptions;
|
|
7
8
|
}
|
|
8
9
|
export declare class GetLoginInfoCommand extends Command {
|
|
9
10
|
private authService;
|
|
11
|
+
private cloudDevService;
|
|
10
12
|
constructor();
|
|
11
13
|
execute(ctx: any): Promise<void>;
|
|
12
14
|
get options(): ICommandOptions;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Logger } from "@vectorx/cloud-toolkit";
|
|
2
|
+
import { Command } from "../../core/base";
|
|
3
|
+
interface EnvCreateOptions {
|
|
4
|
+
name?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class EnvCreateCommand extends Command {
|
|
8
|
+
execute(rawOptions: EnvCreateOptions, log: Logger): Promise<void>;
|
|
9
|
+
get options(): {
|
|
10
|
+
cmd: string;
|
|
11
|
+
childCmd: string;
|
|
12
|
+
desc: string;
|
|
13
|
+
options: {
|
|
14
|
+
flags: string;
|
|
15
|
+
desc: string;
|
|
16
|
+
}[];
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Logger } from "@vectorx/cloud-toolkit";
|
|
2
|
+
import { Command } from "../../core/base";
|
|
3
|
+
export declare class EnvInfoCommand extends Command {
|
|
4
|
+
execute(options: any, log: Logger): Promise<void>;
|
|
5
|
+
get options(): {
|
|
6
|
+
cmd: string;
|
|
7
|
+
childCmd: string;
|
|
8
|
+
desc: string;
|
|
9
|
+
options: {
|
|
10
|
+
flags: string;
|
|
11
|
+
desc: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Logger } from "@vectorx/cloud-toolkit";
|
|
2
|
+
import { Command } from "../../core/base";
|
|
3
|
+
export declare class EnvListCommand extends Command {
|
|
4
|
+
execute(_options: any, log: Logger): Promise<void>;
|
|
5
|
+
get options(): {
|
|
6
|
+
cmd: string;
|
|
7
|
+
childCmd: string;
|
|
8
|
+
desc: string;
|
|
9
|
+
options: any[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Logger } from "@vectorx/cloud-toolkit";
|
|
2
|
+
import { Command } from "../../core/base";
|
|
3
|
+
export declare class EnvSetCommand extends Command {
|
|
4
|
+
execute(options: any, log: Logger): Promise<void>;
|
|
5
|
+
get options(): {
|
|
6
|
+
cmd: string;
|
|
7
|
+
childCmd: string;
|
|
8
|
+
desc: string;
|
|
9
|
+
options: {
|
|
10
|
+
flags: string;
|
|
11
|
+
desc: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Logger } from "@vectorx/cloud-toolkit";
|
|
2
|
+
import { Command } from "../../core/base";
|
|
3
|
+
export declare class FunDeployCommand extends Command {
|
|
4
|
+
execute(options: any, log: Logger): Promise<void>;
|
|
5
|
+
get options(): {
|
|
6
|
+
cmd: string;
|
|
7
|
+
childCmd: string;
|
|
8
|
+
desc: string;
|
|
9
|
+
options: {
|
|
10
|
+
flags: string;
|
|
11
|
+
desc: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Logger } from "@vectorx/cloud-toolkit";
|
|
2
|
+
import { Command } from "../../core/base";
|
|
3
|
+
export declare class FunDevCommand extends Command {
|
|
4
|
+
execute(options: any, log: Logger): Promise<void>;
|
|
5
|
+
get options(): {
|
|
6
|
+
cmd: string;
|
|
7
|
+
childCmd: string;
|
|
8
|
+
desc: string;
|
|
9
|
+
options: {
|
|
10
|
+
flags: string;
|
|
11
|
+
desc: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Logger } from "@vectorx/cloud-toolkit";
|
|
2
|
+
import { Command } from "../../core/base";
|
|
3
|
+
export declare class FunListCommand extends Command {
|
|
4
|
+
execute(options: any, log: Logger): Promise<void>;
|
|
5
|
+
get options(): {
|
|
6
|
+
cmd: string;
|
|
7
|
+
childCmd: string;
|
|
8
|
+
desc: string;
|
|
9
|
+
options: {
|
|
10
|
+
flags: string;
|
|
11
|
+
desc: string;
|
|
12
|
+
}[];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Logger } from "@vectorx/cloud-toolkit";
|
|
2
|
+
import { Command } from "../../core/base";
|
|
3
|
+
export declare class FunNewCommand extends Command {
|
|
4
|
+
execute(options: any, log: Logger): Promise<void>;
|
|
5
|
+
private copyTemplate;
|
|
6
|
+
get options(): {
|
|
7
|
+
cmd: string;
|
|
8
|
+
childCmd: string;
|
|
9
|
+
desc: string;
|
|
10
|
+
usage: string;
|
|
11
|
+
options: {
|
|
12
|
+
flags: string;
|
|
13
|
+
desc: string;
|
|
14
|
+
}[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function checkAndGuideAgentProject(workDir: string): Promise<string | undefined>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface TemplateEntry {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
desc: string;
|
|
5
|
+
}
|
|
6
|
+
export interface TemplatesConfig {
|
|
7
|
+
templates: TemplateEntry[];
|
|
8
|
+
}
|
|
9
|
+
export declare const TEMPLATE_CATEGORIES: {
|
|
10
|
+
readonly "cloud-agents": string;
|
|
11
|
+
readonly "cloud-dev": string;
|
|
12
|
+
};
|
|
13
|
+
export declare function loadTemplatesConfig(category: keyof typeof TEMPLATE_CATEGORIES): TemplateEntry[];
|
|
14
|
+
export declare function resolveTemplatePath(category: keyof typeof TEMPLATE_CATEGORIES, templateId: string): string;
|
|
15
|
+
export declare function selectTemplate(category: keyof typeof TEMPLATE_CATEGORIES, options: {
|
|
16
|
+
template?: string;
|
|
17
|
+
}): Promise<string>;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
const { AgentRuntime, AgentDriver } = require("@vectorx/agent-runtime");
|
|
2
|
-
|
|
3
|
-
class AgentSSE extends AgentRuntime {
|
|
4
|
-
async sendMessage(input) {
|
|
5
|
-
try {
|
|
6
|
-
let conversation_id = ''
|
|
7
|
-
|
|
8
|
-
const result = await this.getConversations()
|
|
9
|
-
if (result.code === 0 && result.data) {
|
|
10
|
-
const { conversations } = result.data
|
|
11
|
-
if (conversations && conversations.length) {
|
|
12
|
-
conversation_id = conversations[conversations.length - 1].id
|
|
13
|
-
} else {
|
|
14
|
-
conversation_id = ''
|
|
15
|
-
}
|
|
16
|
-
} else {
|
|
17
|
-
conversation_id = ''
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const { data: { message_list }} = await this.getMessageList(conversation_id)
|
|
21
|
-
|
|
22
|
-
message_list.push({
|
|
23
|
-
role: 'user',
|
|
24
|
-
content: input.message.content
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
message_list.push({
|
|
28
|
-
role: 'assistant',
|
|
29
|
-
content: '你好,我是AI助手,很高兴为你服务。'
|
|
30
|
-
})
|
|
31
|
-
|
|
32
|
-
const model = this.createModel('deepseek-r1')
|
|
33
|
-
const modelResponse = await model.streamText({
|
|
34
|
-
messages: [
|
|
35
|
-
{
|
|
36
|
-
role: 'user',
|
|
37
|
-
content: {
|
|
38
|
-
type: 'text',
|
|
39
|
-
content: input.message.content
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
]
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
let assistant_output = ''
|
|
46
|
-
let reasoningContent = ''
|
|
47
|
-
|
|
48
|
-
for await (const chunk of modelResponse) {
|
|
49
|
-
if (chunk.choices[0].message.content) {
|
|
50
|
-
assistant_output += chunk.choices[0].message.content
|
|
51
|
-
}
|
|
52
|
-
if (chunk.choices[0].message.reasoning_content) {
|
|
53
|
-
reasoningContent += chunk.choices[0].message.reasoning_content
|
|
54
|
-
}
|
|
55
|
-
this.sseSender.send({ data: chunk });
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
this.sseSender.end();
|
|
59
|
-
|
|
60
|
-
await this.createRecordPair({
|
|
61
|
-
conversation_id,
|
|
62
|
-
user_input: {
|
|
63
|
-
role: 'user',
|
|
64
|
-
content: input.message.content
|
|
65
|
-
},
|
|
66
|
-
assistant_output: {
|
|
67
|
-
role: 'assistant',
|
|
68
|
-
content: assistant_output,
|
|
69
|
-
reasoningContent: assistant_output
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
} catch (e) {
|
|
74
|
-
console.log("开发者 agent 捕获到错误", e);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
async getMessageList(conversation_id) {
|
|
79
|
-
const historyMessages = await this.getHistoryMessages({
|
|
80
|
-
conversation_id,
|
|
81
|
-
cursor: 0,
|
|
82
|
-
count: 5,
|
|
83
|
-
sort: 'desc'
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
return historyMessages
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
exports.main = async (event, context) => {
|
|
91
|
-
return AgentDriver.run(event, context, new AgentSSE(context));
|
|
92
|
-
};
|
|
File without changes
|
/package/templates/{chatbox-agent → cloud-agents/agent-base-template}/agent-cloudbase-functions.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|