claw3d 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.
Files changed (61) hide show
  1. claw3d-0.1.0/LICENSE +21 -0
  2. claw3d-0.1.0/PKG-INFO +178 -0
  3. claw3d-0.1.0/README.md +152 -0
  4. claw3d-0.1.0/pyproject.toml +37 -0
  5. claw3d-0.1.0/setup.cfg +4 -0
  6. claw3d-0.1.0/src/claw3d/__init__.py +3 -0
  7. claw3d-0.1.0/src/claw3d/__main__.py +6 -0
  8. claw3d-0.1.0/src/claw3d/ai_providers/__init__.py +47 -0
  9. claw3d-0.1.0/src/claw3d/ai_providers/base.py +109 -0
  10. claw3d-0.1.0/src/claw3d/ai_providers/edit_3d_render.py +212 -0
  11. claw3d-0.1.0/src/claw3d/ai_providers/fal_provider.py +470 -0
  12. claw3d-0.1.0/src/claw3d/ai_providers/provider_registry.py +117 -0
  13. claw3d-0.1.0/src/claw3d/ai_providers/registry.py +204 -0
  14. claw3d-0.1.0/src/claw3d/ai_providers/replicate_provider.py +52 -0
  15. claw3d-0.1.0/src/claw3d/backends/__init__.py +136 -0
  16. claw3d-0.1.0/src/claw3d/backends/backend_registry.py +108 -0
  17. claw3d-0.1.0/src/claw3d/backends/base.py +130 -0
  18. claw3d-0.1.0/src/claw3d/backends/moonraker.py +264 -0
  19. claw3d-0.1.0/src/claw3d/backends/prusalink.py +53 -0
  20. claw3d-0.1.0/src/claw3d/backends/registry.py +67 -0
  21. claw3d-0.1.0/src/claw3d/cli.py +161 -0
  22. claw3d-0.1.0/src/claw3d/commands/__init__.py +1 -0
  23. claw3d-0.1.0/src/claw3d/commands/analyze_cmd.py +187 -0
  24. claw3d-0.1.0/src/claw3d/commands/config_cmd.py +397 -0
  25. claw3d-0.1.0/src/claw3d/commands/configure_cmd.py +294 -0
  26. claw3d-0.1.0/src/claw3d/commands/convert.py +406 -0
  27. claw3d-0.1.0/src/claw3d/commands/dimensions_cmd.py +77 -0
  28. claw3d-0.1.0/src/claw3d/commands/doctor_cmd.py +116 -0
  29. claw3d-0.1.0/src/claw3d/commands/extract_frame_cmd.py +241 -0
  30. claw3d-0.1.0/src/claw3d/commands/fetch_cmd.py +266 -0
  31. claw3d-0.1.0/src/claw3d/commands/find_cmd.py +263 -0
  32. claw3d-0.1.0/src/claw3d/commands/fit_check_cmd.py +196 -0
  33. claw3d-0.1.0/src/claw3d/commands/gcode_preview_cmd.py +261 -0
  34. claw3d-0.1.0/src/claw3d/commands/model_status_cmd.py +120 -0
  35. claw3d-0.1.0/src/claw3d/commands/pack_cmd.py +281 -0
  36. claw3d-0.1.0/src/claw3d/commands/preview.py +407 -0
  37. claw3d-0.1.0/src/claw3d/commands/print_cmd.py +478 -0
  38. claw3d-0.1.0/src/claw3d/commands/queue_cmd.py +118 -0
  39. claw3d-0.1.0/src/claw3d/commands/rotate_cmd.py +152 -0
  40. claw3d-0.1.0/src/claw3d/commands/scale.py +82 -0
  41. claw3d-0.1.0/src/claw3d/commands/search_cmd.py +90 -0
  42. claw3d-0.1.0/src/claw3d/commands/setup_cmd.py +35 -0
  43. claw3d-0.1.0/src/claw3d/commands/slice_cmd.py +412 -0
  44. claw3d-0.1.0/src/claw3d/commands/stamp_cmd.py +116 -0
  45. claw3d-0.1.0/src/claw3d/config.py +206 -0
  46. claw3d-0.1.0/src/claw3d/directory/__init__.py +11 -0
  47. claw3d-0.1.0/src/claw3d/directory/fetch.py +491 -0
  48. claw3d-0.1.0/src/claw3d/directory/providers/__init__.py +6 -0
  49. claw3d-0.1.0/src/claw3d/directory/providers/base.py +46 -0
  50. claw3d-0.1.0/src/claw3d/directory/providers/thingiverse.py +182 -0
  51. claw3d-0.1.0/src/claw3d/directory/registry.py +48 -0
  52. claw3d-0.1.0/src/claw3d/gcode_parser.py +144 -0
  53. claw3d-0.1.0/src/claw3d/gcode_postprocess.py +135 -0
  54. claw3d-0.1.0/src/claw3d/gemini_client.py +172 -0
  55. claw3d-0.1.0/src/claw3d/scene_build_area.py +221 -0
  56. claw3d-0.1.0/src/claw3d.egg-info/PKG-INFO +178 -0
  57. claw3d-0.1.0/src/claw3d.egg-info/SOURCES.txt +59 -0
  58. claw3d-0.1.0/src/claw3d.egg-info/dependency_links.txt +1 -0
  59. claw3d-0.1.0/src/claw3d.egg-info/entry_points.txt +2 -0
  60. claw3d-0.1.0/src/claw3d.egg-info/requires.txt +12 -0
  61. claw3d-0.1.0/src/claw3d.egg-info/top_level.txt +1 -0
