@duckcodeailabs/dql-cli 1.12.9 → 1.12.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/assets/dql-notebook/assets/{AgentAnswerCard-DbI0CAsX.js → AgentAnswerCard-CpL2kDCV.js} +1 -1
  2. package/dist/assets/dql-notebook/assets/{AgentLogPage-BbMhuJps.js → AgentLogPage-hzHqpD3-.js} +1 -1
  3. package/dist/assets/dql-notebook/assets/{AiBuildDialog-DNgkam6H.js → AiBuildDialog-BQRWoxp9.js} +1 -1
  4. package/dist/assets/dql-notebook/assets/AiBuildResult-D9t_4sQl.js +33 -0
  5. package/dist/assets/dql-notebook/assets/{AiSidePanel-D-EhCOEd.js → AiSidePanel-BCQB9rVF.js} +1 -1
  6. package/dist/assets/dql-notebook/assets/{AnalyticsHome-BTjkolBn.js → AnalyticsHome-Ba4Ve_Gd.js} +1 -1
  7. package/dist/assets/dql-notebook/assets/AppsView-CdAT9BOq.js +4466 -0
  8. package/dist/assets/dql-notebook/assets/{BlockStudio-DTFHMR3y.js → BlockStudio-Brg4fwn5.js} +13 -13
  9. package/dist/assets/dql-notebook/assets/{BusinessArtifactView-DGiHB7OS.js → BusinessArtifactView-CnTbFVGT.js} +1 -1
  10. package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-CQe2FUZq.js +22 -0
  11. package/dist/assets/dql-notebook/assets/{GitPage-BWzPKyws.js → GitPage-DHyDBChc.js} +1 -1
  12. package/dist/assets/dql-notebook/assets/{GlobalAiRail-CGvBUci2.js → GlobalAiRail-Cys4n_rq.js} +1 -1
  13. package/dist/assets/dql-notebook/assets/GovernedContextPage-DyKoDSZ2.js +7 -0
  14. package/dist/assets/dql-notebook/assets/{HelpDocsPage-C7IX_7xh.js → HelpDocsPage-CL0vbSER.js} +3 -3
  15. package/dist/assets/dql-notebook/assets/{HomePage-e0CObjOb.js → HomePage-DzAucwBW.js} +9 -4
  16. package/dist/assets/dql-notebook/assets/{LineageDAG-DV6T_0ha.js → LineageDAG-QHqd_AM5.js} +1 -1
  17. package/dist/assets/dql-notebook/assets/{LineageDetailView-ZVJiCqua.js → LineageDetailView-DdVH-nz6.js} +1 -1
  18. package/dist/assets/dql-notebook/assets/{LineageDrawer-DQdzGIoL.js → LineageDrawer-BvrVZNKY.js} +1 -1
  19. package/dist/assets/dql-notebook/assets/LineagePathBreadcrumb-CSut-zvm.js +14 -0
  20. package/dist/assets/dql-notebook/assets/{MiniLineageGraph-BlJYiAY0.js → MiniLineageGraph-zg_1wW3M.js} +1 -1
  21. package/dist/assets/dql-notebook/assets/NewBlockModal-9cDletl-.js +1 -0
  22. package/dist/assets/dql-notebook/assets/NewNotebookModal-V6de8L4d.js +46 -0
  23. package/dist/assets/dql-notebook/assets/NotebookEditor-EZ0pfWVs.js +200 -0
  24. package/dist/assets/dql-notebook/assets/{ReadinessPage-m8jlEKzQ.js → ReadinessPage-BaGvjyfd.js} +1 -1
  25. package/dist/assets/dql-notebook/assets/{SetupOnboarding-ClldPV4C.js → SetupOnboarding-Bg-MjbC9.js} +2 -2
  26. package/dist/assets/dql-notebook/assets/{TrustBadge-C0FyL1ZO.js → TrustBadge-DGuHB8kP.js} +1 -1
  27. package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-BlWAVEwO.js +83 -0
  28. package/dist/assets/dql-notebook/assets/{answer-to-notebook-CgVDBH0o.js → answer-to-notebook-BDzY4MuQ.js} +1 -1
  29. package/dist/assets/dql-notebook/assets/{arrow-left-XTRkwgdW.js → arrow-left-IjlnAihE.js} +1 -1
  30. package/dist/assets/dql-notebook/assets/{arrow-right-BUYb7B8y.js → arrow-right-BI4cXgOY.js} +2 -2
  31. package/dist/assets/dql-notebook/assets/{book-open-text-CQHKAXcN.js → book-open-text-i6xhxu_I.js} +1 -1
  32. package/dist/assets/dql-notebook/assets/{bot-D9ODKCwi.js → bot-C6DE7Q6m.js} +1 -1
  33. package/dist/assets/dql-notebook/assets/{chevron-up-BR57nCns.js → chevron-up-DSEILnDs.js} +2 -2
  34. package/dist/assets/dql-notebook/assets/{circle-x-B3MKf4hs.js → circle-x-BoAorVSm.js} +1 -1
  35. package/dist/assets/dql-notebook/assets/{codemirror-1_I9gm6Z.js → codemirror-DXt7RW72.js} +1 -1
  36. package/dist/assets/dql-notebook/assets/{dagre.esm-BWViOEog.js → dagre.esm-CycymVj6.js} +1 -1
  37. package/dist/assets/dql-notebook/assets/{external-link-D2rxGhQ_.js → external-link-ZwE5iHsX.js} +1 -1
  38. package/dist/assets/dql-notebook/assets/{grip-vertical-Bzs7bIWP.js → grip-vertical-Dnp2st8l.js} +1 -1
  39. package/dist/assets/dql-notebook/assets/index-BTuliKhK.js +634 -0
  40. package/dist/assets/dql-notebook/assets/{link-2-D6nW0_qQ.js → link-2-CTKe6Snr.js} +2 -2
  41. package/dist/assets/dql-notebook/assets/{list-tree-MH5kYamM.js → list-tree-Ced8e_S1.js} +1 -1
  42. package/dist/assets/dql-notebook/assets/{maximize-2-C3bEmsdA.js → maximize-2-Cojc6867.js} +1 -1
  43. package/dist/assets/dql-notebook/assets/{minimize-2-cji4jKmJ.js → minimize-2-CBIAE0XH.js} +1 -1
  44. package/dist/assets/dql-notebook/assets/{panel-right-open-T-_o8FS9.js → panel-right-open-po3bWSeL.js} +2 -2
  45. package/dist/assets/dql-notebook/assets/{pencil-BzJ_vZuL.js → pencil-Cb45c6WU.js} +2 -2
  46. package/dist/assets/dql-notebook/assets/{rotate-ccw-CqSfrg2J.js → rotate-ccw-B9v1LTJ0.js} +2 -2
  47. package/dist/assets/dql-notebook/assets/{semantic-fields-BXNCrm72.js → semantic-fields-B6ii0an0.js} +1 -1
  48. package/dist/assets/dql-notebook/assets/{star-C22MG8pV.js → star-CO4tfaDq.js} +2 -2
  49. package/dist/assets/dql-notebook/assets/{triangle-alert-BtoT0VL-.js → triangle-alert-BSdIu2El.js} +1 -1
  50. package/dist/assets/dql-notebook/assets/{usePersistedAgentThreadId-BL9P0gFB.js → usePersistedAgentThreadId-CkVFrrjk.js} +2 -2
  51. package/dist/assets/dql-notebook/assets/{user-round-CpifcAyh.js → user-round-BfrV8U-W.js} +3 -3
  52. package/dist/assets/dql-notebook/assets/{wand-sparkles-BiOywrQh.js → wand-sparkles-BgTxZNBc.js} +1 -1
  53. package/dist/assets/dql-notebook/assets/{workflow-DDvVMZ2B.js → workflow--2ycp0yy.js} +2 -2
  54. package/dist/assets/dql-notebook/assets/{wrench-CoKg2kyO.js → wrench-LMCrpa9_.js} +1 -1
  55. package/dist/assets/dql-notebook/assets/{x-CCmr0LQ8.js → x-CeNgQwGm.js} +2 -2
  56. package/dist/assets/dql-notebook/index.html +1 -1
  57. package/dist/local-runtime.d.ts +90 -2
  58. package/dist/local-runtime.d.ts.map +1 -1
  59. package/dist/local-runtime.js +1005 -152
  60. package/dist/local-runtime.js.map +1 -1
  61. package/dist/package.json +10 -10
  62. package/package.json +10 -10
  63. package/dist/assets/dql-notebook/assets/AiBuildResult-BuTao779.js +0 -33
  64. package/dist/assets/dql-notebook/assets/AppsView-B3jlWoNm.js +0 -4466
  65. package/dist/assets/dql-notebook/assets/DbtFirstModelingPage-D-fv_dS2.js +0 -22
  66. package/dist/assets/dql-notebook/assets/GovernedContextPage-CxkrtqyP.js +0 -7
  67. package/dist/assets/dql-notebook/assets/LineagePathBreadcrumb-6gFsnWlN.js +0 -14
  68. package/dist/assets/dql-notebook/assets/NewBlockModal-DaxBAFLu.js +0 -1
  69. package/dist/assets/dql-notebook/assets/NewNotebookModal-B7GPLsYc.js +0 -46
  70. package/dist/assets/dql-notebook/assets/NotebookEditor-RuxFQnQC.js +0 -202
  71. package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-Bd1qmRFx.js +0 -83
  72. package/dist/assets/dql-notebook/assets/index-CDpukm0G.js +0 -644
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duckcodeailabs/dql-cli",
3
- "version": "1.12.9",
3
+ "version": "1.12.11",
4
4
  "description": "Public CLI for parsing, formatting, testing, and certifying DQL blocks",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -25,15 +25,15 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@anthropic-ai/sdk": "^0.104.2",
