AgPerry commited on
Commit
8ba65bb
·
verified ·
1 Parent(s): f29b547

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/backcountry/environment/agent-browser/browser-use +128 -0
  2. tasks/backcountry/environment/agent-browser/gateway.py +305 -0
  3. tasks/backcountry/environment/candidate-abi/websitebench-candidate-preflight +5 -0
  4. tasks/backcountry/environment/mailbox/Dockerfile +5 -0
  5. tasks/backcountry/environment/mailbox/mailbox.py +2433 -0
  6. tasks/backcountry/environment/reference/.websitebench-reference-tls/ca.crt +20 -0
  7. tasks/backcountry/environment/reference/.websitebench-reference-tls/reference.crt +20 -0
  8. tasks/backcountry/environment/reference/.websitebench-reference-tls/reference.key +28 -0
  9. tasks/backcountry/environment/reference/.websitebench-reference-tls/tls_proxy.py +164 -0
  10. tasks/backcountry/environment/reference/Dockerfile +19 -0
  11. tasks/backcountry/environment/reference/README.md +5 -0
  12. tasks/backcountry/environment/reference/backend/model.json +846 -0
  13. tasks/backcountry/environment/reference/backend/runtime.json +104 -0
  14. tasks/backcountry/environment/reference/clone/app.py +790 -0
  15. tasks/backcountry/environment/reference/clone/backend/site_backend_integration.py +112 -0
  16. tasks/backcountry/environment/reference/clone/catalog.py +440 -0
  17. tasks/backcountry/environment/reference/clone/data/catalog-missing.json +42 -0
  18. tasks/backcountry/environment/reference/clone/data/catalog.json +0 -0
  19. tasks/backcountry/environment/reference/clone/data/chrome.json +283 -0
  20. tasks/backcountry/environment/reference/clone/data/home.json +1194 -0
  21. tasks/backcountry/environment/reference/clone/data/landings.json +202 -0
  22. tasks/backcountry/environment/reference/clone/data/nav.json +3509 -0
  23. tasks/backcountry/environment/reference/clone/requirements.txt +4 -0
  24. tasks/backcountry/environment/reference/clone/sanitize.py +102 -0
  25. tasks/backcountry/environment/reference/clone/sitepack.py +450 -0
  26. tasks/backcountry/environment/reference/clone/static/assets/brand/gearhead-top-pick.svg +53 -0
  27. tasks/backcountry/environment/reference/clone/static/assets/brand/icons.json +1 -0
  28. tasks/backcountry/environment/reference/clone/static/assets/brand/logo.svg +1 -0
  29. tasks/backcountry/environment/reference/clone/static/assets/cms/6656310940a36ddf57dbeb72-1_1_Outdoor_Research.jpg-w450 +0 -0
  30. tasks/backcountry/environment/reference/clone/static/assets/cms/66563109fab32508ce34d58a-1_1_Patagonia.jpg-w450 +0 -0
  31. tasks/backcountry/environment/reference/clone/static/assets/cms/665898d0e4a7322dd7978c8e-2_1_returns.jpg-w450 +0 -0
  32. tasks/backcountry/environment/reference/clone/static/assets/cms/6674615b1ae3c1391f0668f9-Salomon.jpg-w450 +0 -0
  33. tasks/backcountry/environment/reference/clone/static/assets/cms/66a7be00bb95123280021e73-Black_Diamond.jpg-w450 +0 -0
  34. tasks/backcountry/environment/reference/clone/static/assets/cms/675b7559ea6bc637e91871ff-Fjall.jpg-w450 +0 -0
  35. tasks/backcountry/environment/reference/clone/static/assets/cms/67630356117e7e1fe846dd2f-Gearhead_Articles.jpg-w450 +3 -0
  36. tasks/backcountry/environment/reference/clone/static/assets/cms/67630356ea6bc69018189da9-Backcountry_Podcasts.jpg-w450 +3 -0
  37. tasks/backcountry/environment/reference/clone/static/assets/cms/677eb2a5bf0f6821ac69d33d-TNF.png-w450 +0 -0
  38. tasks/backcountry/environment/reference/clone/static/assets/cms/679bf2144ddeea83bac81c04-2_1_free_shipping.jpg-w450 +0 -0
  39. tasks/backcountry/environment/reference/clone/static/assets/cms/67d34c1fcb17a22d46903016-Backcountry_Bulletin_main.jpg-w450 +3 -0
  40. tasks/backcountry/environment/reference/clone/static/assets/cms/690bf11337acaee80a5ac231-Card_3x4_GH-Adventure-1.jpg-w450 +3 -0
  41. tasks/backcountry/environment/reference/clone/static/assets/cms/690bf115e56f964b105a0382-Card_3x4_GH-Adventure-4.jpg-w450 +3 -0
  42. tasks/backcountry/environment/reference/clone/static/assets/cms/690bf11a73e076dc122b3d7f-Card_3x4_GH-Adventure-5.jpg-w450 +3 -0
  43. tasks/backcountry/environment/reference/clone/static/assets/cms/690bf11e05acfe73880fbd64-Card_3x4_GH-Adventure-3.jpg-w450 +3 -0
  44. tasks/backcountry/environment/reference/clone/static/assets/cms/690bf11fd3150572106ac9e2-Card_3x4_GH-Adventure-2.jpg-w450 +3 -0
  45. tasks/backcountry/environment/reference/clone/static/assets/cms/6969403d7d6f880008c57811-2_1_SC_V4.jpg-w450 +0 -0
  46. tasks/backcountry/environment/reference/clone/static/assets/cms/69a0bb9af41d202befd3c90b-Rain.jpeg-w450 +3 -0
  47. tasks/backcountry/environment/reference/clone/static/assets/cms/69a0bb9b47c5b03fbdc85871-Destination.jpeg-w450 +3 -0
  48. tasks/backcountry/environment/reference/clone/static/assets/cms/69a0bb9bb9f0f2c78e3240b6-Fleece.jpeg-w450 +3 -0
  49. tasks/backcountry/environment/reference/clone/static/assets/cms/69a0bb9cb9f0f279273240ba-Shop_All.jpeg-w450 +3 -0
  50. tasks/backcountry/environment/reference/clone/static/assets/cms/69a0bb9cba238f747f2f4ccd-Wasatch.jpeg-w450 +3 -0
