Jarvis2345 commited on
Commit
763bdb7
·
verified ·
1 Parent(s): 97cf7fe

deploy(S4): Blender headless pipeline + WebAR client + backend fixes

Browse files
backend/main.py CHANGED
@@ -2,6 +2,27 @@ import asyncio
2
  import logging
3
  import os
4
  import sys
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  # --- load .env early: token_manager.py executes at import time, before main() ---
6
  try:
7
  from dotenv import load_dotenv as _load_dotenv
 
2
  import logging
3
  import os
4
  import sys
5
+
6
+ # ── No flashing console windows in the shipped app ────────────────────────────
7
+ # On Windows every subprocess started from a frozen (PyInstaller) build pops a
8
+ # console window unless CREATE_NO_WINDOW is set. This backend shells out from
9
+ # ~85 call sites, several on short timers (the USB monitor runs every 2s), so
10
+ # the user sees a terminal flashing continuously while JARVIS is running.
11
+ # Rather than annotate every call site (and silently regress on the next one),
12
+ # force the flag globally for the packaged build.
13
+ if sys.platform == "win32":
14
+ import subprocess as _subprocess
15
+
16
+ _CREATE_NO_WINDOW = 0x08000000
17
+ _orig_popen_init = _subprocess.Popen.__init__
18
+
19
+ def _no_window_popen_init(self, *args, **kwargs):
20
+ # shell=True routes through cmd.exe, which is the loudest offender.
21
+ if not kwargs.get("close_fds_is_dummy"):
22
+ kwargs["creationflags"] = kwargs.get("creationflags", 0) | _CREATE_NO_WINDOW
23
+ return _orig_popen_init(self, *args, **kwargs)
24
+
25
+ _subprocess.Popen.__init__ = _no_window_popen_init
26
  # --- load .env early: token_manager.py executes at import time, before main() ---
27
  try:
28
  from dotenv import load_dotenv as _load_dotenv
