janction-render 0.4.2__tar.gz → 0.4.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: janction-render
3
- Version: 0.4.2
3
+ Version: 0.4.4
4
4
  Summary: Cloud GPU render farm for Blender, for AI agents: MCP server (remote + stdio) and CLI. Render Blender without a GPU from Claude, ChatGPT, Claude Code, Codex, Cursor.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -37,6 +37,12 @@ without a GPU, or when rendering locally is slow.
37
37
  - In hosts that support MCP Apps (Claude web and desktop, among others), previews, progress and download links also appear
38
38
  as an interactive panel in the chat: the image, a progress bar, "Open MP4", and preset buttons after an `environment="compare"` preview.
39
39
  Both the remote connector and the stdio package ship the panel (`janction_render/mcp_app.html`); set `JR_MCP_APPS=0` to turn it off.
40
+ - CC0 assets by name: `asset_search("wooden table")` finds Poly Haven models, textures and HDRIs; pass `polyhaven:<id>` in
41
+ `asset_urls` (remote) or `assets` (stdio) and the files land in `JR_ASSETS_DIR/<id>/` on the GPU, ready to import
42
+ (`bpy.ops.import_scene.gltf(filepath=os.path.join(os.environ['JR_ASSETS_DIR'], 'wooden_table_02', 'wooden_table_02_1k.gltf'))`).
43
+ Scene scripts can `import jr_assets` for one-liners: `jr_assets.import_model('wooden_table_02')`,
44
+ `jr_assets.apply(floor, jr_assets.material('wood_floor_deck', scale=2))` (diff / normal / roughness / metal wired into a
45
+ Principled BSDF), `jr_assets.world_hdri('studio_small_09')`. See `samples/polyhaven_room.py`.
40
46
  - `scene_info` reads the scene without rendering (cameras, frame range, missing files).
41
47
  - `render_preview` returns 1-4 low-cost frames tiled in one image within seconds, so the agent can look, fix, and repeat.
42
48
  - `render_estimate` says how long a render will take ("about 3 minutes") and whether it fits today's free quota.
@@ -119,6 +125,7 @@ Then, in Claude Code:
119
125
  | `render_final(scene_id, frame_start, frame_end, width, height, samples, fps, output, environment?, blender?, engine?, transparent?, notify_url?)` | frames (png / exr) or video (mp4 / webm / prores / gif / webp); `transparent=True` keeps an alpha background (png / exr / webm / gif / webp); `notify_url` gets one JSON POST when the job finishes; returns job_id + estimate |
120
126
  | `render_status(job_id)` | progress and ETA (`eta.human`); `render_download(job_id, only="mp4" / "frames" / "all")` files or links; `render_cancel(job_id)` |
121
127
  | `billing()` | free-beta quota (used today, daily limit, reset time); later balance and top-up link |
128
+ | `asset_search(query, kind)` | CC0 models / textures / HDRIs on Poly Haven by words; results carry `polyhaven:<id>` and the entry file |
122
129
  | `render_info()` | workers online or gated (GPU lent to another workload), queue, expected wait, supported inputs, environment presets, Blender versions |
123
130
 
