janction-render 0.4.331__tar.gz → 0.4.334__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 (26) hide show
  1. {janction_render-0.4.331 → janction_render-0.4.334}/PKG-INFO +1 -1
  2. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/__init__.py +1 -1
  3. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/cli.py +23 -1
  4. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/client.py +18 -2
  5. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/mcp_common.py +43 -1
  6. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/mcp_server.py +6 -0
  7. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render.egg-info/PKG-INFO +1 -1
  8. {janction_render-0.4.331 → janction_render-0.4.334}/pyproject.toml +1 -1
  9. {janction_render-0.4.331 → janction_render-0.4.334}/LICENSE +0 -0
  10. {janction_render-0.4.331 → janction_render-0.4.334}/README.md +0 -0
  11. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/brief.py +0 -0
  12. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/decision_words.py +0 -0
  13. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/desktop_notify.py +0 -0
  14. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/hookup.py +0 -0
  15. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/libplan.py +0 -0
  16. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/links.py +0 -0
  17. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/mcp_app.html +0 -0
  18. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/prompts.py +0 -0
  19. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/terms_defaults.py +0 -0
  20. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render/tooldocs.py +0 -0
  21. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render.egg-info/SOURCES.txt +0 -0
  22. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render.egg-info/dependency_links.txt +0 -0
  23. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render.egg-info/entry_points.txt +0 -0
  24. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render.egg-info/requires.txt +0 -0
  25. {janction_render-0.4.331 → janction_render-0.4.334}/janction_render.egg-info/top_level.txt +0 -0
  26. {janction_render-0.4.331 → janction_render-0.4.334}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: janction-render
3
- Version: 0.4.331
3
+ Version: 0.4.334
4
4
  Summary: Cloud GPU rendering for Blender scenes and 3D models (GLB, FBX, USD, OBJ, STL), built for AI agents: MCP server (remote + stdio), HTTP API and CLI. Product shots, 360-degree turntables, animations and stills; preview in seconds with a critic; no local Blender or GPU. Free welcome credit for a new key. Current pricing and limits: https://render.janction.jp/pricing
5
5
  Author-email: "JasmyLab Inc." <contact@jasmylab.com>
6
6
  License-Expression: MIT
@@ -1,3 +1,3 @@
1
1
  """JANCTION Render — ターミナルの AI エージェントから GPU で 3DCG を描く。"""
2
2
 
3
- __version__ = "0.4.331"
3
+ __version__ = "0.4.334"
@@ -365,6 +365,8 @@ def cmd_preview(c: Client, args: argparse.Namespace) -> int:
365
365
  what = ", ".join(f"{k}={v}" for k, v in mp.items()) + (f", frames {frames}" if frames else "")
366
366
  if getattr(args, "changed_since", None):
367
367
  extra["changed_since"] = args.changed_since # 11/17 受付の旗 JR_REGION_AUTO: 前の仕上げから変わった所の四角
368
+ if getattr(args, "auto_fix", None):
369
+ extra["auto_fix"] = args.auto_fix # 11/18 受付の旗 JR_AUTO_FIX: 点検の直しを当てて自分で描き直す(試し描きだけ)
368
370
  j = c.submit(sid, kind="preview", frames=frames, camera=args.camera, width=w, height=h,
369
371
  samples=args.samples, engine=args.engine, max_yen=args.max_yen, **extra)
370
372
  print(f"job {j['job_id']} queued: {what} (estimate ~{j['estimate']['seconds']}s)", file=sys.stderr)
@@ -374,14 +376,31 @@ def cmd_preview(c: Client, args: argparse.Namespace) -> int:
374
376
  return 1
375
377
  out = Path(args.out) if args.out else Path("render_out") / safe_name(j["job_id"])
376
378
  paths = c.download(j["job_id"], out, on_progress=_say_err)