backend/routes/automation_routes.py CHANGED
@@ -1,89 +1,159 @@
1
- from fastapi import APIRouter
2
- from pydantic import BaseModel
3
-
4
- router = APIRouter()
5
-
6
- class Workflow(BaseModel):
7
- name: str
8
- steps: list
9
-
10
- @router.get("/list")
11
- async def get_automation_list():
12
- return []
13
-
14
- @router.post("/trigger/{id}")
15
- async def trigger_automation_route(id: str):
16
- from backend.services.automation_service import trigger_automation
17
- await trigger_automation(id)
18
- return {"status": "triggered"}
19
-
20
- @router.post("/pause_all")
21
- async def pause_all():
22
- from backend.services.automation_service import pause_all_automations
23
- await pause_all_automations()
24
- return {"status": "paused"}
25
-
26
- @router.post("/resume_all")
27
- async def resume_all():
28
- from backend.services.automation_service import resume_all_automations
29
- await resume_all_automations()
30
- return {"status": "resumed"}
31
-
32
- @router.post("/jobs/{job_id}/pause")
33
- async def pause_single_job(job_id: str):
34
- from backend.services.automation_service import pause_job
35
- pause_job(job_id)
36
- return {"status": f"job {job_id} paused"}
37
-
38
- @router.post("/jobs/{job_id}/resume")
39
- async def resume_single_job(job_id: str):
40
- from backend.services.automation_service import resume_job
41
- resume_job(job_id)
42
- return {"status": f"job {job_id} resumed"}
43
-
44
- @router.delete("/jobs/{job_id}")
45
- async def delete_single_job(job_id: str):
46
- from backend.services.automation_service import delete_job
47
- delete_job(job_id)
48
- return {"status": f"job {job_id} deleted"}
49
-
50
- @router.post("/save")
51
- async def save_workflow(w: Workflow):
52
- return {"status": "saved"}
53
-
54
- @router.get("/history")
55
- async def get_history():
56
- return []
57
-
58
- @router.post("/dry-run")
59
- async def dry_run_workflow(w: Workflow):
60
- """
61
- Simulates workflow execution without side effects.
62
- Returns a preview of the steps and their expected mock results.
63
- """
64
- import asyncio
65
- preview_steps = []
66
-
67
- for i, step in enumerate(w.steps):
68
- # Determine a mock result based on step type if present
69
- step_type = step.get('type', 'unknown') if isinstance(step, dict) else 'unknown'
70
- mock_result = f"Mock result for {step_type}"
71
- if step_type == 'api_call': mock_result = "HTTP 200 OK (Mock)"
72
- elif step_type == 'script': mock_result = "Script execution simulated"
73
- elif step_type == 'agent': mock_result = "Agent reasoning simulated"
74
-
75
- preview_steps.append({
76
- "step_index": i,
77
- "step_config": step,
78
- "expected_status": "success",
79
- "mock_result": mock_result
80
- })
81
-
82
- # Simulate minor delay
83
- await asyncio.sleep(0.1)
84
-
85
- return {
86
- "status": "dry-run-complete",
87
- "total_steps": len(w.steps),
88
- "execution_preview": preview_steps
89
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ import re
3
+
4
+ from fastapi import APIRouter, HTTPException
5
+ from pydantic import BaseModel
6
+
7
+ router = APIRouter()
8
+
9
+ class Workflow(BaseModel):
10
+ name: str
11
+ steps: list
12
+
13
+ @router.get("/list")
14
+ async def get_automation_list():
15
+ """User automations plus the live scheduler jobs.
16
+
17
+ This used to be a hardcoded `return []`, so the endpoint reported success
18
+ while claiming the system had no automations — even though
19
+ automation_service.load_automations() reads real rows from
20
+ `custom_automations`, and the scheduler genuinely runs persisted jobs
21
+ (mcu_suit_vitals, mcu_battlefield_intel, hf_keepalive_ping) out of the
22
+ `apscheduler_jobs` table. Anything driven off this route saw an empty system.
23
+ """
24
+ from backend.services.automation_service import load_automations, scheduler
25
+ try:
26
+ automations = load_automations()
27
+ except Exception as exc: # a missing table must not 500 the whole panel
28
+ automations = []
29
+ logging.warning("load_automations failed: %s", exc)
30
+
31
+ jobs = []
32
+ try:
33
+ for job in scheduler.get_jobs():
34
+ jobs.append({
35
+ "id": job.id,
36
+ "name": getattr(job, "name", job.id),
37
+ "trigger": str(job.trigger),
38
+ "next_run_time": job.next_run_time.isoformat() if job.next_run_time else None,
39
+ })
40
+ except Exception as exc:
41
+ logging.warning("scheduler.get_jobs failed: %s", exc)
42
+
43
+ return {"automations": automations, "scheduled_jobs": jobs,
44
+ "counts": {"automations": len(automations), "scheduled_jobs": len(jobs)}}
45
+
46
+ @router.post("/trigger/{id}")
47
+ async def trigger_automation_route(id: str):
48
+ from backend.services.automation_service import trigger_automation
49
+ await trigger_automation(id)
50
+ return {"status": "triggered"}
51
+
52
+ @router.post("/pause_all")
53
+ async def pause_all():
54
+ from backend.services.automation_service import pause_all_automations
55
+ await pause_all_automations()
56
+ return {"status": "paused"}
57
+
58
+ @router.post("/resume_all")
59
+ async def resume_all():
60
+ from backend.services.automation_service import resume_all_automations
61
+ await resume_all_automations()
62
+ return {"status": "resumed"}
63
+
64
+ @router.post("/jobs/{job_id}/pause")
65
+ async def pause_single_job(job_id: str):
66
+ from backend.services.automation_service import pause_job
67
+ # APScheduler raises JobLookupError for an unknown id. Unhandled, that
68
+ # surfaced as a 500 "Internal Server Error" for what is really a client
69
+ # asking about a job that does not exist — a 404.
70
+ try:
71
+ pause_job(job_id)
72
+ except Exception as exc:
73
+ if "No job by the id" in str(exc):
74
+ raise HTTPException(status_code=404, detail=f"No job with id {job_id}")
75
+ raise
76
+ return {"status": f"job {job_id} paused"}
77
+
78
+ @router.post("/jobs/{job_id}/resume")
79
+ async def resume_single_job(job_id: str):
80
+ from backend.services.automation_service import resume_job
81
+ try:
82
+ resume_job(job_id)
83
+ except Exception as exc:
84
+ if "No job by the id" in str(exc):
85
+ raise HTTPException(status_code=404, detail=f"No job with id {job_id}")
86
+ raise
87
+ return {"status": f"job {job_id} resumed"}
88
+
89
+ @router.delete("/jobs/{job_id}")
90
+ async def delete_single_job(job_id: str):
91
+ from backend.services.automation_service import delete_job
92
+ delete_job(job_id)
93
+ return {"status": f"job {job_id} deleted"}
94
+
95
+ @router.post("/save")
96
+ async def save_workflow(w: Workflow):
97
+ """Persist a workflow.
98
+
99
+ This previously returned {"status": "saved"} without writing anything — the
100
+ Save action reported success and the workflow was gone on the next read.
101
+ automation_service.save_automation() is the real write path into the
102
+ `custom_automations` table that /list reads back.
103
+ """
104
+ from backend.services.automation_service import save_automation
105
+ if not (w.name or "").strip():
106
+ raise HTTPException(status_code=400, detail="name is required")
107
+ auto_id = re.sub(r"[^a-z0-9]+", "-", w.name.strip().lower()).strip("-") or "workflow"
108
+ try:
109
+ save_automation(
110
+ auto_id=auto_id,
111
+ trigger_type="manual",
112
+ trigger_data={},
113
+ action_type="workflow",
114
+ action_data={"name": w.name, "steps": w.steps},
115
+ )
116
+ except Exception as exc:
117
+ logging.exception("save_automation failed")
118
+ raise HTTPException(status_code=500, detail=str(exc))
119
+ return {"status": "saved", "id": auto_id, "steps": len(w.steps)}
120
+
121
+ @router.get("/history")
122
+ async def get_history():
123
+ # NOTE: intentionally empty — nothing in the system records automation run
124
+ # history yet. Flagged rather than faked; a real implementation needs a
125
+ # history table written by automation_service.execute_action.
126
+ return []
127
+
128
+ @router.post("/dry-run")
129
+ async def dry_run_workflow(w: Workflow):
130
+ """
131
+ Simulates workflow execution without side effects.
132
+ Returns a preview of the steps and their expected mock results.
133
+ """
134
+ import asyncio
135
+ preview_steps = []
136
+
137
+ for i, step in enumerate(w.steps):
138
+ # Determine a mock result based on step type if present
139
+ step_type = step.get('type', 'unknown') if isinstance(step, dict) else 'unknown'
140
+ mock_result = f"Mock result for {step_type}"
141
+ if step_type == 'api_call': mock_result = "HTTP 200 OK (Mock)"
142
+ elif step_type == 'script': mock_result = "Script execution simulated"
143
+ elif step_type == 'agent': mock_result = "Agent reasoning simulated"
144
+
145
+ preview_steps.append({
146
+ "step_index": i,
147
+ "step_config": step,
148
+ "expected_status": "success",
149
+ "mock_result": mock_result
150
+ })
151
+
152
+ # Simulate minor delay
153
+ await asyncio.sleep(0.1)
154
+
155
+ return {
156
+ "status": "dry-run-complete",
157
+ "total_steps": len(w.steps),
158
+ "execution_preview": preview_steps
159
+ }
backend/routes/internet_routes.py CHANGED
@@ -40,8 +40,13 @@ async def web_search(req: SearchRequest):
40
  async def fetch_url(req: FetchRequest):
41
  """Fetch and optionally summarise a URL using the browser tool."""
42
  try:
43
- from backend.tools.browser_tools import fetch_url as _fetch
44
- content = await _fetch(req.url)
 
 
 
 
 
45
  return {"status": "ok", "url": req.url, "content": content}
46
  except Exception as e:
47
  raise HTTPException(status_code=500, detail=str(e))
@@ -69,7 +74,13 @@ async def osint_recon(req: OsintRequest):
69
  all_results = []
70
  for q in queries:
71
  results = await search_web(q, num_results=3)
72
- all_results.extend(results)
 
 
 
 
 
 
73
 
74
  return {
75
  "status": "ok",
 
40
  async def fetch_url(req: FetchRequest):
41
  """Fetch and optionally summarise a URL using the browser tool."""
42
  try:
43
+ # browser_tools has never exported `fetch_url` (it exposes navigate /
44
+ # get_ephemeral_context), so this route was a guaranteed 500:
45
+ # "cannot import name 'fetch_url' from 'backend.tools.browser_tools'".
46
+ # The function that actually does this job — Playwright fetch, CAPTCHA
47
+ # handling, text extraction — is web_search_tools.fetch_page.
48
+ from backend.tools.web_search_tools import fetch_page
49
+ content = await fetch_page(req.url)
50
  return {"status": "ok", "url": req.url, "content": content}
51
  except Exception as e:
52
  raise HTTPException(status_code=500, detail=str(e))
 
74
  all_results = []
75
  for q in queries:
76
  results = await search_web(q, num_results=3)
77
+ # search_web returns {"results": [...]} (or {"error": ...}).
78
+ # extend()ing the dict itself appended its KEYS — so findings came
79
+ # back as ["results", "results", ...] instead of the actual hits.
80
+ if isinstance(results, dict):
81
+ all_results.extend(results.get("results", []))
82
+ elif isinstance(results, list):
83
+ all_results.extend(results)
84
 
85
  return {
86
  "status": "ok",
backend/routes/xr_routes.py CHANGED
@@ -1,4 +1,4 @@
1
- from fastapi import HTTPException, APIRouter
2
  from pydantic import BaseModel
3
 
4
  # AR-FIX-SESSION: import canonical AR scene store to mirror anchor writes.
@@ -107,19 +107,30 @@ async def handle_ar_task(payload: ArTaskPayload):
107
  return {"ok": True, "status": "dispatched", "message": f"Task '{payload.task}' sent to AR bus."}
108
 
109
  @router.get("/ar_config")
110
- async def get_ar_config():
111
  """
112
  Returns base configuration for the WebAR engine.
 
 
 
 
 
 
 
 
 
113
  """
114
- import os
 
 
115
  return {
116
  "ok": True,
117
  "deviceName": "OMEGA-CORE",
118
- "wsBase": f"ws://{os.environ.get('HOST', '127.0.0.1')}:5050",
119
  "gameUrls": {
120
- "eternum": "http://127.0.0.1:7474/games/eternum",
121
- "ripples": "http://127.0.0.1:7474/games/ripples"
122
- }
123
  }
124
 
125
  @router.post("/ar_scene_patch")
 
1
+ from fastapi import HTTPException, APIRouter, Request
2
  from pydantic import BaseModel
3
 
4
  # AR-FIX-SESSION: import canonical AR scene store to mirror anchor writes.
 
107
  return {"ok": True, "status": "dispatched", "message": f"Task '{payload.task}' sent to AR bus."}
108
 
109
  @router.get("/ar_config")
110
+ async def get_ar_config(request: Request):
111
  """
112
  Returns base configuration for the WebAR engine.
113
+
114
+ Everything here is derived from the *actual request*, never hardcoded. The
115
+ previous version returned ``ws://{HOST or 127.0.0.1}:5050`` and
116
+ ``http://127.0.0.1:7474/...`` unconditionally, which is wrong for every
117
+ client that is not on the same machine as the backend: a phone or headset
118
+ resolves 127.0.0.1 to itself, so the scene socket and game URLs could never
119
+ connect from the cloud deployment. Port 5050 was wrong too — the socket is
120
+ mounted at ``/scene-ws`` on this same app (backend/main.py), and a hosted
121
+ Space only exposes 443.
122
  """
123
+ base = str(request.base_url).rstrip("/") # e.g. https://host or http://127.0.0.1:7474
124
+ ws_base = "wss://" + base.split("://", 1)[1] if base.startswith("https://") \
125
+ else "ws://" + base.split("://", 1)[1]
126
  return {
127
  "ok": True,
128
  "deviceName": "OMEGA-CORE",
129
+ "wsBase": f"{ws_base}/scene-ws",
130
  "gameUrls": {
131
+ "eternum": f"{base}/games/eternum",
132
+ "ripples": f"{base}/games/ripples",
133
+ },
134
  }
135
 
136
  @router.post("/ar_scene_patch")
backend/services/usb_monitor.py CHANGED
@@ -7,6 +7,11 @@ if os.environ.get("CLOUD_ENV", "false").lower() != "true":
7
  else:
8
  wmi = None
9
  pythoncom = None
 
 
 
 
 
10
  import re
11
  import os
12
  import sys
@@ -178,7 +183,14 @@ async def start_usb_monitor():
178
  if wmi:
179
  try:
180
  def fetch_wmi_letters():
181
- c = wmi.WMI()
 
 
 
 
 
 
 
182
  mapping = {}
183
  for disk in c.Win32_DiskDrive():
184
  if "USB" in disk.InterfaceType:
 
7
  else:
8
  wmi = None
9
  pythoncom = None
10
+
11
+ # Cached WMI/COM connection reused by the 2-second monitor loop (see
12
+ # fetch_wmi_letters) instead of reconnecting on every single pass.
13
+ _WMI_CONN = None
14
+
15
  import re
16
  import os
17
  import sys
 
183
  if wmi:
184
  try:
185
  def fetch_wmi_letters():
186
+ # Reuse one COM connection. This runs every 2 seconds, so
187
+ # building a fresh wmi.WMI() each pass meant ~30 new COM
188
+ # connections per minute for the whole life of the app —
189
+ # wasteful, and a steady source of process churn on Windows.
190
+ global _WMI_CONN
191
+ if _WMI_CONN is None:
192
+ _WMI_CONN = wmi.WMI()
193
+ c = _WMI_CONN
194
  mapping = {}
195
  for disk in c.Win32_DiskDrive():
196
  if "USB" in disk.InterfaceType:
backend/tools/web_search_tools.py CHANGED
@@ -4,24 +4,99 @@ import json
4
  import urllib.request
5
  import urllib.parse
6
  import os
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
- async def search_web(query: str) -> dict:
9
- """Search web using Brave Search API (fallback to DuckDuckGo if no key)"""
10
- brave_api_key = os.environ.get("BRAVE_API_KEY")
11
-
12
- if not brave_api_key:
13
- # Fallback to DuckDuckGo
14
- def _duck_search():
15
- url = f"https://api.duckduckgo.com/?q={urllib.parse.quote(query)}&format=json"
16
- req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
17
- try:
18
- with urllib.request.urlopen(req, timeout=10) as response:
19
- data = json.loads(response.read().decode('utf-8'))
20
- return {"results": [{"title": "Abstract", "snippet": data.get('AbstractText', ''), "url": data.get('AbstractURL', '')}]}
21
- except Exception as e:
22
- return {"error": str(e)}
23
- return await asyncio.to_thread(_duck_search)
24
-
25
  def _brave_search():
26
  url = f"https://api.search.brave.com/res/v1/web/search?q={urllib.parse.quote(query)}"
27
  req = urllib.request.Request(url, headers={
@@ -39,17 +114,30 @@ async def search_web(query: str) -> dict:
39
 
40
  parsed = json.loads(data)
41
  results = []
42
- for item in parsed.get('web', {}).get('results', [])[:5]:
43
  results.append({
44
  "title": item.get("title"),
45
  "snippet": item.get("description"),
46
  "url": item.get("url")
47
  })
48
- return {"results": results}
49
  except Exception as e:
50
  return {"error": str(e)}
51
-
52
- return await asyncio.to_thread(_brave_search)
 
 
 
 
 
 
 
 
 
 
 
 
 
53
 
54
  async def fetch_page(url: str) -> dict:
55
  """Fetch page via Playwright, bypassing CAPTCHAs if encountered"""
 
4
  import urllib.request
5
  import urllib.parse
6
  import os
7
+ import logging
8
+
9
+ def _resolve_key(*names: str) -> str | None:
10
+ """Resolve a credential the way the rest of the backend does.
11
+
12
+ `get_secret` checks real environment variables first (how HF Spaces inject
13
+ secrets) and then the encrypted SQLite vault. Reading `os.environ` directly —
14
+ as this module used to — bypasses the vault entirely, so a key the user had
15
+ actually configured through the UI was invisible here.
16
+ """
17
+ for name in names:
18
+ if not name:
19
+ continue
20
+ try:
21
+ from backend.services.usb_vault import get_secret
22
+ value = get_secret(name)
23
+ except Exception:
24
+ value = os.environ.get(name)
25
+ if value:
26
+ return value
27
+ return None
28
+
29
+
30
+ async def search_web(query: str, num_results: int = 5) -> dict:
31
+ """Web search: Brave (primary) -> SerpAPI (fallback) -> DuckDuckGo (last resort).
32
+
33
+ Two real bugs fixed here.
34
+
35
+ 1. ``num_results`` did not exist, yet every caller passed it —
36
+ internet_routes.py (search + osint) and sentinel_routes.py. All three
37
+ routes were a hard 500:
38
+ ``search_web() got an unexpected keyword argument 'num_results'``.
39
+ The result cap was also hardcoded at 5; it is now honoured.
40
+
41
+ 2. The Brave credential was looked up as ``BRAVE_API_KEY`` via a raw
42
+ ``os.environ`` read, but the system provisions it as
43
+ ``BRAVE_SEARCH_API_KEY`` (src-tauri/src/key_registry.rs) and stores it in
44
+ the encrypted vault. The name never matched and the vault was never
45
+ consulted, so Brave was *always* skipped and every search silently fell
46
+ through to DuckDuckGo's instant-answer endpoint — which returns a single,
47
+ usually empty "Abstract" and ignores the result count. For an assistant
48
+ whose whole point is live research, that is a broken capability that
49
+ reports success.
50
+
51
+ SerpAPI is now wired as the real fallback; key_registry.rs already describes
52
+ ``SERPAPI_KEY`` as the "Google/Bing search fallback", but nothing used it, so
53
+ the documented main+fallback pair did not actually exist.
54
+ """
55
+ try:
56
+ num_results = max(1, min(int(num_results), 20))
57
+ except (TypeError, ValueError):
58
+ num_results = 5
59
+
60
+ brave_api_key = _resolve_key("BRAVE_SEARCH_API_KEY", "BRAVE_API_KEY")
61
+ serpapi_key = _resolve_key("SERPAPI_KEY")
62
+
63
+ def _duck_search():
64
+ url = f"https://api.duckduckgo.com/?q={urllib.parse.quote(query)}&format=json"
65
+ req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
66
+ try:
67
+ with urllib.request.urlopen(req, timeout=10) as response:
68
+ data = json.loads(response.read().decode('utf-8'))
69
+ results = []
70
+ abstract = data.get('AbstractText') or ''
71
+ if abstract:
72
+ results.append({"title": data.get('Heading') or "Abstract",
73
+ "snippet": abstract, "url": data.get('AbstractURL', '')})
74
+ # RelatedTopics is the only part of the instant-answer API that
75
+ # returns more than one item, so honour num_results instead of
76
+ # always returning a single (often empty) abstract.
77
+ for topic in data.get('RelatedTopics', []):
78
+ if len(results) >= num_results:
79
+ break
80
+ if isinstance(topic, dict) and topic.get('Text'):
81
+ results.append({"title": topic.get('Text', '')[:80],
82
+ "snippet": topic.get('Text', ''),
83
+ "url": topic.get('FirstURL', '')})
84
+ return {"results": results[:num_results]}
85
+ except Exception as e:
86
+ return {"error": str(e)}
87
+
88
+ def _serpapi_search():
89
+ url = ("https://serpapi.com/search.json?q=" + urllib.parse.quote(query)
90
+ + f"&num={num_results}&api_key={urllib.parse.quote(serpapi_key)}")
91
+ try:
92
+ with urllib.request.urlopen(url, timeout=12) as response:
93
+ parsed = json.loads(response.read().decode('utf-8'))
94
+ results = [{"title": i.get("title"), "snippet": i.get("snippet"), "url": i.get("link")}
95
+ for i in parsed.get("organic_results", [])[:num_results]]
96
+ return {"results": results} if results else {"error": "serpapi returned no results"}
97
+ except Exception as e:
98
+ return {"error": str(e)}
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  def _brave_search():
101
  url = f"https://api.search.brave.com/res/v1/web/search?q={urllib.parse.quote(query)}"
102
  req = urllib.request.Request(url, headers={
 
114
 
115
  parsed = json.loads(data)
116
  results = []
117
+ for item in parsed.get('web', {}).get('results', [])[:num_results]:
118
  results.append({
119
  "title": item.get("title"),
120
  "snippet": item.get("description"),
121
  "url": item.get("url")
122
  })
123
+ return {"results": results} if results else {"error": "brave returned no results"}
124
  except Exception as e:
125
  return {"error": str(e)}
126
+
127
+ # Primary -> fallback -> last resort. A provider is only considered to have
128
+ # worked if it actually returned results; an empty 200 falls through, so a
129
+ # rate-limited or misconfigured primary degrades instead of silently
130
+ # returning nothing to the assistant.
131
+ for provider, available in ((_brave_search, brave_api_key),
132
+ (_serpapi_search, serpapi_key)):
133
+ if not available:
134
+ continue
135
+ out = await asyncio.to_thread(provider)
136
+ if out.get("results"):
137
+ return out
138
+ logging.warning("web search provider %s failed (%s); trying next",
139
+ provider.__name__, out.get("error"))
140
+ return await asyncio.to_thread(_duck_search)
141
 
142
  async def fetch_page(url: str) -> dict:
143
  """Fetch page via Playwright, bypassing CAPTCHAs if encountered"""
webar/assets/ar-compositor-Bfg5JfIW.js ADDED
@@ -0,0 +1 @@
 
 
1
+ import{n as e}from"./ar-init-CHktDPD4.js";export{e as initVrStereoSplitScreen};
webar/assets/ar-init-CHktDPD4.js ADDED
The diff for this file is too large to render. See raw diff
 
webar/assets/index-BGn3T9gi.css ADDED
@@ -0,0 +1 @@
 
 
1
+ :root{--glass-bg:#0a161e6b;--glass-bg-hover:#12222c8c;--glass-bg-active:#35e6ff24;--glass-border:#78dcff33;--glass-border-strong:#78dcff57;--glass-blur:40px;--glass-saturate:180%;--glass-radius:18px;--glass-radius-sm:12px;--glass-radius-lg:26px;--glass-shadow:0 14px 40px #00000080, inset 0 1px 0 #b4f0ff1f, 0 0 0 .5px #00000059;--glass-shadow-deep:0 22px 60px #0009, inset 0 1px 0 #b4f0ff29;--accent:#35e6ff;--accent-glow:#35e6ff59;--accent-pressed:#14c3e0;--amber:#ffb454;--amber-glow:#ffb45466;--text-primary:#dff3fb;--text-secondary:#dff3fb9e;--text-tertiary:#7d99a6d9;--text-placeholder:#7d99a680;--bg-dark:#070f15db;--bg-darker:#03070cf0;--destructive:#ff5470;--destructive-glow:#ff547061;--success:#5ce0a8;--warning:var(--amber);--separator:#78dcff1f;--font:"Chakra Petch", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;--font-mono:"JetBrains Mono", ui-monospace, monospace;--font-large-title:700 34px/1.2 var(--font);--font-title1:600 28px/1.3 var(--font);--font-title2:600 22px/1.3 var(--font);--font-title3:600 20px/1.4 var(--font);--font-headline:600 17px/1.4 var(--font);--font-body:400 17px/1.5 var(--font);--font-callout:400 16px/1.5 var(--font);--font-subheadline:400 15px/1.5 var(--font);--font-footnote:400 13px/1.5 var(--font);--font-caption:400 12px/1.4 var(--font);--letter-spacing-tight:0;--letter-spacing-body:0}*{box-sizing:border-box}html,body{background:var(--bg-darker);width:100vw;height:100vh;color:var(--text-primary);font-family:var(--font);letter-spacing:0;touch-action:none;-webkit-font-smoothing:antialiased;margin:0;overflow:hidden}button,input,textarea,select{font:inherit}button{-webkit-tap-highlight-color:transparent}#camerafeed{z-index:0;background:var(--bg-darker);width:100%;height:100%;display:block;position:fixed;top:0;bottom:0;left:0;right:0}#ar-scene{z-index:1;width:100vw;height:100vh;position:fixed;top:0;bottom:0;left:0;right:0;background:0 0!important}#css3d-layer{z-index:2;pointer-events:none;width:100vw;height:100vh;transform-style:preserve-3d;position:fixed;top:0;bottom:0;left:0;right:0;overflow:hidden}#hand-overlay{z-index:4;pointer-events:none;width:100vw;height:100vh;position:fixed;top:0;bottom:0;left:0;right:0}#world-label-layer{z-index:5;pointer-events:none;position:fixed;top:0;bottom:0;left:0;right:0}#ui-layer{z-index:10;pointer-events:none;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);position:fixed;top:0;bottom:0;left:0;right:0;overflow:hidden}.glass-panel{background:var(--glass-bg);-webkit-backdrop-filter:blur(28px)saturate(1.35);border:1px solid var(--glass-border);border-radius:var(--glass-radius);box-shadow:var(--glass-shadow);position:relative;overflow:hidden}.glass-panel:before{content:"";border-radius:inherit;-webkit-mask-composite:xor;pointer-events:none;z-index:1;background:linear-gradient(135deg,#ffffff47 0%,#ffffff14 30%,#ffffff04 60%,#00000014 100%);padding:1px;position:absolute;top:0;bottom:0;left:0;right:0;-webkit-mask-image:linear-gradient(#fff 0 0),linear-gradient(#fff 0 0);-webkit-mask-position:0 0,0 0;-webkit-mask-size:auto,auto;-webkit-mask-repeat:repeat,repeat;-webkit-mask-clip:content-box,border-box;-webkit-mask-origin:content-box,border-box;-webkit-mask-composite:xor;mask-composite:exclude;-webkit-mask-source-type:auto,auto;mask-mode:match-source,match-source}.glass-panel>*{z-index:2;position:relative}.vibrancy-text{color:var(--text-primary);text-shadow:0 1px 3px #0009,0 0 8px #0000004d}.btn-primary{background:var(--accent);min-width:120px;min-height:50px;color:var(--text-primary);font:var(--font-headline);cursor:pointer;border:0;border-radius:50px;padding:14px 28px;transition:background .1s,transform .1s}.btn-primary:active{background:var(--accent-pressed);transform:scale(.97)}.btn-symbol{width:60px;height:60px;color:var(--text-tertiary);cursor:pointer;-webkit-backdrop-filter:blur(20px);background:0 0;border:1px solid #0000;border-radius:15px;justify-content:center;align-items:center;transition:background .18s,color .18s,border-color .18s,box-shadow .18s;display:flex}.btn-symbol .icon{letter-spacing:.04em;justify-content:center;align-items:center;min-width:24px;min-height:24px;font-size:15px;font-weight:700;display:inline-flex}.btn-symbol:hover{color:var(--text-primary);background:#35e6ff14}.btn-symbol:active{background:var(--glass-bg-active)}.btn-symbol.selected{border-color:var(--glass-border-strong);color:var(--accent);box-shadow:0 0 22px var(--accent-glow);background:#35e6ff24}.panel-close{background:var(--destructive);cursor:pointer;z-index:10;border:0;border-radius:50%;width:52px;height:52px;margin:-8px;padding:0;position:absolute;top:12px;left:12px}.ornament{background:var(--glass-bg);-webkit-backdrop-filter:blur(var(--glass-blur));border:1px solid var(--glass-border);box-shadow:var(--glass-shadow);white-space:nowrap;border-radius:50px;align-items:center;gap:4px;padding:8px;display:flex;position:absolute;bottom:-56px;left:50%;transform:translate(-50%)}.panel-drag-handle{cursor:grab;border-radius:var(--glass-radius) var(--glass-radius) 0 0;z-index:5;height:56px;position:absolute;top:0;left:0;right:0}.panel-drag-handle:active{cursor:grabbing}.panel-resize-handle{cursor:se-resize;border-radius:0 0 var(--glass-radius) 0;z-index:5;background:linear-gradient(135deg,#0000 50%,#fff3 50%);width:40px;height:40px;position:absolute;bottom:0;right:0}body.vision-pro-reduced-motion .glass-panel{-webkit-backdrop-filter:blur(18px)saturate(1.15)}body.vision-pro-reduced-motion .glass-panel:before{background:linear-gradient(135deg,#ffffff2e 0%,#ffffff0d 30%,#ffffff03 60%,#0000000d 100%)}body.vision-pro-reduced-motion .btn-primary,body.vision-pro-reduced-motion .btn-symbol,body.vision-pro-reduced-motion .panel-close{transition:none}body.vision-pro-reduced-motion .panel-drag-handle{cursor:default}@media (max-width:430px){:root{--glass-radius:18px;--glass-blur:32px}.ar-panel{max-width:calc(100vw - 16px);width:calc(100vw - 16px)!important}.hud-toolbar{left:8px;right:8px;bottom:calc(10px + env(safe-area-inset-bottom));gap:6px;padding:8px}.btn-symbol{flex:0 0 56px;width:56px;height:56px}}@media (orientation:landscape) and (max-height:520px){.hud-toolbar{top:calc(10px + env(safe-area-inset-top));bottom:auto;left:calc(8px + env(safe-area-inset-left));width:72px;max-height:calc(100vh - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom));flex-direction:column;right:auto}.status-panel{top:calc(10px + env(safe-area-inset-top));left:92px;right:calc(12px + env(safe-area-inset-right));bottom:auto}}@media (min-width:720px){.ar-panel{width:clamp(340px,38vw,520px)}}.loading-screen{z-index:30;background:radial-gradient(circle at 50% 42%,#007aff38,#000000e0 58%);justify-content:center;align-items:center;padding:20px;display:flex;position:fixed;top:0;bottom:0;left:0;right:0}.loading-screen.hidden,.hidden{display:none!important}.loading-card{pointer-events:auto;text-align:center;width:clamp(288px,92vw,420px);padding:24px}.loading-ring{border:2px solid #ffffff29;border-top-color:var(--accent);border-radius:50%;width:96px;height:96px;margin:0 auto 18px;animation:1.2s linear infinite spin}.caption{color:var(--text-secondary);font:var(--font-caption);text-transform:uppercase;margin:0 0 8px}.loading-card h1{font:var(--font-title1);margin:0 0 8px}.loading-card p{color:var(--text-secondary);font:var(--font-subheadline);margin:0 0 18px}.progress-track{background:#ffffff1f;border-radius:99px;height:4px;margin:0 0 20px;overflow:hidden}.progress-track span{border-radius:inherit;background:var(--accent);width:14%;height:100%;box-shadow:0 0 18px var(--accent-glow);transition:width .25s;display:block}.hud-toolbar{left:calc(12px + env(safe-area-inset-left));right:calc(12px + env(safe-area-inset-right));bottom:calc(14px + env(safe-area-inset-bottom));z-index:15;pointer-events:auto;scrollbar-width:none;justify-content:center;gap:8px;padding:10px;display:flex;position:fixed;overflow-x:auto}.hud-toolbar::-webkit-scrollbar{display:none}.status-panel{top:calc(12px + env(safe-area-inset-top));left:calc(12px + env(safe-area-inset-left));right:calc(12px + env(safe-area-inset-right));z-index:15;pointer-events:none;grid-template-columns:repeat(3,1fr);gap:8px;padding:10px 12px;display:grid;position:fixed}.status-panel span{color:var(--text-tertiary);font:var(--font-caption);letter-spacing:.18em;text-transform:uppercase;margin-bottom:3px;display:block}.status-panel strong{color:var(--accent);font:500 12px/1.25 var(--font-mono);letter-spacing:.02em;text-overflow:ellipsis;text-transform:uppercase;white-space:nowrap;display:block;overflow:hidden}.ar-panel{z-index:12;pointer-events:auto;width:clamp(280px,90vw,400px);min-height:220px;max-height:min(74vh,640px);padding:18px;transition:box-shadow .18s,transform 80ms;position:fixed;transform:translate(16px,96px)}.ar-panel.active{box-shadow:var(--glass-shadow-deep), 0 0 42px var(--accent-glow)}.ar-panel header{justify-content:space-between;align-items:center;gap:12px;height:44px;padding-left:34px;display:flex}.ar-panel h2{min-width:0;font:var(--font-title3);text-overflow:ellipsis;white-space:nowrap;margin:0;overflow:hidden}.panel-minimize{flex:0 0 48px;width:48px;height:48px}.panel-body{scrollbar-width:thin;max-height:calc(min(74vh,640px) - 80px);padding:6px 2px 2px;overflow:auto}.panel-body input,.panel-body select,.panel-body textarea{border:1px solid var(--separator);width:100%;min-height:46px;color:var(--text-primary);background:#00000038;border-radius:14px;outline:0;margin:6px 0;padding:12px 14px}.panel-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;display:grid}.panel-row{align-items:center;gap:8px;display:flex}.panel-action{border:1px solid var(--glass-border);min-height:46px;color:var(--text-primary);cursor:pointer;background:#ffffff14;border-radius:14px;padding:10px 12px}.panel-action:active{background:var(--glass-bg-active);transform:scale(.98)}.panel-list{gap:8px;margin:12px 0;display:grid}.model-card{border:1px solid var(--separator);background:#ffffff0f;border-radius:14px;grid-template-columns:1fr auto;align-items:center;gap:8px;min-height:54px;padding:10px;display:grid}.model-card strong,.model-card span{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.model-card span{color:var(--text-secondary);font:var(--font-caption)}.sketchfab-panel{border:1px solid var(--separator);background:#ffffff0d;border-radius:16px;gap:8px;margin:12px 0;padding:12px;display:grid}.sketchfab-panel strong{font:var(--font-headline)}.panel-note{color:var(--text-secondary);font:var(--font-footnote);margin:0}.inline-row{grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:8px;display:grid}.inline-row .panel-action{min-width:72px}.sketchfab-results{max-height:280px;padding-right:2px;overflow:auto}.sketchfab-card{grid-template-columns:68px minmax(0,1fr);align-items:stretch}.sketchfab-card img{object-fit:cover;background:#00000052;border-radius:12px;align-self:center;width:68px;height:68px}.sketchfab-card>div:first-of-type{gap:2px;min-width:0;display:grid}.sketchfab-card a{min-width:0;color:var(--text-secondary);font:var(--font-caption);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.model-actions{grid-column:1/-1;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;display:grid}.link-action{justify-content:center;align-items:center;min-height:46px;text-decoration:none;display:inline-flex}.jarvis-bubble{left:50%;bottom:calc(98px + env(safe-area-inset-bottom));z-index:20;pointer-events:none;width:min(390px,100vw - 24px);padding:14px 16px;position:fixed;transform:translate(-50%)}.jarvis-bubble span{color:var(--accent);font:700 11px/1 var(--font);letter-spacing:.3em;text-transform:uppercase;margin-bottom:4px;display:block}.jarvis-bubble p{color:var(--text-primary);font:var(--font-callout);margin:0}#error-host,#banner-host{z-index:25;pointer-events:none;position:fixed;left:12px;right:12px}#error-host{top:calc(78px + env(safe-area-inset-top))}#banner-host{top:calc(152px + env(safe-area-inset-top))}.error-panel,.banner-panel{pointer-events:auto;width:min(520px,100vw - 24px);margin:0 auto 8px;padding:12px 14px}.error-panel{box-shadow:var(--glass-shadow), 0 0 28px var(--destructive-glow);border-color:#ff3b3073}.error-panel strong,.banner-panel strong{font:var(--font-headline);margin-bottom:4px;display:block}.error-panel p,.banner-panel p{color:var(--text-secondary);font:var(--font-footnote);margin:0}.error-panel a{color:var(--text-primary)}.context-menu{z-index:22;pointer-events:auto;gap:6px;width:190px;padding:8px;display:grid;position:fixed}.context-menu button{min-height:42px;color:var(--text-primary);background:#ffffff14;border:0;border-radius:12px}.game-frame{background:var(--bg-darker);border:0;width:100%;height:100%}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{0%,to{opacity:.72;transform:scale(1)}50%{opacity:1;transform:scale(1.08)}}@keyframes riseIn{0%{opacity:0;transform:translate(-50%,14px)}to{opacity:1;transform:translate(-50%)}}.jarvis-bubble:not(.hidden){animation:.22s ease-out riseIn}.loading-ring{animation:1.2s linear infinite spin}.pinch-cursor{animation:1.4s ease-in-out infinite pulse}@media (prefers-reduced-motion:reduce){*,:before,:after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}
webar/assets/index-DCOWBc_V.js ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ar-init-CHktDPD4.js","./mediapipe-Ck-u_eH7.js","./three-Bwrc_W3C.js","./rolldown-runtime-DK3Fl9T5.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./mediapipe-Ck-u_eH7.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var t=`jarvis_omega_session_credentials_v1`,n=`/xr/ar_config`;function r(){try{return localStorage.getItem(t)||``}catch{return``}}function i(e){try{localStorage.setItem(t,String(e||``).trim())}catch{}}function a(){try{let e=new URLSearchParams(location.search),t=String(e.get(`omega`)||e.get(`omegaBridge`)||``).trim();if(t)return`${t.replace(/\/+$/,``)}${n}`}catch{}return n}async function o(e){try{return(await fetch(a(),{headers:{Authorization:`Bearer ${e}`},cache:`no-store`})).status===200}catch{return!1}}async function s(){await e(()=>import(`./ar-init-CHktDPD4.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)}function c(){let e=document.createElement(`div`);return e.id=`omega-access-gate`,e.innerHTML=`
3
+ <style>
4
+ #omega-access-gate {
5
+ position: fixed; inset: 0; z-index: 100000;
6
+ display: flex; align-items: center; justify-content: center;
7
+ background:
8
+ radial-gradient(120% 90% at 50% -10%, rgba(11,132,255,0.18), transparent 60%),
9
+ radial-gradient(80% 70% at 50% 120%, rgba(0,224,198,0.10), transparent 55%),
10
+ #05070b;
11
+ font-family: 'Inter', system-ui, sans-serif;
12
+ -webkit-tap-highlight-color: transparent;
13
+ animation: gateFade .5s ease both;
14
+ }
15
+ @keyframes gateFade { from { opacity: 0 } to { opacity: 1 } }
16
+ #omega-access-gate .card {
17
+ width: min(92vw, 380px);
18
+ padding: 34px 30px 28px;
19
+ border-radius: 22px;
20
+ background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
21
+ border: 1px solid rgba(120,180,255,0.18);
22
+ box-shadow: 0 30px 80px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.06);
23
+ backdrop-filter: blur(22px) saturate(140%);
24
+ text-align: center;
25
+ }
26
+ #omega-access-gate .ring {
27
+ width: 62px; height: 62px; margin: 0 auto 18px;
28
+ border-radius: 50%;
29
+ display: grid; place-items: center;
30
+ background: radial-gradient(circle at 50% 35%, rgba(11,132,255,0.35), rgba(11,132,255,0.06));
31
+ border: 1px solid rgba(120,180,255,0.4);
32
+ box-shadow: 0 0 30px rgba(11,132,255,0.35);
33
+ }
34
+ #omega-access-gate .ring svg { width: 26px; height: 26px; stroke: #cfe6ff; }
35
+ #omega-access-gate h1 {
36
+ margin: 0; font-size: 19px; font-weight: 700; letter-spacing: .3px; color: #eaf2ff;
37
+ }
38
+ #omega-access-gate p {
39
+ margin: 8px 0 22px; font-size: 12.5px; line-height: 1.5; color: rgba(200,216,240,0.62);
40
+ }
41
+ #omega-access-gate .field {
42
+ display: flex; gap: 8px; align-items: center;
43
+ background: rgba(0,0,0,0.35);
44
+ border: 1px solid rgba(120,180,255,0.22);
45
+ border-radius: 13px; padding: 4px 4px 4px 14px;
46
+ transition: border-color .2s, box-shadow .2s;
47
+ }
48
+ #omega-access-gate .field.focus { border-color: rgba(11,132,255,0.7); box-shadow: 0 0 0 3px rgba(11,132,255,0.18); }
49
+ #omega-access-gate .field.error { border-color: rgba(255,90,90,0.8); box-shadow: 0 0 0 3px rgba(255,90,90,0.16); }
50
+ #omega-access-gate input {
51
+ flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
52
+ color: #eaf2ff; font-size: 15px; letter-spacing: 1px; padding: 12px 0;
53
+ }
54
+ #omega-access-gate input::placeholder { color: rgba(200,216,240,0.35); letter-spacing: .3px; }
55
+ #omega-access-gate button {
56
+ border: 0; cursor: pointer;
57
+ width: 46px; height: 42px; border-radius: 10px;
58
+ background: linear-gradient(180deg, #1b8bff, #0a6be0);
59
+ color: #fff; font-size: 18px; display: grid; place-items: center;
60
+ transition: filter .15s, transform .1s;
61
+ }
62
+ #omega-access-gate button:hover { filter: brightness(1.08); }
63
+ #omega-access-gate button:active { transform: scale(0.94); }
64
+ #omega-access-gate button[disabled] { opacity: .55; cursor: default; }
65
+ #omega-access-gate .msg { margin-top: 14px; font-size: 12px; min-height: 16px; color: rgba(255,120,120,0.9); }
66
+ #omega-access-gate .foot { margin-top: 18px; font-size: 10.5px; color: rgba(200,216,240,0.32); letter-spacing: .4px; }
67
+ #omega-access-gate .spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.35); border-top-color:#fff; border-radius:50%; animation: gateSpin .7s linear infinite; }
68
+ @keyframes gateSpin { to { transform: rotate(360deg) } }
69
+ </style>
70
+ <div class="card" role="dialog" aria-label="OMEGA access">
71
+ <div class="ring">
72
+ <svg viewBox="0 0 24 24" fill="none" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round">
73
+ <rect x="4.5" y="10.5" width="15" height="10" rx="2.2"></rect>
74
+ <path d="M8 10.5V7.5a4 4 0 0 1 8 0v3"></path>
75
+ <circle cx="12" cy="15.4" r="1.3"></circle>
76
+ </svg>
77
+ </div>
78
+ <h1>OMEGA Access</h1>
79
+ <p>Enter your cloud access key to unlock the AR system.</p>
80
+ <div class="field" id="gate-field">
81
+ <input id="gate-input" type="password" inputmode="text" autocomplete="current-password"
82
+ placeholder="Access key" aria-label="Access key" />
83
+ <button id="gate-go" aria-label="Unlock">→</button>
84
+ </div>
85
+ <div class="msg" id="gate-msg"></div>
86
+ <div class="foot">JARVIS · FRIDAY · OMEGA</div>
87
+ </div>`,e}async function l(e,{field:t,input:n,go:r,msg:a},c){let l=String(e||n?.value||``).trim();if(!l){u(t,a,`Enter your access key.`);return}if(r.innerHTML=`<span class="spin"></span>`,r.disabled=!0,!await o(l)){r.disabled=!1,r.textContent=`→`,u(t,a,`Incorrect access key.`),n&&(n.value=``,n.focus());return}i(l),a.style.color=`rgba(0,224,198,0.9)`,a.textContent=`Access granted.`,c.style.transition=`opacity .45s ease`,c.style.opacity=`0`,setTimeout(()=>c.remove(),460),await s()}function u(e,t,n){t.style.color=`rgba(255,120,120,0.9)`,t.textContent=n,e.classList.add(`error`),setTimeout(()=>e.classList.remove(`error`),900)}async function d(){let e=r();if(e&&await o(e)){await s();return}let t=c();document.body.appendChild(t);let n=t.querySelector(`#gate-field`),i=t.querySelector(`#gate-input`),a=t.querySelector(`#gate-go`),u=t.querySelector(`#gate-msg`),d={field:n,input:i,go:a,msg:u};i.addEventListener(`focus`,()=>n.classList.add(`focus`)),i.addEventListener(`blur`,()=>n.classList.remove(`focus`)),i.addEventListener(`input`,()=>{u.textContent=``}),i.addEventListener(`keydown`,e=>{e.key===`Enter`&&l(null,d,t)}),a.addEventListener(`click`,()=>l(null,d,t)),setTimeout(()=>i.focus(),300)}document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,d,{once:!0}):d();
webar/assets/physics-Cz5QREtR.js ADDED
The diff for this file is too large to render. See raw diff
 
webar/external/xr/xr-face.js CHANGED
The diff for this file is too large to render. See raw diff
 
webar/external/xr/xr-slam.js CHANGED
The diff for this file is too large to render. See raw diff
 
webar/external/xr/xr.js CHANGED
The diff for this file is too large to render. See raw diff
 
webar/index.html CHANGED
@@ -92,9 +92,27 @@
92
  ar-init.js runs and <a-scene> can initialise normally.
93
  Pinned at v1.6.0; update by changing the version in both src and the integrity hash.
94
  -->
95
- <script src="https://cdn.jsdelivr.net/npm/aframe@1.6.0/dist/aframe.min.js"
96
- crossorigin="anonymous"
97
- data-jarvis-aframe="true"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
  <!--
100
  BUG 32 FIX — XR binary loaded statically so XR8 is always attempted even
@@ -119,9 +137,9 @@
119
  <script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands.js" crossorigin="anonymous"></script>
120
  <script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js" crossorigin="anonymous"></script>
121
  <script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.5.0/model-viewer.min.js" crossorigin="anonymous"></script>
122
- <script type="module" crossorigin src="./assets/index-Cl3oi4RS.js"></script>
123
  <link rel="modulepreload" crossorigin href="./assets/mediapipe-Ck-u_eH7.js">
124
- <link rel="stylesheet" crossorigin href="./assets/index-Io0-fChA.css">
125
  </head>
126
  <body>
127
  <canvas id="camerafeed" aria-label="Live rear camera AR feed"></canvas>
 
92
  ar-init.js runs and <a-scene> can initialise normally.
93
  Pinned at v1.6.0; update by changing the version in both src and the integrity hash.
94
  -->
95
+ <!--
96
+ A-Frame is deliberately NOT loaded. History, so this isn't "fixed" back:
97
+
98
+ The tag used to point at aframe@1.6.0/dist/aframe.min.js, which 404s on
99
+ jsDelivr (the real filename is aframe-master.min.js). So `window.AFRAME` has
100
+ never been defined in production, and every page load paid for a failed
101
+ request. Its only consumer was the physics tick in ar-physics.js, which
102
+ silently no-op'd behind `if (window.AFRAME)` — physics never stepped once.
103
+
104
+ Correcting the URL was tried and measured in a real browser: A-Frame ships its
105
+ own copy of three.js, which produced "WARNING: Multiple instances of Three.js
106
+ being imported" plus a CONTEXT_LOST_WEBGL against the app's own renderer.
107
+ A-Frame is not the renderer here — <a-scene> below is display:none and the live
108
+ context comes from XR8 or the fallback THREE canvas (utils/scene-db.js
109
+ getSceneContext/ensureFallbackThree) — so loading it buys nothing and costs a
110
+ duplicate WebGL/three stack.
111
+
112
+ The physics tick now runs on the app's own managed RAF loop instead, so nothing
113
+ depends on A-Frame. The <a-scene> block below is inert without it, which is
114
+ exactly how production has always behaved.
115
+ -->
116
 
117
  <!--
118
  BUG 32 FIX — XR binary loaded statically so XR8 is always attempted even
 
137
  <script src="https://cdn.jsdelivr.net/npm/@mediapipe/hands/hands.js" crossorigin="anonymous"></script>
138
  <script src="https://cdn.jsdelivr.net/npm/@mediapipe/camera_utils/camera_utils.js" crossorigin="anonymous"></script>
139
  <script type="module" src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.5.0/model-viewer.min.js" crossorigin="anonymous"></script>
140
+ <script type="module" crossorigin src="./assets/index-DCOWBc_V.js"></script>
141
  <link rel="modulepreload" crossorigin href="./assets/mediapipe-Ck-u_eH7.js">
142
+ <link rel="stylesheet" crossorigin href="./assets/index-BGn3T9gi.css">
143
  </head>
144
  <body>
145
  <canvas id="camerafeed" aria-label="Live rear camera AR feed"></canvas>
webar/ui/hud.css CHANGED
@@ -353,12 +353,19 @@
353
  pointer-events: none;
354
  }
355
 
 
 
 
 
 
 
 
356
  #error-host {
357
- top: calc(14px + env(safe-area-inset-top));
358
  }
359
 
360
  #banner-host {
361
- top: calc(78px + env(safe-area-inset-top));
362
  }
363
 
364
  .error-panel,
 
353
  pointer-events: none;
354
  }
355
 
356
+ /*
357
+ Both hosts must clear .status-panel, which is fixed at top:12px and ~50px tall.
358
+ #error-host was at top:14px with z-index 25 against the status panel's 15, so an
359
+ error card landed directly on top of the CAMERA / TRACKING / OMEGA readout and
360
+ hid the very state the user needs while something is failing. #banner-host had
361
+ already been cleared to 78px; the error host had not.
362
+ */
363
  #error-host {
364
+ top: calc(78px + env(safe-area-inset-top));
365
  }
366
 
367
  #banner-host {
368
+ top: calc(152px + env(safe-area-inset-top));
369
  }
370
 
371
  .error-panel,