@coze-arch/cli 0.0.15-alpha.a0f5b9 → 0.0.15-alpha.dfd4c4
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/eslint.config.mjs +25 -0
- 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__/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 +0 -24
- 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 +330 -97
- package/package.json +1 -1
- package/lib/__templates__/pi-agent/.coze +0 -10
- package/lib/__templates__/pi-agent/AGENTS.md +0 -140
- package/lib/__templates__/pi-agent/README.md +0 -172
- package/lib/__templates__/pi-agent/_gitignore +0 -3
- package/lib/__templates__/pi-agent/_npmrc +0 -23
- package/lib/__templates__/pi-agent/docs/project-overview.md +0 -356
- package/lib/__templates__/pi-agent/docs/user/getting-started.md +0 -47
- package/lib/__templates__/pi-agent/package.json +0 -60
- package/lib/__templates__/pi-agent/pi-resources/SYSTEM.md +0 -15
- package/lib/__templates__/pi-agent/pi-resources/extensions/preference-memory/index.ts +0 -355
- package/lib/__templates__/pi-agent/pi-resources/extensions/test-ping.ts +0 -19
- package/lib/__templates__/pi-agent/pi-resources/prompts/test-prompt.md +0 -11
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-asr/SKILL.md +0 -36
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-asr/scripts/asr.mjs +0 -9
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-image-gen/SKILL.md +0 -41
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-image-gen/scripts/gen.mjs +0 -9
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-tts/SKILL.md +0 -85
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-tts/scripts/tts.mjs +0 -9
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-video-gen/SKILL.md +0 -53
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-video-gen/scripts/gen.mjs +0 -9
- package/lib/__templates__/pi-agent/pnpm-lock.yaml +0 -8285
- package/lib/__templates__/pi-agent/scripts/dev.sh +0 -14
- package/lib/__templates__/pi-agent/scripts/prepare.sh +0 -2
- package/lib/__templates__/pi-agent/src/agent.ts +0 -363
- package/lib/__templates__/pi-agent/src/channels/feishu/index.ts +0 -760
- package/lib/__templates__/pi-agent/src/channels/feishu/streaming-card.ts +0 -297
- package/lib/__templates__/pi-agent/src/channels/wechat/index.ts +0 -171
- package/lib/__templates__/pi-agent/src/config.ts +0 -596
- package/lib/__templates__/pi-agent/src/core.ts +0 -218
- package/lib/__templates__/pi-agent/src/dashboard/api/channels.ts +0 -148
- package/lib/__templates__/pi-agent/src/dashboard/api/docs.ts +0 -204
- package/lib/__templates__/pi-agent/src/dashboard/api/models.ts +0 -141
- package/lib/__templates__/pi-agent/src/dashboard/api/overview.ts +0 -33
- package/lib/__templates__/pi-agent/src/dashboard/config-store.ts +0 -64
- package/lib/__templates__/pi-agent/src/dashboard/index.ts +0 -39
- package/lib/__templates__/pi-agent/src/dashboard/server.ts +0 -622
- package/lib/__templates__/pi-agent/src/dashboard/types.ts +0 -25
- package/lib/__templates__/pi-agent/src/dashboard/web/index.html +0 -13
- package/lib/__templates__/pi-agent/src/dashboard/web/postcss.config.cjs +0 -7
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/app-layout.tsx +0 -186
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/page-title.tsx +0 -17
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/alert.tsx +0 -22
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/badge.tsx +0 -25
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/button.tsx +0 -40
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/card.tsx +0 -29
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/input.tsx +0 -18
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/label.tsx +0 -8
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/select.tsx +0 -80
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/ui/separator.tsx +0 -23
- package/lib/__templates__/pi-agent/src/dashboard/web/src/hooks/use-fetch.ts +0 -32
- package/lib/__templates__/pi-agent/src/dashboard/web/src/hooks/use-local-storage-state.ts +0 -23
- package/lib/__templates__/pi-agent/src/dashboard/web/src/main.tsx +0 -30
- package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/channels-page.tsx +0 -188
- package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/chat-page.tsx +0 -451
- package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/docs-page.tsx +0 -65
- package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/models-page.tsx +0 -122
- package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/overview-page.tsx +0 -134
- package/lib/__templates__/pi-agent/src/dashboard/web/src/services/chat-ws-service.ts +0 -167
- package/lib/__templates__/pi-agent/src/dashboard/web/src/styles.css +0 -294
- package/lib/__templates__/pi-agent/src/dashboard/web/src/utils/index.ts +0 -11
- package/lib/__templates__/pi-agent/src/dashboard/web/tsconfig.json +0 -13
- package/lib/__templates__/pi-agent/src/dashboard/web/vite.config.ts +0 -17
- package/lib/__templates__/pi-agent/src/index.ts +0 -123
- package/lib/__templates__/pi-agent/src/pi-resources.ts +0 -125
- package/lib/__templates__/pi-agent/src/session-store.ts +0 -223
- package/lib/__templates__/pi-agent/src/tools/common/format-coze-error.ts +0 -12
- package/lib/__templates__/pi-agent/src/tools/index.ts +0 -2
- package/lib/__templates__/pi-agent/src/tools/web-fetch/index.ts +0 -195
- package/lib/__templates__/pi-agent/src/tools/web-search/index.ts +0 -206
- package/lib/__templates__/pi-agent/template.config.js +0 -45
- package/lib/__templates__/pi-agent/tests/config.test.ts +0 -315
- package/lib/__templates__/pi-agent/tests/dashboard-docs-api.test.ts +0 -125
- package/lib/__templates__/pi-agent/tests/dashboard-models-api.test.ts +0 -171
- package/lib/__templates__/pi-agent/tests/feishu-channel.test.ts +0 -149
- package/lib/__templates__/pi-agent/tests/feishu-streaming-card.test.ts +0 -15
- package/lib/__templates__/pi-agent/tests/pi-resources.test.ts +0 -73
- package/lib/__templates__/pi-agent/tests/preference-memory.test.ts +0 -43
- package/lib/__templates__/pi-agent/tests/session-store.test.ts +0 -61
- package/lib/__templates__/pi-agent/tests/smoke/run-smoke.ts +0 -275
- package/lib/__templates__/pi-agent/tests/web-fetch.test.ts +0 -157
- package/lib/__templates__/pi-agent/tests/web-search.test.ts +0 -208
- package/lib/__templates__/pi-agent/tsconfig.json +0 -21
- package/lib/__templates__/pi-agent/types/larksuiteoapi-node-sdk.d.ts +0 -113
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
export type DashboardOverviewResponse = {
|
|
2
|
-
appName: string;
|
|
3
|
-
botStatus: string;
|
|
4
|
-
dashboardUrl: string;
|
|
5
|
-
agentMode: string;
|
|
6
|
-
workspaceDir: string;
|
|
7
|
-
agentDir: string;
|
|
8
|
-
enabledChannels: Array<{ id: string; enabled: boolean }>;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export function buildOverviewResponse(args: {
|
|
12
|
-
dashboardUrl: string;
|
|
13
|
-
dashboardStarted: boolean;
|
|
14
|
-
appName: string;
|
|
15
|
-
agentMode: string;
|
|
16
|
-
workspaceDir: string;
|
|
17
|
-
agentDir: string;
|
|
18
|
-
enabledChannels: { feishu: boolean; wechat: boolean };
|
|
19
|
-
}): DashboardOverviewResponse {
|
|
20
|
-
const { dashboardUrl, dashboardStarted } = args;
|
|
21
|
-
return {
|
|
22
|
-
appName: args.appName,
|
|
23
|
-
botStatus: dashboardStarted ? "running" : "stopped",
|
|
24
|
-
dashboardUrl,
|
|
25
|
-
agentMode: args.agentMode,
|
|
26
|
-
workspaceDir: args.workspaceDir || "Not set",
|
|
27
|
-
agentDir: args.agentDir || "Not set",
|
|
28
|
-
enabledChannels: [
|
|
29
|
-
{ id: "feishu", enabled: Boolean(args.enabledChannels.feishu) },
|
|
30
|
-
{ id: "wechat", enabled: Boolean(args.enabledChannels.wechat) },
|
|
31
|
-
],
|
|
32
|
-
};
|
|
33
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
|
-
|
|
3
|
-
export interface ConfigStore {
|
|
4
|
-
read(): Record<string, unknown>;
|
|
5
|
-
write(root: Record<string, unknown>): void;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export type ConfigSource =
|
|
9
|
-
| {
|
|
10
|
-
configPath: string;
|
|
11
|
-
configStore?: never;
|
|
12
|
-
}
|
|
13
|
-
| {
|
|
14
|
-
configPath?: never;
|
|
15
|
-
configStore: ConfigStore;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
function cloneConfig(root: Record<string, unknown>): Record<string, unknown> {
|
|
19
|
-
return JSON.parse(JSON.stringify(root)) as Record<string, unknown>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function ensureConfigRoot(value: unknown, source: string): Record<string, unknown> {
|
|
23
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
24
|
-
throw new Error(`Invalid config.json shape at ${source}`);
|
|
25
|
-
}
|
|
26
|
-
return value as Record<string, unknown>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function createFileConfigStore(configPath: string): ConfigStore {
|
|
30
|
-
return {
|
|
31
|
-
read() {
|
|
32
|
-
const raw = readFileSync(configPath, "utf-8");
|
|
33
|
-
return ensureConfigRoot(JSON.parse(raw) as unknown, configPath);
|
|
34
|
-
},
|
|
35
|
-
write(root) {
|
|
36
|
-
writeFileSync(configPath, `${JSON.stringify(root, null, 2)}\n`, "utf-8");
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function createMemoryConfigStore(
|
|
42
|
-
initialRoot: Record<string, unknown>,
|
|
43
|
-
): ConfigStore & { snapshot(): Record<string, unknown> } {
|
|
44
|
-
let current = cloneConfig(initialRoot);
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
read() {
|
|
48
|
-
return cloneConfig(current);
|
|
49
|
-
},
|
|
50
|
-
write(root) {
|
|
51
|
-
current = cloneConfig(root);
|
|
52
|
-
},
|
|
53
|
-
snapshot() {
|
|
54
|
-
return cloneConfig(current);
|
|
55
|
-
},
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function getConfigStore(source: ConfigSource): ConfigStore {
|
|
60
|
-
if (source.configStore) {
|
|
61
|
-
return source.configStore;
|
|
62
|
-
}
|
|
63
|
-
return createFileConfigStore(source.configPath);
|
|
64
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { BotAppConfig } from "../core.js";
|
|
2
|
-
import { createDashboardServer } from "./server.js";
|
|
3
|
-
import type { DashboardServer } from "./types.js";
|
|
4
|
-
import type { PiAgentRuntime } from "../agent.js";
|
|
5
|
-
import {
|
|
6
|
-
createFileConfigStore,
|
|
7
|
-
type ConfigStore,
|
|
8
|
-
} from "./config-store.js";
|
|
9
|
-
|
|
10
|
-
export function createDashboard(args: {
|
|
11
|
-
botConfig: BotAppConfig;
|
|
12
|
-
channels: { feishu?: unknown; wechat?: unknown };
|
|
13
|
-
agentRuntime: PiAgentRuntime;
|
|
14
|
-
configStore?: ConfigStore;
|
|
15
|
-
}): DashboardServer {
|
|
16
|
-
const configStore =
|
|
17
|
-
args.configStore ??
|
|
18
|
-
(args.botConfig.agent.configPath
|
|
19
|
-
? createFileConfigStore(args.botConfig.agent.configPath)
|
|
20
|
-
: undefined);
|
|
21
|
-
if (!configStore) {
|
|
22
|
-
throw new Error("Missing botConfig.agent.configPath for dashboard.");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return createDashboardServer({
|
|
26
|
-
runtime: {
|
|
27
|
-
appName: args.botConfig.appName,
|
|
28
|
-
agentMode: args.botConfig.agent.mode,
|
|
29
|
-
workspaceDir: args.botConfig.agent.cwd ?? "",
|
|
30
|
-
agentDir: args.botConfig.agent.agentDir ?? "",
|
|
31
|
-
enabledChannels: {
|
|
32
|
-
feishu: Boolean(args.channels.feishu),
|
|
33
|
-
wechat: Boolean(args.channels.wechat),
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
agentRuntime: args.agentRuntime,
|
|
37
|
-
configStore,
|
|
38
|
-
});
|
|
39
|
-
}
|