tasks/backcountry/environment/agent-browser/browser-use ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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 main() -> int:
85
+ translated = _translate_candidate_origin(sys.argv[1:])
86
+ arguments, local_screenshot, shared_screenshot = _prepare_screenshot(translated)
87
+ request = urllib.request.Request(
88
+ GATEWAY_URL,
89
+ data=json.dumps({"argv": arguments}, separators=(",", ":")).encode("utf-8"),
90
+ headers={"Content-Type": "application/json"},
91
+ method="POST",
92
+ )
93
+ try:
94
+ with urllib.request.urlopen(request, timeout=240) as response:
95
+ payload = json.load(response)
96
+ except urllib.error.HTTPError as exc:
97
+ try:
98
+ detail = json.loads(exc.read().decode("utf-8")).get("error")
99
+ except (UnicodeError, ValueError, AttributeError):
100
+ detail = None
101
+ print(detail or f"Browser Use gateway refused the command (HTTP {exc.code})", file=sys.stderr)
102
+ return 2
103
+ except (OSError, UnicodeError, ValueError) as exc:
104
+ print(f"Browser Use gateway unavailable: {exc}", file=sys.stderr)
105
+ return 2
106
+
107
+ stdout = payload.get("stdout", "")
108
+ stderr = payload.get("stderr", "")
109
+ if isinstance(stdout, str) and stdout:
110
+ print(stdout, end="" if stdout.endswith("\n") else "\n")
111
+ if isinstance(stderr, str) and stderr:
112
+ print(stderr, end="" if stderr.endswith("\n") else "\n", file=sys.stderr)
113
+
114
+ if local_screenshot is not None and shared_screenshot is not None:
115
+ try:
116
+ local_screenshot.parent.mkdir(parents=True, exist_ok=True)
117
+ shutil.copyfile(shared_screenshot, local_screenshot)
118
+ shared_screenshot.unlink(missing_ok=True)
119
+ except OSError as exc:
120
+ print(f"Browser screenshot transfer failed: {exc}", file=sys.stderr)
121
+ return 2
122
+
123
+ exit_code = payload.get("exit_code", 2)
124
+ return exit_code if isinstance(exit_code, int) and 0 <= exit_code <= 255 else 2
125
+
126
+
127
+ if __name__ == "__main__":
128
+ raise SystemExit(main())
tasks/backcountry/environment/agent-browser/gateway.py ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+
11
+ from __future__ import annotations
12
+
13
+ import json
14
+ import os
15
+ import re
16
+ import subprocess
17
+ import threading
18
+ import urllib.parse
19
+ from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
20
+ from pathlib import Path
21
+ from typing import Any
22
+
23
+
24
+ MAX_REQUEST_BYTES = 64 * 1024
25
+ MAX_OUTPUT_BYTES = 4 * 1024 * 1024
26
+ COMMAND_TIMEOUT_SEC = 180
27
+ SESSION_PATTERN = re.compile(r"[A-Za-z0-9][A-Za-z0-9_.-]{0,63}\Z")
28
+ SHARED_ROOT = Path("/browser-share").resolve()
29
+ REAL_BROWSER_USE = os.environ.get(
30
+ "WEBSITEBENCH_BROWSER_USE_REAL",
31
+ "/usr/local/bin/browser-use-real",
32
+ )
33
+ SAFE_COMMANDS = frozenset(
34
+ {
35
+ "open",
36
+ "click",
37
+ "type",
38
+ "input",
39
+ "scroll",
40
+ "back",
41
+ "screenshot",
42
+ "state",
43
+ "switch",
44
+ "close-tab",
45
+ "keys",
46
+ "select",
47
+ "hover",
48
+ "dblclick",
49
+ "rightclick",
50
+ "cookies",
51
+ "close",
52
+ "sessions",
53
+ }
54
+ )
55
+ FORBIDDEN_COMMANDS = frozenset(
56
+ {
57
+ "install",
58
+ "init",
59
+ "setup",
60
+ "doctor",
61
+ "upload",
62
+ "eval",
63
+ "extract",
64
+ "get",
65
+ "python",
66
+ "tunnel",
67
+ "cloud",
68
+ "profile",
69
+ "wait",
70
+ }
71
+ )
72
+ FORBIDDEN_GLOBAL_OPTIONS = frozenset(
73
+ {"--headed", "--profile", "--cdp-url", "--connect", "--mcp", "--template"}
74
+ )
75
+
76
+
77
+ class CommandRejected(ValueError):
78
+ """Raised when an Agent command crosses the browser-only boundary."""
79
+
80
+
81
+ def _origin(value: str) -> tuple[str, str, int]:
82
+ parsed = urllib.parse.urlsplit(value)
83
+ if parsed.scheme not in {"http", "https"} or not parsed.hostname:
84
+ raise ValueError(f"invalid browser origin: {value!r}")
85
+ port = parsed.port or (443 if parsed.scheme == "https" else 80)
86
+ return parsed.scheme, parsed.hostname.lower(), port
87
+
88
+
89
+ def allowed_origins() -> frozenset[tuple[str, str, int]]:
90
+ values = (
91
+ os.environ.get(
92
+ "WEBSITEBENCH_BROWSER_REFERENCE_URL", "https://reference:8080"
93
+ ),
94
+ os.environ.get(
95
+ "WEBSITEBENCH_BROWSER_CANDIDATE_URL", "http://candidate:3000"
96
+ ),
97
+ os.environ.get(
98
+ "WEBSITEBENCH_BROWSER_MAILBOX_URL", "http://mailbox:8026"
99
+ ),
100
+ )
101
+ return frozenset(_origin(value) for value in values)
102
+
103
+
104
+ def _parse_global_options(arguments: list[str]) -> tuple[str, int]:
105
+ session = "default"
106
+ index = 0
107
+ while index < len(arguments):
108
+ value = arguments[index]
109
+ if value == "--session":
110
+ if index + 1 >= len(arguments):
111
+ raise CommandRejected("--session requires a value")
112
+ session = arguments[index + 1]
113
+ index += 2
114
+ continue
115
+ if value.startswith("--session="):
116
+ session = value.partition("=")[2]
117
+ index += 1
118
+ continue
119
+ if value == "--json":
120
+ index += 1
121
+ continue
122
+ if value in {"-h", "--help"}:
123
+ break
124
+ if value in FORBIDDEN_GLOBAL_OPTIONS or any(
125
+ value.startswith(option + "=") for option in FORBIDDEN_GLOBAL_OPTIONS
126
+ ):
127
+ raise CommandRejected(f"Browser Use option {value!r} is disabled")
128
+ if value.startswith("-"):
129
+ raise CommandRejected(f"unsupported Browser Use option {value!r}")
130
+ break
131
+ if not SESSION_PATTERN.fullmatch(session):
132
+ raise CommandRejected("invalid Browser Use session name")
133
+ return session, index
134
+
135
+
136
+ def validate_command(raw_arguments: Any) -> list[str]:
137
+ if not isinstance(raw_arguments, list) or not raw_arguments:
138
+ raise CommandRejected("argv must be a non-empty string array")
139
+ if len(raw_arguments) > 128:
140
+ raise CommandRejected("too many Browser Use arguments")
141
+ arguments: list[str] = []
142
+ for value in raw_arguments:
143
+ if not isinstance(value, str) or "\x00" in value or len(value) > 16_384:
144
+ raise CommandRejected("invalid Browser Use argument")
145
+ arguments.append(value)
146
+
147
+ for value in arguments:
148
+ if value in FORBIDDEN_GLOBAL_OPTIONS or any(
149
+ value.startswith(option + "=") for option in FORBIDDEN_GLOBAL_OPTIONS
150
+ ):
151
+ raise CommandRejected(f"Browser Use option {value!r} is disabled")
152
+
153
+ _session, command_index = _parse_global_options(arguments)
154
+ if (
155
+ command_index == len(arguments) - 1
156
+ and arguments[command_index] in {"-h", "--help"}
157
+ ):
158
+ return arguments
159
+ if command_index >= len(arguments):
160
+ raise CommandRejected("missing Browser Use command")
161
+ command = arguments[command_index]
162
+ if command in FORBIDDEN_COMMANDS:
163
+ raise CommandRejected(
164
+ f"Browser Use command {command!r} is disabled for browser-only references"
165
+ )
166
+ if command not in SAFE_COMMANDS:
167
+ raise CommandRejected(f"unsupported Browser Use command {command!r}")
168
+
169
+ if command == "open":
170
+ urls = [
171
+ value
172
+ for value in arguments[command_index + 1 :]
173
+ if "://" in value
174
+ ]
175
+ if len(urls) != 1:
176
+ raise CommandRejected("open requires exactly one absolute URL")
177
+ try:
178
+ requested_origin = _origin(urls[0])
179
+ except (TypeError, ValueError) as exc:
180
+ raise CommandRejected(str(exc)) from exc
181
+ if requested_origin not in allowed_origins():
182
+ raise CommandRejected("browser navigation target is outside task origins")
183
+
184
+ if command == "screenshot":
185
+ # The bundled Browser Use CLI is `screenshot [--full] [path]`; accept the spellings
186
+ # agents reach for (`--full-page`, `--path X`, `--path=X`) and hand the CLI its own.
187
+ path_values: list[str] = []
188
+ options: list[str] = []
189
+ tail = arguments[command_index + 1 :]
190
+ index = 0
191
+ while index < len(tail):
192
+ value = tail[index]
193
+ if value == "--path":
194
+ if index + 1 >= len(tail):
195
+ raise CommandRejected("screenshot --path requires a value")
196
+ path_values.append(tail[index + 1])
197
+ index += 2
198
+ continue
199
+ if value.startswith("--path="):
200
+ path_values.append(value.partition("=")[2])
201
+ index += 1
202
+ continue
203
+ if value in {"--full", "--full-page"}:
204
+ if "--full" not in options:
205
+ options.append("--full")
206
+ index += 1
207
+ continue
208
+ if value in {"--json", "-h", "--help"}:
209
+ options.append(value)
210
+ index += 1
211
+ continue
212
+ if value.startswith("-"):
213
+ raise CommandRejected(f"unsupported screenshot option {value!r}")
214
+ path_values.append(value)
215
+ index += 1
216
+ paths = [Path(value).resolve() for value in path_values]
217
+ if (
218
+ len(paths) != 1
219
+ or paths[0].parent != SHARED_ROOT
220
+ or re.fullmatch(r"screenshot-[0-9a-f]{32}\.png", paths[0].name) is None
221
+ ):
222
+ raise CommandRejected("screenshots must use one gateway-owned PNG path")
223
+ return arguments[: command_index + 1] + options + [str(paths[0])]
224
+
225
+ return arguments
226
+
227
+
228
+ _COMMAND_LOCK = threading.Lock()
229
+
230
+
231
+ def execute(arguments: list[str]) -> dict[str, Any]:
232
+ with _COMMAND_LOCK:
233
+ try:
234
+ completed = subprocess.run(
235
+ [REAL_BROWSER_USE, *arguments],
236
+ stdin=subprocess.DEVNULL,
237
+ stdout=subprocess.PIPE,
238
+ stderr=subprocess.PIPE,
239
+ timeout=COMMAND_TIMEOUT_SEC,
240
+ check=False,
241
+ )
242
+ except subprocess.TimeoutExpired as exc:
243
+ raise CommandRejected("Browser Use command exceeded 180 seconds") from exc
244
+ except OSError as exc:
245
+ raise CommandRejected(f"Browser Use runtime unavailable: {exc}") from exc
246
+ stdout = completed.stdout[:MAX_OUTPUT_BYTES]
247
+ stderr = completed.stderr[:MAX_OUTPUT_BYTES]
248
+ if len(completed.stdout) > MAX_OUTPUT_BYTES or len(completed.stderr) > MAX_OUTPUT_BYTES:
249
+ raise CommandRejected("Browser Use output exceeded the interactive limit")
250
+ return {
251
+ "exit_code": completed.returncode,
252
+ "stdout": stdout.decode("utf-8", errors="replace"),
253
+ "stderr": stderr.decode("utf-8", errors="replace"),
254
+ }
255
+
256
+
257
+ class Handler(BaseHTTPRequestHandler):
258
+ server_version = "WebsiteBenchBrowserGateway/1"
259
+
260
+ def log_message(self, _format: str, *_arguments: object) -> None:
261
+ return
262
+
263
+ def _send(self, status: int, value: dict[str, Any]) -> None:
264
+ body = json.dumps(value, separators=(",", ":")).encode("utf-8")
265
+ self.send_response(status)
266
+ self.send_header("Content-Type", "application/json")
267
+ self.send_header("Content-Length", str(len(body)))
268
+ self.send_header("Cache-Control", "no-store")
269
+ self.end_headers()
270
+ self.wfile.write(body)
271
+
272
+ def do_GET(self) -> None:
273
+ if self.path == "/healthz":
274
+ self._send(200, {"status": "ok"})
275
+ else:
276
+ self._send(404, {"error": "not_found"})
277
+
278
+ def do_POST(self) -> None:
279
+ if self.path != "/v1/command":
280
+ self._send(404, {"error": "not_found"})
281
+ return
282
+ try:
283
+ length = int(self.headers.get("Content-Length", ""))
284
+ if length <= 0 or length > MAX_REQUEST_BYTES:
285
+ raise CommandRejected("invalid request size")
286
+ payload = json.loads(self.rfile.read(length))
287
+ if not isinstance(payload, dict) or set(payload) != {"argv"}:
288
+ raise CommandRejected("request must contain only argv")
289
+ result = execute(validate_command(payload["argv"]))
290
+ except (CommandRejected, json.JSONDecodeError, UnicodeError, ValueError) as exc:
291
+ self._send(400, {"error": str(exc)})
292
+ return
293
+ self._send(200, result)
294
+
295
+
296
+ def main() -> None:
297
+ bind = os.environ.get("WEBSITEBENCH_BROWSER_GATEWAY_BIND", "0.0.0.0")
298
+ port = int(os.environ.get("WEBSITEBENCH_BROWSER_GATEWAY_PORT", "9224"))
299
+ server = ThreadingHTTPServer((bind, port), Handler)
300
+ server.daemon_threads = True
301
+ server.serve_forever()
302
+
303
+
304
+ if __name__ == "__main__":
305
+ main()
tasks/backcountry/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/backcountry/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/backcountry/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/backcountry/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/backcountry/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/backcountry/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/backcountry/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/backcountry/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-backcountry-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/backcountry/environment/reference/README.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Direct reference adapter
2
+
3
+ The materializer overlays these ABI files on the frozen Backcountry clone and
4
+ backend. The same assembled bytes form the private oracle implementation; the
5
+ clone and backend are not duplicated in this authoring directory.
tasks/backcountry/environment/reference/backend/model.json ADDED
@@ -0,0 +1,846 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "auth_semantics": {
3
+ "account_database_scope": "site-isolated",
4
+ "credential_storage": "salted-scrypt-hash",
5
+ "legacy_write_policy": "read-compatible-write-rejected",
6
+ "mail_default": "LOCAL_ONLY",
7
+ "mail_statuses": [
8
+ "LOCAL_ONLY",
9
+ "SMTP_PENDING",
10
+ "SMTP_SENT",
11
+ "SMTP_FAILED"
12
+ ],
13
+ "password_reset_enumeration": "indistinguishable-public-response",
14
+ "registration_account_creation": "after-email-verification",
15
+ "rejected_secret_journaling": "forbidden",
16
+ "session_storage": "opaque-cookie-digest-at-rest",
17
+ "smtp_activation": "explicit-complete-config-only",
18
+ "smtp_delivery_ceiling": 3,
19
+ "verification_challenge_storage": "salted-hash"
20
+ },
21
+ "capabilities": [
22
+ {
23
+ "category": "authentication",
24
+ "entities": [
25
+ {
26
+ "identity": "opaque pending id bound to one browser session",
27
+ "name": "pending-registration",
28
+ "owner_scope": "session",
29
+ "persistence": "durable"
30
+ },
31
+ {
32
+ "identity": "site-local account id and unique normalized email",
33
+ "name": "local-account",
34
+ "owner_scope": "account",
35
+ "persistence": "durable"
36
+ }
37
+ ],
38
+ "external_effect": "none",
39
+ "id": "account-registration",
40
+ "implementation_status": "implemented",
41
+ "invariant_ids": [
42
+ "registration-requires-verification"
43
+ ],
44
+ "journey_ids": [
45
+ "local-account-registration",
46
+ "registration-invalid-code"
47
+ ],
48
+ "label": "Verified local account registration",
49
+ "priority": "p0",
50
+ "proofs": {
51
+ "evidence": {
52
+ "invalid": [
53
+ "clone/tests/test_backend.py::test_registration_rejects_invalid_details"
54
+ ],
55
+ "restart": [
56
+ "clone/tests/test_backend.py::test_reset_state_is_deterministic"
57
+ ],
58
+ "stale": [
59
+ "clone/tests/test_backend.py::test_registration_verifies_a_code_before_creating_the_account"
60
+ ],
61
+ "valid": [
62
+ "clone/tests/test_backend.py::test_registration_verifies_a_code_before_creating_the_account"
63
+ ]
64
+ },
65
+ "not_applicable": [],
66
+ "planned": [
67
+ "duplicate",
68
+ "foreign-owner",
69
+ "unauthorized-role",
70
+ "migration",
71
+ "concurrency"
72
+ ]
73
+ },
74
+ "server_authorities": [
75
+ "The server normalizes identity and hashes password and code.",
76
+ "An account is created only after successful verification.",
77
+ "Duplicate normalized email creation is rejected transactionally."
78
+ ],
79
+ "state_machine": {
80
+ "kind": "challenge-lifecycle",
81
+ "states": [
82
+ "collecting",
83
+ "pending-verification",
84
+ "verified",
85
+ "account-created",
86
+ "expired",
87
+ "locked"
88
+ ],
89
+ "transitions": [
90
+ {
91
+ "from": "collecting",
92
+ "to": "pending-verification",
93
+ "trigger": "validated registration request"
94
+ },
95
+ {
96
+ "from": "pending-verification",
97
+ "to": "verified",
98
+ "trigger": "correct unexpired code within attempt budget"
99
+ },
100
+ {
101
+ "from": "verified",
102
+ "to": "account-created",
103
+ "trigger": "transactional account creation and session rotation"
104
+ },
105
+ {
106
+ "from": "pending-verification",
107
+ "to": "expired",
108
+ "trigger": "challenge expiry"
109
+ },
110
+ {
111
+ "from": "pending-verification",
112
+ "to": "locked",
113
+ "trigger": "verification attempt budget exhausted"
114
+ }
115
+ ]
116
+ }
117
+ },
118
+ {
119
+ "category": "authentication",
120
+ "entities": [
121
+ {
122
+ "identity": "site-local account id and normalized email",
123
+ "name": "local-account",
124
+ "owner_scope": "account",
125
+ "persistence": "durable"
126
+ }
127
+ ],
128
+ "external_effect": "none",
129
+ "id": "account-sign-in",
130
+ "implementation_status": "implemented",
131
+ "invariant_ids": [
132
+ "member-isolation"
133
+ ],
134
+ "journey_ids": [
135
+ "member-account-surfaces"
136
+ ],
137
+ "label": "Password-based local account sign-in",
138
+ "priority": "p0",
139
+ "proofs": {
140
+ "evidence": {
141
+ "foreign-owner": [
142
+ "clone/tests/test_backend.py::test_orders_are_isolated_between_actors"
143
+ ],
144
+ "invalid": [
145
+ "clone/tests/test_smoke.py::test_signin_rejects_unknown_account",
146
+ "clone/tests/test_smoke.py::test_signin_requires_credentials"
147
+ ],
148
+ "restart": [
149
+ "clone/tests/test_backend.py::test_reset_state_is_deterministic"
150
+ ],
151
+ "valid": [
152
+ "clone/tests/test_backend.py::test_member_sign_in_merges_the_anonymous_cart"
153
+ ]
154
+ },
155
+ "not_applicable": [],
156
+ "planned": [
157
+ "duplicate",
158
+ "stale",
159
+ "unauthorized-role",
160
+ "migration",
161
+ "concurrency"
162
+ ]
163
+ },
164
+ "server_authorities": [
165
+ "The server verifies salted password hashes.",
166
+ "The server rotates the authenticated session.",
167
+ "Client-selected fixture identity is not authentication."
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
+ },
196
+ {
197
+ "category": "authentication",
198
+ "entities": [
199
+ {
200
+ "identity": "opaque cookie token with digest persisted at rest",
201
+ "name": "browser-session",
202
+ "owner_scope": "session",
203
+ "persistence": "durable"
204
+ }
205
+ ],
206
+ "external_effect": "none",
207
+ "id": "session-lifecycle",
208
+ "implementation_status": "implemented",
209
+ "invariant_ids": [
210
+ "member-isolation"
211
+ ],
212
+ "journey_ids": [
213
+ "member-account-surfaces"
214
+ ],
215
+ "label": "Anonymous and authenticated browser sessions",
216
+ "priority": "p0",
217
+ "proofs": {
218
+ "evidence": {
219
+ "foreign-owner": [
220
+ "clone/tests/test_backend.py::test_orders_are_isolated_between_actors"
221
+ ],
222
+ "invalid": [
223
+ "clone/tests/test_smoke.py::test_account_routes_redirect_when_anonymous"
224
+ ],
225
+ "valid": [
226
+ "clone/tests/test_backend.py::test_member_order_history_and_detail"
227
+ ]
228
+ },
229
+ "not_applicable": [],
230
+ "planned": [
231
+ "duplicate",
232
+ "stale",
233
+ "unauthorized-role",
234
+ "restart",
235
+ "migration",
236
+ "concurrency"
237
+ ]
238
+ },
239
+ "server_authorities": [
240
+ "Raw session tokens are never stored in the database.",
241
+ "Ownership is resolved from the server-side session record.",
242
+ "Sign-out revokes server-side authority before deleting the cookie."
243
+ ],
244
+ "state_machine": {
245
+ "kind": "session-lifecycle",
246
+ "states": [
247
+ "anonymous",
248
+ "authenticated",
249
+ "revoked",
250
+ "expired"
251
+ ],
252
+ "transitions": [
253
+ {
254
+ "from": "anonymous",
255
+ "to": "authenticated",
256
+ "trigger": "successful sign-in or registration rotates session"
257
+ },
258
+ {
259
+ "from": "authenticated",
260
+ "to": "revoked",
261
+ "trigger": "sign-out or security reset"
262
+ },
263
+ {
264
+ "from": "anonymous",
265
+ "to": "expired",
266
+ "trigger": "session expiry"
267
+ },
268
+ {
269
+ "from": "authenticated",
270
+ "to": "expired",
271
+ "trigger": "session expiry"
272
+ }
273
+ ]
274
+ }
275
+ },
276
+ {
277
+ "category": "authentication",
278
+ "entities": [
279
+ {
280
+ "identity": "opaque reset id bound to one browser session",
281
+ "name": "password-reset-challenge",
282
+ "owner_scope": "session",
283
+ "persistence": "durable"
284
+ },
285
+ {
286
+ "identity": "nullable concealed account binding",
287
+ "name": "local-account",
288
+ "owner_scope": "account",
289
+ "persistence": "durable"
290
+ }
291
+ ],
292
+ "external_effect": "none",
293
+ "id": "password-recovery",
294
+ "implementation_status": "implemented",
295
+ "invariant_ids": [
296
+ "password-recovery-is-non-enumerating"
297
+ ],
298
+ "journey_ids": [
299
+ "local-password-recovery"
300
+ ],
301
+ "label": "Enumeration-resistant local password recovery",
302
+ "priority": "p0",
303
+ "proofs": {
304
+ "evidence": {
305
+ "foreign-owner": [
306
+ "clone/tests/test_backend.py::test_password_reset_does_not_disclose_unknown_accounts"
307
+ ],
308
+ "invalid": [
309
+ "clone/tests/test_backend.py::test_password_reset_requires_the_emailed_code"
310
+ ],
311
+ "restart": [
312
+ "clone/tests/test_backend.py::test_reset_state_is_deterministic"
313
+ ],
314
+ "valid": [
315
+ "clone/tests/test_backend.py::test_password_reset_requires_the_emailed_code"
316
+ ]
317
+ },
318
+ "not_applicable": [],
319
+ "planned": [
320
+ "duplicate",
321
+ "stale",
322
+ "unauthorized-role",
323
+ "migration",
324
+ "concurrency"
325
+ ]
326
+ },
327
+ "server_authorities": [
328
+ "Known and unknown emails receive indistinguishable public responses.",
329
+ "Only the server binds a reset flow to an account.",
330
+ "Password replacement revokes prior authenticated sessions."
331
+ ],
332
+ "state_machine": {
333
+ "kind": "challenge-lifecycle",
334
+ "states": [
335
+ "requested",
336
+ "verified",
337
+ "consumed",
338
+ "expired",
339
+ "locked"
340
+ ],
341
+ "transitions": [
342
+ {
343
+ "from": "requested",
344
+ "to": "verified",
345
+ "trigger": "correct unexpired code within attempt budget"
346
+ },
347
+ {
348
+ "from": "verified",
349
+ "to": "consumed",
350
+ "trigger": "password is replaced and sessions are revoked"
351
+ },
352
+ {
353
+ "from": "requested",
354
+ "to": "expired",
355
+ "trigger": "challenge expiry"
356
+ },
357
+ {
358
+ "from": "requested",
359
+ "to": "locked",
360
+ "trigger": "verification attempt budget exhausted"
361
+ }
362
+ ]
363
+ }
364
+ },
365
+ {
366
+ "category": "communication",
367
+ "entities": [
368
+ {
369
+ "identity": "site-local outbox id and purpose-bound flow id",
370
+ "name": "mail-outbox-entry",
371
+ "owner_scope": "system",
372
+ "persistence": "durable"
373
+ }
374
+ ],
375
+ "external_effect": "local-only",
376
+ "id": "email-delivery",
377
+ "implementation_status": "implemented",
378
+ "invariant_ids": [
379
+ "registration-requires-verification",
380
+ "password-recovery-is-non-enumerating"
381
+ ],
382
+ "journey_ids": [
383
+ "local-account-registration",
384
+ "local-password-recovery"
385
+ ],
386
+ "label": "Truthful local verification and recovery mail outbox",
387
+ "priority": "p0",
388
+ "proofs": {
389
+ "evidence": {
390
+ "invalid": [
391
+ "clone/tests/test_backend.py::test_password_reset_requires_the_emailed_code"
392
+ ],
393
+ "valid": [
394
+ "clone/tests/test_backend.py::test_registration_verifies_a_code_before_creating_the_account",
395
+ "clone/tests/test_backend.py::test_marketing_signup_lands_in_the_local_outbox"
396
+ ]
397
+ },
398
+ "not_applicable": [
399
+ {
400
+ "obligation": "foreign-owner",
401
+ "rationale": "Mail is written to the local outbox and never delivered, so ownership, role, migration and concurrency obligations do not apply to a delivery path that does not exist."
402
+ },
403
+ {
404
+ "obligation": "unauthorized-role",
405
+ "rationale": "Mail is written to the local outbox and never delivered, so ownership, role, migration and concurrency obligations do not apply to a delivery path that does not exist."
406
+ },
407
+ {
408
+ "obligation": "migration",
409
+ "rationale": "Mail is written to the local outbox and never delivered, so ownership, role, migration and concurrency obligations do not apply to a delivery path that does not exist."
410
+ },
411
+ {
412
+ "obligation": "concurrency",
413
+ "rationale": "Mail is written to the local outbox and never delivered, so ownership, role, migration and concurrency obligations do not apply to a delivery path that does not exist."
414
+ }
415
+ ],
416
+ "planned": [
417
+ "duplicate",
418
+ "stale",
419
+ "restart"
420
+ ]
421
+ },
422
+ "server_authorities": [
423
+ "Offline mode records LOCAL_ONLY and never claims external delivery.",
424
+ "SMTP is disabled unless every required setting is present.",
425
+ "Claim, retry, and startup replay share one delivery ceiling."
426
+ ],
427
+ "state_machine": {
428
+ "kind": "delivery-lifecycle",
429
+ "states": [
430
+ "local-only",
431
+ "smtp-pending",
432
+ "smtp-sent",
433
+ "smtp-failed"
434
+ ],
435
+ "transitions": [
436
+ {
437
+ "from": "local-only",
438
+ "to": "smtp-pending",
439
+ "trigger": "operator enables complete explicit SMTP configuration"
440
+ },
441
+ {
442
+ "from": "smtp-pending",
443
+ "to": "smtp-sent",
444
+ "trigger": "SMTP transport confirms delivery handoff"
445
+ },
446
+ {
447
+ "from": "smtp-pending",
448
+ "to": "smtp-failed",
449
+ "trigger": "delivery attempt fails or ceiling is reached"
450
+ },
451
+ {
452
+ "from": "smtp-failed",
453
+ "to": "smtp-pending",
454
+ "trigger": "bounded idempotent retry below the delivery ceiling"
455
+ }
456
+ ]
457
+ }
458
+ },
459
+ {
460
+ "category": "commerce",
461
+ "entities": [
462
+ {
463
+ "identity": "one row per actor key (member email or anonymous session)",
464
+ "name": "cart",
465
+ "owner_scope": "session",
466
+ "persistence": "durable"
467
+ },
468
+ {
469
+ "identity": "unique (cart, sku id) with quantity and captured prices",
470
+ "name": "cart-line",
471
+ "owner_scope": "session",
472
+ "persistence": "durable"
473
+ }
474
+ ],
475
+ "external_effect": "none",
476
+ "id": "cart",
477
+ "implementation_status": "implemented",
478
+ "invariant_ids": [
479
+ "variant-integrity",
480
+ "cart-arithmetic"
481
+ ],
482
+ "journey_ids": [
483
+ "travel-hiking-pack-add-to-cart",
484
+ "travel-browse-two-pages"
485
+ ],
486
+ "label": "Persistent local cart with variant-accurate lines",
487
+ "priority": "p0",
488
+ "proofs": {
489
+ "evidence": {
490
+ "duplicate": [
491
+ "clone/tests/test_backend.py::test_repeated_add_increments_one_line"
492
+ ],
493
+ "foreign-owner": [
494
+ "clone/tests/test_backend.py::test_orders_are_isolated_between_actors"
495
+ ],
496
+ "invalid": [
497
+ "clone/tests/test_backend.py::test_unavailable_variant_is_refused"
498
+ ],
499
+ "restart": [
500
+ "clone/tests/test_backend.py::test_reset_state_is_deterministic"
501
+ ],
502
+ "valid": [
503
+ "clone/tests/test_backend.py::test_add_to_cart_persists_the_selected_variant"
504
+ ]
505
+ },
506
+ "not_applicable": [],
507
+ "planned": [
508
+ "stale",
509
+ "unauthorized-role",
510
+ "migration",
511
+ "concurrency"
512
+ ]
513
+ },
514
+ "server_authorities": [
515
+ "The server resolves the sku from the captured catalogue and refuses an unknown colour or size combination.",
516
+ "The server owns line prices; the client cannot supply them.",
517
+ "The server keys every cart on the resolved actor, never on a client-supplied identity.",
518
+ "The server recomputes totals, shipping threshold and tax on read."
519
+ ],
520
+ "state_machine": {
521
+ "kind": "entity-lifecycle",
522
+ "states": [
523
+ "empty",
524
+ "holding-lines",
525
+ "line-updated",
526
+ "line-removed",
527
+ "merged-on-sign-in"
528
+ ],
529
+ "transitions": [
530
+ {
531
+ "from": "empty",
532
+ "to": "holding-lines",
533
+ "trigger": "add an in-stock sku for the actor"
534
+ },
535
+ {
536
+ "from": "holding-lines",
537
+ "to": "holding-lines",
538
+ "trigger": "re-add the same sku, incrementing its quantity"
539
+ },
540
+ {
541
+ "from": "holding-lines",
542
+ "to": "line-updated",
543
+ "trigger": "set a line quantity"
544
+ },
545
+ {
546
+ "from": "line-updated",
547
+ "to": "line-removed",
548
+ "trigger": "set a line quantity to zero or remove it"
549
+ },
550
+ {
551
+ "from": "line-removed",
552
+ "to": "empty",
553
+ "trigger": "remove the last remaining line"
554
+ },
555
+ {
556
+ "from": "holding-lines",
557
+ "to": "merged-on-sign-in",
558
+ "trigger": "sign in while an anonymous cart exists"
559
+ }
560
+ ]
561
+ }
562
+ },
563
+ {
564
+ "category": "commerce",
565
+ "entities": [
566
+ {
567
+ "identity": "unique (actor, product slug, colour)",
568
+ "name": "wishlist-entry",
569
+ "owner_scope": "session",
570
+ "persistence": "durable"
571
+ }
572
+ ],
573
+ "external_effect": "none",
574
+ "id": "wish-list",
575
+ "implementation_status": "implemented",
576
+ "invariant_ids": [
577
+ "member-isolation"
578
+ ],
579
+ "journey_ids": [
580
+ "member-account-surfaces"
581
+ ],
582
+ "label": "Per-actor wish list",
583
+ "priority": "p0",
584
+ "proofs": {
585
+ "evidence": {
586
+ "foreign-owner": [
587
+ "clone/tests/test_backend.py::test_orders_are_isolated_between_actors"
588
+ ],
589
+ "valid": [
590
+ "clone/tests/test_backend.py::test_wishlist_toggles"
591
+ ]
592
+ },
593
+ "not_applicable": [],
594
+ "planned": [
595
+ "invalid",
596
+ "duplicate",
597
+ "stale",
598
+ "unauthorized-role",
599
+ "restart",
600
+ "migration",
601
+ "concurrency"
602
+ ]
603
+ },
604
+ "server_authorities": [
605
+ "The server enforces one entry per actor, product and colour.",
606
+ "The server scopes every read and write to the resolved actor."
607
+ ],
608
+ "state_machine": {
609
+ "kind": "idempotent-set",
610
+ "states": [
611
+ "absent",
612
+ "present"
613
+ ],
614
+ "transitions": [
615
+ {
616
+ "from": "absent",
617
+ "to": "present",
618
+ "trigger": "toggle a product and colour onto the actor's list"
619
+ },
620
+ {
621
+ "from": "present",
622
+ "to": "absent",
623
+ "trigger": "toggle the same product and colour off again"
624
+ }
625
+ ]
626
+ }
627
+ },
628
+ {
629
+ "category": "commerce",
630
+ "entities": [
631
+ {
632
+ "identity": "unique order number owned by one member account",
633
+ "name": "order",
634
+ "owner_scope": "account",
635
+ "persistence": "durable"
636
+ },
637
+ {
638
+ "identity": "labelled address owned by one member account",
639
+ "name": "address",
640
+ "owner_scope": "account",
641
+ "persistence": "durable"
642
+ }
643
+ ],
644
+ "external_effect": "none",
645
+ "id": "order-history",
646
+ "implementation_status": "implemented",
647
+ "invariant_ids": [
648
+ "member-isolation"
649
+ ],
650
+ "journey_ids": [
651
+ "member-account-surfaces"
652
+ ],
653
+ "label": "Seeded member order history and order detail",
654
+ "priority": "p0",
655
+ "proofs": {
656
+ "evidence": {
657
+ "foreign-owner": [
658
+ "clone/tests/test_backend.py::test_orders_are_isolated_between_actors"
659
+ ],
660
+ "invalid": [
661
+ "clone/tests/test_backend.py::test_member_order_history_and_detail"
662
+ ],
663
+ "restart": [
664
+ "clone/tests/test_backend.py::test_reset_state_is_deterministic"
665
+ ],
666
+ "valid": [
667
+ "clone/tests/test_backend.py::test_member_order_history_and_detail"
668
+ ]
669
+ },
670
+ "not_applicable": [],
671
+ "planned": [
672
+ "duplicate",
673
+ "stale",
674
+ "unauthorized-role",
675
+ "migration",
676
+ "concurrency"
677
+ ]
678
+ },
679
+ "server_authorities": [
680
+ "Orders are seeded server-side and are never written by a request.",
681
+ "The server returns only orders owned by the resolved member and answers 404 for any other order number."
682
+ ],
683
+ "state_machine": {
684
+ "kind": "immutable-receipt",
685
+ "states": [
686
+ "seeded",
687
+ "readable"
688
+ ],
689
+ "transitions": [
690
+ {
691
+ "from": "seeded",
692
+ "to": "readable",
693
+ "trigger": "a signed-in member opens order history or an order detail"
694
+ }
695
+ ]
696
+ }
697
+ },
698
+ {
699
+ "category": "commerce",
700
+ "entities": [
701
+ {
702
+ "identity": "derived from the actor's current cart; never persisted",
703
+ "name": "checkout-summary",
704
+ "owner_scope": "session",
705
+ "persistence": "ephemeral"
706
+ }
707
+ ],
708
+ "external_effect": "none",
709
+ "id": "checkout",
710
+ "implementation_status": "not-applicable",
711
+ "invariant_ids": [
712
+ "checkout-boundary"
713
+ ],
714
+ "journey_ids": [
715
+ "cart-review-to-checkout-entry"
716
+ ],
717
+ "label": "Checkout entry only; no order submission or payment",
718
+ "priority": "p1",
719
+ "proofs": {
720
+ "evidence": {
721
+ "valid": [
722
+ "clone/tests/test_backend.py::test_checkout_entry_stops_before_submission"
723
+ ]
724
+ },
725
+ "not_applicable": [
726
+ {
727
+ "obligation": "invalid",
728
+ "rationale": "Order submission and payment are outside the frozen scope: placing an order on the source site is an irreversible real-world effect that was never authorised, so the clone renders the entry summary and stops rather than simulating a purchase."
729
+ },
730
+ {
731
+ "obligation": "duplicate",
732
+ "rationale": "Order submission and payment are outside the frozen scope: placing an order on the source site is an irreversible real-world effect that was never authorised, so the clone renders the entry summary and stops rather than simulating a purchase."
733
+ },
734
+ {
735
+ "obligation": "stale",
736
+ "rationale": "Order submission and payment are outside the frozen scope: placing an order on the source site is an irreversible real-world effect that was never authorised, so the clone renders the entry summary and stops rather than simulating a purchase."
737
+ },
738
+ {
739
+ "obligation": "foreign-owner",
740
+ "rationale": "Order submission and payment are outside the frozen scope: placing an order on the source site is an irreversible real-world effect that was never authorised, so the clone renders the entry summary and stops rather than simulating a purchase."
741
+ },
742
+ {
743
+ "obligation": "unauthorized-role",
744
+ "rationale": "Order submission and payment are outside the frozen scope: placing an order on the source site is an irreversible real-world effect that was never authorised, so the clone renders the entry summary and stops rather than simulating a purchase."
745
+ },
746
+ {
747
+ "obligation": "restart",
748
+ "rationale": "Order submission and payment are outside the frozen scope: placing an order on the source site is an irreversible real-world effect that was never authorised, so the clone renders the entry summary and stops rather than simulating a purchase."
749
+ },
750
+ {
751
+ "obligation": "migration",
752
+ "rationale": "Order submission and payment are outside the frozen scope: placing an order on the source site is an irreversible real-world effect that was never authorised, so the clone renders the entry summary and stops rather than simulating a purchase."
753
+ },
754
+ {
755
+ "obligation": "concurrency",
756
+ "rationale": "Order submission and payment are outside the frozen scope: placing an order on the source site is an irreversible real-world effect that was never authorised, so the clone renders the entry summary and stops rather than simulating a purchase."
757
+ }
758
+ ],
759
+ "planned": []
760
+ },
761
+ "server_authorities": [
762
+ "The server derives the summary from the stored cart and persists nothing.",
763
+ "No endpoint exists that could submit an order or take payment."
764
+ ],
765
+ "state_machine": {
766
+ "kind": "entity-lifecycle",
767
+ "states": [
768
+ "cart-empty",
769
+ "summary-rendered"
770
+ ],
771
+ "transitions": [
772
+ {
773
+ "from": "cart-empty",
774
+ "to": "summary-rendered",
775
+ "trigger": "open the checkout entry with a non-empty cart"
776
+ }
777
+ ]
778
+ }
779
+ }
780
+ ],
781
+ "common_capabilities": {
782
+ "account_registration": "account-registration",
783
+ "account_sign_in": "account-sign-in",
784
+ "email_delivery": "email-delivery",
785
+ "password_recovery": "password-recovery",
786
+ "session_lifecycle": "session-lifecycle"
787
+ },
788
+ "database": {
789
+ "concurrency_model": "wal-transactional-single-writer",
790
+ "deterministic_reset": true,
791
+ "engine": "sqlite",
792
+ "location_policy": "runtime-data-outside-candidate",
793
+ "migration_strategy": "versioned-forward-migrations",
794
+ "proofs": [
795
+ {
796
+ "evidence": [
797
+ "clone/backend/site_backend_integration.py",
798
+ "backend/runtime.json (database.data_dir=data, volume websitebench-backcountry-data)",
799
+ "scope/verify.json (boot env WEBSITEBENCH_SITE_BACKEND_DATABASE)"
800
+ ],
801
+ "obligation": "data-location",
802
+ "status": "verified"
803
+ },
804
+ {
805
+ "evidence": [
806
+ "clone/store.py::SCHEMA",
807
+ "websitebench.local_clone_auth ensure_schema"
808
+ ],
809
+ "obligation": "schema-migration",
810
+ "status": "verified"
811
+ },
812
+ {
813
+ "evidence": [
814
+ "clone/tests/test_backend.py::test_reset_state_is_deterministic",
815
+ "clone/store.py::reset_state"
816
+ ],
817
+ "obligation": "deterministic-reset",
818
+ "status": "verified"
819
+ },
820
+ {
821
+ "evidence": [
822
+ "clone/tests/test_backend.py::test_member_order_history_and_detail",
823
+ "offline-clone diagnostic live section boots the clone against its own data dir"
824
+ ],
825
+ "obligation": "restart-persistence",
826
+ "status": "verified"
827
+ },
828
+ {
829
+ "evidence": [],
830
+ "obligation": "backup-restore",
831
+ "status": "planned"
832
+ },
833
+ {
834
+ "evidence": [],
835
+ "obligation": "concurrency",
836
+ "status": "planned"
837
+ }
838
+ ],
839
+ "restart_persistence": true,
840
+ "site_isolation": "one-database-per-site"
841
+ },
842
+ "profile": "offline-benchmark",
843
+ "schema_version": "offline-clone.backend-model.v1",
844
+ "site_id": "backcountry",
845
+ "status": "verified"
846
+ }
tasks/backcountry/environment/reference/backend/runtime.json ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "database": {
3
+ "data_dir": "data",
4
+ "engine": "sqlite",
5
+ "filename": "backcountry.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 Backcountry.",
35
+ "lead": "A password reset was requested for Backcountry.",
36
+ "required_variables": [
37
+ "code",
38
+ "minutes"
39
+ ],
40
+ "secret_variables": [
41
+ "code"
42
+ ],
43
+ "subject": "Reset your Backcountry password",
44
+ "template_id": "backcountry.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 Backcountry.",
50
+ "lead": "Finish creating your Backcountry account.",
51
+ "required_variables": [
52
+ "code",
53
+ "minutes"
54
+ ],
55
+ "secret_variables": [
56
+ "code"
57
+ ],
58
+ "subject": "Verify your Backcountry account",
59
+ "template_id": "backcountry.registration.v1"
60
+ }
61
+ },
62
+ "sender": {
63
+ "address_env": "RESEND_FROM_EMAIL",
64
+ "display_name": "Backcountry"
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": "backcountry",
101
+ "label": "Backcountry",
102
+ "public_origin": "https://backcountry.website-bench.com"
103
+ }
104
+ }
tasks/backcountry/environment/reference/clone/app.py ADDED
@@ -0,0 +1,790 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Backcountry offline clone application.
2
+
3
+ Serves the captured Travel storefront: listings with facets, sorting and
4
+ pagination, product detail with variant selection, a persistent local cart,
5
+ search, and the signed-in member surfaces. All data is local; the process makes
6
+ no outbound network requests.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from pathlib import Path
12
+ from typing import Any
13
+ from urllib.parse import urlencode
14
+
15
+ from fastapi import FastAPI, Form, Query, Request
16
+ from fastapi.responses import HTMLResponse, RedirectResponse, Response
17
+ from fastapi.staticfiles import StaticFiles
18
+ from fastapi.templating import Jinja2Templates
19
+
20
+ import catalog
21
+ import sanitize
22
+ import sitepack
23
+ import store
24
+
25
+ SITE_ID = "backcountry"
26
+ DISPLAY_NAME = "Backcountry"
27
+ ROOT = Path(__file__).resolve().parent
28
+ SESSION_COOKIE = "backcountry_session"
29
+
30
+ app = FastAPI(title=DISPLAY_NAME)
31
+ # The frozen product photography is read out of ``clone/_sitepack`` when
32
+ # compile.sh has packed it and straight off disk when it has not; see
33
+ # sitepack.py for why the compiled tree may not carry ten thousand images.
34
+ STATIC_PACK = sitepack.SitePack.load(ROOT / "_sitepack" / "static.packindex.json")
35
+ app.mount(
36
+ "/static",
37
+ sitepack.packed_static_files(directory=ROOT / "static", pack=STATIC_PACK),
38
+ name="static",
39
+ )
40
+ templates = Jinja2Templates(directory=ROOT / "frontend" / "templates")
41
+
42
+
43
+ # --------------------------------------------------------------------------
44
+ # template helpers
45
+ # --------------------------------------------------------------------------
46
+
47
+ def money(value: float | None) -> str:
48
+ return "" if value is None else f"${value:,.2f}"
49
+
50
+
51
+ def price_label(p: dict[str, Any]) -> str:
52
+ lo, hi = catalog.price_range(p)
53
+ return money(lo) if abs(hi - lo) < 0.005 else f"{money(lo)} - {money(hi)}"
54
+
55
+
56
+ def list_price_label(p: dict[str, Any]) -> str | None:
57
+ """The source strikes through the original price only when the sale price
58
+ is a single value; a price range carries an "Up to N% off" flag instead."""
59
+ if not catalog.on_sale(p):
60
+ return None
61
+ lo, hi = catalog.price_range(p)
62
+ if abs(hi - lo) >= 0.005:
63
+ return None
64
+ list_lo, list_hi = catalog.list_price(p)
65
+ original = list_hi or list_lo
66
+ return money(original) if original and original - lo > 0.005 else None
67
+
68
+
69
+ def discount_label(p: dict[str, Any]) -> str | None:
70
+ lo = p["price"].get("minDiscount") or 0
71
+ hi = p["price"].get("maxDiscount") or 0
72
+ if not hi:
73
+ return None
74
+ return f"{hi}% off" if lo == hi else f"Up to {hi}% off"
75
+
76
+
77
+ def stars(average: float | None) -> str:
78
+ if not average:
79
+ return ""
80
+ full = int(round(average))
81
+ return "★" * full + "☆" * (5 - full)
82
+
83
+
84
+ def static_version(path: str) -> str:
85
+ """Stamp local CSS/JS with their mtime so an edited file is never served
86
+ from a stale browser cache."""
87
+ target = ROOT / "static" / path.lstrip("/").removeprefix("static/")
88
+ try:
89
+ return f"{path}?v={int(target.stat().st_mtime)}"
90
+ except OSError:
91
+ return path
92
+
93
+
94
+ templates.env.filters["money"] = money
95
+ templates.env.filters["clean_html"] = sanitize.clean_html
96
+ templates.env.filters["plain_text"] = sanitize.to_text
97
+ templates.env.filters["slugify"] = catalog.slugify
98
+ templates.env.globals.update(
99
+ static_version=static_version,
100
+ price_label=price_label,
101
+ list_price_label=list_price_label,
102
+ discount_label=discount_label,
103
+ stars=stars,
104
+ default_color=catalog.default_color,
105
+ gallery_for=catalog.gallery_for,
106
+ on_sale=catalog.on_sale,
107
+ )
108
+
109
+
110
+ # --------------------------------------------------------------------------
111
+ # session / actor
112
+ # --------------------------------------------------------------------------
113
+
114
+ def actor_for(request: Request) -> tuple[str, dict[str, Any] | None, str]:
115
+ """Return (actor key, member record or None, session token)."""
116
+ token = request.cookies.get(SESSION_COOKIE)
117
+ auth = store.services().auth
118
+ session = auth.resolve_session(token) if token else None
119
+ account = (session or {}).get("account") or {}
120
+ if session and session.get("authenticated") and account.get("email_normalized"):
121
+ email = account["email_normalized"]
122
+ display = account.get("display_name") or store.MEMBER["first_name"]
123
+ first, _, last = display.partition(" ")
124
+ return email, {
125
+ "email": email,
126
+ "first_name": first,
127
+ "last_name": last,
128
+ "tier": store.MEMBER["tier"],
129
+ }, token or ""
130
+ if not token:
131
+ token = auth.create_anonymous_session()
132
+ return f"anon:{token}", None, token
133
+
134
+
135
+ def base_context(request: Request) -> dict[str, Any]:
136
+ actor, member, token = actor_for(request)
137
+ return {
138
+ "request": request,
139
+ "nav": catalog.nav(),
140
+ "chrome": catalog.chrome(),
141
+ "member": member,
142
+ "actor": actor,
143
+ "session_token": token,
144
+ "cart_count": store.cart_count(actor),
145
+ "search_query": request.query_params.get("q"),
146
+ "active_nav": None,
147
+ "bare_chrome": False,
148
+ "show_campaign": True,
149
+ "main_data_id": None,
150
+ }
151
+
152
+
153
+ def render(name: str, ctx: dict[str, Any], status_code: int = 200) -> HTMLResponse:
154
+ context = {k: v for k, v in ctx.items() if k != "request"}
155
+ response = templates.TemplateResponse(ctx["request"], name, context, status_code=status_code)
156
+ token = ctx.get("session_token")
157
+ if token and ctx["request"].cookies.get(SESSION_COOKIE) != token:
158
+ response.set_cookie(SESSION_COOKIE, token, httponly=True, samesite="lax", path="/")
159
+ return response
160
+
161
+
162
+ def redirect(url: str, ctx: dict[str, Any] | None = None, status_code: int = 303) -> RedirectResponse:
163
+ response = RedirectResponse(url, status_code=status_code)
164
+ if ctx:
165
+ token = ctx.get("session_token")
166
+ if token and ctx["request"].cookies.get(SESSION_COOKIE) != token:
167
+ response.set_cookie(SESSION_COOKIE, token, httponly=True, samesite="lax", path="/")
168
+ return response
169
+
170
+
171
+ # --------------------------------------------------------------------------
172
+ # listing helpers
173
+ # --------------------------------------------------------------------------
174
+
175
+ def local_path(value: str | None, fallback: str = "/") -> str:
176
+ """Only ever redirect to a path on this clone.
177
+
178
+ `next` and `Referer` are caller-controlled, so anything that is not a plain
179
+ local path — including a scheme-relative `//host` — falls back."""
180
+ if not value or not value.startswith("/") or value.startswith("//"):
181
+ return fallback
182
+ return value
183
+
184
+
185
+ def selected_facets(request: Request) -> dict[str, list[str]]:
186
+ out: dict[str, list[str]] = {}
187
+ for group, _label in catalog.FACET_GROUPS:
188
+ values = request.query_params.getlist(f"f:{group}")
189
+ if values:
190
+ out[group] = values
191
+ return out
192
+
193
+
194
+ def facet_url(request: Request, group: str, value: str, *, on: bool) -> str:
195
+ params: list[tuple[str, str]] = []
196
+ for key, val in request.query_params.multi_items():
197
+ if key in ("page",):
198
+ continue
199
+ if key == f"f:{group}" and val == value and not on:
200
+ continue
201
+ params.append((key, val))
202
+ if on and (f"f:{group}", value) not in params:
203
+ params.append((f"f:{group}", value))
204
+ return f"{request.url.path}?{urlencode(params)}" if params else request.url.path
205
+
206
+
207
+ def page_url(request: Request, page: int) -> str:
208
+ params = [(k, v) for k, v in request.query_params.multi_items() if k != "page"]
209
+ if page > 1:
210
+ params.append(("page", str(page)))
211
+ return f"{request.url.path}?{urlencode(params)}" if params else request.url.path
212
+
213
+
214
+ def sort_url(request: Request, sort: str) -> str:
215
+ params = [(k, v) for k, v in request.query_params.multi_items() if k not in ("sort", "page")]
216
+ params.append(("sort", sort))
217
+ return f"{request.url.path}?{urlencode(params)}"
218
+
219
+
220
+ def clear_url(request: Request) -> str:
221
+ params = [(k, v) for k, v in request.query_params.multi_items() if not k.startswith("f:") and k != "page"]
222
+ return f"{request.url.path}?{urlencode(params)}" if params else request.url.path
223
+
224
+
225
+ def listing_context(request: Request, ctx: dict[str, Any], pool: list[dict[str, Any]]) -> dict[str, Any]:
226
+ page = max(1, int(request.query_params.get("page", "1") or 1))
227
+ sort = request.query_params.get("sort", "featured")
228
+ if sort not in dict(catalog.SORT_OPTIONS):
229
+ sort = "featured"
230
+ result = catalog.listing(pool, page=page, sort=sort, selected=selected_facets(request))
231
+ ctx.update({
232
+ "listing": result,
233
+ "sort_options": catalog.SORT_OPTIONS,
234
+ "facet_url": lambda g, v, on: facet_url(request, g, v, on=on),
235
+ "page_url": lambda n: page_url(request, n),
236
+ "sort_url": lambda s: sort_url(request, s),
237
+ "clear_url": clear_url(request),
238
+ "facet_labels": dict(catalog.FACET_GROUPS),
239
+ "price_band_labels": catalog.PRICE_BAND_LABELS,
240
+ })
241
+ return ctx
242
+
243
+
244
+ # --------------------------------------------------------------------------
245
+ # routes
246
+ # --------------------------------------------------------------------------
247
+
248
+ @app.get("/healthz")
249
+ def healthz() -> dict[str, object]:
250
+ return {"ok": True, "site_id": SITE_ID, "products": len(catalog.products())}
251
+
252
+
253
+ @app.get("/", response_class=HTMLResponse)
254
+ def home(request: Request) -> Response:
255
+ ctx = base_context(request)
256
+ ctx["show_campaign"] = False
257
+ home = catalog.home()
258
+ # The curated shelf lists source products; show the captured ones it names,
259
+ # topped up with featured items so the shelf keeps the source's density.
260
+ shelf = next((s for s in home["sections"] if s["kind"] == "shelf"), None)
261
+ named = [catalog.product(slug) for slug in (shelf or {}).get("slugs", [])]
262
+ products = [p for p in named if p]
263
+ if len(products) < 13:
264
+ for p in catalog.sort_items(catalog.products(), "featured"):
265
+ if p not in products:
266
+ products.append(p)
267
+ if len(products) >= 13:
268
+ break
269
+ ctx.update({"home": home, "shelf_products": products[:13]})
270
+ return render("home.html", ctx)
271
+
272
+
273
+ @app.get("/cat/{slug}", response_class=HTMLResponse)
274
+ def category_page(request: Request, slug: str) -> Response:
275
+ landing_key = catalog.landing_routes().get(f"/cat/{slug}")
276
+ if landing_key:
277
+ return _landing(request, landing_key, f"/cat/{slug}")
278
+ entry = catalog.category(slug)
279
+ if entry is None:
280
+ label = catalog.label_for(f"/cat/{slug}")
281
+ if label is None:
282
+ return not_found(request)
283
+ entry = {"slug": slug, "name": label, "url": f"/cat/{slug}", "slugs": []}
284
+ ctx = base_context(request)
285
+ ctx["outside_capture"] = not entry["slugs"] and slug != "travel"
286
+ ctx["active_nav"] = "travel"
287
+ ctx["category"] = entry
288
+ # The source listing shows its own curated subcategory row, not a
289
+ # breadcrumb roll-up; keep any entry the local catalogue can actually serve.
290
+ subnav = catalog.chrome().get("category_subnav", {}).get(slug, [])
291
+ ctx["subcategories"] = [{"name": name, "slug": href.rsplit("/", 1)[-1]}
292
+ for name, href in subnav
293
+ if catalog.category(href.rsplit("/", 1)[-1])]
294
+ return render("plp.html", listing_context(request, ctx, catalog.category_pool(slug)))
295
+
296
+
297
+ @app.get("/brand/{slug}", response_class=HTMLResponse)
298
+ def brand_page(request: Request, slug: str) -> Response:
299
+ landing_key = catalog.landing_routes().get(f"/brand/{slug}")
300
+ if landing_key:
301
+ return _landing(request, landing_key, f"/brand/{slug}")
302
+ entry = catalog.brand_map().get(slug)
303
+ if entry is None:
304
+ label = catalog.label_for(f"/brand/{slug}")
305
+ if label is None:
306
+ return not_found(request)
307
+ entry = {"slug": slug, "name": label, "slugs": []}
308
+ ctx = base_context(request)
309
+ ctx["outside_capture"] = not entry["slugs"]
310
+ ctx["category"] = {"name": entry["name"], "slug": slug, "url": f"/brand/{slug}"}
311
+ ctx["subcategories"] = []
312
+ return render("plp.html", listing_context(request, ctx, catalog.brand_pool(slug)))
313
+
314
+
315
+ @app.get("/shop-all-brands", response_class=HTMLResponse)
316
+ def brands_index(request: Request) -> Response:
317
+ ctx = base_context(request)
318
+ ctx["brands"] = sorted(catalog.brand_map().values(), key=lambda b: b["name"])
319
+ return render("brands.html", ctx)
320
+
321
+
322
+ @app.get("/search", response_class=HTMLResponse)
323
+ def search(request: Request, q: str = Query(default="")) -> Response:
324
+ ctx = base_context(request)
325
+ ctx["category"] = {"name": f'Search Results for "{q}"' if q else "Search", "slug": "search", "url": "/search"}
326
+ ctx["subcategories"] = []
327
+ ctx["search_query"] = q
328
+ ctx["is_search"] = True
329
+ return render("plp.html", listing_context(request, ctx, catalog.search_pool(q)))
330
+
331
+
332
+ @app.get("/cart", response_class=HTMLResponse)
333
+ def cart_page(request: Request, tab: str = Query(default="cart")) -> Response:
334
+ ctx = base_context(request)
335
+ ctx["bare_chrome"] = True
336
+ ctx["main_data_id"] = "cart-detail"
337
+ lines = store.cart_lines(ctx["actor"])
338
+ enriched = []
339
+ for line in lines:
340
+ p = catalog.product(line["product_slug"])
341
+ color = catalog.color_by_name(p, line["color"]) if p else None
342
+ enriched.append({**line, "product": p,
343
+ "image": (color or {}).get("thumb") or (p or {}).get("mainImage"),
344
+ "line_total": round(line["unit_price"] * line["quantity"], 2)})
345
+ wish = []
346
+ for item in store.wishlist(ctx["actor"]):
347
+ p = catalog.product(item["product_slug"])
348
+ if p:
349
+ wish.append({**item, "product": p})
350
+ ctx.update({"lines": enriched, "totals": store.cart_totals(lines), "tab": tab,
351
+ "wishlist": wish,
352
+ "free_shipping_threshold": store.FREE_SHIPPING_THRESHOLD})
353
+ return render("cart.html", ctx)
354
+
355
+
356
+ @app.post("/cart/add")
357
+ def cart_add(request: Request, product: str = Form(...), color: str = Form(default=""),
358
+ size: str = Form(default=""), quantity: int = Form(default=1)) -> Response:
359
+ ctx = base_context(request)
360
+ p = catalog.product(product)
361
+ if p is None:
362
+ return not_found(request)
363
+ sku = catalog.sku_for(p, color or None, size or None)
364
+ if sku is None or sku.get("status") != "InStock":
365
+ return redirect(f"{product}?error=unavailable"
366
+ + (f"&color={color}" if color else ""), ctx)
367
+ store.add_to_cart(
368
+ ctx["actor"], sku_id=sku["id"], product_slug=product, color=sku.get("color"),
369
+ size=sku.get("size"), unit_price=float(sku.get("salePrice") or sku.get("listPrice") or 0),
370
+ list_price=float(sku.get("listPrice") or 0), quantity=max(1, quantity))
371
+ return redirect("/cart", ctx)
372
+
373
+
374
+ @app.post("/cart/update")
375
+ def cart_update(request: Request, sku: str = Form(...), quantity: int = Form(...)) -> Response:
376
+ ctx = base_context(request)
377
+ store.set_line_quantity(ctx["actor"], sku, quantity)
378
+ return redirect("/cart", ctx)
379
+
380
+
381
+ @app.post("/cart/remove")
382
+ def cart_remove(request: Request, sku: str = Form(...)) -> Response:
383
+ ctx = base_context(request)
384
+ store.remove_line(ctx["actor"], sku)
385
+ return redirect("/cart", ctx)
386
+
387
+
388
+ @app.post("/wishlist/toggle")
389
+ def wishlist_toggle(request: Request, product: str = Form(...), color: str = Form(default=""),
390
+ back: str = Form(default="/cart")) -> Response:
391
+ ctx = base_context(request)
392
+ store.toggle_wishlist(ctx["actor"], product, color or None)
393
+ return redirect(local_path(back, "/cart"), ctx)
394
+
395
+
396
+ @app.get("/checkout", response_class=HTMLResponse)
397
+ def checkout_entry(request: Request) -> Response:
398
+ """Checkout entry is reachable and shows the real summary, but this clone
399
+ deliberately stops before any order submission (out of frozen scope)."""
400
+ ctx = base_context(request)
401
+ ctx["bare_chrome"] = True
402
+ lines = store.cart_lines(ctx["actor"])
403
+ if not lines:
404
+ return redirect("/cart", ctx)
405
+ ctx.update({"totals": store.cart_totals(lines), "line_count": sum(line["quantity"] for line in lines),
406
+ "addresses": store.addresses(store.MEMBER["email"]) if ctx["member"] else []})
407
+ return render("checkout.html", ctx)
408
+
409
+
410
+ @app.get("/account/signin", response_class=HTMLResponse)
411
+ def signin_page(request: Request, next: str = Query(default="/account")) -> Response:
412
+ ctx = base_context(request)
413
+ next = local_path(next, "/account")
414
+ if ctx["member"]:
415
+ return redirect(next, ctx)
416
+ ctx.update({"next": next, "error": None, "email": ""})
417
+ return render("signin.html", ctx)
418
+
419
+
420
+ @app.post("/account/signin", response_class=HTMLResponse)
421
+ def signin_submit(request: Request, email: str = Form(default=""), password: str = Form(default=""),
422
+ next: str = Form(default="/account")) -> Response:
423
+ ctx = base_context(request)
424
+ next = local_path(next, "/account")
425
+ anon_actor = ctx["actor"]
426
+ if not email or not password:
427
+ ctx.update({"next": next, "email": email,
428
+ "error": "Enter your email address and password to sign in."})
429
+ return render("signin.html", ctx, status_code=400)
430
+ auth = store.services().auth
431
+ # A password reset invalidates the session it ran in, so mint or revive one
432
+ # before authenticating rather than failing a correct credential pair.
433
+ session_token, _ = auth.ensure_session(ctx["session_token"])
434
+ ctx["session_token"] = session_token
435
+ try:
436
+ result = auth.sign_in(session_token, email=email, password=password)
437
+ except Exception:
438
+ ctx.update({"next": next, "email": email,
439
+ "error": "The email address or password you entered is incorrect."})
440
+ return render("signin.html", ctx, status_code=401)
441
+ # sign_in rotates the session token; the browser must be given the new one.
442
+ ctx["session_token"] = result["session_token"]
443
+ signed_in_email = (result.get("account") or {}).get("email_normalized", email)
444
+ if anon_actor.startswith("anon:"):
445
+ store.merge_cart(anon_actor, signed_in_email)
446
+ response = redirect(next)
447
+ response.set_cookie(SESSION_COOKIE, ctx["session_token"], httponly=True, samesite="lax", path="/")
448
+ return response
449
+
450
+
451
+ @app.get("/account/register", response_class=HTMLResponse)
452
+ def register_page(request: Request) -> Response:
453
+ ctx = base_context(request)
454
+ if ctx["member"]:
455
+ return redirect("/account", ctx)
456
+ ctx.update({"errors": {}, "values": {}, "stage": _registration_stage(ctx)})
457
+ return render("register.html", ctx)
458
+
459
+
460
+ def _registration_stage(ctx: dict[str, Any]) -> str:
461
+ status = store.services().auth.session_flow_status(ctx["session_token"], purpose="registration")
462
+ return "challenge" if status.get("state") == "challenge" else "details"
463
+
464
+
465
+ @app.post("/account/register", response_class=HTMLResponse)
466
+ def register_submit(request: Request, email: str = Form(default=""), display_name: str = Form(default=""),
467
+ password: str = Form(default="")) -> Response:
468
+ ctx = base_context(request)
469
+ auth = store.services().auth
470
+ # The store validates by raising; it returns the normalised values on success.
471
+ try:
472
+ auth.validate_registration_details(email=email, display_name=display_name, password=password)
473
+ auth.start_registration(ctx["session_token"], email=email, display_name=display_name,
474
+ password=password, restart_invalid_flow=True)
475
+ except Exception as exc:
476
+ message = str(exc) or "Check the details you entered."
477
+ field = ("email" if "email" in message else
478
+ "display_name" if "display name" in message else
479
+ "password" if "password" in message else "email")
480
+ ctx.update({"errors": {field: message[:1].upper() + message[1:] + "."},
481
+ "values": {"email": email, "display_name": display_name}, "stage": "details"})
482
+ return render("register.html", ctx, status_code=400)
483
+ return redirect("/account/register/verify", ctx)
484
+
485
+
486
+ @app.get("/account/register/verify", response_class=HTMLResponse)
487
+ def register_verify_page(request: Request) -> Response:
488
+ ctx = base_context(request)
489
+ if ctx["member"]:
490
+ return redirect("/account", ctx)
491
+ ctx.update({"errors": {}, "values": {}, "stage": "challenge",
492
+ "mail": store.services().auth.local_mail_for_session(
493
+ ctx["session_token"], purpose="registration")})
494
+ return render("register.html", ctx)
495
+
496
+
497
+ @app.post("/account/register/verify", response_class=HTMLResponse)
498
+ def register_verify(request: Request, code: str = Form(default="")) -> Response:
499
+ ctx = base_context(request)
500
+ auth = store.services().auth
501
+ try:
502
+ auth.verify_registration_code(ctx["session_token"], code)
503
+ result = auth.complete_registration(ctx["session_token"])
504
+ except Exception:
505
+ ctx.update({"errors": {"code": "That verification code is not valid or has expired."},
506
+ "values": {}, "stage": "challenge",
507
+ "mail": auth.local_mail_for_session(ctx["session_token"], purpose="registration")})
508
+ return render("register.html", ctx, status_code=400)
509
+ token = result.get("session_token") or ctx["session_token"]
510
+ response = redirect("/account")
511
+ response.set_cookie(SESSION_COOKIE, token, httponly=True, samesite="lax", path="/")
512
+ return response
513
+
514
+
515
+ @app.get("/account/forgot-password", response_class=HTMLResponse)
516
+ def forgot_page(request: Request) -> Response:
517
+ ctx = base_context(request)
518
+ ctx.update({"errors": {}, "values": {}, "stage": "request",
519
+ "mail": None})
520
+ return render("forgot_password.html", ctx)
521
+
522
+
523
+ @app.post("/account/forgot-password", response_class=HTMLResponse)
524
+ def forgot_submit(request: Request, email: str = Form(default="")) -> Response:
525
+ ctx = base_context(request)
526
+ if not email:
527
+ ctx.update({"errors": {"email": "Enter the email address on your account."},
528
+ "values": {}, "stage": "request", "mail": None})
529
+ return render("forgot_password.html", ctx, status_code=400)
530
+ # start_password_reset never discloses whether the address exists.
531
+ store.services().auth.start_password_reset(ctx["session_token"], email=email,
532
+ restart_invalid_flow=True)
533
+ return redirect("/account/reset-password", ctx)
534
+
535
+
536
+ @app.get("/account/reset-password", response_class=HTMLResponse)
537
+ def reset_page(request: Request) -> Response:
538
+ ctx = base_context(request)
539
+ ctx.update({"errors": {}, "values": {}, "stage": "reset",
540
+ "mail": store.services().auth.local_mail_for_session(
541
+ ctx["session_token"], purpose="password-reset")})
542
+ return render("forgot_password.html", ctx)
543
+
544
+
545
+ @app.post("/account/reset-password", response_class=HTMLResponse)
546
+ def reset_submit(request: Request, code: str = Form(default=""),
547
+ password: str = Form(default="")) -> Response:
548
+ ctx = base_context(request)
549
+ auth = store.services().auth
550
+ try:
551
+ auth.verify_password_reset_code(ctx["session_token"], code)
552
+ auth.complete_password_reset(ctx["session_token"], new_password=password)
553
+ except Exception:
554
+ ctx.update({"errors": {"code": "That reset code is not valid or has expired."},
555
+ "values": {}, "stage": "reset",
556
+ "mail": auth.local_mail_for_session(ctx["session_token"], purpose="password-reset")})
557
+ return render("forgot_password.html", ctx, status_code=400)
558
+ return redirect("/account/signin?reset=1", ctx)
559
+
560
+
561
+ @app.post("/account/signout")
562
+ def signout(request: Request) -> Response:
563
+ ctx = base_context(request)
564
+ store.services().auth.sign_out(ctx["session_token"])
565
+ response = redirect("/", None)
566
+ response.delete_cookie(SESSION_COOKIE, path="/")
567
+ return response
568
+
569
+
570
+ def require_member(request: Request, ctx: dict[str, Any], path: str) -> Response | None:
571
+ if ctx["member"]:
572
+ return None
573
+ return redirect(f"/account/signin?next={path}", ctx)
574
+
575
+
576
+ @app.get("/account", response_class=HTMLResponse)
577
+ def account_page(request: Request) -> Response:
578
+ ctx = base_context(request)
579
+ guard = require_member(request, ctx, "/account")
580
+ if guard:
581
+ return guard
582
+ email = ctx["member"]["email"]
583
+ ctx.update({"orders": store.orders(email)[:2], "addresses": store.addresses(email),
584
+ "wishlist_count": len(store.wishlist(email)), "account_section": "overview"})
585
+ return render("account.html", ctx)
586
+
587
+
588
+ @app.get("/account/order-history", response_class=HTMLResponse)
589
+ def order_history(request: Request) -> Response:
590
+ ctx = base_context(request)
591
+ guard = require_member(request, ctx, "/account/order-history")
592
+ if guard:
593
+ return guard
594
+ orders = store.orders(ctx["member"]["email"])
595
+ for o in orders:
596
+ for line in o["lines"]:
597
+ line["product"] = catalog.product(line["product_slug"])
598
+ ctx.update({"orders": orders, "account_section": "orders"})
599
+ return render("orders.html", ctx)
600
+
601
+
602
+ @app.get("/account/orders/{order_number}", response_class=HTMLResponse)
603
+ def order_detail(request: Request, order_number: str) -> Response:
604
+ ctx = base_context(request)
605
+ guard = require_member(request, ctx, f"/account/orders/{order_number}")
606
+ if guard:
607
+ return guard
608
+ found = store.order(ctx["member"]["email"], order_number)
609
+ if not found:
610
+ return not_found(request)
611
+ for line in found["lines"]:
612
+ line["product"] = catalog.product(line["product_slug"])
613
+ ctx.update({"order": found, "account_section": "orders",
614
+ "address": next((a for a in store.addresses(ctx["member"]["email"])
615
+ if a["label"] == found["ship_to"]), None)})
616
+ return render("order_detail.html", ctx)
617
+
618
+
619
+ @app.get("/account/wishlist", response_class=HTMLResponse)
620
+ def wishlist_page(request: Request) -> Response:
621
+ ctx = base_context(request)
622
+ guard = require_member(request, ctx, "/account/wishlist")
623
+ if guard:
624
+ return guard
625
+ items = []
626
+ for item in store.wishlist(ctx["member"]["email"]):
627
+ p = catalog.product(item["product_slug"])
628
+ if p:
629
+ items.append({**item, "product": p})
630
+ ctx.update({"items": items, "account_section": "wishlist"})
631
+ return render("wishlist.html", ctx)
632
+
633
+
634
+ @app.post("/subscribe/{channel}")
635
+ def subscribe(request: Request, channel: str, email: str = Form(default=""),
636
+ phone: str = Form(default="")) -> Response:
637
+ ctx = base_context(request)
638
+ recipient = email or phone
639
+ if recipient:
640
+ store.record_outbox(channel, recipient, "marketing-signup")
641
+ referer = request.headers.get("referer", "")
642
+ origin = str(request.base_url).rstrip("/")
643
+ back = referer[len(origin):] if referer.startswith(origin) else "/"
644
+ return redirect(local_path(back, "/"), ctx)
645
+
646
+
647
+ def _landing(request: Request, key: str, path: str) -> Response:
648
+ """A top-level landing page: the same listing family, with the products the
649
+ captured page-one listing showed and the source's anchor sub-navigation."""
650
+ meta = catalog.landing_meta(key)
651
+ ctx = base_context(request)
652
+ ctx["active_nav"] = key
653
+ ctx["category"] = {"name": meta["h1"], "slug": key, "url": path}
654
+ ctx["subcategories"] = []
655
+ ctx["anchor_nav"] = meta["subnav"]
656
+ ctx["source_result_label"] = meta["resultCount"]
657
+ return render("plp.html", listing_context(request, ctx, catalog.landing_pool(key)))
658
+
659
+
660
+ @app.get("/rc/{slug}", response_class=HTMLResponse)
661
+ def curated_page(request: Request, slug: str) -> Response:
662
+ landing_key = catalog.landing_routes().get(f"/rc/{slug}")
663
+ if landing_key:
664
+ return _landing(request, landing_key, f"/rc/{slug}")
665
+ """Curated collections the chrome links to. The captured data volume covers
666
+ the Travel category, so most of these resolve to a real but empty listing
667
+ rather than to a dead link."""
668
+ label = catalog.label_for(f"/rc/{slug}")
669
+ if label is None:
670
+ return not_found(request)
671
+ ctx = base_context(request)
672
+ ctx["category"] = {"name": label, "slug": slug, "url": f"/rc/{slug}"}
673
+ ctx["subcategories"] = []
674
+ ctx["outside_capture"] = True
675
+ return render("plp.html", listing_context(request, ctx, []))
676
+
677
+
678
+ INFORMATIONAL_PREFIXES = ("/service/", "/info/", "/explore", "/campaign/",
679
+ "/family/", "/sc/", "/bulletin")
680
+
681
+
682
+ @app.get("/service/{slug:path}", response_class=HTMLResponse)
683
+ def service_page(request: Request, slug: str) -> Response:
684
+ return _informational(request, f"/service/{slug}")
685
+
686
+
687
+ @app.get("/info/{slug:path}", response_class=HTMLResponse)
688
+ def info_page(request: Request, slug: str) -> Response:
689
+ return _informational(request, f"/info/{slug}")
690
+
691
+
692
+ @app.get("/campaign/{slug:path}", response_class=HTMLResponse)
693
+ def campaign_page(request: Request, slug: str) -> Response:
694
+ return _informational(request, f"/campaign/{slug}")
695
+
696
+
697
+ @app.get("/family/{slug:path}", response_class=HTMLResponse)
698
+ def family_page(request: Request, slug: str) -> Response:
699
+ return _informational(request, f"/family/{slug}")
700
+
701
+
702
+ @app.get("/sc/{slug:path}", response_class=HTMLResponse)
703
+ def store_page(request: Request, slug: str) -> Response:
704
+ return _informational(request, f"/sc/{slug}")
705
+
706
+
707
+ @app.get("/explore", response_class=HTMLResponse)
708
+ @app.get("/explore/{slug:path}", response_class=HTMLResponse)
709
+ def explore_page(request: Request, slug: str = "") -> Response:
710
+ return _informational(request, f"/explore/{slug}" if slug else "/explore")
711
+
712
+
713
+ @app.get("/bulletin", response_class=HTMLResponse)
714
+ @app.get("/bulletin/{slug:path}", response_class=HTMLResponse)
715
+ def bulletin_page(request: Request, slug: str = "") -> Response:
716
+ return _informational(request, f"/bulletin/{slug}" if slug else "/bulletin")
717
+
718
+
719
+ def _informational(request: Request, path: str) -> Response:
720
+ """A real local page for a first-party informational route the chrome links
721
+ to. Its source content was never captured, so the page says exactly that
722
+ instead of inventing copy or leaving the link dead."""
723
+ label = catalog.label_for(path)
724
+ if label is None:
725
+ return not_found(request)
726
+ ctx = base_context(request)
727
+ ctx.update({"page_title": label, "page_path": path})
728
+ return render("informational.html", ctx)
729
+
730
+
731
+ @app.get("/{slug}", response_class=HTMLResponse)
732
+ def product_page(request: Request, slug: str, color: str = Query(default=""),
733
+ size: str = Query(default=""), error: str = Query(default="")) -> Response:
734
+ p = catalog.product("/" + slug)
735
+ if p is None:
736
+ # Some chrome links sit at the site root without a section prefix; serve
737
+ # the informational page rather than a dead link.
738
+ if catalog.label_for("/" + slug):
739
+ return _informational(request, "/" + slug)
740
+ return not_found(request)
741
+ ctx = base_context(request)
742
+ selected_color = catalog.color_by_name(p, color) or catalog.default_color(p)
743
+ available_sizes = selected_color.get("sizes") if selected_color else []
744
+ selected_size = size if size in available_sizes else (available_sizes[0] if available_sizes else None)
745
+ sku = catalog.sku_for(p, (selected_color or {}).get("name"), selected_size)
746
+ ctx.update({
747
+ "product": p,
748
+ "selected_color": selected_color,
749
+ "selected_size": selected_size,
750
+ "sku": sku,
751
+ "gallery": catalog.gallery_for(p, selected_color),
752
+ "error": error,
753
+ "active_nav": "travel",
754
+ "in_wishlist": any(w["product_slug"] == p["slug"] for w in store.wishlist(ctx["actor"])),
755
+ })
756
+ return render("pdp.html", ctx)
757
+
758
+
759
+ def not_found(request: Request) -> Response:
760
+ ctx = base_context(request)
761
+ return render("404.html", ctx, status_code=404)
762
+
763
+
764
+ @app.exception_handler(404)
765
+ def handle_404(request: Request, exc: Exception) -> Response:
766
+ return not_found(request)
767
+
768
+
769
+ def main() -> None:
770
+ """Run the clone directly, which is how the acceptance manual and the
771
+ diagnostic driver's first boot candidate start it.
772
+
773
+ Host, port and data directory come from the environment the runtime
774
+ contract defines, so the same entry point serves local review and an
775
+ isolated diagnostic run.
776
+ """
777
+ import os
778
+
779
+ import uvicorn
780
+
781
+ uvicorn.run(
782
+ app,
783
+ host=os.environ.get("HOST", "127.0.0.1"),
784
+ port=int(os.environ.get("PORT", "8000")),
785
+ log_level=os.environ.get("LOG_LEVEL", "warning"),
786
+ )
787
+
788
+
789
+ if __name__ == "__main__":
790
+ main()
tasks/backcountry/environment/reference/clone/backend/site_backend_integration.py ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ auth = LocalAuthStore(
86
+ backend.lifecycle.database_path,
87
+ site_id=backend.config.site_id,
88
+ )
89
+ auth.ensure_schema()
90
+ return backend, auth
91
+
92
+
93
+ def run_stdio_bridge() -> None:
94
+ """Run only operations frozen in this site's descriptor."""
95
+
96
+ backend, auth = open_site_services()
97
+ descriptor = json.loads(BRIDGE_DESCRIPTOR_PATH.read_text(encoding="utf-8"))
98
+ allowed = validate_allowlist(
99
+ descriptor,
100
+ expected_site_id=backend.config.site_id,
101
+ )
102
+ serve_jsonl(backend, auth, allowed, sys.stdin, sys.stdout)
103
+
104
+
105
+ if __name__ == "__main__":
106
+ import argparse
107
+ import sys
108
+
109
+ parser = argparse.ArgumentParser(prog="websitebench-node-backend-bridge")
110
+ parser.add_argument("--stdio", action="store_true", required=True)
111
+ parser.parse_args()
112
+ run_stdio_bridge()
tasks/backcountry/environment/reference/clone/catalog.py ADDED
@@ -0,0 +1,440 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Deterministic in-process catalogue for the Backcountry offline clone.
2
+
3
+ Records originate from sanitized source evidence normalised into
4
+ ``data/catalog.json`` (schema backcountry.clone-catalog.v2). This module only
5
+ queries, facets, sorts and paginates them; it performs no network access.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import json
11
+ import re
12
+ from dataclasses import dataclass
13
+ from functools import lru_cache
14
+ from pathlib import Path
15
+ from typing import Any
16
+
17
+ DATA = Path(__file__).resolve().parent / "data"
18
+
19
+ PAGE_SIZE = 42 # observed: 42 product tiles per source listing page
20
+
21
+ SORT_OPTIONS = [
22
+ ("featured", "Featured"),
23
+ ("price-low-high", "Price (Low to High)"),
24
+ ("price-high-low", "Price (High to Low)"),
25
+ ("top-rated", "Top Rated"),
26
+ ("most-reviewed", "Most Reviewed"),
27
+ ("brand-a-z", "Brand (A to Z)"),
28
+ ]
29
+
30
+ PRICE_BANDS = [
31
+ ("under-50", "Under $50", 0.0, 50.0),
32
+ ("50-100", "$50 - $100", 50.0, 100.0),
33
+ ("100-200", "$100 - $200", 100.0, 200.0),
34
+ ("200-300", "$200 - $300", 200.0, 300.0),
35
+ ("300-plus", "$300 and Up", 300.0, float("inf")),
36
+ ]
37
+ PRICE_BAND_LABELS = {k: label for k, label, _lo, _hi in PRICE_BANDS}
38
+
39
+ # Facet groups in source sidebar order. "attr:<Name>" reads the product's own
40
+ # attribute vocabulary, which the source uses for the same sidebar groups.
41
+ FACET_GROUPS: list[tuple[str, str]] = [
42
+ ("categories", "Categories"),
43
+ ("brand", "Brand"),
44
+ ("color", "Color"),
45
+ ("sale", "Sale"),
46
+ ("attr:Features", "Features"),
47
+ ("price", "Price"),
48
+ ("attr:Age", "Age"),
49
+ ("attr:Recommended Use", "Recommended Use"),
50
+ ("attr:Volume", "Volume"),
51
+ ("attr:Shop By", "Shop By"),
52
+ ("attr:Access", "Access"),
53
+ ("attr:Material", "Material"),
54
+ ("attr:Sustainability", "Responsible Collection"),
55
+ ]
56
+
57
+
58
+ def _load(name: str) -> dict[str, Any]:
59
+ return json.loads((DATA / name).read_text(encoding="utf-8"))
60
+
61
+
62
+ @lru_cache(maxsize=1)
63
+ def catalog() -> dict[str, Any]:
64
+ return _load("catalog.json")
65
+
66
+
67
+ @lru_cache(maxsize=1)
68
+ def nav() -> list[dict[str, Any]]:
69
+ return _load("nav.json")["items"]
70
+
71
+
72
+ @lru_cache(maxsize=1)
73
+ def chrome() -> dict[str, Any]:
74
+ return _load("chrome.json")
75
+
76
+
77
+ @lru_cache(maxsize=1)
78
+ def home() -> dict[str, Any]:
79
+ return _load("home.json")
80
+
81
+
82
+ @lru_cache(maxsize=1)
83
+ def products() -> list[dict[str, Any]]:
84
+ return catalog()["products"]
85
+
86
+
87
+ @lru_cache(maxsize=1)
88
+ def by_slug() -> dict[str, dict[str, Any]]:
89
+ return {p["slug"]: p for p in products()}
90
+
91
+
92
+ def product(slug: str) -> dict[str, Any] | None:
93
+ return by_slug().get(slug if slug.startswith("/") else "/" + slug)
94
+
95
+
96
+ # --------------------------------------------------------------------------
97
+ # derived product facts
98
+ # --------------------------------------------------------------------------
99
+
100
+ def current_price(p: dict[str, Any]) -> float:
101
+ value = p["price"].get("minSale")
102
+ if value is None:
103
+ value = p["price"].get("minList")
104
+ return float(value or 0.0)
105
+
106
+
107
+ def price_range(p: dict[str, Any]) -> tuple[float, float]:
108
+ lo = p["price"].get("minSale") or p["price"].get("minList") or 0.0
109
+ hi = p["price"].get("maxSale") or p["price"].get("maxList") or lo
110
+ return float(lo), float(hi)
111
+
112
+
113
+ def on_sale(p: dict[str, Any]) -> bool:
114
+ return bool(p["price"].get("maxDiscount") or p["price"].get("variationsOnSale"))
115
+
116
+
117
+ def list_price(p: dict[str, Any]) -> tuple[float, float]:
118
+ lo = p["price"].get("minList") or 0.0
119
+ hi = p["price"].get("maxList") or lo
120
+ return float(lo), float(hi)
121
+
122
+
123
+ def categories_of(p: dict[str, Any]) -> list[str]:
124
+ return [b["name"] for b in p.get("breadcrumbs", []) if b.get("name")]
125
+
126
+
127
+ def color_families(p: dict[str, Any]) -> list[str]:
128
+ """The payload labels each SKU colour with a family; that is the source's
129
+ own colour facet vocabulary."""
130
+ out: list[str] = []
131
+ for s in p.get("skus", []):
132
+ fam = (s.get("colorFamily") or "").strip()
133
+ if fam:
134
+ label = fam.title()
135
+ if label not in out:
136
+ out.append(label)
137
+ return out
138
+
139
+
140
+ def price_band(p: dict[str, Any]) -> str | None:
141
+ value = current_price(p)
142
+ for key, _label, lo, hi in PRICE_BANDS:
143
+ if lo <= value < hi:
144
+ return key
145
+ return None
146
+
147
+
148
+ def _attr(p: dict[str, Any], name: str) -> list[str]:
149
+ return list(p.get("attributes", {}).get(name, []))
150
+
151
+
152
+ def facet_values(p: dict[str, Any], group: str) -> list[str]:
153
+ if group == "categories":
154
+ return categories_of(p)
155
+ if group == "brand":
156
+ return [p["brand"]] if p.get("brand") else []
157
+ if group == "color":
158
+ return color_families(p)
159
+ if group == "sale":
160
+ return ["On Sale"] if on_sale(p) else []
161
+ if group == "price":
162
+ band = price_band(p)
163
+ return [band] if band else []
164
+ if group.startswith("attr:"):
165
+ return _attr(p, group[5:])
166
+ return []
167
+
168
+
169
+ def in_stock_skus(p: dict[str, Any]) -> list[dict[str, Any]]:
170
+ return [s for s in p.get("skus", []) if s.get("status") == "InStock" and (s.get("stockLevel") or 0) > 0]
171
+
172
+
173
+ def sku_for(p: dict[str, Any], color: str | None, size: str | None) -> dict[str, Any] | None:
174
+ for s in p.get("skus", []):
175
+ if (color is None or s.get("color") == color) and (size is None or s.get("size") == size):
176
+ return s
177
+ return None
178
+
179
+
180
+ def color_by_name(p: dict[str, Any], name: str | None) -> dict[str, Any] | None:
181
+ for c in p.get("colors", []):
182
+ if c.get("name") == name:
183
+ return c
184
+ return None
185
+
186
+
187
+ def default_color(p: dict[str, Any]) -> dict[str, Any] | None:
188
+ key = p.get("selectedColorKey")
189
+ for c in p.get("colors", []):
190
+ if c.get("key") == key:
191
+ return c
192
+ return p["colors"][0] if p.get("colors") else None
193
+
194
+
195
+ def gallery_for(p: dict[str, Any], color: dict[str, Any] | None) -> list[str]:
196
+ images: list[str] = []
197
+ if color:
198
+ if color.get("large"):
199
+ images.append(color["large"])
200
+ images.extend(p.get("detailImagesByColor", {}).get(color.get("id") or "", []))
201
+ if not images:
202
+ images = [i for i in [p.get("mainImage")] if i] + list(p.get("detailImages", []))
203
+ out: list[str] = []
204
+ for i in images:
205
+ if i and i not in out:
206
+ out.append(i)
207
+ return out
208
+
209
+
210
+ # --------------------------------------------------------------------------
211
+ # listing
212
+ # --------------------------------------------------------------------------
213
+
214
+ def _matches(p: dict[str, Any], selected: dict[str, list[str]]) -> bool:
215
+ for group, wanted in selected.items():
216
+ if wanted and not set(facet_values(p, group)) & set(wanted):
217
+ return False
218
+ return True
219
+
220
+
221
+ @dataclass(frozen=True)
222
+ class Listing:
223
+ items: list[dict[str, Any]]
224
+ total: int
225
+ page: int
226
+ pages: int
227
+ facets: list[dict[str, Any]]
228
+ sort: str
229
+ selected: dict[str, list[str]]
230
+
231
+
232
+ def facet_counts(pool: list[dict[str, Any]], selected: dict[str, list[str]]) -> list[dict[str, Any]]:
233
+ """Count each value against the pool filtered by every *other* group, so
234
+ sibling options stay selectable exactly as they do in the source sidebar."""
235
+ out = []
236
+ for group, label in FACET_GROUPS:
237
+ others = {g: v for g, v in selected.items() if g != group}
238
+ subset = [p for p in pool if _matches(p, others)]
239
+ counts: dict[str, int] = {}
240
+ for p in subset:
241
+ for value in facet_values(p, group):
242
+ counts[value] = counts.get(value, 0) + 1
243
+ if not counts:
244
+ continue
245
+ if group == "price":
246
+ keys = [k for k, _l, _lo, _hi in PRICE_BANDS if k in counts]
247
+ values = [{"value": k, "label": PRICE_BAND_LABELS[k], "count": counts[k],
248
+ "selected": k in selected.get(group, [])} for k in keys]
249
+ else:
250
+ values = [{"value": v, "label": v, "count": counts[v],
251
+ "selected": v in selected.get(group, [])}
252
+ for v in sorted(counts, key=lambda v: (-counts[v], v))]
253
+ out.append({"group": group, "label": label, "options": values})
254
+ return out
255
+
256
+
257
+ def sort_items(items: list[dict[str, Any]], sort: str) -> list[dict[str, Any]]:
258
+ if sort == "price-low-high":
259
+ return sorted(items, key=current_price)
260
+ if sort == "price-high-low":
261
+ return sorted(items, key=current_price, reverse=True)
262
+ if sort == "top-rated":
263
+ return sorted(items, key=lambda p: (-(p["reviews"].get("average") or 0),
264
+ -(p["reviews"].get("count") or 0)))
265
+ if sort == "most-reviewed":
266
+ return sorted(items, key=lambda p: -(p["reviews"].get("count") or 0))
267
+ if sort == "brand-a-z":
268
+ return sorted(items, key=lambda p: ((p.get("brand") or "").lower(), (p.get("title") or "").lower()))
269
+ return sorted(items, key=lambda p: p.get("listingIndex") or 10 ** 6)
270
+
271
+
272
+ def listing(pool: list[dict[str, Any]], *, page: int = 1, sort: str = "featured",
273
+ selected: dict[str, list[str]] | None = None) -> Listing:
274
+ selected = {g: v for g, v in (selected or {}).items() if v}
275
+ facets = facet_counts(pool, selected)
276
+ filtered = [p for p in pool if _matches(p, selected)]
277
+ ordered = sort_items(filtered, sort)
278
+ total = len(ordered)
279
+ pages = max(1, (total + PAGE_SIZE - 1) // PAGE_SIZE)
280
+ page = max(1, min(page, pages))
281
+ start = (page - 1) * PAGE_SIZE
282
+ return Listing(items=ordered[start:start + PAGE_SIZE], total=total, page=page,
283
+ pages=pages, facets=facets, sort=sort, selected=selected)
284
+
285
+
286
+ # --------------------------------------------------------------------------
287
+ # pools
288
+ # --------------------------------------------------------------------------
289
+
290
+ def slugify(label: str) -> str:
291
+ return re.sub(r"[^a-z0-9]+", "-", (label or "").lower()).strip("-")
292
+
293
+
294
+ @lru_cache(maxsize=1)
295
+ def landings() -> dict[str, list[str]]:
296
+ """Slugs each captured top-level landing page shows, in listing order."""
297
+ return catalog().get("landings", {})
298
+
299
+
300
+ @lru_cache(maxsize=1)
301
+ def landing_routes() -> dict[str, str]:
302
+ """Map each landing route path to the nav key whose products it serves."""
303
+ routes: dict[str, str] = {}
304
+ for item in nav():
305
+ href = (item.get("href") or "").split("?")[0]
306
+ if href and item["key"] in landings():
307
+ routes[href] = item["key"]
308
+ return routes
309
+
310
+
311
+ @lru_cache(maxsize=1)
312
+ def landing_meta_all() -> dict[str, dict[str, Any]]:
313
+ return _load("landings.json")
314
+
315
+
316
+ def landing_meta(key: str) -> dict[str, Any]:
317
+ return landing_meta_all().get(key, {"h1": key.title(), "subnav": [], "resultCount": None})
318
+
319
+
320
+ def landing_pool(key: str) -> list[dict[str, Any]]:
321
+ wanted = landings().get(key, [])
322
+ order = {slug: i for i, slug in enumerate(wanted)}
323
+ pool = [p for p in products() if p["slug"] in order]
324
+ return sorted(pool, key=lambda p: order[p["slug"]])
325
+
326
+
327
+ @lru_cache(maxsize=1)
328
+ def category_map() -> dict[str, dict[str, Any]]:
329
+ """Every breadcrumb category the captured catalogue can actually serve."""
330
+ out: dict[str, dict[str, Any]] = {}
331
+ for p in products():
332
+ for b in p.get("breadcrumbs", []):
333
+ url = b.get("url") or ""
334
+ key = url.rsplit("/", 1)[-1] if url.startswith("/cat/") else slugify(b["name"])
335
+ entry = out.setdefault(key, {"slug": key, "name": b["name"], "url": url or f"/cat/{key}", "slugs": []})
336
+ if p["slug"] not in entry["slugs"]:
337
+ entry["slugs"].append(p["slug"])
338
+ return out
339
+
340
+
341
+ def category(slug: str) -> dict[str, Any] | None:
342
+ return category_map().get(slug)
343
+
344
+
345
+ def category_pool(slug: str) -> list[dict[str, Any]]:
346
+ if slug == "travel":
347
+ return list(products())
348
+ entry = category(slug)
349
+ if not entry:
350
+ return []
351
+ wanted = set(entry["slugs"])
352
+ return [p for p in products() if p["slug"] in wanted]
353
+
354
+
355
+ def brand_map() -> dict[str, dict[str, Any]]:
356
+ out: dict[str, dict[str, Any]] = {}
357
+ for p in products():
358
+ if not p.get("brand"):
359
+ continue
360
+ key = (p.get("brandUrl") or "").rsplit("/", 1)[-1] or slugify(p["brand"])
361
+ entry = out.setdefault(key, {"slug": key, "name": p["brand"], "slugs": []})
362
+ entry["slugs"].append(p["slug"])
363
+ return out
364
+
365
+
366
+ def brand_pool(slug: str) -> list[dict[str, Any]]:
367
+ entry = brand_map().get(slug)
368
+ if not entry:
369
+ return []
370
+ wanted = set(entry["slugs"])
371
+ return [p for p in products() if p["slug"] in wanted]
372
+
373
+
374
+ @lru_cache(maxsize=1)
375
+ def link_labels() -> dict[str, str]:
376
+ """Every first-party destination the reproduced chrome links to, with the
377
+ label the source used for it. Used to serve a real page for a route the
378
+ captured data volume does not populate, instead of a dead link."""
379
+ labels: dict[str, str] = {}
380
+
381
+ def note(href: str | None, label: str | None) -> None:
382
+ if not href or not href.startswith("/") or href.startswith("//"):
383
+ return
384
+ text = (label or "").strip()
385
+ # Chrome links carry query strings and fragments; index the bare path.
386
+ path = href.split("?")[0].split("#")[0]
387
+ if path:
388
+ labels.setdefault(path, text[:90] or "Shop")
389
+
390
+ for item in nav():
391
+ note(item.get("href"), item.get("label"))
392
+ for column in item.get("columns", []):
393
+ if column.get("kind") == "promo":
394
+ note(column.get("href"), (column.get("caption") or column.get("alt") or "").split(".")[0])
395
+ continue
396
+ for block in column.get("blocks", []):
397
+ if block.get("type") == "heading":
398
+ note(block.get("href"), block.get("label"))
399
+ for link in block.get("links", []):
400
+ note(link.get("href"), link.get("label"))
401
+
402
+ footer = chrome().get("footer", {})
403
+ for column in footer.get("columns", []):
404
+ for label, href in column.get("links", []):
405
+ note(href, label)
406
+ for label, href in footer.get("legal", []):
407
+ note(href, label)
408
+ for entry in chrome().get("announcements", []) + chrome().get("utility", []):
409
+ note(entry.get("href"), entry.get("cta") or entry.get("label"))
410
+ for entry in chrome().get("campaign", []):
411
+ note(entry.get("href"), entry.get("heading"))
412
+ for name, href in chrome().get("category_subnav", {}).get("travel", []):
413
+ note(href, name)
414
+
415
+ for section in home().get("sections", []):
416
+ note(section.get("href"), section.get("heading") or section.get("alt"))
417
+ for card in section.get("cards", []):
418
+ note(card.get("href"), card.get("title") or (card.get("alt") or "").split(".")[0])
419
+ return labels
420
+
421
+
422
+ def label_for(path: str) -> str | None:
423
+ return link_labels().get(path)
424
+
425
+
426
+ def search_pool(query: str) -> list[dict[str, Any]]:
427
+ terms = [t for t in re.split(r"\s+", (query or "").strip().lower()) if t]
428
+ if not terms:
429
+ return []
430
+ out = []
431
+ for p in products():
432
+ haystack = " ".join(filter(None, [
433
+ p.get("brand"), p.get("title"), " ".join(categories_of(p)),
434
+ " ".join(c.get("name") or "" for c in p.get("colors", [])),
435
+ " ".join(f"{k} {' '.join(v)}" for k, v in (p.get("attributes") or {}).items()),
436
+ " ".join(p.get("bulletPoints") or []),
437
+ ])).lower()
438
+ if all(t in haystack for t in terms):
439
+ out.append(p)
440
+ return out
tasks/backcountry/environment/reference/clone/data/catalog-missing.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ "/patagonia-guidewater-hip-pack",
3
+ "/eagle-creek-pack-it-isolate-extended-stay-set",
4
+ "/topeak-pakgo-x-bike-case",
5
+ "/patagonia-refugio-32l-day-pack",
6
+ "/oakley-sutro-lite-prizm-sunglasses",
7
+ "/the-north-face-base-camp-voyager-21in-roller-luggage",
8
+ "/eagle-creek-cargo-hauler-xt-90l-wheeled-duffel-bag-eagm365",
9
+ "/smith-wildcat-chromapop-sunglasses",
10
+ "/klymit-drift-summit-camp-pillow",
11
+ "/rumpl-travel-puffy-blanket",
12
+ "/cotopaxi-todo-8l-sling-cada-dia",
13
+ "/osprey-packs-sojourn-porter-65l-pack",
14
+ "/db-roamer-40l-duffel-bag",
15
+ "/sportube-series-3-multi-ski-snowboard-hard-travel-case",
16
+ "/the-north-face-base-camp-s-50l-duffel-bag",
17
+ "/fishpond-dakota-carry-on-rod-and-reel-case-1390cu-in",
18
+ "/thule-compression-cube-set",
19
+ "/cotopaxi-viaje-35l-travel-duffel",
20
+ "/the-north-face-borealis-mini-backpack",
21
+ "/jansport-superbreak-plus-pack",
22
+ "/nemo-equipment-inc.-double-haul-convertible-duffel-55l-bag",
23
+ "/the-north-face-base-camp-voyager-s-daypack",
24
+ "/fishpond-thunderhead-submersible-10l-lumbar-pack",
25
+ "/topo-designs-rover-20l-pack",
26
+ "/scicon-aerotech-evolution-x-tsa-case-sci001o",
27
+ "/eagle-creek-pack-it-isolate-compression-cube-set",
28
+ "/eagle-creek-pack-it-reveal-compression-cube-set",
29
+ "/julbo-ultimate-cover-sunglasses",
30
+ "/topo-designs-mini-rover-10l-pack",
31
+ "/herschel-supply-novel-43l-duffel-bag",
32
+ "/eagle-creek-cargo-hauler-110l-wheeled-duffel-bag-eagm35z",
33
+ "/fishpond-thunderhead-sling",
34
+ "/cotopaxi-allpa-getaway-70l-duffel-bag",
35
+ "/filson-scout-medium-duffle-bag",
36
+ "/fjallraven-raven-20l-backpack",
37
+ "/peak-design-packing-cube-pke001c",
38
+ "/osprey-packs-archeon-chest-rig",
39
+ "/yeti-camino-carryall-20l-bag",
40
+ "/osprey-packs-archeon-30l-backpack",
41
+ "/osprey-packs-packing-cube-set"
42
+ ]
tasks/backcountry/environment/reference/clone/data/catalog.json ADDED
The diff for this file is too large to render. See raw diff
 