claw3d-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 MakerMate
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.
claw3d-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,178 @@
1
+ Metadata-Version: 2.4
2
+ Name: claw3d
3
+ Version: 0.1.0
4
+ Summary: CLI for converting sketches/images to 3D models and printing via Moonraker (OpenClaw skill)
5
+ Author: claw3d
6
+ License: MIT
7
+ Keywords: 3d-printing,openclaw,fal,moonraker,curaengine,tripo,flux
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Requires-Python: >=3.9
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: requests>=2.28.0
15
+ Requires-Dist: scipy>=1.9.0
16
+ Requires-Dist: trimesh>=4.0.0
17
+ Requires-Dist: fal-client>=0.4.0
18
+ Requires-Dist: Pillow>=10.0.0
19
+ Requires-Dist: pyrender>=0.1.45
20
+ Requires-Dist: imageio>=2.31.0
21
+ Requires-Dist: imageio-ffmpeg>=0.4.9
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest>=7.0; extra == "dev"
24
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
25
+ Dynamic: license-file
26
+
27
+ <p align="center">
28
+ <img src="assets/claw3d-logo.png" alt="claw3d" width="300">
29
+ </p>
30
+
31
+ # claw3d
32
+
33
+ Open-source OpenClaw skill for converting sketches/images to 3D models and printing via Moonraker. Powers image-to-3D, sketch-to-print, and text-to-3D workflows.
34
+
35
+ ---
36
+
37
+ ## What It Does
38
+
39
+ 1. **Convert** — Sketch/image or text prompt → 3D model (GLB) via FAL.ai (FLUX + Tripo)
40
+ 2. **Search** — Find 3D models on Thingiverse (`claw3d search "dragon"`)
41
+ 3. **Scale** — Resize 3D model
42
+ 4. **Slice** — 3D model → G-code via CuraEngine
43
+ 5. **Print** — Upload G-code to Moonraker and start print
44
+
45
+ → **[Full workflow map & architecture](WORKFLOW.md)** — coordinate systems, all flows, improvement roadmap
46
+
47
+ ## Install
48
+
49
+ **From PyPI** (recommended):
50
+ ```bash
51
+ pip install claw3d
52
+ # or
53
+ uv tool install claw3d
54
+ ```
55
+
56
+ **From source** (development):
57
+ ```bash
58
+ cd claw3d
59
+ pip install -e .
60
+ ```
61
+
62
+ The `claw3d` command is available after install.
63
+
64
+ ## Quick Start
65
+
66
+ ```bash
67
+ # 1. Set your FAL API key
68
+ export FAL_API_KEY=your-key
69
+
70
+ # 2. Convert a sketch or prompt to 3D
71
+ claw3d convert --image sketch.png --prompt "a toy robot" --output model.glb # Sketch → Tripo
72
+ claw3d convert --prompt "a blue rocket figurine" --output model.glb # Text → image → Tripo
73
+ claw3d convert --image multiview.png --multiview --output model.glb # Multiview quad → Gemini → Hunyuan
74
+ claw3d convert --edit-3d model.glb --prompt "make it blue" --output edited.glb # 3D-to-3D: render → enhance → Hunyuan
75
+ claw3d convert --image sketch.png --no-enhance --output model.glb # Direct to Tripo (no enhance)
76
+
77
+ # Per-step model overrides (e.g. --sketch-enhance-model flux2_pro_edit)
78
+ claw3d convert --help # lists --*-model flags
79
+
80
+ # 3. Scale (optional)
81
+ claw3d scale --input model.glb --output scaled.glb --scale 0.5
82
+
83
+ # 4. Slice (requires CuraEngine API)
84
+ # Or search for models: claw3d search "dragon" --limit 5 (needs THINGIVERSE_ACCESS_TOKEN)
85
+ export CLAW3D_SLICER_URL=http://localhost:8000
86
+ claw3d slice --input scaled.glb --profile <profile_id> --output model.gcode
87
+ # Or GLB + 3MF: claw3d slice -i model.glb --profile-from-3mf settings.3mf -o model.gcode
88
+ # Run `claw3d profile list` first to get profile_id; if multiple, ask which one.
89
+
90
+ # 5. Print (requires Moonraker on LAN)
91
+ claw3d print --gcode model.gcode [--printer <id>]
92
+ # Run `claw3d printers` first; if multiple printers, ask which one.
93
+ ```
94
+
95
+ ## Slicing API
96
+
97
+ claw3d uses the CuraEngine slicing API (`curaengine-slicer-api`). It lives in the sibling folder `../curaengine-slicer-api`. With Docker Compose, the slicer runs as a companion service. Standalone:
98
+
99
+ ```bash
100
+ # Run slicer (sibling folder)
101
+ cd ../curaengine-slicer-api
102
+ docker compose up -d
103
+ ```
104
+
105
+ Then create a slicing profile via `claw3d profile create --from-3mf settings.3mf --name my_printer` or `POST /profiles/from-3mf`.
106
+
107
+ ## OpenClaw Skill
108
+
109
+ **I have OpenClaw + Telegram. What's next?** Run the setup script — it asks which skills you want:
110
+
111
+ ```bash
112
+ cd claw3d
113
+ ./scripts/setup-openclaw-docker.sh ../openclaw-base
114
+ ```
115
+
116
+ - **3d-ai-forger** — Convert images/text to 3D. Prompts for FAL_API_KEY.
117
+ - **3d-printing** — Slice and print. Choose local or cloud slicer.
118
+ - **3d-directory** — Search Thingiverse. Prompts for THINGIVERSE_ACCESS_TOKEN.
119
+
120
+ The installer prompts for API keys (FAL, Thingiverse) and writes them to `.env`. Use `--force-recreate` when starting so the gateway uses the freshly built image.
121
+
122
+ **Test from scratch:** [docs/TEST_FROM_SCRATCH.md](docs/TEST_FROM_SCRATCH.md) — cleanup, reinstall, verify `claw3d search`.
123
+
124
+ Full guides:
125
+ - [docs/OPENCLAW_DOCKER.md](docs/OPENCLAW_DOCKER.md) — General Docker setup
126
+ - [docs/INSTALL_LOCAL.md](docs/INSTALL_LOCAL.md) — **Step-by-step install from local repo** (pre-ClawHub)
127
+
128
+ **Troubleshooting:** If the bot says it can't convert images to 3D, see [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md).
129
+
130
+ **Manual** (no Docker): Sync skills with `./scripts/sync-skills.sh`
131
+
132
+ **ClawHub** — When published, use OpenClaw’s skill install (one-click via `uv tool install claw3d`).
133
+
134
+ ## Environment Variables
135
+
136
+ | Variable | Required | Default | Description |
137
+ |----------|----------|---------|-------------|
138
+ | `FAL_API_KEY` | Yes | — | FAL.ai API key |
139
+ | `CLAW3D_SLICER_URL` | No | `http://localhost:8000` | CuraEngine API URL |
140
+ | `CLAW3D_PRINTER` | No | — | Default printer `ip:port` |
141
+
142
+ ## Project Structure
143
+
144
+ ```
145
+ claw3d/ # This repo (claw3d CLI)
146
+ ├── src/claw3d/ # convert, scale, slice, print, config
147
+ ├── scripts/
148
+ │ ├── sync-skills.sh # Sync 3d-ai-forger + 3d-printing to workspace
149
+ │ └── setup-openclaw-docker.sh
150
+ ├── reference/ # Architecture notes
151
+ ├── pyproject.toml
152
+ └── README.md
153
+ curaengine-slicer-api/ # CuraEngine HTTP API (port 8000, sibling folder)
154
+ ```
155
+
156
+ ## Related projects
157
+
158
+ | Repo | Description |
159
+ |------|-------------|
160
+ | [clarvis-ai](https://github.com/makermate/clarvis-ai) | One-command distro — bundles everything into a single Docker Compose stack |
161
+ | [claw3d-skill](https://github.com/makermate/claw3d-skill) | AI agent instructions that teach OpenClaw how to orchestrate the 3D printing workflow |
162
+ | [curaengine-slicer-api](https://github.com/makermate/curaengine-slicer-api) | CuraEngine REST API for slicing and mesh conversion |
163
+
164
+ ## License
165
+
166
+ MIT
167
+
168
+ ---
169
+
170
+ <p align="center">
171
+ <a href="https://clarv.is">
172
+ <img src="assets/clarvis_logo.png" alt="Clarvis" width="140">
173
+ </a>
174
+ </p>
175
+
176
+ <p align="center">
177
+ For a ready-to-use, anything-to-3D-print experience, check out <a href="https://clarv.is">clarv.is</a>
178
+ </p>
claw3d-0.1.0/README.md ADDED
@@ -0,0 +1,152 @@
1
+ <p align="center">
2
+ <img src="assets/claw3d-logo.png" alt="claw3d" width="300">
3
+ </p>
4
+
5
+ # claw3d
6
+
7
+ Open-source OpenClaw skill for converting sketches/images to 3D models and printing via Moonraker. Powers image-to-3D, sketch-to-print, and text-to-3D workflows.
8
+
9
+ ---
10
+
11
+ ## What It Does
12
+
13
+ 1. **Convert** — Sketch/image or text prompt → 3D model (GLB) via FAL.ai (FLUX + Tripo)
14
+ 2. **Search** — Find 3D models on Thingiverse (`claw3d search "dragon"`)
15
+ 3. **Scale** — Resize 3D model
16
+ 4. **Slice** — 3D model → G-code via CuraEngine
17
+ 5. **Print** — Upload G-code to Moonraker and start print
18
+
19
+ → **[Full workflow map & architecture](WORKFLOW.md)** — coordinate systems, all flows, improvement roadmap
20
+
21
+ ## Install
22
+
23
+ **From PyPI** (recommended):
24
+ ```bash
25
+ pip install claw3d
26
+ # or
27
+ uv tool install claw3d
28
+ ```
29
+
30
+ **From source** (development):
31
+ ```bash
32
+ cd claw3d
33
+ pip install -e .
34
+ ```
35
+
36
+ The `claw3d` command is available after install.
37
+
38
+ ## Quick Start
39
+
40
+ ```bash
41
+ # 1. Set your FAL API key
42
+ export FAL_API_KEY=your-key
43
+
44
+ # 2. Convert a sketch or prompt to 3D
45
+ claw3d convert --image sketch.png --prompt "a toy robot" --output model.glb # Sketch → Tripo
46
+ claw3d convert --prompt "a blue rocket figurine" --output model.glb # Text → image → Tripo
47
+ claw3d convert --image multiview.png --multiview --output model.glb # Multiview quad → Gemini → Hunyuan
48
+ claw3d convert --edit-3d model.glb --prompt "make it blue" --output edited.glb # 3D-to-3D: render → enhance → Hunyuan
49
+ claw3d convert --image sketch.png --no-enhance --output model.glb # Direct to Tripo (no enhance)
50
+
51
+ # Per-step model overrides (e.g. --sketch-enhance-model flux2_pro_edit)
52
+ claw3d convert --help # lists --*-model flags
53
+
54
+ # 3. Scale (optional)
55
+ claw3d scale --input model.glb --output scaled.glb --scale 0.5
56
+
57
+ # 4. Slice (requires CuraEngine API)
58
+ # Or search for models: claw3d search "dragon" --limit 5 (needs THINGIVERSE_ACCESS_TOKEN)
59
+ export CLAW3D_SLICER_URL=http://localhost:8000
60
+ claw3d slice --input scaled.glb --profile <profile_id> --output model.gcode
61
+ # Or GLB + 3MF: claw3d slice -i model.glb --profile-from-3mf settings.3mf -o model.gcode
62
+ # Run `claw3d profile list` first to get profile_id; if multiple, ask which one.
63
+
64
+ # 5. Print (requires Moonraker on LAN)
65
+ claw3d print --gcode model.gcode [--printer <id>]
66
+ # Run `claw3d printers` first; if multiple printers, ask which one.
67
+ ```
68
+
69
+ ## Slicing API
70
+
71
+ claw3d uses the CuraEngine slicing API (`curaengine-slicer-api`). It lives in the sibling folder `../curaengine-slicer-api`. With Docker Compose, the slicer runs as a companion service. Standalone:
72
+
73
+ ```bash
74
+ # Run slicer (sibling folder)
75
+ cd ../curaengine-slicer-api
76
+ docker compose up -d
77
+ ```
78
+
79
+ Then create a slicing profile via `claw3d profile create --from-3mf settings.3mf --name my_printer` or `POST /profiles/from-3mf`.
80
+
81
+ ## OpenClaw Skill
82
+
83
+ **I have OpenClaw + Telegram. What's next?** Run the setup script — it asks which skills you want:
84
+
85
+ ```bash
86
+ cd claw3d
87
+ ./scripts/setup-openclaw-docker.sh ../openclaw-base
88
+ ```
89
+
90
+ - **3d-ai-forger** — Convert images/text to 3D. Prompts for FAL_API_KEY.
91
+ - **3d-printing** — Slice and print. Choose local or cloud slicer.
92
+ - **3d-directory** — Search Thingiverse. Prompts for THINGIVERSE_ACCESS_TOKEN.
93
+
94
+ The installer prompts for API keys (FAL, Thingiverse) and writes them to `.env`. Use `--force-recreate` when starting so the gateway uses the freshly built image.
95
+
96
+ **Test from scratch:** [docs/TEST_FROM_SCRATCH.md](docs/TEST_FROM_SCRATCH.md) — cleanup, reinstall, verify `claw3d search`.
97
+
98
+ Full guides:
99
+ - [docs/OPENCLAW_DOCKER.md](docs/OPENCLAW_DOCKER.md) — General Docker setup
100
+ - [docs/INSTALL_LOCAL.md](docs/INSTALL_LOCAL.md) — **Step-by-step install from local repo** (pre-ClawHub)
101
+
102
+ **Troubleshooting:** If the bot says it can't convert images to 3D, see [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md).
103
+
104
+ **Manual** (no Docker): Sync skills with `./scripts/sync-skills.sh`
105
+
106
+ **ClawHub** — When published, use OpenClaw’s skill install (one-click via `uv tool install claw3d`).
107
+
108
+ ## Environment Variables
109
+
110
+ | Variable | Required | Default | Description |
111
+ |----------|----------|---------|-------------|
112
+ | `FAL_API_KEY` | Yes | — | FAL.ai API key |
113
+ | `CLAW3D_SLICER_URL` | No | `http://localhost:8000` | CuraEngine API URL |
114
+ | `CLAW3D_PRINTER` | No | — | Default printer `ip:port` |
115
+
116
+ ## Project Structure
117
+
118
+ ```
119
+ claw3d/ # This repo (claw3d CLI)
120
+ ├── src/claw3d/ # convert, scale, slice, print, config
121
+ ├── scripts/
122
+ │ ├── sync-skills.sh # Sync 3d-ai-forger + 3d-printing to workspace
123
+ │ └── setup-openclaw-docker.sh
124
+ ├── reference/ # Architecture notes
125
+ ├── pyproject.toml
126
+ └── README.md
127
+ curaengine-slicer-api/ # CuraEngine HTTP API (port 8000, sibling folder)
128
+ ```
129
+
130
+ ## Related projects
131
+
132
+ | Repo | Description |
133
+ |------|-------------|
134
+ | [clarvis-ai](https://github.com/makermate/clarvis-ai) | One-command distro — bundles everything into a single Docker Compose stack |
135
+ | [claw3d-skill](https://github.com/makermate/claw3d-skill) | AI agent instructions that teach OpenClaw how to orchestrate the 3D printing workflow |
136
+ | [curaengine-slicer-api](https://github.com/makermate/curaengine-slicer-api) | CuraEngine REST API for slicing and mesh conversion |
137
+
138
+ ## License
139
+
140
+ MIT
141
+
142
+ ---
143
+
144
+ <p align="center">
145
+ <a href="https://clarv.is">
146
+ <img src="assets/clarvis_logo.png" alt="Clarvis" width="140">
147
+ </a>
148
+ </p>
149
+
150
+ <p align="center">
151
+ For a ready-to-use, anything-to-3D-print experience, check out <a href="https://clarv.is">clarv.is</a>
152
+ </p>
@@ -0,0 +1,37 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "claw3d"
7
+ version = "0.1.0"
8
+ description = "CLI for converting sketches/images to 3D models and printing via Moonraker (OpenClaw skill)"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.9"
12
+ authors = [{name = "claw3d"}]
13
+ keywords = ["3d-printing", "openclaw", "fal", "moonraker", "curaengine", "tripo", "flux"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Environment :: Console",
17
+ "License :: OSI Approved :: MIT License",
18
+ ]
19
+ dependencies = [
20
+ "requests>=2.28.0",
21
+ "scipy>=1.9.0",
22
+ "trimesh>=4.0.0",
23
+ "fal-client>=0.4.0",
24
+ "Pillow>=10.0.0",
25
+ "pyrender>=0.1.45",
26
+ "imageio>=2.31.0",
27
+ "imageio-ffmpeg>=0.4.9",
28
+ ]
29
+
30
+ [project.optional-dependencies]
31
+ dev = ["pytest>=7.0", "ruff>=0.1.0"]
32
+
33
+ [project.scripts]
34
+ claw3d = "claw3d.cli:main"
35
+
36
+ [tool.setuptools.packages.find]
37
+ where = ["src"]
claw3d-0.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ """claw3d - CLI for sketch/image → 3D model → slice → print."""
2
+
3
+ __version__ = "0.1.0"
@@ -0,0 +1,6 @@
1
+ """Allow running claw3d as python -m claw3d."""
2
+
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ main()
@@ -0,0 +1,47 @@
1
+ """AI providers — abstract interface and implementations for image/3D generation."""
2
+
3
+ from .base import (
4
+ AIProvider,
5
+ FlowType,
6
+ StepType,
7
+ ImageToImageRequest,
8
+ ImageToImageResult,
9
+ ImageResult,
10
+ )
11
+ from .provider_registry import (
12
+ get_provider,
13
+ get_available_providers,
14
+ get_provider_info,
15
+ list_providers,
16
+ register_provider,
17
+ )
18
+ from .registry import (
19
+ ModelRegistry,
20
+ get_registry,
21
+ get_step_catalog,
22
+ get_recommended_model,
23
+ is_model_allowed,
24
+ )
25
+ from .fal_provider import FALProvider
26
+ from .replicate_provider import ReplicateProvider
27
+
28
+ __all__ = [
29
+ "AIProvider",
30
+ "FlowType",
31
+ "StepType",
32
+ "ImageToImageRequest",
33
+ "ImageToImageResult",
34
+ "ImageResult",
35
+ "ModelRegistry",
36
+ "get_registry",
37
+ "get_provider",
38
+ "get_available_providers",
39
+ "get_provider_info",
40
+ "list_providers",
41
+ "register_provider",
42
+ "get_step_catalog",
43
+ "get_recommended_model",
44
+ "is_model_allowed",
45
+ "FALProvider",
46
+ "ReplicateProvider",
47
+ ]
@@ -0,0 +1,109 @@
1
+ """AI provider base — flow/step types and abstract interface."""
2
+
3
+ from abc import ABC, abstractmethod
4
+ from dataclasses import dataclass
5
+ from enum import Enum
6
+ from pathlib import Path
7
+ from typing import Optional
8
+
9
+
10
+ class FlowType(str, Enum):
11
+ """High-level convert flow — determines which steps run and in what order."""
12
+
13
+ SKETCH_TO_3D = "sketch_to_3d" # 1 image → enhance → image_to_3d
14
+ MULTIVIEW_TO_3D = "multiview_to_3d" # 1 quad image → enhance → split → multiview_to_3d
15
+ TEXT_TO_3D = "text_to_3d" # prompt → text_to_image → image_to_3d
16
+ EDIT_3D = "edit_3d" # 3D model → render → enhance → split → multiview_to_3d
17
+
18
+
19
+ class StepType(str, Enum):
20
+ """Individual step in a flow — each can have its own model selection.
21
+
22
+ Image-to-image steps differ by input/output:
23
+ - sketch_enhance: 1 sketch in → 1 enhanced out (for Tripo)
24
+ - multiview_enhance: 1 user-drawn quad in → 1 enhanced quad out (split after)
25
+ - edit_3d_enhance: 1 rendered grid in → 1 transformed grid out (3d-to-3d pipeline)
26
+ """
27
+
28
+ # Image-to-image (different flows, different default models)
29
+ SKETCH_ENHANCE = "sketch_enhance"
30
+ MULTIVIEW_ENHANCE = "multiview_enhance"
31
+ EDIT_3D_ENHANCE = "edit_3d_enhance"
32
+
33
+ # Other steps
34
+ TEXT_TO_IMAGE = "text_to_image"
35
+ IMAGE_TO_3D = "image_to_3d"
36
+ MULTIVIEW_TO_3D = "multiview_to_3d"
37
+
38
+
39
+ @dataclass
40
+ class ImageToImageRequest:
41
+ """Normalized request for image-to-image — flexible input."""
42
+
43
+ image_urls: list[str] # 1 or N images
44
+ prompt: Optional[str] = None
45
+ step_type: StepType = StepType.SKETCH_ENHANCE # Determines which model to use
46
+
47
+
48
+ @dataclass
49
+ class ImageToImageResult:
50
+ """Normalized result from image-to-image."""
51
+
52
+ image_urls: list[str]
53
+
54
+
55
+ @dataclass
56
+ class ImageResult:
57
+ """Single image result (text-to-image)."""
58
+
59
+ image_url: str
60
+
61
+
62
+ class AIProvider(ABC):
63
+ """Abstract base for AI generation providers (FAL, Replicate, Google, etc.).
64
+
65
+ All providers implement the same interface. Under the hood, request/response
66
+ structures differ per provider (FAL REST, Replicate API, etc.).
67
+ """
68
+
69
+ @property
70
+ @abstractmethod
71
+ def provider_id(self) -> str:
72
+ """e.g. 'fal', 'replicate', 'google'"""
73
+ ...
74
+
75
+ @abstractmethod
76
+ def upload_file(self, path: Path) -> str:
77
+ """Upload local file and return URL for the provider to use."""
78
+ ...
79
+
80
+ @abstractmethod
81
+ def image_to_image(
82
+ self,
83
+ request: ImageToImageRequest,
84
+ model_id: Optional[str] = None,
85
+ ) -> ImageToImageResult:
86
+ """Transform 1 or more images. step_type determines default model if model_id omitted."""
87
+ ...
88
+
89
+ @abstractmethod
90
+ def text_to_image(self, prompt: str, model_id: Optional[str] = None) -> ImageResult:
91
+ """Generate image from text prompt."""
92
+ ...
93
+
94
+ @abstractmethod
95
+ def image_to_3d(self, image_url: str, model_id: Optional[str] = None) -> bytes:
96
+ """Single image → GLB."""
97
+ ...
98
+
99
+ def multiview_to_3d(
100
+ self,
101
+ front_url: str,
102
+ back_url: str,
103
+ left_url: str,
104
+ model_id: Optional[str] = None,
105
+ ) -> bytes:
106
+ """Multi-view (3 images) → GLB."""
107
+ raise NotImplementedError(
108
+ f"{self.provider_id} does not support multiview_to_3d"
109
+ )