@duckcodeailabs/dql-cli 1.14.0 → 1.14.1
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/args.d.ts +15 -0
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +25 -0
- package/dist/args.js.map +1 -1
- package/dist/assets/dql-notebook/assets/{AgentLogPage-Ch7VK20X.js → AgentLogPage-BPz-UWFh.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildDialog-DBr5TmyM.js → AiBuildDialog-BEl53WA_.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiBuildResult-jLPzQO7O.js → AiBuildResult-B4yfGTTZ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AiSidePanel-CdlGsiVC.js → AiSidePanel-CSZAAvuD.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AnalyticsHome-C0DXbOwY.js → AnalyticsHome-D5P6Ujwi.js} +1 -1
- package/dist/assets/dql-notebook/assets/{AppsView-CcpwjApv.js → AppsView-DQOwU9Cg.js} +4 -4
- package/dist/assets/dql-notebook/assets/{BlockStudio-CFYxafw-.js → BlockStudio-B4ap0GdY.js} +1 -1
- package/dist/assets/dql-notebook/assets/{BusinessArtifactView-C0kLYg2p.js → BusinessArtifactView-BIfNI-0S.js} +1 -1
- package/dist/assets/dql-notebook/assets/{DbtFirstModelingPage-CMwElXD_.js → DbtFirstModelingPage-D72byb2g.js} +1 -1
- package/dist/assets/dql-notebook/assets/{GitPage-JjhRDeWY.js → GitPage-lQb1uXH2.js} +1 -1
- package/dist/assets/dql-notebook/assets/{GlobalAiRail-DakE4NdR.js → GlobalAiRail-CVECf6Xj.js} +1 -1
- package/dist/assets/dql-notebook/assets/{GovernedContextPage-BokDqG6a.js → GovernedContextPage-trOyMCY6.js} +1 -1
- package/dist/assets/dql-notebook/assets/{HelpDocsPage-CjOv6_gz.js → HelpDocsPage-D8hLS5lE.js} +1 -1
- package/dist/assets/dql-notebook/assets/{HomePage-nGaNcwdw.js → HomePage-eIkfBIep.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDAG-CO6CFJRg.js → LineageDAG-CSqcbDrE.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDetailView-BnGb7OF7.js → LineageDetailView-DJZZjZu-.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineageDrawer-C5Y0Ht0b.js → LineageDrawer-BcIipIc3.js} +1 -1
- package/dist/assets/dql-notebook/assets/{LineagePathBreadcrumb-Cgh3GR3F.js → LineagePathBreadcrumb-CviIf8PN.js} +1 -1
- package/dist/assets/dql-notebook/assets/{MiniLineageGraph-Kla9PYuj.js → MiniLineageGraph-vH_MY_Ju.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NewBlockModal-BR2SnmPT.js → NewBlockModal-DbCQg-pj.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NewNotebookModal-BaCHMYeB.js → NewNotebookModal-5Vp6XiuK.js} +1 -1
- package/dist/assets/dql-notebook/assets/{NotebookEditor-CBLqY8cE.js → NotebookEditor-DjqJS44s.js} +1 -1
- package/dist/assets/dql-notebook/assets/{ReadinessPage-CiN0IWSS.js → ReadinessPage-BHGrC5ho.js} +1 -1
- package/dist/assets/dql-notebook/assets/{SetupOnboarding-BhiCsYF-.js → SetupOnboarding-BfS9Tdx-.js} +1 -1
- package/dist/assets/dql-notebook/assets/{SkillsPage-CCSf8VMm.js → SkillsPage-BFH21wSj.js} +1 -1
- package/dist/assets/dql-notebook/assets/{TrustBadge-BgQmFe_x.js → TrustBadge-zm6g_SxZ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{UnifiedAgentRunPanel-Bw5AXNDB.js → UnifiedAgentRunPanel--oxmjlgr.js} +21 -21
- package/dist/assets/dql-notebook/assets/{answer-to-notebook-AeDYUDla.js → answer-to-notebook-DPhxIEzF.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-left-C55x2hq_.js → arrow-left-DNEb86Xc.js} +1 -1
- package/dist/assets/dql-notebook/assets/{arrow-right-C1cJrhOm.js → arrow-right-DpPWbwaD.js} +1 -1
- package/dist/assets/dql-notebook/assets/{book-open-text-CQf_sdv2.js → book-open-text-D7s5jo4X.js} +1 -1
- package/dist/assets/dql-notebook/assets/{circle-x-X8-Z2yLY.js → circle-x-Db3dXKg7.js} +1 -1
- package/dist/assets/dql-notebook/assets/{dagre.esm-BjjNYKyY.js → dagre.esm-C7pppQ1a.js} +1 -1
- package/dist/assets/dql-notebook/assets/{external-link-C2zrz5DH.js → external-link-BxwXitO_.js} +1 -1
- package/dist/assets/dql-notebook/assets/{grip-vertical-qGV_PYGU.js → grip-vertical-Dt4lkWRi.js} +1 -1
- package/dist/assets/dql-notebook/assets/{index-ByTDPDaH.js → index-DKo-bwNw.js} +2 -2
- package/dist/assets/dql-notebook/assets/{link-2-VpyOxQXG.js → link-2-Dfo2P6wi.js} +1 -1
- package/dist/assets/dql-notebook/assets/{list-tree-CH2Jhwms.js → list-tree-DiTmIWAL.js} +1 -1
- package/dist/assets/dql-notebook/assets/{minimize-2-B2TZJ8BT.js → minimize-2-CMTAkPzL.js} +1 -1
- package/dist/assets/dql-notebook/assets/{panel-right-open-BunF88lt.js → panel-right-open-DwYr7FW4.js} +1 -1
- package/dist/assets/dql-notebook/assets/{play-DAFVF4_G.js → play-BXhHYQ4x.js} +1 -1
- package/dist/assets/dql-notebook/assets/{rotate-ccw-DGCrrqtY.js → rotate-ccw-BNi6F8pl.js} +1 -1
- package/dist/assets/dql-notebook/assets/{semantic-fields-Ci-9QL9F.js → semantic-fields-CNOGysAy.js} +1 -1
- package/dist/assets/dql-notebook/assets/{sliders-horizontal-BOAlXXbn.js → sliders-horizontal-Ec5MUMUW.js} +1 -1
- package/dist/assets/dql-notebook/assets/{star-CkksZXHt.js → star-B9leDkp_.js} +1 -1
- package/dist/assets/dql-notebook/assets/{triangle-alert-D3mjyJZE.js → triangle-alert-BefTYCzx.js} +1 -1
- package/dist/assets/dql-notebook/assets/{upload-CTNOAVEO.js → upload-SPiOM2tQ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{usePersistedAgentThreadId-DiQjc7x-.js → usePersistedAgentThreadId-C4foXeiQ.js} +1 -1
- package/dist/assets/dql-notebook/assets/{user-round-BWd5tQRg.js → user-round-comGmyw-.js} +1 -1
- package/dist/assets/dql-notebook/assets/{wand-sparkles-CqsAv8P-.js → wand-sparkles-BffR4dF8.js} +1 -1
- package/dist/assets/dql-notebook/assets/{workflow-CSqsj-sC.js → workflow-ChmPTEzH.js} +1 -1
- package/dist/assets/dql-notebook/assets/{wrench-DWqzqlX8.js → wrench-DovaG_ze.js} +1 -1
- package/dist/assets/dql-notebook/assets/{x-65M5rLCE.js → x-nRx91AgW.js} +1 -1
- package/dist/assets/dql-notebook/index.html +1 -1
- package/dist/commands/agent-eval-cassette.d.ts +73 -0
- package/dist/commands/agent-eval-cassette.d.ts.map +1 -0
- package/dist/commands/agent-eval-cassette.js +170 -0
- package/dist/commands/agent-eval-cassette.js.map +1 -0
- package/dist/commands/agent-eval-runtime.d.ts +97 -0
- package/dist/commands/agent-eval-runtime.d.ts.map +1 -0
- package/dist/commands/agent-eval-runtime.js +155 -0
- package/dist/commands/agent-eval-runtime.js.map +1 -0
- package/dist/commands/agent.d.ts +115 -1
- package/dist/commands/agent.d.ts.map +1 -1
- package/dist/commands/agent.js +289 -62
- package/dist/commands/agent.js.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/llm/analyst-loop-tools.d.ts +19 -0
- package/dist/llm/analyst-loop-tools.d.ts.map +1 -0
- package/dist/llm/analyst-loop-tools.js +56 -0
- package/dist/llm/analyst-loop-tools.js.map +1 -0
- package/dist/llm/providers/dql-agent-provider.d.ts +24 -1
- package/dist/llm/providers/dql-agent-provider.d.ts.map +1 -1
- package/dist/llm/providers/dql-agent-provider.js +306 -7
- package/dist/llm/providers/dql-agent-provider.js.map +1 -1
- package/dist/llm/types.d.ts +19 -1
- package/dist/llm/types.d.ts.map +1 -1
- package/dist/local-runtime.d.ts +108 -1
- package/dist/local-runtime.d.ts.map +1 -1
- package/dist/local-runtime.js +626 -110
- package/dist/local-runtime.js.map +1 -1
- package/dist/package.json +10 -10
- package/package.json +10 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-eIkfBIep.js","assets/TrustBadge-zm6g_SxZ.js","assets/arrow-right-DpPWbwaD.js","assets/triangle-alert-BefTYCzx.js","assets/book-open-text-D7s5jo4X.js","assets/workflow-ChmPTEzH.js","assets/react-CRB3T2We.js","assets/AnalyticsHome-D5P6Ujwi.js","assets/answer-to-notebook-DPhxIEzF.js","assets/UnifiedAgentRunPanel--oxmjlgr.js","assets/usePersistedAgentThreadId-C4foXeiQ.js","assets/AiBuildResult-B4yfGTTZ.js","assets/user-round-comGmyw-.js","assets/rotate-ccw-BNi6F8pl.js","assets/wrench-DovaG_ze.js","assets/x-nRx91AgW.js","assets/list-tree-DiTmIWAL.js","assets/minimize-2-CMTAkPzL.js","assets/star-B9leDkp_.js","assets/GlobalAiRail-CVECf6Xj.js","assets/AiSidePanel-CSZAAvuD.js","assets/NotebookEditor-DjqJS44s.js","assets/LineagePathBreadcrumb-CviIf8PN.js","assets/codemirror-DXt7RW72.js","assets/semantic-fields-CNOGysAy.js","assets/MiniLineageGraph-vH_MY_Ju.js","assets/dagre.esm-C7pppQ1a.js","assets/dagre-BZV40eAE.css","assets/link-2-Dfo2P6wi.js","assets/upload-SPiOM2tQ.js","assets/NewNotebookModal-5Vp6XiuK.js","assets/NewBlockModal-DbCQg-pj.js","assets/SetupOnboarding-BfS9Tdx-.js","assets/arrow-left-DNEb86Xc.js","assets/BlockStudio-B4ap0GdY.js","assets/play-BXhHYQ4x.js","assets/panel-right-open-DwYr7FW4.js","assets/BusinessArtifactView-BIfNI-0S.js","assets/LineageDetailView-DJZZjZu-.js","assets/LineageDAG-CSqcbDrE.js","assets/HelpDocsPage-D8hLS5lE.js","assets/GitPage-lQb1uXH2.js","assets/external-link-BxwXitO_.js","assets/ReadinessPage-BHGrC5ho.js","assets/ai-build-bus-1BR770pY.js","assets/wand-sparkles-BffR4dF8.js","assets/AgentLogPage-BPz-UWFh.js","assets/circle-x-Db3dXKg7.js","assets/GovernedContextPage-trOyMCY6.js","assets/SkillsPage-BFH21wSj.js","assets/DbtFirstModelingPage-D72byb2g.js","assets/sliders-horizontal-Ec5MUMUW.js","assets/AppsView-DQOwU9Cg.js","assets/grip-vertical-Dt4lkWRi.js","assets/LineageDrawer-BcIipIc3.js","assets/AiBuildDialog-BEl53WA_.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var Rf=Object.defineProperty;var ec=e=>{throw TypeError(e)};var Of=(e,t,n)=>t in e?Rf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Pe=(e,t,n)=>Of(e,typeof t!="symbol"?t+"":t,n),Ms=(e,t,n)=>t.has(e)||ec("Cannot "+n);var R=(e,t,n)=>(Ms(e,t,"read from private field"),n?n.call(e):t.get(e)),le=(e,t,n)=>t.has(e)?ec("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Z=(e,t,n,r)=>(Ms(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),fe=(e,t,n)=>(Ms(e,t,"access private method"),n);var $o=(e,t,n,r)=>({set _(o){Z(e,t,o,n)},get _(){return R(e,t,r)}});import{r as Xl,a as Zl,g as ed}from"./react-CRB3T2We.js";function _f(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const i=Object.getOwnPropertyDescriptor(r,o);i&&Object.defineProperty(e,o,i.get?i:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const a of i.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var Ls={exports:{}},Fr={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* react-jsx-runtime.production.min.js
|
|
@@ -607,7 +607,7 @@ ${t}`;return r.replace(/\n\}\s*$/,`${o}
|
|
|
607
607
|
</div>
|
|
608
608
|
<p class="exported-by">Built with DQL Workbench</p>
|
|
609
609
|
</body>
|
|
610
|
-
</html>`}function hC(e,t){const n=fC(e,t),r=new Blob([n],{type:"text/html;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`${e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}-dashboard.html`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}const mC=new Set(["succeeded","failed","cancelled","interrupted"]);function Ir(e){return mC.has(e.status)}function gC(e,t){if(e.id!==t.id)return t;const n=Ir(e),r=Ir(t);return n&&!r||t.updatedAt<e.updatedAt?e:t.updatedAt>e.updatedAt?t:n!==r?r?t:e:t.progress!==e.progress?t.progress>e.progress?t:e:t}function eo(e,t){const n=e.find(o=>o.id===t.id),r=n?gC(n,t):t;return kC([...e.filter(o=>o.id!==t.id),r])}function yC(e,t){return t.reduce(eo,e)}function bC(e){return e.filter(t=>!Ir(t)).map(t=>t.id)}function xC(e,t){for(const n of bC(t))e.add(n)}async function vC(e,t,n){await Promise.all([...e].map(async r=>{try{const o=await t(r);if(n(o)===!1)return;Ir(o)&&e.delete(r)}catch{}}))}function SC(e,t=new Set){return e.filter(n=>n.type==="block_certification"&&n.status==="succeeded").filter(n=>!t.has(n.id)).filter(n=>{const r=n.result;return!!(r!=null&&r.block&&r.outcome)}).sort((n,r)=>n.updatedAt.localeCompare(r.updatedAt)||n.createdAt.localeCompare(r.createdAt)||n.id.localeCompare(r.id))}function fE(e,t){var o;if(t.operationId){const i=e.find(a=>a.type==="block_certification"&&a.id===t.operationId);if(i)return i}const n=Vr(t.activePath),r=(o=t.sourceFingerprint)==null?void 0:o.trim();return e.filter(i=>i.type==="block_certification").filter(i=>{const a=wC(i),c=[Vr(i.scope.startsWith("block:")?i.scope.slice(6):void 0),Vr(a==null?void 0:a.oldPath),Vr(a==null?void 0:a.draftPath),Vr(a==null?void 0:a.newPath)].filter(h=>!!h),l=!!(n&&c.includes(n)),u=!!(r&&i.resourceRevision&&(i.resourceRevision===r||i.resourceRevision.startsWith(`${r}:`)));return l||u}).sort((i,a)=>a.updatedAt.localeCompare(i.updatedAt)||a.createdAt.localeCompare(i.createdAt))[0]}function wC(e){return e.result&&typeof e.result=="object"&&!Array.isArray(e.result)?e.result:void 0}function Vr(e){if(!(typeof e!="string"||!e.trim()))return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"")}function kC(e,t=50){let n=0;return[...e].sort((r,o)=>o.updatedAt.localeCompare(r.updatedAt)||o.createdAt.localeCompare(r.createdAt)||o.id.localeCompare(r.id)).filter(r=>Ir(r)?(n+=1,n<=t):!0)}const ir=["local-operations"],pf=p.createContext(null);function CC({children:e}){const t=Yi(),n=p.useRef(new Set),r=p.useRef(new Set),o=Ge(l=>l.dispatch),i=Ri({queryKey:ir,queryFn:async()=>{const l=(await B.listOperations(50)).operations,u=t.getQueryData(ir)??[];return yC(u,l)},staleTime:15e3,refetchOnWindowFocus:!1,refetchInterval:1500}),a=i.data??[];p.useEffect(()=>{let l=!0,u,h;const d=()=>{h=new AbortController,Ep("/api/operations/events",f=>{if(f.event==="operation")try{const m=JSON.parse(f.data);t.setQueryData(ir,(S=[])=>eo(S,m))}catch{}},h.signal).catch(()=>{!l||h!=null&&h.signal.aborted||(u=setTimeout(d,5e3))})};return d(),()=>{l=!1,u&&clearTimeout(u),h==null||h.abort()}},[t]),p.useEffect(()=>{xC(r.current,a)},[a]),p.useEffect(()=>{let l=!0,u=!1;const h=async()=>{if(!(u||r.current.size===0)){u=!0;try{await vC(r.current,f=>B.getOperation(f),f=>{if(!l)return!1;t.setQueryData(ir,(m=[])=>eo(m,f))})}finally{u=!1}}};h();const d=window.setInterval(()=>void h(),1e3);return()=>{l=!1,window.clearInterval(d)}},[t]),p.useEffect(()=>{for(const l of SC(a,n.current)){const u=l.result;n.current.add(l.id),o({type:"RECONCILE_BLOCK_CERTIFICATION",outcome:u.outcome,oldPath:u.oldPath,draftPath:u.draftPath,newPath:u.newPath,payload:u.block}),window.dispatchEvent(new CustomEvent("dql:block-library-invalidated",{detail:{operationId:l.id,outcome:u.outcome}}))}},[o,a]);const c=p.useMemo(()=>({operations:a,activeCount:a.filter(l=>l.status==="queued"||l.status==="running").length,loading:i.isLoading,cancel:async l=>{const u=await B.cancelOperation(l);r.current.delete(l),t.setQueryData(ir,(h=[])=>eo(h,u))},track:l=>{Ir(l)?r.current.delete(l.id):r.current.add(l.id),t.setQueryData(ir,(u=[])=>eo(u,l))}}),[a,i.isLoading,t]);return s.jsx(pf.Provider,{value:c,children:e})}function jC(){const e=p.useContext(pf);if(!e)throw new Error("useOperations must be used inside OperationsProvider.");return e}const EC=new Set(["succeeded","failed","cancelled","interrupted"]);function TC(e,t=8){const n=AC(e).filter(o=>!EC.has(o.status)||o.type!=="project_refresh"),r=n.map(ff);return{operations:n.slice(0,t),activeCount:r.filter(o=>o.active).length,attentionCount:r.filter(o=>o.tone==="attention").length}}function AC(e){const t=e.filter(l=>l.type==="block_certification"),n=t.map((l,u)=>u),r=new Map,o=l=>{let u=l;for(;n[u]!==u;)n[u]=n[n[u]],u=n[u];return u},i=(l,u)=>{const h=o(l),d=o(u);h!==d&&(n[d]=h)};t.forEach((l,u)=>{for(const h of RC(l)){const d=r.get(h);d===void 0?r.set(h,u):i(u,d)}});const a=new Map;t.forEach((l,u)=>{const h=o(u),d=a.get(h);(!d||OC(l,d)<0)&&a.set(h,l)});const c=new Set([...a.values()].map(l=>l.id));return e.filter(l=>l.type!=="block_certification"||c.has(l.id))}function ff(e){var n,r,o,i,a,c;if(e.status==="queued"||e.status==="running")return{active:!0,tone:"active",statusLabel:e.status,message:e.message,guidance:e.type==="block_certification"?"You can change pages while certification continues.":void 0};if(e.type==="block_certification"&&e.status==="succeeded"){const l=e.result;if((l==null?void 0:l.outcome)==="draft_saved_with_blockers"){const u=((r=(n=l.checklist)==null?void 0:n.issues)==null?void 0:r.length)??((o=l.blockers)==null?void 0:o.length)??((i=l.checklist)==null?void 0:i.blockers.length)??0;return{active:!1,tone:"attention",statusLabel:"needs attention",message:u>0?`Draft saved with ${u} certification blocker${u===1?"":"s"}.`:"Draft saved, but certification requirements are not ready.",guidance:"Open Block Studio to review the exact fixes and retry."}}if((l==null?void 0:l.outcome)==="certified")return{active:!1,tone:"success",statusLabel:"certified",message:"The block passed its required gates and was certified."}}return e.status==="failed"||e.status==="interrupted"?{active:!1,tone:"failure",statusLabel:e.status,message:((a=e.error)==null?void 0:a.message)??e.message,guidance:e.type==="block_certification"?"The saved draft is preserved for review or retry.":void 0}:e.status==="cancelled"?{active:!1,tone:"neutral",statusLabel:"cancelled",message:e.message}:{active:!1,tone:e.status==="succeeded"?"success":"neutral",statusLabel:e.status,message:((c=e.error)==null?void 0:c.message)??e.message}}function RC(e){const t=hi(e.result),n=hi(t==null?void 0:t.block),r=hi(n==null?void 0:n.metadata),o=e.scope.startsWith("block:")?e.scope.slice(6):void 0;return Array.from(new Set([ar(n==null?void 0:n.path),ar(r==null?void 0:r.path),ar(t==null?void 0:t.oldPath),ar(t==null?void 0:t.draftPath),ar(t==null?void 0:t.newPath),ar(o)].filter(i=>!!i)))}function hi(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function ar(e){if(!(typeof e!="string"||!e.trim()))return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"")}function OC(e,t){return t.createdAt.localeCompare(e.createdAt)||t.updatedAt.localeCompare(e.updatedAt)||t.id.localeCompare(e.id)}function _C(){const e=Ge(d=>d.themeMode),t=Qe[e],{operations:n,loading:r,cancel:o}=jC(),[i,a]=p.useState(!1),c=p.useRef(null),{operations:l,activeCount:u,attentionCount:h}=TC(n);return p.useEffect(()=>{if(!i)return;const d=m=>{c.current&&!c.current.contains(m.target)&&a(!1)},f=m=>{m.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",d),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f)}},[i]),!r&&l.length===0?null:s.jsxs("div",{ref:c,style:{position:"relative"},children:[s.jsxs("button",{type:"button","aria-label":"Background tasks","aria-expanded":i,onClick:()=>a(d=>!d),style:{height:28,padding:"0 9px",borderRadius:6,border:`1px solid ${u>0?t.accent:h>0?t.warning:t.btnBorder}`,background:i?t.btnHover:t.btnBg,color:t.textSecondary,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6,fontFamily:t.font,fontSize:11,fontWeight:600},children:[s.jsx("span",{"aria-hidden":"true",style:{width:7,height:7,borderRadius:999,background:u>0?t.accent:h>0?t.warning:t.success,boxShadow:u>0?`0 0 0 3px ${t.accent}20`:"none"}}),u>0?`${u} running`:h>0?`${h} needs attention`:"Tasks"]}),i&&s.jsxs("div",{role:"dialog","aria-label":"Background tasks",style:{position:"absolute",top:34,right:0,zIndex:1200,width:340,maxHeight:420,overflowY:"auto",background:t.modalBg,border:`1px solid ${t.cellBorder}`,borderRadius:9,boxShadow:"0 14px 36px rgba(0,0,0,0.28)",padding:8},children:[s.jsx("div",{style:{padding:"4px 6px 8px",color:t.textPrimary,fontSize:12,fontWeight:700},children:"Background tasks"}),l.map(d=>{const f=ff(d),m=f.active,S=f.tone==="failure"?t.error:f.tone==="attention"?t.warning:f.tone==="success"?t.success:t.textMuted;return s.jsxs("div",{style:{padding:"9px 8px",borderTop:`1px solid ${t.headerBorder}`,display:"flex",flexDirection:"column",gap:6},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[s.jsx("span",{style:{flex:1,color:t.textPrimary,fontSize:11.5,fontWeight:650},children:PC(d.type)}),s.jsx("span",{style:{color:S,fontSize:10},children:f.statusLabel})]}),s.jsx("div",{style:{color:f.tone==="failure"?t.error:f.tone==="attention"?t.warning:t.textSecondary,fontSize:10.5,lineHeight:1.4},children:f.message}),m&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[s.jsx("div",{style:{flex:1,height:3,borderRadius:99,overflow:"hidden",background:t.headerBorder},children:s.jsx("div",{style:{width:`${Math.max(3,d.progress)}%`,height:"100%",background:t.accent,transition:"width 180ms ease"}})}),d.cancellable&&s.jsx("button",{type:"button",onClick:()=>void o(d.id),style:{border:0,background:"transparent",color:t.textMuted,cursor:"pointer",fontSize:10,padding:0},children:"Cancel"})]}),d.type==="block_certification"&&s.jsx("div",{style:{color:t.textMuted,fontSize:9.5},children:f.guidance??(f.tone==="success"?"Certification is complete.":"The saved draft is preserved for review or retry.")}),(d.type==="agent_run"||d.type==="app_ai_build")&&s.jsx("div",{style:{color:t.textMuted,fontSize:9.5},children:m?"This continues while you work on another page.":d.status==="succeeded"?"Completed in the background.":"Open the original surface to review or retry."})]},d.id)})]})]})}function PC(e){return e==="block_certification"?"Block certification":e==="project_refresh"?"Project metadata refresh":e==="agent_run"?"AI request":e==="app_ai_build"?"App proposal":e.replace(/_/g," ")}const rs=new Map;function IC(e,t){let n=rs.get(e);n||(n={running:!1},rs.set(e,n));const r=n,o=new Promise((i,a)=>{r.pending?(r.pending.content=t,r.pending.waiters.push({resolve:i,reject:a})):r.pending={content:t,waiters:[{resolve:i,reject:a}]}});return r.running||(r.running=!0,(async()=>{for(;r.pending;){const i=r.pending;r.pending=void 0;try{await B.saveNotebook(e,i.content);for(const a of i.waiters)a.resolve()}catch(a){for(const c of i.waiters)c.reject(a)}}})().finally(()=>{r.running=!1,r.pending||rs.delete(e)})),o}function DC(e){const t=rs.get(e);return!!(t!=null&&t.running||t!=null&&t.pending)}function $C({t:e}){return s.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"linear-gradient(135deg, #5b8cff 0%, #7c5cff 100%)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:s.jsx("span",{style:{color:"#ffffff",fontSize:10,fontWeight:700,fontFamily:e.fontMono,letterSpacing:"-0.5px"},children:"DQL"})})}function MC(){var te;const e=Ge(Lr(F=>({activeBlockPath:F.activeBlockPath,activeFile:F.activeFile,appMode:F.appMode,autoSave:F.autoSave,blockStudioDirty:F.blockStudioDirty,blockStudioDraft:F.blockStudioDraft,blockStudioMetadata:F.blockStudioMetadata,cells:F.cells,files:F.files,mainView:F.mainView,notebookDirty:F.notebookDirty,notebookMetadata:F.notebookMetadata,notebookTitle:F.notebookTitle,savingFile:F.savingFile,themeMode:F.themeMode}))),t=jn(),n=Qe[e.themeMode],{executeAll:r}=uf(),[o,i]=p.useState(!1),[a,c]=p.useState(""),[l,u]=p.useState(!1),[h,d]=p.useState(!1),[f,m]=p.useState(!1),[S,v]=p.useState(!1),[b,w]=p.useState(!1),j=p.useRef(null),[C,x]=p.useState(!1),[E,P]=p.useState(!1),A=p.useRef(null),g=p.useRef(null),I=e.mainView==="block_studio"?e.blockStudioDirty:e.notebookDirty,T=e.mainView==="notebook",O=e.mainView==="notebook"||e.mainView==="block_studio",_=O&&!!e.activeFile,M={home:"Home",business_artifact:((te=e.activeFile)==null?void 0:te.name.replace(/\.(dqlnb|dql)$/i,""))??"Business Definition",lineage:"Lineage",lineage_detail:"Lineage",connection:"Settings",apps:"Apps",git:"Source control",settings:"Settings",imports:"Import SQL",domains:"Modeling",modeling:"Modeling"},q=O?e.activeFile?e.notebookTitle||"Untitled":e.mainView==="block_studio"?"Blocks":"Notebooks":M[e.mainView]??"DQL Workbench";p.useEffect(()=>{o&&g.current&&(g.current.focus(),g.current.select())},[o]),p.useEffect(()=>{if(!E)return;function F(K){A.current&&!A.current.contains(K.target)&&P(!1)}return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[E]);const G=()=>{c(e.notebookTitle),i(!0)},J=()=>{i(!1),a.trim()&&a!==e.notebookTitle&&(e.mainView==="block_studio"&&e.blockStudioMetadata?(t({type:"SET_BLOCK_STUDIO_METADATA",metadata:{...e.blockStudioMetadata,name:a.trim()}}),t({type:"SET_BLOCK_STUDIO_DRAFT",draft:J1(e.blockStudioDraft,a.trim())})):t({type:"SET_NOTEBOOK_DIRTY",dirty:!0}))},H=p.useCallback(async()=>{var K,oe,ee;const F=In.getState();if(F.activeFile){t({type:"SET_SAVING",saving:!0});try{if(F.mainView==="block_studio"){if(!F.blockStudioMetadata)return;const ce=await B.saveBlockStudio({path:F.activeBlockPath,source:F.blockStudioDraft,metadata:{name:F.blockStudioMetadata.name,domain:F.blockStudioMetadata.domain,folderPath:F.blockStudioMetadata.folderPath,description:F.blockStudioMetadata.description,owner:F.blockStudioMetadata.owner,tags:F.blockStudioMetadata.tags}});t({type:"OPEN_BLOCK_STUDIO",file:{name:`${ce.metadata.name}.dql`,path:ce.path,type:"block",folder:"blocks"},payload:ce}),F.files.some(ke=>ke.path===ce.path)||t({type:"FILE_ADDED",file:{name:`${ce.metadata.name}.dql`,path:ce.path,type:"block",folder:"blocks"}})}else{const ce=F.activeFile,ke=F.cells,xe=F.notebookTitle,De=F.notebookMetadata,We=ce.type==="block"?((K=ke[0])==null?void 0:K.content)??"":L1(xe,ke,De);await IC(ce.path,We);const Be=In.getState();((oe=Be.activeFile)==null?void 0:oe.path)===ce.path&&Be.cells===ke&&Be.notebookTitle===xe&&Be.notebookMetadata===De&&t({type:"SET_NOTEBOOK_DIRTY",dirty:!1})}u(!0),setTimeout(()=>u(!1),2e3)}catch(ce){console.error("Save failed:",ce)}finally{const ce=(ee=In.getState().activeFile)==null?void 0:ee.path;(!ce||!DC(ce))&&t({type:"SET_SAVING",saving:!1})}}},[t]);p.useEffect(()=>{const F=K=>{(K.metaKey||K.ctrlKey)&&K.key==="s"&&(K.preventDefault(),H())};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[H]),p.useEffect(()=>{if(!e.autoSave||!I||!e.activeFile||e.mainView==="block_studio")return;const F=setTimeout(()=>{H()},750);return()=>clearTimeout(F)},[e.autoSave,I,e.activeFile,e.cells,e.blockStudioDraft,H]);const L=[{mode:"obsidian",label:"Obsidian",glyph:"●",swatch:"#0d0e11"},{mode:"paper",label:"Paper",glyph:"☼",swatch:"#f7f4ed"},{mode:"white",label:"White",glyph:"○",swatch:"#ffffff"}],$=e.themeMode==="dark"||e.themeMode==="midnight"?"obsidian":e.themeMode==="light"?"paper":e.themeMode==="arctic"?"white":e.themeMode,X=L.find(F=>F.mode===$)??L[0];p.useEffect(()=>{if(!b)return;const F=oe=>{j.current&&!j.current.contains(oe.target)&&w(!1)},K=oe=>{oe.key==="Escape"&&w(!1)};return document.addEventListener("mousedown",F),document.addEventListener("keydown",K),()=>{document.removeEventListener("mousedown",F),document.removeEventListener("keydown",K)}},[b]);const W={height:28,padding:"0 10px",borderRadius:6,border:`1px solid ${n.btnBorder}`,cursor:"pointer",fontSize:12,fontWeight:500,fontFamily:n.font,display:"flex",alignItems:"center",gap:4,transition:"background 0.15s, color 0.15s",whiteSpace:"nowrap"};return s.jsxs("div",{style:{height:48,flexShrink:0,background:n.headerBg,borderBottom:`1px solid ${n.headerBorder}`,display:"flex",alignItems:"center",padding:"0 12px",gap:8,userSelect:"none"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[s.jsx($C,{t:n}),s.jsx("div",{style:{width:1,height:20,background:n.headerBorder,flexShrink:0}}),e.activeFile&&O&&s.jsx("span",{style:{fontSize:10,fontWeight:600,color:e.activeFile.type==="block"?"#e3b341":n.accent,background:`${e.activeFile.type==="block"?"#e3b341":n.accent}18`,borderRadius:4,padding:"2px 6px",fontFamily:n.font,textTransform:"uppercase",letterSpacing:"0.05em",flexShrink:0},children:e.activeFile.type}),e.activeFile&&O?o?s.jsx("input",{ref:g,value:a,onChange:F=>c(F.target.value),onBlur:J,onKeyDown:F=>{F.key==="Enter"&&J(),F.key==="Escape"&&i(!1)},style:{background:"transparent",border:`1px solid ${n.cellBorderActive}`,borderRadius:4,color:n.textPrimary,fontSize:13,fontWeight:500,fontFamily:n.font,padding:"2px 6px",outline:"none",minWidth:120,maxWidth:320}}):s.jsxs("span",{onClick:G,title:"Click to rename",style:{color:n.textPrimary,fontSize:13,fontWeight:500,fontFamily:n.font,cursor:"text",maxWidth:320,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:"2px 4px",borderRadius:4,border:"1px solid transparent"},children:[q,I&&s.jsx("span",{style:{color:n.textMuted,marginLeft:4},children:"●"})]}):s.jsx("span",{style:{color:n.textSecondary,fontSize:13,fontFamily:n.font,padding:"2px 4px"},children:q||"DQL Workbench"})]}),s.jsx("div",{style:{flex:1}}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsx(_C,{}),e.appMode==="studio"&&_&&e.mainView!=="block_studio"&&s.jsx(s.Fragment,{children:s.jsxs("button",{onClick:T?r:void 0,disabled:!e.activeFile||!T,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{...W,height:30,padding:"0 14px",borderRadius:999,background:n.accent,color:"#ffffff",border:`1px solid ${n.accent}`,opacity:!e.activeFile||!T?.4:h?.9:1,boxShadow:"0 1px 2px rgba(107,93,211,0.25)",gap:6},children:[s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",children:s.jsx("path",{d:"M1.5 1.5l7 3.5-7 3.5V1.5Z"})}),"Run all"]})}),s.jsxs("div",{ref:j,style:{position:"relative"},children:[s.jsxs("button",{onClick:()=>w(F=>!F),onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),title:`Theme: ${X.label}`,"aria-haspopup":"true","aria-expanded":b,style:{...W,background:S||b?n.btnHover:n.btnBg,color:n.textSecondary,padding:"0 10px",fontSize:12,display:"flex",alignItems:"center",gap:6},children:[s.jsx("span",{style:{width:12,height:12,borderRadius:3,background:X.swatch,border:`1px solid ${n.headerBorder}`,flexShrink:0}}),s.jsx("span",{style:{fontFamily:n.fontMono,fontSize:10,letterSpacing:"0.04em"},children:X.label}),s.jsx("span",{style:{fontSize:8,color:n.textMuted},children:"▾"})]}),b&&s.jsx("div",{role:"menu",style:{position:"absolute",top:"100%",right:0,marginTop:4,minWidth:160,background:n.headerBg,border:`1px solid ${n.headerBorder}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.32)",padding:4,zIndex:1e3,display:"flex",flexDirection:"column",gap:1},children:L.map(F=>{const K=F.mode===$;return s.jsxs("button",{role:"menuitemradio","aria-checked":K,onClick:()=>{t({type:"SET_THEME",mode:F.mode}),w(!1)},style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",border:"none",background:K?n.btnHover:"transparent",color:n.textPrimary,cursor:"pointer",borderRadius:4,fontSize:12,fontFamily:n.font,textAlign:"left"},onMouseEnter:oe=>{K||(oe.currentTarget.style.background=n.btnHover)},onMouseLeave:oe=>{K||(oe.currentTarget.style.background="transparent")},children:[s.jsx("span",{style:{width:14,height:14,borderRadius:3,background:F.swatch,border:`1px solid ${n.headerBorder}`,flexShrink:0}}),s.jsx("span",{style:{flex:1},children:F.label}),K&&s.jsx("span",{style:{color:n.accent,fontSize:11},children:"✓"})]},F.mode)})})]}),e.appMode==="studio"&&_&&e.mainView!=="block_studio"&&s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:H,disabled:!e.activeFile||e.savingFile,onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),title:"Save (Cmd+S)",style:{...W,background:f&&e.activeFile?n.btnHover:n.btnBg,color:l?n.success:n.textSecondary,opacity:e.activeFile?1:.4},children:e.savingFile?s.jsxs(s.Fragment,{children:[s.jsx(NC,{}),"Saving…"]}):l?s.jsx(s.Fragment,{children:"✓ Saved"}):s.jsx(s.Fragment,{children:"Save"})}),s.jsx("div",{style:{width:1,height:20,background:n.headerBorder}})]}),_&&e.mainView!=="block_studio"&&s.jsxs("div",{ref:A,style:{position:"relative"},children:[s.jsxs("button",{onClick:()=>{e.activeFile&&P(F=>!F)},disabled:!e.activeFile,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),title:"Share / export",style:{...W,height:30,padding:"0 14px",borderRadius:999,background:(C||E)&&e.activeFile?"#2a2a30":"#1a1a1a",color:"#ffffff",border:"1px solid #1a1a1a",opacity:e.activeFile?1:.4,gap:6},children:[s.jsx("svg",{width:"11",height:"11",viewBox:"0 0 16 16",fill:"currentColor",children:s.jsx("path",{d:"M5.5 10.75a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75Zm0-3a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75ZM3 3.75A1.75 1.75 0 0 1 4.75 2h6.586c.464 0 .909.184 1.237.513l1.914 1.914c.329.328.513.773.513 1.237v6.586A1.75 1.75 0 0 1 13.25 14h-8.5A1.75 1.75 0 0 1 3 12.25Z"})}),"Share",s.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"currentColor",style:{marginLeft:1,opacity:.7},children:s.jsx("path",{d:"M1 2.5l3 3 3-3",stroke:"currentColor",fill:"none",strokeWidth:"1.2",strokeLinecap:"round"})})]}),E&&s.jsx("div",{style:{position:"absolute",top:32,right:0,zIndex:200,background:n.modalBg,border:`1px solid ${n.cellBorder}`,borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.3)",padding:4,minWidth:160,display:"flex",flexDirection:"column",gap:2},children:s.jsx(LC,{label:"Export HTML",description:"Standalone dashboard",t:n,onClick:()=>{hC(e.notebookTitle||"dashboard",e.cells),P(!1)}})})]})]})]})}function LC({label:e,description:t,t:n,onClick:r}){const[o,i]=p.useState(!1);return s.jsxs("button",{onClick:r,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{background:o?n.btnHover:"transparent",border:"none",borderRadius:5,cursor:"pointer",padding:"6px 10px",textAlign:"left",display:"flex",flexDirection:"column",gap:1,transition:"background 0.12s"},children:[s.jsx("span",{style:{fontSize:12,fontWeight:500,color:n.textPrimary,fontFamily:n.font},children:e}),s.jsx("span",{style:{fontSize:10,color:n.textMuted,fontFamily:n.font},children:t})]})}function NC(){return s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{animation:"spin 0.8s linear infinite"},children:[s.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"}),s.jsx("circle",{cx:"6",cy:"6",r:"4.5",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"14 7"})]})}function BC(e){return e.toTimeString().slice(0,8)}function FC(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}function zC(){const{state:e,dispatch:t}=et(),n=Qe[e.themeMode],[r,o]=p.useState(!1),i=e.queryLog.filter(c=>c.error),a=c=>t({type:"SET_DEV_PANEL_TAB",tab:c});return s.jsxs("div",{style:{height:e.devPanelOpen?180:0,flexShrink:0,background:n.sidebarBg,borderTop:`1px solid ${n.headerBorder}`,display:"flex",flexDirection:"column",overflow:"hidden",transition:"height 0.2s ease",position:"relative"},children:[e.devPanelOpen&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{height:32,flexShrink:0,display:"flex",alignItems:"center",borderBottom:`1px solid ${n.headerBorder}`,padding:"0 8px",gap:2},children:[["logs","errors"].map(c=>s.jsx(qC,{label:c==="errors"?`Errors${i.length>0?` (${i.length})`:""}`:`Logs (${e.queryLog.length})`,active:e.devPanelTab===c,onClick:()=>a(c),t:n},c)),s.jsx("div",{style:{flex:1}}),s.jsx("button",{onClick:()=>t({type:"SET_CELLS",cells:e.cells}),title:"Clear logs",style:{background:"transparent",borderTop:"none",borderLeft:"none",borderRight:"none",borderBottom:"none",cursor:"pointer",color:n.textMuted,fontSize:11,fontFamily:n.font,padding:"2px 6px",borderRadius:4},children:"Clear"})]}),s.jsxs("div",{style:{flex:1,overflow:"auto",padding:"4px 0"},children:[e.devPanelTab==="logs"&&(e.queryLog.length===0?s.jsx(Bl,{t:n,message:"No queries executed yet."}):[...e.queryLog].reverse().map(c=>s.jsx(Fl,{entry:c,t:n},c.id))),e.devPanelTab==="errors"&&(i.length===0?s.jsx(Bl,{t:n,message:"No errors."}):[...i].reverse().map(c=>s.jsx(Fl,{entry:c,t:n},c.id)))]})]}),s.jsxs("button",{onClick:()=>t({type:"TOGGLE_DEV_PANEL"}),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),title:e.devPanelOpen?"Close panel":"Open dev panel",style:{position:"absolute",bottom:e.devPanelOpen?4:-28,right:8,height:22,padding:"0 8px",borderRadius:"4px 4px 0 0",borderTop:`1px solid ${n.headerBorder}`,borderLeft:`1px solid ${n.headerBorder}`,borderRight:`1px solid ${n.headerBorder}`,borderBottom:e.devPanelOpen?`1px solid ${n.sidebarBg}`:`1px solid ${n.headerBorder}`,background:r?n.btnHover:n.sidebarBg,color:n.textMuted,cursor:"pointer",fontSize:11,fontFamily:n.font,display:"flex",alignItems:"center",gap:4,transition:"background 0.15s, bottom 0.2s ease",zIndex:10},children:[s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",children:s.jsx("path",{d:e.devPanelOpen?"M1 7l4-4 4 4":"M1 3l4 4 4-4",strokeWidth:"1.5",stroke:"currentColor",fill:"none"})}),"Dev"]})]})}function qC({label:e,active:t,onClick:n,t:r}){const[o,i]=p.useState(!1);return s.jsx("button",{onClick:n,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{background:"transparent",borderTop:"none",borderLeft:"none",borderRight:"none",borderBottom:t?`2px solid ${r.accent}`:"2px solid transparent",cursor:"pointer",color:t?r.textPrimary:o?r.textSecondary:r.textMuted,fontSize:12,fontFamily:r.font,fontWeight:t?500:400,padding:"4px 8px",height:32,transition:"color 0.15s"},children:e})}function Bl({t:e,message:t}){return s.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:e.textMuted,fontSize:12,fontFamily:e.font,fontStyle:"italic"},children:t})}function Fl({entry:e,t}){return s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"3px 12px",fontSize:11,fontFamily:t.fontMono,color:e.error?t.error:t.textSecondary,borderLeft:e.error?`2px solid ${t.error}`:"2px solid transparent"},children:[s.jsx("span",{style:{color:t.textMuted,flexShrink:0},children:BC(e.ts)}),s.jsx("span",{style:{flexShrink:0,color:t.textPrimary,maxWidth:160,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.cellName}),e.error?s.jsx("span",{style:{color:t.error,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.error}):s.jsxs(s.Fragment,{children:[s.jsxs("span",{style:{color:t.textMuted},children:[e.rows.toLocaleString()," rows"]}),s.jsx("span",{style:{color:t.textMuted},children:FC(e.time)})]})]})}function UC(){const{state:e,dispatch:t}=et(),{executeAll:n}=uf();p.useEffect(()=>{const r=o=>{const i=o.metaKey||o.ctrlKey;if(i&&o.key==="b"&&!o.shiftKey){o.preventDefault(),t({type:"TOGGLE_SIDEBAR"});return}if(i&&o.shiftKey&&o.key==="Enter"){o.preventDefault(),e.activeFile&&n();return}if(i&&o.key==="j"&&!o.shiftKey){o.preventDefault(),t({type:"TOGGLE_DEV_PANEL"});return}if(i&&o.key==="d"&&!o.shiftKey){o.preventDefault(),e.activeFile&&t({type:"TOGGLE_DASHBOARD_MODE"});return}if(o.key==="Escape"){if(e.dashboardMode){t({type:"TOGGLE_DASHBOARD_MODE"});return}if(e.newNotebookModalOpen){t({type:"CLOSE_NEW_NOTEBOOK_MODAL"});return}if(e.newBlockModalOpen){t({type:"CLOSE_NEW_BLOCK_MODAL"});return}}};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,n,e.activeFile,e.newNotebookModalOpen,e.newBlockModalOpen,e.dashboardMode])}const WC=600;function KC(e,t){const n=t.filter(r=>r.result||r.error||(r.executionCount??0)>0).map(r=>{var o;return{cellId:r.id,status:r.status,result:r.result,error:r.error,executionCount:r.executionCount,executedAt:((o=r.execution)==null?void 0:o.completedAt)??new Date().toISOString(),execution:r.execution}});return{version:1,notebookPath:e,capturedAt:new Date().toISOString(),cells:n}}function zl(e){return e.map(t=>{var n,r;return`${t.id}:${((n=t.execution)==null?void 0:n.runId)??""}:${t.executionCount??0}:${((r=t.result)==null?void 0:r.rowCount)??-1}:${t.error??""}`}).join("|")}function VC(){var o;const{state:e}=et(),t=p.useRef(null),n=p.useRef(""),r=p.useRef(null);p.useEffect(()=>{var c;const i=((c=e.activeFile)==null?void 0:c.path)??null;if(!i)return;if(i!==r.current){r.current=i,n.current=zl(e.cells);return}const a=zl(e.cells);return a!==n.current&&(n.current=a,t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{const l=KC(i,e.cells);B.saveRunSnapshot(i,l).catch(()=>{})},WC)),()=>{t.current&&(clearTimeout(t.current),t.current=null)}},[e.cells,(o=e.activeFile)==null?void 0:o.path])}const hE="core";function HC(e){var n;const t=e==null?void 0:e.trim();if(t)return((n=t.split("::").at(-1))==null?void 0:n.trim())||void 0}const GC=[{items:[{id:"diagram",label:"Modeling"},{id:"skills",label:"Skills"},{id:"blocks",label:"Blocks"},{id:"notebooks",label:"Notebooks"},{id:"apps",label:"Apps"}]}],QC=new Set(GC.flatMap(e=>e.items.map(t=>t.id)));function hf(e){return e!==null&&QC.has(e)}function mE(e,t){const n=new URL(e);return t.domain?n.searchParams.set("domain",t.domain):n.searchParams.delete("domain"),n.searchParams.set("domainSection",t.section),t.modelAreaId?n.searchParams.set("modelArea",t.modelAreaId):n.searchParams.delete("modelArea"),t.selectedId?n.searchParams.set("domainObject",t.selectedId):n.searchParams.delete("domainObject"),`${n.pathname}${n.search}${n.hash}`}function JC(e){const t=new URL(e);for(const n of mf)t.searchParams.delete(n);return`${t.pathname}${t.search}${t.hash}`}const mf=["domain","domainSection","modelArea","domainObject"],gE="dql.domain-studio.location";function yE(e,t){const n=new URL(e).searchParams;if(mf.some(r=>n.has(r))){const r=n.get("domainSection"),o=hf(r)?r:"diagram";return{domain:n.get("domain"),section:o,modelAreaId:n.get("modelArea"),selectedId:r==="diagram"?n.get("domainObject"):null}}return YC(t)}function YC(e){const t={domain:null,section:"diagram",modelAreaId:null,selectedId:null};if(!e)return t;try{const n=JSON.parse(e),r=typeof n.section=="string"&&hf(n.section)?n.section:"diagram",o=i=>typeof i=="string"&&i.trim()?i:null;return{domain:o(n.domain),section:r,modelAreaId:o(n.modelAreaId),selectedId:o(n.selectedId)}}catch{return t}}function bE(e){return`modeling:${e??"all"}`}function xE(e){const t=Object.values(e),n=new Map;for(const a of t){const c=a.parent&&e[a.parent]?a.parent:void 0;n.set(c,[...n.get(c)??[],a])}for(const a of n.values())a.sort((c,l)=>c.id.localeCompare(l.id));const r=[],o=new Set,i=(a,c)=>{for(const l of n.get(a)??[])o.has(l.id)||(o.add(l.id),r.push({id:l.id,parent:l.parent,depth:c,label:c===0?l.id:`${"— ".repeat(c)}${l.id.split(".").at(-1)??l.id}`}),i(l.id,c+1))};i(void 0,0);for(const a of t.sort((c,l)=>c.id.localeCompare(l.id)))o.has(a.id)||r.push({id:a.id,parent:a.parent,depth:0,label:a.id});return r}function vE(e){const t=(e??"").toLowerCase();return t==="dimension"?"var(--status-success)":t==="bridge"?"var(--status-warning)":t==="event"||t==="snapshot"?"var(--accent)":"var(--text-tertiary)"}function gf(e){return Object.entries(e.entities).map(([t,n])=>({recordKey:t,entity:n}))}function SE(e,t){if(e.entities[t])return t;const n=gf(e).filter(({entity:r})=>r.id===t||r.qualifiedId===t);return n.length===1?n[0].recordKey:void 0}function wE(e,t){return gf(e).filter(({entity:n})=>!t||n.domain===t)}function kE(e,t,n){if(e.operation==="upsert_entity"){if(!t)return!1;const r=e.value;return r.dbtModel===t.dbtUniqueId&&(r.grain??void 0)===(t.grain??void 0)&&JSON.stringify(r.keys??[])===JSON.stringify(t.keys??[])&&(r.status??t.status)===t.status&&(r.areaId??void 0)===HC(t.areaId)&&r.domain===t.domain}return e.operation==="upsert_area"?!!n&&e.value.domain===n.domain&&e.value.id===n.localId:!1}const XC=p.lazy(()=>_e(()=>import("./HomePage-nGaNcwdw.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.HomePage}))),ZC=p.lazy(()=>_e(()=>import("./AnalyticsHome-C0DXbOwY.js"),__vite__mapDeps([7,8,9,10,1,11,12,3,13,14,15,16,17,2,18,6])).then(e=>({default:e.AnalyticsHome}))),ej=p.lazy(()=>_e(()=>import("./GlobalAiRail-DakE4NdR.js"),__vite__mapDeps([19,9,10,1,11,12,3,13,14,15,16,17,2,20,6])).then(e=>({default:e.GlobalAiRail}))),tj=p.lazy(()=>_e(()=>import("./NotebookEditor-CBLqY8cE.js"),__vite__mapDeps([21,4,2,5,22,23,24,10,1,11,12,3,13,14,9,15,16,17,8,25,26,6,27,28,20,29])).then(e=>({default:e.NotebookEditor}))),nj=p.lazy(()=>_e(()=>import("./NewNotebookModal-BaCHMYeB.js"),__vite__mapDeps([30,4,15,6])).then(e=>({default:e.NewNotebookModal}))),rj=p.lazy(()=>_e(()=>import("./NewBlockModal-BR2SnmPT.js"),__vite__mapDeps([31,6])).then(e=>({default:e.NewBlockModal}))),oj=p.lazy(()=>_e(()=>import("./SetupOnboarding-BhiCsYF-.js"),__vite__mapDeps([32,33,2,6])).then(e=>({default:e.SetupOnboarding}))),sj=p.lazy(()=>_e(()=>import("./BlockStudio-CFYxafw-.js"),__vite__mapDeps([34,22,23,10,1,11,12,3,13,14,25,26,6,27,9,15,16,17,2,20,35,36])).then(e=>({default:e.BlockStudio}))),ij=p.lazy(()=>_e(()=>import("./BusinessArtifactView-C0kLYg2p.js"),__vite__mapDeps([37,25,26,6,27])).then(e=>({default:e.BusinessArtifactView}))),aj=p.lazy(()=>_e(()=>import("./LineageDetailView-BnGb7OF7.js"),__vite__mapDeps([38,25,26,6,27,39,33,16])).then(e=>({default:e.LineageDetailView}))),cj=p.lazy(()=>_e(()=>import("./LineageDAG-CO6CFJRg.js"),__vite__mapDeps([39,26,6,27])).then(e=>({default:e.LineageDAG}))),lj=p.lazy(()=>_e(()=>import("./HelpDocsPage-CjOv6_gz.js"),__vite__mapDeps([40,6])).then(e=>({default:e.HelpDocsPage}))),dj=p.lazy(()=>_e(()=>Promise.resolve().then(()=>i1),void 0).then(e=>({default:e.ConnectionPanel}))),uj=p.lazy(()=>_e(()=>import("./GitPage-JjhRDeWY.js"),__vite__mapDeps([41,42,15,6])).then(e=>({default:e.GitPage}))),pj=p.lazy(()=>_e(()=>import("./ReadinessPage-CiN0IWSS.js"),__vite__mapDeps([43,1,44,45,12,3,2,6])).then(e=>({default:e.ReadinessPage}))),fj=p.lazy(()=>_e(()=>import("./AgentLogPage-Ch7VK20X.js"),__vite__mapDeps([46,33,14,47,6])).then(e=>({default:e.AgentLogPage}))),hj=p.lazy(()=>_e(()=>import("./GovernedContextPage-BokDqG6a.js"),__vite__mapDeps([48,3,12,9,10,1,11,13,14,15,16,17,2,49,6])).then(e=>({default:e.GovernedContextPage}))),mj=p.lazy(()=>_e(()=>import("./DbtFirstModelingPage-CMwElXD_.js"),__vite__mapDeps([50,49,9,10,1,11,12,3,13,14,15,16,17,2,26,6,27,28,29,36,51,47])).then(e=>({default:e.DbtFirstModelingPage}))),gj=p.lazy(()=>_e(()=>import("./AppsView-CcpwjApv.js"),__vite__mapDeps([52,20,17,10,1,11,12,3,13,14,15,33,35,29,4,5,24,8,45,53,51,2,18,6])).then(e=>({default:e.AppsView}))),yj=p.lazy(()=>_e(()=>import("./LineageDrawer-C5Y0Ht0b.js"),__vite__mapDeps([54,25,26,6,27,36,15,17,13,53,42])).then(e=>({default:e.LineageDrawer}))),bj=p.lazy(()=>_e(()=>import("./AiBuildDialog-DBr5TmyM.js"),__vite__mapDeps([55,44,11,12,3,13,15,6])).then(e=>({default:e.AiBuildDialog})));function xj(){const e=Ge(Lr(d=>({appMode:d.appMode,dashboardMode:d.dashboardMode,globalAi:d.globalAi,inspectorOpen:d.inspectorOpen,lineageDrawerOpen:d.lineageDrawerOpen,lineageFullscreen:d.lineageFullscreen,mainView:d.mainView,newBlockModalOpen:d.newBlockModalOpen,newNotebookModalOpen:d.newNotebookModalOpen,setupOpen:d.setupOpen,sidebarOpen:d.sidebarOpen,sidebarPanel:d.sidebarPanel,themeMode:d.themeMode}))),t=jn(),n=Qe[e.themeMode],r=p.useRef({}),o=e.mainView==="block_studio"||e.mainView==="imports",[i,a]=p.useState(!1),[c,l]=p.useState(null);p.useEffect(()=>{let d=!0;return B.getSetupLaunch().then(f=>{d&&(l(f),f.shouldOpen&&t({type:"OPEN_SETUP"}))}).catch(()=>{}),()=>{d=!1}},[t]),p.useEffect(()=>{const d=()=>t({type:"SET_MAIN_VIEW",view:"modeling"});return window.addEventListener("dql:open-context-proposal",d),()=>window.removeEventListener("dql:open-context-proposal",d)},[t]),p.useEffect(()=>{if(e.mainView==="domains"||e.mainView==="modeling"||e.mainView==="skills")return;const d=JC(window.location.href),f=`${window.location.pathname}${window.location.search}${window.location.hash}`;d!==f&&window.history.replaceState(window.history.state,"",d)},[e.mainView]),UC(),VC(),p.useEffect(()=>{const d=f=>{(f.metaKey||f.ctrlKey)&&f.key.toLowerCase()==="k"&&!f.shiftKey&&(f.preventDefault(),a(m=>!m)),(f.metaKey||f.ctrlKey)&&f.shiftKey&&f.key.toLowerCase()==="i"&&(f.preventDefault(),t({type:"TOGGLE_INSPECTOR"}))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t]);const u=p.useCallback(async d=>{try{if(d.type==="term"||d.type==="business_view"){e.sidebarPanel!=="files"&&t({type:"SET_SIDEBAR_PANEL",panel:"files"}),t({type:"OPEN_BUSINESS_ARTIFACT",file:d});return}if(d.type==="block"){const j=await B.openBlockStudio(d.path);t({type:"OPEN_BLOCK_STUDIO",file:d,payload:j});return}const{content:f}=await B.readNotebook(d.path),{title:m,cells:S,metadata:v}=N1(d.path,f),b=d.path.endsWith(".dqlnb")?await B.fetchRunSnapshot(d.path):null;let w=S;if(b!=null&&b.found&&b.snapshot){const j=new Map(b.snapshot.cells.map(C=>[C.cellId,C]));w=S.map(C=>{const x=j.get(C.id);return x?{...C,status:x.status??C.status,result:x.result??C.result,error:x.error??C.error,executionCount:x.executionCount??C.executionCount,execution:x.execution??C.execution,fromSnapshot:x.result!=null}:C})}t({type:"OPEN_FILE",file:d,cells:w,title:m,metadata:v}),e.sidebarPanel!=="files"&&t({type:"SET_SIDEBAR_PANEL",panel:"files"})}catch(f){if(console.error("Failed to open file:",f),d.type==="block")try{const{content:m}=await B.readNotebook(d.path);t({type:"OPEN_BLOCK_STUDIO",file:d,payload:{path:d.path,source:m,companionPath:null,metadata:{name:d.name.replace(/\.dql$/i,""),path:d.path,domain:d.path.split("/").slice(1,-1).join("/")||"uncategorized",description:"",owner:"",tags:[]},validation:{valid:!1,diagnostics:[{severity:"warning",message:"Opened block without studio metadata. Save once to normalize it."}],semanticRefs:{metrics:[],dimensions:[],segments:[]}}}});return}catch(m){console.error("Failed to open block fallback:",m)}else t({type:"OPEN_FILE",file:d,cells:[Ra("sql")],title:d.name})}},[t,e.sidebarPanel]);p.useCallback(d=>{const f=r.current[d];f&&f.scrollIntoView({behavior:"smooth",block:"start"})},[]);const h=p.useCallback((d,f)=>{f?r.current[d]=f:delete r.current[d]},[]);return s.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh",width:"100vw",background:n.appBg,fontFamily:n.font,color:n.textPrimary,overflow:"hidden"},children:[s.jsx(MC,{}),s.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[e.appMode==="studio"&&s.jsx(Ww,{}),e.appMode==="studio"&&e.sidebarOpen&&!o&&s.jsx(_1,{onOpenFile:u}),s.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minWidth:0},children:s.jsx(p.Suspense,{fallback:s.jsx(vj,{t:n}),children:e.mainView==="home"?s.jsx(XC,{}):e.mainView==="ask"?s.jsx(ZC,{}):e.mainView==="business_artifact"?s.jsx(ij,{}):e.mainView==="lineage"?s.jsx("div",{style:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:s.jsx(cj,{})}):e.mainView==="lineage_detail"?s.jsx(aj,{}):e.mainView==="help"?s.jsx(lj,{}):e.mainView==="connection"||e.mainView==="settings"?s.jsx(wj,{children:s.jsx(dj,{variant:"page"})}):e.mainView==="git"?s.jsx(uj,{}):e.mainView==="readiness"?s.jsx(pj,{}):e.mainView==="skills"?s.jsx(hj,{initialTab:"skills"}):e.mainView==="domains"||e.mainView==="modeling"?s.jsx(mj,{}):e.mainView==="apps"?s.jsx(gj,{}):e.mainView==="agent_log"?s.jsx(kj,{title:"Agent steps",description:"What the agent did to answer this question, and where the time went — route, tools, checks, and per-step timing.",children:s.jsx(fj,{})}):s.jsx(s.Fragment,{children:e.mainView==="imports"||e.mainView==="block_studio"?s.jsx(sj,{},"block-editor"):s.jsxs(s.Fragment,{children:[s.jsx(tj,{onOpenFile:u,registerCellRef:h}),e.appMode==="studio"&&s.jsx(zC,{})]})})})}),e.appMode==="studio"&&e.lineageDrawerOpen&&!e.lineageFullscreen&&!e.dashboardMode&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(yj,{})}),e.appMode==="studio"&&e.inspectorOpen&&!e.lineageFullscreen&&!e.lineageDrawerOpen&&!e.dashboardMode&&s.jsx(Pw,{}),e.globalAi.open&&e.mainView==="apps"&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(ej,{})})]}),e.newNotebookModalOpen&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(nj,{onFileOpened:u})}),e.newBlockModalOpen&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(rj,{onFileOpened:u})}),s.jsx(ZS,{open:i,onClose:()=>a(!1)}),s.jsx(p.Suspense,{fallback:null,children:s.jsx(bj,{})}),e.setupOpen&&s.jsx(p.Suspense,{fallback:s.jsx(Sj,{t:n}),children:s.jsx(oj,{launch:c!=null&&c.shouldOpen?c:void 0,onAcknowledged:()=>l(d=>d&&{...d,shouldOpen:!1,reason:null})})})]})}function vj({t:e}){return s.jsx("div",{role:"status","aria-live":"polite",style:{flex:1,minWidth:0,display:"grid",placeItems:"center",background:e.appBg,color:e.textSecondary,fontFamily:e.font},children:s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,fontSize:12.5},children:[s.jsx("span",{style:{width:8,height:8,borderRadius:999,background:e.accent}}),"Loading workspace…"]})})}function Sj({t:e}){return s.jsx("div",{role:"status","aria-live":"polite",style:{position:"fixed",inset:0,zIndex:1100,display:"grid",placeItems:"center",background:e.appBg,color:e.textSecondary,fontFamily:e.font},children:s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,fontSize:12.5},children:[s.jsx("span",{style:{width:8,height:8,borderRadius:999,background:e.accent}}),"Checking workspace setup…"]})})}function wj({children:e}){return s.jsx("div",{style:{flex:1,minWidth:0,overflow:"auto"},children:s.jsx("div",{style:{maxWidth:1120,margin:"0 auto",padding:"18px 28px 32px"},children:e})})}function kj({title:e,description:t,children:n}){return s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,overflow:"hidden"},children:[s.jsxs("div",{style:{padding:"18px 24px 12px",borderBottom:"1px solid rgba(127, 127, 127, 0.16)"},children:[s.jsx("div",{style:{fontSize:22,fontWeight:700},children:e}),s.jsx("div",{style:{fontSize:13,opacity:.72,marginTop:6,maxWidth:760,lineHeight:1.5},children:t})]}),s.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:n})]})}function Cj(){const e=jn(),t=Yi(),n=p.useRef(null);p.useEffect(()=>{let r=!0,o=null,i=null,a=null,c=null;const l=()=>{i&&clearTimeout(i),i=setTimeout(()=>{i=null,B.listNotebooks().then(f=>{r&&(t.setQueryData(["notebooks"],f),e({type:"SET_FILES",files:f}))}).catch(()=>{})},150)},u=()=>{a&&clearTimeout(a),a=setTimeout(()=>{a=null,B.getDomains().then(({domains:f})=>{r&&(t.setQueryData(["authored-domains"],{domains:f}),e({type:"SET_AUTHORED_DOMAINS",domains:f}))}).catch(()=>{})},150)},h=()=>{c&&clearTimeout(c),c=setTimeout(()=>{c=null,e({type:"SET_SEMANTIC_LOADING",loading:!0}),B.getSemanticLayer().then(f=>{r&&(t.setQueryData(["semantic-layer"],f),e({type:"SET_SEMANTIC_LAYER",layer:f}))}).catch(()=>{})},100)},d=()=>{if(!r)return;const f=new AbortController;n.current=f,Ep("/api/watch",m=>{if(m.event==="change")try{const S=JSON.parse(m.data);if(S.type==="file-added"||S.type==="file-deleted"||S.type==="file-changed"){const v=S.path??"";/^(?:notebooks|workbooks|blocks|skills|apps|dashboards)\//.test(v)&&l(),v.startsWith("domains/")&&(l(),u())}S.type==="semantic-reload"&&h()}catch{}},f.signal).catch(()=>{!r||f.signal.aborted||(o&&clearTimeout(o),o=setTimeout(d,5e3))})};return d(),()=>{var f;r=!1,o&&clearTimeout(o),i&&clearTimeout(i),a&&clearTimeout(a),c&&clearTimeout(c),(f=n.current)==null||f.abort(),n.current=null}},[e,t])}const jj=new ah({defaultOptions:{queries:{staleTime:15e3,gcTime:5*6e4,retry:1,refetchOnWindowFocus:!1}}});function Ej(){const e=Ge(i=>i.themeMode),t=Ge(i=>i.dispatch),n=Qe[e];p.useEffect(()=>{const i="dql-global-styles";let a=document.getElementById(i);a||(a=document.createElement("style"),a.id=i,document.head.appendChild(a)),a.textContent=`
|
|
610
|
+
</html>`}function hC(e,t){const n=fC(e,t),r=new Blob([n],{type:"text/html;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`${e.toLowerCase().replace(/[^a-z0-9]+/g,"-")}-dashboard.html`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}const mC=new Set(["succeeded","failed","cancelled","interrupted"]);function Ir(e){return mC.has(e.status)}function gC(e,t){if(e.id!==t.id)return t;const n=Ir(e),r=Ir(t);return n&&!r||t.updatedAt<e.updatedAt?e:t.updatedAt>e.updatedAt?t:n!==r?r?t:e:t.progress!==e.progress?t.progress>e.progress?t:e:t}function eo(e,t){const n=e.find(o=>o.id===t.id),r=n?gC(n,t):t;return kC([...e.filter(o=>o.id!==t.id),r])}function yC(e,t){return t.reduce(eo,e)}function bC(e){return e.filter(t=>!Ir(t)).map(t=>t.id)}function xC(e,t){for(const n of bC(t))e.add(n)}async function vC(e,t,n){await Promise.all([...e].map(async r=>{try{const o=await t(r);if(n(o)===!1)return;Ir(o)&&e.delete(r)}catch{}}))}function SC(e,t=new Set){return e.filter(n=>n.type==="block_certification"&&n.status==="succeeded").filter(n=>!t.has(n.id)).filter(n=>{const r=n.result;return!!(r!=null&&r.block&&r.outcome)}).sort((n,r)=>n.updatedAt.localeCompare(r.updatedAt)||n.createdAt.localeCompare(r.createdAt)||n.id.localeCompare(r.id))}function fE(e,t){var o;if(t.operationId){const i=e.find(a=>a.type==="block_certification"&&a.id===t.operationId);if(i)return i}const n=Vr(t.activePath),r=(o=t.sourceFingerprint)==null?void 0:o.trim();return e.filter(i=>i.type==="block_certification").filter(i=>{const a=wC(i),c=[Vr(i.scope.startsWith("block:")?i.scope.slice(6):void 0),Vr(a==null?void 0:a.oldPath),Vr(a==null?void 0:a.draftPath),Vr(a==null?void 0:a.newPath)].filter(h=>!!h),l=!!(n&&c.includes(n)),u=!!(r&&i.resourceRevision&&(i.resourceRevision===r||i.resourceRevision.startsWith(`${r}:`)));return l||u}).sort((i,a)=>a.updatedAt.localeCompare(i.updatedAt)||a.createdAt.localeCompare(i.createdAt))[0]}function wC(e){return e.result&&typeof e.result=="object"&&!Array.isArray(e.result)?e.result:void 0}function Vr(e){if(!(typeof e!="string"||!e.trim()))return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"")}function kC(e,t=50){let n=0;return[...e].sort((r,o)=>o.updatedAt.localeCompare(r.updatedAt)||o.createdAt.localeCompare(r.createdAt)||o.id.localeCompare(r.id)).filter(r=>Ir(r)?(n+=1,n<=t):!0)}const ir=["local-operations"],pf=p.createContext(null);function CC({children:e}){const t=Yi(),n=p.useRef(new Set),r=p.useRef(new Set),o=Ge(l=>l.dispatch),i=Ri({queryKey:ir,queryFn:async()=>{const l=(await B.listOperations(50)).operations,u=t.getQueryData(ir)??[];return yC(u,l)},staleTime:15e3,refetchOnWindowFocus:!1,refetchInterval:1500}),a=i.data??[];p.useEffect(()=>{let l=!0,u,h;const d=()=>{h=new AbortController,Ep("/api/operations/events",f=>{if(f.event==="operation")try{const m=JSON.parse(f.data);t.setQueryData(ir,(S=[])=>eo(S,m))}catch{}},h.signal).catch(()=>{!l||h!=null&&h.signal.aborted||(u=setTimeout(d,5e3))})};return d(),()=>{l=!1,u&&clearTimeout(u),h==null||h.abort()}},[t]),p.useEffect(()=>{xC(r.current,a)},[a]),p.useEffect(()=>{let l=!0,u=!1;const h=async()=>{if(!(u||r.current.size===0)){u=!0;try{await vC(r.current,f=>B.getOperation(f),f=>{if(!l)return!1;t.setQueryData(ir,(m=[])=>eo(m,f))})}finally{u=!1}}};h();const d=window.setInterval(()=>void h(),1e3);return()=>{l=!1,window.clearInterval(d)}},[t]),p.useEffect(()=>{for(const l of SC(a,n.current)){const u=l.result;n.current.add(l.id),o({type:"RECONCILE_BLOCK_CERTIFICATION",outcome:u.outcome,oldPath:u.oldPath,draftPath:u.draftPath,newPath:u.newPath,payload:u.block}),window.dispatchEvent(new CustomEvent("dql:block-library-invalidated",{detail:{operationId:l.id,outcome:u.outcome}}))}},[o,a]);const c=p.useMemo(()=>({operations:a,activeCount:a.filter(l=>l.status==="queued"||l.status==="running").length,loading:i.isLoading,cancel:async l=>{const u=await B.cancelOperation(l);r.current.delete(l),t.setQueryData(ir,(h=[])=>eo(h,u))},track:l=>{Ir(l)?r.current.delete(l.id):r.current.add(l.id),t.setQueryData(ir,(u=[])=>eo(u,l))}}),[a,i.isLoading,t]);return s.jsx(pf.Provider,{value:c,children:e})}function jC(){const e=p.useContext(pf);if(!e)throw new Error("useOperations must be used inside OperationsProvider.");return e}const EC=new Set(["succeeded","failed","cancelled","interrupted"]);function TC(e,t=8){const n=AC(e).filter(o=>!EC.has(o.status)||o.type!=="project_refresh"),r=n.map(ff);return{operations:n.slice(0,t),activeCount:r.filter(o=>o.active).length,attentionCount:r.filter(o=>o.tone==="attention").length}}function AC(e){const t=e.filter(l=>l.type==="block_certification"),n=t.map((l,u)=>u),r=new Map,o=l=>{let u=l;for(;n[u]!==u;)n[u]=n[n[u]],u=n[u];return u},i=(l,u)=>{const h=o(l),d=o(u);h!==d&&(n[d]=h)};t.forEach((l,u)=>{for(const h of RC(l)){const d=r.get(h);d===void 0?r.set(h,u):i(u,d)}});const a=new Map;t.forEach((l,u)=>{const h=o(u),d=a.get(h);(!d||OC(l,d)<0)&&a.set(h,l)});const c=new Set([...a.values()].map(l=>l.id));return e.filter(l=>l.type!=="block_certification"||c.has(l.id))}function ff(e){var n,r,o,i,a,c;if(e.status==="queued"||e.status==="running")return{active:!0,tone:"active",statusLabel:e.status,message:e.message,guidance:e.type==="block_certification"?"You can change pages while certification continues.":void 0};if(e.type==="block_certification"&&e.status==="succeeded"){const l=e.result;if((l==null?void 0:l.outcome)==="draft_saved_with_blockers"){const u=((r=(n=l.checklist)==null?void 0:n.issues)==null?void 0:r.length)??((o=l.blockers)==null?void 0:o.length)??((i=l.checklist)==null?void 0:i.blockers.length)??0;return{active:!1,tone:"attention",statusLabel:"needs attention",message:u>0?`Draft saved with ${u} certification blocker${u===1?"":"s"}.`:"Draft saved, but certification requirements are not ready.",guidance:"Open Block Studio to review the exact fixes and retry."}}if((l==null?void 0:l.outcome)==="certified")return{active:!1,tone:"success",statusLabel:"certified",message:"The block passed its required gates and was certified."}}return e.status==="failed"||e.status==="interrupted"?{active:!1,tone:"failure",statusLabel:e.status,message:((a=e.error)==null?void 0:a.message)??e.message,guidance:e.type==="block_certification"?"The saved draft is preserved for review or retry.":void 0}:e.status==="cancelled"?{active:!1,tone:"neutral",statusLabel:"cancelled",message:e.message}:{active:!1,tone:e.status==="succeeded"?"success":"neutral",statusLabel:e.status,message:((c=e.error)==null?void 0:c.message)??e.message}}function RC(e){const t=hi(e.result),n=hi(t==null?void 0:t.block),r=hi(n==null?void 0:n.metadata),o=e.scope.startsWith("block:")?e.scope.slice(6):void 0;return Array.from(new Set([ar(n==null?void 0:n.path),ar(r==null?void 0:r.path),ar(t==null?void 0:t.oldPath),ar(t==null?void 0:t.draftPath),ar(t==null?void 0:t.newPath),ar(o)].filter(i=>!!i)))}function hi(e){return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}function ar(e){if(!(typeof e!="string"||!e.trim()))return e.trim().replace(/\\/g,"/").replace(/^\.\//,"").replace(/^\/+/,"")}function OC(e,t){return t.createdAt.localeCompare(e.createdAt)||t.updatedAt.localeCompare(e.updatedAt)||t.id.localeCompare(e.id)}function _C(){const e=Ge(d=>d.themeMode),t=Qe[e],{operations:n,loading:r,cancel:o}=jC(),[i,a]=p.useState(!1),c=p.useRef(null),{operations:l,activeCount:u,attentionCount:h}=TC(n);return p.useEffect(()=>{if(!i)return;const d=m=>{c.current&&!c.current.contains(m.target)&&a(!1)},f=m=>{m.key==="Escape"&&a(!1)};return document.addEventListener("mousedown",d),document.addEventListener("keydown",f),()=>{document.removeEventListener("mousedown",d),document.removeEventListener("keydown",f)}},[i]),!r&&l.length===0?null:s.jsxs("div",{ref:c,style:{position:"relative"},children:[s.jsxs("button",{type:"button","aria-label":"Background tasks","aria-expanded":i,onClick:()=>a(d=>!d),style:{height:28,padding:"0 9px",borderRadius:6,border:`1px solid ${u>0?t.accent:h>0?t.warning:t.btnBorder}`,background:i?t.btnHover:t.btnBg,color:t.textSecondary,cursor:"pointer",display:"inline-flex",alignItems:"center",gap:6,fontFamily:t.font,fontSize:11,fontWeight:600},children:[s.jsx("span",{"aria-hidden":"true",style:{width:7,height:7,borderRadius:999,background:u>0?t.accent:h>0?t.warning:t.success,boxShadow:u>0?`0 0 0 3px ${t.accent}20`:"none"}}),u>0?`${u} running`:h>0?`${h} needs attention`:"Tasks"]}),i&&s.jsxs("div",{role:"dialog","aria-label":"Background tasks",style:{position:"absolute",top:34,right:0,zIndex:1200,width:340,maxHeight:420,overflowY:"auto",background:t.modalBg,border:`1px solid ${t.cellBorder}`,borderRadius:9,boxShadow:"0 14px 36px rgba(0,0,0,0.28)",padding:8},children:[s.jsx("div",{style:{padding:"4px 6px 8px",color:t.textPrimary,fontSize:12,fontWeight:700},children:"Background tasks"}),l.map(d=>{const f=ff(d),m=f.active,S=f.tone==="failure"?t.error:f.tone==="attention"?t.warning:f.tone==="success"?t.success:t.textMuted;return s.jsxs("div",{style:{padding:"9px 8px",borderTop:`1px solid ${t.headerBorder}`,display:"flex",flexDirection:"column",gap:6},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[s.jsx("span",{style:{flex:1,color:t.textPrimary,fontSize:11.5,fontWeight:650},children:PC(d.type)}),s.jsx("span",{style:{color:S,fontSize:10},children:f.statusLabel})]}),s.jsx("div",{style:{color:f.tone==="failure"?t.error:f.tone==="attention"?t.warning:t.textSecondary,fontSize:10.5,lineHeight:1.4},children:f.message}),m&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[s.jsx("div",{style:{flex:1,height:3,borderRadius:99,overflow:"hidden",background:t.headerBorder},children:s.jsx("div",{style:{width:`${Math.max(3,d.progress)}%`,height:"100%",background:t.accent,transition:"width 180ms ease"}})}),d.cancellable&&s.jsx("button",{type:"button",onClick:()=>void o(d.id),style:{border:0,background:"transparent",color:t.textMuted,cursor:"pointer",fontSize:10,padding:0},children:"Cancel"})]}),d.type==="block_certification"&&s.jsx("div",{style:{color:t.textMuted,fontSize:9.5},children:f.guidance??(f.tone==="success"?"Certification is complete.":"The saved draft is preserved for review or retry.")}),(d.type==="agent_run"||d.type==="app_ai_build")&&s.jsx("div",{style:{color:t.textMuted,fontSize:9.5},children:m?"This continues while you work on another page.":d.status==="succeeded"?"Completed in the background.":"Open the original surface to review or retry."})]},d.id)})]})]})}function PC(e){return e==="block_certification"?"Block certification":e==="project_refresh"?"Project metadata refresh":e==="agent_run"?"AI request":e==="app_ai_build"?"App proposal":e.replace(/_/g," ")}const rs=new Map;function IC(e,t){let n=rs.get(e);n||(n={running:!1},rs.set(e,n));const r=n,o=new Promise((i,a)=>{r.pending?(r.pending.content=t,r.pending.waiters.push({resolve:i,reject:a})):r.pending={content:t,waiters:[{resolve:i,reject:a}]}});return r.running||(r.running=!0,(async()=>{for(;r.pending;){const i=r.pending;r.pending=void 0;try{await B.saveNotebook(e,i.content);for(const a of i.waiters)a.resolve()}catch(a){for(const c of i.waiters)c.reject(a)}}})().finally(()=>{r.running=!1,r.pending||rs.delete(e)})),o}function DC(e){const t=rs.get(e);return!!(t!=null&&t.running||t!=null&&t.pending)}function $C({t:e}){return s.jsx("div",{style:{width:28,height:28,borderRadius:6,background:"linear-gradient(135deg, #5b8cff 0%, #7c5cff 100%)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:s.jsx("span",{style:{color:"#ffffff",fontSize:10,fontWeight:700,fontFamily:e.fontMono,letterSpacing:"-0.5px"},children:"DQL"})})}function MC(){var te;const e=Ge(Lr(F=>({activeBlockPath:F.activeBlockPath,activeFile:F.activeFile,appMode:F.appMode,autoSave:F.autoSave,blockStudioDirty:F.blockStudioDirty,blockStudioDraft:F.blockStudioDraft,blockStudioMetadata:F.blockStudioMetadata,cells:F.cells,files:F.files,mainView:F.mainView,notebookDirty:F.notebookDirty,notebookMetadata:F.notebookMetadata,notebookTitle:F.notebookTitle,savingFile:F.savingFile,themeMode:F.themeMode}))),t=jn(),n=Qe[e.themeMode],{executeAll:r}=uf(),[o,i]=p.useState(!1),[a,c]=p.useState(""),[l,u]=p.useState(!1),[h,d]=p.useState(!1),[f,m]=p.useState(!1),[S,v]=p.useState(!1),[b,w]=p.useState(!1),j=p.useRef(null),[C,x]=p.useState(!1),[E,P]=p.useState(!1),A=p.useRef(null),g=p.useRef(null),I=e.mainView==="block_studio"?e.blockStudioDirty:e.notebookDirty,T=e.mainView==="notebook",O=e.mainView==="notebook"||e.mainView==="block_studio",_=O&&!!e.activeFile,M={home:"Home",business_artifact:((te=e.activeFile)==null?void 0:te.name.replace(/\.(dqlnb|dql)$/i,""))??"Business Definition",lineage:"Lineage",lineage_detail:"Lineage",connection:"Settings",apps:"Apps",git:"Source control",settings:"Settings",imports:"Import SQL",domains:"Modeling",modeling:"Modeling"},q=O?e.activeFile?e.notebookTitle||"Untitled":e.mainView==="block_studio"?"Blocks":"Notebooks":M[e.mainView]??"DQL Workbench";p.useEffect(()=>{o&&g.current&&(g.current.focus(),g.current.select())},[o]),p.useEffect(()=>{if(!E)return;function F(K){A.current&&!A.current.contains(K.target)&&P(!1)}return document.addEventListener("mousedown",F),()=>document.removeEventListener("mousedown",F)},[E]);const G=()=>{c(e.notebookTitle),i(!0)},J=()=>{i(!1),a.trim()&&a!==e.notebookTitle&&(e.mainView==="block_studio"&&e.blockStudioMetadata?(t({type:"SET_BLOCK_STUDIO_METADATA",metadata:{...e.blockStudioMetadata,name:a.trim()}}),t({type:"SET_BLOCK_STUDIO_DRAFT",draft:J1(e.blockStudioDraft,a.trim())})):t({type:"SET_NOTEBOOK_DIRTY",dirty:!0}))},H=p.useCallback(async()=>{var K,oe,ee;const F=In.getState();if(F.activeFile){t({type:"SET_SAVING",saving:!0});try{if(F.mainView==="block_studio"){if(!F.blockStudioMetadata)return;const ce=await B.saveBlockStudio({path:F.activeBlockPath,source:F.blockStudioDraft,metadata:{name:F.blockStudioMetadata.name,domain:F.blockStudioMetadata.domain,folderPath:F.blockStudioMetadata.folderPath,description:F.blockStudioMetadata.description,owner:F.blockStudioMetadata.owner,tags:F.blockStudioMetadata.tags}});t({type:"OPEN_BLOCK_STUDIO",file:{name:`${ce.metadata.name}.dql`,path:ce.path,type:"block",folder:"blocks"},payload:ce}),F.files.some(ke=>ke.path===ce.path)||t({type:"FILE_ADDED",file:{name:`${ce.metadata.name}.dql`,path:ce.path,type:"block",folder:"blocks"}})}else{const ce=F.activeFile,ke=F.cells,xe=F.notebookTitle,De=F.notebookMetadata,We=ce.type==="block"?((K=ke[0])==null?void 0:K.content)??"":L1(xe,ke,De);await IC(ce.path,We);const Be=In.getState();((oe=Be.activeFile)==null?void 0:oe.path)===ce.path&&Be.cells===ke&&Be.notebookTitle===xe&&Be.notebookMetadata===De&&t({type:"SET_NOTEBOOK_DIRTY",dirty:!1})}u(!0),setTimeout(()=>u(!1),2e3)}catch(ce){console.error("Save failed:",ce)}finally{const ce=(ee=In.getState().activeFile)==null?void 0:ee.path;(!ce||!DC(ce))&&t({type:"SET_SAVING",saving:!1})}}},[t]);p.useEffect(()=>{const F=K=>{(K.metaKey||K.ctrlKey)&&K.key==="s"&&(K.preventDefault(),H())};return document.addEventListener("keydown",F),()=>document.removeEventListener("keydown",F)},[H]),p.useEffect(()=>{if(!e.autoSave||!I||!e.activeFile||e.mainView==="block_studio")return;const F=setTimeout(()=>{H()},750);return()=>clearTimeout(F)},[e.autoSave,I,e.activeFile,e.cells,e.blockStudioDraft,H]);const L=[{mode:"obsidian",label:"Obsidian",glyph:"●",swatch:"#0d0e11"},{mode:"paper",label:"Paper",glyph:"☼",swatch:"#f7f4ed"},{mode:"white",label:"White",glyph:"○",swatch:"#ffffff"}],$=e.themeMode==="dark"||e.themeMode==="midnight"?"obsidian":e.themeMode==="light"?"paper":e.themeMode==="arctic"?"white":e.themeMode,X=L.find(F=>F.mode===$)??L[0];p.useEffect(()=>{if(!b)return;const F=oe=>{j.current&&!j.current.contains(oe.target)&&w(!1)},K=oe=>{oe.key==="Escape"&&w(!1)};return document.addEventListener("mousedown",F),document.addEventListener("keydown",K),()=>{document.removeEventListener("mousedown",F),document.removeEventListener("keydown",K)}},[b]);const W={height:28,padding:"0 10px",borderRadius:6,border:`1px solid ${n.btnBorder}`,cursor:"pointer",fontSize:12,fontWeight:500,fontFamily:n.font,display:"flex",alignItems:"center",gap:4,transition:"background 0.15s, color 0.15s",whiteSpace:"nowrap"};return s.jsxs("div",{style:{height:48,flexShrink:0,background:n.headerBg,borderBottom:`1px solid ${n.headerBorder}`,display:"flex",alignItems:"center",padding:"0 12px",gap:8,userSelect:"none"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[s.jsx($C,{t:n}),s.jsx("div",{style:{width:1,height:20,background:n.headerBorder,flexShrink:0}}),e.activeFile&&O&&s.jsx("span",{style:{fontSize:10,fontWeight:600,color:e.activeFile.type==="block"?"#e3b341":n.accent,background:`${e.activeFile.type==="block"?"#e3b341":n.accent}18`,borderRadius:4,padding:"2px 6px",fontFamily:n.font,textTransform:"uppercase",letterSpacing:"0.05em",flexShrink:0},children:e.activeFile.type}),e.activeFile&&O?o?s.jsx("input",{ref:g,value:a,onChange:F=>c(F.target.value),onBlur:J,onKeyDown:F=>{F.key==="Enter"&&J(),F.key==="Escape"&&i(!1)},style:{background:"transparent",border:`1px solid ${n.cellBorderActive}`,borderRadius:4,color:n.textPrimary,fontSize:13,fontWeight:500,fontFamily:n.font,padding:"2px 6px",outline:"none",minWidth:120,maxWidth:320}}):s.jsxs("span",{onClick:G,title:"Click to rename",style:{color:n.textPrimary,fontSize:13,fontWeight:500,fontFamily:n.font,cursor:"text",maxWidth:320,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",padding:"2px 4px",borderRadius:4,border:"1px solid transparent"},children:[q,I&&s.jsx("span",{style:{color:n.textMuted,marginLeft:4},children:"●"})]}):s.jsx("span",{style:{color:n.textSecondary,fontSize:13,fontFamily:n.font,padding:"2px 4px"},children:q||"DQL Workbench"})]}),s.jsx("div",{style:{flex:1}}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[s.jsx(_C,{}),e.appMode==="studio"&&_&&e.mainView!=="block_studio"&&s.jsx(s.Fragment,{children:s.jsxs("button",{onClick:T?r:void 0,disabled:!e.activeFile||!T,onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),style:{...W,height:30,padding:"0 14px",borderRadius:999,background:n.accent,color:"#ffffff",border:`1px solid ${n.accent}`,opacity:!e.activeFile||!T?.4:h?.9:1,boxShadow:"0 1px 2px rgba(107,93,211,0.25)",gap:6},children:[s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",children:s.jsx("path",{d:"M1.5 1.5l7 3.5-7 3.5V1.5Z"})}),"Run all"]})}),s.jsxs("div",{ref:j,style:{position:"relative"},children:[s.jsxs("button",{onClick:()=>w(F=>!F),onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),title:`Theme: ${X.label}`,"aria-haspopup":"true","aria-expanded":b,style:{...W,background:S||b?n.btnHover:n.btnBg,color:n.textSecondary,padding:"0 10px",fontSize:12,display:"flex",alignItems:"center",gap:6},children:[s.jsx("span",{style:{width:12,height:12,borderRadius:3,background:X.swatch,border:`1px solid ${n.headerBorder}`,flexShrink:0}}),s.jsx("span",{style:{fontFamily:n.fontMono,fontSize:10,letterSpacing:"0.04em"},children:X.label}),s.jsx("span",{style:{fontSize:8,color:n.textMuted},children:"▾"})]}),b&&s.jsx("div",{role:"menu",style:{position:"absolute",top:"100%",right:0,marginTop:4,minWidth:160,background:n.headerBg,border:`1px solid ${n.headerBorder}`,borderRadius:6,boxShadow:"0 8px 24px rgba(0,0,0,0.32)",padding:4,zIndex:1e3,display:"flex",flexDirection:"column",gap:1},children:L.map(F=>{const K=F.mode===$;return s.jsxs("button",{role:"menuitemradio","aria-checked":K,onClick:()=>{t({type:"SET_THEME",mode:F.mode}),w(!1)},style:{display:"flex",alignItems:"center",gap:8,padding:"6px 8px",border:"none",background:K?n.btnHover:"transparent",color:n.textPrimary,cursor:"pointer",borderRadius:4,fontSize:12,fontFamily:n.font,textAlign:"left"},onMouseEnter:oe=>{K||(oe.currentTarget.style.background=n.btnHover)},onMouseLeave:oe=>{K||(oe.currentTarget.style.background="transparent")},children:[s.jsx("span",{style:{width:14,height:14,borderRadius:3,background:F.swatch,border:`1px solid ${n.headerBorder}`,flexShrink:0}}),s.jsx("span",{style:{flex:1},children:F.label}),K&&s.jsx("span",{style:{color:n.accent,fontSize:11},children:"✓"})]},F.mode)})})]}),e.appMode==="studio"&&_&&e.mainView!=="block_studio"&&s.jsxs(s.Fragment,{children:[s.jsx("button",{onClick:H,disabled:!e.activeFile||e.savingFile,onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),title:"Save (Cmd+S)",style:{...W,background:f&&e.activeFile?n.btnHover:n.btnBg,color:l?n.success:n.textSecondary,opacity:e.activeFile?1:.4},children:e.savingFile?s.jsxs(s.Fragment,{children:[s.jsx(NC,{}),"Saving…"]}):l?s.jsx(s.Fragment,{children:"✓ Saved"}):s.jsx(s.Fragment,{children:"Save"})}),s.jsx("div",{style:{width:1,height:20,background:n.headerBorder}})]}),_&&e.mainView!=="block_studio"&&s.jsxs("div",{ref:A,style:{position:"relative"},children:[s.jsxs("button",{onClick:()=>{e.activeFile&&P(F=>!F)},disabled:!e.activeFile,onMouseEnter:()=>x(!0),onMouseLeave:()=>x(!1),title:"Share / export",style:{...W,height:30,padding:"0 14px",borderRadius:999,background:(C||E)&&e.activeFile?"#2a2a30":"#1a1a1a",color:"#ffffff",border:"1px solid #1a1a1a",opacity:e.activeFile?1:.4,gap:6},children:[s.jsx("svg",{width:"11",height:"11",viewBox:"0 0 16 16",fill:"currentColor",children:s.jsx("path",{d:"M5.5 10.75a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75Zm0-3a.75.75 0 0 1 .75-.75h3.5a.75.75 0 0 1 0 1.5h-3.5a.75.75 0 0 1-.75-.75ZM3 3.75A1.75 1.75 0 0 1 4.75 2h6.586c.464 0 .909.184 1.237.513l1.914 1.914c.329.328.513.773.513 1.237v6.586A1.75 1.75 0 0 1 13.25 14h-8.5A1.75 1.75 0 0 1 3 12.25Z"})}),"Share",s.jsx("svg",{width:"8",height:"8",viewBox:"0 0 8 8",fill:"currentColor",style:{marginLeft:1,opacity:.7},children:s.jsx("path",{d:"M1 2.5l3 3 3-3",stroke:"currentColor",fill:"none",strokeWidth:"1.2",strokeLinecap:"round"})})]}),E&&s.jsx("div",{style:{position:"absolute",top:32,right:0,zIndex:200,background:n.modalBg,border:`1px solid ${n.cellBorder}`,borderRadius:8,boxShadow:"0 8px 24px rgba(0,0,0,0.3)",padding:4,minWidth:160,display:"flex",flexDirection:"column",gap:2},children:s.jsx(LC,{label:"Export HTML",description:"Standalone dashboard",t:n,onClick:()=>{hC(e.notebookTitle||"dashboard",e.cells),P(!1)}})})]})]})]})}function LC({label:e,description:t,t:n,onClick:r}){const[o,i]=p.useState(!1);return s.jsxs("button",{onClick:r,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{background:o?n.btnHover:"transparent",border:"none",borderRadius:5,cursor:"pointer",padding:"6px 10px",textAlign:"left",display:"flex",flexDirection:"column",gap:1,transition:"background 0.12s"},children:[s.jsx("span",{style:{fontSize:12,fontWeight:500,color:n.textPrimary,fontFamily:n.font},children:e}),s.jsx("span",{style:{fontSize:10,color:n.textMuted,fontFamily:n.font},children:t})]})}function NC(){return s.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",style:{animation:"spin 0.8s linear infinite"},children:[s.jsx("style",{children:"@keyframes spin { to { transform: rotate(360deg); } }"}),s.jsx("circle",{cx:"6",cy:"6",r:"4.5",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"14 7"})]})}function BC(e){return e.toTimeString().slice(0,8)}function FC(e){return e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`}function zC(){const{state:e,dispatch:t}=et(),n=Qe[e.themeMode],[r,o]=p.useState(!1),i=e.queryLog.filter(c=>c.error),a=c=>t({type:"SET_DEV_PANEL_TAB",tab:c});return s.jsxs("div",{style:{height:e.devPanelOpen?180:0,flexShrink:0,background:n.sidebarBg,borderTop:`1px solid ${n.headerBorder}`,display:"flex",flexDirection:"column",overflow:"hidden",transition:"height 0.2s ease",position:"relative"},children:[e.devPanelOpen&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{style:{height:32,flexShrink:0,display:"flex",alignItems:"center",borderBottom:`1px solid ${n.headerBorder}`,padding:"0 8px",gap:2},children:[["logs","errors"].map(c=>s.jsx(qC,{label:c==="errors"?`Errors${i.length>0?` (${i.length})`:""}`:`Logs (${e.queryLog.length})`,active:e.devPanelTab===c,onClick:()=>a(c),t:n},c)),s.jsx("div",{style:{flex:1}}),s.jsx("button",{onClick:()=>t({type:"SET_CELLS",cells:e.cells}),title:"Clear logs",style:{background:"transparent",borderTop:"none",borderLeft:"none",borderRight:"none",borderBottom:"none",cursor:"pointer",color:n.textMuted,fontSize:11,fontFamily:n.font,padding:"2px 6px",borderRadius:4},children:"Clear"})]}),s.jsxs("div",{style:{flex:1,overflow:"auto",padding:"4px 0"},children:[e.devPanelTab==="logs"&&(e.queryLog.length===0?s.jsx(Bl,{t:n,message:"No queries executed yet."}):[...e.queryLog].reverse().map(c=>s.jsx(Fl,{entry:c,t:n},c.id))),e.devPanelTab==="errors"&&(i.length===0?s.jsx(Bl,{t:n,message:"No errors."}):[...i].reverse().map(c=>s.jsx(Fl,{entry:c,t:n},c.id)))]})]}),s.jsxs("button",{onClick:()=>t({type:"TOGGLE_DEV_PANEL"}),onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),title:e.devPanelOpen?"Close panel":"Open dev panel",style:{position:"absolute",bottom:e.devPanelOpen?4:-28,right:8,height:22,padding:"0 8px",borderRadius:"4px 4px 0 0",borderTop:`1px solid ${n.headerBorder}`,borderLeft:`1px solid ${n.headerBorder}`,borderRight:`1px solid ${n.headerBorder}`,borderBottom:e.devPanelOpen?`1px solid ${n.sidebarBg}`:`1px solid ${n.headerBorder}`,background:r?n.btnHover:n.sidebarBg,color:n.textMuted,cursor:"pointer",fontSize:11,fontFamily:n.font,display:"flex",alignItems:"center",gap:4,transition:"background 0.15s, bottom 0.2s ease",zIndex:10},children:[s.jsx("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"currentColor",children:s.jsx("path",{d:e.devPanelOpen?"M1 7l4-4 4 4":"M1 3l4 4 4-4",strokeWidth:"1.5",stroke:"currentColor",fill:"none"})}),"Dev"]})]})}function qC({label:e,active:t,onClick:n,t:r}){const[o,i]=p.useState(!1);return s.jsx("button",{onClick:n,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),style:{background:"transparent",borderTop:"none",borderLeft:"none",borderRight:"none",borderBottom:t?`2px solid ${r.accent}`:"2px solid transparent",cursor:"pointer",color:t?r.textPrimary:o?r.textSecondary:r.textMuted,fontSize:12,fontFamily:r.font,fontWeight:t?500:400,padding:"4px 8px",height:32,transition:"color 0.15s"},children:e})}function Bl({t:e,message:t}){return s.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:e.textMuted,fontSize:12,fontFamily:e.font,fontStyle:"italic"},children:t})}function Fl({entry:e,t}){return s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"3px 12px",fontSize:11,fontFamily:t.fontMono,color:e.error?t.error:t.textSecondary,borderLeft:e.error?`2px solid ${t.error}`:"2px solid transparent"},children:[s.jsx("span",{style:{color:t.textMuted,flexShrink:0},children:BC(e.ts)}),s.jsx("span",{style:{flexShrink:0,color:t.textPrimary,maxWidth:160,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.cellName}),e.error?s.jsx("span",{style:{color:t.error,flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.error}):s.jsxs(s.Fragment,{children:[s.jsxs("span",{style:{color:t.textMuted},children:[e.rows.toLocaleString()," rows"]}),s.jsx("span",{style:{color:t.textMuted},children:FC(e.time)})]})]})}function UC(){const{state:e,dispatch:t}=et(),{executeAll:n}=uf();p.useEffect(()=>{const r=o=>{const i=o.metaKey||o.ctrlKey;if(i&&o.key==="b"&&!o.shiftKey){o.preventDefault(),t({type:"TOGGLE_SIDEBAR"});return}if(i&&o.shiftKey&&o.key==="Enter"){o.preventDefault(),e.activeFile&&n();return}if(i&&o.key==="j"&&!o.shiftKey){o.preventDefault(),t({type:"TOGGLE_DEV_PANEL"});return}if(i&&o.key==="d"&&!o.shiftKey){o.preventDefault(),e.activeFile&&t({type:"TOGGLE_DASHBOARD_MODE"});return}if(o.key==="Escape"){if(e.dashboardMode){t({type:"TOGGLE_DASHBOARD_MODE"});return}if(e.newNotebookModalOpen){t({type:"CLOSE_NEW_NOTEBOOK_MODAL"});return}if(e.newBlockModalOpen){t({type:"CLOSE_NEW_BLOCK_MODAL"});return}}};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[t,n,e.activeFile,e.newNotebookModalOpen,e.newBlockModalOpen,e.dashboardMode])}const WC=600;function KC(e,t){const n=t.filter(r=>r.result||r.error||(r.executionCount??0)>0).map(r=>{var o;return{cellId:r.id,status:r.status,result:r.result,error:r.error,executionCount:r.executionCount,executedAt:((o=r.execution)==null?void 0:o.completedAt)??new Date().toISOString(),execution:r.execution}});return{version:1,notebookPath:e,capturedAt:new Date().toISOString(),cells:n}}function zl(e){return e.map(t=>{var n,r;return`${t.id}:${((n=t.execution)==null?void 0:n.runId)??""}:${t.executionCount??0}:${((r=t.result)==null?void 0:r.rowCount)??-1}:${t.error??""}`}).join("|")}function VC(){var o;const{state:e}=et(),t=p.useRef(null),n=p.useRef(""),r=p.useRef(null);p.useEffect(()=>{var c;const i=((c=e.activeFile)==null?void 0:c.path)??null;if(!i)return;if(i!==r.current){r.current=i,n.current=zl(e.cells);return}const a=zl(e.cells);return a!==n.current&&(n.current=a,t.current&&clearTimeout(t.current),t.current=setTimeout(()=>{const l=KC(i,e.cells);B.saveRunSnapshot(i,l).catch(()=>{})},WC)),()=>{t.current&&(clearTimeout(t.current),t.current=null)}},[e.cells,(o=e.activeFile)==null?void 0:o.path])}const hE="core";function HC(e){var n;const t=e==null?void 0:e.trim();if(t)return((n=t.split("::").at(-1))==null?void 0:n.trim())||void 0}const GC=[{items:[{id:"diagram",label:"Modeling"},{id:"skills",label:"Skills"},{id:"blocks",label:"Blocks"},{id:"notebooks",label:"Notebooks"},{id:"apps",label:"Apps"}]}],QC=new Set(GC.flatMap(e=>e.items.map(t=>t.id)));function hf(e){return e!==null&&QC.has(e)}function mE(e,t){const n=new URL(e);return t.domain?n.searchParams.set("domain",t.domain):n.searchParams.delete("domain"),n.searchParams.set("domainSection",t.section),t.modelAreaId?n.searchParams.set("modelArea",t.modelAreaId):n.searchParams.delete("modelArea"),t.selectedId?n.searchParams.set("domainObject",t.selectedId):n.searchParams.delete("domainObject"),`${n.pathname}${n.search}${n.hash}`}function JC(e){const t=new URL(e);for(const n of mf)t.searchParams.delete(n);return`${t.pathname}${t.search}${t.hash}`}const mf=["domain","domainSection","modelArea","domainObject"],gE="dql.domain-studio.location";function yE(e,t){const n=new URL(e).searchParams;if(mf.some(r=>n.has(r))){const r=n.get("domainSection"),o=hf(r)?r:"diagram";return{domain:n.get("domain"),section:o,modelAreaId:n.get("modelArea"),selectedId:r==="diagram"?n.get("domainObject"):null}}return YC(t)}function YC(e){const t={domain:null,section:"diagram",modelAreaId:null,selectedId:null};if(!e)return t;try{const n=JSON.parse(e),r=typeof n.section=="string"&&hf(n.section)?n.section:"diagram",o=i=>typeof i=="string"&&i.trim()?i:null;return{domain:o(n.domain),section:r,modelAreaId:o(n.modelAreaId),selectedId:o(n.selectedId)}}catch{return t}}function bE(e){return`modeling:${e??"all"}`}function xE(e){const t=Object.values(e),n=new Map;for(const a of t){const c=a.parent&&e[a.parent]?a.parent:void 0;n.set(c,[...n.get(c)??[],a])}for(const a of n.values())a.sort((c,l)=>c.id.localeCompare(l.id));const r=[],o=new Set,i=(a,c)=>{for(const l of n.get(a)??[])o.has(l.id)||(o.add(l.id),r.push({id:l.id,parent:l.parent,depth:c,label:c===0?l.id:`${"— ".repeat(c)}${l.id.split(".").at(-1)??l.id}`}),i(l.id,c+1))};i(void 0,0);for(const a of t.sort((c,l)=>c.id.localeCompare(l.id)))o.has(a.id)||r.push({id:a.id,parent:a.parent,depth:0,label:a.id});return r}function vE(e){const t=(e??"").toLowerCase();return t==="dimension"?"var(--status-success)":t==="bridge"?"var(--status-warning)":t==="event"||t==="snapshot"?"var(--accent)":"var(--text-tertiary)"}function gf(e){return Object.entries(e.entities).map(([t,n])=>({recordKey:t,entity:n}))}function SE(e,t){if(e.entities[t])return t;const n=gf(e).filter(({entity:r})=>r.id===t||r.qualifiedId===t);return n.length===1?n[0].recordKey:void 0}function wE(e,t){return gf(e).filter(({entity:n})=>!t||n.domain===t)}function kE(e,t,n){if(e.operation==="upsert_entity"){if(!t)return!1;const r=e.value;return r.dbtModel===t.dbtUniqueId&&(r.grain??void 0)===(t.grain??void 0)&&JSON.stringify(r.keys??[])===JSON.stringify(t.keys??[])&&(r.status??t.status)===t.status&&(r.areaId??void 0)===HC(t.areaId)&&r.domain===t.domain}return e.operation==="upsert_area"?!!n&&e.value.domain===n.domain&&e.value.id===n.localId:!1}const XC=p.lazy(()=>_e(()=>import("./HomePage-eIkfBIep.js"),__vite__mapDeps([0,1,2,3,4,5,6])).then(e=>({default:e.HomePage}))),ZC=p.lazy(()=>_e(()=>import("./AnalyticsHome-D5P6Ujwi.js"),__vite__mapDeps([7,8,9,10,1,11,12,3,13,14,15,16,17,2,18,6])).then(e=>({default:e.AnalyticsHome}))),ej=p.lazy(()=>_e(()=>import("./GlobalAiRail-CVECf6Xj.js"),__vite__mapDeps([19,9,10,1,11,12,3,13,14,15,16,17,2,20,6])).then(e=>({default:e.GlobalAiRail}))),tj=p.lazy(()=>_e(()=>import("./NotebookEditor-DjqJS44s.js"),__vite__mapDeps([21,4,2,5,22,23,24,10,1,11,12,3,13,14,9,15,16,17,8,25,26,6,27,28,20,29])).then(e=>({default:e.NotebookEditor}))),nj=p.lazy(()=>_e(()=>import("./NewNotebookModal-5Vp6XiuK.js"),__vite__mapDeps([30,4,15,6])).then(e=>({default:e.NewNotebookModal}))),rj=p.lazy(()=>_e(()=>import("./NewBlockModal-DbCQg-pj.js"),__vite__mapDeps([31,6])).then(e=>({default:e.NewBlockModal}))),oj=p.lazy(()=>_e(()=>import("./SetupOnboarding-BfS9Tdx-.js"),__vite__mapDeps([32,33,2,6])).then(e=>({default:e.SetupOnboarding}))),sj=p.lazy(()=>_e(()=>import("./BlockStudio-B4ap0GdY.js"),__vite__mapDeps([34,22,23,10,1,11,12,3,13,14,25,26,6,27,9,15,16,17,2,20,35,36])).then(e=>({default:e.BlockStudio}))),ij=p.lazy(()=>_e(()=>import("./BusinessArtifactView-BIfNI-0S.js"),__vite__mapDeps([37,25,26,6,27])).then(e=>({default:e.BusinessArtifactView}))),aj=p.lazy(()=>_e(()=>import("./LineageDetailView-DJZZjZu-.js"),__vite__mapDeps([38,25,26,6,27,39,33,16])).then(e=>({default:e.LineageDetailView}))),cj=p.lazy(()=>_e(()=>import("./LineageDAG-CSqcbDrE.js"),__vite__mapDeps([39,26,6,27])).then(e=>({default:e.LineageDAG}))),lj=p.lazy(()=>_e(()=>import("./HelpDocsPage-D8hLS5lE.js"),__vite__mapDeps([40,6])).then(e=>({default:e.HelpDocsPage}))),dj=p.lazy(()=>_e(()=>Promise.resolve().then(()=>i1),void 0).then(e=>({default:e.ConnectionPanel}))),uj=p.lazy(()=>_e(()=>import("./GitPage-lQb1uXH2.js"),__vite__mapDeps([41,42,15,6])).then(e=>({default:e.GitPage}))),pj=p.lazy(()=>_e(()=>import("./ReadinessPage-BHGrC5ho.js"),__vite__mapDeps([43,1,44,45,12,3,2,6])).then(e=>({default:e.ReadinessPage}))),fj=p.lazy(()=>_e(()=>import("./AgentLogPage-BPz-UWFh.js"),__vite__mapDeps([46,33,14,47,6])).then(e=>({default:e.AgentLogPage}))),hj=p.lazy(()=>_e(()=>import("./GovernedContextPage-trOyMCY6.js"),__vite__mapDeps([48,3,12,9,10,1,11,13,14,15,16,17,2,49,6])).then(e=>({default:e.GovernedContextPage}))),mj=p.lazy(()=>_e(()=>import("./DbtFirstModelingPage-D72byb2g.js"),__vite__mapDeps([50,49,9,10,1,11,12,3,13,14,15,16,17,2,26,6,27,28,29,36,51,47])).then(e=>({default:e.DbtFirstModelingPage}))),gj=p.lazy(()=>_e(()=>import("./AppsView-DQOwU9Cg.js"),__vite__mapDeps([52,20,17,10,1,11,12,3,13,14,15,33,35,29,4,5,24,8,45,53,51,2,18,6])).then(e=>({default:e.AppsView}))),yj=p.lazy(()=>_e(()=>import("./LineageDrawer-BcIipIc3.js"),__vite__mapDeps([54,25,26,6,27,36,15,17,13,53,42])).then(e=>({default:e.LineageDrawer}))),bj=p.lazy(()=>_e(()=>import("./AiBuildDialog-BEl53WA_.js"),__vite__mapDeps([55,44,11,12,3,13,15,6])).then(e=>({default:e.AiBuildDialog})));function xj(){const e=Ge(Lr(d=>({appMode:d.appMode,dashboardMode:d.dashboardMode,globalAi:d.globalAi,inspectorOpen:d.inspectorOpen,lineageDrawerOpen:d.lineageDrawerOpen,lineageFullscreen:d.lineageFullscreen,mainView:d.mainView,newBlockModalOpen:d.newBlockModalOpen,newNotebookModalOpen:d.newNotebookModalOpen,setupOpen:d.setupOpen,sidebarOpen:d.sidebarOpen,sidebarPanel:d.sidebarPanel,themeMode:d.themeMode}))),t=jn(),n=Qe[e.themeMode],r=p.useRef({}),o=e.mainView==="block_studio"||e.mainView==="imports",[i,a]=p.useState(!1),[c,l]=p.useState(null);p.useEffect(()=>{let d=!0;return B.getSetupLaunch().then(f=>{d&&(l(f),f.shouldOpen&&t({type:"OPEN_SETUP"}))}).catch(()=>{}),()=>{d=!1}},[t]),p.useEffect(()=>{const d=()=>t({type:"SET_MAIN_VIEW",view:"modeling"});return window.addEventListener("dql:open-context-proposal",d),()=>window.removeEventListener("dql:open-context-proposal",d)},[t]),p.useEffect(()=>{if(e.mainView==="domains"||e.mainView==="modeling"||e.mainView==="skills")return;const d=JC(window.location.href),f=`${window.location.pathname}${window.location.search}${window.location.hash}`;d!==f&&window.history.replaceState(window.history.state,"",d)},[e.mainView]),UC(),VC(),p.useEffect(()=>{const d=f=>{(f.metaKey||f.ctrlKey)&&f.key.toLowerCase()==="k"&&!f.shiftKey&&(f.preventDefault(),a(m=>!m)),(f.metaKey||f.ctrlKey)&&f.shiftKey&&f.key.toLowerCase()==="i"&&(f.preventDefault(),t({type:"TOGGLE_INSPECTOR"}))};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[t]);const u=p.useCallback(async d=>{try{if(d.type==="term"||d.type==="business_view"){e.sidebarPanel!=="files"&&t({type:"SET_SIDEBAR_PANEL",panel:"files"}),t({type:"OPEN_BUSINESS_ARTIFACT",file:d});return}if(d.type==="block"){const j=await B.openBlockStudio(d.path);t({type:"OPEN_BLOCK_STUDIO",file:d,payload:j});return}const{content:f}=await B.readNotebook(d.path),{title:m,cells:S,metadata:v}=N1(d.path,f),b=d.path.endsWith(".dqlnb")?await B.fetchRunSnapshot(d.path):null;let w=S;if(b!=null&&b.found&&b.snapshot){const j=new Map(b.snapshot.cells.map(C=>[C.cellId,C]));w=S.map(C=>{const x=j.get(C.id);return x?{...C,status:x.status??C.status,result:x.result??C.result,error:x.error??C.error,executionCount:x.executionCount??C.executionCount,execution:x.execution??C.execution,fromSnapshot:x.result!=null}:C})}t({type:"OPEN_FILE",file:d,cells:w,title:m,metadata:v}),e.sidebarPanel!=="files"&&t({type:"SET_SIDEBAR_PANEL",panel:"files"})}catch(f){if(console.error("Failed to open file:",f),d.type==="block")try{const{content:m}=await B.readNotebook(d.path);t({type:"OPEN_BLOCK_STUDIO",file:d,payload:{path:d.path,source:m,companionPath:null,metadata:{name:d.name.replace(/\.dql$/i,""),path:d.path,domain:d.path.split("/").slice(1,-1).join("/")||"uncategorized",description:"",owner:"",tags:[]},validation:{valid:!1,diagnostics:[{severity:"warning",message:"Opened block without studio metadata. Save once to normalize it."}],semanticRefs:{metrics:[],dimensions:[],segments:[]}}}});return}catch(m){console.error("Failed to open block fallback:",m)}else t({type:"OPEN_FILE",file:d,cells:[Ra("sql")],title:d.name})}},[t,e.sidebarPanel]);p.useCallback(d=>{const f=r.current[d];f&&f.scrollIntoView({behavior:"smooth",block:"start"})},[]);const h=p.useCallback((d,f)=>{f?r.current[d]=f:delete r.current[d]},[]);return s.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100vh",width:"100vw",background:n.appBg,fontFamily:n.font,color:n.textPrimary,overflow:"hidden"},children:[s.jsx(MC,{}),s.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[e.appMode==="studio"&&s.jsx(Ww,{}),e.appMode==="studio"&&e.sidebarOpen&&!o&&s.jsx(_1,{onOpenFile:u}),s.jsx("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden",minWidth:0},children:s.jsx(p.Suspense,{fallback:s.jsx(vj,{t:n}),children:e.mainView==="home"?s.jsx(XC,{}):e.mainView==="ask"?s.jsx(ZC,{}):e.mainView==="business_artifact"?s.jsx(ij,{}):e.mainView==="lineage"?s.jsx("div",{style:{flex:1,minWidth:0,minHeight:0,display:"flex",flexDirection:"column",overflow:"hidden"},children:s.jsx(cj,{})}):e.mainView==="lineage_detail"?s.jsx(aj,{}):e.mainView==="help"?s.jsx(lj,{}):e.mainView==="connection"||e.mainView==="settings"?s.jsx(wj,{children:s.jsx(dj,{variant:"page"})}):e.mainView==="git"?s.jsx(uj,{}):e.mainView==="readiness"?s.jsx(pj,{}):e.mainView==="skills"?s.jsx(hj,{initialTab:"skills"}):e.mainView==="domains"||e.mainView==="modeling"?s.jsx(mj,{}):e.mainView==="apps"?s.jsx(gj,{}):e.mainView==="agent_log"?s.jsx(kj,{title:"Agent steps",description:"What the agent did to answer this question, and where the time went — route, tools, checks, and per-step timing.",children:s.jsx(fj,{})}):s.jsx(s.Fragment,{children:e.mainView==="imports"||e.mainView==="block_studio"?s.jsx(sj,{},"block-editor"):s.jsxs(s.Fragment,{children:[s.jsx(tj,{onOpenFile:u,registerCellRef:h}),e.appMode==="studio"&&s.jsx(zC,{})]})})})}),e.appMode==="studio"&&e.lineageDrawerOpen&&!e.lineageFullscreen&&!e.dashboardMode&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(yj,{})}),e.appMode==="studio"&&e.inspectorOpen&&!e.lineageFullscreen&&!e.lineageDrawerOpen&&!e.dashboardMode&&s.jsx(Pw,{}),e.globalAi.open&&e.mainView==="apps"&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(ej,{})})]}),e.newNotebookModalOpen&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(nj,{onFileOpened:u})}),e.newBlockModalOpen&&s.jsx(p.Suspense,{fallback:null,children:s.jsx(rj,{onFileOpened:u})}),s.jsx(ZS,{open:i,onClose:()=>a(!1)}),s.jsx(p.Suspense,{fallback:null,children:s.jsx(bj,{})}),e.setupOpen&&s.jsx(p.Suspense,{fallback:s.jsx(Sj,{t:n}),children:s.jsx(oj,{launch:c!=null&&c.shouldOpen?c:void 0,onAcknowledged:()=>l(d=>d&&{...d,shouldOpen:!1,reason:null})})})]})}function vj({t:e}){return s.jsx("div",{role:"status","aria-live":"polite",style:{flex:1,minWidth:0,display:"grid",placeItems:"center",background:e.appBg,color:e.textSecondary,fontFamily:e.font},children:s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,fontSize:12.5},children:[s.jsx("span",{style:{width:8,height:8,borderRadius:999,background:e.accent}}),"Loading workspace…"]})})}function Sj({t:e}){return s.jsx("div",{role:"status","aria-live":"polite",style:{position:"fixed",inset:0,zIndex:1100,display:"grid",placeItems:"center",background:e.appBg,color:e.textSecondary,fontFamily:e.font},children:s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,fontSize:12.5},children:[s.jsx("span",{style:{width:8,height:8,borderRadius:999,background:e.accent}}),"Checking workspace setup…"]})})}function wj({children:e}){return s.jsx("div",{style:{flex:1,minWidth:0,overflow:"auto"},children:s.jsx("div",{style:{maxWidth:1120,margin:"0 auto",padding:"18px 28px 32px"},children:e})})}function kj({title:e,description:t,children:n}){return s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",minWidth:0,overflow:"hidden"},children:[s.jsxs("div",{style:{padding:"18px 24px 12px",borderBottom:"1px solid rgba(127, 127, 127, 0.16)"},children:[s.jsx("div",{style:{fontSize:22,fontWeight:700},children:e}),s.jsx("div",{style:{fontSize:13,opacity:.72,marginTop:6,maxWidth:760,lineHeight:1.5},children:t})]}),s.jsx("div",{style:{flex:1,minHeight:0,overflow:"auto"},children:n})]})}function Cj(){const e=jn(),t=Yi(),n=p.useRef(null);p.useEffect(()=>{let r=!0,o=null,i=null,a=null,c=null;const l=()=>{i&&clearTimeout(i),i=setTimeout(()=>{i=null,B.listNotebooks().then(f=>{r&&(t.setQueryData(["notebooks"],f),e({type:"SET_FILES",files:f}))}).catch(()=>{})},150)},u=()=>{a&&clearTimeout(a),a=setTimeout(()=>{a=null,B.getDomains().then(({domains:f})=>{r&&(t.setQueryData(["authored-domains"],{domains:f}),e({type:"SET_AUTHORED_DOMAINS",domains:f}))}).catch(()=>{})},150)},h=()=>{c&&clearTimeout(c),c=setTimeout(()=>{c=null,e({type:"SET_SEMANTIC_LOADING",loading:!0}),B.getSemanticLayer().then(f=>{r&&(t.setQueryData(["semantic-layer"],f),e({type:"SET_SEMANTIC_LAYER",layer:f}))}).catch(()=>{})},100)},d=()=>{if(!r)return;const f=new AbortController;n.current=f,Ep("/api/watch",m=>{if(m.event==="change")try{const S=JSON.parse(m.data);if(S.type==="file-added"||S.type==="file-deleted"||S.type==="file-changed"){const v=S.path??"";/^(?:notebooks|workbooks|blocks|skills|apps|dashboards)\//.test(v)&&l(),v.startsWith("domains/")&&(l(),u())}S.type==="semantic-reload"&&h()}catch{}},f.signal).catch(()=>{!r||f.signal.aborted||(o&&clearTimeout(o),o=setTimeout(d,5e3))})};return d(),()=>{var f;r=!1,o&&clearTimeout(o),i&&clearTimeout(i),a&&clearTimeout(a),c&&clearTimeout(c),(f=n.current)==null||f.abort(),n.current=null}},[e,t])}const jj=new ah({defaultOptions:{queries:{staleTime:15e3,gcTime:5*6e4,retry:1,refetchOnWindowFocus:!1}}});function Ej(){const e=Ge(i=>i.themeMode),t=Ge(i=>i.dispatch),n=Qe[e];p.useEffect(()=>{const i="dql-global-styles";let a=document.getElementById(i);a||(a=document.createElement("style"),a.id=i,document.head.appendChild(a)),a.textContent=`
|
|
611
611
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
612
612
|
body {
|
|
613
613
|
font-family: var(--font-ui, ${n.font});
|
package/dist/assets/dql-notebook/assets/{semantic-fields-Ci-9QL9F.js → semantic-fields-CNOGysAy.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as x,j as l,t as k,R as y}from"./index-
|
|
1
|
+
import{r as x,j as l,t as k,R as y}from"./index-DKo-bwNw.js";import{c as S,i as j}from"./usePersistedAgentThreadId-C4foXeiQ.js";function w(o,t){const n=o.split(`
|
|
2
2
|
`),s=[];let e=0;for(;e<n.length;){const a=n[e],d=a.match(/^(#{1,6})\s+(.+)$/);if(d){const i=d[1].length,h=d[2],c=[28,22,18,16,14,13][i-1];s.push(l.jsx("div",{style:{fontSize:c,fontWeight:i<=2?700:600,color:t.textPrimary,fontFamily:t.font,lineHeight:1.3,marginBottom:i===1?12:8,marginTop:e>0?i===1?16:10:0,borderBottom:i===1?`1px solid ${t.cellBorder}`:void 0,paddingBottom:i===1?8:void 0},children:p(h,t)},e)),e++;continue}if(/^[-*_]{3,}$/.test(a.trim())){s.push(l.jsx("hr",{style:{border:"none",borderTop:`1px solid ${t.cellBorder}`,margin:"12px 0"}},e)),e++;continue}if(a.startsWith("> ")){s.push(l.jsx("div",{style:{borderLeft:`3px solid ${t.textMuted}`,paddingLeft:12,marginLeft:4,color:t.textSecondary,fontStyle:"italic",fontFamily:t.fontSerif,fontSize:14},children:p(a.slice(2),t)},e)),e++;continue}if(a.startsWith("```")){const i=[];for(e++;e<n.length&&!n[e].startsWith("```");)i.push(n[e]),e++;s.push(l.jsx("pre",{style:{background:"var(--color-bg-surface)",border:"1px solid var(--color-border-subtle)",borderRadius:6,padding:"10px 12px",fontSize:12,fontFamily:"var(--font-mono)",color:"var(--color-text-primary)",overflow:"auto",margin:"8px 0",lineHeight:1.6},children:i.join(`
|
|
3
3
|
`)},e)),e++;continue}if(/^[-*+]\s/.test(a)){const i=e,h=[];for(;e<n.length&&/^[-*+]\s/.test(n[e]);)h.push(n[e].replace(/^[-*+]\s/,"")),e++;s.push(l.jsx("ul",{style:{paddingLeft:20,marginBottom:8,color:t.textSecondary},children:h.map((m,c)=>l.jsx("li",{style:{fontSize:14,fontFamily:t.font,lineHeight:1.6,marginBottom:2},children:p(m,t)},c))},`ul-${i}`));continue}if(/^\d+\.\s/.test(a)){const i=e,h=[];for(;e<n.length&&/^\d+\.\s/.test(n[e]);)h.push(n[e].replace(/^\d+\.\s/,"")),e++;s.push(l.jsx("ol",{style:{paddingLeft:20,marginBottom:8,color:t.textSecondary},children:h.map((m,c)=>l.jsx("li",{style:{fontSize:14,fontFamily:t.font,lineHeight:1.6,marginBottom:2},children:p(m,t)},c))},`ol-${i}`));continue}if(!a.trim()){s.push(l.jsx("div",{style:{height:8}},e)),e++;continue}s.push(l.jsx("p",{style:{fontSize:14,lineHeight:1.7,fontFamily:t.fontSerif,color:t.textSecondary,marginBottom:6},children:p(a,t)},e)),e++}return s}function p(o,t){const n=[];let s=o,e=0;for(;s.length>0;){const a=s.match(/\*{3}(.+?)\*{3}/),d=s.match(/\*{2}(.+?)\*{2}/),i=s.match(/\*(.+?)\*/),h=s.match(/`(.+?)`/),m=s.match(/\[(.+?)\]\((.+?)\)/),c=[a?{match:a,type:"boldItalic"}:null,d?{match:d,type:"bold"}:null,i?{match:i,type:"italic"}:null,h?{match:h,type:"code"}:null,m?{match:m,type:"link"}:null].filter(Boolean);if(c.length===0){n.push(l.jsx(y.Fragment,{children:s},e++));break}const r=c.reduce((u,g)=>(u.match.index??0)<(g.match.index??0)?u:g),f=r.match.index??0;switch(f>0&&n.push(l.jsx(y.Fragment,{children:s.slice(0,f)},e++)),r.type){case"boldItalic":n.push(l.jsx("strong",{style:{fontStyle:"italic"},children:r.match[1]},e++));break;case"bold":n.push(l.jsx("strong",{children:r.match[1]},e++));break;case"italic":n.push(l.jsx("em",{children:r.match[1]},e++));break;case"code":n.push(l.jsx("code",{style:{background:"var(--color-bg-surface)",border:"1px solid var(--color-border-subtle)",borderRadius:4,padding:"1px 5px",fontSize:"0.9em",fontFamily:"var(--font-mono)",color:"var(--color-accent-blue)"},children:r.match[1]},e++));break;case"link":n.push(l.jsx("a",{href:r.match[2],target:"_blank",rel:"noopener noreferrer",style:{color:t.accent,textDecoration:"underline"},children:r.match[1]},e++));break}s=s.slice(f+r.match[0].length)}return l.jsx(l.Fragment,{children:n})}function z({value:o,onChange:t,onRun:n,themeMode:s}){const e=k[s],[a,d]=x.useState(!1),i=x.useRef(null);x.useEffect(()=>{if(a&&i.current){i.current.focus();const r=i.current;r.style.height="auto",r.style.height=`${Math.max(r.scrollHeight,80)}px`}},[a]);const h=()=>{d(!1)},m=r=>{if(r.key==="Escape"&&d(!1),r.key==="Enter"&&r.shiftKey&&(r.preventDefault(),d(!1),n==null||n()),r.key==="Tab"){r.preventDefault();const f=r.currentTarget,u=f.selectionStart,g=f.selectionEnd,b=o.slice(0,u)+" "+o.slice(g);t(b),requestAnimationFrame(()=>{f.selectionStart=f.selectionEnd=u+2})}},c=r=>{t(r.target.value);const f=r.target;f.style.height="auto",f.style.height=`${Math.max(f.scrollHeight,80)}px`};return a?l.jsx("textarea",{ref:i,value:o,onChange:c,onBlur:h,onKeyDown:m,placeholder:"Write markdown here...",spellCheck:!1,style:{display:"block",width:"100%",minHeight:80,padding:"12px 16px",background:e.editorBg,color:e.textPrimary,border:"none",outline:"none",resize:"none",fontFamily:e.fontMono,fontSize:13,lineHeight:"20px",borderRadius:0,caretColor:e.accent}}):o.trim()?l.jsx("div",{onDoubleClick:()=>d(!0),title:"Double-click to edit",style:{padding:"12px 16px",cursor:"text",minHeight:48},children:w(o,e)}):l.jsx("div",{onDoubleClick:()=>d(!0),style:{padding:"12px 16px",color:e.textMuted,fontFamily:e.font,fontSize:13,fontStyle:"italic",cursor:"text",minHeight:48,display:"flex",alignItems:"center"},children:"Double-click to add markdown..."})}function F(o){var h,m;if(!o)return{metrics:[],dimensions:[],columns:[],fields:[],hasSemanticBinding:!1};const t=new Set(((h=o.semanticRefs)==null?void 0:h.metrics)??[]),n=new Set(((m=o.semanticRefs)==null?void 0:m.dimensions)??[]),s=t.size>0||n.size>0,e=[],a=[],d=[],i=[];for(const c of o.columns)t.has(c)?(e.push(c),i.push({name:c,kind:"metric"})):n.has(c)&&(a.push(c),i.push({name:c,kind:"dimension"}));for(const c of o.columns)t.has(c)||n.has(c)||(d.push(c),i.push({name:c,kind:"column",chartRole:S(j(c,o.rows))}));return{metrics:e,dimensions:a,columns:d,fields:i,hasSemanticBinding:s}}function H(o){return o==="metric"?"#":o==="dimension"?"∴":"A"}function M(o,t){return o==="metric"?t:o==="dimension"?"#e3b341":"#56d364"}function C(o){return o==="metric"?"metric":o==="dimension"?"dimension":"column"}export{z as M,M as a,C as b,F as c,H as f,w as r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{R as te,j as r,b8 as Ye,c as le,r as R,t as q,u as Ht,a as Ot,b9 as Ze,L as qt,f as Ut,l as Vt,S as Ge,d as Qt,e as Yt}from"./index-
|
|
1
|
+
import{R as te,j as r,b8 as Ye,c as le,r as R,t as q,u as Ht,a as Ot,b9 as Ze,L as qt,f as Ut,l as Vt,S as Ge,d as Qt,e as Yt}from"./index-DKo-bwNw.js";import{T as Zt}from"./TrustBadge-zm6g_SxZ.js";import{R as Gt,G as Xt}from"./AiBuildResult-B4yfGTTZ.js";import{W as Kt}from"./wrench-DovaG_ze.js";const Jt={value:"Value",block:"Certified block",term:"Business term",metric:"Metric",dimension:"Dimension",model:"dbt model",source:"Source table",consumer:"Used by"};function Xe(e){const t=(e??"").toLowerCase();return t==="certified"?"success":t==="deprecated"?"neutral":t.includes("review")||t==="draft"||t==="pending"?"warning":"neutral"}function Ct({walk:e,defaultOpen:t=!1,triggerLabel:n}){const[o,i]=te.useState(t),s=Math.min(e.steps.length,2),[l,c]=te.useState(s),a=()=>c(s),d=e.steps.slice(0,l),u=e.steps.length-l;return r.jsxs("div",{style:{border:"1px solid var(--border-subtle, rgba(127,127,127,0.25))",borderRadius:8,background:"var(--bg-1, transparent)",overflow:"hidden"},children:[r.jsxs("button",{type:"button","aria-expanded":o,onClick:()=>{i(f=>!f),o&&a()},style:{width:"100%",display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,border:0,background:"transparent",color:"var(--text-secondary, inherit)",cursor:"pointer",padding:"8px 11px",font:"inherit",fontSize:12,fontWeight:700},children:[r.jsxs("span",{style:{display:"flex",alignItems:"center",gap:7},children:[r.jsx("span",{"aria-hidden":!0,style:{transform:o?"rotate(90deg)":"none",transition:"transform 120ms",display:"inline-block"},children:"▸"}),n??"Why?"]}),r.jsx("span",{style:{fontSize:11,color:"var(--text-tertiary, inherit)",fontWeight:600},children:o?"Hide derivation":"Show how this was derived"})]}),o&&r.jsxs("div",{style:{padding:"2px 11px 11px",display:"flex",flexDirection:"column",gap:10},children:[r.jsx("div",{style:{fontSize:12.5,lineHeight:1.5,color:"var(--text-primary, inherit)"},children:e.summary}),(e.trustLabel||e.freshness)&&r.jsxs("div",{style:{display:"flex",gap:6,flexWrap:"wrap",alignItems:"center"},children:[e.trustLabel&&r.jsx(Ye,{tone:Xe(e.trustLabel),children:Ke(e.trustLabel)}),e.freshness&&r.jsxs("span",{style:{fontSize:11,color:"var(--text-tertiary, inherit)"},children:["Fresh as of ",en(e.freshness)]})]}),r.jsx("ol",{style:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:7},children:d.map((f,h)=>r.jsxs("li",{style:{display:"flex",gap:9,alignItems:"flex-start",paddingLeft:2},children:[r.jsx("span",{"aria-hidden":!0,style:{marginTop:3,width:7,height:7,borderRadius:999,flexShrink:0,background:"var(--accent, currentColor)",opacity:.7}}),r.jsxs("div",{style:{minWidth:0,display:"flex",flexDirection:"column",gap:2},children:[r.jsxs("div",{style:{display:"flex",gap:6,alignItems:"center",flexWrap:"wrap"},children:[r.jsx("span",{style:{fontSize:10,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--text-tertiary, inherit)"},children:Jt[f.kind]}),r.jsx("span",{style:{fontSize:12.5,fontWeight:700,color:"var(--text-primary, inherit)",overflowWrap:"anywhere"},children:f.name}),f.status&&r.jsx(Ye,{tone:Xe(f.status),children:Ke(f.status)})]}),(f.owner||f.detail)&&r.jsxs("div",{style:{fontSize:11.5,color:"var(--text-secondary, inherit)",lineHeight:1.45},children:[f.owner&&r.jsxs("span",{children:["Owner: ",f.owner,". "]}),f.detail]})]})]},`${f.kind}-${f.name}-${h}`))}),u>0&&r.jsxs("button",{type:"button",onClick:()=>c(f=>Math.min(e.steps.length,f+1)),style:{alignSelf:"flex-start",border:"1px solid var(--border-default, rgba(127,127,127,0.3))",borderRadius:6,background:"transparent",color:"var(--accent, inherit)",cursor:"pointer",padding:"4px 9px",fontSize:11,fontWeight:700},children:["Show next step (",u," more)"]}),e.caveats&&e.caveats.length>0&&r.jsxs("div",{style:{borderLeft:"3px solid var(--status-warning, #d29922)",background:"var(--status-warning-bg, rgba(210,153,34,0.08))",borderRadius:6,padding:"8px 10px",display:"flex",flexDirection:"column",gap:4},children:[r.jsx("span",{style:{fontSize:10,fontWeight:800,textTransform:"uppercase",letterSpacing:"0.04em",color:"var(--status-warning, inherit)"},children:"Caveats"}),e.caveats.map((f,h)=>r.jsx("span",{style:{fontSize:11.5,color:"var(--text-secondary, inherit)",lineHeight:1.45},children:f},h))]})]})]})}function Ke(e){return e.replace(/[_-]+/g," ").replace(/\b\w/g,t=>t.toUpperCase())}function en(e){const t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString()}/**
|
|
2
2
|
* @license lucide-react v0.563.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&family=Kalam:wght@400;700&family=Caveat:wght@400;600;700&display=swap" rel="stylesheet" />
|
|
10
|
-
<script type="module" crossorigin src="/assets/index-
|
|
10
|
+
<script type="module" crossorigin src="/assets/index-DKo-bwNw.js"></script>
|
|
11
11
|
<link rel="modulepreload" crossorigin href="/assets/react-CRB3T2We.js">
|
|
12
12
|
<link rel="stylesheet" crossorigin href="/assets/index-B3shyZsg.css">
|
|
13
13
|
</head>
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { dirname } from 'node:path';
|
|
2
|
+
import type { AgentMessage, AgentProvider } from '@duckcodeailabs/dql-agent';
|
|
3
|
+
export type CassetteMode = 'record' | 'replay' | 'live';
|
|
4
|
+
/** One recorded tool call, so replay can re-run it against the live tools. */
|
|
5
|
+
export interface CassetteToolCall {
|
|
6
|
+
name: string;
|
|
7
|
+
args: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface CassetteEntry {
|
|
10
|
+
key: string;
|
|
11
|
+
operation: 'generate' | 'generate_with_tools';
|
|
12
|
+
/** Non-secret provenance, so a stale cassette is identifiable by eye. */
|
|
13
|
+
recordedAt: string;
|
|
14
|
+
providerName: string;
|
|
15
|
+
/** The model's final text. */
|
|
16
|
+
text: string;
|
|
17
|
+
/** Tool calls the model made, in order (generate_with_tools only). */
|
|
18
|
+
toolCalls?: CassetteToolCall[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Stable key for one provider dispatch.
|
|
22
|
+
*
|
|
23
|
+
* Deliberately includes the full message list: the prompt IS the input, and two
|
|
24
|
+
* turns that differ only in retrieved context are genuinely different calls.
|
|
25
|
+
* Tool NAMES are included but not their schemas — a description edit should not
|
|
26
|
+
* invalidate every cassette in the suite.
|
|
27
|
+
*/
|
|
28
|
+
export declare function cassetteKey(input: {
|
|
29
|
+
providerName: string;
|
|
30
|
+
operation: CassetteEntry['operation'];
|
|
31
|
+
messages: AgentMessage[];
|
|
32
|
+
toolNames?: string[];
|
|
33
|
+
options?: {
|
|
34
|
+
reasoningEffort?: unknown;
|
|
35
|
+
maxTokens?: unknown;
|
|
36
|
+
temperature?: unknown;
|
|
37
|
+
} | undefined;
|
|
38
|
+
}): string;
|
|
39
|
+
export declare class CassetteStore {
|
|
40
|
+
private readonly dir;
|
|
41
|
+
private readonly loaded;
|
|
42
|
+
constructor(dir: string);
|
|
43
|
+
get(key: string): CassetteEntry | undefined;
|
|
44
|
+
put(entry: CassetteEntry): void;
|
|
45
|
+
size(): number;
|
|
46
|
+
}
|
|
47
|
+
export declare class CassetteMissError extends Error {
|
|
48
|
+
readonly key: string;
|
|
49
|
+
constructor(key: string, operation: string);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Wrap a provider so its dispatches are recorded or replayed.
|
|
53
|
+
*
|
|
54
|
+
* On replay of a tool loop the recorded tool calls are RE-INVOKED against the
|
|
55
|
+
* live tools rather than stubbed. The model's choices stay frozen (that is the
|
|
56
|
+
* point), but compilation, validation, and execution still really happen — so
|
|
57
|
+
* the suite keeps catching a broken compiler or a wrong number, which a fully
|
|
58
|
+
* stubbed replay would sail straight past.
|
|
59
|
+
*/
|
|
60
|
+
export declare function withCassette(provider: AgentProvider, store: CassetteStore, mode: CassetteMode): AgentProvider;
|
|
61
|
+
/**
|
|
62
|
+
* Pick the cassette mode from the environment.
|
|
63
|
+
*
|
|
64
|
+
* Defaults to `replay` for ANY value that is not explicitly `record` or `live`,
|
|
65
|
+
* including a missing or misspelled one. If someone sets the cassette directory
|
|
66
|
+
* in CI and forgets the mode, the safe outcome is "never call a live model",
|
|
67
|
+
* not a surprise bill and a non-deterministic suite.
|
|
68
|
+
*/
|
|
69
|
+
export declare function resolveCassetteModeFromEnv(env: Record<string, string | undefined>): CassetteMode;
|
|
70
|
+
/** Where a project's eval cassettes live. */
|
|
71
|
+
export declare function cassetteDirFor(projectRoot: string, suiteName: string): string;
|
|
72
|
+
export { dirname as _dirname };
|
|
73
|
+
//# sourceMappingURL=agent-eval-cassette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-eval-cassette.d.ts","sourceRoot":"","sources":["../../src/commands/agent-eval-cassette.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,OAAO,EAAQ,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EAId,MAAM,2BAA2B,CAAC;AAEnC,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAExD,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,UAAU,GAAG,qBAAqB,CAAC;IAC9C,yEAAyE;IACzE,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAChC;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;IACtC,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,OAAO,CAAC;QAAC,SAAS,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,SAAS,CAAC;CACjG,GAAG,MAAM,CAWT;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;IAC7B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAoC;gBAE/C,GAAG,EAAE,MAAM;IAevB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS;IAI3C,GAAG,CAAC,KAAK,EAAE,aAAa,GAAG,IAAI;IAM/B,IAAI,IAAI,MAAM;CAGf;AAED,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;gBACT,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAQ3C;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,aAAa,EACpB,IAAI,EAAE,YAAY,GACjB,aAAa,CAiEf;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,YAAY,CAGhG;AAED,6CAA6C;AAC7C,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAG7E;AAED,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,CAAC"}
|