tasks/backcountry/environment/reference/clone/data/chrome.json ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "backcountry.clone-chrome.v1",
3
+ "announcements": [
4
+ {
5
+ "text": "Use Your HSA/FSA Funds Toward Eligible Gear",
6
+ "cta": "See Details",
7
+ "href": "/rc/hsa-fsa-eligible-items"
8
+ },
9
+ {
10
+ "text": "Earn 10% Cash Back On All Purchases & More Perks",
11
+ "cta": "Join Summit Club+",
12
+ "href": "/info/loyalty"
13
+ },
14
+ {
15
+ "text": "Free Shipping For Orders Over $69",
16
+ "cta": "Learn More",
17
+ "href": "/service/shipping-policy"
18
+ },
19
+ {
20
+ "text": "Patagonia New Fall Arrivals:",
21
+ "cta": "Shop Now",
22
+ "href": "/rc/patagonia-new-arrivals"
23
+ },
24
+ {
25
+ "text": "Gear Worth Discovering:",
26
+ "cta": "Introducing Backcountry Garage",
27
+ "href": "/campaign/backcountry-garage"
28
+ }
29
+ ],
30
+ "utility": [
31
+ {
32
+ "label": "What's Summit Club?",
33
+ "href": "/info/loyalty"
34
+ },
35
+ {
36
+ "label": "Find Your Store",
37
+ "href": "/sc/retail-stores"
38
+ }
39
+ ],
40
+ "footer": {
41
+ "help_heading": "Need Expert Advice?",
42
+ "help_sub": "Our Gearheads Can Help",
43
+ "contacts": [
44
+ {
45
+ "label": "Email Us",
46
+ "kind": "email"
47
+ },
48
+ {
49
+ "label": "Text Us",
50
+ "kind": "sms"
51
+ },
52
+ {
53
+ "label": "Chat Now",
54
+ "kind": "chat"
55
+ },
56
+ {
57
+ "label": "1-801-204-4655",
58
+ "kind": "phone"
59
+ },
60
+ {
61
+ "label": "Help Center",
62
+ "href": "/service/bc-help-center"
63
+ }
64
+ ],
65
+ "columns": [
66
+ {
67
+ "heading": "Help",
68
+ "links": [
69
+ [
70
+ "Help Center",
71
+ "/service/bc-help-center"
72
+ ],
73
+ [
74
+ "Find A Store",
75
+ "/sc/retail-stores"
76
+ ],
77
+ [
78
+ "Order Status",
79
+ "/account/order-history"
80
+ ],
81
+ [
82
+ "Return Policy",
83
+ "/service/bc-returnguarantee"
84
+ ],
85
+ [
86
+ "Start A Return",
87
+ "/account/order-history"
88
+ ],
89
+ [
90
+ "Shipping Policy",
91
+ "/service/shipping-policy"
92
+ ],
93
+ [
94
+ "Build A Custom Bike",
95
+ "/campaign/custom-bike"
96
+ ],
97
+ [
98
+ "Pay Later with Affirm",
99
+ "/service/affirm"
100
+ ],
101
+ [
102
+ "Group Sales",
103
+ "/service/group-sales"
104
+ ],
105
+ [
106
+ "Gift Cards",
107
+ "/service/gift-cards"
108
+ ],
109
+ [
110
+ "Gift Card Terms and Conditions",
111
+ "/service/bc-gift-card-policy"
112
+ ],
113
+ [
114
+ "HSA/FSA Eligible Purchases",
115
+ "/rc/hsa-fsa-eligible-items"
116
+ ]
117
+ ]
118
+ },
119
+ {
120
+ "heading": "About Us",
121
+ "links": [
122
+ [
123
+ "About Backcountry",
124
+ "/service/about-us"
125
+ ],
126
+ [
127
+ "Summit Club Loyalty Program",
128
+ "/info/loyalty"
129
+ ],
130
+ [
131
+ "Explore Blog",
132
+ "/explore"
133
+ ],
134
+ [
135
+ "Articles",
136
+ "/explore/articles"
137
+ ],
138
+ [
139
+ "Career Job Site",
140
+ "/service/careers"
141
+ ],
142
+ [
143
+ "Shop Services",
144
+ "/service/shop-services"
145
+ ],
146
+ [
147
+ "Affiliate Program",
148
+ "/service/bc-affiliate-program"
149
+ ],
150
+ [
151
+ "Student Offers",
152
+ "/service/student-offers"
153
+ ],
154
+ [
155
+ "Sell On Backcountry",
156
+ "/service/sell-on-backcountry"
157
+ ],
158
+ [
159
+ "Collections",
160
+ "/service/collections"
161
+ ],
162
+ [
163
+ "Special Group Offers",
164
+ "/service/group-offers"
165
+ ],
166
+ [
167
+ "All Categories",
168
+ "/shop-all-brands"
169
+ ]
170
+ ]
171
+ },
172
+ {
173
+ "heading": "Backcountry Family",
174
+ "links": [
175
+ [
176
+ "Competitive Cyclist",
177
+ "/family/competitive-cyclist"
178
+ ],
179
+ [
180
+ "Steep and Cheap",
181
+ "/family/steep-and-cheap"
182
+ ],
183
+ [
184
+ "MotoSport",
185
+ "/family/motosport"
186
+ ],
187
+ [
188
+ "BikeTiresDirect",
189
+ "/family/biketiresdirect"
190
+ ],
191
+ [
192
+ "Western Bikeworks",
193
+ "/family/western-bikeworks"
194
+ ],
195
+ [
196
+ "TriSports",
197
+ "/family/trisports"
198
+ ]
199
+ ]
200
+ }
201
+ ],
202
+ "email_signup": {
203
+ "heading": "Sign Up for Promotional Emails & Get Exclusive Offers",
204
+ "placeholder": "Email Address",
205
+ "cta": "Subscribe"
206
+ },
207
+ "sms_signup": {
208
+ "heading": "Sign up for text alerts & get 15% off",
209
+ "sub": "First dibs on products, sales & exclusives",
210
+ "placeholder": "Phone Number",
211
+ "cta": "Subscribe",
212
+ "disclaimer": "Disclaimer: Discount applies to full-price items only. Exclusions Apply. By submitting this form, you agree to receive recurring automated marketing text messages (e.g. AI content, cart reminders) from Backcountry at the number you provide. Consent not a condition of purchase. We may share info with service providers per our Privacy Policy. Reply HELP for help & STOP to cancel. Msg frequency varies. Msg & data rates may apply. By submitting this form, you also agree to our Terms & Privacy Policy."
213
+ },
214
+ "copyright": "© Backcountry.com - All Rights Reserved",
215
+ "legal": [
216
+ [
217
+ "Terms Of Use",
218
+ "/service/bc-terms-of-use"
219
+ ],
220
+ [
221
+ "Privacy Policy",
222
+ "/service/bc-privacy-policy"
223
+ ],
224
+ [
225
+ "Do Not Sell My Personal Information",
226
+ "/service/do-not-sell"
227
+ ],
228
+ [
229
+ "CA Supply Chain Act",
230
+ "/service/ca-supply-chain-act"
231
+ ],
232
+ [
233
+ "Accessibility Statement",
234
+ "/info/accessibility-statement"
235
+ ]
236
+ ]
237
+ },
238
+ "campaign": [
239
+ {
240
+ "heading": "Extra 20% Off Clearance",
241
+ "sub": "Shop now | Ends 8/31",
242
+ "href": "/rc/extra-10-20-off-clearance"
243
+ },
244
+ {
245
+ "heading": "Labor Day Sale",
246
+ "sub": "Up to 60% off gear, clothing & more",
247
+ "href": "/rc/labor-day-sale"
248
+ },
249
+ {
250
+ "heading": "Bikes, Components & Apparel",
251
+ "sub": "Up to 40% off Bike Sale",
252
+ "href": "/rc/bike-on-sale"
253
+ }
254
+ ],
255
+ "category_subnav": {
256
+ "travel": [
257
+ [
258
+ "Duffel Bags",
259
+ "/cat/mens-duffels"
260
+ ],
261
+ [
262
+ "Everyday Packs",
263
+ "/cat/mens-everyday-packs"
264
+ ],
265
+ [
266
+ "Travel Packs",
267
+ "/cat/travel-packs"
268
+ ],
269
+ [
270
+ "Rolling Bags",
271
+ "/cat/rolling-bags"
272
+ ],
273
+ [
274
+ "Carry-Ons",
275
+ "/cat/carry-ons"
276
+ ],
277
+ [
278
+ "Organizers",
279
+ "/cat/organizers"
280
+ ]
281
+ ]
282
+ }
283
+ }
tasks/backcountry/environment/reference/clone/data/home.json ADDED
@@ -0,0 +1,1194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "backcountry.clone-home.v2",
3
+ "sections": [
4
+ {
5
+ "kind": "text-banner",
6
+ "heading": "Extra 20% Off Clearance",
7
+ "sub": "Deal ends 8/31",
8
+ "href": "/rc/extra-10-20-off-clearance",
9
+ "height": 77
10
+ },
11
+ {
12
+ "kind": "hero",
13
+ "href": "/rc/labor-day-sale",
14
+ "file": "/static/assets/cms/6a8f18b5bed19dd3f0afbced-2x1_HP_Hero_Launch.jpg-w1350",
15
+ "alt": "Two people stand on a stair landing. Mountains are in the background. Up to 60% off Labor Day Sale.",
16
+ "height": 800,
17
+ "imageWidth": 1176,
18
+ "imageHeight": 752
19
+ },
20
+ {
21
+ "kind": "carousel",
22
+ "heading": null,
23
+ "arrows": true,
24
+ "height": 447,
25
+ "cards": [
26
+ {
27
+ "href": "/rc/mens-sale-clothing",
28
+ "file": "/static/assets/cms/6a8f18a8d05d4cc725580488-3x4_BC_HP_Card_Mens_Clothing.jpg-w450",
29
+ "alt": "Two people paddling a wooden canoe across a calm mountain lake, wearing knit sweaters. Up to 60% off men's clothing.",
30
+ "title": null,
31
+ "subtitle": null,
32
+ "width": 245,
33
+ "height": 343,
34
+ "imageWidth": 245,
35
+ "imageHeight": 327
36
+ },
37
+ {
38
+ "href": "/rc/womens-sale-clothing",
39
+ "file": "/static/assets/cms/6a8f18a00c407b5c08d37434-3x4_BC_HP_Card_Womens_Clothing.jpg-w450",
40
+ "alt": "Woman sitting on a wooden dock, feet splashing in lake water, wearing a tan jacket, yellow rain boots, and yellow-green sunglasses. Women's Clothing Up To 60% off. ",
41
+ "title": null,
42
+ "subtitle": null,
43
+ "width": 245,
44
+ "height": 343,
45
+ "imageWidth": 245,
46
+ "imageHeight": 327
47
+ },
48
+ {
49
+ "href": "/rc/footwear-on-sale",
50
+ "file": "/static/assets/cms/6a8f18a860f795c1d1d758b0-3x4_BC_HP_Card_Footwear.jpg-w450",
51
+ "alt": "Three boots stacked outdoors on a wool blanket: a Blundstone Chelsea, Danner hiker with red laces, and dark leather lace-up work boot. Footwear Up to 60% off.",
52
+ "title": null,
53
+ "subtitle": null,
54
+ "width": 245,
55
+ "height": 343,
56
+ "imageWidth": 245,
57
+ "imageHeight": 327
58
+ },
59
+ {
60
+ "href": "/rc/bike-on-sale",
61
+ "file": "/static/assets/cms/6a8f18a849d4297158a4f896-3x4_BC_HP_Card_Bike.jpg-w450",
62
+ "alt": "A mountain biker rests cross-legged on red slickrock in a white helmet and teal pants, bike leaned nearby, soaking in the desert quiet. Bike Up To 50% off.",
63
+ "title": null,
64
+ "subtitle": null,
65
+ "width": 245,
66
+ "height": 343,
67
+ "imageWidth": 245,
68
+ "imageHeight": 327
69
+ },
70
+ {
71
+ "href": "/rc/hike-camp-gear-on-sale",
72
+ "file": "/static/assets/cms/6a8f18a8111155fc4b0d0534-3x4_BC_HP_Card_Camp_Hike.jpg-w450",
73
+ "alt": "Friends gathered around a portable camp stove in a misty pine forest, laughing and warming up with hot drinks. Up to 50% off Camp & Hike.",
74
+ "title": null,
75
+ "subtitle": null,
76
+ "width": 245,
77
+ "height": 343,
78
+ "imageWidth": 245,
79
+ "imageHeight": 327
80
+ },
81
+ {
82
+ "href": "/rc/travel-on-sale",
83
+ "file": "/static/assets/cms/6a8f18a06ea6da3703009d2c-3x4_BC_HP_Card_Travel.jpg-w450",
84
+ "alt": "A pile of travel duffels — Backcountry, Patagonia, Thule, and NEMO — stacked against a wood wall. Up to 50% off travel gear.",
85
+ "title": null,
86
+ "subtitle": null,
87
+ "width": 245,
88
+ "height": 343,
89
+ "imageWidth": 245,
90
+ "imageHeight": 327
91
+ },
92
+ {
93
+ "href": "/rc/climb-on-sale",
94
+ "file": "/static/assets/cms/6a8f18a8111155a61f0d0530-3x4_BC_HP_Card_Climb.jpg-w450",
95
+ "alt": "A climber hangs off a dramatic sandstone overhang, legs flagging, crash pad visible below. A crescent moon floats in the blue desert sky. Climb up to 50% off.",
96
+ "title": null,
97
+ "subtitle": null,
98
+ "width": 245,
99
+ "height": 343,
100
+ "imageWidth": 245,
101
+ "imageHeight": 327
102
+ },
103
+ {
104
+ "href": "/rc/accessories-on-sale",
105
+ "file": "/static/assets/cms/6a8f18a86ea6dac63a009d30-3x4_BC_HP_Card_Accessories.jpg",
106
+ "alt": "A Garmin GPS watch displaying Hike and Mountaineering activity modes, being navigated by a gloved hand on a rocky outcrop. Up to 50% off accessories.",
107
+ "title": null,
108
+ "subtitle": null,
109
+ "width": 245,
110
+ "height": 343,
111
+ "imageWidth": 245,
112
+ "imageHeight": 327
113
+ },
114
+ {
115
+ "href": "/rc/kids-on-sale",
116
+ "file": "/static/assets/cms/6a8f18a84acc960049249c25-3x4_BC_HP_Card_Kids.jpg",
117
+ "alt": "Two kids crouch inside a driftwood fort in a desert canyon, wearing The North Face sun shirts, bucket hats, and slide sandals. Kids' Up To 50% off.",
118
+ "title": null,
119
+ "subtitle": null,
120
+ "width": 245,
121
+ "height": 343,
122
+ "imageWidth": 245,
123
+ "imageHeight": 327
124
+ },
125
+ {
126
+ "href": "/rc/sale-ski-gear",
127
+ "file": "/static/assets/cms/6a8f18a0971ef95ee85378c6-3x4_BC_HP_Card_Ski.jpg",
128
+ "alt": "Skier catches air off a steep powder face, Salomon skis crossed mid-jump, helmet and goggles on. Up to 50% off ski gear.",
129
+ "title": null,
130
+ "subtitle": null,
131
+ "width": 245,
132
+ "height": 343,
133
+ "imageWidth": 245,
134
+ "imageHeight": 327
135
+ },
136
+ {
137
+ "href": "/rc/snowboard-gear-on-sale",
138
+ "file": "/static/assets/cms/6a8f189f0a3bbe727e59dc72-3x4_BC_HP_Card_Snowboard.jpg",
139
+ "alt": "Snowboarder mid-invert on a sunny groomer, holding a red K2 board overhead, wearing a coral camo one-piece suit. Snowboard Up to 50% off.",
140
+ "title": null,
141
+ "subtitle": null,
142
+ "width": 245,
143
+ "height": 343,
144
+ "imageWidth": 245,
145
+ "imageHeight": 327
146
+ }
147
+ ]
148
+ },
149
+ {
150
+ "kind": "carousel",
151
+ "heading": null,
152
+ "arrows": false,
153
+ "height": 378,
154
+ "cards": [
155
+ {
156
+ "href": "/rc/fall-essentials-layers",
157
+ "file": "/static/assets/cms/6a75031e8bcd80816e2612d6-4_3.jpeg-w450",
158
+ "alt": "Two hikers walk in the rain. One is wearing a bright-yellow jacket and the other is wearing a blue jacket.",
159
+ "title": "Fall Is Near",
160
+ "subtitle": null,
161
+ "width": 381,
162
+ "height": 322,
163
+ "imageWidth": 381,
164
+ "imageHeight": 286
165
+ },
166
+ {
167
+ "href": "/rc/waterproof-gear",
168
+ "file": "/static/assets/cms/6a7b330bef5bef50e24f961a-BC26_0258_Waterproof_Hike_-_Run_Card.jpg-w450",
169
+ "alt": "A shoe splashes in muddy water.",
170
+ "title": "Waterproof Gear",
171
+ "subtitle": null,
172
+ "width": 381,
173
+ "height": 322,
174
+ "imageWidth": 381,
175
+ "imageHeight": 286
176
+ },
177
+ {
178
+ "href": "/rc/back-to-school",
179
+ "file": "/static/assets/cms/6a5583827d086a3459a8d9a6-Card_Image_BC26_0212.jpeg-w450",
180
+ "alt": "A teenager lounging on a tree branch with a book and a backpack.",
181
+ "title": "New School Year, New Adventure",
182
+ "subtitle": null,
183
+ "width": 381,
184
+ "height": 321,
185
+ "imageWidth": 381,
186
+ "imageHeight": 285
187
+ }
188
+ ]
189
+ },
190
+ {
191
+ "kind": "shelf",
192
+ "heading": null,
193
+ "height": 541,
194
+ "slugs": [
195
+ "/patagonia-classic-retro-x-jacket-womens",
196
+ "/patagonia-classic-retro-x-jacket-mens",
197
+ "/patagonia-black-hole-mini-mlc-26l-backpack",
198
+ "/patagonia-nano-puff-insulated-jacket-mens",
199
+ "/patagonia-reversible-ready-freddy-hooded-jacket-boys-patz9ow",
200
+ "/patagonia-better-sweater-fleece-jacket-mens",
201
+ "/patagonia-black-hole-55l-duffel-bag",
202
+ "/patagonia-torrentshell-3l-jacket-mens",
203
+ "/patagonia-nano-puff-jacket-womens",
204
+ "/patagonia-refugio-26l-day-pack",
205
+ "/patagonia-down-sweater-jacket-kids",
206
+ "/patagonia-diamond-quilted-bomber-hooded-jacket-womens",
207
+ "/patagonia-hi-loft-down-sweater-hoodie-kids"
208
+ ]
209
+ },
210
+ {
211
+ "kind": "carousel",
212
+ "heading": null,
213
+ "arrows": true,
214
+ "height": 400,
215
+ "cards": [
216
+ {
217
+ "href": "/rc/hike-bundle",
218
+ "file": "/static/assets/cms/6a32c056958fd47ffebcd798-BC_BackpackingBundle.jpg-w450",
219
+ "alt": "Two hikers ascending a rocky alpine trail at golden hour, wearing packs, trekking poles, and layered hiking apparel.",
220
+ "title": "Hike Bundle",
221
+ "subtitle": "Buy 2+, save 20%",
222
+ "width": 320,
223
+ "height": 296,
224
+ "imageWidth": 320,
225
+ "imageHeight": 240
226
+ },
227
+ {
228
+ "href": "/rc/sock-bundle",
229
+ "file": "/static/assets/cms/69b1d809c048552290e84fae-Card_Socks.jpg-w450",
230
+ "alt": "Spring Sock Bundle",
231
+ "title": "Sock Savings",
232
+ "subtitle": "Buy 3+, save 20%",
233
+ "width": 320,
234
+ "height": 296,
235
+ "imageWidth": 320,
236
+ "imageHeight": 240
237
+ },
238
+ {
239
+ "href": "/rc/run-bundle",
240
+ "file": "/static/assets/cms/6a32c056ead44b57faa9d87d-BC_RunBundle.jpg-w450",
241
+ "alt": "Runner stretching outdoors in Salomon trail shoes with a GPS watch on wrist, against a coastal hillside backdrop.",
242
+ "title": "Run Bundle",
243
+ "subtitle": "Buy 2+, save 20%",
244
+ "width": 320,
245
+ "height": 296,
246
+ "imageWidth": 320,
247
+ "imageHeight": 240
248
+ },
249
+ {
250
+ "href": "/rc/underwear-bundle",
251
+ "file": "/static/assets/cms/6a31b649b2246400085a4f1c-PC080_4_3_HP_Card.jpg-w450",
252
+ "alt": "
A flat lay arrangement of athletic underwear on a light gradient background. The collection features a pair of blue men's boxer briefs with a repeating fish pattern, a solid black women's sports bra with a perforated back detail, and a pair of light purple women's bikini-style underwear.",
253
+ "title": "Underwear",
254
+ "subtitle": "Buy 3+, save 15%",
255
+ "width": 320,
256
+ "height": 296,
257
+ "imageWidth": 320,
258
+ "imageHeight": 240
259
+ },
260
+ {
261
+ "href": "/rc/slickrock-bundle",
262
+ "file": "/static/assets/cms/69fe6635f1c1a0e45ab0ef8f-PC07_4_3.jpg-w450",
263
+ "alt": "Slickrock Bundle",
264
+ "title": "Slickrock MTB",
265
+ "subtitle": "Buy 2+, save 20%",
266
+ "width": 320,
267
+ "height": 296,
268
+ "imageWidth": 320,
269
+ "imageHeight": 240
270
+ },
271
+ {
272
+ "href": "/rc/sunglasses-deal",
273
+ "file": "/static/assets/cms/69efd68b339c2882b43a43b6-PC072_Sunglasses_Bundle_4_3.jpg-w450",
274
+ "alt": "Sunglasses Bundle",
275
+ "title": "Sunglasses Savings",
276
+ "subtitle": "Buy 2+, save 20%",
277
+ "width": 320,
278
+ "height": 296,
279
+ "imageWidth": 320,
280
+ "imageHeight": 240
281
+ },
282
+ {
283
+ "href": "/rc/hat-bundle",
284
+ "file": "/static/assets/cms/69dff43bc0701d0b9e6ddeda-Card_Hats.jpg",
285
+ "alt": "Spring Hat Bundles",
286
+ "title": "Hats Bundle",
287
+ "subtitle": "Buy 3+, save 20%",
288
+ "width": 320,
289
+ "height": 296,
290
+ "imageWidth": 320,
291
+ "imageHeight": 240
292
+ },
293
+ {
294
+ "href": "/rc/backcountry-tahoe-collection",
295
+ "file": "/static/assets/cms/69b31732cbcbd4d15374cccc-Card.jpg",
296
+ "alt": "Two people hike through a very green forest.",
297
+ "title": "Tahoe",
298
+ "subtitle": "Buy 2+, save 20%",
299
+ "width": 320,
300
+ "height": 296,
301
+ "imageWidth": 320,
302
+ "imageHeight": 240
303
+ },
304
+ {
305
+ "href": "/rc/backcountry-destination-collection",
306
+ "file": "/static/assets/cms/69b1dd8e1bca0412cbeaa702-Card.jpg",
307
+ "alt": "Destination Bundle",
308
+ "title": "Destination",
309
+ "subtitle": "Buy 2+, save 20%",
310
+ "width": 320,
311
+ "height": 296,
312
+ "imageWidth": 320,
313
+ "imageHeight": 240
314
+ }
315
+ ]
316
+ },
317
+ {
318
+ "kind": "carousel",
319
+ "heading": null,
320
+ "arrows": true,
321
+ "height": 404,
322
+ "cards": [
323
+ {
324
+ "href": "/rc/totes-duffels",
325
+ "file": "/static/assets/cms/69efdfabfd3d4c190470d4d3-Totes_-_Bags.jpeg-w450",
326
+ "alt": "Totes & Bags",
327
+ "title": "Totes & Bags",
328
+ "subtitle": null,
329
+ "width": 198,
330
+ "height": 300,
331
+ "imageWidth": 198,
332
+ "imageHeight": 264
333
+ },
334
+ {
335
+ "href": "/rc/sunglasses",
336
+ "file": "/static/assets/cms/69efdf9aedcdda5f05fa5338-Sunglasses.jpeg-w450",
337
+ "alt": "Sunglasses",
338
+ "title": "Sunglasses",
339
+ "subtitle": null,
340
+ "width": 198,
341
+ "height": 300,
342
+ "imageWidth": 198,
343
+ "imageHeight": 264
344
+ },
345
+ {
346
+ "href": "/rc/t-shirts",
347
+ "file": "/static/assets/cms/69efdf9aa08dd64dc0da8aa4-T-Shirts.jpeg-w450",
348
+ "alt": "T-Shirts",
349
+ "title": "T-Shirts",
350
+ "subtitle": null,
351
+ "width": 198,
352
+ "height": 300,
353
+ "imageWidth": 198,
354
+ "imageHeight": 264
355
+ },
356
+ {
357
+ "href": "/cat/womens-swimwear",
358
+ "file": "/static/assets/cms/69efdf9ae0947c2e7cc90a8f-Swim.jpeg-w450",
359
+ "alt": "Swim",
360
+ "title": "Swim",
361
+ "subtitle": null,
362
+ "width": 198,
363
+ "height": 300,
364
+ "imageWidth": 198,
365
+ "imageHeight": 264
366
+ },
367
+ {
368
+ "href": "/rc/new-arrivals",
369
+ "file": "/static/assets/cms/69efdf99b2f6cd6fa7839795-New_Arrivals.jpeg-w450",
370
+ "alt": "New Arrivals",
371
+ "title": "New Arrivals",
372
+ "subtitle": null,
373
+ "width": 198,
374
+ "height": 300,
375
+ "imageWidth": 198,
376
+ "imageHeight": 264
377
+ },
378
+ {
379
+ "href": "/rc/sandals",
380
+ "file": "/static/assets/cms/69efdf99d89ffcfebb2f4bb7-Sandals.jpeg-w450",
381
+ "alt": "Sandals",
382
+ "title": "Sandals",
383
+ "subtitle": null,
384
+ "width": 198,
385
+ "height": 300,
386
+ "imageWidth": 198,
387
+ "imageHeight": 264
388
+ },
389
+ {
390
+ "href": "/cat/mens-swimwear",
391
+ "file": "/static/assets/cms/69efdf99e0947c49c2c90a8b-Boardshorts.jpeg-w450",
392
+ "alt": "Boardshorts",
393
+ "title": "Boardshorts",
394
+ "subtitle": null,
395
+ "width": 198,
396
+ "height": 300,
397
+ "imageWidth": 198,
398
+ "imageHeight": 264
399
+ },
400
+ {
401
+ "href": "/rc/upf-apparel",
402
+ "file": "/static/assets/cms/69efdf9a8d93ec6dc3e223b7-Sun_Protection.jpeg-w450",
403
+ "alt": "Sun Protection",
404
+ "title": "Sun Protection",
405
+ "subtitle": null,
406
+ "width": 198,
407
+ "height": 300,
408
+ "imageWidth": 198,
409
+ "imageHeight": 264
410
+ },
411
+ {
412
+ "href": "/cat/coolers",
413
+ "file": "/static/assets/cms/69efdf996466607e5768d139-Coolers.jpeg-w450",
414
+ "alt": "Coolers",
415
+ "title": "Coolers",
416
+ "subtitle": null,
417
+ "width": 198,
418
+ "height": 300,
419
+ "imageWidth": 198,
420
+ "imageHeight": 264
421
+ },
422
+ {
423
+ "href": "/cat/mens-shorts",
424
+ "file": "/static/assets/cms/69efdf99bfa9b63251ef4031-Men_s_Shorts.jpeg",
425
+ "alt": "Men's Shorts",
426
+ "title": "Men's Shorts",
427
+ "subtitle": null,
428
+ "width": 198,
429
+ "height": 300,
430
+ "imageWidth": 198,
431
+ "imageHeight": 264
432
+ },
433
+ {
434
+ "href": "/cat/womens-shorts",
435
+ "file": "/static/assets/cms/69efdfab2a78a3a46fcfe0a6-Women_s_Shorts.jpeg",
436
+ "alt": "Women's Shorts",
437
+ "title": "Women's Shorts",
438
+ "subtitle": null,
439
+ "width": 198,
440
+ "height": 300,
441
+ "imageWidth": 198,
442
+ "imageHeight": 264
443
+ },
444
+ {
445
+ "href": "/rc/hats-caps",
446
+ "file": "/static/assets/cms/69efdf99339c2803233a4405-Hats.jpeg",
447
+ "alt": "Hats",
448
+ "title": "Hats",
449
+ "subtitle": null,
450
+ "width": 198,
451
+ "height": 300,
452
+ "imageWidth": 198,
453
+ "imageHeight": 264
454
+ }
455
+ ]
456
+ },
457
+ {
458
+ "kind": "carousel",
459
+ "heading": null,
460
+ "arrows": true,
461
+ "height": 365,
462
+ "cards": [
463
+ {
464
+ "href": "/rc/new-brands",
465
+ "file": "/static/assets/cms/69badbc3675afc9c4f0aa5ea-HP_Card_Main.jpg-w450",
466
+ "alt": "New&Goatworthy",
467
+ "title": null,
468
+ "subtitle": null,
469
+ "width": 245,
470
+ "height": 261,
471
+ "imageWidth": 245,
472
+ "imageHeight": 245
473
+ },
474
+ {
475
+ "href": "/brand/raide",
476
+ "file": "/static/assets/cms/69badbc3daccab16090b9a5e-HP_Card_Raide.jpg-w450",
477
+ "alt": "Raide",
478
+ "title": null,
479
+ "subtitle": null,
480
+ "width": 245,
481
+ "height": 261,
482
+ "imageWidth": 245,
483
+ "imageHeight": 245
484
+ },
485
+ {
486
+ "href": "/brand/ll-bean ",
487
+ "file": "/static/assets/cms/69badbc32a26b81deb71b69b-HP_Card_LL_Bean.jpg-w450",
488
+ "alt": "L.L.Bean",
489
+ "title": null,
490
+ "subtitle": null,
491
+ "width": 245,
492
+ "height": 261,
493
+ "imageWidth": 245,
494
+ "imageHeight": 245
495
+ },
496
+ {
497
+ "href": "/brand/deso ",
498
+ "file": "/static/assets/cms/69badbc3d22cf29ccb613b50-HP_Card_Deso.jpg-w450",
499
+ "alt": "Deso",
500
+ "title": null,
501
+ "subtitle": null,
502
+ "width": 245,
503
+ "height": 261,
504
+ "imageWidth": 245,
505
+ "imageHeight": 245
506
+ },
507
+ {
508
+ "href": "/brand/royal-robbins ",
509
+ "file": "/static/assets/cms/69badbc3ee9a64805e4b0ec7-HP_Card_Royal_Robbins.jpg-w450",
510
+ "alt": "Royal Robbins",
511
+ "title": null,
512
+ "subtitle": null,
513
+ "width": 245,
514
+ "height": 261,
515
+ "imageWidth": 245,
516
+ "imageHeight": 245
517
+ },
518
+ {
519
+ "href": "/brand/donni ",
520
+ "file": "/static/assets/cms/69badbc30fbeae9b3321b6f8-HP_Card_Donni.jpg-w450",
521
+ "alt": "Donni",
522
+ "title": null,
523
+ "subtitle": null,
524
+ "width": 245,
525
+ "height": 261,
526
+ "imageWidth": 245,
527
+ "imageHeight": 245
528
+ },
529
+ {
530
+ "href": "/brand/oiselle",
531
+ "file": "/static/assets/cms/69badbc4ea47c3bccbfde420-HP_Card_Oiselle.jpg-w450",
532
+ "alt": "Oiselle",
533
+ "title": null,
534
+ "subtitle": null,
535
+ "width": 245,
536
+ "height": 261,
537
+ "imageWidth": 245,
538
+ "imageHeight": 245
539
+ },
540
+ {
541
+ "href": "/brand/pruzan ",
542
+ "file": "/static/assets/cms/69badbc3321ab5ba8e603bfa-HP_Card_Pruzan.jpg",
543
+ "alt": "Pruzan",
544
+ "title": null,
545
+ "subtitle": null,
546
+ "width": 245,
547
+ "height": 261,
548
+ "imageWidth": 245,
549
+ "imageHeight": 245
550
+ },
551
+ {
552
+ "href": "/brand/wallien",
553
+ "file": "/static/assets/cms/69badbc342c8c49634342fcf-HP_Card_Wallien.jpg",
554
+ "alt": "Wallien ",
555
+ "title": null,
556
+ "subtitle": null,
557
+ "width": 245,
558
+ "height": 261,
559
+ "imageWidth": 245,
560
+ "imageHeight": 245
561
+ },
562
+ {
563
+ "href": "/rc/meta-eyewear ",
564
+ "file": "/static/assets/cms/69badbc300c6f039f1875051-HP_Card_Meta.jpg",
565
+ "alt": "Meta",
566
+ "title": null,
567
+ "subtitle": null,
568
+ "width": 245,
569
+ "height": 261,
570
+ "imageWidth": 245,
571
+ "imageHeight": 245
572
+ }
573
+ ]
574
+ },
575
+ {
576
+ "kind": "carousel",
577
+ "heading": null,
578
+ "arrows": true,
579
+ "height": 318,
580
+ "cards": [
581
+ {
582
+ "href": "/rc/gearhead-picks",
583
+ "file": "/static/assets/cms/69b9cba818e42305d34e394d-Carousel_GH_Picks.jpg-w450",
584
+ "alt": "Main",
585
+ "title": null,
586
+ "subtitle": null,
587
+ "width": 198,
588
+ "height": 214,
589
+ "imageWidth": 198,
590
+ "imageHeight": 198
591
+ },
592
+ {
593
+ "href": "/rc/gearhead-picks-camp",
594
+ "file": "/static/assets/cms/69b9cba83a4db2600dcab491-Carousel_Camp.jpg-w450",
595
+ "alt": "Camp",
596
+ "title": null,
597
+ "subtitle": null,
598
+ "width": 198,
599
+ "height": 214,
600
+ "imageWidth": 198,
601
+ "imageHeight": 198
602
+ },
603
+ {
604
+ "href": "/rc/gearhead-picks-bike",
605
+ "file": "/static/assets/cms/69e25b4e195cd9776b7621a3-Carousel_Bike.jpg-w450",
606
+ "alt": "Bike",
607
+ "title": null,
608
+ "subtitle": null,
609
+ "width": 198,
610
+ "height": 214,
611
+ "imageWidth": 198,
612
+ "imageHeight": 198
613
+ },
614
+ {
615
+ "href": "/rc/gearhead-picks-run",
616
+ "file": "/static/assets/cms/6a29cb65a71a312da1822359-Flyout_0168_Run.jpeg-w450",
617
+ "alt": "Run",
618
+ "title": null,
619
+ "subtitle": null,
620
+ "width": 198,
621
+ "height": 214,
622
+ "imageWidth": 198,
623
+ "imageHeight": 198
624
+ },
625
+ {
626
+ "href": "/rc/gearhead-picks-climb",
627
+ "file": "/static/assets/cms/69ceab046ec44e19fed538d7-Carousel_climb.jpg-w450",
628
+ "alt": "Climb",
629
+ "title": null,
630
+ "subtitle": null,
631
+ "width": 198,
632
+ "height": 214,
633
+ "imageWidth": 198,
634
+ "imageHeight": 198
635
+ },
636
+ {
637
+ "href": "/rc/gearhead-picks-hike",
638
+ "file": "/static/assets/cms/69c2f70ff50d05857c343570-Carousel_Hike.jpg-w450",
639
+ "alt": "Hike",
640
+ "title": null,
641
+ "subtitle": null,
642
+ "width": 198,
643
+ "height": 214,
644
+ "imageWidth": 198,
645
+ "imageHeight": 198
646
+ },
647
+ {
648
+ "href": "/rc/gearhead-picks-travel",
649
+ "file": "/static/assets/cms/69b9cba8699c060f3c1da09e-Carousel_Travel.jpg-w450",
650
+ "alt": "Travel",
651
+ "title": null,
652
+ "subtitle": null,
653
+ "width": 198,
654
+ "height": 214,
655
+ "imageWidth": 198,
656
+ "imageHeight": 198
657
+ },
658
+ {
659
+ "href": "/rc/gearhead-picks-paddle",
660
+ "file": "/static/assets/cms/6a3023ba5c24199ca28a606d-BC26_0179_Paddle_GH_Picks_Carousel_Padle.jpg-w450",
661
+ "alt": "Paddle",
662
+ "title": null,
663
+ "subtitle": null,
664
+ "width": 198,
665
+ "height": 214,
666
+ "imageWidth": 198,
667
+ "imageHeight": 198
668
+ },
669
+ {
670
+ "href": "/rc/gearhead-picks-fly-fishing",
671
+ "file": "/static/assets/cms/6a21af2ea91e110f24214f8f-Carousel_Fly_Fishing.jpg-w450",
672
+ "alt": "Fly Fishing",
673
+ "title": null,
674
+ "subtitle": null,
675
+ "width": 198,
676
+ "height": 214,
677
+ "imageWidth": 198,
678
+ "imageHeight": 198
679
+ }
680
+ ]
681
+ },
682
+ {
683
+ "kind": "carousel",
684
+ "heading": null,
685
+ "arrows": false,
686
+ "height": 506,
687
+ "cards": [
688
+ {
689
+ "href": "/rc/mountain-bikes-apparel-components?p=u_categoryPathId:\"bc-bike\"",
690
+ "file": "/static/assets/cms/69bc6448ea47c375b7fdea92-3.4_Card_MTB.jpg-w450",
691
+ "alt": "Mountain Biking",
692
+ "title": "Mountain Biking",
693
+ "subtitle": null,
694
+ "width": 278,
695
+ "height": 407,
696
+ "imageWidth": 278,
697
+ "imageHeight": 371
698
+ },
699
+ {
700
+ "href": "/rc/gravel-bikes-apparel-components?p=u_categoryPathId:\"bc-bike\"",
701
+ "file": "/static/assets/cms/69bc64480fbeaec7fc21be33-3.4_Card_Gravel.jpg-w450",
702
+ "alt": "Gravel Biking",
703
+ "title": "Gravel Biking",
704
+ "subtitle": null,
705
+ "width": 278,
706
+ "height": 407,
707
+ "imageWidth": 278,
708
+ "imageHeight": 371
709
+ },
710
+ {
711
+ "href": "/rc/road-bike-apparel-components?p=u_categoryPathId:\"bc-bike\"",
712
+ "file": "/static/assets/cms/69bc6448544b1e09a103dc0d-3.4_Card_Road.jpg-w450",
713
+ "alt": "Road Biking",
714
+ "title": "Road Biking",
715
+ "subtitle": null,
716
+ "width": 278,
717
+ "height": 407,
718
+ "imageWidth": 278,
719
+ "imageHeight": 371
720
+ },
721
+ {
722
+ "href": "/rc/bike-on-sale?p=u_categoryPathId:\"bc-bike\"",
723
+ "file": "/static/assets/cms/69bc64486b74d39e0e3c7ab5-3.4_Card_Sale.jpg-w450",
724
+ "alt": "Bike on Sale",
725
+ "title": "Bike On Sale",
726
+ "subtitle": null,
727
+ "width": 278,
728
+ "height": 407,
729
+ "imageWidth": 278,
730
+ "imageHeight": 371
731
+ }
732
+ ]
733
+ },
734
+ {
735
+ "kind": "grid",
736
+ "height": 476,
737
+ "cards": [
738
+ {
739
+ "href": "/brand/yeti-cycles?sort=newest",
740
+ "file": "/static/assets/cms/6a8c80c5b0dddea4e7925781-CC26_0235_Yeti_MT_Launch_bc-card-grid-hp.jpg-w450",
741
+ "alt": "Yeti MT Launch",
742
+ "title": "New Yeti MT",
743
+ "subtitle": "Tune it, trade nothing",
744
+ "width": 381,
745
+ "height": 428,
746
+ "imageWidth": 381,
747
+ "imageHeight": 286
748
+ },
749
+ {
750
+ "href": "/rc/mtb-park-enduro-gear",
751
+ "file": "/static/assets/cms/6a68db0517e9ee95cfe3927c-4_3.jpeg-w450",
752
+ "alt": "A mountain biker kicks up some dirt as they make a tight turn.",
753
+ "title": "Downhill Days Of Summer",
754
+ "subtitle": "The best park & enduro bikes & gear",
755
+ "width": 381,
756
+ "height": 428,
757
+ "imageWidth": 381,
758
+ "imageHeight": 286
759
+ },
760
+ {
761
+ "href": "/rc/summer-bike-service?p=u_categoryPathId:%22bc-bike%22",
762
+ "file": "/static/assets/cms/6a57d4181abad581607dcf08-4x3_Card_Image_CC26_0198_BC.jpg-w450",
763
+ "alt": "Flat-lay of mountain bike components — crankset, cassette, chain, derailleur, brake rotor, pedals, tubeless sealant, and knobby tires.",
764
+ "title": "Summer Service Essentials",
765
+ "subtitle": "Everything your bike needs after a season of dirt, dust & miles",
766
+ "width": 381,
767
+ "height": 428,
768
+ "imageWidth": 381,
769
+ "imageHeight": 286
770
+ }
771
+ ]
772
+ },
773
+ {
774
+ "kind": "carousel",
775
+ "heading": null,
776
+ "arrows": false,
777
+ "height": 267,
778
+ "cards": [
779
+ {
780
+ "href": "/brand/outdoor-research",
781
+ "file": "/static/assets/cms/6656310940a36ddf57dbeb72-1_1_Outdoor_Research.jpg-w450",
782
+ "alt": "Outdoor Research",
783
+ "title": null,
784
+ "subtitle": null,
785
+ "width": 152,
786
+ "height": 168,
787
+ "imageWidth": 152,
788
+ "imageHeight": 152
789
+ },
790
+ {
791
+ "href": "/brand/the-north-face",
792
+ "file": "/static/assets/cms/677eb2a5bf0f6821ac69d33d-TNF.png-w450",
793
+ "alt": "The North Face logo",
794
+ "title": null,
795
+ "subtitle": null,
796
+ "width": 152,
797
+ "height": 168,
798
+ "imageWidth": 152,
799
+ "imageHeight": 152
800
+ },
801
+ {
802
+ "href": "/brand/patagonia",
803
+ "file": "/static/assets/cms/66563109fab32508ce34d58a-1_1_Patagonia.jpg-w450",
804
+ "alt": "Patagonia",
805
+ "title": null,
806
+ "subtitle": null,
807
+ "width": 152,
808
+ "height": 168,
809
+ "imageWidth": 152,
810
+ "imageHeight": 152
811
+ },
812
+ {
813
+ "href": "/brand/fjallraven",
814
+ "file": "/static/assets/cms/675b7559ea6bc637e91871ff-Fjall.jpg-w450",
815
+ "alt": "Fjällräven logo featuring a fox silhouette inside a circle beside bold black wordmark text reading \"Fjällräven.",
816
+ "title": null,
817
+ "subtitle": null,
818
+ "width": 152,
819
+ "height": 168,
820
+ "imageWidth": 152,
821
+ "imageHeight": 152
822
+ },
823
+ {
824
+ "href": "/mountain-hardwear?tabNav=0",
825
+ "file": "/static/assets/cms/66a7be00bb95123280021e73-Black_Diamond.jpg-w450",
826
+ "alt": "Mountain Hardwear",
827
+ "title": null,
828
+ "subtitle": null,
829
+ "width": 152,
830
+ "height": 168,
831
+ "imageWidth": 152,
832
+ "imageHeight": 152
833
+ },
834
+ {
835
+ "href": "/brand/osprey-packs",
836
+ "file": "/static/assets/cms/6a68d858ebce9344ec8c97b5-1x1_Logo_Card_Osprey_Lockup.jpg-w450",
837
+ "alt": "Osprey",
838
+ "title": null,
839
+ "subtitle": null,
840
+ "width": 152,
841
+ "height": 168,
842
+ "imageWidth": 152,
843
+ "imageHeight": 152
844
+ },
845
+ {
846
+ "href": "/brand/salomon ",
847
+ "file": "/static/assets/cms/6674615b1ae3c1391f0668f9-Salomon.jpg-w450",
848
+ "alt": "Salomon",
849
+ "title": null,
850
+ "subtitle": null,
851
+ "width": 152,
852
+ "height": 168,
853
+ "imageWidth": 152,
854
+ "imageHeight": 152
855
+ }
856
+ ]
857
+ },
858
+ {
859
+ "kind": "carousel",
860
+ "heading": null,
861
+ "arrows": true,
862
+ "height": 467,
863
+ "cards": [
864
+ {
865
+ "href": "/brand/backcountry",
866
+ "file": "/static/assets/cms/69a0bb9cb9f0f279273240ba-Shop_All.jpeg-w450",
867
+ "alt": "Shop All",
868
+ "title": "Shop All",
869
+ "subtitle": null,
870
+ "width": 245,
871
+ "height": 363,
872
+ "imageWidth": 245,
873
+ "imageHeight": 327
874
+ },
875
+ {
876
+ "href": "/rc/backcountry-wasatch-collection",
877
+ "file": "/static/assets/cms/69a0bb9cba238f747f2f4ccd-Wasatch.jpeg-w450",
878
+ "alt": "Wasatch",
879
+ "title": "Wasatch",
880
+ "subtitle": null,
881
+ "width": 245,
882
+ "height": 363,
883
+ "imageWidth": 245,
884
+ "imageHeight": 327
885
+ },
886
+ {
887
+ "href": "/rc/backcountry-tahoe-collection",
888
+ "file": "/static/assets/cms/69a0bb9ccf0cf6348a1427ac-Tahoe.jpeg-w450",
889
+ "alt": "Tahoe",
890
+ "title": "Tahoe",
891
+ "subtitle": null,
892
+ "width": 245,
893
+ "height": 363,
894
+ "imageWidth": 245,
895
+ "imageHeight": 327
896
+ },
897
+ {
898
+ "href": "/rc/backcountry-destination-collection",
899
+ "file": "/static/assets/cms/69a0bb9b47c5b03fbdc85871-Destination.jpeg-w450",
900
+ "alt": "Destination",
901
+ "title": "Destination",
902
+ "subtitle": null,
903
+ "width": 245,
904
+ "height": 363,
905
+ "imageWidth": 245,
906
+ "imageHeight": 327
907
+ },
908
+ {
909
+ "href": "/rc/backcountry-rainwear",
910
+ "file": "/static/assets/cms/69a0bb9af41d202befd3c90b-Rain.jpeg-w450",
911
+ "alt": "Rain",
912
+ "title": "Rain",
913
+ "subtitle": null,
914
+ "width": 245,
915
+ "height": 363,
916
+ "imageWidth": 245,
917
+ "imageHeight": 327
918
+ },
919
+ {
920
+ "href": "/rc/backcountry-fleece",
921
+ "file": "/static/assets/cms/69a0bb9bb9f0f2c78e3240b6-Fleece.jpeg-w450",
922
+ "alt": "Fleece",
923
+ "title": "Fleece",
924
+ "subtitle": null,
925
+ "width": 245,
926
+ "height": 363,
927
+ "imageWidth": 245,
928
+ "imageHeight": 327
929
+ }
930
+ ]
931
+ },
932
+ {
933
+ "kind": "carousel",
934
+ "heading": null,
935
+ "arrows": true,
936
+ "height": 447,
937
+ "cards": [
938
+ {
939
+ "href": "/brand/patagonia?sort=newest",
940
+ "file": "/static/assets/cms/6a19fbd70ed7ac1dbe50a5eb-3_4_Pat_New_Arrivals.jpg-w450",
941
+ "alt": "Patagonia",
942
+ "title": null,
943
+ "subtitle": null,
944
+ "width": 245,
945
+ "height": 343,
946
+ "imageWidth": 245,
947
+ "imageHeight": 327
948
+ },
949
+ {
950
+ "href": "/brand/the-north-face",
951
+ "file": "/static/assets/cms/6a19fbe1fa36f751af4c7df1-3_4_TNF_Bestsellers.jpg-w450",
952
+ "alt": "The North Face",
953
+ "title": null,
954
+ "subtitle": null,
955
+ "width": 245,
956
+ "height": 343,
957
+ "imageWidth": 245,
958
+ "imageHeight": 327
959
+ },
960
+ {
961
+ "href": "/brand/salomon?sort=newest",
962
+ "file": "/static/assets/cms/6a19fbd79b98a9ee2fc5c197-3_4_Salomon_New_Arrivals.jpg-w450",
963
+ "alt": "Salomon",
964
+ "title": null,
965
+ "subtitle": null,
966
+ "width": 245,
967
+ "height": 343,
968
+ "imageWidth": 245,
969
+ "imageHeight": 327
970
+ },
971
+ {
972
+ "href": "/brand/mountain-hardwear?sort=newest",
973
+ "file": "/static/assets/cms/6a19fbd7bfe3979c01c5e28c-3_4_MHW_New_Arrivals.jpg-w450",
974
+ "alt": "Mountain Hardwear",
975
+ "title": null,
976
+ "subtitle": null,
977
+ "width": 245,
978
+ "height": 343,
979
+ "imageWidth": 245,
980
+ "imageHeight": 327
981
+ },
982
+ {
983
+ "href": "/brand/outdoor-research",
984
+ "file": "/static/assets/cms/6a19fbd7a2cd06769ab0ecc5-3_4_OR_Bestsellers.jpg-w450",
985
+ "alt": "Outdoor Research",
986
+ "title": null,
987
+ "subtitle": null,
988
+ "width": 245,
989
+ "height": 343,
990
+ "imageWidth": 245,
991
+ "imageHeight": 327
992
+ },
993
+ {
994
+ "href": "/brand/black-diamond",
995
+ "file": "/static/assets/cms/6a19fbd7a2cd06a430b0ecc1-3_4_BD_Bestsellers.jpg-w450",
996
+ "alt": "Black Diamond",
997
+ "title": null,
998
+ "subtitle": null,
999
+ "width": 245,
1000
+ "height": 343,
1001
+ "imageWidth": 245,
1002
+ "imageHeight": 327
1003
+ }
1004
+ ]
1005
+ },
1006
+ {
1007
+ "kind": "carousel",
1008
+ "heading": null,
1009
+ "arrows": true,
1010
+ "height": 412,
1011
+ "cards": [
1012
+ {
1013
+ "href": "/bulletin",
1014
+ "file": "/static/assets/cms/67d34c1fcb17a22d46903016-Backcountry_Bulletin_main.jpg-w450",
1015
+ "alt": "Backcountry Bulletin",
1016
+ "title": null,
1017
+ "subtitle": null,
1018
+ "width": 219,
1019
+ "height": 308,
1020
+ "imageWidth": 219,
1021
+ "imageHeight": 292
1022
+ },
1023
+ {
1024
+ "href": "/bulletin/explore-articles",
1025
+ "file": "/static/assets/cms/67630356117e7e1fe846dd2f-Gearhead_Articles.jpg-w450",
1026
+ "alt": "Gearhead Articles",
1027
+ "title": null,
1028
+ "subtitle": null,
1029
+ "width": 219,
1030
+ "height": 308,
1031
+ "imageWidth": 219,
1032
+ "imageHeight": 292
1033
+ },
1034
+ {
1035
+ "href": "/bulletin/backcountry-films",
1036
+ "file": "/static/assets/cms/69d7c8d577743797d075859f-Backountry_Films.jpg-w450",
1037
+ "alt": ".",
1038
+ "title": null,
1039
+ "subtitle": null,
1040
+ "width": 219,
1041
+ "height": 308,
1042
+ "imageWidth": 219,
1043
+ "imageHeight": 292
1044
+ },
1045
+ {
1046
+ "href": "/bulletin/gearhead-field-test",
1047
+ "file": "/static/assets/cms/69d7c8d51e99fbf95b869a44-Field_Test.jpg-w450",
1048
+ "alt": ".",
1049
+ "title": null,
1050
+ "subtitle": null,
1051
+ "width": 219,
1052
+ "height": 308,
1053
+ "imageWidth": 219,
1054
+ "imageHeight": 292
1055
+ },
1056
+ {
1057
+ "href": "/bulletin/gearhead-videos",
1058
+ "file": "/static/assets/cms/69d7c8d58486480430cd7ca8-Gearhead_Videos.jpg-w450",
1059
+ "alt": ".",
1060
+ "title": null,
1061
+ "subtitle": null,
1062
+ "width": 219,
1063
+ "height": 308,
1064
+ "imageWidth": 219,
1065
+ "imageHeight": 292
1066
+ },
1067
+ {
1068
+ "href": "/bulletin/backcountry-podcast",
1069
+ "file": "/static/assets/cms/67630356ea6bc69018189da9-Backcountry_Podcasts.jpg-w450",
1070
+ "alt": "Backcountry Podcast",
1071
+ "title": null,
1072
+ "subtitle": null,
1073
+ "width": 219,
1074
+ "height": 308,
1075
+ "imageWidth": 219,
1076
+ "imageHeight": 292
1077
+ }
1078
+ ]
1079
+ },
1080
+ {
1081
+ "kind": "carousel",
1082
+ "heading": null,
1083
+ "arrows": true,
1084
+ "height": 485,
1085
+ "cards": [
1086
+ {
1087
+ "href": "/bulletin/bikepacking-colorado#watch",
1088
+ "file": "/static/assets/cms/690bf11a73e076dc122b3d7f-Card_3x4_GH-Adventure-5.jpg-w450",
1089
+ "alt": "Gearhead Adventure | Ep. 5",
1090
+ "title": "Gearhead Adventure | Ep. 5",
1091
+ "subtitle": "Bikepacking Colorado",
1092
+ "width": 245,
1093
+ "height": 381,
1094
+ "imageWidth": 245,
1095
+ "imageHeight": 327
1096
+ },
1097
+ {
1098
+ "href": "/bulletin/gearhead-guide-tahoe#touroftahoevideo",
1099
+ "file": "/static/assets/cms/690bf115e56f964b105a0382-Card_3x4_GH-Adventure-4.jpg-w450",
1100
+ "alt": "Gearhead Adventure | Ep. 4",
1101
+ "title": "Gearhead Adventure | Ep. 4",
1102
+ "subtitle": "Tour Of Tahoe",
1103
+ "width": 245,
1104
+ "height": 381,
1105
+ "imageWidth": 245,
1106
+ "imageHeight": 327
1107
+ },
1108
+ {
1109
+ "href": "/bulletin/gearhead-guide-torres-del-paine#ghadventurevideo",
1110
+ "file": "/static/assets/cms/690bf11e05acfe73880fbd64-Card_3x4_GH-Adventure-3.jpg-w450",
1111
+ "alt": "Gearhead Adventure | Ep. 3",
1112
+ "title": "Gearhead Adventure | Ep. 3",
1113
+ "subtitle": "Exploring Patagonia",
1114
+ "width": 245,
1115
+ "height": 381,
1116
+ "imageWidth": 245,
1117
+ "imageHeight": 327
1118
+ },
1119
+ {
1120
+ "href": "/bulletin/top-things-to-do-in-new-zealand#ghadventurevideo",
1121
+ "file": "/static/assets/cms/690bf11fd3150572106ac9e2-Card_3x4_GH-Adventure-2.jpg-w450",
1122
+ "alt": "Gearhead Adventure | Ep. 2",
1123
+ "title": "Gearhead Adventure | Ep. 2",
1124
+ "subtitle": "Trekking New Zealand",
1125
+ "width": 245,
1126
+ "height": 381,
1127
+ "imageWidth": 245,
1128
+ "imageHeight": 327
1129
+ },
1130
+ {
1131
+ "href": "/bulletin/overlanding-guide#ghadventure",
1132
+ "file": "/static/assets/cms/690bf11337acaee80a5ac231-Card_3x4_GH-Adventure-1.jpg-w450",
1133
+ "alt": "Gearhead Adventure | Ep. 1",
1134
+ "title": "Gearhead Adventure | Ep. 1",
1135
+ "subtitle": "What To Do In Montana",
1136
+ "width": 245,
1137
+ "height": 381,
1138
+ "imageWidth": 245,
1139
+ "imageHeight": 327
1140
+ }
1141
+ ]
1142
+ },
1143
+ {
1144
+ "kind": "grid",
1145
+ "height": 205,
1146
+ "cards": [
1147
+ {
1148
+ "href": "/info/loyalty",
1149
+ "file": "/static/assets/cms/6969403d7d6f880008c57811-2_1_SC_V4.jpg-w450",
1150
+ "alt": "Summit Club+",
1151
+ "title": null,
1152
+ "subtitle": null,
1153
+ "width": 282,
1154
+ "height": 157,
1155
+ "imageWidth": 282,
1156
+ "imageHeight": 141
1157
+ },
1158
+ {
1159
+ "href": "/info/shipping-policy",
1160
+ "file": "/static/assets/cms/679bf2144ddeea83bac81c04-2_1_free_shipping.jpg-w450",
1161
+ "alt": "Free Shipping Over 50",
1162
+ "title": null,
1163
+ "subtitle": null,
1164
+ "width": 282,
1165
+ "height": 157,
1166
+ "imageWidth": 282,
1167
+ "imageHeight": 141
1168
+ },
1169
+ {
1170
+ "href": "/info/return-policy",
1171
+ "file": "/static/assets/cms/665898d0e4a7322dd7978c8e-2_1_returns.jpg-w450",
1172
+ "alt": "Hassle Free Returns",
1173
+ "title": null,
1174
+ "subtitle": null,
1175
+ "width": 282,
1176
+ "height": 157,
1177
+ "imageWidth": 282,
1178
+ "imageHeight": 141
1179
+ },
1180
+ {
1181
+ "href": "/info/truemed",
1182
+ "file": "/static/assets/cms/69c443115930182367eb31fe-Truemed_Footer_Card_Image_BC_V4.jpg-w450",
1183
+ "alt": "TrueMed",
1184
+ "title": null,
1185
+ "subtitle": null,
1186
+ "width": 282,
1187
+ "height": 157,
1188
+ "imageWidth": 282,
1189
+ "imageHeight": 141
1190
+ }
1191
+ ]
1192
+ }
1193
+ ]
1194
+ }
tasks/backcountry/environment/reference/clone/data/landings.json ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "activities": {
3
+ "h1": "Gear New Arrivals",
4
+ "title": "Gear New Arrivals | Backcountry.com",
5
+ "resultCount": "778 results",
6
+ "subnav": []
7
+ },
8
+ "bike": {
9
+ "h1": "Bike Accessories, Gear, and Apparel",
10
+ "title": "Bike Gear and Clothing | Backcountry.com",
11
+ "resultCount": "11084 results",
12
+ "subnav": [
13
+ {
14
+ "label": "Shoes",
15
+ "href": "/cat/bike-footwear"
16
+ },
17
+ {
18
+ "label": "Gloves",
19
+ "href": "/cat/bike-gloves"
20
+ },
21
+ {
22
+ "label": "Clothing",
23
+ "href": "/cat/bike-apparel-accessories"
24
+ },
25
+ {
26
+ "label": "Glasses",
27
+ "href": "/cat/sunglasses-goggles"
28
+ },
29
+ {
30
+ "label": "Socks",
31
+ "href": "/cat/bike-socks"
32
+ },
33
+ {
34
+ "label": "Helmets",
35
+ "href": "/cat/bike-helmets-protection"
36
+ }
37
+ ]
38
+ },
39
+ "brands": {
40
+ "h1": "Backcountry",
41
+ "title": "Backcountry Apparel",
42
+ "resultCount": "251 results",
43
+ "subnav": []
44
+ },
45
+ "camp": {
46
+ "h1": "Hiking & Camping Gear",
47
+ "title": "Hiking & Camping Gear | Backcountry.com",
48
+ "resultCount": "8333 results",
49
+ "subnav": []
50
+ },
51
+ "climb": {
52
+ "h1": "Climbing Gear",
53
+ "title": "Climbing Gear, Equipment and Clothing | Backcountry.com",
54
+ "resultCount": "3125 results",
55
+ "subnav": []
56
+ },
57
+ "footwear": {
58
+ "h1": "Footwear",
59
+ "title": "Footwear | Backcountry.com",
60
+ "resultCount": "2477 results",
61
+ "subnav": []
62
+ },
63
+ "guides": {
64
+ "h1": "Gearhead Picks",
65
+ "title": "Gearhead Picks | Backcountry.com",
66
+ "resultCount": "3272 results",
67
+ "subnav": []
68
+ },
69
+ "kids": {
70
+ "h1": "Shop All Kids",
71
+ "title": "Shop All Kids | Backcountry.com",
72
+ "resultCount": "943 results",
73
+ "subnav": [
74
+ {
75
+ "label": "Boys",
76
+ "href": "/rc/shop-all-kids?p=gender_uFilter:\"male\"|gender_uFilter:\"unisex\""
77
+ },
78
+ {
79
+ "label": "Girls",
80
+ "href": "/rc/shop-all-kids?p=gender_uFilter:\"female\"|gender_uFilter:\"unisex\""
81
+ },
82
+ {
83
+ "label": "Jackets",
84
+ "href": "/rc/kids-jackets"
85
+ },
86
+ {
87
+ "label": "Fleece",
88
+ "href": "/rc/kids-fleece-jackets"
89
+ },
90
+ {
91
+ "label": "Tops",
92
+ "href": "/rc/kids-tops"
93
+ },
94
+ {
95
+ "label": "Bottoms",
96
+ "href": "/rc/kids-bottoms"
97
+ },
98
+ {
99
+ "label": "Swimwear",
100
+ "href": "/rc/kids-swimwear"
101
+ }
102
+ ]
103
+ },
104
+ "men": {
105
+ "h1": "Shop All Men's",
106
+ "title": "Shop All Men's | Backcountry.com",
107
+ "resultCount": "11703 results",
108
+ "subnav": [
109
+ {
110
+ "label": "Clothing",
111
+ "href": "/cat/mens-clothing"
112
+ },
113
+ {
114
+ "label": "Footwear",
115
+ "href": "/cat/mens-footwear"
116
+ },
117
+ {
118
+ "label": "Accessories",
119
+ "href": "/cat/mens-accessories"
120
+ }
121
+ ]
122
+ },
123
+ "sale": {
124
+ "h1": "Extra 10–20% Off Clearance",
125
+ "title": "Extra 10–20% Off Clearance | Backcountry.com",
126
+ "resultCount": "3510 results",
127
+ "subnav": [
128
+ {
129
+ "label": "Shop 20%",
130
+ "href": "/rc/extra-20-off-select-markdowns"
131
+ },
132
+ {
133
+ "label": "Shop 10%",
134
+ "href": "/rc/extra-10-off-clearance"
135
+ }
136
+ ]
137
+ },
138
+ "ski": {
139
+ "h1": "Ski Gear, Equipment, and Clothing",
140
+ "title": "Ski Gear and Clothing | Backcountry.com",
141
+ "resultCount": "4043 results",
142
+ "subnav": [
143
+ {
144
+ "label": "Skis",
145
+ "href": "/rc/skis"
146
+ },
147
+ {
148
+ "label": "Ski Clothing",
149
+ "href": "/cat/ski-clothing"
150
+ },
151
+ {
152
+ "label": "Helmets & Goggles",
153
+ "href": "/cat/ski-helmets-goggles"
154
+ },
155
+ {
156
+ "label": "Ski Packages",
157
+ "href": "/rc/ski-packages"
158
+ },
159
+ {
160
+ "label": "All-Mountain Skis",
161
+ "href": "/rc/all-mountain-skis"
162
+ },
163
+ {
164
+ "label": "Touring Skis",
165
+ "href": "/cat/alpine-touring-skis"
166
+ },
167
+ {
168
+ "label": "Women's Skis",
169
+ "href": "/rc/skis?p=gender_uFilter:%22female%22"
170
+ },
171
+ {
172
+ "label": "Kids' Skis",
173
+ "href": "/cat/kids-alpine-skis"
174
+ }
175
+ ]
176
+ },
177
+ "snowboard": {
178
+ "h1": "Snowboarding Gear, Equipment, and Clothing",
179
+ "title": "Snowboarding Gear and Clothing | Backcountry.com",
180
+ "resultCount": "3658 results",
181
+ "subnav": []
182
+ },
183
+ "women": {
184
+ "h1": "Shop All Women's",
185
+ "title": "Shop All Women's | Backcountry.com",
186
+ "resultCount": "10026 results",
187
+ "subnav": [
188
+ {
189
+ "label": "Clothing",
190
+ "href": "/cat/womens-clothing"
191
+ },
192
+ {
193
+ "label": "Footwear",
194
+ "href": "/cat/womens-footwear"
195
+ },
196
+ {
197
+ "label": "Accessories",
198
+ "href": "/cat/womens-accessories"
199
+ }
200
+ ]
201
+ }
202
+ }
tasks/backcountry/environment/reference/clone/data/nav.json ADDED
@@ -0,0 +1,3509 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema_version": "backcountry.clone-nav.v2",
3
+ "items": [
4
+ {
5
+ "key": "men",
6
+ "label": "Men",
7
+ "href": "/rc/shop-all-mens",
8
+ "columns": [
9
+ {
10
+ "kind": "promo",
11
+ "href": "/rc/fall-essentials-layers",
12
+ "alt": "",
13
+ "caption": "Get ready for fall weather with bestselling rainwear, fleece & more layers",
14
+ "file": "/static/assets/cms/BC26_0253-Flyout.jpg",
15
+ "width": 136
16
+ },
17
+ {
18
+ "kind": "links",
19
+ "blocks": [
20
+ {
21
+ "type": "heading",
22
+ "label": "Clothing",
23
+ "href": "/cat/mens-clothing",
24
+ "id": "flyout-section-clothing"
25
+ },
26
+ {
27
+ "type": "links",
28
+ "columns": 1,
29
+ "itemWidth": 122,
30
+ "links": [
31
+ {
32
+ "label": "Shirts",
33
+ "href": "/cat/mens-shirts"
34
+ },
35
+ {
36
+ "label": "Activewear",
37
+ "href": "/cat/mens-activewear"
38
+ },
39
+ {
40
+ "label": "Sun Protection",
41
+ "href": "/rc/mens-upf-apparel"
42
+ },
43
+ {
44
+ "label": "Hoodies & Sweatshirts",
45
+ "href": "/cat/mens-hoodies-sweatshirts"
46
+ },
47
+ {
48
+ "label": "Shorts",
49
+ "href": "/cat/mens-shorts"
50
+ },
51
+ {
52
+ "label": "Pants",
53
+ "href": "/cat/mens-pants"
54
+ },
55
+ {
56
+ "label": "Swimwear",
57
+ "href": "/cat/mens-swimwear"
58
+ },
59
+ {
60
+ "label": "Baselayers",
61
+ "href": "/cat/mens-baselayers"
62
+ },
63
+ {
64
+ "label": "Shop All Men's Clothing",
65
+ "href": "/cat/mens-clothing"
66
+ }
67
+ ]
68
+ }
69
+ ],
70
+ "width": 139
71
+ },
72
+ {
73
+ "kind": "links",
74
+ "blocks": [
75
+ {
76
+ "type": "heading",
77
+ "label": "Outerwear",
78
+ "href": "/rc/mens-outerwear",
79
+ "id": "flyout-section-outerwear"
80
+ },
81
+ {
82
+ "type": "links",
83
+ "columns": 1,
84
+ "itemWidth": 122,
85
+ "links": [
86
+ {
87
+ "label": "Rain Jackets",
88
+ "href": "/cat/mens-rain-jackets"
89
+ },
90
+ {
91
+ "label": "Fleece Jackets",
92
+ "href": "/cat/mens-fleece-jackets"
93
+ },
94
+ {
95
+ "label": "Casual Jackets",
96
+ "href": "/cat/mens-casual-jackets"
97
+ },
98
+ {
99
+ "label": "Technical Shells",
100
+ "href": "/cat/mens-technical-shell-jackets"
101
+ },
102
+ {
103
+ "label": "Vests",
104
+ "href": "/cat/mens-vests"
105
+ },
106
+ {
107
+ "label": "Puffers & Insulation",
108
+ "href": "/cat/mens-insulated-jackets"
109
+ },
110
+ {
111
+ "label": "Ski & Snowboard Jackets",
112
+ "href": "/cat/mens-ski-jackets"
113
+ },
114
+ {
115
+ "label": "Parkas",
116
+ "href": "/rc/mens-parkas"
117
+ },
118
+ {
119
+ "label": "Shop All Men's Outerwear",
120
+ "href": "/rc/mens-outerwear"
121
+ }
122
+ ]
123
+ }
124
+ ],
125
+ "width": 139
126
+ },
127
+ {
128
+ "kind": "links",
129
+ "blocks": [
130
+ {
131
+ "type": "heading",
132
+ "label": "Footwear",
133
+ "href": "/cat/mens-footwear",
134
+ "id": "flyout-section-footwear"
135
+ },
136
+ {
137
+ "type": "links",
138
+ "columns": 1,
139
+ "itemWidth": 122,
140
+ "links": [
141
+ {
142
+ "label": "Hiking Boots",
143
+ "href": "/cat/mens-hiking-backpacking-boots"
144
+ },
145
+ {
146
+ "label": "Hiking Shoes",
147
+ "href": "/cat/mens-hiking-backpacking-shoes"
148
+ },
149
+ {
150
+ "label": "Trail Running Shoes",
151
+ "href": "/cat/mens-trail-running-shoes"
152
+ },
153
+ {
154
+ "label": "Road Running Shoes",
155
+ "href": "/cat/mens-road-running-shoes"
156
+ },
157
+ {
158
+ "label": "Approach Shoes",
159
+ "href": "/rc/approach-shoes?p=u_categoryPathId:bc-mens-footwear"
160
+ },
161
+ {
162
+ "label": "Sandals",
163
+ "href": "/cat/mens-sandals"
164
+ },
165
+ {
166
+ "label": "Casual Shoes",
167
+ "href": "/cat/mens-casual-shoes"
168
+ },
169
+ {
170
+ "label": "Casual Boots",
171
+ "href": "/cat/mens-casual-boots"
172
+ },
173
+ {
174
+ "label": "Water Shoes",
175
+ "href": "/cat/mens-water-shoes"
176
+ },
177
+ {
178
+ "label": "Slippers",
179
+ "href": "/cat/mens-slippers"
180
+ },
181
+ {
182
+ "label": "Winter Boots & Shoes",
183
+ "href": "/cat/mens-winter-boots-shoes"
184
+ },
185
+ {
186
+ "label": "Shop All Men's Footwear",
187
+ "href": "/cat/mens-footwear"
188
+ }
189
+ ]
190
+ }
191
+ ],
192
+ "width": 139
193
+ },
194
+ {
195
+ "kind": "links",
196
+ "blocks": [
197
+ {
198
+ "type": "heading",
199
+ "label": "Accessories",
200
+ "href": "/cat/mens-accessories",
201
+ "id": "flyout-section-accessories"
202
+ },
203
+ {
204
+ "type": "links",
205
+ "columns": 1,
206
+ "itemWidth": 122,
207
+ "links": [
208
+ {
209
+ "label": "Sunglasses",
210
+ "href": "/cat/mens-sunglasses"
211
+ },
212
+ {
213
+ "label": "Caps & Snapbacks",
214
+ "href": "/rc/brimmed-hats"
215
+ },
216
+ {
217
+ "label": "Sun Hats",
218
+ "href": "/cat/mens-sun-rain-hats"
219
+ },
220
+ {
221
+ "label": "Socks",
222
+ "href": "/cat/mens-socks"
223
+ },
224
+ {
225
+ "label": "Neckwear & Bandanas",
226
+ "href": "/cat/mens-neckwear"
227
+ },
228
+ {
229
+ "label": "Gloves & Mittens",
230
+ "href": "/cat/mens-gloves-mittens"
231
+ },
232
+ {
233
+ "label": "Bags & Packs",
234
+ "href": "/cat/mens-everyday-packs"
235
+ },
236
+ {
237
+ "label": "Duffels",
238
+ "href": "/cat/mens-duffels"
239
+ },
240
+ {
241
+ "label": "Blankets & Beach Towels",
242
+ "href": "/cat/blankets-beach-towels"
243
+ },
244
+ {
245
+ "label": "Belts",
246
+ "href": "/cat/mens-belts"
247
+ },
248
+ {
249
+ "label": "Watches",
250
+ "href": "/cat/mens-watches"
251
+ },
252
+ {
253
+ "label": "Electronics",
254
+ "href": "/cat/mens-electronics"
255
+ },
256
+ {
257
+ "label": "Shop All Men's Accessories",
258
+ "href": "/cat/mens-accessories"
259
+ }
260
+ ]
261
+ }
262
+ ],
263
+ "width": 139
264
+ },
265
+ {
266
+ "kind": "links",
267
+ "blocks": [
268
+ {
269
+ "type": "heading",
270
+ "label": "Top Brands",
271
+ "href": "/shop-all-brands",
272
+ "id": "flyout-section-top-brands"
273
+ },
274
+ {
275
+ "type": "links",
276
+ "columns": 1,
277
+ "itemWidth": 122,
278
+ "links": [
279
+ {
280
+ "label": "Patagonia",
281
+ "href": "/brand/patagonia?p=gender_uFilter:\"male\""
282
+ },
283
+ {
284
+ "label": "The North Face",
285
+ "href": "/brand/the-north-face?p=gender_uFilter:\"male\""
286
+ },
287
+ {
288
+ "label": "Backcountry",
289
+ "href": "/brand/backcountry?p=gender_uFilter:\"male\""
290
+ },
291
+ {
292
+ "label": "Outdoor Research",
293
+ "href": "/brand/outdoor-research?p=gender_uFilter:\"male\""
294
+ },
295
+ {
296
+ "label": "Mountain Hardwear",
297
+ "href": "/brand/mountain-hardwear?p=gender_uFilter:\"male\""
298
+ },
299
+ {
300
+ "label": "Fjallraven",
301
+ "href": "/brand/fjallraven?p=gender_uFilter:\"male\""
302
+ },
303
+ {
304
+ "label": "Black Diamond",
305
+ "href": "/brand/black-diamond?p=gender_uFilter:\"male\""
306
+ },
307
+ {
308
+ "label": "Rab",
309
+ "href": "/brand/rab?p=gender_uFilter:\"male\""
310
+ },
311
+ {
312
+ "label": "Salomon",
313
+ "href": "/brand/salomon?p=gender_uFilter:\"male\""
314
+ },
315
+ {
316
+ "label": "Mammut",
317
+ "href": "/brand/mammut?p=gender_uFilter:\"male\""
318
+ },
319
+ {
320
+ "label": "La Sportiva",
321
+ "href": "/brand/la-sportiva?p=gender_uFilter:\"male\""
322
+ },
323
+ {
324
+ "label": "Marmot",
325
+ "href": "/brand/marmot?p=gender_uFilter:\"male\""
326
+ },
327
+ {
328
+ "label": "Katin",
329
+ "href": "/brand/katin"
330
+ },
331
+ {
332
+ "label": "Shop All Brands",
333
+ "href": "/shop-all-brands"
334
+ }
335
+ ]
336
+ }
337
+ ],
338
+ "width": 139
339
+ },
340
+ {
341
+ "kind": "links",
342
+ "blocks": [
343
+ {
344
+ "type": "heading",
345
+ "label": "New Arrivals",
346
+ "href": "/rc/men-s-new-arrivals",
347
+ "id": "flyout-section-new-arrivals"
348
+ },
349
+ {
350
+ "type": "heading",
351
+ "label": "On Sale",
352
+ "href": "/rc/mens-sale-clothing",
353
+ "id": "flyout-section-on-sale"
354
+ },
355
+ {
356
+ "type": "heading",
357
+ "label": "Bestsellers",
358
+ "href": "/rc/mens-best-sellers",
359
+ "id": "flyout-section-bestsellers"
360
+ }
361
+ ],
362
+ "width": 139
363
+ }
364
+ ]
365
+ },
366
+ {
367
+ "key": "women",
368
+ "label": "Women",
369
+ "href": "/rc/shop-all-womens",
370
+ "columns": [
371
+ {
372
+ "kind": "promo",
373
+ "href": "/rc/fall-essentials-layers",
374
+ "alt": "",
375
+ "caption": "Get ready for fall weather with bestselling rainwear, fleece & more layers",
376
+ "file": "/static/assets/cms/BC26_0253-Flyout.jpg",
377
+ "width": 136
378
+ },
379
+ {
380
+ "kind": "links",
381
+ "blocks": [
382
+ {
383
+ "type": "heading",
384
+ "label": "Clothing",
385
+ "href": "/cat/womens-clothing",
386
+ "id": "flyout-section-clothing"
387
+ },
388
+ {
389
+ "type": "links",
390
+ "columns": 1,
391
+ "itemWidth": 122,
392
+ "links": [
393
+ {
394
+ "label": "Tops",
395
+ "href": "/cat/womens-tops"
396
+ },
397
+ {
398
+ "label": "Activewear",
399
+ "href": "/cat/womens-activewear"
400
+ },
401
+ {
402
+ "label": "Sun Protection",
403
+ "href": "/rc/womens-upf-apparel"
404
+ },
405
+ {
406
+ "label": "Hoodies & Sweatshirts",
407
+ "href": "/cat/womens-sweatshirts"
408
+ },
409
+ {
410
+ "label": "Shorts",
411
+ "href": "/cat/womens-shorts"
412
+ },
413
+ {
414
+ "label": "Pants",
415
+ "href": "/cat/womens-pants"
416
+ },
417
+ {
418
+ "label": "Dresses & Skirts",
419
+ "href": "/cat/womens-dresses-skirts"
420
+ },
421
+ {
422
+ "label": "Jumpsuits & Overalls",
423
+ "href": "/cat/womens-jumpsuits"
424
+ },
425
+ {
426
+ "label": "Swimwear",
427
+ "href": "/cat/womens-swimwear"
428
+ },
429
+ {
430
+ "label": "Baselayers",
431
+ "href": "/cat/womens-baselayers"
432
+ },
433
+ {
434
+ "label": "Shop All Women's Clothing",
435
+ "href": "/cat/womens-clothing"
436
+ }
437
+ ]
438
+ }
439
+ ],
440
+ "width": 139
441
+ },
442
+ {
443
+ "kind": "links",
444
+ "blocks": [
445
+ {
446
+ "type": "heading",
447
+ "label": "Outerwear",
448
+ "href": "/rc/womens-outerwear",
449
+ "id": "flyout-section-outerwear"
450
+ },
451
+ {
452
+ "type": "links",
453
+ "columns": 1,
454
+ "itemWidth": 122,
455
+ "links": [
456
+ {
457
+ "label": "Rain Jackets",
458
+ "href": "/cat/womens-rain-jackets"
459
+ },
460
+ {
461
+ "label": "Fleece Jackets",
462
+ "href": "/cat/womens-fleece-jackets"
463
+ },
464
+ {
465
+ "label": "Casual Jackets",
466
+ "href": "/cat/womens-casual-jackets"
467
+ },
468
+ {
469
+ "label": "Technical Shells",
470
+ "href": "/cat/womens-technical-shell-jackets"
471
+ },
472
+ {
473
+ "label": "Vests",
474
+ "href": "/cat/womens-vests"
475
+ },
476
+ {
477
+ "label": "Puffers & Insulation",
478
+ "href": "/cat/womens-insulated-jackets"
479
+ },
480
+ {
481
+ "label": "Ski & Snowboard Jackets",
482
+ "href": "/cat/womens-ski-jackets"
483
+ },
484
+ {
485
+ "label": "Parkas",
486
+ "href": "/rc/womens-parkas"
487
+ },
488
+ {
489
+ "label": "Shop All Women's Outerwear",
490
+ "href": "/rc/womens-outerwear"
491
+ }
492
+ ]
493
+ }
494
+ ],
495
+ "width": 139
496
+ },
497
+ {
498
+ "kind": "links",
499
+ "blocks": [
500
+ {
501
+ "type": "heading",
502
+ "label": "Footwear",
503
+ "href": "/cat/womens-footwear",
504
+ "id": "flyout-section-footwear"
505
+ },
506
+ {
507
+ "type": "links",
508
+ "columns": 1,
509
+ "itemWidth": 122,
510
+ "links": [
511
+ {
512
+ "label": "Hiking Boots",
513
+ "href": "/cat/womens-hiking-backpacking-boots"
514
+ },
515
+ {
516
+ "label": "Hiking Shoes",
517
+ "href": "/cat/womens-hiking-backpacking-shoes"
518
+ },
519
+ {
520
+ "label": "Trail Running Shoes",
521
+ "href": "/cat/womens-trail-running-shoes"
522
+ },
523
+ {
524
+ "label": "Road Running Shoes",
525
+ "href": "/cat/womens-road-running-shoes"
526
+ },
527
+ {
528
+ "label": "Approach Shoes",
529
+ "href": "/rc/approach-shoes?p=u_categoryPathId:bc-womens-footwear"
530
+ },
531
+ {
532
+ "label": "Sandals",
533
+ "href": "/cat/womens-sandals"
534
+ },
535
+ {
536
+ "label": "Casual Shoes & Sneakers",
537
+ "href": "/cat/womens-casual-shoes"
538
+ },
539
+ {
540
+ "label": "Casual Boots",
541
+ "href": "/cat/womens-casual-boots"
542
+ },
543
+ {
544
+ "label": "Water Shoes",
545
+ "href": "/cat/womens-water-shoes"
546
+ },
547
+ {
548
+ "label": "Slippers",
549
+ "href": "/cat/womens-slippers"
550
+ },
551
+ {
552
+ "label": "Winter Boots & Shoes",
553
+ "href": "/cat/womens-winter-boots-shoes"
554
+ },
555
+ {
556
+ "label": "Shop All Women's Footwear",
557
+ "href": "/cat/womens-footwear"
558
+ }
559
+ ]
560
+ }
561
+ ],
562
+ "width": 139
563
+ },
564
+ {
565
+ "kind": "links",
566
+ "blocks": [
567
+ {
568
+ "type": "heading",
569
+ "label": "Accessories",
570
+ "href": "/cat/womens-accessories",
571
+ "id": "flyout-section-accessories"
572
+ },
573
+ {
574
+ "type": "links",
575
+ "columns": 1,
576
+ "itemWidth": 122,
577
+ "links": [
578
+ {
579
+ "label": "Sunglasses",
580
+ "href": "/cat/womens-sunglasses"
581
+ },
582
+ {
583
+ "label": "Caps & Snapbacks",
584
+ "href": "/rc/brimmed-hats"
585
+ },
586
+ {
587
+ "label": "Sun Hats",
588
+ "href": "/cat/womens-sun-rain-hats"
589
+ },
590
+ {
591
+ "label": "Socks",
592
+ "href": "/cat/womens-socks"
593
+ },
594
+ {
595
+ "label": "Neckwear & Bandanas",
596
+ "href": "/cat/womens-neckwear"
597
+ },
598
+ {
599
+ "label": "Headbands",
600
+ "href": "/cat/womens-headbands"
601
+ },
602
+ {
603
+ "label": "Gloves & Mittens",
604
+ "href": "/cat/womens-gloves-mittens"
605
+ },
606
+ {
607
+ "label": "Everyday Bags",
608
+ "href": "/cat/handbags"
609
+ },
610
+ {
611
+ "label": "Backpacks",
612
+ "href": "/cat/womens-everyday-packs"
613
+ },
614
+ {
615
+ "label": "Beach Bags & Totes",
616
+ "href": "/cat/beach-bags-totes"
617
+ },
618
+ {
619
+ "label": "Blankets & Beach Towels",
620
+ "href": "/cat/blankets-beach-towels"
621
+ },
622
+ {
623
+ "label": "Belts",
624
+ "href": "/cat/womens-belts"
625
+ },
626
+ {
627
+ "label": "Watches",
628
+ "href": "/cat/womens-watches"
629
+ },
630
+ {
631
+ "label": "Electronics",
632
+ "href": "/cat/womens-electronics"
633
+ },
634
+ {
635
+ "label": "Shop All Women's Accessories",
636
+ "href": "/cat/womens-accessories"
637
+ }
638
+ ]
639
+ }
640
+ ],
641
+ "width": 139
642
+ },
643
+ {
644
+ "kind": "links",
645
+ "blocks": [
646
+ {
647
+ "type": "heading",
648
+ "label": "Top Brands",
649
+ "href": "/shop-all-brands",
650
+ "id": "flyout-section-top-brands"
651
+ },
652
+ {
653
+ "type": "links",
654
+ "columns": 1,
655
+ "itemWidth": 122,
656
+ "links": [
657
+ {
658
+ "label": "Patagonia",
659
+ "href": "/brand/patagonia?p=gender_uFilter:\"female\""
660
+ },
661
+ {
662
+ "label": "The North Face",
663
+ "href": "/brand/the-north-face?p=gender_uFilter:\"female\""
664
+ },
665
+ {
666
+ "label": "Backcountry",
667
+ "href": "/brand/backcountry?p=gender_uFilter:\"female\""
668
+ },
669
+ {
670
+ "label": "Free People",
671
+ "href": "/brand/free-people"
672
+ },
673
+ {
674
+ "label": "Mountain Hardwear",
675
+ "href": "/brand/mountain-hardwear?p=gender_uFilter:\"female\""
676
+ },
677
+ {
678
+ "label": "Outdoor Research",
679
+ "href": "/brand/outdoor-research?p=gender_uFilter:\"female\""
680
+ },
681
+ {
682
+ "label": "Salomon",
683
+ "href": "/brand/salomon?p=gender_uFilter:\"female\""
684
+ },
685
+ {
686
+ "label": "prAna",
687
+ "href": "/brand/prana?p=gender_uFilter:\"female\""
688
+ },
689
+ {
690
+ "label": "Barbour",
691
+ "href": "/brand/barbour?p=gender_uFilter:\"female\""
692
+ },
693
+ {
694
+ "label": "La Sportiva",
695
+ "href": "/brand/la-sportiva?p=gender_uFilter:\"female\""
696
+ },
697
+ {
698
+ "label": "Rab",
699
+ "href": "/brand/rab?p=gender_uFilter:\"female\""
700
+ },
701
+ {
702
+ "label": "Mammut",
703
+ "href": "/brand/mammut?p=gender_uFilter:\"female\""
704
+ },
705
+ {
706
+ "label": "Cotopaxi",
707
+ "href": "/brand/cotopaxi?p=gender_uFilter:\"female\""
708
+ },
709
+ {
710
+ "label": "Shop All Brands",
711
+ "href": "/shop-all-brands"
712
+ }
713
+ ]
714
+ }
715
+ ],
716
+ "width": 139
717
+ },
718
+ {
719
+ "kind": "links",
720
+ "blocks": [
721
+ {
722
+ "type": "heading",
723
+ "label": "New Arrivals",
724
+ "href": "/rc/women-s-new-arrivals",
725
+ "id": "flyout-section-new-arrivals"
726
+ },
727
+ {
728
+ "type": "heading",
729
+ "label": "On Sale",
730
+ "href": "/rc/womens-sale-clothing",
731
+ "id": "flyout-section-on-sale"
732
+ },
733
+ {
734
+ "type": "heading",
735
+ "label": "Bestsellers",
736
+ "href": "/rc/womens-best-sellers",
737
+ "id": "flyout-section-bestsellers"
738
+ }
739
+ ],
740
+ "width": 139
741
+ }
742
+ ]
743
+ },
744
+ {
745
+ "key": "kids",
746
+ "label": "Kids",
747
+ "href": "/rc/shop-all-kids",
748
+ "columns": [
749
+ {
750
+ "kind": "links",
751
+ "blocks": [
752
+ {
753
+ "type": "heading",
754
+ "label": "Infant & Toddler (0-5T)",
755
+ "href": "/rc/shop-all-infant-toddler",
756
+ "id": "flyout-section-infant-toddler-0-5t"
757
+ },
758
+ {
759
+ "type": "links",
760
+ "columns": 1,
761
+ "itemWidth": 122,
762
+ "links": [
763
+ {
764
+ "label": "Jackets & Outerwear",
765
+ "href": "/rc/infant-toddler-jackets-outerwear"
766
+ },
767
+ {
768
+ "label": "Fleece Jackets",
769
+ "href": "/rc/infant-toddler-fleece-jackets"
770
+ },
771
+ {
772
+ "label": "Rain Jackets",
773
+ "href": "/rc/infant-toddler-rain-jackets"
774
+ },
775
+ {
776
+ "label": "Tops",
777
+ "href": "/rc/infant-toddler-tops"
778
+ },
779
+ {
780
+ "label": "Bottoms",
781
+ "href": "/rc/infant-toddler-bottoms"
782
+ },
783
+ {
784
+ "label": "Swimwear",
785
+ "href": "/rc/infant-toddler-swimwear"
786
+ },
787
+ {
788
+ "label": "One-Pieces & Buntings",
789
+ "href": "/rc/infant-toddler-onepieces-buntings"
790
+ },
791
+ {
792
+ "label": "Baselayers",
793
+ "href": "/rc/infant-toddler-baselayers"
794
+ },
795
+ {
796
+ "label": "Shop All Infant & Toddler",
797
+ "href": "/rc/shop-all-infant-toddler"
798
+ }
799
+ ]
800
+ }
801
+ ],
802
+ "width": 139
803
+ },
804
+ {
805
+ "kind": "links",
806
+ "blocks": [
807
+ {
808
+ "type": "heading",
809
+ "label": "Kids (5+)",
810
+ "href": "/rc/shop-all-kids",
811
+ "id": "flyout-section-kids-5"
812
+ },
813
+ {
814
+ "type": "links",
815
+ "columns": 1,
816
+ "itemWidth": 122,
817
+ "links": [
818
+ {
819
+ "label": "Jackets",
820
+ "href": "/rc/kids-jackets"
821
+ },
822
+ {
823
+ "label": "Fleece Jackets",
824
+ "href": "/rc/kids-fleece-jackets"
825
+ },
826
+ {
827
+ "label": "Rain Jackets",
828
+ "href": "/rc/kids-rain-jackets"
829
+ },
830
+ {
831
+ "label": "Tops",
832
+ "href": "/rc/kids-tops"
833
+ },
834
+ {
835
+ "label": "Bottoms",
836
+ "href": "/rc/kids-bottoms"
837
+ },
838
+ {
839
+ "label": "Swimwear",
840
+ "href": "/rc/kids-swimwear"
841
+ },
842
+ {
843
+ "label": "Snow Outerwear",
844
+ "href": "/rc/kids-snow-outerwear"
845
+ },
846
+ {
847
+ "label": "Baselayers",
848
+ "href": "/rc/kids-baselayers"
849
+ },
850
+ {
851
+ "label": "Shop All Kids",
852
+ "href": "/rc/shop-all-kids"
853
+ }
854
+ ]
855
+ }
856
+ ],
857
+ "width": 139
858
+ },
859
+ {
860
+ "kind": "links",
861
+ "blocks": [
862
+ {
863
+ "type": "heading",
864
+ "label": "Footwear",
865
+ "href": "/cat/kids-footwear",
866
+ "id": "flyout-section-footwear"
867
+ },
868
+ {
869
+ "type": "links",
870
+ "columns": 1,
871
+ "itemWidth": 122,
872
+ "links": [
873
+ {
874
+ "label": "Sneakers & Casual Shoes",
875
+ "href": "/rc/kids-casual-shoes"
876
+ },
877
+ {
878
+ "label": "Sandals & Water Shoes",
879
+ "href": "/rc/kids-sandals-water-shoes"
880
+ },
881
+ {
882
+ "label": "Hiking Boots & Shoes",
883
+ "href": "/rc/kids-hiking-boots-shoes"
884
+ },
885
+ {
886
+ "label": "Rain Boots",
887
+ "href": "/rc/kids-rain-boots"
888
+ },
889
+ {
890
+ "label": "Winter Boots",
891
+ "href": "/rc/kids-winter-boots-shoes"
892
+ },
893
+ {
894
+ "label": "Toddler Shoes",
895
+ "href": "/rc/toddler-shoes"
896
+ },
897
+ {
898
+ "label": "Infant Shoes",
899
+ "href": "/rc/infant-shoes"
900
+ },
901
+ {
902
+ "label": "Shop All Footwear",
903
+ "href": "/cat/kids-footwear"
904
+ }
905
+ ]
906
+ }
907
+ ],
908
+ "width": 139
909
+ },
910
+ {
911
+ "kind": "links",
912
+ "blocks": [
913
+ {
914
+ "type": "heading",
915
+ "label": "Accessories",
916
+ "href": "/cat/kids-accessories",
917
+ "id": "flyout-section-accessories"
918
+ },
919
+ {
920
+ "type": "links",
921
+ "columns": 1,
922
+ "itemWidth": 122,
923
+ "links": [
924
+ {
925
+ "label": "Gloves & Mittens",
926
+ "href": "/rc/kids-gloves-mittens"
927
+ },
928
+ {
929
+ "label": "Hats",
930
+ "href": "/rc/kids-hats"
931
+ },
932
+ {
933
+ "label": "Beanies",
934
+ "href": "/cat/kids-beanies"
935
+ },
936
+ {
937
+ "label": "Balaclavas & Neck Gaiters",
938
+ "href": "/cat/kids-balaclavas-neck-gaiters"
939
+ },
940
+ {
941
+ "label": "Socks",
942
+ "href": "/cat/kids-socks"
943
+ },
944
+ {
945
+ "label": "Sunglasses",
946
+ "href": "/cat/kids-sunglasses"
947
+ },
948
+ {
949
+ "label": "Shop All Accessories",
950
+ "href": "/cat/kids-accessories"
951
+ }
952
+ ]
953
+ }
954
+ ],
955
+ "width": 139
956
+ },
957
+ {
958
+ "kind": "links",
959
+ "blocks": [
960
+ {
961
+ "type": "heading",
962
+ "label": "Everyday Essentials",
963
+ "href": "/cat/kids-accessories",
964
+ "id": "flyout-section-everyday-essentials"
965
+ },
966
+ {
967
+ "type": "links",
968
+ "columns": 1,
969
+ "itemWidth": 122,
970
+ "links": [
971
+ {
972
+ "label": "Backpacks",
973
+ "href": "/cat/kids-backpacks-bags"
974
+ },
975
+ {
976
+ "label": "Kid Carriers",
977
+ "href": "/cat/kid-carriers"
978
+ },
979
+ {
980
+ "label": "Strollers & Trailers",
981
+ "href": "/cat/kids-strollers-trailers"
982
+ },
983
+ {
984
+ "label": "Water Bottles",
985
+ "href": "/rc/kids-water-bottles"
986
+ },
987
+ {
988
+ "label": "Lunch Boxes",
989
+ "href": "/rc/kids-lunch-boxes"
990
+ }
991
+ ]
992
+ }
993
+ ],
994
+ "width": 139
995
+ },
996
+ {
997
+ "kind": "links",
998
+ "blocks": [
999
+ {
1000
+ "type": "heading",
1001
+ "label": "Gear By Activity",
1002
+ "href": "/cat/kids-gear",
1003
+ "id": "flyout-section-gear-by-activity"
1004
+ },
1005
+ {
1006
+ "type": "links",
1007
+ "columns": 1,
1008
+ "itemWidth": 122,
1009
+ "links": [
1010
+ {
1011
+ "label": "Ski",
1012
+ "href": "/cat/kids-ski"
1013
+ },
1014
+ {
1015
+ "label": "Snowboard",
1016
+ "href": "/cat/kids-snowboard-gear"
1017
+ },
1018
+ {
1019
+ "label": "Bike",
1020
+ "href": "/cat/kids-bikes"
1021
+ },
1022
+ {
1023
+ "label": "Camp",
1024
+ "href": "/cat/kids-camp"
1025
+ },
1026
+ {
1027
+ "label": "Climb",
1028
+ "href": "/cat/kids-climb"
1029
+ },
1030
+ {
1031
+ "label": "Water",
1032
+ "href": "/cat/kids-water-sports"
1033
+ },
1034
+ {
1035
+ "label": "Shop All Gear",
1036
+ "href": "/cat/kids-gear"
1037
+ }
1038
+ ]
1039
+ }
1040
+ ],
1041
+ "width": 139
1042
+ },
1043
+ {
1044
+ "kind": "links",
1045
+ "blocks": [
1046
+ {
1047
+ "type": "heading",
1048
+ "label": "New Arrivals",
1049
+ "href": "/rc/kids-new-arrivals",
1050
+ "id": "flyout-section-new-arrivals"
1051
+ },
1052
+ {
1053
+ "type": "heading",
1054
+ "label": "On Sale",
1055
+ "href": "/rc/kids-clothing-on-sale",
1056
+ "id": "flyout-section-on-sale"
1057
+ }
1058
+ ],
1059
+ "width": 139
1060
+ }
1061
+ ]
1062
+ },
1063
+ {
1064
+ "key": "footwear",
1065
+ "label": "Footwear",
1066
+ "href": "/rc/footwear",
1067
+ "columns": [
1068
+ {
1069
+ "kind": "promo",
1070
+ "href": "/rc/waterproof-gear",
1071
+ "alt": "",
1072
+ "caption": "Waterproof gear | Hiking boots, rainwear & more storm-ready styles",
1073
+ "file": "/static/assets/cms/BC26_0258-Flyout.jpg",
1074
+ "width": 178
1075
+ },
1076
+ {
1077
+ "kind": "links",
1078
+ "blocks": [
1079
+ {
1080
+ "type": "heading",
1081
+ "label": "Men's",
1082
+ "href": "/cat/mens-footwear",
1083
+ "id": "flyout-section-men-s"
1084
+ },
1085
+ {
1086
+ "type": "links",
1087
+ "columns": 1,
1088
+ "itemWidth": 161,
1089
+ "links": [
1090
+ {
1091
+ "label": "Hiking",
1092
+ "href": "/cat/mens-hiking-backpacking-boots-shoes"
1093
+ },
1094
+ {
1095
+ "label": "Trail Running",
1096
+ "href": "/cat/mens-trail-running-shoes"
1097
+ },
1098
+ {
1099
+ "label": "Road Running",
1100
+ "href": "/cat/mens-road-running-shoes"
1101
+ },
1102
+ {
1103
+ "label": "Approach",
1104
+ "href": "/rc/approach-shoes?p=u_categoryPathId:bc-mens-footwear"
1105
+ },
1106
+ {
1107
+ "label": "Casual Shoes",
1108
+ "href": "/rc/mens-casual-shoes"
1109
+ },
1110
+ {
1111
+ "label": "Casual Boots",
1112
+ "href": "/cat/mens-casual-boots-shoes"
1113
+ },
1114
+ {
1115
+ "label": "Winter Boots",
1116
+ "href": "/cat/mens-winter-boots-shoes"
1117
+ },
1118
+ {
1119
+ "label": "Slippers",
1120
+ "href": "/cat/mens-slippers"
1121
+ },
1122
+ {
1123
+ "label": "Sandals",
1124
+ "href": "/cat/mens-sandals"
1125
+ },
1126
+ {
1127
+ "label": "Bike",
1128
+ "href": "/cat/bike-footwear?p=gender_uFilter:\"unisex\"|gender_uFilter:\"male\""
1129
+ },
1130
+ {
1131
+ "label": "Climb",
1132
+ "href": "/cat/climbing-shoes?p=gender_uFilter:\"unisex\"|gender_uFilter:\"male\""
1133
+ },
1134
+ {
1135
+ "label": "Water",
1136
+ "href": "/cat/mens-water-shoes"
1137
+ },
1138
+ {
1139
+ "label": "Rain",
1140
+ "href": "/cat/mens-rain-boots-shoes"
1141
+ },
1142
+ {
1143
+ "label": "Shop All",
1144
+ "href": "/cat/mens-footwear"
1145
+ }
1146
+ ]
1147
+ }
1148
+ ],
1149
+ "width": 178
1150
+ },
1151
+ {
1152
+ "kind": "links",
1153
+ "blocks": [
1154
+ {
1155
+ "type": "heading",
1156
+ "label": "Women's",
1157
+ "href": "/cat/womens-footwear",
1158
+ "id": "flyout-section-women-s"
1159
+ },
1160
+ {
1161
+ "type": "links",
1162
+ "columns": 1,
1163
+ "itemWidth": 161,
1164
+ "links": [
1165
+ {
1166
+ "label": "Hiking",
1167
+ "href": "/cat/womens-hiking-backpacking-boots-shoes"
1168
+ },
1169
+ {
1170
+ "label": "Trail Running",
1171
+ "href": "/cat/womens-trail-running-shoes"
1172
+ },
1173
+ {
1174
+ "label": "Road Running",
1175
+ "href": "/cat/womens-road-running-shoes"
1176
+ },
1177
+ {
1178
+ "label": "Approach",
1179
+ "href": "/rc/approach-shoes?p=u_categoryPathId:bc-womens-footwear"
1180
+ },
1181
+ {
1182
+ "label": "Casual Shoes",
1183
+ "href": "/rc/womens-casual-shoes"
1184
+ },
1185
+ {
1186
+ "label": "Casual Boots",
1187
+ "href": "/cat/womens-casual-boots"
1188
+ },
1189
+ {
1190
+ "label": "Winter Boots",
1191
+ "href": "/cat/womens-winter-boots-shoes"
1192
+ },
1193
+ {
1194
+ "label": "Slippers",
1195
+ "href": "/cat/womens-slippers"
1196
+ },
1197
+ {
1198
+ "label": "Sandals",
1199
+ "href": "/cat/womens-sandals"
1200
+ },
1201
+ {
1202
+ "label": "Bike",
1203
+ "href": "/cat/bike-footwear?p=gender_uFilter:\"unisex\"|gender_uFilter:\"female\""
1204
+ },
1205
+ {
1206
+ "label": "Climb",
1207
+ "href": "/cat/climbing-shoes?p=gender_uFilter:\"unisex\"|gender_uFilter:\"female\""
1208
+ },
1209
+ {
1210
+ "label": "Water",
1211
+ "href": "/cat/womens-water-shoes"
1212
+ },
1213
+ {
1214
+ "label": "Rain",
1215
+ "href": "/cat/womens-rain-boots-shoes"
1216
+ },
1217
+ {
1218
+ "label": "Shop All",
1219
+ "href": "/cat/womens-footwear"
1220
+ }
1221
+ ]
1222
+ }
1223
+ ],
1224
+ "width": 178
1225
+ },
1226
+ {
1227
+ "kind": "links",
1228
+ "blocks": [
1229
+ {
1230
+ "type": "heading",
1231
+ "label": "Kids'",
1232
+ "href": "/cat/kids-footwear",
1233
+ "id": "flyout-section-kids"
1234
+ },
1235
+ {
1236
+ "type": "links",
1237
+ "columns": 1,
1238
+ "itemWidth": 161,
1239
+ "links": [
1240
+ {
1241
+ "label": "Boys",
1242
+ "href": "/cat/boys-footwear"
1243
+ },
1244
+ {
1245
+ "label": "Girls",
1246
+ "href": "/cat/girls-footwear"
1247
+ },
1248
+ {
1249
+ "label": "Toddler Boys",
1250
+ "href": "/cat/toddler-boys-footwear"
1251
+ },
1252
+ {
1253
+ "label": "Toddler Girls",
1254
+ "href": "/cat/toddler-girls-footwear"
1255
+ },
1256
+ {
1257
+ "label": "Infant",
1258
+ "href": "/cat/infant-footwear"
1259
+ },
1260
+ {
1261
+ "label": "Shop All",
1262
+ "href": "/cat/kids-footwear"
1263
+ }
1264
+ ]
1265
+ }
1266
+ ],
1267
+ "width": 178
1268
+ },
1269
+ {
1270
+ "kind": "links",
1271
+ "blocks": [
1272
+ {
1273
+ "type": "heading",
1274
+ "label": "New Arrivals",
1275
+ "href": "/rc/footwear-new-arrivals",
1276
+ "id": "flyout-section-new-arrivals"
1277
+ },
1278
+ {
1279
+ "type": "heading",
1280
+ "label": "On Sale",
1281
+ "href": "/rc/footwear-on-sale",
1282
+ "id": "flyout-section-on-sale"
1283
+ },
1284
+ {
1285
+ "type": "heading",
1286
+ "label": "HSA/FSA Eligible",
1287
+ "href": "/rc/hsa-fsa-eligible-items?p=u_categoryPathId:bc-running-shoes",
1288
+ "id": "flyout-section-hsa-fsa-eligible"
1289
+ }
1290
+ ],
1291
+ "width": 178
1292
+ }
1293
+ ]
1294
+ },
1295
+ {
1296
+ "key": "camp",
1297
+ "label": "Camp",
1298
+ "href": "/cat/hike-camp",
1299
+ "columns": [
1300
+ {
1301
+ "kind": "promo",
1302
+ "href": "/rc/gearhead-picks-camp",
1303
+ "alt": "",
1304
+ "caption": "Gearhead Picks: Camp | Tents, sleep systems, camp furniture & more",
1305
+ "file": "/static/assets/cms/BC26_0062-Flyout_refresh.jpg",
1306
+ "width": 178
1307
+ },
1308
+ {
1309
+ "kind": "links",
1310
+ "blocks": [
1311
+ {
1312
+ "type": "heading",
1313
+ "label": "Hike",
1314
+ "href": "/cat/hike-camp",
1315
+ "id": "flyout-section-hike"
1316
+ },
1317
+ {
1318
+ "type": "links",
1319
+ "columns": 1,
1320
+ "itemWidth": 161,
1321
+ "links": [
1322
+ {
1323
+ "label": "Hiking Clothing",
1324
+ "href": "/cat/hiking-clothing"
1325
+ },
1326
+ {
1327
+ "label": "Hiking Footwear",
1328
+ "href": "/cat/hiking-footwear"
1329
+ },
1330
+ {
1331
+ "label": "Backpacking Packs",
1332
+ "href": "/cat/backpacking-packs"
1333
+ },
1334
+ {
1335
+ "label": "Technical Daypacks",
1336
+ "href": "/cat/technical-daypacks"
1337
+ },
1338
+ {
1339
+ "label": "Hydration Packs",
1340
+ "href": "/cat/hydration-packs"
1341
+ },
1342
+ {
1343
+ "label": "Kid Carriers",
1344
+ "href": "/cat/kid-carriers"
1345
+ },
1346
+ {
1347
+ "label": "Water Bottles",
1348
+ "href": "/cat/water-bottles"
1349
+ },
1350
+ {
1351
+ "label": "Headlamps",
1352
+ "href": "/cat/headlamps"
1353
+ },
1354
+ {
1355
+ "label": "Navigation",
1356
+ "href": "/cat/navigation"
1357
+ },
1358
+ {
1359
+ "label": "Trekking Poles",
1360
+ "href": "/cat/trekking-poles"
1361
+ },
1362
+ {
1363
+ "label": "Shop All",
1364
+ "href": "/cat/hike-camp"
1365
+ }
1366
+ ]
1367
+ }
1368
+ ],
1369
+ "width": 178
1370
+ },
1371
+ {
1372
+ "kind": "links",
1373
+ "blocks": [
1374
+ {
1375
+ "type": "heading",
1376
+ "label": "Camp",
1377
+ "href": "/cat/hike-camp",
1378
+ "id": "flyout-section-camp"
1379
+ },
1380
+ {
1381
+ "type": "links",
1382
+ "columns": 1,
1383
+ "itemWidth": 161,
1384
+ "links": [
1385
+ {
1386
+ "label": "Tents & Shelters",
1387
+ "href": "/cat/tents-shelters"
1388
+ },
1389
+ {
1390
+ "label": "Sleeping Bags",
1391
+ "href": "/cat/sleeping-bags"
1392
+ },
1393
+ {
1394
+ "label": "Sleeping Pads",
1395
+ "href": "/cat/sleeping-pads"
1396
+ },
1397
+ {
1398
+ "label": "Coolers",
1399
+ "href": "/cat/coolers"
1400
+ },
1401
+ {
1402
+ "label": "Camp Chairs",
1403
+ "href": "/cat/camp-chairs"
1404
+ },
1405
+ {
1406
+ "label": "Camp Tables",
1407
+ "href": "/cat/camp-tables"
1408
+ },
1409
+ {
1410
+ "label": "Stoves & Grills",
1411
+ "href": "/cat/stoves-grills"
1412
+ },
1413
+ {
1414
+ "label": "Drinkware",
1415
+ "href": "/cat/cups-mugs-flasks"
1416
+ },
1417
+ {
1418
+ "label": "Pots & Pans",
1419
+ "href": "/cat/pots-pans"
1420
+ },
1421
+ {
1422
+ "label": "Kitchen",
1423
+ "href": "/cat/camp-kitchen"
1424
+ },
1425
+ {
1426
+ "label": "Lighting",
1427
+ "href": "/cat/lighting"
1428
+ },
1429
+ {
1430
+ "label": "Hammocks",
1431
+ "href": "/cat/hammocks"
1432
+ },
1433
+ {
1434
+ "label": "Pillows",
1435
+ "href": "/cat/camping-pillows"
1436
+ },
1437
+ {
1438
+ "label": "Blankets",
1439
+ "href": "/cat/blankets"
1440
+ },
1441
+ {
1442
+ "label": "Shop All",
1443
+ "href": "/cat/hike-camp"
1444
+ }
1445
+ ]
1446
+ }
1447
+ ],
1448
+ "width": 178
1449
+ },
1450
+ {
1451
+ "kind": "links",
1452
+ "blocks": [
1453
+ {
1454
+ "type": "heading",
1455
+ "label": "Overlanding",
1456
+ "href": "/cat/overlanding",
1457
+ "id": "flyout-section-overlanding"
1458
+ },
1459
+ {
1460
+ "type": "links",
1461
+ "columns": 1,
1462
+ "itemWidth": 161,
1463
+ "links": [
1464
+ {
1465
+ "label": "Roof Racks & Accessories",
1466
+ "href": "/cat/roof-racks-accessories"
1467
+ },
1468
+ {
1469
+ "label": "Rooftop Tents",
1470
+ "href": "/cat/rooftop-tents"
1471
+ },
1472
+ {
1473
+ "label": "Survival",
1474
+ "href": "/cat/survival"
1475
+ },
1476
+ {
1477
+ "label": "First Aid",
1478
+ "href": "/cat/first-aid"
1479
+ },
1480
+ {
1481
+ "label": "Batteries & Solar Power",
1482
+ "href": "/cat/batteries-solar-power"
1483
+ },
1484
+ {
1485
+ "label": "Navigation",
1486
+ "href": "/cat/navigation"
1487
+ },
1488
+ {
1489
+ "label": "Water Storage & Purification",
1490
+ "href": "/cat/water-storage"
1491
+ },
1492
+ {
1493
+ "label": "Tools",
1494
+ "href": "/cat/tools"
1495
+ },
1496
+ {
1497
+ "label": "Storage Solutions",
1498
+ "href": "/cat/storage-solutions"
1499
+ },
1500
+ {
1501
+ "label": "Showers",
1502
+ "href": "/cat/showers"
1503
+ },
1504
+ {
1505
+ "label": "Outhouses",
1506
+ "href": "/cat/outhouses"
1507
+ },
1508
+ {
1509
+ "label": "Off-Road Recovery",
1510
+ "href": "/cat/off-road-recovery"
1511
+ },
1512
+ {
1513
+ "label": "Shop All",
1514
+ "href": "/cat/overlanding"
1515
+ }
1516
+ ]
1517
+ }
1518
+ ],
1519
+ "width": 178
1520
+ },
1521
+ {
1522
+ "kind": "links",
1523
+ "blocks": [
1524
+ {
1525
+ "type": "heading",
1526
+ "label": "New Arrivals",
1527
+ "href": "/rc/hike-camp-new-arrivals",
1528
+ "id": "flyout-section-new-arrivals"
1529
+ },
1530
+ {
1531
+ "type": "heading",
1532
+ "label": "On Sale",
1533
+ "href": "/rc/hike-camp-gear-on-sale",
1534
+ "id": "flyout-section-on-sale"
1535
+ },
1536
+ {
1537
+ "type": "heading",
1538
+ "label": "Ask A Gearhead",
1539
+ "href": "/campaign/backcountry-gearheads",
1540
+ "id": "flyout-section-ask-a-gearhead"
1541
+ }
1542
+ ],
1543
+ "width": 178
1544
+ }
1545
+ ]
1546
+ },
1547
+ {
1548
+ "key": "bike",
1549
+ "label": "Bike",
1550
+ "href": "/cat/bike",
1551
+ "columns": [
1552
+ {
1553
+ "kind": "promo",
1554
+ "href": "/rc/hsa-fsa-eligible-items",
1555
+ "alt": "",
1556
+ "caption": "Pay with your HSA/FSA on qualifying gear",
1557
+ "file": "/static/assets/cms/GEN26_0009-Flyout.jpeg",
1558
+ "width": 136
1559
+ },
1560
+ {
1561
+ "kind": "links",
1562
+ "blocks": [
1563
+ {
1564
+ "type": "heading",
1565
+ "label": "Bikes & Frames",
1566
+ "href": "/cat/bikes-frames",
1567
+ "id": "flyout-section-bikes-frames"
1568
+ },
1569
+ {
1570
+ "type": "links",
1571
+ "columns": 1,
1572
+ "itemWidth": 122,
1573
+ "links": [
1574
+ {
1575
+ "label": "Mountain Bikes",
1576
+ "href": "/cat/mountain-bikes"
1577
+ },
1578
+ {
1579
+ "label": "Road Bikes",
1580
+ "href": "/cat/road-bikes"
1581
+ },
1582
+ {
1583
+ "label": "Gravel & Cyclocross Bikes",
1584
+ "href": "/cat/gravel-cyclocross-bikes"
1585
+ },
1586
+ {
1587
+ "label": "eBikes",
1588
+ "href": "/cat/ebikes"
1589
+ },
1590
+ {
1591
+ "label": "Kids' Bikes",
1592
+ "href": "/cat/kids-bikes"
1593
+ },
1594
+ {
1595
+ "label": "Build A Custom Bike",
1596
+ "href": "/campaign/custom-bike"
1597
+ },
1598
+ {
1599
+ "label": "Shop All",
1600
+ "href": "/cat/bikes-frames"
1601
+ },
1602
+ {
1603
+ "label": "HSA/FSA Eligible",
1604
+ "href": "/rc/hsa-fsa-eligible-items?p=u_categoryPathId:bc-bikes-frames"
1605
+ }
1606
+ ]
1607
+ }
1608
+ ],
1609
+ "width": 139
1610
+ },
1611
+ {
1612
+ "kind": "links",
1613
+ "blocks": [
1614
+ {
1615
+ "type": "heading",
1616
+ "label": "Components",
1617
+ "href": "/cat/bike-components",
1618
+ "id": "flyout-section-components"
1619
+ },
1620
+ {
1621
+ "type": "links",
1622
+ "columns": 1,
1623
+ "itemWidth": 122,
1624
+ "links": [
1625
+ {
1626
+ "label": "Wheels & Tires",
1627
+ "href": "/rc/bike-wheels-tires"
1628
+ },
1629
+ {
1630
+ "label": "Brakes, Drivetrain, Shifters",
1631
+ "href": "/rc/drivetrain-brakes-shifters"
1632
+ },
1633
+ {
1634
+ "label": "Pedals, Handlebars, Grips",
1635
+ "href": "/rc/pedals-handlebars-grips"
1636
+ },
1637
+ {
1638
+ "label": "Saddles, Seatposts, Stems",
1639
+ "href": "/rc/saddles-seatposts-stems"
1640
+ },
1641
+ {
1642
+ "label": "Suspension",
1643
+ "href": "/rc/forks-suspension"
1644
+ },
1645
+ {
1646
+ "label": "Mountain Components",
1647
+ "href": "/cat/mountain-bike-components"
1648
+ },
1649
+ {
1650
+ "label": "Road Components",
1651
+ "href": "/cat/road-components"
1652
+ },
1653
+ {
1654
+ "label": "Triathlon Components",
1655
+ "href": "/cat/triathlon-tt-bike-components"
1656
+ },
1657
+ {
1658
+ "label": "Shop All",
1659
+ "href": "/cat/bike-components"
1660
+ }
1661
+ ]
1662
+ }
1663
+ ],
1664
+ "width": 139
1665
+ },
1666
+ {
1667
+ "kind": "links",
1668
+ "blocks": [
1669
+ {
1670
+ "type": "heading",
1671
+ "label": "Apparel & Accessories",
1672
+ "href": "/cat/bike-apparel-accessories",
1673
+ "id": "flyout-section-apparel-accessories"
1674
+ },
1675
+ {
1676
+ "type": "links",
1677
+ "columns": 1,
1678
+ "itemWidth": 122,
1679
+ "links": [
1680
+ {
1681
+ "label": "Men's Bike Apparel",
1682
+ "href": "/cat/mens-bike-apparel"
1683
+ },
1684
+ {
1685
+ "label": "Women's Bike Apparel",
1686
+ "href": "/cat/womens-bike-apparel"
1687
+ },
1688
+ {
1689
+ "label": "Kids' Bike Apparel",
1690
+ "href": "/cat/kids-bike-apparel"
1691
+ },
1692
+ {
1693
+ "label": "Shop All",
1694
+ "href": "/cat/bike-apparel-accessories"
1695
+ }
1696
+ ]
1697
+ }
1698
+ ],
1699
+ "width": 139
1700
+ },
1701
+ {
1702
+ "kind": "links",
1703
+ "blocks": [
1704
+ {
1705
+ "type": "heading",
1706
+ "label": "Footwear",
1707
+ "href": "/cat/bike-footwear",
1708
+ "id": "flyout-section-footwear"
1709
+ },
1710
+ {
1711
+ "type": "links",
1712
+ "columns": 1,
1713
+ "itemWidth": 122,
1714
+ "links": [
1715
+ {
1716
+ "label": "Mountain Bike Shoes",
1717
+ "href": "/cat/mountain-bike-shoes"
1718
+ },
1719
+ {
1720
+ "label": "Road Bike Shoes",
1721
+ "href": "/cat/road-bike-shoes"
1722
+ },
1723
+ {
1724
+ "label": "Flat Pedal Shoes",
1725
+ "href": "/cat/flat-pedal-shoes"
1726
+ },
1727
+ {
1728
+ "label": "Triathlon Shoes",
1729
+ "href": "/cat/triathlon-shoes"
1730
+ },
1731
+ {
1732
+ "label": "Shop All",
1733
+ "href": "/cat/bike-footwear"
1734
+ }
1735
+ ]
1736
+ }
1737
+ ],
1738
+ "width": 139
1739
+ },
1740
+ {
1741
+ "kind": "links",
1742
+ "blocks": [
1743
+ {
1744
+ "type": "heading",
1745
+ "label": "Helmets & Protection",
1746
+ "href": "/cat/bike-helmets-protection",
1747
+ "id": "flyout-section-helmets-protection"
1748
+ },
1749
+ {
1750
+ "type": "links",
1751
+ "columns": 1,
1752
+ "itemWidth": 122,
1753
+ "links": [
1754
+ {
1755
+ "label": "Mountain Bike Helmets",
1756
+ "href": "/cat/mountain-bike-helmets"
1757
+ },
1758
+ {
1759
+ "label": "Full Face Helmets",
1760
+ "href": "/cat/mountain-bike-full-face-helmets"
1761
+ },
1762
+ {
1763
+ "label": "Road Bike Helmets",
1764
+ "href": "/cat/road-bike-helmets"
1765
+ },
1766
+ {
1767
+ "label": "Commuter Helmets",
1768
+ "href": "/cat/commuter-helmets"
1769
+ },
1770
+ {
1771
+ "label": "Knee & Shin Pads",
1772
+ "href": "/cat/knee-shin-pads"
1773
+ },
1774
+ {
1775
+ "label": "Arm & Elbow Pads",
1776
+ "href": "/cat/arm-elbow-pads"
1777
+ },
1778
+ {
1779
+ "label": "Chest & Spine Protection",
1780
+ "href": "/cat/chest-spine-protection"
1781
+ },
1782
+ {
1783
+ "label": "Shop All",
1784
+ "href": "/cat/bike-helmets-protection"
1785
+ }
1786
+ ]
1787
+ }
1788
+ ],
1789
+ "width": 139
1790
+ },
1791
+ {
1792
+ "kind": "links",
1793
+ "blocks": [
1794
+ {
1795
+ "type": "heading",
1796
+ "label": "Essentials",
1797
+ "href": "/cat/bike-essentials",
1798
+ "id": "flyout-section-essentials"
1799
+ },
1800
+ {
1801
+ "type": "links",
1802
+ "columns": 1,
1803
+ "itemWidth": 122,
1804
+ "links": [
1805
+ {
1806
+ "label": "Bike Maintenance",
1807
+ "href": "/cat/bike-maintenance"
1808
+ },
1809
+ {
1810
+ "label": "Bike Storage & Transportation",
1811
+ "href": "/cat/bike-storage-transportation"
1812
+ },
1813
+ {
1814
+ "label": "Car Racks",
1815
+ "href": "/cat/bike-car-racks"
1816
+ },
1817
+ {
1818
+ "label": "Bike Packs & Bags",
1819
+ "href": "/cat/bike-packs-bags"
1820
+ },
1821
+ {
1822
+ "label": "Trainers & Accessories",
1823
+ "href": "/cat/bike-trainers-accessories"
1824
+ },
1825
+ {
1826
+ "label": "Bike Lighting & Electronics",
1827
+ "href": "/cat/bike-lighting-electronics"
1828
+ },
1829
+ {
1830
+ "label": "Nutrition",
1831
+ "href": "/cat/nutrition"
1832
+ },
1833
+ {
1834
+ "label": "Hydration Packs",
1835
+ "href": "/cat/bike-hydration-packs"
1836
+ },
1837
+ {
1838
+ "label": "Water Bottles & Cages",
1839
+ "href": "/cat/bike-water-bottles-cages"
1840
+ },
1841
+ {
1842
+ "label": "Bike Trailers",
1843
+ "href": "/cat/bike-trailers"
1844
+ },
1845
+ {
1846
+ "label": "Shop All",
1847
+ "href": "/cat/bike-essentials"
1848
+ }
1849
+ ]
1850
+ }
1851
+ ],
1852
+ "width": 139
1853
+ }
1854
+ ]
1855
+ },
1856
+ {
1857
+ "key": "climb",
1858
+ "label": "Climb",
1859
+ "href": "/cat/climb",
1860
+ "columns": [
1861
+ {
1862
+ "kind": "promo",
1863
+ "href": "/rc/gearhead-picks-climb",
1864
+ "alt": "",
1865
+ "caption": "Gearhead Picks: Climb | The latest, hand-picked gear for going up",
1866
+ "file": "/static/assets/cms/BC26_0076-Flyout.jpg",
1867
+ "width": 178
1868
+ },
1869
+ {
1870
+ "kind": "links",
1871
+ "blocks": [
1872
+ {
1873
+ "type": "heading",
1874
+ "label": "Climbing Shoes",
1875
+ "href": "/cat/climbing-shoes",
1876
+ "id": "flyout-section-climbing-shoes"
1877
+ },
1878
+ {
1879
+ "type": "heading",
1880
+ "label": "Mountaineering Boots",
1881
+ "href": "/cat/mountaineering-boots",
1882
+ "id": "flyout-section-mountaineering-boots"
1883
+ },
1884
+ {
1885
+ "type": "heading",
1886
+ "label": "Ropes",
1887
+ "href": "/cat/ropes",
1888
+ "id": "flyout-section-ropes"
1889
+ },
1890
+ {
1891
+ "type": "heading",
1892
+ "label": "Harnesses",
1893
+ "href": "/rc/climbing-harnesses",
1894
+ "id": "flyout-section-harnesses"
1895
+ },
1896
+ {
1897
+ "type": "heading",
1898
+ "label": "Helmets",
1899
+ "href": "/cat/climbing-helmets",
1900
+ "id": "flyout-section-helmets"
1901
+ },
1902
+ {
1903
+ "type": "heading",
1904
+ "label": "Apparel",
1905
+ "href": "/cat/climbing-clothing-accessories",
1906
+ "id": "flyout-section-apparel"
1907
+ }
1908
+ ],
1909
+ "width": 178
1910
+ },
1911
+ {
1912
+ "kind": "links",
1913
+ "blocks": [
1914
+ {
1915
+ "type": "heading",
1916
+ "label": "Hardware & Protection",
1917
+ "href": "/rc/climbing-hardware-protection",
1918
+ "id": "flyout-section-hardware-protection"
1919
+ },
1920
+ {
1921
+ "type": "links",
1922
+ "columns": 1,
1923
+ "itemWidth": 161,
1924
+ "links": [
1925
+ {
1926
+ "label": "Camming Devices",
1927
+ "href": "/cat/camming-devices"
1928
+ },
1929
+ {
1930
+ "label": "Passive Protection, Pitons & Hooks",
1931
+ "href": "/rc/nuts-pitons-hooks"
1932
+ },
1933
+ {
1934
+ "label": "Belay & Rappel Devices",
1935
+ "href": "/cat/belay-rappel-devices"
1936
+ },
1937
+ {
1938
+ "label": "Ascenders, Descenders & Pulleys",
1939
+ "href": "/rc/ascenders-descenders-pulleys"
1940
+ },
1941
+ {
1942
+ "label": "Carabiners & Quickdraws",
1943
+ "href": "/rc/carabiners-quickdraws"
1944
+ },
1945
+ {
1946
+ "label": "Slings, Webbing & Cords",
1947
+ "href": "/rc/slings-webbing-cords"
1948
+ },
1949
+ {
1950
+ "label": "Ice Axes",
1951
+ "href": "/cat/ice-axes"
1952
+ }
1953
+ ]
1954
+ }
1955
+ ],
1956
+ "width": 178
1957
+ },
1958
+ {
1959
+ "kind": "links",
1960
+ "blocks": [
1961
+ {
1962
+ "type": "heading",
1963
+ "label": "Accessories",
1964
+ "href": "/cat/climbing-essentials",
1965
+ "id": "flyout-section-accessories"
1966
+ },
1967
+ {
1968
+ "type": "links",
1969
+ "columns": 1,
1970
+ "itemWidth": 161,
1971
+ "links": [
1972
+ {
1973
+ "label": "Crampons",
1974
+ "href": "/cat/mountaineering-crampons"
1975
+ },
1976
+ {
1977
+ "label": "Daypacks",
1978
+ "href": "/cat/technical-daypacks"
1979
+ },
1980
+ {
1981
+ "label": "Rope Bags",
1982
+ "href": "/cat/rope-bags"
1983
+ },
1984
+ {
1985
+ "label": "Chalk Bags & Buckets",
1986
+ "href": "/cat/chalk-chalk-bags-chalk-buckets"
1987
+ },
1988
+ {
1989
+ "label": "Crash Pads",
1990
+ "href": "/cat/crash-pads"
1991
+ },
1992
+ {
1993
+ "label": "Brush Kits",
1994
+ "href": "/cat/brush-kits"
1995
+ },
1996
+ {
1997
+ "label": "Training",
1998
+ "href": "/cat/climbing-training"
1999
+ }
2000
+ ]
2001
+ }
2002
+ ],
2003
+ "width": 178
2004
+ },
2005
+ {
2006
+ "kind": "links",
2007
+ "blocks": [
2008
+ {
2009
+ "type": "heading",
2010
+ "label": "Climb Packages",
2011
+ "href": "/rc/climbing-packages",
2012
+ "id": "flyout-section-climb-packages"
2013
+ },
2014
+ {
2015
+ "type": "heading",
2016
+ "label": "On Sale",
2017
+ "href": "/rc/climb-on-sale",
2018
+ "id": "flyout-section-on-sale"
2019
+ },
2020
+ {
2021
+ "type": "heading",
2022
+ "label": "New Arrivals",
2023
+ "href": "/rc/climb-new-arrivals",
2024
+ "id": "flyout-section-new-arrivals"
2025
+ }
2026
+ ],
2027
+ "width": 178
2028
+ }
2029
+ ]
2030
+ },
2031
+ {
2032
+ "key": "travel",
2033
+ "label": "Travel",
2034
+ "href": "/cat/travel",
2035
+ "columns": [
2036
+ {
2037
+ "kind": "promo",
2038
+ "href": "/rc/gearhead-picks-travel",
2039
+ "alt": "",
2040
+ "caption": "Gearhead Picks: Travel | The best bags, luggage & essentials for exploring",
2041
+ "file": "/static/assets/cms/BC26_0063-Flyout.jpeg",
2042
+ "width": 164
2043
+ },
2044
+ {
2045
+ "kind": "links",
2046
+ "blocks": [
2047
+ {
2048
+ "type": "heading",
2049
+ "label": "Travel Bags",
2050
+ "href": "/cat/travel",
2051
+ "id": "flyout-section-travel-bags"
2052
+ },
2053
+ {
2054
+ "type": "links",
2055
+ "columns": 1,
2056
+ "itemWidth": 147,
2057
+ "links": [
2058
+ {
2059
+ "label": "Duffel Bags",
2060
+ "href": "/cat/duffel-bags"
2061
+ },
2062
+ {
2063
+ "label": "Rolling Bags",
2064
+ "href": "/cat/rolling-bags"
2065
+ },
2066
+ {
2067
+ "label": "Carry-On Luggage",
2068
+ "href": "/cat/carry-ons"
2069
+ },
2070
+ {
2071
+ "label": "Travel Packs",
2072
+ "href": "/cat/travel-packs"
2073
+ },
2074
+ {
2075
+ "label": "Organizers",
2076
+ "href": "/cat/organizers"
2077
+ },
2078
+ {
2079
+ "label": "Camera Packs & Bags",
2080
+ "href": "/cat/camera-packs-bags"
2081
+ }
2082
+ ]
2083
+ }
2084
+ ],
2085
+ "width": 164
2086
+ },
2087
+ {
2088
+ "kind": "links",
2089
+ "blocks": [
2090
+ {
2091
+ "type": "heading",
2092
+ "label": "Backpacks",
2093
+ "href": "/cat/packs",
2094
+ "id": "flyout-section-backpacks"
2095
+ },
2096
+ {
2097
+ "type": "links",
2098
+ "columns": 1,
2099
+ "itemWidth": 147,
2100
+ "links": [
2101
+ {
2102
+ "label": "Travel Packs",
2103
+ "href": "/cat/travel-packs"
2104
+ },
2105
+ {
2106
+ "label": "Everyday Packs",
2107
+ "href": "/cat/everyday-packs"
2108
+ },
2109
+ {
2110
+ "label": "Technical Daypacks",
2111
+ "href": "/cat/technical-daypacks"
2112
+ },
2113
+ {
2114
+ "label": "Backpacking Packs",
2115
+ "href": "/cat/backpacking-packs"
2116
+ },
2117
+ {
2118
+ "label": "Hydration Packs",
2119
+ "href": "/cat/hydration-packs"
2120
+ },
2121
+ {
2122
+ "label": "Winter Packs",
2123
+ "href": "/cat/winter-packs"
2124
+ }
2125
+ ]
2126
+ }
2127
+ ],
2128
+ "width": 164
2129
+ },
2130
+ {
2131
+ "kind": "links",
2132
+ "blocks": [
2133
+ {
2134
+ "type": "heading",
2135
+ "label": "Gear Transport",
2136
+ "href": "/cat/gear-transport",
2137
+ "id": "flyout-section-gear-transport"
2138
+ },
2139
+ {
2140
+ "type": "links",
2141
+ "columns": 1,
2142
+ "itemWidth": 147,
2143
+ "links": [
2144
+ {
2145
+ "label": "Bike Racks",
2146
+ "href": "/cat/bike-car-racks"
2147
+ },
2148
+ {
2149
+ "label": "Ski Boot Bags",
2150
+ "href": "/cat/ski-boot-bags"
2151
+ },
2152
+ {
2153
+ "label": "Ski Bags",
2154
+ "href": "/cat/ski-bags"
2155
+ },
2156
+ {
2157
+ "label": "Snowboard Boot Bags",
2158
+ "href": "/cat/snowboard-boot-bags"
2159
+ },
2160
+ {
2161
+ "label": "Snowboard Bags",
2162
+ "href": "/cat/snowboard-bags"
2163
+ },
2164
+ {
2165
+ "label": "Fly Fishing Bags & Luggage",
2166
+ "href": "/cat/fly-fishing-bags-luggage"
2167
+ },
2168
+ {
2169
+ "label": "Bike Travel Cases",
2170
+ "href": "/cat/bike-travel-cases"
2171
+ },
2172
+ {
2173
+ "label": "Surfboard Bags & Packs",
2174
+ "href": "/cat/surfboard-bags-packs"
2175
+ }
2176
+ ]
2177
+ }
2178
+ ],
2179
+ "width": 164
2180
+ },
2181
+ {
2182
+ "kind": "links",
2183
+ "blocks": [
2184
+ {
2185
+ "type": "heading",
2186
+ "label": "Essentials",
2187
+ "href": "/cat/travel-essentials",
2188
+ "id": "flyout-section-essentials"
2189
+ },
2190
+ {
2191
+ "type": "links",
2192
+ "columns": 1,
2193
+ "itemWidth": 147,
2194
+ "links": [
2195
+ {
2196
+ "label": "Sunglasses",
2197
+ "href": "/cat/sunglasses"
2198
+ },
2199
+ {
2200
+ "label": "Water Bottles",
2201
+ "href": "/cat/water-bottles"
2202
+ },
2203
+ {
2204
+ "label": "Blankets",
2205
+ "href": "/cat/blankets"
2206
+ },
2207
+ {
2208
+ "label": "Wallets",
2209
+ "href": "/cat/wallets"
2210
+ },
2211
+ {
2212
+ "label": "Water Filters & Purification",
2213
+ "href": "/cat/water-filters-purification"
2214
+ },
2215
+ {
2216
+ "label": "Travel Pillows",
2217
+ "href": "/cat/camping-pillows"
2218
+ },
2219
+ {
2220
+ "label": "Power Converters",
2221
+ "href": "/cat/power-converters"
2222
+ },
2223
+ {
2224
+ "label": "",
2225
+ "href": null
2226
+ },
2227
+ {
2228
+ "label": "Audio",
2229
+ "href": "/cat/audio"
2230
+ }
2231
+ ]
2232
+ }
2233
+ ],
2234
+ "width": 164
2235
+ },
2236
+ {
2237
+ "kind": "links",
2238
+ "blocks": [
2239
+ {
2240
+ "type": "heading",
2241
+ "label": "New Arrivals",
2242
+ "href": "/rc/travel-new-arrivals",
2243
+ "id": "flyout-section-new-arrivals"
2244
+ },
2245
+ {
2246
+ "type": "heading",
2247
+ "label": "On Sale",
2248
+ "href": "/rc/travel-on-sale",
2249
+ "id": "flyout-section-on-sale"
2250
+ },
2251
+ {
2252
+ "type": "heading",
2253
+ "label": "Ask A Gearhead",
2254
+ "href": "/campaign/backcountry-gearheads",
2255
+ "id": "flyout-section-ask-a-gearhead"
2256
+ }
2257
+ ],
2258
+ "width": 164
2259
+ }
2260
+ ]
2261
+ },
2262
+ {
2263
+ "key": "ski",
2264
+ "label": "Ski",
2265
+ "href": "/cat/ski",
2266
+ "columns": [
2267
+ {
2268
+ "kind": "links",
2269
+ "blocks": [
2270
+ {
2271
+ "type": "links",
2272
+ "columns": 1,
2273
+ "itemWidth": 161,
2274
+ "links": [
2275
+ {
2276
+ "label": "All Skis",
2277
+ "href": "/rc/skis"
2278
+ },
2279
+ {
2280
+ "label": "Alpine Skis",
2281
+ "href": "/cat/alpine-skis"
2282
+ },
2283
+ {
2284
+ "label": "Ski Packages",
2285
+ "href": "/rc/ski-packages"
2286
+ },
2287
+ {
2288
+ "label": "Alpine Touring Skis",
2289
+ "href": "/cat/alpine-touring-skis"
2290
+ },
2291
+ {
2292
+ "label": "Kids' Skis",
2293
+ "href": "/cat/kids-alpine-skis"
2294
+ },
2295
+ {
2296
+ "label": "Cross-Country Skis",
2297
+ "href": "/cat/cross-country-skis"
2298
+ },
2299
+ {
2300
+ "label": "Alpine Bindings",
2301
+ "href": "/cat/alpine-ski-bindings-brakes"
2302
+ },
2303
+ {
2304
+ "label": "Touring Bindings",
2305
+ "href": "/cat/alpine-touring-bindings"
2306
+ },
2307
+ {
2308
+ "label": "Cross-Country Bindings",
2309
+ "href": "/cat/cross-country-bindings"
2310
+ }
2311
+ ]
2312
+ }
2313
+ ],
2314
+ "width": 178
2315
+ },
2316
+ {
2317
+ "kind": "links",
2318
+ "blocks": [
2319
+ {
2320
+ "type": "links",
2321
+ "columns": 1,
2322
+ "itemWidth": 161,
2323
+ "links": [
2324
+ {
2325
+ "label": "All Boots",
2326
+ "href": "/rc/ski-boots"
2327
+ },
2328
+ {
2329
+ "label": "Alpine Boots",
2330
+ "href": "/cat/alpine-ski-boots"
2331
+ },
2332
+ {
2333
+ "label": "Touring Boots",
2334
+ "href": "/cat/alpine-touring-boots"
2335
+ },
2336
+ {
2337
+ "label": "Cross-Country Boots",
2338
+ "href": "/cat/cross-country-boots"
2339
+ },
2340
+ {
2341
+ "label": "Kids' Boots",
2342
+ "href": "/cat/kids-ski-boots"
2343
+ }
2344
+ ]
2345
+ },
2346
+ {
2347
+ "type": "links",
2348
+ "columns": 1,
2349
+ "itemWidth": 161,
2350
+ "links": [
2351
+ {
2352
+ "label": "Poles",
2353
+ "href": "/cat/ski-poles"
2354
+ },
2355
+ {
2356
+ "label": "Adjustable Poles",
2357
+ "href": "/cat/adjustable-poles"
2358
+ },
2359
+ {
2360
+ "label": "Cross-Country Poles",
2361
+ "href": "/cat/cross-country-ski-poles"
2362
+ },
2363
+ {
2364
+ "label": "Kids' Poles",
2365
+ "href": "/cat/kids-ski-poles"
2366
+ }
2367
+ ]
2368
+ },
2369
+ {
2370
+ "type": "links",
2371
+ "columns": 1,
2372
+ "itemWidth": 161,
2373
+ "links": [
2374
+ {
2375
+ "label": "Helmets",
2376
+ "href": "/cat/ski-helmets"
2377
+ },
2378
+ {
2379
+ "label": "Goggles",
2380
+ "href": "/cat/goggles"
2381
+ }
2382
+ ]
2383
+ }
2384
+ ],
2385
+ "width": 178
2386
+ },
2387
+ {
2388
+ "kind": "links",
2389
+ "blocks": [
2390
+ {
2391
+ "type": "links",
2392
+ "columns": 1,
2393
+ "itemWidth": 161,
2394
+ "links": [
2395
+ {
2396
+ "label": "Alpine Touring Skis",
2397
+ "href": "/cat/alpine-touring-skis"
2398
+ },
2399
+ {
2400
+ "label": "Alpine Touring Boots",
2401
+ "href": "/cat/alpine-touring-boots"
2402
+ },
2403
+ {
2404
+ "label": "Alpine Touring Bindings",
2405
+ "href": "/cat/alpine-touring-bindings"
2406
+ },
2407
+ {
2408
+ "label": "Avalanche Safety",
2409
+ "href": "/cat/avalanche-safety"
2410
+ },
2411
+ {
2412
+ "label": "Airbag Packs",
2413
+ "href": "/cat/airbag-packs-accessories"
2414
+ },
2415
+ {
2416
+ "label": "Backpacks",
2417
+ "href": "/cat/winter-packs"
2418
+ },
2419
+ {
2420
+ "label": "Skins",
2421
+ "href": "/cat/climbing-skins"
2422
+ },
2423
+ {
2424
+ "label": "Poles",
2425
+ "href": "/cat/adjustable-poles"
2426
+ }
2427
+ ]
2428
+ }
2429
+ ],
2430
+ "width": 178
2431
+ },
2432
+ {
2433
+ "kind": "links",
2434
+ "blocks": [
2435
+ {
2436
+ "type": "links",
2437
+ "columns": 1,
2438
+ "itemWidth": 161,
2439
+ "links": [
2440
+ {
2441
+ "label": "Ski Bags",
2442
+ "href": "/cat/ski-bags"
2443
+ },
2444
+ {
2445
+ "label": "Boot Bags",
2446
+ "href": "/cat/ski-boot-bags"
2447
+ },
2448
+ {
2449
+ "label": "Backpacks",
2450
+ "href": "/cat/winter-packs"
2451
+ },
2452
+ {
2453
+ "label": "Car Racks & Boxes",
2454
+ "href": "/cat/ski-snowboard-racks"
2455
+ },
2456
+ {
2457
+ "label": "Tuning Accessories",
2458
+ "href": "/cat/tuning-accessories"
2459
+ },
2460
+ {
2461
+ "label": "Boot Dryers & Heaters",
2462
+ "href": "/cat/boot-dryers-heaters"
2463
+ },
2464
+ {
2465
+ "label": "Snowshoes",
2466
+ "href": "/cat/snowshoe"
2467
+ }
2468
+ ]
2469
+ }
2470
+ ],
2471
+ "width": 178
2472
+ },
2473
+ {
2474
+ "kind": "links",
2475
+ "blocks": [
2476
+ {
2477
+ "type": "links",
2478
+ "columns": 1,
2479
+ "itemWidth": 161,
2480
+ "links": [
2481
+ {
2482
+ "label": "Ski Jackets",
2483
+ "href": "/cat/mens-ski-jackets"
2484
+ },
2485
+ {
2486
+ "label": "Ski Pants & Bibs",
2487
+ "href": "/cat/mens-ski-pants-bibs"
2488
+ },
2489
+ {
2490
+ "label": "Midlayers",
2491
+ "href": "/rc/mens-midlayers"
2492
+ },
2493
+ {
2494
+ "label": "Baselayers",
2495
+ "href": "/cat/mens-baselayers"
2496
+ },
2497
+ {
2498
+ "label": "Ski Socks",
2499
+ "href": "/cat/mens-ski-socks"
2500
+ },
2501
+ {
2502
+ "label": "Hats, Gloves & Mittens",
2503
+ "href": "/rc/mens-ski-accessories"
2504
+ }
2505
+ ]
2506
+ },
2507
+ {
2508
+ "type": "links",
2509
+ "columns": 1,
2510
+ "itemWidth": 161,
2511
+ "links": [
2512
+ {
2513
+ "label": "Ski Jackets",
2514
+ "href": "/cat/womens-ski-jackets"
2515
+ },
2516
+ {
2517
+ "label": "Ski Pants & Bibs",
2518
+ "href": "/cat/womens-ski-pants-bibs"
2519
+ },
2520
+ {
2521
+ "label": "Midlayers",
2522
+ "href": "/rc/womens-midlayers"
2523
+ },
2524
+ {
2525
+ "label": "Baselayers",
2526
+ "href": "/cat/womens-baselayers"
2527
+ },
2528
+ {
2529
+ "label": "Ski Socks",
2530
+ "href": "/cat/womens-ski-socks"
2531
+ },
2532
+ {
2533
+ "label": "Hats, Gloves & Mittens",
2534
+ "href": "/rc/womens-ski-accessories"
2535
+ }
2536
+ ]
2537
+ },
2538
+ {
2539
+ "type": "links",
2540
+ "columns": 1,
2541
+ "itemWidth": 161,
2542
+ "links": [
2543
+ {
2544
+ "label": "Kids'",
2545
+ "href": "/rc/kids-snow-outerwear?p=attrAge_uFilter:\"youth\""
2546
+ },
2547
+ {
2548
+ "label": "Toddlers'",
2549
+ "href": "/rc/kids-snow-outerwear?p=attrAge_uFilter:\"toddlers\""
2550
+ }
2551
+ ]
2552
+ }
2553
+ ],
2554
+ "width": 178
2555
+ }
2556
+ ]
2557
+ },
2558
+ {
2559
+ "key": "snowboard",
2560
+ "label": "Snowboard",
2561
+ "href": "/cat/snowboard",
2562
+ "columns": [
2563
+ {
2564
+ "kind": "links",
2565
+ "blocks": [
2566
+ {
2567
+ "type": "links",
2568
+ "columns": 1,
2569
+ "itemWidth": 161,
2570
+ "links": [
2571
+ {
2572
+ "label": "Snowboards",
2573
+ "href": "/cat/snowboards"
2574
+ },
2575
+ {
2576
+ "label": "Snowboard Packages",
2577
+ "href": "/rc/snowboard-packages"
2578
+ },
2579
+ {
2580
+ "label": "Splitboards",
2581
+ "href": "/cat/splitboards"
2582
+ },
2583
+ {
2584
+ "label": "Kids' Snowboards",
2585
+ "href": "/cat/kids-snowboards"
2586
+ },
2587
+ {
2588
+ "label": "Snowboard Bindings",
2589
+ "href": "/cat/snowboard-bindings"
2590
+ },
2591
+ {
2592
+ "label": "Splitboard Bindings",
2593
+ "href": "/cat/splitboard-bindings"
2594
+ },
2595
+ {
2596
+ "label": "Kids' Bindings",
2597
+ "href": "/cat/kids-snowboard-bindings"
2598
+ }
2599
+ ]
2600
+ }
2601
+ ],
2602
+ "width": 178
2603
+ },
2604
+ {
2605
+ "kind": "links",
2606
+ "blocks": [
2607
+ {
2608
+ "type": "links",
2609
+ "columns": 1,
2610
+ "itemWidth": 161,
2611
+ "links": [
2612
+ {
2613
+ "label": "Snowboard Boots",
2614
+ "href": "/cat/snowboard-boots"
2615
+ },
2616
+ {
2617
+ "label": "Splitboard Boots",
2618
+ "href": "/cat/splitboard-boots"
2619
+ },
2620
+ {
2621
+ "label": "Kids' Boots",
2622
+ "href": "/cat/kids-snowboard-boots"
2623
+ }
2624
+ ]
2625
+ },
2626
+ {
2627
+ "type": "links",
2628
+ "columns": 1,
2629
+ "itemWidth": 161,
2630
+ "links": [
2631
+ {
2632
+ "label": "Helmets",
2633
+ "href": "/cat/snowboard-helmets"
2634
+ },
2635
+ {
2636
+ "label": "Goggles",
2637
+ "href": "/cat/goggles"
2638
+ }
2639
+ ]
2640
+ }
2641
+ ],
2642
+ "width": 178
2643
+ },
2644
+ {
2645
+ "kind": "links",
2646
+ "blocks": [
2647
+ {
2648
+ "type": "links",
2649
+ "columns": 1,
2650
+ "itemWidth": 161,
2651
+ "links": [
2652
+ {
2653
+ "label": "Splitboards",
2654
+ "href": "/cat/splitboards"
2655
+ },
2656
+ {
2657
+ "label": "Splitboard Boots",
2658
+ "href": "/cat/splitboard-boots"
2659
+ },
2660
+ {
2661
+ "label": "Splitboard Bindings",
2662
+ "href": "/cat/splitboard-bindings"
2663
+ },
2664
+ {
2665
+ "label": "Avalanche Safety",
2666
+ "href": "/cat/avalanche-safety"
2667
+ },
2668
+ {
2669
+ "label": "Airbag Packs",
2670
+ "href": "/cat/airbag-packs-accessories"
2671
+ },
2672
+ {
2673
+ "label": "Backpacks",
2674
+ "href": "/cat/winter-packs"
2675
+ },
2676
+ {
2677
+ "label": "Skins",
2678
+ "href": "/cat/splitboard-skins"
2679
+ },
2680
+ {
2681
+ "label": "Poles",
2682
+ "href": "/cat/adjustable-poles"
2683
+ }
2684
+ ]
2685
+ }
2686
+ ],
2687
+ "width": 178
2688
+ },
2689
+ {
2690
+ "kind": "links",
2691
+ "blocks": [
2692
+ {
2693
+ "type": "links",
2694
+ "columns": 1,
2695
+ "itemWidth": 161,
2696
+ "links": [
2697
+ {
2698
+ "label": "Snowboard Bags",
2699
+ "href": "/cat/snowboard-bags"
2700
+ },
2701
+ {
2702
+ "label": "Boot Bags",
2703
+ "href": "/cat/snowboard-boot-bags"
2704
+ },
2705
+ {
2706
+ "label": "Backpacks",
2707
+ "href": "/cat/winter-packs"
2708
+ },
2709
+ {
2710
+ "label": "Car Racks & Boxes",
2711
+ "href": "/cat/ski-snowboard-racks"
2712
+ },
2713
+ {
2714
+ "label": "Tuning Accessories",
2715
+ "href": "/cat/tuning-accessories"
2716
+ },
2717
+ {
2718
+ "label": "Snowshoes",
2719
+ "href": "/cat/snowshoe"
2720
+ },
2721
+ {
2722
+ "label": "Boot Dryers & Heaters",
2723
+ "href": "/cat/boot-dryers-heaters"
2724
+ },
2725
+ {
2726
+ "label": "Traction Pads",
2727
+ "href": "/cat/snowboard-traction"
2728
+ }
2729
+ ]
2730
+ }
2731
+ ],
2732
+ "width": 178
2733
+ },
2734
+ {
2735
+ "kind": "links",
2736
+ "blocks": [
2737
+ {
2738
+ "type": "links",
2739
+ "columns": 1,
2740
+ "itemWidth": 161,
2741
+ "links": [
2742
+ {
2743
+ "label": "Snowboard Jackets",
2744
+ "href": "/cat/mens-snowboard-jackets"
2745
+ },
2746
+ {
2747
+ "label": "Snowboard Pants & Bibs",
2748
+ "href": "/cat/mens-snowboard-pants-bibs"
2749
+ },
2750
+ {
2751
+ "label": "Midlayers",
2752
+ "href": "/rc/mens-midlayers"
2753
+ },
2754
+ {
2755
+ "label": "Baselayers",
2756
+ "href": "/cat/mens-baselayers"
2757
+ },
2758
+ {
2759
+ "label": "Snowboard Socks",
2760
+ "href": "/cat/mens-snowboard-socks"
2761
+ },
2762
+ {
2763
+ "label": "Hats, Gloves & Mittens",
2764
+ "href": "/rc/mens-ski-accessories"
2765
+ }
2766
+ ]
2767
+ },
2768
+ {
2769
+ "type": "links",
2770
+ "columns": 1,
2771
+ "itemWidth": 161,
2772
+ "links": [
2773
+ {
2774
+ "label": "Snowboard Jackets",
2775
+ "href": "/cat/womens-snowboard-jackets"
2776
+ },
2777
+ {
2778
+ "label": "Snowboard Pants & Bibs",
2779
+ "href": "/cat/womens-snowboard-pants-bibs"
2780
+ },
2781
+ {
2782
+ "label": "Midlayers",
2783
+ "href": "/rc/womens-midlayers"
2784
+ },
2785
+ {
2786
+ "label": "Baselayers",
2787
+ "href": "/cat/womens-baselayers"
2788
+ },
2789
+ {
2790
+ "label": "Snowboard Socks",
2791
+ "href": "/cat/womens-snowboard-socks"
2792
+ },
2793
+ {
2794
+ "label": "Hats, Gloves & Mittens",
2795
+ "href": "/rc/womens-ski-accessories"
2796
+ }
2797
+ ]
2798
+ },
2799
+ {
2800
+ "type": "links",
2801
+ "columns": 1,
2802
+ "itemWidth": 161,
2803
+ "links": [
2804
+ {
2805
+ "label": "Kids'",
2806
+ "href": "/rc/kids-snow-outerwear?p=attrAge_uFilter:\"youth\""
2807
+ },
2808
+ {
2809
+ "label": "Toddlers'",
2810
+ "href": "/rc/kids-snow-outerwear?p=attrAge_uFilter:\"toddlers\""
2811
+ }
2812
+ ]
2813
+ }
2814
+ ],
2815
+ "width": 178
2816
+ }
2817
+ ]
2818
+ },
2819
+ {
2820
+ "key": "activities",
2821
+ "label": "Activities",
2822
+ "href": "/rc/gear-new-arrivals",
2823
+ "columns": [
2824
+ {
2825
+ "kind": "links",
2826
+ "blocks": [
2827
+ {
2828
+ "type": "heading",
2829
+ "label": "New Arrivals",
2830
+ "href": "/rc/gear-new-arrivals",
2831
+ "id": "flyout-section-new-arrivals"
2832
+ },
2833
+ {
2834
+ "type": "heading",
2835
+ "label": "Ski",
2836
+ "href": "/cat/ski",
2837
+ "id": "flyout-section-ski"
2838
+ },
2839
+ {
2840
+ "type": "heading",
2841
+ "label": "Snowboard",
2842
+ "href": "/cat/snowboard",
2843
+ "id": "flyout-section-snowboard"
2844
+ },
2845
+ {
2846
+ "type": "heading",
2847
+ "label": "Bike",
2848
+ "href": "/cat/bike",
2849
+ "id": "flyout-section-bike"
2850
+ },
2851
+ {
2852
+ "type": "heading",
2853
+ "label": "Hike & Camp",
2854
+ "href": "/cat/hike-camp",
2855
+ "id": "flyout-section-hike-camp"
2856
+ },
2857
+ {
2858
+ "type": "heading",
2859
+ "label": "Overlanding",
2860
+ "href": "/cat/overlanding",
2861
+ "id": "flyout-section-overlanding"
2862
+ },
2863
+ {
2864
+ "type": "heading",
2865
+ "label": "Climb",
2866
+ "href": "/cat/climb",
2867
+ "id": "flyout-section-climb"
2868
+ },
2869
+ {
2870
+ "type": "heading",
2871
+ "label": "Travel",
2872
+ "href": "/cat/travel",
2873
+ "id": "flyout-section-travel"
2874
+ },
2875
+ {
2876
+ "type": "heading",
2877
+ "label": "Fishing",
2878
+ "href": "/cat/fishing",
2879
+ "id": "flyout-section-fishing"
2880
+ }
2881
+ ],
2882
+ "width": 178
2883
+ },
2884
+ {
2885
+ "kind": "links",
2886
+ "blocks": [
2887
+ {
2888
+ "type": "heading",
2889
+ "label": "Snowshoe",
2890
+ "href": "/cat/snowshoe",
2891
+ "id": "flyout-section-snowshoe"
2892
+ },
2893
+ {
2894
+ "type": "heading",
2895
+ "label": "Run",
2896
+ "href": "/cat/run",
2897
+ "id": "flyout-section-run"
2898
+ },
2899
+ {
2900
+ "type": "heading",
2901
+ "label": "Paddle",
2902
+ "href": "/cat/paddle",
2903
+ "id": "flyout-section-paddle"
2904
+ },
2905
+ {
2906
+ "type": "heading",
2907
+ "label": "Surf",
2908
+ "href": "/cat/surf",
2909
+ "id": "flyout-section-surf"
2910
+ },
2911
+ {
2912
+ "type": "heading",
2913
+ "label": "Dog Gear",
2914
+ "href": "/cat/dog-packs-accessories",
2915
+ "id": "flyout-section-dog-gear"
2916
+ },
2917
+ {
2918
+ "type": "heading",
2919
+ "label": "Training",
2920
+ "href": "/cat/training",
2921
+ "id": "flyout-section-training"
2922
+ },
2923
+ {
2924
+ "type": "heading",
2925
+ "label": "Yoga",
2926
+ "href": "/cat/yoga",
2927
+ "id": "flyout-section-yoga"
2928
+ },
2929
+ {
2930
+ "type": "heading",
2931
+ "label": "Wake",
2932
+ "href": "/cat/wake",
2933
+ "id": "flyout-section-wake"
2934
+ },
2935
+ {
2936
+ "type": "heading",
2937
+ "label": "HSA/FSA Eligible",
2938
+ "href": "/rc/hsa-fsa-eligible-items",
2939
+ "id": "flyout-section-hsa-fsa-eligible"
2940
+ }
2941
+ ],
2942
+ "width": 178
2943
+ },
2944
+ {
2945
+ "kind": "promo",
2946
+ "href": "/cat/bike",
2947
+ "alt": "",
2948
+ "caption": "Bike",
2949
+ "file": "/static/assets/cms/PC020-Flyout_bike.jpg",
2950
+ "width": 178
2951
+ },
2952
+ {
2953
+ "kind": "promo",
2954
+ "href": "/cat/hike-camp",
2955
+ "alt": "",
2956
+ "caption": "Hike & Camp",
2957
+ "file": "/static/assets/cms/PC020-Flyout_hikecamp.jpg",
2958
+ "width": 178
2959
+ },
2960
+ {
2961
+ "kind": "promo",
2962
+ "href": "/cat/travel",
2963
+ "alt": "",
2964
+ "caption": "Travel",
2965
+ "file": "/static/assets/cms/PC020-Flyout_travel.jpg",
2966
+ "width": 178
2967
+ }
2968
+ ]
2969
+ },
2970
+ {
2971
+ "key": "brands",
2972
+ "label": "Brands",
2973
+ "href": "/brand/backcountry",
2974
+ "columns": [
2975
+ {
2976
+ "kind": "promo",
2977
+ "href": "/brand/backcountry",
2978
+ "alt": "",
2979
+ "caption": "In-house spring collections made by our Gearhead Experts",
2980
+ "file": "/static/assets/cms/BC26_0061-Flyout.png",
2981
+ "width": 140
2982
+ },
2983
+ {
2984
+ "kind": "promo",
2985
+ "href": "/rc/new-brands",
2986
+ "alt": "",
2987
+ "caption": "Newly added brands: Norda, Pruzan, Sisstr, Royal Robbins & more",
2988
+ "file": "/static/assets/cms/New-Brands-Flyout-Flyout.jpg",
2989
+ "width": 140
2990
+ },
2991
+ {
2992
+ "kind": "links",
2993
+ "blocks": [
2994
+ {
2995
+ "type": "heading",
2996
+ "label": "New Exclusives",
2997
+ "href": "/rc/exclusive-brands-new-arrivals",
2998
+ "id": "flyout-section-new-exclusives"
2999
+ },
3000
+ {
3001
+ "type": "heading",
3002
+ "label": "Sale Exclusives",
3003
+ "href": "/rc/exclusive-brands-on-sale?rp=onsaleUS%3Atrue",
3004
+ "id": "flyout-section-sale-exclusives"
3005
+ },
3006
+ {
3007
+ "type": "heading",
3008
+ "label": "Built By Us",
3009
+ "href": "/rc/built-by-us",
3010
+ "id": "flyout-section-built-by-us"
3011
+ },
3012
+ {
3013
+ "type": "links",
3014
+ "columns": 1,
3015
+ "itemWidth": 126,
3016
+ "links": [
3017
+ {
3018
+ "label": "Backcountry",
3019
+ "href": "/brand/backcountry"
3020
+ },
3021
+ {
3022
+ "label": "Coalatree",
3023
+ "href": "/brand/coalatree"
3024
+ },
3025
+ {
3026
+ "label": "Stoic",
3027
+ "href": "/brand/stoic"
3028
+ }
3029
+ ]
3030
+ }
3031
+ ],
3032
+ "width": 143
3033
+ },
3034
+ {
3035
+ "kind": "links",
3036
+ "blocks": [
3037
+ {
3038
+ "type": "heading",
3039
+ "label": "Brands",
3040
+ "href": "/shop-all-brands",
3041
+ "id": "flyout-section-brands"
3042
+ },
3043
+ {
3044
+ "type": "links",
3045
+ "columns": 2,
3046
+ "itemWidth": 128,
3047
+ "links": [
3048
+ {
3049
+ "label": "Patagonia",
3050
+ "href": "/brand/patagonia"
3051
+ },
3052
+ {
3053
+ "label": "The North Face",
3054
+ "href": "/brand/the-north-face"
3055
+ },
3056
+ {
3057
+ "label": "Burton",
3058
+ "href": "/brand/burton"
3059
+ },
3060
+ {
3061
+ "label": "Smartwool",
3062
+ "href": "/brand/smartwool"
3063
+ },
3064
+ {
3065
+ "label": "Helly Hansen",
3066
+ "href": "/brand/helly-hansen"
3067
+ },
3068
+ {
3069
+ "label": "Columbia",
3070
+ "href": "/brand/columbia"
3071
+ },
3072
+ {
3073
+ "label": "Outdoor Research",
3074
+ "href": "/brand/outdoor-research"
3075
+ },
3076
+ {
3077
+ "label": "Salomon",
3078
+ "href": "/brand/salomon"
3079
+ },
3080
+ {
3081
+ "label": "Black Diamond",
3082
+ "href": "/brand/black-diamond"
3083
+ },
3084
+ {
3085
+ "label": "Mountain Hardwear",
3086
+ "href": "/brand/mountain-hardwear"
3087
+ },
3088
+ {
3089
+ "label": "Sorel",
3090
+ "href": "/brand/sorel"
3091
+ },
3092
+ {
3093
+ "label": "Smith",
3094
+ "href": "/brand/smith"
3095
+ },
3096
+ {
3097
+ "label": "Flylow",
3098
+ "href": "/brand/flylow"
3099
+ },
3100
+ {
3101
+ "label": "Hestra",
3102
+ "href": "/brand/hestra"
3103
+ },
3104
+ {
3105
+ "label": "Mammut",
3106
+ "href": "/brand/mammut"
3107
+ },
3108
+ {
3109
+ "label": "HOKA",
3110
+ "href": "/brand/hoka-one-one"
3111
+ },
3112
+ {
3113
+ "label": "On",
3114
+ "href": "/brand/on"
3115
+ },
3116
+ {
3117
+ "label": "See All Brands",
3118
+ "href": "/shop-all-brands"
3119
+ }
3120
+ ]
3121
+ }
3122
+ ],
3123
+ "width": 290
3124
+ },
3125
+ {
3126
+ "kind": "links",
3127
+ "blocks": [
3128
+ {
3129
+ "type": "heading",
3130
+ "label": "New To Us",
3131
+ "href": "/rc/new-brands",
3132
+ "id": "flyout-section-new-to-us"
3133
+ },
3134
+ {
3135
+ "type": "links",
3136
+ "columns": 1,
3137
+ "itemWidth": 273,
3138
+ "links": [
3139
+ {
3140
+ "label": "Pruzan",
3141
+ "href": "/brand/pruzan"
3142
+ },
3143
+ {
3144
+ "label": "SISSTR",
3145
+ "href": "/brand/sisstr"
3146
+ },
3147
+ {
3148
+ "label": "Wallien",
3149
+ "href": "/brand/wallien"
3150
+ },
3151
+ {
3152
+ "label": "Royal Robbins",
3153
+ "href": "/brand/royal-robbins"
3154
+ },
3155
+ {
3156
+ "label": "woom",
3157
+ "href": "/brand/woom"
3158
+ },
3159
+ {
3160
+ "label": "Callahan",
3161
+ "href": "/brand/callahan"
3162
+ },
3163
+ {
3164
+ "label": "Perfectwhitetee",
3165
+ "href": "/brand/perfectwhitetee"
3166
+ },
3167
+ {
3168
+ "label": "Daughter Lessons",
3169
+ "href": "/brand/daughter-lessons"
3170
+ },
3171
+ {
3172
+ "label": "Melin",
3173
+ "href": "/brand/melin"
3174
+ },
3175
+ {
3176
+ "label": "TravisMathew",
3177
+ "href": "/brand/travismathew"
3178
+ },
3179
+ {
3180
+ "label": "ONWRD Supply",
3181
+ "href": "/brand/onwrd-supply"
3182
+ },
3183
+ {
3184
+ "label": "Xero",
3185
+ "href": "/brand/xero"
3186
+ }
3187
+ ]
3188
+ }
3189
+ ],
3190
+ "width": 290
3191
+ }
3192
+ ]
3193
+ },
3194
+ {
3195
+ "key": "guides",
3196
+ "label": "Guides",
3197
+ "href": "/rc/gearhead-picks",
3198
+ "columns": [
3199
+ {
3200
+ "kind": "promo",
3201
+ "href": "/rc/gearhead-picks",
3202
+ "alt": "",
3203
+ "caption": "",
3204
+ "file": "/static/assets/cms/GEN26_0017-Flyout_Main.jpg",
3205
+ "width": 92
3206
+ },
3207
+ {
3208
+ "kind": "promo",
3209
+ "href": "/rc/gearhead-picks-camp",
3210
+ "alt": "",
3211
+ "caption": "",
3212
+ "file": "/static/assets/cms/GEN26_0017-Flyout_Camp.jpg",
3213
+ "width": 92
3214
+ },
3215
+ {
3216
+ "kind": "promo",
3217
+ "href": "/rc/gearhead-picks-hike",
3218
+ "alt": "",
3219
+ "caption": "",
3220
+ "file": "/static/assets/cms/GEN26_0017-Flyout_Hike.jpg",
3221
+ "width": 92
3222
+ },
3223
+ {
3224
+ "kind": "promo",
3225
+ "href": "/rc/gearhead-picks-bike",
3226
+ "alt": "",
3227
+ "caption": "",
3228
+ "file": "/static/assets/cms/GEN26_0028-Flyout2.jpeg",
3229
+ "width": 92
3230
+ },
3231
+ {
3232
+ "kind": "promo",
3233
+ "href": "/rc/gearhead-picks-run",
3234
+ "alt": "",
3235
+ "caption": "",
3236
+ "file": "/static/assets/cms/BC26_0168-Flyout.jpg",
3237
+ "width": 92
3238
+ },
3239
+ {
3240
+ "kind": "promo",
3241
+ "href": "/rc/gearhead-picks-travel",
3242
+ "alt": "",
3243
+ "caption": "",
3244
+ "file": "/static/assets/cms/GEN26_0017-Flyout_Travel.jpg",
3245
+ "width": 92
3246
+ },
3247
+ {
3248
+ "kind": "promo",
3249
+ "href": "/rc/gearhead-picks-climb",
3250
+ "alt": "",
3251
+ "caption": "",
3252
+ "file": "/static/assets/cms/GEN26_0017-Flyout_Climb.jpg",
3253
+ "width": 92
3254
+ },
3255
+ {
3256
+ "kind": "promo",
3257
+ "href": "/rc/gearhead-picks-paddle",
3258
+ "alt": "",
3259
+ "caption": "",
3260
+ "file": "/static/assets/cms/BC26_0179-Paddle_Flyout.jpg",
3261
+ "width": 92
3262
+ },
3263
+ {
3264
+ "kind": "promo",
3265
+ "href": "/rc/gearhead-picks-fly-fishing",
3266
+ "alt": "",
3267
+ "caption": "",
3268
+ "file": "/static/assets/cms/BC26_0167-Flyfish_Flyout.jpg",
3269
+ "width": 92
3270
+ },
3271
+ {
3272
+ "kind": "promo",
3273
+ "href": "/bulletin",
3274
+ "alt": "",
3275
+ "caption": "Reviews, Gearhead® tips, athlete interviews & more",
3276
+ "file": "/static/assets/cms/BC25_0160-Flyout.jpg",
3277
+ "width": 92
3278
+ }
3279
+ ]
3280
+ },
3281
+ {
3282
+ "key": "sale",
3283
+ "label": "Sale",
3284
+ "href": "/rc/extra-10-20-off-clearance",
3285
+ "columns": [
3286
+ {
3287
+ "kind": "promo",
3288
+ "href": "/rc/extra-10-20-off-clearance",
3289
+ "alt": "",
3290
+ "caption": "Extra 20% off clearance! Offer ends 8/31",
3291
+ "file": "/static/assets/cms/BC26_0225-Flyout.jpg",
3292
+ "width": 136
3293
+ },
3294
+ {
3295
+ "kind": "promo",
3296
+ "href": "/rc/labor-day-sale",
3297
+ "alt": "",
3298
+ "caption": "Labor Day Sale: Up to 60% off gear, outdoor clothing & more",
3299
+ "file": "/static/assets/cms/BC26_0223-Flyout.jpg",
3300
+ "width": 136
3301
+ },
3302
+ {
3303
+ "kind": "links",
3304
+ "blocks": [
3305
+ {
3306
+ "type": "heading",
3307
+ "label": "All Sale",
3308
+ "href": "/rc/shop-all-sale",
3309
+ "id": "flyout-section-all-sale"
3310
+ },
3311
+ {
3312
+ "type": "heading",
3313
+ "label": "Clearance",
3314
+ "href": "/rc/clearance",
3315
+ "id": "flyout-section-clearance"
3316
+ },
3317
+ {
3318
+ "type": "heading",
3319
+ "label": "New to Sale",
3320
+ "href": "/rc/latest-price-drops",
3321
+ "id": "flyout-section-new-to-sale"
3322
+ }
3323
+ ],
3324
+ "width": 140
3325
+ },
3326
+ {
3327
+ "kind": "links",
3328
+ "blocks": [
3329
+ {
3330
+ "type": "heading",
3331
+ "label": "Men's",
3332
+ "href": "/rc/mens-sale-clothing",
3333
+ "id": "flyout-section-men-s"
3334
+ },
3335
+ {
3336
+ "type": "links",
3337
+ "columns": 1,
3338
+ "itemWidth": 123,
3339
+ "links": [
3340
+ {
3341
+ "label": "Clothing",
3342
+ "href": "/rc/mens-sale-clothing"
3343
+ },
3344
+ {
3345
+ "label": "Footwear",
3346
+ "href": "/rc/mens-footwear-on-sale"
3347
+ }
3348
+ ]
3349
+ },
3350
+ {
3351
+ "type": "heading",
3352
+ "label": "Women's",
3353
+ "href": "/rc/womens-sale-clothing",
3354
+ "id": "flyout-section-women-s"
3355
+ },
3356
+ {
3357
+ "type": "links",
3358
+ "columns": 1,
3359
+ "itemWidth": 123,
3360
+ "links": [
3361
+ {
3362
+ "label": "Clothing",
3363
+ "href": "/rc/womens-sale-clothing"
3364
+ },
3365
+ {
3366
+ "label": "Footwear",
3367
+ "href": "/rc/womens-footwear-on-sale"
3368
+ }
3369
+ ]
3370
+ },
3371
+ {
3372
+ "type": "heading",
3373
+ "label": "Kids'",
3374
+ "href": "/rc/kids-clothing-on-sale",
3375
+ "id": "flyout-section-kids"
3376
+ },
3377
+ {
3378
+ "type": "links",
3379
+ "columns": 1,
3380
+ "itemWidth": 123,
3381
+ "links": [
3382
+ {
3383
+ "label": "Clothing",
3384
+ "href": "/rc/kids-clothing-on-sale"
3385
+ },
3386
+ {
3387
+ "label": "Footwear",
3388
+ "href": "/rc/kids-clothing-on-sale"
3389
+ }
3390
+ ]
3391
+ }
3392
+ ],
3393
+ "width": 140
3394
+ },
3395
+ {
3396
+ "kind": "links",
3397
+ "blocks": [
3398
+ {
3399
+ "type": "heading",
3400
+ "label": "Activities",
3401
+ "href": "/rc/gear-on-sale",
3402
+ "id": "flyout-section-activities"
3403
+ },
3404
+ {
3405
+ "type": "links",
3406
+ "columns": 1,
3407
+ "itemWidth": 123,
3408
+ "links": [
3409
+ {
3410
+ "label": "Camp",
3411
+ "href": "/rc/camp-gear-on-sale"
3412
+ },
3413
+ {
3414
+ "label": "Bike",
3415
+ "href": "/rc/bike-on-sale"
3416
+ },
3417
+ {
3418
+ "label": "Travel",
3419
+ "href": "/rc/travel-on-sale"
3420
+ },
3421
+ {
3422
+ "label": "Climb",
3423
+ "href": "/rc/climb-on-sale"
3424
+ },
3425
+ {
3426
+ "label": "Run",
3427
+ "href": "/rc/run-train-on-sale"
3428
+ },
3429
+ {
3430
+ "label": "Ski",
3431
+ "href": "/rc/ski-on-sale"
3432
+ },
3433
+ {
3434
+ "label": "Snowboard",
3435
+ "href": "/rc/snowboard-on-sale"
3436
+ }
3437
+ ]
3438
+ }
3439
+ ],
3440
+ "width": 140
3441
+ },
3442
+ {
3443
+ "kind": "links",
3444
+ "blocks": [
3445
+ {
3446
+ "type": "links",
3447
+ "columns": 1,
3448
+ "itemWidth": 123,
3449
+ "links": [
3450
+ {
3451
+ "label": "Patagonia",
3452
+ "href": "/rc/patagonia-on-sale"
3453
+ },
3454
+ {
3455
+ "label": "The North Face",
3456
+ "href": "/rc/the-north-face-on-sale"
3457
+ },
3458
+ {
3459
+ "label": "Cotopaxi",
3460
+ "href": "/rc/cotopaxi-on-sale"
3461
+ },
3462
+ {
3463
+ "label": "Outdoor Research",
3464
+ "href": "/rc/outdoor-research-on-sale"
3465
+ },
3466
+ {
3467
+ "label": "Smartwool",
3468
+ "href": "/rc/smartwool-on-sale"
3469
+ }
3470
+ ]
3471
+ }
3472
+ ],
3473
+ "width": 140
3474
+ },
3475
+ {
3476
+ "kind": "links",
3477
+ "blocks": [
3478
+ {
3479
+ "type": "heading",
3480
+ "label": "Outlet",
3481
+ "href": "/campaign/backcountry-outlet",
3482
+ "id": "flyout-section-outlet"
3483
+ },
3484
+ {
3485
+ "type": "links",
3486
+ "columns": 1,
3487
+ "itemWidth": 123,
3488
+ "links": [
3489
+ {
3490
+ "label": "70% Off Or More",
3491
+ "href": "/rc/everything-70-off-or-more"
3492
+ },
3493
+ {
3494
+ "label": "Deals Under $50",
3495
+ "href": "/rc/everything-under-50"
3496
+ },
3497
+ {
3498
+ "label": "Deals Under $100",
3499
+ "href": "/rc/everything-under-100"
3500
+ }
3501
+ ]
3502
+ }
3503
+ ],
3504
+ "width": 140
3505
+ }
3506
+ ]
3507
+ }
3508
+ ]
3509
+ }
tasks/backcountry/environment/reference/clone/requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ fastapi==0.139.2
2
+ jinja2==3.1.6
3
+ python-multipart==0.0.32
4
+ uvicorn==0.51.0
tasks/backcountry/environment/reference/clone/sanitize.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Conservative HTML sanitiser for captured source rich text.
2
+
3
+ Source product descriptions are rich text. They are reproduced structurally,
4
+ but only through an explicit tag/attribute allowlist, and every absolute
5
+ source-site link is rewritten to its local equivalent so the clone never sends
6
+ a visitor to the source origin.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ import re
12
+ from html.parser import HTMLParser
13
+ from urllib.parse import urlsplit
14
+
15
+ ALLOWED_TAGS = {
16
+ "p", "br", "strong", "b", "em", "i", "u", "ul", "ol", "li",
17
+ "h2", "h3", "h4", "span", "a", "table", "thead", "tbody", "tr", "th", "td",
18
+ }
19
+ VOID_TAGS = {"br"}
20
+ ALLOWED_ATTRS = {"a": {"href"}}
21
+ SOURCE_HOSTS = {"www.backcountry.com", "backcountry.com", "content.backcountry.com"}
22
+
23
+
24
+ def localize(href: str) -> str | None:
25
+ """Keep same-site links as local paths; drop links that leave the clone."""
26
+ href = (href or "").strip()
27
+ if not href:
28
+ return None
29
+ if href.startswith("/"):
30
+ return href
31
+ parts = urlsplit(href)
32
+ if parts.scheme in ("http", "https") and parts.netloc in SOURCE_HOSTS:
33
+ return (parts.path or "/") + (f"?{parts.query}" if parts.query else "")
34
+ if href.startswith("#"):
35
+ return href
36
+ return None
37
+
38
+
39
+ class _Sanitizer(HTMLParser):
40
+ def __init__(self) -> None:
41
+ super().__init__(convert_charrefs=True)
42
+ self.parts: list[str] = []
43
+ self._open: list[str] = []
44
+
45
+ def handle_starttag(self, tag: str, attrs: list[tuple[str, str | None]]) -> None:
46
+ if tag not in ALLOWED_TAGS:
47
+ return
48
+ if tag == "a":
49
+ href = localize(dict(attrs).get("href") or "")
50
+ if not href:
51
+ # Unresolvable or external destination: keep the text, drop the link.
52
+ self._open.append("")
53
+ return
54
+ self.parts.append(f'<a href="{_escape(href)}">')
55
+ else:
56
+ self.parts.append(f"<{tag}>")
57
+ if tag not in VOID_TAGS:
58
+ self._open.append(tag)
59
+
60
+ def handle_endtag(self, tag: str) -> None:
61
+ if tag not in ALLOWED_TAGS or tag in VOID_TAGS:
62
+ return
63
+ while self._open:
64
+ open_tag = self._open.pop()
65
+ if open_tag:
66
+ self.parts.append(f"</{open_tag}>")
67
+ if open_tag == tag or open_tag == "":
68
+ break
69
+
70
+ def handle_data(self, data: str) -> None:
71
+ self.parts.append(_escape(data))
72
+
73
+ def close_all(self) -> str:
74
+ while self._open:
75
+ open_tag = self._open.pop()
76
+ if open_tag:
77
+ self.parts.append(f"</{open_tag}>")
78
+ return "".join(self.parts)
79
+
80
+
81
+ def _escape(text: str) -> str:
82
+ return (text.replace("&", "&amp;").replace("<", "&lt;")
83
+ .replace(">", "&gt;").replace('"', "&quot;"))
84
+
85
+
86
+ def clean_html(raw: str | None) -> str:
87
+ if not raw:
88
+ return ""
89
+ parser = _Sanitizer()
90
+ parser.feed(raw)
91
+ parser.close()
92
+ html = parser.close_all()
93
+ return re.sub(r"\s+", " ", html).strip()
94
+
95
+
96
+ def to_text(raw: str | None) -> str:
97
+ if not raw:
98
+ return ""
99
+ text = re.sub(r"<[^>]+>", " ", raw)
100
+ text = (text.replace("&amp;", "&").replace("&lt;", "<")
101
+ .replace("&gt;", ">").replace("&quot;", '"').replace("&nbsp;", " "))
102
+ return re.sub(r"\s+", " ", text).strip()
tasks/backcountry/environment/reference/clone/sitepack.py ADDED
@@ -0,0 +1,450 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Frozen binary assets, read out of a few blobs instead of ~10k files.
2
+
3
+ Why this exists
4
+ ---------------
5
+ The verifier re-hashes the *entire* compiled build tree on every runtime start
6
+ (``ExecutableRuntime.start()`` calls ``tree_digest`` before every ``Popen``),
7
+ including the start that the ``restart`` action performs in the middle of a
8
+ case. That walk is pure Python, so the four case shards that share one
9
+ verifier process serialise on the GIL: this tree hashes in 2.2 s alone and in
10
+ 15.9 s when four shards hash it at once, while four *processes* hash it in 2.0 s
11
+ each - and the whole stop-and-start took 24 s on four threads against 4.6 s on
12
+ one. The Browser Use adapter gives the restart controller a hard 15 s HTTP
13
+ budget (``urllib.request.urlopen(..., timeout=15)``) where the Playwright
14
+ executor calls the same restart in-process with no cap, so an oversized tree
15
+ surfaces as ``formal executor disagreement: playwright=True browser-use=False``
16
+ on exactly the cases that restart, at random, and more often the larger the
17
+ tree is.
18
+
19
+ This site froze 10,881 files - 10,235 of them product photographs under
20
+ ``clone/static/assets/items`` - fifteen times the corpus median of 700.
21
+ ``compile.sh`` packs the binary assets - images, fonts, icons, PDFs; never
22
+ HTML, CSS, JS, JSON or SVG - into a handful of blobs, which leaves ~0.9k files
23
+ in the compiled tree. Nothing else changes: the same bytes are served at the
24
+ same URL with the same content type, read out of the blob with ``os.pread``.
25
+
26
+ When the pack is absent - the tree is being run straight from the repository,
27
+ which is what the reference capture does - every lookup falls through to the
28
+ files themselves, so both layouts serve identical responses.
29
+ """
30
+
31
+ from __future__ import annotations
32
+
33
+ import json
34
+ import os
35
+ import threading
36
+ from pathlib import Path
37
+
38
+ SCHEMA = "websitebench.sitepack.v1"
39
+
40
+ #: Where the blobs and their index land, relative to the reference root. It is
41
+ #: deliberately outside every served directory: no route can reach a blob.
42
+ OUTPUT = "clone/_sitepack"
43
+
44
+ #: Only opaque binary payloads are packed. Text assets stay on disk so the
45
+ #: repository policy scans over ``clone/**/*.html|.jinja|.jinja2|.js`` keep
46
+ #: seeing exactly the files they see today, and video stays on disk so range
47
+ #: requests keep streaming straight off a real file.
48
+ BINARY_SUFFIXES = frozenset(
49
+ {
50
+ ".apng",
51
+ ".avif",
52
+ ".bmp",
53
+ ".eot",
54
+ ".gif",
55
+ ".ico",
56
+ ".jpeg",
57
+ ".jpg",
58
+ ".otf",
59
+ ".pdf",
60
+ ".png",
61
+ ".tif",
62
+ ".tiff",
63
+ ".ttf",
64
+ ".webp",
65
+ ".woff",
66
+ ".woff2",
67
+ }
68
+ )
69
+
70
+ #: ``(name, directory relative to the reference root, packed suffixes)``.
71
+ GROUPS: tuple[tuple[str, str, frozenset], ...] = (
72
+ ("static", "clone/static", BINARY_SUFFIXES),
73
+ )
74
+
75
+ #: ``compile.sh`` runs under ``RLIMIT_FSIZE = 256 MiB`` (compiler.MAX_LOG_BYTES),
76
+ #: so the pack is sharded well below that ceiling.
77
+ SHARD_BYTES = 96 * 1024 * 1024
78
+
79
+
80
+ class SitePack:
81
+ """Read-only view over one packed directory."""
82
+
83
+ def __init__(
84
+ self,
85
+ directory: Path,
86
+ shards: tuple[str, ...],
87
+ entries: dict[str, tuple[int, int, int, float]],
88
+ ) -> None:
89
+ self._directory = directory
90
+ self._shards = shards
91
+ self._entries = entries
92
+ self._handles: dict[int, int] = {}
93
+ self._lock = threading.Lock()
94
+
95
+ @classmethod
96
+ def load(cls, index_path: Path | str) -> "SitePack | None":
97
+ index_path = Path(index_path)
98
+ if not index_path.is_file():
99
+ return None
100
+ document = json.loads(index_path.read_text(encoding="utf-8"))
101
+ if document.get("schema") != SCHEMA:
102
+ raise RuntimeError(f"unknown site pack schema: {index_path}")
103
+ entries = {
104
+ str(key): (int(value[0]), int(value[1]), int(value[2]), float(value[3]))
105
+ for key, value in document["entries"].items()
106
+ }
107
+ return cls(index_path.parent, tuple(document["shards"]), entries)
108
+
109
+ def entry(self, relative: str) -> tuple[int, int, int, float] | None:
110
+ return self._entries.get(str(relative).replace(os.sep, "/"))
111
+
112
+ def blob_path(self, entry: tuple[int, int, int, float]) -> Path:
113
+ """The shard file an entry lives in; only used as a diagnostic path."""
114
+
115
+ return self._directory / self._shards[entry[0]]
116
+
117
+ def read(self, entry: tuple[int, int, int, float]) -> bytes:
118
+ shard, offset, size, _mtime = entry
119
+ handle = self._handles.get(shard)
120
+ if handle is None:
121
+ with self._lock:
122
+ handle = self._handles.get(shard)
123
+ if handle is None:
124
+ handle = os.open(
125
+ str(self._directory / self._shards[shard]), os.O_RDONLY
126
+ )
127
+ self._handles[shard] = handle
128
+ chunks: list[bytes] = []
129
+ read = 0
130
+ while read < size:
131
+ chunk = os.pread(handle, size - read, offset + read)
132
+ if not chunk:
133
+ raise OSError(f"site pack blob is truncated: {self._shards[shard]}")
134
+ chunks.append(chunk)
135
+ read += len(chunk)
136
+ return b"".join(chunks)
137
+
138
+
139
+ #: Built on first use: ``starlette`` is only importable once the vendored tree
140
+ #: is on the path, which is not the case while ``--pack`` runs from compile.sh.
141
+ _PACKED_RESPONSE: type | None = None
142
+
143
+
144
+ def _packed_response_class() -> type:
145
+ global _PACKED_RESPONSE
146
+ if _PACKED_RESPONSE is not None:
147
+ return _PACKED_RESPONSE
148
+
149
+ from secrets import token_hex
150
+
151
+ from starlette.datastructures import MutableHeaders
152
+ from starlette.responses import FileResponse
153
+
154
+ # The subclass below replaces exactly these three send paths. If a future
155
+ # starlette renamed one, the base class would silently stream the blob from
156
+ # offset zero and serve the wrong bytes, so refuse to build instead.
157
+ missing = [
158
+ name
159
+ for name in ("_handle_simple", "_handle_single_range", "_handle_multiple_ranges")
160
+ if not callable(getattr(FileResponse, name, None))
161
+ ]
162
+ if missing:
163
+ raise RuntimeError(f"vendored starlette FileResponse lacks {missing}")
164
+
165
+ class _PackedResponse(FileResponse):
166
+ """``FileResponse`` whose bytes come out of a blob instead of a path.
167
+
168
+ Only the three byte-sending paths are replaced. Everything that decides
169
+ *what* to send - HEAD, ``If-Range``, a malformed range (400), an
170
+ unsatisfiable one (416), one range (206), several (206 multipart), and
171
+ the stat-derived ``content-length``/``last-modified``/``etag`` - is
172
+ starlette's own code running against the size and mtime the file had, so
173
+ a packed entry answers exactly as the file did.
174
+ """
175
+
176
+ def __init__(self, payload: bytes, **kwargs) -> None:
177
+ self._payload = payload
178
+ super().__init__(**kwargs)
179
+
180
+ async def _handle_simple(self, send, send_header_only, send_pathsend) -> None:
181
+ await send(
182
+ {
183
+ "type": "http.response.start",
184
+ "status": self.status_code,
185
+ "headers": self.raw_headers,
186
+ }
187
+ )
188
+ await send(
189
+ {
190
+ "type": "http.response.body",
191
+ "body": b"" if send_header_only else self._payload,
192
+ "more_body": False,
193
+ }
194
+ )
195
+
196
+ async def _handle_single_range(
197
+ self, send, start: int, end: int, file_size: int, send_header_only: bool
198
+ ) -> None:
199
+ headers = MutableHeaders(raw=list(self.raw_headers))
200
+ headers["content-range"] = f"bytes {start}-{end - 1}/{file_size}"
201
+ headers["content-length"] = str(end - start)
202
+ await send(
203
+ {"type": "http.response.start", "status": 206, "headers": headers.raw}
204
+ )
205
+ await send(
206
+ {
207
+ "type": "http.response.body",
208
+ "body": b"" if send_header_only else self._payload[start:end],
209
+ "more_body": False,
210
+ }
211
+ )
212
+
213
+ async def _handle_multiple_ranges(
214
+ self, send, ranges, file_size: int, send_header_only: bool
215
+ ) -> None:
216
+ boundary = token_hex(13)
217
+ content_length, header_generator = self.generate_multipart(
218
+ ranges, boundary, file_size, self.headers["content-type"]
219
+ )
220
+ headers = MutableHeaders(raw=list(self.raw_headers))
221
+ headers["content-type"] = f"multipart/byteranges; boundary={boundary}"
222
+ headers["content-length"] = str(content_length)
223
+ await send(
224
+ {"type": "http.response.start", "status": 206, "headers": headers.raw}
225
+ )
226
+ if send_header_only:
227
+ await send(
228
+ {"type": "http.response.body", "body": b"", "more_body": False}
229
+ )
230
+ return
231
+ for start, end in ranges:
232
+ await send(
233
+ {
234
+ "type": "http.response.body",
235
+ "body": header_generator(start, end),
236
+ "more_body": True,
237
+ }
238
+ )
239
+ await send(
240
+ {
241
+ "type": "http.response.body",
242
+ "body": self._payload[start:end],
243
+ "more_body": True,
244
+ }
245
+ )
246
+ await send(
247
+ {"type": "http.response.body", "body": b"\r\n", "more_body": True}
248
+ )
249
+ await send(
250
+ {
251
+ "type": "http.response.body",
252
+ "body": f"--{boundary}--".encode("latin-1"),
253
+ "more_body": False,
254
+ }
255
+ )
256
+
257
+ _PACKED_RESPONSE = _PackedResponse
258
+ return _PACKED_RESPONSE
259
+
260
+
261
+ def _packed_stat(size: int, mtime: float):
262
+ """An ``os.stat_result`` carrying exactly the size and mtime of the file.
263
+
264
+ ``FileResponse`` derives ``content-length``, ``last-modified`` and the
265
+ ``etag`` from these two numbers, so handing it the recorded pair reproduces
266
+ the headers the file itself produced, to the sub-second digit.
267
+ """
268
+
269
+ return os.stat_result(
270
+ (0o100644, 0, 0, 1, 0, 0, size, int(mtime), int(mtime), int(mtime)),
271
+ {"st_atime": mtime, "st_mtime": mtime, "st_ctime": mtime},
272
+ )
273
+
274
+
275
+ def packed_response(
276
+ pack: "SitePack",
277
+ relative: str,
278
+ entry: tuple[int, int, int, float],
279
+ *,
280
+ media_type: str | None = None,
281
+ ):
282
+ """Serve one packed entry the way ``FileResponse`` serves the same file."""
283
+
284
+ from mimetypes import guess_type
285
+
286
+ _shard, _offset, size, mtime = entry
287
+ if media_type is None:
288
+ media_type = guess_type(relative)[0] or "application/octet-stream"
289
+ body = pack.read(entry)
290
+ if len(body) != size: # pragma: no cover - defensive
291
+ raise OSError(f"site pack entry has the wrong length: {relative}")
292
+ return _packed_response_class()(
293
+ body,
294
+ path=str(pack.blob_path(entry)),
295
+ media_type=media_type,
296
+ stat_result=_packed_stat(size, mtime),
297
+ )
298
+
299
+
300
+ def packed_bytes(pack: "SitePack | None", relative: str) -> bytes | None:
301
+ """Return one packed entry's bytes, or ``None`` when it is not packed."""
302
+
303
+ if pack is None:
304
+ return None
305
+ entry = pack.entry(relative)
306
+ return None if entry is None else pack.read(entry)
307
+
308
+
309
+ def packed_static_files(*, directory, pack: "SitePack | None", **kwargs):
310
+ """``StaticFiles`` that answers packed entries before it touches the disk.
311
+
312
+ The class is built here rather than at module import so that ``--pack`` can
313
+ run from ``compile.sh``, before the vendored tree is importable.
314
+ """
315
+
316
+ from starlette.datastructures import Headers
317
+ from starlette.staticfiles import NotModifiedResponse, StaticFiles
318
+
319
+ class _PackedStaticFiles(StaticFiles):
320
+ def __init__(self, *, pack: "SitePack | None", **inner):
321
+ super().__init__(**inner)
322
+ self._pack = pack
323
+
324
+ async def get_response(self, path, scope):
325
+ if self._pack is not None and scope["method"] in ("GET", "HEAD"):
326
+ relative = str(path).replace(os.sep, "/")
327
+ entry = self._pack.entry(relative)
328
+ if entry is not None:
329
+ request_headers = Headers(scope=scope)
330
+ response = packed_response(self._pack, relative, entry)
331
+ if self.is_not_modified(response.headers, request_headers):
332
+ return NotModifiedResponse(response.headers)
333
+ return response
334
+ return await super().get_response(path, scope)
335
+
336
+ return _PackedStaticFiles(directory=directory, pack=pack, **kwargs)
337
+
338
+
339
+ # --------------------------------------------------------------------------
340
+ # Packing. Runs once from ``compile.sh``, never from ``run.sh``.
341
+ # --------------------------------------------------------------------------
342
+
343
+
344
+ #: The three byte-identical runtime copies a Harbor bundle checks in. Packing
345
+ #: deletes the files it absorbs, so it must only ever run against a build copy:
346
+ #: the quarantined tree ``compile_candidate`` makes, the reference Docker image,
347
+ #: or a scratch copy. None of those sits under a ``task.toml``.
348
+ BUNDLE_COPIES = (
349
+ "environment/reference",
350
+ "tests/oracle-runtime",
351
+ "solution/site/implementation",
352
+ )
353
+
354
+
355
+ def _inside_bundle(root: Path) -> bool:
356
+ """True when ``root`` is one of the bundle's three checked-in copies."""
357
+
358
+ for parent in list(root.parents)[:4]:
359
+ if not (parent / "task.toml").is_file():
360
+ continue
361
+ return root.relative_to(parent).as_posix() in BUNDLE_COPIES
362
+ return False
363
+
364
+
365
+ def pack(root: Path) -> int:
366
+ root = Path(root).resolve()
367
+ if _inside_bundle(root):
368
+ print(f"sitepack: {root} is a bundle checkout; not packing")
369
+ return 0
370
+ output = root / OUTPUT
371
+ output.mkdir(parents=True, exist_ok=True)
372
+ for name, relative, suffixes in GROUPS:
373
+ index_path = output / f"{name}.packindex.json"
374
+ if index_path.is_file():
375
+ print(f"sitepack: {name} is already packed")
376
+ continue
377
+ source = root / relative
378
+ if not source.is_dir():
379
+ print(f"sitepack: {relative} is missing; nothing to pack")
380
+ continue
381
+ files = sorted(
382
+ path
383
+ for path in source.rglob("*")
384
+ if path.is_file() and path.suffix.lower() in suffixes
385
+ )
386
+ shards: list[str] = []
387
+ entries: dict[str, list[object]] = {}
388
+ handle = None
389
+ written = 0
390
+ try:
391
+ for path in files:
392
+ size = path.stat().st_size
393
+ if handle is None or (written and written + size > SHARD_BYTES):
394
+ if handle is not None:
395
+ handle.close()
396
+ shards.append(f"{name}.pack.{len(shards):02d}")
397
+ handle = (output / shards[-1]).open("wb")
398
+ written = 0
399
+ entries[path.relative_to(source).as_posix()] = [
400
+ len(shards) - 1,
401
+ written,
402
+ size,
403
+ path.stat().st_mtime,
404
+ ]
405
+ with path.open("rb") as source_handle:
406
+ while chunk := source_handle.read(1024 * 1024):
407
+ handle.write(chunk)
408
+ written += size
409
+ finally:
410
+ if handle is not None:
411
+ handle.close()
412
+ index_path.write_text(
413
+ json.dumps(
414
+ {
415
+ "schema": SCHEMA,
416
+ "root": relative,
417
+ "shards": shards,
418
+ "entries": entries,
419
+ },
420
+ separators=(",", ":"),
421
+ sort_keys=True,
422
+ ),
423
+ encoding="utf-8",
424
+ )
425
+ for path in files:
426
+ path.unlink()
427
+ for directory in sorted(
428
+ (path for path in source.rglob("*") if path.is_dir()),
429
+ key=lambda item: len(item.parts),
430
+ reverse=True,
431
+ ):
432
+ try:
433
+ directory.rmdir()
434
+ except OSError:
435
+ pass
436
+ print(f"sitepack: packed {len(files)} files into {len(shards)} shard(s)")
437
+ return 0
438
+
439
+
440
+ def main(argv: list[str]) -> int:
441
+ if len(argv) == 2 and argv[0] == "--pack":
442
+ return pack(Path(argv[1]))
443
+ print("usage: sitepack.py --pack <reference-root>")
444
+ return 2
445
+
446
+
447
+ if __name__ == "__main__":
448
+ import sys
449
+
450
+ raise SystemExit(main(sys.argv[1:]))
tasks/backcountry/environment/reference/clone/static/assets/brand/gearhead-top-pick.svg ADDED
tasks/backcountry/environment/reference/clone/static/assets/brand/icons.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"account": "<svg viewBox=\"0 0 128 128\" class=\"chakra-avatar__svg css-16ite8i\" role=\"img\" aria-label=\" avatar\"><path fill=\"currentColor\" d=\"M103,102.1388 C93.094,111.92 79.3504,118 64.1638,118 C48.8056,118 34.9294,111.768 25,101.7892 L25,95.2 C25,86.8096 31.981,80 40.6,80 L87.4,80 C96.019,80 103,86.8096 103,95.2 L103,102.1388 Z\"></path><path fill=\"currentColor\" d=\"M63.9961647,24 C51.2938136,24 41,34.2938136 41,46.9961647 C41,59.7061864 51.2938136,70 63.9961647,70 C76.6985159,70 87,59.7061864 87,46.9961647 C87,34.2938136 76.6985159,24 63.9961647,24\"></path></svg>", "cart": "<svg viewBox=\"0 0 20 18\" focusable=\"false\" class=\"chakra-icon css-3otfuf\"><path d=\"M18.1202 9.40542L19.9789 3.43961C20.0974 2.9263 19.7011 2.4375 19.1663 2.4375H5.52806L5.20979 0.905908C5.13049 0.524155 4.78924 0.25 4.39337 0.25H0.833334C0.37309 0.25 0 0.617261 0 1.07031V1.61719C0 2.07024 0.37309 2.4375 0.833334 2.4375H3.25983L5.69899 14.176C5.11545 14.5063 4.72222 15.1258 4.72222 15.8359C4.72222 16.893 5.59278 17.75 6.66667 17.75C7.74056 17.75 8.61111 16.893 8.61111 15.8359C8.61111 15.3002 8.38726 14.8162 8.02695 14.4688H15.3064C14.9461 14.8162 14.7222 15.3002 14.7222 15.8359C14.7222 16.893 15.5928 17.75 16.6667 17.75C17.7406 17.75 18.6111 16.893 18.6111 15.8359C18.6111 15.0781 18.1636 14.4232 17.5146 14.1131L17.7062 13.2834C17.8247 12.7701 17.4283 12.2812 16.8936 12.2812H7.57351L7.12899 10.0439H17.3076C17.6967 10.0439 18.034 9.7789 18.1202 9.40542Z\"></path></svg>", "expert": "<svg viewBox=\"0 0 10 16\" focusable=\"false\" class=\"chakra-icon css-onkibi\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M0 0V1.52547V12.5774V16L2.44187 13.7118L4.99978 11.3152L7.55828 13.7118L10 15.9995V0H0Z\" fill=\"#36827F\"></path></svg>", "search": "<svg viewBox=\"0 0 24 24\" focusable=\"false\" class=\"chakra-icon css-a4aeo8\" aria-hidden=\"true\"><path fill=\"currentColor\" d=\"M23.414,20.591l-4.645-4.645a10.256,10.256,0,1,0-2.828,2.829l4.645,4.644a2.025,2.025,0,0,0,2.828,0A2,2,0,0,0,23.414,20.591ZM10.25,3.005A7.25,7.25,0,1,1,3,10.255,7.258,7.258,0,0,1,10.25,3.005Z\"></path></svg>"}
tasks/backcountry/environment/reference/clone/static/assets/brand/logo.svg ADDED
tasks/backcountry/environment/reference/clone/static/assets/cms/6656310940a36ddf57dbeb72-1_1_Outdoor_Research.jpg-w450 ADDED
Binary file (19.5 kB). View file
 