28
- "@duckcodeailabs/dql-agent": "^1.12.9",
29
- "@duckcodeailabs/dql-compiler": "^1.12.9",
30
- "@duckcodeailabs/dql-connectors": "^1.12.9",
31
- "@duckcodeailabs/dql-core": "^1.12.9",
32
- "@duckcodeailabs/dql-governance": "^1.12.9",
33
- "@duckcodeailabs/dql-mcp": "^1.12.9",
34
- "@duckcodeailabs/dql-notebook": "^1.12.9",
35
- "@duckcodeailabs/dql-project": "^1.12.9",
36
- "@duckcodeailabs/dql-slack": "^1.12.9",
28
+ "@duckcodeailabs/dql-agent": "^1.12.11",
29
+ "@duckcodeailabs/dql-compiler": "^1.12.11",
30
+ "@duckcodeailabs/dql-connectors": "^1.12.11",
31
+ "@duckcodeailabs/dql-core": "^1.12.11",
32
+ "@duckcodeailabs/dql-governance": "^1.12.11",
33
+ "@duckcodeailabs/dql-mcp": "^1.12.11",
34
+ "@duckcodeailabs/dql-notebook": "^1.12.11",
35
+ "@duckcodeailabs/dql-project": "^1.12.11",
36
+ "@duckcodeailabs/dql-slack": "^1.12.11",
37
37
  "isomorphic-git": "^1.27.0",