379
+ afu = None
380
+ if getattr(args, "auto_fix", None):
381
+ from .mcp_common import auto_fix_followup
382
+ afu = auto_fix_followup(j, lambda: c.job(j["job_id"]))
377
383
  print(_j({"job_id": j["job_id"], "scene_id": sid, "frames": frames, "files": [str(p) for p in paths],
378
384
  "warnings": j.get("warnings") or [], "gpu_seconds": j["gpu_seconds"], "device": j["device"],
379
- "expires_at": j["expires_at"], **({"changed_region": j["changed_region"]} if j.get("changed_region") else {})}))
385
+ "expires_at": j["expires_at"], **({"changed_region": j["changed_region"]} if j.get("changed_region") else {}),
386
+ **({"auto_fix": afu} if afu else {})}))
380
387
  _say_changed_region(j.get("changed_region"))
388
+ _say_auto_fix(afu)
381
389
  _suggest_next(c, j["job_id"])
382
390
  return 0
383
391
 
384
392
 
393
+ def _say_auto_fix(af: Any) -> None:
394
+ """11/18 --auto-fix の答え: 自分で出した次の試し描きと、それを取りに行く 1 行(標準エラー)。"""
395
+ if not isinstance(af, dict):
396
+ return
397
+ if af.get("next_job"):
398
+ print(f"auto-fix: the next preview {af['next_job']} applies {af.get('applied')} by itself; get it with: "
399
+ f"janction-render download {af['next_job']}", file=sys.stderr)
400
+ elif af.get("stopped"):
401
+ print(f"auto-fix: stopped ({af['stopped']}); no final was started", file=sys.stderr)
402
+
403
+
385
404
  def _say_changed_region(cr: Any) -> None:
386
405
  """11/17 --changed-since の答え: 変わった所の四角と、その四角だけ描き直す 1 行(標準エラー)。"""
387
406
  if not isinstance(cr, dict):
@@ -1216,6 +1235,9 @@ def build_parser() -> argparse.ArgumentParser:
1216
1235
  s.add_argument("--changed-since", default=None, metavar="JOB_ID",
1217
1236
  help="an earlier single-image PNG final: say which part of it this preview changed, and print the "
1218
1237
  "render line that re-renders only that box")
1238
+ s.add_argument("--auto-fix", type=int, choices=[1, 2, 3], default=None, metavar="N",
1239
+ help="if the preview check suggests settings (light, framing), apply them and preview again by itself, "
1240
+ "up to N times (never starts a final)")
1219
1241
  s.add_argument("--camera", default=None)
1220
1242
  s.add_argument("--size", type=_size, default=(1280, 720))
1221
1243
  s.add_argument("--samples", type=int, default=16)
