Wizzas commited on
Commit
46e957e
·
verified ·
1 Parent(s): d49c762

DefectRAG phase 5: incremental real-model application migration

Browse files
frontend/dist/assets/TeamWorkspace-CWrJp6tY.js ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import{c as E,r as n,a as ne,b as d,R as e,L as le,S as se,A as ce,d as oe,e as ie,w as _,p as Y,f as de}from"./index-pHIVzc7G.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 me=E("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 q=E("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 ue=E("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 pe=E("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 he=E("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 Ee=E("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 ye=E("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 fe=E("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 we({onOpenInspection:P}){var K;const v=n.useRef(0),z=n.useRef(null),[c,U]=n.useState(null),[s,O]=n.useState(null),[g,I]=n.useState([]),[S,Z]=n.useState({}),[C,J]=n.useState(""),[j,D]=n.useState(""),[i,T]=n.useState(!1),[F,w]=n.useState(""),[y,Q]=n.useState(!1),[l,b]=n.useState(null),[X,$]=n.useState([]),[R,ee]=n.useState([]),[A,H]=n.useState(""),[te,B]=n.useState(!1),[W,V]=n.useState(""),[ae,x]=n.useState(!1),M=ne();async function m(t){T(!0),w("");try{await t()}catch(r){w(r.message||"Team request failed.")}finally{T(!1)}}async function k(){const{client:t,staff:r}=await de();O(r);let a=t.from("shared_inspections").select("*").order("created_at",{ascending:!1}).limit(200);a=y?a.not("archived_at","is",null):a.is("archived_at",null);const[{data:u,error:p},{data:o,error:f}]=await Promise.all([a,t.from("staff_members").select("*")]);if(p)throw p;if(f)throw f;I(u||[]),Z(Object.fromEntries((o||[]).map(h=>[h.user_id,h.display_name])))}n.useEffect(()=>{if(!M)return;let t=!1,r;return d().then(async a=>{r=a.auth.onAuthStateChange((p,o)=>{var f;if(!t){const h=((f=o==null?void 0:o.user)==null?void 0:f.id)||null;z.current!==h&&(v.current++,b(null),z.current=h),U((o==null?void 0:o.user)||null),p==="PASSWORD_RECOVERY"&&B(!0)}}).data.subscription;const{data:u}=await a.auth.getUser();t||U(u.user)}).catch(a=>{t||w(a.message)}),()=>{t=!0,v.current++,r==null||r.unsubscribe()}},[M]),n.useEffect(()=>{if(!c)return;let t=!1;k().catch(a=>{t||w(a.message)});const r=setInterval(()=>k().catch(a=>{t||w(a.message)}),15e3);return()=>{t=!0,clearInterval(r)}},[c==null?void 0:c.id,y]);async function L(t){const r=++v.current;await m(async()=>{const a=await d(),u=a.storage.from("team-inspections"),[{data:p,error:o},{data:f,error:h}]=await Promise.all([a.from("shared_inspections").select("*").eq("id",t.id).single(),a.from("staff_notes").select("*").eq("inspection_id",t.id).order("created_at")]);if(o)throw o;if(h)throw h;const G=await Promise.all([p.image_path,p.heatmap_path].map(N=>u.createSignedUrl(N,900)));if(G.some(N=>N.error))throw new Error("Private images could not be loaded. Check staff/storage policies.");r===v.current&&(b(p),$(G.map(N=>N.data.signedUrl)),ee(f||[]))})}async function re(){await m(async()=>{const t=await d(),r=g.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}v.current++,b(null),x(!1),await k(),_()})}return M?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(fe,{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(q,{size:13})," SUPABASE")),F&&e.createElement("div",{className:"error",role:"alert"},F),c?e.createElement(e.Fragment,null,e.createElement("div",{className:"team-toolbar"},e.createElement("div",null,e.createElement(se,{size:18}),e.createElement("strong",null,(s==null?void 0:s.display_name)||c.email),e.createElement("span",{className:"subtle-tag"},(s==null?void 0:s.role)||"CHECKING MEMBERSHIP")),e.createElement("button",{className:"secondary",disabled:i,onClick:()=>m(k)},e.createElement(Ee,{size:16})," Refresh"),e.createElement("button",{className:"secondary",onClick:()=>m(async()=>{await(await d()).auth.signOut(),I([]),b(null),O(null)})},e.createElement(he,{size:16})," Sign out")),te&&e.createElement("form",{className:"login-form",onSubmit:t=>{t.preventDefault(),m(async()=>{const r=await d(),{error:a}=await r.auth.updateUser({password:W});if(a)throw a;V(""),B(!1)})}},e.createElement("label",{className:"field"},"Set a new password",e.createElement("input",{type:"password",minLength:12,autoComplete:"new-password",value:W,onChange:t=>V(t.target.value),required:!0})),e.createElement("button",{className:"primary",disabled:i},"Save password")),e.createElement("div",{className:"team-toolbar"},e.createElement("span",null,"Latest ",g.length," shared records · refreshes every 15 seconds"),(s==null?void 0:s.role)==="developer"&&e.createElement("button",{className:"secondary",onClick:()=>{Q(!y),b(null)}},e.createElement(me,{size:16}),y?"Active history":"Developer recovery"),!y&&e.createElement("button",{className:"secondary danger",disabled:i||!g.some(t=>t.owner_id===c.id),onClick:()=>x(!0)},e.createElement(ce,{size:16})," Archive my visible history")),ae&&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:i,onClick:re},"Archive my records"),e.createElement("button",{className:"secondary",onClick:()=>x(!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,g.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:()=>L(t)},"Review"),y&&(s==null?void 0:s.role)==="developer"&&e.createElement("button",{className:"text-button",disabled:i,onClick:()=>m(async()=>{const a=await d(),{error:u}=await a.rpc("restore_team_inspections",{p_ids:[t.id]});if(u)throw u;await k(),_()})},"Restore")))}))),!g.length&&e.createElement("div",{className:"empty"},e.createElement(q,{size:30}),e.createElement("p",null,y?"No archived records to recover.":"No shared inspections yet. Open an inspection result and select Share with staff.")))):e.createElement("form",{className:"login-form",onSubmit:t=>{t.preventDefault(),m(async()=>{const r=await d(),{error:a}=await r.auth.signInWithPassword({email:C,password:j});if(a)throw a;D("")})}},e.createElement("label",{className:"field"},"Work email",e.createElement("input",{type:"email",autoComplete:"username",value:C,onChange:t=>J(t.target.value),required:!0})),e.createElement("label",{className:"field"},"Password",e.createElement("input",{type:"password",autoComplete:"current-password",value:j,onChange:t=>D(t.target.value),required:!0})),e.createElement("button",{className:"primary",disabled:i},i?e.createElement(le,{className:"spin",size:17}):e.createElement(pe,{size:17})," Sign in"),e.createElement("button",{type:"button",className:"text-button",disabled:!C||i,onClick:()=>m(async()=>{const t=await d(),{error:r}=await t.auth.resetPasswordForEmail(C,{redirectTo:location.origin+location.pathname});if(r)throw r;w("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&&l&&e.createElement("section",{className:"card"},e.createElement("div",{className:"section-title"},e.createElement("div",null,e.createElement("h2",null,"Shared inspection · ",l.id.slice(0,8)),e.createElement("p",null,"Saved snapshot from ",S[l.owner_id]||"a colleague",". This page does not run a new prediction.")),e.createElement("div",{className:"button-row"},P&&!l.archived_at&&e.createElement("button",{className:"secondary",onClick:()=>P(l)},"Open inspection & assistant"),e.createElement("button",{className:"text-button",onClick:()=>{v.current++,b(null)}},"Close"))),e.createElement("div",{className:"shared-images"},X.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,l.payload.verdict," · score ",Number(l.payload.score).toFixed(5)," · threshold ",Number(l.payload.threshold).toFixed(5))),e.createElement("h3",{className:"section-gap"},"Recorded evidence"),(K=l.conversation)!=null&&K.length?l.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."),!l.archived_at&&e.createElement(oe,{key:l.id+String(R.length),current:R.map(t=>Y(t,S)).filter(Boolean).at(-1),disabled:i,onSave:async t=>{const r=await d(),{error:a}=await r.from("staff_notes").insert({inspection_id:l.id,author_id:c.id,body:ie(t.status,t.decision,t.note)});if(a)throw a;await L(l),_()}}),e.createElement("h3",{className:"section-gap"},"Staff review notes"),R.filter(t=>!Y(t,S)).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()))),!l.archived_at&&e.createElement("form",{className:"question-form",onSubmit:t=>{t.preventDefault(),m(async()=>{const r=await d(),{error:a}=await r.from("staff_notes").insert({inspection_id:l.id,author_id:c.id,body:A.trim()});if(a)throw a;H(""),await L(l),_()})}},e.createElement("input",{"aria-label":"Staff review note",maxLength:2e3,placeholder:"Add a review note for your colleagues…",value:A,onChange:t=>H(t.target.value)}),e.createElement("button",{className:"primary",disabled:i||!A.trim()},e.createElement(ye,{size:16})," Add note")))):e.createElement("section",{className:"card cloud-setup"},e.createElement("div",{className:"setup-icon"},e.createElement(q,{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(ue,{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{we as default};
frontend/dist/assets/index-pHIVzc7G.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-DyHDnvjh.js"></script>
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-pHIVzc7G.js"></script>
2
  <link rel="stylesheet" crossorigin href="./assets/index-Bn4HF2vD.css">
3
  </head><body><div id="root"></div></body></html>