@optima-chat/optima-agent 0.8.37 → 0.8.39

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.
@@ -145,7 +145,8 @@
145
145
  "Bash(aws ecs:*)",
146
146
  "Bash(aws ecr:*)",
147
147
  "Bash(gh search:*)",
148
- "Bash(npx tsc:*)"
148
+ "Bash(npx tsc:*)",
149
+ "Bash(find /Users/verypro/optima-agent -path */node_modules -prune -o -type f \\\\\\(-name *comfy* -o -name *gen* \\\\\\) -print)"
149
150
  ],
150
151
  "deny": [],
151
152
  "ask": []
@@ -1,9 +1,9 @@
1
1
  ---
2
- name: comfy
2
+ name: gen
3
3
  description: "生成和编辑图片/视频/语音/虚拟试穿。使用场景:生成图片(generate images/生成图片/画图)、编辑图片(edit images/编辑图片/图生图/风格转换)、生成视频(create videos/图生视频)、文本转语音(TTS/语音合成/朗读)、语音识别(ASR/语音转文字/转录)、虚拟试穿(virtual try-on/试穿/换装/试衣)。"
4
4
  ---
5
5
 
6
- # 图像视频生成工具
6
+ # AI 内容生成工具
7
7
 
8
8
  ## 图片生成
9
9
 
@@ -11,21 +11,21 @@ description: "生成和编辑图片/视频/语音/虚拟试穿。使用场景:
11
11
 
12
12
  ```bash
13
13
  # 文生图
14
- comfy image "提示词" -o /home/aiuser/project/result.png
14
+ gen image "提示词" -o /home/aiuser/project/result.png
15
15
 
16
16
  # 图片编辑/风格转换
17
- comfy image "转成水彩风格" -i photo.png -o /home/aiuser/project/result.png
17
+ gen image "转成水彩风格" -i photo.png -o /home/aiuser/project/result.png
18
18
 
19
19
  # 读取并描述结果
20
20
  Read /home/aiuser/project/result.png
21
21
  ```
22
22
 
23
- ### comfy image 命令
23
+ ### gen image 命令
24
24
 
25
25
  统一的图像生成/编辑命令。
26
26
 
27
27
  ```bash
28
- comfy image <prompt> [options]
28
+ gen image <prompt> [options]
29
29
  ```
30
30
 
31
31
  #### 参数
@@ -33,8 +33,8 @@ comfy image <prompt> [options]
33
33
  | 参数 | 说明 |
34
34
  |------|------|
35
35
  | `-i, --input <path>` | 输入图像(可多次使用,最多 8 张) |
36
- | `-W, --width <px>` | 输出宽度(默认 1024,必须是 16 的倍数) |
37
- | `-H, --height <px>` | 输出高度(默认 1024,必须是 16 的倍数) |
36
+ | `-W, --width <px>` | 输出宽度(默认 1024,最大 2048) |
37
+ | `-H, --height <px>` | 输出高度(默认 1024,最大 2048) |
38
38
  | `-o, --output <path>` | 输出目录或完整路径 |
39
39
  | `-s, --seed <number>` | 随机种子(可复现结果) |
40
40
  | `-f, --format <fmt>` | 输出格式:jpeg \| png |
@@ -44,14 +44,14 @@ comfy image <prompt> [options]
44
44
  #### 文生图
45
45
 
46
46
  ```bash
47
- comfy image "a cute fluffy cat sitting on a windowsill, natural lighting" -o /home/aiuser/project/cat.png
47
+ gen image "a cute fluffy cat sitting on a windowsill, natural lighting" -o /home/aiuser/project/cat.png
48
48
  Read /home/aiuser/project/cat.png
49
49
  ```
50
50
 
51
51
  #### 图片风格转换
52
52
 
53
53
  ```bash
54
- comfy image "watercolor painting style, artistic brushstrokes" -i photo.jpg -o /home/aiuser/project/watercolor.png
54
+ gen image "watercolor painting style, artistic brushstrokes" -i photo.jpg -o /home/aiuser/project/watercolor.png
55
55
  Read /home/aiuser/project/watercolor.png
56
56
  ```
57
57
 
@@ -60,7 +60,7 @@ Read /home/aiuser/project/watercolor.png
60
60
  将第一张图的风格应用到第二张图的内容上:
61
61
 
62
62
  ```bash
63
- comfy image "apply the artistic style from image 1 to the content of image 2" -i style.png -i content.png -o /home/aiuser/project/fusion.png
63
+ gen image "apply the artistic style from image 1 to the content of image 2" -i style.png -i content.png -o /home/aiuser/project/fusion.png
64
64
  Read /home/aiuser/project/fusion.png
65
65
  ```
66
66
 
@@ -69,7 +69,7 @@ Read /home/aiuser/project/fusion.png
69
69
  从多张图中提取元素组合成新图:
70
70
 
71
71
  ```bash
72
- comfy image "The person from image 1 is petting the cat from image 2, in a cozy living room" -i person.jpg -i cat.jpg -o /home/aiuser/project/combined.png
72
+ gen image "The person from image 1 is petting the cat from image 2, in a cozy living room" -i person.jpg -i cat.jpg -o /home/aiuser/project/combined.png
73
73
  ```
74
74
 
75
75
  #### 精确颜色控制
@@ -77,13 +77,13 @@ comfy image "The person from image 1 is petting the cat from image 2, in a cozy
77
77
  使用 hex code 指定精确颜色:
78
78
 
79
79
  ```bash
80
- comfy image "a modern logo with brand color #02eb3c as the primary accent" -o /home/aiuser/project/logo.png
80
+ gen image "a modern logo with brand color #02eb3c as the primary accent" -o /home/aiuser/project/logo.png
81
81
  ```