@@ -51,6 +51,8 @@ PRO_ASSET_EXTENSIONS = frozenset({".vdb", ".bphys", ".blob", ".uni", ".gz", ".av
51
51
  LIBRARY_ASSET_EXTENSIONS = frozenset({".blend"})
52
52
  # 11/16 旗 JR_SPLAT_ASSETS の受付だけが受ける型(スクリプトが jr_assets.import_splat で読むスキャン)。旗の無い受付は 400 unsupported
53
53
  SPLAT_ASSET_EXTENSIONS = frozenset({".spz", ".ply"})
54
+ # 旗 JR_SCENE_AUDIO の受付だけが受ける型(シーケンサーの音のファイル、11/16、server/scene_audio.py)。旗の無い受付は 400 unsupported
55
+ SOUND_ASSET_EXTENSIONS = frozenset({".wav", ".mp3", ".ogg", ".flac", ".aif", ".aiff", ".m4a"})
54
56
  LIBRARY_FILES_MAX = 500 # リンクした .blend 1 つが読むファイルとして送る数の上限(材質の大きなライブラリで送りすぎない)
55
57
  _ASSET_NAME_RE = re.compile(r"^[A-Za-z0-9_.\-]{1,120}(/[A-Za-z0-9_.\-]{1,120}){0,4}$")
56
58
  # ワーカーは .blend を scene.blend として開くので、既定の点のキャッシュ(//blendcache_<名前>/)は blendcache_scene/ で送る
@@ -340,6 +342,9 @@ def is_pro_asset(name: str) -> bool:
340
342
  def is_splat_asset(name: str) -> bool:
341
343
  """旗 JR_SPLAT_ASSETS の受付だけが受ける型(素材のスキャン .spz・.ply)か(11/16)。"""
342
344
  return Path(name).suffix.lower() in SPLAT_ASSET_EXTENSIONS
345
+ def is_sound_asset(name: str) -> bool:
346
+ """旗 JR_SCENE_AUDIO の受付だけが受ける音のファイルか(11/16)。"""
347
+ return Path(name).suffix.lower() in SOUND_ASSET_EXTENSIONS
343
348
 
344
349
 
345
350
  def is_library_asset(name: str) -> bool:
@@ -354,7 +359,7 @@ def asset_name_problem(name: str) -> Optional[str]:
354
359
  return "the name has characters the service does not take (letters, digits, . _ - and up to 4 folders)"
355
360
  if ext == ".gz" and not name.lower().endswith(".bobj.gz"):
356
361
  return ".gz files other than fluid meshes (.bobj.gz) are not accepted"
357
- if ext not in BASE_ASSET_EXTENSIONS and ext not in PRO_ASSET_EXTENSIONS:
362
+ if ext not in BASE_ASSET_EXTENSIONS and ext not in PRO_ASSET_EXTENSIONS and ext not in SOUND_ASSET_EXTENSIONS:
358
363
  return f"{ext or 'no extension'} files are not accepted; pack it into the .blend"
359
364
  return None
360
365
 
@@ -986,7 +991,10 @@ class Client:
986
991
  libs = [(n, ap) for n, ap in todo if is_library_asset(n)]
987
992
  # 11/16: 素材のスキャン(旗 JR_SPLAT_ASSETS)も別に送る。受付が受けなければ外して理由を書く(描画は続ける)
988
993
  splats = [(n, ap) for n, ap in todo if is_splat_asset(n)]
989
- todo = [(n, ap) for n, ap in todo if not is_pro_asset(n) and not is_library_asset(n) and not is_splat_asset(n)]
994
+ # 11/16: シーケンサーの音のファイル(旗 JR_SCENE_AUDIO)も別に送る。受付が受けなければ外して理由を書く
995
+ sounds = [(n, ap) for n, ap in todo if is_sound_asset(n)]
996
+ todo = [(n, ap) for n, ap in todo if not is_pro_asset(n) and not is_library_asset(n) and not is_splat_asset(n)
997
+ and not is_sound_asset(n)]
990
998
  scene_id = out["scene_id"]
991
999
  if todo:
992
1000
  out = self.upload_assets(scene_id, todo)
@@ -1005,6 +1013,14 @@ class Client:
1005
1013
  raise
1006
1014
  missing += [f"{n} (this server does not take scans as assets yet; send the scan itself as the scene)"
1007
1015
  for n, _ in splats]
1016
+ if sounds:
1017
+ try:
1018
+ out = self.upload_assets(scene_id, sounds)
1019
+ except ClientError as exc:
1020
+ if exc.status != 400 or exc.error not in ("unsupported", "unsupported_input"):
1021
+ raise
1022
+ missing += [f"{n} (this server does not take sound files here; pack the sound into the .blend)"
1023
+ for n, _ in sounds]
1008
1024
  if libs:
1009
1025
  try:
1010
1026
  out = self.upload_assets(scene_id, libs)
@@ -10,7 +10,8 @@ from __future__ import annotations
10
10
 
11
11
  import json
12
12
  import os
13
- from typing import Any, Optional
13
+ import time
14
+ from typing import Any, Callable, Optional
14
15
 
15
16
  from .decision_words import SMALLER_IS_USERS_CHOICE
16
17
 
@@ -857,6 +858,8 @@ OPT_IN: tuple[tuple[str, str, str, str], ...] = (
857
858
  # 11/12 スキャンの被写体だけ(受付の旗 JR_SPLAT_SUBJECT、server/splat.py)
858
859
  # 道具の説明には足さない(引数の説明だけ。11/9 の旗と同じ・審査中の道具の説明を変えない)
859
860
  ("JR_SPLAT_SUBJECT", "render_preview", "subject_only", ""),
861
+ # 11/14 v2 AGT-04 上限つきの自動の直し(受付の旗 JR_AUTO_FIX、server/auto_fix.py)。試し描きだけ
862
+ ("JR_AUTO_FIX", "render_preview", "auto_fix", ""),
860
863
  ("JR_SPLAT_SUBJECT", "render_final", "subject_only", ""),
861
864
  # 11/12 大きなスキャンを減らして描く(受付の旗 JR_SPLAT_REDUCE、server/splat.py)
862
865
  ("JR_SPLAT_REDUCE", "render_preview", "reduce_points", ""),
@@ -936,6 +939,9 @@ OPT_IN_PARAM_DOCS: dict[str, str] = {
936
939
  "Leave frames out. The reply's final_estimate is the time and price of every frame at full quality."),
937
940
  "full_turn": ("True with orbit=True (or preset='turntable'): preview the whole turn as up to 24 small frames in one sheet "
938
941
  "(labelled in degrees) instead of 4 angles; leave frames out. Preview only."),
942
+ "auto_fix": ("1-3: when the preview check says fix and suggests settings (fix_params), the service starts that many follow-up "
943
+ "previews with them by itself and stops when the check is ok, the score does not improve or a preview would be "
944
+ "charged; it never starts a final. Follow the reply's auto_fix.next_job with render_status. 0 = off."),
939
945
  "subject_only": ("Gaussian splats (.spz, 3DGS .ply) only: True keeps the scanned subject and what it stands on and removes the "
940
946
  "rest of the capture (sky, far scenery, haze, the floor); the file is not changed. Use the same value for the "
941
947
  "final as for the preview."),
@@ -1237,3 +1243,39 @@ def hide_params(fn: Any, *names: Any) -> Any:
1237
1243
  return_annotation=hints.get("return", sig.return_annotation))
1238
1244
  run.__annotations__ = {k: v for k, v in hints.items() if k not in hidden}
1239
1245
  return run
1246
+
1247
+
1248
+ # 11/18: auto_fix(旗 JR_AUTO_FIX)の試し描き。受付は試し描きが done になった後に裏で「次を出すか止めるか」を決めるので、
1249
+ # MCP の返事を作る時点ではまだ決まっていないことがある(本番で遠隔 MCP の返事が auto_fix: null になり、AI が次の試し描きに
1250
+ # 気づけなかった)。少しだけ待って決まりを読み、返事に auto_fix の欄と次の一言を載せる。
1251
+ AUTO_FIX_WAIT_S = 8.0
1252
+
1253
+
1254
+ def auto_fix_followup(job: dict[str, Any], reread: Callable[[], dict[str, Any]],
1255
+ wait_s: float = AUTO_FIX_WAIT_S) -> Optional[dict[str, Any]]:
1256
+ """auto_fix を頼んだ試し描きなら、その欄(next_job か stopped まで少し待つ)。頼んでいなければ None。"""
1257
+ if not isinstance((job.get("params") or {}).get("auto_fix"), dict) and not isinstance(job.get("auto_fix"), dict):
1258
+ return None
1259
+ deadline = time.monotonic() + max(0.0, wait_s)
1260
+ j = job
1261
+ while True:
1262
+ af = j.get("auto_fix") if isinstance(j.get("auto_fix"), dict) else None
1263
+ if af and (af.get("next_job") or af.get("stopped")):
1264
+ break
1265
+ if time.monotonic() >= deadline:
1266
+ break
1267
+ time.sleep(0.5)
1268
+ try:
1269
+ j = reread() or j
1270
+ except Exception: # noqa: BLE001 — 読み直せなければ、今わかっている分だけ
1271
+ break
1272
+ af = dict(j.get("auto_fix") or {}) if isinstance(j.get("auto_fix"), dict) else {}
1273
+ if af.get("next_job"):
1274
+ af["next"] = (f"auto_fix started the next preview {af['next_job']} by itself (applied {json.dumps(af.get('applied'))}): "
1275
+ f"show this image, then call render_status(job_id='{af['next_job']}') and render_download for the fixed "
1276
+ "preview. No final is started.")
1277
+ elif not af.get("stopped"):
1278
+ af["next"] = ("auto_fix is still deciding: call render_status(job_id) of this preview in a few seconds; its auto_fix "
1279
+ "names the next preview or why it stopped.")
1280
+ return af
1281
+
@@ -747,6 +747,7 @@ def render_preview(
747
747
  camera_move: Annotated[str, D("camera_move", "")] = "",
748
748
  camera_angle: Annotated[float, D("camera_angle", 0.0)] = 0.0,
749
749
  changed_since: Annotated[str, D("changed_since", "")] = "",
750
+ auto_fix: Annotated[int, D("auto_fix", 0)] = 0,
750
751
  ) -> list[Any]:
751
752
  """Render a fast, cheap preview of a Blender scene on a JANCTION GPU and show the image. (full description on the tool)."""
752
753
  c = _client()
@@ -762,6 +763,7 @@ def render_preview(
762
763
  **_job_params(environment, environment_strength, environment_visible, blender, orbit, orbit_frames,
763
764
  orbit_elevation, orbit_target, orbit_distance, engine=engine),
764
765
  **mcp_common.opt_in_values(subject_only=(True if subject_only else None), # 11/12 旗 JR_SPLAT_SUBJECT
766
+ auto_fix=(int(auto_fix) if auto_fix else None), # 11/14 旗 JR_AUTO_FIX
765
767
  full_turn=(True if full_turn else None), # 11/12 旗 JR_FULL_TURN
766
768
  reduce_points=(True if reduce_points else None), # 11/12 旗 JR_SPLAT_REDUCE
767
769
  ocio_config=ocio_config or None, # 11/12 旗 JR_CUSTOM_OCIO
@@ -798,6 +800,10 @@ def render_preview(
798
800
  brief["next"] = PRESENT_FIRST + critic_next(j.get("critic")) + VARIANTS_NEXT + final_estimate_text(fu)
799
801
  _add_feature_offers(c, j, brief)
800
802
  _attach_upload_notes(brief)
803
+ afu = mcp_common.auto_fix_followup(j, lambda: c.job(j["job_id"])) # 11/18 旗 JR_AUTO_FIX
804
+ if afu:
805
+ brief["auto_fix"] = afu
806
+ brief["next"] = afu.get("next", "") + " " + brief.get("next", "")
801
807
  result: list[Any] = [_j(brief)]
802
808
  if show is not None:
803
809
  img = _shown_image(show)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: janction-render
3
- Version: 0.4.331
3
+ Version: 0.4.334
4
4
  Summary: Cloud GPU rendering for Blender scenes and 3D models (GLB, FBX, USD, OBJ, STL), built for AI agents: MCP server (remote + stdio), HTTP API and CLI. Product shots, 360-degree turntables, animations and stills; preview in seconds with a critic; no local Blender or GPU. Free welcome credit for a new key. Current pricing and limits: https://render.janction.jp/pricing
5
5
  Author-email: "JasmyLab Inc." <contact@jasmylab.com>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "janction-render"
7
- version = "0.4.331"
7
+ version = "0.4.334"
8
8
  description = "Cloud GPU rendering for Blender scenes and 3D models (GLB, FBX, USD, OBJ, STL), built for AI agents: MCP server (remote + stdio), HTTP API and CLI. Product shots, 360-degree turntables, animations and stills; preview in seconds with a critic; no local Blender or GPU. Free welcome credit for a new key. Current pricing and limits: https://render.janction.jp/pricing"
9
9
  readme = "README.md"
10
10
  license = "MIT"