neural-loom 0.2.55 → 0.2.56

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 (49) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/cache/.previewinfo +1 -1
  4. package/.next/cache/.rscinfo +1 -1
  5. package/.next/cache/.tsbuildinfo +1 -1
  6. package/.next/diagnostics/route-bundle-stats.json +2 -2
  7. package/.next/fallback-build-manifest.json +3 -3
  8. package/.next/prerender-manifest.json +3 -3
  9. package/.next/server/app/_global-error.html +1 -1
  10. package/.next/server/app/_global-error.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found.html +1 -1
  17. package/.next/server/app/_not-found.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  19. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  20. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  21. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  22. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  23. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  24. package/.next/server/app/index.html +1 -1
  25. package/.next/server/app/index.rsc +2 -2
  26. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  27. package/.next/server/app/index.segments/_full.segment.rsc +2 -2
  28. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  29. package/.next/server/app/index.segments/_index.segment.rsc +1 -1
  30. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  31. package/.next/server/app/page_client-reference-manifest.js +1 -1
  32. package/.next/server/chunks/[root-of-the-server]__0_o7_jj._.js +1 -1
  33. package/.next/server/chunks/[root-of-the-server]__0_o7_jj._.js.map +1 -1
  34. package/.next/server/chunks/ssr/_0t7oqy6._.js +6 -1
  35. package/.next/server/chunks/ssr/_0t7oqy6._.js.map +1 -1
  36. package/.next/server/middleware-build-manifest.js +3 -3
  37. package/.next/server/pages/404.html +1 -1
  38. package/.next/server/pages/500.html +1 -1
  39. package/.next/server/server-reference-manifest.js +1 -1
  40. package/.next/server/server-reference-manifest.json +1 -1
  41. package/.next/static/chunks/162be8draqhn..js +11 -0
  42. package/.next/trace +1 -1
  43. package/.next/trace-build +1 -1
  44. package/package.json +1 -1
  45. package/src/app/components/DbExplorer.tsx +293 -16
  46. package/.next/static/chunks/0ulfmf9nsz_o-.js +0 -6
  47. /package/.next/static/{PtixAwrSwsBc6DJtUuNCf → E5W0YoY_yEbo_xJeWaMEB}/_buildManifest.js +0 -0
  48. /package/.next/static/{PtixAwrSwsBc6DJtUuNCf → E5W0YoY_yEbo_xJeWaMEB}/_clientMiddlewareManifest.js +0 -0
  49. /package/.next/static/{PtixAwrSwsBc6DJtUuNCf → E5W0YoY_yEbo_xJeWaMEB}/_ssgManifest.js +0 -0
