@pippit-dev/cli 0.0.12 → 0.0.14

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # pippit-cli
1
+ # pippit-tool-cli
2
2
 
3
3
  Minimal demo CLI for Pippit workflows.
4
4
 
@@ -10,11 +10,11 @@ matching prebuilt binary for macOS, Linux, or Windows:
10
10
  ```bash
11
11
  npx @pippit-dev/cli@latest install
12
12
  export XYQ_ACCESS_KEY="<access-key>"
13
- pippit-cli --version
14
- pippit-cli short-drama +submit-run --message "写一个赛博朋克短剧开头"
15
- pippit-cli short-drama +upload-file --path ./reference.doc
16
- pippit-cli short-drama +get-thread --thread-id thread_123 --run-id run_456 --after-seq 0
17
- pippit-cli short-drama +download-result --output-path ./thread_123/results/result.mp4 --url URL
13
+ pippit-tool-cli --version
14
+ pippit-tool-cli short-drama +submit-run --message "写一个赛博朋克短剧开头"
15
+ pippit-tool-cli short-drama +upload-file --path ./reference.doc
16
+ pippit-tool-cli short-drama +get-thread --thread-id thread_123 --run-id run_456 --after-seq 0
17
+ pippit-tool-cli short-drama +download-result --output-path ./thread_123/results/result.mp4 --url URL
18
18
  ```
19
19
 
20
20
  NPM package names must be lowercase, so the publishable package name is
package/checksums.txt CHANGED
@@ -1,6 +1,6 @@
1
- 5062d1d4950aa9e0d8b1770e62476d9bb2076f4492cd24a541ad93b05a254f49 pippit-cli-0.0.12-darwin-amd64.tar.gz
2
- 5a0c8d044ebcb717d18954147433ac5f54f2dc89285e2e50f6be6755431ee99c pippit-cli-0.0.12-darwin-arm64.tar.gz
3
- 456420a71cd9909e152907faa96f35abb93e62079786021d1bee28cfac61e8ff pippit-cli-0.0.12-linux-amd64.tar.gz
4
- 1c6681fa8f8edaa19dac835dd9bdf4bc17c06936700316f7d74b68d55d572460 pippit-cli-0.0.12-linux-arm64.tar.gz
5
- e7c156bb35fb373fa89d05c729252b20951a41c70f3bbd4e8794e4c5abe65e06 pippit-cli-0.0.12-windows-amd64.zip
6
- 2832786f9c13069f3580407e24037e95cc9452534e9996366dc6751f841fcd26 pippit-cli-0.0.12-windows-arm64.zip
1
+ 2d0d79a7a277b9969076a38d3584b6dfc9fece10d6505edc314e56a67ab78974 pippit-tool-cli-0.0.14-darwin-amd64.tar.gz
2
+ e1ecf0319de259bf7e790e90a96e0e596a4a04b5f0b5c774196fd7a5048e9336 pippit-tool-cli-0.0.14-darwin-arm64.tar.gz
3
+ 09056e9f1b2241c7021bb9cb47279d6497848adaea72fb5531cf1ed62a7e6e88 pippit-tool-cli-0.0.14-linux-amd64.tar.gz
4
+ 2b50fa3f7745e6cb5436d82f309870cf17b7faa52ab5129b3179cee69e6b6c88 pippit-tool-cli-0.0.14-linux-arm64.tar.gz
5
+ ffaaca77e50f4962713ce871a871d47992c276ac174c8721c507359b369afcb4 pippit-tool-cli-0.0.14-windows-amd64.zip
6
+ 6cb91adab8d2004160f6792014fd948aea3368c38f38f30aabccd381d31e82eb pippit-tool-cli-0.0.14-windows-arm64.zip
package/cmd/root.go CHANGED
@@ -13,7 +13,7 @@ import (
13
13
  "github.com/spf13/cobra"
14
14
  )
15
15
 
16
- // Execute runs the pippit-cli command tree.
16
+ // Execute runs the pippit-tool-cli command tree.
17
17
  func Execute() error {
18
18
  return NewRootCommand(os.Stdout, os.Stderr).Execute()
19
19
  }