82
82
 
83
83
  #### 产品海报
84
84
 
85
85
  ```bash
86
- comfy image "Disney Pixar style 3D poster, [产品描述], cute character, vibrant gradient background, professional studio lighting" -W 1024 -H 1024 -o /home/aiuser/project/poster.png
86
+ gen image "Disney Pixar style 3D poster, [产品描述], cute character, vibrant gradient background, professional studio lighting" -W 1024 -H 1024 -o /home/aiuser/project/poster.png
87
87
  ```
88
88
 
89
89
  ### 提示词指南(FLUX.2)
@@ -116,18 +116,18 @@ comfy image "Disney Pixar style 3D poster, [产品描述], cute character, vibra
116
116
 
117
117
  ```bash
118
118
  # 简单
119
- comfy image "a robot"
119
+ gen image "a robot"
120
120
 
121
121
  # 添加风格
122
- comfy image "a friendly AI robot, cute cartoon style, bright colors, 3D render"
122
+ gen image "a friendly AI robot, cute cartoon style, bright colors, 3D render"
123
123
 
124
124
  # 完整描述
125
- comfy image "Disney Pixar style 3D animated robot character, friendly cheerful expression, wearing headset, surrounded by floating icons, gradient purple-blue background, professional studio lighting, vibrant colors"
125
+ gen image "Disney Pixar style 3D animated robot character, friendly cheerful expression, wearing headset, surrounded by floating icons, gradient purple-blue background, professional studio lighting, vibrant colors"
126
126
  ```
127
127
 
128
128
  ### 分辨率选择
129
129
 
130
- 尺寸必须是 **16 的倍数**,最大支持 4MP(推荐 2MP 内)。
130
+ 最大 2048x2048。
131
131
 
132
132
  | 用途 | 分辨率 |
133
133
  |------|--------|
@@ -142,33 +142,29 @@ comfy image "Disney Pixar style 3D animated robot character, friendly cheerful e
142
142
  - 向用户描述图片内容(颜色、风格、构图、元素)
143
143
  - 验证是否符合用户要求
144
144
 
145
- #### 尺寸要求
146
- - 宽高必须是 16 的倍数
147
- - 最大 4MP,推荐 2MP 内
148
-
149
145
  #### 多图参考
150
146
  - 最多 8 张输入图
151
147
 
152
148
  ## 视频生成
153
149
 
154
- 从静态图片生成视频(wan2.6-i2v),支持 720P/1080P,5-15 秒。
150
+ 从静态图片生成视频(wan2.6-i2v),支持 720P/1080P,5-10 秒。
155
151
 
156
152
  ```bash
157
- comfy video <图片路径> [options]
153
+ gen video <图片路径> [options]
158
154
  ```
159
155
 
160
156
  ### 参数
161
157
 
162
158
  | 参数 | 说明 | 默认值 |
163
159
  |------|------|--------|
164
- | `-p, --prompt` | 运动/内容描述(最长 1500 字) | - |
165
- | `-n, --negative` | 负向提示词(最长 500 字) | - |
160
+ | `-p, --prompt` | 运动/内容描述 | - |
161
+ | `-n, --negative` | 负向提示词 | - |
166
162
  | `-o, --output <path>` | 输出目录或完整路径 | - |
167
163
  | `-r, --resolution` | 720P \| 1080P | 1080P |
168
- | `-d, --duration` | 5 \| 10 \| 15 秒 | 5 |
164
+ | `-d, --duration` | 5 \| 10 秒 | 5 |
169
165
  | `--shot-type` | single \| multi(多镜头叙事) | single |
170
166
  | `--no-audio` | 禁用自动配音 | - |
171
- | `--audio-url <url>` | 自定义音频 URL(需先用 `commerce upload` 上传) | - |
167
+ | `--audio-url <url>` | 自定义音频 URL | - |
172
168
  | `--no-prompt-extend` | 禁用智能改写 prompt | - |
173
169
  | `--watermark` | 添加 AI 生成水印 | - |
174
170
  | `--seed <number>` | 随机种子(可复现) | - |
@@ -177,46 +173,39 @@ comfy video <图片路径> [options]
177
173
 
178
174
  ```bash
179
175
  # 基础用法
180
- comfy video portrait.png --prompt "gentle smile, subtle head movement"
176
+ gen video portrait.png --prompt "gentle smile, subtle head movement"
181
177
 
182
178
  # 10 秒 1080P 视频
183
- comfy video scene.png -d 10 -r 1080P --prompt "cinematic camera pan"
184
-
185
- # 多镜头叙事(15 秒故事性视频)
186
- comfy video story.png --shot-type multi -d 15 --prompt "a day in the life"
179
+ gen video scene.png -d 10 -r 1080P --prompt "cinematic camera pan"
187
180
 
188
181
  # 静音视频
189
- comfy video product.png --no-audio --prompt "360 degree rotation"
190
-
191
- # 自定义音频(需先上传获取 URL)
192
- commerce upload file --path "/home/aiuser/music.mp3"
193
- # 返回 URL 后使用
194
- comfy video scene.png --audio-url "https://..." -o /home/aiuser/project/with-audio.mp4
182
+ gen video product.png --no-audio --prompt "360 degree rotation"
195
183
 
196
184
  # 指定输出路径
197
- comfy video scene.png -o /home/aiuser/project/result.mp4 --prompt "camera zoom"
185
+ gen video scene.png -o /home/aiuser/project/result.mp4 --prompt "camera zoom"
198
186
  Read /home/aiuser/project/result.mp4
199
187
  ```