38
38
  "js-yaml": "^4.1.0",
39
39
  "node-cron": "^3.0.3",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duckcodeailabs/dql-cli",
3
- "version": "1.12.9",
3
+ "version": "1.12.11",
4
4
  "description": "Public CLI for parsing, formatting, testing, and certifying DQL blocks",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -20,15 +20,15 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@anthropic-ai/sdk": "^0.104.2",
23
- "@duckcodeailabs/dql-agent": "^1.12.9",
24
- "@duckcodeailabs/dql-compiler": "^1.12.9",
25
- "@duckcodeailabs/dql-connectors": "^1.12.9",
26
- "@duckcodeailabs/dql-core": "^1.12.9",
27
- "@duckcodeailabs/dql-governance": "^1.12.9",
28
- "@duckcodeailabs/dql-mcp": "^1.12.9",
29
- "@duckcodeailabs/dql-notebook": "^1.12.9",
30
- "@duckcodeailabs/dql-project": "^1.12.9",
31
- "@duckcodeailabs/dql-slack": "^1.12.9",
23
+ "@duckcodeailabs/dql-agent": "^1.12.11",
24
+ "@duckcodeailabs/dql-compiler": "^1.12.11",
25
+ "@duckcodeailabs/dql-connectors": "^1.12.11",
26
+ "@duckcodeailabs/dql-core": "^1.12.11",
27
+ "@duckcodeailabs/dql-governance": "^1.12.11",
28
+ "@duckcodeailabs/dql-mcp": "^1.12.11",
29
+ "@duckcodeailabs/dql-notebook": "^1.12.11",
30
+ "@duckcodeailabs/dql-project": "^1.12.11",
31
+ "@duckcodeailabs/dql-slack": "^1.12.11",
32
32
  "isomorphic-git": "^1.27.0",
33
33
  "js-yaml": "^4.1.0",
34
34
  "node-cron": "^3.0.3",
