studio-console 1.3.4__py3-none-any.whl

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.
@@ -0,0 +1,184 @@
1
+ # studio_console/constants.py
2
+ """Static constants - component lists, mappings, display groupings."""
3
+
4
+ # ---------------------------------------------------------------------------
5
+ # Component definitions
6
+ # ---------------------------------------------------------------------------
7
+
8
+ ALL_COMPONENTS = [
9
+ "PostgreSQL",
10
+ "API",
11
+ "UI",
12
+ "General worker",
13
+ "Transfer worker",
14
+ ]
15
+
16
+ CORE_DEFAULTS = {"PostgreSQL", "API", "UI"}
17
+
18
+ # Restricted runtime DB role (RLS cutover). The API's bootstrap provisions it
19
+ # from SHS_DATABASE_APP_URL's credentials on every boot — console only names
20
+ # it and supplies the URL; it never runs role/grant SQL itself.
21
+ APP_DB_ROLE = "shs_app"
22
+
23
+ # ---------------------------------------------------------------------------
24
+ # Component → compose profile mapping
25
+ # ---------------------------------------------------------------------------
26
+
27
+ COMPONENT_TO_PROFILE = {
28
+ "General worker": "worker-general",
29
+ "Transfer worker": "worker-transfer",
30
+ "Audio worker": "worker-audio",
31
+ "Video worker": "worker-video",
32
+ "ComfyUI image worker": "worker-comfyui-image",
33
+ "ComfyUI video worker": "worker-comfyui-image",
34
+ }
35
+
36
+ # ---------------------------------------------------------------------------
37
+ # Component → Docker image mapping
38
+ # ---------------------------------------------------------------------------
39
+
40
+ COMPONENT_TO_IMAGE = {
41
+ "API": "studio-api",
42
+ "UI": "studio-ui",
43
+ "General worker": "studio-worker-general",
44
+ "Transfer worker": "studio-worker-transfer",
45
+ "Audio worker": "studio-worker-audio",
46
+ "Video worker": "studio-worker-video",
47
+ "ComfyUI image worker": "studio-worker-comfyui",
48
+ "ComfyUI video worker": "studio-worker-comfyui",
49
+ }
50
+
51
+ # Image name → (Dockerfile relative to repo root, build context)
52
+ IMAGE_BUILD_CONFIG = {
53
+ "studio-api": ("api/Dockerfile", "api/"),
54
+ "studio-ui": ("ui/Dockerfile", "ui/"),
55
+ "studio-worker-general": ("workers/engines/general/Dockerfile", "workers/"),
56
+ "studio-worker-transfer": ("workers/engines/transfer/Dockerfile", "workers/"),
57
+ "studio-worker-video": ("workers/engines/video/Dockerfile", "workers/"),
58
+ "studio-worker-audio": ("workers/engines/audio/Dockerfile", "workers/"),
59
+ "studio-worker-comfyui": ("workers/engines/comfyui/Dockerfile", "workers/"),
60
+ }
61
+
62
+ THIRD_PARTY_IMAGES = [
63
+ "pgvector/pgvector:0.8.3-pg18-trixie@sha256:6232c5ea178707f278d060b51747c30f310164595674e95d5f9d100f4a48b56c"
64
+ ]
65
+
66
+ # ---------------------------------------------------------------------------
67
+ # Worker scaling - component name ↔ env var ↔ compose service
68
+ # ---------------------------------------------------------------------------
69
+
70
+ # Component name → env var name
71
+ SCALE_VARS: dict[str, str] = {
72
+ "General worker": "SHS_GENERAL_WORKERS",
73
+ "Transfer worker": "SHS_TRANSFER_WORKERS",
74
+ "Audio worker": "SHS_AUDIO_WORKERS",
75
+ "Video worker": "SHS_VIDEO_WORKERS",
76
+ "ComfyUI image worker": "SHS_COMFYUI_IMAGE_WORKERS",
77
+ "ComfyUI video worker": "SHS_COMFYUI_VIDEO_WORKERS",
78
+ }
79
+
80
+ # Env var name → compose service name (for --scale flags)
81
+ SCALE_PROFILES: dict[str, str] = {
82
+ "SHS_GENERAL_WORKERS": "worker-general",
83
+ "SHS_TRANSFER_WORKERS": "worker-transfer",
84
+ "SHS_AUDIO_WORKERS": "worker-audio",
85
+ "SHS_VIDEO_WORKERS": "worker-video",
86
+ "SHS_COMFYUI_IMAGE_WORKERS": "worker-comfyui-image",
87
+ "SHS_COMFYUI_VIDEO_WORKERS": "worker-comfyui-image",
88
+ }
89
+
90
+ # Reverse: env var name → component name (for restoring state from .env)
91
+ SCALE_VARS_REVERSE: dict[str, str] = {v: k for k, v in SCALE_VARS.items()}
92
+
93
+ # ---------------------------------------------------------------------------
94
+ # .env display grouping (for `show .env` command)
95
+ # ---------------------------------------------------------------------------
96
+
97
+ ENV_SECTIONS = {
98
+ "Required Secrets": [
99
+ "SHS_JWT_SECRET_KEY",
100
+ "SHS_WORKER_SHARED_SECRET",
101
+ "SHS_CREDENTIAL_ENCRYPTION_KEY",
102
+ ],
103
+ "URLs": [
104
+ "SHS_API_BASE_URL",
105
+ "SHS_PUBLIC_API_URL",
106
+ "SHS_PUBLIC_BASE_URL",
107
+ "SHS_FRONTEND_URL",
108
+ "SHS_CORS_ORIGINS",
109
+ "SHS_WS_URL",
110
+ ],
111
+ "Database": [
112
+ "SHS_DATABASE_URL",
113
+ "SHS_DATABASE_APP_URL",
114
+ "POSTGRES_USER",
115
+ "POSTGRES_PASSWORD",
116
+ "POSTGRES_PORT",
117
+ ],
118
+ "Workspace": [
119
+ "SHS_WORKSPACE_ROOT",
120
+ "SHS_WORKSPACE_DIR",
121
+ "SHS_DB_DATA",
122
+ "SHS_STORAGE_ROOT",
123
+ "SHS_MODELS_ROOT",
124
+ "CONSOLE_BACKUP_ROOT",
125
+ ],
126
+ "Version": ["SHS_STUDIO_VERSION"],
127
+ "API Settings": [
128
+ "SHS_ENV",
129
+ "SHS_DEBUG",
130
+ "PORT",
131
+ "SHS_LOG_LEVEL",
132
+ "SHS_LOG_FORMAT",
133
+ "SHS_ENABLE_ACCESS_LOGS",
134
+ "SHS_SUPPRESS_WORKER_POLLING_LOGS",
135
+ "SHS_STORAGE_BACKEND",
136
+ "SHS_MAINTENANCE_MODE",
137
+ "SHS_COMMUNITY_SOURCE",
138
+ "SHS_PLUS_SOURCE",
139
+ "SHS_CATALOG_CACHE_HOURS",
140
+ ],
141
+ "Worker Settings": [
142
+ "SHS_COMFYUI_URL",
143
+ "CONSOLE_MODELS_PATH",
144
+ "SHS_WHISPER_MODEL",
145
+ "HF_HOME",
146
+ "SHS_GENERAL_WORKERS",
147
+ "SHS_TRANSFER_WORKERS",
148
+ ],
149
+ "Scaling": [
150
+ "CONSOLE_API_REPLICAS",
151
+ "CONSOLE_UI_REPLICAS",
152
+ "SHS_NGINX_PORT",
153
+ ],
154
+ "Runtime": [
155
+ "CONSOLE_COMPONENTS",
156
+ "COMPOSE_PROFILES",
157
+ ],
158
+ "Cloudflare": [
159
+ "CLOUDFLARE_TUNNEL_TOKEN",
160
+ "CLOUDFLARE_API_TOKEN",
161
+ "CLOUDFLARE_ACCOUNT_ID",
162
+ "CLOUDFLARE_TUNNEL_ID",
163
+ "CLOUDFLARE_ZONE_ID",
164
+ "CLOUDFLARE_ACCESS_APP_ID",
165
+ ],
166
+ }
167
+
168
+ # ---------------------------------------------------------------------------
169
+ # Secret detection
170
+ # ---------------------------------------------------------------------------
171
+
172
+ SECRET_KEYS = {
173
+ "SHS_JWT_SECRET_KEY",
174
+ "SHS_WORKER_SHARED_SECRET",
175
+ "SHS_CREDENTIAL_ENCRYPTION_KEY",
176
+ "POSTGRES_PASSWORD",
177
+ "SHS_ADMIN_PASSWORD",
178
+ "SHS_ENTITLEMENT_TOKEN",
179
+ "CLOUDFLARE_TUNNEL_TOKEN",
180
+ "CLOUDFLARE_API_TOKEN",
181
+ }
182
+
183
+ # Substrings that mark a key as secret
184
+ SECRET_PATTERNS = ("SECRET", "PASSWORD", "ENCRYPTION_KEY", "TUNNEL_TOKEN", "API_TOKEN")
@@ -0,0 +1,37 @@
1
+ # Bundled data
2
+
3
+ ## `known_baselines.json`
4
+
5
+ Maps each Studio **major version** to the list of alembic **baseline revisions**
6
+ that identify a database as belonging to that major:
7
+
8
+ ```json
9
+ { "1": ["9f01e7ae15f2"] }
10
+ ```
11
+
12
+ `major_version.classify_revision` uses it to block install/upgrade/restore when a
13
+ DB sits on a prior major (or an unknown future major) before the API would fail
14
+ to start. A DB rev that matches no listed baseline classifies as `ok` and defers
15
+ to the API's own guardrail — that fallback is intentional; do NOT block unknown
16
+ revisions here.
17
+
18
+ ### This file is a release artifact: it MUST be re-synced from the Studio repo
19
+
20
+ A major has **more than one** baseline whenever Studio squashes-and-stamps
21
+ its migration chain to a new baseline. Every historical baseline that a
22
+ **restorable** DB might still be stamped to has to stay in that major's list —
23
+ dropping one makes those DBs unrecognizable, so a prior-major restore slips past
24
+ the upfront block and only fails later at API start.
25
+
26
+ Update this file in the **same change** that:
27
+
28
+ - introduces a **new Studio major** → add a new `"<major>": ["<baseline>"]` entry, or
29
+ - **squashes-and-stamps** a new baseline for any major a deployed/restorable DB
30
+ could be on → **append** the new baseline to that major's list (never replace).
31
+
32
+ Cadence: Studio squashes periodically; this file lags until the next console
33
+ release. That staleness window is covered by the API guardrail + log-scrape
34
+ fallback, but it is a window, so sync promptly.
35
+
36
+ The format also accepts the legacy scalar form (`{"1": "abc"}`); `load_baselines`
37
+ normalizes a scalar to a single-element list. Prefer the list form.
@@ -0,0 +1,3 @@
1
+ {
2
+ "1": ["9f01e7ae15f2"]
3
+ }