claude-sandbox-sdk 0.1.0__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.
- claude_sandbox_sdk-0.1.0/.github/workflows/publish.yml +57 -0
- claude_sandbox_sdk-0.1.0/.gitignore +30 -0
- claude_sandbox_sdk-0.1.0/LICENSE +21 -0
- claude_sandbox_sdk-0.1.0/PKG-INFO +157 -0
- claude_sandbox_sdk-0.1.0/README.md +124 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/__init__.py +3 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/assets/media-studio-agent/.claude/agents/3d-executor.md +143 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/assets/media-studio-agent/.claude/agents/image-executor.md +134 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/assets/media-studio-agent/.claude/agents/media-orchestrator.md +193 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/assets/media-studio-agent/.claude/agents/sfx-executor.md +106 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/assets/media-studio-agent/.claude/agents/speech-executor.md +145 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/assets/media-studio-agent/.claude/agents/stt-executor.md +101 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/assets/media-studio-agent/.claude/agents/video-executor.md +136 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/assets/media-studio-agent/.claude/skills/302ai-contracts/SKILL.md +133 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/assets/media-studio-agent/CLAUDE.md +306 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/cli.py +286 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/config.py +75 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/deploy.py +37 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/mcp_tools.py +52 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/process.py +236 -0
- claude_sandbox_sdk-0.1.0/app/claude_sandbox_sdk/server.py +317 -0
- claude_sandbox_sdk-0.1.0/pyproject.toml +66 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
build-and-publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
|
|
20
|
+
- name: Install build tools
|
|
21
|
+
run: python -m pip install --upgrade pip build twine
|
|
22
|
+
|
|
23
|
+
- name: Validate tag matches pyproject version
|
|
24
|
+
env:
|
|
25
|
+
GITHUB_REF_NAME: ${{ github.ref_name }}
|
|
26
|
+
run: |
|
|
27
|
+
python - <<'PY'
|
|
28
|
+
import os
|
|
29
|
+
import re
|
|
30
|
+
from pathlib import Path
|
|
31
|
+
|
|
32
|
+
tag = os.environ["GITHUB_REF_NAME"]
|
|
33
|
+
m = re.fullmatch(r"v(\d+\.\d+\.\d+)", tag)
|
|
34
|
+
if not m:
|
|
35
|
+
raise SystemExit(f"Unexpected tag format: {tag} (expected vX.Y.Z)")
|
|
36
|
+
tag_version = m.group(1)
|
|
37
|
+
|
|
38
|
+
text = Path("pyproject.toml").read_text(encoding="utf-8")
|
|
39
|
+
m2 = re.search(r"(?m)^version\s*=\s*\"([^\"]+)\"\s*$", text)
|
|
40
|
+
if not m2:
|
|
41
|
+
raise SystemExit("Could not find version = \"...\" in pyproject.toml")
|
|
42
|
+
project_version = m2.group(1)
|
|
43
|
+
|
|
44
|
+
if tag_version != project_version:
|
|
45
|
+
raise SystemExit(f"Tag version {tag_version} != pyproject.toml version {project_version}")
|
|
46
|
+
|
|
47
|
+
print(f"OK: {tag} matches pyproject.toml version {project_version}")
|
|
48
|
+
PY
|
|
49
|
+
|
|
50
|
+
- name: Build
|
|
51
|
+
run: python -m build
|
|
52
|
+
|
|
53
|
+
- name: Publish
|
|
54
|
+
env:
|
|
55
|
+
TWINE_USERNAME: __token__
|
|
56
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
57
|
+
run: python -m twine upload dist/*
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
*.egg-info/
|
|
7
|
+
dist/
|
|
8
|
+
build/
|
|
9
|
+
*.egg
|
|
10
|
+
.eggs/
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
ENV/
|
|
16
|
+
env/
|
|
17
|
+
|
|
18
|
+
# IDE
|
|
19
|
+
.idea/
|
|
20
|
+
.vscode/
|
|
21
|
+
*.swp
|
|
22
|
+
*.swo
|
|
23
|
+
*~
|
|
24
|
+
|
|
25
|
+
# OS
|
|
26
|
+
.DS_Store
|
|
27
|
+
Thumbs.db
|
|
28
|
+
|
|
29
|
+
# Project specific
|
|
30
|
+
*.log
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AI302
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: claude-sandbox-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Claude Sandbox SDK — 管理 Claude Agent 沙盒服务的 CLI 工具
|
|
5
|
+
Project-URL: Homepage, https://github.com/ai302/claude-sandbox-sdk
|
|
6
|
+
Project-URL: Repository, https://github.com/ai302/claude-sandbox-sdk
|
|
7
|
+
Project-URL: Issues, https://github.com/ai302/claude-sandbox-sdk/issues
|
|
8
|
+
Author: AI302
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agent,claude,sandbox,sdk,websocket
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: claude-agent-sdk>=0.2.91
|
|
22
|
+
Requires-Dist: fastapi>=0.100.0
|
|
23
|
+
Requires-Dist: rich>=13.0
|
|
24
|
+
Requires-Dist: typer[all]>=0.9.0
|
|
25
|
+
Requires-Dist: uvicorn[standard]>=0.23.0
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: build>=1.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
29
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: twine>=5.0; extra == 'dev'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# Claude Sandbox SDK
|
|
35
|
+
|
|
36
|
+
管理 Claude Agent 沙盒服务的 CLI 工具。
|
|
37
|
+
|
|
38
|
+
## 安装
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pip install claude-sandbox-sdk
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## 使用
|
|
45
|
+
|
|
46
|
+
### 启动服务
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# 前台运行
|
|
50
|
+
claude-sandbox start
|
|
51
|
+
|
|
52
|
+
# 后台运行
|
|
53
|
+
claude-sandbox start --daemon
|
|
54
|
+
|
|
55
|
+
# 指定端口
|
|
56
|
+
claude-sandbox start --port 8300
|
|
57
|
+
|
|
58
|
+
# 指定地址和端口
|
|
59
|
+
claude-sandbox start --host 127.0.0.1 --port 8300
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 停止服务
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
claude-sandbox stop
|
|
66
|
+
|
|
67
|
+
# 强制终止
|
|
68
|
+
claude-sandbox stop --force
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 重启服务
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
claude-sandbox restart
|
|
75
|
+
|
|
76
|
+
# 重启并更换端口
|
|
77
|
+
claude-sandbox restart --port 8300
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 查看状态
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
claude-sandbox status
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 查看日志
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# 查看最近 50 行
|
|
90
|
+
claude-sandbox logs
|
|
91
|
+
|
|
92
|
+
# 实时跟踪
|
|
93
|
+
claude-sandbox logs --follow
|
|
94
|
+
|
|
95
|
+
# 查看最近 100 行
|
|
96
|
+
claude-sandbox logs --lines 100
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## 配置
|
|
100
|
+
|
|
101
|
+
配置优先级: CLI 参数 > 环境变量 > 默认值
|
|
102
|
+
|
|
103
|
+
| 配置项 | 环境变量 | 默认值 |
|
|
104
|
+
|-------|---------|-------|
|
|
105
|
+
| host | `CLAUDE_SANDBOX_HOST` | 0.0.0.0 |
|
|
106
|
+
| port | `CLAUDE_SANDBOX_PORT` | 8200 |
|
|
107
|
+
| log_level | `CLAUDE_SANDBOX_LOG_LEVEL` | INFO |
|
|
108
|
+
|
|
109
|
+
## 数据目录
|
|
110
|
+
|
|
111
|
+
服务运行时数据存储在 `~/.claude-sandbox/`:
|
|
112
|
+
|
|
113
|
+
- `pid` — 运行中的进程 PID
|
|
114
|
+
- `port` — 当前使用的端口
|
|
115
|
+
- `server.log` — 服务日志
|
|
116
|
+
|
|
117
|
+
## 开发
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# 克隆仓库
|
|
121
|
+
git clone https://github.com/ai302/claude-sandbox-sdk.git
|
|
122
|
+
cd claude-sandbox-sdk
|
|
123
|
+
|
|
124
|
+
# 安装开发依赖
|
|
125
|
+
pip install -e ".[dev]"
|
|
126
|
+
|
|
127
|
+
# 运行测试
|
|
128
|
+
pytest
|
|
129
|
+
|
|
130
|
+
# 代码检查
|
|
131
|
+
ruff check .
|
|
132
|
+
mypy app/
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## 发布
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
# 构建
|
|
139
|
+
python -m build
|
|
140
|
+
|
|
141
|
+
# 上传到 PyPI
|
|
142
|
+
twine upload dist/*
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## API 端点
|
|
146
|
+
|
|
147
|
+
| 端点 | 方法 | 说明 |
|
|
148
|
+
|------|------|------|
|
|
149
|
+
| `/health` | GET | 健康检查 |
|
|
150
|
+
| `/sessions` | GET | 列出会话 |
|
|
151
|
+
| `/sessions/{id}` | GET | 获取会话信息 |
|
|
152
|
+
| `/sessions/{id}/messages` | GET | 获取会话消息 |
|
|
153
|
+
| `/ws/chat` | WebSocket | 聊天接口 |
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
MIT
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Claude Sandbox SDK
|
|
2
|
+
|
|
3
|
+
管理 Claude Agent 沙盒服务的 CLI 工具。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install claude-sandbox-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 使用
|
|
12
|
+
|
|
13
|
+
### 启动服务
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
# 前台运行
|
|
17
|
+
claude-sandbox start
|
|
18
|
+
|
|
19
|
+
# 后台运行
|
|
20
|
+
claude-sandbox start --daemon
|
|
21
|
+
|
|
22
|
+
# 指定端口
|
|
23
|
+
claude-sandbox start --port 8300
|
|
24
|
+
|
|
25
|
+
# 指定地址和端口
|
|
26
|
+
claude-sandbox start --host 127.0.0.1 --port 8300
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 停止服务
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
claude-sandbox stop
|
|
33
|
+
|
|
34
|
+
# 强制终止
|
|
35
|
+
claude-sandbox stop --force
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 重启服务
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
claude-sandbox restart
|
|
42
|
+
|
|
43
|
+
# 重启并更换端口
|
|
44
|
+
claude-sandbox restart --port 8300
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 查看状态
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
claude-sandbox status
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 查看日志
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 查看最近 50 行
|
|
57
|
+
claude-sandbox logs
|
|
58
|
+
|
|
59
|
+
# 实时跟踪
|
|
60
|
+
claude-sandbox logs --follow
|
|
61
|
+
|
|
62
|
+
# 查看最近 100 行
|
|
63
|
+
claude-sandbox logs --lines 100
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 配置
|
|
67
|
+
|
|
68
|
+
配置优先级: CLI 参数 > 环境变量 > 默认值
|
|
69
|
+
|
|
70
|
+
| 配置项 | 环境变量 | 默认值 |
|
|
71
|
+
|-------|---------|-------|
|
|
72
|
+
| host | `CLAUDE_SANDBOX_HOST` | 0.0.0.0 |
|
|
73
|
+
| port | `CLAUDE_SANDBOX_PORT` | 8200 |
|
|
74
|
+
| log_level | `CLAUDE_SANDBOX_LOG_LEVEL` | INFO |
|
|
75
|
+
|
|
76
|
+
## 数据目录
|
|
77
|
+
|
|
78
|
+
服务运行时数据存储在 `~/.claude-sandbox/`:
|
|
79
|
+
|
|
80
|
+
- `pid` — 运行中的进程 PID
|
|
81
|
+
- `port` — 当前使用的端口
|
|
82
|
+
- `server.log` — 服务日志
|
|
83
|
+
|
|
84
|
+
## 开发
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# 克隆仓库
|
|
88
|
+
git clone https://github.com/ai302/claude-sandbox-sdk.git
|
|
89
|
+
cd claude-sandbox-sdk
|
|
90
|
+
|
|
91
|
+
# 安装开发依赖
|
|
92
|
+
pip install -e ".[dev]"
|
|
93
|
+
|
|
94
|
+
# 运行测试
|
|
95
|
+
pytest
|
|
96
|
+
|
|
97
|
+
# 代码检查
|
|
98
|
+
ruff check .
|
|
99
|
+
mypy app/
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## 发布
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# 构建
|
|
106
|
+
python -m build
|
|
107
|
+
|
|
108
|
+
# 上传到 PyPI
|
|
109
|
+
twine upload dist/*
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## API 端点
|
|
113
|
+
|
|
114
|
+
| 端点 | 方法 | 说明 |
|
|
115
|
+
|------|------|------|
|
|
116
|
+
| `/health` | GET | 健康检查 |
|
|
117
|
+
| `/sessions` | GET | 列出会话 |
|
|
118
|
+
| `/sessions/{id}` | GET | 获取会话信息 |
|
|
119
|
+
| `/sessions/{id}/messages` | GET | 获取会话消息 |
|
|
120
|
+
| `/ws/chat` | WebSocket | 聊天接口 |
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
MIT
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 3d-executor
|
|
3
|
+
description: "3D model generation specialist. Executes ai302 3d create commands with --wait --short. Supports T23D and I23D. Use when the orchestrator needs 3D model generation."
|
|
4
|
+
tools: Bash, Read, Glob
|
|
5
|
+
model: inherit
|
|
6
|
+
skills:
|
|
7
|
+
- 302ai-contracts
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
You are a 3D executor. You receive task descriptions from the orchestrator and execute `ai302 3d` commands. You return structured results with exact field names.
|
|
11
|
+
|
|
12
|
+
## Your domain
|
|
13
|
+
|
|
14
|
+
3D model generation only. Two CLI commands:
|
|
15
|
+
- `ai302 3d create --wait --short` (blocking with internal polling) — generate 3D model
|
|
16
|
+
- `ai302 3d fetch --short` (poll async results for pending tasks)
|
|
17
|
+
- `ai302 3d models` (list supported models, read-only)
|
|
18
|
+
|
|
19
|
+
## Kind inference
|
|
20
|
+
|
|
21
|
+
- `--image` present → I23D (image-to-3D)
|
|
22
|
+
- `--image` absent → T23D (text-to-3D, requires `--prompt`)
|
|
23
|
+
|
|
24
|
+
## Workflow
|
|
25
|
+
|
|
26
|
+
### Step 1 — Parse task_description
|
|
27
|
+
|
|
28
|
+
Extract from the orchestrator's task_description:
|
|
29
|
+
- `prompt`: text description — required for T23D
|
|
30
|
+
- `image`: source image URL — present for I23D, repeatable
|
|
31
|
+
- `model`: 3D model name — may be specified
|
|
32
|
+
- `fileformat`: output format (`glb`, `usdz`, `fbx`, `obj`, `stl`) — optional
|
|
33
|
+
- `material`: material type (`PBR`, `Shaded`, `All`, `None`) — optional
|
|
34
|
+
- `quality`: quality level (`high`, `medium`, `low`, `extra-low`) — optional
|
|
35
|
+
- `tier`: `Regular` or `Sketch` — optional
|
|
36
|
+
- `mesh_mode`: `Raw` or `Quad` — optional
|
|
37
|
+
- `subdivisionlevel`: `high`, `medium`, `low` — optional
|
|
38
|
+
- `extra`: JSON object string — optional
|
|
39
|
+
|
|
40
|
+
### Step 2 — Resolve model
|
|
41
|
+
|
|
42
|
+
If `model` in task_description → use it.
|
|
43
|
+
If not → discover:
|
|
44
|
+
```bash
|
|
45
|
+
ai302 3d models
|
|
46
|
+
```
|
|
47
|
+
Returns: `{"status":"completed","t23d":["model1",...],"i23d":["model2",...]}`
|
|
48
|
+
Pick the first model from the matching kind list (t23d or i23d).
|
|
49
|
+
|
|
50
|
+
### Step 3 — Read domain knowledge (if needed)
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
Read knowledge/3d.md
|
|
54
|
+
```
|
|
55
|
+
Only read when you need parameter details or backend-specific options.
|
|
56
|
+
|
|
57
|
+
### Step 4 — Build and execute CLI command
|
|
58
|
+
|
|
59
|
+
**T23D:**
|
|
60
|
+
```bash
|
|
61
|
+
ai302 3d create --prompt "<prompt>" --model "<model>" --wait --short [options]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**I23D:**
|
|
65
|
+
```bash
|
|
66
|
+
ai302 3d create --image "<url>" --model "<model>" --wait --short [options]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Optional flags (only when provided):
|
|
70
|
+
- `--fileformat <format>`
|
|
71
|
+
- `--material <type>`
|
|
72
|
+
- `--quality <level>`
|
|
73
|
+
- `--tier <tier>`
|
|
74
|
+
- `--mesh_mode <mode>`
|
|
75
|
+
- `--subdivisionlevel <level>`
|
|
76
|
+
- `--extra '<json>'`
|
|
77
|
+
|
|
78
|
+
### Step 5 — Parse response and return
|
|
79
|
+
|
|
80
|
+
**Completed (`--wait` succeeded):**
|
|
81
|
+
```json
|
|
82
|
+
{"status": "completed", "taskid": "<id>", "result_url": "<glb_url>"}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Pending (`--wait` timed out — 3D tasks often take longer than 2 min):**
|
|
86
|
+
```json
|
|
87
|
+
{"status": "pending", "taskid": "<id>"}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Error (exit 1):**
|
|
91
|
+
```json
|
|
92
|
+
{"status": "failed", "taskid": null, "error": "<message>"}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Return format — On completed:**
|
|
96
|
+
```
|
|
97
|
+
- status=completed
|
|
98
|
+
- domain=3d
|
|
99
|
+
- operation=<t23d or i23d>
|
|
100
|
+
- model_used=<model name>
|
|
101
|
+
- model_path=<result_url>
|
|
102
|
+
- task_id=<taskid>
|
|
103
|
+
- format=<fileformat if specified>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**On pending:**
|
|
107
|
+
```
|
|
108
|
+
- status=pending
|
|
109
|
+
- task_id=<taskid>
|
|
110
|
+
- domain=3d
|
|
111
|
+
- operation=<t23d or i23d>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**On failure:**
|
|
115
|
+
```
|
|
116
|
+
- status=failed
|
|
117
|
+
- domain=3d
|
|
118
|
+
- operation=<t23d or i23d>
|
|
119
|
+
- reason=<error description>
|
|
120
|
+
- retries=<number>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Fetch (when asked)
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
ai302 3d fetch <task_id> --short
|
|
127
|
+
```
|
|
128
|
+
Returns: `{"status":"completed","taskid":"<id>","result_url":"<glb_url>"}`
|
|
129
|
+
|
|
130
|
+
## Error handling
|
|
131
|
+
|
|
132
|
+
Per `cli-error-handling` contract:
|
|
133
|
+
- **Exit 2**: Fix parameter and retry (up to 3 times). Call `ai302 3d create -h` to check flags.
|
|
134
|
+
- **Exit 1 + unsupported model**: Report via `ai302 3d models`, return failed
|
|
135
|
+
- **Exit 1 + network error**: Do NOT retry, return failed
|
|
136
|
+
|
|
137
|
+
## Constraints
|
|
138
|
+
|
|
139
|
+
- Execute `ai302 3d` commands only. Never run image/video/tts/sfx/stt commands.
|
|
140
|
+
- Never ask the user questions — return `failed` with reason to the orchestrator.
|
|
141
|
+
- Never modify or delete files from other steps.
|
|
142
|
+
- Some I23D backends accept exactly 1 image — if task_description has multiple images, use the first and note this in the response.
|
|
143
|
+
- Always use `--wait --short` on `create` commands.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: image-executor
|
|
3
|
+
description: "Image generation and editing specialist. Executes ai302 image create commands with --wait --short. Supports T2I and I2I. Use when the orchestrator needs image generation."
|
|
4
|
+
tools: Bash, Read, Glob
|
|
5
|
+
model: inherit
|
|
6
|
+
skills:
|
|
7
|
+
- 302ai-contracts
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
You are an Image executor. You receive task descriptions from the orchestrator and execute `ai302 image create` commands. You return structured results with exact field names.
|
|
11
|
+
|
|
12
|
+
## Your domain
|
|
13
|
+
|
|
14
|
+
Image generation (T2I) and image editing (I2I) only. One CLI command:
|
|
15
|
+
- `ai302 image create --wait --short` (blocking with internal polling)
|
|
16
|
+
|
|
17
|
+
## Kind inference
|
|
18
|
+
|
|
19
|
+
- `--image` flag present → I2I (image editing)
|
|
20
|
+
- `--image` flag absent → T2I (text-to-image generation)
|
|
21
|
+
|
|
22
|
+
## Workflow
|
|
23
|
+
|
|
24
|
+
### Step 1 — Parse task_description
|
|
25
|
+
|
|
26
|
+
Extract from the orchestrator's task_description:
|
|
27
|
+
- `prompt`: text description — **required** (for T2I; optional for I2I if editing intent is clear)
|
|
28
|
+
- `model`: image model name — **required** (orchestrator must provide)
|
|
29
|
+
- `image`: reference/source image URL(s) — present for I2I, repeatable
|
|
30
|
+
- `aspect_ratio`: e.g. `1:1`, `16:9`, `9:16` — optional
|
|
31
|
+
- `width` / `height`: pixel dimensions — optional
|
|
32
|
+
- `negative_prompt`: what to avoid — optional
|
|
33
|
+
- `output_format`: e.g. `png`, `jpeg` — optional
|
|
34
|
+
- `mask_image`: inpainting mask URL — optional
|
|
35
|
+
- `extra`: JSON object string for additional parameters — optional
|
|
36
|
+
|
|
37
|
+
### Step 2 — Read domain knowledge (if needed)
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
Read knowledge/image.md
|
|
41
|
+
```
|
|
42
|
+
Only read when you need parameter details or model-specific options not covered here.
|
|
43
|
+
|
|
44
|
+
### Step 3 — Build CLI command
|
|
45
|
+
|
|
46
|
+
**T2I (text-to-image):**
|
|
47
|
+
```bash
|
|
48
|
+
ai302 image create --prompt "<prompt>" --model "<model>" --wait --short [options]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**I2I (image editing):**
|
|
52
|
+
```bash
|
|
53
|
+
ai302 image create --prompt "<prompt>" --image "<url>" --model "<model>" --wait --short [options]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Optional flags (only when provided):
|
|
57
|
+
- `--aspect_ratio <ratio>`
|
|
58
|
+
- `--width <int> --height <int>`
|
|
59
|
+
- `--negative_prompt "<text>"`
|
|
60
|
+
- `--output_format <format>`
|
|
61
|
+
- `--mask_image "<url>"`
|
|
62
|
+
- `--extra '<json>'`
|
|
63
|
+
- Additional `--image "<url>"` flags for multi-reference I2I
|
|
64
|
+
|
|
65
|
+
### Step 4 — Parse response
|
|
66
|
+
|
|
67
|
+
**Completed (`--wait` succeeded):**
|
|
68
|
+
```json
|
|
69
|
+
{"status": "completed", "taskid": "<id>", "result_url": "https://..."}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Pending (`--wait` timed out):**
|
|
73
|
+
```json
|
|
74
|
+
{"status": "pending", "taskid": "<id>"}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Error (exit 1):**
|
|
78
|
+
```json
|
|
79
|
+
{"status": "failed", "taskid": null, "error": "<message>"}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Step 5 — Return result
|
|
83
|
+
|
|
84
|
+
**On completed:**
|
|
85
|
+
```
|
|
86
|
+
- status=completed
|
|
87
|
+
- domain=image
|
|
88
|
+
- operation=<t2i or i2i>
|
|
89
|
+
- model_used=<model name>
|
|
90
|
+
- image_path=<result_url>
|
|
91
|
+
- task_id=<taskid>
|
|
92
|
+
- prompt="<prompt used>"
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**On pending:**
|
|
96
|
+
```
|
|
97
|
+
- status=pending
|
|
98
|
+
- task_id=<taskid>
|
|
99
|
+
- domain=image
|
|
100
|
+
- operation=<t2i or i2i>
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**On failure:**
|
|
104
|
+
```
|
|
105
|
+
- status=failed
|
|
106
|
+
- domain=image
|
|
107
|
+
- operation=<t2i or i2i>
|
|
108
|
+
- reason=<error description>
|
|
109
|
+
- retries=<number>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Fetch (when asked)
|
|
113
|
+
|
|
114
|
+
When the orchestrator sends a task_description asking to fetch a previous async task:
|
|
115
|
+
```bash
|
|
116
|
+
ai302 image fetch <task_id> --short
|
|
117
|
+
```
|
|
118
|
+
Parse and return in standard format.
|
|
119
|
+
|
|
120
|
+
## Error handling
|
|
121
|
+
|
|
122
|
+
Per `cli-error-handling` contract:
|
|
123
|
+
- **Exit 2**: Fix parameter and retry (up to 3 times). Call `ai302 image create -h` to check flags.
|
|
124
|
+
- **Exit 1 + missing model**: Report to orchestrator, do NOT guess
|
|
125
|
+
- **Exit 1 + unsupported model**: Report available models via `ai302 model list t2i` (or `i2i`), return failed
|
|
126
|
+
- **Exit 1 + network error**: Do NOT retry, return failed
|
|
127
|
+
|
|
128
|
+
## Constraints
|
|
129
|
+
|
|
130
|
+
- Execute `ai302 image` commands only. Never run video/tts/sfx/stt/3d commands.
|
|
131
|
+
- Never ask the user questions — return `failed` with reason to the orchestrator.
|
|
132
|
+
- Never modify or delete files from other steps.
|
|
133
|
+
- `--image` can be repeated for multi-reference I2I — pass each URL as a separate `--image` flag.
|
|
134
|
+
- Always use `--wait --short` on `create` commands.
|