200
188
 
201
189
  ### 注意事项
202
190
 
203
- - 输入图片:360-2000px,≤10MB,推荐 1080P 比例
204
- - 输出规格:30fps,MP4 (H.264)
205
- - 可用 `-o` 指定输出路径,默认保存到 `./comfy-output/`
191
+ - 输入图片:推荐 1080P 比例,≤10MB
192
+ - 最大时长 10 秒
193
+ - 输出:30fps,MP4 (H.264)
194
+ - 默认保存到 `./gen-output/`
206
195
 
207
196
  ## 虚拟试穿 (Virtual Try-On)
208
197
 
209
198
  使用 FASHN AI tryon-v1.6 将服装穿到人物照片上。
210
199
 
211
200
  ```bash
212
- comfy tryon <人物照片> <服装照片> [options]
201
+ gen tryon <人物照片> <服装照片> [options]
213
202
  ```
214
203
 
215
204
  ### 参数
216
205
 
217
206
  | 参数 | 说明 | 默认值 |
218
207
  |------|------|--------|
219
- | `-o, --output <path>` | 输出文件路径 | `./comfy-output/tryon_{timestamp}.png` |
208
+ | `-o, --output <path>` | 输出文件路径 | `./gen-output/tryon_{timestamp}.png` |
220
209
  | `-c, --category <type>` | 服装类别:auto \| tops \| bottoms \| one-pieces | auto |
221
210
  | `-m, --mode <mode>` | 生成模式:performance \| balanced \| quality | quality |
222
211
  | `--garment-type <type>` | 服装照片类型:auto \| flat-lay \| model | auto |
@@ -227,44 +216,40 @@ comfy tryon <人物照片> <服装照片> [options]
227
216
  ### 示例
228
217
 
229
218
  ```bash
230
- # 基本用法 - 本地图片试穿
231
- comfy tryon person.jpg garment.jpg -o /home/aiuser/project/result.png
219
+ # 基本用法
220
+ gen tryon person.jpg garment.jpg -o /home/aiuser/project/result.png
232
221
  Read /home/aiuser/project/result.png
233
222
 
234
223
  # 使用 URL 图片
235
- comfy tryon https://example.com/model.jpg https://example.com/dress.jpg -o /home/aiuser/project/result.png
224
+ gen tryon https://example.com/model.jpg https://example.com/dress.jpg -o /home/aiuser/project/result.png
236
225
 
237
226
  # 指定服装类别和快速模式
238
- comfy tryon person.jpg top.jpg -c tops -m performance -o /home/aiuser/project/result.png
227
+ gen tryon person.jpg top.jpg -c tops -m performance -o /home/aiuser/project/result.png
239
228
 
240
229
  # 生成多张结果
241
- comfy tryon person.jpg dress.jpg -n 4 -c one-pieces -o /home/aiuser/project/result.png
242
-
243
- # 使用种子复现结果
244
- comfy tryon person.jpg garment.jpg --seed 42 -o /home/aiuser/project/result.png
230
+ gen tryon person.jpg dress.jpg -n 4 -c one-pieces -o /home/aiuser/project/result.png
245
231
  ```
246
232
 
247
233
  ### 注意事项
248
234
 
249
235
  - 支持本地图片路径和 URL
250
236
  - 服装类别:auto (自动检测), tops (上装), bottoms (下装), one-pieces (连体)
251
- - 三种模式价格相同(1 credit/张),quality 效果最好
252
- - 推荐图片高度不超过 2000px,比例 2:3,JPEG 95% 质量
253
- - 可用 `-o` 指定输出路径,默认保存到 `./comfy-output/`
237
+ - 三种模式:performance (~7s), balanced (~9s), quality (~13s)
238
+ - 默认保存到 `./gen-output/`
254
239
 
255
240
  ## 语音合成 (TTS)
256
241
 
257
242
  使用 DashScope qwen3-tts-flash 将文本转为语音。
258
243
 
259
244
  ```bash
260
- comfy tts <文本> [options]
245
+ gen tts <文本> [options]
261
246
  ```
262
247
 
263
248
  ### 参数
264
249
 
265
250
  | 参数 | 说明 | 默认值 |
266
251
  |------|------|--------|
267
- | `-o, --output <path>` | 输出文件路径 | `./comfy-output/tts_{timestamp}.wav` |
252
+ | `-o, --output <path>` | 输出文件路径 | `./gen-output/tts_{timestamp}.wav` |
268
253
  | `--voice <name>` | 声音名称 | Cherry |
269
254
  | `--voices` | 列出可用声音 | - |
270
255
  | `--play` | 生成后自动播放 | - |
@@ -278,27 +263,28 @@ comfy tts <文本> [options]
278
263
 
279
264
  ```bash
280
265
  # 中文语音合成
281
- comfy tts "你好,欢迎使用语音合成功能" -o /home/aiuser/project/hello.wav
266
+ gen tts "你好,欢迎使用语音合成功能" -o /home/aiuser/project/hello.wav
282
267
 
283
268
  # 指定男声
284
- comfy tts "Hello, welcome!" --voice Ethan -o /home/aiuser/project/greeting.wav
269
+ gen tts "Hello, welcome!" --voice Ethan -o /home/aiuser/project/greeting.wav
285
270
 
286
271
  # 生成后播放
287
- comfy tts "测试语音" --play -o /home/aiuser/project/test.wav
272
+ gen tts "测试语音" --play -o /home/aiuser/project/test.wav
288
273
  ```
289
274
 
290
275
  ### 注意事项
