@duckcodeailabs/dql-cli 1.12.10 → 1.12.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/dist/assets/dql-notebook/assets/{AgentAnswerCard-Dp4odOLE.js → AgentAnswerCard-CpL2kDCV.js} +1 -1
  2. package/dist/assets/dql-notebook/assets/{AgentLogPage-uvVs284-.js → AgentLogPage-hzHqpD3-.js} +1 -1
  3. package/dist/assets/dql-notebook/assets/{AiBuildDialog-DEUS19WF.js → AiBuildDialog-BQRWoxp9.js} +1 -1
  4. package/dist/assets/dql-notebook/assets/AiBuildResult-D9t_4sQl.js +33 -0
  5. package/dist/assets/dql-notebook/assets/{AiSidePanel-C7BZVSkM.js → AiSidePanel-BCQB9rVF.js} +1 -1
  6. package/dist/assets/dql-notebook/assets/{AnalyticsHome-4TgtH6SB.js → AnalyticsHome-Ba4Ve_Gd.js} +1 -1
  7. package/dist/assets/dql-notebook/assets/AppsView-CdAT9BOq.js +4466 -0
  8. package/dist/assets/dql-notebook/assets/{BlockStudio-DUXN3MKz.js → BlockStudio-Brg4fwn5.js} +13 -13
  9. package/dist/assets/dql-notebook/assets/{BusinessArtifactView-D8FIgrkF.js → BusinessArtifactView-CnTbFVGT.js} +1 -1
  10. package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-CQe2FUZq.js +22 -0
  11. package/dist/assets/dql-notebook/assets/{GitPage-BS2sm9zh.js → GitPage-DHyDBChc.js} +1 -1
  12. package/dist/assets/dql-notebook/assets/{GlobalAiRail-B_MZsB0z.js → GlobalAiRail-Cys4n_rq.js} +1 -1
  13. package/dist/assets/dql-notebook/assets/GovernedContextPage-DyKoDSZ2.js +7 -0
  14. package/dist/assets/dql-notebook/assets/{HelpDocsPage-Bc5pLakt.js → HelpDocsPage-CL0vbSER.js} +3 -3
  15. package/dist/assets/dql-notebook/assets/{HomePage-DQSo-K4y.js → HomePage-DzAucwBW.js} +9 -4
  16. package/dist/assets/dql-notebook/assets/{LineageDAG-RdpWmGmR.js → LineageDAG-QHqd_AM5.js} +1 -1
  17. package/dist/assets/dql-notebook/assets/{LineageDetailView-CZEx2r1H.js → LineageDetailView-DdVH-nz6.js} +1 -1
  18. package/dist/assets/dql-notebook/assets/{LineageDrawer-P7ZdOW8-.js → LineageDrawer-BvrVZNKY.js} +1 -1
  19. package/dist/assets/dql-notebook/assets/LineagePathBreadcrumb-CSut-zvm.js +14 -0
  20. package/dist/assets/dql-notebook/assets/{MiniLineageGraph-Ctp_yFh8.js → MiniLineageGraph-zg_1wW3M.js} +1 -1
  21. package/dist/assets/dql-notebook/assets/NewBlockModal-9cDletl-.js +1 -0
  22. package/dist/assets/dql-notebook/assets/NewNotebookModal-V6de8L4d.js +46 -0
  23. package/dist/assets/dql-notebook/assets/NotebookEditor-EZ0pfWVs.js +200 -0
  24. package/dist/assets/dql-notebook/assets/{ReadinessPage-C8hATaT_.js → ReadinessPage-BaGvjyfd.js} +1 -1
  25. package/dist/assets/dql-notebook/assets/{SetupOnboarding-DX2f53J2.js → SetupOnboarding-Bg-MjbC9.js} +2 -2
  26. package/dist/assets/dql-notebook/assets/{TrustBadge-DPnKzRSY.js → TrustBadge-DGuHB8kP.js} +1 -1
  27. package/dist/assets/dql-notebook/assets/{UnifiedAgentRunPanel-CwxQ4T19.js → UnifiedAgentRunPanel-BlWAVEwO.js} +17 -17
  28. package/dist/assets/dql-notebook/assets/{answer-to-notebook-Bm9oByWA.js → answer-to-notebook-BDzY4MuQ.js} +1 -1
  29. package/dist/assets/dql-notebook/assets/{arrow-left-D2FbLWqh.js → arrow-left-IjlnAihE.js} +1 -1
  30. package/dist/assets/dql-notebook/assets/{arrow-right-OYItAZ-s.js → arrow-right-BI4cXgOY.js} +2 -2
  31. package/dist/assets/dql-notebook/assets/{book-open-text-BnnirfAc.js → book-open-text-i6xhxu_I.js} +1 -1
  32. package/dist/assets/dql-notebook/assets/{bot-BJNxPYFm.js → bot-C6DE7Q6m.js} +1 -1
  33. package/dist/assets/dql-notebook/assets/{chevron-up-DM5LX-26.js → chevron-up-DSEILnDs.js} +2 -2
  34. package/dist/assets/dql-notebook/assets/{circle-x-Dic_-4tF.js → circle-x-BoAorVSm.js} +1 -1
  35. package/dist/assets/dql-notebook/assets/{codemirror-1_I9gm6Z.js → codemirror-DXt7RW72.js} +1 -1
  36. package/dist/assets/dql-notebook/assets/{dagre.esm-C9zxjHHX.js → dagre.esm-CycymVj6.js} +1 -1
  37. package/dist/assets/dql-notebook/assets/{external-link-DHxAcoCE.js → external-link-ZwE5iHsX.js} +1 -1
  38. package/dist/assets/dql-notebook/assets/{grip-vertical-02I-EOjL.js → grip-vertical-Dnp2st8l.js} +1 -1
  39. package/dist/assets/dql-notebook/assets/index-BTuliKhK.js +634 -0
  40. package/dist/assets/dql-notebook/assets/{link-2-Delh-lai.js → link-2-CTKe6Snr.js} +2 -2
  41. package/dist/assets/dql-notebook/assets/{list-tree-BrIZg6l6.js → list-tree-Ced8e_S1.js} +1 -1
  42. package/dist/assets/dql-notebook/assets/{maximize-2-CQOA-bbN.js → maximize-2-Cojc6867.js} +1 -1
  43. package/dist/assets/dql-notebook/assets/{minimize-2-CUDBPkwe.js → minimize-2-CBIAE0XH.js} +1 -1
  44. package/dist/assets/dql-notebook/assets/{panel-right-open-CwhZfkKJ.js → panel-right-open-po3bWSeL.js} +2 -2
  45. package/dist/assets/dql-notebook/assets/{pencil-Cf6-MgpT.js → pencil-Cb45c6WU.js} +2 -2
  46. package/dist/assets/dql-notebook/assets/{rotate-ccw-DndbJAiz.js → rotate-ccw-B9v1LTJ0.js} +2 -2
  47. package/dist/assets/dql-notebook/assets/{semantic-fields-DwKPY_mU.js → semantic-fields-B6ii0an0.js} +1 -1
  48. package/dist/assets/dql-notebook/assets/{star-DvcMC9wZ.js → star-CO4tfaDq.js} +2 -2
  49. package/dist/assets/dql-notebook/assets/{triangle-alert-DUf4Ook0.js → triangle-alert-BSdIu2El.js} +1 -1
  50. package/dist/assets/dql-notebook/assets/{usePersistedAgentThreadId-DbdBi0oH.js → usePersistedAgentThreadId-CkVFrrjk.js} +2 -2
  51. package/dist/assets/dql-notebook/assets/{user-round-DSt0xU3K.js → user-round-BfrV8U-W.js} +3 -3
  52. package/dist/assets/dql-notebook/assets/{wand-sparkles-ro8Cq0ro.js → wand-sparkles-BgTxZNBc.js} +1 -1
  53. package/dist/assets/dql-notebook/assets/{workflow-DVJXehjU.js → workflow--2ycp0yy.js} +2 -2
  54. package/dist/assets/dql-notebook/assets/{wrench-DxUnoHtz.js → wrench-LMCrpa9_.js} +1 -1
  55. package/dist/assets/dql-notebook/assets/{x-9Gtb3EAd.js → x-CeNgQwGm.js} +2 -2
  56. package/dist/assets/dql-notebook/index.html +1 -1
  57. package/dist/local-runtime.d.ts +40 -1
  58. package/dist/local-runtime.d.ts.map +1 -1
  59. package/dist/local-runtime.js +602 -172
  60. package/dist/local-runtime.js.map +1 -1
  61. package/dist/package.json +10 -10
  62. package/package.json +10 -10
  63. package/dist/assets/dql-notebook/assets/AiBuildResult-B9KmBRsh.js +0 -33
  64. package/dist/assets/dql-notebook/assets/AppsView-CnfNtk5W.js +0 -4466
  65. package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-DR8hTZ95.js +0 -22
  66. package/dist/assets/dql-notebook/assets/GovernedContextPage-CNM5UCAH.js +0 -7
  67. package/dist/assets/dql-notebook/assets/LineagePathBreadcrumb-DTUMFkJ8.js +0 -14
  68. package/dist/assets/dql-notebook/assets/NewBlockModal-BLtjuWGy.js +0 -1
  69. package/dist/assets/dql-notebook/assets/NewNotebookModal-xgaKB2kI.js +0 -46
  70. package/dist/assets/dql-notebook/assets/NotebookEditor-D6RgLQw-.js +0 -202
  71. package/dist/assets/dql-notebook/assets/index-Ca3UeUWI.js +0 -644
