janction-render 0.4.2__tar.gz → 0.4.3__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.3
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,9 @@ 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'))`).
40
43
  - `scene_info` reads the scene without rendering (cameras, frame range, missing files).
41
44
  - `render_preview` returns 1-4 low-cost frames tiled in one image within seconds, so the agent can look, fix, and repeat.
42
45
  - `render_estimate` says how long a render will take ("about 3 minutes") and whether it fits today's free quota.
@@ -119,6 +122,7 @@ Then, in Claude Code:
119
122
  | `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
123
  | `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
124
  | `billing()` | free-beta quota (used today, daily limit, reset time); later balance and top-up link |
125
+ | `asset_search(query, kind)` | CC0 models / textures / HDRIs on Poly Haven by words; results carry `polyhaven:<id>` and the entry file |
122
126
  | `render_info()` | workers online or gated (GPU lent to another workload), queue, expected wait, supported inputs, environment presets, Blender versions |
123
127
 
124
128
  Options on `render_preview` / `render_final`: `environment` (`studio`, `sunset`, `overcast`, `night`, `compare` on previews; `environment_strength`,
@@ -159,6 +163,8 @@ POST /v1/jobs {scene_id, kind: info|preview|final, frames|frame_start/frame_en
159
163
  environment, environment_strength, environment_visible, blender, orbit, orbit_frames, orbit_elevation}
160
164
  GET /v1/jobs/{id} status, progress, eta, artifacts[], cost, warnings, info DELETE /v1/jobs/{id} cancel
161
165
  GET /v1/jobs/{id}/artifacts/{name} PNG / MP4
166
+ GET /v1/assets/search?q=&kind=models|textures|hdris CC0 assets (Poly Haven) -> spec polyhaven:<id>
167
+ POST /v1/files/{id}/assets/urls {urls: ["https://...", "polyhaven:<id>"]} fetch assets server-side
162
168
  POST /mcp remote MCP (Streamable HTTP; Bearer api key or OAuth)
163
169
  GET /.well-known/oauth-protected-resource/mcp OAuth discovery
164
170
  POST /v1/billing/checkout {amount_yen} -> {checkout_url} POST /v1/billing/sync GET /v1/ledger GET /v1/me
@@ -20,6 +20,9 @@ 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'))`).
23
26
  - `scene_info` reads the scene without rendering (cameras, frame range, missing files).
24
27
  - `render_preview` returns 1-4 low-cost frames tiled in one image within seconds, so the agent can look, fix, and repeat.
25
28
  - `render_estimate` says how long a render will take ("about 3 minutes") and whether it fits today's free quota.
@@ -102,6 +105,7 @@ Then, in Claude Code:
102
105
  | `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
106
  | `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
107
  | `billing()` | free-beta quota (used today, daily limit, reset time); later balance and top-up link |
108
+ | `asset_search(query, kind)` | CC0 models / textures / HDRIs on Poly Haven by words; results carry `polyhaven:<id>` and the entry file |
105
109
  | `render_info()` | workers online or gated (GPU lent to another workload), queue, expected wait, supported inputs, environment presets, Blender versions |
106
110
 
107
111
  Options on `render_preview` / `render_final`: `environment` (`studio`, `sunset`, `overcast`, `night`, `compare` on previews; `environment_strength`,
@@ -142,6 +146,8 @@ POST /v1/jobs {scene_id, kind: info|preview|final, frames|frame_start/frame_en
142
146
  environment, environment_strength, environment_visible, blender, orbit, orbit_frames, orbit_elevation}
143
147
  GET /v1/jobs/{id} status, progress, eta, artifacts[], cost, warnings, info DELETE /v1/jobs/{id} cancel
144
148
  GET /v1/jobs/{id}/artifacts/{name} PNG / MP4
149
+ GET /v1/assets/search?q=&kind=models|textures|hdris CC0 assets (Poly Haven) -> spec polyhaven:<id>
150
+ POST /v1/files/{id}/assets/urls {urls: ["https://...", "polyhaven:<id>"]} fetch assets server-side
145
151
  POST /mcp remote MCP (Streamable HTTP; Bearer api key or OAuth)
146
152
  GET /.well-known/oauth-protected-resource/mcp OAuth discovery
147
153
  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.3"
@@ -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,10 @@ 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
+ ENV_DOC = ENV_DOC + POLYHAVEN_DOC
90
94
 
91
95
 
92
96
  def _log(msg: str) -> None:
@@ -153,8 +157,28 @@ def _payment_block(exc: ClientError) -> Optional[dict[str, Any]]:
153
157
  _LAST_UPLOAD: dict[str, Any] = {}
154
158
 
155
159
 
160
+ def _is_remote_asset(a: str) -> bool:
161
+ s = str(a).strip().lower()
162
+ return s.startswith("polyhaven:") or s.startswith("https://")
163
+
164
+
156
165
  def _resolve_scene(c: Client, scene_path: str, scene_id: str, scene_script: str = "",
157
166
  assets: Optional[list[str]] = None) -> str:
167
+ """手元のファイルは upload、polyhaven:<id> と https の素材は受付に取らせる。"""
168
+ remote = [str(a) for a in (assets or []) if _is_remote_asset(a)]
169
+ local = [a for a in (assets or []) if not _is_remote_asset(a)]
170
+ sid = _resolve_scene_local(c, scene_path, scene_id, scene_script, local or None)
171
+ if remote:
172
+ up = c.fetch_asset_urls(sid, remote)
173
+ got = list(_LAST_UPLOAD.get("assets") or [])
174
+ _LAST_UPLOAD["assets"] = got + [x for x in (up.get("added") or []) if x not in got]
175
+ if up.get("polyhaven"):
176
+ _LAST_UPLOAD["polyhaven"] = up["polyhaven"]
177
+ return sid
178
+
179
+
180
+ def _resolve_scene_local(c: Client, scene_path: str, scene_id: str, scene_script: str = "",
181
+ assets: Optional[list[str]] = None) -> str:
158
182
  _LAST_UPLOAD.clear()
159
183
  if scene_id:
160
184
  if assets:
@@ -265,6 +289,20 @@ RENDER_PREVIEW_DESCRIPTION = (
265
289
  )
266
290
 
267
291
 
292
+ @mcp.tool()
293
+ def asset_search(query: str, kind: str = "models") -> str:
294
+ """Find CC0 3D models, PBR textures or HDRIs on Poly Haven by words (name, tags, category), to furnish a scene
295
+ without local files. kind: 'models' (default) | 'textures' | 'hdris'. Each result has spec 'polyhaven:<id>', its
296
+ size in metres (models) and the entry file. Then pass the spec in assets of scene_info / render_preview /
297
+ render_final; the service fetches the files into JR_ASSETS_DIR/<id>/ and the scene script imports the entry with
298
+ bpy.ops.import_scene.gltf(filepath=os.path.join(os.environ['JR_ASSETS_DIR'], '<entry>')). No GPU time is used."""
299
+ c = _client()
300
+ try:
301
+ return _j(c.asset_search(query, kind))
302
+ except ClientError as exc:
303
+ return _j({"ok": False, "error": str(exc)})
304
+
305
+
268
306
  @mcp.tool(structured_output=False, meta=_ui_meta(), description=RENDER_PREVIEW_DESCRIPTION)
269
307
  def render_preview(
270
308
  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.3
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,9 @@ 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'))`).
40
43
  - `scene_info` reads the scene without rendering (cameras, frame range, missing files).
41
44
  - `render_preview` returns 1-4 low-cost frames tiled in one image within seconds, so the agent can look, fix, and repeat.
42
45
  - `render_estimate` says how long a render will take ("about 3 minutes") and whether it fits today's free quota.
@@ -119,6 +122,7 @@ Then, in Claude Code:
119
122
  | `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
123
  | `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
124
  | `billing()` | free-beta quota (used today, daily limit, reset time); later balance and top-up link |
125
+ | `asset_search(query, kind)` | CC0 models / textures / HDRIs on Poly Haven by words; results carry `polyhaven:<id>` and the entry file |
122
126
  | `render_info()` | workers online or gated (GPU lent to another workload), queue, expected wait, supported inputs, environment presets, Blender versions |
123
127
 
124
128
  Options on `render_preview` / `render_final`: `environment` (`studio`, `sunset`, `overcast`, `night`, `compare` on previews; `environment_strength`,
@@ -159,6 +163,8 @@ POST /v1/jobs {scene_id, kind: info|preview|final, frames|frame_start/frame_en
159
163
  environment, environment_strength, environment_visible, blender, orbit, orbit_frames, orbit_elevation}
160
164
  GET /v1/jobs/{id} status, progress, eta, artifacts[], cost, warnings, info DELETE /v1/jobs/{id} cancel
161
165
  GET /v1/jobs/{id}/artifacts/{name} PNG / MP4
166
+ GET /v1/assets/search?q=&kind=models|textures|hdris CC0 assets (Poly Haven) -> spec polyhaven:<id>
167
+ POST /v1/files/{id}/assets/urls {urls: ["https://...", "polyhaven:<id>"]} fetch assets server-side
162
168
  POST /mcp remote MCP (Streamable HTTP; Bearer api key or OAuth)
163
169
  GET /.well-known/oauth-protected-resource/mcp OAuth discovery
164
170
  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.3"
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