tasks/backcountry/environment/reference/clone/static/assets/cms/66563109fab32508ce34d58a-1_1_Patagonia.jpg-w450 ADDED
Binary file (28.8 kB). View file
 
tasks/backcountry/environment/reference/clone/static/assets/cms/665898d0e4a7322dd7978c8e-2_1_returns.jpg-w450 ADDED
Binary file (34.8 kB). View file
 
tasks/backcountry/environment/reference/clone/static/assets/cms/6674615b1ae3c1391f0668f9-Salomon.jpg-w450 ADDED
Binary file (28.8 kB). View file
 
tasks/backcountry/environment/reference/clone/static/assets/cms/66a7be00bb95123280021e73-Black_Diamond.jpg-w450 ADDED
Binary file (63 kB). View file
 
tasks/backcountry/environment/reference/clone/static/assets/cms/675b7559ea6bc637e91871ff-Fjall.jpg-w450 ADDED
Binary file (40.9 kB). View file
 
tasks/backcountry/environment/reference/clone/static/assets/cms/67630356117e7e1fe846dd2f-Gearhead_Articles.jpg-w450 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3c06a8d5221eff0071bc9512110330ccb685d7c906cc952abc49d96757a92776
3
+ size 345494
tasks/backcountry/environment/reference/clone/static/assets/cms/67630356ea6bc69018189da9-Backcountry_Podcasts.jpg-w450 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bb3a0cd3357a46f4c5f6895b6612e16427f6e2d29a70b13b2971614472df9942
3
+ size 195152
tasks/backcountry/environment/reference/clone/static/assets/cms/677eb2a5bf0f6821ac69d33d-TNF.png-w450 ADDED
Binary file (36.3 kB). View file
 
