compshare-cli 0.5.6__tar.gz → 0.5.8__tar.gz
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.
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/CHANGELOG.md +11 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/PKG-INFO +1 -1
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/connector/compshare/connector-meta.json +1 -1
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/connector/compshare/mcp.json +1 -1
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/connector/compshare/skills/compshare/SKILL.md +17 -1
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/plugin.json +2 -2
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/skills/compshare-cli/SKILL.md +28 -7
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/__init__.py +1 -1
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/commands/instance.py +43 -35
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/commands/minimax.py +1 -3
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/i18n.py +6 -3
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli.egg-info/PKG-INFO +1 -1
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_cli.py +31 -9
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_minimax.py +44 -2
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_minimax_media.py +29 -2
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/.agents/plugins/marketplace.json +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/LICENSE +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/MANIFEST.in +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/README.md +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/RELEASING.md +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/connector/compshare/icon.svg +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/connector/compshare/token-schema.json +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/pyproject.toml +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/setup.cfg +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/skills/compshare-cli/agents/openai.yaml +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/__main__.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/actions.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/api.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/cli.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/commands/__init__.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/commands/bandwidth.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/commands/common.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/commands/doctor.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/commands/image.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/commands/storage.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/commands/team.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/config.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/errors.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/insights.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/instance_templates.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/location.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/mcp_server.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/output.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/parsing.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/remote_jobs.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/runtime.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/sdk.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/ssh.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli/ssh_cache.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli.egg-info/SOURCES.txt +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli.egg-info/dependency_links.txt +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli.egg-info/entry_points.txt +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli.egg-info/requires.txt +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/src/compshare_cli.egg-info/top_level.txt +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_actions.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_api.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_bandwidth.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_cfs.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_config.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_insights.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_instance_templates.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_location.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_mcp_server.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_output.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_parsing.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_release_version.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_remote_jobs.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_sdk.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_ssh.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_ssh_cache.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_ssh_integration.py +0 -0
- {compshare_cli-0.5.6 → compshare_cli-0.5.8}/tests/test_workbuddy_connector.py +0 -0
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 0.5.8
|
|
6
|
+
|
|
7
|
+
- 新增 `instance create --skip-capacity-check`,在已指定 GPU 数、CPU 和内存时跳过库存预查,保留询价和 `--max-price` 保护。
|
|
8
|
+
|
|
9
|
+
## 0.5.7
|
|
10
|
+
|
|
11
|
+
- 对齐最新 H3 API,允许仅用参考音频创建视频,可省略文本提示词。
|
|
12
|
+
- 将 IndexTTS 2.5 语音生成的参考音频上传时长上限调整为 30 秒;H3 视频参考音频仍为
|
|
13
|
+
单段 2~15.08 秒,同类合计不超过 15.08 秒。
|
|
14
|
+
- 同步 CLI 和 WorkBuddy Skill 的素材限制、提示词优化及参考视频费用和语音结果保留说明。
|
|
15
|
+
|
|
5
16
|
## 0.5.6
|
|
6
17
|
|
|
7
18
|
- 移除 `compshare feedback` 命令及反馈提交功能。
|
|
@@ -3,7 +3,7 @@ name: compshare
|
|
|
3
3
|
description: Manage CompShare GPU cloud resources and MiniMax H3 media tasks through the controlled CompShare MCP bridge.
|
|
4
4
|
description_zh: 通过受控 CompShare MCP 桥接查询和管理优云智算 GPU 云资源及 MiniMax H3 视频、图片和语音任务。
|
|
5
5
|
description_en: Manage CompShare GPU cloud resources and MiniMax H3 media tasks through the controlled CompShare MCP bridge.
|
|
6
|
-
version: "0.5.
|
|
6
|
+
version: "0.5.8"
|
|
7
7
|
author: "CompShare"
|
|
8
8
|
---
|
|
9
9
|
|
|
@@ -119,6 +119,9 @@ CLI 本身要求确认的操作仍需在 `args` 中加入 `--yes`。若返回 `o
|
|
|
119
119
|
相同的参数移除 `--dry-run`,加入 `--yes`,再调用写工具。不要在没有用户给定价格保护时
|
|
120
120
|
自行猜测 `--max-price`。
|
|
121
121
|
|
|
122
|
+
用户要求跳过库存预查时,在预演和创建命令中都加入 `--skip-capacity-check`,并指定
|
|
123
|
+
`--count`、`--cpu` 和 `--memory`。询价和 `--max-price` 保护仍然生效。
|
|
124
|
+
|
|
122
125
|
JSON 创建至少提供 GPU、每实例 GPU 数、CPU、内存、镜像、Region 和 Zone;不要触发交互
|
|
123
126
|
向导。创建超时后先 `instance list/show`,按幂等标识或创建时间核对,不能立即再次购买。
|
|
124
127
|
|
|
@@ -175,10 +178,23 @@ MiniMax 使用 Token 表单中的独立 `COMPSHARE_MINIMAX_API_KEY`。缺失时
|
|
|
175
178
|
|
|
176
179
|
图片默认使用 1K;2K 以配置接口返回的价格是否存在为准,价格为 `null` 时不要提交。
|
|
177
180
|
|
|
181
|
+
视频 4~30 秒均一次生成,包括带参考视频的任务。`--context-ir` 默认关闭,所有时长均
|
|
182
|
+
强烈建议开启,每条任务另收 5 积分;使用 `--skill-id` 时必须同时开启。
|
|
183
|
+
全能参考允许仅用音频,最多 9 张图片、3 段视频、3 段音频,合计最多 12 个;不能与首尾帧混用。
|
|
184
|
+
图片宽高均为 256~5760 像素,宽高比为 0.4~2.5,单张最多 30 MiB。
|
|
185
|
+
参考视频单段最多 50 MiB,参考音频单段最多 15 MiB;单段时长均为 2~15.08 秒,
|
|
186
|
+
视频和音频分别累计,各自合计不超过 15.08 秒。参考视频合计时长向上取整到秒后收费,
|
|
187
|
+
480P 为每秒 5 积分,其他分辨率为每秒 10 积分;图片和音频参考不另收输入费。
|
|
188
|
+
|
|
178
189
|
视频素材支持公开 URL 或 Data URL;图片和语音参考素材通过 `image upload`、
|
|
179
190
|
`audio upload` 登记后使用资产 ID。生成结果 URL 默认脱敏;不要为了显示它而绕过连接器
|
|
180
191
|
的敏感输出限制。
|
|
181
192
|
|
|
193
|
+
`audio upload --duration-ms` 用于语音参考素材,时长为 500~30000 毫秒,文件最多 15 MiB,
|
|
194
|
+
与视频生成中的参考音频限制不同。语音生成结果由组织媒体库管理,自动清理默认关闭,
|
|
195
|
+
开启后按组织的保留时长或容量设置清理。未使用的语音参考素材默认保留 7 天;
|
|
196
|
+
保存的自定义音色单独保留。删除已完成任务会同时删除结果文件。
|
|
197
|
+
|
|
182
198
|
## 故障恢复
|
|
183
199
|
|
|
184
200
|
- `authentication` 或 `configuration_error`:让用户在 WorkBuddy Connector 设置中更新两把
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
|
|
3
3
|
"name": "compshare-cli",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.8",
|
|
5
5
|
"description": "Manage CompShare GPU cloud resources and MiniMax H3 media tasks through the compshare CLI.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "CompShare"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
]
|
|
26
26
|
},
|
|
27
27
|
"publication": {
|
|
28
|
-
"release_notes": "Adds
|
|
28
|
+
"release_notes": "Adds an option to skip the instance inventory precheck while retaining the price quote and maximum price guard."
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -130,6 +130,8 @@ compshare --json instance create \
|
|
|
130
130
|
|
|
131
131
|
In JSON mode, creation cannot open the interactive wizard. Supply `--gpu`, `--count`, `--cpu`, `--memory`, `--image`, `--region` and `--zone`. Here `--count` is GPUs per instance; `--max-count` is the number of instances.
|
|
132
132
|
|
|
133
|
+
When the user requests creation without an inventory precheck, add `--skip-capacity-check` to both the dry run and creation command. Supply `--count`, `--cpu`, and `--memory` through options or a template. The CLI still quotes the price and enforces `--max-price`.
|
|
134
|
+
|
|
133
135
|
## Inspect and manage instances
|
|
134
136
|
|
|
135
137
|
```bash
|
|
@@ -340,10 +342,24 @@ compshare --json minimax create 'A sailboat crossing a golden sea' \
|
|
|
340
342
|
|
|
341
343
|
Use `--first-frame` and `--last-frame` for frame-driven video, or repeat
|
|
342
344
|
`--reference-image`, `--reference-video` and `--reference-audio` for reference-driven video.
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
345
|
+
Audio references can be used alone, with or without a text prompt. Frame inputs cannot be
|
|
346
|
+
combined with reference inputs. Reference inputs allow up to 9 images, 3 videos and 3 audio
|
|
347
|
+
clips, with at most 12 in total.
|
|
348
|
+
|
|
349
|
+
Video supports 480P, 768P, 1080P, 2K and 4K and durations from 4 to 30 seconds, generated in
|
|
350
|
+
one pass even with video references. `--context-ir` is optional for every duration and off by
|
|
351
|
+
default; it is strongly recommended and adds 5 points per task. Use `minimax skill list` to
|
|
352
|
+
find a Skill, then pass both `--context-ir` and `--skill-id`.
|
|
353
|
+
|
|
354
|
+
Video inputs may use publicly accessible URLs or Data URLs. Images must be at most 30 MiB,
|
|
355
|
+
with each dimension between 256 and 5760 pixels and a width/height ratio between 0.4 and 2.5.
|
|
356
|
+
Reference videos allow at most 50 MiB per file; reference audio allows 15 MiB. Each video or
|
|
357
|
+
audio clip must be 2-15.08 seconds long, and each media type has a separate total duration
|
|
358
|
+
limit of 15.08 seconds. Input limits are independent of the output video duration.
|
|
359
|
+
Video references add 5 points per input second at 480P or 10 at higher resolutions, with
|
|
360
|
+
durations summed before rounding up to whole seconds. Image and audio references add no
|
|
361
|
+
input fee. For callbacks, pass `--callback-url` and set `COMPSHARE_MINIMAX_CALLBACK_TOKEN`
|
|
362
|
+
if the receiver validates a token.
|
|
347
363
|
Generated video URLs stay redacted unless the user explicitly needs them and `--show-sensitive`
|
|
348
364
|
is added as a root option.
|
|
349
365
|
|
|
@@ -385,11 +401,16 @@ compshare --json minimax audio show TASK_ID
|
|
|
385
401
|
```
|
|
386
402
|
|
|
387
403
|
For an authorized reference recording, `minimax audio upload FILE --duration-ms MS --yes`
|
|
388
|
-
|
|
404
|
+
accepts 500-30000 milliseconds and at most 15 MiB, and returns an asset ID. These speech
|
|
405
|
+
reference limits differ from the audio references used for video generation above.
|
|
406
|
+
Use `--voice-source asset --asset-id ASSET_ID`, or save it with
|
|
389
407
|
`minimax audio voice-create ASSET_ID NAME --yes` and then use `--voice-source custom --voice-id VOICE_ID`.
|
|
390
408
|
Generated image and speech URLs stay redacted unless the user explicitly needs them and
|
|
391
|
-
`--show-sensitive` is added as a root option.
|
|
392
|
-
|
|
409
|
+
`--show-sensitive` is added as a root option. Speech output is managed in the organization's
|
|
410
|
+
media library; automatic cleanup is off by default and follows organization retention or
|
|
411
|
+
capacity settings when enabled. Download output promptly. Unused speech reference assets
|
|
412
|
+
are retained for seven days by default; saved custom voices are kept separately.
|
|
413
|
+
Deleting a finished task also removes its output.
|
|
393
414
|
|
|
394
415
|
## Diagnostics
|
|
395
416
|
|
|
@@ -1350,6 +1350,11 @@ def create(
|
|
|
1350
1350
|
"--cfs/--no-cfs",
|
|
1351
1351
|
help="Attach existing CFS during container creation; does not purchase storage.",
|
|
1352
1352
|
),
|
|
1353
|
+
skip_capacity_check: bool = typer.Option(
|
|
1354
|
+
False,
|
|
1355
|
+
"--skip-capacity-check",
|
|
1356
|
+
help="Skip the inventory precheck. Requires --count, --cpu, and --memory.",
|
|
1357
|
+
),
|
|
1353
1358
|
dry_run: bool = typer.Option(
|
|
1354
1359
|
False,
|
|
1355
1360
|
"--dry-run",
|
|
@@ -1401,6 +1406,9 @@ def create(
|
|
|
1401
1406
|
resolved_platform = str(platform if platform is not None else "Auto")
|
|
1402
1407
|
resolved_max_count = int(max_count if max_count is not None else 1)
|
|
1403
1408
|
resolved_us3 = bool(us3) if us3 is not None else False
|
|
1409
|
+
if skip_capacity_check and any(value is None for value in (count, cpu, memory)):
|
|
1410
|
+
raise UsageError(tr("--skip-capacity-check requires --count, --cpu, and --memory."))
|
|
1411
|
+
|
|
1404
1412
|
interactive = any(value is None for value in (gpu, count, cpu, memory, image, region, zone))
|
|
1405
1413
|
if interactive and state.json_output:
|
|
1406
1414
|
raise UsageError(
|
|
@@ -1437,9 +1445,11 @@ def create(
|
|
|
1437
1445
|
|
|
1438
1446
|
disks = _disk_list(resolved_boot_disk, resolved_boot_type, data_disk)
|
|
1439
1447
|
common = {"Region": region, "Zone": selected_zone}
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1448
|
+
requested_memory = memory_mib(memory) // 1024 if memory is not None else None
|
|
1449
|
+
selected_spec: Dict[str, Any] = {}
|
|
1450
|
+
if not skip_capacity_check:
|
|
1451
|
+
capacity_params = {
|
|
1452
|
+
**common,
|
|
1443
1453
|
"GpuType": resolved_gpu,
|
|
1444
1454
|
"MachineType": "G",
|
|
1445
1455
|
"MinimalCpuPlatform": resolved_platform,
|
|
@@ -1447,36 +1457,34 @@ def create(
|
|
|
1447
1457
|
"ChargeType": resolved_charge,
|
|
1448
1458
|
"Disks": disks,
|
|
1449
1459
|
}
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
"
|
|
1466
|
-
)
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
),
|
|
1479
|
-
)
|
|
1460
|
+
capacity = call(state, "CheckCompShareResourceCapacity", capacity_params)
|
|
1461
|
+
matching = [
|
|
1462
|
+
spec
|
|
1463
|
+
for spec in capacity.get("Specs") or []
|
|
1464
|
+
if spec.get("ResourceEnough")
|
|
1465
|
+
and (count is None or spec.get("Gpu") == count)
|
|
1466
|
+
and (cpu is None or spec.get("Cpu") == cpu)
|
|
1467
|
+
and (requested_memory is None or spec.get("Mem") == requested_memory)
|
|
1468
|
+
]
|
|
1469
|
+
if not matching:
|
|
1470
|
+
Renderer(state.json_output, state.show_sensitive).error(
|
|
1471
|
+
tr(
|
|
1472
|
+
"No inventory is available for the selected GPU, CPU, memory, image, billing, "
|
|
1473
|
+
"and disk combination."
|
|
1474
|
+
),
|
|
1475
|
+
details={"capacity": capacity},
|
|
1476
|
+
)
|
|
1477
|
+
raise typer.Exit(2)
|
|
1478
|
+
|
|
1479
|
+
selected_spec = matching[0]
|
|
1480
|
+
if interactive and any(value is None for value in (count, cpu, memory)):
|
|
1481
|
+
selected_spec = _choose(
|
|
1482
|
+
"Available specification",
|
|
1483
|
+
matching,
|
|
1484
|
+
lambda spec: (
|
|
1485
|
+
f"GPU ×{spec.get('Gpu')} · {spec.get('Cpu')} CPU · {spec.get('Mem')}GiB memory"
|
|
1486
|
+
),
|
|
1487
|
+
)
|
|
1480
1488
|
resolved_count = int(count if count is not None else selected_spec["Gpu"])
|
|
1481
1489
|
resolved_cpu = int(cpu if cpu is not None else selected_spec["Cpu"])
|
|
1482
1490
|
resolved_memory_gib = int(
|
|
@@ -1552,7 +1560,7 @@ def create(
|
|
|
1552
1560
|
"dry_run": dry_run,
|
|
1553
1561
|
"max_price": str(price_limit) if price_limit is not None else None,
|
|
1554
1562
|
"selection": selection,
|
|
1555
|
-
"capacity": selected_spec,
|
|
1563
|
+
"capacity": selected_spec or None,
|
|
1556
1564
|
"price": price,
|
|
1557
1565
|
"request": create_params,
|
|
1558
1566
|
}
|
|
@@ -1593,7 +1601,7 @@ def create(
|
|
|
1593
1601
|
created = call(state, "CreateCompShareInstance", create_params)
|
|
1594
1602
|
result = {
|
|
1595
1603
|
"selection": selection,
|
|
1596
|
-
"capacity": selected_spec,
|
|
1604
|
+
"capacity": selected_spec or None,
|
|
1597
1605
|
"price": price,
|
|
1598
1606
|
"instance": created,
|
|
1599
1607
|
}
|
|
@@ -190,8 +190,6 @@ def _content(
|
|
|
190
190
|
raise UsageError(tr("Prompt cannot be empty."))
|
|
191
191
|
if sum(map(len, (reference_images, reference_videos, reference_audio))) > 12:
|
|
192
192
|
raise UsageError(tr("At most 12 reference inputs are allowed."))
|
|
193
|
-
if reference_audio and not (reference_images or reference_videos):
|
|
194
|
-
raise UsageError(tr("Reference audio requires a reference image or video."))
|
|
195
193
|
limits = (
|
|
196
194
|
(reference_images, 9, "--reference-image"),
|
|
197
195
|
(reference_videos, 3, "--reference-video"),
|
|
@@ -960,7 +958,7 @@ def audio_upload(
|
|
|
960
958
|
ctx: typer.Context,
|
|
961
959
|
file: Path = typer.Argument(..., exists=True, dir_okay=False, readable=True),
|
|
962
960
|
duration_ms: int = typer.Option(
|
|
963
|
-
..., min=500, max=
|
|
961
|
+
..., min=500, max=30000, help="Actual duration in milliseconds."
|
|
964
962
|
),
|
|
965
963
|
yes: bool = typer.Option(False, "--yes", "-y"),
|
|
966
964
|
) -> None:
|
|
@@ -120,9 +120,6 @@ ZH_TRANSLATIONS: Dict[str, str] = {
|
|
|
120
120
|
),
|
|
121
121
|
"{option} may be specified at most {maximum} times.": ("{option} 最多可指定 {maximum} 次。"),
|
|
122
122
|
"At most 12 reference inputs are allowed.": "参考素材合计最多 12 个。",
|
|
123
|
-
"Reference audio requires a reference image or video.": (
|
|
124
|
-
"参考音频需要同时指定参考图片或视频。"
|
|
125
|
-
),
|
|
126
123
|
"Unsupported video model: {model}.": "不支持的视频模型:{model}。",
|
|
127
124
|
"--resolution must be 480P, 768P, 1080P, 2K, or 4K.": (
|
|
128
125
|
"--resolution 必须是 480P、768P、1080P、2K 或 4K。"
|
|
@@ -600,6 +597,9 @@ ZH_TRANSLATIONS: Dict[str, str] = {
|
|
|
600
597
|
"Wait for the operation to reach a stable state.": "等待操作进入稳定状态。",
|
|
601
598
|
"Maximum wait time in seconds.": "最长等待时间(秒)。",
|
|
602
599
|
"Validate and show the request without changing resources.": "仅校验并显示请求,不变更资源。",
|
|
600
|
+
"Skip the inventory precheck. Requires --count, --cpu, and --memory.": (
|
|
601
|
+
"跳过库存预查。需要指定 --count、--cpu 和 --memory。"
|
|
602
|
+
),
|
|
603
603
|
"Operation plan": "操作计划",
|
|
604
604
|
"Create plan": "创建计划",
|
|
605
605
|
"Instance details": "实例详情",
|
|
@@ -828,6 +828,9 @@ ZH_TRANSLATIONS: Dict[str, str] = {
|
|
|
828
828
|
),
|
|
829
829
|
"Option --profile requires a value.": "选项 --profile 需要一个值。",
|
|
830
830
|
"Option --profile may only be specified once.": "选项 --profile 只能指定一次。",
|
|
831
|
+
"--skip-capacity-check requires --count, --cpu, and --memory.": (
|
|
832
|
+
"--skip-capacity-check 需要指定 --count、--cpu 和 --memory。"
|
|
833
|
+
),
|
|
831
834
|
(
|
|
832
835
|
"No inventory is available for the selected GPU, CPU, memory, image, billing, "
|
|
833
836
|
"and disk combination."
|
|
@@ -933,6 +933,17 @@ def test_create_json_requires_explicit_parameters(capsys) -> None:
|
|
|
933
933
|
assert "--gpu" in payload["error"]["message"]
|
|
934
934
|
|
|
935
935
|
|
|
936
|
+
def test_create_skip_capacity_check_requires_explicit_spec(capsys) -> None:
|
|
937
|
+
with pytest.raises(SystemExit) as raised:
|
|
938
|
+
cli.main(["--json", "instance", "create", "--skip-capacity-check"])
|
|
939
|
+
|
|
940
|
+
assert raised.value.code == 2
|
|
941
|
+
error = _json_error(capsys.readouterr().out)
|
|
942
|
+
assert error["code"] == "invalid_usage"
|
|
943
|
+
for option in ("--skip-capacity-check", "--count", "--cpu", "--memory"):
|
|
944
|
+
assert option in error["message"]
|
|
945
|
+
|
|
946
|
+
|
|
936
947
|
def test_local_instance_template_crud() -> None:
|
|
937
948
|
created = runner.invoke(
|
|
938
949
|
cli.app,
|
|
@@ -1070,7 +1081,8 @@ def test_instance_create_loads_template_and_explicit_options_override(
|
|
|
1070
1081
|
]
|
|
1071
1082
|
|
|
1072
1083
|
|
|
1073
|
-
|
|
1084
|
+
@pytest.mark.parametrize("skip_capacity_check", [False, True])
|
|
1085
|
+
def test_create_explicit_json_mode_skips_discovery(monkeypatch, skip_capacity_check) -> None:
|
|
1074
1086
|
calls = []
|
|
1075
1087
|
|
|
1076
1088
|
def fake_call(state, action, params):
|
|
@@ -1112,6 +1124,7 @@ def test_create_explicit_json_mode_skips_discovery(monkeypatch) -> None:
|
|
|
1112
1124
|
"--zone",
|
|
1113
1125
|
"cn-wlcb-01",
|
|
1114
1126
|
"--yes",
|
|
1127
|
+
*(["--skip-capacity-check"] if skip_capacity_check else []),
|
|
1115
1128
|
],
|
|
1116
1129
|
env={
|
|
1117
1130
|
"COMPSHARE_PUBLIC_KEY": "public",
|
|
@@ -1120,12 +1133,16 @@ def test_create_explicit_json_mode_skips_discovery(monkeypatch) -> None:
|
|
|
1120
1133
|
)
|
|
1121
1134
|
|
|
1122
1135
|
assert result.exit_code == 0, result.output
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
"
|
|
1126
|
-
|
|
1127
|
-
]
|
|
1128
|
-
assert
|
|
1136
|
+
expected_actions = ["GetCompShareInstancePrice", "CreateCompShareInstance"]
|
|
1137
|
+
if not skip_capacity_check:
|
|
1138
|
+
expected_actions.insert(0, "CheckCompShareResourceCapacity")
|
|
1139
|
+
assert [action for action, _ in calls] == expected_actions
|
|
1140
|
+
assert calls[-1][1]["GPU"] == 1
|
|
1141
|
+
assert calls[-1][1]["CPU"] == 12
|
|
1142
|
+
assert calls[-1][1]["Memory"] == 32 * 1024
|
|
1143
|
+
payload = _json_data(result.stdout)
|
|
1144
|
+
assert payload["selection"]["ChargeType"] == "Postpay"
|
|
1145
|
+
assert (payload["capacity"] is None) is skip_capacity_check
|
|
1129
1146
|
assert waits == [("uhost-test", {"region": "cn-wlcb", "desired": {"Running"}, "timeout": 600})]
|
|
1130
1147
|
|
|
1131
1148
|
|
|
@@ -3160,7 +3177,8 @@ def test_batch_lifecycle_reports_partial_failure(monkeypatch) -> None:
|
|
|
3160
3177
|
assert payload["error"]["details"]["failed"][0]["instance"] == "host-2"
|
|
3161
3178
|
|
|
3162
3179
|
|
|
3163
|
-
|
|
3180
|
+
@pytest.mark.parametrize("skip_capacity_check", [False, True])
|
|
3181
|
+
def test_create_max_price_stops_before_create(monkeypatch, capsys, skip_capacity_check) -> None:
|
|
3164
3182
|
calls = []
|
|
3165
3183
|
|
|
3166
3184
|
def fake_call(state, action, params):
|
|
@@ -3195,11 +3213,15 @@ def test_create_max_price_stops_before_create(monkeypatch, capsys) -> None:
|
|
|
3195
3213
|
"--max-price",
|
|
3196
3214
|
"0.50",
|
|
3197
3215
|
"--yes",
|
|
3216
|
+
*(["--skip-capacity-check"] if skip_capacity_check else []),
|
|
3198
3217
|
]
|
|
3199
3218
|
)
|
|
3200
3219
|
|
|
3201
3220
|
assert raised.value.code == 2
|
|
3202
|
-
|
|
3221
|
+
expected_actions = ["GetCompShareInstancePrice"]
|
|
3222
|
+
if not skip_capacity_check:
|
|
3223
|
+
expected_actions.insert(0, "CheckCompShareResourceCapacity")
|
|
3224
|
+
assert calls == expected_actions
|
|
3203
3225
|
assert "0.7" in _json_error(capsys.readouterr().out)["message"]
|
|
3204
3226
|
|
|
3205
3227
|
|
|
@@ -116,8 +116,50 @@ def test_video_media_only_and_reference_limits() -> None:
|
|
|
116
116
|
]
|
|
117
117
|
with pytest.raises(UsageError, match="12"):
|
|
118
118
|
minimax._content("prompt", None, None, ["image"] * 9, ["video"] * 3, ["audio"])
|
|
119
|
-
with pytest.raises(UsageError):
|
|
120
|
-
minimax._content("prompt", None, None, [], [], ["audio"])
|
|
119
|
+
with pytest.raises(UsageError, match="3"):
|
|
120
|
+
minimax._content("prompt", None, None, [], [], ["audio"] * 4)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@pytest.mark.parametrize("prompt", ["", "参考音频的海浪声生成海边画面"])
|
|
124
|
+
@pytest.mark.parametrize("context_options", [[], ["--no-context-ir"]])
|
|
125
|
+
def test_create_accepts_audio_only_reference_without_context_ir(
|
|
126
|
+
monkeypatch, prompt, context_options
|
|
127
|
+
) -> None:
|
|
128
|
+
captured = {}
|
|
129
|
+
|
|
130
|
+
def fake_urlopen(req, timeout):
|
|
131
|
+
captured.update(json.loads(req.data))
|
|
132
|
+
return FakeResponse({"task_id": "task-audio-reference"})
|
|
133
|
+
|
|
134
|
+
monkeypatch.setattr(minimax.request, "urlopen", fake_urlopen)
|
|
135
|
+
result = runner.invoke(
|
|
136
|
+
cli.app,
|
|
137
|
+
[
|
|
138
|
+
"--json",
|
|
139
|
+
"minimax",
|
|
140
|
+
"create",
|
|
141
|
+
*([prompt] if prompt else []),
|
|
142
|
+
"--reference-audio",
|
|
143
|
+
"https://example.com/ocean.wav",
|
|
144
|
+
"--duration",
|
|
145
|
+
"30",
|
|
146
|
+
*context_options,
|
|
147
|
+
"--yes",
|
|
148
|
+
],
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
assert result.exit_code == 0, result.output
|
|
152
|
+
expected_content = [{"type": "text", "text": prompt}] if prompt else []
|
|
153
|
+
expected_content.append(
|
|
154
|
+
{
|
|
155
|
+
"type": "audio_url",
|
|
156
|
+
"audio_url": {"url": "https://example.com/ocean.wav"},
|
|
157
|
+
"role": "reference_audio",
|
|
158
|
+
}
|
|
159
|
+
)
|
|
160
|
+
assert captured["content"] == expected_content
|
|
161
|
+
assert captured["duration"] == 30
|
|
162
|
+
assert "use_context_ir" not in captured
|
|
121
163
|
|
|
122
164
|
|
|
123
165
|
def test_video_new_options_follow_api_contract() -> None:
|
|
@@ -186,7 +186,7 @@ def test_audio_create_rejects_invalid_options(args):
|
|
|
186
186
|
(
|
|
187
187
|
"audio",
|
|
188
188
|
"reference.wav",
|
|
189
|
-
["--duration-ms", "
|
|
189
|
+
["--duration-ms", "30000"],
|
|
190
190
|
{
|
|
191
191
|
"upload_url": "https://upload.example.com/reference.wav?signature=secret",
|
|
192
192
|
"object_key": "audio-key",
|
|
@@ -230,7 +230,34 @@ def test_reference_upload_uses_signed_url_then_registers(
|
|
|
230
230
|
assert registered["height"] == 20
|
|
231
231
|
else:
|
|
232
232
|
assert "Authorization" not in calls[1][2]
|
|
233
|
-
assert registered["duration_ms"] ==
|
|
233
|
+
assert registered["duration_ms"] == 30000
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
@pytest.mark.parametrize("duration_ms", [499, 30001])
|
|
237
|
+
def test_audio_upload_rejects_out_of_range_duration(monkeypatch, tmp_path, duration_ms):
|
|
238
|
+
file = tmp_path / "reference.wav"
|
|
239
|
+
file.write_bytes(b"test-data")
|
|
240
|
+
monkeypatch.setattr(
|
|
241
|
+
minimax.request,
|
|
242
|
+
"urlopen",
|
|
243
|
+
lambda *args, **kwargs: pytest.fail("invalid duration called the API"),
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
result = runner.invoke(
|
|
247
|
+
cli.app,
|
|
248
|
+
[
|
|
249
|
+
"--json",
|
|
250
|
+
"minimax",
|
|
251
|
+
"audio",
|
|
252
|
+
"upload",
|
|
253
|
+
str(file),
|
|
254
|
+
"--duration-ms",
|
|
255
|
+
str(duration_ms),
|
|
256
|
+
"--yes",
|
|
257
|
+
],
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
assert result.exit_code == 2
|
|
234
261
|
|
|
235
262
|
|
|
236
263
|
def test_video_skill_create_uses_documented_endpoint(monkeypatch):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|