291
276
 
292
277
  - 输出格式为 WAV
278
+ - 最大 5000 字符
293
279
  - 支持中、英、日、韩、法、德等 10 种语言(自动检测)
294
- - 可用 `-o` 指定输出路径,默认保存到 `./comfy-output/`
280
+ - 默认保存到 `./gen-output/`
295
281
 
296
282
  ## 语音识别 (ASR)
297
283
 
298
284
  使用 Groq Whisper 将语音转为文字。
299
285
 
300
286
  ```bash
301
- comfy asr <音频文件> [options]
287
+ gen asr <音频文件> [options]
302
288
  ```
303
289
 
304
290
  ### 参数
@@ -312,13 +298,26 @@ comfy asr <音频文件> [options]
312
298
 
313
299
  ```bash
314
300
  # 自动检测语言
315
- comfy asr /home/aiuser/project/recording.mp3
301
+ gen asr /home/aiuser/project/recording.mp3
316
302
 
317
303
  # 指定语言提示(提高准确率)
318
- comfy asr /home/aiuser/project/recording.wav --language zh
304
+ gen asr /home/aiuser/project/recording.wav --language zh
319
305
  ```
320
306
 
321
307
  ### 注意事项
322
308
 
323
309
  - 支持 mp3, wav, m4a, ogg, webm 格式
324
310
  - 文件大小限制 25MB
311
+
312
+ ## 任务管理
313
+
314
+ 所有生成命令会自动等待完成。如需查看历史或管理任务:
315
+
316
+ ```bash
317
+ gen task list # 查看所有任务
318
+ gen task list --type image # 按类型过滤
319
+ gen task list --status failed # 按状态过滤
320
+ gen task get <task_id> # 查看任务详情
321
+ gen task cancel <task_id> # 取消任务
322
+ gen task retry <task_id> # 重试失败的任务
323
+ ```
@@ -151,6 +151,30 @@ logistics address validate --address '<JSON Address>'
151
151
 
152
152
  所有命令支持 `--pretty` 参数输出人类可读格式。
153
153
 
154
+ ### JD 走货限制知识
155
+
156
+ **货物类型限制**(不同专线支持不同 cargo type):
157
+ - 普货线:仅接 general
158
+ - 带电线:接 battery + general
159
+ - 服装线:接 clothing + general
160
+ - 化妆品线:接 cosmetic
161
+ - 系统会自动根据产品 cargo_type 过滤不可用专线
162
+
163
+ **品牌限制**:部分国际品牌在 JD 禁运列表中,系统自动检查
164
+
165
+ **PGA 管控**:部分商品(食品、药品等)受 PGA 管控,系统做关键词初筛
166
+
167
+ **偏远邮编**:US 部分邮编为偏远无服务区域,JD 不提供服务
168
+
169
+ ### AI 发货决策树
170
+
171
+ ```
172
+ 卖家说"发货" → 查 getRates
173
+ ├── 有可用方案 → AskUserQuestion 展示方案让卖家选择
174
+ ├── JD 无方案但有 EasyShip → 告知原因,建议使用其他物流或手动发货
175
+ └── 全部无方案 → 告知原因 + 建议手动发货
176
+ ```
177
+
154
178
  ## 不确定用什么命令?
155
179
 
156
180
  运行 `logistics --help` 查看所有子命令。
@@ -45,10 +45,28 @@ description: Order fulfillment and shipping management. Process orders, ship pac
45
45
 
46
46
  | shipping_mode_used | 含义 | 发货方式 |
47
47
  |--------------------|------|----------|
48
- | `easyship` | 买家选择了动态运费快递 | 可选自动发货 手动发货 |
49
- | `fixed` | 买家使用固定运费 | 只能手动发货 |
50
- | `free` | 全球免运费 | 只能手动发货 |
51
- | 空/null | 历史订单 | 只能手动发货 |
48
+ | `easyship` | 买家选择了动态运费快递(DYNAMIC) | 自动发货 / 指定方案 / 手动 |
49
+ | `fixed` | 买家使用固定运费 | 指定方案 / 手动 |
50
+ | `free` | 全球免运费 | 指定方案 / 手动 |
51
+ | 空/null | 历史订单 | 指定方案 / 手动 |
52
+
53
+ #### 发货流程
54
+
55
+ 卖家说"发货" → 查订单 → AskUserQuestion "如何发货?"
56
+
57
+ **DYNAMIC 订单**(买家已选物流方案,有 selected_courier_id):
58
+ - 选项 1: 使用买家选择的物流方案 → `commerce order ship --id <order-id> --auto`
59
+ - 选项 2: 使用其他系统物流方案 → 先 `logistics rates query` 查报价 → AskUserQuestion 展示方案 → 卖家选 → `commerce order ship --id <order-id> --rate-id <selected-rate-id>`
60
+ - 选项 3: 自己处理 → 卖家提供 tracking number → `commerce order ship --id <order-id> --tracking <number> [--carrier <name>]`
61
+
62
+ **FREE/FIXED 订单**(无 selected_courier_id):
63
+ - 选项 1: 使用系统物流 → 先 `logistics rates query` 查报价 → AskUserQuestion 展示方案 → 卖家选 → `commerce order ship --id <order-id> --rate-id <selected-rate-id>`
64
+ - 选项 2: 自己处理 → 卖家提供 tracking number → `commerce order ship --id <order-id> --tracking <number> [--carrier <name>]`
65
+
66
+ 三种 CLI 路径:
67
+ - `--auto`:仅 DYNAMIC 默认方案(使用买家 checkout 时选的 courier)
68
+ - `--rate-id <id>`:任意模式,卖家/AI 指定方案
69
+ - `--tracking <number>`:手动发货
52
70
 