tasks/backcountry/environment/reference/clone/static/assets/cms/679bf2144ddeea83bac81c04-2_1_free_shipping.jpg-w450 ADDED
Binary file (40.9 kB). View file
 
tasks/backcountry/environment/reference/clone/static/assets/cms/67d34c1fcb17a22d46903016-Backcountry_Bulletin_main.jpg-w450 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1edce1c08dca216df58ef02956ebacf1bd4166e0976ac93b19060ebcfd51a39c
3
+ size 267045
tasks/backcountry/environment/reference/clone/static/assets/cms/690bf11337acaee80a5ac231-Card_3x4_GH-Adventure-1.jpg-w450 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5f22afb03565ad742755f4796d9bade5b9acca317bcfb7d5b8ac6beabca2b0e8
3
+ size 190545
tasks/backcountry/environment/reference/clone/static/assets/cms/690bf115e56f964b105a0382-Card_3x4_GH-Adventure-4.jpg-w450 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:de83d8acd09122e2a2c75e6f867a0a165d91fd3e303719558da5c5b8226b639a
3
+ size 252461
tasks/backcountry/environment/reference/clone/static/assets/cms/690bf11a73e076dc122b3d7f-Card_3x4_GH-Adventure-5.jpg-w450 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7730cd789d4bd829a1211bcb6c4a8959af0b31cfa31d78628a470ced088dca62
3
+ size 315612
tasks/backcountry/environment/reference/clone/static/assets/cms/690bf11e05acfe73880fbd64-Card_3x4_GH-Adventure-3.jpg-w450 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d626b9a0bdb504b24472077d69cf4f47c599bf3535c48e578efbff3de49d5565
3
+ size 236880
tasks/backcountry/environment/reference/clone/static/assets/cms/690bf11fd3150572106ac9e2-Card_3x4_GH-Adventure-2.jpg-w450 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8b238181b4ec90475d7df8c48019d899850e9ddd754d4c70c3d45c12cabde36
3
+ size 478035
tasks/backcountry/environment/reference/clone/static/assets/cms/6969403d7d6f880008c57811-2_1_SC_V4.jpg-w450 ADDED
Binary file (83 kB). View file
 
