@coze-arch/cli 0.0.19-alpha.502ddf → 0.0.19-alpha.a5388a
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__/nuxt-vue/app/pages/index.vue +0 -6
- package/lib/__templates__/nuxt-vue/nuxt.config.ts +2 -2
- package/lib/__templates__/pi-agent/AGENTS.md +2 -7
- package/lib/__templates__/pi-agent/README.md +0 -2
- package/lib/__templates__/pi-agent/docs/project-overview.md +15 -9
- package/lib/__templates__/pi-agent/docs/user/getting-started.md +4 -3
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-asr/SKILL.md +10 -4
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-asr/scripts/asr.mjs +9 -0
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-image-gen/SKILL.md +18 -6
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-image-gen/scripts/gen.mjs +9 -0
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-tts/SKILL.md +37 -9
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-tts/scripts/tts.mjs +9 -0
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-video-gen/SKILL.md +30 -17
- package/lib/__templates__/pi-agent/pi-resources/skills/coze-video-gen/scripts/gen.mjs +9 -0
- package/lib/__templates__/pi-agent/src/config.ts +19 -60
- package/lib/__templates__/pi-agent/src/core.ts +0 -1
- package/lib/__templates__/pi-agent/src/dashboard/api/docs.ts +204 -0
- package/lib/__templates__/pi-agent/src/dashboard/index.ts +4 -39
- package/lib/__templates__/pi-agent/src/dashboard/server.ts +12 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/components/app-layout.tsx +15 -1
- package/lib/__templates__/pi-agent/src/dashboard/web/src/main.tsx +6 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/channels-page.tsx +188 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/chat-page.tsx +11 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/docs-page.tsx +65 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/models-page.tsx +122 -0
- package/lib/__templates__/pi-agent/src/dashboard/web/src/pages/overview-page.tsx +72 -268
- package/lib/__templates__/pi-agent/src/dashboard/web/src/styles.css +91 -0
- package/lib/__templates__/pi-agent/tests/config.test.ts +1 -63
- package/lib/__templates__/pi-agent/tests/dashboard-docs-api.test.ts +125 -0
- package/lib/cli.js +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
// 显式声明多词组件名,否则 index.vue 会命中 vue/multi-word-component-names,导致 lint 报错。
|
|
3
|
-
defineOptions({
|
|
4
|
-
name: 'LandingPage',
|
|
5
|
-
});
|
|
6
|
-
</script>
|
|
7
1
|
<template>
|
|
8
2
|
<div class="flex min-h-screen items-center justify-center">
|
|
9
3
|
<main class="flex w-full max-w-3xl flex-col items-center justify-center px-16 py-32">
|
|
@@ -9,8 +9,7 @@ export default defineNuxtConfig({
|
|
|
9
9
|
compatibilityDate: '2025-07-15',
|
|
10
10
|
// Disable devtools in CI/test environments (prevents hanging in headless mode)
|
|
11
11
|
devtools: {
|
|
12
|
-
enabled:
|
|
13
|
-
process.env.CI !== 'true' && process.env.COZE_PROJECT_ENV !== 'PROD',
|
|
12
|
+
enabled: process.env.CI !== 'true' && process.env.COZE_PROJECT_ENV !== 'PROD',
|
|
14
13
|
},
|
|
15
14
|
telemetry: false,
|
|
16
15
|
|
|
@@ -80,6 +79,7 @@ export default defineNuxtConfig({
|
|
|
80
79
|
// Vite configuration (similar to Next.js allowedDevOrigins)
|
|
81
80
|
vite: {
|
|
82
81
|
server: {
|
|
82
|
+
host: '0.0.0.0',
|
|
83
83
|
cors: {
|
|
84
84
|
origin: ['*.dev.coze.site'],
|
|
85
85
|
credentials: true,
|
|
@@ -93,14 +93,9 @@
|
|
|
93
93
|
- 新增 skill:
|
|
94
94
|
- `pi-resources/skills/<skill-name>/SKILL.md`
|
|
95
95
|
- 必要的 `scripts/*`
|
|
96
|
-
-
|
|
96
|
+
- 用户要求新建 Markdown 文档、方案、总结、设计稿等 `.md` 文件:
|
|
97
97
|
- 默认放在 `cwd`
|
|
98
|
-
-
|
|
99
|
-
- 二次开发过程中新增给开发者看的 Markdown 文档,例如功能使用说明、代码上下文说明、设计约束、排障手册:
|
|
100
|
-
- 默认放在 `docs/` 下,按内容选择合适的子目录
|
|
101
|
-
- 文件名使用小写 kebab-case,不要使用大写字母命名
|
|
102
|
-
- 如果该文档会成为后续开发过程中的长期参考资料,同步更新 `docs/project-overview.md`,写明推荐阅读时机
|
|
103
|
-
- 不要默认放进 repo 根目录、`src/` 或其他源码目录
|
|
98
|
+
- 不要默认放进 `src/` 或其他源码目录
|
|
104
99
|
- 新增 extension / runtime tool:
|
|
105
100
|
- `pi-resources/extensions/<extension-name>/index.ts`
|
|
106
101
|
- 或 `pi-resources/extensions/*.ts`
|
|
@@ -49,8 +49,6 @@ npm run dev
|
|
|
49
49
|
`npm run dev` 会先按顺序加载 `.env` 和 `.env.local`,然后启动 `src/index.ts`。
|
|
50
50
|
默认会使用 `pi` runtime;如果你只是想走本地 mock 链路,可以额外设置 `PI_BOT_AGENT_MODE=mock`。
|
|
51
51
|
|
|
52
|
-
如果默认的 `<%= workspaceDir %>/config.json` 不存在,启动时会输出 warning,并自动回退到最小 mock 配置;此时默认会以 `mock` runtime 运行。
|
|
53
|
-
|
|
54
52
|
## 用户文档
|
|
55
53
|
|
|
56
54
|
启动后,可以在 Dashboard 的 `Docs` 页面查看当前项目的用户指引,默认地址是:
|
|
@@ -52,6 +52,7 @@
|
|
|
52
52
|
│ │ ├── config-store.ts
|
|
53
53
|
│ │ ├── api
|
|
54
54
|
│ │ │ ├── channels.ts
|
|
55
|
+
│ │ │ ├── docs.ts
|
|
55
56
|
│ │ │ ├── models.ts
|
|
56
57
|
│ │ │ └── overview.ts
|
|
57
58
|
│ │ ├── web
|
|
@@ -130,7 +131,8 @@
|
|
|
130
131
|
- `src/channels/wechat`
|
|
131
132
|
- 微信消息标准化和回复发送
|
|
132
133
|
- `src/dashboard/*`
|
|
133
|
-
- 本地 Dashboard(HTTP + WebSocket
|
|
134
|
+
- 本地 Dashboard(HTTP + WebSocket),用于查看运行状态、编辑配置、以及以 UI 方式调试聊天会话
|
|
135
|
+
- 同时提供 `Docs` 页面,直接展示项目内的快速开始文档
|
|
134
136
|
- 开发态通过 Vite middleware 提供前端资源;生产态直接托管 `src/dashboard/web/dist`
|
|
135
137
|
- `src/dashboard/config-store.ts`
|
|
136
138
|
- Dashboard 配置存储抽象
|
|
@@ -151,6 +153,8 @@
|
|
|
151
153
|
- `coze_web_fetch` 工具单测:覆盖 text/markdown/json 格式渲染、textOnly 模式、链接过滤、图片尺寸、并发抓取、异常处理
|
|
152
154
|
- `tests/web-search.test.ts`
|
|
153
155
|
- `coze_web_search` 工具单测:覆盖基本搜索、摘要、内容包含、图片搜索、路由判断、默认参数、空结果、异常处理
|
|
156
|
+
- `tests/dashboard-docs-api.test.ts`
|
|
157
|
+
- Dashboard docs API 测试
|
|
154
158
|
- `tests/dashboard-models-api.test.ts`
|
|
155
159
|
- Dashboard models API 测试
|
|
156
160
|
- `tests/feishu-channel.test.ts`
|
|
@@ -200,16 +204,18 @@ Dashboard 是一个「和 Bot 同进程」启动的本地 HTTP 服务,默认
|
|
|
200
204
|
|
|
201
205
|
前端路由位于 `src/dashboard/web/src/main.tsx`,当前页面:
|
|
202
206
|
|
|
203
|
-
- `/overview
|
|
207
|
+
- `/overview`:运行状态与关键路径(workspace/agent dir 等)
|
|
208
|
+
- `/docs`:项目快速开始文档
|
|
209
|
+
- `/models`:切换默认模型
|
|
210
|
+
- `/channels`:编辑渠道配置
|
|
204
211
|
- `/chat`:调试聊天会话(含历史、reset、WebSocket 流式)
|
|
205
212
|
|
|
206
|
-
导航栏仅包含「聊天」和「概览」两个入口,md 断点及以上直接展示带文字标签的侧边栏。
|
|
207
|
-
|
|
208
213
|
### 3.3 HTTP API(服务端)
|
|
209
214
|
|
|
210
215
|
当前主要接口(均在同一进程内,不做鉴权):
|
|
211
216
|
|
|
212
|
-
- `GET /api/overview
|
|
217
|
+
- `GET /api/overview`:运行状态/路径/启用渠道等
|
|
218
|
+
- `GET /api/docs`:读取 `docs/user/` 下的用户文档并返回当前文档内容
|
|
213
219
|
- `GET /api/models`:通过 `ConfigStore` 读取配置并返回默认模型与可选模型列表(用于下拉选择)
|
|
214
220
|
- `POST /api/models`:仅写回默认模型(请求体只包含 `defaultModel`;服务端会基于当前配置扫描列表做校验)
|
|
215
221
|
- `GET /api/channels`:通过 `ConfigStore` 读取配置并返回可编辑结构
|
|
@@ -224,13 +230,13 @@ Dashboard 是一个「和 Bot 同进程」启动的本地 HTTP 服务,默认
|
|
|
224
230
|
- `createBotApp(..., { dashboardConfigStore })` 可注入自定义存储实现
|
|
225
231
|
- `tests/smoke/run-smoke.ts` 当前使用内存型 `ConfigStore`,直接验证 dashboard 配置的读写 API 行为
|
|
226
232
|
|
|
227
|
-
### 3.4
|
|
233
|
+
### 3.4 模型配置页能力边界
|
|
228
234
|
|
|
229
|
-
|
|
235
|
+
当前 `/models` 页面的目标,是以 UI 方式快速切换默认模型,降低直接手改 JSON 的成本。当前页面支持:
|
|
230
236
|
|
|
231
237
|
- 修改默认模型(写回 `agents.defaults.model.primary`)
|
|
232
238
|
|
|
233
|
-
|
|
239
|
+
当前页面不支持:
|
|
234
240
|
|
|
235
241
|
- 编辑 Provider 配置
|
|
236
242
|
- 编辑模型参数
|
|
@@ -363,6 +369,6 @@ npm run dashboard:build
|
|
|
363
369
|
- `docs/project-overview.md`
|
|
364
370
|
- 面向维护者的架构介绍
|
|
365
371
|
- `docs/user/getting-started.md`
|
|
366
|
-
-
|
|
372
|
+
- 面向项目使用者的快速开始文档,Dashboard 的 `Docs` 页面会直接读取并展示
|
|
367
373
|
|
|
368
374
|
最贴近现状的介绍文档是这份 `docs/project-overview.md`。如果其他文档与当前目录结构冲突,应以当前源码、`README.md` 和本文件为准。
|
|
@@ -9,10 +9,11 @@ title: 快速开始
|
|
|
9
9
|
|
|
10
10
|
## 接入飞书机器人
|
|
11
11
|
|
|
12
|
-
1. 打开 [
|
|
12
|
+
1. 打开 [渠道](/channels) 页面。
|
|
13
13
|
2. 填写 `App ID` 和 `App Secret`。
|
|
14
|
-
3.
|
|
15
|
-
4.
|
|
14
|
+
3. 按需填写 `domain`、`encryptKey`、`verificationToken`。
|
|
15
|
+
4. 点击保存。
|
|
16
|
+
5. 重启应用让配置生效。
|
|
16
17
|
|
|
17
18
|
### 飞书机器人配置
|
|
18
19
|
|
|
@@ -10,15 +10,14 @@ Transcribe audio from a URL or local file using Coze ASR.
|
|
|
10
10
|
## Quick start
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
node {skillDir}/scripts/asr.mjs --url "https://example.com/audio.mp3"
|
|
14
|
+
node {skillDir}/scripts/asr.mjs --file ./recording.mp3
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Options
|
|
18
18
|
|
|
19
19
|
- `--url <url>`, `-u <url>` remote audio URL
|
|
20
|
-
- `--file <path>`, `-f <path>` local audio file
|
|
21
|
-
- `--header <key:value>`, `-H <key:value>` custom HTTP header; repeatable
|
|
20
|
+
- `--file <path>`, `-f <path>` local audio file
|
|
22
21
|
|
|
23
22
|
## Behavior
|
|
24
23
|
|
|
@@ -28,3 +27,10 @@ npx coze-coding-ai asr --file ./recording.mp3
|
|
|
28
27
|
- Supported audio formats follow the SDK/API capability: WAV, MP3, OGG Opus, M4A.
|
|
29
28
|
- Recommended limits from the SDK docs: duration up to 2 hours, size up to 100MB.
|
|
30
29
|
- The CLI prints recognized `text`, and may also print `duration` and `segments`.
|
|
30
|
+
- The CLI does not print full `utterances` details or raw response payload.
|
|
31
|
+
- This skill does not expose custom headers such as `--header`, `-H`, or mock mode.
|
|
32
|
+
|
|
33
|
+
## Notes
|
|
34
|
+
|
|
35
|
+
- `{skillDir}` means the directory containing this `SKILL.md`.
|
|
36
|
+
- Local files are read and uploaded as base64 audio content.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import createJiti from "jiti";
|
|
4
|
+
|
|
5
|
+
const jiti = createJiti(import.meta.url);
|
|
6
|
+
const { runAsrCli } = await jiti.import("../../../src/skill-cli.ts");
|
|
7
|
+
|
|
8
|
+
const code = await runAsrCli(process.argv.slice(2), process.env);
|
|
9
|
+
process.exit(code);
|
|
@@ -7,23 +7,35 @@ description: Generate one or more images from text prompts using Coze image gene
|
|
|
7
7
|
|
|
8
8
|
Generate one or more images from a prompt using Coze.
|
|
9
9
|
|
|
10
|
+
This skill runs as a Node CLI wrapper around the backend SDK. Do not use the SDK from client-side code.
|
|
11
|
+
|
|
10
12
|
## Quick start
|
|
11
13
|
|
|
12
14
|
```bash
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
node {skillDir}/scripts/gen.mjs --prompt "A futuristic city at sunset"
|
|
16
|
+
node {skillDir}/scripts/gen.mjs --prompt "A serene mountain landscape" --count 2 --size 4K
|
|
17
|
+
node {skillDir}/scripts/gen.mjs --prompt "A hero's journey through magical lands" --sequential --max-sequential 5
|
|
18
|
+
node {skillDir}/scripts/gen.mjs --prompt "Transform into anime style" --image "https://example.com/input.jpg"
|
|
19
|
+
node {skillDir}/scripts/gen.mjs --prompt "A modern office workspace" --response-format url
|
|
16
20
|
```
|
|
17
21
|
|
|
18
22
|
## Options
|
|
19
23
|
|
|
20
|
-
- `--prompt <text
|
|
24
|
+
- `--prompt <text>` required prompt text
|
|
25
|
+
- `--count <n>` number of independent generation requests, default `1`
|
|
21
26
|
- `--size <size>` image size: `2K`, `4K`, or `WIDTHxHEIGHT`, default `2K`
|
|
22
|
-
- `--
|
|
23
|
-
- `--
|
|
27
|
+
- `--image <url>` reference image URL; repeat the flag to pass multiple images
|
|
28
|
+
- `--response-format <format>` only supports `url`
|
|
29
|
+
- `--watermark <true|false>` whether to keep watermark
|
|
30
|
+
- `--optimize-prompt-mode <mode>` prompt optimization mode passed through to the SDK
|
|
31
|
+
- `--sequential` enable sequential image generation
|
|
32
|
+
- `--max-sequential <n>` max sequential frames, default `15`
|
|
33
|
+
- `--header <key:value>` custom HTTP header; repeatable, alias `-H`
|
|
24
34
|
|
|
25
35
|
## Notes
|
|
26
36
|
|
|
37
|
+
- `{skillDir}` means the directory containing this `SKILL.md`.
|
|
27
38
|
- Successful runs print generated URLs directly.
|
|
28
39
|
- Printed image URLs must be kept exactly intact, complete, and accurate. All URL parameters must be preserved without truncation, rewriting, omission, or reordering; in particular, parameters inside the query string such as `sign` must not be dropped, otherwise the image may be inaccessible.
|
|
29
40
|
- Unless the user explicitly asks to download the URL content, only return the complete URL link to the user.
|
|
41
|
+
- This skill does not expose base64 output.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import createJiti from "jiti";
|
|
4
|
+
|
|
5
|
+
const jiti = createJiti(import.meta.url);
|
|
6
|
+
const { runImageCli } = await jiti.import("../../../src/skill-cli.ts");
|
|
7
|
+
|
|
8
|
+
const code = await runImageCli(process.argv.slice(2), process.env);
|
|
9
|
+
process.exit(code);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: coze-tts
|
|
3
|
-
description: Convert text to speech using Coze TTS. Use when you need to synthesize spoken audio from text input, optionally with a specific speaker
|
|
3
|
+
description: Convert text to speech using Coze TTS. Use when you need to synthesize spoken audio from one text input or multiple text segments, optionally with a specific speaker, format, sample rate, or speech settings.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Coze TTS
|
|
@@ -10,15 +10,43 @@ Generate speech audio URLs from text using Coze TTS.
|
|
|
10
10
|
## Quick start
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
node {skillDir}/scripts/tts.mjs --text "Hello, welcome to our service"
|
|
14
|
+
node {skillDir}/scripts/tts.mjs --texts "Chapter 1" "Chapter 2" --speaker zh_male_m191_uranus_bigtts
|
|
15
|
+
node {skillDir}/scripts/tts.mjs --text "Fast announcement" --speech-rate 30 --format mp3 --sample-rate 48000
|
|
15
16
|
```
|
|
16
17
|
|
|
17
18
|
## Options
|
|
18
19
|
|
|
19
|
-
- `--text <text
|
|
20
|
-
- `--
|
|
21
|
-
- `--
|
|
20
|
+
- `--text <text>` single text input. If both `--text` and `--texts` are provided, `--text` takes precedence.
|
|
21
|
+
- `--texts <texts...>` multiple text inputs. Values are read until the next `--flag`.
|
|
22
|
+
- `--speaker <id>` speaker id, default `zh_female_xiaohe_uranus_bigtts`
|
|
23
|
+
- `--format <fmt>` audio format: `mp3`, `pcm`, or `ogg_opus`. Default is SDK default (`mp3`).
|
|
24
|
+
- `--sample-rate <hz>` sample rate. Supported values: `8000`, `16000`, `22050`, `24000`, `32000`, `44100`, `48000`. Default is SDK default (`24000`).
|
|
25
|
+
- `--speech-rate <n>` speech rate adjustment, range `-50` to `100`, default `0`
|
|
26
|
+
- `--loudness-rate <n>` loudness adjustment, range `-50` to `100`, default `0`
|
|
27
|
+
|
|
28
|
+
## Behavior
|
|
29
|
+
|
|
30
|
+
- At least one of `--text` or `--texts` is required.
|
|
31
|
+
- This skill currently supports plain text input only. It does not expose `ssml`, `--header`, `-H`, or `--mock`.
|
|
32
|
+
- The CLI prints one audio URL per generated segment. It does not download audio files locally.
|
|
33
|
+
- Printed audio URLs must be kept exactly intact, complete, and accurate. All URL parameters must be preserved without truncation, rewriting, omission, or reordering; in particular, parameters inside the query string such as `sign` must not be dropped, otherwise the audio may be inaccessible.
|
|
34
|
+
- Unless the user explicitly asks to download the URL content, only return the complete URL link to the user.
|
|
35
|
+
- The CLI does not print `audioSize`, even though the underlying SDK returns it.
|
|
36
|
+
- Invalid ranges or unsupported values are passed through to the SDK and may fail there.
|
|
37
|
+
|
|
38
|
+
## Sample Rates
|
|
39
|
+
|
|
40
|
+
Supported: `8000`, `16000`, `22050`, `24000`, `32000`, `44100`, `48000` Hz
|
|
41
|
+
|
|
42
|
+
- `8000-16000`: Phone quality
|
|
43
|
+
- `22050-24000`: Standard quality (default)
|
|
44
|
+
- `32000-48000`: High quality
|
|
45
|
+
|
|
46
|
+
## Tuning
|
|
47
|
+
|
|
48
|
+
- `speechRate`: range `-50` to `100`, default `0`. Negative values slow speech down, positive values speed it up.
|
|
49
|
+
- `loudnessRate`: range `-50` to `100`, default `0`. Negative values make output quieter, positive values make it louder.
|
|
22
50
|
|
|
23
51
|
## Voices
|
|
24
52
|
|
|
@@ -52,6 +80,6 @@ npx coze-coding-ai tts --text "你好,欢迎使用我们的服务" --speaker z
|
|
|
52
80
|
|
|
53
81
|
## Notes
|
|
54
82
|
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
83
|
+
- `{skillDir}` means the directory containing this `SKILL.md`.
|
|
84
|
+
- The script prints one audio URL per generated segment.
|
|
85
|
+
- The returned URL must be used as-is, in full, and with every parameter preserved exactly, especially query parameters such as `sign`, otherwise the audio may not be accessible.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import createJiti from "jiti";
|
|
4
|
+
|
|
5
|
+
const jiti = createJiti(import.meta.url);
|
|
6
|
+
const { runTtsCli } = await jiti.import("../../../src/skill-cli.ts");
|
|
7
|
+
|
|
8
|
+
const code = await runTtsCli(process.argv.slice(2), process.env);
|
|
9
|
+
process.exit(code);
|
|
@@ -7,34 +7,47 @@ description: Generate a video from text prompts and/or image inputs using Coze v
|
|
|
7
7
|
|
|
8
8
|
Generate a video URL from text and image inputs using Coze.
|
|
9
9
|
|
|
10
|
+
This skill runs as a Node CLI wrapper around the backend SDK. Do not use the SDK from client-side code.
|
|
11
|
+
|
|
10
12
|
## Quick start
|
|
11
13
|
|
|
12
14
|
```bash
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
node {skillDir}/scripts/gen.mjs --prompt "A serene mountain landscape with flowing clouds"
|
|
16
|
+
node {skillDir}/scripts/gen.mjs --prompt "A cinematic robot walking through neon rain" --duration 6 --ratio 9:16 --resolution 1080p
|
|
17
|
+
node {skillDir}/scripts/gen.mjs --prompt "Animate this concept art" --first-frame "https://example.com/first.png"
|
|
18
|
+
node {skillDir}/scripts/gen.mjs --prompt "Transition from sunrise to night" --first-frame "https://example.com/start.png" --last-frame "https://example.com/end.png" --return-last-frame true
|
|
17
19
|
```
|
|
18
20
|
|
|
19
21
|
## Options
|
|
20
22
|
|
|
21
|
-
- `--prompt <text
|
|
22
|
-
- `--image
|
|
23
|
-
- `--
|
|
24
|
-
- `--
|
|
25
|
-
- `--model <
|
|
26
|
-
- `--
|
|
27
|
-
- `--
|
|
28
|
-
- `--
|
|
29
|
-
- `--
|
|
30
|
-
- `--
|
|
31
|
-
- `--
|
|
32
|
-
- `--
|
|
23
|
+
- `--prompt <text>` text prompt
|
|
24
|
+
- `--image <url>` reference image URL; repeat the flag to pass multiple images
|
|
25
|
+
- `--first-frame <url>` first frame image URL
|
|
26
|
+
- `--last-frame <url>` last frame image URL
|
|
27
|
+
- `--model <id>` model id, default SDK model is `doubao-seedance-1-5-pro-251215`
|
|
28
|
+
- `--duration <seconds>` video duration in seconds
|
|
29
|
+
- `--ratio <ratio>` one of `16:9`, `9:16`, `1:1`, `4:3`, `3:4`, `21:9`, `adaptive`
|
|
30
|
+
- `--resolution <value>` one of `480p`, `720p`, `1080p`
|
|
31
|
+
- `--watermark <true|false>` whether to keep watermark
|
|
32
|
+
- `--seed <n>` fixed random seed for reproducibility
|
|
33
|
+
- `--camera-fixed <true|false>` whether to fix the camera
|
|
34
|
+
- `--generate-audio <true|false>` whether to generate synced audio
|
|
35
|
+
- `--return-last-frame <true|false>` whether to return the last-frame image URL
|
|
36
|
+
- `--max-wait-time <seconds>` max synchronous wait time
|
|
37
|
+
- `--callback-url <url>` async callback URL passed through to the SDK
|
|
38
|
+
- `--header <key:value>` custom HTTP header; repeatable, alias `-H`
|
|
33
39
|
|
|
34
40
|
## Behavior
|
|
35
41
|
|
|
36
|
-
- At least one of `--prompt
|
|
42
|
+
- At least one of `--prompt`, `--image`, `--first-frame`, or `--last-frame` is required.
|
|
37
43
|
- Successful runs print `Task ID`, `Status`, `Video URL`, and optionally `Last Frame URL`.
|
|
38
44
|
- The CLI does not download video files locally.
|
|
39
45
|
- Printed video URLs and frame URLs must be kept exactly intact, complete, and accurate. All URL parameters must be preserved without truncation, rewriting, omission, or reordering; in particular, parameters inside the query string such as `sign` must not be dropped, otherwise the asset may be inaccessible.
|
|
40
46
|
- Unless the user explicitly asks to download the URL content, only return the complete URL link to the user.
|
|
47
|
+
|
|
48
|
+
## Notes
|
|
49
|
+
|
|
50
|
+
- `{skillDir}` means the directory containing this `SKILL.md`.
|
|
51
|
+
- The default model `doubao-seedance-1-5-pro-251215` supports text input plus `first_frame` and `last_frame`. Generic `reference_image` inputs from `--image` may be rejected by that model.
|
|
52
|
+
- Only use `--image` when you have selected a model that explicitly supports `reference_image`.
|
|
53
|
+
- The returned video URL is already hosted with a valid expiration period. Unless the user explicitly needs rehosting or download, use it directly.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import createJiti from "jiti";
|
|
4
|
+
|
|
5
|
+
const jiti = createJiti(import.meta.url);
|
|
6
|
+
const { runVideoCli } = await jiti.import("../../../src/skill-cli.ts");
|
|
7
|
+
|
|
8
|
+
const code = await runVideoCli(process.argv.slice(2), process.env);
|
|
9
|
+
process.exit(code);
|
|
@@ -93,7 +93,6 @@ export interface LoadedConfig {
|
|
|
93
93
|
path: string;
|
|
94
94
|
directory: string;
|
|
95
95
|
workspaceDir: string;
|
|
96
|
-
source: "file" | "fallback-mock";
|
|
97
96
|
thinkingLevel?: ThinkingLevel;
|
|
98
97
|
config: Config;
|
|
99
98
|
providers: Record<string, ProviderConfig>;
|
|
@@ -128,56 +127,6 @@ const DEFAULT_APP_NAME = "starter-bot";
|
|
|
128
127
|
const DEFAULT_CONFIG_FILENAME = "config.json";
|
|
129
128
|
const MODULE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
130
129
|
|
|
131
|
-
function createMockConfig(): Config {
|
|
132
|
-
return {
|
|
133
|
-
agents: {
|
|
134
|
-
defaults: {
|
|
135
|
-
workspace: ".",
|
|
136
|
-
model: {
|
|
137
|
-
primary: "openai/gpt-5-mini"
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
channels: {
|
|
142
|
-
feishu: {
|
|
143
|
-
enabled: false,
|
|
144
|
-
requireMention: true,
|
|
145
|
-
thinkingReaction: {
|
|
146
|
-
enabled: true,
|
|
147
|
-
emojiType: "OneSecond"
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
wechat: {
|
|
151
|
-
enabled: false,
|
|
152
|
-
requireMention: false
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
function createLoadedConfig(
|
|
159
|
-
configPath: string,
|
|
160
|
-
parsed: Config,
|
|
161
|
-
source: LoadedConfig["source"]
|
|
162
|
-
): LoadedConfig {
|
|
163
|
-
const directory = dirname(configPath);
|
|
164
|
-
const workspaceDir = resolve(directory, parsed.agents?.defaults?.workspace ?? ".");
|
|
165
|
-
const defaultModelReference = parsed.agents?.defaults?.model?.primary;
|
|
166
|
-
|
|
167
|
-
return {
|
|
168
|
-
path: configPath,
|
|
169
|
-
directory,
|
|
170
|
-
workspaceDir,
|
|
171
|
-
source,
|
|
172
|
-
thinkingLevel: parsed.agents?.defaults?.thinkingLevel,
|
|
173
|
-
config: parsed,
|
|
174
|
-
providers: parsed.models?.providers ?? {},
|
|
175
|
-
defaultModel: defaultModelReference
|
|
176
|
-
? parseModelReference(defaultModelReference, "agents.defaults.model.primary")
|
|
177
|
-
: undefined
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
|
|
181
130
|
export function parseModelReference(reference: string, description = "model reference"): ModelReference {
|
|
182
131
|
const normalized = reference.trim();
|
|
183
132
|
const splitIndex = normalized.indexOf("/");
|
|
@@ -196,8 +145,7 @@ export function parseModelReference(reference: string, description = "model refe
|
|
|
196
145
|
|
|
197
146
|
export function loadConfig(configPath: string): LoadedConfig {
|
|
198
147
|
if (!existsSync(configPath)) {
|
|
199
|
-
|
|
200
|
-
return createLoadedConfig(configPath, createMockConfig(), "fallback-mock");
|
|
148
|
+
throw new Error(`Config not found: ${configPath}`);
|
|
201
149
|
}
|
|
202
150
|
|
|
203
151
|
let parsed: Config;
|
|
@@ -212,11 +160,25 @@ export function loadConfig(configPath: string): LoadedConfig {
|
|
|
212
160
|
);
|
|
213
161
|
}
|
|
214
162
|
|
|
215
|
-
|
|
163
|
+
const directory = dirname(configPath);
|
|
164
|
+
const workspaceDir = resolve(directory, parsed.agents?.defaults?.workspace ?? ".");
|
|
165
|
+
const defaultModelReference = parsed.agents?.defaults?.model?.primary;
|
|
166
|
+
|
|
167
|
+
return {
|
|
168
|
+
path: configPath,
|
|
169
|
+
directory,
|
|
170
|
+
workspaceDir,
|
|
171
|
+
thinkingLevel: parsed.agents?.defaults?.thinkingLevel,
|
|
172
|
+
config: parsed,
|
|
173
|
+
providers: parsed.models?.providers ?? {},
|
|
174
|
+
defaultModel: defaultModelReference
|
|
175
|
+
? parseModelReference(defaultModelReference, "agents.defaults.model.primary")
|
|
176
|
+
: undefined
|
|
177
|
+
};
|
|
216
178
|
}
|
|
217
179
|
|
|
218
180
|
export function loadOptionalConfig(configPath: string | undefined): LoadedConfig | undefined {
|
|
219
|
-
if (!configPath) {
|
|
181
|
+
if (!configPath || !existsSync(configPath)) {
|
|
220
182
|
return undefined;
|
|
221
183
|
}
|
|
222
184
|
|
|
@@ -299,14 +261,11 @@ export function loadBotAppConfig(
|
|
|
299
261
|
|
|
300
262
|
return {
|
|
301
263
|
appName: DEFAULT_APP_NAME,
|
|
302
|
-
configRoot: loadedConfig.config as Record<string, unknown>,
|
|
303
264
|
agent: {
|
|
304
|
-
mode:
|
|
305
|
-
(env.PI_BOT_AGENT_MODE as BotAppConfig["agent"]["mode"] | undefined) ??
|
|
306
|
-
(loadedConfig.source === "fallback-mock" ? "mock" : "pi"),
|
|
265
|
+
mode: (env.PI_BOT_AGENT_MODE as BotAppConfig["agent"]["mode"] | undefined) ?? "pi",
|
|
307
266
|
provider: defaultModel?.provider ?? "openai",
|
|
308
267
|
model: defaultModel?.modelId ?? "gpt-5-mini",
|
|
309
|
-
configPath
|
|
268
|
+
configPath,
|
|
310
269
|
thinkingLevel: loadedConfig.thinkingLevel,
|
|
311
270
|
cwd: workspaceDir,
|
|
312
271
|
agentDir: workspaceDir
|