@@ -1,8 +1,13 @@
1
- module.exports=[41997,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={BailoutToCSRError:function(){return g},isBailoutToCSRError:function(){return h}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f="BAILOUT_TO_CLIENT_SIDE_RENDERING";class g extends Error{constructor(a){super(`Bail out to client-side rendering: ${a}`),this.reason=a,this.digest=f}}function h(a){return"object"==typeof a&&null!==a&&"digest"in a&&a.digest===f}},32245,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"BailoutToCSR",{enumerable:!0,get:function(){return e}});let d=a.r(41997);function e({reason:a,children:b}){throw Object.defineProperty(new d.BailoutToCSRError(a),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0})}},7773,(a,b,c)=>{"use strict";function d(a){return a.split("/").map(a=>encodeURIComponent(a)).join("/")}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"encodeURIPath",{enumerable:!0,get:function(){return d}})},68063,(a,b,c)=>{"use strict";let d;Object.defineProperty(c,"__esModule",{value:!0});var e={getAssetToken:function(){return i},getAssetTokenQuery:function(){return j},getDeploymentId:function(){return g},getDeploymentIdQuery:function(){return h}};for(var f in e)Object.defineProperty(c,f,{enumerable:!0,get:e[f]});function g(){return d}function h(a=!1){return d?`${a?"&":"?"}dpl=${d}`:""}function i(){return!1}function j(a=!1){return""}d=void 0},97458,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"PreloadChunks",{enumerable:!0,get:function(){return i}});let d=a.r(87924),e=a.r(35112),f=a.r(56704),g=a.r(7773),h=a.r(68063);function i({moduleIds:a}){let b=f.workAsyncStorage.getStore();if(void 0===b)return null;let c=[];if(b.reactLoadableManifest&&a){let d=b.reactLoadableManifest;for(let b of a){if(!d[b])continue;let a=d[b].files;c.push(...a)}}if(0===c.length)return null;let j=(0,h.getAssetTokenQuery)();return(0,d.jsx)(d.Fragment,{children:c.map(a=>{let c=`${b.assetPrefix}/_next/${(0,g.encodeURIPath)(a)}${j}`;return a.endsWith(".css")?(0,d.jsx)("link",{precedence:"dynamic",href:c,rel:"stylesheet",as:"style",nonce:b.nonce},a):((0,e.preload)(c,{as:"script",fetchPriority:"low",nonce:b.nonce}),null)})})}},69853,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"default",{enumerable:!0,get:function(){return j}});let d=a.r(87924),e=a.r(72131),f=a.r(32245),g=a.r(97458);function h(a){return{default:a&&"default"in a?a.default:a}}let i={loader:()=>Promise.resolve(h(()=>null)),loading:null,ssr:!0},j=function(a){let b={...i,...a},c=(0,e.lazy)(()=>b.loader().then(h)),j=b.loading;function k(a){let h=j?(0,d.jsx)(j,{isLoading:!0,pastDelay:!0,error:null}):null,i=!b.ssr||!!b.loading,k=i?e.Suspense:e.Fragment,l=b.ssr?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.PreloadChunks,{moduleIds:b.modules}),(0,d.jsx)(c,{...a})]}):(0,d.jsx)(f.BailoutToCSR,{reason:"next/dynamic",children:(0,d.jsx)(c,{...a})});return(0,d.jsx)(k,{...i?{fallback:h}:{},children:l})}return k.displayName="LoadableComponent",k}},19721,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"default",{enumerable:!0,get:function(){return e}});let d=a.r(33354)._(a.r(69853));function e(a,b){let c={};"function"==typeof a&&(c.loader=a);let e={...c,...b};return(0,d.default)({...e,modules:e.loadableGenerated?.modules})}("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},46845,a=>{a.v({activeBorder:"page-module___8aEwW__activeBorder",agentBadge:"page-module___8aEwW__agentBadge",agentCard:"page-module___8aEwW__agentCard",agentGrid:"page-module___8aEwW__agentGrid",agentHeader:"page-module___8aEwW__agentHeader",agentName:"page-module___8aEwW__agentName",agentStateBadge:"page-module___8aEwW__agentStateBadge",ansiCyan:"page-module___8aEwW__ansiCyan",ansiGreen:"page-module___8aEwW__ansiGreen",ansiMagenta:"page-module___8aEwW__ansiMagenta",ansiRed:"page-module___8aEwW__ansiRed",ansiYellow:"page-module___8aEwW__ansiYellow",cardBody:"page-module___8aEwW__cardBody",container:"page-module___8aEwW__container",containerActive:"page-module___8aEwW__containerActive",contextDetails:"page-module___8aEwW__contextDetails",contextItem:"page-module___8aEwW__contextItem",contextList:"page-module___8aEwW__contextList",contextMeta:"page-module___8aEwW__contextMeta",contextTitle:"page-module___8aEwW__contextTitle",dashboardGrid:"page-module___8aEwW__dashboardGrid",envGrid:"page-module___8aEwW__envGrid",envName:"page-module___8aEwW__envName",envRow:"page-module___8aEwW__envRow",envStatus:"page-module___8aEwW__envStatus",footer:"page-module___8aEwW__footer",header:"page-module___8aEwW__header",logoArea:"page-module___8aEwW__logoArea",mainPanel:"page-module___8aEwW__mainPanel",pulse:"page-module___8aEwW__pulse","pulse-attention":"page-module___8aEwW__pulse-attention","pulse-thinking":"page-module___8aEwW__pulse-thinking",pulseDot:"page-module___8aEwW__pulseDot",quickLaunchBtn:"page-module___8aEwW__quickLaunchBtn",sectionTitle:"page-module___8aEwW__sectionTitle",sidePanel:"page-module___8aEwW__sidePanel","state-complete":"page-module___8aEwW__state-complete","state-idle":"page-module___8aEwW__state-idle","state-needs-input":"page-module___8aEwW__state-needs-input","state-thinking":"page-module___8aEwW__state-thinking",statusIndicator:"page-module___8aEwW__statusIndicator",stoppedBadge:"page-module___8aEwW__stoppedBadge",subtitle:"page-module___8aEwW__subtitle",terminalContainer:"page-module___8aEwW__terminalContainer",terminalInput:"page-module___8aEwW__terminalInput",terminalInputArea:"page-module___8aEwW__terminalInputArea",terminalLine:"page-module___8aEwW__terminalLine",terminalSendBtn:"page-module___8aEwW__terminalSendBtn",title:"page-module___8aEwW__title"})},40777,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(19721),e=a.i(46845),f=a.i(35112);function g({workspaceRoot:a}){let[d,e]=(0,c.useState)({global:[],workspace:[]}),[i,j]=(0,c.useState)(null),[k,l]=(0,c.useState)(!0),[m,n]=(0,c.useState)([]),[o,p]=(0,c.useState)(null),[q,r]=(0,c.useState)({}),[s,t]=(0,c.useState)(!1),[u,v]=(0,c.useState)("SELECT * FROM sqlite_master;"),[w,x]=(0,c.useState)(!1),[y,z]=(0,c.useState)(null),[A,B]=(0,c.useState)(null),[C,D]=(0,c.useState)(!1),[E,F]=(0,c.useState)(!1),[G,H]=(0,c.useState)({id:"",name:"",type:"sqlite",filepath:"./dev.db",host:"localhost",port:5432,database:"postgres",username:"postgres",password:"",ssl:!1,readOnly:!0}),[I,J]=(0,c.useState)(!1),[K,L]=(0,c.useState)(null),M=async()=>{try{let b=await fetch(`/api/sql/connections?root=${encodeURIComponent(a)}`);if(b.ok){let a=await b.json();a.success&&(e({global:a.global||[],workspace:a.workspace||[]}),j(a.activeId),l(a.isActiveGlobal))}}catch(a){console.error("Failed to load connection profiles:",a)}},N=async()=>{if(!i)return void n([]);t(!0);try{let b=await fetch(`/api/sql/schema?action=list_tables&root=${encodeURIComponent(a)}`);if(b.ok){let a=await b.json();a.success?(n(a.tables||[]),z(null)):z(a.error||"Failed to load database schema.")}else{let a=await b.json();z(a.error||"Failed to load database schema.")}}catch(a){console.error("Failed to load schema:",a)}finally{t(!1)}},O=async b=>{if(q[b])return void p(o===b?null:b);try{let c=await fetch(`/api/sql/schema?action=describe_table&table=${encodeURIComponent(b)}&root=${encodeURIComponent(a)}`);if(c.ok){let a=await c.json();a.success&&(r(c=>({...c,[b]:a.columns})),p(b))}}catch(a){console.error(`Failed to load columns for table ${b}:`,a)}};(0,c.useEffect)(()=>{M()},[a]),(0,c.useEffect)(()=>{N(),B(null),p(null),r({});let a=k?d.global.find(a=>a.id===i):d.workspace.find(a=>a.id===i);a&&("sqlite"===a.type?v("SELECT name, type FROM sqlite_master WHERE type='table';"):"mssql"===a.type?v("SELECT * FROM sys.tables;"):v("SELECT * FROM information_schema.tables LIMIT 10;"))},[i,k,d.global.length,d.workspace.length]);let P=async(b,c)=>{try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"set_active",profileId:b,isGlobal:c,root:a})})).ok&&(j(b),l(c))}catch(a){console.error("Failed to set active profile:",a)}},Q=async()=>{L(null);try{let b=await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"test",profile:G,root:a})}),c=await b.json();c.success?L({success:!0,message:"Connection test successful!"}):L({success:!1,message:c.error||"Connection test failed."})}catch(a){L({success:!1,message:a.message||"Failed to make test query."})}},R=async b=>{if(b.preventDefault(),!G.name||!G.type)return;J(!0);let c=G.id||`profile_${Math.random().toString(36).substring(7)}`,d={...G,id:c,name:G.name,type:G.type};try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"save",profile:d,isGlobal:E,root:a})})).ok&&(await M(),D(!1),i||P(c,E))}catch(a){console.error("Failed to save profile:",a)}finally{J(!1)}},S=async(b,c)=>{if(confirm("Are you sure you want to delete this connection profile?"))try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",profileId:b,isGlobal:c,root:a})})).ok&&(await M(),i===b&&j(null))}catch(a){console.error("Failed to delete connection profile:",a)}},T=async()=>{if(u.trim()&&i){x(!0),z(null),B(null);try{let b=await fetch("/api/sql/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:u.trim(),root:a})}),c=await b.json();b.ok&&c.success?(B({rows:c.rows||[],fields:c.fields||[],durationMs:c.durationMs||0,affectedRows:c.affectedRows}),(u.toLowerCase().includes("create table")||u.toLowerCase().includes("drop table")||u.toLowerCase().includes("alter table"))&&N()):z(c.error||"Failed to execute query.")}catch(a){z(a.message||"An unexpected error occurred during execution.")}finally{x(!1)}}},U=k?d.global.find(a=>a.id===i):d.workspace.find(a=>a.id===i);return(0,b.jsxs)("div",{style:h.container,children:[(0,b.jsxs)("div",{style:h.sidebar,children:[(0,b.jsxs)("div",{style:h.section,children:[(0,b.jsxs)("div",{style:h.sectionHeader,children:[(0,b.jsx)("span",{style:h.sectionTitle,children:"Connections"}),(0,b.jsx)("button",{style:h.addBtn,onClick:()=>{L(null),H({id:"",name:"",type:"sqlite",filepath:"./dev.db",host:"localhost",port:5432,database:"postgres",username:"postgres",password:"",ssl:!1,readOnly:!0}),F(!1),D(!0)},title:"Add Database Connection Profile",children:"➕ Add"})]}),(0,b.jsxs)("div",{style:h.profileList,children:[0===d.global.length&&0===d.workspace.length&&(0,b.jsx)("div",{style:h.emptyText,children:"No connections configured. Add one to start."}),d.workspace.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{style:h.groupHeader,children:"WORKSPACE CONNECTIONS"}),d.workspace.map(a=>(0,b.jsxs)("div",{style:{...h.profileItem,...i===a.id&&!k?h.profileItemActive:{}},onClick:()=>P(a.id,!1),children:[(0,b.jsxs)("div",{style:h.profileMeta,children:[(0,b.jsxs)("span",{style:h.profileName,children:["📁 ",a.name]}),(0,b.jsx)("span",{style:h.profileType,children:a.type})]}),(0,b.jsx)("button",{style:h.deleteProfileBtn,onClick:b=>{b.stopPropagation(),S(a.id,!1)},children:"✖"})]},a.id))]}),d.global.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{style:h.groupHeader,children:"GLOBAL CONNECTIONS"}),d.global.map(a=>(0,b.jsxs)("div",{style:{...h.profileItem,...i===a.id&&k?h.profileItemActive:{}},onClick:()=>P(a.id,!0),children:[(0,b.jsxs)("div",{style:h.profileMeta,children:[(0,b.jsxs)("span",{style:h.profileName,children:["🌐 ",a.name]}),(0,b.jsx)("span",{style:h.profileType,children:a.type})]}),(0,b.jsx)("button",{style:h.deleteProfileBtn,onClick:b=>{b.stopPropagation(),S(a.id,!0)},children:"✖"})]},a.id))]})]})]}),(0,b.jsxs)("div",{style:{...h.section,flex:1,borderTop:"1px solid var(--border)"},children:[(0,b.jsxs)("div",{style:h.sectionHeader,children:[(0,b.jsx)("span",{style:h.sectionTitle,children:"Schema Tables"}),s&&(0,b.jsx)("span",{style:h.spinnerMini})]}),(0,b.jsxs)("div",{style:h.tableList,children:[!i&&(0,b.jsx)("div",{style:h.emptyText,children:"Select an active connection to view tables."}),i&&0===m.length&&!s&&(0,b.jsx)("div",{style:h.emptyText,children:"No tables found in database schema."}),m.map(a=>(0,b.jsxs)("div",{style:h.tableTreeItem,children:[(0,b.jsxs)("div",{style:h.tableRow,onClick:()=>O(a.name),children:[(0,b.jsx)("span",{style:h.tableIcon,children:"view"===a.type?"👁️":"📊"}),(0,b.jsx)("span",{style:h.tableName,children:a.name}),(0,b.jsx)("span",{style:h.tableChevron,children:o===a.name?"▼":"▶"})]}),o===a.name&&q[a.name]&&(0,b.jsx)("div",{style:h.columnList,children:q[a.name].map(a=>(0,b.jsxs)("div",{style:h.columnItem,children:[(0,b.jsx)("span",{style:h.columnIcon,children:a.isPrimaryKey?"🔑":a.isForeignKey?"🔗":"▫"}),(0,b.jsx)("span",{style:h.columnName,title:a.type,children:a.name}),(0,b.jsx)("span",{style:h.columnType,children:a.type.toLowerCase().substring(0,12)})]},a.name))})]},a.name))]})]})]}),(0,b.jsxs)("div",{style:h.mainContent,children:[(0,b.jsxs)("div",{style:h.statusBar,children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,b.jsx)("span",{style:h.statusLabel,children:"Active Connection:"}),U?(0,b.jsxs)("span",{style:h.statusValue,children:[k?"🌐":"📁"," ",U.name," (",U.type,")",U.readOnly&&(0,b.jsx)("span",{style:h.readOnlyBadge,children:"Read-Only"})]}):(0,b.jsx)("span",{style:{...h.statusValue,color:"var(--danger)"},children:"No Connection Selected"})]}),(0,b.jsx)("button",{style:{...h.runBtn,opacity:!i||w?.6:1,cursor:!i||w?"not-allowed":"pointer"},onClick:T,disabled:!i||w,children:w?"⌛ Running...":"⚡ Execute Query (F5)"})]}),(0,b.jsx)("div",{style:h.editorArea,children:(0,b.jsx)("textarea",{style:h.textarea,value:u,onChange:a=>v(a.target.value),placeholder:"Write your SQL query script here...",onKeyDown:a=>{("F5"===a.key||a.ctrlKey&&"Enter"===a.key)&&(a.preventDefault(),T())}})}),(0,b.jsxs)("div",{style:h.resultsArea,children:[y&&(0,b.jsxs)("div",{style:h.errorContainer,children:[(0,b.jsx)("h4",{style:{margin:"0 0 0.5rem 0",color:"var(--danger)"},children:"⚠️ Execution Error"}),(0,b.jsx)("pre",{style:h.errorText,children:y}),y.includes("not installed")&&(0,b.jsxs)("div",{style:h.driverPrompt,children:[(0,b.jsx)("p",{style:{margin:"0 0 0.5rem 0"},children:"To resolve this, run this installer command in your workspace terminal:"}),(0,b.jsx)("code",{style:h.driverCode,children:U?.type==="sqlite"?"npm install better-sqlite3":U?.type==="postgres"?"npm install pg":U?.type==="mysql"?"npm install mysql2":"npm install mssql"})]})]}),A&&(0,b.jsxs)("div",{style:h.resultsWrapper,children:[(0,b.jsxs)("div",{style:h.resultsMeta,children:[(0,b.jsxs)("span",{children:["Query completed."," ",void 0!==A.affectedRows?`Affected rows: ${A.affectedRows}`:`Returned ${A.rows.length} rows`]}),(0,b.jsxs)("span",{children:["Duration: ",A.durationMs,"ms"]})]}),A.rows.length>0?(0,b.jsx)("div",{style:h.tableContainer,children:(0,b.jsxs)("table",{style:h.table,children:[(0,b.jsx)("thead",{children:(0,b.jsx)("tr",{children:A.fields.map(a=>(0,b.jsx)("th",{style:h.th,children:a},a))})}),(0,b.jsx)("tbody",{children:A.rows.map((a,c)=>(0,b.jsx)("tr",{style:c%2==0?h.trEven:h.trOdd,children:A.fields.map(c=>(0,b.jsx)("td",{style:h.td,children:null===a[c]?"NULL":"object"==typeof a[c]?JSON.stringify(a[c]):String(a[c])},c))},c))})]})}):void 0===A.affectedRows&&(0,b.jsx)("div",{style:h.emptyResults,children:"Query executed successfully, but returned 0 results."})]}),!y&&!A&&!w&&(0,b.jsx)("div",{style:h.emptyResults,children:"Write a query script and click Execute to view table records."}),w&&(0,b.jsxs)("div",{style:h.loadingWrapper,children:[(0,b.jsx)("span",{style:h.spinnerLarge}),(0,b.jsx)("span",{style:{color:"var(--muted)"},children:"Running database statement..."})]})]})]}),C&&"u">typeof document&&(0,f.createPortal)((0,b.jsx)("div",{style:h.modalOverlay,children:(0,b.jsxs)("div",{style:h.modalContent,children:[(0,b.jsxs)("h3",{style:{margin:"0 0 1rem 0",display:"flex",justifyContent:"space-between"},children:[(0,b.jsx)("span",{children:"🔌 Add Database Profile"}),(0,b.jsx)("span",{style:{cursor:"pointer"},onClick:()=>D(!1),children:"✖"})]}),(0,b.jsxs)("form",{onSubmit:R,children:[(0,b.jsxs)("div",{style:h.formRow,children:[(0,b.jsx)("label",{style:h.label,children:"Profile Name"}),(0,b.jsx)("input",{style:h.input,type:"text",required:!0,value:G.name,onChange:a=>H(b=>({...b,name:a.target.value})),placeholder:"e.g. Local Postgres, Dev SQLite"})]}),(0,b.jsxs)("div",{style:h.formRow,children:[(0,b.jsx)("label",{style:h.label,children:"Scope Level"}),(0,b.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,b.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,b.jsx)("input",{type:"radio",checked:!E,onChange:()=>F(!1)}),"Workspace Local"]}),(0,b.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,b.jsx)("input",{type:"radio",checked:E,onChange:()=>F(!0)}),"Global User Profile"]})]})]}),(0,b.jsxs)("div",{style:h.formRow,children:[(0,b.jsx)("label",{style:h.label,children:"Database Type"}),(0,b.jsxs)("select",{style:h.select,value:G.type,onChange:a=>{let b=a.target.value,c=5432;"mysql"===b&&(c=3306),"mssql"===b&&(c=1433),H(a=>({...a,type:b,filepath:"sqlite"===b?"./dev.db":void 0,port:"sqlite"!==b?c:void 0,database:"sqlite"===b?void 0:"mssql"===b?"master":"postgres"===b?"postgres":"",username:"sqlite"===b?void 0:"mssql"===b?"sa":"postgres"===b?"postgres":"root"}))},children:[(0,b.jsx)("option",{value:"sqlite",children:"SQLite (Local File)"}),(0,b.jsx)("option",{value:"postgres",children:"PostgreSQL"}),(0,b.jsx)("option",{value:"mysql",children:"MySQL"}),(0,b.jsx)("option",{value:"mssql",children:"Microsoft SQL Server"})]})]}),"sqlite"===G.type?(0,b.jsxs)("div",{style:h.formRow,children:[(0,b.jsx)("label",{style:h.label,children:"Database File Path"}),(0,b.jsx)("input",{style:h.input,type:"text",required:!0,value:G.filepath||"",onChange:a=>H(b=>({...b,filepath:a.target.value})),placeholder:"Relative (e.g. ./data/dev.db) or Absolute path"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,b.jsxs)("div",{style:{...h.formRow,flex:3},children:[(0,b.jsx)("label",{style:h.label,children:"Host IP Address"}),(0,b.jsx)("input",{style:h.input,type:"text",required:!0,value:G.host||"",onChange:a=>H(b=>({...b,host:a.target.value})),placeholder:"localhost or IP"})]}),(0,b.jsxs)("div",{style:{...h.formRow,flex:1},children:[(0,b.jsx)("label",{style:h.label,children:"Port"}),(0,b.jsx)("input",{style:h.input,type:"number",required:!0,value:G.port||0,onChange:a=>H(b=>({...b,port:parseInt(a.target.value)}))})]})]}),(0,b.jsxs)("div",{style:h.formRow,children:[(0,b.jsx)("label",{style:h.label,children:"Database Name"}),(0,b.jsx)("input",{style:h.input,type:"text",required:!0,value:G.database||"",onChange:a=>H(b=>({...b,database:a.target.value}))})]}),(0,b.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,b.jsxs)("div",{style:{...h.formRow,flex:1},children:[(0,b.jsx)("label",{style:h.label,children:"Username"}),(0,b.jsx)("input",{style:h.input,type:"text",required:!0,value:G.username||"",onChange:a=>H(b=>({...b,username:a.target.value}))})]}),(0,b.jsxs)("div",{style:{...h.formRow,flex:1},children:[(0,b.jsx)("label",{style:h.label,children:"Password"}),(0,b.jsx)("input",{style:h.input,type:"password",value:G.password||"",onChange:a=>H(b=>({...b,password:a.target.value}))})]})]}),("postgres"===G.type||"mssql"===G.type)&&(0,b.jsx)("div",{style:h.formRow,children:(0,b.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,b.jsx)("input",{type:"checkbox",checked:!!G.ssl,onChange:a=>H(b=>({...b,ssl:a.target.checked}))}),"Require SSL Secure Connection"]})})]}),(0,b.jsx)("div",{style:h.formRow,children:(0,b.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,b.jsx)("input",{type:"checkbox",checked:!!G.readOnly,onChange:a=>H(b=>({...b,readOnly:a.target.checked}))}),"Enforce Read-Only Connection (Disable mutations)"]})}),K&&(0,b.jsx)("div",{style:{...h.testResult,backgroundColor:K.success?"rgba(16, 185, 129, 0.12)":"rgba(239, 68, 68, 0.12)",border:K.success?"1px solid var(--success)":"1px solid var(--danger)",color:K.success?"var(--success)":"var(--danger)"},children:K.message}),(0,b.jsxs)("div",{style:h.modalFooter,children:[(0,b.jsx)("button",{type:"button",style:h.testBtn,onClick:Q,children:"🔍 Test Connection"}),(0,b.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,b.jsx)("button",{type:"button",style:h.cancelBtn,onClick:()=>D(!1),children:"Cancel"}),(0,b.jsx)("button",{type:"submit",style:h.saveBtn,disabled:I,children:I?"Saving...":"Save Profile"})]})]})]})]})}),document.body)]})}let h={container:{display:"flex",height:"100%",width:"100%",backgroundColor:"#05070a",color:"#cbd5e1",fontSize:"0.875rem",minHeight:0},sidebar:{width:"280px",borderRight:"1px solid var(--border)",display:"flex",flexDirection:"column",minHeight:0,backgroundColor:"rgba(10, 15, 24, 0.4)",flexShrink:0},section:{display:"flex",flexDirection:"column",padding:"1rem",minHeight:0},sectionHeader:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.75rem"},sectionTitle:{fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",fontSize:"0.75rem",color:"var(--muted)"},addBtn:{padding:"0.2rem 0.5rem",borderRadius:"4px",border:"1px solid var(--primary)",backgroundColor:"transparent",color:"var(--primary)",fontSize:"0.7rem",fontWeight:600,cursor:"pointer"},profileList:{display:"flex",flexDirection:"column",gap:"0.4rem",overflowY:"auto",maxHeight:"220px"},groupHeader:{fontSize:"0.65rem",fontWeight:600,color:"var(--muted)",marginTop:"0.5rem",marginBottom:"0.2rem",letterSpacing:"0.05em"},profileItem:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.5rem 0.6rem",borderRadius:"6px",backgroundColor:"rgba(255, 255, 255, 0.02)",border:"1px solid var(--border)",cursor:"pointer",transition:"all 0.2s ease"},profileItemActive:{backgroundColor:"rgba(109, 40, 217, 0.08)",border:"1px solid var(--border-focus)",boxShadow:"0 0 10px rgba(109, 40, 217, 0.1)"},profileMeta:{display:"flex",flexDirection:"column",gap:"0.15rem",flex:1,minWidth:0},profileName:{fontWeight:600,fontSize:"0.8rem",color:"#fff",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},profileType:{fontSize:"0.7rem",color:"var(--muted)",textTransform:"uppercase"},deleteProfileBtn:{background:"none",border:"none",color:"rgba(239, 68, 68, 0.4)",cursor:"pointer",fontSize:"0.75rem",padding:"0.25rem"},tableList:{display:"flex",flexDirection:"column",gap:"0.25rem",overflowY:"auto",flex:1,minHeight:0},emptyText:{fontSize:"0.75rem",color:"var(--muted)",textAlign:"center",padding:"1rem 0"},tableTreeItem:{display:"flex",flexDirection:"column"},tableRow:{display:"flex",alignItems:"center",padding:"0.35rem 0.5rem",borderRadius:"4px",cursor:"pointer",userSelect:"none",transition:"background 0.2s ease"},tableIcon:{marginRight:"0.4rem",fontSize:"0.9rem"},tableName:{flex:1,fontSize:"0.8rem",color:"#e2e8f0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},tableChevron:{fontSize:"0.6rem",color:"var(--muted)",marginLeft:"0.25rem"},columnList:{display:"flex",flexDirection:"column",gap:"0.2rem",paddingLeft:"1.5rem",marginTop:"0.15rem",borderLeft:"1px dashed rgba(255,255,255,0.06)",marginLeft:"0.8rem",marginBottom:"0.25rem"},columnItem:{display:"flex",alignItems:"center",padding:"0.15rem 0.25rem",fontSize:"0.75rem"},columnIcon:{marginRight:"0.3rem",fontSize:"0.7rem"},columnName:{flex:1,color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis"},columnType:{fontSize:"0.65rem",color:"rgba(109, 40, 217, 0.75)",fontFamily:"monospace",paddingLeft:"0.5rem"},mainContent:{flex:1,display:"flex",flexDirection:"column",minHeight:0,backgroundColor:"#05070a"},statusBar:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 1rem",borderBottom:"1px solid var(--border)",backgroundColor:"rgba(15, 23, 42, 0.3)",flexShrink:0},statusLabel:{fontSize:"0.75rem",color:"var(--muted)"},statusValue:{fontSize:"0.8rem",fontWeight:600,color:"#fff",display:"flex",alignItems:"center",gap:"0.4rem"},readOnlyBadge:{padding:"0.1rem 0.4rem",borderRadius:"4px",backgroundColor:"rgba(234, 179, 8, 0.12)",color:"#eab308",fontSize:"0.65rem",fontWeight:700,border:"1px solid rgba(234, 179, 8, 0.2)"},runBtn:{padding:"0.4rem 0.9rem",borderRadius:"6px",border:"none",backgroundColor:"var(--primary)",color:"#fff",fontSize:"0.8rem",fontWeight:600,transition:"all 0.2s ease"},editorArea:{height:"180px",borderBottom:"1px solid var(--border)",position:"relative",flexShrink:0},textarea:{width:"100%",height:"100%",backgroundColor:"#080c14",border:"none",resize:"none",color:"#e2e8f0",fontFamily:"monospace",fontSize:"0.85rem",padding:"1rem",outline:"none",lineHeight:"1.4"},resultsArea:{flex:1,display:"flex",flexDirection:"column",minHeight:0,padding:"1rem"},errorContainer:{padding:"1rem",borderRadius:"8px",backgroundColor:"rgba(239, 68, 68, 0.08)",border:"1px solid rgba(239, 68, 68, 0.2)",overflowY:"auto"},errorText:{margin:0,fontFamily:"monospace",fontSize:"0.8rem",color:"#f87171",whiteSpace:"pre-wrap"},driverPrompt:{marginTop:"1rem",padding:"0.75rem",borderRadius:"6px",backgroundColor:"rgba(0, 0, 0, 0.3)",border:"1px solid var(--border)"},driverCode:{display:"block",padding:"0.5rem",backgroundColor:"#090d16",borderRadius:"4px",fontFamily:"monospace",fontSize:"0.8rem",color:"var(--primary)",border:"1px solid var(--border)"},resultsWrapper:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},resultsMeta:{display:"flex",justifyContent:"space-between",fontSize:"0.75rem",color:"var(--muted)",marginBottom:"0.5rem"},tableContainer:{flex:1,overflow:"auto",border:"1px solid var(--border)",borderRadius:"6px"},table:{width:"100%",borderCollapse:"collapse",fontFamily:"monospace",fontSize:"0.8rem"},th:{padding:"0.5rem 0.75rem",textAlign:"left",backgroundColor:"#0f172a",borderBottom:"1px solid var(--border)",color:"#94a3b8",fontWeight:600,position:"sticky",top:0,zIndex:1},td:{padding:"0.4rem 0.75rem",borderBottom:"1px solid rgba(255, 255, 255, 0.03)",color:"#cbd5e1",whiteSpace:"nowrap"},trEven:{backgroundColor:"transparent"},trOdd:{backgroundColor:"rgba(255, 255, 255, 0.01)"},emptyResults:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--muted)",fontSize:"0.8rem",textAlign:"center"},loadingWrapper:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"1rem"},spinnerLarge:{width:"24px",height:"24px",border:"3px solid rgba(109, 40, 217, 0.15)",borderTop:"3px solid var(--primary)",borderRadius:"50%",animation:"spin 1s linear infinite"},spinnerMini:{width:"12px",height:"12px",border:"2px solid rgba(255, 255, 255, 0.1)",borderTop:"2px solid var(--muted)",borderRadius:"50%",animation:"spin 1s linear infinite"},modalOverlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999},modalContent:{width:"480px",backgroundColor:"#0d131f",borderRadius:"12px",border:"1px solid var(--border-focus)",padding:"1.5rem",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.5)"},formRow:{display:"flex",flexDirection:"column",gap:"0.35rem",marginBottom:"1rem"},label:{fontSize:"0.75rem",fontWeight:600,color:"var(--muted)"},input:{padding:"0.5rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"#070a12",color:"#fff",outline:"none",fontSize:"0.8rem"},select:{padding:"0.5rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"#070a12",color:"#fff",outline:"none",fontSize:"0.8rem"},testResult:{padding:"0.5rem",borderRadius:"6px",fontSize:"0.75rem",marginBottom:"1rem"},modalFooter:{display:"flex",justifyContent:"space-between",marginTop:"1.5rem"},testBtn:{padding:"0.4rem 0.75rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"transparent",color:"var(--muted)",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"},cancelBtn:{padding:"0.4rem 0.75rem",borderRadius:"6px",border:"none",backgroundColor:"transparent",color:"var(--muted)",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"},saveBtn:{padding:"0.4rem 0.75rem",borderRadius:"6px",border:"none",backgroundColor:"var(--primary)",color:"#fff",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"}};if("u">typeof document){let a=document.createElement("style");a.innerHTML=`
1
+ module.exports=[41997,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});var d={BailoutToCSRError:function(){return g},isBailoutToCSRError:function(){return h}};for(var e in d)Object.defineProperty(c,e,{enumerable:!0,get:d[e]});let f="BAILOUT_TO_CLIENT_SIDE_RENDERING";class g extends Error{constructor(a){super(`Bail out to client-side rendering: ${a}`),this.reason=a,this.digest=f}}function h(a){return"object"==typeof a&&null!==a&&"digest"in a&&a.digest===f}},32245,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"BailoutToCSR",{enumerable:!0,get:function(){return e}});let d=a.r(41997);function e({reason:a,children:b}){throw Object.defineProperty(new d.BailoutToCSRError(a),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0})}},7773,(a,b,c)=>{"use strict";function d(a){return a.split("/").map(a=>encodeURIComponent(a)).join("/")}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"encodeURIPath",{enumerable:!0,get:function(){return d}})},68063,(a,b,c)=>{"use strict";let d;Object.defineProperty(c,"__esModule",{value:!0});var e={getAssetToken:function(){return i},getAssetTokenQuery:function(){return j},getDeploymentId:function(){return g},getDeploymentIdQuery:function(){return h}};for(var f in e)Object.defineProperty(c,f,{enumerable:!0,get:e[f]});function g(){return d}function h(a=!1){return d?`${a?"&":"?"}dpl=${d}`:""}function i(){return!1}function j(a=!1){return""}d=void 0},97458,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"PreloadChunks",{enumerable:!0,get:function(){return i}});let d=a.r(87924),e=a.r(35112),f=a.r(56704),g=a.r(7773),h=a.r(68063);function i({moduleIds:a}){let b=f.workAsyncStorage.getStore();if(void 0===b)return null;let c=[];if(b.reactLoadableManifest&&a){let d=b.reactLoadableManifest;for(let b of a){if(!d[b])continue;let a=d[b].files;c.push(...a)}}if(0===c.length)return null;let j=(0,h.getAssetTokenQuery)();return(0,d.jsx)(d.Fragment,{children:c.map(a=>{let c=`${b.assetPrefix}/_next/${(0,g.encodeURIPath)(a)}${j}`;return a.endsWith(".css")?(0,d.jsx)("link",{precedence:"dynamic",href:c,rel:"stylesheet",as:"style",nonce:b.nonce},a):((0,e.preload)(c,{as:"script",fetchPriority:"low",nonce:b.nonce}),null)})})}},69853,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"default",{enumerable:!0,get:function(){return j}});let d=a.r(87924),e=a.r(72131),f=a.r(32245),g=a.r(97458);function h(a){return{default:a&&"default"in a?a.default:a}}let i={loader:()=>Promise.resolve(h(()=>null)),loading:null,ssr:!0},j=function(a){let b={...i,...a},c=(0,e.lazy)(()=>b.loader().then(h)),j=b.loading;function k(a){let h=j?(0,d.jsx)(j,{isLoading:!0,pastDelay:!0,error:null}):null,i=!b.ssr||!!b.loading,k=i?e.Suspense:e.Fragment,l=b.ssr?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(g.PreloadChunks,{moduleIds:b.modules}),(0,d.jsx)(c,{...a})]}):(0,d.jsx)(f.BailoutToCSR,{reason:"next/dynamic",children:(0,d.jsx)(c,{...a})});return(0,d.jsx)(k,{...i?{fallback:h}:{},children:l})}return k.displayName="LoadableComponent",k}},19721,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"default",{enumerable:!0,get:function(){return e}});let d=a.r(33354)._(a.r(69853));function e(a,b){let c={};"function"==typeof a&&(c.loader=a);let e={...c,...b};return(0,d.default)({...e,modules:e.loadableGenerated?.modules})}("function"==typeof c.default||"object"==typeof c.default&&null!==c.default)&&void 0===c.default.__esModule&&(Object.defineProperty(c.default,"__esModule",{value:!0}),Object.assign(c.default,c),b.exports=c.default)},46845,a=>{a.v({activeBorder:"page-module___8aEwW__activeBorder",agentBadge:"page-module___8aEwW__agentBadge",agentCard:"page-module___8aEwW__agentCard",agentGrid:"page-module___8aEwW__agentGrid",agentHeader:"page-module___8aEwW__agentHeader",agentName:"page-module___8aEwW__agentName",agentStateBadge:"page-module___8aEwW__agentStateBadge",ansiCyan:"page-module___8aEwW__ansiCyan",ansiGreen:"page-module___8aEwW__ansiGreen",ansiMagenta:"page-module___8aEwW__ansiMagenta",ansiRed:"page-module___8aEwW__ansiRed",ansiYellow:"page-module___8aEwW__ansiYellow",cardBody:"page-module___8aEwW__cardBody",container:"page-module___8aEwW__container",containerActive:"page-module___8aEwW__containerActive",contextDetails:"page-module___8aEwW__contextDetails",contextItem:"page-module___8aEwW__contextItem",contextList:"page-module___8aEwW__contextList",contextMeta:"page-module___8aEwW__contextMeta",contextTitle:"page-module___8aEwW__contextTitle",dashboardGrid:"page-module___8aEwW__dashboardGrid",envGrid:"page-module___8aEwW__envGrid",envName:"page-module___8aEwW__envName",envRow:"page-module___8aEwW__envRow",envStatus:"page-module___8aEwW__envStatus",footer:"page-module___8aEwW__footer",header:"page-module___8aEwW__header",logoArea:"page-module___8aEwW__logoArea",mainPanel:"page-module___8aEwW__mainPanel",pulse:"page-module___8aEwW__pulse","pulse-attention":"page-module___8aEwW__pulse-attention","pulse-thinking":"page-module___8aEwW__pulse-thinking",pulseDot:"page-module___8aEwW__pulseDot",quickLaunchBtn:"page-module___8aEwW__quickLaunchBtn",sectionTitle:"page-module___8aEwW__sectionTitle",sidePanel:"page-module___8aEwW__sidePanel","state-complete":"page-module___8aEwW__state-complete","state-idle":"page-module___8aEwW__state-idle","state-needs-input":"page-module___8aEwW__state-needs-input","state-thinking":"page-module___8aEwW__state-thinking",statusIndicator:"page-module___8aEwW__statusIndicator",stoppedBadge:"page-module___8aEwW__stoppedBadge",subtitle:"page-module___8aEwW__subtitle",terminalContainer:"page-module___8aEwW__terminalContainer",terminalInput:"page-module___8aEwW__terminalInput",terminalInputArea:"page-module___8aEwW__terminalInputArea",terminalLine:"page-module___8aEwW__terminalLine",terminalSendBtn:"page-module___8aEwW__terminalSendBtn",title:"page-module___8aEwW__title"})},40777,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(19721),e=a.i(46845),f=a.i(35112);function g({workspaceRoot:a}){let[d,e]=(0,c.useState)({global:[],workspace:[]}),[i,j]=(0,c.useState)(null),[k,l]=(0,c.useState)(!0),[m,n]=(0,c.useState)([]),[o,p]=(0,c.useState)(null),[q,r]=(0,c.useState)({}),[s,t]=(0,c.useState)(!1),[u,v]=(0,c.useState)("SELECT * FROM sqlite_master;"),[w,x]=(0,c.useState)(!1),[y,z]=(0,c.useState)(null),[A,B]=(0,c.useState)(null),[C,D]=(0,c.useState)(null),[E,F]=(0,c.useState)(null),[G,H]=(0,c.useState)(!1),[I,J]=(0,c.useState)(!1),[K,L]=(0,c.useState)({id:"",name:"",type:"sqlite",filepath:"./dev.db",host:"localhost",port:5432,database:"postgres",username:"postgres",password:"",ssl:!1,readOnly:!0}),[M,N]=(0,c.useState)(!1),[O,P]=(0,c.useState)(null),Q=async()=>{try{let b=await fetch(`/api/sql/connections?root=${encodeURIComponent(a)}`);if(b.ok){let a=await b.json();a.success&&(e({global:a.global||[],workspace:a.workspace||[]}),j(a.activeId),l(a.isActiveGlobal))}}catch(a){console.error("Failed to load connection profiles:",a)}},R=async()=>{if(!i)return void n([]);t(!0);try{let b=await fetch(`/api/sql/schema?action=list_tables&root=${encodeURIComponent(a)}`);if(b.ok){let a=await b.json();a.success?(n(a.tables||[]),z(null)):z(a.error||"Failed to load database schema.")}else{let a=await b.json();z(a.error||"Failed to load database schema.")}}catch(a){console.error("Failed to load schema:",a)}finally{t(!1)}},S=async b=>{if(q[b])return void p(o===b?null:b);try{let c=await fetch(`/api/sql/schema?action=describe_table&table=${encodeURIComponent(b)}&root=${encodeURIComponent(a)}`);if(c.ok){let a=await c.json();a.success&&(r(c=>({...c,[b]:a.columns})),p(b))}}catch(a){console.error(`Failed to load columns for table ${b}:`,a)}};(0,c.useEffect)(()=>{Q()},[a]),(0,c.useEffect)(()=>{R(),B(null),p(null),r({});let a=k?d.global.find(a=>a.id===i):d.workspace.find(a=>a.id===i);a&&("sqlite"===a.type?v("SELECT name, type FROM sqlite_master WHERE type='table';"):"mssql"===a.type?v("SELECT * FROM sys.tables;"):v("SELECT * FROM information_schema.tables LIMIT 10;"))},[i,k,d.global.length,d.workspace.length]);let T=async(b,c)=>{try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"set_active",profileId:b,isGlobal:c,root:a})})).ok&&(j(b),l(c))}catch(a){console.error("Failed to set active profile:",a)}},U=async()=>{P(null);try{let b=await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"test",profile:K,root:a})}),c=await b.json();c.success?P({success:!0,message:"Connection test successful!"}):P({success:!1,message:c.error||"Connection test failed."})}catch(a){P({success:!1,message:a.message||"Failed to make test query."})}},V=async b=>{if(b.preventDefault(),!K.name||!K.type)return;N(!0);let c=K.id||`profile_${Math.random().toString(36).substring(7)}`,d={...K,id:c,name:K.name,type:K.type};try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"save",profile:d,isGlobal:I,root:a})})).ok&&(await Q(),H(!1),i||T(c,I))}catch(a){console.error("Failed to save profile:",a)}finally{N(!1)}},W=async(b,c)=>{if(confirm("Are you sure you want to delete this connection profile?"))try{(await fetch("/api/sql/connections",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"delete",profileId:b,isGlobal:c,root:a})})).ok&&(await Q(),i===b&&j(null))}catch(a){console.error("Failed to delete connection profile:",a)}},X=async(b,c,d,e)=>{if(Z?.readOnly)return void alert("Database connection is Read-Only. Updates are disabled.");let f=(a=>{let b=a.match(/from\s+([a-zA-Z0-9_\`"\[\]\.]+)/i);if(!b)return null;let c=b[1].trim(),d=(c=c.replace(/[\`"\[\]]/g,"")).split(".");return d[d.length-1]})(u);if(!f)return void alert("Could not extract table name from query for inline edit. Please ensure your query includes 'FROM tableName'.");F({rowIndex:b,field:c,status:"saving"});try{let e=q[f];if(!e){let b=await fetch(`/api/sql/schema?action=describe_table&table=${encodeURIComponent(f)}&root=${encodeURIComponent(a)}`);if(b.ok){let a=await b.json();a.success&&a.columns&&(e=a.columns,r(b=>({...b,[f]:a.columns})))}}if(!e)throw Error(`Could not load schema columns for table "${f}".`);let g=e.find(a=>a.isPrimaryKey);if(!g)throw Error(`Table "${f}" does not have a primary key. Inline editing requires a primary key.`);let h=A?.rows[b];if(!h||!(g.name in h))throw Error(`Primary key column "${g.name}" was not returned in the query results. Please include it in your SELECT statement.`);let i=h[g.name],j=e.find(a=>a.name===c);if(!j)throw Error(`Column "${c}" was not found in schema columns.`);let k=a=>{let b=a.toLowerCase();return b.includes("int")||b.includes("decimal")||b.includes("numeric")||b.includes("float")||b.includes("double")||b.includes("real")},l="";if("NULL"===d.toUpperCase())l=`${c} = NULL`;else if(k(j.type)){if(""===d||isNaN(Number(d)))throw Error(`Value "${d}" is not a valid number for column "${c}".`);l=`${c} = ${d}`}else l=`${c} = '${d.replace(/'/g,"''")}'`;let m="";m=k(g.type)?`${g.name} = ${i}`:`${g.name} = '${String(i).replace(/'/g,"''")}'`;let n=`UPDATE ${f} SET ${l} WHERE ${m};`,o=await fetch("/api/sql/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:n,root:a})}),p=await o.json();if(o.ok&&p.success){if(A){let a=[...A.rows],e=d;"NULL"===d.toUpperCase()?e=null:k(j.type)&&(e=Number(d)),a[b]={...a[b],[c]:e},B({...A,rows:a})}F({rowIndex:b,field:c,status:"success"}),setTimeout(()=>F(null),1500)}else throw Error(p.error||"Update database query failed.")}catch(a){F({rowIndex:b,field:c,status:"error",message:a.message}),alert(`Inline Update Failed:
2
+ ${a.message}`)}},Y=async()=>{if(u.trim()&&i){x(!0),z(null),B(null);try{let b=await fetch("/api/sql/query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sql:u.trim(),root:a})}),c=await b.json();b.ok&&c.success?(B({rows:c.rows||[],fields:c.fields||[],durationMs:c.durationMs||0,affectedRows:c.affectedRows}),(u.toLowerCase().includes("create table")||u.toLowerCase().includes("drop table")||u.toLowerCase().includes("alter table"))&&R()):z(c.error||"Failed to execute query.")}catch(a){z(a.message||"An unexpected error occurred during execution.")}finally{x(!1)}}},Z=k?d.global.find(a=>a.id===i):d.workspace.find(a=>a.id===i);return(0,b.jsxs)("div",{style:h.container,children:[(0,b.jsxs)("div",{style:h.sidebar,children:[(0,b.jsxs)("div",{style:h.section,children:[(0,b.jsxs)("div",{style:h.sectionHeader,children:[(0,b.jsx)("span",{style:h.sectionTitle,children:"Connections"}),(0,b.jsx)("button",{style:h.addBtn,onClick:()=>{P(null),L({id:"",name:"",type:"sqlite",filepath:"./dev.db",host:"localhost",port:5432,database:"postgres",username:"postgres",password:"",ssl:!1,readOnly:!0}),J(!1),H(!0)},title:"Add Database Connection Profile",children:"➕ Add"})]}),(0,b.jsxs)("div",{style:h.profileList,children:[0===d.global.length&&0===d.workspace.length&&(0,b.jsx)("div",{style:h.emptyText,children:"No connections configured. Add one to start."}),d.workspace.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{style:h.groupHeader,children:"WORKSPACE CONNECTIONS"}),d.workspace.map(a=>(0,b.jsxs)("div",{style:{...h.profileItem,...i===a.id&&!k?h.profileItemActive:{}},onClick:()=>T(a.id,!1),children:[(0,b.jsxs)("div",{style:h.profileMeta,children:[(0,b.jsxs)("span",{style:h.profileName,children:["📁 ",a.name]}),(0,b.jsx)("span",{style:h.profileType,children:a.type})]}),(0,b.jsx)("button",{style:h.deleteProfileBtn,onClick:b=>{b.stopPropagation(),W(a.id,!1)},children:"✖"})]},a.id))]}),d.global.length>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{style:h.groupHeader,children:"GLOBAL CONNECTIONS"}),d.global.map(a=>(0,b.jsxs)("div",{style:{...h.profileItem,...i===a.id&&k?h.profileItemActive:{}},onClick:()=>T(a.id,!0),children:[(0,b.jsxs)("div",{style:h.profileMeta,children:[(0,b.jsxs)("span",{style:h.profileName,children:["🌐 ",a.name]}),(0,b.jsx)("span",{style:h.profileType,children:a.type})]}),(0,b.jsx)("button",{style:h.deleteProfileBtn,onClick:b=>{b.stopPropagation(),W(a.id,!0)},children:"✖"})]},a.id))]})]})]}),(0,b.jsxs)("div",{style:{...h.section,flex:1,borderTop:"1px solid var(--border)"},children:[(0,b.jsxs)("div",{style:h.sectionHeader,children:[(0,b.jsx)("span",{style:h.sectionTitle,children:"Schema Tables"}),s&&(0,b.jsx)("span",{style:h.spinnerMini})]}),(0,b.jsxs)("div",{style:h.tableList,children:[!i&&(0,b.jsx)("div",{style:h.emptyText,children:"Select an active connection to view tables."}),i&&0===m.length&&!s&&(0,b.jsx)("div",{style:h.emptyText,children:"No tables found in database schema."}),m.map(a=>(0,b.jsxs)("div",{style:h.tableTreeItem,children:[(0,b.jsxs)("div",{style:h.tableRow,onClick:()=>S(a.name),children:[(0,b.jsx)("span",{style:h.tableIcon,children:"view"===a.type?"👁️":"📊"}),(0,b.jsx)("span",{style:h.tableName,children:a.name}),(0,b.jsx)("span",{style:h.tableChevron,children:o===a.name?"▼":"▶"})]}),o===a.name&&q[a.name]&&(0,b.jsx)("div",{style:h.columnList,children:q[a.name].map(a=>(0,b.jsxs)("div",{style:h.columnItem,children:[(0,b.jsx)("span",{style:h.columnIcon,children:a.isPrimaryKey?"🔑":a.isForeignKey?"🔗":"▫"}),(0,b.jsx)("span",{style:h.columnName,title:a.type,children:a.name}),(0,b.jsx)("span",{style:h.columnType,children:a.type.toLowerCase().substring(0,12)})]},a.name))})]},a.name))]})]})]}),(0,b.jsxs)("div",{style:h.mainContent,children:[(0,b.jsxs)("div",{style:h.statusBar,children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,b.jsx)("span",{style:h.statusLabel,children:"Active Connection:"}),Z?(0,b.jsxs)("span",{style:h.statusValue,children:[k?"🌐":"📁"," ",Z.name," (",Z.type,")",Z.readOnly&&(0,b.jsx)("span",{style:h.readOnlyBadge,children:"Read-Only"})]}):(0,b.jsx)("span",{style:{...h.statusValue,color:"var(--danger)"},children:"No Connection Selected"})]}),(0,b.jsx)("button",{style:{...h.runBtn,opacity:!i||w?.6:1,cursor:!i||w?"not-allowed":"pointer"},onClick:Y,disabled:!i||w,children:w?"⌛ Running...":"⚡ Execute Query (F5)"})]}),(0,b.jsx)("div",{style:h.editorArea,children:(0,b.jsx)("textarea",{style:h.textarea,value:u,onChange:a=>v(a.target.value),placeholder:"Write your SQL query script here...",onKeyDown:a=>{("F5"===a.key||a.ctrlKey&&"Enter"===a.key)&&(a.preventDefault(),Y())}})}),(0,b.jsxs)("div",{style:h.resultsArea,children:[y&&(0,b.jsxs)("div",{style:h.errorContainer,children:[(0,b.jsx)("h4",{style:{margin:"0 0 0.5rem 0",color:"var(--danger)"},children:"⚠️ Execution Error"}),(0,b.jsx)("pre",{style:h.errorText,children:y}),y.includes("not installed")&&(0,b.jsxs)("div",{style:h.driverPrompt,children:[(0,b.jsx)("p",{style:{margin:"0 0 0.5rem 0"},children:"To resolve this, run this installer command in your workspace terminal:"}),(0,b.jsx)("code",{style:h.driverCode,children:Z?.type==="sqlite"?"npm install better-sqlite3":Z?.type==="postgres"?"npm install pg":Z?.type==="mysql"?"npm install mysql2":"npm install mssql"})]})]}),A&&(0,b.jsxs)("div",{style:h.resultsWrapper,children:[(0,b.jsxs)("div",{style:h.resultsMeta,children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,b.jsxs)("span",{children:["Query completed."," ",void 0!==A.affectedRows?`Affected rows: ${A.affectedRows}`:`Returned ${A.rows.length} rows`]}),(0,b.jsxs)("span",{children:["Duration: ",A.durationMs,"ms"]})]}),A.rows.length>0&&(0,b.jsxs)("div",{style:{display:"flex",gap:"0.4rem"},children:[(0,b.jsx)("button",{onClick:()=>{if(A&&0!==A.rows.length)try{let a=A.fields.join(","),b=A.rows.map(a=>A.fields.map(b=>{let c=a[b];if(null===c)return"NULL";let d=String(c);return d.includes(",")||d.includes('"')||d.includes("\n")||d.includes("\r")?`"${d.replace(/"/g,'""')}"`:d}).join(",")),c=[a,...b].join("\r\n"),d=new Blob([c],{type:"text/csv;charset=utf-8;"}),e=URL.createObjectURL(d),f=document.createElement("a");f.setAttribute("href",e),f.setAttribute("download",`query-results-${Date.now()}.csv`),document.body.appendChild(f),f.click(),document.body.removeChild(f)}catch(a){console.error("Export CSV failed:",a),alert("Failed to export as CSV")}},style:h.exportBtn,children:"📥 Export CSV"}),(0,b.jsx)("button",{onClick:()=>{if(A&&0!==A.rows.length)try{let a=JSON.stringify(A.rows,null,2),b=new Blob([a],{type:"application/json;charset=utf-8;"}),c=URL.createObjectURL(b),d=document.createElement("a");d.setAttribute("href",c),d.setAttribute("download",`query-results-${Date.now()}.json`),document.body.appendChild(d),d.click(),document.body.removeChild(d)}catch(a){console.error("Export JSON failed:",a),alert("Failed to export as JSON")}},style:h.exportBtn,children:"📥 Export JSON"})]})]}),A.rows.length>0?(0,b.jsx)("div",{style:h.tableContainer,children:(0,b.jsxs)("table",{style:h.table,children:[(0,b.jsx)("thead",{children:(0,b.jsx)("tr",{children:A.fields.map(a=>(0,b.jsx)("th",{style:h.th,children:a},a))})}),(0,b.jsx)("tbody",{children:A.rows.map((a,c)=>(0,b.jsx)("tr",{style:c%2==0?h.trEven:h.trOdd,children:A.fields.map(d=>{let e=C&&C.rowIndex===c&&C.field===d,f=E&&E.rowIndex===c&&E.field===d&&"saving"===E.status,g=E&&E.rowIndex===c&&E.field===d&&"success"===E.status,i=E&&E.rowIndex===c&&E.field===d&&"error"===E.status,j={...h.td,...h.editableCell};return f?j={...j,backgroundColor:"rgba(168, 85, 247, 0.15)"}:g?j={...j,backgroundColor:"rgba(16, 185, 129, 0.25)"}:i&&(j={...j,backgroundColor:"rgba(239, 68, 68, 0.25)"}),(0,b.jsx)("td",{style:j,onDoubleClick:()=>{Z?.readOnly?alert("Database connection is Read-Only. Editing is disabled."):D({rowIndex:c,field:d,value:null===a[d]?"NULL":String(a[d])})},className:"db-cell",title:"Double click to edit cell",children:e?(0,b.jsx)("input",{style:h.cellInput,value:C.value,autoFocus:!0,onChange:a=>D({...C,value:a.target.value}),onKeyDown:async b=>{if("Enter"===b.key){b.preventDefault();let e=C.value;D(null),e!==(null===a[d]?"NULL":String(a[d]))&&await X(c,d,e,a[d])}else"Escape"===b.key&&D(null)},onBlur:async()=>{let b=C.value;D(null),b!==(null===a[d]?"NULL":String(a[d]))&&await X(c,d,b,a[d])}}):null===a[d]?"NULL":"object"==typeof a[d]?JSON.stringify(a[d]):String(a[d])},d)})},c))})]})}):void 0===A.affectedRows&&(0,b.jsx)("div",{style:h.emptyResults,children:"Query executed successfully, but returned 0 results."})]}),!y&&!A&&!w&&(0,b.jsx)("div",{style:h.emptyResults,children:"Write a query script and click Execute to view table records."}),w&&(0,b.jsxs)("div",{style:h.loadingWrapper,children:[(0,b.jsx)("span",{style:h.spinnerLarge}),(0,b.jsx)("span",{style:{color:"var(--muted)"},children:"Running database statement..."})]})]})]}),G&&"u">typeof document&&(0,f.createPortal)((0,b.jsx)("div",{style:h.modalOverlay,children:(0,b.jsxs)("div",{style:h.modalContent,children:[(0,b.jsxs)("h3",{style:{margin:"0 0 1rem 0",display:"flex",justifyContent:"space-between"},children:[(0,b.jsx)("span",{children:"🔌 Add Database Profile"}),(0,b.jsx)("span",{style:{cursor:"pointer"},onClick:()=>H(!1),children:"✖"})]}),(0,b.jsxs)("form",{onSubmit:V,children:[(0,b.jsxs)("div",{style:h.formRow,children:[(0,b.jsx)("label",{style:h.label,children:"Profile Name"}),(0,b.jsx)("input",{style:h.input,type:"text",required:!0,value:K.name,onChange:a=>L(b=>({...b,name:a.target.value})),placeholder:"e.g. Local Postgres, Dev SQLite"})]}),(0,b.jsxs)("div",{style:h.formRow,children:[(0,b.jsx)("label",{style:h.label,children:"Scope Level"}),(0,b.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,b.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,b.jsx)("input",{type:"radio",checked:!I,onChange:()=>J(!1)}),"Workspace Local"]}),(0,b.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,b.jsx)("input",{type:"radio",checked:I,onChange:()=>J(!0)}),"Global User Profile"]})]})]}),(0,b.jsxs)("div",{style:h.formRow,children:[(0,b.jsx)("label",{style:h.label,children:"Database Type"}),(0,b.jsxs)("select",{style:h.select,value:K.type,onChange:a=>{let b=a.target.value,c=5432;"mysql"===b&&(c=3306),"mssql"===b&&(c=1433),L(a=>({...a,type:b,filepath:"sqlite"===b?"./dev.db":void 0,port:"sqlite"!==b?c:void 0,database:"sqlite"===b?void 0:"mssql"===b?"master":"postgres"===b?"postgres":"",username:"sqlite"===b?void 0:"mssql"===b?"sa":"postgres"===b?"postgres":"root"}))},children:[(0,b.jsx)("option",{value:"sqlite",children:"SQLite (Local File)"}),(0,b.jsx)("option",{value:"postgres",children:"PostgreSQL"}),(0,b.jsx)("option",{value:"mysql",children:"MySQL"}),(0,b.jsx)("option",{value:"mssql",children:"Microsoft SQL Server"})]})]}),"sqlite"===K.type?(0,b.jsxs)("div",{style:h.formRow,children:[(0,b.jsx)("label",{style:h.label,children:"Database File Path"}),(0,b.jsx)("input",{style:h.input,type:"text",required:!0,value:K.filepath||"",onChange:a=>L(b=>({...b,filepath:a.target.value})),placeholder:"Relative (e.g. ./data/dev.db) or Absolute path"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,b.jsxs)("div",{style:{...h.formRow,flex:3},children:[(0,b.jsx)("label",{style:h.label,children:"Host IP Address"}),(0,b.jsx)("input",{style:h.input,type:"text",required:!0,value:K.host||"",onChange:a=>L(b=>({...b,host:a.target.value})),placeholder:"localhost or IP"})]}),(0,b.jsxs)("div",{style:{...h.formRow,flex:1},children:[(0,b.jsx)("label",{style:h.label,children:"Port"}),(0,b.jsx)("input",{style:h.input,type:"number",required:!0,value:K.port||0,onChange:a=>L(b=>({...b,port:parseInt(a.target.value)}))})]})]}),(0,b.jsxs)("div",{style:h.formRow,children:[(0,b.jsx)("label",{style:h.label,children:"Database Name"}),(0,b.jsx)("input",{style:h.input,type:"text",required:!0,value:K.database||"",onChange:a=>L(b=>({...b,database:a.target.value}))})]}),(0,b.jsxs)("div",{style:{display:"flex",gap:"1rem"},children:[(0,b.jsxs)("div",{style:{...h.formRow,flex:1},children:[(0,b.jsx)("label",{style:h.label,children:"Username"}),(0,b.jsx)("input",{style:h.input,type:"text",required:!0,value:K.username||"",onChange:a=>L(b=>({...b,username:a.target.value}))})]}),(0,b.jsxs)("div",{style:{...h.formRow,flex:1},children:[(0,b.jsx)("label",{style:h.label,children:"Password"}),(0,b.jsx)("input",{style:h.input,type:"password",value:K.password||"",onChange:a=>L(b=>({...b,password:a.target.value}))})]})]}),("postgres"===K.type||"mssql"===K.type)&&(0,b.jsx)("div",{style:h.formRow,children:(0,b.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,b.jsx)("input",{type:"checkbox",checked:!!K.ssl,onChange:a=>L(b=>({...b,ssl:a.target.checked}))}),"Require SSL Secure Connection"]})})]}),(0,b.jsx)("div",{style:h.formRow,children:(0,b.jsxs)("label",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:"0.25rem"},children:[(0,b.jsx)("input",{type:"checkbox",checked:!!K.readOnly,onChange:a=>L(b=>({...b,readOnly:a.target.checked}))}),"Enforce Read-Only Connection (Disable mutations)"]})}),O&&(0,b.jsx)("div",{style:{...h.testResult,backgroundColor:O.success?"rgba(16, 185, 129, 0.12)":"rgba(239, 68, 68, 0.12)",border:O.success?"1px solid var(--success)":"1px solid var(--danger)",color:O.success?"var(--success)":"var(--danger)"},children:O.message}),(0,b.jsxs)("div",{style:h.modalFooter,children:[(0,b.jsx)("button",{type:"button",style:h.testBtn,onClick:U,children:"🔍 Test Connection"}),(0,b.jsxs)("div",{style:{display:"flex",gap:"0.5rem"},children:[(0,b.jsx)("button",{type:"button",style:h.cancelBtn,onClick:()=>H(!1),children:"Cancel"}),(0,b.jsx)("button",{type:"submit",style:h.saveBtn,disabled:M,children:M?"Saving...":"Save Profile"})]})]})]})]})}),document.body)]})}let h={container:{display:"flex",height:"100%",width:"100%",backgroundColor:"#05070a",color:"#cbd5e1",fontSize:"0.875rem",minHeight:0},sidebar:{width:"280px",borderRight:"1px solid var(--border)",display:"flex",flexDirection:"column",minHeight:0,backgroundColor:"rgba(10, 15, 24, 0.4)",flexShrink:0},section:{display:"flex",flexDirection:"column",padding:"1rem",minHeight:0},sectionHeader:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"0.75rem"},sectionTitle:{fontWeight:700,letterSpacing:"0.05em",textTransform:"uppercase",fontSize:"0.75rem",color:"var(--muted)"},addBtn:{padding:"0.2rem 0.5rem",borderRadius:"4px",border:"1px solid var(--primary)",backgroundColor:"transparent",color:"var(--primary)",fontSize:"0.7rem",fontWeight:600,cursor:"pointer"},profileList:{display:"flex",flexDirection:"column",gap:"0.4rem",overflowY:"auto",maxHeight:"220px"},groupHeader:{fontSize:"0.65rem",fontWeight:600,color:"var(--muted)",marginTop:"0.5rem",marginBottom:"0.2rem",letterSpacing:"0.05em"},profileItem:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.5rem 0.6rem",borderRadius:"6px",backgroundColor:"rgba(255, 255, 255, 0.02)",border:"1px solid var(--border)",cursor:"pointer",transition:"all 0.2s ease"},profileItemActive:{backgroundColor:"rgba(109, 40, 217, 0.08)",border:"1px solid var(--border-focus)",boxShadow:"0 0 10px rgba(109, 40, 217, 0.1)"},profileMeta:{display:"flex",flexDirection:"column",gap:"0.15rem",flex:1,minWidth:0},profileName:{fontWeight:600,fontSize:"0.8rem",color:"#fff",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},profileType:{fontSize:"0.7rem",color:"var(--muted)",textTransform:"uppercase"},deleteProfileBtn:{background:"none",border:"none",color:"rgba(239, 68, 68, 0.4)",cursor:"pointer",fontSize:"0.75rem",padding:"0.25rem"},tableList:{display:"flex",flexDirection:"column",gap:"0.25rem",overflowY:"auto",flex:1,minHeight:0},emptyText:{fontSize:"0.75rem",color:"var(--muted)",textAlign:"center",padding:"1rem 0"},tableTreeItem:{display:"flex",flexDirection:"column"},tableRow:{display:"flex",alignItems:"center",padding:"0.35rem 0.5rem",borderRadius:"4px",cursor:"pointer",userSelect:"none",transition:"background 0.2s ease"},tableIcon:{marginRight:"0.4rem",fontSize:"0.9rem"},tableName:{flex:1,fontSize:"0.8rem",color:"#e2e8f0",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},tableChevron:{fontSize:"0.6rem",color:"var(--muted)",marginLeft:"0.25rem"},columnList:{display:"flex",flexDirection:"column",gap:"0.2rem",paddingLeft:"1.5rem",marginTop:"0.15rem",borderLeft:"1px dashed rgba(255,255,255,0.06)",marginLeft:"0.8rem",marginBottom:"0.25rem"},columnItem:{display:"flex",alignItems:"center",padding:"0.15rem 0.25rem",fontSize:"0.75rem"},columnIcon:{marginRight:"0.3rem",fontSize:"0.7rem"},columnName:{flex:1,color:"var(--muted)",overflow:"hidden",textOverflow:"ellipsis"},columnType:{fontSize:"0.65rem",color:"rgba(109, 40, 217, 0.75)",fontFamily:"monospace",paddingLeft:"0.5rem"},mainContent:{flex:1,display:"flex",flexDirection:"column",minHeight:0,backgroundColor:"#05070a"},statusBar:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0.75rem 1rem",borderBottom:"1px solid var(--border)",backgroundColor:"rgba(15, 23, 42, 0.3)",flexShrink:0},statusLabel:{fontSize:"0.75rem",color:"var(--muted)"},statusValue:{fontSize:"0.8rem",fontWeight:600,color:"#fff",display:"flex",alignItems:"center",gap:"0.4rem"},readOnlyBadge:{padding:"0.1rem 0.4rem",borderRadius:"4px",backgroundColor:"rgba(234, 179, 8, 0.12)",color:"#eab308",fontSize:"0.65rem",fontWeight:700,border:"1px solid rgba(234, 179, 8, 0.2)"},runBtn:{padding:"0.4rem 0.9rem",borderRadius:"6px",border:"none",backgroundColor:"var(--primary)",color:"#fff",fontSize:"0.8rem",fontWeight:600,transition:"all 0.2s ease"},editorArea:{height:"180px",borderBottom:"1px solid var(--border)",position:"relative",flexShrink:0},textarea:{width:"100%",height:"100%",backgroundColor:"#080c14",border:"none",resize:"none",color:"#e2e8f0",fontFamily:"monospace",fontSize:"0.85rem",padding:"1rem",outline:"none",lineHeight:"1.4"},resultsArea:{flex:1,display:"flex",flexDirection:"column",minHeight:0,padding:"1rem"},errorContainer:{padding:"1rem",borderRadius:"8px",backgroundColor:"rgba(239, 68, 68, 0.08)",border:"1px solid rgba(239, 68, 68, 0.2)",overflowY:"auto"},errorText:{margin:0,fontFamily:"monospace",fontSize:"0.8rem",color:"#f87171",whiteSpace:"pre-wrap"},driverPrompt:{marginTop:"1rem",padding:"0.75rem",borderRadius:"6px",backgroundColor:"rgba(0, 0, 0, 0.3)",border:"1px solid var(--border)"},driverCode:{display:"block",padding:"0.5rem",backgroundColor:"#090d16",borderRadius:"4px",fontFamily:"monospace",fontSize:"0.8rem",color:"var(--primary)",border:"1px solid var(--border)"},resultsWrapper:{display:"flex",flexDirection:"column",height:"100%",minHeight:0},resultsMeta:{display:"flex",justifyContent:"space-between",alignItems:"center",fontSize:"0.75rem",color:"var(--muted)",marginBottom:"0.5rem"},tableContainer:{flex:1,overflow:"auto",border:"1px solid var(--border)",borderRadius:"6px"},table:{width:"100%",borderCollapse:"collapse",fontFamily:"monospace",fontSize:"0.8rem"},th:{padding:"0.5rem 0.75rem",textAlign:"left",backgroundColor:"#0f172a",borderBottom:"1px solid var(--border)",color:"#94a3b8",fontWeight:600,position:"sticky",top:0,zIndex:1},td:{padding:"0.4rem 0.75rem",borderBottom:"1px solid rgba(255, 255, 255, 0.03)",color:"#cbd5e1",whiteSpace:"nowrap"},exportBtn:{padding:"0.2rem 0.5rem",borderRadius:"4px",border:"1px solid var(--border)",backgroundColor:"rgba(255, 255, 255, 0.02)",color:"var(--muted)",fontSize:"0.7rem",fontWeight:600,cursor:"pointer",transition:"all 0.15s ease"},cellInput:{width:"100%",backgroundColor:"#070a12",border:"1px solid var(--border-focus)",borderRadius:"3px",color:"#fff",padding:"0.1rem 0.3rem",fontSize:"0.8rem",fontFamily:"monospace",outline:"none"},editableCell:{cursor:"pointer",transition:"all 0.15s ease"},trEven:{backgroundColor:"transparent"},trOdd:{backgroundColor:"rgba(255, 255, 255, 0.01)"},emptyResults:{flex:1,display:"flex",alignItems:"center",justifyContent:"center",color:"var(--muted)",fontSize:"0.8rem",textAlign:"center"},loadingWrapper:{flex:1,display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"1rem"},spinnerLarge:{width:"24px",height:"24px",border:"3px solid rgba(109, 40, 217, 0.15)",borderTop:"3px solid var(--primary)",borderRadius:"50%",animation:"spin 1s linear infinite"},spinnerMini:{width:"12px",height:"12px",border:"2px solid rgba(255, 255, 255, 0.1)",borderTop:"2px solid var(--muted)",borderRadius:"50%",animation:"spin 1s linear infinite"},modalOverlay:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999},modalContent:{width:"480px",backgroundColor:"#0d131f",borderRadius:"12px",border:"1px solid var(--border-focus)",padding:"1.5rem",boxShadow:"0 4px 24px rgba(0, 0, 0, 0.5)"},formRow:{display:"flex",flexDirection:"column",gap:"0.35rem",marginBottom:"1rem"},label:{fontSize:"0.75rem",fontWeight:600,color:"var(--muted)"},input:{padding:"0.5rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"#070a12",color:"#fff",outline:"none",fontSize:"0.8rem"},select:{padding:"0.5rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"#070a12",color:"#fff",outline:"none",fontSize:"0.8rem"},testResult:{padding:"0.5rem",borderRadius:"6px",fontSize:"0.75rem",marginBottom:"1rem"},modalFooter:{display:"flex",justifyContent:"space-between",marginTop:"1.5rem"},testBtn:{padding:"0.4rem 0.75rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"transparent",color:"var(--muted)",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"},cancelBtn:{padding:"0.4rem 0.75rem",borderRadius:"6px",border:"none",backgroundColor:"transparent",color:"var(--muted)",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"},saveBtn:{padding:"0.4rem 0.75rem",borderRadius:"6px",border:"none",backgroundColor:"var(--primary)",color:"#fff",fontSize:"0.75rem",fontWeight:600,cursor:"pointer"}};if("u">typeof document){let a=document.createElement("style");a.innerHTML=`
2
3
  @keyframes spin {
3
4
  0% { transform: rotate(0deg); }
4
5
  100% { transform: rotate(360deg); }
5
6
  }
7
+ .db-cell:hover {
8
+ background-color: rgba(255, 255, 255, 0.03) !important;
9
+ outline: 1px dashed rgba(255, 255, 255, 0.2);
10
+ }
6
11
  `,document.head.appendChild(a)}let i=a=>"mock"===a?"🧪":a.includes("-docker")?"🐳":a.includes("-ssh")?"🌐":"💻",j=(0,d.default)(async()=>{},{loadableGenerated:{modules:[37314]},ssr:!1,loading:()=>(0,b.jsx)("div",{style:{height:"400px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#05070a",color:"var(--muted)",border:"1px solid var(--border)",borderBottomLeftRadius:"12px",borderBottomRightRadius:"12px"},children:(0,b.jsx)("span",{children:"Initializing terminal emulator..."})})}),k=(0,d.default)(async()=>{},{loadableGenerated:{modules:[1985]},ssr:!1,loading:()=>(0,b.jsx)("div",{style:{height:"280px",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--card)",border:"1px solid var(--border)",borderRadius:"12px",marginTop:"1.5rem"},children:(0,b.jsx)("span",{style:{color:"var(--muted)"},children:"Initializing prompt editor..."})})}),l=(0,d.default)(async()=>{},{loadableGenerated:{modules:[99026]},ssr:!1}),m=(0,d.default)(async()=>{},{loadableGenerated:{modules:[9949]},ssr:!1}),n=(0,d.default)(async()=>{},{loadableGenerated:{modules:[20032]},ssr:!1}),o=(0,d.default)(async()=>{},{loadableGenerated:{modules:[97722]},ssr:!1});a.s(["default",0,function(){let[a,d]=(0,c.useState)([]),[f,h]=(0,c.useState)(null),[p,q]=(0,c.useState)(!1),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(!1),[v,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)(!1),[z,A]=(0,c.useState)(!1),[B,C]=(0,c.useState)(""),[D,E]=(0,c.useState)(3001),[F,G]=(0,c.useState)("0.2.19"),[H,I]=(0,c.useState)(null),J=a.filter(a=>"workspace-terminal"!==a.id),K=a.find(a=>a.id===f),L=J.some(a=>("claude-docker"===a.type||"aider-docker"===a.type)&&"running"===a.status),M=J.some(a=>"claude-ssh"===a.type&&"running"===a.status),N=async()=>{try{let a=await fetch("/api/sessions"),b=await a.json();b.sessions&&d(b.sessions),b.wsPort&&E(b.wsPort),b.originalCwd&&C(b.originalCwd),b.version&&G(b.version)}catch(a){console.error("Failed to fetch sessions:",a)}},O=async()=>{try{let a=await fetch("/api/recents");if(a.ok){let b=await a.json();b.success&&b.recents&&b.recents.lastSession&&I(b.recents.lastSession)}}catch(a){console.error("Failed to fetch recents:",a)}};(0,c.useEffect)(()=>{(async()=>{await N(),await O()})(),"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then(a=>console.log("Service Worker registered:",a.scope)).catch(a=>console.error("Service Worker registration failed:",a));let a=setInterval(N,4e3);return()=>clearInterval(a)},[]);let P=async(a,b,c,d)=>{q(!0);try{let e=b;e||("claude"===a?e="Claude Local":"claude-docker"===a?e="Claude Docker":"claude-ssh"===a?e="Claude SSH":"aider"===a?e="Aider Local":"aider-docker"===a?e="Aider Docker":"mock"===a&&(e="Mock Session"));let f={type:a,name:e,workspaceRoot:c,scopedDirs:d};if(("aider"===a||"aider-docker"===a)&&!c)try{let a=await fetch("/api/context/aider");if(a.ok){let b=await a.json();b.success&&b.config&&(f.workspaceRoot=b.config.workspaceRoot,f.scopedDirs=b.config.scopedDirs)}}catch(a){console.error("Failed to load aider configuration before launch:",a)}let g=await fetch("/api/sessions/launch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}),i=await g.json();i.success&&(await N(),h(i.session.id),I({type:a,name:e,workspaceRoot:c,scopedDirs:d}))}catch(a){console.error("Failed to launch session:",a)}finally{q(!1)}},Q=async(a,b=!1)=>{try{let c=await fetch("/api/sessions/stop",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a,delete:b})});(await c.json()).success&&(b&&f===a&&h(null),await N())}catch(a){console.error("Failed to stop session:",a)}};return(0,b.jsxs)("div",{className:`${e.default.container} ${K?e.default.containerActive:""}`,children:[(0,b.jsxs)("header",{className:e.default.header,children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"1.5rem"},children:[(0,b.jsx)("img",{src:"/logo.png",alt:"NeuralLoom Logo",style:{width:"160px",height:"160px",borderRadius:"16px",objectFit:"contain"}}),(0,b.jsxs)("div",{className:e.default.logoArea,children:[(0,b.jsx)("h1",{className:e.default.title,style:{margin:0,lineHeight:1.1},children:"NeuralLoom"}),(0,b.jsx)("span",{className:e.default.subtitle,children:"Unified AI Orchestrator & Context Bridge"})]})]}),(0,b.jsxs)("div",{className:e.default.statusIndicator,children:[(0,b.jsx)("span",{className:e.default.pulseDot}),(0,b.jsx)("span",{children:"Orchestrator Online"})]})]}),K?(0,b.jsx)("div",{style:{flex:1,minHeight:0,display:"flex",flexDirection:"column"},children:(0,b.jsx)(o,{sessionId:K.id,workspaceRoot:K.workspaceRoot||"",scopedDirs:K.scopedDirs||[],onClose:()=>h(null),sessions:a,onSwitchSession:a=>h(a),onRefreshSessions:N,wsPort:D})}):(0,b.jsxs)("div",{className:e.default.dashboardGrid,children:[(0,b.jsxs)("main",{className:e.default.mainPanel,children:[(0,b.jsxs)("section",{children:[(0,b.jsx)("h2",{className:e.default.sectionTitle,children:"Active AI Agents"}),0===J.length?(0,b.jsxs)("div",{className:"card",style:{padding:"3rem 1.5rem",textAlign:"center"},children:[(0,b.jsx)("p",{style:{color:"var(--muted)",marginBottom:"1.5rem"},children:"No active agent sessions in this workspace. Launch a Claude or Aider agent session to begin."}),(0,b.jsxs)("div",{style:{display:"flex",gap:"1rem",justifyContent:"center",flexWrap:"wrap"},children:[H&&(0,b.jsx)("button",{className:e.default.quickLaunchBtn,onClick:()=>{P(H.type,H.name,H.workspaceRoot,H.scopedDirs)},disabled:p,style:{background:"linear-gradient(135deg, hsl(38, 92%, 50%) 0%, hsl(0, 84%, 60%) 100%)",border:"none",maxWidth:"200px"},title:`Re-launch: ${H.name||H.type}`,children:"⚡ Re-launch Last Session"}),(0,b.jsx)("button",{className:e.default.quickLaunchBtn,onClick:()=>{A(!1),y(!0)},disabled:p,style:{background:"linear-gradient(135deg, hsl(262, 83%, 60%) 0%, hsl(195, 100%, 45%) 100%)",border:"none",maxWidth:"200px"},children:"Launch Claude PTY"}),(0,b.jsx)("button",{className:e.default.quickLaunchBtn,onClick:()=>{w(!1),u(!0)},disabled:p,style:{background:"linear-gradient(135deg, hsl(210, 80%, 45%) 0%, hsl(262, 80%, 55%) 100%)",border:"none",maxWidth:"200px"},children:"Launch Aider PTY"})]}),(0,b.jsxs)("div",{style:{marginTop:"1.5rem",fontSize:"0.75rem",color:"var(--muted)"},children:["Want to verify layout features first?"," ",(0,b.jsx)("span",{onClick:()=>P("mock"),style:{color:"var(--primary)",cursor:"pointer",textDecoration:"underline"},children:"Start simulated sandbox session"})]})]}):(0,b.jsx)("div",{className:e.default.agentGrid,children:J.map(a=>(0,b.jsxs)("div",{className:`${e.default.agentCard} card ${f===a.id?e.default.activeBorder:""}`,children:[(0,b.jsxs)("div",{className:e.default.agentHeader,children:[(0,b.jsx)("span",{className:e.default.agentName,children:a.name}),(0,b.jsxs)("div",{style:{display:"flex",gap:"0.35rem",alignItems:"center"},children:["running"===a.status&&a.agentState&&(0,b.jsxs)("span",{className:`${e.default.agentStateBadge} ${e.default["state-"+a.agentState]}`,children:["thinking"===a.agentState&&`${i(a.type)} 💭 thinking`,"needs-input"===a.agentState&&`${i(a.type)} ⚠️ needs input`,"complete"===a.agentState&&`${i(a.type)} ✅ complete`,"idle"===a.agentState&&`${i(a.type)} 💤 idle`]}),(0,b.jsx)("span",{className:`${e.default.agentBadge} ${"stopped"===a.status?e.default.stoppedBadge:""}`,children:a.status})]})]}),(0,b.jsxs)("div",{className:e.default.cardBody,children:[(0,b.jsxs)("p",{style:{fontSize:"0.825rem",color:"var(--muted)"},children:["ID: ",(0,b.jsx)("code",{style:{fontSize:"0.75rem"},children:a.id.substring(0,8)}),(0,b.jsx)("br",{}),"Type: ","claude"===a.type?"Claude Local PTY":"claude-docker"===a.type?"Claude Docker PTY":"claude-ssh"===a.type?"Claude SSH PTY":"aider"===a.type?"Aider Local PTY":"aider-docker"===a.type?"Aider Docker PTY":"mock"===a.type?"Simulated Mock PTY":"Unknown PTY",(0,b.jsx)("br",{}),"Logs: ",a.logsCount," captured lines"]}),(0,b.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"1rem"},children:["running"===a.status?(0,b.jsx)("button",{onClick:()=>Q(a.id,!1),style:{flex:1,padding:"0.4rem 0.6rem",borderRadius:"6px",border:"1px solid var(--danger)",backgroundColor:"transparent",fontSize:"0.75rem",fontWeight:600,color:"var(--danger)"},children:"Stop"}):(0,b.jsx)("button",{onClick:()=>Q(a.id,!0),style:{flex:1,padding:"0.4rem 0.6rem",borderRadius:"6px",border:"1px solid var(--border)",backgroundColor:"transparent",fontSize:"0.75rem",fontWeight:600,color:"var(--muted)"},children:"Delete"}),(0,b.jsx)("button",{onClick:()=>h(a.id),style:{flex:2,padding:"0.4rem 0.6rem",borderRadius:"6px",border:"none",backgroundColor:f===a.id?"var(--border-focus)":"var(--primary)",fontSize:"0.75rem",fontWeight:600,color:"#fff"},children:f===a.id?"Connected":"Open Session"})]})]})]},a.id))})]}),f&&"workspace-terminal"!==f&&(0,b.jsxs)("section",{className:"card",style:{display:"flex",flexDirection:"column",border:"1px solid var(--border-focus)"},children:[(0,b.jsxs)("div",{className:e.default.agentHeader,style:{justifyContent:"space-between",background:"rgba(109, 40, 217, 0.08)"},children:[(0,b.jsxs)("span",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem"},children:["🖥️ Console Bridge — ",a.find(a=>a.id===f)?.name]}),(0,b.jsxs)("div",{style:{display:"flex",gap:"0.5rem",alignItems:"center"},children:[a.find(a=>a.id===f)?.status==="stopped"&&(0,b.jsx)("button",{onClick:async()=>{try{let a=await fetch("/api/sessions/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:f})});if(a.ok)await N();else{let b=await a.json();alert(b.error||"Failed to restart session.")}}catch(a){console.error("Failed to restart session:",a),alert("Network error: failed to restart session.")}},style:{padding:"0.2rem 0.5rem",borderRadius:"4px",border:"1px solid #eab308",backgroundColor:"rgba(234, 179, 8, 0.15)",color:"#eab308",fontSize:"0.7rem",fontWeight:600,cursor:"pointer",boxShadow:"0 0 8px rgba(234, 179, 8, 0.2)"},title:"Restart the stopped session process runner",children:"⚡ Restart Session"}),(0,b.jsx)("button",{onClick:()=>h(null),style:{border:"none",background:"none",color:"var(--muted)",cursor:"pointer",fontSize:"0.75rem"},children:"Close Panel ✖"})]})]}),(0,b.jsx)(j,{sessionId:f,wsPort:D})]}),(0,b.jsxs)("section",{children:[(0,b.jsx)("h2",{className:e.default.sectionTitle,children:"Workspace Shell Terminal"}),(0,b.jsxs)("div",{className:"card",style:{display:"flex",flexDirection:"column",border:"1px solid var(--border)",padding:0},children:[(0,b.jsxs)("div",{className:e.default.agentHeader,style:{justifyContent:"space-between",background:"rgba(255, 255, 255, 0.02)"},children:[(0,b.jsxs)("span",{style:{fontWeight:600,display:"flex",alignItems:"center",gap:"0.5rem",fontSize:"0.85rem"},children:["💻 Local Workspace Shell (CWD: ",B||"root",")"]}),(0,b.jsx)("span",{style:{fontSize:"0.7rem",color:"var(--muted)"},children:"Pre-configured environment"})]}),(0,b.jsx)(j,{sessionId:"workspace-terminal",height:"300px",wsPort:D})]})]}),(0,b.jsxs)("section",{style:{marginTop:"2rem"},children:[(0,b.jsx)("h2",{className:e.default.sectionTitle,children:"Shared Context Hub & Slash Commands"}),(0,b.jsxs)("div",{className:e.default.contextList,children:[(0,b.jsxs)("div",{className:`${e.default.contextItem} card`,children:[(0,b.jsxs)("div",{className:e.default.contextMeta,children:[(0,b.jsx)("span",{className:e.default.contextTitle,children:"Staged Context & System Rules (/ccc)"}),(0,b.jsx)("span",{className:e.default.contextDetails,children:"Compiles AGENTS.md guidelines and project files folder hierarchy map."})]}),(0,b.jsx)("button",{onClick:async()=>{f&&await fetch("/api/sessions/inject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:f,command:"/ccc"})})},disabled:!f,style:{padding:"0.4rem 0.8rem",borderRadius:"6px",border:"1px solid var(--primary)",backgroundColor:"transparent",color:"var(--primary)",fontSize:"0.75rem",fontWeight:600,opacity:f?1:.5,cursor:f?"pointer":"not-allowed"},children:"🚀 Mount Context (/ccc)"})]}),(0,b.jsxs)("div",{className:`${e.default.contextItem} card`,children:[(0,b.jsxs)("div",{className:e.default.contextMeta,children:[(0,b.jsx)("span",{className:e.default.contextTitle,children:"Staged Developer Prompt (/ccp)"}),(0,b.jsx)("span",{className:e.default.contextDetails,children:"Executes instructions written in .ai/neural-loom/cprompt.md."})]}),(0,b.jsx)("button",{onClick:async()=>{f&&await fetch("/api/sessions/inject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:f,command:"/ccp"})})},disabled:!f,style:{padding:"0.4rem 0.8rem",borderRadius:"6px",border:"1px solid var(--success)",backgroundColor:"transparent",color:"var(--success)",fontSize:"0.75rem",fontWeight:600,opacity:f?1:.5,cursor:f?"pointer":"not-allowed"},children:"⚡ Trigger Prompt (/ccp)"})]})]}),(0,b.jsx)(k,{})]}),(0,b.jsxs)("section",{style:{marginTop:"2rem"},children:[(0,b.jsx)("h2",{className:e.default.sectionTitle,children:"Built-in Database Explorer & SQL Client"}),(0,b.jsx)("div",{className:"card",style:{padding:0,overflow:"hidden",height:"480px",border:"1px solid var(--border)"},children:(0,b.jsx)(g,{workspaceRoot:B||""})})]})]}),(0,b.jsxs)("aside",{className:e.default.sidePanel,children:[(0,b.jsxs)("section",{children:[(0,b.jsx)("h2",{className:e.default.sectionTitle,children:"Execution Environments"}),(0,b.jsxs)("div",{className:e.default.envGrid,children:[(0,b.jsxs)("div",{className:e.default.envRow,children:[(0,b.jsx)("span",{className:e.default.envName,children:"💻 Local host OS"}),(0,b.jsx)("span",{className:e.default.envStatus,style:{color:"var(--success)"},children:"Active"})]}),(0,b.jsxs)("div",{className:e.default.envRow,style:{opacity:L?1:.6},children:[(0,b.jsx)("span",{className:e.default.envName,children:"🐳 Docker Sandbox"}),(0,b.jsx)("span",{className:e.default.envStatus,style:{color:L?"var(--success)":"var(--muted)"},children:L?"Active":"Not Mounted"})]}),(0,b.jsxs)("div",{className:e.default.envRow,style:{opacity:M?1:.6},children:[(0,b.jsx)("span",{className:e.default.envName,children:"🌐 Remote VM (SSH)"}),(0,b.jsx)("span",{className:e.default.envStatus,style:{color:M?"var(--success)":"var(--muted)"},children:M?"Active":"Disconnected"})]})]})]}),(0,b.jsxs)("section",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>{A(!1),y(!0)},disabled:p,style:{background:"linear-gradient(135deg, hsl(262, 83%, 60%) 0%, hsl(195, 100%, 45%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🤖"}),(0,b.jsx)("span",{children:"Launch Claude PTY"})]}),(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>{A(!0),y(!0)},disabled:p,style:{background:"linear-gradient(135deg, hsl(170, 72%, 40%) 0%, hsl(195, 100%, 40%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🐳"}),(0,b.jsx)("span",{children:"Launch Docker PTY"})]}),(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>s(!0),disabled:p,style:{background:"linear-gradient(135deg, hsl(38, 92%, 50%) 0%, hsl(0, 84%, 60%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🌐"}),(0,b.jsx)("span",{children:"Launch SSH PTY"})]}),(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>{w(!1),u(!0)},disabled:p,style:{background:"linear-gradient(135deg, hsl(210, 80%, 45%) 0%, hsl(262, 80%, 55%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🐍"}),(0,b.jsx)("span",{children:"Launch Aider PTY"})]}),(0,b.jsxs)("button",{className:e.default.quickLaunchBtn,onClick:()=>{w(!0),u(!0)},disabled:p,style:{background:"linear-gradient(135deg, hsl(195, 100%, 40%) 0%, hsl(262, 80%, 55%) 100%)",border:"none"},children:[(0,b.jsx)("span",{children:"🐳"}),(0,b.jsx)("span",{children:"Launch Aider Docker"})]})]}),(0,b.jsxs)("section",{className:"card",style:{padding:"1.5rem",display:"flex",flexDirection:"column",gap:"0.75rem"},children:[(0,b.jsx)("h3",{style:{fontSize:"1rem",fontWeight:700},children:"Quick Actions"}),(0,b.jsxs)("ul",{style:{listStyle:"none",fontSize:"0.875rem",display:"flex",flexDirection:"column",gap:"0.5rem",color:"var(--muted)"},children:[(0,b.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,b.jsx)("span",{children:"Configure global API Keys"}),(0,b.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]}),(0,b.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,b.jsx)("span",{children:"Edit rules templates"}),(0,b.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]}),(0,b.jsxs)("li",{style:{display:"flex",justifyContent:"space-between"},children:[(0,b.jsx)("span",{children:"Inspect process locks"}),(0,b.jsx)("span",{style:{color:"var(--primary)",cursor:"pointer"},children:"→"})]})]}),(0,b.jsxs)("div",{style:{marginTop:"1.2rem",textAlign:"center",fontSize:"0.72rem",color:"var(--muted)"},children:["Need to troubleshoot?"," ",(0,b.jsx)("span",{onClick:()=>P("mock"),style:{color:"var(--primary)",cursor:"pointer",textDecoration:"underline"},children:"Launch simulated playground sandbox"})]})]})]})]}),(0,b.jsxs)("footer",{className:e.default.footer,children:[(0,b.jsxs)("span",{children:["NeuralLoom v",F," — Experimental AI Orchestrator Bridge"]}),(0,b.jsxs)("span",{children:["Directory: ",B||"Loading..."]})]}),r&&(0,b.jsx)(l,{onClose:()=>s(!1),onConfirmLaunch:()=>{s(!1),P("claude-ssh")}}),t&&(0,b.jsx)(m,{onClose:()=>u(!1),isDocker:v,onConfirmLaunch:()=>{u(!1),P(v?"aider-docker":"aider")}}),x&&(0,b.jsx)(n,{onClose:()=>y(!1),isDocker:z,onConfirmLaunch:(a,b,c)=>{y(!1),P(z?"claude-docker":"claude",a,b,c)}})]})}],40777)}];
7
12
 
8
13
  //# sourceMappingURL=_0t7oqy6._.js.map