tasks/backcountry/environment/reference/clone/static/assets/cms/69a0bb9af41d202befd3c90b-Rain.jpeg-w450 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b78a25f23276ea1595575d35f871ee1a904b80d0a8883a29659722790df2d2db
3
+ size 242543
tasks/backcountry/environment/reference/clone/static/assets/cms/69a0bb9b47c5b03fbdc85871-Destination.jpeg-w450 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d787c5b8bfe157b52d70f379e3b2dda743dd2fd2314e1b32b1ad6b70c74c829
3
+ size 425492
tasks/backcountry/environment/reference/clone/static/assets/cms/69a0bb9bb9f0f2c78e3240b6-Fleece.jpeg-w450 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e41bd72f8450dd92a1fda01b4005342a7cd37c8160f3ed8cc7e03e238c70d77c
3
+ size 615030
tasks/backcountry/environment/reference/clone/static/assets/cms/69a0bb9cb9f0f279273240ba-Shop_All.jpeg-w450 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1e8fdc7939fd08300ff7af4d2bf9b0c4be021db8a55f71a3a215087cf8390545
3
+ size 303473
tasks/backcountry/environment/reference/clone/static/assets/cms/69a0bb9cba238f747f2f4ccd-Wasatch.jpeg-w450 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2885d220514caf880cfcaa7ebf395bf3116aa53e0843adbd71287cfbbeb39e05
3
+ size 301868