53
71
  #### 发货决策规则(必须严格遵守)
54
72
 
@@ -60,30 +78,35 @@ description: Order fulfillment and shipping management. Process orders, ship pac
60
78
 
61
79
  **步骤3**:根据字段值决定下一步操作:
62
80
 
63
- - **如果 `shipping_mode_used = "easyship"`**:
81
+ - **如果 `shipping_mode_used = "easyship"`(DYNAMIC 订单)**:
64
82
  1. **必须**使用 AskUserQuestion 工具询问用户
65
- 2. 提供两个选项让用户选择
83
+ 2. 提供三个选项:使用买家方案(--auto)、选择其他方案(--rate-id)、手动发货(--tracking)
66
84
  3. **禁止**直接询问运单号
67
85
  4. 等待用户选择后再执行对应命令
68
86
 
69
87
  - **如果 `shipping_mode_used = "fixed"` 或 `"free"` 或字段为空**:
70
- 1. 询问用户提供运单号。快递公司名称为**可选**,如果用户未提供,后端会根据运单号自动检测
71
- 2. 用户提供运单号后即可执行发货命令,无需等待用户补充 carrier
72
- 3. **即使用户提供了快递公司名称,发货时也统一不传 carrier**,让后端根据运单号自动检测并存储准确的快递公司名称(人类可读,如 "SF Express"、"UPS")。发货成功后对比响应中的 carrier 与用户所说的:
88
+ 1. **必须**使用 AskUserQuestion 工具询问用户
89
+ 2. 提供两个选项:使用系统物流(--rate-id)、手动发货(--tracking)
90
+ 3. 如果用户选择系统物流,先 `logistics rates query` 查报价,再用 AskUserQuestion 展示可用方案
91
+ 4. 如果用户选择手动发货:询问运单号,快递公司名称为**可选**
92
+ 5. **即使用户提供了快递公司名称,发货时也统一不传 carrier**,让后端根据运单号自动检测并存储准确的快递公司名称(人类可读,如 "SF Express"、"UPS")。发货成功后对比响应中的 carrier 与用户所说的:
73
93
  - 一致 → 正常告知
74
94
  - 不一致 → 告知用户:"您提供的是 XX,系统根据运单号识别为 YY,已按识别结果记录。如有误请告知。"
75
95
 
76
- #### Easyship 自动发货
96
+ #### 系统物流发货
77
97
 
78
- **适用场景**:`shipping_mode_used = "easyship"` 且用户选择使用 Easyship
98
+ **适用场景**:任意 shipping_mode_used,用户选择使用系统物流
79
99
 
80
100
  **命令**:
81
101
  ```bash
82
- # 使用买家选择的快递(推荐)
102
+ # DYNAMIC 订单 — 使用买家选择的快递(推荐)
83
103
  commerce order ship --id <order-id> --auto
84
104
 
85
- # 或指定其他 Easyship 支持的快递
105
+ # DYNAMIC 订单 — 指定其他快递
86
106
  commerce order ship --id <order-id> --auto --courier-id <courier-id>
107
+
108
+ # 任意模式 — 使用指定的物流方案(先查 logistics rates query)
109
+ commerce order ship --id <order-id> --rate-id <rate-id>
87
110
  ```
88
111
 
89
112
  **返回结果包含**:
@@ -95,7 +118,7 @@ commerce order ship --id <order-id> --auto --courier-id <courier-id>
95
118
 
96
119
  **运单标签处理(重要)**:
97
120
 
98
- 运单标签是用户必须打印并贴在包裹上的快递单。Easyship 生成标签需要几秒到几分钟。
121
+ 运单标签是用户必须打印并贴在包裹上的快递单。物流服务生成标签需要几秒到几分钟。
99
122
 
100
123
  **发货后根据 label_state 处理**:
101
124
 
@@ -103,11 +126,11 @@ commerce order ship --id <order-id> --auto --courier-id <courier-id>
103
126
  |-------------|------|----------|
104
127
  | `generated` / `printed` | 标签已生成 | 提供 `label_url` 让用户下载打印 |
105
128
  | `pending` / `generating` | 标签生成中 | 告知用户「标签正在生成,稍后可以让我帮你查询」 |
106
- | `failed` / `technical_failed` | 生成失败 | 告知用户需要检查 EasyShip 后台或重新发货 |
129
+ | `failed` / `technical_failed` | 生成失败 | 告知用户需要检查物流服务后台或重新发货 |
107
130
 
108
131
  **查询标签状态**:
109
132
 
110
- 如果发货时 label_state 为 pending/generating,稍后使用 `order refresh-label` 从 Easyship 同步最新状态:
133
+ 如果发货时 label_state 为 pending/generating,稍后使用 `order refresh-label` 同步最新状态:
111
134
  ```bash
112
135
  commerce order refresh-label --id <order-id>
113
136
  ```
@@ -166,64 +189,68 @@ commerce order mark-delivered --id <order-id>
166
189
 
167
190
  #### 发货场景示例对话
168
191
 