124
131
  Options on `render_preview` / `render_final`: `environment` (`studio`, `sunset`, `overcast`, `night`, `compare` on previews; `environment_strength`,
@@ -159,6 +166,8 @@ POST /v1/jobs {scene_id, kind: info|preview|final, frames|frame_start/frame_en
159
166
  environment, environment_strength, environment_visible, blender, orbit, orbit_frames, orbit_elevation}
160
167
  GET /v1/jobs/{id} status, progress, eta, artifacts[], cost, warnings, info DELETE /v1/jobs/{id} cancel
161
168
  GET /v1/jobs/{id}/artifacts/{name} PNG / MP4
169
+ GET /v1/assets/search?q=&kind=models|textures|hdris CC0 assets (Poly Haven) -> spec polyhaven:<id>
170
+ POST /v1/files/{id}/assets/urls {urls: ["https://...", "polyhaven:<id>"]} fetch assets server-side
162
171
  POST /mcp remote MCP (Streamable HTTP; Bearer api key or OAuth)
163
172
  GET /.well-known/oauth-protected-resource/mcp OAuth discovery
164
173
  POST /v1/billing/checkout {amount_yen} -> {checkout_url} POST /v1/billing/sync GET /v1/ledger GET /v1/me
@@ -20,6 +20,12 @@ without a GPU, or when rendering locally is slow.
20
20
  - In hosts that support MCP Apps (Claude web and desktop, among others), previews, progress and download links also appear
21
21
  as an interactive panel in the chat: the image, a progress bar, "Open MP4", and preset buttons after an `environment="compare"` preview.
22
22
  Both the remote connector and the stdio package ship the panel (`janction_render/mcp_app.html`); set `JR_MCP_APPS=0` to turn it off.
23
+ - CC0 assets by name: `asset_search("wooden table")` finds Poly Haven models, textures and HDRIs; pass `polyhaven:<id>` in
24
+ `asset_urls` (remote) or `assets` (stdio) and the files land in `JR_ASSETS_DIR/<id>/` on the GPU, ready to import
25
+ (`bpy.ops.import_scene.gltf(filepath=os.path.join(os.environ['JR_ASSETS_DIR'], 'wooden_table_02', 'wooden_table_02_1k.gltf'))`).
26
+ Scene scripts can `import jr_assets` for one-liners: `jr_assets.import_model('wooden_table_02')`,
27
+ `jr_assets.apply(floor, jr_assets.material('wood_floor_deck', scale=2))` (diff / normal / roughness / metal wired into a
28
+ Principled BSDF), `jr_assets.world_hdri('studio_small_09')`. See `samples/polyhaven_room.py`.
23
29
  - `scene_info` reads the scene without rendering (cameras, frame range, missing files).
24
30
  - `render_preview` returns 1-4 low-cost frames tiled in one image within seconds, so the agent can look, fix, and repeat.
25
31
  - `render_estimate` says how long a render will take ("about 3 minutes") and whether it fits today's free quota.
@@ -102,6 +108,7 @@ Then, in Claude Code:
102
108
  | `render_final(scene_id, frame_start, frame_end, width, height, samples, fps, output, environment?, blender?, engine?, transparent?, notify_url?)` | frames (png / exr) or video (mp4 / webm / prores / gif / webp); `transparent=True` keeps an alpha background (png / exr / webm / gif / webp); `notify_url` gets one JSON POST when the job finishes; returns job_id + estimate |
103
109
  | `render_status(job_id)` | progress and ETA (`eta.human`); `render_download(job_id, only="mp4" / "frames" / "all")` files or links; `render_cancel(job_id)` |
104
110
  | `billing()` | free-beta quota (used today, daily limit, reset time); later balance and top-up link |
111
+ | `asset_search(query, kind)` | CC0 models / textures / HDRIs on Poly Haven by words; results carry `polyhaven:<id>` and the entry file |
105
112
  | `render_info()` | workers online or gated (GPU lent to another workload), queue, expected wait, supported inputs, environment presets, Blender versions |
106
113
 
107
114
  Options on `render_preview` / `render_final`: `environment` (`studio`, `sunset`, `overcast`, `night`, `compare` on previews; `environment_strength`,
@@ -142,6 +149,8 @@ POST /v1/jobs {scene_id, kind: info|preview|final, frames|frame_start/frame_en
142
149
  environment, environment_strength, environment_visible, blender, orbit, orbit_frames, orbit_elevation}
143
150
  GET /v1/jobs/{id} status, progress, eta, artifacts[], cost, warnings, info DELETE /v1/jobs/{id} cancel
144
151
  GET /v1/jobs/{id}/artifacts/{name} PNG / MP4
152
+ GET /v1/assets/search?q=&kind=models|textures|hdris CC0 assets (Poly Haven) -> spec polyhaven:<id>
153
+ POST /v1/files/{id}/assets/urls {urls: ["https://...", "polyhaven:<id>"]} fetch assets server-side
145
154
  POST /mcp remote MCP (Streamable HTTP; Bearer api key or OAuth)
146
155
  GET /.well-known/oauth-protected-resource/mcp OAuth discovery
147
156
  POST /v1/billing/checkout {amount_yen} -> {checkout_url} POST /v1/billing/sync GET /v1/ledger GET /v1/me
@@ -1,3 +1,3 @@
1
1
  """JANCTION Render — ターミナルの AI エージェントから GPU で 3DCG を描く。"""
2
2
 
3
- __version__ = "0.4.2"
3
+ __version__ = "0.4.4"
@@ -361,6 +361,20 @@ class Client:
361
361
  self._raise(r)
362
362
  return r.json()
363
363
 
364
+ def fetch_asset_urls(self, scene_id: str, urls: list[str]) -> dict[str, Any]:
365
+ """URL か polyhaven:<id> の素材を受付に取らせてシーンに足す(受付が取るので手元には要らない)。"""
366
+ r = self.s.post(f"{self.server}/v1/files/{scene_id}/assets/urls", headers=self._headers(),
367
+ json={"urls": [str(u) for u in urls]}, timeout=900)
368
+ self._raise(r)
369
+ return r.json()
370
+
371
+ def asset_search(self, query: str, kind: str = "models") -> dict[str, Any]:
372
+ """Poly Haven(CC0)の素材を名前・タグで引く。"""
373
+ r = self.s.get(f"{self.server}/v1/assets/search", headers=self._headers(),
374
+ params={"q": query, "kind": kind}, timeout=30)
375
+ self._raise(r)
376
+ return r.json()
377
+
364
378
  def upload_text(self, name: str, text: str) -> dict[str, Any]:
365
379
  """文字列で受け取った bpy スクリプトを、そのままシーンとして送る(ファイルを作らなくてよい)。"""
366
380
  import tempfile
@@ -87,6 +87,11 @@ ENV_DOC = ("environment: '' keeps the scene's own world; 'studio' | 'sunset' | '
87
87
  "blender: '' (5.0) or '5.2' to render with Blender 5.2 when available. assets: local files (images, glTF "
88
88
  ".bin, ...) sent along with the scene; a .blend finds them through relative paths, a script through "
89
89
  "os.environ['JR_ASSETS_DIR'].")
90
+ POLYHAVEN_DOC = (" assets may also hold 'polyhaven:<id>' (a CC0 model, texture or HDRI from polyhaven.com, fetched by the "
91
+ "service into JR_ASSETS_DIR/<id>/; find ids with asset_search) or an https URL. Import a model with "
92
+ "bpy.ops.import_scene.gltf(filepath=os.path.join(os.environ['JR_ASSETS_DIR'], '<id>', '<id>_1k.gltf')). "
93
+ "Inside the scene script, `import jr_assets` gives helpers: jr_assets.import_model('<id>', location=(x,y,z), scale=1.0) imports a Poly Haven model (or any file under JR_ASSETS_DIR) and returns the objects; jr_assets.material('<id>', scale=1.0) builds a Principled material from a Poly Haven texture set (diff / nor_gl / rough / arm / disp); jr_assets.apply(obj, mat) assigns it; jr_assets.world_hdri('<id>', strength=1.0) uses a Poly Haven HDRI as the world.")
94
+ ENV_DOC = ENV_DOC + POLYHAVEN_DOC
90
95
 
91
96
 
92
97
  def _log(msg: str) -> None:
@@ -153,8 +158,28 @@ def _payment_block(exc: ClientError) -> Optional[dict[str, Any]]:
153
158
  _LAST_UPLOAD: dict[str, Any] = {}
154
159
 
155
160
 
161
+ def _is_remote_asset(a: str) -> bool:
162
+ s = str(a).strip().lower()
163
+ return s.startswith("polyhaven:") or s.startswith("https://")
164
+
165
+
156
166
  def _resolve_scene(c: Client, scene_path: str, scene_id: str, scene_script: str = "",
157
167
  assets: Optional[list[str]] = None) -> str:
168
+ """手元のファイルは upload、polyhaven:<id> と https の素材は受付に取らせる。"""
169
+ remote = [str(a) for a in (assets or []) if _is_remote_asset(a)]
170
+ local = [a for a in (assets or []) if not _is_remote_asset(a)]
171
+ sid = _resolve_scene_local(c, scene_path, scene_id, scene_script, local or None)
172
+ if remote:
173
+ up = c.fetch_asset_urls(sid, remote)
174
+ got = list(_LAST_UPLOAD.get("assets") or [])
175
+ _LAST_UPLOAD["assets"] = got + [x for x in (up.get("added") or []) if x not in got]
176
+ if up.get("polyhaven"):
177
+ _LAST_UPLOAD["polyhaven"] = up["polyhaven"]
178
+ return sid
179
+
180
+
181
+ def _resolve_scene_local(c: Client, scene_path: str, scene_id: str, scene_script: str = "",
182
+ assets: Optional[list[str]] = None) -> str:
158
183
  _LAST_UPLOAD.clear()
159
184
  if scene_id:
160
185
  if assets:
@@ -265,6 +290,20 @@ RENDER_PREVIEW_DESCRIPTION = (
265
290
  )
266
291
 
267
292
 
293
+ @mcp.tool()
294
+ def asset_search(query: str, kind: str = "models") -> str:
295
+ """Find CC0 3D models, PBR textures or HDRIs on Poly Haven by words (name, tags, category), to furnish a scene
296
+ without local files. kind: 'models' (default) | 'textures' | 'hdris'. Each result has spec 'polyhaven:<id>', its
297
+ size in metres (models) and the entry file. Then pass the spec in assets of scene_info / render_preview /
298
+ render_final; the service fetches the files into JR_ASSETS_DIR/<id>/ and the scene script imports the entry with
299
+ bpy.ops.import_scene.gltf(filepath=os.path.join(os.environ['JR_ASSETS_DIR'], '<entry>')). No GPU time is used."""
300
+ c = _client()
301
+ try:
302
+ return _j(c.asset_search(query, kind))
303
+ except ClientError as exc:
304
+ return _j({"ok": False, "error": str(exc)})
305
+
306
+
268
307
  @mcp.tool(structured_output=False, meta=_ui_meta(), description=RENDER_PREVIEW_DESCRIPTION)
269
308
  def render_preview(
270
309
  scene_path: str = "",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: janction-render
3
- Version: 0.4.2
3
+ Version: 0.4.4
4
4
  Summary: Cloud GPU render farm for Blender, for AI agents: MCP server (remote + stdio) and CLI. Render Blender without a GPU from Claude, ChatGPT, Claude Code, Codex, Cursor.
5
5
  Requires-Python: >=3.11
6
6
  Description-Content-Type: text/markdown
@@ -37,6 +37,12 @@ without a GPU, or when rendering locally is slow.
37
37
  - In hosts that support MCP Apps (Claude web and desktop, among others), previews, progress and download links also appear
38
38
  as an interactive panel in the chat: the image, a progress bar, "Open MP4", and preset buttons after an `environment="compare"` preview.
39
39
  Both the remote connector and the stdio package ship the panel (`janction_render/mcp_app.html`); set `JR_MCP_APPS=0` to turn it off.
40
+ - CC0 assets by name: `asset_search("wooden table")` finds Poly Haven models, textures and HDRIs; pass `polyhaven:<id>` in
41
+ `asset_urls` (remote) or `assets` (stdio) and the files land in `JR_ASSETS_DIR/<id>/` on the GPU, ready to import
42
+ (`bpy.ops.import_scene.gltf(filepath=os.path.join(os.environ['JR_ASSETS_DIR'], 'wooden_table_02', 'wooden_table_02_1k.gltf'))`).
43
+ Scene scripts can `import jr_assets` for one-liners: `jr_assets.import_model('wooden_table_02')`,
44
+ `jr_assets.apply(floor, jr_assets.material('wood_floor_deck', scale=2))` (diff / normal / roughness / metal wired into a
45
+ Principled BSDF), `jr_assets.world_hdri('studio_small_09')`. See `samples/polyhaven_room.py`.
40
46
  - `scene_info` reads the scene without rendering (cameras, frame range, missing files).
41
47
  - `render_preview` returns 1-4 low-cost frames tiled in one image within seconds, so the agent can look, fix, and repeat.
42
48
  - `render_estimate` says how long a render will take ("about 3 minutes") and whether it fits today's free quota.
@@ -119,6 +125,7 @@ Then, in Claude Code:
119
125
  | `render_final(scene_id, frame_start, frame_end, width, height, samples, fps, output, environment?, blender?, engine?, transparent?, notify_url?)` | frames (png / exr) or video (mp4 / webm / prores / gif / webp); `transparent=True` keeps an alpha background (png / exr / webm / gif / webp); `notify_url` gets one JSON POST when the job finishes; returns job_id + estimate |
120
126
  | `render_status(job_id)` | progress and ETA (`eta.human`); `render_download(job_id, only="mp4" / "frames" / "all")` files or links; `render_cancel(job_id)` |
121
127
  | `billing()` | free-beta quota (used today, daily limit, reset time); later balance and top-up link |
128
+ | `asset_search(query, kind)` | CC0 models / textures / HDRIs on Poly Haven by words; results carry `polyhaven:<id>` and the entry file |
122
129
  | `render_info()` | workers online or gated (GPU lent to another workload), queue, expected wait, supported inputs, environment presets, Blender versions |
123
130
 
124
131
  Options on `render_preview` / `render_final`: `environment` (`studio`, `sunset`, `overcast`, `night`, `compare` on previews; `environment_strength`,
@@ -159,6 +166,8 @@ POST /v1/jobs {scene_id, kind: info|preview|final, frames|frame_start/frame_en
159
166
  environment, environment_strength, environment_visible, blender, orbit, orbit_frames, orbit_elevation}
160
167
  GET /v1/jobs/{id} status, progress, eta, artifacts[], cost, warnings, info DELETE /v1/jobs/{id} cancel
161
168
  GET /v1/jobs/{id}/artifacts/{name} PNG / MP4
169
+ GET /v1/assets/search?q=&kind=models|textures|hdris CC0 assets (Poly Haven) -> spec polyhaven:<id>
170
+ POST /v1/files/{id}/assets/urls {urls: ["https://...", "polyhaven:<id>"]} fetch assets server-side
162
171
  POST /mcp remote MCP (Streamable HTTP; Bearer api key or OAuth)
163
172
  GET /.well-known/oauth-protected-resource/mcp OAuth discovery
164
173
  POST /v1/billing/checkout {amount_yen} -> {checkout_url} POST /v1/billing/sync GET /v1/ledger GET /v1/me
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "janction-render"
7
- version = "0.4.2"
7
+ version = "0.4.4"
8
8
  description = "Cloud GPU render farm for Blender, for AI agents: MCP server (remote + stdio) and CLI. Render Blender without a GPU from Claude, ChatGPT, Claude Code, Codex, Cursor."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
File without changes