DefectRAG phase 5: incremental real-model application migration
Browse files- README.md +1 -1
- deployment/space/app.py +2 -1
- deployment/space/verify_final_cpu.py +44 -0
- deployment/space/verify_rpc_anonymous.py +36 -0
- deployment/space/verify_staff_artifacts.py +56 -0
- frontend/dist/assets/TeamWorkspace-DW8NTaM7.js +41 -0
- frontend/dist/assets/index-lxOeBgSd.js +0 -0
- frontend/dist/index.html +1 -1
README.md
CHANGED
|
@@ -12,7 +12,7 @@ pinned: false
|
|
| 12 |
short_description: Live React dashboard and DINOv2 inspection on ZeroGPU
|
| 13 |
---
|
| 14 |
|
| 15 |
-
# DefectRAG — migration phase
|
| 16 |
|
| 17 |
Existing React UI, real frozen DINOv2 inspection across all 12 VisA categories,
|
| 18 |
original normal-reference banks, calibration and heatmaps. No training rerun.
|
|
|
|
| 12 |
short_description: Live React dashboard and DINOv2 inspection on ZeroGPU
|
| 13 |
---
|
| 14 |
|
| 15 |
+
# DefectRAG — migration phase 5
|
| 16 |
|
| 17 |
Existing React UI, real frozen DINOv2 inspection across all 12 VisA categories,
|
| 18 |
original normal-reference banks, calibration and heatmaps. No training rerun.
|
deployment/space/app.py
CHANGED
|
@@ -212,7 +212,8 @@ def assistant(inspection_id: str, question: str, session: str, token: str='') ->
|
|
| 212 |
def health():
|
| 213 |
return {'data':{'status':'ok','mode':'cloud_session_workspace','models':list(CARDS.values()),
|
| 214 |
'encoder_configured':True,'llm_model':'Qwen3-4B-Instruct-2507' if WORKFLOW and ZERO else 'Qwen2.5:3b (local Ollama)' if WORKFLOW else 'generation migration in progress','zero_gpu':ZERO,
|
| 215 |
-
'
|
|
|
|
| 216 |
|
| 217 |
|
| 218 |
def artifact(identifier: str,kind: str):
|
|
|
|
| 212 |
def health():
|
| 213 |
return {'data':{'status':'ok','mode':'cloud_session_workspace','models':list(CARDS.values()),
|
| 214 |
'encoder_configured':True,'llm_model':'Qwen3-4B-Instruct-2507' if WORKFLOW and ZERO else 'Qwen2.5:3b (local Ollama)' if WORKFLOW else 'generation migration in progress','zero_gpu':ZERO,
|
| 215 |
+
'staff_persistence_enabled':CLOUD_CONFIG is not None,
|
| 216 |
+
'history':'anonymous browser history is temporary; signed-in approved staff use Supabase' if CLOUD_CONFIG else 'anonymous browser history is temporary; staff backend disabled'}}
|
| 217 |
|
| 218 |
|
| 219 |
def artifact(identifier: str,kind: str):
|
deployment/space/verify_final_cpu.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""CPU-only public deployment boundaries; no model jobs or database writes."""
|
| 2 |
+
import hashlib
|
| 3 |
+
import json
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
import re
|
| 6 |
+
import secrets
|
| 7 |
+
import httpx
|
| 8 |
+
|
| 9 |
+
ROOT=Path(__file__).resolve().parents[2]
|
| 10 |
+
TARGET='https://wizzas-defectrag.hf.space'
|
| 11 |
+
|
| 12 |
+
def main():
|
| 13 |
+
checks=[]
|
| 14 |
+
with httpx.Client(timeout=25,trust_env=False) as client:
|
| 15 |
+
page=client.get(TARGET+'/')
|
| 16 |
+
page.raise_for_status()
|
| 17 |
+
css=re.search(r'href="([^"]+\.css)"',page.text).group(1)
|
| 18 |
+
original=next((ROOT/'frontend/dist/assets').glob('*.css')).read_bytes()
|
| 19 |
+
deployed=client.get(TARGET+'/'+css.lstrip('./'))
|
| 20 |
+
deployed.raise_for_status()
|
| 21 |
+
checks.append({'name':'css_preserved','passed':deployed.content==original,
|
| 22 |
+
'sha256':hashlib.sha256(deployed.content).hexdigest()})
|
| 23 |
+
for endpoint in ('health','models','evaluation','benchmark/official','samples'):
|
| 24 |
+
response=client.get(TARGET+'/api/'+endpoint)
|
| 25 |
+
checks.append({'name':endpoint,'passed':response.status_code==200,'status':response.status_code})
|
| 26 |
+
if endpoint=='health':
|
| 27 |
+
checks[-1]['categories']=len(response.json()['data']['models'])
|
| 28 |
+
checks[-1]['zero_gpu']=response.json()['data']['zero_gpu']
|
| 29 |
+
for endpoint in ('stats','inspections','alerts','archives','export.csv'):
|
| 30 |
+
response=client.get(TARGET+'/api/'+endpoint)
|
| 31 |
+
checks.append({'name':'workspace_required_'+endpoint,'passed':response.status_code==401,
|
| 32 |
+
'status':response.status_code})
|
| 33 |
+
for endpoint in ('stats','inspections'):
|
| 34 |
+
response=client.get(TARGET+'/api/'+endpoint,headers={
|
| 35 |
+
'X-DefectRAG-Session':secrets.token_hex(32),'Authorization':'Bearer invalid-acceptance-token'})
|
| 36 |
+
checks.append({'name':'invalid_staff_token_'+endpoint,'passed':response.status_code==403,
|
| 37 |
+
'status':response.status_code})
|
| 38 |
+
report={'status':'passed' if all(row['passed'] for row in checks) else 'failed','checks':checks}
|
| 39 |
+
(ROOT/'development-support/space/final-cpu.json').write_text(json.dumps(report,indent=2))
|
| 40 |
+
print(json.dumps(report))
|
| 41 |
+
assert report['status']=='passed'
|
| 42 |
+
|
| 43 |
+
if __name__=='__main__':
|
| 44 |
+
main()
|
deployment/space/verify_rpc_anonymous.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Bounded anonymous RPC denial check; no SQL/admin operations or real record IDs."""
|
| 2 |
+
import json
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
import uuid
|
| 5 |
+
import httpx
|
| 6 |
+
from deployment.space.supabase_repository import read_public_config
|
| 7 |
+
|
| 8 |
+
ROOT=Path(__file__).resolve().parents[2]
|
| 9 |
+
OUT=ROOT/'development-support/space'
|
| 10 |
+
|
| 11 |
+
def main():
|
| 12 |
+
confirmation=json.loads((OUT/'migration-confirmed.json').read_text())
|
| 13 |
+
assert confirmation.get('user_confirmed_manual_execution') is True
|
| 14 |
+
config=read_public_config(OUT/'ui-dist/config.js')
|
| 15 |
+
identifier=uuid.uuid4().hex
|
| 16 |
+
checks=[]
|
| 17 |
+
with httpx.Client(timeout=20,trust_env=False) as client:
|
| 18 |
+
for name,payload in (
|
| 19 |
+
('defectrag_append_conversation',{'p_id':identifier,'p_question':'Authorization boundary test',
|
| 20 |
+
'p_answer':{'answer':'Disposable denial check; not a model answer.'}}),
|
| 21 |
+
('defectrag_acknowledge_review',{'p_id':identifier})):
|
| 22 |
+
response=client.post(config['url']+'/rest/v1/rpc/'+name,
|
| 23 |
+
headers={'apikey':config['key']},json=payload)
|
| 24 |
+
body=response.json()
|
| 25 |
+
check={'rpc':name,'status':response.status_code,'code':body.get('code'),
|
| 26 |
+
'permission_denied':response.status_code in (401,403) and body.get('code')=='42501'}
|
| 27 |
+
checks.append(check)
|
| 28 |
+
report={'role':'anonymous','checks':checks,
|
| 29 |
+
'status':'passed' if all(row['permission_denied'] for row in checks) else 'failed',
|
| 30 |
+
'note':'No user JWT/admin access. Random nonexistent inspection ID. Missing function is not accepted as a pass.'}
|
| 31 |
+
(OUT/'rpc-anonymous.json').write_text(json.dumps(report,indent=2))
|
| 32 |
+
print(json.dumps(report))
|
| 33 |
+
assert report['status']=='passed'
|
| 34 |
+
|
| 35 |
+
if __name__=='__main__':
|
| 36 |
+
main()
|
deployment/space/verify_staff_artifacts.py
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Read only the signed report/export links captured from the authorized dashboard."""
|
| 2 |
+
import csv
|
| 3 |
+
import html
|
| 4 |
+
from io import StringIO
|
| 5 |
+
import json
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
import re
|
| 8 |
+
from urllib.parse import urlparse
|
| 9 |
+
import httpx
|
| 10 |
+
from deployment.space.supabase_repository import read_public_config
|
| 11 |
+
|
| 12 |
+
ROOT=Path(__file__).resolve().parents[2]
|
| 13 |
+
OUT=ROOT/'development-support/space'
|
| 14 |
+
IDENTIFIER='a6351615259d42868b766a004f5dd303'
|
| 15 |
+
|
| 16 |
+
def main():
|
| 17 |
+
links=json.loads((OUT/'phase4-private-links.json').read_text())
|
| 18 |
+
config=read_public_config(OUT/'ui-dist/config.js')
|
| 19 |
+
for value in links.values():
|
| 20 |
+
assert urlparse(value).scheme=='https' and urlparse(value).netloc=='wizzas-defectrag.hf.space'
|
| 21 |
+
checks={}
|
| 22 |
+
with httpx.Client(timeout=25,trust_env=False) as client:
|
| 23 |
+
exported=client.get(links['csv'])
|
| 24 |
+
checks['csv_status']=exported.status_code
|
| 25 |
+
assert exported.status_code==200
|
| 26 |
+
rows=list(csv.DictReader(StringIO(exported.text)))
|
| 27 |
+
item=next(row for row in rows if row['id']==IDENTIFIER)
|
| 28 |
+
checks['csv_has_staff_inspection']=item['batch']=='PHASE4-STAFF-ACCEPTANCE'
|
| 29 |
+
report=client.get(links['report'])
|
| 30 |
+
checks['report_status']=report.status_code
|
| 31 |
+
assert report.status_code==200
|
| 32 |
+
checks['conversation_present']=all(text in report.text for text in
|
| 33 |
+
('Is this image anomalous?','What does the heatmap show?','screening-4'))
|
| 34 |
+
cells={html.unescape(re.sub('<[^>]+>','',key)):html.unescape(re.sub('<[^>]+>','',value))
|
| 35 |
+
for key,value in re.findall(r'<tr><th>(.*?)</th><td>(.*?)</td></tr>',report.text)}
|
| 36 |
+
checks['supabase_storage']=cells.get('storage')=='supabase'
|
| 37 |
+
checks['acknowledged_persisted']=cells.get('alert acknowledged')=='True'
|
| 38 |
+
images=re.findall(r'<img src="([^"]+)"',report.text)
|
| 39 |
+
assert len(images)==2
|
| 40 |
+
checks['image_statuses']=[]
|
| 41 |
+
for image in images:
|
| 42 |
+
image=html.unescape(image)
|
| 43 |
+
assert urlparse(image).netloc==urlparse(config['url']).netloc
|
| 44 |
+
response=client.get(image)
|
| 45 |
+
checks['image_statuses'].append(response.status_code)
|
| 46 |
+
assert checks['image_statuses']==[200,200]
|
| 47 |
+
(OUT/'phase4-staff-report.html').write_text(report.text,encoding='utf8')
|
| 48 |
+
(OUT/'phase4-staff-export.csv').write_text(exported.text,encoding='utf8')
|
| 49 |
+
assert all(checks[key] for key in ('csv_has_staff_inspection','conversation_present','supabase_storage','acknowledged_persisted'))
|
| 50 |
+
summary={'status':'passed','inspection_id':IDENTIFIER,'checks':checks,
|
| 51 |
+
'measurements':{key:cells.get(key) for key in ('score','threshold','inference ms','verdict','model id','device')}}
|
| 52 |
+
(OUT/'phase4-staff-artifacts.json').write_text(json.dumps(summary,indent=2))
|
| 53 |
+
print(json.dumps(summary))
|
| 54 |
+
|
| 55 |
+
if __name__=='__main__':
|
| 56 |
+
main()
|
frontend/dist/assets/TeamWorkspace-DW8NTaM7.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import{c as h,r as n,a as Q,b as d,R as e,L as X,S as $,A as ee,d as te}from"./index-lxOeBgSd.js";/**
|
| 2 |
+
* @license lucide-react v0.468.0 - ISC
|
| 3 |
+
*
|
| 4 |
+
* This source code is licensed under the ISC license.
|
| 5 |
+
* See the LICENSE file in the root directory of this source tree.
|
| 6 |
+
*/const ae=h("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
|
| 7 |
+
* @license lucide-react v0.468.0 - ISC
|
| 8 |
+
*
|
| 9 |
+
* This source code is licensed under the ISC license.
|
| 10 |
+
* See the LICENSE file in the root directory of this source tree.
|
| 11 |
+
*/const _=h("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/**
|
| 12 |
+
* @license lucide-react v0.468.0 - ISC
|
| 13 |
+
*
|
| 14 |
+
* This source code is licensed under the ISC license.
|
| 15 |
+
* See the LICENSE file in the root directory of this source tree.
|
| 16 |
+
*/const re=h("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
| 17 |
+
* @license lucide-react v0.468.0 - ISC
|
| 18 |
+
*
|
| 19 |
+
* This source code is licensed under the ISC license.
|
| 20 |
+
* See the LICENSE file in the root directory of this source tree.
|
| 21 |
+
*/const ne=h("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
|
| 22 |
+
* @license lucide-react v0.468.0 - ISC
|
| 23 |
+
*
|
| 24 |
+
* This source code is licensed under the ISC license.
|
| 25 |
+
* See the LICENSE file in the root directory of this source tree.
|
| 26 |
+
*/const le=h("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
|
| 27 |
+
* @license lucide-react v0.468.0 - ISC
|
| 28 |
+
*
|
| 29 |
+
* This source code is licensed under the ISC license.
|
| 30 |
+
* See the LICENSE file in the root directory of this source tree.
|
| 31 |
+
*/const se=h("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
|
| 32 |
+
* @license lucide-react v0.468.0 - ISC
|
| 33 |
+
*
|
| 34 |
+
* This source code is licensed under the ISC license.
|
| 35 |
+
* See the LICENSE file in the root directory of this source tree.
|
| 36 |
+
*/const ce=h("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
|
| 37 |
+
* @license lucide-react v0.468.0 - ISC
|
| 38 |
+
*
|
| 39 |
+
* This source code is licensed under the ISC license.
|
| 40 |
+
* See the LICENSE file in the root directory of this source tree.
|
| 41 |
+
*/const oe=h("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);function me(){var D;const[c,A]=n.useState(null),[l,x]=n.useState(null),[v,M]=n.useState([]),[S,H]=n.useState({}),[g,F]=n.useState(""),[R,L]=n.useState(""),[o,q]=n.useState(!1),[P,y]=n.useState(""),[E,W]=n.useState(!1),[s,w]=n.useState(null),[B,V]=n.useState([]),[K,G]=n.useState([]),[k,z]=n.useState(""),[Y,I]=n.useState(!1),[U,O]=n.useState(""),[Z,N]=n.useState(!1),C=Q();async function i(t){q(!0),y("");try{await t()}catch(r){y(r.message||"Team request failed.")}finally{q(!1)}}async function b(){const{client:t,staff:r}=await te();x(r);let a=t.from("shared_inspections").select("*").order("created_at",{ascending:!1}).limit(200);a=E?a.not("archived_at","is",null):a.is("archived_at",null);const[{data:m,error:f},{data:u,error:p}]=await Promise.all([a,t.from("staff_members").select("*")]);if(f)throw f;if(p)throw p;M(m||[]),H(Object.fromEntries((u||[]).map(T=>[T.user_id,T.display_name])))}n.useEffect(()=>{if(!C)return;let t=!1,r;return d().then(async a=>{r=a.auth.onAuthStateChange((f,u)=>{t||(A((u==null?void 0:u.user)||null),f==="PASSWORD_RECOVERY"&&I(!0))}).data.subscription;const{data:m}=await a.auth.getUser();t||A(m.user)}).catch(a=>{t||y(a.message)}),()=>{t=!0,r==null||r.unsubscribe()}},[C]),n.useEffect(()=>{if(!c)return;let t=!1;b().catch(a=>{t||y(a.message)});const r=setInterval(()=>b().catch(a=>{t||y(a.message)}),15e3);return()=>{t=!0,clearInterval(r)}},[c==null?void 0:c.id,E]);async function j(t){await i(async()=>{const r=await d(),a=r.storage.from("team-inspections"),m=await Promise.all([t.image_path,t.heatmap_path].map(p=>a.createSignedUrl(p,900)));if(m.some(p=>p.error))throw new Error("Private images could not be loaded. Check staff/storage policies.");const{data:f,error:u}=await r.from("staff_notes").select("*").eq("inspection_id",t.id).order("created_at");if(u)throw u;w(t),V(m.map(p=>p.data.signedUrl)),G(f||[])})}async function J(){await i(async()=>{const t=await d(),r=v.filter(a=>a.owner_id===c.id).map(a=>a.id);if(r.length){const{error:a}=await t.rpc("archive_team_inspections",{p_ids:r});if(a)throw a}w(null),N(!1),await b()})}return C?e.createElement(e.Fragment,null,e.createElement("section",{className:"card"},e.createElement("div",{className:"section-title"},e.createElement("div",null,e.createElement("h2",null,e.createElement(oe,{size:21})," Staff workspace"),e.createElement("p",null,"Signed-in staff share saved inspections and review notes. Live AI runs on the connected inspection backend.")),e.createElement("span",{className:"subtle-tag"},e.createElement(_,{size:13})," SUPABASE")),P&&e.createElement("div",{className:"error",role:"alert"},P),c?e.createElement(e.Fragment,null,e.createElement("div",{className:"team-toolbar"},e.createElement("div",null,e.createElement($,{size:18}),e.createElement("strong",null,(l==null?void 0:l.display_name)||c.email),e.createElement("span",{className:"subtle-tag"},(l==null?void 0:l.role)||"CHECKING MEMBERSHIP")),e.createElement("button",{className:"secondary",disabled:o,onClick:()=>i(b)},e.createElement(se,{size:16})," Refresh"),e.createElement("button",{className:"secondary",onClick:()=>i(async()=>{await(await d()).auth.signOut(),M([]),w(null),x(null)})},e.createElement(le,{size:16})," Sign out")),Y&&e.createElement("form",{className:"login-form",onSubmit:t=>{t.preventDefault(),i(async()=>{const r=await d(),{error:a}=await r.auth.updateUser({password:U});if(a)throw a;O(""),I(!1)})}},e.createElement("label",{className:"field"},"Set a new password",e.createElement("input",{type:"password",minLength:12,autoComplete:"new-password",value:U,onChange:t=>O(t.target.value),required:!0})),e.createElement("button",{className:"primary",disabled:o},"Save password")),e.createElement("div",{className:"team-toolbar"},e.createElement("span",null,"Latest ",v.length," shared records · refreshes every 15 seconds"),(l==null?void 0:l.role)==="developer"&&e.createElement("button",{className:"secondary",onClick:()=>{W(!E),w(null)}},e.createElement(ae,{size:16}),E?"Active history":"Developer recovery"),!E&&e.createElement("button",{className:"secondary danger",disabled:o||!v.some(t=>t.owner_id===c.id),onClick:()=>N(!0)},e.createElement(ee,{size:16})," Archive my visible history")),Z&&e.createElement("div",{className:"note"},e.createElement("div",null,e.createElement("strong",null,"Archive your visible records?"),e.createElement("p",null,"They will leave the shared active history. Original files and conversations remain recoverable by a developer. Other staff members’ records will stay active."),e.createElement("div",{className:"button-row"},e.createElement("button",{className:"primary",disabled:o,onClick:J},"Archive my records"),e.createElement("button",{className:"secondary",onClick:()=>N(!1)},"Cancel")))),e.createElement("div",{className:"table-wrap"},e.createElement("table",null,e.createElement("thead",null,e.createElement("tr",null,e.createElement("th",null,"Inspection"),e.createElement("th",null,"Product"),e.createElement("th",null,"Result"),e.createElement("th",null,"Shared by"),e.createElement("th",null,"Saved"),e.createElement("th",null))),e.createElement("tbody",null,v.map(t=>{var r;return e.createElement("tr",{key:t.id},e.createElement("td",null,e.createElement("strong",null,t.id.slice(0,8))),e.createElement("td",null,t.payload.category),e.createElement("td",null,e.createElement("span",{className:"badge "+((r=t.payload.verdict)==null?void 0:r.toLowerCase())},t.payload.verdict)),e.createElement("td",null,S[t.owner_id]||"Staff member"),e.createElement("td",null,new Date(t.created_at).toLocaleString()),e.createElement("td",null,e.createElement("button",{className:"text-button",onClick:()=>j(t)},"Review"),E&&(l==null?void 0:l.role)==="developer"&&e.createElement("button",{className:"text-button",disabled:o,onClick:()=>i(async()=>{const a=await d(),{error:m}=await a.rpc("restore_team_inspections",{p_ids:[t.id]});if(m)throw m;await b()})},"Restore")))}))),!v.length&&e.createElement("div",{className:"empty"},e.createElement(_,{size:30}),e.createElement("p",null,E?"No archived records to recover.":"No shared inspections yet. In the local app, open a result and select Share with staff.")))):e.createElement("form",{className:"login-form",onSubmit:t=>{t.preventDefault(),i(async()=>{const r=await d(),{error:a}=await r.auth.signInWithPassword({email:g,password:R});if(a)throw a;L("")})}},e.createElement("label",{className:"field"},"Work email",e.createElement("input",{type:"email",autoComplete:"username",value:g,onChange:t=>F(t.target.value),required:!0})),e.createElement("label",{className:"field"},"Password",e.createElement("input",{type:"password",autoComplete:"current-password",value:R,onChange:t=>L(t.target.value),required:!0})),e.createElement("button",{className:"primary",disabled:o},o?e.createElement(X,{className:"spin",size:17}):e.createElement(ne,{size:17})," Sign in"),e.createElement("button",{type:"button",className:"text-button",disabled:!g||o,onClick:()=>i(async()=>{const t=await d(),{error:r}=await t.auth.resetPasswordForEmail(g,{redirectTo:location.origin+location.pathname});if(r)throw r;y("Password reset requested. Check your email.")})},"Reset password"),e.createElement("p",{className:"caption"},"Accounts must be invited and approved by your workspace developer. Signing up alone does not grant staff access."))),c&&s&&e.createElement("section",{className:"card"},e.createElement("div",{className:"section-title"},e.createElement("div",null,e.createElement("h2",null,"Shared inspection · ",s.id.slice(0,8)),e.createElement("p",null,"Saved snapshot from ",S[s.owner_id]||"a colleague",". This page does not run a new prediction.")),e.createElement("button",{className:"text-button",onClick:()=>w(null)},"Close")),e.createElement("div",{className:"shared-images"},B.map((t,r)=>e.createElement("img",{key:t,src:t,alt:r?"Saved anomaly heatmap":"Saved inspected product"}))),e.createElement("div",{className:"observation"},e.createElement("strong",null,"SAVED MEASUREMENTS"),e.createElement("span",null,s.payload.verdict," · score ",Number(s.payload.score).toFixed(5)," · threshold ",Number(s.payload.threshold).toFixed(5))),e.createElement("h3",{className:"section-gap"},"Recorded evidence"),(D=s.conversation)!=null&&D.length?s.conversation.map((t,r)=>e.createElement("p",{className:"cloud-message",key:r},e.createElement("strong",null,t.role==="user"?"Inspector":"Evidence Assistant",": "),t.question||t.answer)):e.createElement("p",{className:"caption"},"No conversation was included when this inspection was shared."),e.createElement("h3",{className:"section-gap"},"Staff review notes"),K.map(t=>e.createElement("div",{className:"cloud-message",key:t.id},e.createElement("strong",null,S[t.author_id]||"Staff member"),e.createElement("p",null,t.body),e.createElement("small",null,new Date(t.created_at).toLocaleString()))),!s.archived_at&&e.createElement("form",{className:"question-form",onSubmit:t=>{t.preventDefault(),i(async()=>{const r=await d(),{error:a}=await r.from("staff_notes").insert({inspection_id:s.id,author_id:c.id,body:k.trim()});if(a)throw a;z(""),await j(s)})}},e.createElement("input",{"aria-label":"Staff review note",maxLength:2e3,placeholder:"Add a review note for your colleagues…",value:k,onChange:t=>z(t.target.value)}),e.createElement("button",{className:"primary",disabled:o||!k.trim()},e.createElement(ce,{size:16})," Add note")))):e.createElement("section",{className:"card cloud-setup"},e.createElement("div",{className:"setup-icon"},e.createElement(_,{size:32})),e.createElement("span",{className:"eyebrow"},"TEAM WORKSPACE"),e.createElement("h2",null,"One shared view of inspection."),e.createElement("p",null,"The staff workspace is ready to connect to your own Supabase project. No cloud project or account has been created for you."),e.createElement("div",{className:"setup-grid"},[["01","Create a free project","Use your Supabase account and select an eligible Free plan."],["02","Set up staff access","Run the supplied schema, add your developer account and invite colleagues."],["03","Connect this dashboard","Add the project URL and publishable key to config.js, then reload."]].map(([t,r,a])=>e.createElement("div",{key:t},e.createElement("b",null,t),e.createElement("h3",null,r),e.createElement("p",null,a)))),e.createElement("a",{className:"primary",href:"https://supabase.com/dashboard",target:"_blank",rel:"noreferrer"},"Open Supabase ",e.createElement(re,{size:16})),e.createElement("p",{className:"caption"},"Setup files: deployment/SUPABASE_SETUP.md and deployment/supabase.sql. Never place a service-role key in the browser. Local inspection works without cloud setup."))}export{me as default};
|
frontend/dist/assets/index-lxOeBgSd.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
frontend/dist/index.html
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
-
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><meta name="theme-color" content="#132e32"/><meta name="description" content="Local visual anomaly inspection with traceable evidence."/><title>DefectRAG · Inspection intelligence</title><link rel="icon" type="image/svg+xml" href="./logo.svg"><script src="./config.js"></script> <script type="module" crossorigin src="./assets/index-
|
| 2 |
<link rel="stylesheet" crossorigin href="./assets/index-Bn4HF2vD.css">
|
| 3 |
</head><body><div id="root"></div></body></html>
|
|
|
|
| 1 |
+
<!doctype html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><meta name="theme-color" content="#132e32"/><meta name="description" content="Local visual anomaly inspection with traceable evidence."/><title>DefectRAG · Inspection intelligence</title><link rel="icon" type="image/svg+xml" href="./logo.svg"><script src="./config.js"></script> <script type="module" crossorigin src="./assets/index-lxOeBgSd.js"></script>
|
| 2 |
<link rel="stylesheet" crossorigin href="./assets/index-Bn4HF2vD.css">
|
| 3 |
</head><body><div id="root"></div></body></html>
|