169
- **场景1:Easyship 订单**
192
+ **场景1:DYNAMIC 订单(买家已选物流方案)**
170
193
  ```
171
194
  用户:订单 order_abc 发货
172
195
 
173
196
  助手:[执行 Bash: commerce order get --id order_abc]
174
- [发现 shipping_mode_used = "easyship"]
197
+ [发现 shipping_mode_used = "easyship",有 selected_courier_id]
175
198
  [使用 AskUserQuestion 工具]
176
199
 
177
200
  AskUserQuestion:
178
- question: "该订单使用 Easyship 运费模式,请选择发货方式"
201
+ question: "该订单买家已选择物流方案,请选择发货方式"
179
202
  options:
180
- - label: "Easyship 自动发货(推荐)"
181
- description: "自动生成运单号和标签,使用买家选择的快递"
203
+ - label: "使用买家选择的物流方案(推荐)"
204
+ description: "自动生成运单号和标签,使用买家 checkout 时选的快递"
205
+ - label: "选择其他系统物流方案"
206
+ description: "查询可用物流方案,选择后创建运单"
182
207
  - label: "手动填写运单号"
183
- description: "使用其他快递公司,需要提供运单号"
208
+ description: "自己处理物流,需要提供运单号"
184
209
 
185
- 用户:[选择 Easyship 自动发货]
210
+ 用户:[选择使用买家方案]
186
211
 
187
212
  助手:[执行 Bash: commerce order ship --id order_abc --auto]
188
213
  [检查返回结果中的 label_state]
189
-
190
- [情况A:label_state = "generated",有 label_url]
191
- 发货成功!运单号 ES123456789,快递公司 FedEx。
192
- 运单标签已生成,请下载打印后贴在包裹上:https://...
193
- 物流信息同步中,稍后可以让我帮你查询物流状态。
194
-
195
- [情况B:label_state = "pending" 或 "generating"]
196
214
  发货成功!运单号 ES123456789,快递公司 FedEx。
197
- 运单标签正在生成中,稍后可以让我帮你查询标签和物流状态。
198
-
199
- 用户:标签好了吗
200
-
201
- 助手:[执行 Bash: commerce order refresh-label --id order_abc]
202
- [检查返回结果中的 label_state 和 label_url]
203
-
204
- [情况A:label_state = "generated",有 label_url]
205
215
  运单标签已生成,请下载打印后贴在包裹上:https://...
206
-
207
- [情况B:label_state 仍为 "pending" 或 "generating"]
208
- 运单标签仍在生成中,请稍后再试。
209
216
  ```
210
217
 
211
- **场景2:固定运费/免运费订单(手动发货)**
218
+ **场景2:FREE/FIXED 订单(使用系统物流)**
212
219
  ```
213
220
  用户:订单 order_xyz 发货
214
221
 
215
222
  助手:[执行 Bash: commerce order get --id order_xyz]
216
- [发现 shipping_mode_used = "fixed" 或 "free"]
217
- 请提供运单号(快递公司可选,系统会自动识别)。
223
+ [发现 shipping_mode_used = "fixed",无 selected_courier_id]
224
+ [使用 AskUserQuestion 工具]
218
225
 
219
- 用户:单号 SF123456
226
+ AskUserQuestion:
227
+ question: "该订单使用固定运费模式,请选择发货方式"
228
+ options:
229
+ - label: "使用系统物流"
230
+ description: "查询可用物流方案,选择后自动创建运单和标签"
231
+ - label: "手动填写运单号"
232
+ description: "自己处理物流,需要提供运单号"
220
233
 
221
- 助手:[执行 Bash: commerce order ship --id order_xyz --tracking SF123456]
222
- 发货成功!运单号 SF123456,快递公司顺丰速运(自动识别)。
223
- 随时可以让我帮你查询物流状态。
234
+ 用户:[选择系统物流]
235
+
236
+ 助手:[执行 Bash: logistics rates query --origin '...' --destination '...' --items '...']
237
+ [查到 3 个可用方案]
238
+ [使用 AskUserQuestion 展示方案]
239
+
240
+ AskUserQuestion:
241
+ question: "以下是可用的物流方案,请选择"
242
+ options:
243
+ - label: "Standard Shipping (7-15 days) - ¥72.00 CNY"
244
+ - label: "Economy Shipping (15-25 days) - ¥45.00 CNY"
245
+ - label: "Express Shipping (3-7 days) - ¥128.00 CNY"
246
+
247
+ 用户:[选择 Standard Shipping]
248
+
249
+ 助手:[执行 Bash: commerce order ship --id order_xyz --rate-id rate_abc123]
250
+ 发货成功!运单号 JD123456789。
224
251
  ```
225
252
 
226
- **场景3:用户直接提供运单号发货**
253
+ **场景3:手动发货(用户直接提供运单号)**
227
254
  ```
228
255
  用户:订单 order_abc 发货,单号 YT9876543210
229
256
 
@@ -365,16 +392,14 @@ commerce order list --status paid --limit 50
365
392
  # 步骤1:先获取订单信息,检查 shipping_mode_used
366
393
  commerce order get --id order_123
367
394
 
368
- # 步骤2a:如果 shipping_mode_used = "easyship",询问用户选择后
369
- # 用户选择 Easyship 自动发货
395
+ # DYNAMIC 订单 使用买家选择的方案
370
396
  commerce order ship --id order_123 --auto
371
397
 
372
- # 步骤2b:如果用户选择手动发货,或 shipping_mode_used = "fixed"/"free"
373
- # 只需提供运单号,carrier 可选
374
- commerce order ship --id order_123 --tracking DHL123456
398
+ # 任意模式 指定物流方案(先查 logistics rates query 获取 rate-id)
399
+ commerce order ship --id order_123 --rate-id rate_abc123
375
400
 
376
- # 或同时指定 carrier
377
- commerce order ship --id order_123 --tracking DHL123456 --carrier DHL
401
+ # 手动发货 — 只需提供运单号,carrier 可选
402
+ commerce order ship --id order_123 --tracking DHL123456
378
403
  ```
379
404
 
