@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.
- package/dist/assets/dql-notebook/assets/{AgentAnswerCard-Dp4odOLE.js → AgentAnswerCard-CpL2kDCV.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AgentLogPage-uvVs284-.js → AgentLogPage-hzHqpD3-.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildDialog-DEUS19WF.js → AiBuildDialog-BQRWoxp9.js} +1 -1
- package/dist/assets/dql-notebook/assets/AiBuildResult-D9t_4sQl.js +33 -0
- package/dist/assets/dql-notebook/assets/{AiSidePanel-C7BZVSkM.js → AiSidePanel-BCQB9rVF.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AnalyticsHome-4TgtH6SB.js → AnalyticsHome-Ba4Ve_Gd.js} +1 -1
- package/dist/assets/dql-notebook/assets/AppsView-CdAT9BOq.js +4466 -0
- package/dist/assets/dql-notebook/assets/{BlockStudio-DUXN3MKz.js → BlockStudio-Brg4fwn5.js} +13 -13
- package/dist/assets/dql-notebook/assets/{BusinessArtifactView-D8FIgrkF.js → BusinessArtifactView-CnTbFVGT.js} +1 -1
- package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-CQe2FUZq.js +22 -0
- package/dist/assets/dql-notebook/assets/{GitPage-BS2sm9zh.js → GitPage-DHyDBChc.js} +1 -1
- package/dist/assets/dql-notebook/assets/{GlobalAiRail-B_MZsB0z.js → GlobalAiRail-Cys4n_rq.js} +1 -1
- package/dist/assets/dql-notebook/assets/GovernedContextPage-DyKoDSZ2.js +7 -0
- package/dist/assets/dql-notebook/assets/{HelpDocsPage-Bc5pLakt.js → HelpDocsPage-CL0vbSER.js} +3 -3
- package/dist/assets/dql-notebook/assets/{HomePage-DQSo-K4y.js → HomePage-DzAucwBW.js} +9 -4
- package/dist/assets/dql-notebook/assets/{LineageDAG-RdpWmGmR.js → LineageDAG-QHqd_AM5.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDetailView-CZEx2r1H.js → LineageDetailView-DdVH-nz6.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDrawer-P7ZdOW8-.js → LineageDrawer-BvrVZNKY.js} +1 -1
- package/dist/assets/dql-notebook/assets/LineagePathBreadcrumb-CSut-zvm.js +14 -0
- package/dist/assets/dql-notebook/assets/{MiniLineageGraph-Ctp_yFh8.js → MiniLineageGraph-zg_1wW3M.js} +1 -1
- package/dist/assets/dql-notebook/assets/NewBlockModal-9cDletl-.js +1 -0
- package/dist/assets/dql-notebook/assets/NewNotebookModal-V6de8L4d.js +46 -0
- package/dist/assets/dql-notebook/assets/NotebookEditor-EZ0pfWVs.js +200 -0
- package/dist/assets/dql-notebook/assets/{ReadinessPage-C8hATaT_.js → ReadinessPage-BaGvjyfd.js} +1 -1
- package/dist/assets/dql-notebook/assets/{SetupOnboarding-DX2f53J2.js → SetupOnboarding-Bg-MjbC9.js} +2 -2
- package/dist/assets/dql-notebook/assets/{TrustBadge-DPnKzRSY.js → TrustBadge-DGuHB8kP.js} +1 -1
- package/dist/assets/dql-notebook/assets/{UnifiedAgentRunPanel-CwxQ4T19.js → UnifiedAgentRunPanel-BlWAVEwO.js} +17 -17
- package/dist/assets/dql-notebook/assets/{answer-to-notebook-Bm9oByWA.js → answer-to-notebook-BDzY4MuQ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-left-D2FbLWqh.js → arrow-left-IjlnAihE.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-right-OYItAZ-s.js → arrow-right-BI4cXgOY.js} +2 -2
- package/dist/assets/dql-notebook/assets/{book-open-text-BnnirfAc.js → book-open-text-i6xhxu_I.js} +1 -1
- package/dist/assets/dql-notebook/assets/{bot-BJNxPYFm.js → bot-C6DE7Q6m.js} +1 -1
- package/dist/assets/dql-notebook/assets/{chevron-up-DM5LX-26.js → chevron-up-DSEILnDs.js} +2 -2
- package/dist/assets/dql-notebook/assets/{circle-x-Dic_-4tF.js → circle-x-BoAorVSm.js} +1 -1
- package/dist/assets/dql-notebook/assets/{codemirror-1_I9gm6Z.js → codemirror-DXt7RW72.js} +1 -1
- package/dist/assets/dql-notebook/assets/{dagre.esm-C9zxjHHX.js → dagre.esm-CycymVj6.js} +1 -1
- package/dist/assets/dql-notebook/assets/{external-link-DHxAcoCE.js → external-link-ZwE5iHsX.js} +1 -1
- package/dist/assets/dql-notebook/assets/{grip-vertical-02I-EOjL.js → grip-vertical-Dnp2st8l.js} +1 -1
- package/dist/assets/dql-notebook/assets/index-BTuliKhK.js +634 -0
- package/dist/assets/dql-notebook/assets/{link-2-Delh-lai.js → link-2-CTKe6Snr.js} +2 -2
- package/dist/assets/dql-notebook/assets/{list-tree-BrIZg6l6.js → list-tree-Ced8e_S1.js} +1 -1
- package/dist/assets/dql-notebook/assets/{maximize-2-CQOA-bbN.js → maximize-2-Cojc6867.js} +1 -1
- package/dist/assets/dql-notebook/assets/{minimize-2-CUDBPkwe.js → minimize-2-CBIAE0XH.js} +1 -1
- package/dist/assets/dql-notebook/assets/{panel-right-open-CwhZfkKJ.js → panel-right-open-po3bWSeL.js} +2 -2
- package/dist/assets/dql-notebook/assets/{pencil-Cf6-MgpT.js → pencil-Cb45c6WU.js} +2 -2
- package/dist/assets/dql-notebook/assets/{rotate-ccw-DndbJAiz.js → rotate-ccw-B9v1LTJ0.js} +2 -2
- package/dist/assets/dql-notebook/assets/{semantic-fields-DwKPY_mU.js → semantic-fields-B6ii0an0.js} +1 -1
- package/dist/assets/dql-notebook/assets/{star-DvcMC9wZ.js → star-CO4tfaDq.js} +2 -2
- package/dist/assets/dql-notebook/assets/{triangle-alert-DUf4Ook0.js → triangle-alert-BSdIu2El.js} +1 -1
- package/dist/assets/dql-notebook/assets/{usePersistedAgentThreadId-DbdBi0oH.js → usePersistedAgentThreadId-CkVFrrjk.js} +2 -2
- package/dist/assets/dql-notebook/assets/{user-round-DSt0xU3K.js → user-round-BfrV8U-W.js} +3 -3
- package/dist/assets/dql-notebook/assets/{wand-sparkles-ro8Cq0ro.js → wand-sparkles-BgTxZNBc.js} +1 -1
- package/dist/assets/dql-notebook/assets/{workflow-DVJXehjU.js → workflow--2ycp0yy.js} +2 -2
- package/dist/assets/dql-notebook/assets/{wrench-DxUnoHtz.js → wrench-LMCrpa9_.js} +1 -1
- package/dist/assets/dql-notebook/assets/{x-9Gtb3EAd.js → x-CeNgQwGm.js} +2 -2
- package/dist/assets/dql-notebook/index.html +1 -1
- package/dist/local-runtime.d.ts +40 -1
- package/dist/local-runtime.d.ts.map +1 -1
- package/dist/local-runtime.js +602 -172
- package/dist/local-runtime.js.map +1 -1
- package/dist/package.json +10 -10
- package/package.json +10 -10
- package/dist/assets/dql-notebook/assets/AiBuildResult-B9KmBRsh.js +0 -33
- package/dist/assets/dql-notebook/assets/AppsView-CnfNtk5W.js +0 -4466
- package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-DR8hTZ95.js +0 -22
- package/dist/assets/dql-notebook/assets/GovernedContextPage-CNM5UCAH.js +0 -7
- package/dist/assets/dql-notebook/assets/LineagePathBreadcrumb-DTUMFkJ8.js +0 -14
- package/dist/assets/dql-notebook/assets/NewBlockModal-BLtjuWGy.js +0 -1
- package/dist/assets/dql-notebook/assets/NewNotebookModal-xgaKB2kI.js +0 -46
- package/dist/assets/dql-notebook/assets/NotebookEditor-D6RgLQw-.js +0 -202
- package/dist/assets/dql-notebook/assets/index-Ca3UeUWI.js +0 -644
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{c as Ue,u as he,t as Se,r as a,a as D,j as e,a0 as se,Y as fe,L as F,S as ne,P as X,B as Qe,d as Ee,T as ie,X as Be,a1 as Ye,J as ae,N as We,h as Je,aG as Ae,f as Ve}from"./index-BTuliKhK.js";import{T as Oe}from"./triangle-alert-BSdIu2El.js";import{U as Ie,G as re}from"./user-round-BfrV8U-W.js";import{C as Le}from"./chevron-up-DSEILnDs.js";import{P as Ne}from"./pencil-Cb45c6WU.js";import{X as ye}from"./x-CeNgQwGm.js";/**
|
|
2
|
+
* @license lucide-react v0.563.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 Xe=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],Ze=Ue("tags",Xe),oe="dql-context-bootstrap-session",le="dql-context-bootstrap-selection";function et(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,64)}function Te(t){return t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}function tt(){return{id:"",name:"",owner:"",boundedContext:"",sourceSystems:[],description:""}}function nt({embedded:t=!1}={}){const{state:n,dispatch:l}=he(),i=Se[n.themeMode],[s,d]=a.useState([]),[o,r]=a.useState(!0),[g,S]=a.useState(null),[v,c]=a.useState(null),[W,j]=a.useState(null),[p,h]=a.useState(!1),[R,I]=a.useState(null),[m,E]=a.useState(null),[y,w]=a.useState(!1),[P,A]=a.useState(!1),[O,$]=a.useState(null),[b,x]=a.useState([]),T=a.useCallback(()=>{let f=!1;return r(!0),S(null),D.getDomains().then(C=>{if(f)return;const B=Array.isArray(C==null?void 0:C.domains)?C.domains:[];d(B),l({type:"SET_AUTHORED_DOMAINS",domains:B})}).catch(C=>{f||(d([]),S(C instanceof Error&&C.message?C.message:"Could not load domains. Is the local DQL server running?"))}).finally(()=>{f||r(!1)}),()=>{f=!0}},[l]);a.useEffect(()=>T(),[T]),a.useEffect(()=>{const f=window.sessionStorage.getItem(oe);let C=!1;const B=u=>{if(u&&!C){E(u);try{const k=JSON.parse(window.sessionStorage.getItem(le)??"[]");x(Array.isArray(k)?k.filter(_=>typeof _=="string"):u.candidates.filter(_=>_.action!=="unchanged").map(_=>_.id))}catch{x(u.candidates.filter(k=>k.action!=="unchanged").map(k=>k.id))}}};return(f?D.getContextBootstrap(f):D.getLatestContextBootstrap()).then(B).catch(async()=>{window.sessionStorage.removeItem(oe),window.sessionStorage.removeItem(le),f&&B(await D.getLatestContextBootstrap().catch(()=>null))}),()=>{C=!0}},[]),a.useEffect(()=>{m&&(window.sessionStorage.setItem(oe,m.id),window.sessionStorage.setItem(le,JSON.stringify(b)))},[m==null?void 0:m.id,b]);const L=a.useMemo(()=>[...s].sort((f,C)=>f.name.localeCompare(C.name)),[s]),z=a.useCallback(f=>{d(C=>{const B=C.findIndex(u=>u.id===f.id),M=B===-1?[...C,f]:[...C];return B!==-1&&(M[B]=f),l({type:"SET_AUTHORED_DOMAINS",domains:M}),M}),c(null)},[l]),U=a.useCallback(async()=>{if(W){h(!0),I(null);try{await D.deleteDomain(W.id),d(f=>{const C=f.filter(B=>B.id!==W.id);return l({type:"SET_AUTHORED_DOMAINS",domains:C}),C}),j(null)}catch(f){I(f instanceof Error&&f.message?f.message:"Could not delete this domain.")}finally{h(!1)}}},[l,W]),N=a.useCallback(async()=>{w(!0),$(null);try{const f=await D.startContextBootstrap({ai:!0});E(f);const C=f.candidates.filter(B=>B.action!=="unchanged").map(B=>B.id);x(C),window.sessionStorage.setItem(oe,f.id),window.sessionStorage.setItem(le,JSON.stringify(C))}catch(f){$(f instanceof Error?f.message:"Could not draft repository context.")}finally{w(!1)}},[]);a.useEffect(()=>{if(!t)return;const f=()=>{N()};return window.addEventListener("dql:context-build",f),()=>window.removeEventListener("dql:context-build",f)},[t,N]),a.useEffect(()=>{if(!m||["ready","needs_attention"].includes(m.status))return;let f=!1;const C=async()=>{try{const M=await D.getContextBootstrap(m.id);f||E(M)}catch(M){f||$(M instanceof Error?M.message:"Could not update AI draft progress.")}};C();const B=window.setInterval(()=>void C(),750);return()=>{f=!0,window.clearInterval(B)}},[m==null?void 0:m.id,m==null?void 0:m.status]);const J=a.useCallback(async()=>{if(!(!m||b.length===0)){A(!0),$(null);try{await D.saveContextBootstrapSelected(m.id,b),E(null),x([]),window.sessionStorage.removeItem(oe),window.sessionStorage.removeItem(le),T()}catch(f){$(f instanceof Error?f.message:"Could not save selected drafts.")}finally{A(!1)}}},[m,b,T]);return e.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:i.appBg},children:[e.jsxs("div",{style:{maxWidth:980,margin:"0 auto",padding:"22px 28px 40px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",justifyContent:"space-between",gap:18,marginBottom:18},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(se,{size:20,strokeWidth:1.9,color:i.accent}),e.jsx("div",{style:{fontSize:22,fontWeight:700,color:i.textPrimary},children:"Domains"})]}),e.jsx("div",{style:{fontSize:13,color:i.textMuted,marginTop:6,maxWidth:680,lineHeight:1.5},children:"Domains are the top of your business model — each one owns the terms, skills, and blocks beneath it. Name the business area, who owns it, the bounded context, and the source systems it draws from."})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsxs("button",{type:"button",onClick:()=>T(),title:"Refresh",style:Z(i),children:[e.jsx(fe,{size:13,strokeWidth:2})," Refresh"]}),e.jsxs("button",{type:"button",onClick:()=>void N(),disabled:y,style:Z(i),children:[y?e.jsx(F,{size:13,strokeWidth:2}):e.jsx(ne,{size:13,strokeWidth:2})," Draft with AI"]}),e.jsxs("button",{type:"button",onClick:()=>c({kind:"create"}),style:pe(i),children:[e.jsx(X,{size:14,strokeWidth:2.2})," Add domain"]})]})]}),o?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:i.textMuted,fontSize:13,padding:"40px 0"},children:[e.jsx(F,{size:15,strokeWidth:2})," Loading domains…"]}):g?e.jsx(ot,{t:i,message:g,onRetry:()=>T()}):L.length===0?e.jsx(rt,{t:i,onAdd:()=>c({kind:"create"})}):e.jsx("div",{style:{display:"grid",gap:10},children:L.map(f=>e.jsx(it,{domain:f,t:i,onEdit:()=>c({kind:"edit",domain:f}),onDelete:()=>{I(null),j(f)}},f.id))}),O?e.jsx("div",{style:{marginTop:12},children:e.jsx(ce,{t:i,tone:"error",children:O})}):null,m?e.jsxs("section",{style:{marginTop:18,border:`1px solid ${i.cellBorder}`,borderRadius:10,background:i.cellBg,padding:14},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:13,fontWeight:750,color:i.textPrimary},children:"Repository-guided AI draft"}),e.jsx("div",{style:{fontSize:12,color:i.textMuted,marginTop:3},children:"Inventory is deterministic; AI may enrich only grounded prose and guidance. Nothing is written to Git until you save."})]}),e.jsxs("button",{type:"button",disabled:P||b.length===0||!["ready","needs_attention"].includes(m.status),onClick:()=>void J(),style:{...pe(i),opacity:P||b.length===0||!["ready","needs_attention"].includes(m.status)?.55:1},children:[P?e.jsx(F,{size:13,strokeWidth:2}):e.jsx(X,{size:13,strokeWidth:2})," Save selected drafts"]})]}),e.jsx(lt,{t:i,session:m}),e.jsx("div",{style:{display:"grid",gap:9,marginTop:12},children:m.candidates.map(f=>{const C=f.action!=="unchanged",B=b.includes(f.id);return e.jsx(at,{candidate:f,selected:B,selectable:C,disabled:P,t:i,onToggle:()=>x(M=>B?M.filter(u=>u!==f.id):[...M,f.id])},f.id)})})]}):null]}),v?e.jsx(st,{mode:v,existingIds:s.map(f=>f.id),domains:s,t:i,onClose:()=>c(null),onSaved:z}):null,W?e.jsx(dt,{domain:W,t:i,deleting:p,error:R,onCancel:()=>{p||j(null)},onConfirm:U}):null]})}function it({domain:t,t:n,onEdit:l,onDelete:i}){const s=t.sourceSystems??[],[d,o]=a.useState(!1);return e.jsxs("section",{style:{border:`1px solid ${n.cellBorder}`,borderRadius:10,background:n.cellBg,padding:"13px 15px",display:"flex",alignItems:"flex-start",gap:14},children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:13.5,fontWeight:750,color:n.textPrimary},children:t.name}),t.parent?e.jsxs("span",{style:ke(n),children:["↳ ",t.parent]}):null,t.owner?e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:4,fontSize:11,color:n.textMuted},children:[e.jsx(Ie,{size:11,strokeWidth:2})," ",t.owner]}):null,t.businessOwner?e.jsxs("span",{style:ke(n),children:[e.jsx(Ie,{size:10,strokeWidth:2.2})," Business owner: ",t.businessOwner]}):null]}),t.description?e.jsx("div",{style:{fontSize:12.5,color:n.textSecondary,marginTop:5,lineHeight:1.5},children:t.description}):e.jsx("div",{style:{fontSize:12,color:n.textMuted,marginTop:5,fontStyle:"italic"},children:"No description yet."}),s.length>0?e.jsx("div",{style:{display:"flex",gap:5,marginTop:9,flexWrap:"wrap"},children:s.map(r=>e.jsx("span",{style:we(n),children:r},r))}):null,e.jsxs("div",{style:{display:"flex",gap:7,marginTop:9,flexWrap:"wrap"},children:[e.jsx(be,{t:n,icon:e.jsx(Qe,{size:11,strokeWidth:2}),label:"blocks",count:t.blockCount??0}),e.jsx(be,{t:n,icon:e.jsx(re,{size:11,strokeWidth:2}),label:"skills",count:t.skillCount??0}),e.jsx(be,{t:n,icon:e.jsx(Ze,{size:11,strokeWidth:2}),label:"terms",count:t.termCount??0})]}),d?e.jsxs("div",{style:{display:"grid",gap:9,marginTop:12,paddingTop:11,borderTop:`1px solid ${n.btnBorder}`},children:[t.boundedContext?e.jsx(De,{t:n,label:"Business boundary",children:t.boundedContext}):null,t.businessOutcome?e.jsx(De,{t:n,label:"Decision outcome",children:t.businessOutcome}):null,e.jsx(de,{t:n,label:"In scope",values:t.inScope,empty:"Not defined yet"}),e.jsx(de,{t:n,label:"Out of scope",values:t.outOfScope,empty:"Not defined yet"}),e.jsx(de,{t:n,label:"Primary terms",values:t.primaryTerms,empty:"No terms linked yet"}),e.jsx(de,{t:n,label:"Tags",values:t.tags,empty:"No tags"})]}):null]}),e.jsxs("div",{style:{display:"flex",gap:6,flexShrink:0},children:[e.jsxs("button",{type:"button",onClick:()=>o(r=>!r),style:{...Z(n),padding:"5px 7px",fontSize:11.5},title:d?"Hide domain details":"Show domain details",children:[d?e.jsx(Le,{size:13}):e.jsx(Ee,{size:13}),d?"Less":"Details"]}),e.jsx("button",{type:"button",onClick:l,style:ve(n),title:"Edit domain",children:e.jsx(Ne,{size:13,strokeWidth:2})}),e.jsx("button",{type:"button",onClick:i,style:ve(n),title:"Delete domain",children:e.jsx(ie,{size:13,strokeWidth:2})})]})]})}function st({mode:t,existingIds:n,domains:l,t:i,onClose:s,onSaved:d}){const o=t.kind==="edit",[r,g]=a.useState(()=>t.kind==="edit"?{...t.domain}:tt()),[S,v]=a.useState(o),[c,W]=a.useState(!1),[j,p]=a.useState(null),h=a.useCallback((y,w)=>{g(P=>({...P,[y]:w}))},[]),R=y=>{g(w=>({...w,name:y,...!o&&!S?{id:Te(y)}:{}}))},I=!o&&r.id.length>0&&n.includes(r.id),m=r.id.trim().length>0&&r.name.trim().length>0&&!I&&!c,E=a.useCallback(async()=>{var w,P,A,O,$;const y={...r,id:r.id.trim(),name:r.name.trim(),owner:(w=r.owner)!=null&&w.trim()?r.owner.trim():void 0,businessOwner:(P=r.businessOwner)!=null&&P.trim()?r.businessOwner.trim():void 0,parent:(A=r.parent)!=null&&A.trim()?r.parent.trim():void 0,boundedContext:(O=r.boundedContext)!=null&&O.trim()?r.boundedContext.trim():void 0,description:($=r.description)!=null&&$.trim()?r.description.trim():void 0,sourceSystems:(r.sourceSystems??[]).map(b=>b.trim()).filter(Boolean),primaryTerms:(r.primaryTerms??[]).map(b=>b.trim()).filter(Boolean),tags:(r.tags??[]).map(b=>b.trim()).filter(Boolean),inScope:(r.inScope??[]).map(b=>b.trim()).filter(Boolean),outOfScope:(r.outOfScope??[]).map(b=>b.trim()).filter(Boolean),dbtGroups:(r.dbtGroups??[]).map(b=>b.trim()).filter(Boolean),dbtPaths:(r.dbtPaths??[]).map(b=>b.trim()).filter(Boolean),dbtTags:(r.dbtTags??[]).map(b=>b.trim()).filter(Boolean),semanticDomains:(r.semanticDomains??[]).map(b=>b.trim()).filter(Boolean),semanticTags:(r.semanticTags??[]).map(b=>b.trim()).filter(Boolean)};W(!0),p(null);try{const b=o?await D.updateDomain(y.id,y):await D.createDomain(y);d(b.domain??y)}catch(b){p(b instanceof Error&&b.message?b.message:"Could not save this domain. Try again.")}finally{W(!1)}},[r,o,d]);return e.jsx("div",{style:gt,onClick:()=>!c&&s(),children:e.jsxs("div",{style:ht(i),onClick:y=>y.stopPropagation(),children:[e.jsxs("div",{style:ft(i),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx(se,{size:16,strokeWidth:2,color:i.accent}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:i.textPrimary},children:o?"Edit domain":"New domain"})]}),e.jsx("button",{type:"button",onClick:()=>!c&&s(),style:ve(i),title:"Close",children:e.jsx(ye,{size:15,strokeWidth:2})})]}),e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto",padding:"16px 18px",display:"grid",gap:16},children:[e.jsx(G,{label:"Name",t:i,hint:o?void 0:"A short, human label for this business area.",children:e.jsx("input",{type:"text",value:r.name,onChange:y=>R(y.target.value),placeholder:"Revenue",style:Q(i)})}),e.jsxs(G,{label:"ID (slug)",t:i,hint:"Used as the on-disk identifier. Letters, numbers, and dashes.",children:[e.jsx("input",{type:"text",value:r.id,disabled:o,onChange:y=>{v(!0),h("id",et(y.target.value))},onBlur:()=>h("id",Te(r.id)),placeholder:"revenue",style:{...Q(i),fontFamily:i.fontMono,opacity:o?.7:1}}),I?e.jsx(ce,{t:i,tone:"error",children:"A domain with this id already exists."}):null]}),e.jsx(G,{label:"Parent domain",t:i,hint:"Optional. Depth becomes Domain, Subdomain, Microdomain, and beyond.",children:e.jsxs("select",{value:r.parent??"",onChange:y=>h("parent",y.target.value||void 0),style:Q(i),children:[e.jsx("option",{value:"",children:"Top-level domain"}),l.filter(y=>y.id!==r.id).map(y=>e.jsx("option",{value:y.id,children:y.name},y.id))]})}),e.jsx(G,{label:"Owner",t:i,hint:"The team or person accountable for this domain.",children:e.jsx("input",{type:"text",value:r.owner??"",onChange:y=>h("owner",y.target.value),placeholder:"finance-analytics",style:Q(i)})}),e.jsx(G,{label:"Business owner",t:i,hint:"The stakeholder accountable for business use and definitions.",children:e.jsx("input",{type:"text",value:r.businessOwner??"",onChange:y=>h("businessOwner",y.target.value),placeholder:"Revenue Operations",style:Q(i)})}),e.jsx(G,{label:"Bounded context",t:i,hint:"The conceptual boundary this domain owns, e.g. 'recognized revenue and invoicing'.",children:e.jsx("input",{type:"text",value:r.boundedContext??"",onChange:y=>h("boundedContext",y.target.value),placeholder:"Recognized revenue and invoicing",style:Q(i)})}),e.jsx(G,{label:"Source systems",t:i,hint:"The upstream systems this domain draws from — type a name and press Enter.",children:e.jsx(me,{t:i,values:r.sourceSystems??[],onChange:y=>h("sourceSystems",y),placeholder:"Add a source system…"})}),e.jsx(G,{label:"Primary terms",t:i,hint:"Business concepts the agent should use to recognize this domain.",children:e.jsx(me,{t:i,values:r.primaryTerms??[],onChange:y=>h("primaryTerms",y),placeholder:"Add a term…"})}),e.jsx(G,{label:"Scope tags",t:i,hint:"Short labels used for routing and discovery.",children:e.jsx(me,{t:i,values:r.tags??[],onChange:y=>h("tags",y),placeholder:"Add a tag…"})}),e.jsx(G,{label:"Description",t:i,hint:"What this domain covers and how it's used.",children:e.jsx("textarea",{value:r.description??"",onChange:y=>h("description",y.target.value),rows:5,placeholder:"All recognized-revenue metrics and the blocks that report them, sourced from the billing warehouse.",style:pt(i)})}),j?e.jsx(ce,{t:i,tone:"error",children:j}):null]}),e.jsxs("div",{style:yt(i),children:[e.jsx("button",{type:"button",onClick:()=>!c&&s(),style:Z(i),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:E,disabled:!m,style:{...pe(i),opacity:m?1:.55},children:[c?e.jsx(F,{size:13,strokeWidth:2}):null,c?"Saving…":o?"Save changes":"Create domain"]})]})]})})}function me({t,values:n,onChange:l,placeholder:i}){const[s,d]=a.useState(""),o=r=>{const g=r.trim();!g||n.includes(g)||(l([...n,g]),d(""))};return e.jsxs("div",{style:{display:"grid",gap:7},children:[n.length>0?e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:5},children:n.map(r=>e.jsxs("span",{style:ut(t),children:[r,e.jsx("button",{type:"button",onClick:()=>l(n.filter(g=>g!==r)),style:xt(t),title:"Remove",children:e.jsx(ye,{size:11,strokeWidth:2.4})})]},r))}):null,e.jsx("input",{type:"text",value:s,onChange:r=>d(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),o(s))},placeholder:i,style:Q(t)})]})}function rt({t,onAdd:n}){return e.jsxs("div",{style:{border:`1px dashed ${t.cellBorder}`,borderRadius:12,background:t.cellBg,padding:"34px 28px",textAlign:"center",display:"grid",gap:12,justifyItems:"center"},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:`${t.accent}18`,color:t.accent,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(se,{size:22,strokeWidth:1.9})}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:t.textPrimary},children:"Name your business domains"}),e.jsx("div",{style:{fontSize:13,color:t.textMuted,maxWidth:460,lineHeight:1.55},children:`Domains organize everything below them — terms, skills, and blocks. Add your first one, like "Revenue" or "Customer", and you'll be able to pick it when authoring blocks and skills.`}),e.jsxs("button",{type:"button",onClick:n,style:{...pe(t),marginTop:4},children:[e.jsx(X,{size:14,strokeWidth:2.2})," Add your first domain"]})]})}function ot({t,message:n,onRetry:l}){return e.jsxs("div",{style:{border:`1px solid ${t.warning}55`,borderRadius:10,background:`${t.warning}12`,padding:"16px 18px",display:"flex",alignItems:"flex-start",gap:11},children:[e.jsx(Oe,{size:16,strokeWidth:2,color:t.warning,style:{marginTop:1,flexShrink:0}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:13,fontWeight:650,color:t.textPrimary},children:"Domains are not available right now"}),e.jsx("div",{style:{fontSize:12.5,color:t.textSecondary,marginTop:4,lineHeight:1.5},children:n}),e.jsxs("button",{type:"button",onClick:l,style:{...Z(t),marginTop:10},children:[e.jsx(fe,{size:13,strokeWidth:2})," Retry"]})]})]})}function lt({t,session:n}){var s;const l=!["ready","needs_attention"].includes(n.status),i=n.ai.mode==="evidence_only"?"Evidence-only":n.ai.provider?`${n.ai.provider} grounded`:"Preparing AI";return e.jsxs("div",{style:{marginTop:14,padding:"10px 11px",borderRadius:8,background:t.appBg,border:`1px solid ${t.btnBorder}`},children:[e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"center",flexWrap:"wrap",fontSize:12,color:t.textSecondary},children:[l?e.jsx(F,{size:14,strokeWidth:2,color:t.accent}):e.jsx(ne,{size:14,strokeWidth:2,color:t.accent}),e.jsx("strong",{style:{color:t.textPrimary,textTransform:"capitalize"},children:n.status.replace("_"," ")}),e.jsx("span",{children:i}),e.jsxs("span",{children:[n.progress.domains.ready,"/",n.progress.domains.total," domains"]}),e.jsxs("span",{children:[n.progress.skills.ready,"/",n.progress.skills.total," skills"]})]}),e.jsx("div",{style:{height:5,borderRadius:999,background:t.btnBg,overflow:"hidden",marginTop:9},children:e.jsx("div",{style:{width:`${Math.max(3,Math.min(100,n.progress.percent))}%`,height:"100%",background:t.accent,transition:"width 260ms ease"}})}),e.jsx("div",{style:{marginTop:7,fontSize:11.5,color:t.textMuted,lineHeight:1.45},children:n.progress.message}),(s=n.warnings)!=null&&s.length?e.jsx("div",{style:{marginTop:7,fontSize:11.5,color:t.warning,lineHeight:1.45},children:n.warnings.slice(-2).join(" ")}):null]})}function at({candidate:t,selected:n,selectable:l,disabled:i,t:s,onToggle:d}){var W,j,p,h,R,I,m,E,y,w,P,A,O,$,b,x,T,L,z,U,N,J,f,C,B,M;const[o,r]=a.useState(!1),g=t.kind==="domain",S=((W=t.domain)==null?void 0:W.name)??((j=t.skill)==null?void 0:j.id)??t.id.replace(/^(domain|skill):/,""),v=g?((p=t.domain)==null?void 0:p.description)??((h=t.domain)==null?void 0:h.boundedContext):((R=t.skill)==null?void 0:R.description)??((m=(I=t.skill)==null?void 0:I.body)==null?void 0:m.split(`
|
|
7
|
+
`).find(Boolean)),c=g?[["Business outcome",(E=t.domain)==null?void 0:E.businessOutcome],["In scope",(w=(y=t.domain)==null?void 0:y.inScope)==null?void 0:w.join(" · ")],["Out of scope",(A=(P=t.domain)==null?void 0:P.outOfScope)==null?void 0:A.join(" · ")],["Primary terms",($=(O=t.domain)==null?void 0:O.primaryTerms)==null?void 0:$.join(" · ")]]:[["Applies when",(x=(b=t.skill)==null?void 0:b.triggers)==null?void 0:x.join(" · ")],["Ask first when",(L=(T=t.skill)==null?void 0:T.clarifyWhen)==null?void 0:L.join(" · ")],["Avoid when",(U=(z=t.skill)==null?void 0:z.exclusions)==null?void 0:U.join(" · ")],["Preferred metrics",(J=(N=t.skill)==null?void 0:N.preferredMetrics)==null?void 0:J.join(" · ")],["Preferred blocks",(C=(f=t.skill)==null?void 0:f.preferredBlocks)==null?void 0:C.join(" · ")]];return e.jsx("article",{style:{border:`1px solid ${n?`${s.accent}66`:s.btnBorder}`,background:n?`${s.accent}08`:s.appBg,borderRadius:8,padding:"10px 11px",opacity:l?1:.72},children:e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"flex-start"},children:[e.jsx("input",{"aria-label":`Select ${g?"domain":"skill"} ${S}`,type:"checkbox",disabled:!l||i,checked:n,onChange:d,style:{marginTop:3}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",gap:7,alignItems:"center",flexWrap:"wrap"},children:[e.jsxs("strong",{style:{color:s.textPrimary,fontSize:12.5},children:[g?"Domain":"Skill"," · ",S]}),e.jsx("span",{style:ke(s),children:t.action.replace("_"," ")}),e.jsxs("span",{style:{fontSize:11,color:s.textMuted},children:[Math.round(t.confidence*100),"% evidence confidence"]})]}),v?e.jsx("p",{style:{marginTop:5,color:s.textSecondary,fontSize:12,lineHeight:1.45},children:v}):e.jsx("p",{style:{marginTop:5,color:s.textMuted,fontSize:12,fontStyle:"italic"},children:"Waiting for grounded guidance…"}),e.jsx("div",{style:{display:"flex",gap:5,marginTop:7,flexWrap:"wrap"},children:t.evidence.map(u=>e.jsx("span",{style:we(s),children:u},u))}),o?e.jsxs("div",{style:{marginTop:9,display:"grid",gap:6,borderTop:`1px solid ${s.btnBorder}`,paddingTop:9},children:[c.filter(([,u])=>!!u).map(([u,k])=>e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"116px minmax(0, 1fr)",gap:8,fontSize:11.5,lineHeight:1.45},children:[e.jsx("strong",{style:{color:s.textMuted},children:u}),e.jsx("span",{style:{color:s.textSecondary},children:k})]},u)),!g&&((B=t.skill)!=null&&B.body)?e.jsx("pre",{style:{margin:0,whiteSpace:"pre-wrap",fontFamily:s.font,fontSize:11.5,color:s.textSecondary,background:s.cellBg,padding:9,borderRadius:6,maxHeight:180,overflow:"auto"},children:t.skill.body}):null,(M=t.notes)!=null&&M.length?e.jsx("div",{style:{fontSize:11.5,color:s.accent},children:t.notes.join(" ")}):null]}):null]}),e.jsxs("button",{type:"button",onClick:()=>r(u=>!u),style:{...Z(s),padding:"4px 6px",fontSize:11.5},"aria-expanded":o,children:[o?e.jsx(Le,{size:13}):e.jsx(Ee,{size:13}),o?"Less":"Review"]})]})})}function dt({domain:t,t:n,deleting:l,error:i,onCancel:s,onConfirm:d}){return e.jsx("div",{style:mt,onClick:s,children:e.jsxs("div",{style:bt(n),onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(ie,{size:16,strokeWidth:2,color:n.error}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:n.textPrimary},children:"Delete this domain?"})]}),e.jsxs("div",{style:{fontSize:13,color:n.textSecondary,lineHeight:1.55},children:[e.jsx("span",{style:{fontWeight:700,color:n.textPrimary},children:t.name})," will be removed. Blocks, skills, and terms that referenced it will become unassigned. This can't be undone."]}),i?e.jsx(ce,{t:n,tone:"error",children:i}):null,e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:4},children:[e.jsx("button",{type:"button",onClick:s,disabled:l,style:Z(n),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:d,disabled:l,style:{...ct(n),opacity:l?.6:1},children:[l?e.jsx(F,{size:13,strokeWidth:2}):e.jsx(ie,{size:13,strokeWidth:2}),l?"Deleting…":"Delete"]})]})]})})}function be({t,icon:n,label:l,count:i}){return e.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11,fontWeight:600,color:i>0?t.textSecondary:t.textMuted,background:t.btnBg,border:`1px solid ${t.btnBorder}`,borderRadius:6,padding:"3px 8px"},children:[n,i," ",l]})}function De({t,label:n,children:l}){return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"118px minmax(0, 1fr)",gap:10,fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{color:t.textMuted},children:n}),e.jsx("span",{style:{color:t.textSecondary},children:l})]})}function de({t,label:n,values:l,empty:i}){return e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"118px minmax(0, 1fr)",gap:10,fontSize:12,lineHeight:1.5},children:[e.jsx("strong",{style:{color:t.textMuted},children:n}),e.jsx("div",{style:{display:"flex",gap:5,flexWrap:"wrap"},children:l!=null&&l.length?l.map(s=>e.jsx("span",{style:we(t),children:s},s)):e.jsx("span",{style:{color:t.textMuted,fontStyle:"italic"},children:i})})]})}function G({label:t,hint:n,t:l,children:i}){return e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsx("label",{style:{fontSize:12,fontWeight:700,color:l.textPrimary},children:t}),n?e.jsx("div",{style:{fontSize:11.5,color:l.textMuted,lineHeight:1.45,marginTop:-2},children:n}):null,i]})}function ce({t,tone:n,children:l}){const i=n==="error"?t.error:t.textMuted;return e.jsx("div",{style:{fontSize:11.5,color:i,lineHeight:1.45},children:l})}function pe(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:7,border:`1px solid ${t.accent}`,background:t.accent,color:"#ffffff",fontSize:12.5,fontWeight:700,fontFamily:t.font,cursor:"pointer"}}function Z(t){return{display:"inline-flex",alignItems:"center",gap:5,padding:"7px 11px",borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,fontSize:12,fontWeight:600,fontFamily:t.font,cursor:"pointer"}}function ct(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:7,border:`1px solid ${t.error}`,background:t.error,color:"#ffffff",fontSize:12.5,fontWeight:700,fontFamily:t.font,cursor:"pointer"}}function ve(t){return{display:"inline-flex",alignItems:"center",justifyContent:"center",width:30,height:30,borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,cursor:"pointer",flexShrink:0}}function Q(t){return{width:"100%",border:`1px solid ${t.btnBorder}`,borderRadius:7,background:t.cellBg,color:t.textPrimary,fontSize:12.5,fontFamily:t.font,padding:"8px 10px",boxSizing:"border-box"}}function pt(t){return{...Q(t),resize:"vertical",lineHeight:1.5,padding:"9px 11px"}}function ke(t){return{display:"inline-flex",alignItems:"center",gap:4,fontSize:10.5,fontWeight:700,color:t.accent,background:`${t.accent}14`,border:`1px solid ${t.accent}38`,borderRadius:999,padding:"2px 8px"}}function we(t){return{fontSize:11,fontWeight:600,color:t.textSecondary,background:t.btnBg,border:`1px solid ${t.btnBorder}`,borderRadius:6,padding:"3px 8px",fontFamily:t.fontMono}}function ut(t){return{display:"inline-flex",alignItems:"center",gap:4,fontSize:11.5,fontWeight:600,color:t.textPrimary,background:`${t.accent}14`,border:`1px solid ${t.accent}38`,borderRadius:6,padding:"3px 4px 3px 9px",fontFamily:t.fontMono}}function xt(t){return{display:"inline-flex",alignItems:"center",justifyContent:"center",border:"none",background:"transparent",color:t.textMuted,cursor:"pointer",padding:2,borderRadius:4}}const gt={position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.42)",display:"flex",justifyContent:"flex-end",zIndex:60};function ht(t){return{width:"min(560px, 100%)",height:"100%",background:t.appBg,borderLeft:`1px solid ${t.headerBorder}`,display:"flex",flexDirection:"column",boxShadow:"-8px 0 28px rgba(0,0,0,0.18)"}}function ft(t){return{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"14px 18px",borderBottom:`1px solid ${t.headerBorder}`,flexShrink:0}}function yt(t){return{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"13px 18px",borderTop:`1px solid ${t.headerBorder}`,flexShrink:0}}const mt={position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.42)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:70,padding:20};function bt(t){return{width:"min(420px, 100%)",background:t.cellBg,border:`1px solid ${t.cellBorder}`,borderRadius:12,padding:20,display:"grid",gap:13,boxShadow:"0 18px 48px rgba(0,0,0,0.3)"}}function jt(t,n,l){var d,o;if(n&&t.domain!==n&&!((d=t.domains)!=null&&d.includes(n)))return!1;const i=(o=l==null?void 0:l.split("::").at(-1))==null?void 0:o.toLowerCase();if(!i)return!0;const s=(t.modelAreaRefs??[]).map(r=>{var g;return(g=r.split("::").at(-1))==null?void 0:g.toLowerCase()});return s.length===0||s.includes(i)}function vt(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").slice(0,64)}function $e(t){return t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}function kt(){return{id:"",scope:"project",description:"",body:"",preferredMetrics:[],preferredBlocks:[],vocabulary:{},sourcePath:""}}function St({embedded:t=!1,domainFilter:n=null,modelAreaFilter:l=null}={}){var M;const{state:i}=he(),s=Se[i.themeMode],[d,o]=a.useState([]),[r,g]=a.useState(!0),[S,v]=a.useState(null),[c,W]=a.useState({metrics:[],blocks:[]}),j=i.authoredDomains,[p,h]=a.useState(null),[R,I]=a.useState(!1),[m,E]=a.useState("skills"),[y,w]=a.useState(!1),[P,A]=a.useState(null),[O,$]=a.useState(null),[b,x]=a.useState(null),[T,L]=a.useState(!1),[z,U]=a.useState(null),N=a.useCallback(()=>{let u=!1;return g(!0),v(null),D.getSkills().then(k=>{u||o(Array.isArray(k==null?void 0:k.skills)?k.skills:[])}).catch(k=>{u||(o([]),v(k instanceof Error&&k.message?k.message:"Could not load skills. Is the local DQL server running?"))}).finally(()=>{u||g(!1)}),D.getSkillOptions().then(k=>{u||W({metrics:Array.isArray(k==null?void 0:k.metrics)?k.metrics:[],blocks:Array.isArray(k==null?void 0:k.blocks)?k.blocks:[]})}).catch(()=>{u||W({metrics:[],blocks:[]})}),D.getSkillPathSettings().then(k=>{u||(h(k),E(k.path))}).catch(()=>{u||h(null)}),()=>{u=!0}},[]);a.useEffect(()=>N(),[N]);const J=a.useMemo(()=>d.filter(u=>jt(u,n,l)).sort((u,k)=>u.id.localeCompare(k.id)),[d,n,l]),f=a.useCallback(u=>{o(k=>{const _=k.findIndex(ze=>(ze.qualifiedId??ze.id)===(u.qualifiedId??u.id));if(_===-1)return[...k,u];const Ce=[...k];return Ce[_]=u,Ce}),$(null)},[]),C=a.useCallback(async()=>{if(b){L(!0),U(null);try{const u=b.qualifiedId??b.id;await D.deleteSkill(u),o(k=>k.filter(_=>(_.qualifiedId??_.id)!==u)),x(null)}catch(u){U(u instanceof Error&&u.message?u.message:"Could not delete this skill.")}finally{L(!1)}}},[b]),B=a.useCallback(async()=>{w(!0),A(null);try{const u=await D.updateSkillPath(m);h(u),E(u.path),I(!1),N()}catch(u){A(u instanceof Error&&u.message?u.message:"Could not use this Skills folder.")}finally{w(!1)}},[N,m]);return e.jsxs("div",{style:{flex:1,minWidth:0,overflow:"auto",background:s.appBg},children:[e.jsxs("div",{style:{maxWidth:980,margin:"0 auto",padding:t?"18px 20px 40px":"22px 28px 40px"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"flex-end",justifyContent:"space-between",gap:18,marginBottom:18},children:[e.jsxs("div",{style:{minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(re,{size:20,strokeWidth:1.9,color:s.accent}),e.jsx("div",{style:{fontSize:t?18:22,fontWeight:700,color:s.textPrimary},children:l?`${(M=l.split("::").at(-1))==null?void 0:M.replace(/_/g," ")} skills`:n?`${n} skills`:"Skills"})]}),e.jsxs("div",{style:{fontSize:13,color:s.textMuted,marginTop:6,maxWidth:680,lineHeight:1.5},children:["Definitions, vocabulary, and instructions the AI follows when answering",l?" in this model area":n?" in this domain":"",". Applied only when their triggers match — drafts never guide answers."]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginTop:7,color:s.textMuted,fontSize:10.5,minWidth:0},children:[e.jsx(Be,{size:12,strokeWidth:1.8}),e.jsx("span",{children:"Skill folder"}),e.jsx("code",{style:{color:s.textSecondary,fontFamily:s.fontMono,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:(p==null?void 0:p.path)??"skills"}),p?e.jsxs("span",{children:["· ",p.exists?`${p.skillCount} loaded`:"not found"]}):null]})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[e.jsxs("button",{type:"button",onClick:()=>N(),title:"Refresh",style:Y(s),children:[e.jsx(fe,{size:13,strokeWidth:2})," Refresh"]}),e.jsxs("button",{type:"button",onClick:()=>{A(null),I(u=>!u)},style:Y(s),children:[e.jsx(Be,{size:13,strokeWidth:2})," Skill folder"]}),e.jsxs("button",{type:"button",onClick:()=>$({kind:"create"}),style:xe(s),children:[e.jsx(X,{size:14,strokeWidth:2.2})," Add skill"]})]})]}),R?e.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:10,background:s.cellBg,padding:"12px 14px",marginBottom:16,display:"grid",gap:8},children:[e.jsx("div",{style:{fontSize:12.5,fontWeight:700,color:s.textPrimary},children:"Use an existing Skills folder"}),e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx("input",{"aria-label":"Existing Skills folder",value:m,onChange:u=>E(u.target.value),onKeyDown:u=>{u.key==="Enter"&&m.trim()&&!y&&B()},placeholder:"skills or ../skills",style:{...H(s),flex:1,fontFamily:s.fontMono}}),e.jsx("button",{type:"button",onClick:()=>I(!1),disabled:y,style:Y(s),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:()=>void B(),disabled:!m.trim()||y,style:{...xe(s),opacity:m.trim()&&!y?1:.55},children:[y?e.jsx(F,{size:13,strokeWidth:2}):null,y?"Connecting…":"Use folder"]})]}),e.jsxs("div",{style:{fontSize:10.5,lineHeight:1.45,color:s.textMuted},children:["Relative paths start from the DQL project. If DQL is in a ",e.jsx("code",{style:{fontFamily:s.fontMono},children:"/dql"})," folder inside your dbt repo, use ",e.jsx("code",{style:{fontFamily:s.fontMono},children:"../skills"}),". Existing ",e.jsx("code",{style:{fontFamily:s.fontMono},children:".skill.md"})," and Markdown skill files are loaded in place and stay Git-owned by that repo."]}),p!=null&&p.resolvedPath?e.jsxs("div",{style:{fontSize:10.5,color:s.textMuted,fontFamily:s.fontMono,overflowWrap:"anywhere"},children:["Resolved: ",p.resolvedPath]}):null,P?e.jsx(ue,{t:s,tone:"error",children:P}):null]}):null,r?e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,color:s.textMuted,fontSize:13,padding:"40px 0"},children:[e.jsx(F,{size:15,strokeWidth:2})," Loading skills…"]}):S?e.jsx(It,{t:s,message:S,onRetry:()=>N()}):J.length===0?e.jsx(Wt,{t:s,onAdd:()=>$({kind:"create"})}):e.jsx("div",{style:{display:"grid",gap:10},children:J.map(u=>e.jsx(wt,{skill:u,t:s,onEdit:()=>$({kind:"edit",skill:u}),onDelete:()=>{U(null),x(u)}},u.qualifiedId??u.id))})]}),O?e.jsx(Ct,{mode:O,options:c,domains:j,defaultDomain:n,defaultModelArea:l,existingIds:d.map(u=>u.id),t:s,onClose:()=>$(null),onSaved:f}):null,b?e.jsx(Tt,{skill:b,t:s,deleting:T,error:z,onCancel:()=>{T||x(null)},onConfirm:C}):null]})}function wt({skill:t,t:n,onEdit:l,onDelete:i}){var r,g,S;const[s,d]=a.useState(!1),o=(r=t.domains)!=null&&r.length?t.domains:t.domain?[t.domain]:[];return e.jsxs("section",{style:{border:"1px solid var(--border-subtle)",borderRadius:11,background:n.cellBg,overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9,padding:"12px 14px"},children:[e.jsx("span",{style:{width:28,height:28,borderRadius:7,background:"var(--accent-dim)",color:n.accent,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(re,{size:14,strokeWidth:1.75})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[e.jsx("span",{style:{fontSize:13,fontWeight:650,color:n.textPrimary,fontFamily:n.fontMono},children:t.id}),t.status==="draft"?e.jsx("span",{style:Me(n),children:"draft — inactive"}):null,t.status==="active"||!t.status?e.jsx("span",{style:Dt(n),children:"active"}):null,o.map(v=>e.jsx("span",{style:$t(n),children:v},v)),t.isStarter?e.jsxs("span",{style:Me(n),title:"A dbt-seeded starter — edit it to make it yours",children:[e.jsx(ne,{size:10,strokeWidth:2.2})," starter — edit me"]}):null]}),e.jsx("div",{style:{fontSize:12,color:t.description?n.textSecondary:n.textMuted,fontStyle:t.description?void 0:"italic",marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.description||"No description yet."}),e.jsx("div",{title:t.sourcePath,style:{marginTop:3,color:n.textMuted,fontSize:10,fontFamily:n.fontMono,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:t.sourcePath})]}),e.jsx("button",{type:"button",onClick:()=>d(v=>!v),style:{...Y(n),height:26,padding:"0 10px",fontSize:11},title:s?"Hide skill details":"Show skill details",children:s?"Hide details":"Details"}),e.jsx("button",{type:"button",onClick:l,style:{...ge(n),width:26,height:26},title:"Edit skill",children:e.jsx(Ne,{size:12,strokeWidth:1.75})}),e.jsx("button",{type:"button",onClick:i,style:{...ge(n),width:26,height:26},title:"Delete skill",children:e.jsx(ie,{size:12,strokeWidth:1.75})})]}),s?e.jsxs("div",{style:{borderTop:"1px solid var(--border-subtle)",padding:"12px 14px",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"12px 20px"},children:[e.jsx(ee,{t:n,label:"Apply when",values:t.triggers,empty:"No trigger phrases defined"}),e.jsx(ee,{t:n,label:"Prefer these metrics",values:t.preferredMetrics,empty:"No preferred metrics",accent:!0,mono:!0}),e.jsx(ee,{t:n,label:"Reuse these blocks",values:t.preferredBlocks,empty:"No preferred blocks",accent:!0,mono:!0}),e.jsx(ee,{t:n,label:"Ask first when",values:t.clarifyWhen,empty:"No clarification rule defined"}),(g=t.exclusions)!=null&&g.length?e.jsx(ee,{t:n,label:"Avoid when",values:t.exclusions,empty:""}):null,(S=t.modelAreaRefs)!=null&&S.length?e.jsx(ee,{t:n,label:"Focus on model areas",values:t.modelAreaRefs,empty:"",mono:!0}):null,t.body?e.jsxs("div",{style:{gridColumn:"1 / -1"},children:[e.jsx("div",{style:te(n),children:"Guidance"}),e.jsx("div",{style:{fontSize:12,lineHeight:1.6,color:n.textSecondary,background:"var(--bg-1)",border:"1px solid var(--border-subtle)",borderRadius:8,padding:"10px 12px",whiteSpace:"pre-wrap",maxHeight:220,overflow:"auto"},children:t.body})]}):null]}):null]})}function Ct({mode:t,options:n,domains:l,defaultDomain:i=null,defaultModelArea:s=null,existingIds:d,t:o,onClose:r,onSaved:g}){const{dispatch:S}=he(),v=t.kind==="edit",[c,W]=a.useState(()=>t.kind==="edit"?{...t.skill}:{...kt(),domain:i??void 0,domains:i?[i]:[],modelAreaRefs:s?[s]:[]}),[j,p]=a.useState(v),[h,R]=a.useState(()=>t.kind==="edit"?t.skill.id:""),[I,m]=a.useState(!1),[E,y]=a.useState(null),w=a.useCallback((x,T)=>{W(L=>({...L,[x]:T}))},[]),P=x=>{R(x),!v&&!j&&w("id",$e(x))},A=!v&&c.id.length>0&&d.includes(c.id),O=c.id.trim().length>0&&c.body.trim().length>0&&!A&&!I,$=Ye(c.domain,l),b=a.useCallback(async()=>{var T,L;const x={...c,id:c.id.trim(),description:(T=c.description)!=null&&T.trim()?c.description.trim():void 0,body:c.body,domain:(L=c.domain)!=null&&L.trim()?c.domain.trim():void 0,domains:(c.domains??(c.domain?[c.domain]:[])).map(z=>z.trim()).filter(Boolean),modelAreaRefs:(c.modelAreaRefs??[]).map(z=>z.trim()).filter(Boolean),triggers:(c.triggers??[]).map(z=>z.trim()).filter(Boolean),exclusions:(c.exclusions??[]).map(z=>z.trim()).filter(Boolean),preferredDimensions:(c.preferredDimensions??[]).map(z=>z.trim()).filter(Boolean),requiredFilters:(c.requiredFilters??[]).map(z=>z.trim()).filter(Boolean),clarifyWhen:(c.clarifyWhen??[]).map(z=>z.trim()).filter(Boolean),examples:(c.examples??[]).map(z=>z.trim()).filter(Boolean)};m(!0),y(null);try{const z=v?await D.updateSkill(x.id,x):await D.createSkill(x);g(z.skill??x)}catch(z){y(z instanceof Error&&z.message?z.message:"Could not save this skill. Try again.")}finally{m(!1)}},[c,v,g]);return e.jsx("div",{style:Et,onClick:()=>!I&&r(),children:e.jsxs("div",{style:At(o),onClick:x=>x.stopPropagation(),children:[e.jsxs("div",{style:Ot(),children:[e.jsx("span",{style:{width:30,height:30,borderRadius:8,background:"var(--accent-dim)",color:o.accent,display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(re,{size:15,strokeWidth:1.75})}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:14,fontWeight:700,color:o.textPrimary},children:v?"Edit skill":"New skill"}),e.jsx("div",{style:{fontSize:11,color:o.textMuted,marginTop:1},children:"Git-backed guidance · applied only when triggers match"})]}),e.jsx("button",{type:"button",onClick:()=>!I&&r(),style:{...ge(o),width:26,height:26,border:"none",background:"none"},title:"Close",children:e.jsx(ye,{size:14,strokeWidth:2})})]}),e.jsxs("div",{style:{flex:1,minHeight:0,overflow:"auto",padding:"18px 22px",display:"grid",gridTemplateColumns:"1fr 1fr",gap:"20px 28px",alignContent:"start"},children:[e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsx("div",{style:te(o),children:"Identity"}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Name"}),e.jsx("input",{type:"text",value:h,onChange:x=>P(x.target.value),placeholder:"e.g. Revenue definition",style:H(o)}),e.jsxs("span",{style:{fontSize:10.5,color:o.textMuted},children:["Saved as"," ",e.jsx("input",{type:"text",value:`skills/${c.id}.skill.md`,disabled:v,onChange:x=>{p(!0),w("id",vt(x.target.value.replace(/^skills\//,"").replace(/\.skill\.md$/,"")))},onBlur:()=>w("id",$e(c.id)),title:"File name — letters, numbers, and dashes",style:{border:"none",background:"none",outline:"none",padding:0,fontFamily:o.fontMono,fontSize:10.5,color:o.textSecondary,width:`${Math.max(20,c.id.length+15)}ch`,borderBottom:v?"none":`1px dashed ${o.btnBorder}`}})]}),A?e.jsx(ue,{t:o,tone:"error",children:"A skill with this id already exists."}):null]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"1fr 1fr",gap:10},children:[e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Domain"}),e.jsxs("select",{value:c.domain??"",onChange:x=>{const T=x.target.value||void 0;w("domain",T),w("domains",T?[T]:[])},style:{...H(o),cursor:"pointer",color:c.domain?o.textPrimary:o.textMuted},children:[e.jsx("option",{value:"",children:l.length===0?"No domains yet":"No domain"}),$.map(x=>e.jsx("option",{value:x.value,disabled:x.disabled,children:x.label},x.value))]})]}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Type"}),e.jsxs("select",{value:c.kind??"custom",onChange:x=>w("kind",x.target.value),style:{...H(o),cursor:"pointer"},children:[e.jsx("option",{value:"custom",children:"Custom guidance"}),e.jsx("option",{value:"domain_reference",children:"Domain reference — broad context"}),e.jsx("option",{value:"metric_policy",children:"Policy — focused rule"}),e.jsx("option",{value:"glossary",children:"Glossary"}),e.jsx("option",{value:"analysis_pattern",children:"Analysis pattern"}),e.jsx("option",{value:"sql_policy",children:"SQL policy"})]})]})]}),e.jsx("button",{type:"button",onClick:()=>S({type:"SET_MAIN_VIEW",view:"domains"}),style:{border:"none",background:"none",padding:0,fontSize:10.5,color:o.accent,cursor:"pointer",fontFamily:o.font,alignSelf:"flex-start"},title:"Create a new domain on the Domains page",children:"+ New domain"}),e.jsxs("div",{children:[e.jsx("span",{style:{...q(o),display:"block",marginBottom:5},children:"Lifecycle"}),e.jsx("div",{style:{display:"inline-flex",alignItems:"center",gap:2,padding:2,border:`1px solid ${o.btnBorder}`,borderRadius:7,background:"var(--bg-1)"},children:["active","draft","deprecated"].map(x=>{const T=(c.status??"active")===x;return e.jsx("button",{type:"button",onClick:()=>w("status",x),style:{border:"none",borderRadius:5,padding:"4px 12px",fontSize:11.5,fontWeight:600,cursor:"pointer",fontFamily:o.font,background:T?o.cellBg:"transparent",color:T?o.textPrimary:o.textMuted,boxShadow:T?"0 1px 3px rgba(26,26,26,0.1)":"none",textTransform:"capitalize"},children:x},x)})}),e.jsx("span",{style:{fontSize:10.5,color:o.textMuted,marginLeft:8},children:(c.status??"active")==="active"?"Guides matching answers.":c.status==="draft"?"Drafts never guide answers.":"Kept in Git for history only."})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsx("div",{style:te(o),children:"When to apply"}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Apply when the question mentions"}),e.jsx(zt,{t:o,values:c.triggers??[],onChange:x=>w("triggers",x),placeholder:"Add phrase, press Enter"})]}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Ask first when"}),e.jsx(ae,{values:c.clarifyWhen??[],onChange:x=>w("clarifyWhen",x),placeholder:"e.g. 'sales' could mean revenue or order count",style:H(o)})]}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Avoid when"}),e.jsx(ae,{values:c.exclusions??[],onChange:x=>w("exclusions",x),placeholder:"e.g. question is about pipeline or bookings",style:H(o)})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10,gridRow:"span 2"},children:[e.jsx("div",{style:te(o),children:"Guidance"}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"One-line summary"}),e.jsx("input",{type:"text",value:c.description??"",onChange:x=>w("description",x.target.value),placeholder:"What rule does this skill encode?",style:H(o)})]}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Full guidance"}),e.jsx("textarea",{value:c.body,onChange:x=>w("body",x.target.value),rows:9,placeholder:"Definitions, exclusions, edge cases — written for the agent.",style:Mt(o)})]})]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsx("div",{style:te(o),children:"Prefer these assets"}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Metrics"}),e.jsx(Re,{t:o,options:n.metrics,optionKind:"metrics",selected:c.preferredMetrics,onChange:x=>w("preferredMetrics",x),placeholder:"Search metrics…",emptyOptionsHint:"No metrics available from the project yet."})]}),e.jsxs("label",{style:K,children:[e.jsx("span",{style:q(o),children:"Blocks"}),e.jsx(Re,{t:o,options:n.blocks,optionKind:"blocks",selected:c.preferredBlocks,onChange:x=>w("preferredBlocks",x),placeholder:"Search blocks…",emptyOptionsHint:"No blocks available from the project yet."})]})]}),e.jsxs("details",{style:{gridColumn:"1 / -1"},children:[e.jsx("summary",{style:{fontSize:11.5,fontWeight:650,color:o.accent,cursor:"pointer"},children:"Advanced — model areas, dimensions, and vocabulary"}),e.jsxs("div",{style:{display:"grid",gap:14,marginTop:12},children:[e.jsx(je,{label:"Focused model areas (optional)",t:o,hint:"Comma-separated area ids from the Model workspace. This boosts the skill only inside its selected domain; it never expands access.",children:e.jsx(ae,{values:c.modelAreaRefs??[],onChange:x=>w("modelAreaRefs",x),placeholder:"customer_lifecycle, revenue_reporting",style:H(o)})}),e.jsx(je,{label:"Preferred dimensions",t:o,hint:"Business-safe dimensions the agent should prefer when they are compatible.",children:e.jsx(ae,{values:c.preferredDimensions??[],onChange:x=>w("preferredDimensions",x),placeholder:"region, month",style:H(o)})}),e.jsx(je,{label:"Vocabulary",t:o,hint:"Map your terms to a target, e.g. arr → metric:arr or revenue → block:revenue_by_region.",children:e.jsx(Bt,{t:o,value:c.vocabulary,onChange:x=>w("vocabulary",x)})})]})]}),E?e.jsx("div",{style:{gridColumn:"1 / -1"},children:e.jsx(ue,{t:o,tone:"error",children:E})}):null]}),e.jsxs("div",{style:Lt(),children:[e.jsx("span",{style:{fontSize:10.5,color:o.textMuted,flex:1,textAlign:"left"},children:"Saved to Git — review in source control before merging."}),e.jsx("button",{type:"button",onClick:()=>!I&&r(),style:Y(o),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:b,disabled:!O,style:{...xe(o),opacity:O?1:.55},children:[I?e.jsx(F,{size:13,strokeWidth:2}):null,I?"Saving…":v?"Save changes":"Create skill"]})]})]})})}function zt({t,values:n,onChange:l,placeholder:i}){const[s,d]=a.useState(""),o=r=>{const g=r.trim().replace(/,$/,"");!g||n.includes(g)||(l([...n,g]),d(""))};return e.jsxs("div",{style:He(t),children:[n.map(r=>e.jsxs("span",{style:_e(t),children:[r,e.jsx("button",{type:"button",onClick:()=>l(n.filter(g=>g!==r)),style:qe(t),title:"Remove",children:"×"})]},r)),e.jsx("input",{type:"text",value:s,onChange:r=>d(r.target.value),onKeyDown:r=>{r.key==="Enter"||r.key===","?(r.preventDefault(),o(s)):r.key==="Backspace"&&!s&&n.length&&l(n.slice(0,-1))},onBlur:()=>o(s),placeholder:n.length?"":i,style:Fe(t)})]})}function Re({t,options:n,optionKind:l,selected:i,onChange:s,placeholder:d,emptyOptionsHint:o}){const[r,g]=a.useState(""),[S,v]=a.useState(n);a.useEffect(()=>{let j=!1;const p=window.setTimeout(()=>{D.getSkillOptions(r).then(h=>{j||v(l==="metrics"?h.metrics:h.blocks)}).catch(()=>{j||v(n)})},160);return()=>{j=!0,window.clearTimeout(p)}},[l,n,r]);const c=a.useMemo(()=>S.filter(j=>!i.includes(j)).filter(j=>r?j.toLowerCase().includes(r.toLowerCase()):!0).slice(0,8),[S,i,r]),W=j=>{const p=j.trim();!p||i.includes(p)||(s([...i,p]),g(""))};return e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsxs("div",{style:He(t),children:[i.map(j=>e.jsxs("span",{style:{..._e(t),fontFamily:t.fontMono},children:[j,e.jsx("button",{type:"button",onClick:()=>s(i.filter(p=>p!==j)),style:qe(t),title:"Remove",children:"×"})]},j)),e.jsx("input",{type:"text",value:r,onChange:j=>g(j.target.value),onKeyDown:j=>{j.key==="Enter"&&(j.preventDefault(),W(r))},placeholder:i.length?"":d,style:Fe(t)})]}),c.length>0?e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:5},children:c.map(j=>e.jsxs("button",{type:"button",onClick:()=>W(j),style:Pt(t),children:[e.jsx(X,{size:10,strokeWidth:2.4})," ",j]},j))}):S.length===0?e.jsxs("div",{style:{fontSize:11,color:t.textMuted},children:[o," You can still type a value and press Enter."]}):null]})}function Bt({t,value:n,onChange:l}){const[i,s]=a.useState(()=>Object.entries(n??{}).map(([r,g])=>({term:r,target:g}))),d=r=>{s(r);const g={};for(const S of r){const v=S.term.trim();v&&(g[v]=S.target.trim())}l(g)},o=(r,g)=>{d(i.map((S,v)=>v===r?{...S,...g}:S))};return e.jsxs("div",{style:{display:"grid",gap:7},children:[i.map((r,g)=>e.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center"},children:[e.jsx("input",{type:"text",value:r.term,onChange:S=>o(g,{term:S.target.value}),placeholder:"arr",style:{...H(t),flex:1}}),e.jsx("span",{style:{color:t.textMuted,fontSize:13},children:"→"}),e.jsx("input",{type:"text",value:r.target,onChange:S=>o(g,{target:S.target.value}),placeholder:"metric:arr",style:{...H(t),flex:1.3,fontFamily:t.fontMono}}),e.jsx("button",{type:"button",onClick:()=>d(i.filter((S,v)=>v!==g)),style:ge(t),title:"Remove row",children:e.jsx(ye,{size:13,strokeWidth:2})})]},g)),e.jsxs("button",{type:"button",onClick:()=>s([...i,{term:"",target:""}]),style:{...Y(t),justifySelf:"start"},children:[e.jsx(X,{size:12,strokeWidth:2.2})," Add term"]})]})}function Wt({t,onAdd:n}){return e.jsxs("div",{style:{border:`1px dashed ${t.cellBorder}`,borderRadius:12,background:t.cellBg,padding:"34px 28px",textAlign:"center",display:"grid",gap:12,justifyItems:"center"},children:[e.jsx("div",{style:{width:44,height:44,borderRadius:10,background:`${t.accent}18`,color:t.accent,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(re,{size:22,strokeWidth:1.9})}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:t.textPrimary},children:"Teach the AI your business rules"}),e.jsx("div",{style:{fontSize:13,color:t.textMuted,maxWidth:460,lineHeight:1.55},children:'Skills are the definitions, rules, and vocabulary the AI follows when it answers — like "revenue = recognized, not bookings" or "always exclude test accounts." Add your first one to start guiding every answer.'}),e.jsxs("button",{type:"button",onClick:n,style:{...xe(t),marginTop:4},children:[e.jsx(X,{size:14,strokeWidth:2.2})," Add your first skill"]})]})}function It({t,message:n,onRetry:l}){return e.jsxs("div",{style:{border:`1px solid ${t.warning}55`,borderRadius:10,background:`${t.warning}12`,padding:"16px 18px",display:"flex",alignItems:"flex-start",gap:11},children:[e.jsx(Oe,{size:16,strokeWidth:2,color:t.warning,style:{marginTop:1,flexShrink:0}}),e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsx("div",{style:{fontSize:13,fontWeight:650,color:t.textPrimary},children:"Skills are not available right now"}),e.jsx("div",{style:{fontSize:12.5,color:t.textSecondary,marginTop:4,lineHeight:1.5},children:n}),e.jsxs("button",{type:"button",onClick:l,style:{...Y(t),marginTop:10},children:[e.jsx(fe,{size:13,strokeWidth:2})," Retry"]})]})]})}function Tt({skill:t,t:n,deleting:l,error:i,onCancel:s,onConfirm:d}){return e.jsx("div",{style:Nt,onClick:s,children:e.jsxs("div",{style:Ht(n),onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:9},children:[e.jsx(ie,{size:16,strokeWidth:2,color:n.error}),e.jsx("div",{style:{fontSize:15,fontWeight:700,color:n.textPrimary},children:"Delete this skill?"})]}),e.jsxs("div",{style:{fontSize:13,color:n.textSecondary,lineHeight:1.55},children:[e.jsx("span",{style:{fontFamily:n.fontMono,color:n.textPrimary},children:t.id})," will be removed and the AI will stop following it. This can't be undone."]}),i?e.jsx(ue,{t:n,tone:"error",children:i}):null,e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:4},children:[e.jsx("button",{type:"button",onClick:s,disabled:l,style:Y(n),children:"Cancel"}),e.jsxs("button",{type:"button",onClick:d,disabled:l,style:{...Rt(n),opacity:l?.6:1},children:[l?e.jsx(F,{size:13,strokeWidth:2}):e.jsx(ie,{size:13,strokeWidth:2}),l?"Deleting…":"Delete"]})]})]})})}function te(t){return{fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",color:t.textMuted,marginBottom:5}}function ee({t,label:n,values:l,empty:i,accent:s=!1,mono:d=!1}){return e.jsxs("div",{style:{minWidth:0},children:[e.jsx("div",{style:te(t),children:n}),e.jsx("div",{style:{display:"flex",gap:5,flexWrap:"wrap"},children:l!=null&&l.length?l.map(o=>e.jsx("span",{style:{fontSize:11,padding:"3px 9px",borderRadius:999,background:s?"var(--accent-dim)":"var(--bg-1)",color:s?t.accent:t.textSecondary,border:s?`1px solid ${t.accent}33`:"1px solid var(--border-subtle)",fontFamily:d?t.fontMono:void 0},children:o},o)):e.jsx("span",{style:{fontSize:11.5,color:t.textMuted,fontStyle:"italic"},children:i})})]})}function je({label:t,hint:n,t:l,children:i}){return e.jsxs("div",{style:{display:"grid",gap:6},children:[e.jsx("label",{style:{fontSize:12,fontWeight:700,color:l.textPrimary},children:t}),n?e.jsx("div",{style:{fontSize:11.5,color:l.textMuted,lineHeight:1.45,marginTop:-2},children:n}):null,i]})}function ue({t,tone:n,children:l}){const i=n==="error"?t.error:t.textMuted;return e.jsx("div",{style:{fontSize:11.5,color:i,lineHeight:1.45},children:l})}function Dt(t){return{display:"inline-flex",alignItems:"center",fontSize:10.5,fontWeight:700,color:t.success,background:`${t.success}14`,border:`1px solid ${t.success}38`,borderRadius:999,padding:"2px 7px"}}function $t(t){return{display:"inline-flex",alignItems:"center",fontSize:10.5,fontWeight:700,color:t.accent,background:`${t.accent}14`,border:`1px solid ${t.accent}38`,borderRadius:999,padding:"2px 7px"}}function xe(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:7,border:`1px solid ${t.accent}`,background:t.accent,color:"#ffffff",fontSize:12.5,fontWeight:700,fontFamily:t.font,cursor:"pointer"}}function Y(t){return{display:"inline-flex",alignItems:"center",gap:5,padding:"7px 11px",borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,fontSize:12,fontWeight:600,fontFamily:t.font,cursor:"pointer"}}function Rt(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 13px",borderRadius:7,border:`1px solid ${t.error}`,background:t.error,color:"#ffffff",fontSize:12.5,fontWeight:700,fontFamily:t.font,cursor:"pointer"}}function ge(t){return{display:"inline-flex",alignItems:"center",justifyContent:"center",width:30,height:30,borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,cursor:"pointer",flexShrink:0}}function H(t){return{width:"100%",border:`1px solid ${t.btnBorder}`,borderRadius:7,background:t.cellBg,color:t.textPrimary,fontSize:12.5,fontFamily:t.font,padding:"8px 10px",boxSizing:"border-box"}}function Mt(t){return{...H(t),resize:"vertical",lineHeight:1.5,padding:"9px 11px"}}function Me(t){return{display:"inline-flex",alignItems:"center",gap:4,fontSize:10,fontWeight:700,letterSpacing:"0.02em",color:t.warning,background:`${t.warning}16`,border:`1px solid ${t.warning}40`,borderRadius:999,padding:"2px 8px"}}function He(t){return{display:"flex",alignItems:"center",gap:5,flexWrap:"wrap",border:`1px solid ${t.btnBorder}`,background:t.cellBg,borderRadius:7,padding:"6px 8px"}}function Fe(t){return{flex:1,minWidth:110,border:"none",background:"none",outline:"none",fontSize:11.5,fontFamily:t.font,color:t.textPrimary,padding:2}}function _e(t){return{display:"inline-flex",alignItems:"center",gap:4,fontSize:11,padding:"2.5px 8px",borderRadius:999,background:"var(--accent-dim)",color:t.accent,border:`1px solid ${t.accent}33`}}function qe(t){return{border:"none",background:"none",color:t.accent,cursor:"pointer",padding:0,fontSize:12,lineHeight:1,fontFamily:t.font}}const K={display:"flex",flexDirection:"column",gap:4};function q(t){return{fontSize:11,fontWeight:650,color:t.textSecondary}}function Pt(t){return{display:"inline-flex",alignItems:"center",gap:4,fontSize:11,fontWeight:600,color:t.textSecondary,background:t.btnBg,border:`1px solid ${t.btnBorder}`,borderRadius:6,padding:"3px 8px",cursor:"pointer",fontFamily:t.fontMono}}const Et={position:"fixed",inset:0,background:"rgba(26, 26, 26, 0.22)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:60};function At(t){return{width:"min(860px, 94vw)",height:"min(640px, 90vh)",background:t.cellBg,border:`1px solid ${t.headerBorder}`,borderRadius:14,display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 24px 70px rgba(26,26,26,0.22)"}}function Ot(t){return{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--border-subtle)",flexShrink:0}}function Lt(t){return{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:8,padding:"12px 18px",borderTop:"1px solid var(--border-subtle)",background:"var(--bg-1)",flexShrink:0}}const Nt={position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.42)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:70,padding:20};function Ht(t){return{width:"min(420px, 100%)",background:t.cellBg,border:`1px solid ${t.cellBorder}`,borderRadius:12,padding:20,display:"grid",gap:13,boxShadow:"0 18px 48px rgba(0,0,0,0.3)"}}function Ft({initialTab:t="overview"}){const{state:n}=he(),l=Se[n.themeMode],[i,s]=a.useState(t),[d,o]=a.useState([]),[r,g]=a.useState([]),[S,v]=a.useState(!0);a.useEffect(()=>s(t),[t]);const c=a.useCallback(()=>{let h=!1;return v(!0),Promise.all([D.getDomains(),D.getSkills()]).then(([R,I])=>{h||(o(Array.isArray(R.domains)?R.domains:[]),g(Array.isArray(I.skills)?I.skills:[]))}).catch(()=>{h||(o([]),g([]))}).finally(()=>{h||v(!1)}),()=>{h=!0}},[]);a.useEffect(()=>c(),[c]);const W=a.useMemo(()=>{const h=d.filter(m=>!!(m.businessOwner||m.owner)).length,R=r.filter(m=>!m.status||m.status==="active").length,I=r.filter(m=>m.status==="draft").length;return{ownedDomains:h,activeSkills:R,draftSkills:I}},[d,r]),j=a.useCallback(()=>{s("domains"),window.setTimeout(()=>window.dispatchEvent(new Event("dql:context-build")),50)},[]),p=[{id:"overview",label:"Overview"},{id:"domains",label:"Domains",count:d.length},{id:"skills",label:"Skills",count:r.length},{id:"knowledge",label:"Knowledge 360"}];return e.jsx("div",{style:{flex:1,minWidth:0,overflow:"auto",background:l.appBg},children:e.jsxs("div",{style:{maxWidth:1040,margin:"0 auto",padding:"22px 28px 40px"},children:[e.jsxs("header",{style:{display:"flex",justifyContent:"space-between",alignItems:"flex-end",gap:18,marginBottom:15},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:9,alignItems:"center"},children:[e.jsx(se,{size:20,color:l.accent}),e.jsx("h1",{style:{fontSize:22,color:l.textPrimary},children:"Governed context"})]}),e.jsx("p",{style:{marginTop:6,fontSize:13,lineHeight:1.5,color:l.textMuted,maxWidth:700},children:"Domains define business boundaries. Skills teach the agent approved vocabulary, reuse rules, and when to ask for clarification."})]}),e.jsxs("button",{type:"button",onClick:j,style:Ke(l),children:[e.jsx(ne,{size:14})," Build with AI"]})]}),e.jsx("nav",{"aria-label":"Governed context sections",style:{display:"flex",gap:3,borderBottom:`1px solid ${l.headerBorder}`,marginBottom:18},children:p.map(h=>e.jsxs("button",{type:"button",onClick:()=>s(h.id),style:{border:"none",borderBottom:`2px solid ${i===h.id?l.accent:"transparent"}`,background:"transparent",padding:"9px 12px",color:i===h.id?l.textPrimary:l.textMuted,fontWeight:i===h.id?700:600,cursor:"pointer",fontFamily:l.font,fontSize:12.5},children:[h.label,h.count!==void 0?` · ${h.count}`:""]},h.id))}),i==="overview"?e.jsx(_t,{t:l,loading:S,domains:d,skills:r,status:W,onBuild:j,onTab:s}):null,i==="domains"?e.jsx(nt,{embedded:!0}):null,i==="skills"?e.jsx(St,{embedded:!0}):null,i==="knowledge"?e.jsx(Ge,{t:l,domains:d}):null]})})}function Ge({t,domains:n,initialDomainId:l}){var W,j;const[i,s]=a.useState(l??((W=n[0])==null?void 0:W.id)??""),[d,o]=a.useState(null),[r,g]=a.useState(!1),[S,v]=a.useState(null);a.useEffect(()=>{var p;!i&&((p=n[0])!=null&&p.id)&&s(n[0].id)},[i,n]),a.useEffect(()=>{l&&n.some(p=>p.id===l)&&s(l)},[n,l]),a.useEffect(()=>{if(!i){o(null);return}let p=!1;return g(!0),v(null),D.getDomainKnowledge(i).then(h=>{p||o(h)}).catch(h=>{p||(o(null),v(h instanceof Error?h.message:"Could not load the compiled knowledge capsule."))}).finally(()=>{p||g(!1)}),()=>{p=!0}},[i]);const c=a.useMemo(()=>{const p={};for(const h of(d==null?void 0:d.objects)??[])p[h.kind]=(p[h.kind]??0)+1;return Object.entries(p).sort((h,R)=>R[1]-h[1]||h[0].localeCompare(R[0]))},[d]);return e.jsxs("div",{style:{display:"grid",gap:14},children:[e.jsx("section",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:10,background:t.cellBg,padding:15},children:e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:12,flexWrap:"wrap"},children:[e.jsxs("div",{children:[e.jsxs("div",{style:{display:"flex",gap:7,alignItems:"center",color:t.textPrimary,fontWeight:700,fontSize:13},children:[e.jsx(We,{size:16,color:t.accent})," Compiled Domain 360"]}),e.jsx("div",{style:{marginTop:4,color:t.textMuted,fontSize:12},children:"The same qualified graph, route policy, and skill snapshot used by Ask."})]}),e.jsxs("select",{"aria-label":"Domain knowledge capsule",value:i,onChange:p=>s(p.target.value),style:{minWidth:210,border:`1px solid ${t.inputBorder}`,borderRadius:7,background:t.inputBg,color:t.textPrimary,padding:"7px 9px",fontFamily:t.font},children:[e.jsx("option",{value:"",children:"Select a domain"}),[...n].sort((p,h)=>p.name.localeCompare(h.name)).map(p=>e.jsx("option",{value:p.id,children:p.name},p.id))]})]})}),r?e.jsxs("div",{style:{color:t.textMuted,display:"flex",gap:8,alignItems:"center",padding:24},children:[e.jsx(F,{size:15})," Loading compiled knowledge…"]}):null,S?e.jsx("div",{style:{border:`1px solid ${t.error}`,background:t.cellBg,color:t.error,borderRadius:8,padding:12,fontSize:12.5},children:S}):null,d?e.jsxs(e.Fragment,{children:[e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"repeat(4, minmax(0, 1fr))",gap:9},children:[e.jsx(V,{t,label:"Objects",value:d.counts.objects,detail:"qualified knowledge",icon:e.jsx(se,{size:16})}),e.jsx(V,{t,label:"Relations",value:d.counts.edges,detail:"provenance + policy",icon:e.jsx(We,{size:16})}),e.jsx(V,{t,label:"Authorized",value:d.counts.routeStates.authorized??0,detail:"safe cross-domain routes",icon:e.jsx(Je,{size:16})}),e.jsx(V,{t,label:"Blocked / stale",value:(d.counts.routeStates.blocked??0)+(d.counts.routeStates.stale??0),detail:"never auto-joined",icon:e.jsx(Ae,{size:16})})]}),e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1.2fr) minmax(0, 1fr)",gap:12},children:[e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:9,background:t.cellBg,padding:14},children:[e.jsx("strong",{style:{color:t.textPrimary,fontSize:13},children:"Knowledge capsule"}),e.jsx("p",{style:{color:t.textSecondary,fontSize:12.5,lineHeight:1.5,margin:"7px 0 11px"},children:((j=d.capsule)==null?void 0:j.description)||"Compiled domain boundary and governed references."}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:c.map(([p,h])=>e.jsxs("span",{style:{border:`1px solid ${t.cellBorder}`,background:t.pillBg,color:t.textSecondary,borderRadius:999,padding:"3px 7px",fontSize:11},children:[p.replace(/_/g," ")," · ",h]},p))}),e.jsxs("div",{style:{marginTop:11,color:t.textMuted,fontSize:11},children:["Snapshot ",d.snapshotId.slice(0,12)," · graph ",d.sourceFingerprint.slice(0,12),d.truncated?" · bounded response":""]})]}),e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:9,background:t.cellBg,padding:14},children:[e.jsx("strong",{style:{color:t.textPrimary,fontSize:13},children:"Cross-domain routes"}),e.jsx("div",{style:{display:"grid",gap:7,marginTop:9},children:d.routes.length?d.routes.map(p=>e.jsxs("div",{style:{borderTop:`1px solid ${t.headerBorder}`,paddingTop:7},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:8,color:t.textSecondary,fontSize:12},children:[e.jsxs("span",{children:[p.providerDomainId," → ",p.consumerDomainId]}),e.jsx("span",{style:{color:p.state==="authorized"?t.success:p.state==="observed"?t.textMuted:t.warning,fontWeight:700},children:p.state})]}),e.jsx("div",{style:{marginTop:3,color:t.textMuted,fontSize:11},children:p.purpose||p.reasonCodes.join(", ")||"governed route"})]},p.id)):e.jsx("div",{style:{color:t.textMuted,fontSize:12,marginTop:8},children:"No cross-domain routes declared."})})]})]})]}):null]})}function _t({t,loading:n,domains:l,skills:i,status:s,onBuild:d,onTab:o}){if(n)return e.jsxs("div",{style:{padding:"42px 0",color:t.textMuted,display:"flex",gap:8,alignItems:"center",fontSize:13},children:[e.jsx(F,{size:15})," Loading governed context…"]});const r=[];return l.length?s.ownedDomains<l.length&&r.push(`${l.length-s.ownedDomains} domain${l.length-s.ownedDomains===1?"":"s"} still need an owner.`):r.push("Create a business domain before relying on AI guidance."),i.length||r.push("Draft a domain skill so the agent has governed business guidance."),s.draftSkills&&r.push(`${s.draftSkills} skill${s.draftSkills===1?" is":"s are"} still draft-only and will not guide answers.`),e.jsxs("div",{style:{display:"grid",gap:16},children:[e.jsxs("section",{style:{display:"grid",gridTemplateColumns:"repeat(3, minmax(0, 1fr))",gap:10},children:[e.jsx(V,{t,label:"Domains",value:l.length,detail:`${s.ownedDomains} with an owner`,icon:e.jsx(se,{size:17})}),e.jsx(V,{t,label:"Active skills",value:s.activeSkills,detail:"available to the agent",icon:e.jsx(re,{size:17})}),e.jsx(V,{t,label:"Draft skills",value:s.draftSkills,detail:"review before activation",icon:e.jsx(ne,{size:17})})]}),e.jsxs("section",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:10,background:t.cellBg,padding:16,display:"grid",gap:10},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[e.jsx(Ve,{size:16,color:r.length?t.warning:t.success}),e.jsx("strong",{style:{color:t.textPrimary,fontSize:13},children:"Readiness"})]}),r.length?e.jsx("div",{style:{display:"grid",gap:6},children:r.map(g=>e.jsxs("div",{style:{display:"flex",gap:7,color:t.textSecondary,fontSize:12.5},children:[e.jsx(Ae,{size:14,color:t.warning}),g]},g))}):e.jsx("div",{style:{color:t.success,fontSize:12.5},children:"Your agent has owned domains and active governed skills available for retrieval."}),e.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:2},children:[e.jsxs("button",{type:"button",onClick:d,style:Ke(t),children:[e.jsx(ne,{size:13})," Build domains & skills with AI"]}),e.jsx("button",{type:"button",onClick:()=>o("domains"),style:Pe(t),children:"Manage domains"}),e.jsx("button",{type:"button",onClick:()=>o("skills"),style:Pe(t),children:"Manage skills"})]})]})]})}function V({t,label:n,value:l,detail:i,icon:s}){return e.jsxs("div",{style:{border:`1px solid ${t.cellBorder}`,borderRadius:9,background:t.cellBg,padding:13},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",color:t.textMuted,fontSize:12},children:[n,s]}),e.jsx("div",{style:{color:t.textPrimary,fontSize:25,fontWeight:750,marginTop:7},children:l}),e.jsx("div",{style:{color:t.textMuted,fontSize:11.5,marginTop:3},children:i})]})}function Ke(t){return{display:"inline-flex",alignItems:"center",gap:6,padding:"7px 12px",borderRadius:7,border:`1px solid ${t.accent}`,background:t.accent,color:"#fff",fontWeight:700,fontSize:12.5,fontFamily:t.font,cursor:"pointer"}}function Pe(t){return{display:"inline-flex",alignItems:"center",padding:"7px 12px",borderRadius:7,border:`1px solid ${t.btnBorder}`,background:t.btnBg,color:t.textSecondary,fontWeight:650,fontSize:12.5,fontFamily:t.font,cursor:"pointer"}}const Jt=Object.freeze(Object.defineProperty({__proto__:null,GovernedContextPage:Ft,Knowledge360:Ge},Symbol.toStringTag,{value:"Module"}));export{Jt as G,Ge as K,St as S};
|
package/dist/assets/dql-notebook/assets/{HelpDocsPage-Bc5pLakt.js → HelpDocsPage-CL0vbSER.js}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{c as k,u as z,t as R,r as u,j as e,aw as I}from"./index-BTuliKhK.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 q=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],A=
|
|
6
|
+
*/const q=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],A=k("image",q);/**
|
|
7
7
|
* @license lucide-react v0.563.0 - ISC
|
|
8
8
|
*
|
|
9
9
|
* This source code is licensed under the ISC license.
|
|
10
10
|
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],W=
|
|
11
|
+
*/const B=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],W=k("info",B),F=[{title:"Installation",mins:"3 min"},{title:"Run CLI commands",mins:"3 min"},{title:"Connect your database",mins:"4 min"},{title:"Sync your dbt project",mins:"2 min"},{title:"Create your first block",mins:"5 min"},{title:"Ask your first question",mins:"3 min"},{title:"Share your work",mins:"3 min"},{title:"Troubleshooting",mins:"—"}],j="https://github.com/duckcode-ai/dql/blob/main/docs/reference/cli.md";function _(){const{state:v,dispatch:S}=z(),t=R[v.themeMode],[w,T]=u.useState(0),[d,f]=u.useState(null),g=u.useRef(null),m=u.useRef([]),C=()=>{const n=g.current;if(!n)return;const r=n.scrollTop+90;let i=0;m.current.forEach((b,L)=>{b&&b.offsetTop<=r&&(i=L)}),T(i)},D=n=>{const r=g.current,i=m.current[n];!r||!i||r.scrollTo({top:Math.max(0,i.offsetTop-24),behavior:"smooth"})},p=t.fontMono,y={margin:"12px 0 0",border:`1px solid ${t.cellBorder}`,background:"#1e1c26",borderRadius:10,padding:"13px 16px",fontSize:12.5,lineHeight:1.7,fontFamily:p,color:"#e8e6f0",overflowX:"auto",whiteSpace:"pre"},c={color:"#8a8d96"},s={fontFamily:p,fontSize:12,background:"var(--bg-0)",borderRadius:4,padding:"1px 5px"},l=(n,r)=>e.jsxs("h2",{style:{margin:0,fontSize:20,fontWeight:700,letterSpacing:"-0.01em",color:t.textPrimary,display:"flex",alignItems:"center",gap:9},children:[e.jsx("span",{style:{color:t.textMuted,fontFamily:p,fontSize:15},children:n}),r]}),o={margin:"12px 0 0"},h=(n,r)=>e.jsxs("div",{style:{margin:"16px 0 0"},children:[e.jsxs("div",{style:{width:"100%",height:300,borderRadius:10,border:`1.5px dashed ${t.cellBorder}`,background:t.appBg,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:8,color:t.textMuted},children:[e.jsx(A,{size:22,strokeWidth:1.5}),e.jsx("span",{style:{fontSize:12,fontStyle:"italic",maxWidth:420,textAlign:"center"},children:r})]}),e.jsx("div",{style:{marginTop:6,fontSize:11.5,color:t.textMuted,textAlign:"center"},children:n})]}),x=(n,r)=>e.jsxs("div",{style:{border:"1px solid var(--border-subtle)",borderRadius:10,background:t.cellBg,padding:"12px 14px"},children:[e.jsx("div",{style:{fontSize:13,fontWeight:650,color:t.textPrimary},children:n}),e.jsx("div",{style:{fontSize:12.5,color:t.textSecondary,marginTop:4,lineHeight:1.6},children:r})]}),a=n=>r=>{m.current[n]=r};return e.jsxs("div",{style:{flex:1,minWidth:0,minHeight:0,display:"flex",overflow:"hidden",background:"var(--bg-canvas)",fontFamily:t.font},children:[e.jsxs("div",{style:{width:"clamp(200px, 18vw, 252px)",flexShrink:0,borderRight:`1px solid ${t.headerBorder}`,background:t.cellBg,display:"flex",flexDirection:"column",minHeight:0,overflow:"auto",padding:"16px 8px"},children:[e.jsx("div",{style:{padding:"0 10px 8px",fontSize:10,fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",color:t.textMuted},children:"Getting started"}),F.map((n,r)=>{const i=w===r;return e.jsxs("button",{type:"button",onClick:()=>D(r),style:{display:"flex",alignItems:"center",gap:8,padding:"6.5px 10px",borderRadius:7,border:"none",cursor:"pointer",textAlign:"left",fontSize:12,fontWeight:550,fontFamily:t.font,width:"100%",background:i?"var(--accent-dim)":"transparent",color:i?t.accent:t.textSecondary},children:[e.jsx("span",{style:{width:18,height:18,borderRadius:5,background:i?t.accent:"var(--bg-0)",color:i?"#fff":t.textMuted,display:"inline-flex",alignItems:"center",justifyContent:"center",fontSize:9.5,fontWeight:700,flexShrink:0,fontFamily:p},children:String(r+1).padStart(2,"0")}),e.jsx("span",{style:{flex:1},children:n.title}),e.jsx("span",{style:{fontSize:9.5,color:t.textMuted},children:n.mins})]},n.title)}),e.jsx("div",{style:{height:1,background:"var(--border-subtle)",margin:"12px 10px"}}),e.jsxs("div",{style:{padding:"0 10px",display:"flex",flexDirection:"column",gap:7,fontSize:11.5},children:[e.jsx("a",{href:"https://github.com/duckcode-ai/dql#readme",target:"_blank",rel:"noreferrer",style:{color:t.accent,textDecoration:"none"},children:"Keyboard shortcuts"}),e.jsx("a",{href:j,target:"_blank",rel:"noreferrer",style:{color:t.accent,textDecoration:"none"},children:"CLI reference"}),e.jsx("a",{href:"https://github.com/duckcode-ai/dql/discussions",target:"_blank",rel:"noreferrer",style:{color:t.accent,textDecoration:"none"},children:"Community & support"})]}),e.jsx("div",{style:{flex:1}}),e.jsxs("div",{style:{margin:"12px 10px 0",border:"1px solid var(--border-subtle)",borderRadius:9,background:t.appBg,padding:"10px 11px",fontSize:11,color:t.textMuted,lineHeight:1.5},children:["Stuck? Ask the assistant — it reads these docs.",e.jsx("div",{children:e.jsxs("button",{type:"button",onClick:()=>S({type:"OPEN_GLOBAL_AI",autoRun:{text:"Help me finish setting up DQL — what is left to configure in this workspace?"}}),style:{marginTop:7,display:"inline-flex",alignItems:"center",gap:5,height:26,padding:"0 10px",borderRadius:6,border:`1px solid ${t.cellBorder}`,background:t.cellBg,color:t.accent,fontSize:11,fontWeight:650,cursor:"pointer",fontFamily:t.font},children:[e.jsx(I,{size:11,strokeWidth:1.75})," Ask about setup"]})})]})]}),e.jsx("div",{ref:g,onScroll:C,style:{flex:1,minWidth:0,overflow:"auto"},children:e.jsxs("div",{style:{width:"min(680px, 100% - 56px)",margin:"0 auto",padding:"34px 0 80px",fontSize:14,lineHeight:1.7,color:t.textSecondary},children:[e.jsx("div",{style:{fontSize:11,fontWeight:700,letterSpacing:"0.06em",textTransform:"uppercase",color:t.accent},children:"Guide"}),e.jsx("h1",{style:{margin:"6px 0 0",fontSize:28,fontWeight:700,letterSpacing:"-0.02em",color:t.textPrimary,lineHeight:1.25},children:"Getting started with DQL"}),e.jsx("div",{style:{marginTop:8,fontSize:13.5,color:t.textMuted},children:"From install to your first governed answer — about 20 minutes."}),e.jsxs("div",{ref:a(0),style:{marginTop:36},children:[l("01","Installation"),e.jsxs("p",{style:o,children:["DQL runs locally next to your dbt project. The recommended setup creates a ",e.jsx("span",{style:s,children:"dql/"})," workspace and installs the CLI inside it, so every repository keeps the version it was tested with."]}),e.jsxs("pre",{style:{...y,margin:"14px 0 0"},children:["cd my-dbt-project",`
|
|
12
12
|
`,"dbt parse",`
|
|
13
13
|
`,"npx create-dql-app@latest dql",`
|
|
14
14
|
`,"cd dql",`
|