AgPerry commited on
Commit
4d669fc
·
verified ·
1 Parent(s): aa40ccb

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. tasks/asana/environment/agent-browser/browser-use +152 -0
  2. tasks/asana/environment/agent-browser/gateway.py +524 -0
  3. tasks/asana/environment/candidate-abi/websitebench-candidate-preflight +5 -0
  4. tasks/asana/environment/mailbox/Dockerfile +5 -0
  5. tasks/asana/environment/mailbox/mailbox.py +2433 -0
  6. tasks/asana/environment/reference/.websitebench-reference-tls/ca.crt +20 -0
  7. tasks/asana/environment/reference/.websitebench-reference-tls/reference.crt +20 -0
  8. tasks/asana/environment/reference/.websitebench-reference-tls/reference.key +28 -0
  9. tasks/asana/environment/reference/.websitebench-reference-tls/tls_proxy.py +164 -0
  10. tasks/asana/environment/reference/Dockerfile +19 -0
  11. tasks/asana/environment/reference/README.md +10 -0
  12. tasks/asana/environment/reference/backend/model.json +430 -0
  13. tasks/asana/environment/reference/backend/runtime.json +104 -0
  14. tasks/asana/environment/reference/clone/app.py +176 -0
  15. tasks/asana/environment/reference/clone/asana_app/__init__.py +1 -0
  16. tasks/asana/environment/reference/clone/asana_app/api.py +0 -0
  17. tasks/asana/environment/reference/clone/asana_app/db.py +273 -0
  18. tasks/asana/environment/reference/clone/asana_app/pages.py +858 -0
  19. tasks/asana/environment/reference/clone/asana_app/seed.py +220 -0
  20. tasks/asana/environment/reference/clone/asana_app/services.py +45 -0
  21. tasks/asana/environment/reference/clone/backend/site_backend_integration.py +121 -0
  22. tasks/asana/environment/reference/clone/requirements.txt +3 -0
  23. tasks/asana/environment/reference/clone/static/app.css +591 -0
  24. tasks/asana/environment/reference/clone/static/app.js +0 -0
  25. tasks/asana/environment/reference/clone/static/auth.js +119 -0
  26. tasks/asana/environment/reference/clone/static/favicon.svg +1 -0
  27. tasks/asana/environment/reference/clone/static/home.js +48 -0
  28. tasks/asana/environment/reference/clone/static/official-pages/academy--trainings.json +0 -0
  29. tasks/asana/environment/reference/clone/static/official-pages/agencies.json +0 -0
  30. tasks/asana/environment/reference/clone/static/official-pages/apps.json +0 -0
  31. tasks/asana/environment/reference/clone/static/official-pages/customer-success.json +0 -0
  32. tasks/asana/environment/reference/clone/static/official-pages/customers.json +0 -0
  33. tasks/asana/environment/reference/clone/static/official-pages/help.json +0 -0
  34. tasks/asana/environment/reference/clone/static/official-pages/industry--education.json +0 -0
  35. tasks/asana/environment/reference/clone/static/official-pages/industry--government-solutions.json +0 -0
  36. tasks/asana/environment/reference/clone/static/official-pages/industry--healthcare.json +0 -0
  37. tasks/asana/environment/reference/clone/static/official-pages/industry--nonprofit.json +0 -0
  38. tasks/asana/environment/reference/clone/static/official-pages/industry--retail.json +0 -0
  39. tasks/asana/environment/reference/clone/static/official-pages/product--service-management.json +0 -0
  40. tasks/asana/environment/reference/clone/static/official-pages/product--stackai.json +0 -0
  41. tasks/asana/environment/reference/clone/static/official-pages/teams--it.json +0 -0
  42. tasks/asana/environment/reference/clone/static/official-pages/teams--leaders.json +0 -0
  43. tasks/asana/environment/reference/clone/static/official-pages/teams--marketing.json +0 -0
  44. tasks/asana/environment/reference/clone/static/official-pages/teams--operations.json +0 -0
  45. tasks/asana/environment/reference/clone/static/official-pages/uses--product-launch.json +0 -0
  46. tasks/asana/environment/reference/clone/static/public-nav.js +153 -0
  47. tasks/asana/environment/reference/clone/static/site.css +1021 -0
  48. tasks/asana/environment/reference/clone/websitebench/__init__.py +1 -0
  49. tasks/asana/environment/reference/compile.sh +5 -0
  50. tasks/asana/environment/reference/harbor_entry.py +123 -0
tasks/asana/environment/agent-browser/browser-use ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Forward the safe Browser Use CLI subset to the isolated browser sidecar."""
3
+
4
+ from __future__ import annotations
5
+
6
+ import json
7
+ import os
8
+ import shutil
9
+ import sys
10
+ import urllib.error
11
+ import urllib.request
12
+ import uuid
13
+ from pathlib import Path
14
+
15
+
16
+ GATEWAY_URL = os.environ.get(
17
+ "WEBSITEBENCH_BROWSER_GATEWAY_URL",
18
+ "http://browser:9224/v1/command",
19
+ )
20
+ SHARED_ROOT = Path("/browser-share")
21
+
22
+
23
+ def _translate_candidate_origin(arguments: list[str]) -> list[str]:
24
+ public_origin = os.environ.get(
25
+ "WEBSITEBENCH_CANDIDATE_URL", "http://127.0.0.1:3000"
26
+ ).rstrip("/")
27
+ browser_origin = os.environ.get(
28
+ "WEBSITEBENCH_BROWSER_CANDIDATE_URL", "http://candidate:3000"
29
+ ).rstrip("/")
30
+ return [
31
+ browser_origin + value[len(public_origin) :]
32
+ if value == public_origin or value.startswith(public_origin + "/")
33
+ else value
34
+ for value in arguments
35
+ ]
36
+
37
+
38
+ def _command_index(arguments: list[str]) -> int | None:
39
+ index = 0
40
+ while index < len(arguments):
41
+ value = arguments[index]
42
+ if value in {"--session"}:
43
+ index += 2
44
+ continue
45
+ if value.startswith("--session=") or value == "--json":
46
+ index += 1
47
+ continue
48
+ if value in {"-h", "--help"}:
49
+ return None
50
+ if value.startswith("-"):
51
+ return index
52
+ return index
53
+ return None
54
+
55
+
56
+ def _prepare_screenshot(arguments: list[str]) -> tuple[list[str], Path | None, Path | None]:
57
+ forwarded = list(arguments)
58
+ command_index = _command_index(forwarded)
59
+ if command_index is None or forwarded[command_index] != "screenshot":
60
+ return forwarded, None, None
61
+
62
+ local_path: Path | None = None
63
+ path_index: int | None = None
64
+ for index in range(command_index + 1, len(forwarded)):
65
+ if forwarded[index] == "--path" and index + 1 < len(forwarded):
66
+ path_index = index + 1
67
+ local_path = Path(forwarded[path_index])
68
+ break
69
+ if not forwarded[index].startswith("-"):
70
+ path_index = index
71
+ local_path = Path(forwarded[path_index])
72
+ break
73
+ if local_path is None:
74
+ local_path = Path("screenshot.png")
75
+ forwarded.append(str(local_path))
76
+ path_index = len(forwarded) - 1
77
+
78
+ shared_path = SHARED_ROOT / f"screenshot-{uuid.uuid4().hex}.png"
79
+ assert path_index is not None
80
+ forwarded[path_index] = str(shared_path)
81
+ return forwarded, local_path, shared_path
82
+
83
+
84
+ def _prepare_asset(arguments: list[str]) -> tuple[list[str], Path | None, Path | None]:
85
+ forwarded = list(arguments)
86
+ command_index = _command_index(forwarded)
87
+ if command_index is None or forwarded[command_index] != "save-asset":
88
+ return forwarded, None, None
89
+ tail = forwarded[command_index + 1 :]
90
+ if len(tail) != 2:
91
+ # Let the gateway reject the malformed command with its own message.
92
+ return forwarded, None, None
93
+ local_path = Path(tail[1])
94
+ shared_path = SHARED_ROOT / f"asset-{uuid.uuid4().hex}"
95
+ forwarded[command_index + 2] = str(shared_path)
96
+ return forwarded, local_path, shared_path
97
+
98
+
99
+ def main() -> int:
100
+ translated = _translate_candidate_origin(sys.argv[1:])
101
+ arguments, local_screenshot, shared_screenshot = _prepare_screenshot(translated)
102
+ if local_screenshot is None:
103
+ arguments, local_screenshot, shared_screenshot = _prepare_asset(arguments)
104
+ request = urllib.request.Request(
105
+ GATEWAY_URL,
106
+ data=json.dumps({"argv": arguments}, separators=(",", ":")).encode("utf-8"),
107
+ headers={"Content-Type": "application/json"},
108
+ method="POST",
109
+ )
110
+ try:
111
+ with urllib.request.urlopen(request, timeout=240) as response:
112
+ payload = json.load(response)
113
+ except urllib.error.HTTPError as exc:
114
+ try:
115
+ detail = json.loads(exc.read().decode("utf-8")).get("error")
116
+ except (UnicodeError, ValueError, AttributeError):
117
+ detail = None
118
+ print(detail or f"Browser Use gateway refused the command (HTTP {exc.code})", file=sys.stderr)
119
+ return 2
120
+ except (OSError, UnicodeError, ValueError) as exc:
121
+ print(f"Browser Use gateway unavailable: {exc}", file=sys.stderr)
122
+ return 2
123
+
124
+ stdout = payload.get("stdout", "")
125
+ stderr = payload.get("stderr", "")
126
+ if local_screenshot is not None and shared_screenshot is not None:
127
+ # The shared file is moved to the caller's path below; report that path, not the
128
+ # transient gateway-owned one, so a later read of the printed path succeeds.
129
+ if isinstance(stdout, str):
130
+ stdout = stdout.replace(str(shared_screenshot), str(local_screenshot))
131
+ if isinstance(stderr, str):
132
+ stderr = stderr.replace(str(shared_screenshot), str(local_screenshot))
133
+ if isinstance(stdout, str) and stdout:
134
+ print(stdout, end="" if stdout.endswith("\n") else "\n")
135
+ if isinstance(stderr, str) and stderr:
136
+ print(stderr, end="" if stderr.endswith("\n") else "\n", file=sys.stderr)
137
+
138
+ if local_screenshot is not None and shared_screenshot is not None and shared_screenshot.exists():
139
+ try:
140
+ local_screenshot.parent.mkdir(parents=True, exist_ok=True)
141
+ shutil.copyfile(shared_screenshot, local_screenshot)
142
+ shared_screenshot.unlink(missing_ok=True)
143
+ except OSError as exc:
144
+ print(f"Browser file transfer failed: {exc}", file=sys.stderr)
145
+ return 2
146
+
147
+ exit_code = payload.get("exit_code", 2)
148
+ return exit_code if isinstance(exit_code, int) and 0 <= exit_code <= 255 else 2
149
+
150
+
151
+ if __name__ == "__main__":
152
+ raise SystemExit(main())
tasks/asana/environment/agent-browser/gateway.py ADDED
@@ -0,0 +1,524 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Constrained Browser Use command gateway for browser-only references.
3
+
4
+ The gateway is the only process that joins the reference network. It exposes
5
+ interactive browser actions, but deliberately excludes arbitrary Python,
6
+ JavaScript evaluation, DOM serialization, cloud/tunnel commands, and direct
7
+ CDP attachment. The Agent container can inspect the rendered site without
8
+ obtaining a general-purpose HTTP path to its source responses.
9
+
10
+ Static assets are the one exception to that boundary. ``assets`` lists the
11
+ reference-origin images, icons, fonts and media the current page uses, and
12
+ ``save-asset`` copies one of them into the Agent's repository. Stylesheets and
13
+ scripts are the reference's code: formal runs never hand them to the Agent, so
14
+ both commands refuse them, as they refuse documents and API responses.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ import json
20
+ import os
21
+ import re
22
+ import ssl
23
+ import subprocess
24
+ import threading
25
+ import urllib.error
26
+ import urllib.parse
27
+ import urllib.request
28
+ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
29
+ from pathlib import Path
30
+ from typing import Any
31
+
32
+
33
+ MAX_REQUEST_BYTES = 64 * 1024
34
+ MAX_OUTPUT_BYTES = 4 * 1024 * 1024
35
+ COMMAND_TIMEOUT_SEC = 180
36
+ SESSION_PATTERN = re.compile(r"[A-Za-z0-9][A-Za-z0-9_.-]{0,63}\Z")
37
+ SHARED_ROOT = Path("/browser-share").resolve()
38
+ ASSET_MAX_BYTES = 32 * 1024 * 1024
39
+ ASSET_TIMEOUT_SEC = 60
40
+ ASSET_LIST_LIMIT = 2000
41
+ ASSET_SHARED_NAME = re.compile(r"asset-[0-9a-f]{32}\Z")
42
+ # Static media only: a document, JSON or other API body is never an asset, and neither is
43
+ # a stylesheet or script (the agent must not receive the reference's CSS or JavaScript).
44
+ STATIC_CONTENT_PREFIXES = ("image/", "font/", "audio/", "video/")
45
+ STATIC_CONTENT_TYPES = frozenset(
46
+ {
47
+ "application/font-woff",
48
+ "application/font-woff2",
49
+ "application/x-font-woff",
50
+ "application/x-font-ttf",
51
+ "application/x-font-otf",
52
+ "application/font-sfnt",
53
+ "application/vnd.ms-fontobject",
54
+ }
55
+ )
56
+ # Servers often label fonts and media application/octet-stream; accept that
57
+ # label only when the path itself names a static file.
58
+ STATIC_EXTENSIONS = frozenset(
59
+ {
60
+ ".png", ".jpg", ".jpeg", ".gif", ".webp", ".avif", ".svg", ".ico", ".bmp",
61
+ ".woff", ".woff2", ".ttf", ".otf", ".eot",
62
+ ".mp4", ".webm", ".ogv", ".mp3", ".ogg", ".wav", ".m4a",
63
+ }
64
+ )
65
+ # Reference code is refused whatever its declared type: a script served as octet-stream or a
66
+ # stylesheet under an image-like path must not pass.
67
+ CODE_CONTENT_TYPES = frozenset(
68
+ {
69
+ "text/css",
70
+ "text/javascript",
71
+ "text/ecmascript",
72
+ "application/javascript",
73
+ "application/x-javascript",
74
+ "application/ecmascript",
75
+ "application/wasm",
76
+ }
77
+ )
78
+ CODE_EXTENSIONS = frozenset({".css", ".scss", ".less", ".js", ".mjs", ".cjs", ".jsx", ".ts", ".tsx", ".map", ".wasm"})
79
+ # Gateway-owned inventory script: returns only URLs the page references or loaded.
80
+ ASSET_INVENTORY_JS = r"""JSON.stringify((() => {
81
+ const found = new Set();
82
+ const add = (value, base) => { try { if (value) found.add(new URL(value, base || location.href).href); } catch (e) {} };
83
+ const urls = (text, base) => { for (const m of String(text || '').matchAll(/url\(\s*["']?([^"')]+)["']?\s*\)/g)) add(m[1], base); };
84
+ for (const entry of performance.getEntriesByType('resource')) add(entry.name);
85
+ for (const image of document.images) { add(image.currentSrc); add(image.src); }
86
+ for (const node of document.querySelectorAll('link[href]')) add(node.href);
87
+ for (const node of document.querySelectorAll('script[src]')) add(node.src);
88
+ for (const node of document.querySelectorAll('source[src], source[srcset], video[src], video[poster], audio[src], img[srcset]')) {
89
+ add(node.src); add(node.poster);
90
+ for (const part of String(node.srcset || '').split(',')) add(part.trim().split(/\s+/)[0]);
91
+ }
92
+ let count = 0;
93
+ for (const element of document.querySelectorAll('*')) {
94
+ if (++count > 5000) break;
95
+ const style = getComputedStyle(element);
96
+ urls(style.backgroundImage); urls(style.listStyleImage); urls(style.content);
97
+ }
98
+ for (const sheet of document.styleSheets) {
99
+ try { for (const rule of sheet.cssRules) urls(rule.cssText, sheet.href || location.href); } catch (e) {}
100
+ }
101
+ return [...found];
102
+ })())"""
103
+ REAL_BROWSER_USE = os.environ.get(
104
+ "WEBSITEBENCH_BROWSER_USE_REAL",
105
+ "/usr/local/bin/browser-use-real",
106
+ )
107
+ SAFE_COMMANDS = frozenset(
108
+ {
109
+ "open",
110
+ "click",
111
+ "type",
112
+ "input",
113
+ "scroll",
114
+ "back",
115
+ "screenshot",
116
+ "state",
117
+ "switch",
118
+ "close-tab",
119
+ "keys",
120
+ "select",
121
+ "hover",
122
+ "dblclick",
123
+ "rightclick",
124
+ "cookies",
125
+ "close",
126
+ "sessions",
127
+ }
128
+ )
129
+ FORBIDDEN_COMMANDS = frozenset(
130
+ {
131
+ "install",
132
+ "init",
133
+ "setup",
134
+ "doctor",
135
+ "upload",
136
+ "eval",
137
+ "extract",
138
+ "get",
139
+ "python",
140
+ "tunnel",
141
+ "cloud",
142
+ "profile",
143
+ "wait",
144
+ }
145
+ )
146
+ FORBIDDEN_GLOBAL_OPTIONS = frozenset(
147
+ {"--headed", "--profile", "--cdp-url", "--connect", "--mcp", "--template"}
148
+ )
149
+
150
+
151
+ class CommandRejected(ValueError):
152
+ """Raised when an Agent command crosses the browser-only boundary."""
153
+
154
+
155
+ def _origin(value: str) -> tuple[str, str, int]:
156
+ parsed = urllib.parse.urlsplit(value)
157
+ if parsed.scheme not in {"http", "https"} or not parsed.hostname:
158
+ raise ValueError(f"invalid browser origin: {value!r}")
159
+ port = parsed.port or (443 if parsed.scheme == "https" else 80)
160
+ return parsed.scheme, parsed.hostname.lower(), port
161
+
162
+
163
+ def allowed_origins() -> frozenset[tuple[str, str, int]]:
164
+ values = (
165
+ os.environ.get(
166
+ "WEBSITEBENCH_BROWSER_REFERENCE_URL", "https://reference:8080"
167
+ ),
168
+ os.environ.get(
169
+ "WEBSITEBENCH_BROWSER_CANDIDATE_URL", "http://candidate:3000"
170
+ ),
171
+ os.environ.get(
172
+ "WEBSITEBENCH_BROWSER_MAILBOX_URL", "http://mailbox:8026"
173
+ ),
174
+ )
175
+ return frozenset(_origin(value) for value in values)
176
+
177
+
178
+ def reference_origin() -> tuple[str, str, int]:
179
+ return _origin(
180
+ os.environ.get("WEBSITEBENCH_BROWSER_REFERENCE_URL", "https://reference:8080")
181
+ )
182
+
183
+
184
+ def _reference_asset_url(value: str) -> str:
185
+ try:
186
+ requested = _origin(value)
187
+ except (TypeError, ValueError) as exc:
188
+ raise CommandRejected(str(exc)) from exc
189
+ if requested != reference_origin():
190
+ raise CommandRejected("static assets can only be saved from the reference origin")
191
+ parsed = urllib.parse.urlsplit(value)
192
+ if parsed.username is not None or parsed.password is not None:
193
+ raise CommandRejected("asset URL must not carry credentials")
194
+ return urllib.parse.urlunsplit(parsed._replace(fragment=""))
195
+
196
+
197
+ def is_reference_code(url: str, content_type: str = "") -> bool:
198
+ media = content_type.split(";", 1)[0].strip().lower()
199
+ suffix = Path(urllib.parse.urlsplit(url).path).suffix.lower()
200
+ return media in CODE_CONTENT_TYPES or suffix in CODE_EXTENSIONS
201
+
202
+
203
+ def is_static_asset(url: str, content_type: str) -> bool:
204
+ if is_reference_code(url, content_type):
205
+ return False
206
+ media = content_type.split(";", 1)[0].strip().lower()
207
+ if media.startswith(STATIC_CONTENT_PREFIXES) or media in STATIC_CONTENT_TYPES:
208
+ return True
209
+ suffix = Path(urllib.parse.urlsplit(url).path).suffix.lower()
210
+ return media in {"application/octet-stream", "binary/octet-stream", ""} and suffix in STATIC_EXTENSIONS
211
+
212
+
213
+ def _parse_global_options(arguments: list[str]) -> tuple[str, int]:
214
+ session = "default"
215
+ index = 0
216
+ while index < len(arguments):
217
+ value = arguments[index]
218
+ if value == "--session":
219
+ if index + 1 >= len(arguments):
220
+ raise CommandRejected("--session requires a value")
221
+ session = arguments[index + 1]
222
+ index += 2
223
+ continue
224
+ if value.startswith("--session="):
225
+ session = value.partition("=")[2]
226
+ index += 1
227
+ continue
228
+ if value == "--json":
229
+ index += 1
230
+ continue
231
+ if value in {"-h", "--help"}:
232
+ break
233
+ if value in FORBIDDEN_GLOBAL_OPTIONS or any(
234
+ value.startswith(option + "=") for option in FORBIDDEN_GLOBAL_OPTIONS
235
+ ):
236
+ raise CommandRejected(f"Browser Use option {value!r} is disabled")
237
+ if value.startswith("-"):
238
+ raise CommandRejected(f"unsupported Browser Use option {value!r}")
239
+ break
240
+ if not SESSION_PATTERN.fullmatch(session):
241
+ raise CommandRejected("invalid Browser Use session name")
242
+ return session, index
243
+
244
+
245
+ def validate_command(raw_arguments: Any) -> list[str]:
246
+ if not isinstance(raw_arguments, list) or not raw_arguments:
247
+ raise CommandRejected("argv must be a non-empty string array")
248
+ if len(raw_arguments) > 128:
249
+ raise CommandRejected("too many Browser Use arguments")
250
+ arguments: list[str] = []
251
+ for value in raw_arguments:
252
+ if not isinstance(value, str) or "\x00" in value or len(value) > 16_384:
253
+ raise CommandRejected("invalid Browser Use argument")
254
+ arguments.append(value)
255
+
256
+ for value in arguments:
257
+ if value in FORBIDDEN_GLOBAL_OPTIONS or any(
258
+ value.startswith(option + "=") for option in FORBIDDEN_GLOBAL_OPTIONS
259
+ ):
260
+ raise CommandRejected(f"Browser Use option {value!r} is disabled")
261
+
262
+ _session, command_index = _parse_global_options(arguments)
263
+ if (
264
+ command_index == len(arguments) - 1
265
+ and arguments[command_index] in {"-h", "--help"}
266
+ ):
267
+ return arguments
268
+ if command_index >= len(arguments):
269
+ raise CommandRejected("missing Browser Use command")
270
+ command = arguments[command_index]
271
+ if command == "assets":
272
+ if len(arguments) != command_index + 1:
273
+ raise CommandRejected("assets takes no arguments; it lists the current page")
274
+ return arguments
275
+ if command == "save-asset":
276
+ tail = arguments[command_index + 1 :]
277
+ if len(tail) != 2:
278
+ raise CommandRejected("save-asset requires a reference asset URL and a destination path")
279
+ url = _reference_asset_url(tail[0])
280
+ if is_reference_code(url):
281
+ raise CommandRejected("reference stylesheets and scripts are not available to the agent")
282
+ destination = Path(tail[1]).resolve()
283
+ if destination.parent != SHARED_ROOT or ASSET_SHARED_NAME.fullmatch(destination.name) is None:
284
+ raise CommandRejected("saved assets must use one gateway-owned path")
285
+ return arguments[: command_index + 1] + [url, str(destination)]
286
+ if command in FORBIDDEN_COMMANDS:
287
+ raise CommandRejected(
288
+ f"Browser Use command {command!r} is disabled for browser-only references"
289
+ )
290
+ if command not in SAFE_COMMANDS:
291
+ raise CommandRejected(f"unsupported Browser Use command {command!r}")
292
+
293
+ if command == "open":
294
+ urls = [
295
+ value
296
+ for value in arguments[command_index + 1 :]
297
+ if "://" in value
298
+ ]
299
+ if len(urls) != 1:
300
+ raise CommandRejected("open requires exactly one absolute URL")
301
+ try:
302
+ requested_origin = _origin(urls[0])
303
+ except (TypeError, ValueError) as exc:
304
+ raise CommandRejected(str(exc)) from exc
305
+ if requested_origin not in allowed_origins():
306
+ raise CommandRejected("browser navigation target is outside task origins")
307
+
308
+ if command == "screenshot":
309
+ # The bundled Browser Use CLI is `screenshot [--full] [path]`; accept the spellings
310
+ # agents reach for (`--full-page`, `--path X`, `--path=X`) and hand the CLI its own.
311
+ path_values: list[str] = []
312
+ options: list[str] = []
313
+ tail = arguments[command_index + 1 :]
314
+ index = 0
315
+ while index < len(tail):
316
+ value = tail[index]
317
+ if value == "--path":
318
+ if index + 1 >= len(tail):
319
+ raise CommandRejected("screenshot --path requires a value")
320
+ path_values.append(tail[index + 1])
321
+ index += 2
322
+ continue
323
+ if value.startswith("--path="):
324
+ path_values.append(value.partition("=")[2])
325
+ index += 1
326
+ continue
327
+ if value in {"--full", "--full-page"}:
328
+ if "--full" not in options:
329
+ options.append("--full")
330
+ index += 1
331
+ continue
332
+ if value in {"--json", "-h", "--help"}:
333
+ options.append(value)
334
+ index += 1
335
+ continue
336
+ if value.startswith("-"):
337
+ raise CommandRejected(f"unsupported screenshot option {value!r}")
338
+ path_values.append(value)
339
+ index += 1
340
+ paths = [Path(value).resolve() for value in path_values]
341
+ if (
342
+ len(paths) != 1
343
+ or paths[0].parent != SHARED_ROOT
344
+ or re.fullmatch(r"screenshot-[0-9a-f]{32}\.png", paths[0].name) is None
345
+ ):
346
+ raise CommandRejected("screenshots must use one gateway-owned PNG path")
347
+ return arguments[: command_index + 1] + options + [str(paths[0])]
348
+
349
+ return arguments
350
+
351
+
352
+ _COMMAND_LOCK = threading.Lock()
353
+
354
+
355
+ def execute(arguments: list[str]) -> dict[str, Any]:
356
+ with _COMMAND_LOCK:
357
+ try:
358
+ completed = subprocess.run(
359
+ [REAL_BROWSER_USE, *arguments],
360
+ stdin=subprocess.DEVNULL,
361
+ stdout=subprocess.PIPE,
362
+ stderr=subprocess.PIPE,
363
+ timeout=COMMAND_TIMEOUT_SEC,
364
+ check=False,
365
+ )
366
+ except subprocess.TimeoutExpired as exc:
367
+ raise CommandRejected("Browser Use command exceeded 180 seconds") from exc
368
+ except OSError as exc:
369
+ raise CommandRejected(f"Browser Use runtime unavailable: {exc}") from exc
370
+ stdout = completed.stdout[:MAX_OUTPUT_BYTES]
371
+ stderr = completed.stderr[:MAX_OUTPUT_BYTES]
372
+ if len(completed.stdout) > MAX_OUTPUT_BYTES or len(completed.stderr) > MAX_OUTPUT_BYTES:
373
+ raise CommandRejected("Browser Use output exceeded the interactive limit")
374
+ return {
375
+ "exit_code": completed.returncode,
376
+ "stdout": stdout.decode("utf-8", errors="replace"),
377
+ "stderr": stderr.decode("utf-8", errors="replace"),
378
+ }
379
+
380
+
381
+ GATEWAY_HELP = """
382
+ WebsiteBench gateway commands:
383
+ assets List the reference-origin images, icons, fonts and media that the
384
+ current page references or loaded.
385
+ save-asset URL PATH Save one of those assets to PATH (for example under /app/repo).
386
+ Stylesheets, scripts, HTML documents, JSON and other API responses are refused.
387
+ """
388
+
389
+
390
+ def _find_result(value: Any) -> Any:
391
+ if isinstance(value, dict):
392
+ if "result" in value:
393
+ return value["result"]
394
+ for nested in value.values():
395
+ found = _find_result(nested)
396
+ if found is not None:
397
+ return found
398
+ return None
399
+
400
+
401
+ def list_assets(arguments: list[str], command_index: int) -> dict[str, Any]:
402
+ inventory = execute(arguments[:command_index] + ["--json", "eval", ASSET_INVENTORY_JS])
403
+ if inventory["exit_code"] != 0:
404
+ return {"exit_code": inventory["exit_code"], "stdout": "", "stderr": "could not list assets: " + inventory["stderr"][-400:]}
405
+ try:
406
+ urls = json.loads(_find_result(json.loads(inventory["stdout"])) or "[]")
407
+ except (TypeError, ValueError):
408
+ return {"exit_code": 1, "stdout": "", "stderr": "could not list assets: no page is open"}
409
+ origin = reference_origin()
410
+ assets = []
411
+ for url in urls if isinstance(urls, list) else []:
412
+ try:
413
+ if not isinstance(url, str) or _origin(url) != origin:
414
+ continue
415
+ except ValueError:
416
+ continue
417
+ path = urllib.parse.urlsplit(url).path
418
+ if is_reference_code(url):
419
+ continue
420
+ if Path(path).suffix.lower() in STATIC_EXTENSIONS or "/static/" in path or "/assets/" in path:
421
+ assets.append(urllib.parse.urlunsplit(urllib.parse.urlsplit(url)._replace(fragment="")))
422
+ assets = sorted(set(assets))[:ASSET_LIST_LIMIT]
423
+ text = "\n".join(assets) + ("\n" if assets else "no reference static assets found on the current page\n")
424
+ return {"exit_code": 0, "stdout": text, "stderr": ""}
425
+
426
+
427
+ class _SameOriginRedirect(urllib.request.HTTPRedirectHandler):
428
+ def redirect_request(self, req, fp, code, msg, headers, newurl): # type: ignore[override]
429
+ _reference_asset_url(urllib.parse.urljoin(req.full_url, newurl))
430
+ return super().redirect_request(req, fp, code, msg, headers, newurl)
431
+
432
+
433
+ def save_asset(url: str, destination: Path) -> dict[str, Any]:
434
+ opener = urllib.request.build_opener(
435
+ urllib.request.HTTPSHandler(context=ssl.create_default_context()), _SameOriginRedirect()
436
+ )
437
+ request = urllib.request.Request(url, headers={"User-Agent": "WebsiteBenchAssetGateway/1", "Accept": "*/*"})
438
+ try:
439
+ with opener.open(request, timeout=ASSET_TIMEOUT_SEC) as response:
440
+ content_type = response.headers.get("Content-Type", "")
441
+ final_url = response.geturl()
442
+ if is_reference_code(final_url, content_type):
443
+ raise CommandRejected(f"refused stylesheet or script ({content_type or 'no content type'}): reference CSS and JavaScript are not available to the agent")
444
+ if not is_static_asset(final_url, content_type):
445
+ raise CommandRejected(f"refused non-static response ({content_type or 'no content type'})")
446
+ body = response.read(ASSET_MAX_BYTES + 1)
447
+ except urllib.error.HTTPError as exc:
448
+ raise CommandRejected(f"reference returned HTTP {exc.code} for {url}") from exc
449
+ except (urllib.error.URLError, OSError) as exc:
450
+ raise CommandRejected(f"asset download failed: {exc}") from exc
451
+ if len(body) > ASSET_MAX_BYTES:
452
+ raise CommandRejected("asset exceeds the 32 MiB limit")
453
+ temporary = destination.with_name(destination.name + ".partial")
454
+ temporary.write_bytes(body)
455
+ os.replace(temporary, destination)
456
+ return {
457
+ "exit_code": 0,
458
+ "stdout": f"saved {url} -> {destination} ({len(body)} bytes, {content_type.split(';', 1)[0].strip() or 'unknown type'})\n",
459
+ "stderr": "",
460
+ }
461
+
462
+
463
+ def run(arguments: list[str]) -> dict[str, Any]:
464
+ _session, command_index = _parse_global_options(arguments)
465
+ command = arguments[command_index] if command_index < len(arguments) else None
466
+ if command == "assets":
467
+ return list_assets(arguments, command_index)
468
+ if command == "save-asset":
469
+ return save_asset(arguments[command_index + 1], Path(arguments[command_index + 2]))
470
+ result = execute(arguments)
471
+ if command in {None, "-h", "--help"}:
472
+ result["stdout"] = result["stdout"] + GATEWAY_HELP
473
+ return result
474
+
475
+
476
+ class Handler(BaseHTTPRequestHandler):
477
+ server_version = "WebsiteBenchBrowserGateway/1"
478
+
479
+ def log_message(self, _format: str, *_arguments: object) -> None:
480
+ return
481
+
482
+ def _send(self, status: int, value: dict[str, Any]) -> None:
483
+ body = json.dumps(value, separators=(",", ":")).encode("utf-8")
484
+ self.send_response(status)
485
+ self.send_header("Content-Type", "application/json")
486
+ self.send_header("Content-Length", str(len(body)))
487
+ self.send_header("Cache-Control", "no-store")
488
+ self.end_headers()
489
+ self.wfile.write(body)
490
+
491
+ def do_GET(self) -> None:
492
+ if self.path == "/healthz":
493
+ self._send(200, {"status": "ok"})
494
+ else:
495
+ self._send(404, {"error": "not_found"})
496
+
497
+ def do_POST(self) -> None:
498
+ if self.path != "/v1/command":
499
+ self._send(404, {"error": "not_found"})
500
+ return
501
+ try:
502
+ length = int(self.headers.get("Content-Length", ""))
503
+ if length <= 0 or length > MAX_REQUEST_BYTES:
504
+ raise CommandRejected("invalid request size")
505
+ payload = json.loads(self.rfile.read(length))
506
+ if not isinstance(payload, dict) or set(payload) != {"argv"}:
507
+ raise CommandRejected("request must contain only argv")
508
+ result = run(validate_command(payload["argv"]))
509
+ except (CommandRejected, json.JSONDecodeError, UnicodeError, ValueError) as exc:
510
+ self._send(400, {"error": str(exc)})
511
+ return
512
+ self._send(200, result)
513
+
514
+
515
+ def main() -> None:
516
+ bind = os.environ.get("WEBSITEBENCH_BROWSER_GATEWAY_BIND", "0.0.0.0")
517
+ port = int(os.environ.get("WEBSITEBENCH_BROWSER_GATEWAY_PORT", "9224"))
518
+ server = ThreadingHTTPServer((bind, port), Handler)
519
+ server.daemon_threads = True
520
+ server.serve_forever()
521
+
522
+
523
+ if __name__ == "__main__":
524
+ main()
tasks/asana/environment/candidate-abi/websitebench-candidate-preflight ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ set -eu
3
+ PYTHONPATH=/opt/websitebench/candidate-abi
4
+ export PYTHONPATH
5
+ exec python3 -m websitebench.harbor.candidate_preflight "$@"
tasks/asana/environment/mailbox/Dockerfile ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ FROM python:3.12.11-slim-bookworm@sha256:519591d6871b7bc437060736b9f7456b8731f1499a57e22e6c285135ae657bf7
2
+ WORKDIR /srv/mailbox
3
+ COPY mailbox.py .
4
+ HEALTHCHECK --interval=2s --timeout=2s --retries=30 CMD python -c "import os,urllib.request as r;a=os.environ.get('WEBSITEBENCH_MAILBOX_API_BIND') or '127.0.0.1';i=os.environ.get('WEBSITEBENCH_MAILBOX_INBOX_BIND') or '127.0.0.1';r.urlopen(f'http://{a}:8025/healthz',timeout=1);r.urlopen(f'http://{i}:8026/healthz',timeout=1)"
5
+ CMD ["python", "mailbox.py", "--smtp-port", "1025", "--http-port", "8025", "--inbox-port", "8026"]
tasks/asana/environment/mailbox/mailbox.py ADDED
@@ -0,0 +1,2433 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Local-only mail writers plus Inbox HTTP sidecar for deterministic tasks.
2
+
3
+ The sidecar serves two disjoint listeners so the agent and the evaluator never
4
+ share a surface:
5
+
6
+ ``api``
7
+ The Bearer-gated JSON API plus ``/internal/bootstrap``. The reference site
8
+ and the evaluator reach it; it is where every capability lives.
9
+ ``inbox``
10
+ An HTML-only inbox for exactly one namespace, reachable without a
11
+ credential because a browser has none to present. It exposes no JSON, no
12
+ capability, and no way to name a second namespace.
13
+
14
+ Formal candidates receive a separate per-case write listener. Its primary
15
+ surface is a text-only Resend-style ``POST /emails`` API; legacy SMTP and the
16
+ ``websitebench.site_backend`` bootstrap remain compatibility writers. None of
17
+ those surfaces exposes an inbox or a JSON read route.
18
+
19
+ This module is copied *alone* into the mailbox container build context, so it
20
+ must stay self-contained: no imports outside the standard library.
21
+ """
22
+
23
+ from __future__ import annotations
24
+
25
+ import email
26
+ import hashlib
27
+ import hmac
28
+ import html
29
+ import http.client
30
+ import json
31
+ import os
32
+ import re
33
+ import secrets
34
+ import shutil
35
+ import socket
36
+ import socketserver
37
+ import signal
38
+ import subprocess
39
+ import sys
40
+ import tempfile
41
+ import threading
42
+ import time
43
+ import urllib.parse
44
+ from collections.abc import Mapping
45
+ from dataclasses import dataclass, field, replace
46
+ from email.message import EmailMessage
47
+ from email.policy import default
48
+ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
49
+ from typing import Any
50
+
51
+
52
+ _NAMESPACE = re.compile(r"^[a-zA-Z0-9._-]{1,160}$")
53
+ _OTP = re.compile(r"(?<!\d)(\d{4,8})(?!\d)")
54
+ _MAX_MESSAGE_BYTES = 1024 * 1024
55
+ _MAX_MESSAGES_PER_NAMESPACE = 32
56
+ _MAX_STORED_BYTES_PER_NAMESPACE = 2 * 1024 * 1024
57
+ _MAX_RECIPIENTS = 16
58
+ _MAX_COMMANDS_PER_CONNECTION = 256
59
+ _CONNECTION_TIMEOUT_SECONDS = 10
60
+ _MAX_CONNECTION_LIFETIME_SECONDS = 30
61
+ _MAX_CONCURRENT_CONNECTIONS = 16
62
+ MAILPIT_IMAGE = (
63
+ "ghcr.io/axllent/mailpit:v1.30.6@"
64
+ "sha256:7f33095f80e901f6ad08028f06ca284aa58fe84942be5496008d041d3b9f4d4d"
65
+ )
66
+ #: The one variable that names the Mailpit a trial or capture must use. It is
67
+ #: read in exactly one place, :meth:`MailPlane.from_environment`.
68
+ MAILPIT_HTTP_SOCKET_ENV = "WEBSITEBENCH_MAILPIT_HTTP_SOCKET"
69
+ #: Where Mailpit's private sockets live inside the compose sidecar. A value
70
+ #: mentioning this path in a candidate environment is an evaluator-side leak.
71
+ MAILPIT_RUNTIME_DIR = "/run/websitebench-mailpit"
72
+ #: The envelope sender every benchmark mail writer presents. Some captured
73
+ #: runtimes pin this exact suffix before opening SMTP, so paired capture and a
74
+ #: scored candidate trial must agree on it to the byte.
75
+ CANDIDATE_MAIL_SENDER = "no-reply@candidate.websitebench.local"
76
+ #: The complete optional mail ABI a candidate runtime may be handed. Nothing
77
+ #: outside this set ever reaches a candidate process.
78
+ CANDIDATE_MAIL_ENVIRONMENT = frozenset(
79
+ {
80
+ "WEBSITEBENCH_MAIL_API_URL",
81
+ "WEBSITEBENCH_MAIL_API_TOKEN",
82
+ "WEBSITEBENCH_MAIL_FROM",
83
+ "WEBSITEBENCH_SMTP_HOST",
84
+ "WEBSITEBENCH_SMTP_PORT",
85
+ "WEBSITEBENCH_SMTP_FROM",
86
+ "WEBSITEBENCH_MAILBOX_BOOTSTRAP_URL",
87
+ "WEBSITEBENCH_MAILBOX_BOOTSTRAP_TOKEN",
88
+ }
89
+ )
90
+ #: Every mail variable an authoring capture exports into its own process, so
91
+ #: capture can save and restore exactly this set around a shard.
92
+ AUTHORING_MAIL_ENVIRONMENT = (
93
+ "WEBSITEBENCH_MAIL_API_URL",
94
+ "WEBSITEBENCH_MAIL_API_TOKEN",
95
+ "WEBSITEBENCH_MAIL_FROM",
96
+ "WEBSITEBENCH_SMTP_FROM",
97
+ "WEBSITEBENCH_MAILBOX_URL",
98
+ "WEBSITEBENCH_MAILBOX_ALLOWLIST",
99
+ "WEBSITEBENCH_MAILBOX_NAMESPACE",
100
+ "WEBSITEBENCH_SMTP_HOST",
101
+ "WEBSITEBENCH_SMTP_PORT",
102
+ "WEBSITEBENCH_MAILBOX_BOOTSTRAP_URL",
103
+ "WEBSITEBENCH_MAILBOX_BOOTSTRAP_TOKEN",
104
+ "WEBSITEBENCH_MAILBOX_CREDENTIAL",
105
+ )
106
+ _LOG_SECRET = re.compile(
107
+ r"(?i)(?:bearer\s+[^\s\"']+|"
108
+ r"(?:authorization|cookie|credential|password|secret|token|otp|"
109
+ r"verification[-_ ]?code|card[-_ ]?number)\s*[:=]\s*"
110
+ r"(?:bearer\s+)?[^\s,;]+)"
111
+ )
112
+
113
+
114
+ class MailpitInfrastructureError(RuntimeError):
115
+ """Mailpit is missing or unhealthy, as distinct from rejected candidate mail."""
116
+
117
+
118
+ class MailInfrastructureUnavailable(MailpitInfrastructureError):
119
+ """No Mailpit is configured for this process, or the configured one is down."""
120
+
121
+
122
+ class MailboxCapacityError(RuntimeError):
123
+ """A namespace exhausted its fixed message or submitted-byte quota."""
124
+
125
+
126
+ class _UnixHTTPConnection(http.client.HTTPConnection):
127
+ """A minimal HTTP/1.1 connection transported over one Unix socket."""
128
+
129
+ def __init__(self, socket_path: str, timeout: float) -> None:
130
+ super().__init__("localhost", timeout=timeout)
131
+ self._socket_path = socket_path
132
+
133
+ def connect(self) -> None:
134
+ connection = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
135
+ connection.settimeout(self.timeout)
136
+ connection.connect(self._socket_path)
137
+ self.sock = connection
138
+
139
+
140
+ class MailpitClient:
141
+ """Trusted Mailpit client: HTTP UDS reads and sibling SMTP UDS writes.
142
+
143
+ This is intentionally not a general Mailpit client. It never exposes the
144
+ UI, delete, release, tag-mutation, or remote-content endpoints. All
145
+ candidate-authored control headers are discarded and the SMTP writer adds
146
+ exactly one trusted tag.
147
+ """
148
+
149
+ _MAX_RESPONSE_BYTES = 8 * 1024 * 1024
150
+
151
+ def __init__(
152
+ self,
153
+ socket_path: str | os.PathLike[str],
154
+ *,
155
+ smtp_socket_path: str | os.PathLike[str] | None = None,
156
+ timeout: float = 5.0,
157
+ ) -> None:
158
+ self.socket_path = os.fspath(socket_path)
159
+ if not self.socket_path:
160
+ raise ValueError("Mailpit HTTP socket path must not be empty")
161
+ if timeout <= 0:
162
+ raise ValueError("Mailpit timeout must be positive")
163
+ self.smtp_socket_path = (
164
+ os.fspath(smtp_socket_path)
165
+ if smtp_socket_path is not None
166
+ else os.path.join(os.path.dirname(self.socket_path), "smtp.sock")
167
+ )
168
+ self.timeout = float(timeout)
169
+
170
+ def _request(
171
+ self, method: str, path: str, body: dict[str, Any] | None = None
172
+ ) -> tuple[int, bytes]:
173
+ encoded = None if body is None else json.dumps(body).encode("utf-8")
174
+ headers = {"Accept": "application/json", "Connection": "close"}
175
+ if encoded is not None:
176
+ headers["Content-Type"] = "application/json"
177
+ headers["Content-Length"] = str(len(encoded))
178
+ connection = _UnixHTTPConnection(self.socket_path, self.timeout)
179
+ try:
180
+ connection.request(method, path, body=encoded, headers=headers)
181
+ response = connection.getresponse()
182
+ length = response.getheader("Content-Length")
183
+ if length is not None and int(length) > self._MAX_RESPONSE_BYTES:
184
+ raise MailpitInfrastructureError("Mailpit response exceeded limit")
185
+ value = response.read(self._MAX_RESPONSE_BYTES + 1)
186
+ if len(value) > self._MAX_RESPONSE_BYTES:
187
+ raise MailpitInfrastructureError("Mailpit response exceeded limit")
188
+ return int(response.status), value
189
+ except (OSError, TimeoutError, http.client.HTTPException, ValueError) as error:
190
+ raise MailpitInfrastructureError(
191
+ f"Mailpit request failed: {redact_text(str(error))}"
192
+ ) from error
193
+ finally:
194
+ connection.close()
195
+
196
+ def _json(
197
+ self, method: str, path: str, body: dict[str, Any] | None = None
198
+ ) -> dict[str, Any]:
199
+ status, raw = self._request(method, path, body)
200
+ if not 200 <= status < 300:
201
+ raise MailpitInfrastructureError(f"Mailpit API returned HTTP {status}")
202
+ try:
203
+ value = json.loads(raw)
204
+ except (UnicodeDecodeError, json.JSONDecodeError) as error:
205
+ raise MailpitInfrastructureError("Mailpit returned invalid JSON") from error
206
+ if not isinstance(value, dict):
207
+ raise MailpitInfrastructureError("Mailpit returned an invalid response")
208
+ return value
209
+
210
+ def ready(self) -> bool:
211
+ """Return whether Mailpit's built-in readiness endpoint is healthy."""
212
+
213
+ try:
214
+ status, _body = self._request("GET", "/readyz")
215
+ except MailpitInfrastructureError:
216
+ return False
217
+ return status == 200
218
+
219
+ def send(
220
+ self,
221
+ raw: bytes,
222
+ envelope_from: str,
223
+ recipients: list[str],
224
+ *,
225
+ tag: str,
226
+ ) -> str:
227
+ """Store mail with one trusted tag, ignoring all untrusted X-headers."""
228
+
229
+ if any(
230
+ "\r" in value or "\n" in value for value in [envelope_from, *recipients]
231
+ ):
232
+ raise ValueError("invalid SMTP envelope")
233
+ message = email.message_from_bytes(raw, policy=default)
234
+ for part in message.walk():
235
+ for header in list(part.keys()):
236
+ lowered = header.lower()
237
+ if lowered == "x-tags" or lowered.startswith("x-websitebench-"):
238
+ del part[header]
239
+ for header in ("From", "To", "Cc", "Bcc"):
240
+ if message.get(header) is not None:
241
+ del message[header]
242
+ message["From"] = envelope_from
243
+ message["To"] = ", ".join(recipients)
244
+ message["X-Tags"] = tag
245
+ wire = message.as_bytes(policy=default.clone(linesep="\r\n"))
246
+
247
+ connection = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
248
+ connection.settimeout(self.timeout)
249
+ stream = None
250
+ try:
251
+ connection.connect(self.smtp_socket_path)
252
+ stream = connection.makefile("rb")
253
+
254
+ def response() -> tuple[int, str]:
255
+ lines: list[str] = []
256
+ while True:
257
+ line = stream.readline(65537)
258
+ if not line or len(line) > 65536:
259
+ raise MailpitInfrastructureError(
260
+ "invalid Mailpit SMTP response"
261
+ )
262
+ decoded = line.decode("utf-8", "replace").rstrip("\r\n")
263
+ lines.append(decoded)
264
+ if len(decoded) < 4 or decoded[3:4] != "-":
265
+ break
266
+ try:
267
+ return int(lines[-1][:3]), "\n".join(lines)
268
+ except ValueError as error:
269
+ raise MailpitInfrastructureError(
270
+ "invalid Mailpit SMTP status"
271
+ ) from error
272
+
273
+ def command(value: bytes, expected: set[int]) -> str:
274
+ connection.sendall(value + b"\r\n")
275
+ status, reply = response()
276
+ if status not in expected:
277
+ raise MailpitInfrastructureError(
278
+ f"Mailpit SMTP returned status {status}: "
279
+ f"{redact_text(reply)[:200]}"
280
+ )
281
+ return reply
282
+
283
+ status, _greeting = response()
284
+ if status != 220:
285
+ raise MailpitInfrastructureError(
286
+ "Mailpit SMTP did not greet the gateway"
287
+ )
288
+ command(b"EHLO websitebench.local", {250})
289
+ command(f"MAIL FROM:<{envelope_from}>".encode("utf-8"), {250})
290
+ for recipient in recipients:
291
+ command(f"RCPT TO:<{recipient}>".encode("utf-8"), {250})
292
+ command(b"DATA", {354})
293
+ stuffed = b"\r\n".join(
294
+ (b"." + line if line.startswith(b".") else line)
295
+ for line in wire.split(b"\r\n")
296
+ )
297
+ connection.sendall(stuffed + b"\r\n.\r\n")
298
+ status, reply = response()
299
+ if status != 250:
300
+ raise MailpitInfrastructureError(
301
+ f"Mailpit SMTP returned status {status}: {redact_text(reply)[:200]}"
302
+ )
303
+ match = re.search(r"queued as ([A-Za-z0-9_-]+)", reply)
304
+ return match.group(1) if match else hashlib.sha256(wire).hexdigest()[:24]
305
+ except (OSError, TimeoutError) as error:
306
+ raise MailpitInfrastructureError("Mailpit SMTP request failed") from error
307
+ finally:
308
+ if stream is not None:
309
+ stream.close()
310
+ connection.close()
311
+
312
+ @staticmethod
313
+ def _addresses(value: Any) -> list[str]:
314
+ if not isinstance(value, list):
315
+ return []
316
+ return [
317
+ str(item.get("Address", item.get("Email")))
318
+ for item in value
319
+ if isinstance(item, dict)
320
+ and isinstance(item.get("Address", item.get("Email")), str)
321
+ ]
322
+
323
+ def messages(self, *, tag: str, recipient: str) -> list[dict[str, Any]]:
324
+ """Read only exact-tag, exact-recipient messages, oldest first."""
325
+
326
+ query = urllib.parse.urlencode(
327
+ {"query": f"tag:{tag}", "start": "0", "limit": "512"}
328
+ )
329
+ listing = self._json("GET", f"/api/v1/search?{query}")
330
+ summaries = listing.get("messages", [])
331
+ if not isinstance(summaries, list):
332
+ raise MailpitInfrastructureError(
333
+ "Mailpit returned invalid message summaries"
334
+ )
335
+ values: list[dict[str, Any]] = []
336
+ for summary in reversed(summaries):
337
+ if not isinstance(summary, dict):
338
+ continue
339
+ tags = summary.get("Tags", [])
340
+ all_recipients = (
341
+ self._addresses(summary.get("To"))
342
+ + self._addresses(summary.get("Cc"))
343
+ + self._addresses(summary.get("Bcc"))
344
+ )
345
+ identifier = summary.get("ID")
346
+ if (
347
+ tag not in tags
348
+ or recipient not in all_recipients
349
+ or not isinstance(identifier, str)
350
+ ):
351
+ continue
352
+ detail = self._json(
353
+ "GET", "/api/v1/message/" + urllib.parse.quote(identifier, safe="")
354
+ )
355
+ # Recheck authorization against the detailed record. Search is an
356
+ # index, never an authorization decision.
357
+ detail_tags = detail.get("Tags", [])
358
+ detailed_recipients = (
359
+ self._addresses(detail.get("To"))
360
+ + self._addresses(detail.get("Cc"))
361
+ + self._addresses(detail.get("Bcc"))
362
+ )
363
+ if tag not in detail_tags or recipient not in detailed_recipients:
364
+ continue
365
+ sender = detail.get("From", {})
366
+ attachments = detail.get("Attachments", [])
367
+ inline = detail.get("Inline", [])
368
+ metadata = [
369
+ *(attachments if isinstance(attachments, list) else []),
370
+ *(inline if isinstance(inline, list) else []),
371
+ ]
372
+ values.append(
373
+ {
374
+ "mailpit_id": identifier,
375
+ "envelope_from": str(sender.get("Address", sender.get("Email", "")))
376
+ if isinstance(sender, dict)
377
+ else "",
378
+ "recipients": detailed_recipients,
379
+ "subject": str(detail.get("Subject", "")),
380
+ "text": str(detail.get("Text", "")),
381
+ "attachments": metadata,
382
+ "stored_bytes": int(detail.get("Size", 0)),
383
+ }
384
+ )
385
+ for index, item in enumerate(values, 1):
386
+ item["id"] = index
387
+ match = _OTP.search(str(item["text"]))
388
+ item["otp"] = match.group(1) if match else None
389
+ return values
390
+
391
+
392
+ @dataclass
393
+ class MailAccount:
394
+ """Internal ``websitebench.mail-account.v1`` logical account."""
395
+
396
+ account_id: str
397
+ tag: str
398
+ address: str
399
+ role: str
400
+ allowed_from: set[str]
401
+ allowed_to: set[str]
402
+ send_capability: str = field(repr=False)
403
+ read_capability: str = field(repr=False)
404
+ state: str = "active"
405
+ schema: str = field(default="websitebench.mail-account.v1", init=False)
406
+
407
+
408
+ class MailAccountBroker:
409
+ """Authorize logical accounts before calling the untrusted storage engine."""
410
+
411
+ _SEND_ROLES = frozenset(
412
+ {
413
+ "reference-backend",
414
+ "formal-candidate",
415
+ "capture-writer",
416
+ "gateway",
417
+ "selfhost-pair",
418
+ "formal-pair",
419
+ "capture-pair",
420
+ }
421
+ )
422
+ _READ_ROLES = frozenset(
423
+ {
424
+ "agent",
425
+ "formal-verifier",
426
+ "capture-reader",
427
+ "gateway",
428
+ "selfhost-pair",
429
+ "formal-pair",
430
+ "capture-pair",
431
+ }
432
+ )
433
+ _ROLES = _SEND_ROLES | _READ_ROLES
434
+
435
+ def __init__(self, client: MailpitClient) -> None:
436
+ self.client = client
437
+ self._accounts: dict[str, MailAccount] = {}
438
+ self._lock = threading.Lock()
439
+
440
+ def create_account(
441
+ self,
442
+ *,
443
+ address: str,
444
+ role: str,
445
+ allowed_from: Any = (),
446
+ allowed_to: Any = (),
447
+ ) -> MailAccount:
448
+ if address and ("@" not in address or "\r" in address or "\n" in address):
449
+ raise ValueError("invalid mail account address")
450
+ if role not in self._ROLES:
451
+ raise ValueError("invalid mail account role")
452
+ account = MailAccount(
453
+ account_id="acct_" + secrets.token_hex(24),
454
+ tag="wb-" + secrets.token_hex(24),
455
+ address=address,
456
+ role=role,
457
+ allowed_from=set(allowed_from),
458
+ allowed_to=set(allowed_to) | ({address} if address else set()),
459
+ send_capability="send_" + secrets.token_hex(32),
460
+ read_capability="read_" + secrets.token_hex(32),
461
+ )
462
+ with self._lock:
463
+ self._accounts[account.account_id] = account
464
+ return account
465
+
466
+ def _account(self, account_id: str) -> MailAccount:
467
+ with self._lock:
468
+ account = self._accounts.get(account_id)
469
+ if account is None or account.state == "destroyed":
470
+ raise PermissionError("mail account is unavailable")
471
+ return account
472
+
473
+ def send(
474
+ self,
475
+ account_id: str,
476
+ capability: str,
477
+ raw: bytes,
478
+ envelope_from: str,
479
+ recipients: list[str],
480
+ ) -> str:
481
+ account = self._account(account_id)
482
+ if (
483
+ account.role not in self._SEND_ROLES
484
+ or account.state != "active"
485
+ or not hmac.compare_digest(account.send_capability, capability)
486
+ ):
487
+ raise PermissionError("mail account cannot send")
488
+ if (
489
+ not envelope_from
490
+ or "@" not in envelope_from
491
+ or "\r" in envelope_from
492
+ or "\n" in envelope_from
493
+ or not 1 <= len(recipients) <= _MAX_RECIPIENTS
494
+ or len(raw) > _MAX_MESSAGE_BYTES
495
+ or any(
496
+ not recipient
497
+ or len(recipient) > 320
498
+ or "@" not in recipient
499
+ or "\r" in recipient
500
+ or "\n" in recipient
501
+ for recipient in recipients
502
+ )
503
+ ):
504
+ raise PermissionError("mail envelope is not allowed")
505
+ if account.allowed_from and envelope_from not in account.allowed_from:
506
+ raise PermissionError("mail sender is not allowed")
507
+ learn_recipients = account.role == "gateway" or not account.allowed_to
508
+ if account.role != "gateway" and account.allowed_to and any(
509
+ value not in account.allowed_to for value in recipients
510
+ ):
511
+ raise PermissionError("mail recipient is not allowed")
512
+ provider_id = self.client.send(raw, envelope_from, recipients, tag=account.tag)
513
+ if learn_recipients:
514
+ # A trial can legitimately exercise more than one authentication
515
+ # address. Namespace-scoped gateway accounts therefore learn every
516
+ # address from a Mailpit-accepted envelope; reads remain limited to
517
+ # those exact delivered addresses and still require the capability.
518
+ with self._lock:
519
+ account.allowed_to.update(recipients)
520
+ if not account.address and recipients:
521
+ account.address = recipients[0]
522
+ return provider_id
523
+
524
+ def messages(
525
+ self, account_id: str, capability: str, recipient: str | None = None
526
+ ) -> list[dict[str, Any]]:
527
+ account = self._account(account_id)
528
+ if account.role not in self._READ_ROLES or not hmac.compare_digest(
529
+ account.read_capability, capability
530
+ ):
531
+ raise PermissionError("mail account cannot read")
532
+ with self._lock:
533
+ allowed_to = set(account.allowed_to)
534
+ # SMTP delivery is asynchronous. A verifier can legitimately poll the
535
+ # exact recipient before the writer has learned its first envelope. An
536
+ # empty account therefore means "not delivered yet", not "forbidden".
537
+ # Once the first envelope arrives, the usual exact-recipient boundary
538
+ # applies and a different address is still rejected.
539
+ if recipient is not None and not allowed_to:
540
+ return []
541
+ targets = [recipient] if recipient is not None else sorted(allowed_to)
542
+ if any(target not in allowed_to for target in targets):
543
+ raise PermissionError("mail recipient is not allowed")
544
+ combined: dict[str, dict[str, Any]] = {}
545
+ for target in targets:
546
+ for message in self.client.messages(tag=account.tag, recipient=target):
547
+ combined[str(message["mailpit_id"])] = message
548
+ values = list(combined.values())
549
+ for index, item in enumerate(values, 1):
550
+ item["id"] = index
551
+ return values
552
+
553
+ def seal(self, account_id: str) -> None:
554
+ account = self._account(account_id)
555
+ with self._lock:
556
+ account.state = "sealed"
557
+
558
+ def destroy(self, account_id: str) -> None:
559
+ account = self._account(account_id)
560
+ with self._lock:
561
+ account.state = "destroyed"
562
+
563
+
564
+ class EphemeralMailpit:
565
+ """One pinned, networkless Mailpit container with a private UDS directory."""
566
+
567
+ def __init__(
568
+ self,
569
+ runtime_dir: str | os.PathLike[str] | None = None,
570
+ *,
571
+ docker_binary: str = "docker",
572
+ startup_timeout: float = 45.0,
573
+ ) -> None:
574
+ if startup_timeout <= 0:
575
+ raise ValueError("startup timeout must be positive")
576
+ self._owns_runtime_dir = runtime_dir is None
577
+ self.runtime_dir = (
578
+ tempfile.mkdtemp(prefix="websitebench-mailpit-")
579
+ if runtime_dir is None
580
+ else os.path.abspath(os.fspath(runtime_dir))
581
+ )
582
+ os.makedirs(self.runtime_dir, mode=0o700, exist_ok=True)
583
+ os.chmod(self.runtime_dir, 0o700)
584
+ self.docker_binary = docker_binary
585
+ self.startup_timeout = float(startup_timeout)
586
+ self.container_name = "websitebench-mailpit-" + secrets.token_hex(12)
587
+ self.client = MailpitClient(os.path.join(self.runtime_dir, "http.sock"))
588
+ self._process: subprocess.Popen[bytes] | None = None
589
+
590
+ def _uses_rootless_podman(self) -> bool:
591
+ """Detect the Podman Docker shim that needs the host uid preserved."""
592
+
593
+ try:
594
+ result = subprocess.run(
595
+ [self.docker_binary, "info"],
596
+ stdin=subprocess.DEVNULL,
597
+ stdout=subprocess.PIPE,
598
+ stderr=subprocess.STDOUT,
599
+ text=True,
600
+ timeout=5,
601
+ check=False,
602
+ )
603
+ except (OSError, subprocess.TimeoutExpired):
604
+ return False
605
+ output = result.stdout.casefold()
606
+ return result.returncode == 0 and "podman" in output and "rootless" in output
607
+
608
+ def start(self) -> "EphemeralMailpit":
609
+ if self._process is not None:
610
+ return self
611
+ command = [
612
+ self.docker_binary,
613
+ "run",
614
+ "--rm",
615
+ "--name",
616
+ self.container_name,
617
+ ]
618
+ if self._uses_rootless_podman():
619
+ command.append("--userns=keep-id")
620
+ command.extend(
621
+ [
622
+ "--user",
623
+ f"{os.getuid()}:{os.getgid()}",
624
+ "--network",
625
+ "none",
626
+ "--tmpfs",
627
+ "/tmp:rw,noexec,nosuid,nodev,size=64m",
628
+ "--mount",
629
+ f"type=bind,src={self.runtime_dir},dst=/run/websitebench-mailpit",
630
+ ]
631
+ )
632
+ settings = {
633
+ "MP_UI_BIND_ADDR": "unix:/run/websitebench-mailpit/http.sock:660",
634
+ "MP_SMTP_BIND_ADDR": "unix:/run/websitebench-mailpit/smtp.sock:660",
635
+ "MP_DATABASE": "/tmp/mailpit.db",
636
+ "MP_MAX_MESSAGES": "512",
637
+ "MP_MAX_MESSAGE_SIZE": "1",
638
+ "MP_SMTP_MAX_RECIPIENTS": "16",
639
+ "MP_POP3_BIND_ADDR": "",
640
+ "MP_POP3_AUTH_FILE": "",
641
+ "MP_SMTP_RELAY_CONFIG": "",
642
+ "MP_SMTP_RELAY_ALL": "false",
643
+ "MP_SMTP_FORWARD_CONFIG": "",
644
+ "MP_WEBHOOK_URL": "",
645
+ "MP_ENABLE_CHAOS": "false",
646
+ "MP_ENABLE_PROMETHEUS": "false",
647
+ "MP_DISABLE_VERSION_CHECK": "true",
648
+ "MP_BLOCK_REMOTE_CSS_AND_FONTS": "true",
649
+ "MP_ALLOW_INTERNAL_HTTP_REQUESTS": "false",
650
+ }
651
+ for key, value in settings.items():
652
+ command.extend(("--env", f"{key}={value}"))
653
+ command.append(MAILPIT_IMAGE)
654
+ try:
655
+ self._process = subprocess.Popen(
656
+ command,
657
+ stdin=subprocess.DEVNULL,
658
+ stdout=subprocess.DEVNULL,
659
+ stderr=subprocess.DEVNULL,
660
+ )
661
+ except OSError as error:
662
+ self.close()
663
+ raise MailpitInfrastructureError(
664
+ "Docker is unavailable for Mailpit"
665
+ ) from error
666
+ deadline = time.monotonic() + self.startup_timeout
667
+ while time.monotonic() < deadline:
668
+ if self._process.poll() is not None:
669
+ self.close()
670
+ raise MailpitInfrastructureError(
671
+ "Mailpit container exited during startup"
672
+ )
673
+ if self.client.ready():
674
+ return self
675
+ time.sleep(0.1)
676
+ self.close()
677
+ raise MailpitInfrastructureError("Mailpit did not become ready")
678
+
679
+ def close(self) -> None:
680
+ process, self._process = self._process, None
681
+ if process is not None and process.poll() is None:
682
+ try:
683
+ subprocess.run(
684
+ [self.docker_binary, "stop", "--time", "3", self.container_name],
685
+ stdin=subprocess.DEVNULL,
686
+ stdout=subprocess.DEVNULL,
687
+ stderr=subprocess.DEVNULL,
688
+ timeout=8,
689
+ check=False,
690
+ )
691
+ except (OSError, subprocess.TimeoutExpired):
692
+ process.terminate()
693
+ try:
694
+ process.wait(timeout=5)
695
+ except subprocess.TimeoutExpired:
696
+ process.kill()
697
+ process.wait(timeout=5)
698
+ if self._owns_runtime_dir:
699
+ shutil.rmtree(self.runtime_dir, ignore_errors=True)
700
+ else:
701
+ for name in ("http.sock", "smtp.sock"):
702
+ try:
703
+ os.unlink(os.path.join(self.runtime_dir, name))
704
+ except FileNotFoundError:
705
+ pass
706
+
707
+ def __enter__(self) -> "EphemeralMailpit":
708
+ return self.start()
709
+
710
+ def __exit__(self, exc_type: object, exc: object, traceback: object) -> None:
711
+ self.close()
712
+
713
+
714
+ def redact_text(value: str) -> str:
715
+ """Redact secret-like log fragments without retaining the matched value."""
716
+
717
+ return _LOG_SECRET.sub("[REDACTED]", value)
718
+
719
+
720
+ def redact_log_file(path: str) -> None:
721
+ """Sanitize one UTF-8 verifier log in place before it is published."""
722
+
723
+ from pathlib import Path
724
+
725
+ target = Path(path)
726
+ if not target.is_file():
727
+ return
728
+ value = target.read_text(encoding="utf-8", errors="replace")
729
+ target.write_text(redact_text(value), encoding="utf-8", newline="\n")
730
+
731
+
732
+ def redact_evidence(value: Any) -> Any:
733
+ """Remove credentials and sensitive form values from retained evidence."""
734
+
735
+ sensitive = re.compile(
736
+ r"(?:authorization|cookie|credential|password|secret|token|otp|code|payment|card)",
737
+ re.IGNORECASE,
738
+ )
739
+ if isinstance(value, dict):
740
+ return {
741
+ str(key): "[REDACTED]"
742
+ if sensitive.search(str(key))
743
+ else redact_evidence(child)
744
+ for key, child in value.items()
745
+ }
746
+ if isinstance(value, list):
747
+ return [redact_evidence(child) for child in value]
748
+ return value
749
+
750
+
751
+ @dataclass
752
+ class MailboxStore:
753
+ mailpit_client: MailpitClient
754
+ _capabilities: dict[str, str] = field(default_factory=dict)
755
+ _idempotency: dict[tuple[str, str], str] = field(default_factory=dict)
756
+ _namespace_message_counts: dict[str, int] = field(default_factory=dict)
757
+ _namespace_stored_bytes: dict[str, int] = field(default_factory=dict)
758
+ _lock: threading.Lock = field(default_factory=threading.Lock)
759
+ _broker: MailAccountBroker = field(init=False)
760
+ _accounts: dict[str, MailAccount] = field(default_factory=dict, init=False)
761
+
762
+ def __post_init__(self) -> None:
763
+ if not isinstance(self.mailpit_client, MailpitClient):
764
+ raise MailpitInfrastructureError("Mailpit client is required")
765
+ self._broker = MailAccountBroker(self.mailpit_client)
766
+
767
+ def healthy(self) -> bool:
768
+ return self.mailpit_client.ready()
769
+
770
+ def register(
771
+ self,
772
+ namespace: str,
773
+ capability: str,
774
+ *,
775
+ allowed_from: tuple[str, ...] = (),
776
+ ) -> None:
777
+ if not _NAMESPACE.fullmatch(namespace) or len(capability) < 32:
778
+ raise ValueError("invalid mailbox namespace capability")
779
+ if any(
780
+ not value or "@" not in value or "\r" in value or "\n" in value
781
+ for value in allowed_from
782
+ ):
783
+ raise ValueError("invalid allowed mail sender")
784
+ allowed_senders = set(allowed_from)
785
+ with self._lock:
786
+ existing = self._capabilities.get(namespace)
787
+ if existing is not None and existing != capability:
788
+ raise ValueError("mailbox namespace is already registered")
789
+ self._capabilities[namespace] = capability
790
+ account = self._accounts.get(namespace)
791
+ if account is None:
792
+ self._accounts[namespace] = self._broker.create_account(
793
+ address="", role="gateway", allowed_from=allowed_senders
794
+ )
795
+ elif account.allowed_from != allowed_senders:
796
+ raise ValueError("mailbox namespace sender policy is already registered")
797
+
798
+ def authorized(self, namespace: str, capability: str | None) -> bool:
799
+ with self._lock:
800
+ expected = self._capabilities.get(namespace)
801
+ return (
802
+ expected is not None
803
+ and capability is not None
804
+ and hmac.compare_digest(expected, capability)
805
+ )
806
+
807
+ def seal_namespace(self, namespace: str) -> None:
808
+ """Retire one writer while retaining trusted reads until teardown."""
809
+
810
+ with self._lock:
811
+ self._capabilities.pop(namespace, None)
812
+ account = self._accounts.get(namespace)
813
+ self._namespace_message_counts.pop(namespace, None)
814
+ self._namespace_stored_bytes.pop(namespace, None)
815
+ self._idempotency = {
816
+ identity: provider_id
817
+ for identity, provider_id in self._idempotency.items()
818
+ if identity[0] != namespace
819
+ }
820
+ if account is not None:
821
+ self._broker.seal(account.account_id)
822
+
823
+ def destroy_namespaces(self) -> None:
824
+ """Revoke every logical account without deleting Mailpit messages."""
825
+
826
+ with self._lock:
827
+ accounts = list(self._accounts.values())
828
+ self._capabilities.clear()
829
+ self._accounts.clear()
830
+ self._namespace_message_counts.clear()
831
+ self._namespace_stored_bytes.clear()
832
+ self._idempotency.clear()
833
+ for account in accounts:
834
+ if account.state != "destroyed":
835
+ self._broker.destroy(account.account_id)
836
+
837
+ def _store_message(
838
+ self,
839
+ message: Any,
840
+ envelope_from: str,
841
+ recipients: list[str],
842
+ *,
843
+ namespace: str,
844
+ idempotency_key: str | None = None,
845
+ raw: bytes | None = None,
846
+ ) -> tuple[bool, str | None]:
847
+ with self._lock:
848
+ idempotency_identity = (
849
+ (namespace, idempotency_key) if idempotency_key else None
850
+ )
851
+ if idempotency_identity is not None:
852
+ previous = self._idempotency.get(idempotency_identity)
853
+ if previous is not None:
854
+ return True, previous
855
+ account = self._accounts.get(namespace)
856
+ if account is None:
857
+ return False, None
858
+ wire = raw if raw is not None else message.as_bytes()
859
+ message_count = self._namespace_message_counts.get(namespace, 0)
860
+ stored_bytes = self._namespace_stored_bytes.get(namespace, 0)
861
+ if (
862
+ message_count >= _MAX_MESSAGES_PER_NAMESPACE
863
+ or stored_bytes + len(wire) > _MAX_STORED_BYTES_PER_NAMESPACE
864
+ ):
865
+ raise MailboxCapacityError("mailbox namespace capacity exceeded")
866
+ # Keep the lock across the final hop so concurrent requests with
867
+ # one idempotency key cannot manufacture two accepted messages.
868
+ # No message body or code is retained after Mailpit acknowledges
869
+ # the SMTP DATA command.
870
+ provider_id = self._broker.send(
871
+ account.account_id,
872
+ account.send_capability,
873
+ wire,
874
+ envelope_from,
875
+ recipients,
876
+ )
877
+ self._namespace_message_counts[namespace] = message_count + 1
878
+ self._namespace_stored_bytes[namespace] = stored_bytes + len(wire)
879
+ if idempotency_identity is not None:
880
+ self._idempotency[idempotency_identity] = provider_id
881
+ return True, provider_id
882
+
883
+ def deliver(self, raw: bytes, envelope_from: str, recipients: list[str]) -> bool:
884
+ message = email.message_from_bytes(raw, policy=default)
885
+ namespace = str(message.get("X-WebsiteBench-Namespace", "default"))
886
+ capability = str(message.get("X-WebsiteBench-Capability", ""))
887
+ if not _NAMESPACE.fullmatch(namespace) or not self.authorized(
888
+ namespace, capability
889
+ ):
890
+ return False
891
+ accepted, _provider_id = self._store_message(
892
+ message,
893
+ envelope_from,
894
+ recipients,
895
+ namespace=namespace,
896
+ raw=raw,
897
+ )
898
+ return accepted
899
+
900
+ def deliver_to(
901
+ self,
902
+ namespace: str,
903
+ raw: bytes,
904
+ envelope_from: str,
905
+ recipients: list[str],
906
+ ) -> bool:
907
+ """Store mail on a listener already fixed to one registered namespace.
908
+
909
+ Formal candidate runtimes receive access to that write-only listener,
910
+ not to the namespace-selecting SMTP or JSON API used by reference
911
+ capture. The routing decision therefore belongs to trusted verifier
912
+ infrastructure rather than to candidate-authored message headers.
913
+ """
914
+
915
+ if not _NAMESPACE.fullmatch(namespace):
916
+ return False
917
+ with self._lock:
918
+ registered = namespace in self._capabilities
919
+ if not registered:
920
+ return False
921
+ message = email.message_from_bytes(raw, policy=default)
922
+ accepted, _provider_id = self._store_message(
923
+ message,
924
+ envelope_from,
925
+ recipients,
926
+ namespace=namespace,
927
+ raw=raw,
928
+ )
929
+ return accepted
930
+
931
+ def deliver_resend_style_to(
932
+ self,
933
+ namespace: str,
934
+ *,
935
+ envelope_from: str,
936
+ recipients: list[str],
937
+ subject: str,
938
+ text: str,
939
+ idempotency_key: str | None,
940
+ ) -> tuple[bool, str | None]:
941
+ """Store one text-only Resend-style request in a fixed namespace."""
942
+
943
+ if not _NAMESPACE.fullmatch(namespace):
944
+ return False, None
945
+ with self._lock:
946
+ registered = namespace in self._capabilities
947
+ if not registered:
948
+ return False, None
949
+ message = EmailMessage()
950
+ message["From"] = envelope_from
951
+ message["To"] = ", ".join(recipients)
952
+ message["Subject"] = subject
953
+ message.set_content(text)
954
+ return self._store_message(
955
+ message,
956
+ envelope_from,
957
+ recipients,
958
+ namespace=namespace,
959
+ idempotency_key=idempotency_key,
960
+ raw=message.as_bytes(),
961
+ )
962
+
963
+ def messages(
964
+ self, namespace: str, recipient: str | None = None
965
+ ) -> list[dict[str, Any]]:
966
+ with self._lock:
967
+ account = self._accounts.get(namespace)
968
+ if account is None:
969
+ return []
970
+ values = self._broker.messages(
971
+ account.account_id, account.read_capability, recipient
972
+ )
973
+ for item in values:
974
+ item["namespace"] = namespace
975
+ item.pop("stored_bytes", None)
976
+ item.pop("mailpit_id", None)
977
+ return values
978
+
979
+
980
+ _INBOX_STYLE = (
981
+ "body{font:16px/1.5 system-ui,sans-serif;margin:0;background:#f6f7f9;"
982
+ "color:#1b1f24}"
983
+ "header{background:#fff;border-bottom:1px solid #d8dee4;padding:16px 24px}"
984
+ "h1{font-size:20px;margin:0}"
985
+ "main{max-width:52rem;margin:0 auto;padding:24px}"
986
+ "a{color:#0b62d0}"
987
+ ".msg{background:#fff;border:1px solid #d8dee4;border-radius:8px;"
988
+ "padding:12px 16px;margin-bottom:12px}"
989
+ ".msg h2{font-size:16px;margin:0 0 4px}"
990
+ ".meta{color:#57606a;font-size:13px;margin:0}"
991
+ ".empty{color:#57606a}"
992
+ "pre{white-space:pre-wrap;word-break:break-word;background:#f6f8fa;"
993
+ "border-radius:6px;padding:12px;margin:12px 0 0}"
994
+ )
995
+
996
+
997
+ def _document(title: str, body: str) -> bytes:
998
+ """One self-contained HTML page. Every interpolated value is escaped."""
999
+
1000
+ return (
1001
+ "<!doctype html><html lang=en><meta charset=utf-8>"
1002
+ '<meta name=viewport content="width=device-width,initial-scale=1">'
1003
+ f"<title>{html.escape(title)}</title>"
1004
+ f"<style>{_INBOX_STYLE}</style>"
1005
+ f"<header><h1>{html.escape(title)}</h1></header><main>{body}</main>"
1006
+ "</html>"
1007
+ ).encode("utf-8")
1008
+
1009
+
1010
+ def _recipients(message: dict[str, Any]) -> str:
1011
+ return ", ".join(str(item) for item in message.get("recipients", []))
1012
+
1013
+
1014
+ def render_inbox(messages: list[dict[str, Any]], *, base_path: str = "") -> bytes:
1015
+ """The message list an agent reads in a browser.
1016
+
1017
+ The extracted ``otp`` is deliberately absent: an agent should read the code
1018
+ out of the body the way a person would. That field stays an evaluator-side
1019
+ convenience on the JSON API.
1020
+ """
1021
+
1022
+ if not messages:
1023
+ body = (
1024
+ "<p class=empty id=inbox-empty>No messages yet. Mail sent to this "
1025
+ "mailbox appears here.</p>"
1026
+ )
1027
+ else:
1028
+ body = "".join(
1029
+ "<article class=msg>"
1030
+ f'<h2><a href="{html.escape(base_path)}/messages/{int(item["id"])}">'
1031
+ f"{html.escape(str(item.get('subject', '')))}</a></h2>"
1032
+ f"<p class=meta>From {html.escape(str(item.get('envelope_from', '')))}"
1033
+ f" &middot; To {html.escape(_recipients(item))}"
1034
+ f" &middot; Message {int(item['id'])}</p>"
1035
+ "</article>"
1036
+ for item in messages
1037
+ )
1038
+ refresh = f'<p><a href="{html.escape(base_path)}" id=inbox-refresh>Refresh</a></p>'
1039
+ return _document("Inbox", body + refresh)
1040
+
1041
+
1042
+ def render_message(message: dict[str, Any], *, base_path: str = "") -> bytes:
1043
+ """One message, body included, for the agent to read the code out of."""
1044
+
1045
+ body = (
1046
+ "<article class=msg>"
1047
+ f"<h2>{html.escape(str(message.get('subject', '')))}</h2>"
1048
+ f"<p class=meta>From {html.escape(str(message.get('envelope_from', '')))}"
1049
+ f" &middot; To {html.escape(_recipients(message))}</p>"
1050
+ f"<pre id=message-body>{html.escape(str(message.get('text', '')))}</pre>"
1051
+ "</article>"
1052
+ f'<p><a href="{html.escape(base_path)}" id=inbox-back>Back to inbox</a></p>'
1053
+ )
1054
+ return _document("Message", body)
1055
+
1056
+
1057
+ class _SmtpHandler(socketserver.StreamRequestHandler):
1058
+ def handle(self) -> None:
1059
+ timer = threading.Timer(
1060
+ _MAX_CONNECTION_LIFETIME_SECONDS, self._expire_connection
1061
+ )
1062
+ timer.daemon = True
1063
+ timer.start()
1064
+ try:
1065
+ self._handle_session()
1066
+ finally:
1067
+ timer.cancel()
1068
+
1069
+ def _expire_connection(self) -> None:
1070
+ try:
1071
+ self.connection.shutdown(socket.SHUT_RDWR)
1072
+ except OSError:
1073
+ pass
1074
+
1075
+ def _handle_session(self) -> None:
1076
+ store: MailboxStore = self.server.store # type: ignore[attr-defined]
1077
+ self.connection.settimeout(_CONNECTION_TIMEOUT_SECONDS)
1078
+ self.wfile.write(b"220 websitebench.local ESMTP\r\n")
1079
+ envelope_from = ""
1080
+ recipients: list[str] = []
1081
+ for _command_count in range(_MAX_COMMANDS_PER_CONNECTION):
1082
+ try:
1083
+ line = self.rfile.readline(65537)
1084
+ except (TimeoutError, socket.timeout):
1085
+ return
1086
+ if not line:
1087
+ return
1088
+ if len(line) > 65536:
1089
+ self.wfile.write(b"500 Command line too long\r\n")
1090
+ return
1091
+ command = line.decode("utf-8", "replace").rstrip("\r\n")
1092
+ upper = command.upper()
1093
+ if upper.startswith(("EHLO", "HELO")):
1094
+ self.wfile.write(b"250-websitebench.local\r\n250 SIZE 1048576\r\n")
1095
+ elif upper.startswith("MAIL FROM:"):
1096
+ path = command.split(":", 1)[1].strip()
1097
+ envelope_from = (
1098
+ path[1:].split(">", 1)[0]
1099
+ if path.startswith("<") and ">" in path
1100
+ else path.split(None, 1)[0].strip("<>")
1101
+ )
1102
+ recipients = []
1103
+ self.wfile.write(b"250 OK\r\n")
1104
+ elif upper.startswith("RCPT TO:"):
1105
+ if len(recipients) >= _MAX_RECIPIENTS:
1106
+ self.wfile.write(b"452 Too many recipients\r\n")
1107
+ continue
1108
+ path = command.split(":", 1)[1].strip()
1109
+ recipients.append(
1110
+ path[1:].split(">", 1)[0]
1111
+ if path.startswith("<") and ">" in path
1112
+ else path.split(None, 1)[0].strip("<>")
1113
+ )
1114
+ self.wfile.write(b"250 OK\r\n")
1115
+ elif upper == "DATA":
1116
+ self.wfile.write(b"354 End data with <CR><LF>.<CR><LF>\r\n")
1117
+ chunks = bytearray()
1118
+ oversized = False
1119
+ while True:
1120
+ try:
1121
+ data_line = self.rfile.readline(65537)
1122
+ except (TimeoutError, socket.timeout):
1123
+ return
1124
+ if data_line in {b".\r\n", b".\n", b""}:
1125
+ break
1126
+ if len(data_line) > 65536:
1127
+ oversized = True
1128
+ value = data_line[1:] if data_line.startswith(b"..") else data_line
1129
+ if len(chunks) + len(value) > _MAX_MESSAGE_BYTES:
1130
+ oversized = True
1131
+ elif not oversized:
1132
+ chunks.extend(value)
1133
+ if oversized:
1134
+ self.wfile.write(b"552 Message exceeds fixed local limit\r\n")
1135
+ continue
1136
+ fixed_namespace = getattr(self.server, "fixed_namespace", None)
1137
+ try:
1138
+ accepted = (
1139
+ store.deliver_to(
1140
+ fixed_namespace,
1141
+ bytes(chunks),
1142
+ envelope_from,
1143
+ recipients,
1144
+ )
1145
+ if isinstance(fixed_namespace, str)
1146
+ else store.deliver(bytes(chunks), envelope_from, recipients)
1147
+ )
1148
+ except MailboxCapacityError:
1149
+ self.wfile.write(b"452 Mailbox capacity exceeded\r\n")
1150
+ continue
1151
+ except PermissionError:
1152
+ self.wfile.write(b"550 Mail sender or recipient is not allowed\r\n")
1153
+ continue
1154
+ except MailpitInfrastructureError:
1155
+ self.wfile.write(b"451 Mailpit delivery unavailable\r\n")
1156
+ continue
1157
+ self.wfile.write(
1158
+ b"250 Accepted by Mailpit\r\n"
1159
+ if accepted
1160
+ else b"550 Invalid namespace capability\r\n"
1161
+ )
1162
+ elif upper == "RSET":
1163
+ envelope_from, recipients = "", []
1164
+ self.wfile.write(b"250 OK\r\n")
1165
+ elif upper == "NOOP":
1166
+ self.wfile.write(b"250 OK\r\n")
1167
+ elif upper == "QUIT":
1168
+ self.wfile.write(b"221 Bye\r\n")
1169
+ return
1170
+ else:
1171
+ self.wfile.write(b"502 Command not implemented\r\n")
1172
+ self.wfile.write(b"421 Command limit exceeded\r\n")
1173
+
1174
+
1175
+ class _SmtpServer(socketserver.ThreadingTCPServer):
1176
+ allow_reuse_address = True
1177
+ daemon_threads = True
1178
+
1179
+ def __init__(
1180
+ self,
1181
+ address: tuple[str, int],
1182
+ store: MailboxStore,
1183
+ *,
1184
+ fixed_namespace: str | None = None,
1185
+ ) -> None:
1186
+ self.store = store
1187
+ self.fixed_namespace = fixed_namespace
1188
+ self._connection_slots = threading.BoundedSemaphore(_MAX_CONCURRENT_CONNECTIONS)
1189
+ super().__init__(address, _SmtpHandler)
1190
+
1191
+ def process_request(self, request: Any, client_address: Any) -> None:
1192
+ if not self._connection_slots.acquire(blocking=False):
1193
+ request.close()
1194
+ return
1195
+ super().process_request(request, client_address)
1196
+
1197
+ def process_request_thread(self, request: Any, client_address: Any) -> None:
1198
+ try:
1199
+ super().process_request_thread(request, client_address)
1200
+ finally:
1201
+ self._connection_slots.release()
1202
+
1203
+
1204
+ class _HttpServer(ThreadingHTTPServer):
1205
+ daemon_threads = True
1206
+
1207
+ def __init__(self, address: tuple[str, int], handler: Any) -> None:
1208
+ self._connection_slots = threading.BoundedSemaphore(_MAX_CONCURRENT_CONNECTIONS)
1209
+ super().__init__(address, handler)
1210
+
1211
+ def process_request(self, request: Any, client_address: Any) -> None:
1212
+ if not self._connection_slots.acquire(blocking=False):
1213
+ request.close()
1214
+ return
1215
+ super().process_request(request, client_address)
1216
+
1217
+ def process_request_thread(self, request: Any, client_address: Any) -> None:
1218
+ def expire() -> None:
1219
+ try:
1220
+ request.shutdown(socket.SHUT_RDWR)
1221
+ except OSError:
1222
+ pass
1223
+
1224
+ timer = threading.Timer(_MAX_CONNECTION_LIFETIME_SECONDS, expire)
1225
+ timer.daemon = True
1226
+ timer.start()
1227
+ try:
1228
+ request.settimeout(_CONNECTION_TIMEOUT_SECONDS)
1229
+ super().process_request_thread(request, client_address)
1230
+ finally:
1231
+ timer.cancel()
1232
+ self._connection_slots.release()
1233
+
1234
+
1235
+ def _http_handler(
1236
+ store: MailboxStore,
1237
+ bootstrap: "_Bootstrap | _BootstrapSlot | None" = None,
1238
+ ) -> type[BaseHTTPRequestHandler]:
1239
+ """The evaluator- and site-facing listener: JSON, Bearer-gated throughout."""
1240
+
1241
+ slot = (
1242
+ bootstrap
1243
+ if isinstance(bootstrap, _BootstrapSlot)
1244
+ else _BootstrapSlot(bootstrap)
1245
+ )
1246
+
1247
+ class Handler(BaseHTTPRequestHandler):
1248
+ def _authorized(self, namespace: str) -> bool:
1249
+ prefix = "Bearer "
1250
+ header = self.headers.get("Authorization", "")
1251
+ capability = header[len(prefix) :] if header.startswith(prefix) else None
1252
+ if store.authorized(namespace, capability):
1253
+ return True
1254
+ self._json(403, {"error": "forbidden"})
1255
+ return False
1256
+
1257
+ def _json(self, status: int, value: Any) -> None:
1258
+ body = json.dumps(value, ensure_ascii=False, sort_keys=True).encode("utf-8")
1259
+ self.send_response(status)
1260
+ self.send_header("Content-Type", "application/json; charset=utf-8")
1261
+ self.send_header("Content-Length", str(len(body)))
1262
+ self.end_headers()
1263
+ self.wfile.write(body)
1264
+
1265
+ def _html(self, status: int, body: bytes) -> None:
1266
+ self.send_response(status)
1267
+ self.send_header("Content-Type", "text/html; charset=utf-8")
1268
+ self.send_header("Content-Length", str(len(body)))
1269
+ self.end_headers()
1270
+ self.wfile.write(body)
1271
+
1272
+ def do_GET(self) -> None: # noqa: N802
1273
+ parsed = urllib.parse.urlsplit(self.path)
1274
+ if parsed.path == "/healthz":
1275
+ if store.healthy():
1276
+ self._json(200, {"status": "ok"})
1277
+ else:
1278
+ self._json(503, {"status": "unavailable"})
1279
+ return
1280
+ if parsed.path == "/internal/bootstrap":
1281
+ # The site process learns this trial's namespace and capability
1282
+ # here. It is gated on its own token so the route stays closed
1283
+ # even if the internal network were misrouted.
1284
+ identity = slot.get()
1285
+ if identity is None:
1286
+ self._json(404, {"error": "not_found"})
1287
+ return
1288
+ prefix = "Bearer "
1289
+ header = self.headers.get("Authorization", "")
1290
+ presented = header[len(prefix) :] if header.startswith(prefix) else ""
1291
+ if not hmac.compare_digest(identity.token, presented):
1292
+ self._json(403, {"error": "forbidden"})
1293
+ return
1294
+ self._json(200, identity.payload())
1295
+ return
1296
+ parts = parsed.path.strip("/").split("/")
1297
+ if (
1298
+ len(parts) >= 4
1299
+ and parts[:2] == ["api", "namespaces"]
1300
+ and parts[3] == "messages"
1301
+ ):
1302
+ namespace = urllib.parse.unquote(parts[2])
1303
+ if not _NAMESPACE.fullmatch(namespace):
1304
+ self._json(400, {"error": "invalid_namespace"})
1305
+ return
1306
+ if not self._authorized(namespace):
1307
+ return
1308
+ recipient = urllib.parse.parse_qs(parsed.query).get(
1309
+ "recipient", [None]
1310
+ )[0]
1311
+ try:
1312
+ values = store.messages(namespace, recipient)
1313
+ except PermissionError:
1314
+ self._json(403, {"error": "recipient_forbidden"})
1315
+ return
1316
+ except MailpitInfrastructureError:
1317
+ self._json(503, {"error": "mailpit_unavailable"})
1318
+ return
1319
+ if len(parts) == 5 and parts[4] == "latest":
1320
+ if not values:
1321
+ self._json(404, {"error": "message_not_found"})
1322
+ else:
1323
+ self._json(200, values[-1])
1324
+ else:
1325
+ self._json(200, {"messages": values})
1326
+ return
1327
+ if len(parts) == 2 and parts[0] == "inbox":
1328
+ namespace = urllib.parse.unquote(parts[1])
1329
+ if not _NAMESPACE.fullmatch(namespace):
1330
+ self._json(400, {"error": "invalid_namespace"})
1331
+ return
1332
+ if not self._authorized(namespace):
1333
+ return
1334
+ try:
1335
+ messages = store.messages(namespace)
1336
+ except PermissionError:
1337
+ self._json(403, {"error": "forbidden"})
1338
+ return
1339
+ except MailpitInfrastructureError:
1340
+ self._json(503, {"error": "mailpit_unavailable"})
1341
+ return
1342
+ body = render_inbox(
1343
+ messages, base_path=f"/inbox/{urllib.parse.quote(namespace)}"
1344
+ )
1345
+ self._html(200, body)
1346
+ return
1347
+ self._json(404, {"error": "not_found"})
1348
+
1349
+ def do_POST(self) -> None: # noqa: N802
1350
+ """Accept reference mail through a bootstrap-token write-only API."""
1351
+
1352
+ parsed = urllib.parse.urlsplit(self.path)
1353
+ if parsed.path != "/emails" or parsed.query or parsed.fragment:
1354
+ self._json(404, {"error": "not_found"})
1355
+ return
1356
+ identity = slot.get()
1357
+ if identity is None:
1358
+ self._json(404, {"error": "not_found"})
1359
+ return
1360
+ prefix = "Bearer "
1361
+ header = self.headers.get("Authorization", "")
1362
+ presented = header[len(prefix) :] if header.startswith(prefix) else ""
1363
+ if not hmac.compare_digest(identity.token, presented):
1364
+ self._json(401, {"error": "unauthorized"})
1365
+ return
1366
+ if self.headers.get("Content-Type", "").split(";", 1)[0].strip().lower() != "application/json":
1367
+ self._json(415, {"error": "application_json_required"})
1368
+ return
1369
+ try:
1370
+ content_length = int(self.headers.get("Content-Length", ""))
1371
+ except ValueError:
1372
+ self._json(411, {"error": "content_length_required"})
1373
+ return
1374
+ if content_length < 0 or content_length > _MAX_MESSAGE_BYTES:
1375
+ self._json(413, {"error": "message_too_large"})
1376
+ return
1377
+ try:
1378
+ value = json.loads(self.rfile.read(content_length).decode("utf-8"))
1379
+ except (UnicodeDecodeError, json.JSONDecodeError):
1380
+ self._json(400, {"error": "invalid_json"})
1381
+ return
1382
+ if not isinstance(value, dict) or set(value) != {"from", "to", "subject", "text"}:
1383
+ self._json(400, {"error": "invalid_message_fields"})
1384
+ return
1385
+ envelope_from = value.get("from")
1386
+ recipients = value.get("to")
1387
+ subject = value.get("subject")
1388
+ message_text = value.get("text")
1389
+ recipients = [recipients] if isinstance(recipients, str) else recipients
1390
+ if (
1391
+ not isinstance(envelope_from, str)
1392
+ or not envelope_from
1393
+ or "@" not in envelope_from
1394
+ or "\r" in envelope_from
1395
+ or "\n" in envelope_from
1396
+ or not isinstance(recipients, list)
1397
+ or not 1 <= len(recipients) <= _MAX_RECIPIENTS
1398
+ or any(
1399
+ not isinstance(recipient, str)
1400
+ or not recipient
1401
+ or len(recipient) > 320
1402
+ or "@" not in recipient
1403
+ or "\r" in recipient
1404
+ or "\n" in recipient
1405
+ for recipient in recipients
1406
+ )
1407
+ or not isinstance(subject, str)
1408
+ or len(subject) > 998
1409
+ or "\r" in subject
1410
+ or "\n" in subject
1411
+ or not isinstance(message_text, str)
1412
+ or len(message_text.encode("utf-8")) > _MAX_MESSAGE_BYTES
1413
+ ):
1414
+ self._json(400, {"error": "invalid_message"})
1415
+ return
1416
+ idempotency_key = self.headers.get("Idempotency-Key")
1417
+ if idempotency_key is not None and (
1418
+ not idempotency_key
1419
+ or len(idempotency_key) > 256
1420
+ or "\r" in idempotency_key
1421
+ or "\n" in idempotency_key
1422
+ ):
1423
+ self._json(400, {"error": "invalid_idempotency_key"})
1424
+ return
1425
+ try:
1426
+ accepted, provider_id = store.deliver_resend_style_to(
1427
+ identity.namespace,
1428
+ envelope_from=envelope_from,
1429
+ recipients=recipients,
1430
+ subject=subject,
1431
+ text=message_text,
1432
+ idempotency_key=idempotency_key,
1433
+ )
1434
+ except MailboxCapacityError:
1435
+ self._json(429, {"error": "mailbox_capacity"})
1436
+ return
1437
+ except MailpitInfrastructureError:
1438
+ self._json(503, {"error": "mailpit_unavailable"})
1439
+ return
1440
+ if not accepted or provider_id is None:
1441
+ self._json(503, {"error": "delivery_failed"})
1442
+ return
1443
+ self._json(200, {"id": provider_id})
1444
+
1445
+ def log_message(self, format: str, *args: Any) -> None:
1446
+ return
1447
+
1448
+ return Handler
1449
+
1450
+
1451
+ def _candidate_bootstrap_handler(
1452
+ *,
1453
+ store: MailboxStore,
1454
+ bootstrap_token: str,
1455
+ mail_api_token: str,
1456
+ namespace: str,
1457
+ capability: str,
1458
+ smtp_host: str,
1459
+ smtp_port: int,
1460
+ sender: str,
1461
+ ) -> type[BaseHTTPRequestHandler]:
1462
+ """Expose write-only mail paths without exposing the mailbox read API.
1463
+
1464
+ ``POST /emails`` is deliberately a small Resend-style subset: one fixed
1465
+ sender, one or more recipients, a subject, and a plain-text body. The
1466
+ endpoint owns the trial namespace, so candidate input can never select a
1467
+ second mailbox. The legacy bootstrap and SMTP coordinates remain here for
1468
+ candidates using the vendored ``websitebench.site_backend`` transport.
1469
+ """
1470
+
1471
+ payload = {
1472
+ "namespace": namespace,
1473
+ "capability": capability,
1474
+ "smtp_host": smtp_host,
1475
+ "smtp_port": smtp_port,
1476
+ }
1477
+
1478
+ class CandidateBootstrapHandler(BaseHTTPRequestHandler):
1479
+ def _json(self, status: int, value: Any) -> None:
1480
+ body = json.dumps(value, ensure_ascii=False, sort_keys=True).encode("utf-8")
1481
+ self.send_response(status)
1482
+ self.send_header("Content-Type", "application/json; charset=utf-8")
1483
+ self.send_header("Content-Length", str(len(body)))
1484
+ self.send_header("Cache-Control", "no-store")
1485
+ self.end_headers()
1486
+ self.wfile.write(body)
1487
+
1488
+ def do_GET(self) -> None: # noqa: N802
1489
+ parsed = urllib.parse.urlsplit(self.path)
1490
+ if parsed.path == "/healthz":
1491
+ healthy = store.healthy()
1492
+ self._json(200 if healthy else 503, {"status": "ok" if healthy else "unavailable"})
1493
+ return
1494
+ if parsed.path != "/internal/bootstrap":
1495
+ self._json(404, {"error": "not_found"})
1496
+ return
1497
+ prefix = "Bearer "
1498
+ header = self.headers.get("Authorization", "")
1499
+ presented = header[len(prefix) :] if header.startswith(prefix) else ""
1500
+ if not hmac.compare_digest(bootstrap_token, presented):
1501
+ self._json(403, {"error": "forbidden"})
1502
+ return
1503
+ self._json(200, payload)
1504
+
1505
+ def do_POST(self) -> None: # noqa: N802
1506
+ parsed = urllib.parse.urlsplit(self.path)
1507
+ if parsed.path != "/emails" or parsed.query or parsed.fragment:
1508
+ self._json(404, {"error": "not_found"})
1509
+ return
1510
+ prefix = "Bearer "
1511
+ header = self.headers.get("Authorization", "")
1512
+ presented = header[len(prefix) :] if header.startswith(prefix) else ""
1513
+ if not hmac.compare_digest(mail_api_token, presented):
1514
+ self._json(401, {"error": "unauthorized"})
1515
+ return
1516
+ content_type = self.headers.get("Content-Type", "").split(";", 1)[0]
1517
+ if content_type.strip().lower() != "application/json":
1518
+ self._json(415, {"error": "application_json_required"})
1519
+ return
1520
+ try:
1521
+ content_length = int(self.headers.get("Content-Length", ""))
1522
+ except ValueError:
1523
+ self._json(411, {"error": "content_length_required"})
1524
+ return
1525
+ if content_length < 0 or content_length > _MAX_MESSAGE_BYTES:
1526
+ self._json(413, {"error": "message_too_large"})
1527
+ return
1528
+ raw = self.rfile.read(content_length)
1529
+ if len(raw) != content_length:
1530
+ self._json(400, {"error": "incomplete_request"})
1531
+ return
1532
+ try:
1533
+ value = json.loads(raw.decode("utf-8"))
1534
+ except (UnicodeDecodeError, json.JSONDecodeError):
1535
+ self._json(400, {"error": "invalid_json"})
1536
+ return
1537
+ if not isinstance(value, dict) or set(value) != {
1538
+ "from",
1539
+ "to",
1540
+ "subject",
1541
+ "text",
1542
+ }:
1543
+ self._json(400, {"error": "invalid_message_fields"})
1544
+ return
1545
+ envelope_from = value.get("from")
1546
+ subject = value.get("subject")
1547
+ text = value.get("text")
1548
+ raw_recipients = value.get("to")
1549
+ recipients = (
1550
+ [raw_recipients] if isinstance(raw_recipients, str) else raw_recipients
1551
+ )
1552
+ if (
1553
+ envelope_from != sender
1554
+ or not isinstance(subject, str)
1555
+ or not isinstance(text, str)
1556
+ or not isinstance(recipients, list)
1557
+ or not 1 <= len(recipients) <= _MAX_RECIPIENTS
1558
+ or any(
1559
+ not isinstance(recipient, str)
1560
+ or not recipient
1561
+ or len(recipient) > 320
1562
+ or "@" not in recipient
1563
+ or "\r" in recipient
1564
+ or "\n" in recipient
1565
+ for recipient in recipients
1566
+ )
1567
+ or len(subject) > 998
1568
+ or "\r" in subject
1569
+ or "\n" in subject
1570
+ ):
1571
+ self._json(400, {"error": "invalid_message"})
1572
+ return
1573
+ try:
1574
+ encoded_text = text.encode("utf-8")
1575
+ subject.encode("utf-8")
1576
+ for recipient in recipients:
1577
+ recipient.encode("utf-8")
1578
+ except UnicodeEncodeError:
1579
+ self._json(400, {"error": "invalid_message"})
1580
+ return
1581
+ if len(encoded_text) > _MAX_MESSAGE_BYTES:
1582
+ self._json(413, {"error": "message_too_large"})
1583
+ return
1584
+ idempotency_key = self.headers.get("Idempotency-Key")
1585
+ if idempotency_key is not None and (
1586
+ not idempotency_key
1587
+ or len(idempotency_key) > 256
1588
+ or "\r" in idempotency_key
1589
+ or "\n" in idempotency_key
1590
+ ):
1591
+ self._json(400, {"error": "invalid_idempotency_key"})
1592
+ return
1593
+ try:
1594
+ accepted, provider_id = store.deliver_resend_style_to(
1595
+ namespace,
1596
+ envelope_from=envelope_from,
1597
+ recipients=recipients,
1598
+ subject=subject,
1599
+ text=text,
1600
+ idempotency_key=idempotency_key,
1601
+ )
1602
+ except MailboxCapacityError:
1603
+ self._json(429, {"error": "mailbox_capacity"})
1604
+ return
1605
+ except MailpitInfrastructureError:
1606
+ self._json(503, {"error": "mailpit_unavailable"})
1607
+ return
1608
+ if not accepted or provider_id is None:
1609
+ self._json(429, {"error": "mailbox_capacity"})
1610
+ return
1611
+ self._json(200, {"id": provider_id})
1612
+
1613
+ def log_message(self, format: str, *args: Any) -> None:
1614
+ return
1615
+
1616
+ return CandidateBootstrapHandler
1617
+
1618
+
1619
+ @dataclass(frozen=True, repr=False)
1620
+ class _Bootstrap:
1621
+ """What the site process is allowed to learn, and the token that gates it."""
1622
+
1623
+ token: str
1624
+ namespace: str
1625
+ capability: str
1626
+ smtp_host: str
1627
+ smtp_port: int
1628
+
1629
+ def __repr__(self) -> str:
1630
+ return f"_Bootstrap(namespace={self.namespace!r}, token=<redacted>)"
1631
+
1632
+ def payload(self) -> dict[str, Any]:
1633
+ return {
1634
+ "namespace": self.namespace,
1635
+ "capability": self.capability,
1636
+ "smtp_host": self.smtp_host,
1637
+ "smtp_port": self.smtp_port,
1638
+ }
1639
+
1640
+
1641
+ class _BootstrapSlot:
1642
+ """The identity ``/internal/bootstrap`` is serving right now.
1643
+
1644
+ A trial's mailbox identity is minted once and never moves, so the slot is
1645
+ written once and read forever. Reference capture is the exception that
1646
+ makes it a slot at all: it relaunches the reference between tasks, and each
1647
+ relaunch has to be its own trial -- same bootstrap token, because that is
1648
+ the site process's own credential and the site is what stays the same, but
1649
+ a namespace and capability nothing before it could have seen. Rotating
1650
+ behind the slot lets the operator do that without tearing down the listener
1651
+ the site is about to call.
1652
+ """
1653
+
1654
+ def __init__(self, bootstrap: "_Bootstrap | None" = None) -> None:
1655
+ self._lock = threading.Lock()
1656
+ self._value = bootstrap
1657
+
1658
+ def __repr__(self) -> str:
1659
+ return f"_BootstrapSlot({self._value!r})"
1660
+
1661
+ def get(self) -> "_Bootstrap | None":
1662
+ with self._lock:
1663
+ return self._value
1664
+
1665
+ def rotate(self, *, namespace: str, capability: str) -> "_Bootstrap":
1666
+ """Swap in a fresh namespace and capability, keeping the token."""
1667
+
1668
+ with self._lock:
1669
+ current = self._value
1670
+ if current is None:
1671
+ raise RuntimeError("this mailbox serves no bootstrap identity")
1672
+ rotated = replace(current, namespace=namespace, capability=capability)
1673
+ self._value = rotated
1674
+ return rotated
1675
+
1676
+
1677
+ def _inbox_handler(
1678
+ store: MailboxStore, namespace: str, token: str
1679
+ ) -> type[BaseHTTPRequestHandler]:
1680
+ """The agent-facing listener: one namespace, HTML only, no capability.
1681
+
1682
+ The namespace is closed over at construction, so there is no request-time
1683
+ parameter an agent could vary to reach a second mailbox. Requirement 5
1684
+ holds by construction rather than by a check that could be bypassed.
1685
+ """
1686
+
1687
+ inbox_path = "/inbox/" + urllib.parse.quote(token, safe="")
1688
+
1689
+ class InboxHandler(BaseHTTPRequestHandler):
1690
+ def _send(self, status: int, body: bytes, content_type: str) -> None:
1691
+ self.send_response(status)
1692
+ self.send_header("Content-Type", content_type)
1693
+ self.send_header("Content-Length", str(len(body)))
1694
+ # The inbox is per-trial and mutates; never let it be cached.
1695
+ self.send_header("Cache-Control", "no-store")
1696
+ self.send_header("Referrer-Policy", "no-referrer")
1697
+ self.end_headers()
1698
+ self.wfile.write(body)
1699
+
1700
+ def _not_found(self) -> None:
1701
+ self._send(
1702
+ 404,
1703
+ _document("Not found", "<p>No such page.</p>"),
1704
+ "text/html; charset=utf-8",
1705
+ )
1706
+
1707
+ def do_GET(self) -> None: # noqa: N802
1708
+ parsed = urllib.parse.urlsplit(self.path)
1709
+ if parsed.path == "/healthz":
1710
+ healthy = store.healthy()
1711
+ body = json.dumps(
1712
+ {"status": "ok" if healthy else "unavailable"}
1713
+ ).encode("utf-8")
1714
+ self._send(
1715
+ 200 if healthy else 503,
1716
+ body,
1717
+ "application/json; charset=utf-8",
1718
+ )
1719
+ return
1720
+ if parsed.path in {"", "/"}:
1721
+ self.send_response(302)
1722
+ self.send_header("Location", inbox_path)
1723
+ self.send_header("Content-Length", "0")
1724
+ self.end_headers()
1725
+ return
1726
+ parts = [
1727
+ urllib.parse.unquote(part) for part in parsed.path.strip("/").split("/")
1728
+ ]
1729
+ # Defence in depth for the shared-origin topology, where the path is
1730
+ # the only thing separating one trial's inbox from another's.
1731
+ if len(parts) < 2 or parts[0] != "inbox":
1732
+ self._not_found()
1733
+ return
1734
+ if not hmac.compare_digest(token, parts[1]):
1735
+ self._not_found()
1736
+ return
1737
+ try:
1738
+ values = store.messages(namespace)
1739
+ except MailpitInfrastructureError:
1740
+ body = json.dumps({"status": "unavailable"}).encode("utf-8")
1741
+ self._send(503, body, "application/json; charset=utf-8")
1742
+ return
1743
+ if len(parts) == 2:
1744
+ self._send(
1745
+ 200,
1746
+ render_inbox(values, base_path=inbox_path),
1747
+ "text/html; charset=utf-8",
1748
+ )
1749
+ return
1750
+ if len(parts) == 4 and parts[2] == "messages":
1751
+ try:
1752
+ identifier = int(parts[3])
1753
+ except ValueError:
1754
+ self._not_found()
1755
+ return
1756
+ for item in values:
1757
+ if int(item["id"]) == identifier:
1758
+ self._send(
1759
+ 200,
1760
+ render_message(item, base_path=inbox_path),
1761
+ "text/html; charset=utf-8",
1762
+ )
1763
+ return
1764
+ self._not_found()
1765
+
1766
+ def log_message(self, format: str, *args: Any) -> None:
1767
+ return
1768
+
1769
+ return InboxHandler
1770
+
1771
+
1772
+ class LocalMailboxSidecar:
1773
+ """A loopback-only SMTP and Inbox API pair with namespace isolation."""
1774
+
1775
+ def __init__(
1776
+ self,
1777
+ *,
1778
+ smtp_port: int = 0,
1779
+ http_port: int = 0,
1780
+ bind_host: str = "127.0.0.1",
1781
+ inbox_port: int | None = None,
1782
+ inbox_bind_host: str | None = None,
1783
+ inbox_namespace: str | None = None,
1784
+ inbox_token: str | None = None,
1785
+ bootstrap: "_Bootstrap | None" = None,
1786
+ mailpit_client: MailpitClient,
1787
+ ) -> None:
1788
+ self.store = MailboxStore(mailpit_client=mailpit_client)
1789
+ self._bootstrap = _BootstrapSlot(bootstrap)
1790
+ self.smtp = _SmtpServer((bind_host, smtp_port), self.store)
1791
+ self.http = _HttpServer(
1792
+ (bind_host, http_port), _http_handler(self.store, self._bootstrap)
1793
+ )
1794
+ self.inbox: _HttpServer | None = None
1795
+ self._inbox_token = inbox_token
1796
+ if inbox_namespace is not None or inbox_token is not None:
1797
+ if not inbox_namespace or not inbox_token:
1798
+ raise ValueError("an inbox listener needs both namespace and token")
1799
+ self.inbox = _HttpServer(
1800
+ (inbox_bind_host or bind_host, inbox_port or 0),
1801
+ _inbox_handler(self.store, inbox_namespace, inbox_token),
1802
+ )
1803
+ self._threads: list[threading.Thread] = []
1804
+
1805
+ @property
1806
+ def smtp_port(self) -> int:
1807
+ return int(self.smtp.server_address[1])
1808
+
1809
+ @property
1810
+ def http_port(self) -> int:
1811
+ return int(self.http.server_address[1])
1812
+
1813
+ @property
1814
+ def inbox_port(self) -> int:
1815
+ if self.inbox is None:
1816
+ raise RuntimeError("this sidecar has no inbox listener")
1817
+ return int(self.inbox.server_address[1])
1818
+
1819
+ @property
1820
+ def url(self) -> str:
1821
+ return f"http://127.0.0.1:{self.http_port}"
1822
+
1823
+ @property
1824
+ def inbox_url(self) -> str:
1825
+ """The bare origin an agent is handed. It carries no secret."""
1826
+
1827
+ return f"http://127.0.0.1:{self.inbox_port}"
1828
+
1829
+ @property
1830
+ def _servers(self) -> tuple[Any, ...]:
1831
+ return (
1832
+ (self.smtp, self.http)
1833
+ if self.inbox is None
1834
+ else (
1835
+ self.smtp,
1836
+ self.http,
1837
+ self.inbox,
1838
+ )
1839
+ )
1840
+
1841
+ def register_namespace(self, namespace: str, capability: str) -> None:
1842
+ """Bind one opaque namespace to its unguessable per-worker capability."""
1843
+
1844
+ self.store.register(namespace, capability)
1845
+
1846
+ def rotate_bootstrap(self, namespace: str, capability: str) -> None:
1847
+ """Point ``/internal/bootstrap`` at a freshly minted namespace.
1848
+
1849
+ Registration happens first on purpose: a site that fetched the new
1850
+ identity and sent before the store knew it would have its message
1851
+ dropped at the SMTP door, which reads as a flaky mailbox rather than
1852
+ the ordering bug it is.
1853
+ """
1854
+
1855
+ previous = self._bootstrap.get()
1856
+ self.register_namespace(namespace, capability)
1857
+ # Candidate trials route direct SMTP into one fixed namespace. Mirror
1858
+ # that ABI during paired reference capture so runtimes using the direct
1859
+ # writer do not need the structured transport's namespace headers.
1860
+ self.smtp.fixed_namespace = namespace
1861
+ self._bootstrap.rotate(namespace=namespace, capability=capability)
1862
+ if previous is not None and previous.namespace != namespace:
1863
+ self.store.seal_namespace(previous.namespace)
1864
+
1865
+ def start(self) -> "LocalMailboxSidecar":
1866
+ if not self.store.healthy():
1867
+ raise MailpitInfrastructureError("Mailpit is not ready")
1868
+ for server in self._servers:
1869
+ thread = threading.Thread(target=server.serve_forever, daemon=True)
1870
+ thread.start()
1871
+ self._threads.append(thread)
1872
+ return self
1873
+
1874
+ def close(self) -> None:
1875
+ for server in self._servers:
1876
+ server.shutdown()
1877
+ server.server_close()
1878
+ for thread in self._threads:
1879
+ thread.join(timeout=5)
1880
+ self._threads.clear()
1881
+ self.store.destroy_namespaces()
1882
+
1883
+ def __enter__(self) -> "LocalMailboxSidecar":
1884
+ return self.start()
1885
+
1886
+ def __exit__(self, exc_type: object, exc: object, traceback: object) -> None:
1887
+ self.close()
1888
+
1889
+
1890
+ class CandidateMailboxTrial:
1891
+ """One formal case's write-only candidate mailbox and trusted reader.
1892
+
1893
+ Candidate code prefers the Resend-style ``POST /emails`` endpoint and may
1894
+ use ``smtp``/``bootstrap`` for compatibility. Both writers are fixed to
1895
+ this trial's namespace. The verifier API listens on a third, unadvertised
1896
+ port that the candidate sandbox does not permit, and it uses a distinct
1897
+ read credential that never enters the candidate environment.
1898
+ """
1899
+
1900
+ def __init__(
1901
+ self,
1902
+ *,
1903
+ bind_host: str = "127.0.0.1",
1904
+ mailpit_client: MailpitClient | None = None,
1905
+ ) -> None:
1906
+ self._runtime = None if mailpit_client is not None else EphemeralMailpit()
1907
+ storage_client = (
1908
+ mailpit_client
1909
+ if mailpit_client is not None
1910
+ else self._runtime.client
1911
+ if self._runtime is not None
1912
+ else None
1913
+ )
1914
+ namespace, read_credential, _inbox_token = _mint_identity()
1915
+ self.namespace = namespace
1916
+ self.read_credential = read_credential
1917
+ self._write_capability = secrets.token_hex(32)
1918
+ self._bootstrap_token = secrets.token_hex(32)
1919
+ self._mail_api_token = secrets.token_hex(32)
1920
+ self._sender = CANDIDATE_MAIL_SENDER
1921
+ self.store = MailboxStore(mailpit_client=storage_client)
1922
+ self.store.register(
1923
+ namespace,
1924
+ read_credential,
1925
+ allowed_from=(self._sender,),
1926
+ )
1927
+ self.smtp = _SmtpServer(
1928
+ (bind_host, 0),
1929
+ self.store,
1930
+ fixed_namespace=namespace,
1931
+ )
1932
+ self.http = _HttpServer(
1933
+ (bind_host, 0),
1934
+ _http_handler(self.store),
1935
+ )
1936
+ self.bootstrap = _HttpServer(
1937
+ (bind_host, 0),
1938
+ _candidate_bootstrap_handler(
1939
+ store=self.store,
1940
+ bootstrap_token=self._bootstrap_token,
1941
+ mail_api_token=self._mail_api_token,
1942
+ namespace=namespace,
1943
+ capability=self._write_capability,
1944
+ smtp_host=bind_host,
1945
+ smtp_port=self.smtp_port,
1946
+ sender=self._sender,
1947
+ ),
1948
+ )
1949
+ self._threads: list[threading.Thread] = []
1950
+
1951
+ @property
1952
+ def smtp_port(self) -> int:
1953
+ return int(self.smtp.server_address[1])
1954
+
1955
+ @property
1956
+ def http_port(self) -> int:
1957
+ return int(self.http.server_address[1])
1958
+
1959
+ @property
1960
+ def bootstrap_port(self) -> int:
1961
+ return int(self.bootstrap.server_address[1])
1962
+
1963
+ @property
1964
+ def url(self) -> str:
1965
+ return f"http://127.0.0.1:{self.http_port}"
1966
+
1967
+ @property
1968
+ def candidate_environment(self) -> dict[str, str]:
1969
+ """The complete optional mail ABI handed to the candidate runtime."""
1970
+
1971
+ return {
1972
+ "WEBSITEBENCH_MAIL_API_URL": (
1973
+ f"http://127.0.0.1:{self.bootstrap_port}/emails"
1974
+ ),
1975
+ "WEBSITEBENCH_MAIL_API_TOKEN": self._mail_api_token,
1976
+ "WEBSITEBENCH_MAIL_FROM": self._sender,
1977
+ "WEBSITEBENCH_SMTP_HOST": "127.0.0.1",
1978
+ "WEBSITEBENCH_SMTP_PORT": str(self.smtp_port),
1979
+ "WEBSITEBENCH_SMTP_FROM": self._sender,
1980
+ # Compatibility seam for candidates using websitebench.site_backend.
1981
+ # It serves write coordinates only and has no read routes.
1982
+ "WEBSITEBENCH_MAILBOX_BOOTSTRAP_URL": (
1983
+ f"http://127.0.0.1:{self.bootstrap_port}/internal/bootstrap"
1984
+ ),
1985
+ "WEBSITEBENCH_MAILBOX_BOOTSTRAP_TOKEN": self._bootstrap_token,
1986
+ }
1987
+
1988
+ @property
1989
+ def candidate_connect_ports(self) -> frozenset[int]:
1990
+ return frozenset({self.smtp_port, self.bootstrap_port})
1991
+
1992
+ def start(self) -> "CandidateMailboxTrial":
1993
+ if self._runtime is not None:
1994
+ try:
1995
+ self._runtime.start()
1996
+ except BaseException:
1997
+ for server in (self.smtp, self.http, self.bootstrap):
1998
+ server.server_close()
1999
+ raise
2000
+ if not self.store.healthy():
2001
+ for server in (self.smtp, self.http, self.bootstrap):
2002
+ server.server_close()
2003
+ if self._runtime is not None:
2004
+ self._runtime.close()
2005
+ raise MailpitInfrastructureError("Mailpit is not ready")
2006
+ for server in (self.smtp, self.http, self.bootstrap):
2007
+ thread = threading.Thread(
2008
+ target=server.serve_forever,
2009
+ name=f"candidate-mailbox-{server.server_address[1]}",
2010
+ daemon=True,
2011
+ )
2012
+ thread.start()
2013
+ self._threads.append(thread)
2014
+ return self
2015
+
2016
+ def close(self) -> None:
2017
+ for server in (self.smtp, self.http, self.bootstrap):
2018
+ server.shutdown()
2019
+ server.server_close()
2020
+ for thread in self._threads:
2021
+ thread.join(timeout=5)
2022
+ self._threads.clear()
2023
+ self.store.destroy_namespaces()
2024
+ if self._runtime is not None:
2025
+ self._runtime.close()
2026
+
2027
+ def __enter__(self) -> "CandidateMailboxTrial":
2028
+ return self.start()
2029
+
2030
+ def __exit__(self, exc_type: object, exc: object, traceback: object) -> None:
2031
+ self.close()
2032
+
2033
+
2034
+ def _candidate_environment_problem(
2035
+ environment: Mapping[str, str], private_values: tuple[str, ...]
2036
+ ) -> str | None:
2037
+ """Return why ``environment`` may not be handed to a candidate, or ``None``.
2038
+
2039
+ The candidate mail ABI is a closed set of names carrying loopback
2040
+ coordinates only. A name outside the set, a Mailpit control variable, or
2041
+ any value naming the evaluator's own Mailpit socket would hand a candidate
2042
+ the trusted store instead of its write-only door.
2043
+ """
2044
+
2045
+ unknown = sorted(set(environment) - CANDIDATE_MAIL_ENVIRONMENT)
2046
+ if unknown:
2047
+ return f"candidate mailbox environment has unknown names: {unknown}"
2048
+ leaked = any(
2049
+ name.startswith("WEBSITEBENCH_MAILPIT_")
2050
+ or MAILPIT_RUNTIME_DIR in str(value)
2051
+ or any(private and private in str(value) for private in private_values)
2052
+ for name, value in environment.items()
2053
+ )
2054
+ if leaked:
2055
+ return "candidate mailbox environment exposed the Mailpit UDS"
2056
+ return None
2057
+
2058
+
2059
+ class MailTrial:
2060
+ """One case's candidate mailbox, as the rest of the evaluator sees it.
2061
+
2062
+ The candidate environment handed out here is already proved to be the
2063
+ closed mail ABI and free of evaluator-side coordinates, so no caller
2064
+ re-scans it. Reads stay on the trusted side: :meth:`deliveries` is the
2065
+ only way out of the store and it never leaves this trial's namespace.
2066
+ """
2067
+
2068
+ def __init__(
2069
+ self,
2070
+ trial: CandidateMailboxTrial,
2071
+ *,
2072
+ private_values: tuple[str, ...] = (),
2073
+ ) -> None:
2074
+ environment = dict(trial.candidate_environment)
2075
+ problem = _candidate_environment_problem(environment, private_values)
2076
+ if problem is not None:
2077
+ trial.close()
2078
+ raise MailpitInfrastructureError(problem)
2079
+ self._trial = trial
2080
+ self._environment = environment
2081
+
2082
+ @property
2083
+ def namespace(self) -> str:
2084
+ return self._trial.namespace
2085
+
2086
+ @property
2087
+ def read_credential(self) -> str:
2088
+ return self._trial.read_credential
2089
+
2090
+ @property
2091
+ def url(self) -> str:
2092
+ """The verifier-only reader origin; the candidate cannot reach it."""
2093
+
2094
+ return self._trial.url
2095
+
2096
+ @property
2097
+ def http_port(self) -> int:
2098
+ return self._trial.http_port
2099
+
2100
+ @property
2101
+ def store(self) -> MailboxStore:
2102
+ return self._trial.store
2103
+
2104
+ @property
2105
+ def candidate_environment(self) -> dict[str, str]:
2106
+ """The complete optional mail ABI this case's candidate receives."""
2107
+
2108
+ return dict(self._environment)
2109
+
2110
+ @property
2111
+ def candidate_connect_ports(self) -> frozenset[int]:
2112
+ """The loopback ports the candidate sandbox may connect out to."""
2113
+
2114
+ return self._trial.candidate_connect_ports
2115
+
2116
+ def healthy(self) -> bool:
2117
+ """Whether the backing store still answers, so an outage is not scored."""
2118
+
2119
+ return self._trial.store.healthy()
2120
+
2121
+ def deliveries(self) -> list[dict[str, Any]]:
2122
+ """Every message this trial's namespace received, newest first."""
2123
+
2124
+ return self._trial.store.messages(self._trial.namespace)
2125
+
2126
+ def close(self) -> None:
2127
+ self._trial.close()
2128
+
2129
+ def __enter__(self) -> "MailTrial":
2130
+ return self
2131
+
2132
+ def __exit__(self, exc_type: object, exc: object, traceback: object) -> None:
2133
+ self.close()
2134
+
2135
+
2136
+ class MailPlane:
2137
+ """The evaluator's single door to Mailpit.
2138
+
2139
+ Everything that knows a socket path, a container lifetime, a namespace or
2140
+ the candidate mail ABI lives behind this facade. ``formal``,
2141
+ ``trusted_check`` and ``capture`` ask the plane for a trial, a runner
2142
+ passthrough or an authoring gateway; they never build a Mailpit client,
2143
+ read a Mailpit variable, or inspect what they hand a candidate.
2144
+ """
2145
+
2146
+ def __init__(
2147
+ self, client: MailpitClient, *, runtime: EphemeralMailpit | None = None
2148
+ ) -> None:
2149
+ self.client = client
2150
+ self._runtime = runtime
2151
+
2152
+ @staticmethod
2153
+ def _configured_socket(env: Mapping[str, str]) -> str:
2154
+ """The evaluator's only read of :data:`MAILPIT_HTTP_SOCKET_ENV`."""
2155
+
2156
+ return str(env.get(MAILPIT_HTTP_SOCKET_ENV, "") or "").strip()
2157
+
2158
+ @classmethod
2159
+ def from_environment(cls, env: Mapping[str, str] = os.environ) -> "MailPlane":
2160
+ """Open the Mailpit the environment advertises.
2161
+
2162
+ A missing variable and an unhealthy Mailpit are the same answer to the
2163
+ caller: this process has no mail plane.
2164
+ """
2165
+
2166
+ socket_path = cls._configured_socket(env)
2167
+ if not socket_path:
2168
+ raise MailInfrastructureUnavailable(
2169
+ f"{MAILPIT_HTTP_SOCKET_ENV} is not configured"
2170
+ )
2171
+ client = MailpitClient(socket_path)
2172
+ if not client.ready():
2173
+ raise MailInfrastructureUnavailable(
2174
+ "Mailpit is not ready on its configured HTTP socket"
2175
+ )
2176
+ return cls(client)
2177
+
2178
+ @classmethod
2179
+ def ephemeral(
2180
+ cls, runtime_dir: str | os.PathLike[str] | None = None
2181
+ ) -> "MailPlane":
2182
+ """Start a private, networkless Mailpit this plane owns and will stop.
2183
+
2184
+ Host-side only: a Harbor trial has no Docker binary, so a scored run
2185
+ always goes through :meth:`from_environment` instead.
2186
+ """
2187
+
2188
+ runtime = EphemeralMailpit(runtime_dir=runtime_dir).start()
2189
+ return cls(runtime.client, runtime=runtime)
2190
+
2191
+ @classmethod
2192
+ def open(
2193
+ cls,
2194
+ *,
2195
+ runtime_dir: str | os.PathLike[str] | None = None,
2196
+ env: Mapping[str, str] = os.environ,
2197
+ ) -> "MailPlane":
2198
+ """Prefer the advertised Mailpit; start a private one when there is none."""
2199
+
2200
+ if cls._configured_socket(env):
2201
+ return cls.from_environment(env)
2202
+ return cls.ephemeral(runtime_dir=runtime_dir)
2203
+
2204
+ @property
2205
+ def socket_path(self) -> str:
2206
+ return self.client.socket_path
2207
+
2208
+ @property
2209
+ def owns_runtime(self) -> bool:
2210
+ """Whether closing this plane stops a Mailpit container."""
2211
+
2212
+ return self._runtime is not None
2213
+
2214
+ def healthy(self) -> bool:
2215
+ return self.client.ready()
2216
+
2217
+ def trial(self, *, bind_host: str = "127.0.0.1") -> MailTrial:
2218
+ """Start one case's write-only candidate mailbox on this plane.
2219
+
2220
+ The result is a context manager, so a caller that owns the mailbox for
2221
+ the length of a ``with`` block needs no other cleanup; a caller that
2222
+ owns it for the length of a case calls :meth:`MailTrial.close`.
2223
+ """
2224
+
2225
+ trial = CandidateMailboxTrial(
2226
+ bind_host=bind_host, mailpit_client=self.client
2227
+ ).start()
2228
+ return MailTrial(trial, private_values=(self.socket_path,))
2229
+
2230
+ def runner_environment(self, base: Mapping[str, str]) -> dict[str, str]:
2231
+ """Add to ``base`` exactly what a child verifier runner needs.
2232
+
2233
+ A trusted CI/CD runner is launched with a scrubbed environment and has
2234
+ to find the same Mailpit; that is one variable, and no other mail
2235
+ coordinate crosses the boundary.
2236
+ """
2237
+
2238
+ return {**dict(base), MAILPIT_HTTP_SOCKET_ENV: self.socket_path}
2239
+
2240
+ def authoring_gateway(
2241
+ self,
2242
+ *,
2243
+ namespace: str,
2244
+ capability: str,
2245
+ bootstrap_token: str,
2246
+ smtp_port: int,
2247
+ bind_host: str = "127.0.0.1",
2248
+ ) -> LocalMailboxSidecar:
2249
+ """Expose the stable loopback writer ABI over this plane, for authoring.
2250
+
2251
+ Capture hands a reference site the same SMTP/bootstrap door a scored
2252
+ candidate gets, so what capture exercises is what a trial will run.
2253
+ There is intentionally no in-memory fallback.
2254
+ """
2255
+
2256
+ if not self.client.ready():
2257
+ raise MailInfrastructureUnavailable("Mailpit is not ready for capture")
2258
+ sidecar = LocalMailboxSidecar(
2259
+ smtp_port=smtp_port,
2260
+ bind_host=bind_host,
2261
+ bootstrap=_Bootstrap(
2262
+ token=bootstrap_token,
2263
+ namespace=namespace,
2264
+ capability=capability,
2265
+ smtp_host=bind_host,
2266
+ smtp_port=smtp_port,
2267
+ ),
2268
+ mailpit_client=self.client,
2269
+ )
2270
+ sidecar.register_namespace(namespace, capability)
2271
+ sidecar.start()
2272
+ return sidecar
2273
+
2274
+ def close(self) -> None:
2275
+ runtime, self._runtime = self._runtime, None
2276
+ if runtime is not None:
2277
+ runtime.close()
2278
+
2279
+ def __enter__(self) -> "MailPlane":
2280
+ return self
2281
+
2282
+ def __exit__(self, exc_type: object, exc: object, traceback: object) -> None:
2283
+ self.close()
2284
+
2285
+
2286
+ def authoring_environment(
2287
+ sidecar: LocalMailboxSidecar,
2288
+ *,
2289
+ namespace: str,
2290
+ capability: str,
2291
+ bootstrap_token: str,
2292
+ smtp_port: int,
2293
+ smtp_host: str = "127.0.0.1",
2294
+ ) -> dict[str, str]:
2295
+ """The complete mail ABI an authoring capture exports around a reference site.
2296
+
2297
+ It is a superset of the candidate ABI: authoring also owns the read
2298
+ credential and the namespace, which a scored candidate never sees. The
2299
+ names are exactly :data:`AUTHORING_MAIL_ENVIRONMENT`.
2300
+ """
2301
+
2302
+ gateway = sidecar.url.rstrip("/")
2303
+ return {
2304
+ "WEBSITEBENCH_MAILBOX_URL": sidecar.url,
2305
+ "WEBSITEBENCH_MAILBOX_ALLOWLIST": "",
2306
+ "WEBSITEBENCH_MAILBOX_CREDENTIAL": capability,
2307
+ "WEBSITEBENCH_MAILBOX_NAMESPACE": namespace,
2308
+ "WEBSITEBENCH_MAILBOX_BOOTSTRAP_URL": f"{gateway}/internal/bootstrap",
2309
+ "WEBSITEBENCH_MAILBOX_BOOTSTRAP_TOKEN": bootstrap_token,
2310
+ "WEBSITEBENCH_SMTP_HOST": smtp_host,
2311
+ "WEBSITEBENCH_SMTP_PORT": str(smtp_port),
2312
+ # Paired capture must present the same sender ABI as a formal candidate
2313
+ # trial: some runtimes pin this exact suffix before opening SMTP, so a
2314
+ # site-specific authoring sender would disable their only mail path.
2315
+ "WEBSITEBENCH_MAIL_API_URL": f"{gateway}/emails",
2316
+ "WEBSITEBENCH_MAIL_API_TOKEN": bootstrap_token,
2317
+ "WEBSITEBENCH_MAIL_FROM": CANDIDATE_MAIL_SENDER,
2318
+ "WEBSITEBENCH_SMTP_FROM": CANDIDATE_MAIL_SENDER,
2319
+ }
2320
+
2321
+
2322
+ def _mint_identity() -> tuple[str, str, str]:
2323
+ """Mint one trial's mailbox identity.
2324
+
2325
+ Minted from ``secrets``, never derived from the public ``seed-<seed>``
2326
+ trial ID, while the inbox token doubles as the browser's access token.
2327
+ Determinism is not lost, because scoring reads no mail.
2328
+ """
2329
+
2330
+ return (
2331
+ f"trial-{secrets.token_hex(16)}",
2332
+ secrets.token_hex(32),
2333
+ secrets.token_urlsafe(32),
2334
+ )
2335
+
2336
+
2337
+ def main(argv: list[str] | None = None) -> int:
2338
+ """Run one trial's mailbox, minting that trial's identity at boot.
2339
+
2340
+ ``materialize`` runs once per *bundle*; a trial is one *run* of that
2341
+ bundle, so a value written into ``docker-compose.yaml`` can never be
2342
+ per-trial. The identity is therefore minted here, by the one process that
2343
+ owns it, and each party learns only its own half over the listener it is
2344
+ allowed to reach: the site reads ``/internal/bootstrap`` on the API
2345
+ listener, the agent gets a bare inbox URL and no credential at all.
2346
+
2347
+ The values come from ``secrets`` rather than from the public
2348
+ ``seed-<seed>`` trial ID. Determinism is not lost, because formal scoring
2349
+ never reads mail.
2350
+ """
2351
+
2352
+ import argparse
2353
+
2354
+ parser = argparse.ArgumentParser(prog="websitebench-local-mailbox")
2355
+ parser.add_argument("--smtp-port", type=int, default=1025)
2356
+ parser.add_argument("--http-port", type=int, default=8025)
2357
+ parser.add_argument("--inbox-port", type=int, default=8026)
2358
+ parser.add_argument("--bind-host", default="127.0.0.1")
2359
+ parser.add_argument(
2360
+ "--api-bind-host",
2361
+ default=None,
2362
+ help="interface for the SMTP and JSON API listeners (defaults to --bind-host)",
2363
+ )
2364
+ parser.add_argument(
2365
+ "--inbox-bind-host",
2366
+ default=None,
2367
+ help="interface for the agent inbox listener (defaults to --bind-host)",
2368
+ )
2369
+ args = parser.parse_args(argv)
2370
+
2371
+ api_bind = (
2372
+ args.api_bind_host
2373
+ or os.environ.get("WEBSITEBENCH_MAILBOX_API_BIND")
2374
+ or args.bind_host
2375
+ )
2376
+ inbox_bind = (
2377
+ args.inbox_bind_host
2378
+ or os.environ.get("WEBSITEBENCH_MAILBOX_INBOX_BIND")
2379
+ or args.bind_host
2380
+ )
2381
+ smtp_advertise_host = (
2382
+ os.environ.get("WEBSITEBENCH_MAILBOX_SMTP_ADVERTISE_HOST", "").strip()
2383
+ or api_bind
2384
+ )
2385
+
2386
+ namespace, capability, inbox_token = _mint_identity()
2387
+ bootstrap_token = os.environ.get("WEBSITEBENCH_MAILBOX_BOOTSTRAP_TOKEN", "")
2388
+ if len(bootstrap_token) < 32:
2389
+ raise SystemExit(
2390
+ "WEBSITEBENCH_MAILBOX_BOOTSTRAP_TOKEN must be at least 32 characters"
2391
+ )
2392
+ try:
2393
+ mailpit_client = MailPlane.from_environment().client
2394
+ except MailInfrastructureUnavailable as error:
2395
+ # The sidecar discovers its store the same way the evaluator does, and
2396
+ # refuses to serve an in-memory production mailbox when there is none.
2397
+ raise SystemExit(f"{error}; refusing an in-memory production mailbox")
2398
+
2399
+ stopped = threading.Event()
2400
+ signal.signal(signal.SIGTERM, lambda _signum, _frame: stopped.set())
2401
+ signal.signal(signal.SIGINT, lambda _signum, _frame: stopped.set())
2402
+ sidecar = LocalMailboxSidecar(
2403
+ smtp_port=args.smtp_port,
2404
+ http_port=args.http_port,
2405
+ bind_host=api_bind,
2406
+ inbox_port=args.inbox_port,
2407
+ inbox_bind_host=inbox_bind,
2408
+ inbox_namespace=namespace,
2409
+ inbox_token=inbox_token,
2410
+ bootstrap=_Bootstrap(
2411
+ token=bootstrap_token,
2412
+ namespace=namespace,
2413
+ capability=capability,
2414
+ smtp_host=smtp_advertise_host,
2415
+ smtp_port=args.smtp_port,
2416
+ ),
2417
+ mailpit_client=mailpit_client,
2418
+ )
2419
+ sidecar.register_namespace(namespace, capability)
2420
+ sidecar.start()
2421
+ # The inbox path is the agent's entry point and holds no secret beyond the
2422
+ # token that scopes it to this trial; nothing else about the trial is
2423
+ # printed, and the capability never is.
2424
+ print(f"inbox listening on {inbox_bind}:{args.inbox_port}", flush=True)
2425
+ try:
2426
+ stopped.wait()
2427
+ finally:
2428
+ sidecar.close()
2429
+ return 0
2430
+
2431
+
2432
+ if __name__ == "__main__":
2433
+ raise SystemExit(main(sys.argv[1:]))
tasks/asana/environment/reference/.websitebench-reference-tls/ca.crt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDSzCCAjOgAwIBAgIJV1NCSEFSQk9SMA0GCSqGSIb3DQEBCwUAMDExLzAtBgNV
3
+ BAMMJldlYnNpdGVCZW5jaCBIYXJib3IgTG9jYWwgUmVmZXJlbmNlIENBMB4XDTI2
4
+ MDgyMjEzMDg1NloXDTQ2MDgyMjEzMDg1NlowMTEvMC0GA1UEAwwmV2Vic2l0ZUJl
5
+ bmNoIEhhcmJvciBMb2NhbCBSZWZlcmVuY2UgQ0EwggEiMA0GCSqGSIb3DQEBAQUA
6
+ A4IBDwAwggEKAoIBAQCnBZES7bXJo/hajL5T54GDV/FLmQxmk0dGN+aPwRrgpiN6
7
+ syddg/krh/dhiUzfxgJV+6ajnYuYyQ4BVo1rQGY0va95T8cjcHgC7EyEAaDUZF+i
8
+ qo3v/ucMmquZodezEkghWz6FDcGH3dDtz0bQyYgoGQKnioeYXsVlfvIzXJpE1VTW
9
+ iGUH83/APzvPInZ5jRRrCEnqj1WtSoi+Yycs/eaYueDomoZeT3xvK5MTz6tC6EvW
10
+ hAh8qyv2DjPZUSToiZH23X6qXYRkKkLDXHWHfhamRwlFoh9pp2s4D+Cq/Wke+o2f
11
+ /cj8KvAkTnMo4iMmZFpb/NRaGjhfy8UBPuM7SwMJAgMBAAGjZjBkMB0GA1UdDgQW
12
+ BBQn+U1eizvlvKbfavSxHoXFYQ/UfTAfBgNVHSMEGDAWgBQn+U1eizvlvKbfavSx
13
+ HoXFYQ/UfTASBgNVHRMBAf8ECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwIBBjANBgkq
14
+ hkiG9w0BAQsFAAOCAQEAoSC3zzZEAs2eigloiDkdeh98+2cPmcs44TG+TU6sq6SP
15
+ EBEgHg/c6yzh74UijEImksT9aZ+LxtTNM+nfNFzWku1T3R7gSimP5TSnC4rTEhfM
16
+ Ih8fMoUbcAe/uFwVE9UHn/QQNsqRg6hg2jdUlmwr206e62/eBQXDNeuLcapAxcdU
17
+ VYno4HNi5gAaakS2dM/IgiorRqM7SVT+s8B9Fl0mzMdRNCUeOOU4q8zGtQGp4IV+
18
+ x/LZIMsLogP2Rpks8ecyanRSXYpGbqpZ+14rcO5bdWQ7P8B/sFssT3b1mR3H/aVh
19
+ yZycwgzCbkbdMaxyz2Vm/c7PVb3so5Xb98jufp2L9A==
20
+ -----END CERTIFICATE-----
tasks/asana/environment/reference/.websitebench-reference-tls/reference.crt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDWjCCAkKgAwIBAgIIV1NCUkVGMDEwDQYJKoZIhvcNAQELBQAwMTEvMC0GA1UE
3
+ AwwmV2Vic2l0ZUJlbmNoIEhhcmJvciBMb2NhbCBSZWZlcmVuY2UgQ0EwHhcNMjYw
4
+ ODIyMTMwODU2WhcNNDYwODIyMTMwODU2WjAUMRIwEAYDVQQDDAlyZWZlcmVuY2Uw
5
+ ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDNJXc7onbK78RiLSAe3LjI
6
+ eko9xNumYRejoB+kKFGLBL4U7vY+02coiXpne4e1CMzUVzRiaQ9i9XHBe0Oq4CR1
7
+ HW7wzMRV8XVM5/dVq+j0vZVarZbITyHSWHwypa7yPL7o/kBekdwi8ncdUy/mhYqw
8
+ 7sOdM4Nq0ifj+lcJ/rwSqjvcML4//4THY9CP5iB2YT+U+Z7F/JfLOJFZ12l4Sglx
9
+ RDf1awDLJpGfpX0kRgW7jYuWf49C5VcPjggTRl1WYy1qrgaNIFu75sresXYkDgRx
10
+ uLiXfc/6wNwykh9fQo+GNFqBGy2lC8Ey425m4XEROraenAGMqVMfxJsJ5wjqRhlV
11
+ AgMBAAGjgZIwgY8wDAYDVR0TAQH/BAIwADAOBgNVHQ8BAf8EBAMCBaAwEwYDVR0l
12
+ BAwwCgYIKwYBBQUHAwEwGgYDVR0RBBMwEYIJcmVmZXJlbmNlhwR/AAABMB0GA1Ud
13
+ DgQWBBQ0EtbLFU1HI9Wdikc8qRx8TdRT8TAfBgNVHSMEGDAWgBQn+U1eizvlvKbf
14
+ avSxHoXFYQ/UfTANBgkqhkiG9w0BAQsFAAOCAQEATXVQdAfuOvbbsBhNHCvfoYuM
15
+ rgnUOdAHevutvg/gPe6AcshAJMvvfL6J/TpimY+TKDqVBVs0qB6jXjgZURQ9EsFR
16
+ WDJywamDHAFNTTuq1A+78VAS3LK3z54JH2BRlvtjnEDkzDei0/brOentce73YwVR
17
+ XU6+y/yGlSYGdq63wzDxBOUwD/I/src9WpmYqrSwstlD1epemMUIsfDpfSRcGYM2
18
+ tB+zMBccmP/hrB3eJcrjiediwhSBNJjdKysK66GzFRqcyGwwvsz1YPbWcpcQXoVZ
19
+ nnNXEs5TrxTj67/DLuP/233oEoz2XQNh1O2ohq1o5JMu4hbotqkepCwcidNBmQ==
20
+ -----END CERTIFICATE-----
tasks/asana/environment/reference/.websitebench-reference-tls/reference.key ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -----BEGIN PRIVATE KEY-----
2
+ MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDNJXc7onbK78Ri
3
+ LSAe3LjIeko9xNumYRejoB+kKFGLBL4U7vY+02coiXpne4e1CMzUVzRiaQ9i9XHB
4
+ e0Oq4CR1HW7wzMRV8XVM5/dVq+j0vZVarZbITyHSWHwypa7yPL7o/kBekdwi8ncd
5
+ Uy/mhYqw7sOdM4Nq0ifj+lcJ/rwSqjvcML4//4THY9CP5iB2YT+U+Z7F/JfLOJFZ
6
+ 12l4SglxRDf1awDLJpGfpX0kRgW7jYuWf49C5VcPjggTRl1WYy1qrgaNIFu75sre
7
+ sXYkDgRxuLiXfc/6wNwykh9fQo+GNFqBGy2lC8Ey425m4XEROraenAGMqVMfxJsJ
8
+ 5wjqRhlVAgMBAAECggEAIdiyWyGzKUjVVSBeWhEvII6CpL3Pwpvmz02KIuavC3l5
9
+ FhGWCagN71N9YUjxizYcO1V29FyimABoaBR7BdyMz1DPnsWeCBL6ODnWZilimkyU
10
+ MX2N8NcTfLWyKhYJbviERAM84g19LTvlWK6Cqu0yBH6kQhG/dzacs8G4LhM7+vUU
11
+ +43RFW4GFmYDXtfUEZuZ8IRzWxDdXQ9yVnKxKrhuYj4/UYgTTspOx87m++Ft6BJR
12
+ IQRw1dZ7dE2R8pZbYQdOXRXSjf59KisJSr9N2+mYZYNUWWv7zF8bmD17hxtsQk9C
13
+ wesyN3DqzoLHK3GfoG3ZuA+v3aEVKHRk8Tc1aosYyQKBgQD0ddALajm0XHictsG3
14
+ /JTC1RL0nj+SoVVgYdWccA7VUs68Cbpq1RYzUawDOhYlQjbJBJTQ9z5kwWP+50vH
15
+ VPjpU/cMFx4d63WwDEXcC2o09mh3OjkfujUdRroyn6rJgKXuSJeMAz0JrGCTIS91
16
+ 0t2cmoSqKSIaN2oU5IsONLg6SQKBgQDW1JBCiP1c6tYi9wKpEJLjlRqSIsLgLApg
17
+ h6o1sWFfUrbQ21ORS1jhLnCkJsyLWoyZkUgwaXbXoLoVw3kIdPLJ8TI1FJ+ZPYdt
18
+ EJcvvVjmJIrcq9um1qoKKpmiKuwRe4/OYdFQcdTRwob1wpoAi7T9CfiNgo53WHsR
19
+ mviPzSEGrQKBgQDnpL+YIXc+niU4MsFL6463NBq7Kz0IX9I7+1jj3RdhMw9tBTbd
20
+ Rr+7r1d001Tqx1yMjMfLX42DAfIUN+4Jm04mIwdFMJ68MUMap/aGtVZVi2ygFc7N
21
+ brAn5r5HfB7kw//31FeuN99dzDbTFC4Z0s9mNtEhQMrs1rexxoKx2mj76QKBgBi5
22
+ AZkGltG4nMgNURsPszfJkvM6WN7fcppFQotHTINhy3QhqW5RE3tmksPxSxzGYOPT
23
+ WlFn8atC7edPRYB5pO8keLivFObXs9wTSrLNwYtKrUhT5sU+cvcUi/WjpuMkKxp/
24
+ G018rBcvocRqjrp9WWi9WwM+ARMu9YrDINO7sY9JAoGBAJlTUtKVOOuaujK53Vnq
25
+ 2O5FrC/HcsUa1nTRO/WSDyUjGWeqAr75yi05UD6M2tTov1uGbtg47Q5n6eqjVyy3
26
+ FTYmG+lVbVXjVcOFuUhZxJhELsHulsJ1LRPAJccC0Uci8IZ8rfIZyREn7tKpBJI4
27
+ 4s+BQ5R45Cv3eUi2JU/xuAtK
28
+ -----END PRIVATE KEY-----
tasks/asana/environment/reference/.websitebench-reference-tls/tls_proxy.py ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Terminate trusted local TLS in front of a Harbor reference process.
2
+
3
+ The reference application's own launch contract remains HTTP on loopback. The
4
+ Agent-facing Docker service is HTTPS only, so Secure ``__Host-`` cookies have
5
+ the same browser semantics as the source site without changing clone code.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import asyncio
11
+ import contextlib
12
+ import os
13
+ import signal
14
+ import ssl
15
+ import subprocess
16
+ import sys
17
+ from pathlib import Path
18
+
19
+
20
+ BUFFER_SIZE = 64 * 1024
21
+ STARTUP_TIMEOUT_SECONDS = 30.0
22
+
23
+
24
+ async def _copy_stream(
25
+ reader: asyncio.StreamReader,
26
+ writer: asyncio.StreamWriter,
27
+ ) -> None:
28
+ while block := await reader.read(BUFFER_SIZE):
29
+ writer.write(block)
30
+ await writer.drain()
31
+
32
+
33
+ async def _forward(
34
+ client_reader: asyncio.StreamReader,
35
+ client_writer: asyncio.StreamWriter,
36
+ *,
37
+ upstream_port: int,
38
+ ) -> None:
39
+ try:
40
+ upstream_reader, upstream_writer = await asyncio.open_connection(
41
+ "127.0.0.1", upstream_port
42
+ )
43
+ except OSError:
44
+ client_writer.close()
45
+ await client_writer.wait_closed()
46
+ return
47
+
48
+ tasks = {
49
+ asyncio.create_task(_copy_stream(client_reader, upstream_writer)),
50
+ asyncio.create_task(_copy_stream(upstream_reader, client_writer)),
51
+ }
52
+ try:
53
+ _done, pending = await asyncio.wait(
54
+ tasks, return_when=asyncio.FIRST_COMPLETED
55
+ )
56
+ for task in pending:
57
+ task.cancel()
58
+ await asyncio.gather(*tasks, return_exceptions=True)
59
+ finally:
60
+ upstream_writer.close()
61
+ client_writer.close()
62
+ with contextlib.suppress(OSError):
63
+ await upstream_writer.wait_closed()
64
+ with contextlib.suppress(OSError):
65
+ await client_writer.wait_closed()
66
+
67
+
68
+ async def _wait_for_upstream(process: subprocess.Popen[bytes], port: int) -> None:
69
+ loop = asyncio.get_running_loop()
70
+ deadline = loop.time() + STARTUP_TIMEOUT_SECONDS
71
+ while loop.time() < deadline:
72
+ return_code = process.poll()
73
+ if return_code is not None:
74
+ raise RuntimeError(
75
+ f"reference process exited before readiness with {return_code}"
76
+ )
77
+ try:
78
+ _reader, writer = await asyncio.open_connection("127.0.0.1", port)
79
+ except OSError:
80
+ await asyncio.sleep(0.1)
81
+ continue
82
+ writer.close()
83
+ await writer.wait_closed()
84
+ return
85
+ raise TimeoutError("reference process did not open its loopback port")
86
+
87
+
88
+ async def _terminate(process: subprocess.Popen[bytes]) -> None:
89
+ if process.poll() is not None:
90
+ return
91
+ process.terminate()
92
+ try:
93
+ await asyncio.wait_for(asyncio.to_thread(process.wait), timeout=10.0)
94
+ except TimeoutError:
95
+ process.kill()
96
+ await asyncio.to_thread(process.wait)
97
+
98
+
99
+ async def _serve(command: list[str]) -> int:
100
+ external_port = int(os.environ.get("PORT", "8080"))
101
+ upstream_port = int(
102
+ os.environ.get("WEBSITEBENCH_REFERENCE_UPSTREAM_PORT", "18080")
103
+ )
104
+ if external_port == upstream_port:
105
+ raise ValueError("reference TLS and upstream ports must differ")
106
+
107
+ child_environment = dict(os.environ)
108
+ child_environment["HOST"] = "127.0.0.1"
109
+ child_environment["PORT"] = str(upstream_port)
110
+ process = subprocess.Popen(command, env=child_environment)
111
+ server: asyncio.AbstractServer | None = None
112
+ try:
113
+ await _wait_for_upstream(process, upstream_port)
114
+ tls_root = Path(__file__).resolve().parent
115
+ context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
116
+ context.minimum_version = ssl.TLSVersion.TLSv1_2
117
+ context.load_cert_chain(
118
+ certfile=tls_root / "reference.crt",
119
+ keyfile=tls_root / "reference.key",
120
+ )
121
+ server = await asyncio.start_server(
122
+ lambda reader, writer: _forward(
123
+ reader, writer, upstream_port=upstream_port
124
+ ),
125
+ "0.0.0.0",
126
+ external_port,
127
+ ssl=context,
128
+ )
129
+ print(
130
+ "WebsiteBench reference HTTPS ready on "
131
+ f"0.0.0.0:{external_port}; upstream=127.0.0.1:{upstream_port}",
132
+ flush=True,
133
+ )
134
+
135
+ stop = asyncio.Event()
136
+ loop = asyncio.get_running_loop()
137
+ for signum in (signal.SIGINT, signal.SIGTERM):
138
+ loop.add_signal_handler(signum, stop.set)
139
+ process_wait = asyncio.create_task(asyncio.to_thread(process.wait))
140
+ stop_wait = asyncio.create_task(stop.wait())
141
+ done, pending = await asyncio.wait(
142
+ {process_wait, stop_wait}, return_when=asyncio.FIRST_COMPLETED
143
+ )
144
+ for task in pending:
145
+ task.cancel()
146
+ await asyncio.gather(*pending, return_exceptions=True)
147
+ if process_wait in done:
148
+ return process_wait.result()
149
+ return 0
150
+ finally:
151
+ if server is not None:
152
+ server.close()
153
+ await server.wait_closed()
154
+ await _terminate(process)
155
+
156
+
157
+ def main() -> int:
158
+ if len(sys.argv) < 2:
159
+ raise SystemExit("usage: tls_proxy.py COMMAND [ARG ...]")
160
+ return asyncio.run(_serve(sys.argv[1:]))
161
+
162
+
163
+ if __name__ == "__main__":
164
+ raise SystemExit(main())
tasks/asana/environment/reference/Dockerfile ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.12.11-slim-bookworm@sha256:519591d6871b7bc437060736b9f7456b8731f1499a57e22e6c285135ae657bf7
2
+ WORKDIR /srv/reference
3
+ # BEGIN WebsiteBench runtime dependencies
4
+ COPY --from=ghcr.io/astral-sh/uv:0.12.8@sha256:d1cbaeadc234fe19c0d93daabcf5e98738cd93c6d1dd4918ef6aa30735feb23a /uv /usr/local/bin/uv
5
+ COPY vendor.requirements.lock vendor.requirements.lock
6
+ RUN uv pip install --python /usr/local/bin/python --no-cache --no-deps --require-hashes --only-binary :all: --link-mode copy --target vendor -r vendor.requirements.lock && rm -f vendor/.lock
7
+ # END WebsiteBench runtime dependencies
8
+ COPY . .
9
+ ENV HOST=0.0.0.0 PORT=8080 DATA_DIR=/tmp/websitebench-asana-reference-data SEED=0 TZ=UTC
10
+ RUN ./compile.sh
11
+ HEALTHCHECK --interval=2s --timeout=3s --retries=30 CMD python3 -c "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8080/healthz', timeout=2)"
12
+ CMD ["./executable"]
13
+
14
+ # Added by the WebsiteBench Harbor materializer. The original app runs only on loopback; the Agent-facing reference is trusted HTTPS.
15
+ COPY .websitebench-reference-tls/ /opt/websitebench/reference-tls/
16
+ RUN chmod 600 /opt/websitebench/reference-tls/reference.key && chmod 755 /opt/websitebench/reference-tls/tls_proxy.py
17
+ ENV WEBSITEBENCH_REFERENCE_UPSTREAM_PORT=18080
18
+ HEALTHCHECK --interval=2s --timeout=3s --retries=30 CMD python3 -c "import os,ssl,urllib.request as r;c=ssl.create_default_context(cafile='/opt/websitebench/reference-tls/ca.crt');u='https://127.0.0.1:'+os.environ.get('PORT','8080')+'/healthz';r.urlopen(u,context=c,timeout=2).close()"
19
+ CMD ["python3", "/opt/websitebench/reference-tls/tls_proxy.py", "./run.sh"]
tasks/asana/environment/reference/README.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ # Direct reference adapter
2
+
3
+ Add Dockerfile, compile.sh, run.sh, solve.sh and optional oracle helpers.
4
+
5
+ The offline fixture includes `demo.owner@asana.example.test` with password
6
+ `AsanaDemo2026!`. Sign in through `/-/login` or `POST /api/auth/login`; the
7
+ normal authenticated handler creates this user's synthetic demo workspace.
8
+ The fixture uses the same hashed credentials, session rotation, and workspace
9
+ permissions as registered users. Registration remains a separate verified
10
+ mail flow; no management endpoint is used to establish a session.
tasks/asana/environment/reference/backend/model.json ADDED
@@ -0,0 +1,430 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "offline-clone.backend-model.v1",
3
+ "site_id": "asana",
4
+ "status": "verified",
5
+ "profile": "offline-benchmark",
6
+ "database": {
7
+ "engine": "sqlite",
8
+ "location_policy": "runtime-data-outside-candidate",
9
+ "concurrency_model": "wal-transactional-single-writer",
10
+ "migration_strategy": "versioned-forward-migrations",
11
+ "deterministic_reset": true,
12
+ "restart_persistence": true,
13
+ "site_isolation": "one-database-per-site",
14
+ "proofs": [
15
+ {
16
+ "obligation": "data-location",
17
+ "status": "verified",
18
+ "evidence": ["clone/tests/test_backend_contract.py::test_backend_data_location_binding_and_migration"]
19
+ },
20
+ {
21
+ "obligation": "schema-migration",
22
+ "status": "verified",
23
+ "evidence": ["clone/tests/test_backend_contract.py::test_backend_data_location_binding_and_migration"]
24
+ },
25
+ {
26
+ "obligation": "deterministic-reset",
27
+ "status": "verified",
28
+ "evidence": ["clone/tests/test_backend_contract.py::test_backend_reset_is_deterministic_and_site_bound"]
29
+ },
30
+ {
31
+ "obligation": "restart-persistence",
32
+ "status": "verified",
33
+ "evidence": ["clone/tests/test_backend_contract.py::test_backend_restart_persistence_and_backup_restore"]
34
+ },
35
+ {
36
+ "obligation": "backup-restore",
37
+ "status": "verified",
38
+ "evidence": ["clone/tests/test_backend_contract.py::test_backend_restart_persistence_and_backup_restore"]
39
+ },
40
+ {
41
+ "obligation": "concurrency",
42
+ "status": "verified",
43
+ "evidence": ["clone/tests/test_backend_contract.py::test_backend_wal_concurrency_serializes_writers"]
44
+ }
45
+ ]
46
+ },
47
+ "auth_semantics": {
48
+ "account_database_scope": "site-isolated",
49
+ "credential_storage": "salted-scrypt-hash",
50
+ "session_storage": "opaque-cookie-digest-at-rest",
51
+ "registration_account_creation": "after-email-verification",
52
+ "verification_challenge_storage": "salted-hash",
53
+ "password_reset_enumeration": "indistinguishable-public-response",
54
+ "mail_default": "LOCAL_ONLY",
55
+ "mail_statuses": [
56
+ "LOCAL_ONLY",
57
+ "SMTP_PENDING",
58
+ "SMTP_SENT",
59
+ "SMTP_FAILED"
60
+ ],
61
+ "smtp_activation": "explicit-complete-config-only",
62
+ "smtp_delivery_ceiling": 3,
63
+ "rejected_secret_journaling": "forbidden",
64
+ "legacy_write_policy": "read-compatible-write-rejected"
65
+ },
66
+ "common_capabilities": {
67
+ "account_registration": "account-registration",
68
+ "account_sign_in": "account-sign-in",
69
+ "session_lifecycle": "session-lifecycle",
70
+ "password_recovery": "password-recovery",
71
+ "email_delivery": "email-delivery"
72
+ },
73
+ "capabilities": [
74
+ {
75
+ "id": "account-registration",
76
+ "label": "Verified local account registration",
77
+ "priority": "p0",
78
+ "category": "authentication",
79
+ "implementation_status": "verified",
80
+ "entities": [
81
+ {
82
+ "name": "pending-registration",
83
+ "identity": "opaque pending id bound to one browser session",
84
+ "owner_scope": "session",
85
+ "persistence": "durable"
86
+ },
87
+ {
88
+ "name": "local-account",
89
+ "identity": "site-local account id and unique normalized email",
90
+ "owner_scope": "account",
91
+ "persistence": "durable"
92
+ }
93
+ ],
94
+ "state_machine": {
95
+ "kind": "challenge-lifecycle",
96
+ "states": [
97
+ "collecting",
98
+ "pending-verification",
99
+ "verified",
100
+ "account-created",
101
+ "expired",
102
+ "locked"
103
+ ],
104
+ "transitions": [
105
+ {
106
+ "from": "collecting",
107
+ "to": "pending-verification",
108
+ "trigger": "validated registration request"
109
+ },
110
+ {
111
+ "from": "pending-verification",
112
+ "to": "verified",
113
+ "trigger": "correct unexpired code within attempt budget"
114
+ },
115
+ {
116
+ "from": "verified",
117
+ "to": "account-created",
118
+ "trigger": "transactional account creation and session rotation"
119
+ },
120
+ {
121
+ "from": "pending-verification",
122
+ "to": "expired",
123
+ "trigger": "challenge expiry"
124
+ },
125
+ {
126
+ "from": "pending-verification",
127
+ "to": "locked",
128
+ "trigger": "verification attempt budget exhausted"
129
+ }
130
+ ]
131
+ },
132
+ "server_authorities": [
133
+ "The server normalizes identity and hashes password and code.",
134
+ "An account is created only after successful verification.",
135
+ "Duplicate normalized email creation is rejected transactionally."
136
+ ],
137
+ "external_effect": "none",
138
+ "journey_ids": ["auth-signup", "auth-signup-invalid"],
139
+ "invariant_ids": ["auth-protection", "no-false-success"],
140
+ "proofs": {
141
+ "evidence": {
142
+ "valid": ["clone/tests/test_auth.py::test_signup_verify_creates_seeded_workspace"],
143
+ "invalid": ["clone/tests/test_auth.py::test_signup_validation"],
144
+ "duplicate": ["clone/tests/test_auth.py::test_duplicate_signup_conflict"],
145
+ "stale": ["tests/local_clone_auth/test_local_clone_auth.py"],
146
+ "foreign-owner": ["tests/local_clone_auth/test_local_clone_auth.py"],
147
+ "unauthorized-role": ["clone/tests/test_auth.py::test_protected_routes_require_auth"],
148
+ "restart": ["tests/site_backend/test_profiles.py"],
149
+ "migration": ["tests/local_clone_auth/test_local_clone_auth.py::test_schema_wal_migration_and_session_token_digest_only"],
150
+ "concurrency": ["tests/local_clone_auth/test_local_clone_auth.py::test_registration_and_mail_claims_are_serialized_under_concurrency"]
151
+ },
152
+ "not_applicable": []
153
+ }
154
+ },
155
+ {
156
+ "id": "account-sign-in",
157
+ "label": "Password-based local account sign-in",
158
+ "priority": "p0",
159
+ "category": "authentication",
160
+ "implementation_status": "verified",
161
+ "entities": [
162
+ {
163
+ "name": "local-account",
164
+ "identity": "site-local account id and normalized email",
165
+ "owner_scope": "account",
166
+ "persistence": "durable"
167
+ }
168
+ ],
169
+ "state_machine": {
170
+ "kind": "entity-lifecycle",
171
+ "states": [
172
+ "signed-out",
173
+ "identified",
174
+ "authenticated",
175
+ "rejected"
176
+ ],
177
+ "transitions": [
178
+ {
179
+ "from": "signed-out",
180
+ "to": "identified",
181
+ "trigger": "normalized email submitted"
182
+ },
183
+ {
184
+ "from": "identified",
185
+ "to": "authenticated",
186
+ "trigger": "constant-time password verification succeeds"
187
+ },
188
+ {
189
+ "from": "identified",
190
+ "to": "rejected",
191
+ "trigger": "credentials are invalid"
192
+ }
193
+ ]
194
+ },
195
+ "server_authorities": [
196
+ "The server verifies salted password hashes.",
197
+ "The server rotates the authenticated session.",
198
+ "Client-selected fixture identity is not authentication."
199
+ ],
200
+ "external_effect": "none",
201
+ "journey_ids": ["auth-login", "auth-login-bad"],
202
+ "invariant_ids": ["auth-protection"],
203
+ "proofs": {
204
+ "evidence": {
205
+ "valid": ["clone/tests/test_auth.py::test_login_logout_cycle"],
206
+ "invalid": ["clone/tests/test_auth.py::test_bad_credentials"],
207
+ "duplicate": ["tests/local_clone_auth/test_local_clone_auth.py"],
208
+ "stale": ["tests/local_clone_auth/test_local_clone_auth.py"],
209
+ "foreign-owner": ["clone/tests/test_admin.py::test_workspace_isolation_between_accounts"],
210
+ "unauthorized-role": ["clone/tests/test_auth.py::test_protected_routes_require_auth"],
211
+ "restart": ["tests/site_backend/test_profiles.py"],
212
+ "migration": ["tests/local_clone_auth/test_local_clone_auth.py::test_schema_wal_migration_and_session_token_digest_only"],
213
+ "concurrency": ["tests/local_clone_auth/test_local_clone_auth.py::test_registration_and_mail_claims_are_serialized_under_concurrency"]
214
+ },
215
+ "not_applicable": []
216
+ }
217
+ },
218
+ {
219
+ "id": "session-lifecycle",
220
+ "label": "Anonymous and authenticated browser sessions",
221
+ "priority": "p0",
222
+ "category": "authentication",
223
+ "implementation_status": "verified",
224
+ "entities": [
225
+ {
226
+ "name": "browser-session",
227
+ "identity": "opaque cookie token with digest persisted at rest",
228
+ "owner_scope": "session",
229
+ "persistence": "durable"
230
+ }
231
+ ],
232
+ "state_machine": {
233
+ "kind": "session-lifecycle",
234
+ "states": [
235
+ "anonymous",
236
+ "authenticated",
237
+ "revoked",
238
+ "expired"
239
+ ],
240
+ "transitions": [
241
+ {
242
+ "from": "anonymous",
243
+ "to": "authenticated",
244
+ "trigger": "successful sign-in or registration rotates session"
245
+ },
246
+ {
247
+ "from": "authenticated",
248
+ "to": "revoked",
249
+ "trigger": "sign-out or security reset"
250
+ },
251
+ {
252
+ "from": "anonymous",
253
+ "to": "expired",
254
+ "trigger": "session expiry"
255
+ },
256
+ {
257
+ "from": "authenticated",
258
+ "to": "expired",
259
+ "trigger": "session expiry"
260
+ }
261
+ ]
262
+ },
263
+ "server_authorities": [
264
+ "Raw session tokens are never stored in the database.",
265
+ "Ownership is resolved from the server-side session record.",
266
+ "Sign-out revokes server-side authority before deleting the cookie."
267
+ ],
268
+ "external_effect": "none",
269
+ "journey_ids": ["auth-login", "auth-logout"],
270
+ "invariant_ids": ["auth-protection"],
271
+ "proofs": {
272
+ "evidence": {
273
+ "valid": ["clone/tests/test_auth.py::test_security_sessions"],
274
+ "invalid": ["clone/tests/test_auth.py::test_protected_routes_require_auth"],
275
+ "duplicate": ["tests/local_clone_auth/test_local_clone_auth.py"],
276
+ "stale": ["tests/local_clone_auth/test_local_clone_auth.py"],
277
+ "foreign-owner": ["clone/tests/test_admin.py::test_workspace_isolation_between_accounts"],
278
+ "unauthorized-role": ["clone/tests/test_auth.py::test_protected_routes_require_auth"],
279
+ "restart": ["tests/site_backend/test_profiles.py"],
280
+ "migration": ["tests/local_clone_auth/test_local_clone_auth.py::test_schema_wal_migration_and_session_token_digest_only"],
281
+ "concurrency": ["tests/local_clone_auth/test_local_clone_auth.py::test_registration_and_mail_claims_are_serialized_under_concurrency"]
282
+ },
283
+ "not_applicable": []
284
+ }
285
+ },
286
+ {
287
+ "id": "password-recovery",
288
+ "label": "Enumeration-resistant local password recovery",
289
+ "priority": "p0",
290
+ "category": "authentication",
291
+ "implementation_status": "verified",
292
+ "entities": [
293
+ {
294
+ "name": "password-reset-challenge",
295
+ "identity": "opaque reset id bound to one browser session",
296
+ "owner_scope": "session",
297
+ "persistence": "durable"
298
+ },
299
+ {
300
+ "name": "local-account",
301
+ "identity": "nullable concealed account binding",
302
+ "owner_scope": "account",
303
+ "persistence": "durable"
304
+ }
305
+ ],
306
+ "state_machine": {
307
+ "kind": "challenge-lifecycle",
308
+ "states": [
309
+ "requested",
310
+ "verified",
311
+ "consumed",
312
+ "expired",
313
+ "locked"
314
+ ],
315
+ "transitions": [
316
+ {
317
+ "from": "requested",
318
+ "to": "verified",
319
+ "trigger": "correct unexpired code within attempt budget"
320
+ },
321
+ {
322
+ "from": "verified",
323
+ "to": "consumed",
324
+ "trigger": "password is replaced and sessions are revoked"
325
+ },
326
+ {
327
+ "from": "requested",
328
+ "to": "expired",
329
+ "trigger": "challenge expiry"
330
+ },
331
+ {
332
+ "from": "requested",
333
+ "to": "locked",
334
+ "trigger": "verification attempt budget exhausted"
335
+ }
336
+ ]
337
+ },
338
+ "server_authorities": [
339
+ "Known and unknown emails receive indistinguishable public responses.",
340
+ "Only the server binds a reset flow to an account.",
341
+ "Password replacement revokes prior authenticated sessions."
342
+ ],
343
+ "external_effect": "local-only",
344
+ "journey_ids": ["auth-reset"],
345
+ "invariant_ids": ["auth-protection", "no-false-success"],
346
+ "proofs": {
347
+ "evidence": {
348
+ "valid": ["clone/tests/test_auth.py::test_password_reset_flow"],
349
+ "invalid": ["clone/tests/test_auth.py::test_forgot_does_not_enumerate"],
350
+ "duplicate": ["tests/local_clone_auth/test_local_clone_auth.py"],
351
+ "stale": ["tests/local_clone_auth/test_local_clone_auth.py"],
352
+ "foreign-owner": ["tests/local_clone_auth/test_local_clone_auth.py"],
353
+ "unauthorized-role": ["clone/tests/test_auth.py::test_protected_routes_require_auth"],
354
+ "restart": ["tests/site_backend/test_profiles.py"],
355
+ "migration": ["tests/local_clone_auth/test_local_clone_auth.py::test_schema_wal_migration_and_session_token_digest_only"],
356
+ "concurrency": ["tests/local_clone_auth/test_local_clone_auth.py::test_registration_and_mail_claims_are_serialized_under_concurrency"]
357
+ },
358
+ "not_applicable": []
359
+ }
360
+ },
361
+ {
362
+ "id": "email-delivery",
363
+ "label": "Truthful local verification and recovery mail outbox",
364
+ "priority": "p0",
365
+ "category": "communication",
366
+ "implementation_status": "verified",
367
+ "entities": [
368
+ {
369
+ "name": "mail-outbox-entry",
370
+ "identity": "site-local outbox id and purpose-bound flow id",
371
+ "owner_scope": "system",
372
+ "persistence": "durable"
373
+ }
374
+ ],
375
+ "state_machine": {
376
+ "kind": "delivery-lifecycle",
377
+ "states": [
378
+ "local-only",
379
+ "smtp-pending",
380
+ "smtp-sent",
381
+ "smtp-failed"
382
+ ],
383
+ "transitions": [
384
+ {
385
+ "from": "local-only",
386
+ "to": "smtp-pending",
387
+ "trigger": "operator enables complete explicit SMTP configuration"
388
+ },
389
+ {
390
+ "from": "smtp-pending",
391
+ "to": "smtp-sent",
392
+ "trigger": "SMTP transport confirms delivery handoff"
393
+ },
394
+ {
395
+ "from": "smtp-pending",
396
+ "to": "smtp-failed",
397
+ "trigger": "delivery attempt fails or ceiling is reached"
398
+ },
399
+ {
400
+ "from": "smtp-failed",
401
+ "to": "smtp-pending",
402
+ "trigger": "bounded idempotent retry below the delivery ceiling"
403
+ }
404
+ ]
405
+ },
406
+ "server_authorities": [
407
+ "Offline mode records LOCAL_ONLY and never claims external delivery.",
408
+ "SMTP is disabled unless every required setting is present.",
409
+ "Claim, retry, and startup replay share one delivery ceiling."
410
+ ],
411
+ "external_effect": "local-only",
412
+ "journey_ids": ["auth-signup", "auth-reset"],
413
+ "invariant_ids": ["no-false-success"],
414
+ "proofs": {
415
+ "evidence": {
416
+ "valid": ["clone/tests/test_auth.py::test_password_reset_flow"],
417
+ "invalid": ["tests/local_clone_auth/test_local_clone_auth.py"],
418
+ "duplicate": ["tests/local_clone_auth/test_local_clone_auth.py"],
419
+ "stale": ["tests/local_clone_auth/test_local_clone_auth.py"],
420
+ "foreign-owner": ["tests/local_clone_auth/test_local_clone_auth.py"],
421
+ "unauthorized-role": ["tests/local_clone_auth/test_local_clone_auth.py"],
422
+ "restart": ["tests/local_clone_auth/test_local_clone_auth.py"],
423
+ "migration": ["tests/local_clone_auth/test_local_clone_auth.py::test_schema_wal_migration_and_session_token_digest_only"],
424
+ "concurrency": ["tests/local_clone_auth/test_local_clone_auth.py::test_registration_and_mail_claims_are_serialized_under_concurrency"]
425
+ },
426
+ "not_applicable": []
427
+ }
428
+ }
429
+ ]
430
+ }
tasks/asana/environment/reference/backend/runtime.json ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "database": {
3
+ "data_dir": "data",
4
+ "engine": "sqlite",
5
+ "filename": "asana.sqlite3",
6
+ "legacy_unbound_migration": false,
7
+ "migration_hook": null,
8
+ "seed_hook": null
9
+ },
10
+ "deployment": {
11
+ "profiles": {
12
+ "cloudflare-review": {
13
+ "mail_adapter": "redis-resend",
14
+ "payment_adapter": "local-sandbox",
15
+ "persistence": "ephemeral-reset"
16
+ },
17
+ "docker-volume": {
18
+ "mail_adapter": "effects-gateway",
19
+ "payment_adapter": "local-sandbox",
20
+ "persistence": "persistent-volume"
21
+ },
22
+ "offline-harbor": {
23
+ "mail_adapter": "local-outbox",
24
+ "payment_adapter": "local-sandbox",
25
+ "persistence": "persistent"
26
+ }
27
+ }
28
+ },
29
+ "mail": {
30
+ "purposes": {
31
+ "password-reset": {
32
+ "body": "Your password reset code is ${code}.",
33
+ "expiry": "This code expires in ${minutes} minutes.",
34
+ "footer": "Ignore this message if you did not contact Asana.",
35
+ "lead": "A password reset was requested for Asana.",
36
+ "required_variables": [
37
+ "code",
38
+ "minutes"
39
+ ],
40
+ "secret_variables": [
41
+ "code"
42
+ ],
43
+ "subject": "Reset your Asana password",
44
+ "template_id": "12go-asia.password-reset.v1"
45
+ },
46
+ "registration": {
47
+ "body": "Your verification code is ${code}.",
48
+ "expiry": "This code expires in ${minutes} minutes.",
49
+ "footer": "This code is only for Asana.",
50
+ "lead": "Finish creating your Asana account.",
51
+ "required_variables": [
52
+ "code",
53
+ "minutes"
54
+ ],
55
+ "secret_variables": [
56
+ "code"
57
+ ],
58
+ "subject": "Verify your Asana account",
59
+ "template_id": "12go-asia.registration.v1"
60
+ }
61
+ },
62
+ "sender": {
63
+ "address_env": "RESEND_FROM_EMAIL",
64
+ "display_name": "Asana"
65
+ }
66
+ },
67
+ "payments": {
68
+ "currency": "USD",
69
+ "default_adapter": "local-sandbox",
70
+ "enabled": false,
71
+ "local_sandbox": {
72
+ "scenarios": [
73
+ {
74
+ "display_label": "Simulated approval",
75
+ "id": "sandbox-approved",
76
+ "outcome": "approved"
77
+ },
78
+ {
79
+ "display_label": "Simulated decline",
80
+ "id": "sandbox-declined",
81
+ "outcome": "declined"
82
+ },
83
+ {
84
+ "display_label": "Simulated retry",
85
+ "id": "sandbox-retry",
86
+ "outcome": "retryable"
87
+ }
88
+ ]
89
+ },
90
+ "stripe_test": null
91
+ },
92
+ "schema_version": "websitebench.site-backend-runtime.v1",
93
+ "session": {
94
+ "host_only": true,
95
+ "http_only": true,
96
+ "same_site": "Lax",
97
+ "secure": true
98
+ },
99
+ "site": {
100
+ "id": "asana",
101
+ "label": "Asana",
102
+ "public_origin": "https://asana.website-bench.com"
103
+ }
104
+ }
tasks/asana/environment/reference/clone/app.py ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Asana offline clone — WebsiteBench candidate application.
2
+
3
+ Route hub only; business logic lives in ``asana_app``. All state is local:
4
+ site-bound SQLite through the generated ``websitebench.site_backend`` seam and
5
+ LocalAuthStore. No runtime request leaves the local origin.
6
+ """
7
+
8
+ import json
9
+ import os
10
+ from pathlib import Path
11
+
12
+ from fastapi import FastAPI, Request
13
+ from fastapi.responses import HTMLResponse, JSONResponse, RedirectResponse
14
+ from fastapi.staticfiles import StaticFiles
15
+
16
+ from asana_app import pages
17
+ from asana_app.api import _cookie_name, public_project_snapshot, router as api_router
18
+ from asana_app.services import SERVICES
19
+
20
+ SITE_ID = "asana"
21
+ DISPLAY_NAME = "Asana"
22
+ CLONE_ROOT = Path(__file__).resolve().parent
23
+
24
+ app = FastAPI(title=DISPLAY_NAME, docs_url=None, redoc_url=None, openapi_url=None)
25
+ app.include_router(api_router)
26
+ app.mount("/static", StaticFiles(directory=CLONE_ROOT / "static"), name="static")
27
+
28
+
29
+ @app.middleware("http")
30
+ async def validate_api_json(request: Request, call_next):
31
+ """Reject malformed or non-object JSON before business handlers run."""
32
+ content_type = request.headers.get("content-type", "").lower()
33
+ if (request.url.path.startswith("/api/") and
34
+ request.method in {"POST", "PUT", "PATCH"} and
35
+ content_type.startswith("application/json")):
36
+ try:
37
+ body = await request.json()
38
+ except (json.JSONDecodeError, UnicodeDecodeError):
39
+ return JSONResponse(
40
+ {"error": {"code": "invalid-json",
41
+ "message": "Request body must be valid JSON."}},
42
+ status_code=400,
43
+ )
44
+ if not isinstance(body, dict):
45
+ return JSONResponse(
46
+ {"error": {"code": "invalid-json",
47
+ "message": "Request body must be a JSON object."}},
48
+ status_code=400,
49
+ )
50
+ return await call_next(request)
51
+
52
+
53
+ @app.get("/healthz")
54
+ def healthz() -> JSONResponse:
55
+ return JSONResponse(
56
+ {"ok": True, "site_id": SITE_ID},
57
+ headers={
58
+ "X-WebsiteBench-Container-Build-ID": os.environ.get(
59
+ "DEPLOYMENT_BUILD_ID", os.environ.get("SOURCE_REF", "")
60
+ )
61
+ },
62
+ )
63
+
64
+
65
+ _MARKETING = {
66
+ "/": pages.home_page,
67
+ "/pricing": pages.pricing_page,
68
+ "/product": pages.product_page,
69
+ "/resources": pages.resources_page,
70
+ "/templates": pages.templates_page,
71
+ }
72
+
73
+
74
+ def _register_marketing(path: str, render) -> None:
75
+ @app.get(path, response_class=HTMLResponse)
76
+ def marketing_page() -> str: # pragma: no cover - thin wrapper
77
+ return render()
78
+
79
+
80
+ for _path, _render in _MARKETING.items():
81
+ _register_marketing(_path, _render)
82
+
83
+
84
+ def _register_nav_detail(path: str) -> None:
85
+ @app.get(path, response_class=HTMLResponse)
86
+ def nav_detail_page() -> str: # pragma: no cover - thin wrapper
87
+ return pages.nav_detail_page(path)
88
+
89
+
90
+ for _path in pages.NAV_DETAIL_PAGES:
91
+ _register_nav_detail(_path)
92
+
93
+
94
+ @app.get("/templates/{category}", response_class=HTMLResponse)
95
+ def template_category(category: str) -> str:
96
+ """Keep every observed public template-card destination locally reachable."""
97
+
98
+ return pages.templates_page()
99
+
100
+
101
+ @app.get("/resources/category/{category}", response_class=HTMLResponse)
102
+ def resource_category(category: str) -> str:
103
+ """Keep every observed resource-card destination locally reachable."""
104
+
105
+ return pages.resources_page()
106
+
107
+
108
+ @app.get("/demo/main", response_class=HTMLResponse)
109
+ def public_demo() -> str:
110
+ return pages.resources_page()
111
+
112
+
113
+ @app.get("/terms/{document}", response_class=HTMLResponse)
114
+ def public_terms(document: str) -> str:
115
+ return pages.templates_page()
116
+
117
+
118
+ @app.get("/solutions", response_class=HTMLResponse)
119
+ def solutions() -> str:
120
+ return pages.solutions_page()
121
+
122
+
123
+ def _authenticated(request: Request) -> bool:
124
+ token = request.cookies.get(_cookie_name(request, SERVICES))
125
+ session = SERVICES.auth.resolve_session(token)
126
+ return bool(session and session.get("authenticated"))
127
+
128
+
129
+ @app.get("/-/login", response_class=HTMLResponse)
130
+ def login(request: Request):
131
+ if _authenticated(request):
132
+ return RedirectResponse("/app/home", status_code=302)
133
+ return pages.login_page()
134
+
135
+
136
+ @app.get("/create-account", response_class=HTMLResponse)
137
+ def create_account(request: Request, email: str = ""):
138
+ if _authenticated(request):
139
+ return RedirectResponse("/app/home", status_code=302)
140
+ return pages.signup_page(email)
141
+
142
+
143
+ @app.get("/-/forgot_password", response_class=HTMLResponse)
144
+ def forgot_password() -> str:
145
+ return pages.forgot_page()
146
+
147
+
148
+ # Dash-free aliases for tooling that cannot pass "-/" routes as arguments
149
+ # (OpenCLI adapters treat a leading dash as an option). Same content.
150
+ @app.get("/login", response_class=HTMLResponse)
151
+ def login_alias(request: Request):
152
+ return login(request)
153
+
154
+
155
+ @app.get("/forgot_password", response_class=HTMLResponse)
156
+ def forgot_alias() -> str:
157
+ return pages.forgot_page()
158
+
159
+
160
+ @app.get("/share/{project_id}", response_class=HTMLResponse)
161
+ def shared_project(project_id: str):
162
+ """Anonymous read-only surface enabled only by a project's public-link mode."""
163
+ with SERVICES.auth.connect() as connection:
164
+ snapshot = public_project_snapshot(connection, project_id)
165
+ if snapshot is None:
166
+ return HTMLResponse(pages.not_found_page(), status_code=404)
167
+ return pages.shared_project_page(snapshot)
168
+
169
+
170
+ @app.get("/app", response_class=HTMLResponse)
171
+ @app.get("/app/{rest:path}", response_class=HTMLResponse)
172
+ def app_pages(request: Request, rest: str = ""):
173
+ if not _authenticated(request):
174
+ target = request.url.path
175
+ return RedirectResponse(f"/-/login?u={target}", status_code=302)
176
+ return pages.app_shell()
tasks/asana/environment/reference/clone/asana_app/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ """Asana offline-clone business application package."""
tasks/asana/environment/reference/clone/asana_app/api.py ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/asana_app/db.py ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Business schema for the Asana offline clone.
2
+
3
+ All state lives in the site-bound SQLite database opened through the generated
4
+ ``websitebench.site_backend`` seam. The auth tables belong to LocalAuthStore;
5
+ these tables model the workspace/project/task domain. Data here is entirely
6
+ synthetic — no source-site records are ever imported.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import json
12
+ import sqlite3
13
+ import time
14
+ import uuid
15
+ from typing import Any
16
+
17
+ SCHEMA_SQL = """
18
+ CREATE TABLE IF NOT EXISTS az_users (
19
+ user_id TEXT PRIMARY KEY,
20
+ email TEXT NOT NULL UNIQUE,
21
+ display_name TEXT NOT NULL,
22
+ initials TEXT NOT NULL,
23
+ avatar_color TEXT NOT NULL DEFAULT '#f06a6a',
24
+ role_title TEXT NOT NULL DEFAULT '',
25
+ about_me TEXT NOT NULL DEFAULT '',
26
+ synthetic INTEGER NOT NULL DEFAULT 0,
27
+ task_default_view TEXT NOT NULL DEFAULT 'list',
28
+ theme TEXT NOT NULL DEFAULT 'light',
29
+ notify_mentions INTEGER NOT NULL DEFAULT 1,
30
+ notify_status INTEGER NOT NULL DEFAULT 1,
31
+ notify_daily_summary INTEGER NOT NULL DEFAULT 0,
32
+ created_at INTEGER NOT NULL
33
+ );
34
+ CREATE TABLE IF NOT EXISTS az_workspaces (
35
+ workspace_id TEXT PRIMARY KEY,
36
+ name TEXT NOT NULL,
37
+ plan TEXT NOT NULL DEFAULT 'personal',
38
+ owner_user_id TEXT NOT NULL,
39
+ created_at INTEGER NOT NULL
40
+ );
41
+ CREATE TABLE IF NOT EXISTS az_workspace_members (
42
+ workspace_id TEXT NOT NULL,
43
+ user_id TEXT NOT NULL,
44
+ role TEXT NOT NULL DEFAULT 'member',
45
+ joined_at INTEGER NOT NULL,
46
+ PRIMARY KEY (workspace_id, user_id)
47
+ );
48
+ CREATE TABLE IF NOT EXISTS az_portfolios (
49
+ portfolio_id TEXT PRIMARY KEY,
50
+ workspace_id TEXT NOT NULL,
51
+ name TEXT NOT NULL,
52
+ color TEXT NOT NULL DEFAULT '#796eff',
53
+ owner_user_id TEXT NOT NULL,
54
+ created_at INTEGER NOT NULL
55
+ );
56
+ CREATE TABLE IF NOT EXISTS az_projects (
57
+ project_id TEXT PRIMARY KEY,
58
+ workspace_id TEXT NOT NULL,
59
+ portfolio_id TEXT,
60
+ name TEXT NOT NULL,
61
+ description TEXT NOT NULL DEFAULT '',
62
+ color TEXT NOT NULL DEFAULT '#4573d2',
63
+ icon TEXT NOT NULL DEFAULT 'list',
64
+ status TEXT NOT NULL DEFAULT 'on_track',
65
+ status_note TEXT NOT NULL DEFAULT '',
66
+ default_view TEXT NOT NULL DEFAULT 'list',
67
+ owner_user_id TEXT NOT NULL,
68
+ archived INTEGER NOT NULL DEFAULT 0,
69
+ deleted_at INTEGER,
70
+ starred INTEGER NOT NULL DEFAULT 0,
71
+ share_mode TEXT NOT NULL DEFAULT 'workspace',
72
+ created_from_template TEXT,
73
+ created_at INTEGER NOT NULL
74
+ );
75
+ CREATE TABLE IF NOT EXISTS az_sections (
76
+ section_id TEXT PRIMARY KEY,
77
+ project_id TEXT NOT NULL,
78
+ name TEXT NOT NULL,
79
+ sort_order INTEGER NOT NULL DEFAULT 0
80
+ );
81
+ CREATE TABLE IF NOT EXISTS az_tasks (
82
+ task_id TEXT PRIMARY KEY,
83
+ workspace_id TEXT NOT NULL,
84
+ project_id TEXT,
85
+ section_id TEXT,
86
+ parent_task_id TEXT,
87
+ name TEXT NOT NULL,
88
+ notes TEXT NOT NULL DEFAULT '',
89
+ assignee_user_id TEXT,
90
+ creator_user_id TEXT NOT NULL,
91
+ due_date TEXT,
92
+ start_date TEXT,
93
+ priority TEXT,
94
+ task_status TEXT,
95
+ completed INTEGER NOT NULL DEFAULT 0,
96
+ completed_at INTEGER,
97
+ liked_by TEXT NOT NULL DEFAULT '[]',
98
+ sort_order INTEGER NOT NULL DEFAULT 0,
99
+ deleted_at INTEGER,
100
+ created_at INTEGER NOT NULL,
101
+ modified_at INTEGER NOT NULL
102
+ );
103
+ CREATE TABLE IF NOT EXISTS az_task_dependencies (
104
+ task_id TEXT NOT NULL,
105
+ depends_on_task_id TEXT NOT NULL,
106
+ PRIMARY KEY (task_id, depends_on_task_id)
107
+ );
108
+ CREATE TABLE IF NOT EXISTS az_task_collaborators (
109
+ task_id TEXT NOT NULL,
110
+ user_id TEXT NOT NULL,
111
+ PRIMARY KEY (task_id, user_id)
112
+ );
113
+ CREATE TABLE IF NOT EXISTS az_comments (
114
+ comment_id TEXT PRIMARY KEY,
115
+ task_id TEXT NOT NULL,
116
+ author_user_id TEXT NOT NULL,
117
+ body TEXT NOT NULL,
118
+ created_at INTEGER NOT NULL,
119
+ edited_at INTEGER
120
+ );
121
+ CREATE TABLE IF NOT EXISTS az_attachments (
122
+ attachment_id TEXT PRIMARY KEY,
123
+ task_id TEXT NOT NULL,
124
+ filename TEXT NOT NULL,
125
+ size_bytes INTEGER NOT NULL,
126
+ content_type TEXT NOT NULL,
127
+ data BLOB NOT NULL,
128
+ uploader_user_id TEXT NOT NULL,
129
+ created_at INTEGER NOT NULL
130
+ );
131
+ CREATE TABLE IF NOT EXISTS az_activity (
132
+ activity_id INTEGER PRIMARY KEY AUTOINCREMENT,
133
+ workspace_id TEXT NOT NULL,
134
+ actor_user_id TEXT NOT NULL,
135
+ verb TEXT NOT NULL,
136
+ object_type TEXT NOT NULL,
137
+ object_id TEXT NOT NULL,
138
+ object_name TEXT NOT NULL DEFAULT '',
139
+ detail TEXT NOT NULL DEFAULT '',
140
+ created_at INTEGER NOT NULL
141
+ );
142
+ CREATE TABLE IF NOT EXISTS az_notifications (
143
+ notification_id INTEGER PRIMARY KEY AUTOINCREMENT,
144
+ user_id TEXT NOT NULL,
145
+ workspace_id TEXT NOT NULL,
146
+ kind TEXT NOT NULL,
147
+ text TEXT NOT NULL,
148
+ task_id TEXT,
149
+ read INTEGER NOT NULL DEFAULT 0,
150
+ archived INTEGER NOT NULL DEFAULT 0,
151
+ created_at INTEGER NOT NULL
152
+ );
153
+ CREATE TABLE IF NOT EXISTS az_goals (
154
+ goal_id TEXT PRIMARY KEY,
155
+ workspace_id TEXT NOT NULL,
156
+ name TEXT NOT NULL,
157
+ owner_user_id TEXT NOT NULL,
158
+ time_period TEXT NOT NULL DEFAULT 'FY26',
159
+ progress INTEGER NOT NULL DEFAULT 0,
160
+ status TEXT NOT NULL DEFAULT 'on_track',
161
+ created_at INTEGER NOT NULL
162
+ );
163
+ CREATE TABLE IF NOT EXISTS az_saved_views (
164
+ view_id TEXT PRIMARY KEY,
165
+ workspace_id TEXT NOT NULL,
166
+ user_id TEXT NOT NULL,
167
+ name TEXT NOT NULL,
168
+ query_json TEXT NOT NULL,
169
+ created_at INTEGER NOT NULL
170
+ );
171
+ CREATE TABLE IF NOT EXISTS az_project_memberships (
172
+ project_id TEXT NOT NULL,
173
+ user_id TEXT NOT NULL,
174
+ access TEXT NOT NULL DEFAULT 'editor',
175
+ PRIMARY KEY (project_id, user_id)
176
+ );
177
+ CREATE TABLE IF NOT EXISTS az_rules (
178
+ rule_id TEXT PRIMARY KEY,
179
+ project_id TEXT NOT NULL,
180
+ name TEXT NOT NULL,
181
+ trigger TEXT NOT NULL,
182
+ action TEXT NOT NULL,
183
+ enabled INTEGER NOT NULL DEFAULT 1,
184
+ created_at INTEGER NOT NULL
185
+ );
186
+ CREATE TABLE IF NOT EXISTS az_invites (
187
+ invite_id TEXT PRIMARY KEY,
188
+ workspace_id TEXT NOT NULL,
189
+ email TEXT NOT NULL,
190
+ role TEXT NOT NULL DEFAULT 'member',
191
+ invited_by TEXT NOT NULL,
192
+ status TEXT NOT NULL DEFAULT 'pending',
193
+ created_at INTEGER NOT NULL
194
+ );
195
+ CREATE TABLE IF NOT EXISTS az_agent_drafts (
196
+ agent_id TEXT PRIMARY KEY,
197
+ workspace_id TEXT NOT NULL,
198
+ creator_user_id TEXT NOT NULL,
199
+ name TEXT NOT NULL,
200
+ instructions TEXT NOT NULL,
201
+ created_at INTEGER NOT NULL,
202
+ modified_at INTEGER NOT NULL
203
+ );
204
+ CREATE INDEX IF NOT EXISTS idx_az_tasks_project ON az_tasks(project_id, section_id, sort_order);
205
+ CREATE INDEX IF NOT EXISTS idx_az_tasks_assignee ON az_tasks(assignee_user_id);
206
+ CREATE INDEX IF NOT EXISTS idx_az_activity_ws ON az_activity(workspace_id, created_at);
207
+ CREATE INDEX IF NOT EXISTS idx_az_project_members_user ON az_project_memberships(user_id, project_id);
208
+ CREATE INDEX IF NOT EXISTS idx_az_agent_drafts_workspace ON az_agent_drafts(workspace_id, modified_at);
209
+ """
210
+
211
+
212
+ def now() -> int:
213
+ return int(time.time())
214
+
215
+
216
+ def new_id(prefix: str) -> str:
217
+ return f"{prefix}_{uuid.uuid4().hex[:12]}"
218
+
219
+
220
+ def ensure_schema(connection: sqlite3.Connection) -> None:
221
+ connection.executescript(SCHEMA_SQL)
222
+ connection.execute("PRAGMA optimize")
223
+
224
+
225
+ def row_to_dict(row: sqlite3.Row | None) -> dict[str, Any] | None:
226
+ return None if row is None else {k: row[k] for k in row.keys()}
227
+
228
+
229
+ def rows_to_dicts(rows: list[sqlite3.Row]) -> list[dict[str, Any]]:
230
+ return [{k: r[k] for k in r.keys()} for r in rows]
231
+
232
+
233
+ def record_activity(
234
+ connection: sqlite3.Connection,
235
+ *,
236
+ workspace_id: str,
237
+ actor_user_id: str,
238
+ verb: str,
239
+ object_type: str,
240
+ object_id: str,
241
+ object_name: str = "",
242
+ detail: str = "",
243
+ ) -> None:
244
+ connection.execute(
245
+ "INSERT INTO az_activity(workspace_id, actor_user_id, verb, object_type,"
246
+ " object_id, object_name, detail, created_at) VALUES (?,?,?,?,?,?,?,?)",
247
+ (workspace_id, actor_user_id, verb, object_type, object_id, object_name,
248
+ detail, now()),
249
+ )
250
+
251
+
252
+ def notify(
253
+ connection: sqlite3.Connection,
254
+ *,
255
+ user_id: str,
256
+ workspace_id: str,
257
+ kind: str,
258
+ text: str,
259
+ task_id: str | None = None,
260
+ ) -> None:
261
+ connection.execute(
262
+ "INSERT INTO az_notifications(user_id, workspace_id, kind, text, task_id,"
263
+ " created_at) VALUES (?,?,?,?,?,?)",
264
+ (user_id, workspace_id, kind, text, task_id, now()),
265
+ )
266
+
267
+
268
+ def liked_by(value: str) -> list[str]:
269
+ try:
270
+ parsed = json.loads(value)
271
+ except (TypeError, ValueError):
272
+ return []
273
+ return parsed if isinstance(parsed, list) else []
tasks/asana/environment/reference/clone/asana_app/pages.py ADDED
@@ -0,0 +1,858 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Server-rendered marketing and auth pages for the Asana offline clone.
2
+
3
+ Copy on the login/forgot pages is reproduced from directly captured anonymous
4
+ evidence (EA1). Marketing pages reproduce server-rendered headings observed by
5
+ EA2; their full source visuals were unavailable (renderer crash), so layout is
6
+ an honest local design in Asana's visual language, not a pixel claim.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import html
12
+ import json
13
+ import re
14
+ from pathlib import Path
15
+
16
+ LOGO_SVG = (
17
+ '<svg viewBox="0 0 112 22" width="112" height="22" aria-hidden="true">'
18
+ '<path d="M108.202 16.703c.067.765.679 1.739 1.74 1.739h.62a.44.44 0 0 0 .438-.438V4.359h-.003a.437.437 0 0 0-.435-.414h-1.922a.437.437 0 0 0-.435.414h-.003v1.109c-1.178-1.452-3.035-2.055-4.897-2.055a7.667 7.667 0 0 0-7.665 7.67 7.668 7.668 0 0 0 7.665 7.672c1.862 0 3.892-.723 4.897-2.054v.002Zm-4.89-.633c-2.692 0-4.874-2.232-4.874-4.986 0-2.754 2.182-4.986 4.874-4.986 2.693 0 4.875 2.232 4.875 4.986 0 2.754-2.182 4.986-4.875 4.986ZM93.21 17.172v-7.06c0-3.981-2.51-6.666-6.51-6.666-1.91 0-3.476 1.105-4.029 2.055-.12-.743-.513-1.523-1.735-1.523h-.622a.439.439 0 0 0-.438.438v13.646h.003c.012.23.203.414.435.414h1.923c.232 0 .422-.184.435-.414h.002v-8.06a3.87 3.87 0 0 1 7.736 0l.001 8.06h.002c.013.23.203.414.435.414h1.923c.232 0 .422-.184.435-.414h.003v-.89ZM73.188 16.703c.067.765.68 1.739 1.74 1.739h.62c.24 0 .437-.197.437-.438V4.359h-.002a.438.438 0 0 0-.435-.414h-1.923a.438.438 0 0 0-.435.414h-.002v1.109c-1.178-1.452-3.035-2.055-4.898-2.055a7.667 7.667 0 0 0-7.664 7.67c0 4.237 3.431 7.672 7.664 7.672 1.863 0 3.892-.723 4.898-2.054v.002Zm-4.89-.633c-2.692 0-4.875-2.232-4.875-4.986 0-2.754 2.183-4.986 4.875-4.986s4.874 2.232 4.874 4.986c0 2.754-2.182 4.986-4.874 4.986ZM49.257 14.748c1.283.89 2.684 1.322 4.03 1.322 1.283 0 2.609-.665 2.609-1.823 0-1.546-2.89-1.787-4.705-2.405-1.815-.617-3.379-1.893-3.379-3.96 0-3.163 2.816-4.47 5.444-4.47 1.665 0 3.383.55 4.497 1.338.384.29.15.625.15.625l-1.063 1.52c-.12.17-.328.318-.628.133s-1.352-.93-2.956-.93c-1.603 0-2.57.74-2.57 1.66 0 1.1 1.256 1.447 2.727 1.823 2.562.691 5.357 1.522 5.357 4.666 0 2.786-2.604 4.508-5.483 4.508-2.181 0-4.038-.622-5.596-1.766-.324-.325-.098-.627-.098-.627l1.058-1.512c.216-.282.487-.184.606-.102ZM41.866 16.703c.068.765.68 1.739 1.74 1.739h.62a.44.44 0 0 0 .438-.438V4.359h-.003a.437.437 0 0 0-.435-.414h-1.922a.438.438 0 0 0-.435.414h-.003v1.109c-1.178-1.452-3.035-2.055-4.897-2.055a7.668 7.668 0 0 0-7.665 7.67c0 4.237 3.432 7.672 7.665 7.672 1.862 0 3.892-.723 4.897-2.054v.002Zm-4.89-.633c-2.692 0-4.874-2.232-4.874-4.986 0-2.754 2.182-4.986 4.875-4.986 2.692 0 4.874 2.232 4.874 4.986 0 2.754-2.182 4.986-4.874 4.986Z" fill="#0D0E10"/>'
19
+ '<path d="M18.559 11.605a5.158 5.158 0 1 0 0 10.317 5.158 5.158 0 0 0 0-10.317Zm-13.401.001a5.158 5.158 0 1 0 0 10.315 5.158 5.158 0 0 0 0-10.315Zm11.858-6.448a5.158 5.158 0 1 1-10.316 0 5.158 5.158 0 0 1 10.316 0Z" fill="#F06A6A"/></svg>'
20
+ )
21
+
22
+ LANGUAGE_SVG = (
23
+ '<svg viewBox="0 0 19 19" width="28" height="28" aria-hidden="true">'
24
+ '<path d="M9.5 0A9.5 9.5 0 1 0 9.5 19 9.5 9.5 0 0 0 9.5 0Zm7.481 5.938h-3.622c-.296-1.841-.83-3.385-1.543-4.394a8.35 8.35 0 0 1 5.165 4.394ZM12.469 9.5c0 .831-.06 1.603-.119 2.375h-5.7A31 31 0 0 1 6.531 9.5c0-.831.06-1.603.119-2.375h5.7c.06.772.119 1.544.119 2.375ZM9.5 17.813c-1.01 0-2.138-1.841-2.672-4.75h5.344c-.535 2.909-1.663 4.75-2.672 4.75ZM6.828 5.938C7.363 3.028 8.491 1.188 9.5 1.188c1.01 0 2.138 1.84 2.672 4.75H6.828ZM7.184 1.544c-.712 1.01-1.246 2.553-1.543 4.394H2.019a8.35 8.35 0 0 1 5.165-4.394ZM1.544 7.125h3.919A31 31 0 0 0 5.344 9.5c0 .831.06 1.603.119 2.375H1.544A8.3 8.3 0 0 1 1.188 9.5c0-.831.118-1.603.356-2.375Zm.475 5.938h3.622c.297 1.84.831 3.384 1.543 4.393a8.35 8.35 0 0 1-5.165-4.393Zm9.797 4.393c.712-1.069 1.246-2.553 1.543-4.393h3.622a8.35 8.35 0 0 1-5.165 4.393Zm5.64-5.581h-3.919c.06-.772.119-1.544.119-2.375 0-.831-.06-1.603-.119-2.375h3.919c.237.772.356 1.544.356 2.375 0 .831-.119 1.603-.356 2.375Z" fill="#0D0E10"/></svg>'
25
+ )
26
+
27
+
28
+ def _head(title: str, extra: str = "") -> str:
29
+ return f"""<!doctype html>
30
+ <html lang="en"><head><meta charset="utf-8">
31
+ <meta name="viewport" content="width=device-width,initial-scale=1">
32
+ <title>{html.escape(title)}</title>
33
+ <link rel="icon" href="/static/favicon.svg" type="image/svg+xml">
34
+ <link rel="stylesheet" href="/static/site.css?v=public-nav-1">{extra}</head>"""
35
+
36
+
37
+ def _marketing_nav(active: str = "") -> str:
38
+ def menu_link(title: str, href: str, copy: str = "", icon: str = "",
39
+ badge: str = "") -> str:
40
+ icon_html = f'<i class="mnav-item-icon {icon}" aria-hidden="true">✣</i>' if icon else ""
41
+ copy_html = f'<small>{copy}</small>' if copy else ""
42
+ badge_html = f'<em>{badge}</em>' if badge else ""
43
+ return (f'<li><a href="{href}">{icon_html}<span><strong>{title}</strong>'
44
+ f'{copy_html}</span>{badge_html}<b aria-hidden="true">→</b></a></li>')
45
+
46
+ def group(title: str, links: list[tuple[str, str, str, str, str]]) -> str:
47
+ return (f'<section class="mnav-group"><p>{title}</p><ul>'
48
+ + "".join(menu_link(*link) for link in links) + '</ul></section>')
49
+
50
+ product_groups = [
51
+ ("PRODUCTS", [
52
+ ("Agentic Work Management", "/product/ai", "For cross-functional teams", "pink", ""),
53
+ ("Asana Service Management", "/product/service-management", "For service teams", "green", "Coming soon"),
54
+ ("Asana Client Management", "/product/client-management", "For teams delivering client work", "yellow", "Coming soon"),
55
+ ("Command by Asana", "/product/command", "For developer teams", "blue", "Coming soon"),
56
+ ("StackAI by Asana", "/product/stackai", "For every critical workflow", "gray", ""),
57
+ ]),
58
+ ("AI PLATFORM", [
59
+ ("AI Teammates", "/product/ai/ai-teammates", "Ready-to-go AI agents for every team", "plain", ""),
60
+ ("AI Studio", "/product/ai/ai-studio", "Powerful no-code automations", "plain", ""),
61
+ ("Asana Dash", "/product/ai/dash", "Your AI Chief of Staff", "plain", ""),
62
+ ]),
63
+ ("ASANA FOUNDATIONS", [
64
+ ("Admin and security", "/features/admin-security", "", "", ""),
65
+ ("App integrations", "/apps", "", "", ""),
66
+ ("Developer", "/developers", "", "", ""),
67
+ ("Latest feature release", "/whats-new", "", "", ""),
68
+ ]),
69
+ ]
70
+ solution_groups = [
71
+ ("COMPANY TYPE", [("Enterprise", "/enterprise", "", "", ""), ("Small business", "/small-business", "", "", ""), ("Nonprofit", "/industry/nonprofit", "", "", ""), ("Agencies", "/agencies", "", "", "")]),
72
+ ("TEAMS", [("Operations", "/teams/operations", "", "", ""), ("Marketing", "/teams/marketing", "", "", ""), ("IT", "/teams/it", "", "", ""), ("Leaders", "/teams/leaders", "", "", "")]),
73
+ ("INDUSTRIES", [("Government", "/industry/government-solutions", "", "", ""), ("Healthcare", "/industry/healthcare", "", "", ""), ("Retail", "/industry/retail", "", "", ""), ("Financial services", "/industry/financial-services", "", "", ""), ("Education", "/industry/education", "", "", ""), ("Manufacturing", "/industry/manufacturing", "", "", "")]),
74
+ ("USE CASES", [("Goal management", "/uses/goal-management", "", "", ""), ("Organizational planning", "/uses/organizational-planning", "", "", ""), ("Project intake", "/uses/project-intake", "", "", ""), ("Resource planning", "/uses/resource-planning", "", "", ""), ("Product launches", "/uses/product-launch", "", "", ""), ("View all use cases", "/uses", "", "", "")]),
75
+ ]
76
+ learning_groups = [
77
+ ("LEARN", [("Resource center", "/resources", "", "", ""), ("Events and webinars", "/events", "", "", ""), ("Customer stories", "/customers", "", "", ""), ("Asana Academy", "/academy", "", "", ""), ("Certifications", "/certifications", "", "", ""), ("Trainings", "/academy/trainings", "", "", "")]),
78
+ ("SUPPORT", [("Help Center", "/help", "", "", ""), ("Community", "/community", "", "", ""), ("Templates", "/templates", "", "", "")]),
79
+ ("SERVICES", [("Customer Success", "/customer-success", "", "", ""), ("Find a partner", "/partners/channel/directory", "", "", ""), ("Become a partner", "/partners", "", "", "")]),
80
+ ]
81
+ menu_specs = [
82
+ ("Products", "product", product_groups),
83
+ ("Solutions", "solutions", solution_groups),
84
+ ("Learning & support", "resources", learning_groups),
85
+ ]
86
+ menu_buttons = "".join(
87
+ f'<button class="mnav-link has-menu{" active" if active == key else ""}" type="button" '
88
+ f'data-nav-menu="{key}" aria-expanded="false" aria-controls="mnav-panel-{key}">{label}</button>'
89
+ for label, key, _ in menu_specs
90
+ )
91
+ panels = "".join(
92
+ f'<div class="mnav-panel mnav-panel-{key}" id="mnav-panel-{key}" role="tabpanel" '
93
+ f'aria-hidden="true">{"".join(group(title, links) for title, links in groups)}</div>'
94
+ for _, key, groups in menu_specs
95
+ )
96
+ items = menu_buttons + (
97
+ f'<a href="/pricing" class="mnav-link{" active" if active == "pricing" else ""}">Pricing</a>'
98
+ )
99
+ if active == "pricing":
100
+ actions = f"""<a class="mnav-language" href="/resources" aria-label="Choose your preferred language">{LANGUAGE_SVG}</a>
101
+ <a class="pricing-sales-link" href="/solutions">Contact sales</a>
102
+ <a class="btn primary sales" href="/create-account">Get started</a>"""
103
+ else:
104
+ actions = f"""<a class="mnav-language" href="/resources" aria-label="Choose your preferred language">{LANGUAGE_SVG}</a>
105
+ <a class="btn ghost" href="/-/login">Log in</a>
106
+ <a class="btn ghost sales" href="/solutions">Contact sales</a>
107
+ <a class="btn primary" href="/create-account">Get started</a>"""
108
+ return f"""<header class="mnav">
109
+ <div class="mnav-inner">
110
+ <a class="mnav-logo" href="/" aria-label="Asana home">{LOGO_SVG}<span>asana</span></a>
111
+ <button class="mnav-burger" aria-label="Menu" aria-expanded="false" onclick="const links=document.querySelector('.mnav-links');const open=links.classList.toggle('open');this.setAttribute('aria-expanded',String(open))">☰</button>
112
+ <nav class="mnav-links">{items}</nav>
113
+ <div class="mnav-actions">{actions}</div>
114
+ </div>
115
+ </header>
116
+ <div class="mnav-layer" hidden>
117
+ <button class="mnav-scrim" type="button" aria-label="Close navigation menu"></button>
118
+ <div class="mnav-mega-shell"><div class="mnav-panel-slot">{panels}</div>
119
+ <div class="mnav-mega-footer"><a href="/sales"><i aria-hidden="true">▣</i>Contact sales</a>
120
+ <a href="/demo/main"><i aria-hidden="true">◯</i>View demo</a>
121
+ <a href="/download"><i aria-hidden="true">⇩</i>Download app</a></div>
122
+ </div>
123
+ </div>"""
124
+
125
+
126
+ def _marketing_footer(full_home: bool = False) -> str:
127
+ if full_home:
128
+ cols = [
129
+ ("New to Asana?", [("Product overview", "/product"), ("All features", "/product#features"),
130
+ ("Latest feature release", "/product#latest"), ("Pricing", "/pricing"),
131
+ ("Starter plan", "/pricing#starter"), ("Advanced plan", "/pricing#advanced"),
132
+ ("Enterprise", "/solutions#enterprise"), ("App integrations", "/product#integrations"),
133
+ ("AI work management", "/product#ai"), ("Project management", "/resources")]),
134
+ ("Use cases", [("Campaign management", "/templates/marketing"), ("Content calendar", "/templates/marketing"),
135
+ ("Creative production", "/templates/design"), ("Goal management", "/templates/operations-pmo"),
136
+ ("New hire onboarding", "/templates/hr"), ("Organizational planning", "/templates/operations-pmo"),
137
+ ("Product launches", "/templates/product-engineering"), ("Resource planning", "/resources"),
138
+ ("Strategic planning", "/resources/category/strategic-planning"),
139
+ ("Task Management", "/product")]),
140
+ ("Solutions", [("Small business", "/solutions"), ("Marketing", "/solutions#marketing"),
141
+ ("Operations", "/solutions#operations"), ("IT", "/templates/it"),
142
+ ("Product", "/solutions#product"), ("Sales", "/templates/sales-cx"),
143
+ ("Healthcare", "/solutions#enterprise"), ("Retail", "/solutions#enterprise"),
144
+ ("Government", "/solutions#enterprise"), ("Education", "/solutions#enterprise")]),
145
+ ("Resources", [("Help Center", "/resources#support"), ("Get support", "/resources#support"),
146
+ ("Asana Academy", "/resources#guide"), ("Certifications", "/resources#guide"),
147
+ ("Forum", "/resources"), ("Resource center", "/resources"),
148
+ ("Events and webinars", "/resources"), ("Project templates", "/templates"),
149
+ ("Customer Success", "/resources"), ("Developers and API", "/resources")]),
150
+ ("Company", [("About us", "/resources"), ("Leadership", "/resources"),
151
+ ("Customers", "/resources"), ("Careers", "/resources"),
152
+ ("Inside Asana", "/resources"), ("Culture", "/resources"),
153
+ ("Press", "/resources"), ("Investor relations", "/resources"),
154
+ ("Trust and security", "/resources"), ("Privacy", "/terms/privacy-statement")]),
155
+ ]
156
+ body = "".join(
157
+ '<div class="fcol"><h4>%s</h4>%s</div>' % (
158
+ title, "".join(f'<a href="{href}">{label}</a>' for label, href in links))
159
+ for title, links in cols)
160
+ return f"""<footer class="mfooter mfooter-home">
161
+ <div class="mfooter-inner">
162
+ <div class="fbrand" aria-label="Asana home">{LOGO_SVG}</div>
163
+ <div class="fcols">{body}</div>
164
+ <div class="flegal-row">
165
+ <span>© 2026 Asana, Inc.</span><a href="/resources">◎ English</a>
166
+ <span class="fsocial" aria-label="Social links"><a href="/resources">X</a><a href="/resources">in</a><a href="/resources">◎</a><a href="/resources">f</a><a href="/resources">▶</a></span>
167
+ <a href="/terms/terms-of-service">Terms</a><span>&amp;</span><a href="/terms/privacy-statement">Privacy</a>
168
+ </div>
169
+ <div class="fapp-row"><a href="/resources"> App Store</a><a href="/resources">▶ Google Play</a></div>
170
+ </div>
171
+ </footer>"""
172
+ cols = [
173
+ ("Asana", [("Home", "/"), ("Product", "/product"), ("Pricing", "/pricing"),
174
+ ("Templates", "/templates"), ("Log In", "/-/login")]),
175
+ ("Solutions", [("Marketing", "/solutions#marketing"), ("Operations", "/solutions#operations"),
176
+ ("Product teams", "/solutions#product"), ("Enterprise", "/solutions#enterprise")]),
177
+ ("Resources", [("Resource center", "/resources"), ("Asana guide", "/resources#guide"),
178
+ ("Templates", "/templates"), ("Support", "/resources#support")]),
179
+ ("Get started", [("Sign Up", "/create-account"), ("View demo", "/demo/main"),
180
+ ("Terms", "/terms/terms-of-service"),
181
+ ("Privacy", "/terms/privacy-statement")]),
182
+ ]
183
+ body = "".join(
184
+ '<div class="fcol"><h4>%s</h4>%s</div>' % (
185
+ t, "".join(
186
+ f'<a href="{h}"{" id=\"footer-support\"" if x == "Support" else ""}>{x}</a>'
187
+ for x, h in ls))
188
+ for t, ls in cols)
189
+ return f"""<footer class="mfooter">
190
+ <div class="mfooter-inner">
191
+ <div class="fbrand">{LOGO_SVG}<span>asana</span></div>
192
+ <div class="fcols">{body}</div>
193
+ <p class="flegal">Offline WebsiteBench demo clone. Local data only — no
194
+ connection to Asana, Inc.</p>
195
+ </div>
196
+ </footer>"""
197
+
198
+
199
+ def _page(title: str, active: str, main: str) -> str:
200
+ support = ""
201
+ if active == "pricing":
202
+ support = """<aside class="synthetic-help" aria-label="Synthetic local help" hidden>
203
+ <div class="synthetic-help-panel" id="synthetic-help-panel">
204
+ <button class="synthetic-help-close" type="button" aria-label="Close help"
205
+ onclick="document.querySelector('.synthetic-help').hidden=true"
206
+ >×</button>
207
+ <p class="synthetic-help-copy desktop-copy">Get clear, local guidance for choosing a<br>
208
+ plan that fits your team's current work.<br>
209
+ Review collaboration needs,<br>
210
+ billing options, and helpful features in<br>
211
+ this demo.</p>
212
+ <p class="synthetic-help-copy mobile-copy">Local synthetic pricing guidance is here.<br>
213
+ Compare team plans and workflow goals.<br>
214
+ Nothing is sent outside this demo.</p>
215
+ </div>
216
+ <button class="synthetic-help-launcher" type="button" aria-controls="synthetic-help-panel"
217
+ onclick="const panel=document.getElementById('synthetic-help-panel');panel.dataset.touched='1';panel.hidden=!panel.hidden">
218
+ <span class="synthetic-help-mark" aria-hidden="true"><i></i><i></i><i></i></span>
219
+ <span>Synthetic help</span>
220
+ </button>
221
+ </aside><script>
222
+ (() => {
223
+ const help = document.querySelector('.synthetic-help');
224
+ const panel = document.getElementById('synthetic-help-panel');
225
+ const opener = document.getElementById('footer-support');
226
+ opener.addEventListener('click', event => {
227
+ event.preventDefault(); help.hidden = false; panel.hidden = false;
228
+ });
229
+ })();
230
+ </script>"""
231
+ is_home = active == ""
232
+ body_class = "marketing home-marketing" if is_home else "marketing"
233
+ home_script = '<script src="/static/home.js" defer></script>' if is_home else ""
234
+ return (_head(title) + f"<body class='{body_class}'>" + _marketing_nav(active)
235
+ + f"<main>{main}</main>" + _marketing_footer(is_home)
236
+ + '<script src="/static/public-nav.js" defer></script>' + home_script
237
+ + support + "</body></html>")
238
+
239
+
240
+ NAV_DETAIL_PAGES = {
241
+ "/product/ai": "product",
242
+ "/product/service-management": "product",
243
+ "/product/client-management": "product",
244
+ "/product/command": "product",
245
+ "/product/stackai": "product",
246
+ "/product/ai/ai-teammates": "product",
247
+ "/product/ai/ai-studio": "product",
248
+ "/product/ai/dash": "product",
249
+ "/features/admin-security": "product",
250
+ "/apps": "product",
251
+ "/developers": "product",
252
+ "/whats-new": "product",
253
+ "/enterprise": "solutions",
254
+ "/small-business": "solutions",
255
+ "/industry/nonprofit": "solutions",
256
+ "/agencies": "solutions",
257
+ "/teams/operations": "solutions",
258
+ "/teams/marketing": "solutions",
259
+ "/teams/it": "solutions",
260
+ "/teams/leaders": "solutions",
261
+ "/industry/government-solutions": "solutions",
262
+ "/industry/healthcare": "solutions",
263
+ "/industry/retail": "solutions",
264
+ "/industry/financial-services": "solutions",
265
+ "/industry/education": "solutions",
266
+ "/industry/manufacturing": "solutions",
267
+ "/uses/goal-management": "solutions",
268
+ "/uses/organizational-planning": "solutions",
269
+ "/uses/project-intake": "solutions",
270
+ "/uses/resource-planning": "solutions",
271
+ "/uses/product-launch": "solutions",
272
+ "/uses": "solutions",
273
+ "/events": "resources",
274
+ "/customers": "resources",
275
+ "/academy": "resources",
276
+ "/certifications": "resources",
277
+ "/academy/trainings": "resources",
278
+ "/help": "resources",
279
+ "/community": "resources",
280
+ "/customer-success": "resources",
281
+ "/partners/channel/directory": "resources",
282
+ "/partners": "resources",
283
+ "/sales": "resources",
284
+ "/download": "resources",
285
+ }
286
+
287
+
288
+ def nav_detail_page(path: str) -> str:
289
+ active = NAV_DETAIL_PAGES[path]
290
+ snapshot_file = (Path(__file__).resolve().parent.parent / "static" /
291
+ "official-pages" / f"{path.strip('/').replace('/', '--')}.json")
292
+ snapshot = json.loads(snapshot_file.read_text(encoding="utf-8"))
293
+ stylesheets = "".join(snapshot["stylesheets"])
294
+ if snapshot.get("external"):
295
+ static_root = Path(__file__).resolve().parent.parent / "static"
296
+ inline_styles = []
297
+ for stylesheet in snapshot["stylesheets"]:
298
+ match = re.search(r'href="/static/([^"]+\.css)"', stylesheet)
299
+ if match:
300
+ css_file = static_root / match.group(1)
301
+ inline_styles.append(f"<style>{css_file.read_text(encoding='utf-8')}</style>")
302
+ elif stylesheet.startswith("<style>"):
303
+ inline_styles.append(stylesheet)
304
+ body_attributes = dict(snapshot.get("body_attributes", {}))
305
+ external_header = ""
306
+ external_script = ""
307
+ extra_head = ""
308
+ if path == "/help":
309
+ body_attributes["class"] = f'marketing {body_attributes.get("class", "")}'.strip()
310
+ external_header = _marketing_nav("resources")
311
+ external_script = '<script src="/static/public-nav.js" defer></script>'
312
+ extra_head = '<link rel="stylesheet" href="/static/site.css?v=official-pages-3">'
313
+ elif path.startswith("/academy"):
314
+ body_attributes["class"] = f'marketing {body_attributes.get("class", "")}'.strip()
315
+ external_header = _marketing_nav("resources")
316
+ external_script = '<script src="/static/public-nav.js" defer></script>'
317
+ extra_head = """<link rel="stylesheet" href="/static/site.css?v=official-pages-3">
318
+ <style>
319
+ body.marketing>.mnav{display:block!important;position:relative!important;top:auto!important;height:68px!important;visibility:visible!important;opacity:1!important;z-index:10000!important}
320
+ #asana-homepage .styles-module_hero-container__lEZxv{position:relative;display:block;margin:24px}
321
+ #asana-homepage .styles-module_hero__o-pUo{width:100%;aspect-ratio:213/125;background-position:center;background-size:cover;border-radius:28px}
322
+ #asana-homepage .styles-module_content-container__hl45r{position:absolute;z-index:2;top:48px;left:40px;align-items:flex-start;padding:0}
323
+ #asana-homepage .styles-module_content-container__hl45r h1{max-width:620px;color:#fff;text-align:left}
324
+ #asana-homepage .styles-module_cta-container__fwAZH{display:flex;flex-direction:row;gap:8px;width:auto}
325
+ #asana-homepage .styles-module_cta-container__fwAZH a{width:auto!important;background:rgba(255,255,255,.15)!important;border:1px solid #fff!important;color:#fff!important}
326
+ @media(max-width:767px){#asana-homepage .styles-module_content-container__hl45r{position:relative;top:auto;left:auto;padding:32px 24px}#asana-homepage .styles-module_content-container__hl45r h1{color:inherit}#asana-homepage .styles-module_cta-container__fwAZH{flex-direction:column;width:100%}}
327
+ </style>"""
328
+ elif path == "/community":
329
+ extra_head = """<style>
330
+ .custom-search-banner__content h1,.community-stats-item .title,.community-stats-item .title a{opacity:1!important;visibility:visible!important;color:#fff!important}
331
+ .custom-search-banner .search-term__input{opacity:1!important;visibility:visible!important;color:#2d2e2f!important;-webkit-text-fill-color:#2d2e2f!important}
332
+ .custom-search-banner .search-term__input::placeholder{color:#777!important;opacity:1!important}
333
+ </style>"""
334
+ body_attrs = " ".join(
335
+ f'{html.escape(key)}="{html.escape(value)}"'
336
+ for key, value in body_attributes.items()
337
+ )
338
+ return f"""<!doctype html><html lang="en"><head><meta charset="utf-8">
339
+ <meta name="viewport" content="width=device-width,initial-scale=1">
340
+ <title>{html.escape(snapshot["title"])}</title><link rel="icon" href="/static/favicon.svg" type="image/svg+xml">
341
+ {"".join(inline_styles)}{extra_head}<style>html,body{{overflow-x:hidden}}</style></head>
342
+ <body {body_attrs}>{external_header}{snapshot["html"]}{external_script}</body></html>"""
343
+ return f"""<!doctype html><html lang="en"><head><meta charset="utf-8">
344
+ <meta name="viewport" content="width=device-width,initial-scale=1">
345
+ <title>{html.escape(snapshot["title"])}</title><link rel="icon" href="/static/favicon.svg" type="image/svg+xml">
346
+ {stylesheets}<link rel="stylesheet" href="/static/site.css?v=official-pages-4"></head>
347
+ <body class="marketing official-snapshot">{_marketing_nav(active)}{snapshot["html"]}
348
+ <script src="/static/public-nav.js" defer></script></body></html>"""
349
+
350
+ def home_page() -> str:
351
+ ai_tabs = [
352
+ ("Asana Work Graph®", "A neural network of every person, task, project, goal, and dependency, so humans and agents always know who is doing what, by when, and toward which goal.", "/static/source/product-hero.png", "Connected work graph across goals, projects, and AI agents"),
353
+ ("Multiplayer", "Every workflow, app, and agent runs in a shared space where humans and agents act on the same plan and see the same context.", "/static/source/resource-ai-at-work.avif", "People and AI coordinating work in one shared space"),
354
+ ("Shared memory", "AI Teammates learn from completed work, feedback, and preferences, so every workflow starts smarter than the last.", "/static/source/home-project.webp", "A shared product launch plan with human and AI teammates"),
355
+ ("Enterprise governance", "Every agent has an identity, scoped permissions, an audit trail, and cost constraints governed from the same console as human users.", "/static/source/resource-workflow-automation.avif", "Governed workflow automation in Asana"),
356
+ ]
357
+ ai_controls = "".join(
358
+ f'''<button class="ai-story-tab{' is-active' if index == 0 else ''}" type="button" role="tab"
359
+ aria-selected="{'true' if index == 0 else 'false'}" data-image="{image}" data-alt="{alt}" data-stage-title="{title}">
360
+ <span>{title}</span><b aria-hidden="true">{'−' if index == 0 else '+'}</b><p>{copy}</p></button>'''
361
+ for index, (title, copy, image, alt) in enumerate(ai_tabs)
362
+ )
363
+ teammates = [
364
+ ("Launch Planner", "Turns project goals into step-by-step timelines so you can hit every deadline without constant coordination.", "ROADMAP SYNCING · GTM SEQUENCING", "#9EF2A4"),
365
+ ("Workflow Optimizer", "Finds bottlenecks in your workflows and suggests fixes so work keeps moving.", "ARTIFACT AUDITING · MESSAGING COMPLIANCE", "#FFD4FF"),
366
+ ("Compliance Specialist", "Reviews project docs against regulatory standards so teams stay compliant without slowing down.", "POLICY REVIEW · DEPENDENCY MAPPING", "#B8A1FF"),
367
+ ("Status Reporter", "Turns project updates into executive-ready reports to keep leaders aligned and in the loop.", "STATUS SYNTHESIS · GTM SEQUENCING", "#F6FF8E"),
368
+ ("Data Quality Manager", "Cleans up missing data and naming formats so your workspace stays organized and reliable.", "LINGUISTIC QA · REGIONAL NUANCING", "#FFC785"),
369
+ ]
370
+ teammate_cards = "".join(
371
+ f'''<article class="teammate-card"><i style="--agent-color:{color}" aria-hidden="true">✣</i>
372
+ <h3>{title}</h3><p>{copy}</p><small>SKILLS</small><strong>{skills}</strong></article>'''
373
+ for title, copy, skills, color in teammates
374
+ )
375
+ products = [
376
+ ("Agentic Work Management", "Agentic Work Management brings together AI Teammates, AI Studio, Asana Dash, and MCP and AI Connectors — so your team and your agents run critical workflows together.", "/static/source/home-project.webp", "Launch plan run by human and AI teammates", "#FFD4FF"),
377
+ ("Asana Service Management", "One AI-native enterprise service management platform for IT, HR, facilities, and legal.", "/static/source/resource-workflow-automation.avif", "Automated service management workflow", "#9EF2A4"),
378
+ ("Asana Client Management", "Build lasting client relationships on an AI-native platform built for agency work.", "/static/source/resource-work-management.avif", "Connected client work management", "#F6FF8E"),
379
+ ("Command by Asana", "Ship faster with humans and agents in sync.", "/static/source/resource-project-planning.avif", "Project planning with humans and agents in sync", "#9EDCF2"),
380
+ ("StackAI by Asana", "Drag and drop to create powerful Agentic Workflows connected to any app, with enterprise-level governance.", "/static/source/resource-strategic-planning.avif", "Enterprise agentic workflow builder", "#FFFFFF"),
381
+ ]
382
+ product_tabs = "".join(
383
+ f'''<button class="productivity-tab{' is-active' if index == 0 else ''}" type="button" role="tab"
384
+ style="--pill:{color}" aria-selected="{'true' if index == 0 else 'false'}"
385
+ data-title="{title}" data-copy="{copy}" data-image="{image}" data-alt="{alt}">{title}</button>'''
386
+ for index, (title, copy, image, alt, color) in enumerate(products)
387
+ )
388
+ return _page("The OS for human-agent teams • Asana", "", """
389
+ <section class="hero source-home">
390
+ <div class="source-orbit" aria-hidden="true">
391
+ <canvas class="mobile-orbit-canvas" width="975" height="1250"></canvas>
392
+ <svg class="orbit-wires" viewBox="0 0 1280 674" preserveAspectRatio="none">
393
+ <path class="wire hot" d="M250 79H348Q365 79 365 62V60Q365 43 382 43H457M584 43H665Q682 43 682 60V70H789M826 70H1043Q1060 70 1060 87V103"/>
394
+ <path class="wire pale" d="M111 126V420Q111 437 128 437H132Q149 437 149 454V601M292 630H535Q552 630 552 614Q552 601 569 601H597M635 627H825Q842 627 842 610V563M921 627H1019Q1036 627 1036 610V563"/>
395
+ <path class="wire hot" d="M1060 162V228H1134Q1152 228 1152 246V298"/>
396
+ <path class="wire pale" d="M1152 352V445Q1152 463 1134 463H1053Q1036 463 1036 480V513"/>
397
+ <circle cx="250" cy="79" r="3"/><circle cx="457" cy="43" r="3"/><circle cx="584" cy="43" r="3"/><circle cx="789" cy="70" r="3"/><circle cx="826" cy="70" r="3"/><circle cx="1060" cy="103" r="3"/><circle cx="1060" cy="162" r="3"/><circle cx="1152" cy="298" r="3"/><circle cx="1152" cy="352" r="3"/><circle cx="1036" cy="513" r="3"/><circle cx="149" cy="601" r="3"/><circle cx="292" cy="630" r="3"/><circle cx="842" cy="627" r="3"/><circle cx="921" cy="627" r="3"/>
398
+ </svg>
399
+ <svg class="orbit-mobile-wires" viewBox="0 0 390 500" preserveAspectRatio="none">
400
+ <path class="hot" d="M159 82H194Q196 82 196 88Q196 98 207 98H248"/>
401
+ <path class="hot" d="M329 116V180"/>
402
+ <path class="hot" d="M52 205V187Q52 176 63 176H123"/>
403
+ <path class="hot" d="M221 176H254Q265 176 265 187Q265 199 276 199H309"/>
404
+ <path class="soft" d="M183 228H232Q243 228 243 239V295"/>
405
+ <circle cx="159" cy="82" r="2"/><circle cx="248" cy="98" r="2"/><circle cx="329" cy="116" r="2"/><circle cx="329" cy="180" r="2"/><circle cx="52" cy="205" r="2"/><circle cx="123" cy="176" r="2"/><circle cx="221" cy="176" r="2"/><circle cx="309" cy="199" r="2"/><circle cx="183" cy="228" r="2"/><circle cx="243" cy="295" r="2"/>
406
+ </svg>
407
+ <span class="orbit-node team-person"></span><span class="orbit-node team-bot">✿</span>
408
+ <span class="orbit-node team-plan">▲</span><span class="orbit-node google-node">▲</span>
409
+ <span class="orbit-card launch">Launch product<br>in 4 weeks</span>
410
+ <span class="orbit-chip planner">Launch Planner</span>
411
+ <span class="orbit-card readiness"><b>Pricing Strategist</b><small>Sales and launch readiness</small></span>
412
+ <span class="orbit-card launched"><i aria-hidden="true"></i><span>Product launched!</span></span>
413
+ <span class="orbit-card edits"><i aria-hidden="true"></i><span>Approve edits</span></span>
414
+ <span class="orbit-card enablement"><i aria-hidden="true"></i><span>Enablement</span></span>
415
+ <span class="orbit-node campaign-node">✿</span><span class="orbit-chip campaign-chip">Campaign Planner</span>
416
+ <span class="orbit-node bottom-person-one"></span><span class="orbit-node bottom-person-two"></span>
417
+ <img class="orbit-texture texture-initial" src="/static/source/home-initial.webp" alt="">
418
+ <img class="orbit-texture texture-launch" src="/static/source/home-launch.webp" alt="">
419
+ <img class="orbit-texture texture-avatar1" src="/static/source/home-avatar1.webp" alt="">
420
+ <img class="orbit-texture texture-google" src="/static/source/home-google.webp" alt="">
421
+ <img class="orbit-texture texture-drive" src="/static/source/home-drive.png" alt="">
422
+ <img class="orbit-texture texture-campaign" src="/static/source/home-campaign.webp" alt="">
423
+ <img class="orbit-texture texture-enablement" src="/static/source/home-enablement.webp" alt="">
424
+ <img class="orbit-texture texture-avatar2" src="/static/source/home-avatar2.webp" alt="">
425
+ <img class="orbit-texture texture-pricing" src="/static/source/home-pricing.webp" alt="">
426
+ <img class="orbit-texture texture-launched" src="/static/source/home-launched.webp" alt="">
427
+ <img class="orbit-texture texture-approve" src="/static/source/home-approve.webp" alt="">
428
+ </div>
429
+ <script>(()=>{const canvas=document.querySelector('.mobile-orbit-canvas');if(!canvas)return;
430
+ const draw=()=>{const x=canvas.getContext('2d');x.clearRect(0,0,975,1250);x.save();x.scale(2.5,2.5);
431
+ const line=(color,fn)=>{x.beginPath();fn();x.strokeStyle=color;x.lineWidth=2;x.lineCap='round';x.lineJoin='round';x.stroke()};
432
+ const rr=(a,b,w,h,r,fill='#fff',stroke='#d9d9d9')=>{x.beginPath();x.roundRect(a,b,w,h,r);x.fillStyle=fill;x.fill();if(stroke){x.strokeStyle=stroke;x.lineWidth=1;x.stroke()}};
433
+ line('#ed686b',()=>{x.moveTo(159,82);x.lineTo(194,82);x.quadraticCurveTo(207,82,207,94);x.quadraticCurveTo(207,98,215,98);x.lineTo(248,98)});
434
+ line('#ed686b',()=>{x.moveTo(329,116);x.lineTo(329,180)});
435
+ line('#ed686b',()=>{x.moveTo(52,205);x.lineTo(52,187);x.quadraticCurveTo(52,176,63,176);x.lineTo(123,176)});
436
+ line('#f39ac8',()=>{x.moveTo(183,228);x.lineTo(232,228);x.quadraticCurveTo(243,228,243,239);x.lineTo(243,295)});
437
+ rr(24,57,136,57,8);x.beginPath();x.moveTo(34,114);x.lineTo(34,122);x.lineTo(46,114);x.fillStyle='#fff';x.fill();x.strokeStyle='#d9d9d9';x.lineWidth=1;x.stroke();
438
+ x.fillStyle='#0d0e10';x.font='300 13px "TWK Lausanne"';x.fillText('Launch product',42,80);x.fillText('in 4 weeks',42,95);
439
+ x.beginPath();x.arc(96,117,14,0,Math.PI*2);x.fillStyle='#fff';x.fill();x.strokeStyle='#73df90';x.lineWidth=3;x.stroke();rr(91,112,10,10,2,'#fff','#111');x.fillStyle='#111';x.font='8px Arial';x.fillText('✿',92,120);
440
+ rr(113,109,65,12,2,'#b1f0ab',null);x.fillStyle='#111';x.font='300 7px "TWK Lausanne"';x.fillText('Launch Planner',116,118);
441
+ const node=(cx,cy,bg,inner)=>{x.beginPath();x.arc(cx,cy,20,0,Math.PI*2);x.fillStyle=bg;x.fill();x.strokeStyle='#d9d9d9';x.lineWidth=1;x.stroke();x.beginPath();x.arc(cx,cy,16.5,0,Math.PI*2);x.strokeStyle='#fff';x.lineWidth=3;x.stroke();inner&&inner(cx,cy)};
442
+ node(268,97,'#fff',(cx,cy)=>{x.beginPath();x.arc(cx,cy,12,0,Math.PI*2);x.fillStyle='#111';x.fill();x.beginPath();x.arc(cx,cy+1,8,0,Math.PI*2);x.fillStyle='#e5aa7e';x.fill();x.fillStyle='#1767a5';x.fillRect(cx-9,cy-13,5,8)});
443
+ node(308,97,'#306ff6',(cx,cy)=>{x.beginPath();x.arc(cx,cy,12,0,Math.PI*2);x.fillStyle='#fff';x.fill();x.fillStyle='#111';x.font='14px Arial';x.textAlign='center';x.textBaseline='middle';x.fillText('✿',cx,cy)});
444
+ node(342,97,'#f7cbfc',(cx,cy)=>{x.beginPath();x.arc(cx,cy,12,0,Math.PI*2);x.fillStyle='#fff';x.fill();x.fillStyle='#111';x.font='13px Arial';x.textAlign='center';x.textBaseline='middle';x.fillText('⌃',cx,cy+1)});
445
+ rr(123,160,98,31,8);rr(131,166,18,18,4,'#306ff6',null);x.fillStyle='#fff';x.fillRect(135,170,8,1);x.fillRect(135,174,8,1);x.fillRect(135,178,8,1);x.fillStyle='#0d0e10';x.font='300 11px "TWK Lausanne"';x.textAlign='left';x.textBaseline='alphabetic';x.fillText('Enablement',154,180);
446
+ node(330,201,'#fff',(cx,cy)=>{x.beginPath();x.moveTo(cx,cy-12);x.lineTo(cx-11,cy+9);x.lineTo(cx+11,cy+9);x.closePath();x.fillStyle='#79b66f';x.fill();x.beginPath();x.moveTo(cx-9,cy+8);x.lineTo(cx-1,cy-8);x.lineTo(cx+5,cy+8);x.closePath();x.fillStyle='#5ea4e8';x.fill();x.beginPath();x.moveTo(cx+1,cy-8);x.lineTo(cx+10,cy+8);x.lineTo(cx+5,cy+8);x.closePath();x.fillStyle='#c7d94f';x.fill()});
447
+ rr(24,205,159,47,8);x.beginPath();x.arc(46,228,13,0,Math.PI*2);x.fillStyle='#ebf56e';x.fill();x.fillStyle='#111';x.font='12px Arial';x.textAlign='center';x.textBaseline='middle';x.fillText('✿',46,228);rr(63,212,63,9,1,'#ebf56e',null);x.fillStyle='#111';x.font='300 7px "TWK Lausanne"';x.textAlign='left';x.textBaseline='alphabetic';x.fillText('Pricing Strategist',65,220);x.font='300 8px "TWK Lausanne"';x.fillText('Sales and launch readiness',64,238);
448
+ rr(106,295,181,47,8);x.beginPath();x.arc(129,318,11,0,Math.PI*2);x.fillStyle='#499e4e';x.fill();x.strokeStyle='#fff';x.lineWidth=2;x.beginPath();x.moveTo(124,318);x.lineTo(128,322);x.lineTo(135,313);x.stroke();x.fillStyle='#0d0e10';x.font='300 15px "TWK Lausanne"';x.textAlign='left';x.textBaseline='alphabetic';x.fillText('Product launched!',148,324);
449
+ x.restore()};document.fonts.ready.then(draw);window.addEventListener('resize',draw,{passive:true});})();</script>
450
+ <h1>The OS for<br><span class="grad">human-agent</span> teams</h1>
451
+ <h2>Supercharge your teams to get things done</h2>
452
+ <p class="signup-note">Try Asana for free. No credit card required.</p>
453
+ <div class="source-sso">
454
+ <a class="source-sso-btn" href="/create-account"><span class="google-g">G</span>Google</a>
455
+ <a class="source-sso-btn" href="/create-account"><span class="microsoft-mark">■</span>Microsoft</a>
456
+ </div>
457
+ <div class="source-or"><span>or</span></div>
458
+ <form class="source-signup" action="/create-account" method="get">
459
+ <input aria-label="Work email address" placeholder="name@company.com" type="email" name="email">
460
+ <button type="submit"><span class="desktop-label">Sign up</span><span class="mobile-label">Get started</span></button>
461
+ </form>
462
+ <p class="source-fineprint">By signing up, I agree to Asana's <a href="/resources">Terms of Service</a> and acknowledge the <a href="/resources">Privacy Statement</a>.</p>
463
+ <aside class="home-synthetic-help" aria-label="Synthetic local help">
464
+ <div class="home-synthetic-panel" hidden><button type="button" aria-label="Close local help" onclick="this.parentElement.hidden=true">×</button><p>Local synthetic help only. Nothing is sent.</p></div>
465
+ <button class="home-synthetic-launcher" type="button" onclick="this.previousElementSibling.hidden=!this.previousElementSibling.hidden"><span class="synthetic-help-mark" aria-hidden="true"><i></i><i></i><i></i></span><span>Ask local help</span></button>
466
+ </aside>
467
+ </section>""" + f"""
468
+ <section class="home-trust" aria-label="Customer trust">
469
+ <p><strong>85%</strong> of Fortune 100<br>companies choose Asana<sup>1</sup></p>
470
+ <div class="home-logos" aria-label="Customer logos"><span>amazon</span><span>accenture</span><span>Johnson&amp;Johnson</span><span class="dell-logo">DELL</span><span>◆ MERCK</span></div>
471
+ </section>
472
+
473
+ <section class="home-ai-story" aria-labelledby="ai-story-heading">
474
+ <div class="home-section-heading"><h2 id="ai-story-heading">AI that works the way your team works</h2></div>
475
+ <div class="ai-story-layout">
476
+ <div class="ai-story-stage" aria-live="polite">
477
+ <span class="ai-stage-kicker">WORK GRAPH</span><h3 id="ai-stage-title">Asana Work Graph®</h3>
478
+ <img id="ai-stage-image" src="{ai_tabs[0][2]}" alt="{ai_tabs[0][3]}">
479
+ <div class="ai-stage-route" aria-hidden="true"><i>Goal</i><b>→</b><i>Project</i><b>→</b><i>AI teammate</i></div>
480
+ </div>
481
+ <div class="ai-story-tabs" role="tablist" aria-label="How Asana AI works">{ai_controls}</div>
482
+ </div>
483
+ </section>
484
+
485
+ <section class="home-teammates" aria-labelledby="teammates-heading">
486
+ <p class="section-kicker">AI TEAMMATES</p><h2 id="teammates-heading">Your team just got bigger</h2>
487
+ <div class="teammates-intro"><p>Pre-built AI agents that work alongside your team inside real workflows, with shared memory, governance, and context from the Work Graph, so they are ready to go on day one.</p><a href="/product#ai">Learn more <span>→</span></a></div>
488
+ <div class="teammate-rail">{teammate_cards}</div>
489
+ </section>
490
+
491
+ <section class="home-productivity" aria-labelledby="productivity-heading">
492
+ <div class="productivity-inner"><h2 id="productivity-heading">Deliver real productivity for every team</h2>
493
+ <div class="productivity-tabs" role="tablist" aria-label="Asana products">{product_tabs}</div>
494
+ <div class="productivity-stage" aria-live="polite">
495
+ <article class="productivity-side productivity-side-left"><span>CONNECTED WORK</span><strong id="product-left-title">Goals and portfolios</strong><p id="product-left-copy">Strategy stays connected to every project.</p></article>
496
+ <article class="productivity-main"><div><i aria-hidden="true">✣</i><span><h3 id="product-title">{products[0][0]}</h3><p id="product-copy">{products[0][1]}</p></span></div><img id="product-image" src="{products[0][2]}" alt="{products[0][3]}"></article>
497
+ <article class="productivity-side productivity-side-right"><span>HUMAN + AI</span><strong id="product-right-title">One shared plan</strong><p id="product-right-copy">People and agents act with the same context.</p></article>
498
+ </div>
499
+ </div>
500
+ </section>
501
+
502
+ <section class="home-case" aria-label="Customer story">
503
+ <div class="case-connector" aria-hidden="true"><i></i><b>✣</b></div>
504
+ <div class="case-grid"><div class="case-image"><img src="/static/source/home-cos.webp" alt="COS fashion collection displayed in a bright showroom"></div>
505
+ <blockquote><div class="cos-logo">COS</div><span class="quote-mark">”</span><p>By building scalable workflows and leveraging AI with intention, we’ve been able to increase visibility and speed while focusing our energy on strategic execution.</p><footer><strong>Simone Williams</strong><small>Chief Digital, Technology &amp; Business Development Officer, COS</small></footer></blockquote>
506
+ </div>
507
+ </section>
508
+
509
+ <section class="home-get-started" aria-labelledby="get-started-heading">
510
+ <div><h2 id="get-started-heading">Get started easily</h2><p>Tour the platform, read a few deep dives, or kickstart your work management journey with the right template.</p></div>
511
+ <nav aria-label="Get started resources"><a href="/demo/main"><span><strong>Try the Asana demo</strong><small>See Asana in action</small></span><b>→</b></a><a href="/resources"><span><strong>Discover resources</strong><small>Help articles and tutorials</small></span><b>→</b></a><a href="/templates"><span><strong>Start with a template</strong><small>Get started faster with a template</small></span><b>→</b></a></nav>
512
+ </section>
513
+
514
+ <section class="home-recognition" aria-labelledby="recognition-heading">
515
+ <div class="recognition-connector" aria-hidden="true"><i></i><b>✣</b></div><h2 id="recognition-heading">Recognized as a leader</h2>
516
+ <div class="award-grid"><article><div class="award-art award-gartner"><span class="gartner-grid"><i></i><i></i><i></i><i></i><i></i><i></i></span></div><h3>A Leader in the Collaborative Work Management three years in a row</h3><a href="/resources">Learn more <span>→</span></a></article>
517
+ <article><div class="award-art award-g2"><span><b>RANKED #2</b><i>2025<br><strong>Top 50</strong><small>PROJECT MANAGEMENT PRODUCTS</small></i></span><span><b>RANKED #2</b><i>2025<br><strong>Top 50</strong><small>SMALL BUSINESS PRODUCTS</small></i></span><span><b>RANKED #3</b><i>2025<br><strong>Top 100</strong><small>BEST SOFTWARE PRODUCTS</small></i></span></div><h3>A leader in Work Management and OKR Software with more than 12,000 user reviews</h3><a href="/resources">Read user reviews <span>→</span></a></article></div>
518
+ </section>
519
+
520
+ <section class="home-bottom-cta"><h2>The only platform that can support your company at any scale</h2><a class="btn" href="/create-account">Get started</a><p><sup>1</sup> Accurate as of December 2023, includes free and paid users.</p></section>""")
521
+
522
+
523
+ def product_page() -> str:
524
+ return _page("Product • Asana", "product", """
525
+ <section class="product-contract">
526
+ <h1>The only work management&#8232;platform built for scale</h1>
527
+ <p class="product-lead">With Asana, humans and agents run an organization’s critical workflows together, on the same plan, toward the same goals.</p>
528
+ <div class="product-sso"><a href="/create-account"><span class="google-g">G</span>Google</a><a href="/create-account"><span class="microsoft-mark">■</span>Microsoft</a></div>
529
+ <div class="product-or"><span>or</span></div>
530
+ <form class="product-signup" action="/create-account" method="get"><input type="email" name="email" aria-label="Work email address" placeholder="name@company.com"><button type="submit">Continue</button></form>
531
+ <p class="product-fine">By signing up, I agree to the Asana <a href="/resources">Privacy Policy</a> and <a href="/resources">Terms of Service</a>.</p>
532
+ <img class="product-source-visual" src="/static/source/product-hero.png"
533
+ alt="Where your teams and AI coordinate work together">
534
+ </section>
535
+ <section class="product-depth product-overview"><h2>See work clearly across your organization</h2><p>Coordinate projects, goals, portfolios, and workflows in one local workspace.</p></section>
536
+ <section class="product-depth product-workflows"><h2>Move work forward with connected workflows</h2><p>Use forms, rules, and reusable templates to keep every handoff clear.</p></section>
537
+ <section class="product-depth product-scale"><h2>Built for teams at every scale</h2><p>Local controls, reporting, and permissions keep work dependable.</p></section>
538
+ <section class="product-depth product-final"><h2>Get started with Asana</h2><a class="btn primary lg" href="/create-account">Get started</a></section>""")
539
+
540
+
541
+ def solutions_page() -> str:
542
+ solutions = [
543
+ ("marketing", "Marketing", "Plan campaigns, manage creative production, and connect every launch to measurable goals."),
544
+ ("operations", "Operations", "Standardize intake, approvals, and cross-functional processes without losing visibility."),
545
+ ("product", "Product", "Keep roadmaps, launches, customer feedback, and engineering handoffs in one shared plan."),
546
+ ("enterprise", "Enterprise", "Coordinate work securely across departments with goals, portfolios, and reporting."),
547
+ ]
548
+ cards = "".join(
549
+ f'<article id="{slug}"><span>0{index}</span><h2>{title}</h2><p>{copy}</p>'
550
+ f'<a href="/templates">Explore templates <b>→</b></a></article>'
551
+ for index, (slug, title, copy) in enumerate(solutions, 1)
552
+ )
553
+ return _page("Work management solutions • Asana", "solutions", f"""
554
+ <section class="solutions-hero"><p class="solutions-kicker">ASANA SOLUTIONS</p>
555
+ <h1>Move every team’s work forward</h1>
556
+ <p>Connect strategy, planning, and execution in one flexible work management platform.</p>
557
+ <div><a class="btn primary lg" href="/create-account">Get started</a><a class="btn ghost lg" href="/demo/main">View demo</a></div>
558
+ </section>
559
+ <section class="solutions-grid">{cards}</section>
560
+ <section class="solutions-band"><p>ONE CONNECTED PLATFORM</p><h2>From company goals to the work that delivers them</h2>
561
+ <div><article><strong>Clarity</strong><span>See owners, deadlines, and progress at a glance.</span></article>
562
+ <article><strong>Consistency</strong><span>Turn proven processes into reusable workflows.</span></article>
563
+ <article><strong>Impact</strong><span>Connect projects to goals and report on outcomes.</span></article></div>
564
+ </section>
565
+ <section class="solutions-proof"><h2>Built for focused teams and growing organizations</h2>
566
+ <p>Use projects for day-to-day work, portfolios for oversight, and goals for shared direction.</p>
567
+ <a href="/product">Explore the product <span>→</span></a>
568
+ </section>
569
+ <section class="solutions-final"><h2>Work smarter. Move faster.</h2><a class="btn primary lg" href="/create-account">Get started for free</a></section>
570
+ """)
571
+
572
+
573
+ def resources_page() -> str:
574
+ cards = [
575
+ ("work-management", "Work management", "Resources to help you better coordinate plans, projects, and processes with Asana.", "#c8efff", "#1d3187"),
576
+ ("project-planning", "Project planning", "Resources to help you organize and track everything your team needs to deliver successful projects.", "#ffe7ea", "#77002f"),
577
+ ("workflow-automation", "Workflow automation", "Resources to help you build intelligent workflows and keep work moving automatically.", "#c9f9d7", "#083f2f"),
578
+ ("ai-at-work", "AI at work", "Resources to help your team get more efficient and achieve growth with AI.", "#fad4fb", "#70008c"),
579
+ ("strategic-planning", "Strategic planning", "Resources to help you map out large-scale strategies and connect them to everyday work.", "#c8efff", "#1d3187"),
580
+ ]
581
+ rail = "".join(f'''<a class="resource-topic" href="/resources/category/{slug}" style="--topic-bg:{bg};--topic-ink:{ink}">
582
+ <img src="/static/source/resource-{slug}.avif" alt=""><div><h2>{title}</h2><p>{copy}</p></div></a>'''
583
+ for slug, title, copy, bg, ink in cards)
584
+ return _page("Resources • Asana", "resources", f"""
585
+ <section class="resources-contract">
586
+ <p class="resources-kicker">RESOURCE CENTER</p><h1>Explore the resource<br class="desktop-only"> center</h1>
587
+ <a class="resources-demo" href="/demo/main">View demo</a>
588
+ <div class="resource-rail">{rail}</div>
589
+ </section>
590
+ <section class="resource-depth"><h2>Resources for every way your team works</h2><p>Explore practical guides, customer stories, and local learning paths.</p></section>
591
+ <section class="resource-depth resource-dark"><h2>Turn plans into progress</h2><p>Connect strategy, projects, and workflows in one place.</p></section>
592
+ <section class="resource-depth"><h2>Learn from teams doing their best work</h2></section>
593
+ <section class="resource-final"><h2>Ready to get started?</h2><a class="btn primary lg" href="/create-account">Get started</a></section>
594
+ """)
595
+
596
+
597
+ def templates_page() -> str:
598
+ teams = [
599
+ ("Marketing", "Manage your next campaign, build a content calendar, and more.", "/templates/marketing"),
600
+ ("Operations", "Create repeatable processes for requests, planning, and team operations.", "/templates/operations-pmo"),
601
+ ("Design", "Organize creative requests, reviews, and production schedules.", "/templates/design"),
602
+ ("IT", "Standardize requests, incidents, and technology projects.", "/templates/it"),
603
+ ("Product & Engineering", "Plan roadmaps, launches, and cross-functional product work.", "/templates/product-engineering"),
604
+ ("HR", "Coordinate recruiting, onboarding, and employee programs.", "/templates/hr"),
605
+ ("Sales & Customer Success", "Track accounts, handoffs, and customer outcomes.", "/templates/sales-cx"),
606
+ ]
607
+ icons = [
608
+ '<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M8 16C3.6 16 0 12.4 0 8C0 3.6 3.6 0 8 0C12.4 0 16 3.6 16 8C16 12.4 12.4 16 8 16ZM8 1C4.15 1 1 4.15 1 8C1 11.85 4.15 15 8 15C11.85 15 15 11.85 15 8C15 4.15 11.85 1 8 1ZM11.4 6.45C11.6 6.25 11.6 5.95 11.4 5.75C11.2 5.55 10.9 5.55 10.7 5.75L6.4 10.05L4.85 8.5C4.65 8.3 4.3 8.3 4.15 8.5C4 8.7 4 9 4.15 9.2L6.05 11.1C6.25 11.3 6.55 11.3 6.75 11.1L11.4 6.45Z"/></svg>',
609
+ '<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M6 2.5h8v2h2.5v13h-13v-13H6v-2Zm1 1v2h6v-2H7Zm-2.5 2v11h11v-11H14v1H6v-1H4.5Zm3 3h5v1h-5v-1Zm0 3h5v1h-5v-1Z"/></svg>',
610
+ '<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M10 2.5 17.5 7v6L10 17.5 2.5 13V7L10 2.5Zm0 1.2L4 7.3v5.1l6 3.6 6-3.6V7.3l-6-3.6Zm0 2.1 3.7 2.2-3.7 2.2L6.3 8 10 5.8Zm-3.2 4 2.7 1.6v3.1l-2.7-1.6V9.8Zm6.4 0v3.1l-2.7 1.6v-3.1l2.7-1.6Z"/></svg>',
611
+ '<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M3 3h14v14H3V3Zm1 1v12h12V4H4Zm2 2h3v3H6V6Zm5 0h3v3h-3V6Zm-5 5h3v3H6v-3Zm5 0h3v3h-3v-3Z"/></svg>',
612
+ '<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M4 3h12v3h2v11H2V6h2V3Zm1 1v3h10V4H5Zm-2 4v8h14V8H3Zm3 2h8v1H6v-1Zm0 3h5v1H6v-1Z"/></svg>',
613
+ '<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M10 2.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 0 1 0-7Zm0 1a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5ZM4 17c.3-3.3 2.3-5.5 6-5.5s5.7 2.2 6 5.5h-1c-.3-2.7-1.9-4.5-5-4.5S5.3 14.3 5 17H4Z"/></svg>',
614
+ '<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M3 15.5h14v1H3v-1Zm1-2 3.5-4 3 2 4.5-6 1 .7-5 6.7-3.3-2.2-3 3.5-.7-.7Z"/></svg>',
615
+ ]
616
+ arrow = '<svg class="template-arrow" viewBox="0 0 16 16" aria-hidden="true"><circle cx="8" cy="8" r="8"/><path d="M5 7.62h5.1L8.25 5.77a.38.38 0 0 1 .53-.53l2.5 2.5a.38.38 0 0 1 0 .53l-2.5 2.5a.38.38 0 0 1-.53-.53l1.82-1.85H5a.38.38 0 0 1 0-.77Z"/></svg>'
617
+ team_cards = "".join(f'''<article class="template-team"><i aria-hidden="true">{icons[index]}</i><div><h2>{title}</h2><p>{copy}</p><a href="{href}">See templates{arrow}</a></div></article>'''
618
+ for index, (title, copy, href) in enumerate(teams))
619
+ return _page("Templates • Asana", "templates", f"""
620
+ <section class="templates-contract">
621
+ <h1>AI workflow template gallery</h1>
622
+ <p class="templates-lead">Any team can plan and manage their projects more successfully starting with Asana templates.</p>
623
+ <div class="templates-sso"><a href="/templates"><svg class="public-google-mark" width="24" height="24" viewBox="0 0 48 48" aria-hidden="true"><path fill="#EA4335" d="M24 9.5c3.5 0 6.6 1.2 9 3.5l6.7-6.7C35.6 2.4 30.2 0 24 0 14.6 0 6.5 5.4 2.5 13.2l7.8 6.1C12.2 13.4 17.6 9.5 24 9.5z"/><path fill="#4285F4" d="M46.5 24.5c0-1.6-.1-3.1-.4-4.5H24v9h12.7c-.6 3-2.3 5.5-4.8 7.2l7.6 5.9c4.4-4.1 7-10.1 7-17.6z"/><path fill="#FBBC05" d="M10.3 28.7a14.5 14.5 0 0 1 0-9.4l-7.8-6.1a24 24 0 0 0 0 21.6l7.8-6.1z"/><path fill="#34A853" d="M24 48c6.2 0 11.4-2 15.5-5.9l-7.6-5.9c-2.1 1.4-4.8 2.3-7.9 2.3-6.4 0-11.8-3.9-13.7-9.8l-7.8 6.1C6.5 42.6 14.6 48 24 48z"/></svg>Google</a><a href="/templates"><svg class="public-microsoft-mark" width="18" height="18" viewBox="0 0 21 21" aria-hidden="true"><rect x="1" y="1" width="9" height="9" fill="#f25022"/><rect x="11" y="1" width="9" height="9" fill="#7fba00"/><rect x="1" y="11" width="9" height="9" fill="#00a4ef"/><rect x="11" y="11" width="9" height="9" fill="#ffb900"/></svg>Microsoft</a></div>
624
+ <div class="templates-or"><span>or</span></div>
625
+ <form class="templates-signup" action="/create-account" method="get"><input type="email" name="email" aria-label="Work email address" placeholder="name@company.com"><button type="submit">Continue</button></form>
626
+ <p class="templates-fine">By signing up, I agree to Asana's <a href="/terms/terms-of-service">Terms of Service</a> and acknowledge the <a href="/terms/privacy-statement">Privacy Statement</a>.</p>
627
+ </section>
628
+ <section class="templates-explore"><h2>Explore by team</h2><div class="template-rail">{team_cards}</div></section>
629
+ <section class="template-depth"><h2>Popular templates to help your team move faster</h2></section>
630
+ <section class="template-depth template-dark"><h2>Turn every repeatable process into a clear workflow</h2></section>
631
+ <section class="template-final"><h2>Start with a template today</h2><a class="btn primary lg" href="/create-account">Get started</a></section>
632
+ """)
633
+
634
+
635
+ def pricing_page() -> str:
636
+ tiers = [
637
+ ("Personal", "For one or two people managing personal projects.", "$0", "Free forever",
638
+ ["Manage tasks and personal to-dos:", "2 users", "Unlimited tasks and projects",
639
+ "List, board, and calendar views", "Collaborate with teammates"],
640
+ "Try for free", "/create-account", ""),
641
+ ("Starter", "For growing teams that need to track their projects’ progress and hit deadlines.", "$10.99", "Per user, per month billed annually",
642
+ ["Everything in Personal, plus:", "Timeline view", "Project dashboards",
643
+ "Forms and rules", "Up to 500 teammates"],
644
+ "Try for free", "/create-account", "Purchase now"),
645
+ ("Advanced", "For companies that need to manage a portfolio of work and goals across departments.", "$24.99", "Per user, per month billed annually",
646
+ ["Everything in Starter, plus:", "Portfolios and goals", "Workload",
647
+ "Advanced reporting", "Approvals and proofing"],
648
+ "Try for free", "/create-account", "Purchase now"),
649
+ ("Enterprise", "For companies that need to coordinate and automate complex work across departments, without limits.", "Contact sales for pricing", "",
650
+ ["Everything in Advanced, plus:", "Enterprise-grade controls to manage"
651
+ " access, protect data, and keep your organization secure at scale."],
652
+ "Contact sales", "/solutions", ""),
653
+ ]
654
+ cards = ""
655
+ for name, description, price, per, feats, cta, href, purchase in tiers:
656
+ lis = "".join(f"<li>{f}</li>" for f in feats)
657
+ purchase_link = (f'<a class="purchase" href="{href}">{purchase}<span aria-hidden="true">➜</span></a>'
658
+ if purchase else '<span class="purchase placeholder" aria-hidden="true"></span>')
659
+ cards += f"""<article class="tier tier-{name.lower()}">
660
+ <h3>{name}</h3><p class="tier-desc">{description}</p>
661
+ <div class="price">{price}</div><p class="per">{per}</p>
662
+ <a class="btn {'primary' if name == 'Starter' else 'ghost'}" href="{href}"><span class="desktop-cta">{cta}</span><span class="mobile-cta">{'Get started' if cta == 'Try for free' else cta}</span></a>
663
+ {purchase_link}<ul>{lis}</ul></article>"""
664
+ addons = [
665
+ ("AI Teammates", "Build AI teammates that collaborate with your teams and handle repeatable work."),
666
+ ("Timesheets and Budgets", "Track time, budgets, and progress without leaving the work."),
667
+ ("Compliance management", "Support regulated workflows with controls for complex organizations."),
668
+ ("Permissions management", "Manage access and permissions across teams and projects."),
669
+ ]
670
+ addon_cards = "".join(
671
+ f'<article class="pricing-addon"><h3>{title}</h3><p>{copy}</p>'
672
+ '<div><a class="btn primary" href="/solutions">Contact sales</a>'
673
+ '<a class="btn ghost" href="/resources">Learn more</a></div></article>'
674
+ for title, copy in addons)
675
+ faq = [
676
+ "Which plan is right for my team?", "Can I try Asana before I buy?",
677
+ "How does billing work?", "What security and privacy options are available?",
678
+ "Can I change plans later?", "Does Asana offer nonprofit discounts?",
679
+ ]
680
+ faq_items = "".join(f'<details><summary>{item}</summary><p>Learn more about this option in our local product guide.</p></details>' for item in faq)
681
+ main = f"""
682
+ <div class="pricing-page">
683
+ <section class="pricing-hero"><h1>Pick the plan that fits your<br> team</h1></section>
684
+ <section class="pricing-plans"><div class="billing-toggle"><span>Monthly</span><i aria-hidden="true"></i><strong>Yearly</strong><em>Save up to 18%</em></div><div class="tiers">{cards}</div></section>
685
+ <section class="pricing-note"><p>Every paid plan includes unlimited projects, tasks, storage, and activity logs.</p></section>
686
+ <section class="pricing-addons">{addon_cards}</section>
687
+ <section class="pricing-loved"><h4>Loved by 100,000+ organizations across the globe</h4><div class="logo-dots" aria-hidden="true">●&nbsp;&nbsp;●&nbsp;&nbsp;●&nbsp;&nbsp;●&nbsp;&nbsp;●</div></section>
688
+ <section class="pricing-faq"><h2>Frequently asked questions</h2><div class="faq-list">{faq_items}</div></section>
689
+ </div>"""
690
+ return _page("Asana Pricing | Personal, Starter, Advanced, & Enterprise plans • Asana", "pricing", main)
691
+
692
+
693
+ # ------------------------------------------------------------------ auth
694
+
695
+ def _auth_shell(title: str, body: str) -> str:
696
+ footer_links = ["Asana.com", "Support", "Integrations", "Forum",
697
+ "Developers & API", "Resources", "Guide", "Templates",
698
+ "Pricing", "Terms", "Privacy"]
699
+ links = "".join(f'<a href="/">{x}</a>' for x in footer_links)
700
+ return f"""{_head(title)}<body class="authpage">
701
+ <header class="auth-logo"><a href="/" aria-label="Asana home">{LOGO_SVG}<span>asana</span></a></header>
702
+ <main class="auth-main">{body}</main>
703
+ <footer class="auth-footer"><nav>{links}</nav>
704
+ <p>This offline demo stores data locally. No real emails are sent.</p></footer>
705
+ <script src="/static/auth.js" defer></script></body></html>"""
706
+
707
+
708
+ _SSO_BUTTONS = """<div class="sso-row">
709
+ <button type="button" class="sso" data-sso="Google" aria-label="Continue with Google">
710
+ <svg width="18" height="18" viewBox="0 0 48 48" aria-hidden="true"><path fill="#EA4335" d="M24 9.5c3.5 0 6.6 1.2 9 3.5l6.7-6.7C35.6 2.4 30.2 0 24 0 14.6 0 6.5 5.4 2.5 13.2l7.8 6.1C12.2 13.4 17.6 9.5 24 9.5z"/><path fill="#4285F4" d="M46.5 24.5c0-1.6-.1-3.1-.4-4.5H24v9h12.7c-.6 3-2.3 5.5-4.8 7.2l7.6 5.9c4.4-4.1 7-10.1 7-17.6z"/><path fill="#FBBC05" d="M10.3 28.7a14.5 14.5 0 0 1 0-9.4l-7.8-6.1a24 24 0 0 0 0 21.6l7.8-6.1z"/><path fill="#34A853" d="M24 48c6.2 0 11.4-2 15.5-5.9l-7.6-5.9c-2.1 1.4-4.8 2.3-7.9 2.3-6.4 0-11.8-3.9-13.7-9.8l-7.8 6.1C6.5 42.6 14.6 48 24 48z"/></svg></button>
711
+ <button type="button" class="sso" data-sso="Microsoft" aria-label="Continue with Microsoft">
712
+ <svg width="18" height="18" viewBox="0 0 21 21" aria-hidden="true"><rect x="1" y="1" width="9" height="9" fill="#f25022"/><rect x="11" y="1" width="9" height="9" fill="#7fba00"/><rect x="1" y="11" width="9" height="9" fill="#00a4ef"/><rect x="11" y="11" width="9" height="9" fill="#ffb900"/></svg></button>
713
+ </div>
714
+ <div class="or-rule"><span>or</span></div>"""
715
+
716
+
717
+ def login_page() -> str:
718
+ return _auth_shell("Log in - Asana", f"""
719
+ <div class="auth-card" id="login-card">
720
+ <h2>Welcome to Asana</h2>
721
+ <h3>To get started, please sign in</h3>
722
+ {_SSO_BUTTONS}
723
+ <form id="login-form" novalidate>
724
+ <div class="field"><label for="email">Email address</label>
725
+ <input id="email" name="email" type="email" autocomplete="email" required></div>
726
+ <div class="field hidden" id="password-field"><label for="password">Password</label>
727
+ <input id="password" name="password" type="password" autocomplete="current-password"></div>
728
+ <p class="form-error" id="login-error" role="alert" hidden></p>
729
+ <button class="btn primary block" type="submit" id="login-continue">Continue</button>
730
+ </form>
731
+ <p class="auth-alt"><a href="/-/forgot_password">Forgot password?</a>
732
+ <span>or</span> <a href="/create-account">Sign up</a></p>
733
+ </div>
734
+ <p class="auth-fineprint">Offline demo: SSO buttons are visual placeholders and
735
+ explain that only local email accounts work here.</p>""")
736
+
737
+
738
+ def signup_page(email: str = "") -> str:
739
+ escaped_email = html.escape(email, quote=True)
740
+ return _auth_shell("Sign up - Asana", f"""
741
+ <div class="auth-card" id="signup-card">
742
+ <h2>You're one click away from being more productive</h2>
743
+ <h3>Sign up with your work email</h3>
744
+ {_SSO_BUTTONS}
745
+ <form id="signup-form" novalidate>
746
+ <div class="field"><label for="name">Full name</label>
747
+ <input id="name" name="name" autocomplete="name" required></div>
748
+ <div class="field"><label for="email">Email address</label>
749
+ <input id="email" name="email" type="email" autocomplete="email" value="{escaped_email}" required></div>
750
+ <div class="field"><label for="password">Password</label>
751
+ <input id="password" name="password" type="password" autocomplete="new-password"
752
+ minlength="8" required aria-describedby="pw-hint">
753
+ <p class="hint" id="pw-hint">At least 8 characters.</p></div>
754
+ <p class="form-error" id="signup-error" role="alert" hidden></p>
755
+ <button class="btn primary block" type="submit">Sign up</button>
756
+ </form>
757
+ <div id="verify-step" class="hidden">
758
+ <h3>Check your inbox</h3>
759
+ <p>Enter the verification code sent to your email address.</p>
760
+ <form id="verify-form" novalidate>
761
+ <div class="field"><label for="code">Verification code</label>
762
+ <input id="code" name="code" inputmode="numeric" autocomplete="one-time-code" required></div>
763
+ <p class="form-error" id="verify-error" role="alert" hidden></p>
764
+ <button class="btn primary block" type="submit">Verify</button>
765
+ </form>
766
+ </div>
767
+ <p class="auth-alt">Already have an account? <a href="/-/login">Log in</a></p>
768
+ </div>""")
769
+
770
+
771
+ def forgot_page() -> str:
772
+ return _auth_shell("Log in - Asana", """
773
+ <div class="auth-card" id="forgot-card">
774
+ <h2>Forgot password?</h2>
775
+ <h3>Enter your email address for instructions</h3>
776
+ <form id="forgot-form" novalidate>
777
+ <div class="field"><label for="email">Email address</label>
778
+ <input id="email" name="email" type="email" autocomplete="email" required></div>
779
+ <p class="form-error" id="forgot-error" role="alert" hidden></p>
780
+ <button class="btn primary block" type="submit">Send instructions</button>
781
+ </form>
782
+ <div id="reset-step" class="hidden">
783
+ <h3>Reset your password</h3>
784
+ <p>Enter the reset code sent to your email address.</p>
785
+ <form id="reset-form" novalidate>
786
+ <div class="field"><label for="code">Reset code</label>
787
+ <input id="code" name="code" inputmode="numeric" required></div>
788
+ <div class="field"><label for="new-password">New password</label>
789
+ <input id="new-password" name="password" type="password" minlength="8" required></div>
790
+ <p class="form-error" id="reset-error" role="alert" hidden></p>
791
+ <button class="btn primary block" type="submit">Reset password</button>
792
+ </form>
793
+ </div>
794
+ <p class="auth-alt"><a href="/-/login">Log in</a> <span>or</span>
795
+ <a href="/create-account">Sign up</a></p>
796
+ </div>""")
797
+
798
+
799
+ def app_shell() -> str:
800
+ app_style = '<link rel="stylesheet" href="/static/app.css">'
801
+ return f"""{_head("Asana", app_style)}<body class="appbody">
802
+ <div id="app" data-app-root></div>
803
+ <script src="/static/app.js" defer></script>
804
+ </body></html>"""
805
+
806
+
807
+ def shared_project_page(snapshot: dict) -> str:
808
+ """Render the anonymous, read-only destination promised by a public link."""
809
+ project = snapshot["project"]
810
+ tasks_by_section: dict[str | None, list[dict]] = {}
811
+ for task in snapshot["tasks"]:
812
+ tasks_by_section.setdefault(task["section_id"], []).append(task)
813
+ sections = []
814
+ for section in snapshot["sections"]:
815
+ task_rows = "".join(
816
+ '<li class="shared-task%s"><span aria-hidden="true">%s</span>'
817
+ '<strong>%s</strong>%s%s</li>' % (
818
+ " complete" if task["completed"] else "",
819
+ "✓" if task["completed"] else "○",
820
+ html.escape(task["name"]),
821
+ (f'<small>{html.escape(task["priority"])} priority</small>'
822
+ if task["priority"] else ""),
823
+ (f'<time datetime="{html.escape(task["due_date"])}">Due '
824
+ f'{html.escape(task["due_date"])}</time>' if task["due_date"] else ""),
825
+ )
826
+ for task in tasks_by_section.pop(section["section_id"], [])
827
+ )
828
+ sections.append(
829
+ f'<section class="shared-section"><h2>{html.escape(section["name"])}</h2>'
830
+ f'<ul>{task_rows or "<li class=\"shared-empty\">No tasks</li>"}</ul></section>'
831
+ )
832
+ if tasks_by_section.get(None):
833
+ sections.append(
834
+ '<section class="shared-section"><h2>No section</h2><ul>' + "".join(
835
+ f'<li class="shared-task"><span aria-hidden="true">○</span>'
836
+ f'<strong>{html.escape(task["name"])}</strong></li>'
837
+ for task in tasks_by_section[None]
838
+ ) + '</ul></section>'
839
+ )
840
+ status = project["status"].replace("_", " ").title()
841
+ return f"""{_head(project["name"] + " - Asana")}
842
+ <body class="shared-project-page" data-public-project="{html.escape(project["project_id"], quote=True)}">
843
+ <header class="shared-header"><a href="/" aria-label="Asana home">{LOGO_SVG}<span>asana</span></a>
844
+ <span>Shared project · read only</span><a class="btn ghost" href="/-/login">Log in</a></header>
845
+ <main class="shared-main"><div class="shared-title" style="border-color:{html.escape(project["color"], quote=True)}">
846
+ <p class="eyebrow">PUBLIC LOCAL LINK</p><h1>{html.escape(project["name"])}</h1>
847
+ <p>{html.escape(project["description"])}</p><span class="shared-status">{html.escape(status)}</span>
848
+ </div><div class="shared-columns">{"".join(sections)}</div>
849
+ <p class="shared-disclosure">This local link provides read-only access to this project. Comments, files, members, and workspace data stay private.</p>
850
+ </main></body></html>"""
851
+
852
+
853
+ def not_found_page() -> str:
854
+ return f"""{_head("Page not found - Asana")}
855
+ <body class="marketing"><main class="shared-main"><div class="shared-title">
856
+ {LOGO_SVG}<p class="eyebrow">ASANA</p><h1>That project link isn’t available</h1>
857
+ <p>The project may be private, the link may be disabled, or the project may have been deleted.</p>
858
+ <a class="btn primary" href="/">Return to Asana</a></div></main></body></html>"""
tasks/asana/environment/reference/clone/asana_app/seed.py ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic synthetic demo data for the Asana offline clone.
2
+
3
+ Every record is synthetic; nothing here is captured from the source site.
4
+ Seeding is idempotent per workspace: it runs once when a new account's
5
+ workspace is created.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import datetime as dt
11
+ import sqlite3
12
+
13
+ from .db import new_id, now, record_activity
14
+
15
+ SYNTHETIC_TEAMMATES = [
16
+ ("Mia Chen", "mia.chen@demo.asana.offline.invalid", "MC", "#aa62e3", "Product Manager"),
17
+ ("Leo Park", "leo.park@demo.asana.offline.invalid", "LP", "#4573d2", "Design Lead"),
18
+ ("Ana Souza", "ana.souza@demo.asana.offline.invalid", "AS", "#f1bd6c", "Engineer"),
19
+ ("Sam Rivera", "sam.rivera@demo.asana.offline.invalid", "SR", "#5da283", "Marketing"),
20
+ ]
21
+
22
+
23
+ def _date(offset_days: int) -> str:
24
+ return (dt.date.today() + dt.timedelta(days=offset_days)).isoformat()
25
+
26
+
27
+ def ensure_synthetic_users(connection: sqlite3.Connection) -> list[str]:
28
+ ids = []
29
+ for name, email, initials, color, title in SYNTHETIC_TEAMMATES:
30
+ row = connection.execute(
31
+ "SELECT user_id FROM az_users WHERE email=?", (email,)
32
+ ).fetchone()
33
+ if row:
34
+ ids.append(row["user_id"])
35
+ continue
36
+ uid = new_id("user")
37
+ connection.execute(
38
+ "INSERT INTO az_users(user_id, email, display_name, initials,"
39
+ " avatar_color, role_title, synthetic, created_at)"
40
+ " VALUES (?,?,?,?,?,?,1,?)",
41
+ (uid, email, name, initials, color, title, now()),
42
+ )
43
+ ids.append(uid)
44
+ return ids
45
+
46
+
47
+ def seed_workspace(
48
+ connection: sqlite3.Connection,
49
+ *,
50
+ workspace_id: str,
51
+ owner_user_id: str,
52
+ ) -> None:
53
+ """Populate a fresh workspace with a synthetic demo state."""
54
+
55
+ teammates = ensure_synthetic_users(connection)
56
+ for uid in teammates:
57
+ connection.execute(
58
+ "INSERT OR IGNORE INTO az_workspace_members(workspace_id, user_id,"
59
+ " role, joined_at) VALUES (?,?,'member',?)",
60
+ (workspace_id, uid, now()),
61
+ )
62
+
63
+ portfolio_id = new_id("portfolio")
64
+ connection.execute(
65
+ "INSERT INTO az_portfolios(portfolio_id, workspace_id, name, color,"
66
+ " owner_user_id, created_at) VALUES (?,?,?,?,?,?)",
67
+ (portfolio_id, workspace_id, "Research Projects 2026", "#796eff",
68
+ owner_user_id, now()),
69
+ )
70
+
71
+ projects = [
72
+ ("Product launch plan", "#4573d2", "rocket",
73
+ "Cross-functional launch plan for the spring release.", portfolio_id),
74
+ ("Website redesign", "#f06a6a", "palette",
75
+ "Refresh the marketing site with the new brand system.", portfolio_id),
76
+ ("User research study", "#5da283", "chat",
77
+ "Interview program and synthesis for Q3 discovery.", portfolio_id),
78
+ ]
79
+ section_names = ["To do", "In progress", "Done"]
80
+ all_users = [owner_user_id] + teammates
81
+
82
+ demo_tasks = {
83
+ "Product launch plan": [
84
+ ("Draft launch brief", 0, 0, -2, "High", "On track", 1,
85
+ "Summarize goals, audience, and success metrics for the launch."),
86
+ ("Align stakeholders on messaging", 0, 1, 1, "Medium", "On track", 0,
87
+ "Collect feedback from product marketing and sales."),
88
+ ("Build launch timeline", 1, 2, 3, "High", "At risk", 0,
89
+ "Sequence beta, announcement, and rollout milestones."),
90
+ ("Prepare press kit", 1, 3, 7, "Low", None, 0,
91
+ "Screenshots, boilerplate, and spokesperson quotes."),
92
+ ("QA release candidate", 2, 4, -1, "High", "Off track", 1,
93
+ "Full regression pass on the release branch."),
94
+ ],
95
+ "Website redesign": [
96
+ ("Audit current pages", 0, 0, -5, "Medium", None, 1,
97
+ "Inventory templates and traffic to prioritize the rebuild."),
98
+ ("Design new homepage hero", 1, 1, 2, "High", "On track", 0,
99
+ "Explore three hero concepts with the new brand palette."),
100
+ ("Migrate pricing page", 1, 2, 5, "Medium", "On track", 0,
101
+ "Port pricing tiers to the new component library."),
102
+ ("Accessibility review", 0, 3, 9, "High", None, 0,
103
+ "WCAG 2.2 AA sweep across the redesigned templates."),
104
+ ],
105
+ "User research study": [
106
+ ("Recruit 10 participants", 0, 0, -3, "High", "On track", 1,
107
+ "Screen for teams of 5-50 using work management tools."),
108
+ ("Write interview guide", 0, 1, 0, "Medium", None, 1,
109
+ "Focus on planning rituals and tool-switching pain."),
110
+ ("Run interview sessions", 1, 2, 4, "High", "On track", 0,
111
+ "Five 45-minute remote sessions per week."),
112
+ ("Synthesize findings", 2, 3, 12, "Medium", None, 0,
113
+ "Affinity-map notes and draft opportunity areas."),
114
+ ],
115
+ }
116
+
117
+ project_ids: dict[str, str] = {}
118
+ first_task_ids: dict[str, list[str]] = {}
119
+ for pi, (pname, color, icon, desc, pf) in enumerate(projects):
120
+ project_id = new_id("project")
121
+ project_ids[pname] = project_id
122
+ connection.execute(
123
+ "INSERT INTO az_projects(project_id, workspace_id, portfolio_id,"
124
+ " name, description, color, icon, owner_user_id, starred, created_at)"
125
+ " VALUES (?,?,?,?,?,?,?,?,?,?)",
126
+ (project_id, workspace_id, pf, pname, desc, color, icon,
127
+ owner_user_id, 1 if pi == 0 else 0, now()),
128
+ )
129
+ connection.execute(
130
+ "INSERT INTO az_project_memberships(project_id, user_id, access)"
131
+ " VALUES (?,?,'admin')", (project_id, owner_user_id),
132
+ )
133
+ section_ids = []
134
+ for si, sname in enumerate(section_names):
135
+ sid = new_id("section")
136
+ section_ids.append(sid)
137
+ connection.execute(
138
+ "INSERT INTO az_sections(section_id, project_id, name, sort_order)"
139
+ " VALUES (?,?,?,?)", (sid, project_id, sname, si),
140
+ )
141
+ task_ids = []
142
+ for ti, (tname, sec, assignee_i, due_off, priority, status, done, notes) in \
143
+ enumerate(demo_tasks[pname]):
144
+ task_id = new_id("task")
145
+ task_ids.append(task_id)
146
+ section_id = section_ids[2] if done else section_ids[sec]
147
+ connection.execute(
148
+ "INSERT INTO az_tasks(task_id, workspace_id, project_id,"
149
+ " section_id, name, notes, assignee_user_id, creator_user_id,"
150
+ " due_date, priority, task_status, completed, completed_at,"
151
+ " sort_order, created_at, modified_at)"
152
+ " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)",
153
+ (task_id, workspace_id, project_id, section_id, tname, notes,
154
+ all_users[assignee_i % len(all_users)], owner_user_id,
155
+ _date(due_off), priority, status, done,
156
+ now() - 86400 if done else None, ti, now() - 86400 * 3, now()),
157
+ )
158
+ first_task_ids[pname] = task_ids
159
+
160
+ # Subtasks and a dependency chain on the launch plan.
161
+ launch = first_task_ids["Product launch plan"]
162
+ for sub_i, sub in enumerate(["Collect metric baselines", "Review with leadership"]):
163
+ connection.execute(
164
+ "INSERT INTO az_tasks(task_id, workspace_id, project_id, section_id,"
165
+ " parent_task_id, name, creator_user_id, assignee_user_id, due_date,"
166
+ " sort_order, created_at, modified_at)"
167
+ " VALUES (?,?,?,?,?,?,?,?,?,?,?,?)",
168
+ (new_id("task"), workspace_id, project_ids["Product launch plan"],
169
+ None, launch[0], sub, owner_user_id,
170
+ all_users[sub_i % len(all_users)], _date(2 + sub_i), sub_i,
171
+ now(), now()),
172
+ )
173
+ connection.execute(
174
+ "INSERT OR IGNORE INTO az_task_dependencies(task_id, depends_on_task_id)"
175
+ " VALUES (?,?)", (launch[2], launch[1]),
176
+ )
177
+ connection.execute(
178
+ "INSERT OR IGNORE INTO az_task_dependencies(task_id, depends_on_task_id)"
179
+ " VALUES (?,?)", (launch[3], launch[2]),
180
+ )
181
+
182
+ # Synthetic conversation on the first launch task.
183
+ for author, body, age in [
184
+ (teammates[0], "I drafted the first outline — feedback welcome.", 7200),
185
+ (teammates[1], "Looks solid. Can we add the beta cohort size?", 3600),
186
+ ]:
187
+ connection.execute(
188
+ "INSERT INTO az_comments(comment_id, task_id, author_user_id, body,"
189
+ " created_at) VALUES (?,?,?,?,?)",
190
+ (new_id("comment"), launch[0], author, body, now() - age),
191
+ )
192
+ connection.execute(
193
+ "INSERT OR IGNORE INTO az_task_collaborators(task_id, user_id)"
194
+ " VALUES (?,?)", (launch[0], teammates[0]),
195
+ )
196
+
197
+ # Goals, a sample automation rule, one pending invite.
198
+ for gname, progress, status in [
199
+ ("Ship spring release on time", 45, "on_track"),
200
+ ("Grow research participant panel to 100", 20, "at_risk"),
201
+ ]:
202
+ connection.execute(
203
+ "INSERT INTO az_goals(goal_id, workspace_id, name, owner_user_id,"
204
+ " time_period, progress, status, created_at) VALUES (?,?,?,?,?,?,?,?)",
205
+ (new_id("goal"), workspace_id, gname, owner_user_id, "FY26",
206
+ progress, status, now()),
207
+ )
208
+ connection.execute(
209
+ "INSERT INTO az_rules(rule_id, project_id, name, trigger, action,"
210
+ " created_at) VALUES (?,?,?,?,?,?)",
211
+ (new_id("rule"), project_ids["Product launch plan"],
212
+ "Move completed tasks to Done", "task_completed",
213
+ "move_to_section:Done", now()),
214
+ )
215
+
216
+ record_activity(
217
+ connection, workspace_id=workspace_id, actor_user_id=owner_user_id,
218
+ verb="seeded", object_type="workspace", object_id=workspace_id,
219
+ object_name="Demo workspace", detail="Synthetic demo data created",
220
+ )
tasks/asana/environment/reference/clone/asana_app/services.py ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Process-wide backend/auth services opened through the generated seam."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import sys
6
+ from pathlib import Path
7
+
8
+ _CLONE_ROOT = Path(__file__).resolve().parents[1]
9
+ if str(_CLONE_ROOT) not in sys.path:
10
+ sys.path.insert(0, str(_CLONE_ROOT))
11
+
12
+ import os # noqa: E402
13
+
14
+ # Under the isolated diagnostic runner the candidate root is read-only and a
15
+ # private writable directory is provided; place the site database there.
16
+ if not os.environ.get("WEBSITEBENCH_SITE_BACKEND_DATABASE"):
17
+ _data_dir = os.environ.get("WEBSITEBENCH_DATA_DIR")
18
+ if _data_dir:
19
+ os.environ["WEBSITEBENCH_SITE_BACKEND_DATABASE"] = str(
20
+ Path(_data_dir) / "asana.sqlite3"
21
+ )
22
+
23
+ from backend.site_backend_integration import open_site_services # noqa: E402
24
+
25
+ from . import db as _db # noqa: E402
26
+
27
+
28
+ class _Services:
29
+ def __init__(self) -> None:
30
+ self.backend, self.auth = open_site_services()
31
+ self.cookie_name = self.backend.session_cookie["name"]
32
+ with self.auth.connect() as connection:
33
+ _db.ensure_schema(connection)
34
+ connection.commit()
35
+ # Public synthetic fixture credentials use the ordinary login path.
36
+ # New users still complete recipient-scoped registration and verification.
37
+ self.auth.seed_account(
38
+ subject_id="asana-demo-owner",
39
+ email="demo.owner@asana.example.test",
40
+ display_name="Demo Owner",
41
+ password="AsanaDemo2026!",
42
+ )
43
+
44
+
45
+ SERVICES = _Services()
tasks/asana/environment/reference/clone/backend/site_backend_integration.py ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Generated, site-bound backend integration seam."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import importlib
6
+ import json
7
+ import os
8
+ import sqlite3
9
+ from pathlib import Path
10
+ from typing import Any, Callable
11
+
12
+ from websitebench.local_clone_auth import LocalAuthStore
13
+ from websitebench.site_backend import (
14
+ SiteBackend,
15
+ load_runtime,
16
+ serve_jsonl,
17
+ validate_allowlist,
18
+ )
19
+
20
+
21
+ DEFAULT_RUNTIME_PATH = (
22
+ Path(__file__).resolve().parents[2] / "backend" / "runtime.json"
23
+ )
24
+ BRIDGE_DESCRIPTOR_PATH = (
25
+ Path(__file__).resolve().parents[2] / "backend" / "node-bridge.json"
26
+ )
27
+
28
+
29
+ def _declared_hook(
30
+ declaration: str | None,
31
+ ) -> Callable[[sqlite3.Connection], None] | None:
32
+ if declaration is None:
33
+ return None
34
+ module_name, function_name = declaration.split(":", 1)
35
+ module = importlib.import_module(module_name)
36
+ hook: Any = getattr(module, function_name, None)
37
+ if not callable(hook):
38
+ raise RuntimeError(f"declared backend hook is not callable: {declaration}")
39
+ actual = f"{hook.__module__}:{hook.__name__}"
40
+ if actual != declaration:
41
+ raise RuntimeError(
42
+ f"declared backend hook resolved as {actual!r}, expected {declaration!r}"
43
+ )
44
+ return hook
45
+
46
+
47
+ def open_site_services() -> tuple[SiteBackend, LocalAuthStore]:
48
+ """Open one bound database; never omit the site id for permanent auth."""
49
+
50
+ runtime_path = Path(
51
+ os.environ.get(
52
+ "WEBSITEBENCH_SITE_BACKEND_RUNTIME",
53
+ str(DEFAULT_RUNTIME_PATH),
54
+ )
55
+ ).resolve()
56
+ runtime = load_runtime(runtime_path)
57
+ migration_hook = _declared_hook(runtime.migration_hook)
58
+ seed_hook = _declared_hook(runtime.seed_hook)
59
+ deployed_database = os.environ.get(
60
+ "WEBSITEBENCH_SITE_BACKEND_DATABASE",
61
+ )
62
+ if deployed_database is None:
63
+ backend = SiteBackend.open(
64
+ runtime_path,
65
+ migration_hook=migration_hook,
66
+ seed_hook=seed_hook,
67
+ )
68
+ else:
69
+ database_path = Path(deployed_database).resolve()
70
+ if database_path.name != runtime.database_filename:
71
+ raise RuntimeError(
72
+ "deployed database filename does not match runtime contract"
73
+ )
74
+ backend = SiteBackend.open(
75
+ json.loads(runtime_path.read_text(encoding="utf-8")),
76
+ data_root=database_path.parent,
77
+ migration_hook=migration_hook,
78
+ seed_hook=seed_hook,
79
+ )
80
+ if backend.lifecycle.database_path != database_path:
81
+ raise RuntimeError(
82
+ "deployed database path does not match backend preflight"
83
+ )
84
+ backend.lifecycle.initialize()
85
+ # The declared concurrency contract is WAL transactional single-writer.
86
+ # Make that runtime property explicit and fail closed if the database
87
+ # cannot enter WAL mode (for example, on an incompatible filesystem).
88
+ with backend.lifecycle.connection() as connection:
89
+ journal_mode = str(
90
+ connection.execute("PRAGMA journal_mode=WAL").fetchone()[0]
91
+ ).casefold()
92
+ if journal_mode != "wal":
93
+ raise RuntimeError("site database could not enter WAL journal mode")
94
+ auth = LocalAuthStore(
95
+ backend.lifecycle.database_path,
96
+ site_id=backend.config.site_id,
97
+ )
98
+ auth.ensure_schema()
99
+ return backend, auth
100
+
101
+
102
+ def run_stdio_bridge() -> None:
103
+ """Run only operations frozen in this site's descriptor."""
104
+
105
+ backend, auth = open_site_services()
106
+ descriptor = json.loads(BRIDGE_DESCRIPTOR_PATH.read_text(encoding="utf-8"))
107
+ allowed = validate_allowlist(
108
+ descriptor,
109
+ expected_site_id=backend.config.site_id,
110
+ )
111
+ serve_jsonl(backend, auth, allowed, sys.stdin, sys.stdout)
112
+
113
+
114
+ if __name__ == "__main__":
115
+ import argparse
116
+ import sys
117
+
118
+ parser = argparse.ArgumentParser(prog="websitebench-node-backend-bridge")
119
+ parser.add_argument("--stdio", action="store_true", required=True)
120
+ parser.parse_args()
121
+ run_stdio_bridge()
tasks/asana/environment/reference/clone/requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ fastapi>=0.115
2
+ uvicorn>=0.30
3
+ python-multipart>=0.0.9
tasks/asana/environment/reference/clone/static/app.css ADDED
@@ -0,0 +1,591 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Authenticated app shell for the Asana offline clone. */
2
+ :root {
3
+ --coral: #f06a6a;
4
+ --ink: #1e1f21;
5
+ --ink-soft: #6d6e6f;
6
+ --line: #edeae9;
7
+ --bg: #ffffff;
8
+ --bg-warm: #f9f8f8;
9
+ --side: #2a2c2e;
10
+ --side-ink: #f5f4f3;
11
+ --side-soft: #a2a0a2;
12
+ --blue: #4573d2;
13
+ --green: #5da283;
14
+ --yellow: #f1bd6c;
15
+ --red: #c92f54;
16
+ --purple: #796eff;
17
+ --radius: 8px;
18
+ }
19
+ * { box-sizing: border-box; }
20
+ [hidden] { display: none !important; }
21
+ html, body { height: 100%; max-width: 100%; overflow: hidden; }
22
+ body.appbody {
23
+ margin: 0; color: var(--ink); background: var(--bg);
24
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
25
+ font-size: 14px; -webkit-font-smoothing: antialiased;
26
+ }
27
+ a { color: inherit; text-decoration: none; }
28
+ button { font: inherit; cursor: pointer; }
29
+ input, select, textarea { font: inherit; }
30
+
31
+ #app { display: flex; flex-direction: column; width: 100%; height: 100vh; overflow: hidden; }
32
+ .app-frame { display: flex; flex: 1; min-width: 0; min-height: 0; }
33
+
34
+ /* ---------- sidebar ---------- */
35
+ .sidebar {
36
+ width: 245px; min-width: 245px; height: 100%; background: var(--side); color: var(--side-ink);
37
+ display: flex; flex-direction: row; overflow: hidden; transition: margin-left .2s;
38
+ }
39
+ .sidebar.collapsed { margin-left: -245px; }
40
+ .mode-rail {
41
+ width: 64px; min-width: 64px; display: flex; flex-direction: column; align-items: center;
42
+ padding: 0 0 10px; background: var(--side); border-right: 1px solid #4a4c4e;
43
+ }
44
+ .mode-button {
45
+ width: 64px; height: 52px; margin-bottom: 8px; padding-top: 4px; flex: none; border: 0; border-radius: 0;
46
+ display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: flex-start;
47
+ color: #b8b9ba; font-size: 16px; line-height: 16px;
48
+ }
49
+ .mode-button > span { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
50
+ .mode-button .app-icon { width: 16px; height: 16px; }
51
+ .mode-button small { font-size: 10px; line-height: 12px; font-weight: 400; }
52
+ .mode-button:hover, .mode-button:focus-visible, .mode-button.active { color: #f2f3f4; outline: none; }
53
+ .mode-button:hover > span, .mode-button:focus-visible > span, .mode-button.active > span { background: rgba(255,255,255,.11); }
54
+ .mode-spacer { flex: 1; }
55
+ .mode-help { width: 32px; height: 32px; margin-bottom: 6px; padding: 0; border: 0; border-radius: 7px; display: flex; align-items: center; justify-content: center; background: transparent; color: #b8b9ba; }
56
+ .mode-help:hover, .mode-help:focus-visible { background: rgba(255,255,255,.11); color: #fff; outline: none; }
57
+ .mode-help svg { width: 16px; height: 16px; fill: currentColor; }
58
+ .mode-profile { width: 28px !important; height: 28px !important; font-size: 10px !important; margin: 0 0 9px; }
59
+ .workspace-rail { width: 181px; min-width: 181px; display: flex; flex-direction: column; min-height: 0; }
60
+ .mode-links { padding-top: 8px; }.mode-note { margin: 12px 10px; color: #b8b9ba; font-size: 11px; line-height: 16px; }
61
+ .workspace-title {
62
+ width: 179px; height: 30px; margin: 4px 1px 0; padding: 0 5px; border: 0; border-radius: 6px;
63
+ display: flex; align-items: center; gap: 7px; overflow: hidden; background: transparent;
64
+ color: #f5f4f3; text-align: left; font-size: 14px; line-height: 22px;
65
+ }
66
+ .workspace-title > span:first-child { padding-left: 4px; }
67
+ .workspace-title:hover { background: rgba(255,255,255,.08); }
68
+ .workspace-mark {
69
+ width: 20px; height: 20px; flex: none; display: inline-flex; align-items: center; justify-content: center;
70
+ border-radius: 5px; background: #6d6e6f; color: #fff; font-size: 8px; font-weight: 700;
71
+ }
72
+ .workspace-title > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
73
+ .workspace-chevron { margin-left: auto; color: #a2a0a2; }
74
+ .workspace-primary, .workspace-links { padding: 0 5px; }
75
+ .side-item {
76
+ display: flex; align-items: center; gap: 8px; width: 100%; height: 32px;
77
+ padding: 0 8px; border-radius: 8px; color: var(--side-ink);
78
+ background: none; border: none; text-align: left; font-size: 14px; line-height: 22px;
79
+ }
80
+ .side-item > span:first-child { width: 16px; flex: none; text-align: center; color: #c5c6c7; }
81
+ .workspace-primary .side-item:nth-child(2) > span:first-child { position: relative; }
82
+ .workspace-primary .side-item:nth-child(2) > span:first-child::after {
83
+ content: ""; position: absolute; right: -1px; top: -1px; width: 6px; height: 6px; border-radius: 50%; background: #f06a6a;
84
+ }
85
+ .app-icon { width: 16px; height: 16px; display: block; fill: currentColor; }
86
+ .side-item:hover { background: rgba(255,255,255,.07); }
87
+ .side-item.active { background: rgba(255,255,255,.11); }
88
+ .side-item .badge { margin-left: auto; background: var(--coral); color: #fff; border-radius: 999px; font-size: .7rem; padding: .05rem .45rem; }
89
+ .workspace-separator { height: 1px; min-height: 1px; margin: 8px 9px; background: #4b4d4f; }
90
+ .side-section { padding: 8px 5px 6px; overflow-y: auto; flex: 1; min-height: 72px; }
91
+ .side-head { height: 32px; display: flex; align-items: center; justify-content: space-between; color: var(--side-soft); font-size: .8rem; padding: 0 8px; text-transform: none; }
92
+ .side-head button { background: none; border: none; color: var(--side-soft); font-size: 1rem; }
93
+ .side-head button svg { width: 12px; height: 12px; display: block; fill: currentColor; }
94
+ .side-head button:hover { color: #fff; }
95
+ .side-disclosure { width: 16px; height: 16px; margin-right: 3px; display: inline-flex; align-items: center; justify-content: center; color: #b6b7b8; }
96
+ .side-disclosure svg { width: 16px; height: 16px; display: block; fill: currentColor; transform: rotate(90deg); }
97
+ .proj-dot { width: .7rem; height: .7rem; border-radius: 3px; flex: none; }
98
+ .proj-mark { width: 20px; height: 20px; margin-left: -2px; margin-right: -2px; display: inline-flex; align-items: center; justify-content: center; border-radius: 5px; background: #ff9b6a; color: #292a2c !important; }
99
+ .proj-mark svg { width: 12px; height: 12px; display: block; fill: currentColor; }
100
+ .side-foot {
101
+ width: 179px; height: 155px; flex: none; margin: 0 1px 9px; padding: 8px 8px 0;
102
+ display: flex; flex-direction: column; gap: 8px; border-top: 1px solid #626364;
103
+ font-size: 14px; color: var(--side-soft);
104
+ }
105
+ .trial-card {
106
+ width: 163px; height: 102px; flex: none; margin: 0; padding: 8px; display: grid;
107
+ grid-template-columns: 26px 1fr; grid-template-rows: 36px 36px; column-gap: 8px; row-gap: 12px;
108
+ align-items: start; border: 1px solid #414244; border-radius: 6px; background: #252728; color: #f2f3f4;
109
+ }
110
+ .trial-card > span:nth-child(2) { height: 36px; display: flex; flex-direction: column; gap: 0; font-size: 12px; line-height: 18px; }
111
+ .trial-card strong { font-weight: 400; }
112
+ .trial-card small { color: #6dad8f; font-size: 12px; line-height: 18px; }
113
+ .trial-ring { width: 26px; height: 26px; align-self: center; border: 4px solid #6dad8f; border-right-color: #414244; border-radius: 50%; }
114
+ .trial-card button { grid-column: 1 / -1; height: 36px; border: 0; border-radius: 6px; background: #e5bf8d; color: #1d1f21; font-size: 14px; line-height: 36px; }
115
+ .invite-row { width: 163px; height: 36px; flex: none; gap: 4px; border: 1px solid #4f5052; justify-content: center; }
116
+ .invite-row > span:first-child { width: 20px; height: 16px; }
117
+ .invite-row svg { width: 20px; height: 16px; display: block; fill: currentColor; }
118
+ .workspace-switch-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
119
+
120
+ /* ---------- topbar ---------- */
121
+ .main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
122
+ .topbar {
123
+ position: relative; z-index: 35; display: flex; align-items: center; width: 100%; height: 49px;
124
+ min-height: 49px; padding: 0; border: 0; background: rgb(42,44,46); color: #fff;
125
+ }
126
+ .hamb-slot { width: 64px; height: 49px; display: flex; align-items: center; justify-content: center; flex: none; }
127
+ .hamb {
128
+ width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: none;
129
+ color: #f5f4f3; font-size: 17px; line-height: 28px;
130
+ }
131
+ .hamb { display: flex; align-items: center; justify-content: center; color: #c8c9ca; font-size: 0; }
132
+ .hamb svg, .create-btn svg, .searchbox svg, .assistant-btn svg { width: 16px; height: 16px; display: block; fill: currentColor; }
133
+ .hamb:hover, .hamb:focus-visible, .assistant-btn:hover, .assistant-btn:focus-visible { background: rgba(255,255,255,.1); outline: none; }
134
+ .create-btn {
135
+ position: absolute; left: 64px; top: 8px; width: 89px; height: 32px; padding: 0 13px;
136
+ display: flex; align-items: center; justify-content: center; gap: 5px; background: rgb(64,66,68);
137
+ border: 1px solid #626364; color: #fff; border-radius: 16px; font-size: 14px; line-height: 22px; font-weight: 500;
138
+ }
139
+ .create-btn:hover { background: #505254; }
140
+ .searchbox { position: absolute; left: calc(50% - 270px); top: 8px; width: 540px; height: 32px; }
141
+ .searchbox input {
142
+ width: 100%; height: 32px; padding: 0 14px 0 34px; border-radius: 16px;
143
+ border: 1px solid #626364; background: #414244; color: #fff; font-size: 14px;
144
+ }
145
+ .searchbox input::placeholder { color: #d4d5d6; opacity: 1; }
146
+ .searchbox input:focus { outline: 2px solid #aebce0; outline-offset: 0; background: #505254; }
147
+ .searchbox .icon { position: absolute; z-index: 1; left: 12px; top: 8px; color: #c7c8c9; }
148
+ .assistant-btn {
149
+ position: absolute; right: 12px; top: 10px; width: 28px; height: 28px; padding: 0;
150
+ border: 1px solid #9d1b16; border-radius: 50%; background: none; color: #f06a6a; font-size: 15px;
151
+ }
152
+ .assistant-btn { display: flex; align-items: center; justify-content: center; }
153
+ .avatar {
154
+ width: 2rem; height: 2rem; border-radius: 50%; color: #fff; display: inline-flex;
155
+ align-items: center; justify-content: center; font-size: .78rem; font-weight: 600; flex: none;
156
+ border: none;
157
+ }
158
+ .avatar.sm { width: 1.55rem; height: 1.55rem; font-size: .62rem; }
159
+
160
+ /* ---------- content ---------- */
161
+ .content {
162
+ flex: 1; min-width: 0; overflow-x: hidden; overflow-y: auto;
163
+ background-color: #f6f2e9; background-image: url("/static/source/oat-background.png");
164
+ background-position: 0 0; background-repeat: no-repeat; background-size: cover;
165
+ }
166
+ .page { padding: 1.2rem 1.6rem 3rem; max-width: 80rem; }
167
+ .page-head { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; margin-bottom: .6rem; }
168
+ .page-head h1 { font-size: 1.35rem; margin: 0; letter-spacing: -.01em; }
169
+ .page-sub { color: var(--ink-soft); margin: 0 0 1rem; }
170
+ .proj-icon { width: 2.4rem; height: 2.4rem; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 1.1rem; flex: none; }
171
+
172
+ .tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
173
+ .tab { background: none; border: none; padding: .5rem .8rem; color: var(--ink-soft); border-bottom: 2px solid transparent; font-size: .92rem; }
174
+ .tab:hover { color: var(--ink); }
175
+ .tab.active { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
176
+
177
+ .toolbar { display: flex; align-items: center; gap: .5rem; margin-bottom: .8rem; flex-wrap: wrap; }
178
+ .toolbar .spacer { flex: 1; }
179
+ .tbtn { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: .35rem .7rem; font-size: .87rem; color: var(--ink); display: inline-flex; gap: .35rem; align-items: center; }
180
+ .tbtn:hover { border-color: #cfcbcb; background: var(--bg-warm); }
181
+ .tbtn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
182
+ .tbtn.danger { color: var(--red); }
183
+ .tbtn.on { background: #e8f0fe; border-color: var(--blue); color: var(--blue); }
184
+ select.tbtn { padding: .32rem .5rem; }
185
+
186
+ /* list view */
187
+ .tasklist { border-top: 1px solid var(--line); }
188
+ .section-row { display: flex; align-items: center; gap: .5rem; padding: .55rem .3rem .3rem; font-weight: 600; }
189
+ .section-row .count { color: var(--ink-soft); font-weight: 400; }
190
+ .task-row {
191
+ display: flex; align-items: center; gap: .55rem; padding: .42rem .3rem;
192
+ border-bottom: 1px solid var(--line); cursor: pointer;
193
+ }
194
+ .task-row:hover { background: var(--bg-warm); }
195
+ .task-row.done .tname { text-decoration: line-through; color: var(--ink-soft); }
196
+ .checkbox {
197
+ width: 1.15rem; height: 1.15rem; border-radius: 50%; border: 1.5px solid #b9b6b6;
198
+ background: #fff; display: inline-flex; align-items: center; justify-content: center;
199
+ color: transparent; font-size: .7rem; flex: none; padding: 0;
200
+ }
201
+ .checkbox:hover { border-color: var(--green); color: var(--green); }
202
+ .checkbox.on { background: var(--green); border-color: var(--green); color: #fff; }
203
+ .tname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
204
+ .tmeta { display: flex; align-items: center; gap: .55rem; color: var(--ink-soft); font-size: .82rem; }
205
+ .due { white-space: nowrap; }
206
+ .due.overdue { color: var(--red); }
207
+ .due.today { color: var(--green); }
208
+ .chip { border-radius: 999px; padding: .1rem .55rem; font-size: .75rem; background: var(--bg-warm); border: 1px solid var(--line); white-space: nowrap; }
209
+ .chip.p-High { background: #fce9ec; color: #c92f54; border-color: #f5c9d2; }
210
+ .chip.p-Medium { background: #fdf3e3; color: #9a6700; border-color: #f3ddb0; }
211
+ .chip.p-Low { background: #e9f2ee; color: #2f6f4f; border-color: #cfe3d9; }
212
+ .chip.s-on_track { background: #e9f2ee; color: #2f6f4f; }
213
+ .chip.s-at_risk { background: #fdf3e3; color: #9a6700; }
214
+ .chip.s-off_track { background: #fce9ec; color: #c92f54; }
215
+ .addtask-row { padding: .5rem .3rem; }
216
+ .selectbox { width: 1rem; height: 1rem; flex: none; }
217
+
218
+ /* board view */
219
+ .board { display: flex; gap: .9rem; align-items: flex-start; overflow-x: auto; padding-bottom: 1rem; }
220
+ .col { background: var(--bg-warm); border-radius: 10px; min-width: 17rem; width: 17rem; padding: .6rem; }
221
+ .col-head { display: flex; align-items: center; gap: .4rem; font-weight: 600; padding: .2rem .3rem .6rem; }
222
+ .col-head .count { color: var(--ink-soft); font-weight: 400; }
223
+ .card {
224
+ background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .7rem;
225
+ margin-bottom: .55rem; cursor: pointer; box-shadow: 0 1px 2px rgba(30,31,33,.04);
226
+ }
227
+ .card:hover { border-color: #cfcbcb; }
228
+ .card .cname { font-weight: 500; margin-bottom: .45rem; }
229
+ .card.done .cname { text-decoration: line-through; color: var(--ink-soft); }
230
+ .card .cmeta { display: flex; gap: .45rem; align-items: center; color: var(--ink-soft); font-size: .78rem; flex-wrap: wrap; }
231
+ .addcard { width: 100%; background: none; border: none; color: var(--ink-soft); text-align: left; padding: .4rem .3rem; border-radius: 6px; }
232
+ .addcard:hover { background: #efecec; color: var(--ink); }
233
+
234
+ /* calendar view */
235
+ .cal-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .6rem; }
236
+ .cal-head h2 { margin: 0; font-size: 1.05rem; }
237
+ .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
238
+ .cal-dow { padding: .35rem .5rem; font-size: .78rem; color: var(--ink-soft); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg-warm); }
239
+ .cal-cell { min-height: 6.2rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: .3rem; font-size: .8rem; }
240
+ .cal-cell.other { background: var(--bg-warm); color: var(--ink-soft); }
241
+ .cal-date { font-size: .75rem; color: var(--ink-soft); margin-bottom: .25rem; }
242
+ .cal-date.today { background: var(--coral); color: #fff; border-radius: 999px; width: 1.4rem; height: 1.4rem; display: inline-flex; align-items: center; justify-content: center; }
243
+ .cal-task { display: block; width: 100%; text-align: left; border: none; border-radius: 5px; color: #fff; padding: .18rem .4rem; margin-bottom: .2rem; font-size: .75rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
244
+
245
+ /* timeline view */
246
+ .tl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
247
+ .tl-grid { position: relative; min-width: 60rem; }
248
+ .tl-days { display: flex; border-bottom: 1px solid var(--line); background: var(--bg-warm); }
249
+ .tl-day { width: 3rem; flex: none; font-size: .7rem; color: var(--ink-soft); text-align: center; padding: .3rem 0; border-right: 1px solid var(--line); }
250
+ .tl-day.wknd { background: #f1efee; }
251
+ .tl-row { position: relative; height: 2.3rem; border-bottom: 1px solid var(--line); }
252
+ .tl-bar {
253
+ position: absolute; top: .35rem; height: 1.6rem; border-radius: 6px; color: #fff;
254
+ font-size: .78rem; display: flex; align-items: center; padding: 0 .5rem;
255
+ overflow: hidden; white-space: nowrap; border: none; text-overflow: ellipsis;
256
+ }
257
+ .tl-bar.done { opacity: .55; }
258
+ .tl-unscheduled { padding: .6rem; color: var(--ink-soft); font-size: .85rem; }
259
+
260
+ /* generic cards/grids */
261
+ .grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .9rem; }
262
+ .gcard { border: 1px solid var(--line); border-radius: 10px; padding: 1rem; cursor: pointer; background: #fff; }
263
+ .gcard:hover { border-color: #cfcbcb; box-shadow: 0 2px 8px rgba(30,31,33,.06); }
264
+ .gcard h3 { margin: .5rem 0 .2rem; font-size: 1rem; }
265
+ .gcard .gsub { color: var(--ink-soft); font-size: .83rem; }
266
+ .mode-page { max-width: 72rem; padding: 32px 40px 60px; }
267
+ .mode-hero { min-height: 240px; margin-bottom: 28px; padding: 34px; display: flex; align-items: center; gap: 30px; border-radius: 16px; background: #f5f3f3; }
268
+ .mode-hero > div { max-width: 700px; }.mode-hero h1 { margin: 5px 0 12px; font-size: 34px; line-height: 40px; }
269
+ .mode-hero p { margin: 0; color: var(--ink-soft); line-height: 24px; }.mode-eyebrow { color: var(--ink) !important; font-size: 11px; letter-spacing: .14em; }
270
+ .strategy-hero { background: #edf6ff; }.mode-card-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
271
+ .mode-card { width: 100%; min-height: 190px; text-align: left; color: var(--ink); }
272
+ .mode-card p, .people-card p { color: var(--ink-soft); line-height: 21px; }.mode-card > span:last-child, .people-card > span:last-child { display: inline-block; margin-top: 15px; font-size: 13px; font-weight: 600; }
273
+ .mode-card-icon { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: #ffd5d2; }
274
+ .mode-card-icon.large { width: 74px; height: 74px; flex: none; border-radius: 20px; font-size: 28px; }
275
+ .knowledge-search, .people-tools { max-width: 760px; margin: 18px 0 24px; display: flex; gap: 10px; }
276
+ .knowledge-search input, .people-tools input { width: 100%; height: 42px; padding: 0 13px; border: 1px solid #cfcbcb; border-radius: 8px; }
277
+ .people-directory { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }.people-card { min-height: 180px; width: 100%; text-align: left; color: var(--ink); }
278
+ .profile-menu-head { display: flex; align-items: center; gap: 12px; }.profile-menu-head h2 { margin: 0 0 3px; }.profile-menu-head .page-sub { margin: 0; }
279
+ .profile-menu-actions, .help-menu-grid, .home-option-list { margin-top: 18px; display: grid; gap: 8px; }.profile-menu-actions .tbtn, .help-menu-grid .tbtn, .home-option-list .tbtn { width: 100%; justify-content: flex-start; text-align: left; }
280
+ .progressbar { height: .45rem; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: .5rem; }
281
+ .progressbar > div { height: 100%; background: var(--green); }
282
+
283
+ /* Authenticated Home: geometry is derived only from the sanitized visual2 facts. */
284
+ .home-page { width: 100%; min-width: 0; max-width: none; min-height: 1741px; padding: 0; }
285
+ .home-header {
286
+ position: relative; height: 90px; margin: 0 24px; padding: 24px 8px 0;
287
+ }
288
+ .home-date { display: block; height: 22px; color: #1d1f21; font-size: 14px; line-height: 22px; font-weight: 500; }
289
+ .home-header h1 {
290
+ height: 40px; margin: 4px 0 0; font-size: 32px; line-height: 40px; font-weight: 400;
291
+ letter-spacing: normal; white-space: nowrap;
292
+ }
293
+ .home-header-actions {
294
+ position: absolute; right: 8px; top: 62px; height: 28px; display: flex; align-items: center; gap: 10px;
295
+ }
296
+ .home-summary { height: 28px; display: flex; align-items: center; border-radius: 6px; overflow: hidden; background: rgba(255,255,255,.88); }
297
+ .home-summary button, .home-customize {
298
+ height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: rgba(255,255,255,.56);
299
+ color: #38393b; font-size: 12px; line-height: 28px;
300
+ }
301
+ .home-summary button { border-radius: 0; border-right: 0; background: transparent; display: flex; align-items: center; justify-content: center; }
302
+ .home-summary button:first-child {
303
+ background-image: linear-gradient(rgba(30,31,33,.14),rgba(30,31,33,.14));
304
+ background-size: 1px 24px; background-position: right center; background-repeat: no-repeat;
305
+ }
306
+ .home-summary svg { width: 12px; height: 12px; display: block; fill: currentColor; }
307
+ .home-summary button:nth-child(1) { width: 85px; }
308
+ .home-summary button:nth-child(2) { width: 150px; }
309
+ .home-summary button:nth-child(3) { width: 119px; }
310
+ .home-summary button:hover, .home-customize:hover { background: rgba(255,255,255,.84); }
311
+ .home-customize {
312
+ width: 94px; padding: 0 6px; border: 1px solid rgba(30,31,33,.18); font-size: 12px;
313
+ white-space: nowrap;
314
+ }
315
+ .home-customize > span {
316
+ width: 12px; height: 12px; margin-right: 4px; display: inline-block; vertical-align: -2px;
317
+ border-radius: 2px; color: transparent;
318
+ background: conic-gradient(#f06a6a 0 25%, #f1bd6c 0 50%, #5da283 0 75%, #4573d2 0);
319
+ }
320
+ .home-list {
321
+ display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
322
+ width: auto; margin: 12px 24px 0;
323
+ }
324
+ .home-section { height: 416px; min-width: 0; padding: 8px; }
325
+ .home-card {
326
+ width: 100%; height: 400px; overflow: hidden; background: #fff; border: 1px solid rgba(30,31,33,.08);
327
+ border-radius: 8px; box-shadow: 0 1px 2px rgba(30,31,33,.06);
328
+ }
329
+ .home-card h2 { margin: 0; font-size: 20px; line-height: 28px; font-weight: 500; }
330
+ .home-task-head { height: 97px; border-bottom: 1px solid var(--line); }
331
+ .home-title-row { height: 52px; padding: 24px 24px 0; display: flex; align-items: center; gap: 8px; }
332
+ .home-title-row h2 { flex: none; }
333
+ .home-avatar { width: 24px; height: 24px; font-size: 9px; }
334
+ .home-lock { color: #6d6e6f; font-size: 10px; }
335
+ .home-more {
336
+ width: 28px; height: 28px; margin-left: auto; padding: 0; border: 0; border-radius: 6px;
337
+ background: transparent; color: var(--ink-soft); letter-spacing: 1px;
338
+ }
339
+ .home-title-row, .home-project-head { position: relative; }
340
+ .home-title-row > .home-more, .home-project-head > .home-more {
341
+ position: absolute; right: 8px; top: 8px; width: 38px; height: 38px;
342
+ border: 1px solid #e5e2e1; border-radius: 9px; background: rgba(255,255,255,.92);
343
+ box-shadow: 0 1px 2px rgba(30,31,33,.03);
344
+ }
345
+ .home-more:hover { background: var(--bg-warm); }
346
+ .home-task-tabs { height: 44px; margin: 0 24px; padding: 8px 0; display: flex; align-items: stretch; gap: 4px; }
347
+ .home-task-tabs button {
348
+ height: 28px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent;
349
+ color: var(--ink-soft); font-size: 14px; line-height: 28px;
350
+ }
351
+ .home-task-tabs button:hover { background: var(--bg-warm); color: var(--ink); }
352
+ .home-task-tabs button.active { background: #e9f1fe; color: #335fb5; font-weight: 500; }
353
+ .home-task-panel { height: 301px; display: flex; flex-direction: column; overflow: hidden; }
354
+ .home-task-create { height: 53px; min-height: 53px; padding: 0 24px; border: 0; border-bottom: 1px solid var(--line); background: #fff; color: #55575a; text-align: left; }
355
+ .home-task-create:hover { background: var(--bg-warm); }
356
+ .home-task-rows { flex: 1; min-height: 0; padding: 0 24px; overflow-y: auto; }
357
+ .home-task-rows .task-row { min-height: 36px; padding: 7px 0; }
358
+ .home-project-chip { max-width: 92px; padding: 3px 7px; display: inline-flex; align-items: center; gap: 5px; overflow: hidden; border-radius: 5px; background: #f1f1f1; color: #4d4e50; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
359
+ .home-project-chip i { width: 11px; height: 11px; flex: none; border-radius: 3px; background: #ff9b6a; }
360
+ .home-due { min-width: 70px; color: #477b68; font-size: 12px; text-align: right; white-space: nowrap; }
361
+ .home-task-actions {
362
+ height: 43px; min-height: 43px; padding: 6px 24px 8px; display: flex; align-items: center; gap: 16px;
363
+ border-top: 1px solid var(--line); color: var(--ink-soft); font-size: 13px;
364
+ }
365
+ .home-task-actions button, .home-project-actions button, .home-project-actions a {
366
+ padding: 0; border: 0; background: none; color: var(--ink-soft); font-size: 13px;
367
+ }
368
+ .home-task-actions a { margin-left: auto; }
369
+ .home-task-actions button:hover, .home-task-actions a:hover,
370
+ .home-project-actions button:hover, .home-project-actions a:hover { color: var(--ink); text-decoration: underline; }
371
+ .home-empty {
372
+ min-height: 90px; padding: 28px 8px; display: flex; flex-direction: column; align-items: center;
373
+ justify-content: center; gap: 4px; color: var(--ink-soft); text-align: center;
374
+ }
375
+ .home-empty strong { color: var(--ink); font-weight: 500; }
376
+ .home-project-head { height: 52px; padding: 22px 8px 2px 24px; display: flex; align-items: center; gap: 14px; }
377
+ .home-project-view { padding: 0; border: 0; background: transparent; color: #55575a; font-size: 12px; }
378
+ .home-project-head .home-more { margin-left: auto; }
379
+ .home-project-list {
380
+ height: 240px; padding: 16px 28px 8px; display: flex; align-items: flex-start; gap: 2px; overflow: hidden;
381
+ }
382
+ .home-project-row, .home-project-create {
383
+ width: 220px; min-height: 64px; padding: 8px; display: flex; align-items: center; gap: 12px;
384
+ border: 0; border-radius: 8px; background: #fff; color: var(--ink); text-align: left;
385
+ }
386
+ .home-project-row:hover, .home-project-create:hover { background: var(--bg-warm); }
387
+ .home-project-create > span { width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 1px dashed #8e8f90; border-radius: 10px; font-size: 24px; font-weight: 300; }
388
+ .home-project-create strong { font-weight: 500; }
389
+ .home-project-icon {
390
+ width: 40px; height: 40px; flex: none; display: inline-flex; align-items: center; justify-content: center;
391
+ border-radius: 9px; color: #fff; font-size: 16px;
392
+ }
393
+ .home-project-row .home-project-icon { background: #ff9b6a !important; color: #292a2c; }
394
+ .home-project-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 2px; }
395
+ .home-project-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
396
+ .home-project-copy span { color: var(--ink-soft); font-size: 12px; }
397
+ .row-arrow { color: var(--ink-soft); font-size: 20px; }
398
+ .home-project-actions {
399
+ height: 52px; padding: 11px 24px; display: flex; align-items: center; justify-content: space-between;
400
+ border-top: 1px solid var(--line);
401
+ }
402
+ .home-learn { grid-column: 1 / -1; }
403
+ .home-learn .home-card > h2 { height: 52px; padding: 24px 24px 0; }
404
+ .home-learn .home-card > h2 span { display: block; height: 28px; }
405
+ .learn-carousel { width: 100%; height: 338px; padding: 24px; overflow: hidden; }
406
+ .learn-track { width: max-content; margin: 2px; display: flex; gap: 20px; }
407
+ .learn-card {
408
+ width: 320px; height: 286px; padding: 0; overflow: hidden; flex: none; display: flex; flex-direction: column;
409
+ border: 1px solid #e8e9ea; border-radius: 8px; background: #fff; color: var(--ink); text-align: left;
410
+ }
411
+ .learn-card:hover { border-color: #e4bfc2; box-shadow: 0 2px 8px rgba(30,31,33,.08); }
412
+ .learn-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
413
+ .learn-graphic {
414
+ position: relative; width: 318px; min-height: 180px; display: block; overflow: hidden;
415
+ border-radius: 7px 7px 0 0; background: #ffeaec;
416
+ }
417
+ .learn-vector { position: absolute; left: 99px; top: 30px; width: 120px; height: 120px; display: block; }
418
+ .learn-art { position: absolute; left: 50%; top: 28px; width: 150px; height: 125px; transform: translateX(-50%); color: #a82543; }
419
+ .learn-art-rocket i:nth-child(1) { position: absolute; left: 57px; top: 6px; width: 38px; height: 88px; border: 2px solid currentColor; border-radius: 50% 50% 12px 12px; background: #fff5f5; }
420
+ .learn-art-rocket i:nth-child(2), .learn-art-rocket i:nth-child(3) { position: absolute; top: 54px; width: 34px; height: 45px; border: 2px solid currentColor; background: #f06a6a; }
421
+ .learn-art-rocket i:nth-child(2) { left: 28px; border-radius: 28px 5px 5px 8px; }
422
+ .learn-art-rocket i:nth-child(3) { right: 27px; border-radius: 5px 28px 8px 5px; }
423
+ .learn-art-rocket i:nth-child(4) { position: absolute; left: 36px; right: 36px; bottom: 3px; height: 28px; border-bottom: 2px solid currentColor; border-radius: 50%; box-shadow: inset 0 -11px 0 #fff; }
424
+ .learn-art-education i:nth-child(1) { position: absolute; left: 19px; top: 39px; width: 105px; height: 58px; border: 2px solid currentColor; background: #fff5f5; transform: skew(-18deg) rotate(-13deg); }
425
+ .learn-art-education i:nth-child(2) { position: absolute; left: 46px; top: 31px; width: 85px; height: 36px; border: 2px solid currentColor; background: #f7c5ca; transform: rotate(-13deg); clip-path: polygon(0 50%,50% 0,100% 50%,50% 100%); }
426
+ .learn-art-education i:nth-child(3) { position: absolute; right: 4px; top: 43px; width: 3px; height: 44px; background: currentColor; transform: rotate(-13deg); }
427
+ .learn-art-education i:nth-child(4) { position: absolute; right: 0; top: 82px; width: 10px; height: 18px; border: 2px solid currentColor; border-radius: 50%; }
428
+ .learn-art-calendar i:nth-child(1) { position: absolute; left: 29px; top: 12px; width: 92px; height: 88px; border: 2px solid currentColor; border-radius: 7px; background: #fff7f7; box-shadow: inset 0 23px 0 #f7c5ca; }
429
+ .learn-art-calendar i:nth-child(2) { position: absolute; left: 46px; top: 53px; width: 56px; height: 35px; border-left: 3px solid currentColor; border-bottom: 3px solid currentColor; transform: skew(-12deg); }
430
+ .learn-art-calendar i:nth-child(3) { position: absolute; left: 54px; top: 70px; width: 16px; height: 15px; background: #f06a6a; box-shadow: 20px -10px 0 #f06a6a,40px -23px 0 #f06a6a; }
431
+ .learn-art-calendar i:nth-child(4) { position: absolute; left: 70px; bottom: 1px; width: 18px; height: 23px; background: currentColor; clip-path: polygon(50% 0,100% 100%,0 100%); }
432
+ .learn-art-workflow { opacity: .7; }
433
+ .learn-art-workflow i { position: absolute; width: 42px; height: 42px; border: 2px solid currentColor; border-radius: 8px; background: #fff; }
434
+ .learn-art-workflow i:nth-child(1) { left: 12px; top: 22px; }.learn-art-workflow i:nth-child(2) { left: 54px; top: 54px; }.learn-art-workflow i:nth-child(3) { right: 12px; top: 22px; }.learn-art-workflow i:nth-child(4) { left: 54px; top: 96px; }
435
+ .learn-graphic-2, .learn-graphic-3, .learn-graphic-4 { background: #ffeaec; }
436
+ .learn-duration { position: absolute; left: 15px; bottom: 12px; padding: 2px 7px; border-radius: 4px; background: #424244; color: #fff; font-size: 12px; line-height: 20px; }
437
+ .learn-card:nth-child(1) .learn-duration::before,
438
+ .learn-card:nth-child(3) .learn-duration::before { content: "▷ "; font-size: 12px; }
439
+ .learn-card:nth-child(2) .learn-duration::before { content: "▤ "; font-size: 11px; }
440
+ .learn-card > strong { margin: 16px 16px 0; font-size: 16px; line-height: 20px; font-weight: 500; }
441
+ .learn-copy { margin: 8px 16px 0; color: var(--ink-soft); font-size: 14px; line-height: 20px; }
442
+ .home-widget { min-width: 0; }
443
+ .home-focus { height: 342px; }
444
+ .home-focus .home-card { height: 326px; }
445
+ .widget-card { padding: 0 24px 20px; }
446
+ .widget-head { min-height: 112px; padding: 28px 0 16px; display: flex; gap: 16px; justify-content: space-between; border-bottom: 1px solid var(--line); }
447
+ .widget-head h2 { margin-bottom: 8px; }.widget-head p { margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 20px; }
448
+ .widget-rows button { width: 100%; height: 48px; padding: 0; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 8px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
449
+ .widget-rows strong { overflow: hidden; font-weight: 400; white-space: nowrap; text-overflow: ellipsis; }.widget-rows time { color: var(--ink-soft); font-size: 12px; }
450
+ .people-grid { padding-top: 20px; display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
451
+ .people-grid button { min-height: 118px; padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
452
+ .people-grid strong { font-size: 13px; font-weight: 500; }.people-grid small { color: var(--ink-soft); }
453
+ .widget-avatar { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-size: 11px; }.widget-avatar.blue{background:#4573d2}.widget-avatar.pink{background:#f06a6a}.widget-avatar.green{background:#5da283}
454
+ .focus-steps { padding-top: 20px; display: flex; gap: 16px; }.focus-steps button { flex: 1; min-height: 100px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: left; }.focus-steps span { width: 32px; height: 32px; margin-left: 12px; display: inline-flex; align-items:center;justify-content:center;border-radius:50%;background:#ffeaec;color:#a82543; }.focus-steps strong { font-weight:500; }
455
+ .assistant-prompts { display: flex; flex-wrap: wrap; gap: 8px; }
456
+ .assistant-answer { min-height: 22px; margin: 14px 0 0; color: var(--ink-soft); }
457
+ .achievement-list p { padding: 10px 0; border-bottom: 1px solid var(--line); }
458
+ .achievement-list p > span { margin-right: 8px; }
459
+ .saved-view-row {
460
+ width: 100%; min-height: 38px; padding: 7px 9px; border: 0; border-bottom: 1px solid var(--line);
461
+ background: #fff; color: var(--ink); text-align: left;
462
+ }
463
+ .saved-view-row:hover { background: var(--bg-warm); }
464
+ .text-button { padding: 0; border: 0; background: transparent; color: var(--blue); text-align: left; }
465
+ .text-button:hover { text-decoration: underline; }
466
+
467
+ /* empty + error states */
468
+ .empty { text-align: center; padding: 3.2rem 1rem; color: var(--ink-soft); }
469
+ .empty h3 { color: var(--ink); margin-bottom: .3rem; }
470
+ .empty .art { font-size: 2.2rem; margin-bottom: .6rem; }
471
+ .loading { padding: 2.5rem; text-align: center; color: var(--ink-soft); }
472
+ .spinner { display: inline-block; width: 1.4rem; height: 1.4rem; border: 2.5px solid var(--line); border-top-color: var(--coral); border-radius: 50%; animation: spin .8s linear infinite; }
473
+ @keyframes spin { to { transform: rotate(360deg); } }
474
+
475
+ /* task pane */
476
+ .pane-backdrop { position: fixed; inset: 0; background: rgba(30,31,33,.25); z-index: 40; }
477
+ .task-pane {
478
+ position: fixed; top: 0; right: 0; bottom: 0; width: min(34rem, 100vw);
479
+ background: #fff; border-left: 1px solid var(--line); z-index: 41;
480
+ display: flex; flex-direction: column; box-shadow: -12px 0 30px rgba(30,31,33,.08);
481
+ }
482
+ .pane-top { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); }
483
+ .pane-top .spacer { flex: 1; }
484
+ .iconbtn { background: none; border: none; color: var(--ink-soft); font-size: 1rem; padding: .3rem .45rem; border-radius: 6px; }
485
+ .iconbtn:hover { background: var(--bg-warm); color: var(--ink); }
486
+ .pane-body { flex: 1; overflow-y: auto; padding: 1rem 1.2rem; }
487
+ .pane-body h2[contenteditable] { font-size: 1.25rem; margin: 0 0 .9rem; outline: none; border-radius: 6px; padding: .2rem .3rem; }
488
+ .pane-body h2[contenteditable]:focus { box-shadow: 0 0 0 2px var(--blue); }
489
+ .frow { display: flex; align-items: center; gap: .7rem; margin-bottom: .65rem; }
490
+ .frow .flabel { width: 6.5rem; color: var(--ink-soft); font-size: .85rem; flex: none; }
491
+ .frow select, .frow input[type=date] { border: 1px solid var(--line); border-radius: 6px; padding: .3rem .5rem; background: #fff; }
492
+ .notes-box { width: 100%; min-height: 5.5rem; border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; resize: vertical; }
493
+ .subhead { font-weight: 600; margin: 1.1rem 0 .45rem; font-size: .92rem; }
494
+ .subtask-row { display: flex; gap: .5rem; align-items: center; padding: .3rem 0; border-bottom: 1px solid var(--line); }
495
+ .dep-row { display: flex; gap: .5rem; align-items: center; padding: .25rem 0; font-size: .88rem; }
496
+ .comment { display: flex; gap: .6rem; margin-bottom: .8rem; }
497
+ .comment .cbody { background: var(--bg-warm); border-radius: 10px; padding: .5rem .8rem; flex: 1; }
498
+ .comment .cwho { font-weight: 600; font-size: .85rem; }
499
+ .comment .cwhen { color: var(--ink-soft); font-size: .75rem; margin-left: .4rem; font-weight: 400; }
500
+ .comment-box { display: flex; gap: .6rem; margin-top: .6rem; }
501
+ .comment-box textarea { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; min-height: 2.6rem; resize: vertical; }
502
+ .activity-item { color: var(--ink-soft); font-size: .82rem; padding: .22rem 0; }
503
+
504
+ /* modal */
505
+ .modal-backdrop { position: fixed; inset: 0; background: rgba(30,31,33,.35); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 7vh 1rem; }
506
+ .modal { background: #fff; border-radius: 12px; width: 100%; max-width: 30rem; padding: 1.3rem 1.4rem; box-shadow: 0 24px 60px rgba(30,31,33,.25); max-height: 84vh; overflow-y: auto; }
507
+ .modal h2 { margin: 0 0 1rem; font-size: 1.15rem; }
508
+ .modal .field { margin-bottom: .8rem; text-align: left; }
509
+ .modal .field label { display: block; font-size: .84rem; margin-bottom: .25rem; }
510
+ .modal .field input, .modal .field select, .modal .field textarea { width: 100%; border: 1px solid #cfcbcb; border-radius: 6px; padding: .5rem .6rem; }
511
+ .modal-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.1rem; }
512
+ .color-row { display: flex; gap: .4rem; flex-wrap: wrap; }
513
+ .color-swatch { width: 1.6rem; height: 1.6rem; border-radius: 6px; border: 2px solid transparent; padding: 0; }
514
+ .color-swatch.on { border-color: var(--ink); }
515
+
516
+ /* toast */
517
+ .toasts { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: .5rem; }
518
+ .toast { background: var(--ink); color: #fff; border-radius: 8px; padding: .6rem 1.1rem; font-size: .9rem; box-shadow: 0 8px 24px rgba(30,31,33,.3); }
519
+ .toast.error { background: var(--red); }
520
+
521
+ /* inbox */
522
+ .inbox-item { display: flex; gap: .7rem; padding: .75rem .4rem; border-bottom: 1px solid var(--line); align-items: flex-start; }
523
+ .inbox-item.unread { background: #f5f8ff; }
524
+ .inbox-item .when { color: var(--ink-soft); font-size: .78rem; }
525
+ .inbox-actions { margin-left: auto; display: flex; gap: .3rem; }
526
+
527
+ /* settings/admin */
528
+ .settings-block { border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; max-width: 44rem; }
529
+ .settings-block h3 { margin-top: 0; }
530
+ .member-row { display: flex; align-items: center; gap: .7rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
531
+ .member-row .who { flex: 1; min-width: 0; }
532
+ .member-row .who .em { color: var(--ink-soft); font-size: .8rem; }
533
+ .table { width: 100%; border-collapse: collapse; }
534
+ .table th, .table td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); font-size: .88rem; }
535
+ .table th { color: var(--ink-soft); font-weight: 500; }
536
+
537
+ @media (max-width: 860px) {
538
+ .sidebar {
539
+ position: fixed; z-index: 30; height: calc(100vh - 49px); left: 0; top: 49px; margin-left: -245px;
540
+ }
541
+ .sidebar.open { margin-left: 0; box-shadow: 20px 0 50px rgba(0,0,0,.3); }
542
+ .sidebar.collapsed { margin-left: -245px; }
543
+ .main { width: 100%; }
544
+ .mode-page { padding: 24px 18px 48px; }.mode-hero { padding: 24px; align-items: flex-start; }.mode-hero h1 { font-size: 27px; line-height: 32px; }
545
+ .create-btn {
546
+ left: 64px; top: 10px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
547
+ background: var(--coral); font-size: 18px;
548
+ }
549
+ .create-btn:hover { background: #e45f5f; }
550
+ .create-label { display: none; }
551
+ .searchbox { left: 100px; top: 8px; width: calc(100% - 148px); max-width: none; }
552
+ .searchbox input { padding-right: 10px; font-size: 13px; }
553
+ .assistant-btn { right: 12px; width: 28px; height: 28px; }
554
+ .page { padding: .9rem .8rem 3rem; }
555
+ .page.home-page { min-height: 2683px; padding: 0; }
556
+ .home-header { height: 126px; margin: 0 8px 0 24px; padding: 24px 8px 0; }
557
+ .home-header-actions { top: 48px; right: 0; left: 8px; height: 78px; display: block; }
558
+ .home-customize { position: absolute; right: 0; top: 0; width: 91px; }
559
+ .home-summary { position: absolute; left: 0; top: 50px; width: 352px; padding-right: 8px; background: #fff; }
560
+ .home-summary button { min-width: 0; padding: 0; flex: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
561
+ .home-summary button:nth-child(1) { width: 85px; padding-left: 8px; justify-content: flex-start; gap: 4px; text-align: left; font-weight: 500; color: #626364; }
562
+ .home-summary button:nth-child(1) { border: 1px solid transparent; }
563
+ .home-summary button:nth-child(2) { width: 137px; padding-left: 16.67px; justify-content: flex-start; text-align: left; color: #626364; }
564
+ .home-summary button:nth-child(3) { width: 122px; padding-left: 12.4px; justify-content: flex-start; text-align: left; color: #626364; }
565
+ .home-summary button:nth-child(2) > span, .home-summary button:nth-child(3) > span {
566
+ width: 12px; height: 12px; flex: none; display: block; margin-right: 15.5px; color: #626364;
567
+ }
568
+ .home-list { display: block; width: 344px; margin: 11px 23px 0; }
569
+ .home-section { width: 344px; }
570
+ .home-my-tasks { width: 342px; margin-left: 1px; padding: 9px 8px 7px; }
571
+ .home-card { border-color: #fff; }
572
+ .home-project-list { height: 168px; }
573
+ .home-project-list { padding: 11px 29px 8px; flex-direction: column; gap: 8px; overflow: hidden; }
574
+ .home-project-row, .home-project-create { width: 268px; min-height: 64px; }
575
+ .home-project-create { gap: 19px; }
576
+ .home-project-row { gap: 20px; }
577
+ .home-project-actions { margin-top: 126px; }
578
+ .home-learn .home-card > h2 { height: 52px; padding: 24px 24px 0; }
579
+ .learn-carousel { height: 338px; padding: 24px; }
580
+ .home-focus { height: 416px; }
581
+ .home-focus .home-card { height: 400px; }
582
+ .widget-card { padding-left: 24px; padding-right: 24px; }
583
+ .widget-head { min-height: 112px; }
584
+ .people-grid { grid-template-columns: 1fr; gap: 8px; }
585
+ .people-grid button { min-height: 66px; flex-direction: row; justify-content: flex-start; padding: 8px 12px; }
586
+ .people-grid small { margin-left: auto; }
587
+ .focus-steps { flex-direction: column; gap: 8px; }
588
+ .focus-steps button { min-height: 64px; }
589
+ .task-pane { width: 100vw; }
590
+ .tmeta .chip { display: none; }
591
+ }
tasks/asana/environment/reference/clone/static/app.js ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/auth.js ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // Auth page behavior: login (two-step continue), signup + verify, forgot + reset.
2
+ // All requests stay on the local origin.
3
+ (function () {
4
+ "use strict";
5
+
6
+ function $(sel) { return document.querySelector(sel); }
7
+
8
+ async function post(url, body) {
9
+ const res = await fetch(url, {
10
+ method: "POST",
11
+ headers: { "Content-Type": "application/json" },
12
+ body: JSON.stringify(body || {}),
13
+ credentials: "same-origin",
14
+ });
15
+ let data = {};
16
+ try { data = await res.json(); } catch (e) { /* empty body */ }
17
+ return { ok: res.ok, status: res.status, data: data };
18
+ }
19
+
20
+ function showError(el, message) {
21
+ el.textContent = message;
22
+ el.hidden = !message;
23
+ }
24
+
25
+ function returnTarget() {
26
+ const u = new URLSearchParams(location.search).get("u");
27
+ return u && u.startsWith("/app") ? u : "/app/home";
28
+ }
29
+
30
+ document.querySelectorAll(".sso").forEach(function (btn) {
31
+ btn.addEventListener("click", function () {
32
+ alert(btn.dataset.sso + " sign-in is not available in this offline demo. " +
33
+ "Use an email account instead.");
34
+ });
35
+ });
36
+
37
+ // ---- login: reveal password on first continue, then submit.
38
+ const loginForm = $("#login-form");
39
+ if (loginForm) {
40
+ loginForm.addEventListener("submit", async function (ev) {
41
+ ev.preventDefault();
42
+ const errEl = $("#login-error");
43
+ showError(errEl, "");
44
+ const email = $("#email").value.trim();
45
+ if (!email || email.indexOf("@") < 1) {
46
+ showError(errEl, "Enter a valid email address."); return;
47
+ }
48
+ const pwField = $("#password-field");
49
+ if (pwField.classList.contains("hidden")) {
50
+ pwField.classList.remove("hidden");
51
+ $("#login-continue").textContent = "Log in";
52
+ $("#password").focus();
53
+ return;
54
+ }
55
+ const password = $("#password").value;
56
+ if (!password) { showError(errEl, "Enter your password."); return; }
57
+ const r = await post("/api/auth/login", { email: email, password: password });
58
+ if (r.ok) { location.assign(returnTarget()); }
59
+ else { showError(errEl, r.data.error ? r.data.error.message : "Log in failed."); }
60
+ });
61
+ }
62
+
63
+ // ---- signup
64
+ const signupForm = $("#signup-form");
65
+ if (signupForm) {
66
+ signupForm.addEventListener("submit", async function (ev) {
67
+ ev.preventDefault();
68
+ const errEl = $("#signup-error");
69
+ showError(errEl, "");
70
+ const name = $("#name").value.trim();
71
+ const email = $("#email").value.trim();
72
+ const password = $("#password").value;
73
+ if (!name) { showError(errEl, "Enter your full name."); return; }
74
+ if (!email || email.indexOf("@") < 1) { showError(errEl, "Enter a valid email address."); return; }
75
+ if (password.length < 8) { showError(errEl, "Password must be at least 8 characters."); return; }
76
+ const r = await post("/api/auth/signup", { name: name, email: email, password: password });
77
+ if (!r.ok) { showError(errEl, r.data.error ? r.data.error.message : "Sign up failed."); return; }
78
+ signupForm.classList.add("hidden");
79
+ $("#verify-step").classList.remove("hidden");
80
+ $("#code").focus();
81
+ });
82
+ const verifyForm = $("#verify-form");
83
+ verifyForm.addEventListener("submit", async function (ev) {
84
+ ev.preventDefault();
85
+ const errEl = $("#verify-error");
86
+ showError(errEl, "");
87
+ const r = await post("/api/auth/verify", { code: $("#code").value.trim() });
88
+ if (r.ok) { location.assign("/app/home"); }
89
+ else { showError(errEl, r.data.error ? r.data.error.message : "Verification failed."); }
90
+ });
91
+ }
92
+
93
+ // ---- forgot / reset
94
+ const forgotForm = $("#forgot-form");
95
+ if (forgotForm) {
96
+ forgotForm.addEventListener("submit", async function (ev) {
97
+ ev.preventDefault();
98
+ const errEl = $("#forgot-error");
99
+ showError(errEl, "");
100
+ const email = $("#email").value.trim();
101
+ if (!email || email.indexOf("@") < 1) { showError(errEl, "Enter a valid email address."); return; }
102
+ const r = await post("/api/auth/forgot", { email: email });
103
+ if (!r.ok) { showError(errEl, r.data.error ? r.data.error.message : "Request failed."); return; }
104
+ forgotForm.classList.add("hidden");
105
+ $("#reset-step").classList.remove("hidden");
106
+ });
107
+ $("#reset-form").addEventListener("submit", async function (ev) {
108
+ ev.preventDefault();
109
+ const errEl = $("#reset-error");
110
+ showError(errEl, "");
111
+ const password = $("#new-password").value;
112
+ if (password.length < 8) { showError(errEl, "Password must be at least 8 characters."); return; }
113
+ const r = await post("/api/auth/reset", { code: $("#code").value.trim(), password: password });
114
+ if (r.ok) {
115
+ location.assign("/-/login");
116
+ } else { showError(errEl, r.data.error ? r.data.error.message : "Reset failed."); }
117
+ });
118
+ }
119
+ })();
tasks/asana/environment/reference/clone/static/favicon.svg ADDED
tasks/asana/environment/reference/clone/static/home.js ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (() => {
2
+ const setActive = (buttons, selected) => {
3
+ buttons.forEach(button => {
4
+ const active = button === selected;
5
+ button.classList.toggle("is-active", active);
6
+ button.setAttribute("aria-selected", String(active));
7
+ const mark = button.querySelector("b");
8
+ if (mark) mark.textContent = active ? "−" : "+";
9
+ });
10
+ };
11
+
12
+ const aiButtons = [...document.querySelectorAll(".ai-story-tab")];
13
+ const aiStage = document.querySelector(".ai-story-stage");
14
+ const aiImage = document.getElementById("ai-stage-image");
15
+ const aiTitle = document.getElementById("ai-stage-title");
16
+ aiButtons.forEach(button => button.addEventListener("click", () => {
17
+ setActive(aiButtons, button);
18
+ aiStage.classList.add("is-changing");
19
+ aiImage.src = button.dataset.image;
20
+ aiImage.alt = button.dataset.alt;
21
+ aiTitle.textContent = button.dataset.stageTitle;
22
+ requestAnimationFrame(() => aiStage.classList.remove("is-changing"));
23
+ }));
24
+
25
+ const productDetails = [
26
+ ["Goals and portfolios", "Strategy stays connected to every project.", "One shared plan", "People and agents act with the same context."],
27
+ ["Requests to resolution", "Route service work to the right expert instantly.", "Governed automation", "Agents resolve requests with clear permissions."],
28
+ ["Client context", "Keep briefs, meetings, and delivery in one view.", "Durable relationships", "Teams and agents remember every commitment."],
29
+ ["Product context", "Issues, pull requests, and decisions stay connected.", "Faster shipping", "Humans and agents coordinate every handoff."],
30
+ ["Agentic workflows", "Connect enterprise knowledge to repeatable flows.", "Enterprise control", "Build, monitor, and govern every agent."],
31
+ ];
32
+ const productButtons = [...document.querySelectorAll(".productivity-tab")];
33
+ const productStage = document.querySelector(".productivity-stage");
34
+ const productImage = document.getElementById("product-image");
35
+ const productTitle = document.getElementById("product-title");
36
+ const productCopy = document.getElementById("product-copy");
37
+ const sideFields = ["product-left-title", "product-left-copy", "product-right-title", "product-right-copy"];
38
+ productButtons.forEach((button, index) => button.addEventListener("click", () => {
39
+ setActive(productButtons, button);
40
+ productStage.classList.add("is-changing");
41
+ productTitle.textContent = button.dataset.title;
42
+ productCopy.textContent = button.dataset.copy;
43
+ productImage.src = button.dataset.image;
44
+ productImage.alt = button.dataset.alt;
45
+ sideFields.forEach((id, field) => { document.getElementById(id).textContent = productDetails[index][field]; });
46
+ requestAnimationFrame(() => productStage.classList.remove("is-changing"));
47
+ }));
48
+ })();
tasks/asana/environment/reference/clone/static/official-pages/academy--trainings.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/agencies.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/apps.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/customer-success.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/customers.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/help.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/industry--education.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/industry--government-solutions.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/industry--healthcare.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/industry--nonprofit.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/industry--retail.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/product--service-management.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/product--stackai.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/teams--it.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/teams--leaders.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/teams--marketing.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/teams--operations.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/official-pages/uses--product-launch.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/asana/environment/reference/clone/static/public-nav.js ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ (() => {
2
+ const layer = document.querySelector(".mnav-layer");
3
+ if (!layer) return;
4
+
5
+ const buttons = [...document.querySelectorAll("[data-nav-menu]")];
6
+ const panels = [...document.querySelectorAll(".mnav-panel")];
7
+ const scrim = layer.querySelector(".mnav-scrim");
8
+ const transitionMs = 200;
9
+ let currentKey = "";
10
+ let switchTimer = 0;
11
+ let closeTimer = 0;
12
+
13
+ const panelFor = key => document.getElementById(`mnav-panel-${key}`);
14
+
15
+ const selectButton = key => {
16
+ buttons.forEach(button => {
17
+ const selected = button.dataset.navMenu === key;
18
+ button.classList.toggle("is-menu-active", selected);
19
+ button.setAttribute("aria-expanded", String(selected));
20
+ });
21
+ };
22
+
23
+ const showPanel = key => {
24
+ const panel = panelFor(key);
25
+ if (!panel) return;
26
+ panel.classList.add("is-active", "is-entering");
27
+ panel.setAttribute("aria-hidden", "false");
28
+ void panel.offsetWidth;
29
+ requestAnimationFrame(() => panel.classList.remove("is-entering"));
30
+ };
31
+
32
+ const closeMenu = () => {
33
+ window.clearTimeout(switchTimer);
34
+ window.clearTimeout(closeTimer);
35
+ selectButton("");
36
+ const panel = panelFor(currentKey);
37
+ if (panel) panel.classList.add("is-leaving");
38
+ layer.classList.remove("is-open");
39
+ currentKey = "";
40
+ closeTimer = window.setTimeout(() => {
41
+ panels.forEach(item => {
42
+ item.classList.remove("is-active", "is-entering", "is-leaving");
43
+ item.setAttribute("aria-hidden", "true");
44
+ });
45
+ layer.hidden = true;
46
+ }, transitionMs);
47
+ };
48
+
49
+ const openMenu = key => {
50
+ if (key === currentKey) {
51
+ closeMenu();
52
+ return;
53
+ }
54
+
55
+ window.clearTimeout(switchTimer);
56
+ window.clearTimeout(closeTimer);
57
+ selectButton(key);
58
+
59
+ if (layer.hidden) {
60
+ layer.hidden = false;
61
+ void layer.offsetWidth;
62
+ layer.classList.add("is-open");
63
+ currentKey = key;
64
+ showPanel(key);
65
+ return;
66
+ }
67
+
68
+ const previous = panelFor(currentKey);
69
+ if (previous) previous.classList.add("is-leaving");
70
+ currentKey = key;
71
+ switchTimer = window.setTimeout(() => {
72
+ panels.forEach(item => {
73
+ item.classList.remove("is-active", "is-entering", "is-leaving");
74
+ item.setAttribute("aria-hidden", "true");
75
+ });
76
+ showPanel(key);
77
+ }, transitionMs);
78
+ };
79
+
80
+ buttons.forEach(button => {
81
+ button.addEventListener("click", () => openMenu(button.dataset.navMenu));
82
+ });
83
+ scrim.addEventListener("click", closeMenu);
84
+ document.addEventListener("keydown", event => {
85
+ if (event.key === "Escape" && currentKey) closeMenu();
86
+ });
87
+
88
+ document.querySelectorAll(".official-snapshot .faq [role='button'][aria-controls]").forEach(control => {
89
+ const answer = document.getElementById(control.getAttribute("aria-controls"));
90
+ if (!answer) return;
91
+ const toggle = () => {
92
+ const expanded = control.getAttribute("aria-expanded") === "true";
93
+ control.setAttribute("aria-expanded", String(!expanded));
94
+ answer.setAttribute("aria-hidden", String(expanded));
95
+ };
96
+ control.addEventListener("click", toggle);
97
+ control.addEventListener("keydown", event => {
98
+ if (event.key === "Enter" || event.key === " ") {
99
+ event.preventDefault();
100
+ toggle();
101
+ }
102
+ });
103
+ });
104
+
105
+ const eventTabs = [...document.querySelectorAll(".official-snapshot button[id*='-tab-'][aria-controls]")];
106
+ if (eventTabs.length) {
107
+ const activateEvent = selected => {
108
+ eventTabs.forEach((control, index) => {
109
+ const active = index === selected;
110
+ const details = control.parentElement.querySelector(".evkak7z7");
111
+ const panel = document.getElementById(control.getAttribute("aria-controls"));
112
+ control.setAttribute("aria-expanded", String(active));
113
+ control.querySelector("svg")?.style.setProperty("transform", active ? "rotate(0deg)" : "rotate(180deg)");
114
+ if (details) details.style.display = active ? "block" : "none";
115
+ if (panel) {
116
+ panel.dataset.visible = String(active);
117
+ panel.style.display = active ? "block" : "none";
118
+ panel.toggleAttribute("inert", !active);
119
+ }
120
+ });
121
+ };
122
+ eventTabs.forEach((control, index) => control.addEventListener("click", () => activateEvent(index)));
123
+ activateEvent(Math.max(0, eventTabs.findIndex(control => control.getAttribute("aria-expanded") === "true")));
124
+ }
125
+
126
+ const eventFilters = [...document.querySelectorAll(".official-snapshot button.ex99a2l3")];
127
+ eventFilters.forEach(control => {
128
+ const content = control.parentElement.querySelector(".ex99a2l1");
129
+ if (!content) return;
130
+ control.addEventListener("click", () => {
131
+ const expanded = control.getAttribute("aria-expanded") === "true";
132
+ control.setAttribute("aria-expanded", String(!expanded));
133
+ content.style.marginTop = expanded ? "" : "16px";
134
+ content.style.zIndex = expanded ? "" : "0";
135
+ });
136
+ });
137
+
138
+ const eventCards = [...document.querySelectorAll(".official-snapshot a.e13akj4k0")];
139
+ const loadMore = [...document.querySelectorAll(".official-snapshot button")]
140
+ .find(button => button.textContent.trim() === "Load more");
141
+ if (eventCards.length && loadMore) {
142
+ let visibleCards = Math.min(6, eventCards.length);
143
+ const renderCards = () => {
144
+ eventCards.forEach((card, index) => card.style.display = index < visibleCards ? "" : "none");
145
+ loadMore.style.display = visibleCards < eventCards.length ? "" : "none";
146
+ };
147
+ loadMore.addEventListener("click", () => {
148
+ visibleCards = Math.min(visibleCards + 6, eventCards.length);
149
+ renderCards();
150
+ });
151
+ renderCards();
152
+ }
153
+ })();
tasks/asana/environment/reference/clone/static/site.css ADDED
@@ -0,0 +1,1021 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Marketing + auth styles for the Asana offline clone. */
2
+ @font-face { font-family: "TWK Lausanne"; src: url("/static/fonts/lausanne/TWKLausanne-300.otf") format("opentype"); font-weight: 300; font-style: normal; font-display: block; }
3
+ @font-face { font-family: "TWK Lausanne"; src: url("/static/fonts/lausanne/TWKLausanne-400.otf") format("opentype"); font-weight: 400; font-style: normal; font-display: block; }
4
+ @font-face { font-family: "TWK Lausanne"; src: url("/static/fonts/lausanne/TWKLausanne-500.otf") format("opentype"); font-weight: 500; font-style: normal; font-display: block; }
5
+ :root {
6
+ --coral: #f06a6a;
7
+ --ink: #1e1f21;
8
+ --ink-soft: #6d6e6f;
9
+ --line: #edeae9;
10
+ --bg: #ffffff;
11
+ --bg-warm: #f9f8f8;
12
+ --blue: #4573d2;
13
+ --radius: 8px;
14
+ font-size: 16px;
15
+ }
16
+
17
+ /* Anonymous read-only project links intentionally expose only project/task summary data. */
18
+ .shared-project-page{margin:0;background:#f7f6f3;color:#1e1f21;font-family:Arial,sans-serif;min-height:100vh}
19
+ .shared-header{height:64px;background:#fff;border-bottom:1px solid #e8e8e8;display:flex;align-items:center;gap:20px;padding:0 32px}
20
+ .shared-header>a:first-child{display:flex;align-items:center;gap:8px;color:#1e1f21;text-decoration:none;font-size:22px;font-weight:700}
21
+ .shared-header svg{width:28px;height:28px}.shared-header>span{color:#6d6e6f;flex:1}
22
+ .shared-main{max-width:1120px;margin:0 auto;padding:48px 28px 64px}
23
+ .shared-title{background:#fff;border-top:6px solid #4573d2;border-radius:12px;padding:30px;box-shadow:0 1px 4px #00000012}
24
+ .shared-title h1{font-size:38px;line-height:1.15;margin:8px 0 10px}.shared-title>p:not(.eyebrow){color:#6d6e6f;max-width:760px}
25
+ .shared-title .eyebrow{font-size:12px;font-weight:700;letter-spacing:.12em;color:#6d6e6f}.shared-status{display:inline-block;background:#e8f7f0;color:#237a57;border-radius:12px;padding:5px 10px;font-size:13px}
26
+ .shared-columns{display:grid;grid-template-columns:repeat(3,minmax(220px,1fr));gap:18px;margin-top:24px;align-items:start}
27
+ .shared-section{background:#fff;border-radius:10px;padding:18px;box-shadow:0 1px 4px #00000010}.shared-section h2{font-size:17px;margin:0 0 12px}.shared-section ul{list-style:none;margin:0;padding:0}
28
+ .shared-task{display:grid;grid-template-columns:24px 1fr auto;gap:6px;align-items:center;padding:11px 0;border-top:1px solid #eee}.shared-task strong{font-size:14px}.shared-task small,.shared-task time{font-size:11px;color:#6d6e6f}.shared-task.complete strong{text-decoration:line-through;color:#6d6e6f}.shared-empty{color:#8b8b8b;padding:10px 0}.shared-disclosure{color:#6d6e6f;font-size:13px;margin-top:24px}
29
+ @media(max-width:760px){.shared-header{padding:0 16px}.shared-main{padding:28px 16px}.shared-columns{grid-template-columns:1fr}.shared-title h1{font-size:30px}.shared-header>span{display:none}}
30
+
31
+ /* Direct anonymous public-route contracts captured in an isolated Playwright
32
+ context on 2026-08-25. The support pill is a synthetic local shell: it
33
+ reproduces only the dynamic surface geometry and never loads its provider. */
34
+ .not-found-page { position:relative; height:542px; color:#0d0d0d; }
35
+ .not-found-video { position:absolute; left:73.15px; top:92px; width:554.85px; height:369.3px; object-fit:contain; background:#fff url("/static/source/404-hero-frame.png") center/contain no-repeat; }
36
+ .not-found-copy { position:absolute; left:58.47%; top:101px; width:458px; }
37
+ .not-found-copy h1 { margin:0; font-size:64px; line-height:64px; letter-spacing:-1.28px; font-weight:300; }
38
+ .not-found-copy p { width:458px; margin:32px 0 0; font-size:20px; line-height:30px; letter-spacing:.4px; font-weight:300; }
39
+ .not-found-arch { position:absolute; left:8.68%; top:123px; width:478px; height:333px; border-bottom:3px solid #111; }
40
+ .not-found-arch .arch { position:absolute; bottom:2px; display:block; border-style:solid; border-bottom:0; }
41
+ .arch-outer { left:27px; width:424px; height:334px; border-width:46px; border-radius:230px 230px 0 0; border-color:#eeeef0 #eeeef0 transparent #eeeef0; background:transparent; }
42
+ .arch-outer::before { content:""; position:absolute; left:-46px; top:-46px; width:212px; height:334px; border:46px solid #f4c76e; border-right:0; border-bottom:0; border-radius:230px 0 0 0; }
43
+ .arch-outer::after { content:""; position:absolute; right:-46px; bottom:0; width:46px; height:144px; background:#5680dc; }
44
+ .arch-middle { left:106px; width:267px; height:264px; border-width:44px; border-radius:150px 150px 0 0; border-color:#efefef #efefef transparent #efefef; }
45
+ .arch-middle::after { content:""; position:absolute; left:50%; top:-44px; width:50%; height:264px; border:44px solid #195549; border-left:0; border-bottom:0; border-radius:0 150px 0 0; }
46
+ .arch-outer::before,.arch-middle::after { clip-path:inset(0 0 46px 0); }
47
+ .arch-inner { left:184px; width:111px; height:187px; border-width:35px; border-radius:68px 68px 0 0; border-color:#ededeb #ededeb transparent #ededeb; }
48
+ .not-found-arch::after { content:""; position:absolute; left:254px; bottom:2px; width:39px; height:72px; background:linear-gradient(135deg,#f5f5f3,#e8e8e6); }
49
+ .arch-dot { position:absolute; width:37px; height:37px; border-radius:50%; background:#ef7371; z-index:3; }
50
+ .dot-one { left:124px; top:31px; }.dot-two { left:153px; top:101px; }.dot-three { left:189px; top:176px; }
51
+ .not-found-rescue { height:250px; padding:81px 73px 36px; display:grid; grid-template-columns:repeat(4,265.42px); gap:24px; background:#f5f5f5; color:#252525; }
52
+ .not-found-rescue h2 { min-height:72px; margin:0 0 30px; font-size:20px; line-height:30px; font-weight:300; letter-spacing:.4px; }
53
+ .not-found-rescue a { font-size:16px; line-height:24px; font-weight:500; }
54
+ .not-found-rescue a span { padding-left:6px; }
55
+ @media (min-width:721px) { .not-found-copy { top:103.65px; } }
56
+
57
+ .resources-contract { height:820px; padding:51px 0 0 73px; color:#0d0d0d; overflow:hidden; }
58
+ .resources-kicker { margin:0; font-size:16px; line-height:24px; letter-spacing:.64px; font-weight:500; }
59
+ .resources-contract > h1 { width:650px; margin:8px 0 0; font-size:64px; line-height:64px; letter-spacing:-1.28px; font-weight:300; }
60
+ .resources-demo { width:148px; height:58px; margin-top:17px; display:flex; align-items:center; justify-content:center; border-radius:999px; background:#0d0d0d; color:#fff; font-size:16px; line-height:24px; font-weight:500; }
61
+ .resource-rail { display:flex; gap:24px; margin-top:60px; overflow:visible; }
62
+ .resource-topic { flex:0 0 265.42px; height:397px; padding:24px; display:flex; flex-direction:column; justify-content:space-between; border-radius:7px; background:var(--topic-bg); color:var(--topic-ink); overflow:hidden; }
63
+ .resource-topic img { width:150px; height:auto; object-fit:contain; align-self:flex-start; }
64
+ .resource-topic h2 { margin:0; font-size:26px; line-height:30px; letter-spacing:-.26px; font-weight:500; }
65
+ .resource-topic p { margin:14px 0 0; font-size:15px; line-height:22.5px; letter-spacing:.3px; font-weight:300; }
66
+ .resource-depth { height:1500px; padding:140px 73px; }
67
+ .resource-depth h2,.resource-final h2 { max-width:850px; margin:0; font-size:64px; line-height:66px; font-weight:300; }
68
+ .resource-depth p { font-size:22px; line-height:32px; }.resource-dark { color:#fff; background:#151515; }
69
+ .resource-final { height:560px; padding:120px 73px; }
70
+
71
+ .templates-contract { height:630px; padding-top:51px; color:#0d0d0d; text-align:center; }
72
+ .templates-contract h1 { width:850px; margin:0 auto; font-size:64px; line-height:64px; letter-spacing:-1.28px; font-weight:300; }
73
+ .templates-lead { width:720px; margin:31px auto 0; font-size:20px; line-height:30px; letter-spacing:.4px; font-weight:300; }
74
+ .templates-sso { display:flex; justify-content:center; gap:8px; margin-top:34px; }
75
+ .templates-sso a { width:265px; height:69px; display:flex; align-items:center; justify-content:center; gap:14px; border:1px solid #858585; border-radius:999px; font-size:16px; font-weight:500; }
76
+ .public-google-mark,.public-microsoft-mark { flex:none; border-radius:50%; background:#fafafa; }
77
+ .public-google-mark { width:32px; height:32px; padding:4px; }
78
+ .public-microsoft-mark { width:32px; height:32px; padding:7px; }
79
+ .templates-sso .google-g { position:relative; width:24px; height:24px; flex:0 0 24px; border-radius:50%; color:transparent; font-size:0; background:conic-gradient(from -42deg,#4285f4 0 29%,#34a853 29% 49%,#fbbc05 49% 70%,#ea4335 70% 86%,#4285f4 86% 100%); }
80
+ .templates-sso .google-g::before { content:""; position:absolute; inset:5px; border-radius:50%; background:#fff; }.templates-sso .google-g::after { content:""; position:absolute; right:0; top:10px; width:11px; height:5px; background:#4285f4; }
81
+ .templates-or { position:relative; width:538px; height:1px; margin:28px auto 0; background:#d2d2d2; }
82
+ .templates-or span { position:absolute; left:50%; top:0; transform:translate(-50%,-50%); padding:0 12px; background:#fff; color:#6e6e6e; }
83
+ .templates-signup { width:538px; margin:27px auto 0; }
84
+ .templates-signup input { width:538px; height:50px; padding:12px 16px; border:2px solid #0b67e8; border-radius:4px; color:#0d0d0d; font:300 16px/24px "TWK Lausanne"; letter-spacing:.32px; outline:0; }
85
+ .templates-signup button { width:538px; height:58px; margin-top:16px; padding:16px 32px; border:0; border-radius:999px; background:#0d0d0d; color:#fff; font:500 16px/24px "TWK Lausanne"; }
86
+ .templates-fine { width:538px; margin:17px auto 0; font-size:12px; line-height:18px; font-weight:300; letter-spacing:.24px; }.templates-fine a { text-decoration:underline; }
87
+ .templates-explore { height:690px; padding:25px 0 0 73px; overflow:hidden; }
88
+ .templates-explore > h2 { margin:0; font-size:54px; line-height:64px; letter-spacing:-1.08px; font-weight:300; }
89
+ .template-rail { display:flex; gap:16px; margin-top:72px; }
90
+ .template-team { flex:0 0 300px; height:345px; padding:24px; border:1px solid #ddd; border-radius:8px; }
91
+ .template-team i { width:48px; height:48px; display:flex; align-items:center; justify-content:center; border-radius:50%; background:#f4f4f4; font-style:normal; }
92
+ .template-team h2 { margin:22px 0 0; font-size:22px; line-height:28px; font-weight:500; }.template-team p { font-size:16px; line-height:24px; font-weight:300; }.template-team span { font-weight:500; }
93
+ .template-depth { height:1450px; padding:140px 73px; }.template-depth h2,.template-final h2 { max-width:900px; font-size:64px; line-height:66px; font-weight:300; }.template-dark { background:#f3f3f3; }.template-final { height:520px; padding:120px 73px; }
94
+ .public-help-shell { position:fixed; right:24px; bottom:24px; z-index:35; width:154px; height:48px; display:flex; align-items:center; justify-content:center; gap:8px; border:1px solid #111; border-radius:999px; background:#fff; color:#111; font-size:14px; }
95
+ .help-dots { position:relative; width:27px; height:27px; flex:0 0 27px; color:transparent; font-size:0; }
96
+ .help-dots::before,.help-dots::after { content:""; position:absolute; width:9px; height:9px; border-radius:50%; background:#ff6158; }
97
+ .help-dots::before { left:9px; top:2px; }.help-dots::after { left:3px; top:14px; box-shadow:12px 0 #ff6158; }
98
+
99
+ @media (max-width:720px) {
100
+ .not-found-page { height:658px; }
101
+ .not-found-video { left:24.95px; top:311.5px; width:340.09px; height:226.37px; }
102
+ .not-found-copy { left:25px; top:96px; width:340px; }
103
+ .not-found-copy h1 { width:340px; font-size:38px; line-height:38px; letter-spacing:-.76px; }
104
+ .not-found-copy p { width:340px; margin-top:31px; font-size:15px; line-height:22.5px; letter-spacing:.3px; }
105
+ .not-found-arch { left:49px; top:337px; width:292px; height:204px; }
106
+ .arch-outer { left:20px; width:252px; height:202px; border-width:27px; border-radius:140px 140px 0 0; }
107
+ .arch-outer::before { left:-27px; top:-27px; width:126px; height:202px; border-width:27px; border-radius:140px 0 0 0; }
108
+ .arch-outer::after { right:-27px; width:27px; height:86px; }
109
+ .arch-middle { left:66px; width:160px; height:158px; border-width:27px; border-radius:90px 90px 0 0; }
110
+ .arch-middle::after { top:-27px; height:158px; border-width:27px; border-left:0; border-bottom:0; border-radius:0 90px 0 0; }
111
+ .arch-outer::before,.arch-middle::after { clip-path:inset(0 0 27px 0); }
112
+ .arch-inner { left:113px; width:66px; height:111px; border-width:22px; border-radius:42px 42px 0 0; }
113
+ .not-found-arch::after { left:154px; width:24px; height:44px; }.arch-dot { width:22px; height:22px; }
114
+ .dot-one { left:23px; top:175px; }.dot-two { left:68px; top:175px; }.dot-three { left:114px; top:175px; }
115
+ .not-found-rescue { height:520px; padding:49px 25px; display:flex; gap:48px; overflow:hidden; }
116
+ .not-found-rescue article { flex:0 0 280px; }.not-found-rescue h2 { min-height:48px; font-size:16px; line-height:24px; }
117
+
118
+ .resources-contract { height:746px; padding:48px 0 0 25px; }
119
+ .resources-kicker { font-size:11px; line-height:16.5px; letter-spacing:.44px; }
120
+ .resources-contract > h1 { width:340px; margin-top:3px; font-size:38px; line-height:38px; letter-spacing:-.76px; }
121
+ .resources-contract .desktop-only { display:none; }
122
+ .resources-demo { width:121.63px; height:47px; margin-top:10px; font-size:14px; line-height:21px; }
123
+ .resource-rail { gap:16px; margin-top:48px; overflow:visible; }
124
+ .resource-topic { flex-basis:286px; height:410px; padding:32px 24px 24px; border-radius:7px; }
125
+ .resource-topic img { width:200px; height:auto; }.resource-topic h2 { font-size:23px; line-height:27px; }.resource-topic p { margin-top:5px; font-size:14px; line-height:21px; }
126
+ .resource-rail { margin-top:51px; }
127
+ .resource-topic > div { transform:translateY(-8px); }
128
+ .resource-depth { height:2000px; padding:100px 25px; }.resource-depth h2,.resource-final h2 { font-size:42px; line-height:44px; }.resource-final { height:900px; padding:100px 25px; }
129
+
130
+ .templates-contract { height:535px; padding-top:48px; }
131
+ .templates-contract h1 { width:340px; font-size:38px; line-height:38px; letter-spacing:-.76px; }
132
+ .templates-contract h1 { text-wrap:balance; }
133
+ .templates-lead { width:340px; margin-top:16px; font-size:15px; line-height:22.5px; letter-spacing:.3px; }
134
+ .templates-sso { gap:8px; margin-top:16px; }.templates-sso a { width:166px; height:69px; gap:8px; border-color:#6e6e6e; background:#fafafa; color:#0d0e10; font-size:14px; line-height:21px; }
135
+ .public-google-mark,.public-microsoft-mark { width:35px; height:35px; padding:4px; border:1px solid transparent; background:#fff; }
136
+ .templates-or { width:340px; margin-top:25px; background:transparent; }.templates-or::before { content:""; position:absolute; left:0; right:0; top:1px; height:1px; background:#d2d2d2; }.templates-signup { width:340px; margin-top:26px; transform:translateY(1px); }
137
+ .templates-signup input { width:340px; height:47px; padding:12px 16px; border:1px solid #cfcfcf; font-size:14px; line-height:21px; letter-spacing:.28px; }
138
+ .templates-signup button { width:340px; height:55px; margin-top:16px; border:1px solid transparent; font-size:14px; line-height:21px; }
139
+ .templates-fine { width:340px; margin-top:17px; font-size:12px; line-height:18px; letter-spacing:.24px; }.templates-fine a { letter-spacing:normal; }
140
+ .templates-explore { height:620px; padding:20px 0 0 25px; color:#0d0d0d; }.templates-explore > h2 { transform:translateY(2px); font-size:30px; line-height:33px; letter-spacing:-.6px; }
141
+ .template-rail { gap:8px; margin-top:47px; }.template-team { flex:0 0 298.016px; height:249px; padding:24px; border-color:#e7e7e7; background:#fff; color:#0d0d0d; }
142
+ .template-team i { color:#0d0d0d; position:relative; }
143
+ .template-team i svg { width:20px; height:20px; fill:currentColor; }
144
+ .template-team h2 { margin-top:16px; color:#0d0d0d; font-size:20px; line-height:28px; font-weight:400; }
145
+ .template-team p { margin:0; color:#0d0d0d; font-size:16px; line-height:28px; font-weight:300; }
146
+ .template-team > div > a { display:inline-flex; align-items:center; gap:8px; margin-top:17px; color:#0d0d0d; font-size:15px; line-height:16px; font-weight:500; }
147
+ .template-arrow { width:16px; height:16px; }.template-arrow circle { fill:#0d0d0d; }.template-arrow path { fill:#fff; }
148
+ .template-depth { height:1400px; padding:100px 25px; }.template-depth h2,.template-final h2 { font-size:42px; line-height:44px; }.template-final { height:800px; padding:100px 25px; }
149
+ .public-help-shell { right:24px; bottom:24px; }
150
+ }
151
+ * { box-sizing: border-box; }
152
+ body {
153
+ margin: 0; color: var(--ink); background: var(--bg);
154
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
155
+ -webkit-font-smoothing: antialiased;
156
+ }
157
+ body.marketing { font-family: "TWK Lausanne", "Helvetica Neue", Helvetica, sans-serif; }
158
+ a { color: inherit; text-decoration: none; }
159
+ h1, h2, h3 { font-weight: 600; margin: 0 0 .5em; }
160
+
161
+ .btn {
162
+ display: inline-flex; align-items: center; justify-content: center;
163
+ border-radius: var(--radius); border: 1px solid transparent;
164
+ padding: .55rem 1.1rem; font-size: .95rem; font-weight: 500; cursor: pointer;
165
+ transition: background .15s, border-color .15s, color .15s;
166
+ }
167
+ .btn.primary { background: var(--ink); color: #fff; }
168
+ .btn.primary:hover { background: #3d3e40; }
169
+ .btn.ghost { border-color: #cfcbcb; color: var(--ink); background: #fff; }
170
+ .btn.ghost:hover { border-color: var(--ink); }
171
+ .btn.lg { padding: .8rem 1.5rem; font-size: 1.05rem; }
172
+ .btn.block { width: 100%; }
173
+
174
+ /* nav */
175
+ .mnav { border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 30; }
176
+ .mnav-inner { max-width: none; height: 69px; margin: 0 auto; display: flex; align-items: center; gap: 1.4rem; padding: 0 5rem; }
177
+ .mnav-logo { display: flex; align-items: center; gap: .45rem; font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }
178
+ .mnav-logo { flex: none; }
179
+ .mnav-links { display: flex; align-self: stretch; align-items: center; gap: 2.85rem; flex: 1; margin-left: 2.7rem; }
180
+ .mnav-link { color:var(--ink); font-size:.95rem; padding:.4rem .2rem; border:0; background:transparent; font-family:inherit; cursor:pointer; }
181
+ .mnav-link:hover { color:#555; }
182
+ .mnav-layer { position:fixed; z-index:29; inset:68px 0 0; }
183
+ .mnav-layer[hidden] { display:none; }
184
+ .mnav-scrim { position:absolute; inset:0; width:100%; height:100%; padding:0; border:0; background:rgba(13,14,16,.10); backdrop-filter:blur(7px); -webkit-backdrop-filter:blur(7px); opacity:0; transition:opacity .2s cubic-bezier(.6,0,.13,1); }
185
+ .mnav-layer.is-open .mnav-scrim { opacity:1; }
186
+ .mnav-mega-shell { position:relative; z-index:1; width:min(1280px,calc(100% - 32px)); height:455px; margin:8px auto 0; overflow:hidden; border-radius:14px; background:#fff; box-shadow:0 22px 52px rgba(0,0,0,.18); opacity:0; transform:translateY(-6px); transition:opacity .2s cubic-bezier(.6,0,.13,1),transform .2s cubic-bezier(.6,0,.13,1); }
187
+ .mnav-layer.is-open .mnav-mega-shell { opacity:1; transform:none; }
188
+ .mnav-panel-slot { height:371px; padding:42px 84px 26px; }
189
+ .mnav-panel { height:100%; display:none; opacity:0; transform:translateY(3px); transition:opacity .2s cubic-bezier(.6,0,.13,1),transform .2s cubic-bezier(.6,0,.13,1); }
190
+ .mnav-panel.is-active { display:grid; opacity:1; transform:none; }
191
+ .mnav-panel.is-entering, .mnav-panel.is-leaving { opacity:0; transform:translateY(3px); }
192
+ .mnav-panel-product { grid-template-columns:1.2fr 1fr .8fr; gap:90px; }
193
+ .mnav-panel-solutions { grid-template-columns:repeat(4,1fr); gap:74px; }
194
+ .mnav-panel-resources { grid-template-columns:1.25fr 1fr .8fr; gap:110px; }
195
+ .mnav-group p { margin:0 0 12px; color:#707070; font-size:11px; line-height:16px; font-weight:600; }
196
+ .mnav-group ul { margin:0; padding:0; list-style:none; }
197
+ .mnav-group li { margin:0; }
198
+ .mnav-group a { position:relative; min-height:40px; display:flex; align-items:flex-start; gap:14px; padding:8px 0; }
199
+ .mnav-panel-product .mnav-group:first-child a { min-height:64px; }
200
+ .mnav-group a>span { min-width:0; }
201
+ .mnav-group strong { display:block; color:#111; font-size:16px; line-height:20px; font-weight:500; }
202
+ .mnav-group small { display:block; margin-top:2px; color:#6a6a6a; font-size:13px; line-height:17px; white-space:nowrap; }
203
+ .mnav-group em { align-self:center; margin-left:7px; padding:3px 8px; border-radius:4px; background:#cce9ff; color:#285878; font-size:11px; font-style:normal; white-space:nowrap; }
204
+ .mnav-group a>b { margin-left:auto; color:#111; font-size:16px; font-weight:400; opacity:0; transform:translateX(-4px); transition:opacity .2s ease-in,transform .2s ease-in; }
205
+ .mnav-group a:hover>b, .mnav-group a:focus-visible>b { opacity:1; transform:none; }
206
+ .mnav-item-icon { width:32px; height:32px; flex:0 0 32px; display:flex; align-items:center; justify-content:center; border-radius:7px; color:#111; font:17px/1 Arial,sans-serif; }
207
+ .mnav-item-icon.pink { background:#ffd4ff; }.mnav-item-icon.green { background:#9ef2a4; }.mnav-item-icon.yellow { background:#f6ff8e; }.mnav-item-icon.blue { background:#9edcf2; }.mnav-item-icon.gray { background:#e2e2e2; }.mnav-item-icon.plain { background:#f7f7f7; border-radius:50%; }
208
+ .mnav-mega-footer { height:84px; padding:0 76px; display:flex; align-items:center; gap:42px; background:#f4f4f4; }
209
+ .mnav-mega-footer a { display:flex; align-items:center; gap:10px; color:#111; font-size:13px; font-weight:500; }
210
+ .mnav-mega-footer i { font-size:18px; font-style:normal; }
211
+ .mnav-actions { display: flex; gap: .55rem; align-items: center; }
212
+ .mnav-actions .btn { border-radius: 999px; min-height: 44px; padding-left: 1.2rem; padding-right: 1.2rem; }
213
+ .mnav-language { font-size: 1.55rem; line-height: 1; margin-right: .75rem; }
214
+ .mnav-burger { display: none; background: none; border: none; font-size: 1.4rem; cursor: pointer; }
215
+ body.marketing .mnav { height: 68px; border-bottom: 0; }
216
+ body.marketing .mnav-inner { height: 68px; padding: 0 64px; gap: 0; }
217
+ body.marketing .mnav-logo { width: 136px; height: 44px; padding: 0 12px; gap: 5px; font-size: 31px; font-weight: 500; }
218
+ body.marketing .mnav-logo svg { width:112px; height:22px; }
219
+ body.marketing .mnav-logo span, .fbrand span, .auth-logo span { display:none; }
220
+ body.marketing .mnav-links { margin-left: 32px; gap: 0; }
221
+ body.marketing .mnav-link { height: 44px; padding: 0 24px; display: flex; align-items: center; }
222
+ body.marketing .mnav-link { font-size:14px; line-height:36px; font-weight:500; }
223
+ body.marketing .mnav-link.has-menu { gap:6px; }
224
+ body.marketing .mnav-link.has-menu::after { content:""; width:7px; height:7px; margin-top:-4px; border-right:1px solid currentColor; border-bottom:1px solid currentColor; transform:rotate(45deg); }
225
+ body.marketing .mnav-link.has-menu.is-menu-active { border-radius:999px; background:#f3f3f3; color:#111; }
226
+ body.marketing .mnav-link.has-menu[aria-expanded="true"]::after { margin-top:4px; transform:rotate(225deg); }
227
+ body.marketing .mnav-link:last-child { padding-left:12px; padding-right:12px; line-height:21px; }
228
+ body.marketing .mnav-actions { gap:8px; }
229
+ body.marketing .mnav-actions .btn { height:44px; min-height:44px; font-size:14px; line-height:21px; font-weight:500; }
230
+ body.marketing .mnav-language { width:44px; height:44px; margin:0; display:flex; align-items:center; justify-content:center; }
231
+ body.marketing .mnav-actions > .btn.ghost:not(.sales) { width:63px; padding:0 12px; border-color:transparent; white-space:nowrap; }
232
+ body.marketing .mnav-actions > .btn.sales { width:120px; padding:0 16px; white-space:nowrap; }
233
+ body.marketing .mnav-actions > .btn.primary:not(.sales) { width:105px; padding:0 12px; }
234
+
235
+ body.official-snapshot { overflow-x:hidden; }
236
+ html:has(body.official-snapshot) { overflow-x:hidden; }
237
+ body.official-snapshot>.mnav .mnav-logo { display:flex!important; width:136px!important; flex:0 0 136px!important; visibility:visible!important; opacity:1!important; }
238
+ body.official-snapshot>.mnav .mnav-logo svg { display:block!important; visibility:visible!important; opacity:1!important; }
239
+ body.official-snapshot .faq [role="button"][aria-expanded="false"] ~ [aria-hidden="true"] { display:none!important; }
240
+ body.official-snapshot .faq [role="button"][aria-expanded="true"] ~ [aria-hidden="false"] { display:flex!important; }
241
+ body.official-snapshot .faq [role="button"][aria-expanded="true"] > span { transform:rotateZ(0deg)!important; }
242
+
243
+ /* hero */
244
+ .hero { max-width: 62rem; margin: 0 auto; padding: 4.5rem 1.2rem 3rem; text-align: center; }
245
+ .hero.small { padding-top: 3.2rem; }
246
+ .hero h1 { font-size: clamp(2.1rem, 5.5vw, 3.6rem); letter-spacing: -.03em; line-height: 1.08; }
247
+ .grad {
248
+ background: linear-gradient(90deg, #ff453e 0%, #f481f4 50%, #ff453e 100%);
249
+ -webkit-background-clip: text; background-clip: text; color: transparent;
250
+ }
251
+ .sub { color: var(--ink-soft); font-size: 1.15rem; max-width: 40rem; margin: 1rem auto 0; line-height: 1.55; }
252
+ .hero-cta { display: flex; gap: .8rem; justify-content: center; margin-top: 1.6rem; flex-wrap: wrap; }
253
+ .hero-cta.center { margin-top: 1.2rem; }
254
+
255
+ /* Public source home, observed in a fresh anonymous headed Playwright context. */
256
+ .source-home { position: relative; max-width: none; height: 674px; min-height: 674px; padding: 64px 24px 0; overflow: hidden; }
257
+ .source-home h1 { position: relative; z-index: 2; width: 874px; color:#0d0e10; font-size: 102px; font-weight: 300; line-height: .9; letter-spacing: -2.55px; margin: 0 auto; }
258
+ .source-home h2 { position: relative; z-index: 2; width:521px; margin: 28px auto 0; color: rgba(62,62,62,.8); font-size: 26px; line-height:33.8px; font-weight: 300; letter-spacing: .52px; }
259
+ .source-home .grad { background: linear-gradient(90deg,#ff453e 0%,#f481f4 50%,#ff453e 100%); -webkit-background-clip:text; background-clip:text; }
260
+ .signup-note { position: relative; z-index: 2; width:537px; margin: 16px auto 0; color: #6e6e6e; font-size: 16px; line-height:24px; font-weight:300; letter-spacing:.32px; }
261
+ .source-sso { position: relative; z-index: 2; display: flex; justify-content: center; gap: 8px; margin-top: 24px; }
262
+ .source-sso-btn { width: 265px; height: 69px; border: 1px solid #858585; border-radius: 999px; display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 16px; font-weight: 600; background: #fff; }
263
+ .google-g { color: #4285f4; font-size: 24px; font-weight: 800; }
264
+ .microsoft-mark { color: #f25022; font-size: 21px; text-shadow: 10px 0 #7fba00, 0 10px #00a4ef, 10px 10px #ffb900; margin-right: 9px; line-height: 11px; width: 12px; overflow: visible; }
265
+ .source-or { position: relative; z-index: 2; width: 537px; margin: 27px auto 0; height: 1px; background: #d2d2d2; }
266
+ .source-or span { position: absolute; left: 50%; top: 0; transform: translate(-50%,-50%); padding: 0 13px; background: #fff; color: #717171; }
267
+ .source-signup { position: relative; z-index: 2; display: flex; justify-content: center; gap: 15px; margin-top: 28px; }
268
+ .source-signup input { width: 400px; height: 50px; padding: 0 15px; border: 1px solid #cfcfcf; border-radius: 4px; font: inherit; font-size: 16px; line-height:24px; font-weight:300; letter-spacing:.32px; outline:0; }
269
+ .source-signup button { width: 122px; height: 50px; border: 1px solid transparent; border-radius: 999px; background: #0e0e0f; color: #fff; font-size: 16px; line-height:24px; font-weight: 500; cursor: pointer; }
270
+ .source-signup .mobile-label { display:none; }
271
+ .source-fineprint { position: relative; z-index: 2; font-size: 13px; margin: 18px 0 0; }
272
+ .source-fineprint a { text-decoration: underline; }
273
+ @media (min-width: 721px) {
274
+ /* The public desktop composition keeps the central sign-up stack lower than
275
+ the orbit's first row. Keep the orbit coordinates stable and move only
276
+ the deterministic foreground stack. */
277
+ .source-home { overflow:visible; }
278
+ .source-home > h1,
279
+ .source-home > h2,
280
+ .source-home > .signup-note,
281
+ .source-home > .source-sso,
282
+ .source-home > .source-or,
283
+ .source-home > .source-signup,
284
+ .source-home > .source-fineprint { top: 42px; }
285
+ body:has(.product-contract) .mnav-link.active { border-bottom-color:transparent; }
286
+ .product-lead,
287
+ .product-sso,
288
+ .product-or,
289
+ .product-signup,
290
+ .product-fine { position:relative; top:-6px; }
291
+ .product-lead { top:-4px; }
292
+ .product-fine { top:-8px; }
293
+ .product-signup input { border:2px solid #0b67e8; }
294
+ .product-title-line-one { display:inline-block; transform:translateX(-7px); }
295
+ body:has(.product-contract) .mnav-actions > .btn.primary:not(.sales) { padding-left:16px; padding-right:16px; border:0; }
296
+ .home-synthetic-help { display:block; position:fixed; right:23px; bottom:23px; z-index:40; }
297
+ .home-synthetic-launcher { width:72px; height:50px; padding:0; display:flex; align-items:center; justify-content:center; border:1px solid #111; border-radius:999px; background:#fff; cursor:pointer; }
298
+ .home-synthetic-launcher > span:last-child { display:none; }
299
+ .home-synthetic-panel { position:absolute; right:0; bottom:60px; width:322px; min-height:84px; padding:14px 16px; border:1px solid #e9e9e9; border-radius:17px; background:#fff; box-shadow:0 3px 14px rgba(0,0,0,.09); }
300
+ .home-synthetic-panel button { position:absolute; right:7px; top:5px; border:0; background:transparent; }
301
+ .home-synthetic-panel p { margin:0; font-size:14px; line-height:22px; }
302
+ .orbit-card.edits i { order:2; width:40px; height:40px; margin-left:auto; flex:0 0 40px; border:3px solid #fff; border-radius:50%; box-shadow:0 0 0 1px #d7d7d7; background:#e8f1f8 no-repeat center/34px 34px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34' viewBox='0 0 34 34'%3E%3Ccircle cx='17' cy='17' r='17' fill='%23d9f0ff'/%3E%3Cpath d='M1 34c1-9 7-13 16-13s15 4 16 13' fill='%23156ca8'/%3E%3Cellipse cx='17' cy='14' rx='8' ry='10' fill='%23d89b72'/%3E%3Cpath d='M8 15C6 5 11 1 17 1c7 0 11 5 9 15-3-5-7-8-14-7l-4 6z' fill='%23201a17'/%3E%3Ccircle cx='14' cy='14' r='.8' fill='%23111'/%3E%3Ccircle cx='20' cy='14' r='.8' fill='%23111'/%3E%3Cpath d='M14 19q3 2 6 0' fill='none' stroke='white' stroke-width='.8'/%3E%3C/svg%3E"); }
303
+ }
304
+ .source-orbit { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
305
+ .mobile-orbit-canvas { display:none; }
306
+ .source-orbit::before { display:none; }
307
+ .orbit-wires { position:absolute; inset:0; width:100%; height:674px; overflow:visible; }
308
+ .orbit-wires .wire { fill:none; stroke-width:1; vector-effect:non-scaling-stroke; }
309
+ .orbit-wires .hot { stroke:#fa5ede; }
310
+ .orbit-wires .pale { stroke:#d6d6d6; }
311
+ .orbit-wires circle { fill:#0d0e10; }
312
+ .orbit-mobile-wires { display:none; }
313
+ .orbit-card { position:absolute; border:1px solid #d1d1d1; border-radius:12px; background:#fff; text-align:left; font-size:16px; line-height:1.1; padding:12px 14px; box-shadow:0 1px 1px rgba(0,0,0,.02); }
314
+ .orbit-card.launch { left:24px; top:33px; width:228px; height:93px; font-size:24px; padding:17px 34px; white-space:nowrap; }
315
+ .orbit-chip { position:absolute; left:226px; top:104px; padding:4px 9px; border-radius:3px; background:#9bef9f; font-size:12px; }
316
+ .orbit-chip::before { content:"✿"; position:absolute; left:-30px; top:-7px; width:26px; height:26px; display:flex; align-items:center; justify-content:center; border:3px solid #7ee596; border-radius:50%; background:#fff; color:#111; font:11px/1 Arial,sans-serif; }
317
+ .orbit-card.readiness { right:122px; top:98px; width:198px; height:65px; padding:15px 10px 12px 47px; font-size:10px; }
318
+ .orbit-card.readiness::before { content:"✿"; position:absolute; left:8px; top:10px; width:26px; height:26px; display:flex; align-items:center; justify-content:center; border-radius:50%; background:#e7f84e; color:#111; font:12px/1 Arial,sans-serif; }
319
+ .orbit-card.readiness b { display:inline-block; background:#dff73b; font-weight:400; margin-bottom:6px; }
320
+ .orbit-card.readiness small { display:block; font-size:10px; white-space:nowrap; }
321
+ .orbit-card.launched { right:19px; top:295px; width:210px; height:58px; font-size:16px; display:flex; align-items:center; gap:10px; }
322
+ .orbit-card.launched i { width:22px; height:22px; border-radius:50%; background:#10a958; position:relative; }
323
+ .orbit-card.launched i::after { content:"✓"; position:absolute; inset:0; color:#fff; text-align:center; font:700 14px/22px Arial,sans-serif; }
324
+ .orbit-card.edits { right:138px; top:513px; width:190px; height:50px; display:flex; align-items:center; gap:9px; }
325
+ .orbit-card.edits i { width:16px; height:16px; border:1px solid #555; border-radius:2px; }
326
+ .orbit-card.enablement { left:95px; top:602px; width:199px; height:58px; font-size:23px; display:flex; align-items:center; gap:10px; }
327
+ .orbit-card.enablement i { width:34px; height:34px; border-radius:7px; background:#4b8df8; position:relative; }
328
+ .orbit-card.enablement i::after { content:""; position:absolute; left:8px; right:7px; top:9px; height:2px; background:#fff; box-shadow:0 6px #fff,0 12px #fff; opacity:.9; }
329
+ .orbit-node { position: absolute; z-index: 2; width:42px; height:42px; border:3px solid #fff; border-radius:50%; box-shadow:0 0 0 1px #d7d7d7; display:flex; align-items:center; justify-content:center; font-size:16px; }
330
+ .team-person { left:460px; top:22px; background:radial-gradient(circle at 54% 38%,#e5aa7e 0 22%,#6f4635 23% 44%,#f2f2f2 45%); }
331
+ .team-bot { left:503px; top:22px; background:#3997f3; color:transparent; }
332
+ .team-bot::before { content:"✿"; width:27px; height:27px; display:flex; align-items:center; justify-content:center; border-radius:50%; background:#fff; color:#111; font:14px/1 Arial,sans-serif; }
333
+ .team-plan { left:546px; top:22px; background:#efb6f6; color:transparent; }
334
+ .team-plan::before { content:"▲"; width:27px; height:27px; display:flex; align-items:center; justify-content:center; border-radius:50%; background:#fff; color:#111; font:12px/1 Arial,sans-serif; }
335
+ .google-node { right:453px; top:51px; background:#fff; color:transparent; }
336
+ .google-node::before { content:"▲"; color:#c7d94f; font:22px/1 Arial,sans-serif; text-shadow:-6px 6px #5ea4e8,6px 6px #79b66f; }
337
+ .campaign-node { left:597px; top:586px; width:38px; height:38px; border-color:#fff; background:#b9ecf8; color:#111; font:13px/1 Arial,sans-serif; }
338
+ .campaign-chip { left:639px; top:599px; padding:3px 8px; background:#a9e8f3; font-size:8px; }
339
+ .campaign-chip::before { display:none; }
340
+ .bottom-person-one { left:843px; top:608px; width:42px; height:42px; background:radial-gradient(circle at 50% 36%,#e0a37d 0 24%,#4a271c 25% 45%,#cfebff 46%); }
341
+ .bottom-person-two { left:878px; top:608px; width:42px; height:42px; background:radial-gradient(circle at 50% 36%,#e5ad82 0 24%,#5d3828 25% 45%,#d6f5e5 46%); }
342
+ .orbit-chip:not(.planner):not(.campaign-chip) { }
343
+ .orbit-chip.planner::before { left:-56px; top:-13px; width:42px; height:42px; border-width:4px; font-size:15px; }
344
+ .orbit-texture { position:absolute; z-index:3; display:block; object-fit:fill; }
345
+ .texture-initial { left:28px; top:39px; width:256px; height:121px; }
346
+ .texture-launch { left:190px; top:103px; width:170px; height:55px; }
347
+ .texture-avatar1 { left:516px; top:24px; width:141px; height:53px; }
348
+ .texture-google { right:510px; top:57px; width:42px; height:42px; }
349
+ .texture-drive { display:none; }
350
+ .texture-pricing { right:139px; top:121px; width:222px; height:64px; }
351
+ .texture-launched { right:22px; top:340px; width:236px; height:59px; }
352
+ .texture-approve { right:156px; top:579px; width:214px; height:56px; }
353
+ .texture-enablement { left:106px; top:678px; width:223px; height:71px; }
354
+ .texture-campaign { left:671px; top:661px; width:146px; height:43px; }
355
+ .texture-avatar2 { left:946px; top:680px; width:89px; height:52px; }
356
+ .orbit-card.launch, .orbit-chip.planner, .team-person, .team-bot, .team-plan,
357
+ .google-node, .orbit-card.readiness, .orbit-card.launched, .orbit-card.edits,
358
+ .orbit-card.enablement, .campaign-node, .campaign-chip,
359
+ .bottom-person-one, .bottom-person-two { visibility:hidden; }
360
+ @media (min-width: 721px) {
361
+ .orbit-wires { height:752px; }
362
+ .orbit-card.launch { left:28px; top:39px; width:256px; height:104px; padding:20px 38px; font-size:28px; line-height:29px; }
363
+ .orbit-chip.planner { left:254px; top:120px; font-size:13px; }
364
+ .orbit-chip.planner::before { left:-64px; top:-16px; width:50px; height:50px; }
365
+ .team-person { left:518px; top:25px; }
366
+ .team-bot { left:570px; top:25px; }
367
+ .team-plan { left:613px; top:25px; }
368
+ .google-node { left:auto; right:510px; top:57px; }
369
+ .orbit-card.readiness { right:139px; top:121px; width:222px; height:64px; }
370
+ .orbit-card.launched { right:22px; top:340px; width:236px; height:58px; }
371
+ .orbit-card.edits { right:156px; top:579px; width:214px; height:58px; }
372
+ .orbit-card.enablement { left:106px; top:678px; width:223px; height:73px; font-size:27px; }
373
+ .campaign-node { left:676px; top:661px; }
374
+ .campaign-chip { left:720px; top:674px; }
375
+ .bottom-person-one { left:946px; top:684px; }
376
+ .bottom-person-two { left:984px; top:684px; }
377
+ .texture-google { display:none; }
378
+ .google-node { visibility:visible; left:888px; right:auto; top:57px; width:42px; height:42px; background:#fff; color:transparent; }
379
+ .google-node::before { display:none; }
380
+ .texture-drive { display:block; left:900px; top:67px; width:18px; height:22px; }
381
+ }
382
+ .home-synthetic-help { display:none; }
383
+ .home-marketing main { overflow:hidden; }
384
+ .home-trust { width:calc(100% - 146px); max-width:1134px; min-height:250px; margin:0 auto; display:grid; grid-template-columns:300px 1fr; align-items:center; gap:48px; border-bottom:1px solid #e5e5e5; }
385
+ .home-trust p { margin:0; font-size:22px; line-height:25px; font-weight:300; }
386
+ .home-trust p strong { font-weight:500; }
387
+ .home-trust sup { font-size:11px; }
388
+ .home-logos { display:flex; align-items:center; justify-content:space-between; gap:30px; color:#111; }
389
+ .home-logos span { white-space:nowrap; font-size:18px; font-weight:600; letter-spacing:-.03em; }
390
+ .home-logos span:nth-child(3) { font-family:Georgia,serif; font-size:14px; }
391
+ .home-logos .dell-logo { width:54px; height:54px; border:2px solid #111; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:13px; letter-spacing:.02em; }
392
+ .home-section-heading { min-height:230px; display:flex; align-items:flex-end; padding-bottom:56px; }
393
+ .home-section-heading h2, .home-teammates h2, .home-productivity h2, .home-get-started h2, .home-recognition h2, .home-bottom-cta h2 { margin:0; font-size:54px; line-height:1.02; font-weight:300; letter-spacing:-1.5px; }
394
+ .home-ai-story { width:calc(100% - 146px); max-width:1134px; margin:0 auto; padding-bottom:120px; }
395
+ .home-section-heading h2 { width:730px; }
396
+ .ai-story-layout { display:grid; grid-template-columns:minmax(0,1.15fr) minmax(350px,.85fr); gap:62px; align-items:stretch; }
397
+ .ai-story-stage { position:relative; min-height:620px; padding:38px; border-radius:18px; overflow:hidden; background:#f1f3f3; transition:background-color .25s ease,transform .25s ease; }
398
+ .ai-story-stage.is-changing { transform:scale(.995); background:#ebe8ff; }
399
+ .ai-stage-kicker { display:inline-block; padding:7px 10px; border-radius:5px; background:#ffd4ff; font-size:11px; font-weight:700; letter-spacing:.08em; }
400
+ .ai-story-stage h3 { position:relative; z-index:2; margin:18px 0 28px; font-size:30px; font-weight:400; }
401
+ .ai-story-stage img { position:absolute; left:38px; right:38px; bottom:104px; width:calc(100% - 76px); height:360px; object-fit:cover; object-position:center; border:1px solid #d3d3d3; border-radius:12px; background:#fff; box-shadow:0 12px 34px rgba(0,0,0,.09); transition:opacity .2s ease,transform .2s ease; }
402
+ .ai-story-stage.is-changing img { opacity:.52; transform:translateY(4px); }
403
+ .ai-stage-route { position:absolute; left:38px; right:38px; bottom:34px; display:flex; align-items:center; justify-content:center; gap:13px; }
404
+ .ai-stage-route i { padding:7px 12px; border:1px solid #c9c9c9; border-radius:999px; background:#fff; font-size:12px; font-style:normal; }
405
+ .ai-story-tabs { border-top:1px solid #cfcfcf; }
406
+ .ai-story-tab { width:100%; min-height:82px; padding:24px 4px 20px; display:grid; grid-template-columns:1fr 30px; text-align:left; border:0; border-bottom:1px solid #dedede; background:transparent; color:#111; cursor:pointer; }
407
+ .ai-story-tab span { font:400 20px/26px "TWK Lausanne"; }
408
+ .ai-story-tab b { text-align:center; font:300 21px/26px "TWK Lausanne"; }
409
+ .ai-story-tab p { display:none; grid-column:1/3; margin:14px 36px 3px 0; color:#4f4f4f; font-size:15px; line-height:22px; }
410
+ .ai-story-tab.is-active { min-height:184px; }
411
+ .ai-story-tab.is-active p { display:block; }
412
+ .section-kicker { margin:0 0 14px; font-size:13px; font-weight:600; letter-spacing:.08em; }
413
+ .home-teammates { max-width:1280px; margin:0 auto; padding:125px 73px 135px; }
414
+ .home-teammates h2 { max-width:760px; }
415
+ .teammates-intro { margin-top:28px; display:flex; align-items:flex-start; justify-content:space-between; gap:40px; }
416
+ .teammates-intro p { max-width:750px; margin:0; font-size:19px; line-height:29px; color:#424242; }
417
+ .teammates-intro a, .award-grid article>a { display:inline-flex; gap:9px; align-items:center; font-weight:500; border-bottom:1px solid #111; padding-bottom:4px; }
418
+ .teammate-rail { margin-top:68px; display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:14px; }
419
+ .teammate-card { min-height:430px; padding:22px 20px; border:1px solid #dedede; border-radius:4px; background:#fff; }
420
+ .teammate-card i { width:67px; height:67px; display:flex; align-items:center; justify-content:center; border:3px solid #111; border-radius:50%; background:var(--agent-color); font:32px/1 Arial; }
421
+ .teammate-card h3 { min-height:58px; margin:27px 0 9px; font-size:22px; line-height:25px; font-weight:400; }
422
+ .teammate-card p { min-height:140px; margin:0; color:#4d4d4d; font-size:14px; line-height:20px; }
423
+ .teammate-card small { display:block; padding-top:21px; border-top:1px solid #e1e1e1; color:#777; font-size:10px; }
424
+ .teammate-card strong { display:block; margin-top:10px; font-size:9px; line-height:16px; letter-spacing:.03em; }
425
+ .home-productivity { background:#0d0d0d; color:#fff; padding:122px 0 132px; }
426
+ .productivity-inner { width:calc(100% - 64px); max-width:1216px; margin:0 auto; }
427
+ .home-productivity h2 { max-width:650px; }
428
+ .productivity-tabs { margin-top:52px; display:flex; justify-content:center; gap:10px; flex-wrap:wrap; }
429
+ .productivity-tab { min-height:45px; padding:0 24px; border:0; border-radius:999px; background:#3c3c3c; color:#fff; font:500 13px/1 "TWK Lausanne"; cursor:pointer; transition:background .2s ease,color .2s ease,transform .2s ease; }
430
+ .productivity-tab:hover { transform:translateY(-2px); }
431
+ .productivity-tab.is-active { background:var(--pill); color:#111; }
432
+ .productivity-stage { height:570px; margin-top:56px; display:grid; grid-template-columns:170px minmax(0,1fr) 170px; gap:24px; transition:opacity .2s ease; }
433
+ .productivity-stage.is-changing { opacity:.55; }
434
+ .productivity-side, .productivity-main { border-radius:15px; background:#292929; overflow:hidden; }
435
+ .productivity-side { padding:28px 22px; display:flex; flex-direction:column; justify-content:center; opacity:.55; }
436
+ .productivity-side span { color:#aaa; font-size:10px; letter-spacing:.08em; }
437
+ .productivity-side strong { margin-top:18px; font-size:21px; line-height:25px; font-weight:400; }
438
+ .productivity-side p { color:#bababa; font-size:13px; line-height:19px; }
439
+ .productivity-main { padding:25px; display:flex; flex-direction:column; }
440
+ .productivity-main>div { min-height:112px; display:flex; gap:16px; }
441
+ .productivity-main i { width:46px; height:46px; flex:0 0 46px; display:flex; align-items:center; justify-content:center; border-radius:8px; background:#ffd4ff; color:#111; font:24px/1 Arial; }
442
+ .productivity-main h3 { margin:0 0 8px; font-size:22px; font-weight:400; }
443
+ .productivity-main p { max-width:690px; margin:0; color:#ddd; font-size:14px; line-height:20px; }
444
+ .productivity-main img { width:100%; height:390px; margin-top:auto; object-fit:cover; object-position:center; border-radius:8px; background:#fff; }
445
+ .home-case { max-width:1134px; margin:0 auto; padding:110px 0 125px; }
446
+ .case-connector, .recognition-connector { height:76px; position:relative; margin-bottom:52px; }
447
+ .case-connector::before, .recognition-connector::before { content:""; position:absolute; left:0; right:0; top:36px; height:1px; background:linear-gradient(90deg,transparent,#f092b3 22%,#f092b3 78%,transparent); }
448
+ .case-connector i, .case-connector b, .recognition-connector i, .recognition-connector b { position:absolute; top:18px; z-index:1; width:38px; height:38px; border:3px solid #fff; box-shadow:0 0 0 1px #ccc; border-radius:50%; background:#d7a27e; }
449
+ .case-connector i { left:12%; }
450
+ .case-connector b { left:48%; display:flex; align-items:center; justify-content:center; background:#f6ff8e; color:#111; }
451
+ .case-grid { display:grid; grid-template-columns:1fr 1fr; gap:34px; align-items:center; }
452
+ .case-image { height:390px; border-radius:16px; overflow:hidden; background:#eee; }
453
+ .case-image img { width:100%; height:100%; object-fit:cover; }
454
+ .case-grid blockquote { position:relative; margin:0; padding:18px 0 0 6px; }
455
+ .cos-logo { font:400 42px/1 Arial,sans-serif; letter-spacing:.02em; }
456
+ .quote-mark { position:absolute; right:4px; top:10px; font:700 42px/1 Georgia,serif; }
457
+ .case-grid blockquote>p { margin:30px 0 34px; font-size:29px; line-height:36px; font-weight:300; }
458
+ .case-grid blockquote footer strong, .case-grid blockquote footer small { display:block; }
459
+ .case-grid blockquote footer small { margin-top:4px; font-size:11px; }
460
+ .home-get-started { max-width:1216px; min-height:610px; margin:0 auto 120px; padding:74px; display:grid; grid-template-columns:1fr 1.12fr; gap:72px; border-radius:20px; background:#f7f7f6; }
461
+ .home-get-started>div p { max-width:420px; margin-top:25px; color:#4b4b4b; font-size:18px; line-height:27px; }
462
+ .home-get-started nav { display:flex; flex-direction:column; gap:12px; }
463
+ .home-get-started nav a { min-height:128px; padding:26px 28px; display:flex; align-items:center; justify-content:space-between; background:#fff; transition:transform .2s ease,box-shadow .2s ease; }
464
+ .home-get-started nav a:hover { transform:translateX(4px); box-shadow:0 8px 24px rgba(0,0,0,.07); }
465
+ .home-get-started nav strong, .home-get-started nav small { display:block; }
466
+ .home-get-started nav strong { font-size:22px; font-weight:400; }
467
+ .home-get-started nav small { margin-top:10px; color:#777; font-size:14px; }
468
+ .home-get-started nav b { width:48px; height:48px; display:flex; align-items:center; justify-content:center; border-radius:50%; background:#111; color:#fff; font-size:22px; }
469
+ .home-recognition { max-width:1134px; margin:0 auto; padding:0 0 135px; }
470
+ .recognition-connector i { left:39%; }
471
+ .recognition-connector b { left:44%; display:flex; align-items:center; justify-content:center; background:#c6b5ff; }
472
+ .award-grid { margin-top:52px; display:grid; grid-template-columns:1fr 1fr; gap:28px; }
473
+ .award-grid article { min-width:0; }
474
+ .award-art { height:340px; border-radius:8px; overflow:hidden; }
475
+ .award-gartner { position:relative; background:#0c0c0c; }
476
+ .award-gartner::before { content:""; position:absolute; left:0; right:0; top:50%; height:1px; background:#e785a7; }
477
+ .gartner-grid { position:absolute; left:50%; top:50%; width:205px; height:205px; transform:translate(-50%,-50%); display:grid; grid-template-columns:repeat(3,1fr); grid-template-rows:repeat(3,1fr); background:#fff; border-radius:7px; box-shadow:0 14px 32px rgba(255,255,255,.15); }
478
+ .gartner-grid i { width:8px; height:8px; margin:auto; border-radius:50%; background:#b9b9b9; }
479
+ .award-g2 { display:flex; align-items:center; justify-content:center; gap:18px; padding:28px; background:#064c39; }
480
+ .award-g2 span { flex:1; text-align:center; color:#d4f6e8; }
481
+ .award-g2 span>b { display:block; margin-bottom:14px; font-size:10px; }
482
+ .award-g2 span>i { min-height:150px; padding:17px 7px; display:block; border:5px solid #ef6847; background:#fff; color:#111; font-style:normal; font-size:13px; clip-path:polygon(0 0,100% 0,100% 84%,50% 100%,0 84%); }
483
+ .award-g2 strong, .award-g2 small { display:block; }
484
+ .award-g2 strong { font-size:27px; }
485
+ .award-g2 small { margin-top:8px; font-size:8px; }
486
+ .award-grid h3 { min-height:60px; margin:22px 0 16px; font-size:18px; line-height:25px; font-weight:400; }
487
+ .home-bottom-cta { min-height:520px; padding:108px max(73px,calc((100% - 1134px)/2)); background:#0d0d0d; color:#fff; }
488
+ .home-bottom-cta h2 { max-width:620px; font-size:56px; }
489
+ .home-bottom-cta>.btn { margin-top:32px; padding:15px 25px; border-radius:999px; background:#fff; color:#111; }
490
+ .home-bottom-cta p { margin:96px 0 0; font-size:11px; color:#bdbdbd; }
491
+
492
+ /* Direct anonymous /product top-of-route contract. */
493
+ .product-contract { position:relative; height:1000px; padding-top:52px; text-align:center; color:#0d0d0d; overflow:hidden; }
494
+ .product-title-mobile { display:none; }
495
+ .product-contract h1 { width:848px; margin:0 auto; font-size:64px; line-height:64px; font-weight:300; letter-spacing:-1.28px; text-wrap:balance; white-space:pre-wrap; }
496
+ .product-lead { width:628px; margin:36px auto 0; font-size:20px; line-height:30px; font-weight:300; letter-spacing:.4px; }
497
+ .product-sso { display:flex; justify-content:center; gap:8px; margin-top:34px; }
498
+ .product-sso a { width:205px; height:69px; display:flex; align-items:center; justify-content:center; gap:14px; border:1px solid #858585; border-radius:999px; font-size:16px; font-weight:500; }
499
+ .product-sso .google-g { position:relative; width:24px; height:24px; flex:0 0 24px; border-radius:50%; color:transparent; font-size:0; background:conic-gradient(from -42deg,#4285f4 0 29%,#34a853 29% 49%,#fbbc05 49% 70%,#ea4335 70% 86%,#4285f4 86% 100%); }
500
+ .product-sso .google-g::before { content:""; position:absolute; inset:5px; border-radius:50%; background:#fff; }
501
+ .product-sso .google-g::after { content:""; position:absolute; right:0; top:10px; width:11px; height:5px; background:#4285f4; }
502
+ .product-or { position:relative; width:418px; height:1px; margin:28px auto 0; background:#d2d2d2; }
503
+ .product-or span { position:absolute; left:50%; top:0; transform:translate(-50%,-50%); padding:0 12px; background:#fff; color:#6e6e6e; }
504
+ .product-signup { width:418px; margin:27px auto 0; }
505
+ .product-signup input { width:418px; height:50px; padding:12px 16px; border:1px solid #cfcfcf; border-radius:4px; color:#0d0d0d; font:300 16px/24px "TWK Lausanne"; letter-spacing:.32px; outline:0; }
506
+ .product-signup button { width:418px; height:58px; margin-top:16px; border:0; border-radius:999px; background:#0d0e10; color:#fff; font:500 16px/24px "TWK Lausanne"; }
507
+ .product-fine { width:418px; margin:17px auto 0; font-size:13px; line-height:19.5px; font-weight:300; letter-spacing:.26px; }
508
+ .product-fine a { text-decoration:underline; }
509
+ .product-source-visual { position:absolute; left:76px; top:669px; width:calc(100% - 152px); height:auto; display:block; border-radius:14px 14px 0 0; }
510
+ .product-synthetic-visual { position:absolute; left:76px; top:669px; width:calc(100% - 152px); height:330px; border-radius:14px 14px 0 0; overflow:hidden;
511
+ background:
512
+ radial-gradient(ellipse at 2% 58%,rgba(27,83,36,.92) 0 4%,transparent 13%),
513
+ radial-gradient(ellipse at 47% 30%,rgba(38,28,22,.75) 0 3%,transparent 10%),
514
+ radial-gradient(ellipse at 98% 54%,rgba(22,21,19,.82) 0 3%,transparent 11%),
515
+ linear-gradient(90deg,#486849 0 5%,#ddd9d1 5% 15%,#c9b8a6 15% 32%,#dfd2c3 32% 49.45%,#fff 49.45% 50.55%,#a66e49 50.55% 59%,#cd8b64 59% 72%,#6f3e29 72% 86%,#a65b34 86% 97%,#25221e 97% 100%); }
516
+ .product-synthetic-visual::before,.product-synthetic-visual::after { content:""; position:absolute; bottom:25px; width:190px; height:260px; border-radius:48% 48% 18% 18%; background:radial-gradient(circle at 50% 21%,#7a4a34 0 10%,#2a201b 11% 24%,transparent 25%),linear-gradient(#b18769 0 38%,#4d423b 39%); }
517
+ .product-synthetic-visual::before { left:355px; }.product-synthetic-visual::after { right:240px; background:radial-gradient(circle at 50% 21%,#d7a276 0 10%,#2d211b 11% 24%,transparent 25%),linear-gradient(#a47151 0 38%,#202b4a 39%); }
518
+ .product-synthetic-visual b { position:absolute; left:50%; top:129px; transform:translateX(-50%); width:170px; height:110px; border:6px solid #fff; border-radius:8px; background:linear-gradient(#fff 0 22%,#f3f3f3 22% 100%); box-shadow:0 2px 8px rgba(0,0,0,.15); }
519
+ .product-depth { height:1900px; padding:180px 73px; border-top:1px solid #eee; }
520
+ .product-depth h2 { max-width:900px; font-size:60px; line-height:62px; font-weight:300; }.product-depth p{max-width:720px;font-size:22px;line-height:34px;color:#646f79}.product-final{height:1100px;background:#0d0e10;color:#fff;text-align:center}
521
+
522
+ /* Public solutions route. */
523
+ .solutions-hero { min-height: 720px; padding: 128px 73px 96px; background: #f7f7f5; text-align: center; }
524
+ .solutions-kicker { margin: 0 0 24px; font-size: 13px; letter-spacing: .14em; }
525
+ .solutions-hero h1 { max-width: 940px; margin: 0 auto; font-size: 72px; line-height: 74px; font-weight: 300; letter-spacing: -1.5px; }
526
+ .solutions-hero > p:not(.solutions-kicker) { max-width: 680px; margin: 30px auto 38px; color: #646f79; font-size: 21px; line-height: 31px; }
527
+ .solutions-hero > div { display: flex; justify-content: center; gap: 12px; }
528
+ .solutions-grid { padding: 96px 73px 130px; display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
529
+ .solutions-grid article { min-height: 430px; padding: 38px; border: 1px solid #d9d7d5; border-radius: 18px; scroll-margin-top: 96px; }
530
+ .solutions-grid article > span { color: #6d6e6f; font-size: 13px; letter-spacing: .12em; }
531
+ .solutions-grid h2 { margin: 82px 0 16px; font-size: 42px; font-weight: 400; }
532
+ .solutions-grid p { max-width: 500px; color: #646f79; font-size: 18px; line-height: 28px; }
533
+ .solutions-grid a, .solutions-proof a { display: inline-block; margin-top: 28px; font-weight: 500; text-decoration: underline; text-underline-offset: 6px; }
534
+ .solutions-band { min-height: 900px; padding: 150px 73px; background: #0d0e10; color: #fff; }
535
+ .solutions-band > p { font-size: 13px; letter-spacing: .14em; }
536
+ .solutions-band > h2 { max-width: 920px; margin: 28px 0 110px; font-size: 60px; line-height: 64px; font-weight: 300; }
537
+ .solutions-band > div { display: grid; grid-template-columns: repeat(3,1fr); gap: 52px; }
538
+ .solutions-band article { display: flex; flex-direction: column; gap: 16px; border-top: 1px solid #696a6b; padding-top: 24px; }
539
+ .solutions-band strong { font-size: 26px; font-weight: 400; }.solutions-band span { color: #c7c8c9; font-size: 18px; line-height: 28px; }
540
+ .solutions-proof { min-height: 850px; padding: 170px 73px; background: #edf6ff; }
541
+ .solutions-proof h2 { max-width: 850px; font-size: 58px; line-height: 62px; font-weight: 300; }
542
+ .solutions-proof p { max-width: 700px; color: #4f5b66; font-size: 21px; line-height: 32px; }
543
+ .solutions-final { min-height: 620px; padding: 160px 73px; text-align: center; }
544
+ .solutions-final h2 { margin-bottom: 42px; font-size: 64px; font-weight: 300; }
545
+
546
+ /* fake product shot */
547
+ .hero-shot { margin: 3rem auto 0; max-width: 56rem; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 24px 60px rgba(30,31,33,.12); text-align: left; }
548
+ .shot-bar { background: var(--bg-warm); border-bottom: 1px solid var(--line); padding: .5rem .8rem; display: flex; gap: .35rem; }
549
+ .dot { width: .6rem; height: .6rem; border-radius: 50%; display: inline-block; }
550
+ .dot.r { background: #f06a6a; } .dot.y { background: #f1bd6c; } .dot.g { background: #5da283; }
551
+ .shot-body { display: grid; grid-template-columns: 11rem 1fr; min-height: 15rem; }
552
+ .shot-side { background: #2e2e30; padding: 1rem .8rem; display: flex; flex-direction: column; gap: .7rem; }
553
+ .shot-side .sk { background: #4a4a4c; }
554
+ .shot-main { padding: 1.1rem; }
555
+ .shot-cards { display: flex; gap: .8rem; margin-top: 1rem; }
556
+ .scard { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: .8rem; display: flex; flex-direction: column; gap: .5rem; }
557
+ .sk { height: .55rem; border-radius: 4px; background: var(--line); }
558
+ .sk.title { height: .9rem; margin-bottom: .4rem; }
559
+ .w40 { width: 40%; } .w50 { width: 50%; } .w60 { width: 60%; } .w70 { width: 70%; } .w80 { width: 80%; }
560
+
561
+ /* strips + cards */
562
+ .strip { max-width: 72rem; margin: 0 auto; padding: 3rem 1.2rem; text-align: center; }
563
+ .strip.alt { background: var(--bg-warm); max-width: none; }
564
+ .strip.alt > * { max-width: 72rem; margin-left: auto; margin-right: auto; }
565
+ .strip h2 { font-size: clamp(1.5rem, 3.4vw, 2.2rem); letter-spacing: -.02em; }
566
+ .center-sub { color: var(--ink-soft); max-width: 38rem; margin: .6rem auto 0; }
567
+ .cards3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.2rem; margin-top: 2rem; text-align: left; }
568
+ .mcard { border: 1px solid var(--line); border-radius: 12px; padding: 1.4rem; background: #fff; }
569
+ .mcard h3 { font-size: 1.1rem; }
570
+ .mcard p { color: var(--ink-soft); line-height: 1.5; margin: 0 0 .8rem; }
571
+
572
+ /* pricing */
573
+ .tiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.2rem; margin-top: 2rem; text-align: left; }
574
+ .tier { border: 1px solid var(--line); border-radius: 12px; padding: 1.4rem; position: relative; background: #fff; display: flex; flex-direction: column; }
575
+ .tier.popular { border-color: var(--ink); box-shadow: 0 10px 30px rgba(30,31,33,.10); }
576
+ .tier .badge { position: absolute; top: -0.8rem; left: 1.2rem; background: var(--ink); color: #fff; border-radius: 999px; font-size: .75rem; padding: .2rem .7rem; }
577
+ .tier .price { font-size: 2rem; font-weight: 700; }
578
+ .tier .per { color: var(--ink-soft); font-size: .85rem; min-height: 2.2em; }
579
+ .tier ul { padding-left: 1.1rem; color: var(--ink-soft); line-height: 1.65; font-size: .92rem; margin-top: 1rem; }
580
+ .tier .btn { margin-top: .4rem; }
581
+ .finenote { color: var(--ink-soft); font-size: .85rem; margin-top: 2rem; }
582
+
583
+ /* Pricing: direct 1280px source contract captured from the existing headed
584
+ session. The observed third-party messenger is represented by a generic,
585
+ deterministic local help surface; it contains no third-party copy or API. */
586
+ body:has(.pricing-page) .mnav {
587
+ position: fixed; inset: 0 0 auto; height: 68px; border: 0; z-index: 20;
588
+ }
589
+ body:has(.pricing-page) { font-family: "TWK Lausanne", "Helvetica Neue", Helvetica, sans-serif; }
590
+ body:has(.pricing-page) .mnav-inner { height: 68px; padding: 0 64px; gap: 0; }
591
+ body:has(.pricing-page) .mnav-logo { width:136px; height:44px; padding:0 12px; gap:0; }
592
+ body:has(.pricing-page) .mnav-links { margin-left:32px; gap:0; }
593
+ body:has(.pricing-page) .mnav-actions { gap: 8px; }
594
+ body:has(.pricing-page) .mnav-actions .btn { min-height: 44px; border-radius: 999px; padding: 0 18px; }
595
+ body:has(.pricing-page) .mnav-actions .sales { min-width: 105px; }
596
+ body:has(.pricing-page) .pricing-sales-link { margin: 0 11px 0 19px; font-size: 14px; font-weight: 500; white-space: nowrap; }
597
+ body:has(.pricing-page) .mnav-language { margin: 0 10px 0 0; font-size: 24px; }
598
+ body:has(.pricing-page) .mnav-link.active { border-bottom-color: transparent; }
599
+ body:has(.pricing-page) main { padding: 0; }
600
+ .pricing-page { color: #0d0d0d; }
601
+ .pricing-page > section { width: calc(100% - 146px); max-width: 1134px; margin: 0 auto; }
602
+ .pricing-hero { height: 328px; display: flex; justify-content: center; align-items: flex-start; }
603
+ .pricing-hero h1 {
604
+ width: 748px; margin: 120px 0 0; text-align: center; font-size: 64px;
605
+ line-height: 64px; letter-spacing: -1.28px; font-weight: 300;
606
+ }
607
+ .pricing-plans { height: 1037px; position: relative; }
608
+ .billing-toggle {
609
+ position: absolute; right: 89px; top: -5px; height: 32px; display: flex;
610
+ align-items: center; gap: 14px; color: #6e6e6e; font-size: 16px;
611
+ }
612
+ .billing-toggle i { display: block; width: 45px; height: 24px; border-radius: 999px; background: #21a45d; position: relative; }
613
+ .billing-toggle i::after { content: ""; position: absolute; right: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; }
614
+ .billing-toggle strong { color: #0d0d0d; font-weight: 500; }
615
+ .billing-toggle em { margin-left: -8px; padding: 5px 4px; background: #c8f4d8; color: #175f3a; font-size: 11px; line-height: 16px; font-style: normal; white-space: nowrap; }
616
+ .pricing-page .tiers {
617
+ margin: 0; padding-top: 45px; height: 1037px; display: grid;
618
+ grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; align-items: stretch;
619
+ }
620
+ .pricing-page .tier {
621
+ min-width: 0; min-height: 992px; padding: 32px; border: 1px solid #cfcfcf;
622
+ border-radius: 16px 16px 0 0; box-shadow: none; color: #0d0d0d;
623
+ }
624
+ .pricing-page .tier h3 { margin: 0; font-size: 36px; line-height: 36px; font-weight: 400; letter-spacing: -.36px; }
625
+ .pricing-page .tier-desc { margin: 16px 0 0; min-height: 92px; color: #6e6e6e; font-size: 13px; line-height: 19.5px; font-weight: 300; letter-spacing: .26px; }
626
+ .pricing-page .tier .price { margin-top: 18px; font-size: 30px; line-height: 36px; font-weight: 400; letter-spacing: -.3px; }
627
+ .pricing-page .tier-enterprise .price { margin-top: 18px; font-size: 16px; line-height: 20px; font-weight: 500; }
628
+ .pricing-page .tier .per { min-height: 40px; margin: 8px 0 0; color: #6e6e6e; font-size: 13px; line-height: 19.5px; font-weight: 300; letter-spacing: .26px; }
629
+ .pricing-page .tier .btn { height: 50px; margin: 23px 0 0; padding: 0 12px; border: 0; border-radius: 100px; font-size: 16px; font-weight: 500; }
630
+ .pricing-page .mobile-cta { display: none; }
631
+ .pricing-page .tier .btn.ghost { background: #f3f3f3; }
632
+ .pricing-page .purchase { height: 50px; display: flex; align-items: center; justify-content: center; gap: 8px; color: #0d0d0d; font-size: 13px; font-weight: 500; }
633
+ .pricing-page .purchase span { width: 16px; height: 16px; border-radius: 50%; background: #0d0d0d; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; }
634
+ .pricing-page .tier ul { margin: 26px 0 0; padding: 0; list-style: none; color: #646f79; font-size: 14px; line-height: 24px; }
635
+ .pricing-page .tier li::before { content: "✓"; margin-right: 8px; color: #0d0d0d; }
636
+ .pricing-note { height: 236px; display: flex; align-items: center; justify-content: center; border-top: 1px solid #dedede; }
637
+ .pricing-note p { max-width: 650px; margin: 0; text-align: center; font-size: 24px; line-height: 32px; color: #0d0d0d; }
638
+ .pricing-addons { height: 1159px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; column-gap: 32px; }
639
+ .pricing-addon { padding: 108px 33px 72px; border-top: 1px solid #dedede; }
640
+ .pricing-addon h3 { margin: 0; font-size: 36px; line-height: 43px; font-weight: 400; }
641
+ .pricing-addon p { width: 390px; min-height: 218px; margin: 24px 0 0; color: #646f79; font-size: 18px; line-height: 28px; }
642
+ .pricing-addon .btn { height: 42px; border-radius: 100px; margin-right: 8px; }
643
+ .pricing-loved { height: 351px; border-top: 1px solid #dedede; display: grid; grid-template-columns: 1fr 2fr; align-items: center; }
644
+ .pricing-loved h4 { width: 362px; margin: 0; font-size: 30px; line-height: 36px; font-weight: 400; }
645
+ .logo-dots { text-align: center; font-size: 44px; word-spacing: 26px; color: #646f79; }
646
+ .pricing-faq { height: 1394px; border-top: 1px solid #dedede; display: grid; grid-template-columns: 362px 1fr; column-gap: 24px; padding-top: 0; }
647
+ .pricing-faq h2 { margin: 0; padding-top: 0; font-size: 54px; line-height: 54px; font-weight: 300; letter-spacing: -2px; }
648
+ .faq-list { padding-left: 24px; }
649
+ .faq-list details { border-bottom: 1px solid #dedede; padding: 32px 0; }
650
+ .faq-list summary { cursor: pointer; list-style: none; font-size: 20px; line-height: 30px; }
651
+ .faq-list summary::after { content: "+"; float: right; font-size: 28px; }
652
+ .faq-list p { color: #646f79; font-size: 16px; line-height: 26px; }
653
+ body:has(.pricing-page) .mfooter { height: 885px; margin: 0; border-top: 0; background: #0d0d0d; color: #fff; }
654
+ body:has(.pricing-page) .mfooter-inner { padding-top: 82px; }
655
+ body:has(.pricing-page) .fcol a, body:has(.pricing-page) .flegal { color: #b7b7b7; }
656
+
657
+ /* Deterministic local stand-in for the observed session-dynamic help surface. */
658
+ .synthetic-help { position: fixed; right: 24px; bottom: 24px; z-index: 40; }
659
+ .synthetic-help-panel {
660
+ position: absolute; right: 0; bottom: 60px; width: 322px; height: 126px;
661
+ padding: 10px 17px; border: 1px solid #e9e9e9; border-radius: 17px;
662
+ background: #fff; color: #101010;
663
+ box-shadow: 0 3px 14px rgba(0, 0, 0, .09);
664
+ }
665
+ .synthetic-help-panel[hidden] { display: none; }
666
+ .synthetic-help-copy {
667
+ margin: 0; font-family: Arial, sans-serif; font-size: 15px;
668
+ font-weight: 400; line-height: 22px; letter-spacing: 0;
669
+ }
670
+ .synthetic-help-close {
671
+ position: absolute; right: 5px; top: 3px; width: 20px; height: 20px;
672
+ padding: 0; border: 0; border-radius: 50%; background: transparent;
673
+ color: #777; font: 16px/20px Arial, sans-serif; cursor: pointer; opacity: .35;
674
+ }
675
+ .synthetic-help-launcher {
676
+ width: 153px; height: 48px; margin-left: 169px; padding: 0 13px;
677
+ display: flex; align-items: center; justify-content: center; gap: 12px;
678
+ border: 1px solid #0d0d0d; border-radius: 999px; background: #fff;
679
+ color: #101010; font: 14px/1 Arial, sans-serif; cursor: pointer;
680
+ }
681
+ .synthetic-help-mark { position: relative; width: 27px; height: 26px; flex: 0 0 27px; }
682
+ .synthetic-help-mark i { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: #ff5b57; }
683
+ .synthetic-help-mark i:nth-child(1) { left: 9px; top: 0; }
684
+ .synthetic-help-mark i:nth-child(2) { left: 2px; top: 12px; }
685
+ .synthetic-help-mark i:nth-child(3) { right: 2px; top: 12px; }
686
+ .synthetic-help .mobile-copy { display: none; }
687
+
688
+ /* footer */
689
+ .mfooter { border-top: 1px solid var(--line); background: var(--bg-warm); margin-top: 2rem; }
690
+ .mfooter-inner { max-width: 72rem; margin: 0 auto; padding: 2.5rem 1.2rem; }
691
+ .fbrand { display: flex; align-items: center; gap: .45rem; font-weight: 700; font-size: 1.2rem; margin-bottom: 1.4rem; }
692
+ .fcols { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1.4rem; }
693
+ .fcol h4 { margin: 0 0 .6rem; font-size: .9rem; }
694
+ .fcol a { display: block; color: var(--ink-soft); font-size: .9rem; padding: .22rem 0; }
695
+ .fcol a:hover { color: var(--ink); }
696
+ .flegal { color: var(--ink-soft); font-size: .8rem; margin-top: 2rem; }
697
+ .mfooter-home { margin:0; border:0; background:#0d0d0d; color:#fff; }
698
+ .mfooter-home .mfooter-inner { max-width:1134px; padding:78px 0 54px; border-top:1px solid #383838; }
699
+ .mfooter-home .fbrand { margin-bottom:45px; }
700
+ .mfooter-home .fbrand svg { width:27px; height:27px; }
701
+ .mfooter-home .fcols { grid-template-columns:repeat(5,1fr); gap:32px; }
702
+ .mfooter-home .fcol h4 { margin-bottom:18px; font-size:13px; color:#fff; }
703
+ .mfooter-home .fcol a { color:#d0d0d0; font-size:12px; line-height:17px; padding:5px 0; }
704
+ .mfooter-home .fcol a:hover { color:#fff; }
705
+ .flegal-row { margin-top:68px; padding-top:28px; border-top:1px solid #383838; display:flex; align-items:center; gap:18px; color:#c7c7c7; font-size:11px; }
706
+ .flegal-row a { color:inherit; }
707
+ .fsocial { display:flex; gap:8px; margin-left:auto; }
708
+ .fsocial a { width:25px; height:25px; display:flex; align-items:center; justify-content:center; border-radius:50%; background:#fff; color:#111; font-weight:700; }
709
+ .fapp-row { margin-top:17px; display:flex; gap:10px; }
710
+ .fapp-row a { padding:7px 12px; border:1px solid #777; border-radius:5px; color:#fff; font-size:11px; }
711
+
712
+ /* ------------------------------------------------ auth pages */
713
+ .authpage { background: #fff; min-height: 100vh; display: flex; flex-direction: column; }
714
+ .auth-logo { padding: 1.4rem 2rem; }
715
+ .auth-logo a { display: inline-flex; align-items: center; gap: .45rem; font-size: 1.45rem; font-weight: 700; letter-spacing: -.02em; }
716
+ .auth-main { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 3.5rem 1.2rem 2rem; }
717
+ .auth-card { width: 100%; max-width: 25rem; text-align: center; }
718
+ .auth-card h2 { font-size: 1.6rem; letter-spacing: -.02em; }
719
+ .auth-card h3 { font-size: 1rem; font-weight: 400; color: var(--ink-soft); margin-bottom: 1.6rem; }
720
+ .sso-row { display: flex; gap: .8rem; }
721
+ .sso { flex: 1; border: 1px solid #cfcbcb; background: #fff; border-radius: var(--radius); padding: .7rem; cursor: pointer; display: flex; justify-content: center; }
722
+ .sso:hover { border-color: var(--ink); }
723
+ .or-rule { display: flex; align-items: center; gap: .8rem; color: var(--ink-soft); margin: 1.1rem 0; font-size: .9rem; }
724
+ .or-rule::before, .or-rule::after { content: ""; flex: 1; height: 1px; background: var(--line); }
725
+ .field { text-align: left; margin-bottom: .9rem; }
726
+ .field label { display: block; font-size: .85rem; margin-bottom: .3rem; color: var(--ink); }
727
+ .field input { width: 100%; padding: .7rem .8rem; border: 1px solid #cfcbcb; border-radius: var(--radius); font-size: 1rem; }
728
+ .field input:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
729
+ .hint { font-size: .78rem; color: var(--ink-soft); margin: .3rem 0 0; }
730
+ .form-error { color: #c92f54; font-size: .88rem; text-align: left; margin: .2rem 0 .8rem; }
731
+ .auth-card .btn.primary { background: var(--blue); }
732
+ .auth-card .btn.primary:hover { background: #3a63b8; }
733
+ .auth-alt { margin-top: 1.4rem; font-size: .92rem; }
734
+ .auth-alt a { color: var(--blue); }
735
+ .auth-alt span { color: var(--ink-soft); padding: 0 .2rem; }
736
+ .auth-fineprint { color: var(--ink-soft); font-size: .78rem; max-width: 25rem; margin: 1rem auto 0; text-align: center; }
737
+ .local-outbox { border: 1px dashed #cfcbcb; border-radius: var(--radius); background: var(--bg-warm); padding: .8rem; font-size: .9rem; text-align: left; margin-bottom: 1rem; }
738
+ .local-outbox .code { font-weight: 700; font-size: 1.2rem; letter-spacing: .12em; }
739
+ .auth-footer { padding: 1.5rem 2rem 2rem; text-align: center; }
740
+ .auth-footer nav { display: flex; flex-wrap: wrap; gap: .9rem; justify-content: center; }
741
+ .auth-footer nav a { color: var(--ink-soft); font-size: .82rem; }
742
+ .auth-footer nav a:hover { color: var(--ink); }
743
+ .auth-footer p { color: var(--ink-soft); font-size: .75rem; margin-top: .9rem; }
744
+ .hidden { display: none !important; }
745
+
746
+ @media (max-width: 720px) {
747
+ .mnav-links { display: none; position: absolute; top: 100%; left: 0; right: 0;
748
+ background: #fff; border-bottom: 1px solid var(--line); flex-direction: column;
749
+ padding: .8rem 1.2rem; gap: .4rem; }
750
+ .mnav-links.open { display: flex; }
751
+ body.marketing .mnav-link { width:100%; height:46px; padding:0 10px; }
752
+ .mnav-layer { inset:64px 0 0; }
753
+ .mnav-mega-shell { width:calc(100% - 24px); height:calc(100vh - 88px); overflow:auto; }
754
+ .mnav-panel-slot { height:auto; padding:28px 24px; }
755
+ .mnav-panel.is-active { grid-template-columns:1fr; gap:28px; }
756
+ .mnav-panel-product .mnav-group:first-child a { min-height:58px; }
757
+ .mnav-group small { white-space:normal; }
758
+ .mnav-mega-footer { height:auto; padding:22px 24px; flex-direction:column; align-items:flex-start; gap:18px; }
759
+ .mnav-burger { display: block; }
760
+ .mnav-actions .btn.ghost { display: none; }
761
+ .mnav-actions .sales, .mnav-language { display: none; }
762
+ .mnav-inner { height: 64px; padding: 0 20px; }
763
+ body.marketing .mnav { height: 64px; }
764
+ body.marketing .mnav-inner { height: 64px; padding: 0 24px; }
765
+ body.marketing .mnav-logo { order:1; width:136px; height:40px; padding:0 12px; gap:4px; font-size:31px; }
766
+ body.marketing .mnav-actions { order:2; margin-left:auto; }
767
+ body.marketing .mnav-language { display:none; }
768
+ body.marketing .mnav-burger { order:3; width:40px; height:40px; margin-left:8px; padding:0 10px; font-size:0; }
769
+ body.marketing .mnav-burger::before { content:""; display:block; width:16px; height:14px; margin:auto; background:linear-gradient(#111,#111) 0 0/16px 1.5px no-repeat,linear-gradient(#111,#111) 0 6px/16px 1.5px no-repeat,linear-gradient(#111,#111) 0 12px/16px 1.5px no-repeat; }
770
+ body.marketing .mnav-actions .btn.primary { width:95px; min-width:95px; height:40px; min-height:40px; padding:0 12px; font-size:12px; white-space:nowrap; }
771
+ body.marketing .mnav-actions > .btn.primary:not(.sales) { width:95px; min-width:95px; padding:0 12px; }
772
+ .source-home {
773
+ height: 780px; min-height:780px; padding:533px 24px 0; background:none;
774
+ }
775
+ .source-home::before { content:""; position:absolute; z-index:0; left:0; right:0; top:10px; height:492px; background-image:radial-gradient(circle,rgba(13,14,16,.035) 1px,transparent 1.2px); background-size:23px 23px; background-position:3px -1px; -webkit-mask-image:linear-gradient(to bottom,rgba(0,0,0,.5) 0,#000 70px,#000 120px,transparent 230px); mask-image:linear-gradient(to bottom,rgba(0,0,0,.5) 0,#000 70px,#000 120px,transparent 230px); }
776
+ .source-home h1 { width:342px; font-size:48px; line-height:43.2px; letter-spacing:-.96px; }
777
+ .source-home .grad { background:linear-gradient(90deg,#ff514f 0%,#f75f94 48%,#da65ec 100%); -webkit-background-clip:text; background-clip:text; }
778
+ .source-home h2 { width:342px; min-height:54.8px; margin:16px auto 0; font-size:18px; line-height:23.4px; font-weight:300; letter-spacing:.36px; }
779
+ .source-orbit { display:block; height:500px; }
780
+ .source-orbit { transform:translate(-1px,-1px); }
781
+ .orbit-wires { display:none; }
782
+ .mobile-orbit-canvas { display:none; }
783
+ .orbit-mobile-wires { display:block; position:absolute; inset:0; width:390px; height:500px; overflow:visible; }
784
+ body:has(.source-home) .mnav-burger { width:40px; height:40px; margin-left:8px; padding:0 10px; border:0; border-radius:4px; outline:0; }
785
+ body:has(.source-home) .mnav-burger:focus-visible { outline:2px solid #0b67e8; outline-offset:2px; }
786
+ .orbit-mobile-wires path { fill:none; opacity:1; stroke-opacity:1; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; vector-effect:non-scaling-stroke; }
787
+ .orbit-mobile-wires .hot { stroke:#ff6b6b; }
788
+ .orbit-mobile-wires .soft { stroke:#ff8fbc; }
789
+ .orbit-mobile-wires circle { fill:#393939; }
790
+ .source-orbit::before { display:none; }
791
+ /* The headed source capture is at the mobile hero initial animation state:
792
+ connector paths and endpoint dots are visible before the content nodes. */
793
+ .source-home .source-orbit > .orbit-card,
794
+ .source-home .source-orbit > .orbit-chip,
795
+ .source-home .source-orbit > .orbit-node,
796
+ .source-home .source-orbit > .orbit-texture { display:none; }
797
+ .orbit-card { border-radius:8px; }
798
+ .orbit-card { border-color:#d9d9d9; }
799
+ .orbit-card.launch { left:24px; top:56px; width:136px; height:58px; padding:12px 18px; font-size:13px; line-height:15px; }
800
+ .orbit-card.launch::before { content:""; display:block; position:absolute; left:10px; top:56px; width:13px; height:10px; background:#fff; border-left:1px solid #d9d9d9; border-bottom:1px solid #d9d9d9; transform:skewY(-35deg); }
801
+ .orbit-chip.planner { left:113px; top:109px; padding:2px 5px; font-size:8px; background:#b1f0ab; }
802
+ .orbit-chip::before { border-color:#7ee596; }
803
+ .orbit-card.enablement { left:123px; top:159px; width:98px; height:31px; padding:6px 7px; gap:5px; font-size:11px; white-space:nowrap; }
804
+ .orbit-card.enablement i { width:18px; height:18px; flex:0 0 18px; border-radius:4px; background:#306ff6; }
805
+ .orbit-card.enablement i::after { left:4px; right:3px; top:4px; height:1px; box-shadow:0 4px #fff,0 8px #fff; }
806
+ .orbit-card.readiness { left:24px; right:auto; top:204px; width:159px; height:47px; padding:8px 8px 8px 39px; font-size:8px; }
807
+ .orbit-card.readiness b { margin-bottom:3px; white-space:nowrap; }
808
+ .orbit-card.launched { left:106px; right:auto; top:294px; width:181px; height:47px; padding:10px 12px; font-size:15px; white-space:nowrap; gap:8px; }
809
+ .orbit-card.launched i { width:22px; height:22px; flex:0 0 22px; background:#499e4e; }
810
+ .orbit-card.edits { display:none; }
811
+ .campaign-node, .campaign-chip, .bottom-person-one, .bottom-person-two { display:none; }
812
+ .orbit-chip.planner::before { content:""; left:-29px; top:-6px; width:27px; height:27px; border:0; background:no-repeat center/27px 27px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='27' height='27' viewBox='0 0 27 27'%3E%3Ccircle cx='13.5' cy='13.5' r='12' fill='white' stroke='%237ee596' stroke-width='3'/%3E%3Crect x='7.5' y='8' width='12' height='11' rx='3' fill='white' stroke='%230d0e10' stroke-width='1.35'/%3E%3Ccircle cx='10.7' cy='13.5' r='1' fill='%230d0e10'/%3E%3Ccircle cx='16.3' cy='13.5' r='1' fill='%230d0e10'/%3E%3C/svg%3E"); }
813
+ .team-person { left:247px; top:78px; background:radial-gradient(circle at 52% 42%,#e9ac82 0 21%,#181513 22% 38%,transparent 39%),linear-gradient(155deg,#1664a7 0 48%,#f5f5f5 49%); }
814
+ .team-bot { left:290px; top:78px; background:#306ff6; }
815
+ .team-plan { left:324px; top:78px; width:38px; height:38px; background:#f7cbfc; }
816
+ .team-person { width:40px; height:40px; transform:translate(1px,1px); background:#b07a48 no-repeat center/34px 34px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Ccircle cx='18' cy='18' r='18' fill='%23b77d48'/%3E%3Cpath d='M0 36c1-10 8-14 18-14s17 4 18 14' fill='%231267a6'/%3E%3Cellipse cx='18' cy='16' rx='13' ry='16' fill='%23120f0e'/%3E%3Cellipse cx='18' cy='15.5' rx='8' ry='10.5' fill='%23d79c73'/%3E%3Cpath d='M9 15C8 5 13 0 19 0c7 0 11 6 9 16-3-6-8-9-15-8l-4 7z' fill='%23110d0c'/%3E%3Cpath d='M6 13c-1 9 1 16 7 19l1-15-8-4zm24 0c1 9-1 16-7 19l-1-15 8-4z' fill='%23110d0c'/%3E%3Cpath d='M12 27h12l4 9H8l4-9z' fill='white'/%3E%3Cpath d='M8 36l4-9 4 9zm20 0l-4-9-4 9z' fill='%231267a6'/%3E%3Ccircle cx='15' cy='15' r='.85' fill='%23251b17'/%3E%3Ccircle cx='21' cy='15' r='.85' fill='%23251b17'/%3E%3Cpath d='M14.8 21q3.2 2.2 6.4 0' fill='none' stroke='white' stroke-width='.9'/%3E%3C/svg%3E"); }
817
+ .team-bot { width:40px; height:40px; transform:translate(1px,1px); }
818
+ .team-bot::before { content:""; width:27px; height:27px; font-size:0; background:white no-repeat center/27px 27px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='27' height='27' viewBox='0 0 27 27'%3E%3Ccircle cx='13.5' cy='13.5' r='13' fill='white'/%3E%3Cpath d='M7.4 18.2c-2.8-1-3.3-4.4-.9-6.1-.5-3.1 3.2-5.1 5.5-3.1 2-2.3 5.7-.9 5.6 2.2 3 .4 4 4.1 1.4 5.8-1.3 2.6-5 2.8-6.5.5-1.5 1.4-3.6 1.7-5.1.7z' fill='white' stroke='%230d0e10' stroke-width='1.75' stroke-linejoin='round'/%3E%3Cpath d='M10 11.7v3.3m-1.6-1.6h3.2m3.6-1.7V15m-1.6-1.6h3.2' stroke='%230d0e10' stroke-width='1.2' stroke-linecap='round'/%3E%3C/svg%3E"); }
819
+ .team-plan::before { content:""; width:27px; height:27px; background:no-repeat center/27px 27px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='27' height='27' viewBox='0 0 27 27'%3E%3Ccircle cx='13.5' cy='13.5' r='13' fill='white'/%3E%3Cpath d='M8 6.8h11l4 6.7-4 6.7H8l-4-6.7 4-6.7z' fill='white' stroke='%230d0e10' stroke-width='1.8' stroke-linejoin='round'/%3E%3Crect x='10' y='11.6' width='2.1' height='4' rx='.7' fill='%230d0e10'/%3E%3Crect x='15.4' y='11.6' width='2.1' height='4' rx='.7' fill='%230d0e10'/%3E%3C/svg%3E"); }
820
+ .google-node { left:312px; right:auto; top:180px; }
821
+ .google-node::before { content:""; width:28px; height:25px; background:no-repeat center/25px 23px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='25' height='23' viewBox='0 0 25 23'%3E%3Cpath fill='%2334a853' d='M9 1h5l10 17h-6L9 1z'/%3E%3Cpath fill='%23fbbc04' d='M9 1l3 5-8 16H0L9 1z'/%3E%3Cpath fill='%234285f4' d='M4 22l3-6h17l-3 6H4z'/%3E%3C/svg%3E"); text-shadow:none; }
822
+ .orbit-card.readiness::before { content:""; background:#ebf56e no-repeat center/24px 24px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M6 15.5a4.2 4.2 0 0 1 1-8.2 5.4 5.4 0 0 1 9.8-.8 4.3 4.3 0 0 1 1.2 8.6h-3.2v3h-2v-3H9.4v3h-2v-2.6H6z' fill='white' stroke='%230d0e10' stroke-width='1.45' stroke-linejoin='round'/%3E%3Ccircle cx='10.2' cy='11.4' r='.8' fill='%230d0e10'/%3E%3Ccircle cx='14.1' cy='11.4' r='.8' fill='%230d0e10'/%3E%3C/svg%3E"); color:transparent; }
823
+ .orbit-card.launch::after, .team-plan::after, .orbit-card.enablement::before, .orbit-card.readiness::after { display:none; }
824
+ .texture-initial { left:24.118px; top:56.186px; width:138.554px; height:66.413px; }
825
+ .texture-launch { left:84.205px; top:103.429px; width:86.865px; height:28.237px; }
826
+ .texture-avatar1 { left:245.567px; top:76.135px; width:117.191px; height:44.611px; }
827
+ .texture-google { display:none; }
828
+ .google-node { visibility:visible; left:309.969px; right:auto; top:179.235px; width:39.809px; height:40.399px; background:#fff; color:transparent; }
829
+ .google-node::before { display:none; }
830
+ .texture-drive { display:block; left:320.874px; top:188.435px; width:18px; height:22px; }
831
+ .texture-enablement { left:125.321px; top:159.420px; width:97.965px; height:31.781px; }
832
+ .texture-pricing { left:24.765px; right:auto; top:205.530px; width:158.932px; height:47.513px; }
833
+ .texture-launched { left:106.872px; right:auto; top:294.638px; width:181.488px; height:46.156px; }
834
+ .texture-campaign, .texture-avatar2, .texture-approve { display:none; }
835
+ .signup-note, .source-sso, .source-or, .source-signup input, .source-fineprint { display:none; }
836
+ .source-signup { position:fixed; z-index:35; left:64px; bottom:0; width:262px; height:46px; margin:0; display:block; }
837
+ .source-signup button { width:262px; height:46px; border-radius:999px; }
838
+ .source-signup .desktop-label { display:none; }
839
+ .source-signup .mobile-label { display:inline; }
840
+ .home-synthetic-help { display:none; }
841
+ .home-synthetic-launcher { width:154px; height:48px; display:flex; align-items:center; justify-content:center; gap:10px; border:1px solid #111; border-radius:999px; background:#fff; font:14px/1 Arial,sans-serif; }
842
+ .home-synthetic-panel { position:absolute; right:0; bottom:58px; width:322px; min-height:84px; padding:14px 16px; border:1px solid #e9e9e9; border-radius:17px; background:#fff; box-shadow:0 3px 14px rgba(0,0,0,.09); }
843
+ .home-synthetic-panel button { position:absolute; right:7px; top:5px; border:0; background:transparent; }
844
+ .home-synthetic-panel p { margin:0; font-size:14px; line-height:22px; }
845
+ .home-trust { width:342px; min-height:360px; grid-template-columns:1fr; gap:30px; padding:58px 0; }
846
+ .home-trust p { font-size:21px; line-height:24px; }
847
+ .home-logos { display:grid; grid-template-columns:repeat(3,1fr); gap:26px 16px; }
848
+ .home-logos span { font-size:14px; }
849
+ .home-logos .dell-logo { width:44px; height:44px; }
850
+ .home-section-heading h2, .home-teammates h2, .home-productivity h2, .home-get-started h2, .home-recognition h2, .home-bottom-cta h2 { font-size:42px; line-height:44px; letter-spacing:-.8px; }
851
+ .home-ai-story { width:342px; padding-bottom:90px; }
852
+ .home-section-heading { min-height:250px; padding-bottom:45px; }
853
+ .home-section-heading h2 { width:342px; }
854
+ .ai-story-layout { grid-template-columns:1fr; gap:34px; }
855
+ .ai-story-stage { min-height:420px; padding:24px; }
856
+ .ai-story-stage h3 { font-size:24px; }
857
+ .ai-story-stage img { left:24px; right:24px; bottom:82px; width:calc(100% - 48px); height:235px; }
858
+ .ai-stage-route { left:20px; right:20px; bottom:25px; gap:6px; }
859
+ .ai-stage-route i { padding:6px 8px; font-size:9px; }
860
+ .ai-story-tab span { font-size:18px; }
861
+ .home-teammates { padding:90px 24px 100px; }
862
+ .teammates-intro { display:block; }
863
+ .teammates-intro p { font-size:16px; line-height:24px; }
864
+ .teammates-intro a { margin-top:24px; }
865
+ .teammate-rail { margin-top:45px; grid-template-columns:none; grid-auto-flow:column; grid-auto-columns:250px; overflow-x:auto; padding-bottom:16px; }
866
+ .teammate-card { min-height:405px; }
867
+ .home-productivity { padding:92px 0 100px; }
868
+ .productivity-inner { width:342px; }
869
+ .productivity-tabs { margin-top:38px; justify-content:flex-start; }
870
+ .productivity-tab { padding:0 15px; font-size:11px; }
871
+ .productivity-stage { height:auto; grid-template-columns:1fr; gap:14px; }
872
+ .productivity-side { display:none; }
873
+ .productivity-main { min-height:470px; padding:20px; }
874
+ .productivity-main>div { min-height:160px; }
875
+ .productivity-main h3 { font-size:20px; }
876
+ .productivity-main p { font-size:13px; }
877
+ .productivity-main img { height:250px; }
878
+ .home-case { width:342px; padding:78px 0 90px; }
879
+ .case-connector, .recognition-connector { margin-bottom:32px; }
880
+ .case-grid { grid-template-columns:1fr; }
881
+ .case-image { height:245px; }
882
+ .case-grid blockquote>p { font-size:24px; line-height:30px; }
883
+ .home-get-started { width:342px; min-height:0; margin-bottom:90px; padding:40px 22px; grid-template-columns:1fr; gap:36px; }
884
+ .home-get-started nav a { min-height:106px; padding:20px; }
885
+ .home-get-started nav strong { font-size:18px; }
886
+ .home-get-started nav b { width:40px; height:40px; }
887
+ .home-recognition { width:342px; padding-bottom:95px; }
888
+ .award-grid { grid-template-columns:1fr; }
889
+ .award-art { height:245px; }
890
+ .gartner-grid { width:150px; height:150px; }
891
+ .award-g2 { gap:9px; padding:18px; }
892
+ .award-g2 span>i { min-height:125px; padding:12px 3px; border-width:3px; font-size:10px; }
893
+ .award-g2 strong { font-size:20px; }
894
+ .home-bottom-cta { min-height:480px; padding:82px 24px; }
895
+ .home-bottom-cta h2 { font-size:44px; line-height:46px; }
896
+ .home-bottom-cta p { margin-top:90px; }
897
+ .mfooter-home .mfooter-inner { width:342px; padding:60px 0 44px; }
898
+ .mfooter-home .fcols { grid-template-columns:1fr 1fr; gap:38px 26px; }
899
+ .flegal-row { align-items:flex-start; flex-wrap:wrap; }
900
+ .fsocial { width:100%; margin:8px 0 0; order:5; }
901
+ .product-contract { height:920px; padding-top:46px; }
902
+ body:has(.product-contract) { color:#0d0d0d; }
903
+ .product-title-desktop { display:none; }
904
+ .product-title-mobile { display:inline; }
905
+ .product-contract h1 { width:340px; font-size:38px; line-height:38px; letter-spacing:-.76px; position:relative; top:2px; }
906
+ .product-lead { width:340px; margin-top:18px; font-size:15px; line-height:22.5px; letter-spacing:.3px; }
907
+ .product-lead br { display:none; }
908
+ .product-sso { gap:8px; margin-top:16px; }
909
+ .product-sso a { width:166px; height:69px; font-size:15px; }
910
+ .product-or { width:340px; margin-top:25px; }
911
+ .product-signup { width:340px; margin-top:26px; position:relative; top:1px; }
912
+ .product-signup input { width:340px; height:47px; padding:12px 16px; border-radius:4px; font-size:14px; line-height:21px; letter-spacing:.28px; }
913
+ .product-signup button { width:340px; height:55px; margin-top:16px; padding:16px 32px; border:0; font-size:14px; line-height:21px; }
914
+ .product-fine { width:340px; margin:17px auto 0; font-size:12px; line-height:18px; font-weight:300; letter-spacing:.24px; }
915
+ body:has(.product-contract) .mnav-actions > .btn.primary:not(.sales) { width:94px; min-width:94px; padding:0 16px; border:0; line-height:18px; }
916
+ .product-source-visual { left:25px; top:631px; width:340px; height:auto; border-radius:8px; }
917
+ .product-synthetic-visual { left:25px; top:631px; width:340px; height:146px; border-radius:8px;
918
+ background:
919
+ radial-gradient(ellipse at 3% 48%,rgba(28,83,37,.86) 0 5%,transparent 16%),
920
+ radial-gradient(ellipse at 46% 20%,rgba(45,31,22,.7) 0 4%,transparent 12%),
921
+ radial-gradient(ellipse at 97% 58%,rgba(25,24,22,.72) 0 4%,transparent 13%),
922
+ linear-gradient(90deg,#486849 0 5%,#ddd9d1 5% 15%,#c9b8a6 15% 32%,#dfd2c3 32% 49.3%,#fff 49.3% 50.7%,#a66e49 50.7% 59%,#cd8b64 59% 72%,#6f3e29 72% 86%,#a65b34 86% 97%,#25221e 97% 100%); }
923
+ .product-synthetic-visual::before,.product-synthetic-visual::after { bottom:-9px; width:94px; height:135px; }
924
+ .product-synthetic-visual::before { left:38px; }.product-synthetic-visual::after { right:32px; }
925
+ .product-synthetic-visual b { top:39px; width:95px; height:71px; border-width:3px; }
926
+ .product-depth { height:1800px; padding:100px 24px; }.product-depth h2{font-size:44px;line-height:46px}
927
+ .solutions-hero { min-height: 620px; padding: 90px 24px 70px; }
928
+ .solutions-hero h1 { font-size: 46px; line-height: 48px; }.solutions-hero > p:not(.solutions-kicker) { font-size: 18px; line-height: 27px; }
929
+ .solutions-hero > div { flex-direction: column; align-items: stretch; }
930
+ .solutions-grid { padding: 64px 24px 90px; grid-template-columns: 1fr; }.solutions-grid article { min-height: 340px; padding: 28px; }
931
+ .solutions-grid h2 { margin-top: 52px; font-size: 34px; }
932
+ .solutions-band { min-height: 980px; padding: 96px 24px; }.solutions-band > h2 { margin-bottom: 70px; font-size: 44px; line-height: 47px; }
933
+ .solutions-band > div { grid-template-columns: 1fr; gap: 44px; }
934
+ .solutions-proof { min-height: 720px; padding: 110px 24px; }.solutions-proof h2 { font-size: 44px; line-height: 47px; }
935
+ .solutions-final { min-height: 520px; padding: 120px 24px; }.solutions-final h2 { font-size: 46px; }
936
+ .shot-body { grid-template-columns: 1fr; }
937
+ .shot-side { display: none; }
938
+
939
+ body:has(.pricing-page) .mnav { position: relative; height: 64px; }
940
+ body:has(.pricing-page) .mnav-inner { height: 64px; padding: 0 24px; }
941
+ body:has(.pricing-page) .mnav-logo {
942
+ order: 1; width: 136px; height: 40px; padding: 0 12px; gap: 5px;
943
+ font-size: 30px; font-weight: 500; line-height: 1;
944
+ }
945
+ body:has(.pricing-page) .mnav-logo svg { width:112px; height:22px; }
946
+ body:has(.pricing-page) .mnav-actions { order: 2; margin-left: auto; }
947
+ body:has(.pricing-page) .mnav-burger { order: 3; margin-left: 8px; padding: 0 10px; width: 40px; height: 40px; font-size: 0; }
948
+ body:has(.pricing-page) .mnav-burger::before { content: "☰"; font-size: 20px; }
949
+ body:has(.pricing-page) .mnav-links { order: 4; }
950
+ body:has(.pricing-page) .mnav-actions .upgrade,
951
+ body:has(.pricing-page) .mnav-actions .mnav-language { display: none; }
952
+ body:has(.pricing-page) .pricing-sales-link { display: none; }
953
+ body:has(.pricing-page) .mnav-actions .sales {
954
+ display: inline-flex; width: 95px; min-width: 95px; min-height: 40px; height: 40px;
955
+ padding: 0 12px; font-size: 12px; line-height: 12px; white-space: nowrap;
956
+ }
957
+ .pricing-page > section { width: 340px; max-width: none; }
958
+ .pricing-hero { height: 172px; }
959
+ .pricing-hero h1 {
960
+ width: 340px; height: 76px; margin-top: 48px; font-size: 38px;
961
+ line-height: 38px; letter-spacing: -.76px;
962
+ }
963
+ .pricing-hero h1 br { display: none; }
964
+ .pricing-plans { height: 675px; }
965
+ .billing-toggle { display: none; }
966
+ .pricing-page .tiers {
967
+ width: calc(100vw - 28px); height: 675px; margin-left: 3px; padding: 0;
968
+ display: flex; gap: 12px; overflow-x: auto; overflow-y: hidden;
969
+ scrollbar-width: none; scroll-snap-type: x mandatory;
970
+ }
971
+ .pricing-page .tiers::-webkit-scrollbar { display: none; }
972
+ .pricing-page .tier {
973
+ flex: 0 0 340px; min-height: 654.5px; height: 654.5px; padding: 20px;
974
+ border-radius: 16px; scroll-snap-align: start;
975
+ }
976
+ .pricing-page .tier h3 { font-size: 23px; line-height: 23px; letter-spacing: -.23px; }
977
+ .pricing-page .tier-desc {
978
+ min-height: 39px; margin-top: 16px; font-size: 13px; line-height: 19.5px;
979
+ }
980
+ .pricing-page .tier .price {
981
+ margin-top: 51.5px; font-size: 30px; line-height: 36px;
982
+ }
983
+ .pricing-page .tier .per { min-height: 39px; margin-top: 8px; }
984
+ .pricing-page .tier .btn {
985
+ height: 40px; margin-top: 24px; padding: 12px 24px; font-size: 14px;
986
+ line-height: 14px;
987
+ }
988
+ .pricing-page .desktop-cta { display: none; }
989
+ .pricing-page .mobile-cta { display: inline; }
990
+ .pricing-page .purchase { height: 56px; }
991
+ .pricing-page .purchase:not(.placeholder) { font-size: 12px; }
992
+ .pricing-page .tier ul { margin-top: 26px; font-size: 13px; line-height: 19.5px; }
993
+ .pricing-page .tier-personal li:first-child { margin-bottom: 22px; color: #0d0d0d; }
994
+ .pricing-page .tier-personal li:first-child::before { content: none; }
995
+ .pricing-page .tier li::before { margin-right: 17px; color: #50c878; }
996
+ .pricing-note { height: 96px; }
997
+ .pricing-note p { font-size: 16px; line-height: 22px; }
998
+ .pricing-addons {
999
+ height: 2396px; display: grid; grid-template-columns: 1fr;
1000
+ grid-template-rows: repeat(4, 599px); column-gap: 0;
1001
+ }
1002
+ .pricing-addon { padding: 72px 20px; }
1003
+ .pricing-addon h3 { font-size: 30px; line-height: 36px; }
1004
+ .pricing-addon p { width: auto; }
1005
+ .pricing-loved { height: 246px; display: block; padding-top: 48px; }
1006
+ .pricing-loved h4 { width: auto; font-size: 26px; line-height: 32px; }
1007
+ .logo-dots { margin-top: 34px; font-size: 28px; word-spacing: 6px; }
1008
+ .pricing-faq {
1009
+ height: 1024px; display: block; padding-top: 48px;
1010
+ }
1011
+ .pricing-faq h2 { font-size: 38px; line-height: 38px; }
1012
+ .faq-list { padding: 24px 0 0; }
1013
+ .faq-list details { padding: 24px 0; }
1014
+ body:has(.pricing-page) .mfooter { height: 2194px; }
1015
+ .synthetic-help-panel {
1016
+ bottom: 59px; width: 322px; height: 84px; padding: 10px 16px;
1017
+ }
1018
+ .synthetic-help .desktop-copy { display: none; }
1019
+ .synthetic-help .mobile-copy { display: block; }
1020
+ .synthetic-help-launcher { width: 154px; height: 48px; margin-left: 168px; }
1021
+ }
tasks/asana/environment/reference/clone/websitebench/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ """Vendored WebsiteBench runtime modules."""
tasks/asana/environment/reference/compile.sh ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ set -Eeuo pipefail
3
+ root="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
4
+ cp "$root/harbor_entry.py" "$root/executable"
5
+ chmod 755 "$root/executable"
tasks/asana/environment/reference/harbor_entry.py ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ from __future__ import annotations
3
+
4
+ import os
5
+ import random
6
+ import sys
7
+ import time
8
+ from pathlib import Path
9
+ from typing import Any
10
+
11
+ ROOT = Path(__file__).resolve().parent
12
+ sys.path.insert(0, str(ROOT / "vendor"))
13
+
14
+ import uvicorn # noqa: E402
15
+
16
+ SITE_ID = "asana"
17
+ DATABASE_NAME = "asana.sqlite3"
18
+ # The session identity this adapter runs with. Harbor reads the cookie off the
19
+ # wire; this names the same contract in the executable and fails the runtime
20
+ # closed if the projected backend ever stops scoping the session to this site
21
+ # or stops hardening it.
22
+ asana_session_cookie = "websitebench-asana-session"
23
+ asana_session_policy = dict(httponly=True, samesite="lax", path="/")
24
+ PAYMENT_ADAPTER = "disabled"
25
+ payment_profile = "no-payment-external-effects"
26
+ FORBIDDEN_PAYMENT_ADAPTERS = ("local-sandbox", "stripe-test", "live")
27
+ MAIL_TRANSPORT = "local-sidecar"
28
+ migration_version = 1
29
+ status_code = 200
30
+ required_invariants = (
31
+ "asana.offline-closure",
32
+ "asana.auth-protection",
33
+ "asana.persistence",
34
+ "asana.no-false-success",
35
+ )
36
+ if PAYMENT_ADAPTER in FORBIDDEN_PAYMENT_ADAPTERS:
37
+ raise SystemExit("Asana payments must remain disabled")
38
+ contract_headers = {
39
+ "X-WebsiteBench-Site": SITE_ID,
40
+ "X-WebsiteBench-Database": DATABASE_NAME,
41
+ "X-WebsiteBench-Migration": str(migration_version),
42
+ "X-WebsiteBench-Payment-Adapter": PAYMENT_ADAPTER,
43
+ "X-WebsiteBench-Mail-Transport": MAIL_TRANSPORT,
44
+ }
45
+
46
+ for name in ("HOST", "PORT", "DATA_DIR", "SEED", "TZ"):
47
+ if not os.environ.get(name):
48
+ raise SystemExit(f"{name} is required")
49
+ data_dir = Path(os.environ["DATA_DIR"])
50
+ if not data_dir.is_absolute():
51
+ raise SystemExit("DATA_DIR must be absolute")
52
+ data_dir.mkdir(parents=True, exist_ok=True)
53
+ try:
54
+ random.seed(int(os.environ["SEED"]))
55
+ except ValueError:
56
+ raise SystemExit("SEED must be an integer") from None
57
+ if hasattr(time, "tzset"):
58
+ time.tzset()
59
+
60
+ os.environ["WEBSITEBENCH_SITE_BACKEND_DATABASE"] = str(data_dir / DATABASE_NAME)
61
+ os.environ["WEBSITEBENCH_SITE_BACKEND_RUNTIME"] = str(ROOT / "backend/runtime.json")
62
+ os.environ["WEBSITEBENCH_LOCAL_HTTP_COOKIE"] = "1"
63
+ os.environ["WEBSITEBENCH_DEPLOYMENT_PROFILE"] = "offline-harbor"
64
+ os.environ["WEBSITEBENCH_PAYMENT_PROFILE"] = PAYMENT_ADAPTER
65
+ os.environ["WEBSITEBENCH_DATA_DIR"] = str(data_dir)
66
+ os.environ["PYTHONDONTWRITEBYTECODE"] = "1"
67
+ for name in (
68
+ "STRIPE_SECRET_KEY",
69
+ "STRIPE_WEBHOOK_SECRET",
70
+ "STRIPE_TEST_SECRET_KEY",
71
+ "STRIPE_TEST_WEBHOOK_SECRET",
72
+ ):
73
+ os.environ.pop(name, None)
74
+
75
+ sys.dont_write_bytecode = True
76
+ sys.path.insert(0, str(ROOT / "clone"))
77
+
78
+ from websitebench.site_backend.runtime import load_runtime # noqa: E402
79
+
80
+ _session_contract = load_runtime(ROOT / "backend" / "runtime.json")
81
+ if _session_contract.cookie_name.removeprefix("__Host-") != asana_session_cookie:
82
+ raise SystemExit("Asana session cookie is not scoped to this site")
83
+ _session_options = _session_contract.cookie_options
84
+ if not _session_options["httponly"] or str(
85
+ _session_options["samesite"]
86
+ ).lower() != asana_session_policy["samesite"]:
87
+ raise SystemExit("Asana session cookie is not hardened")
88
+ if _session_options["path"] != asana_session_policy["path"]:
89
+ raise SystemExit("Asana session cookie is not host-scoped to the root path")
90
+
91
+ import app as clone_app # noqa: E402
92
+ from starlette.responses import JSONResponse # noqa: E402
93
+
94
+ HEALTH_PATHS = {"/healthz", "/__websitebench/health"}
95
+
96
+
97
+ @clone_app.app.middleware("http")
98
+ async def harbor_contract(request: Any, call_next: Any):
99
+ response = (
100
+ JSONResponse({"status": "ok"})
101
+ if request.url.path in HEALTH_PATHS
102
+ else await call_next(request)
103
+ )
104
+ for name, value in contract_headers.items():
105
+ response.headers[name] = value
106
+ if request.url.path not in HEALTH_PATHS:
107
+ response.headers["X-WebsiteBench-Invariants"] = ",".join(required_invariants)
108
+ configured_status = int(
109
+ os.environ.get("WEBSITEBENCH_HARBOR_STATUS_CODE", str(status_code))
110
+ )
111
+ if configured_status != 200 and request.url.path not in HEALTH_PATHS:
112
+ response.status_code = configured_status
113
+ return response
114
+
115
+
116
+ if __name__ == "__main__":
117
+ uvicorn.run(
118
+ clone_app.app,
119
+ host=os.environ["HOST"],
120
+ port=int(os.environ["PORT"]),
121
+ log_level="warning",
122
+ timeout_graceful_shutdown=2,
123
+ )