380
405
  ### 取消订单
@@ -335,6 +335,19 @@ commerce product add-images --id prod_123 --media-id media_red,media_blue
335
335
  commerce product get --id prod_123
336
336
  ```
337
337
 
338
+ ### 物流属性引导(物理产品)
339
+
340
+ 创建 `requires_shipping: true` 的物理产品时:
341
+
342
+ 1. **重量**:引导卖家填写准确重量(影响所有物流报价准确性)
343
+ 2. **cargo_type**:根据产品标题/描述自动推断(默认 general),向卖家确认
344
+ - 推断方式:"根据产品信息,我推断这是普通商品,对吗?"(不要直接问"含电池吗?")
345
+ - 可选值:general(普货)、battery(带电)、liquid(液体)、cosmetic(化妆品)、clothing(服装)、powder(粉末)、wood(木制品)
346
+ - 这是通用物流属性,不需要提及任何具体物流商
347
+ 3. **brand**:引导填写品牌(可选,用于物流限制检查)
348
+ 4. 用户可跳过,但告知"会影响物流方案选择和报价准确性"
349
+ 5. 数字产品跳过整个物流属性流程
350
+
338
351
  ## 重要提示
339
352
 
340
353
  - **国际化策略** - 平台默认语言是英文(en-US)。当用户同时提供中英文内容时,用英文创建商品,中文通过 `i18n` skill 添加翻译。当用户要求"国际化"时,确保英文在主表,其他语言通过 i18n 添加。详见 i18n skill。
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import "@optima-chat/gen-cli";
3
+ //# sourceMappingURL=gen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gen.d.ts","sourceRoot":"","sources":["../../bin/gen.ts"],"names":[],"mappings":";AACA,OAAO,sBAAsB,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import "@optima-chat/gen-cli";
3
+ //# sourceMappingURL=gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gen.js","sourceRoot":"","sources":["../../bin/gen.ts"],"names":[],"mappings":";AACA,OAAO,sBAAsB,CAAC"}
@@ -11,7 +11,7 @@ export declare class OptimaAgent {
11
11
  * @param prompt 用户输入
12
12
  * @param chatOptions 选项,包括 streamFormat: 'delta' | 'content'
13
13
  */
14
- chat(prompt: string, chatOptions?: ChatOptions): AsyncGenerator<import("@anthropic-ai/claude-agent-sdk").SDKUserMessage | import("@anthropic-ai/claude-agent-sdk").SDKAssistantMessage | import("@anthropic-ai/claude-agent-sdk").SDKResultSuccess | import("@anthropic-ai/claude-agent-sdk").SDKResultError | import("@anthropic-ai/claude-agent-sdk").SDKSystemMessage | import("@anthropic-ai/claude-agent-sdk").SDKPartialAssistantMessage | import("@anthropic-ai/claude-agent-sdk").SDKCompactBoundaryMessage | import("@anthropic-ai/claude-agent-sdk").SDKStatusMessage | import("@anthropic-ai/claude-agent-sdk").SDKLocalCommandOutputMessage | import("@anthropic-ai/claude-agent-sdk").SDKHookStartedMessage | import("@anthropic-ai/claude-agent-sdk").SDKHookProgressMessage | import("@anthropic-ai/claude-agent-sdk").SDKHookResponseMessage | import("@anthropic-ai/claude-agent-sdk").SDKToolProgressMessage | import("@anthropic-ai/claude-agent-sdk").SDKAuthStatusMessage | import("@anthropic-ai/claude-agent-sdk").SDKTaskNotificationMessage | import("@anthropic-ai/claude-agent-sdk").SDKTaskStartedMessage | import("@anthropic-ai/claude-agent-sdk").SDKTaskProgressMessage | import("@anthropic-ai/claude-agent-sdk").SDKFilesPersistedEvent | import("@anthropic-ai/claude-agent-sdk").SDKToolUseSummaryMessage | import("@anthropic-ai/claude-agent-sdk").SDKRateLimitEvent | import("@anthropic-ai/claude-agent-sdk").SDKElicitationCompleteMessage | import("@anthropic-ai/claude-agent-sdk").SDKPromptSuggestionMessage | {
14
+ chat(prompt: string, chatOptions?: ChatOptions): AsyncGenerator<import("@anthropic-ai/claude-agent-sdk").SDKUserMessage | import("@anthropic-ai/claude-agent-sdk").SDKAssistantMessage | import("@anthropic-ai/claude-agent-sdk").SDKResultSuccess | import("@anthropic-ai/claude-agent-sdk").SDKResultError | import("@anthropic-ai/claude-agent-sdk").SDKSystemMessage | import("@anthropic-ai/claude-agent-sdk").SDKPartialAssistantMessage | import("@anthropic-ai/claude-agent-sdk").SDKCompactBoundaryMessage | import("@anthropic-ai/claude-agent-sdk").SDKStatusMessage | import("@anthropic-ai/claude-agent-sdk").SDKAPIRetryMessage | import("@anthropic-ai/claude-agent-sdk").SDKLocalCommandOutputMessage | import("@anthropic-ai/claude-agent-sdk").SDKHookStartedMessage | import("@anthropic-ai/claude-agent-sdk").SDKHookProgressMessage | import("@anthropic-ai/claude-agent-sdk").SDKHookResponseMessage | import("@anthropic-ai/claude-agent-sdk").SDKToolProgressMessage | import("@anthropic-ai/claude-agent-sdk").SDKAuthStatusMessage | import("@anthropic-ai/claude-agent-sdk").SDKTaskNotificationMessage | import("@anthropic-ai/claude-agent-sdk").SDKTaskStartedMessage | import("@anthropic-ai/claude-agent-sdk").SDKTaskProgressMessage | import("@anthropic-ai/claude-agent-sdk").SDKFilesPersistedEvent | import("@anthropic-ai/claude-agent-sdk").SDKToolUseSummaryMessage | import("@anthropic-ai/claude-agent-sdk").SDKRateLimitEvent | import("@anthropic-ai/claude-agent-sdk").SDKElicitationCompleteMessage | import("@anthropic-ai/claude-agent-sdk").SDKPromptSuggestionMessage | {
15
15
  type: "text_delta";
16
16
  delta: {
17
17
  text: string;
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/system-prompt.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,IAAI,MAAM,CAkKxC"}
1
+ {"version":3,"file":"system-prompt.d.ts","sourceRoot":"","sources":["../../src/system-prompt.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,IAAI,MAAM,CA6KxC"}
@@ -35,7 +35,7 @@ export function getSystemPrompt() {
35
35
  - **collection** - 商品集合管理(分组、促销专区)
36
36
  - **homepage** - 店铺首页配置(Banner、集合展示)
37
37
  - **product-page** - 商品详情页配置
38
- - **comfy** - 图像/视频生成
38
+ - **gen** - 图像/视频/语音生成
39
39
  - **markdown-pdf** - Markdown 转 PDF(文档导出、报告生成)
40
40
  - **ffmpeg** - 音视频处理(格式转换、压缩、提取音频)
41
41
  - **ads** - Google Ads 广告投放
@@ -51,7 +51,7 @@ export function getSystemPrompt() {
51
51
  示例:
52
52
  - 用户:"查看我的店铺信息" - 使用 Skill 工具加载 "merchant"
53
53
  - 用户:"帮我创建一个商品" - 使用 Skill 工具加载 "product"
54
- - 用户:"生成一张产品图片" - 使用 Skill 工具加载 "comfy"
54
+ - 用户:"生成一张产品图片" - 使用 Skill 工具加载 "gen"
55
55
  - 用户:"包裹到哪了" / "查物流" - 使用 Skill 工具加载 "order"
56
56
  - 用户:"连接我的 Shopify 店铺" / "看看 Shopify 商品" - 使用 Skill 工具加载 "shopify"
57
57
 
@@ -74,6 +74,17 @@ export function getSystemPrompt() {
74
74
  4. 3 次均失败后,告知用户:"认证已过期,请刷新页面后重试",**停止重试**
75
75
  - 不要尝试通过 login/logout 修复认证问题
76
76
 
77
+ ## 额度不足处理
78
+
79
+ 当工具返回 \`INSUFFICIENT_CREDITS\` 错误时:
80
+ - 告知用户当前积分不足,无法完成本次操作
81
+ - 引导用户查看用量明细:[查看用量明细](action://usage)
82
+ - 告知用户可以**购买积分**或**升级计划**来获取更多额度
83
+ - **不要重试**,等用户充值后再操作
84
+
85
+ **回复示例**:
86
+ - "积分不足,无法生成图片。您可以 [查看用量明细](action://usage) 了解当前额度,通过购买积分或升级计划来继续使用。"
87
+
77
88
  ## 链接处理规则
78
89
 
79
90
  当用户发送电商平台链接时,**不要用 WebFetch 访问**(会被反爬拦截),先用 Skill 工具加载对应技能,再按技能中的 URL 解析规则执行命令:
@@ -1 +1 @@
1
- {"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/system-prompt.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC9C,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,MAAM;QACb,GAAG,EAAE,SAAS;QACd,OAAO,EAAE,MAAM;KAChB,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC9C,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH,OAAO;;;;;;;;;aASI,OAAO,IAAI,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2I9B,CAAC;AACF,CAAC"}
1
+ {"version":3,"file":"system-prompt.js","sourceRoot":"","sources":["../../src/system-prompt.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe;IAC7B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC9C,IAAI,EAAE,SAAS;QACf,KAAK,EAAE,MAAM;QACb,GAAG,EAAE,SAAS;QACd,OAAO,EAAE,MAAM;KAChB,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,GAAG,CAAC,kBAAkB,CAAC,OAAO,EAAE;QAC9C,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC;IAEH,OAAO;;;;;;;;;aASI,OAAO,IAAI,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsJ9B,CAAC;AACF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optima-chat/optima-agent",
3
- "version": "0.8.37",
3
+ "version": "0.8.39",
4
4
  "description": "基于 Claude Agent SDK 的电商运营 AI 助手",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",
@@ -9,7 +9,7 @@
9
9
  "optima": "./dist/bin/optima.js",
10
10
  "commerce": "./dist/bin/commerce.js",
11
11
  "bi-cli": "./dist/bin/bi-cli.js",
12
- "comfy": "./dist/bin/comfy.js",
12
+ "gen": "./dist/bin/gen.js",
13
13
  "google-ads": "./dist/bin/google-ads.js",
14
14
  "scout": "./dist/bin/scout.js",
15
15
  "sentinel": "./dist/bin/sentinel.js",
@@ -48,7 +48,7 @@
48
48
  "@anthropic-ai/claude-agent-sdk": "^0.2.63",
49
49
  "@optima-chat/ads-cli": "latest",
50
50
  "@optima-chat/bi-cli": "latest",
51
- "@optima-chat/comfy-cli": "latest",
51
+ "@optima-chat/gen-cli": "latest",
52
52
  "@optima-chat/commerce-cli": "latest",
53
53
  "@optima-chat/scout-cli": "latest",
54
54
  "@optima-chat/sentinel-cli": "latest",