@@ -1 +1 @@
1
- import{u as G,r,a as I,j as e,S as H,Y as P,az as _,L as N,h as q,b as Q,d as V,B as U,e as K}from"./index-Ca3UeUWI.js";import{T as Y}from"./TrustBadge-DPnKzRSY.js";import{o as O}from"./ai-build-bus-1BR770pY.js";import{W as M}from"./wand-sparkles-ro8Cq0ro.js";import{U as J,G as X}from"./user-round-DSt0xU3K.js";import{T as B}from"./triangle-alert-DUf4Ook0.js";import{A as Z}from"./arrow-right-OYItAZ-s.js";import"./react-CRB3T2We.js";function Ce(){const{state:s,dispatch:c}=G(),[o,y]=r.useState(null),[w,u]=r.useState(!0),[p,f]=r.useState(new Set),[l,k]=r.useState(!1),[R,T]=r.useState(null),[W,z]=r.useState(null);r.useEffect(()=>{let t=!1;return I.getIdentity().then(n=>{!t&&(n!=null&&n.owner)&&z(n.owner)}).catch(()=>{}),()=>{t=!0}},[]);const C=r.useCallback(async(t,n)=>{const i={name:t.split("/").pop()??`${n}.dql`,path:t,type:"block",folder:"blocks"};s.files.some(a=>a.path===t)||c({type:"FILE_ADDED",file:i});const x=await I.openBlockStudio(t);c({type:"OPEN_BLOCK_STUDIO",file:i,payload:x})},[c,s.files]),b=r.useCallback(()=>{let t=!1;return u(!0),I.getProposeReadiness().then(n=>{if(t)return;y(n);const i=n.ready?n.plan.domains.flatMap(x=>x.candidates.map(a=>a.slug)):[];f(new Set(i)),u(!1)}),()=>{t=!0}},[]);r.useEffect(()=>b(),[b]);const m=r.useCallback(()=>{c({type:"SET_MAIN_VIEW",view:"block_studio"})},[c]),D=r.useCallback(t=>{f(n=>{const i=new Set(n);return i.has(t)?i.delete(t):i.add(t),i})},[]),v=r.useCallback(t=>{f(n=>{const i=new Set(n),x=t.candidates.map(g=>g.slug),a=x.every(g=>i.has(g));for(const g of x)a?i.delete(g):i.add(g);return i})},[]),L=r.useCallback(async()=>{const t=[...p];if(t.length===0)return;k(!0),T(null);const n=await I.generateProposeDrafts({slugs:t});if(k(!1),!n.ready){T(n.reason??"Could not generate drafts.");return}const i=n.proposals.find(x=>x.path);i!=null&&i.path?C(i.path,i.slug):m()},[p,m,C]),d=o==null?void 0:o.summary,h=o!=null&&o.ready?o.plan:null;return e.jsx("div",{style:{flex:1,minWidth:0,overflow:"auto"},children:e.jsxs("div",{style:{maxWidth:980,margin:"0 auto",padding:"22px 28px 40px",display:"grid",gap:16},children:[e.jsxs("header",{style:{display:"grid",gap:6},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx(H,{size:20}),e.jsx("div",{style:{fontSize:22,fontWeight:750},children:"Get started"}),e.jsx("div",{style:{flex:1}}),e.jsxs("button",{type:"button",onClick:()=>O({target:"block",lockTarget:!0,sourceLabel:"Describe a block to draft from your project context."}),style:ue,children:[e.jsx(M,{size:14})," Ask AI to build a block"]})]}),e.jsx("div",{style:{fontSize:13,opacity:.72,maxWidth:760,lineHeight:1.55},children:d!=null&&d.modelsScanned?`I scanned your dbt project and found ${d.businessModels} ${d.businessModels===1?"thing":"things"} worth governing — here's what each one does. Expand a row to see the SQL it would run and what's still missing to certify. Plumbing and low-value models are left out. Nothing is drafted or certified until you approve it.`:"I scanned your dbt project for the business models worth governing — here's what each one does. Expand a row to see the SQL it would run and what's still missing to certify. Nothing is drafted or certified until you approve it."}),W?e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11.5,opacity:.62},children:[e.jsx(J,{size:12})," drafting as ",W]}):null,e.jsxs("button",{type:"button",onClick:()=>c({type:"SET_MAIN_VIEW",view:"skills"}),style:{display:"inline-flex",alignItems:"center",gap:6,alignSelf:"start",marginTop:2,padding:0,border:"none",background:"transparent",color:"var(--color-accent-blue, #6b5dd3)",fontSize:12,fontWeight:650,cursor:"pointer"},children:[e.jsx(X,{size:13})," Teach the AI your business rules →"]})]}),w?e.jsx("div",{style:E,children:"Classifying dbt models and planning the business seed…"}):o?o.ready?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:10},children:[e.jsx(S,{label:"dbt models scanned",value:d.modelsScanned}),e.jsx(S,{label:"Business models",value:d.businessModels,tone:"success"}),e.jsx(S,{label:"Plumbing excluded",value:d.plumbingExcluded}),e.jsx(S,{label:"Metrics found",value:d.metricsFound})]}),d.reviewTelemetry&&d.reviewTelemetry.existingDrafts>0?e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:10},children:[e.jsx(S,{label:"Drafts ready for review",value:`${Math.round((d.reviewTelemetry.readyForReviewRate??0)*100)}%`,tone:"success"}),e.jsx(S,{label:"Median draft age",value:d.reviewTelemetry.medianReviewAgeHours!=null?`${d.reviewTelemetry.medianReviewAgeHours.toFixed(1)}h`:"—"}),e.jsx(S,{label:"Est. review time",value:`~${d.reviewTelemetry.estimatedReviewMinutes} min`})]}):null,e.jsxs("div",{style:ye,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx(_,{size:16}),e.jsxs("div",{style:{fontSize:13},children:[e.jsxs("strong",{children:["Will generate ",p.size]}),e.jsxs("span",{style:{opacity:.65},children:[" ","of ",h.willGenerate," planned · skipping ",h.willSkip," · ≤ ",h.config.maxPerDomain," per domain"]})]})]}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsxs("button",{type:"button",onClick:b,style:$,children:[e.jsx(P,{size:13})," Refresh"]}),e.jsxs("button",{type:"button",onClick:()=>void L(),disabled:l||p.size===0,style:{...he,opacity:l||p.size===0?.6:1},children:[l?e.jsx(N,{size:13,className:"spin"}):e.jsx(q,{size:13}),l?"Generating…":e.jsxs(e.Fragment,{children:["Approve & generate ",p.size>0?`(${p.size})`:""]})]})]})]}),R?e.jsxs("div",{style:{...E,display:"flex",gap:8,alignItems:"center",borderColor:"var(--status-error, #cf222e)"},children:[e.jsx(B,{size:16})," ",R]}):null,e.jsx("div",{style:{display:"grid",gap:12},children:h.domains.length===0?e.jsxs("div",{style:E,children:["No business models found to govern. Tag a layer in ",e.jsx("code",{children:"dql.config.json"})," ","(",e.jsx("code",{children:"propose.businessLayers"}),") or add ",e.jsx("code",{children:"meta.dql.business"})," to your dbt models."]}):h.domains.map(t=>e.jsx(ee,{domain:t,selected:p,onToggleSlug:D,onToggleDomain:v,onOpenInBlockStudio:C},t.name))}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsxs("button",{type:"button",onClick:m,style:fe,children:["Open Block Studio ",e.jsx(Z,{size:13})]})})]}):e.jsxs("div",{style:{...E,display:"flex",alignItems:"flex-start",gap:10},children:[e.jsx(B,{size:18,style:{flexShrink:0,marginTop:1}}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("div",{style:{fontWeight:650},children:"Not ready to propose yet"}),e.jsx("div",{style:{opacity:.8},children:o.reason}),e.jsxs("button",{type:"button",onClick:b,style:$,children:[e.jsx(P,{size:13})," Re-check"]})]})]}):e.jsx("div",{style:E,children:"Could not load readiness."})]})})}function ee({domain:s,selected:c,onToggleSlug:o,onToggleDomain:y,onOpenInBlockStudio:w}){const u=s.candidates.map(l=>l.slug),p=u.every(l=>c.has(l)),f=u.some(l=>c.has(l));return e.jsxs("div",{style:ie,children:[e.jsxs("div",{style:le,children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:p,ref:l=>{l&&(l.indeterminate=!p&&f)},onChange:()=>y(s)}),e.jsx("span",{style:{fontSize:13,fontWeight:700},children:s.name}),e.jsxs("span",{style:{fontSize:11,opacity:.6},children:[s.modelCount," model",s.modelCount===1?"":"s"]})]}),s.owner?e.jsxs("span",{style:{fontSize:11,opacity:.6},children:["owner ",s.owner]}):null]}),e.jsx("div",{style:{display:"grid",gap:6},children:s.candidates.map(l=>e.jsx(se,{candidate:l,checked:c.has(l.slug),onToggle:()=>o(l.slug),onOpenInBlockStudio:w},l.slug))})]})}function se({candidate:s,checked:c,onToggle:o,onOpenInBlockStudio:y}){const w=r.useMemo(()=>s.evidence.slice(0,3),[s.evidence]),[u,p]=r.useState(!1),[f,l]=r.useState(null),[k,R]=r.useState(!1),[T,W]=r.useState(null),[z,C]=r.useState(!1),[b,m]=r.useState(null),D=r.useCallback(()=>{p(a=>{const g=!a;return g&&!f&&!k&&(R(!0),W(null),I.proposePreview(s.slug).then(j=>l(j.candidate)).catch(j=>W(j instanceof Error?j.message:"Could not load the preview.")).finally(()=>R(!1))),g})},[s.slug,f,k]),v=f??s,L=v.sqlPreview,d=v.outputs??[],h=v.examples??[],t=v.certifierVerdict,n=v.description,i=r.useCallback(async()=>{C(!0),m(null);try{const a=await I.generateProposeDrafts({slugs:[s.slug]}),g=a.proposals.find(F=>F.slug===s.slug)??a.proposals[0],j=g==null?void 0:g.path;if(!j){m("No draft path was returned for this model yet.");return}await y(j,s.model)}catch(a){m(a instanceof Error?a.message:"Could not open this draft.")}finally{C(!1)}},[s.model,s.slug,y]),x=r.useCallback(()=>{O({target:"block",lockTarget:!0,prompt:`Refine the "${s.model}" block: ${n??`a ${s.pattern??"business"} model${s.grain?` at ${s.grain} grain`:""}`}.`,sourceLabel:`Refining ${s.model}`})},[s.grain,s.model,s.pattern,n]);return e.jsxs("div",{style:{...oe,opacity:c?1:.7},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto minmax(0, 1fr) auto",gap:10,alignItems:"start"},children:[e.jsx("input",{type:"checkbox",checked:c,onChange:o,style:{marginTop:3},"aria-label":`Include ${s.model}`}),e.jsxs("div",{style:{display:"grid",gap:4,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:14,fontWeight:700},children:s.model}),e.jsx(Y,{state:"ai_generated"}),s.pattern?e.jsx(ne,{children:s.pattern}):null,s.grain?e.jsxs("span",{style:{fontSize:11,opacity:.6},children:["grain ",s.grain]}):null]}),w.length>0?e.jsxs("div",{style:{fontSize:11,opacity:.66},children:[e.jsx("span",{style:{opacity:.8},children:"why: "}),w.join(" · ")]}):null]}),e.jsxs("button",{type:"button",onClick:D,"aria-expanded":u,style:de,children:[u?e.jsx(Q,{size:13}):e.jsx(V,{size:13}),u?"Hide":"Details"]})]}),u?e.jsx("div",{style:ae,children:k?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,opacity:.75},children:[e.jsx(N,{size:13,className:"spin"})," Loading the generated SQL and verdict…"]}):T?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:"var(--status-error, #cf222e)"},children:[e.jsx(B,{size:14})," ",T]}):e.jsxs(e.Fragment,{children:[n?e.jsx("div",{style:{fontSize:12,opacity:.82,lineHeight:1.5},children:n}):null,e.jsxs("div",{style:{display:"grid",gap:5},children:[e.jsx(A,{children:"SQL this block will run"}),L?e.jsx("pre",{style:ce,children:e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",fontSize:11.5,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:L.trim()})}):e.jsx("div",{style:{fontSize:11.5,opacity:.6},children:"The generated SQL is not available for this model yet."})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:12},children:[e.jsxs("div",{style:{display:"grid",gap:5,alignContent:"start"},children:[e.jsx(A,{children:"Outputs"}),d.length>0?e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:5},children:d.map(a=>e.jsx(re,{children:a},a))}):e.jsx("div",{style:{fontSize:11,opacity:.6},children:"No declared outputs yet."})]}),e.jsxs("div",{style:{display:"grid",gap:5,alignContent:"start"},children:[e.jsx(A,{children:"Answers questions like"}),h.length>0?e.jsx("ul",{style:{margin:0,padding:"0 0 0 16px",display:"grid",gap:3},children:h.slice(0,3).map(a=>e.jsx("li",{style:{fontSize:11.5,opacity:.82,lineHeight:1.45},children:a},a))}):e.jsx("div",{style:{fontSize:11,opacity:.6},children:"No example questions yet."})]})]}),e.jsx(te,{verdict:t}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsxs("button",{type:"button",onClick:()=>void i(),disabled:z,style:{...pe,opacity:z?.65:1},children:[z?e.jsx(N,{size:13,className:"spin"}):e.jsx(U,{size:13}),z?"Opening…":"Open in Block Studio"]}),e.jsxs("button",{type:"button",onClick:x,style:ge,children:[e.jsx(M,{size:13})," Refine with AI"]})]}),b?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:11.5,color:"var(--status-error, #cf222e)"},children:[e.jsx(B,{size:13})," ",b]}):null]})}):null]})}function te({verdict:s}){const c=!!(s!=null&&s.ready&&s.blocking.length===0),o=s?[...s.blocking,...s.warnings]:[];return e.jsxs("div",{style:{display:"grid",gap:5},children:[e.jsx(A,{children:"What's missing to certify"}),c?e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,color:"var(--status-success, #1f883d)"},children:[e.jsx(K,{size:14})," Grain, outputs, and context are set."]}):e.jsxs("div",{style:{display:"grid",gap:4},children:[e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,color:"var(--status-warning, #9a6700)"},children:[e.jsx(B,{size:14})," Needs an owner and passing tests before it can be certified."]}),o.length>0?e.jsx("ul",{style:{margin:0,padding:"0 0 0 16px",display:"grid",gap:2},children:o.map(y=>e.jsx("li",{style:{fontSize:11,opacity:.78,lineHeight:1.4},children:y},y))}):s?null:e.jsx("div",{style:{fontSize:11,opacity:.6},children:"Expand to load the Certifier verdict."})]})]})}function A({children:s}){return e.jsx("div",{style:{fontSize:10,fontWeight:800,letterSpacing:"0.05em",textTransform:"uppercase",opacity:.55},children:s})}function re({children:s}){return e.jsx("span",{style:{fontSize:11,fontWeight:600,padding:"3px 8px",borderRadius:6,border:"1px solid var(--border-color, rgba(0,0,0,0.12))",background:"var(--surface-hover, rgba(0,0,0,0.04))",fontFamily:"var(--font-mono, monospace)"},children:s})}function S({label:s,value:c,tone:o}){return e.jsxs("div",{style:{...xe,borderTop:`2px solid ${o==="success"?"var(--status-success, #1f883d)":"var(--border-color, rgba(0,0,0,0.10))"}`},children:[e.jsx("div",{style:{fontSize:11,opacity:.62},children:s}),e.jsx("div",{style:{fontSize:24,fontWeight:800},children:c})]})}function ne({children:s}){return e.jsx("span",{style:{fontSize:10,padding:"2px 7px",borderRadius:4,background:"var(--surface-hover, rgba(0,0,0,0.06))",opacity:.82},children:s})}const ie={border:"1px solid var(--border-color, rgba(0,0,0,0.10))",borderRadius:8,background:"var(--surface, rgba(0,0,0,0.02))",padding:12,display:"grid",gap:8},le={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,paddingBottom:6,borderBottom:"1px solid var(--border-color, rgba(0,0,0,0.08))"},oe={width:"100%",border:"1px solid var(--border-color, rgba(0,0,0,0.10))",borderLeft:"3px solid var(--status-warning, #9a6700)",borderRadius:7,background:"var(--surface, rgba(0,0,0,0.02))",padding:10,display:"grid",gap:10},ae={borderTop:"1px solid var(--border-color, rgba(0,0,0,0.08))",paddingTop:10,marginLeft:26,display:"grid",gap:12},de={display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",borderRadius:6,border:"1px solid var(--border-color, rgba(0,0,0,0.12))",background:"transparent",color:"inherit",fontSize:11,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",alignSelf:"start"},ce={margin:0,border:"1px solid var(--border-color, rgba(0,0,0,0.12))",borderRadius:8,background:"var(--color-bg-primary, rgba(0,0,0,0.03))",padding:"9px 11px",overflow:"auto",maxHeight:280},pe={display:"inline-flex",alignItems:"center",gap:6,padding:"6px 11px",borderRadius:6,border:"1px solid var(--color-accent-blue, #6b5dd3)",background:"var(--color-accent-blue, #6b5dd3)",color:"#fff",fontSize:12,fontWeight:650,cursor:"pointer",whiteSpace:"nowrap"},ge={display:"inline-flex",alignItems:"center",gap:6,padding:"6px 11px",borderRadius:6,border:"1px solid var(--border-color, rgba(0,0,0,0.12))",background:"transparent",color:"inherit",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},ue={display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:7,border:"1px solid var(--color-clay, #b4593f)",background:"var(--color-clay, #b4593f)",color:"#fff",fontSize:12.5,fontWeight:700,cursor:"pointer",whiteSpace:"nowrap"},xe={border:"1px solid var(--border-color, rgba(0,0,0,0.10))",borderRadius:7,background:"var(--surface, rgba(0,0,0,0.02))",padding:12},ye={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,border:"1px solid var(--border-color, rgba(0,0,0,0.10))",borderRadius:8,background:"var(--surface, rgba(0,0,0,0.02))",padding:"10px 12px"},fe={display:"inline-flex",alignItems:"center",gap:5,padding:"6px 11px",borderRadius:6,border:"1px solid var(--border-color, rgba(0,0,0,0.12))",background:"var(--surface, transparent)",color:"inherit",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},he={display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:6,border:"1px solid var(--status-success, #1f883d)",background:"var(--status-success, #1f883d)",color:"#fff",fontSize:12,fontWeight:650,cursor:"pointer",whiteSpace:"nowrap"},$={display:"inline-flex",alignItems:"center",gap:5,padding:"6px 11px",borderRadius:6,border:"1px solid var(--border-color, rgba(0,0,0,0.12))",background:"transparent",color:"inherit",fontSize:12,cursor:"pointer"},E={border:"1px dashed var(--border-color, rgba(0,0,0,0.16))",borderRadius:8,padding:24,fontSize:13,opacity:.85};export{Ce as ReadinessPage};
1
+ import{u as G,r,a as I,j as e,S as H,Y as P,aA as _,L as N,h as q,d as Q,e as V,B as U,f as K}from"./index-BTuliKhK.js";import{T as Y}from"./TrustBadge-DGuHB8kP.js";import{o as O}from"./ai-build-bus-1BR770pY.js";import{W as M}from"./wand-sparkles-BgTxZNBc.js";import{U as J,G as X}from"./user-round-BfrV8U-W.js";import{T as B}from"./triangle-alert-BSdIu2El.js";import{A as Z}from"./arrow-right-BI4cXgOY.js";import"./react-CRB3T2We.js";function Ce(){const{state:s,dispatch:c}=G(),[o,y]=r.useState(null),[w,u]=r.useState(!0),[p,f]=r.useState(new Set),[l,k]=r.useState(!1),[R,T]=r.useState(null),[W,z]=r.useState(null);r.useEffect(()=>{let t=!1;return I.getIdentity().then(n=>{!t&&(n!=null&&n.owner)&&z(n.owner)}).catch(()=>{}),()=>{t=!0}},[]);const C=r.useCallback(async(t,n)=>{const i={name:t.split("/").pop()??`${n}.dql`,path:t,type:"block",folder:"blocks"};s.files.some(a=>a.path===t)||c({type:"FILE_ADDED",file:i});const x=await I.openBlockStudio(t);c({type:"OPEN_BLOCK_STUDIO",file:i,payload:x})},[c,s.files]),b=r.useCallback(()=>{let t=!1;return u(!0),I.getProposeReadiness().then(n=>{if(t)return;y(n);const i=n.ready?n.plan.domains.flatMap(x=>x.candidates.map(a=>a.slug)):[];f(new Set(i)),u(!1)}),()=>{t=!0}},[]);r.useEffect(()=>b(),[b]);const m=r.useCallback(()=>{c({type:"SET_MAIN_VIEW",view:"block_studio"})},[c]),D=r.useCallback(t=>{f(n=>{const i=new Set(n);return i.has(t)?i.delete(t):i.add(t),i})},[]),v=r.useCallback(t=>{f(n=>{const i=new Set(n),x=t.candidates.map(g=>g.slug),a=x.every(g=>i.has(g));for(const g of x)a?i.delete(g):i.add(g);return i})},[]),A=r.useCallback(async()=>{const t=[...p];if(t.length===0)return;k(!0),T(null);const n=await I.generateProposeDrafts({slugs:t});if(k(!1),!n.ready){T(n.reason??"Could not generate drafts.");return}const i=n.proposals.find(x=>x.path);i!=null&&i.path?C(i.path,i.slug):m()},[p,m,C]),d=o==null?void 0:o.summary,h=o!=null&&o.ready?o.plan:null;return e.jsx("div",{style:{flex:1,minWidth:0,overflow:"auto"},children:e.jsxs("div",{style:{maxWidth:980,margin:"0 auto",padding:"22px 28px 40px",display:"grid",gap:16},children:[e.jsxs("header",{style:{display:"grid",gap:6},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx(H,{size:20}),e.jsx("div",{style:{fontSize:22,fontWeight:750},children:"Get started"}),e.jsx("div",{style:{flex:1}}),e.jsxs("button",{type:"button",onClick:()=>O({target:"block",lockTarget:!0,sourceLabel:"Describe a block to draft from your project context."}),style:ue,children:[e.jsx(M,{size:14})," Ask AI to build a block"]})]}),e.jsx("div",{style:{fontSize:13,opacity:.72,maxWidth:760,lineHeight:1.55},children:d!=null&&d.modelsScanned?`I scanned your dbt project and found ${d.businessModels} ${d.businessModels===1?"thing":"things"} worth governing — here's what each one does. Expand a row to see the SQL it would run and what's still missing to certify. Plumbing and low-value models are left out. Nothing is drafted or certified until you approve it.`:"I scanned your dbt project for the business models worth governing — here's what each one does. Expand a row to see the SQL it would run and what's still missing to certify. Nothing is drafted or certified until you approve it."}),W?e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11.5,opacity:.62},children:[e.jsx(J,{size:12})," drafting as ",W]}):null,e.jsxs("button",{type:"button",onClick:()=>c({type:"SET_MAIN_VIEW",view:"skills"}),style:{display:"inline-flex",alignItems:"center",gap:6,alignSelf:"start",marginTop:2,padding:0,border:"none",background:"transparent",color:"var(--color-accent-blue, #6b5dd3)",fontSize:12,fontWeight:650,cursor:"pointer"},children:[e.jsx(X,{size:13})," Teach the AI your business rules →"]})]}),w?e.jsx("div",{style:E,children:"Classifying dbt models and planning the business seed…"}):o?o.ready?e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:10},children:[e.jsx(S,{label:"dbt models scanned",value:d.modelsScanned}),e.jsx(S,{label:"Business models",value:d.businessModels,tone:"success"}),e.jsx(S,{label:"Plumbing excluded",value:d.plumbingExcluded}),e.jsx(S,{label:"Metrics found",value:d.metricsFound})]}),d.reviewTelemetry&&d.reviewTelemetry.existingDrafts>0?e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:10},children:[e.jsx(S,{label:"Drafts ready for review",value:`${Math.round((d.reviewTelemetry.readyForReviewRate??0)*100)}%`,tone:"success"}),e.jsx(S,{label:"Median draft age",value:d.reviewTelemetry.medianReviewAgeHours!=null?`${d.reviewTelemetry.medianReviewAgeHours.toFixed(1)}h`:"—"}),e.jsx(S,{label:"Est. review time",value:`~${d.reviewTelemetry.estimatedReviewMinutes} min`})]}):null,e.jsxs("div",{style:ye,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[e.jsx(_,{size:16}),e.jsxs("div",{style:{fontSize:13},children:[e.jsxs("strong",{children:["Will generate ",p.size]}),e.jsxs("span",{style:{opacity:.65},children:[" ","of ",h.willGenerate," planned · skipping ",h.willSkip," · ≤ ",h.config.maxPerDomain," per domain"]})]})]}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsxs("button",{type:"button",onClick:b,style:$,children:[e.jsx(P,{size:13})," Refresh"]}),e.jsxs("button",{type:"button",onClick:()=>void A(),disabled:l||p.size===0,style:{...he,opacity:l||p.size===0?.6:1},children:[l?e.jsx(N,{size:13,className:"spin"}):e.jsx(q,{size:13}),l?"Generating…":e.jsxs(e.Fragment,{children:["Approve & generate ",p.size>0?`(${p.size})`:""]})]})]})]}),R?e.jsxs("div",{style:{...E,display:"flex",gap:8,alignItems:"center",borderColor:"var(--status-error, #cf222e)"},children:[e.jsx(B,{size:16})," ",R]}):null,e.jsx("div",{style:{display:"grid",gap:12},children:h.domains.length===0?e.jsxs("div",{style:E,children:["No business models found to govern. Tag a layer in ",e.jsx("code",{children:"dql.config.json"})," ","(",e.jsx("code",{children:"propose.businessLayers"}),") or add ",e.jsx("code",{children:"meta.dql.business"})," to your dbt models."]}):h.domains.map(t=>e.jsx(ee,{domain:t,selected:p,onToggleSlug:D,onToggleDomain:v,onOpenInBlockStudio:C},t.name))}),e.jsx("div",{style:{display:"flex",justifyContent:"flex-end"},children:e.jsxs("button",{type:"button",onClick:m,style:fe,children:["Open Block Studio ",e.jsx(Z,{size:13})]})})]}):e.jsxs("div",{style:{...E,display:"flex",alignItems:"flex-start",gap:10},children:[e.jsx(B,{size:18,style:{flexShrink:0,marginTop:1}}),e.jsxs("div",{style:{display:"grid",gap:8},children:[e.jsx("div",{style:{fontWeight:650},children:"Not ready to propose yet"}),e.jsx("div",{style:{opacity:.8},children:o.reason}),e.jsxs("button",{type:"button",onClick:b,style:$,children:[e.jsx(P,{size:13})," Re-check"]})]})]}):e.jsx("div",{style:E,children:"Could not load readiness."})]})})}function ee({domain:s,selected:c,onToggleSlug:o,onToggleDomain:y,onOpenInBlockStudio:w}){const u=s.candidates.map(l=>l.slug),p=u.every(l=>c.has(l)),f=u.some(l=>c.has(l));return e.jsxs("div",{style:ie,children:[e.jsxs("div",{style:le,children:[e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:8,cursor:"pointer"},children:[e.jsx("input",{type:"checkbox",checked:p,ref:l=>{l&&(l.indeterminate=!p&&f)},onChange:()=>y(s)}),e.jsx("span",{style:{fontSize:13,fontWeight:700},children:s.name}),e.jsxs("span",{style:{fontSize:11,opacity:.6},children:[s.modelCount," model",s.modelCount===1?"":"s"]})]}),s.owner?e.jsxs("span",{style:{fontSize:11,opacity:.6},children:["owner ",s.owner]}):null]}),e.jsx("div",{style:{display:"grid",gap:6},children:s.candidates.map(l=>e.jsx(se,{candidate:l,checked:c.has(l.slug),onToggle:()=>o(l.slug),onOpenInBlockStudio:w},l.slug))})]})}function se({candidate:s,checked:c,onToggle:o,onOpenInBlockStudio:y}){const w=r.useMemo(()=>s.evidence.slice(0,3),[s.evidence]),[u,p]=r.useState(!1),[f,l]=r.useState(null),[k,R]=r.useState(!1),[T,W]=r.useState(null),[z,C]=r.useState(!1),[b,m]=r.useState(null),D=r.useCallback(()=>{p(a=>{const g=!a;return g&&!f&&!k&&(R(!0),W(null),I.proposePreview(s.slug).then(j=>l(j.candidate)).catch(j=>W(j instanceof Error?j.message:"Could not load the preview.")).finally(()=>R(!1))),g})},[s.slug,f,k]),v=f??s,A=v.sqlPreview,d=v.outputs??[],h=v.examples??[],t=v.certifierVerdict,n=v.description,i=r.useCallback(async()=>{C(!0),m(null);try{const a=await I.generateProposeDrafts({slugs:[s.slug]}),g=a.proposals.find(F=>F.slug===s.slug)??a.proposals[0],j=g==null?void 0:g.path;if(!j){m("No draft path was returned for this model yet.");return}await y(j,s.model)}catch(a){m(a instanceof Error?a.message:"Could not open this draft.")}finally{C(!1)}},[s.model,s.slug,y]),x=r.useCallback(()=>{O({target:"block",lockTarget:!0,prompt:`Refine the "${s.model}" block: ${n??`a ${s.pattern??"business"} model${s.grain?` at ${s.grain} grain`:""}`}.`,sourceLabel:`Refining ${s.model}`})},[s.grain,s.model,s.pattern,n]);return e.jsxs("div",{style:{...oe,opacity:c?1:.7},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"auto minmax(0, 1fr) auto",gap:10,alignItems:"start"},children:[e.jsx("input",{type:"checkbox",checked:c,onChange:o,style:{marginTop:3},"aria-label":`Include ${s.model}`}),e.jsxs("div",{style:{display:"grid",gap:4,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:14,fontWeight:700},children:s.model}),e.jsx(Y,{state:"ai_generated"}),s.pattern?e.jsx(ne,{children:s.pattern}):null,s.grain?e.jsxs("span",{style:{fontSize:11,opacity:.6},children:["grain ",s.grain]}):null]}),w.length>0?e.jsxs("div",{style:{fontSize:11,opacity:.66},children:[e.jsx("span",{style:{opacity:.8},children:"why: "}),w.join(" · ")]}):null]}),e.jsxs("button",{type:"button",onClick:D,"aria-expanded":u,style:de,children:[u?e.jsx(Q,{size:13}):e.jsx(V,{size:13}),u?"Hide":"Details"]})]}),u?e.jsx("div",{style:ae,children:k?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,opacity:.75},children:[e.jsx(N,{size:13,className:"spin"})," Loading the generated SQL and verdict…"]}):T?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,fontSize:12,color:"var(--status-error, #cf222e)"},children:[e.jsx(B,{size:14})," ",T]}):e.jsxs(e.Fragment,{children:[n?e.jsx("div",{style:{fontSize:12,opacity:.82,lineHeight:1.5},children:n}):null,e.jsxs("div",{style:{display:"grid",gap:5},children:[e.jsx(L,{children:"SQL this block will run"}),A?e.jsx("pre",{style:ce,children:e.jsx("code",{style:{fontFamily:"var(--font-mono, monospace)",fontSize:11.5,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:A.trim()})}):e.jsx("div",{style:{fontSize:11.5,opacity:.6},children:"The generated SQL is not available for this model yet."})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:12},children:[e.jsxs("div",{style:{display:"grid",gap:5,alignContent:"start"},children:[e.jsx(L,{children:"Outputs"}),d.length>0?e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:5},children:d.map(a=>e.jsx(re,{children:a},a))}):e.jsx("div",{style:{fontSize:11,opacity:.6},children:"No declared outputs yet."})]}),e.jsxs("div",{style:{display:"grid",gap:5,alignContent:"start"},children:[e.jsx(L,{children:"Answers questions like"}),h.length>0?e.jsx("ul",{style:{margin:0,padding:"0 0 0 16px",display:"grid",gap:3},children:h.slice(0,3).map(a=>e.jsx("li",{style:{fontSize:11.5,opacity:.82,lineHeight:1.45},children:a},a))}):e.jsx("div",{style:{fontSize:11,opacity:.6},children:"No example questions yet."})]})]}),e.jsx(te,{verdict:t}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[e.jsxs("button",{type:"button",onClick:()=>void i(),disabled:z,style:{...pe,opacity:z?.65:1},children:[z?e.jsx(N,{size:13,className:"spin"}):e.jsx(U,{size:13}),z?"Opening…":"Open in Block Studio"]}),e.jsxs("button",{type:"button",onClick:x,style:ge,children:[e.jsx(M,{size:13})," Refine with AI"]})]}),b?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,fontSize:11.5,color:"var(--status-error, #cf222e)"},children:[e.jsx(B,{size:13})," ",b]}):null]})}):null]})}function te({verdict:s}){const c=!!(s!=null&&s.ready&&s.blocking.length===0),o=s?[...s.blocking,...s.warnings]:[];return e.jsxs("div",{style:{display:"grid",gap:5},children:[e.jsx(L,{children:"What's missing to certify"}),c?e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,color:"var(--status-success, #1f883d)"},children:[e.jsx(K,{size:14})," Grain, outputs, and context are set."]}):e.jsxs("div",{style:{display:"grid",gap:4},children:[e.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,color:"var(--status-warning, #9a6700)"},children:[e.jsx(B,{size:14})," Needs an owner and passing tests before it can be certified."]}),o.length>0?e.jsx("ul",{style:{margin:0,padding:"0 0 0 16px",display:"grid",gap:2},children:o.map(y=>e.jsx("li",{style:{fontSize:11,opacity:.78,lineHeight:1.4},children:y},y))}):s?null:e.jsx("div",{style:{fontSize:11,opacity:.6},children:"Expand to load the Certifier verdict."})]})]})}function L({children:s}){return e.jsx("div",{style:{fontSize:10,fontWeight:800,letterSpacing:"0.05em",textTransform:"uppercase",opacity:.55},children:s})}function re({children:s}){return e.jsx("span",{style:{fontSize:11,fontWeight:600,padding:"3px 8px",borderRadius:6,border:"1px solid var(--border-color, rgba(0,0,0,0.12))",background:"var(--surface-hover, rgba(0,0,0,0.04))",fontFamily:"var(--font-mono, monospace)"},children:s})}function S({label:s,value:c,tone:o}){return e.jsxs("div",{style:{...xe,borderTop:`2px solid ${o==="success"?"var(--status-success, #1f883d)":"var(--border-color, rgba(0,0,0,0.10))"}`},children:[e.jsx("div",{style:{fontSize:11,opacity:.62},children:s}),e.jsx("div",{style:{fontSize:24,fontWeight:800},children:c})]})}function ne({children:s}){return e.jsx("span",{style:{fontSize:10,padding:"2px 7px",borderRadius:4,background:"var(--surface-hover, rgba(0,0,0,0.06))",opacity:.82},children:s})}const ie={border:"1px solid var(--border-color, rgba(0,0,0,0.10))",borderRadius:8,background:"var(--surface, rgba(0,0,0,0.02))",padding:12,display:"grid",gap:8},le={display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,paddingBottom:6,borderBottom:"1px solid var(--border-color, rgba(0,0,0,0.08))"},oe={width:"100%",border:"1px solid var(--border-color, rgba(0,0,0,0.10))",borderLeft:"3px solid var(--status-warning, #9a6700)",borderRadius:7,background:"var(--surface, rgba(0,0,0,0.02))",padding:10,display:"grid",gap:10},ae={borderTop:"1px solid var(--border-color, rgba(0,0,0,0.08))",paddingTop:10,marginLeft:26,display:"grid",gap:12},de={display:"inline-flex",alignItems:"center",gap:4,padding:"4px 8px",borderRadius:6,border:"1px solid var(--border-color, rgba(0,0,0,0.12))",background:"transparent",color:"inherit",fontSize:11,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",alignSelf:"start"},ce={margin:0,border:"1px solid var(--border-color, rgba(0,0,0,0.12))",borderRadius:8,background:"var(--color-bg-primary, rgba(0,0,0,0.03))",padding:"9px 11px",overflow:"auto",maxHeight:280},pe={display:"inline-flex",alignItems:"center",gap:6,padding:"6px 11px",borderRadius:6,border:"1px solid var(--color-accent-blue, #6b5dd3)",background:"var(--color-accent-blue, #6b5dd3)",color:"#fff",fontSize:12,fontWeight:650,cursor:"pointer",whiteSpace:"nowrap"},ge={display:"inline-flex",alignItems:"center",gap:6,padding:"6px 11px",borderRadius:6,border:"1px solid var(--border-color, rgba(0,0,0,0.12))",background:"transparent",color:"inherit",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},ue={display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:7,border:"1px solid var(--color-clay, #b4593f)",background:"var(--color-clay, #b4593f)",color:"#fff",fontSize:12.5,fontWeight:700,cursor:"pointer",whiteSpace:"nowrap"},xe={border:"1px solid var(--border-color, rgba(0,0,0,0.10))",borderRadius:7,background:"var(--surface, rgba(0,0,0,0.02))",padding:12},ye={display:"flex",alignItems:"center",justifyContent:"space-between",gap:12,border:"1px solid var(--border-color, rgba(0,0,0,0.10))",borderRadius:8,background:"var(--surface, rgba(0,0,0,0.02))",padding:"10px 12px"},fe={display:"inline-flex",alignItems:"center",gap:5,padding:"6px 11px",borderRadius:6,border:"1px solid var(--border-color, rgba(0,0,0,0.12))",background:"var(--surface, transparent)",color:"inherit",fontSize:12,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap"},he={display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:6,border:"1px solid var(--status-success, #1f883d)",background:"var(--status-success, #1f883d)",color:"#fff",fontSize:12,fontWeight:650,cursor:"pointer",whiteSpace:"nowrap"},$={display:"inline-flex",alignItems:"center",gap:5,padding:"6px 11px",borderRadius:6,border:"1px solid var(--border-color, rgba(0,0,0,0.12))",background:"transparent",color:"inherit",fontSize:12,cursor:"pointer"},E={border:"1px dashed var(--border-color, rgba(0,0,0,0.16))",borderRadius:8,padding:24,fontSize:13,opacity:.85};export{Ce as ReadinessPage};
@@ -1,6 +1,6 @@
1
- import{g as ne,u as ae,t as de,r as a,a as S,j as t,Z as le,_ as pe,$ as ce,a0 as fe,k as ue,S as ge}from"./index-Ca3UeUWI.js";import{A as xe}from"./arrow-left-D2FbLWqh.js";import{A as ye}from"./arrow-right-OYItAZ-s.js";import"./react-CRB3T2We.js";/**
1
+ import{c as ne,u as ae,t as de,r as a,a as S,j as t,Z as le,_ as pe,$ as ce,a0 as fe,F as ue,S as ge}from"./index-BTuliKhK.js";import{A as xe}from"./arrow-left-IjlnAihE.js";import{A as ye}from"./arrow-right-BI4cXgOY.js";import"./react-CRB3T2We.js";/**
2
2
  * @license lucide-react v0.563.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const me=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Se=ne("message-circle-question-mark",me);function he(e){return Object.values(e).some(p=>{if(!p||typeof p!="object")return!1;const c=p,l=String(c.driver??c.type??"").toLowerCase();if(l!=="duckdb")return!!l;const i=String(c.filepath??c.path??"").trim();return!!(i&&i!==":memory:")})}function ve(e){return e?`${e.label}${e.model?` · ${e.model}`:""}`:"No AI provider configured."}function Ce({launch:e,onAcknowledged:p}){const{state:c,dispatch:l}=ae(),i=de[c.themeMode],[s,r]=a.useState(1),[R,X]=a.useState(!0),[h,z]=a.useState("missing"),[v,$]=a.useState("missing"),[x,B]=a.useState("missing"),[P,T]=a.useState("Choose a local dbt project or Git repository."),[k,M]=a.useState("Import a dbt profile or enter warehouse credentials."),[L,O]=a.useState(null),[m,E]=a.useState(!1),[u,W]=a.useState(!1),[Y,I]=a.useState(!(e!=null&&e.requiresDbtReapply)),[_,w]=a.useState(null),d=!!((e==null?void 0:e.reason)==="version_upgrade"&&e.requiresDbtReapply&&!Y);a.useEffect(()=>{I(!(e!=null&&e.requiresDbtReapply)),w(null),e!=null&&e.requiresDbtReapply&&r(1)},[e==null?void 0:e.requiresDbtReapply,e==null?void 0:e.version]),a.useEffect(()=>{let o=!0;return Promise.all([S.getOnboardingStatus().catch(()=>null),S.getBlockStudioDbtStatus().catch(()=>null),S.getConnections().catch(()=>null),S.getProviderSettings().catch(()=>null)]).then(([n,g,b,y])=>{var U,V,G,K,Z,J;if(!o)return;if(((U=n==null?void 0:n.dbt)!=null&&U.configured||g!=null&&g.configured&&g.artifacts.manifest.exists)&&(z(((V=n==null?void 0:n.modeling)==null?void 0:V.snapshotState)==="ready"?"passed":"configured"),T(((G=n==null?void 0:n.preparation)==null?void 0:G.message)||((K=n==null?void 0:n.dbt)==null?void 0:K.repoUrl)||((Z=n==null?void 0:n.dbt)==null?void 0:Z.projectDir)||(g==null?void 0:g.projectPath)||"dbt project configured")),b&&he(b.connections??{})){$("configured");const f=(J=b.connections)==null?void 0:J[b.default],re=f&&typeof f=="object"?String(f.driver??f.type??"Database"):"Database";M(`${re} configured — test to verify reachability.`)}const H=(y==null?void 0:y.providers.find(f=>f.active&&f.configured))??(y==null?void 0:y.providers.find(f=>f.enabled&&f.configured))??null;H&&(O(H),B("configured"))}).finally(()=>o&&X(!1)),()=>{o=!1}},[]);const q=async()=>{W(!0),w(null);try{return await S.acknowledgeSetupLaunch(),p==null||p(),!0}catch(o){return w(o instanceof Error?o.message:String(o)),!1}finally{W(!1)}},ee=()=>{u||d||q().then(o=>{o&&l({type:"CLOSE_SETUP"})})},j=o=>{u||d||q().then(n=>{n&&(l({type:"SET_MAIN_VIEW",view:o}),o==="notebook"&&l({type:"OPEN_NEW_NOTEBOOK_MODAL"}),l({type:"CLOSE_SETUP"}))})},te=o=>{I(!0),z(o.readiness==="ready"?"passed":"configured"),T(o.readinessDetail||`${o.name} · ${o.summary}`)},ie=o=>{E(!1),B("passed"),O(o)},se=a.useMemo(()=>R?"Loading existing project-local configuration…":s===1?d?`Required for DQL ${e==null?void 0:e.version}: Preview and Reapply the prefilled dbt project.`:h==="missing"?"Preview before applying; existing dbt settings stay untouched.":`${h==="passed"?"Ready":"Configured"} · ${P}`:s===2?v==="passed"?`Test passed · ${k}`:v==="configured"?k:"A failed test rolls back to the previous connection.":s===3?m?"AI skipped · limited-AI mode remains available.":x==="missing"?"Optional · skip for now or configure a provider.":`${x==="passed"?"Test passed":"Configured"} · ${ve(L)}`:"Setup complete",[L,m,x,k,v,e==null?void 0:e.version,R,P,h,d,s]),Q=i.textSecondary,N={display:"inline-flex",alignItems:"center",gap:7,height:34,padding:"0 16px",borderRadius:8,border:"none",background:i.accent,color:"#fff",fontSize:12.5,fontWeight:700,cursor:"pointer",fontFamily:i.font},C={display:"inline-flex",alignItems:"center",gap:7,height:34,padding:"0 14px",borderRadius:8,border:`1px solid ${i.headerBorder}`,background:i.cellBg,color:i.textSecondary,fontSize:12.5,fontWeight:650,cursor:"pointer",fontFamily:i.font},oe=(e==null?void 0:e.reason)==="version_upgrade"?`DQL ${e.version} update review`:(e==null?void 0:e.reason)==="first_install"?`Welcome to DQL ${e.version}`:"Guided Setup",F=(e==null?void 0:e.reason)==="version_upgrade"?d?`DQL was updated${e.acknowledgedVersion?` from ${e.acknowledgedVersion}`:""} to ${e.version}. Reapply the prefilled dbt project to rebuild its OSS governed snapshot with this version. Saved paths and credentials remain unchanged until Apply succeeds.`:`DQL was updated${e.acknowledgedVersion?` from ${e.acknowledgedVersion}`:""} to ${e.version}. The dbt project was reapplied with this version; review the remaining saved connections before finishing.`:(e==null?void 0:e.reason)==="first_install"?`DQL ${e.version} is installed. Connect the project and database before entering the workspace; AI remains optional.`:null;return t.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Guided Setup",style:{position:"fixed",inset:0,zIndex:1e3,background:i.appBg,color:i.textPrimary,display:"flex",flexDirection:"column",fontFamily:i.font},children:[t.jsxs("header",{style:{height:54,flexShrink:0,borderBottom:`1px solid ${i.headerBorder}`,background:i.headerBg,display:"flex",alignItems:"center",gap:11,padding:"0 20px"},children:[t.jsx("span",{style:{width:29,height:29,borderRadius:7,background:"linear-gradient(135deg, #5b8cff 0%, #7c5cff 100%)",color:"#fff",display:"inline-flex",alignItems:"center",justifyContent:"center",fontFamily:i.fontMono,fontSize:10,fontWeight:800},children:"DQL"}),t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:13.5,fontWeight:700},children:oe}),t.jsx("div",{style:{fontSize:10.5,color:i.textMuted},children:"Project → Database → optional AI → Finish"})]}),t.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:10},children:[t.jsxs("span",{style:{fontSize:11.5,color:i.textMuted},children:["Step ",s," of 4"]}),t.jsx("div",{style:{display:"flex",gap:4},"aria-hidden":!0,children:[1,2,3,4].map(o=>t.jsx("span",{style:{width:23,height:4,borderRadius:999,background:o<=s?i.accent:i.pillBg}},o))})]})]}),t.jsx("main",{style:{flex:1,minHeight:0,overflow:"auto"},children:t.jsxs("div",{style:{width:"min(760px, calc(100% - 36px))",margin:"0 auto",padding:"26px 0 34px"},children:[F?t.jsx("div",{style:{marginBottom:18,border:"1px solid var(--status-info-border)",background:"var(--status-info-bg)",borderRadius:10,padding:"11px 13px",color:Q,fontSize:11.5,lineHeight:1.55},children:F}):null,s===1?t.jsx(D,{eyebrow:"Step 1 of 4",title:"Connect your dbt project",description:"Preview a local project or Git repository, then apply it only after the manifest is valid.",t:i,children:t.jsx(le,{compact:!0,reapplyRequired:d,onConfigured:te})}):null,s===2?t.jsx(D,{eyebrow:"Step 2 of 4",title:"Connect your database",description:"Use the same profile import, enterprise authentication fields, test, and rollback flow available in Settings.",t:i,children:t.jsx(pe,{variant:"setup",onConfigured:o=>{$("passed"),M(o)}})}):null,s===3?t.jsxs(D,{eyebrow:"Step 3 of 4",title:"Set up an AI provider",description:"Optional. AI powers governed Ask and assisted authoring; deterministic queries and non-AI product paths remain available without it.",badge:"Optional",t:i,children:[t.jsx(ce,{embedded:!0,includeMemory:!1,section:"providers",editorMode:"setup",onProviderConfigured:ie}),t.jsxs("div",{style:{border:"1px solid var(--status-info-border)",background:"var(--status-info-bg)",borderRadius:10,padding:"11px 13px",display:"flex",alignItems:"center",gap:12},children:[t.jsx("div",{style:{flex:1,fontSize:11.5,color:Q,lineHeight:1.5},children:"Continue in limited-AI mode and configure a provider later in Settings."}),t.jsx("button",{type:"button",onClick:()=>{E(!0),r(4)},style:C,children:"Skip AI for now"})]})]}):null,s===4?t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[t.jsxs("div",{style:{textAlign:"center"},children:[t.jsx("div",{style:{fontSize:11,fontWeight:750,letterSpacing:"0.06em",textTransform:"uppercase",color:i.accent},children:"Step 4 of 4 · Setup complete"}),t.jsx("h2",{style:{margin:"7px 0 0",fontSize:22,color:i.textPrimary},children:"Where do you want to start?"}),x==="missing"||m?t.jsx("div",{style:{fontSize:12,color:i.textMuted,marginTop:7},children:"AI is not configured. Deterministic and non-AI workflows remain available; return to Settings when you want governed Ask."}):null]}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(190px, 1fr))",gap:11},children:[t.jsx(A,{icon:t.jsx(fe,{size:17}),title:"Build your domain",body:"Model entities, prove joins, and add governed context.",action:"Open Domains",onClick:()=>j("domains"),t:i,primary:!0}),t.jsx(A,{icon:t.jsx(Se,{size:17}),title:"Ask",body:x==="missing"||m?"Open Ask in limited mode; configure AI before a governed model answer.":"Ask a business question grounded in your governed context.",action:"Open Ask",onClick:()=>j("ask"),t:i}),t.jsx(A,{icon:t.jsx(ue,{size:17}),title:"Research notebook",body:"Work with SQL, DQL, and charts, then save reusable blocks.",action:"New notebook",onClick:()=>j("notebook"),t:i})]})]}):null]})}),t.jsxs("footer",{style:{flexShrink:0,minHeight:58,borderTop:`1px solid ${i.headerBorder}`,background:i.headerBg,display:"flex",alignItems:"center",gap:10,padding:"11px 22px"},children:[s>1?t.jsxs("button",{type:"button",onClick:()=>r(o=>Math.max(1,o-1)),style:C,children:[t.jsx(xe,{size:13})," Back"]}):null,t.jsx("div",{style:{flex:1}}),t.jsx("span",{style:{fontSize:11,color:i.textMuted,maxWidth:420,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:se}),_?t.jsx("span",{role:"alert",style:{fontSize:11,color:"var(--status-error)",maxWidth:320},children:_}):null,t.jsx("button",{type:"button",disabled:u||d,onClick:ee,style:{...C,opacity:u||d?.5:1,cursor:u||d?"not-allowed":"pointer"},children:u?"Saving review…":d?"Reapply required":(e==null?void 0:e.reason)==="version_upgrade"?"Close update review":h==="missing"&&v==="missing"?"Skip setup":"Close setup"}),s<4?t.jsxs("button",{type:"button",disabled:s===1&&d,onClick:()=>r(o=>Math.min(4,o+1)),style:{...N,opacity:s===1&&d?.5:1,cursor:s===1&&d?"not-allowed":"pointer"},children:[s===1?"Continue to database":s===2?"Continue to optional AI":"Continue to finish"," ",t.jsx(ye,{size:13})]}):t.jsxs("button",{type:"button",disabled:u,onClick:()=>j(x==="missing"||m?"domains":"ask"),style:{...N,opacity:u?.65:1},children:[t.jsx(ge,{size:13})," Finish setup"]})]})]})}function D({eyebrow:e,title:p,description:c,badge:l,children:i,t:s}){return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:17},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,fontWeight:750,letterSpacing:"0.06em",textTransform:"uppercase",color:s.accent},children:e}),t.jsxs("h2",{style:{margin:"6px 0 0",fontSize:21,fontWeight:750,color:s.textPrimary,display:"flex",alignItems:"center",gap:8},children:[p,l?t.jsx("span",{style:{border:`1px solid ${s.headerBorder}`,color:s.textMuted,borderRadius:999,padding:"2px 9px",fontSize:10,fontWeight:750},children:l}):null]}),t.jsx("div",{style:{marginTop:6,fontSize:12.5,color:s.textSecondary,lineHeight:1.55},children:c})]}),i]})}function A({icon:e,title:p,body:c,action:l,onClick:i,primary:s=!1,t:r}){return t.jsxs("button",{type:"button",onClick:i,style:{border:`1.5px solid ${s?r.accent:r.headerBorder}`,borderRadius:12,background:s?"var(--accent-dim)":r.cellBg,padding:17,textAlign:"left",cursor:"pointer",fontFamily:r.font,minHeight:170,display:"flex",flexDirection:"column"},children:[t.jsx("span",{style:{width:34,height:34,borderRadius:9,color:s?r.accent:r.textSecondary,background:s?r.cellBg:r.appBg,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e}),t.jsx("span",{style:{marginTop:12,fontSize:13.5,fontWeight:750,color:r.textPrimary},children:p}),t.jsx("span",{style:{marginTop:6,fontSize:11.5,color:r.textSecondary,lineHeight:1.5},children:c}),t.jsxs("span",{style:{marginTop:"auto",paddingTop:12,fontSize:11.5,fontWeight:700,color:s?r.accent:r.textSecondary},children:[l," →"]})]})}export{Ce as SetupOnboarding};
6
+ */const me=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],Se=ne("message-circle-question-mark",me);function he(e){return Object.values(e).some(p=>{if(!p||typeof p!="object")return!1;const c=p,l=String(c.driver??c.type??"").toLowerCase();if(l!=="duckdb")return!!l;const i=String(c.filepath??c.path??"").trim();return!!(i&&i!==":memory:")})}function ve(e){return e?`${e.label}${e.model?` · ${e.model}`:""}`:"No AI provider configured."}function Ce({launch:e,onAcknowledged:p}){const{state:c,dispatch:l}=ae(),i=de[c.themeMode],[s,r]=a.useState(1),[R,X]=a.useState(!0),[h,z]=a.useState("missing"),[v,$]=a.useState("missing"),[x,B]=a.useState("missing"),[P,T]=a.useState("Choose a local dbt project or Git repository."),[k,M]=a.useState("Import a dbt profile or enter warehouse credentials."),[L,O]=a.useState(null),[m,E]=a.useState(!1),[u,W]=a.useState(!1),[Y,I]=a.useState(!(e!=null&&e.requiresDbtReapply)),[_,w]=a.useState(null),d=!!((e==null?void 0:e.reason)==="version_upgrade"&&e.requiresDbtReapply&&!Y);a.useEffect(()=>{I(!(e!=null&&e.requiresDbtReapply)),w(null),e!=null&&e.requiresDbtReapply&&r(1)},[e==null?void 0:e.requiresDbtReapply,e==null?void 0:e.version]),a.useEffect(()=>{let o=!0;return Promise.all([S.getOnboardingStatus().catch(()=>null),S.getBlockStudioDbtStatus().catch(()=>null),S.getConnections().catch(()=>null),S.getProviderSettings().catch(()=>null)]).then(([n,g,b,y])=>{var U,V,G,K,Z,J;if(!o)return;if(((U=n==null?void 0:n.dbt)!=null&&U.configured||g!=null&&g.configured&&g.artifacts.manifest.exists)&&(z(((V=n==null?void 0:n.modeling)==null?void 0:V.snapshotState)==="ready"?"passed":"configured"),T(((G=n==null?void 0:n.preparation)==null?void 0:G.message)||((K=n==null?void 0:n.dbt)==null?void 0:K.repoUrl)||((Z=n==null?void 0:n.dbt)==null?void 0:Z.projectDir)||(g==null?void 0:g.projectPath)||"dbt project configured")),b&&he(b.connections??{})){$("configured");const f=(J=b.connections)==null?void 0:J[b.default],re=f&&typeof f=="object"?String(f.driver??f.type??"Database"):"Database";M(`${re} configured — test to verify reachability.`)}const H=(y==null?void 0:y.providers.find(f=>f.active&&f.configured))??(y==null?void 0:y.providers.find(f=>f.enabled&&f.configured))??null;H&&(O(H),B("configured"))}).finally(()=>o&&X(!1)),()=>{o=!1}},[]);const q=async()=>{W(!0),w(null);try{return await S.acknowledgeSetupLaunch(),p==null||p(),!0}catch(o){return w(o instanceof Error?o.message:String(o)),!1}finally{W(!1)}},ee=()=>{u||d||q().then(o=>{o&&l({type:"CLOSE_SETUP"})})},j=o=>{u||d||q().then(n=>{n&&(l({type:"SET_MAIN_VIEW",view:o}),o==="notebook"&&l({type:"OPEN_NEW_NOTEBOOK_MODAL"}),l({type:"CLOSE_SETUP"}))})},te=o=>{I(!0),z(o.readiness==="ready"?"passed":"configured"),T(o.readinessDetail||`${o.name} · ${o.summary}`)},ie=o=>{E(!1),B("passed"),O(o)},se=a.useMemo(()=>R?"Loading existing project-local configuration…":s===1?d?`Required for DQL ${e==null?void 0:e.version}: Preview and Reapply the prefilled dbt project.`:h==="missing"?"Preview before applying; existing dbt settings stay untouched.":`${h==="passed"?"Ready":"Configured"} · ${P}`:s===2?v==="passed"?`Test passed · ${k}`:v==="configured"?k:"A failed test rolls back to the previous connection.":s===3?m?"AI skipped · limited-AI mode remains available.":x==="missing"?"Optional · skip for now or configure a provider.":`${x==="passed"?"Test passed":"Configured"} · ${ve(L)}`:"Setup complete",[L,m,x,k,v,e==null?void 0:e.version,R,P,h,d,s]),Q=i.textSecondary,F={display:"inline-flex",alignItems:"center",gap:7,height:34,padding:"0 16px",borderRadius:8,border:"none",background:i.accent,color:"#fff",fontSize:12.5,fontWeight:700,cursor:"pointer",fontFamily:i.font},C={display:"inline-flex",alignItems:"center",gap:7,height:34,padding:"0 14px",borderRadius:8,border:`1px solid ${i.headerBorder}`,background:i.cellBg,color:i.textSecondary,fontSize:12.5,fontWeight:650,cursor:"pointer",fontFamily:i.font},oe=(e==null?void 0:e.reason)==="version_upgrade"?`DQL ${e.version} update review`:(e==null?void 0:e.reason)==="first_install"?`Welcome to DQL ${e.version}`:"Guided Setup",N=(e==null?void 0:e.reason)==="version_upgrade"?d?`DQL was updated${e.acknowledgedVersion?` from ${e.acknowledgedVersion}`:""} to ${e.version}. Reapply the prefilled dbt project to rebuild its OSS governed snapshot with this version. Saved paths and credentials remain unchanged until Apply succeeds.`:`DQL was updated${e.acknowledgedVersion?` from ${e.acknowledgedVersion}`:""} to ${e.version}. The dbt project was reapplied with this version; review the remaining saved connections before finishing.`:(e==null?void 0:e.reason)==="first_install"?`DQL ${e.version} is installed. Connect the project and database before entering the workspace; AI remains optional.`:null;return t.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":"Guided Setup",style:{position:"fixed",inset:0,zIndex:1e3,background:i.appBg,color:i.textPrimary,display:"flex",flexDirection:"column",fontFamily:i.font},children:[t.jsxs("header",{style:{height:54,flexShrink:0,borderBottom:`1px solid ${i.headerBorder}`,background:i.headerBg,display:"flex",alignItems:"center",gap:11,padding:"0 20px"},children:[t.jsx("span",{style:{width:29,height:29,borderRadius:7,background:"linear-gradient(135deg, #5b8cff 0%, #7c5cff 100%)",color:"#fff",display:"inline-flex",alignItems:"center",justifyContent:"center",fontFamily:i.fontMono,fontSize:10,fontWeight:800},children:"DQL"}),t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:13.5,fontWeight:700},children:oe}),t.jsx("div",{style:{fontSize:10.5,color:i.textMuted},children:"Project → Database → optional AI → Finish"})]}),t.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:10},children:[t.jsxs("span",{style:{fontSize:11.5,color:i.textMuted},children:["Step ",s," of 4"]}),t.jsx("div",{style:{display:"flex",gap:4},"aria-hidden":!0,children:[1,2,3,4].map(o=>t.jsx("span",{style:{width:23,height:4,borderRadius:999,background:o<=s?i.accent:i.pillBg}},o))})]})]}),t.jsx("main",{style:{flex:1,minHeight:0,overflow:"auto"},children:t.jsxs("div",{style:{width:"min(760px, calc(100% - 36px))",margin:"0 auto",padding:"26px 0 34px"},children:[N?t.jsx("div",{style:{marginBottom:18,border:"1px solid var(--status-info-border)",background:"var(--status-info-bg)",borderRadius:10,padding:"11px 13px",color:Q,fontSize:11.5,lineHeight:1.55},children:N}):null,s===1?t.jsx(D,{eyebrow:"Step 1 of 4",title:"Connect your dbt project",description:"Preview a local project or Git repository, then apply it only after the manifest is valid.",t:i,children:t.jsx(le,{compact:!0,reapplyRequired:d,onConfigured:te})}):null,s===2?t.jsx(D,{eyebrow:"Step 2 of 4",title:"Connect your database",description:"Use the same profile import, enterprise authentication fields, test, and rollback flow available in Settings.",t:i,children:t.jsx(pe,{variant:"setup",onConfigured:o=>{$("passed"),M(o)}})}):null,s===3?t.jsxs(D,{eyebrow:"Step 3 of 4",title:"Set up an AI provider",description:"Optional. AI powers governed Ask and assisted authoring; deterministic queries and non-AI product paths remain available without it.",badge:"Optional",t:i,children:[t.jsx(ce,{embedded:!0,includeMemory:!1,section:"providers",editorMode:"setup",onProviderConfigured:ie}),t.jsxs("div",{style:{border:"1px solid var(--status-info-border)",background:"var(--status-info-bg)",borderRadius:10,padding:"11px 13px",display:"flex",alignItems:"center",gap:12},children:[t.jsx("div",{style:{flex:1,fontSize:11.5,color:Q,lineHeight:1.5},children:"Continue in limited-AI mode and configure a provider later in Settings."}),t.jsx("button",{type:"button",onClick:()=>{E(!0),r(4)},style:C,children:"Skip AI for now"})]})]}):null,s===4?t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:20},children:[t.jsxs("div",{style:{textAlign:"center"},children:[t.jsx("div",{style:{fontSize:11,fontWeight:750,letterSpacing:"0.06em",textTransform:"uppercase",color:i.accent},children:"Step 4 of 4 · Setup complete"}),t.jsx("h2",{style:{margin:"7px 0 0",fontSize:22,color:i.textPrimary},children:"Where do you want to start?"}),x==="missing"||m?t.jsx("div",{style:{fontSize:12,color:i.textMuted,marginTop:7},children:"AI is not configured. Deterministic and non-AI workflows remain available; return to Settings when you want governed Ask."}):null]}),t.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(190px, 1fr))",gap:11},children:[t.jsx(A,{icon:t.jsx(fe,{size:17}),title:"Build your domain",body:"Model entities, prove joins, and add governed context.",action:"Open Domains",onClick:()=>j("domains"),t:i,primary:!0}),t.jsx(A,{icon:t.jsx(Se,{size:17}),title:"Ask",body:x==="missing"||m?"Open Ask in limited mode; configure AI before a governed model answer.":"Ask a business question grounded in your governed context.",action:"Open Ask",onClick:()=>j("ask"),t:i}),t.jsx(A,{icon:t.jsx(ue,{size:17}),title:"Research notebook",body:"Work with SQL, DQL, and charts, then save reusable blocks.",action:"New notebook",onClick:()=>j("notebook"),t:i})]})]}):null]})}),t.jsxs("footer",{style:{flexShrink:0,minHeight:58,borderTop:`1px solid ${i.headerBorder}`,background:i.headerBg,display:"flex",alignItems:"center",gap:10,padding:"11px 22px"},children:[s>1?t.jsxs("button",{type:"button",onClick:()=>r(o=>Math.max(1,o-1)),style:C,children:[t.jsx(xe,{size:13})," Back"]}):null,t.jsx("div",{style:{flex:1}}),t.jsx("span",{style:{fontSize:11,color:i.textMuted,maxWidth:420,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:se}),_?t.jsx("span",{role:"alert",style:{fontSize:11,color:"var(--status-error)",maxWidth:320},children:_}):null,t.jsx("button",{type:"button",disabled:u||d,onClick:ee,style:{...C,opacity:u||d?.5:1,cursor:u||d?"not-allowed":"pointer"},children:u?"Saving review…":d?"Reapply required":(e==null?void 0:e.reason)==="version_upgrade"?"Close update review":h==="missing"&&v==="missing"?"Skip setup":"Close setup"}),s<4?t.jsxs("button",{type:"button",disabled:s===1&&d,onClick:()=>r(o=>Math.min(4,o+1)),style:{...F,opacity:s===1&&d?.5:1,cursor:s===1&&d?"not-allowed":"pointer"},children:[s===1?"Continue to database":s===2?"Continue to optional AI":"Continue to finish"," ",t.jsx(ye,{size:13})]}):t.jsxs("button",{type:"button",disabled:u,onClick:()=>j(x==="missing"||m?"domains":"ask"),style:{...F,opacity:u?.65:1},children:[t.jsx(ge,{size:13})," Finish setup"]})]})]})}function D({eyebrow:e,title:p,description:c,badge:l,children:i,t:s}){return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:17},children:[t.jsxs("div",{children:[t.jsx("div",{style:{fontSize:11,fontWeight:750,letterSpacing:"0.06em",textTransform:"uppercase",color:s.accent},children:e}),t.jsxs("h2",{style:{margin:"6px 0 0",fontSize:21,fontWeight:750,color:s.textPrimary,display:"flex",alignItems:"center",gap:8},children:[p,l?t.jsx("span",{style:{border:`1px solid ${s.headerBorder}`,color:s.textMuted,borderRadius:999,padding:"2px 9px",fontSize:10,fontWeight:750},children:l}):null]}),t.jsx("div",{style:{marginTop:6,fontSize:12.5,color:s.textSecondary,lineHeight:1.55},children:c})]}),i]})}function A({icon:e,title:p,body:c,action:l,onClick:i,primary:s=!1,t:r}){return t.jsxs("button",{type:"button",onClick:i,style:{border:`1.5px solid ${s?r.accent:r.headerBorder}`,borderRadius:12,background:s?"var(--accent-dim)":r.cellBg,padding:17,textAlign:"left",cursor:"pointer",fontFamily:r.font,minHeight:170,display:"flex",flexDirection:"column"},children:[t.jsx("span",{style:{width:34,height:34,borderRadius:9,color:s?r.accent:r.textSecondary,background:s?r.cellBg:r.appBg,display:"inline-flex",alignItems:"center",justifyContent:"center"},children:e}),t.jsx("span",{style:{marginTop:12,fontSize:13.5,fontWeight:750,color:r.textPrimary},children:p}),t.jsx("span",{style:{marginTop:6,fontSize:11.5,color:r.textSecondary,lineHeight:1.5},children:c}),t.jsxs("span",{style:{marginTop:"auto",paddingTop:12,fontSize:11.5,fontWeight:700,color:s?r.accent:r.textSecondary},children:[l," →"]})]})}export{Ce as SetupOnboarding};
@@ -1 +1 @@
1
- import{j as c,aN as l}from"./index-Ca3UeUWI.js";const e={certified:{base:"Certified",tone:"success"},reviewed:{base:"Reviewed",tone:"info"},ai_generated:{base:"AI-Generated",tone:"warning"},insufficient_context:{base:"Insufficient-Context",tone:"neutral"},conflict:{base:"Conflict",tone:"error"}},s="insufficient_context";function d({state:t,qualifier:i,label:a}){if(!t)return null;const n=o[t]??o[s],r=i?`${n.label} · ${i}`:n.label;return c.jsx(l,{tone:n.tone,children:a??r})}const o={certified:{tone:e.certified.tone,label:e.certified.base},reviewed:{tone:e.reviewed.tone,label:e.reviewed.base},ai_generated:{tone:e.ai_generated.tone,label:e.ai_generated.base},insufficient_context:{tone:e.insufficient_context.tone,label:e.insufficient_context.base},conflict:{tone:e.conflict.tone,label:e.conflict.base},draft:{tone:"warning",label:"Draft"},pending:{tone:"warning",label:"Pending review"},review:{tone:"warning",label:"Review"},uncertified:{tone:"warning",label:"Uncertified"},deprecated:{tone:"neutral",label:"Deprecated"},no_answer:{tone:"error",label:"No answer"}};export{d as T};
1
+ import{j as c,aP as l}from"./index-BTuliKhK.js";const e={certified:{base:"Certified",tone:"success"},reviewed:{base:"Reviewed",tone:"info"},ai_generated:{base:"AI-Generated",tone:"warning"},insufficient_context:{base:"Insufficient-Context",tone:"neutral"},conflict:{base:"Conflict",tone:"error"}},s="insufficient_context";function d({state:t,qualifier:i,label:a}){if(!t)return null;const n=o[t]??o[s],r=i?`${n.label} · ${i}`:n.label;return c.jsx(l,{tone:n.tone,children:a??r})}const o={certified:{tone:e.certified.tone,label:e.certified.base},reviewed:{tone:e.reviewed.tone,label:e.reviewed.base},ai_generated:{tone:e.ai_generated.tone,label:e.ai_generated.base},insufficient_context:{tone:e.insufficient_context.tone,label:e.insufficient_context.base},conflict:{tone:e.conflict.tone,label:e.conflict.base},draft:{tone:"warning",label:"Draft"},pending:{tone:"warning",label:"Pending review"},review:{tone:"warning",label:"Review"},uncertified:{tone:"warning",label:"Uncertified"},deprecated:{tone:"neutral",label:"Deprecated"},no_answer:{tone:"error",label:"No answer"}};export{d as T};