fix(config): unify RPA runtime reads through config.get* (v1.0.16)
All checks were successful
Publish Python Package to Gitea / publish (push) Successful in 21s
All checks were successful
Publish Python Package to Gitea / publish (push) Successful in 21s
Route OPENCLAW_BROWSER_HEADLESS, OPENCLAW_PLAYWRIGHT_STEALTH, OPENCLAW_ARTIFACTS_ON_FAILURE, and OPENCLAW_RECORD_VIDEO (health diagnostics) through jiangchang_skill_core.config.get_bool so user .env and .env.example share the same three-tier priority as the rest of the skill stack. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "jiangchang-platform-kit"
|
name = "jiangchang-platform-kit"
|
||||||
version = "1.0.15"
|
version = "1.0.16"
|
||||||
description = "匠厂平台共享组件:Skill 实体 SDK + 桌面应用自动化 SDK"
|
description = "匠厂平台共享组件:Skill 实体 SDK + 桌面应用自动化 SDK"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
|
|||||||
@@ -5,10 +5,11 @@ from __future__ import annotations
|
|||||||
import os
|
import os
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
|
from .. import config
|
||||||
|
|
||||||
|
|
||||||
def _artifacts_enabled() -> bool:
|
def _artifacts_enabled() -> bool:
|
||||||
v = (os.environ.get("OPENCLAW_ARTIFACTS_ON_FAILURE") or "1").strip().lower()
|
return config.get_bool("OPENCLAW_ARTIFACTS_ON_FAILURE", default=True)
|
||||||
return v not in ("0", "false", "no", "off")
|
|
||||||
|
|
||||||
|
|
||||||
def artifact_path(data_dir: str, batch_id: str, tag: str, ext: str = "png") -> str:
|
def artifact_path(data_dir: str, batch_id: str, tag: str, ext: str = "png") -> str:
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from .. import config
|
||||||
from ..runtime_env import find_chrome_executable
|
from ..runtime_env import find_chrome_executable
|
||||||
from .stealth import (
|
from .stealth import (
|
||||||
STEALTH_INIT_SCRIPT,
|
STEALTH_INIT_SCRIPT,
|
||||||
@@ -31,8 +31,7 @@ async def launch_persistent_browser(
|
|||||||
录屏由 RpaVideoSession(ffmpeg)负责,本函数不向 Playwright 传递任何录屏参数。
|
录屏由 RpaVideoSession(ffmpeg)负责,本函数不向 Playwright 传递任何录屏参数。
|
||||||
"""
|
"""
|
||||||
if headless is None:
|
if headless is None:
|
||||||
v = (os.environ.get("OPENCLAW_BROWSER_HEADLESS") or "0").strip().lower()
|
headless = config.get_bool("OPENCLAW_BROWSER_HEADLESS", default=False)
|
||||||
headless = v in ("1", "true", "yes", "on")
|
|
||||||
|
|
||||||
chrome = executable_path or find_chrome_executable()
|
chrome = executable_path or find_chrome_executable()
|
||||||
if not chrome:
|
if not chrome:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
from .. import config
|
||||||
|
|
||||||
STEALTH_INIT_SCRIPT = """
|
STEALTH_INIT_SCRIPT = """
|
||||||
(() => {
|
(() => {
|
||||||
@@ -48,8 +48,7 @@ STEALTH_INIT_SCRIPT = """
|
|||||||
|
|
||||||
|
|
||||||
def stealth_enabled() -> bool:
|
def stealth_enabled() -> bool:
|
||||||
v = (os.environ.get("OPENCLAW_PLAYWRIGHT_STEALTH") or "1").strip().lower()
|
return config.get_bool("OPENCLAW_PLAYWRIGHT_STEALTH", default=True)
|
||||||
return v not in ("0", "false", "no", "off")
|
|
||||||
|
|
||||||
|
|
||||||
def persistent_context_launch_parts(
|
def persistent_context_launch_parts(
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ from pathlib import Path
|
|||||||
from typing import Any, Mapping
|
from typing import Any, Mapping
|
||||||
|
|
||||||
import jiangchang_skill_core
|
import jiangchang_skill_core
|
||||||
|
from . import config
|
||||||
from .media_assets import probe_background_music, probe_media_assets, resolve_media_assets_root
|
from .media_assets import probe_background_music, probe_media_assets, resolve_media_assets_root
|
||||||
from .runtime_env import platform_default_data_root
|
from .runtime_env import platform_default_data_root
|
||||||
|
|
||||||
@@ -230,7 +231,10 @@ def collect_runtime_diagnostics(
|
|||||||
)
|
)
|
||||||
|
|
||||||
if record_video is None:
|
if record_video is None:
|
||||||
record_video_enabled = _bool_from_env(env_map, "OPENCLAW_RECORD_VIDEO", False)
|
if env is not None:
|
||||||
|
record_video_enabled = _bool_from_env(env_map, "OPENCLAW_RECORD_VIDEO", False)
|
||||||
|
else:
|
||||||
|
record_video_enabled = config.get_bool("OPENCLAW_RECORD_VIDEO", default=False)
|
||||||
else:
|
else:
|
||||||
record_video_enabled = record_video
|
record_video_enabled = record_video
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user