@@ -1,33 +0,0 @@
1
- import{g as M,u as U,r as f,a as D,j as t,B as Q,t as Ce,S as V,L as se,ai as Be,e as K,c as oe,T as re,b as le,d as ae,R as de}from"./index-CDpukm0G.js";import{U as ce,G as pe}from"./user-round-CpifcAyh.js";import{T as ue}from"./triangle-alert-BtoT0VL-.js";import{R as Y}from"./rotate-ccw-CqSfrg2J.js";/**
2
- * @license lucide-react v0.563.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const Fe=[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Me=M("badge-check",Fe);/**
7
- * @license lucide-react v0.563.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const Re=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],fe=M("file-code-corner",Re);/**
12
- * @license lucide-react v0.563.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const Le=[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]],$e=M("git-compare-arrows",Le);/**
17
- * @license lucide-react v0.563.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const _e=[["path",{d:"m15 12-9.373 9.373a1 1 0 0 1-3.001-3L12 9",key:"1hayfq"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172v-.344a2 2 0 0 0-.586-1.414l-1.657-1.657A6 6 0 0 0 12.516 3H9l1.243 1.243A6 6 0 0 1 12 8.485V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"15ts47"}]],De=M("hammer",_e);/**
22
- * @license lucide-react v0.563.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const Ie=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],xe=M("square-pen",Ie);/**
27
- * @license lucide-react v0.563.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const Ee=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]],A=M("square-plus",Ee),Pe={cell:"Cell",block:"Block"};function it({themeMode:e,initialTarget:n="cell",lockTarget:i=!1,initialPrompt:d="",context:r,onInsertCell:p,onOpenBlock:o,quickActions:u,initialMode:x="create",initialBlockPath:c}){const l=Ce[e],{dispatch:s}=U(),y=f.useCallback(()=>{s({type:"SET_MAIN_VIEW",view:"skills"})},[s]),[g,R]=f.useState(x==="edit"?"block":n),[k,L]=f.useState(d),[z,v]=f.useState("idle"),[m,j]=f.useState(null),[W,b]=f.useState(null),[C,Se]=f.useState(null),[ve,I]=f.useState(!1),T=f.useRef(""),[S,we]=f.useState(x),[B,X]=f.useState(c),[E,ze]=f.useState(void 0);f.useEffect(()=>{let a=!1;return D.getIdentity().then(h=>{!a&&(h!=null&&h.owner)&&Se(h.owner)}).catch(()=>{}),()=>{a=!0}},[]);const P=f.useCallback(async(a,h)=>{const O=a.trim();if(!O)return;const te=h==="block"&&S==="edit";if(!(te&&!B)){T.current=O,v("building"),b(null),I(!1);try{const _=await D.aiBuild({prompt:O,context:r,target:h,...C?{owner:C}:{},...h==="block"?{mode:S}:{},...te&&B?{blockPath:B}:{},...E?{domain:E}:{}});j(_),v("ready")}catch(_){b(_ instanceof Error&&_.message?_.message:"Could not build that. Try rewording the request."),j(null),v("error")}}},[r,C,S,B,E]),ee=f.useCallback(()=>{P(k,g)},[k,P,g]),We=f.useCallback(a=>{const h=a.target&&!i?a.target:g;a.target&&!i&&R(a.target),L(a.prompt),P(a.prompt,h)},[i,P,g]),H=f.useCallback(()=>{v("idle"),j(null),b(null),I(!1),!k.trim()&&T.current&&L(T.current)},[k]),$=f.useCallback(()=>{j(null),b(null),I(!1),v("idle")},[]),F=z==="building",q=g==="block"&&S==="edit",N=q&&!B;return t.jsx("div",{style:{display:"flex",flexDirection:"column",minHeight:0,height:"100%",overflow:"auto"},children:t.jsxs("div",{style:{padding:12,display:"grid",gap:10},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,flexWrap:"wrap"},children:[t.jsx("div",{role:"group","aria-label":"Build target",style:ne(l),children:["cell","block"].map(a=>{const h=g===a;return t.jsxs("button",{type:"button",disabled:i&&!h,onClick:()=>{i||(R(a),$())},"aria-pressed":h,style:ie(l,h,i&&!h),children:[a==="cell"?t.jsx(A,{size:13,strokeWidth:2}):t.jsx(Q,{size:13,strokeWidth:2}),Pe[a]]},a)})}),t.jsx("span",{style:{fontSize:11,color:l.textMuted,fontFamily:l.font},children:g==="cell"?"Create a review-required SQL preview for a notebook cell.":S==="edit"?"Rewrite an existing draft DQL block.":"Generate a reusable draft DQL block."}),C&&t.jsxs("span",{title:"Drafts are attributed to you",style:{marginLeft:"auto",display:"inline-flex",alignItems:"center",gap:5,fontSize:11,color:l.textMuted,fontFamily:l.font},children:[t.jsx(ce,{size:12,strokeWidth:2}),"drafting as ",C]})]}),g==="block"?t.jsx(Ve,{t:l,value:E,onChange:ze}):null,g==="block"?t.jsxs("div",{style:{display:"grid",gap:8},children:[t.jsx("div",{role:"group","aria-label":"Block build mode",style:ne(l),children:["create","edit"].map(a=>{const h=S===a;return t.jsxs("button",{type:"button",onClick:()=>{we(a),$(),a==="create"&&X(void 0)},"aria-pressed":h,style:ie(l,h,!1),children:[a==="create"?t.jsx(A,{size:13,strokeWidth:2}):t.jsx(xe,{size:13,strokeWidth:2}),a==="create"?"New block":"Modify existing"]},a)})}),S==="edit"?t.jsx(Ue,{t:l,selectedPath:B,onSelect:a=>{X(a),$()}}):null]}):null,u&&u.length>0?t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:u.map(a=>t.jsxs("button",{type:"button",disabled:F,onClick:()=>We(a),style:{...w(l),opacity:F?.6:1},children:[t.jsx(V,{size:12,strokeWidth:2})," ",a.label]},a.label))}):null,t.jsxs("div",{style:{display:"grid",gap:7},children:[t.jsx("textarea",{value:k,onChange:a=>L(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.metaKey||a.ctrlKey)&&(a.preventDefault(),ee())},rows:3,placeholder:g==="cell"?'Describe the preview SQL you want, e.g. "monthly revenue by region for the last 12 months".':S==="edit"?'Describe the change, e.g. "add a 12-month trailing window and exclude test accounts".':'Describe the reusable block, e.g. "active customers by signup cohort".',style:Ye(l)}),r!=null&&r.cellSql?t.jsxs("div",{style:{fontSize:10.5,color:l.textMuted,fontFamily:l.font},children:["Using the active SQL cell",r.selection?" and your selection":""," as context."]}):null,N?t.jsx("div",{style:{fontSize:10.5,color:l.textMuted,fontFamily:l.font},children:"Pick the block you want to modify above."}):null,t.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:t.jsxs("button",{type:"button",onClick:ee,disabled:F||!k.trim()||N,style:{...J(l),opacity:F||!k.trim()||N?.6:1},children:[F?t.jsx(se,{size:13,strokeWidth:2}):t.jsx(De,{size:13,strokeWidth:2}),F?q?"Updating…":"Building…":q?"Update block":"Build"]})})]}),z==="error"&&t.jsx(Ke,{t:l,message:W??"Could not build that.",onRefine:H}),z==="ready"&&(m==null?void 0:m.target)==="cell"&&t.jsx(Ae,{t:l,sql:m.sql,explanation:m.explanation,appliedSkills:m.appliedSkills,diagnostics:m.diagnostics,route:m.route,inserted:ve,onInsert:()=>{p==null||p(m.sql),I(!0)},onRefine:H,onDiscard:$,onOpenSkills:y}),z==="ready"&&(m==null?void 0:m.target)==="block"&&t.jsx(Te,{t:l,result:m,owner:C,editing:q,onOpen:()=>o==null?void 0:o(m.path,m.name),onRefine:H,onDiscard:$,onOpenSkills:y})]})})}function qe(){return{heading:"SQL preview",badge:"Review-required",guidance:"Use this as a notebook preview. For reusable governed analytics, promote the reviewed logic into a DQL draft.",insertLabel:"Insert preview",insertedLabel:"Preview inserted"}}function Ae({t:e,sql:n,explanation:i,appliedSkills:d,diagnostics:r,route:p,inserted:o,onInsert:u,onRefine:x,onDiscard:c,onOpenSkills:l}){const s=qe();return t.jsxs("section",{style:Z(e),children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[t.jsx(V,{size:14,strokeWidth:2,color:e.accent}),t.jsx("div",{style:{fontSize:12.5,fontWeight:800,color:e.textPrimary,fontFamily:e.font},children:s.heading}),t.jsx("span",{style:je(e),children:s.badge}),t.jsx(ge,{t:e,route:p})]}),i?t.jsx("div",{style:{fontSize:12,color:e.textSecondary,lineHeight:1.5,fontFamily:e.font},children:i}):null,t.jsx("div",{style:{fontSize:11.5,color:e.textMuted,lineHeight:1.45,fontFamily:e.font},children:s.guidance}),t.jsx(me,{t:e,code:n}),t.jsx(he,{t:e,skills:d,onOpenSkills:l}),t.jsx(ye,{t:e,diagnostics:r}),t.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[t.jsxs("button",{type:"button",onClick:u,disabled:o,style:{...J(e),opacity:o?.65:1},children:[o?t.jsx(K,{size:13,strokeWidth:2}):t.jsx(A,{size:13,strokeWidth:2}),o?s.insertedLabel:s.insertLabel]}),t.jsxs("button",{type:"button",onClick:x,style:w(e),children:[t.jsx(Y,{size:13,strokeWidth:2})," Refine"]}),t.jsxs("button",{type:"button",onClick:c,style:w(e),children:[t.jsx(re,{size:13,strokeWidth:2})," Discard"]})]})]})}function Te({t:e,result:n,owner:i,editing:d,onOpen:r,onRefine:p,onDiscard:o,onOpenSkills:u}){const[x,c]=f.useState(!1),{name:l,description:s,sqlPreview:y,grain:g,outputs:R,examples:k,certifierVerdict:L,appliedSkills:z,diagnostics:v,route:m,previousSql:j}=n,W=d||typeof j=="string";return t.jsxs("section",{style:Z(e),children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[t.jsx(Q,{size:14,strokeWidth:2,color:e.accent}),t.jsx("div",{style:{fontSize:13,fontWeight:850,color:e.textPrimary,fontFamily:e.font},children:l}),t.jsx("span",{style:je(e),children:W?"AI-edited · draft":"AI-generated · draft"}),g?t.jsxs("span",{style:Ze(e),children:["grain ",g]}):null,t.jsx(ge,{t:e,route:m})]}),s?t.jsx("div",{style:{fontSize:12,color:e.textSecondary,lineHeight:1.5,fontFamily:e.font},children:s}):null,W&&typeof j=="string"?t.jsx(Ne,{t:e,previousSql:j,nextSql:y}):t.jsxs("div",{children:[t.jsxs("button",{type:"button",onClick:()=>c(b=>!b),style:ke(e),children:[x?t.jsx(le,{size:13,strokeWidth:2}):t.jsx(ae,{size:13,strokeWidth:2}),x?"Hide SQL this block will run":"Show SQL this block will run"]}),x?t.jsx("div",{style:{marginTop:7},children:t.jsx(me,{t:e,code:y})}):null]}),R.length>0?t.jsxs("div",{style:{display:"grid",gap:5},children:[t.jsx(G,{t:e,children:"Outputs"}),t.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:5},children:R.map(b=>t.jsx("span",{style:Je(e),children:b},b))})]}):null,k.length>0?t.jsxs("div",{style:{display:"grid",gap:5},children:[t.jsx(G,{t:e,children:"Answers questions like"}),t.jsx("ul",{style:{margin:0,padding:"0 0 0 16px",display:"grid",gap:3},children:k.slice(0,3).map(b=>t.jsx("li",{style:{fontSize:11.5,color:e.textSecondary,lineHeight:1.45,fontFamily:e.font},children:b},b))})]}):null,t.jsx(Oe,{t:e,verdict:L}),t.jsx(he,{t:e,skills:z,onOpenSkills:u}),t.jsx(ye,{t:e,diagnostics:v}),i?t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:11,color:e.textMuted,fontFamily:e.font},children:[t.jsx(ce,{size:12,strokeWidth:2})," drafting as ",i]}):null,t.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[t.jsxs("button",{type:"button",onClick:r,style:J(e),children:[W?t.jsx(xe,{size:13,strokeWidth:2}):t.jsx(Q,{size:13,strokeWidth:2}),W?"Update block in Block Studio":"Open in Block Studio"]}),t.jsxs("button",{type:"button",onClick:p,style:w(e),children:[t.jsx(Y,{size:13,strokeWidth:2})," Refine"]}),t.jsxs("button",{type:"button",onClick:o,style:w(e),children:[t.jsx(re,{size:13,strokeWidth:2})," Discard"]})]})]})}function He(e,n){const i=e.replace(/\s+$/g,"").split(`
32
- `),d=n.replace(/\s+$/g,"").split(`
33
- `),r=i.length,p=d.length,o=Array.from({length:r+1},()=>new Array(p+1).fill(0));for(let l=r-1;l>=0;l--)for(let s=p-1;s>=0;s--)o[l][s]=i[l]===d[s]?o[l+1][s+1]+1:Math.max(o[l+1][s],o[l][s+1]);const u=[];let x=0,c=0;for(;x<r&&c<p;)i[x]===d[c]?(u.push({kind:"context",text:i[x]}),x++,c++):o[x+1][c]>=o[x][c+1]?(u.push({kind:"remove",text:i[x]}),x++):(u.push({kind:"add",text:d[c]}),c++);for(;x<r;)u.push({kind:"remove",text:i[x]}),x++;for(;c<p;)u.push({kind:"add",text:d[c]}),c++;return u}function Ne({t:e,previousSql:n,nextSql:i}){const[d,r]=f.useState(!0),p=de.useMemo(()=>He(n.trim(),i.trim()),[n,i]),o=p.filter(c=>c.kind==="add").length,u=p.filter(c=>c.kind==="remove").length,x=o===0&&u===0;return t.jsxs("div",{style:{display:"grid",gap:7},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[t.jsxs("button",{type:"button",onClick:()=>r(c=>!c),style:ke(e),children:[d?t.jsx(le,{size:13,strokeWidth:2}):t.jsx(ae,{size:13,strokeWidth:2}),t.jsx($e,{size:13,strokeWidth:2}),d?"Hide what changed":"Show what changed"]}),x?t.jsx("span",{style:{fontSize:11,color:e.textMuted,fontFamily:e.font},children:"No SQL changes."}):t.jsxs("span",{style:{fontSize:11,color:e.textMuted,fontFamily:e.font},children:[t.jsxs("span",{style:{color:e.success,fontWeight:700},children:["+",o]})," ",t.jsxs("span",{style:{color:e.error,fontWeight:700},children:["-",u]})," line",o+u===1?"":"s"]})]}),d?t.jsx("pre",{style:{...be(e),padding:0},children:t.jsx("code",{style:{display:"block",fontFamily:e.fontMono,fontSize:11.5,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:p.map((c,l)=>t.jsxs("span",{style:{display:"block",padding:"0 11px",color:c.kind==="add"?e.success:c.kind==="remove"?e.error:e.textPrimary,background:c.kind==="add"?`${e.success}14`:c.kind==="remove"?`${e.error}14`:"transparent"},children:[t.jsx("span",{"aria-hidden":!0,style:{userSelect:"none",opacity:.7},children:c.kind==="add"?"+ ":c.kind==="remove"?"- ":" "}),c.text||" "]},l))})}):null]})}function Oe({t:e,verdict:n}){if(!n)return null;const i=n.ready&&n.blocking.length===0,d=i?[]:[...n.blocking,...n.warnings];return t.jsxs("div",{style:{display:"grid",gap:5},children:[t.jsx(G,{t:e,children:"What's missing to certify"}),i?t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,color:e.success,fontFamily:e.font},children:[t.jsx(K,{size:14,strokeWidth:2}),"Grain, outputs, and context are set."]}):t.jsxs("div",{style:{display:"grid",gap:4},children:[t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:12,color:e.warning,fontFamily:e.font},children:[t.jsx(ue,{size:14,strokeWidth:2}),"Needs an owner and passing tests before it can be certified."]}),d.length>0?t.jsx("ul",{style:{margin:0,padding:"0 0 0 16px",display:"grid",gap:2},children:d.map(r=>t.jsx("li",{style:{fontSize:11,color:e.textSecondary,lineHeight:1.4,fontFamily:e.font},children:r},r))}):null]})]})}function ye({t:e,diagnostics:n}){if(!n)return null;const i=n.sourceTrust==="governed_semantic_source",d=n.activeDomain?`domain ${n.activeDomain}`:"project metadata",r=n.allowedRelations.length,p=n.warnings[0];return t.jsxs("div",{style:{display:"grid",gap:3,fontSize:10.5,color:e.textMuted,lineHeight:1.4,fontFamily:e.font},children:[t.jsxs("span",{title:n.contextPackId?`Context pack ${n.contextPackId}`:void 0,children:[i?"Built from governed semantic context":"Exploratory DBT-grounded draft"," · ",d," · ",r," allowed relation",r===1?"":"s"," · review required"]}),p?t.jsx("span",{style:{color:e.warning},children:p}):null]})}function he({t:e,skills:n,onOpenSkills:i}){return!n||n.length===0?null:t.jsxs("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:5,fontSize:11,color:e.textMuted,fontFamily:e.font},children:[t.jsx(pe,{size:12,strokeWidth:2}),t.jsx("span",{children:"guided by"}),n.map((d,r)=>t.jsxs(de.Fragment,{children:[r>0?t.jsx("span",{"aria-hidden":!0,style:{color:e.textMuted},children:","}):null,t.jsx("button",{type:"button",onClick:i,title:d.description??`Open the ${d.id} skill`,style:{padding:0,border:"none",background:"transparent",color:e.accent,fontSize:11,fontWeight:700,fontFamily:e.font,cursor:"pointer",textDecoration:"underline",textUnderlineOffset:2},children:d.id})]},d.id))]})}const Qe={certified_block:{tone:"success",icon:Me},semantic_metric:{tone:"accent",icon:V},generated_sql:{tone:"textMuted",icon:fe},business_context:{tone:"accent",icon:pe},no_answer:null};function ge({t:e,route:n}){var o;if(!n)return null;const i=Qe[n.tier];if(!i)return null;const d=i.icon,r=e[i.tone]??e.textMuted,p=((o=n.label)==null?void 0:o.trim())||Ge(n);return t.jsxs("span",{title:n.ref?`${p} (${n.ref})`:p,style:{display:"inline-flex",alignItems:"center",gap:5,fontSize:10.5,fontWeight:700,color:r,background:`${r}14`,border:`1px solid ${r}3a`,borderRadius:999,padding:"2px 9px",fontFamily:e.font,maxWidth:"100%"},children:[t.jsx(d,{size:11,strokeWidth:2.2,style:{flexShrink:0}}),t.jsx("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:p})]})}function Ge(e){switch(e.tier){case"certified_block":return e.ref?`Certified block ${e.ref}`:"Certified block";case"semantic_metric":return e.ref?`Answered from metric ${e.ref}`:"Answered from metric";case"generated_sql":return"Generated SQL preview";case"business_context":return"From business context";default:return""}}function Ue({t:e,selectedPath:n,onSelect:i}){const[d,r]=f.useState([]),[p,o]=f.useState(!0),[u,x]=f.useState("");f.useEffect(()=>{let s=!1;return o(!0),D.getBlockLibrary().then(y=>{s||r(Array.isArray(y==null?void 0:y.blocks)?y.blocks.map(g=>({name:g.name,domain:g.domain,path:g.path})):[])}).catch(()=>{s||r([])}).finally(()=>{s||o(!1)}),()=>{s=!0}},[]);const c=d.filter(s=>{if(!u.trim())return!0;const y=u.toLowerCase();return s.name.toLowerCase().includes(y)||s.path.toLowerCase().includes(y)||(s.domain??"").toLowerCase().includes(y)}).slice(0,40),l=d.find(s=>s.path===n);return t.jsxs("div",{style:{display:"grid",gap:7,border:`1px solid ${e.cellBorder}`,borderRadius:8,background:e.cellBg,padding:9},children:[t.jsxs("div",{style:{position:"relative"},children:[t.jsx(Be,{size:13,strokeWidth:2,color:e.textMuted,style:{position:"absolute",left:9,top:"50%",transform:"translateY(-50%)"}}),t.jsx("input",{type:"text",value:u,onChange:s=>x(s.target.value),placeholder:l?`Modifying ${l.name} — search to change`:"Search blocks to modify…",style:{width:"100%",border:`1px solid ${e.btnBorder}`,borderRadius:7,background:e.appBg,color:e.textPrimary,fontSize:12,fontFamily:e.font,padding:"7px 9px 7px 28px",boxSizing:"border-box"}})]}),p?t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,fontSize:11.5,color:e.textMuted,fontFamily:e.font,padding:"4px 2px"},children:[t.jsx(se,{size:12,strokeWidth:2})," Loading blocks…"]}):d.length===0?t.jsxs("div",{style:{fontSize:11.5,color:e.textMuted,fontFamily:e.font,padding:"2px 2px",lineHeight:1.45},children:["No blocks found. Type the block file path you want to modify, then press Enter.",t.jsx("input",{type:"text",defaultValue:n??"",onKeyDown:s=>{if(s.key==="Enter"){const y=s.target.value.trim();y&&i(y)}},placeholder:"blocks/revenue_by_region.dql",style:{marginTop:6,width:"100%",border:`1px solid ${e.btnBorder}`,borderRadius:7,background:e.appBg,color:e.textPrimary,fontSize:12,fontFamily:e.fontMono,padding:"7px 9px",boxSizing:"border-box"}})]}):t.jsx("div",{style:{display:"grid",gap:3,maxHeight:184,overflow:"auto"},children:c.length===0?t.jsxs("div",{style:{fontSize:11.5,color:e.textMuted,fontFamily:e.font,padding:"4px 2px"},children:["No blocks match “",u,"”."]}):c.map(s=>{const y=s.path===n;return t.jsxs("button",{type:"button",onClick:()=>i(s.path),style:{display:"flex",alignItems:"center",gap:8,textAlign:"left",width:"100%",border:`1px solid ${y?e.accent:"transparent"}`,background:y?`${e.accent}14`:"transparent",borderRadius:6,padding:"6px 8px",cursor:"pointer"},children:[t.jsx(fe,{size:13,strokeWidth:2,color:y?e.accent:e.textMuted,style:{flexShrink:0}}),t.jsxs("span",{style:{minWidth:0,display:"grid",gap:1},children:[t.jsx("span",{style:{fontSize:12,fontWeight:700,color:e.textPrimary,fontFamily:e.fontMono,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s.name}),t.jsxs("span",{style:{fontSize:10.5,color:e.textMuted,fontFamily:e.font,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:[s.domain?`${s.domain} · `:"",s.path]})]}),y?t.jsx(K,{size:14,strokeWidth:2,color:e.accent,style:{marginLeft:"auto",flexShrink:0}}):null]},s.path)})})]})}function Ve({t:e,value:n,onChange:i}){const{dispatch:d}=U(),[r,p]=f.useState([]);return f.useEffect(()=>{let o=!1;return D.getDomains().then(u=>{o||p(Array.isArray(u==null?void 0:u.domains)?u.domains:[])}).catch(()=>{o||p([])}),()=>{o=!0}},[]),t.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[t.jsx("span",{style:{fontSize:11,fontWeight:700,color:e.textSecondary,fontFamily:e.font},children:"Domain"}),t.jsxs("select",{value:n??"",onChange:o=>i(o.target.value||void 0),style:{border:`1px solid ${e.btnBorder}`,borderRadius:7,background:e.btnBg,color:n?e.textPrimary:e.textMuted,fontSize:12,fontFamily:e.font,padding:"5px 9px",cursor:"pointer"},children:[t.jsx("option",{value:"",children:r.length===0?"No domains yet":"No domain"}),r.map(o=>t.jsx("option",{value:o.id,children:o.name},o.id))]}),t.jsxs("button",{type:"button",onClick:()=>d({type:"SET_MAIN_VIEW",view:"domains"}),style:w(e),title:"Create a new domain on the Domains page",children:[t.jsx(A,{size:12,strokeWidth:2})," New"]})]})}function Ke({t:e,message:n,onRefine:i}){return t.jsxs("section",{style:{...Z(e),borderColor:`${e.error}66`},children:[t.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[t.jsx(ue,{size:15,strokeWidth:2,color:e.error,style:{marginTop:1,flexShrink:0}}),t.jsx("div",{style:{fontSize:12.5,color:e.textPrimary,lineHeight:1.5,fontFamily:e.font},children:n})]}),t.jsx("div",{style:{display:"flex",gap:8},children:t.jsxs("button",{type:"button",onClick:i,style:w(e),children:[t.jsx(Y,{size:13,strokeWidth:2})," Refine and try again"]})})]})}function me({t:e,code:n}){return t.jsx("pre",{style:be(e),children:t.jsx("code",{style:{fontFamily:e.fontMono,fontSize:11.5,color:e.textPrimary,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:n.trim()})})}function G({t:e,children:n}){return t.jsx("div",{style:{fontSize:10,fontWeight:800,letterSpacing:"0.05em",textTransform:"uppercase",color:e.textMuted,fontFamily:e.font},children:n})}function ne(e){return{display:"inline-flex",padding:2,gap:2,border:`1px solid ${e.btnBorder}`,borderRadius:8,background:e.btnBg}}function ie(e,n,i){return{display:"inline-flex",alignItems:"center",gap:5,padding:"5px 11px",borderRadius:6,border:"1px solid transparent",background:n?e.accent:"transparent",color:n?"#ffffff":e.textSecondary,fontSize:12,fontWeight:n?800:600,fontFamily:e.font,cursor:i?"default":"pointer",opacity:i?.45:1}}function Ye(e){return{width:"100%",resize:"vertical",border:`1px solid ${e.btnBorder}`,borderRadius:8,background:e.cellBg,color:e.textPrimary,fontSize:12.5,fontFamily:e.font,lineHeight:1.5,padding:"9px 11px",boxSizing:"border-box"}}function Z(e){return{border:`1px solid ${e.cellBorder}`,borderRadius:10,background:e.cellBg,padding:12,display:"grid",gap:10}}function be(e){return{margin:0,border:`1px solid ${e.cellBorder}`,borderRadius:8,background:e.appBg,padding:"9px 11px",overflow:"auto",maxHeight:280}}function J(e){return oe(e,{variant:"primary",size:"md"})}function w(e){return oe(e,{variant:"ghost",size:"md"})}function ke(e){return{display:"inline-flex",alignItems:"center",gap:5,padding:0,border:"none",background:"transparent",color:e.accent,fontSize:11.5,fontWeight:700,fontFamily:e.font,cursor:"pointer"}}function je(e){return{fontSize:10,fontWeight:800,letterSpacing:"0.03em",textTransform:"uppercase",color:e.accent,background:`${e.accent}18`,border:`1px solid ${e.accent}40`,borderRadius:999,padding:"2px 8px",fontFamily:e.font}}function Ze(e){return{fontSize:10.5,fontWeight:600,color:e.textMuted,background:e.btnBg,border:`1px solid ${e.btnBorder}`,borderRadius:999,padding:"2px 8px",fontFamily:e.font}}function Je(e){return{fontSize:11,fontWeight:600,color:e.textSecondary,background:e.btnBg,border:`1px solid ${e.btnBorder}`,borderRadius:6,padding:"3px 8px",fontFamily:e.fontMono}}function st(){const{state:e,dispatch:n}=U();return f.useCallback(async(i,d)=>{const r={name:i.split("/").pop()??`${d}.dql`,path:i,type:"block",folder:"blocks"};e.files.some(o=>o.path===i)||n({type:"FILE_ADDED",file:r});const p=await D.openBlockStudio(i);n({type:"OPEN_BLOCK_STUDIO",file:r,payload:p})},[n,e.files])}export{it as A,Oe as C,he as G,ge as R,st as u};