@@ -27,7 +27,7 @@ func NewRootCommand(stdout, stderr io.Writer) *cobra.Command {
27
27
 
28
28
  func newRootCommand(stdout, stderr io.Writer, runner *common.Runner) *cobra.Command {
29
29
  root := &cobra.Command{
30
- Use: "pippit-cli",
30
+ Use: "pippit-tool-cli",
31
31
  Short: "Pippit CLI",
32
32
  Long: "Pippit CLI submits short-drama workflows, downloads generated assets, and updates the installed CLI package.",
33
33
  Version: version.Current(),
@@ -18,7 +18,7 @@ const defaultPackage = "@pippit-dev/cli"
18
18
  func NewCommand(stdout, stderr io.Writer) *cobra.Command {
19
19
  cmd := &cobra.Command{
20
20
  Use: "update",
21
- Short: "Update pippit-cli and bundled skills",
21
+ Short: "Update pippit-tool-cli and bundled skills",
22
22
  RunE: func(cmd *cobra.Command, _ []string) error {
23
23
  return runUpdate(stdout, stderr)
24
24
  },
@@ -32,14 +32,14 @@ func runUpdate(stdout, stderr io.Writer) error {
32
32
  pkg = defaultPackage + "@latest"
33
33
  }
34
34
 
35
- fmt.Fprintf(stderr, "Updating pippit-cli via npm: %s\n", pkg)
35
+ fmt.Fprintf(stderr, "Updating pippit-tool-cli via npm: %s\n", pkg)
36
36
  restore, err := prepareSelfReplace()
37
37
  if err != nil {
38
38
  return fmt.Errorf("prepare self replace: %w", err)
39
39
  }
40
40
  if err := runInheritEnv(stderr, []string{"PIPPIT_CLI_SKIP_SKILLS=1"}, "npm", "install", "-g", pkg); err != nil {
41
41
  restore()
42
- return fmt.Errorf("update pippit-cli: %w", err)
42
+ return fmt.Errorf("update pippit-tool-cli: %w", err)
43
43
  }
44
44
 
45
45
  root, err := globalPackageRoot(defaultPackage)
@@ -47,12 +47,12 @@ func runUpdate(stdout, stderr io.Writer) error {
47
47
  return fmt.Errorf("locate global package: %w", err)
48
48
  }
49
49
 
50
- fmt.Fprintln(stderr, "Updating pippit-cli skills...")
50
+ fmt.Fprintln(stderr, "Updating pippit-tool-cli skills...")
51
51
  if err := installSkills(root, stderr); err != nil {
52
- return fmt.Errorf("update pippit-cli skills: %w", err)
52
+ return fmt.Errorf("update pippit-tool-cli skills: %w", err)
53
53
  }
54
54
 
55
- fmt.Fprintln(stdout, "pippit-cli and skills updated")
55
+ fmt.Fprintln(stdout, "pippit-tool-cli and skills updated")
56
56
  return nil
57
57
  }
58
58
 
@@ -107,7 +107,7 @@ func prepareSelfReplace() (func(), error) {
107
107
  if err != nil {
108
108
  return nil, err
109
109
  }
110
- if filepath.Base(exe) != "pippit-cli.exe" || !strings.Contains(exe, "node_modules") {
110
+ if filepath.Base(exe) != "pippit-tool-cli.exe" || !strings.Contains(exe, "node_modules") {
111
111
  return func() {}, nil
112
112
  }
113
113
  old := exe + ".old"
@@ -31,7 +31,7 @@ type DownloadResultError struct {
31
31
  Error string `json:"error"`
32
32
  }
33
33
 
34
- // DownloadResultResponse is the JSON envelope printed by `pippit-cli short-drama +download-result`.
34
+ // DownloadResultResponse is the JSON envelope printed by `pippit-tool-cli short-drama +download-result`.
35
35
  type DownloadResultResponse struct {
36
36
  OutputPath string `json:"output_path"`
37
37
  Downloaded []string `json:"downloaded"`
@@ -24,7 +24,7 @@ type ThreadFile struct {
24
24
  DownloadURL string `json:"download_url"`
25
25
  }
26
26
 
27
- // ListThreadFileResult is the JSON envelope printed by `pippit-cli short-drama +list-thread-file`.
27
+ // ListThreadFileResult is the JSON envelope printed by `pippit-tool-cli short-drama +list-thread-file`.
28
28
  type ListThreadFileResult struct {
29
29
  Files []*ThreadFile `json:"files"`
30
30
  Total int64 `json:"total"`
@@ -17,7 +17,7 @@ type UploadFileOptions struct {
17
17
  FileName string `json:"file_name"`
18
18
  }
19
19
 
20
- // UploadFileResult is the JSON envelope printed by `pippit-cli short-drama +upload-file`.
20
+ // UploadFileResult is the JSON envelope printed by `pippit-tool-cli short-drama +upload-file`.
21
21
  type UploadFileResult struct {
22
22
  AssetID string `json:"asset_id"`
23
23
  }
@@ -22,7 +22,7 @@ type ThreadEntry struct {
22
22
  Content []any `json:"content"`
23
23
  }
24
24
 
25
- // GetThreadResult is the JSON envelope printed by `pippit-cli short-drama +get-thread`.
25
+ // GetThreadResult is the JSON envelope printed by `pippit-tool-cli short-drama +get-thread`.
26
26
  type GetThreadResult struct {
27
27
  Messages []*ThreadEntry `json:"messages"`
28
28
  }
@@ -15,7 +15,7 @@ type SubmitRunOptions struct {
15
15
  AssetIDs []string `json:"asset_ids,omitempty"`
16
16
  }
17
17
 
18
- // SubmitRunResult is the JSON envelope printed by `pippit-cli short-drama +submit-run`.
18
+ // SubmitRunResult is the JSON envelope printed by `pippit-tool-cli short-drama +submit-run`.
19
19
  type SubmitRunResult struct {
20
20
  ThreadID string `json:"thread_id"`
21
21
  RunID string `json:"run_id"`
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@pippit-dev/cli",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "description": "Pippit CLI",
5
5
  "bin": {
6
- "pippit-cli": "scripts/run.js"
6
+ "pippit-tool-cli": "scripts/run.js"
7
7
  },
8
8
  "scripts": {
9
9
  "postinstall": "node scripts/install.js",
@@ -17,12 +17,12 @@ function getGloballyInstalledVersion() {
17
17
  }
18
18
  }
19
19
 
20
- function whichPippitCli() {
20
+ function whichPippitToolCli() {
21
21
  try {
22
22
  const prefix = runSilent("npm", ["prefix", "-g"], { timeout: 15000 }).toString().trim();
23
23
  const bin = isWindows
24
- ? path.join(prefix, "pippit-cli.cmd")
25
- : path.join(prefix, "bin", "pippit-cli");
24
+ ? path.join(prefix, "pippit-tool-cli.cmd")
25
+ : path.join(prefix, "bin", "pippit-tool-cli");
26
26
  if (fs.existsSync(bin)) return bin;
27
27
  } catch (_) {
28
28
  // Fall back to PATH lookup.
@@ -30,7 +30,7 @@ function whichPippitCli() {
30
30
 
31
31
  try {
32
32
  const cmd = isWindows ? "where" : "which";
33
- return runSilent(cmd, ["pippit-cli"]).toString().split("\n")[0].trim();
33
+ return runSilent(cmd, ["pippit-tool-cli"]).toString().split("\n")[0].trim();
34
34
  } catch (_) {
35
35
  return null;
36
36
  }
@@ -39,7 +39,7 @@ function whichPippitCli() {
39
39
  function main() {
40
40
  const installed = getGloballyInstalledVersion();
41
41
  if (installed) {
42
- console.log(`Updating global pippit-cli (${installed}) via ${PKG}...`);
42
+ console.log(`Updating global pippit-tool-cli (${installed}) via ${PKG}...`);
43
43
  } else {
44
44
  console.log(`Installing ${PKG} globally...`);
45
45
  }
@@ -48,7 +48,7 @@ function main() {
48
48
  env: { ...process.env, PIPPIT_CLI_SKIP_SKILLS: "1" },
49
49
  });
50
50
 
51
- console.log("Installing pippit-cli skills...");
51
+ console.log("Installing pippit-tool-cli skills...");
52
52
  try {
53
53
  installGlobalPackageSkills(DEFAULT_PKG);
54
54
  } catch (err) {
@@ -60,15 +60,15 @@ function main() {
60
60
  installGlobalPackageSkills(DEFAULT_PKG);
61
61
  }
62
62
 
63
- const bin = whichPippitCli();
63
+ const bin = whichPippitToolCli();
64
64
  if (!bin) {
65
- console.error("pippit-cli was installed, but no global command was found in npm prefix.");
65
+ console.error("pippit-tool-cli was installed, but no global command was found in npm prefix.");
66
66
  console.error("Check that npm's global bin directory is in PATH.");
67
67
  process.exit(1);
68
68
  }
69
69
 
70
- console.log(`pippit-cli is ready: ${bin}`);
71
- console.log("Try: pippit-cli short-drama +submit-run --message \"写一个短剧开头\"");
70
+ console.log(`pippit-tool-cli is ready: ${bin}`);
71
+ console.log("Try: pippit-tool-cli short-drama +submit-run --message \"写一个短剧开头\"");
72
72
  }
73
73
 
74
74
  main();
@@ -9,7 +9,7 @@ const { installSkillsFromRoot } = require("./skills");
9
9
 
10
10
  const VERSION = require("../package.json").version.replace(/-.*$/, "");
11
11
  const REPO = "Pippit-dev/cli";
12
- const NAME = "pippit-cli";
12
+ const NAME = "pippit-tool-cli";
13
13
  const ROOT = path.join(__dirname, "..");
14
14
  const BIN_DIR = path.join(ROOT, "bin");
15
15
 
@@ -121,7 +121,7 @@ function install() {
121
121
 
122
122
  fs.mkdirSync(BIN_DIR, { recursive: true });
123
123
 
124
- const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "pippit-cli-"));
124
+ const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "pippit-tool-cli-"));
125
125
  const archivePath = path.join(tmpDir, archiveName);
126
126
  try {
127
127
  download(releaseURL, archivePath);
package/scripts/run.js CHANGED
@@ -6,7 +6,7 @@ const path = require("path");
6
6
  const { maybeWarnNewVersion } = require("./version-check");
7
7
 
8
8
  const ext = process.platform === "win32" ? ".exe" : "";
9
- const bin = path.join(__dirname, "..", "bin", "pippit-cli" + ext);
9
+ const bin = path.join(__dirname, "..", "bin", "pippit-tool-cli" + ext);
10
10
  const args = process.argv.slice(2);
11
11
 
12
12
  const oldBin = bin + ".old";
@@ -50,7 +50,7 @@ if (args[0] === "install") {
50
50
  });
51
51
  } catch (_) {
52
52
  console.error(
53
- "\nFailed to prepare pippit-cli binary.\n" +
53
+ "\nFailed to prepare pippit-tool-cli binary.\n" +
54
54
  "Make sure Go is installed and available in PATH, then retry.\n"
55
55
  );
56
56
  process.exit(1);
@@ -85,7 +85,7 @@ function maybeWarnNewVersion(args = [], opts = {}) {
85
85
  if (compareSemver(latest, current) <= 0) return;
86
86
 
87
87
  const warn = opts.warn || console.error;
88
- warn(`[pippit-cli] New version available: ${current} -> ${latest}. Run: pippit-cli update`);
88
+ warn(`[pippit-tool-cli] New version available: ${current} -> ${latest}. Run: pippit-tool-cli update`);
89
89
  }
90
90
 
91
91
  module.exports = {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pippit-short-drama-skill
3
- description: 使用 pippit-cli 的短剧场景能力提交和查询短剧创作任务。覆盖短剧生成、续写、改写、剧情扩展、人物设定、分集草稿、世界观设定、会话文件获取、文件资源下载等创作场景。当用户要求创作短剧、写短剧剧本、续写故事、修改剧情、补充角色设定、查询短剧任务进展、获取短剧会话文件或下载短剧文件资源,或提到 pippit-cli short-drama / 小云雀短剧时触发。
3
+ description: 使用 pippit-tool-cli 的短剧场景能力提交和查询短剧创作任务。覆盖短剧生成、续写、改写、剧情扩展、人物设定、分集草稿、世界观设定、会话文件获取、文件资源下载等创作场景。当用户要求创作短剧、写短剧剧本、续写故事、修改剧情、补充角色设定、查询短剧任务进展、获取短剧会话文件或下载短剧文件资源,或提到 pippit-tool-cli short-drama / 小云雀短剧时触发。
4
4
  user-invocable: true
5
5
  metadata:
6
6
  {
@@ -9,7 +9,7 @@ metadata:
9
9
  "emoji": "📖",
10
10
  "requires":
11
11
  {
12
- "bins": ["pippit-cli"]
12
+ "bins": ["pippit-tool-cli"]
13
13
  }
14
14
  }
15
15
  }
@@ -17,7 +17,7 @@ metadata:
17
17
 
18
18
  # 小云雀短剧创作
19
19
 
20
- 通过 `pippit-cli short-drama` 命令提交短剧创作任务、上传参考文件,并行查询任务进展和会话产物文件,及时把重要资产下载到用户本地。
20
+ 通过 `pippit-tool-cli short-drama` 命令提交短剧创作任务、上传参考文件,并行查询任务进展和会话产物文件,及时把重要资产下载到用户本地。
21
21
 
22
22
  短剧场景面向剧情、人物、分集与画面化叙事创作,用户的原始需求通过 `--message` 发送给后端 Agent。后端 Agent 负责理解任务、编排流程和生成内容;用户侧 Agent 负责提交任务、并行查询进展与产物、主动下载重要资产并展示结果。
23
23
 
@@ -25,7 +25,7 @@ metadata:
25
25
 
26
26
  1. **提交短剧 Run 任务** - 创建新会话或向已有会话发送短剧创作需求。
27
27
  2. **查询会话进展** - 根据 `thread_id`、`run_id`、`after_seq` 拉取短剧任务消息列表。
28
- 3. **上传文件** - 上传短剧相关参考文件,得到文件 ID,供后续任务引用。
28
+ 3. **上传文件** - 上传本地 `.doc` / `.txt` 参考文件,得到 `asset_id`,供后续任务引用。
29
29
  4. **获取会话文件** - 根据 `thread_id` 拉取会话文件列表,得到 `file_path`、`download_url`。这和查询会话进展同等重要。
30
30
  5. **下载重要资产** - 使用文件列表中的 `download_url` 下载资源,并按 `file_path` 写入用户本地目标文件路径。
31
31
 
@@ -33,7 +33,7 @@ metadata:
33
33
 
34
34
  ## 前置要求
35
35
 
36
- 需要已安装 `pippit-cli`:
36
+ 需要已安装 `pippit-tool-cli`:
37
37
 
38
38
  ```bash
39
39
  npx @pippit-dev/cli@latest install
@@ -45,37 +45,47 @@ npx @pippit-dev/cli@latest install
45
45
 
46
46
  ```bash
47
47
  # 创建新会话并提交短剧创作需求
48
- pippit-cli short-drama +submit-run --message "创作一个赛博朋克短剧开头"
48
+ pippit-tool-cli short-drama +submit-run --message "创作一个赛博朋克短剧开头"
49
49
 
50
50
  # 向已有会话追加新的短剧需求
51
- pippit-cli short-drama +submit-run --message "继续写下一集,重点描写主角的逃亡" --thread-id THREAD_ID
51
+ pippit-tool-cli short-drama +submit-run --message "继续写下一集,重点描写主角的逃亡" --thread-id THREAD_ID
52
52
 
53
- # 携带已上传文件 ID 提交任务
54
- pippit-cli short-drama +submit-run --message "参考这个大纲写第一集" --asset-ids ASSET_ID
53
+ # 携带已上传剧本文件 asset_id 提交任务;同一 thread_id 只允许一个剧本文件
54
+ pippit-tool-cli short-drama +submit-run --message "参考这个大纲写第一集" --asset-ids ASSET_ID
55
55
  ```
56
56
 
57
57
  ### 2. 查询短剧任务进展
58
58
 
59
59
  ```bash
60
60
  # 查询会话消息列表
61
- pippit-cli short-drama +get-thread --thread-id THREAD_ID --run-id RUN_ID --after-seq 0
61
+ pippit-tool-cli short-drama +get-thread --thread-id THREAD_ID --run-id RUN_ID --after-seq 0
62
62
  ```
63
63
 
64
64
  > `thread_id` 和 `run_id` 由 `+submit-run` 返回。`after-seq` 用于增量拉取消息,首次查询可使用 `0`。
65
65
 
66
66
  ### 3. 上传文件
67
67
 
68
- 当用户提供短剧大纲、人物设定、世界观设定、已有分集或剧本等本地文件路径时,可先上传文件。
68
+ 当用户提供短剧大纲、人物设定、世界观设定、已有分集或剧本等本地参考文件时,可先上传文件。`+upload-file` 当前只接收本地文件路径,并且只支持 `.doc` 和 `.txt` 后缀;不要把 `.md`、`.pdf`、图片、视频或 URL 传给该命令。
69
69
 
70
70
  ```bash
71
- pippit-cli short-drama +upload-file --path /path/to/outline.md
71
+ pippit-tool-cli short-drama +upload-file --path /path/to/outline.txt
72
72
  ```
73
73
 
74
+ 上传成功后命令只返回 `asset_id`:
75
+
76
+ ```json
77
+ {
78
+ "asset_id": "asset_..."
79
+ }
80
+ ```
81
+
82
+ 后续提交任务时,把该值作为唯一的 `--asset-ids` 传给 `+submit-run`。单次创作会话中(相同 `thread_id`),只支持上传并绑定一个剧本文件;如果用户提供多个剧本文件,先让用户选择一个,或为不同剧本分别开启新的创作会话,不要在同一 `thread_id` 下重复追加剧本文件。
83
+
74
84
  ### 4. 获取会话文件
75
85
 
76
86
  ```bash
77
87
  # 获取会话文件列表
78
- pippit-cli short-drama +list-thread-file --thread-id THREAD_ID --page-num 1 --page-size 200
88
+ pippit-tool-cli short-drama +list-thread-file --thread-id THREAD_ID --page-num 1 --page-size 200
79
89
  ```
80
90
 
81
91
  `+list-thread-file` 返回的每个文件对象包含:
@@ -93,7 +103,7 @@ pippit-cli short-drama +list-thread-file --thread-id THREAD_ID --page-num 1 --pa
93
103
 
94
104
  ```bash
95
105
  # 下载文件资源到指定文件路径
96
- pippit-cli short-drama +download-result --url DOWNLOAD_URL --output-path FILE_PATH
106
+ pippit-tool-cli short-drama +download-result --url DOWNLOAD_URL --output-path FILE_PATH
97
107
  ```
98
108
 
99
109
  `FILE_PATH` 必须直接使用 `+list-thread-file` 返回的完整 `file_path`,包含文件名,不要取父目录。`+download-result` 负责把会话产生的文件通过 URL 下载到该目标文件路径;如果目标文件已存在,跳过下载。
@@ -103,12 +113,12 @@ pippit-cli short-drama +download-result --url DOWNLOAD_URL --output-path FILE_PA
103
113
  ### 场景 1:用户要求生成短剧内容
104
114
 
105
115
  ```
106
- 1. pippit-cli short-drama +submit-run --message "用户的原始短剧需求"
116
+ 1. pippit-tool-cli short-drama +submit-run --message "用户的原始短剧需求"
107
117
  → 拿到 thread_id、run_id 和 web_thread_link
108
118
  2. 立即将 web_thread_link 展示给用户
109
119
  3. 并行发起,二者同等重要:
110
- a. pippit-cli short-drama +get-thread --thread-id THREAD_ID --run-id RUN_ID --after-seq SEQUENCE
111
- b. pippit-cli short-drama +list-thread-file --thread-id THREAD_ID --page-num PAGE_NUM --page-size 200
120
+ a. pippit-tool-cli short-drama +get-thread --thread-id THREAD_ID --run-id RUN_ID --after-seq SEQUENCE
121
+ b. pippit-tool-cli short-drama +list-thread-file --thread-id THREAD_ID --page-num PAGE_NUM --page-size 200
112
122
  4. 检查 `get-thread` 返回的 messages:
113
123
  - 如果任务仍在进行中:展示过程消息,继续查询
114
124
  - 如果后端 Agent 提出问题:展示问题,等待用户回复
@@ -130,19 +140,22 @@ pippit-cli short-drama +download-result --url DOWNLOAD_URL --output-path FILE_PA
130
140
  ### 场景 2:用户提供参考文件要求创作
131
141
 
132
142
  ```
133
- 1. pippit-cli short-drama +upload-file --path /path/to/file
134
- 拿到 file_id
135
- 2. pippit-cli short-drama +submit-run --message "用户的原始短剧需求" --asset-ids file_id
143
+ 1. 检查用户提供的是一个本地 `.doc` `.txt` 剧本文件路径;如果不是,告知当前上传命令只支持这两类文件,不要擅自转换或改写文件。
144
+ 2. pippit-tool-cli short-drama +upload-file --path /path/to/file.txt
145
+ 拿到 asset_id
146
+ 3. pippit-tool-cli short-drama +submit-run --message "用户的原始短剧需求" --asset-ids asset_id
136
147
  → 拿到 thread_id、run_id 和 web_thread_link
137
- 3. 后续同场景 1 的并行查询、重要资产发现和文件下载流程
148
+ 4. 记录该 thread_id 已绑定这个剧本文件;后续同一 thread_id 的续写或修改只传 --thread-id,不再传新的剧本 asset_id
149
+ 5. 后续同场景 1 的并行查询、重要资产发现和文件下载流程
138
150
  ```
139
151
 
140
152
  ### 场景 3:在已有短剧会话中续写或修改
141
153
 
142
154
  ```
143
- 1. pippit-cli short-drama +submit-run --message "用户的新需求" --thread-id THREAD_ID
155
+ 1. pippit-tool-cli short-drama +submit-run --message "用户的新需求" --thread-id THREAD_ID
144
156
  → 拿到新的 run_id 和 web_thread_link
145
- 2. 继续按场景 1 展示进展、处理用户补充问题、获取新增会话文件列表,并及时下载新增重要资产
157
+ 2. 如果该 THREAD_ID 已经绑定过剧本文件,不要再上传或通过 --asset-ids 追加第二个剧本文件
158
+ 3. 继续按场景 1 展示进展、处理用户补充问题、获取新增会话文件列表,并及时下载新增重要资产
146
159
  ```
147
160
 
148
161
  ## 轮询策略
@@ -202,17 +215,12 @@ pippit-cli short-drama +download-result --url DOWNLOAD_URL --output-path FILE_PA
202
215
 
203
216
  ```json
204
217
  {
205
- "scene": "short-drama",
206
- "file_id": "file_...",
207
- "status": "uploaded",
208
- "uploaded_at": "2026-05-19T00:00:00Z",
209
- "request": {
210
- "path": "/path/to/file",
211
- "file_name": "file.md"
212
- }
218
+ "asset_id": "asset_..."
213
219
  }
214
220
  ```
215
221
 
222
+ `+upload-file` 通过 `multipart/form-data` 上传文件,表单文件字段名为 `file`。本地文件必须存在、不能是目录,后缀必须是 `.doc` 或 `.txt`;不支持的后缀会直接报错。返回的 `asset_id` 来自服务端 `pippit_asset_id`,如果没有该字段才回退到 `asset_id`。
223
+
216
224
  **+list-thread-file** 返回:
217
225
 
218
226
  ```json
@@ -264,7 +272,7 @@ pippit-cli short-drama +download-result --url DOWNLOAD_URL --output-path FILE_PA
264
272
 
265
273
  对带 `download_url` 的重要资产调用下载工具,可并行。重要资产必须主动下载,不要等用户再次要求,也不要在调用下载工具前先检查本地文件是否存在。
266
274
 
267
- 1. 调用 `pippit-cli short-drama +download-result --url DOWNLOAD_URL --output-path FILE_PATH`。
275
+ 1. 调用 `pippit-tool-cli short-drama +download-result --url DOWNLOAD_URL --output-path FILE_PATH`。
268
276
  2. 下载完成后,向用户展示本地文件路径;如果某个文件下载失败,记录失败项并在后续轮询中重试,不阻塞已成功落盘的文件展示。
269
277
 
270
278
  ## 向用户展示内容
@@ -283,8 +291,8 @@ pippit-cli short-drama +download-result --url DOWNLOAD_URL --output-path FILE_PA
283
291
 
284
292
  你要做的只有三件事:
285
293
 
286
- 1. **上传**:如果用户给了本地参考文件,先调用 `+upload-file`。
287
- 2. **提交任务**:把用户原始短剧需求和文件 ID 通过 `+submit-run` 发给后端。
294
+ 1. **上传**:如果用户给了本地 `.doc` / `.txt` 参考文件,先调用 `+upload-file`。
295
+ 2. **提交任务**:首次创作时把用户原始短剧需求和唯一剧本 `asset_id` 通过 `+submit-run --asset-ids` 发给后端;同一 `thread_id` 后续续写或修改不再追加新的剧本文件。
288
296
  3. **传话、取文件、下载资源**:根据 `+get-thread` 返回的消息展示进展、问题和结果;根据 `+list-thread-file` 获取文件列表;再根据 `download_url` 调用 `+download-result` 把缺失资源下载到用户本地。
289
297
 
290
298
  **不要做的事:**
@@ -301,7 +309,9 @@ pippit-cli short-drama +download-result --url DOWNLOAD_URL --output-path FILE_PA
301
309
  - `--message` 是用户的原始短剧需求,不能为空。
302
310
  - 查询进展时优先使用 `+submit-run` 返回的 `thread_id` 和 `run_id`。
303
311
  - `--after-seq` 用于增量拉取消息,首次查询可设置为 `0`。
304
- - `+upload-file` 当前用于短剧场景文件上传链路,上传后将返回可传给 `+submit-run` 的文件 ID。
312
+ - `+upload-file` 当前用于短剧场景文件上传链路,只支持本地 `.doc` / `.txt` 文件;`--path` 不能为空,路径必须指向真实文件,不能是目录。
313
+ - `+upload-file` 上传成功后只返回 `asset_id`;把该值原样作为 `+submit-run --asset-ids` 的参数。
314
+ - 单次创作会话中(相同 `thread_id`),`+submit-run` 只支持绑定一个剧本文件。不要在同一 `thread_id` 下重复上传并追加第二个剧本 `asset_id`;用户给多个剧本时,先让用户选择一个,或分别开启新的创作会话。
305
315
  - `+list-thread-file` 只需要 `thread_id`;分页参数使用 `--page-num 1 --page-size 200` 起步,`total` 达到 200 时下一轮递增 `page-num`。
306
316
  - `+list-thread-file` 和 `+download-result` 是两个不同的 CLI 指令:前者获取会话文件元信息,后者下载 URL 资源并写入到本地目标文件路径。
307
317
  - `+download-result` 接收 `--url`、`--output-path`、`--workers`;`--output-path` 必须是包含文件名的目标文件路径。