@coze-arch/cli 0.0.18 → 0.0.19-alpha.502ddf
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/lib/__templates__/expo/.coze +1 -0
- package/lib/__templates__/expo/.cozeproj/scripts/validate.sh +8 -0
- package/lib/__templates__/expo/package.json +2 -1
- package/lib/__templates__/nextjs/.coze +1 -0
- package/lib/__templates__/nextjs/package.json +3 -1
- package/lib/__templates__/nextjs/scripts/validate.sh +10 -0
- package/lib/__templates__/nuxt-vue/.coze +1 -0
- package/lib/__templates__/nuxt-vue/app/pages/index.vue +6 -0
- package/lib/__templates__/nuxt-vue/eslint.config.mjs +25 -0
- package/lib/__templates__/nuxt-vue/nuxt.config.ts +2 -2
- package/lib/__templates__/nuxt-vue/package.json +9 -2
- package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +790 -10
- package/lib/__templates__/nuxt-vue/scripts/validate.sh +10 -0
- package/lib/__templates__/pi-agent/.coze +10 -0
- package/lib/__templates__/pi-agent/AGENTS.md +149 -0
- package/lib/__templates__/pi-agent/README.md +218 -0
- package/lib/__templates__/pi-agent/_gitignore +3 -0
- package/lib/__templates__/pi-agent/_npmrc +23 -0
- package/lib/__templates__/pi-agent/bin/pi-bot.ts +8 -0
- package/lib/__templates__/pi-agent/docs/project-overview.md +368 -0
- package/lib/__templates__/pi-agent/docs/user/getting-started.md +46 -0
- package/lib/__templates__/pi-agent/package.json +63 -0
- package/lib/__templates__/pi-agent/pi-resources/SYSTEM.md +15 -0
- package/lib/__templates__/pi-agent/pi-resources/extensions/preference-memory/index.ts +355 -0
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-asr/SKILL.md +30 -0
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-image-gen/SKILL.md +29 -0
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-tts/SKILL.md +57 -0
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-video-gen/SKILL.md +40 -0
- package/lib/__templates__/pi-agent/pnpm-lock.yaml +8282 -0
- package/lib/__templates__/pi-agent/scripts/dev.sh +14 -0
- package/lib/__templates__/pi-agent/scripts/prepare.sh +35 -0
- package/lib/__templates__/pi-agent/src/agent.ts +363 -0
- package/lib/__templates__/pi-agent/src/channels/feishu/index.ts +760 -0
- package/lib/__templates__/pi-agent/src/channels/feishu/streaming-card.ts +297 -0
- package/lib/__templates__/pi-agent/src/channels/wechat/index.ts +171 -0
- package/lib/__templates__/pi-agent/src/cli.ts +117 -0
- package/lib/__templates__/pi-agent/src/config.ts +749 -0
- package/lib/__templates__/pi-agent/src/core.ts +219 -0
- package/lib/__templates__/pi-agent/src/dashboard/api/channels.ts +104 -0
- package/lib/__templates__/pi-agent/src/dashboard/api/models.ts +98 -0
- package/lib/__templates__/pi-agent/src/dashboard/api/overview.ts +33 -0
- package/lib/__templates__/pi-agent/src/dashboard/config-store.ts +64 -0
- package/lib/__templates__/pi-agent/src/dashboard/index.ts +74 -0
- package/lib/__templates__/pi-agent/src/dashboard/server.ts +610 -0
- package/lib/__templates__/pi-agent/src/dashboard/types.ts +25 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/index.html +13 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/postcss.config.cjs +7 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/app-layout.tsx +172 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/page-title.tsx +17 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/alert.tsx +22 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/badge.tsx +25 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/button.tsx +40 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/card.tsx +29 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/input.tsx +18 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/label.tsx +8 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/select.tsx +80 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/separator.tsx +23 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/hooks/use-fetch.ts +32 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/hooks/use-local-storage-state.ts +23 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/main.tsx +24 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/chat-page.tsx +440 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/overview-page.tsx +330 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/services/chat-ws-service.ts +167 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/styles.css +203 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/utils/index.ts +11 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/tsconfig.json +13 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/vite.config.ts +17 -0
- package/lib/__templates__/pi-agent/src/index.ts +123 -0
- package/lib/__templates__/pi-agent/src/pi-resources.ts +125 -0
- package/lib/__templates__/pi-agent/src/session-store.ts +223 -0
- package/lib/__templates__/pi-agent/src/tools/common/format-coze-error.ts +12 -0
- package/lib/__templates__/pi-agent/src/tools/index.ts +2 -0
- package/lib/__templates__/pi-agent/src/tools/web-fetch/index.ts +195 -0
- package/lib/__templates__/pi-agent/src/tools/web-search/index.ts +206 -0
- package/lib/__templates__/pi-agent/template.config.js +45 -0
- package/lib/__templates__/pi-agent/tests/cli.test.ts +136 -0
- package/lib/__templates__/pi-agent/tests/config.test.ts +377 -0
- package/lib/__templates__/pi-agent/tests/dashboard-models-api.test.ts +171 -0
- package/lib/__templates__/pi-agent/tests/feishu-channel.test.ts +149 -0
- package/lib/__templates__/pi-agent/tests/feishu-streaming-card.test.ts +15 -0
- package/lib/__templates__/pi-agent/tests/pi-resources.test.ts +73 -0
- package/lib/__templates__/pi-agent/tests/preference-memory.test.ts +43 -0
- package/lib/__templates__/pi-agent/tests/session-store.test.ts +61 -0
- package/lib/__templates__/pi-agent/tests/smoke/run-smoke.ts +275 -0
- package/lib/__templates__/pi-agent/tests/web-fetch.test.ts +157 -0
- package/lib/__templates__/pi-agent/tests/web-search.test.ts +208 -0
- package/lib/__templates__/pi-agent/tsconfig.json +21 -0
- package/lib/__templates__/pi-agent/types/larksuiteoapi-node-sdk.d.ts +113 -0
- package/lib/__templates__/taro/.coze +1 -0
- package/lib/__templates__/taro/.cozeproj/scripts/validate.sh +8 -0
- package/lib/__templates__/taro/package.json +1 -1
- package/lib/__templates__/templates.json +24 -0
- package/lib/__templates__/vite/.coze +1 -0
- package/lib/__templates__/vite/package.json +3 -1
- package/lib/__templates__/vite/scripts/validate.sh +10 -0
- package/lib/cli.js +13 -2
- package/package.json +1 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { SearchClient, type SearchResponse } from "coze-coding-dev-sdk";
|
|
4
|
+
import { cozeWebSearchTool } from "../src/tools/web-search/index.js";
|
|
5
|
+
|
|
6
|
+
function resultText(result: { content: { type: string; text?: string }[] }): string {
|
|
7
|
+
return result.content[0].text ?? "";
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function makeWebSearchResponse(overrides: Partial<SearchResponse> = {}): SearchResponse {
|
|
11
|
+
return {
|
|
12
|
+
web_items: [
|
|
13
|
+
{
|
|
14
|
+
id: "1",
|
|
15
|
+
sort_id: 1,
|
|
16
|
+
title: "Result A",
|
|
17
|
+
site_name: "example.com",
|
|
18
|
+
url: "https://example.com/a",
|
|
19
|
+
snippet: "Snippet A",
|
|
20
|
+
auth_info_des: "",
|
|
21
|
+
auth_info_level: 0,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "2",
|
|
25
|
+
sort_id: 2,
|
|
26
|
+
title: "Result B",
|
|
27
|
+
url: "https://example.com/b",
|
|
28
|
+
snippet: "Snippet B",
|
|
29
|
+
publish_time: "2025-01-01",
|
|
30
|
+
auth_info_des: "",
|
|
31
|
+
auth_info_level: 0,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
image_items: [],
|
|
35
|
+
...overrides,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function makeImageSearchResponse(): SearchResponse {
|
|
40
|
+
return {
|
|
41
|
+
web_items: [],
|
|
42
|
+
image_items: [
|
|
43
|
+
{
|
|
44
|
+
id: "img-1",
|
|
45
|
+
sort_id: 1,
|
|
46
|
+
title: "Cat Photo",
|
|
47
|
+
url: "https://example.com/cat",
|
|
48
|
+
site_name: "photos.com",
|
|
49
|
+
image: { url: "https://cdn.com/cat.jpg", width: 800, height: 600, shape: "rect" },
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: "img-2",
|
|
53
|
+
sort_id: 2,
|
|
54
|
+
url: "https://example.com/dog",
|
|
55
|
+
image: { url: "https://cdn.com/dog.jpg", width: 1024, height: 768, shape: "rect" },
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
test("web-search: basic web search returns formatted text", async (t) => {
|
|
62
|
+
const resp = makeWebSearchResponse();
|
|
63
|
+
t.mock.method(SearchClient.prototype, "webSearch", async () => resp);
|
|
64
|
+
|
|
65
|
+
const result = await cozeWebSearchTool.execute("call-1", { query: "test" }, undefined as any, undefined as any, undefined as any);
|
|
66
|
+
const text = resultText(result);
|
|
67
|
+
|
|
68
|
+
assert.ok(text.includes("Coze web search: test"));
|
|
69
|
+
assert.ok(text.includes("Results (2)"));
|
|
70
|
+
assert.ok(text.includes("1. Result A"));
|
|
71
|
+
assert.ok(text.includes("URL: https://example.com/a"));
|
|
72
|
+
assert.ok(text.includes("Source: example.com"));
|
|
73
|
+
assert.ok(text.includes("Snippet A"));
|
|
74
|
+
assert.ok(text.includes("2. Result B"));
|
|
75
|
+
assert.ok(text.includes("Published: 2025-01-01"));
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test("web-search: includes summary when present", async (t) => {
|
|
79
|
+
const resp = makeWebSearchResponse({ summary: "This is the summary" });
|
|
80
|
+
t.mock.method(SearchClient.prototype, "webSearch", async () => resp);
|
|
81
|
+
|
|
82
|
+
const result = await cozeWebSearchTool.execute("call-2", { query: "test", needSummary: true }, undefined as any, undefined as any, undefined as any);
|
|
83
|
+
const text = resultText(result);
|
|
84
|
+
|
|
85
|
+
assert.ok(text.includes("Summary: This is the summary"));
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test("web-search: includes content when needContent is true", async (t) => {
|
|
89
|
+
const resp = makeWebSearchResponse();
|
|
90
|
+
resp.web_items[0].content = "Full page content here";
|
|
91
|
+
t.mock.method(SearchClient.prototype, "advancedSearch", async () => resp);
|
|
92
|
+
|
|
93
|
+
const result = await cozeWebSearchTool.execute("call-3", { query: "test", needContent: true }, undefined as any, undefined as any, undefined as any);
|
|
94
|
+
const text = resultText(result);
|
|
95
|
+
|
|
96
|
+
assert.ok(text.includes("Content:"));
|
|
97
|
+
assert.ok(text.includes("Full page content here"));
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
test("web-search: image search maps image items", async (t) => {
|
|
101
|
+
const resp = makeImageSearchResponse();
|
|
102
|
+
t.mock.method(SearchClient.prototype, "imageSearch", async () => resp);
|
|
103
|
+
|
|
104
|
+
const result = await cozeWebSearchTool.execute("call-4", { query: "cats", type: "image" }, undefined as any, undefined as any, undefined as any);
|
|
105
|
+
const text = resultText(result);
|
|
106
|
+
|
|
107
|
+
assert.ok(text.includes("1. Cat Photo"));
|
|
108
|
+
assert.ok(text.includes("Image: https://cdn.com/cat.jpg"));
|
|
109
|
+
assert.ok(text.includes("2. Untitled"));
|
|
110
|
+
assert.ok(text.includes("Image: https://cdn.com/dog.jpg"));
|
|
111
|
+
assert.equal((result as any).details.type, "image");
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
test("web-search: uses advancedSearch when filters are present", async (t) => {
|
|
115
|
+
const resp = makeWebSearchResponse();
|
|
116
|
+
const calls: string[] = [];
|
|
117
|
+
t.mock.method(SearchClient.prototype, "advancedSearch", async () => {
|
|
118
|
+
calls.push("advancedSearch");
|
|
119
|
+
return resp;
|
|
120
|
+
});
|
|
121
|
+
t.mock.method(SearchClient.prototype, "webSearch", async () => {
|
|
122
|
+
calls.push("webSearch");
|
|
123
|
+
return resp;
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
await cozeWebSearchTool.execute("call-5", { query: "test", timeRange: "1d" }, undefined as any, undefined as any, undefined as any);
|
|
127
|
+
assert.deepEqual(calls, ["advancedSearch"]);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test("web-search: uses webSearch when no filters present", async (t) => {
|
|
131
|
+
const resp = makeWebSearchResponse();
|
|
132
|
+
const calls: string[] = [];
|
|
133
|
+
t.mock.method(SearchClient.prototype, "advancedSearch", async () => {
|
|
134
|
+
calls.push("advancedSearch");
|
|
135
|
+
return resp;
|
|
136
|
+
});
|
|
137
|
+
t.mock.method(SearchClient.prototype, "webSearch", async () => {
|
|
138
|
+
calls.push("webSearch");
|
|
139
|
+
return resp;
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
await cozeWebSearchTool.execute("call-6", { query: "test" }, undefined as any, undefined as any, undefined as any);
|
|
143
|
+
assert.deepEqual(calls, ["webSearch"]);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
test("web-search: uses advancedSearch when sites filter is set", async (t) => {
|
|
147
|
+
const resp = makeWebSearchResponse();
|
|
148
|
+
const calls: string[] = [];
|
|
149
|
+
t.mock.method(SearchClient.prototype, "advancedSearch", async () => {
|
|
150
|
+
calls.push("advancedSearch");
|
|
151
|
+
return resp;
|
|
152
|
+
});
|
|
153
|
+
t.mock.method(SearchClient.prototype, "webSearch", async () => {
|
|
154
|
+
calls.push("webSearch");
|
|
155
|
+
return resp;
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
await cozeWebSearchTool.execute("call-7", { query: "test", sites: "example.com" }, undefined as any, undefined as any, undefined as any);
|
|
159
|
+
assert.deepEqual(calls, ["advancedSearch"]);
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test("web-search: returns error content on search failure", async (t) => {
|
|
163
|
+
t.mock.method(SearchClient.prototype, "webSearch", async () => {
|
|
164
|
+
throw new Error("API timeout");
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
const result = await cozeWebSearchTool.execute("call-8", { query: "test" }, undefined as any, undefined as any, undefined as any);
|
|
168
|
+
|
|
169
|
+
assert.ok(resultText(result).includes("Error: API timeout"));
|
|
170
|
+
assert.equal((result as any).details.error, true);
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
test("web-search: defaults count to 10 and type to web", async (t) => {
|
|
174
|
+
const captured: any[] = [];
|
|
175
|
+
t.mock.method(SearchClient.prototype, "webSearch", async (query: string, count: number, needSummary?: boolean) => {
|
|
176
|
+
captured.push({ query, count, needSummary });
|
|
177
|
+
return makeWebSearchResponse();
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
await cozeWebSearchTool.execute("call-9", { query: "hello" }, undefined as any, undefined as any, undefined as any);
|
|
181
|
+
|
|
182
|
+
assert.equal(captured[0].query, "hello");
|
|
183
|
+
assert.equal(captured[0].count, 10);
|
|
184
|
+
assert.equal((captured[0] as any).needSummary, undefined);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
test("web-search: details contain correct metadata", async (t) => {
|
|
188
|
+
const resp = makeWebSearchResponse({ summary: "Sum" });
|
|
189
|
+
t.mock.method(SearchClient.prototype, "webSearch", async () => resp);
|
|
190
|
+
|
|
191
|
+
const result = await cozeWebSearchTool.execute("call-10", { query: "meta test" }, undefined as any, undefined as any, undefined as any);
|
|
192
|
+
|
|
193
|
+
assert.equal((result as any).details.query, "meta test");
|
|
194
|
+
assert.equal((result as any).details.type, "web");
|
|
195
|
+
assert.equal((result as any).details.summary, "Sum");
|
|
196
|
+
assert.equal((result as any).details.count, 2);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
test("web-search: empty results produces correct output", async (t) => {
|
|
200
|
+
const resp: SearchResponse = { web_items: [], image_items: [] };
|
|
201
|
+
t.mock.method(SearchClient.prototype, "webSearch", async () => resp);
|
|
202
|
+
|
|
203
|
+
const result = await cozeWebSearchTool.execute("call-11", { query: "nothing" }, undefined as any, undefined as any, undefined as any);
|
|
204
|
+
const text = resultText(result);
|
|
205
|
+
|
|
206
|
+
assert.ok(text.includes("Results (0)"));
|
|
207
|
+
assert.equal((result as any).details.count, 0);
|
|
208
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "NodeNext",
|
|
5
|
+
"moduleResolution": "NodeNext",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"verbatimModuleSyntax": true,
|
|
10
|
+
"forceConsistentCasingInFileNames": true,
|
|
11
|
+
"allowSyntheticDefaultImports": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"baseUrl": "."
|
|
14
|
+
},
|
|
15
|
+
"include": [
|
|
16
|
+
"src/**/*.ts",
|
|
17
|
+
"pi-resources/extensions/**/*.ts",
|
|
18
|
+
"tests/**/*.ts",
|
|
19
|
+
"types/**/*.d.ts"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
declare module "@larksuiteoapi/node-sdk" {
|
|
2
|
+
export enum AppType {
|
|
3
|
+
SelfBuild = "SelfBuild"
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export enum Domain {
|
|
7
|
+
Feishu = "https://open.feishu.cn",
|
|
8
|
+
Lark = "https://open.larksuite.com"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum LoggerLevel {
|
|
12
|
+
warn = "warn"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ClientOptions {
|
|
16
|
+
appId: string;
|
|
17
|
+
appSecret: string;
|
|
18
|
+
appType: AppType;
|
|
19
|
+
domain?: Domain | string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface MessageReplyArgs {
|
|
23
|
+
path: {
|
|
24
|
+
message_id: string;
|
|
25
|
+
};
|
|
26
|
+
data: {
|
|
27
|
+
msg_type: string;
|
|
28
|
+
content: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface MessageReactionCreateArgs {
|
|
33
|
+
path: {
|
|
34
|
+
message_id: string;
|
|
35
|
+
};
|
|
36
|
+
data: {
|
|
37
|
+
reaction_type: {
|
|
38
|
+
emoji_type: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface MessageReactionDeleteArgs {
|
|
44
|
+
path: {
|
|
45
|
+
message_id: string;
|
|
46
|
+
reaction_id: string;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export class Client {
|
|
51
|
+
constructor(options: ClientOptions);
|
|
52
|
+
request(args: {
|
|
53
|
+
method: string;
|
|
54
|
+
url: string;
|
|
55
|
+
data: Record<string, never>;
|
|
56
|
+
}): Promise<{
|
|
57
|
+
bot?: {
|
|
58
|
+
open_id?: string;
|
|
59
|
+
};
|
|
60
|
+
data?: {
|
|
61
|
+
bot?: {
|
|
62
|
+
open_id?: string;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
}>;
|
|
66
|
+
im: {
|
|
67
|
+
message: {
|
|
68
|
+
reply(args: MessageReplyArgs): Promise<unknown>;
|
|
69
|
+
};
|
|
70
|
+
messageReaction: {
|
|
71
|
+
create(args: MessageReactionCreateArgs): Promise<{
|
|
72
|
+
code?: number;
|
|
73
|
+
msg?: string;
|
|
74
|
+
data?: {
|
|
75
|
+
reaction_id?: string;
|
|
76
|
+
reaction_type?: {
|
|
77
|
+
emoji_type?: string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}>;
|
|
81
|
+
delete(args: MessageReactionDeleteArgs): Promise<{
|
|
82
|
+
code?: number;
|
|
83
|
+
msg?: string;
|
|
84
|
+
data?: {
|
|
85
|
+
reaction_id?: string;
|
|
86
|
+
reaction_type?: {
|
|
87
|
+
emoji_type?: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}>;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export class EventDispatcher {
|
|
96
|
+
constructor(options: {
|
|
97
|
+
encryptKey: string;
|
|
98
|
+
verificationToken: string;
|
|
99
|
+
});
|
|
100
|
+
register(handlers: Record<string, (data: unknown) => Promise<void> | void>): void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export class WSClient {
|
|
104
|
+
constructor(options: {
|
|
105
|
+
appId: string;
|
|
106
|
+
appSecret: string;
|
|
107
|
+
domain?: Domain | string;
|
|
108
|
+
loggerLevel?: LoggerLevel;
|
|
109
|
+
});
|
|
110
|
+
start(args: { eventDispatcher: EventDispatcher }): Promise<void>;
|
|
111
|
+
close(args?: { force?: boolean }): void;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -7,6 +7,7 @@ build = ["bash", ".cozeproj/scripts/dev_build.sh"]
|
|
|
7
7
|
run = ["bash", ".cozeproj/scripts/dev_run.sh"]
|
|
8
8
|
deps = ["git"] # -> apt install git
|
|
9
9
|
pack = ["bash", ".cozeproj/scripts/pack.sh"]
|
|
10
|
+
validate = ["bash", ".cozeproj/scripts/validate.sh"]
|
|
10
11
|
|
|
11
12
|
[deploy]
|
|
12
13
|
build = ["bash", ".cozeproj/scripts/deploy_build.sh"]
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"postinstall": "weapp-tw patch",
|
|
20
20
|
"kill:all": "pkill -9 -f 'concurrently' 2>/dev/null || true; pkill -9 -f 'nest start' 2>/dev/null || true; pkill -9 -f 'taro build' 2>/dev/null || true; pkill -9 -f 'node.*dev' 2>/dev/null || true; echo 'All dev processes cleaned'",
|
|
21
21
|
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx,css}\"",
|
|
22
|
-
"lint:build": "eslint \"src/**/*.{js,jsx,ts,tsx,css}\" --max-warnings=0",
|
|
22
|
+
"lint:build": "eslint \"src/**/*.{js,jsx,ts,tsx,css}\" --max-warnings=0 --quiet",
|
|
23
23
|
"lint:fix": "eslint \"src/**/*.{js,jsx,ts,tsx,css}\" --fix",
|
|
24
24
|
"new": "taro new",
|
|
25
25
|
"preview:tt": "taro build --type tt --preview",
|
|
@@ -94,6 +94,30 @@
|
|
|
94
94
|
"additionalProperties": false
|
|
95
95
|
}
|
|
96
96
|
},
|
|
97
|
+
{
|
|
98
|
+
"name": "pi-agent",
|
|
99
|
+
"description": "Pi Agent:`coze init ${COZE_WORKSPACE_PATH} --template pi-agent`\n- 适用:基于 pi-agent-core 的 AI Agent 应用\n- 支持飞书、微信等多渠道接入\n- 内置 Dashboard 管理面板\n- 使用 TypeScript + Express + Vite",
|
|
100
|
+
"location": "./pi-agent",
|
|
101
|
+
"paramsSchema": {
|
|
102
|
+
"type": "object",
|
|
103
|
+
"properties": {
|
|
104
|
+
"port": {
|
|
105
|
+
"type": "number",
|
|
106
|
+
"default": 5000,
|
|
107
|
+
"minimum": 1024,
|
|
108
|
+
"maximum": 65535,
|
|
109
|
+
"description": "Dashboard server port"
|
|
110
|
+
},
|
|
111
|
+
"workspaceDir": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"default": "/workspace/workspace",
|
|
114
|
+
"description": "Workspace directory path"
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
"required": [],
|
|
118
|
+
"additionalProperties": false
|
|
119
|
+
}
|
|
120
|
+
},
|
|
97
121
|
{
|
|
98
122
|
"name": "taro",
|
|
99
123
|
"description": "Taro(小程序 + H5):`coze init ${COZE_WORKSPACE_PATH} --template taro`\n- 适用:微信小程序、H5 跨端应用\n- 前后端分离架构:Taro 4 + NestJS\n- 支持微信小程序和 H5 双端构建\n- 使用 TailwindCSS + weapp-tailwindcss 实现跨端样式",
|
|
@@ -7,8 +7,10 @@
|
|
|
7
7
|
"dev": "bash ./scripts/dev.sh",
|
|
8
8
|
"preinstall": "npx only-allow pnpm",
|
|
9
9
|
"lint": "eslint",
|
|
10
|
+
"lint:build": "eslint . --quiet",
|
|
10
11
|
"start": "bash ./scripts/start.sh",
|
|
11
|
-
"ts-check": "tsc -p tsconfig.json"
|
|
12
|
+
"ts-check": "tsc -p tsconfig.json",
|
|
13
|
+
"validate": "pnpm run --parallel '/^(ts-check|lint:build)$/'"
|
|
12
14
|
},
|
|
13
15
|
"dependencies": {
|
|
14
16
|
"@supabase/supabase-js": "2.95.3",
|
package/lib/cli.js
CHANGED
|
@@ -2107,7 +2107,7 @@ const EventBuilder = {
|
|
|
2107
2107
|
};
|
|
2108
2108
|
|
|
2109
2109
|
var name = "@coze-arch/cli";
|
|
2110
|
-
var version = "0.0.
|
|
2110
|
+
var version = "0.0.19-alpha.502ddf";
|
|
2111
2111
|
var description = "coze coding devtools cli";
|
|
2112
2112
|
var license = "MIT";
|
|
2113
2113
|
var author = "fanwenjie.fe@bytedance.com";
|
|
@@ -5985,7 +5985,6 @@ const getCommandConfig = (
|
|
|
5985
5985
|
) => {
|
|
5986
5986
|
let commandConfig;
|
|
5987
5987
|
|
|
5988
|
-
// 根据命令名称映射到配置路径
|
|
5989
5988
|
switch (commandName) {
|
|
5990
5989
|
case 'dev':
|
|
5991
5990
|
commandConfig = _optionalChain$4([config, 'access', _ => _.dev, 'optionalAccess', _2 => _2.run]);
|
|
@@ -5996,6 +5995,9 @@ const getCommandConfig = (
|
|
|
5996
5995
|
case 'start':
|
|
5997
5996
|
commandConfig = _optionalChain$4([config, 'access', _5 => _5.deploy, 'optionalAccess', _6 => _6.run]);
|
|
5998
5997
|
break;
|
|
5998
|
+
case 'validate':
|
|
5999
|
+
commandConfig = _optionalChain$4([config, 'access', _7 => _7.dev, 'optionalAccess', _8 => _8.validate]);
|
|
6000
|
+
break;
|
|
5999
6001
|
default:
|
|
6000
6002
|
throw new Error(`Unknown command: ${commandName}`);
|
|
6001
6003
|
}
|
|
@@ -7100,6 +7102,15 @@ const registerCommand$3 = program => {
|
|
|
7100
7102
|
.action(async options => {
|
|
7101
7103
|
await executeRun('start', options);
|
|
7102
7104
|
});
|
|
7105
|
+
|
|
7106
|
+
// validate 命令
|
|
7107
|
+
program
|
|
7108
|
+
.command('validate')
|
|
7109
|
+
.description('Validate project (lint + type check)')
|
|
7110
|
+
.option('--log-file <path>', 'Log file path')
|
|
7111
|
+
.action(async options => {
|
|
7112
|
+
await executeRun('validate', options);
|
|
7113
|
+
});
|
|
7103
7114
|
};
|
|
7104
7115
|
|
|
7105
7116
|
// ABOUTME: Nuxt route scanner
|