tide-commander 1.40.3 → 1.40.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{BossLogsModal-5ehRTeGs.js → BossLogsModal-CehuxNwV.js} +1 -1
- package/dist/assets/{BossSpawnModal-DibwTCub.js → BossSpawnModal-Cohl0WaH.js} +1 -1
- package/dist/assets/{ControlsModal-Bd5SZVzZ.js → ControlsModal-CAVkg9mM.js} +1 -1
- package/dist/assets/{DockerLogsModal-DWzJq-fY.js → DockerLogsModal-BXv9Hzg-.js} +1 -1
- package/dist/assets/{EmbeddedEditor-D0Yo-o66.js → EmbeddedEditor-CTlTVKdD.js} +1 -1
- package/dist/assets/{GmailOAuthSetup-CdX36hAm.js → GmailOAuthSetup-B1zQWbRR.js} +1 -1
- package/dist/assets/{GoogleOAuthSetup-B3zA-0E7.js → GoogleOAuthSetup-CmayoZ-D.js} +1 -1
- package/dist/assets/{IframeModal-Cz8quXPm.js → IframeModal-DlS7y7PK.js} +1 -1
- package/dist/assets/{IntegrationsPanel-C1ktSqvl.js → IntegrationsPanel-BPKoNwZm.js} +2 -2
- package/dist/assets/{LogViewerModal-De8tLix0.js → LogViewerModal-Bx9IDiFM.js} +1 -1
- package/dist/assets/{MonitoringModal-DOaMyrjA.js → MonitoringModal-DzqEa0fQ.js} +1 -1
- package/dist/assets/{PM2LogsModal-D-Gq8l2H.js → PM2LogsModal-DZXPRV5-.js} +1 -1
- package/dist/assets/{RestoreArchivedAreaModal-COSiM8Fi.js → RestoreArchivedAreaModal-BajWqtWn.js} +1 -1
- package/dist/assets/{SaveSnapshotModal-DxwK-i0L.js → SaveSnapshotModal-LqaLezB-.js} +1 -1
- package/dist/assets/{Scene2DCanvas-4ByVcSoi.js → Scene2DCanvas-DWDmyh_y.js} +1 -1
- package/dist/assets/{SceneManager-7WDKGyPC.js → SceneManager-BgkqWsDb.js} +1 -1
- package/dist/assets/{SkillsPanel-1Msh9dAe.js → SkillsPanel-CO-Zt0Tq.js} +1 -1
- package/dist/assets/{SnapshotManager-DQ6jkxDW.js → SnapshotManager-D4Uzw6Tp.js} +1 -1
- package/dist/assets/{SpawnModal-CHALHOLz.js → SpawnModal-BdCgTKpM.js} +1 -1
- package/dist/assets/{SubordinateAssignmentModal-DBZsFe-S.js → SubordinateAssignmentModal-BoaofULj.js} +1 -1
- package/dist/assets/{SupervisorPanel-NYoLg7_B.js → SupervisorPanel-D8Cp77my.js} +1 -1
- package/dist/assets/{TriggerManagerPanel-CNhhmDvm.js → TriggerManagerPanel-CFf3Tud5.js} +1 -1
- package/dist/assets/{WorkflowEditorPanel-BMpT0GGS.js → WorkflowEditorPanel-EtzhBZWw.js} +1 -1
- package/dist/assets/{index-CSOx3Jk0.js → index-2YWd58Wh.js} +1 -1
- package/dist/assets/{index-CqZxf78s.js → index-BKRKKMPQ.js} +3 -3
- package/dist/assets/{index-DAOIgllP.js → index-BgTRovwT.js} +1 -1
- package/dist/assets/{index-BvYoT0dH.js → index-BiJ_hIit.js} +1 -1
- package/dist/assets/{index-CTINc_P-.js → index-CDAtstMx.js} +1 -1
- package/dist/assets/{index-BzYz2FJi.js → index-DBpmD8r7.js} +2 -2
- package/dist/assets/{index-CDKrcnoB.js → index-DByGRjfY.js} +1 -1
- package/dist/assets/index-VO6fNr63.js +1 -0
- package/dist/assets/main-BFSqr5mR.css +1 -0
- package/dist/assets/main-BSyGZK2z.js +152 -0
- package/dist/assets/{web-2Scyvbzn.js → web-1BwWjkKM.js} +1 -1
- package/dist/assets/{web-DXju9dHs.js → web-BXQj42md.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/locales/en/config.json +1 -0
- package/dist/src/packages/server/claude/backend.js +9 -0
- package/dist/src/packages/server/claude/runner/process-lifecycle.js +79 -7
- package/dist/src/packages/server/claude/runner/recovery-store.js +73 -10
- package/dist/src/packages/server/claude/runner/restart-policy.js +9 -0
- package/dist/src/packages/server/claude/runner/stdout-pipeline.js +28 -4
- package/dist/src/packages/server/claude/runner/tmux-helper.js +264 -0
- package/dist/src/packages/server/claude/runner/watchdog.js +27 -0
- package/dist/src/packages/server/claude/runner.js +84 -9
- package/dist/src/packages/server/data/index.js +6 -0
- package/dist/src/packages/server/opencode/backend.js +1 -0
- package/dist/src/packages/server/opencode/index.js +1 -0
- package/dist/src/packages/server/routes/agents.js +29 -1
- package/dist/src/packages/server/services/system-prompt-service.js +38 -0
- package/dist/src/packages/server/websocket/listeners/runtime-listeners.js +19 -1
- package/package.json +1 -1
- package/dist/assets/index-CEZ1e3Of.js +0 -1
- package/dist/assets/main-CUx2B9bn.css +0 -1
- package/dist/assets/main-DSF4XPLl.js +0 -152
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as g,V as D,w as O,j as e,s as te}from"./main-DSF4XPLl.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const se=[{id:"triggers",label:"Triggers",icon:"⚡"},{id:"workflows",label:"Workflows",icon:"⚙️"},{id:"instances",label:"Instances",icon:"🔄"},{id:"messages",label:"Messages",icon:"💬"},{id:"stats",label:"Stats",icon:"📊"}],ae={trigger:"#89b4fa",slack:"#cba6f7",email:"#f9e2af",calendar:"#a6e3a1",document:"#fab387",jira:"#89dceb",workflow:"#f38ba8",system:"#6c7086",step:"#f38ba8",variable_change:"#cba6f7",approval:"#a6e3a1",audit:"#6c7086"},ne={trigger:"Trigger",slack:"Slack",email:"Email",calendar:"Calendar",document:"Document",jira:"Jira",workflow:"Workflow",system:"System",step:"Step",variable_change:"Variable",approval:"Approval",audit:"Audit"};function he({isOpen:r,onClose:s}){const[n,B]=g.useState("triggers"),[T,M]=g.useState([]),[y,x]=g.useState(!0),[_,j]=g.useState(null),[C,N]=g.useState("24h"),[R,$]=g.useState(""),[W,E]=g.useState(null),[m,p]=g.useState({}),[i,z]=g.useState(!1),[t,c]=g.useState(null),[d,b]=g.useState([]),l=g.useCallback(async()=>{if(!(n==="stats"||n==="instances")){x(!0);try{const o=Date.now(),h={"1h":36e5,"6h":216e5,"24h":864e5,"7d":6048e5,all:0},w=h[C]>0?String(o-h[C]):void 0;let k=[];if(n==="triggers"){const v=new URLSearchParams({limit:"200"});w&&v.set("since",w);const S=await D(O(`/api/events/triggers?${v}`));if(!S.ok){j(`HTTP ${S.status}`);return}k=((await S.json()).events||[]).map(F=>({type:"trigger",timestamp:F.firedAt,data:F}))}else if(n==="workflows"){const v=new URLSearchParams({limit:"200",category:"workflow"});w&&v.set("since",w);const S=await D(O(`/api/events/audit?${v}`));if(!S.ok){j(`HTTP ${S.status}`);return}k=((await S.json()).entries||[]).map(F=>({type:"workflow",timestamp:F.createdAt,data:F}))}else if(n==="messages"){const v=new URLSearchParams({limit:"200"}),S=new URLSearchParams({limit:"200"}),H=new URLSearchParams({limit:"200"});w&&(v.set("since",w),S.set("since",w));const[F,K,X]=await Promise.all([D(O(`/api/events/slack?${v}`)),D(O(`/api/events/email?${S}`)),D(O(`/api/events/approvals?${H}`))]);if(F.ok){const P=await F.json();for(const I of P.messages||[])k.push({type:"slack",timestamp:I.receivedAt,data:I})}if(K.ok){const P=await K.json();for(const I of P.messages||[])k.push({type:"email",timestamp:I.receivedAt,data:I})}if(X.ok){const P=await X.json();for(const I of P.events||[])k.push({type:"approval",timestamp:I.recordedAt,data:I})}k.sort((P,I)=>I.timestamp-P.timestamp)}M(k),j(null)}catch(o){j(`Failed to load events: ${o}`)}finally{x(!1)}}},[n,C]),f=g.useCallback(async()=>{x(!0);try{const[o,h]=await Promise.all([D(O("/api/events/stats")),D(O("/api/integrations"))]);if(o.ok&&c(await o.json()),h.ok){const w=await h.json();b(Array.isArray(w)?w:[])}j(null)}catch(o){j(`Failed to load stats: ${o}`)}finally{x(!1)}},[]);g.useEffect(()=>{r&&(n==="stats"?f():l())},[r,n,l,f]);const u=T.filter(o=>{if(!R)return!0;const h=R.toLowerCase();return JSON.stringify(o.data).toLowerCase().includes(h)});if(!r)return null;const A=d.filter(o=>o.status.connected).length;return e.jsx("div",{style:a.overlay,onClick:s,children:e.jsxs("div",{style:a.modal,onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{style:a.header,children:[e.jsxs("div",{style:a.headerTitle,children:[e.jsx("span",{children:"📊"}),e.jsx("span",{children:"Monitoring & Logs"})]}),e.jsx("button",{style:a.closeBtn,onClick:s,title:"Close",children:"×"})]}),e.jsx("div",{style:a.tabs,children:se.map(o=>e.jsxs("button",{style:a.tab(n===o.id),onClick:()=>{B(o.id),$(""),E(null)},children:[e.jsx("span",{children:o.icon}),e.jsx("span",{children:o.label})]},o.id))}),n!=="stats"&&n!=="instances"&&e.jsxs("div",{style:a.filters,children:[e.jsx("div",{style:{display:"flex",gap:4},children:["1h","6h","24h","7d","all"].map(o=>e.jsx("button",{style:{...a.timeBtn,background:C===o?"#89b4fa":"transparent",color:C===o?"#1e1e2e":"#a6adc8"},onClick:()=>N(o),children:o},o))}),e.jsx("input",{style:a.searchInput,placeholder:"Search events...",value:R,onChange:o=>$(o.target.value)}),e.jsx("button",{style:a.refreshBtn,onClick:l,children:"Refresh"})]}),e.jsx("div",{style:a.content,children:n==="stats"?e.jsx(oe,{loading:y,error:_,stats:t,integrations:d,connectedCount:A,onRefresh:f}):n==="instances"?e.jsx(ce,{}):e.jsx(re,{loading:y,error:_,entries:u,expandedId:W,matcherResults:m,loadingMatchers:i,onToggleExpand:async(o,h)=>{var w;if(W===o){E(null);return}if(E(o),!m[o]){z(!0);try{let k="";if((h==null?void 0:h.type)==="trigger"&&((w=h==null?void 0:h.data)!=null&&w.id))k=`/api/triggers/events/${h.data.id}/matchers`;else if(h&&["slack","email","approval"].includes(h.type)){const v=h.data,S=v.ts||v.messageId||v.email_id;S&&h.type&&(k=`/api/triggers/matchers/by-source/${h.type}/${encodeURIComponent(S)}`)}if(k){const v=await D(O(k));if(v.ok){const S=await v.json();p(H=>({...H,[o]:S.matchers||[]}))}}}catch(k){console.error("Failed to fetch matchers:",k)}finally{z(!1)}}}})}),n!=="stats"&&n!=="instances"&&e.jsx("div",{style:a.footer,children:e.jsxs("span",{style:{color:"#6c7086",fontSize:11},children:[u.length," event",u.length!==1?"s":""," shown",R&&` (filtered from ${T.length})`]})})]})})}function re({loading:r,error:s,entries:n,expandedId:B,matcherResults:T,loadingMatchers:M,onToggleExpand:y}){return r?e.jsx("div",{style:{color:"#a6adc8",padding:20},children:"Loading events..."}):s?e.jsx("div",{style:{color:"#f38ba8",padding:20},children:s}):n.length===0?e.jsx("div",{style:{color:"#6c7086",textAlign:"center",padding:40},children:"No events found for the selected filters."}):e.jsx(e.Fragment,{children:n.map((x,_)=>{var W;const j=`${x.type}-${x.timestamp}-${_}`,C=B===j,N=ae[x.type]||"#6c7086",R=ie(x),$=new Date(x.timestamp);return e.jsxs("div",{style:{...a.eventRow,borderLeft:`3px solid ${N}`,background:C?"rgba(137,180,250,0.05)":"transparent"},onClick:()=>y(j,x),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{...a.tag,background:`${N}22`,color:N},children:ne[x.type]||x.type}),e.jsx("span",{style:{color:"#cdd6f4",fontSize:12,flex:1},children:R}),e.jsxs("span",{style:{color:"#6c7086",fontSize:10,whiteSpace:"nowrap"},children:[$.toLocaleTimeString()," ",$.toLocaleDateString()]})]}),C&&e.jsxs(e.Fragment,{children:[e.jsx("pre",{style:a.detail,children:JSON.stringify(x.data,null,2)}),T[j]&&e.jsxs("div",{style:{marginTop:12,borderTop:"1px solid #313244",paddingTop:12},children:[e.jsx("div",{style:{color:"#a6adc8",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,marginBottom:8},children:x.type==="trigger"?"Matcher Results":"Trigger Evaluations"}),M?e.jsx("div",{style:{color:"#6c7086",fontSize:12},children:"Loading matchers..."}):((W=T[j])==null?void 0:W.length)===0?e.jsx("div",{style:{color:"#6c7086",fontSize:12},children:"No matchers evaluated"}):(()=>{const E=T[j];if(x.type!=="trigger"){const m=new Map;for(const p of E){const i=String(p.trigger_id||"unknown");m.has(i)||m.set(i,[]),m.get(i).push(p)}return Array.from(m.entries()).map(([p,i])=>{var z;return e.jsxs("div",{style:{marginBottom:12},children:[e.jsxs("div",{style:{color:"#cdd6f4",fontSize:11,fontWeight:500,marginBottom:6,paddingBottom:4,borderBottom:"1px solid #45475a"},children:["Trigger: ",String(((z=i[0])==null?void 0:z.trigger_name)||p)]}),i.map((t,c)=>{const d=t.matched===1||t.matched===!0,b=d?"#a6e3a1":"#f38ba8",l=t.confidence??null,f=String(t.matcher_name||"unknown"),u=t.reason?String(t.reason):"";return e.jsxs("div",{style:{display:"flex",gap:8,padding:"6px 10px",background:"#313244",borderRadius:4,marginBottom:4,fontSize:11},children:[e.jsx("span",{style:{color:b,fontWeight:600,minWidth:50},children:d?"✓":"✗"}),e.jsx("span",{style:{color:"#cdd6f4",flex:1},children:f}),l!==null&&e.jsxs("span",{style:{color:"#a6adc8"},children:["(",(l*100).toFixed(0),"%)"]}),u&&e.jsx("span",{style:{color:"#6c7086",fontSize:10},children:u})]},c)})]},p)})}else return E.map((m,p)=>{const i=m.matched===1||m.matched===!0,z=i?"#a6e3a1":"#f38ba8",t=m.confidence??null,c=String(m.matcher_name||"unknown"),d=m.reason?String(m.reason):"";return e.jsxs("div",{style:{display:"flex",gap:8,padding:"6px 10px",background:"#313244",borderRadius:4,marginBottom:4,fontSize:11},children:[e.jsx("span",{style:{color:z,fontWeight:600,minWidth:50},children:i?"✓ MATCH":"✗ FAIL"}),e.jsx("span",{style:{color:"#cdd6f4",flex:1},children:c}),t!==null&&e.jsxs("span",{style:{color:"#a6adc8"},children:["(",(t*100).toFixed(0),"%)"]}),d&&e.jsx("span",{style:{color:"#6c7086",fontSize:10},children:d})]},p)})})()]})]})]},j)})})}function oe({loading:r,error:s,stats:n,integrations:B,connectedCount:T,onRefresh:M}){return r?e.jsx("div",{style:{color:"#a6adc8",padding:20},children:"Loading stats..."}):s?e.jsx("div",{style:{color:"#f38ba8",padding:20},children:s}):e.jsxs("div",{style:{padding:20},children:[e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:16},children:e.jsx("button",{style:a.refreshBtn,onClick:M,children:"Refresh"})}),n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:a.section,children:[e.jsx("h3",{style:a.sectionTitle,children:"Workflows"}),e.jsxs("div",{style:a.grid,children:[e.jsx(U,{label:"Active",value:n.activeWorkflows,color:"#89b4fa"}),e.jsx(U,{label:"Completed",value:n.completedWorkflows,color:"#a6e3a1"}),e.jsx(U,{label:"Failed",value:n.failedWorkflows,color:"#f38ba8"})]})]}),e.jsxs("div",{style:a.section,children:[e.jsx("h3",{style:a.sectionTitle,children:"Events (Today)"}),e.jsxs("div",{style:a.grid,children:[e.jsx(U,{label:"Triggers Fired",value:n.triggersFiredToday,color:"#f9e2af"}),e.jsx(U,{label:"Slack Messages",value:n.slackMessageCount,color:"#cba6f7"}),e.jsx(U,{label:"Emails",value:n.emailCount,color:"#fab387"})]})]}),e.jsxs("div",{style:a.section,children:[e.jsxs("h3",{style:a.sectionTitle,children:["Integrations (",T,"/",B.length," connected)"]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[B.map(y=>e.jsxs("div",{style:a.integrationRow,children:[e.jsx("span",{style:{color:"#cdd6f4",fontSize:13},children:y.name}),e.jsx("span",{style:{...a.statusBadge,background:y.status.connected?"rgba(166,227,161,0.15)":"rgba(108,112,134,0.15)",color:y.status.connected?"#a6e3a1":"#6c7086"},children:y.status.error?"Error":y.status.connected?"Connected":"Disconnected"})]},y.id)),B.length===0&&e.jsx("div",{style:{color:"#6c7086",fontSize:12},children:"No integrations configured"})]})]})]}),!n&&e.jsx("div",{style:{color:"#6c7086",textAlign:"center",padding:40},children:"No stats available. The event store may not have any data yet."})]})}function U({label:r,value:s,color:n}){return e.jsxs("div",{style:a.card,children:[e.jsx("div",{style:{color:n,fontSize:28,fontWeight:700,lineHeight:1},children:s}),e.jsx("div",{style:{color:"#a6adc8",fontSize:11,marginTop:4},children:r})]})}function ie(r){const s=r.data;switch(r.type){case"trigger":return`Trigger "${s.triggerName||s.triggerId}" ${s.status||"fired"}`;case"slack":return`${s.direction==="outbound"?"Sent":"Received"} in #${s.channelName||s.channelId}: ${Y(s.text,60)}`;case"email":return`${s.direction==="outbound"?"Sent to":"From"} ${s.direction==="outbound"?s.toAddresses:s.fromAddress}: ${Y(s.subject,50)}`;case"approval":return`${s.approved?"Approved":"Rejected"} by ${s.approverEmail}`;case"document":return`Generated "${s.outputFilename}" from template "${s.templateName}"`;case"calendar":return`Calendar event ${s.action}: "${s.summary}"`;case"jira":return`${s.ticketKey} ${s.action}: ${Y(s.summary,50)}`;case"step":return`Workflow step: ${s.toStateName} (${s.status})`;case"variable_change":return`Variable "${s.variableName}" changed by ${s.changedBy}`;case"audit":return`[${(s.level||"info").toUpperCase()}] ${s.category}: ${s.action}`;default:return JSON.stringify(s).slice(0,80)}}function Y(r,s){return r?r.length>s?r.slice(0,s)+"...":r:""}const V={running:"#a6e3a1",paused:"#f9e2af",completed:"#89b4fa",failed:"#f38ba8",cancelled:"#6c7086"},q={action:"#89b4fa",wait:"#f9e2af",decision:"#cba6f7",end:"#6c7086"};let G=null,Q,Z;function ee(){const r=te.getState(),s=r.workflowDefinitions??new Map,n=r.workflowInstances??new Map;return G&&Q===s&&Z===n||(Q=s,Z=n,G={definitions:s,instances:n}),G}function le(){return g.useSyncExternalStore(r=>te.subscribe(r),ee,ee)}function ce(){var z;const{definitions:r,instances:s}=le(),[n,B]=g.useState("all"),[T,M]=g.useState("all"),[y,x]=g.useState(""),[_,j]=g.useState(null),[C,N]=g.useState(null),[R,$]=g.useState(null),W=g.useMemo(()=>Array.from(s.values()),[s]),E=g.useMemo(()=>Array.from(r.values()),[r]),m=g.useMemo(()=>W.filter(t=>{if(n!=="all"&&t.status!==n||T!=="all"&&t.workflowDefId!==T)return!1;if(y){const c=y.toLowerCase();return t.workflowName.toLowerCase().includes(c)||t.id.toLowerCase().includes(c)||JSON.stringify(t.variables).toLowerCase().includes(c)}return!0}).sort((t,c)=>c.updatedAt-t.updatedAt),[W,n,T,y]),p=_?s.get(_):null,i=R?s.get(R):null;if(i){const t=r.get(i.workflowDefId),c=t==null?void 0:t.states.find(f=>f.id===i.currentStateId),d=V[i.status]||"#6c7086",b={},l={};for(const[f,u]of Object.entries(i.variables))f.startsWith("wi_")?b[f]=u:l[f]=u;return e.jsxs("div",{style:{padding:"12px 0"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx("button",{style:{...a.refreshBtn,fontSize:12},onClick:()=>$(null),children:"Back"}),e.jsxs("span",{style:{color:"#cdd6f4",fontSize:13,fontWeight:500},children:["Debug: ",i.workflowName]}),e.jsx("span",{style:{...a.tag,background:`${d}22`,color:d},children:i.status})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:8,marginBottom:16},children:[e.jsx(L,{label:"ID",value:i.id}),e.jsx(L,{label:"Def ID",value:i.workflowDefId}),e.jsx(L,{label:"Current State",value:(c==null?void 0:c.name)||i.currentStateId}),e.jsx(L,{label:"State Type",value:(c==null?void 0:c.type)||"unknown"}),e.jsx(L,{label:"Created",value:J(i.createdAt)}),e.jsx(L,{label:"Updated",value:J(i.updatedAt)}),i.completedAt&&e.jsx(L,{label:"Completed",value:J(i.completedAt)}),i.error&&e.jsx(L,{label:"Error",value:i.error,color:"#f38ba8"}),e.jsx(L,{label:"Steps",value:String(((z=i.history)==null?void 0:z.length)??0)})]}),Object.keys(l).length>0&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{color:"#a6adc8",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:1,marginBottom:6},children:"User Variables"}),e.jsx("pre",{style:a.detail,children:JSON.stringify(l,null,2)})]}),Object.keys(b).length>0&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{color:"#a6adc8",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:1,marginBottom:6},children:"Internal Variables (wi_*)"}),e.jsx("pre",{style:a.detail,children:JSON.stringify(b,null,2)})]}),c&&c.transitions.length>0&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{color:"#a6adc8",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:1,marginBottom:6},children:"Available Transitions"}),c.transitions.map(f=>{var u;return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"4px 10px",background:"#313244",borderRadius:4,marginBottom:4},children:[e.jsx("span",{style:{color:"#cdd6f4",fontSize:12},children:f.name}),e.jsxs("span",{style:{color:"#6c7086",fontSize:10},children:[f.condition.type," → ",((u=t==null?void 0:t.states.find(A=>A.id===f.targetStateId))==null?void 0:u.name)||f.targetStateId]})]},f.id)})]}),e.jsxs("div",{children:[e.jsx("div",{style:{color:"#a6adc8",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:1,marginBottom:6},children:"Raw JSON"}),e.jsx("pre",{style:{...a.detail,maxHeight:400},children:JSON.stringify(i,null,2)})]})]})}if(p){const t=r.get(p.workflowDefId),c=V[p.status]||"#6c7086";return e.jsxs("div",{style:{padding:"12px 0"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("button",{style:{...a.refreshBtn,fontSize:12},onClick:()=>{j(null),N(null)},children:"Back"}),e.jsx("span",{style:{color:"#cdd6f4",fontSize:13,fontWeight:500},children:p.workflowName}),e.jsxs("span",{style:{color:"#6c7086",fontSize:10,fontFamily:"monospace"},children:["(",p.id.slice(0,8),")"]}),e.jsx("span",{style:{...a.tag,background:`${c}22`,color:c},children:p.status}),e.jsx("div",{style:{flex:1}}),e.jsx("button",{style:{...a.refreshBtn,fontFamily:"monospace",fontSize:10},onClick:()=>$(p.id),children:"{..}"})]}),e.jsxs("div",{style:{display:"flex",gap:16,color:"#6c7086",fontSize:11,marginBottom:12},children:[e.jsxs("span",{children:["Created: ",J(p.createdAt)]}),e.jsxs("span",{children:["Updated: ",J(p.updatedAt)]}),p.error&&e.jsxs("span",{style:{color:"#f38ba8"},children:["Error: ",p.error]})]}),e.jsxs("div",{style:{color:"#a6adc8",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:1,marginBottom:8},children:["Timeline (",p.history.length," step",p.history.length!==1?"s":"",")"]}),p.history.length===0&&e.jsx("div",{style:{color:"#6c7086",fontSize:12,padding:16},children:"No steps recorded yet."}),p.history.map((d,b)=>{const l=t==null?void 0:t.states.find(A=>A.id===d.toStateId),f=C===b,u=l&&q[l.type]||"#6c7086";return e.jsxs("div",{style:{padding:"10px 12px",borderLeft:`3px solid ${u}`,borderBottom:"1px solid #313244",cursor:"pointer",background:f?"rgba(137,180,250,0.05)":"transparent",marginLeft:8},onClick:()=>N(f?null:b),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:u,flexShrink:0}}),e.jsx("span",{style:{color:"#cdd6f4",fontSize:12,fontWeight:500},children:(l==null?void 0:l.name)||d.toStateId}),l&&e.jsx("span",{style:{...a.tag,background:`${u}22`,color:u},children:l.type}),d.transitionName&&e.jsxs("span",{style:{color:"#6c7086",fontSize:10},children:['via "',d.transitionName,'"']}),e.jsx("div",{style:{flex:1}}),e.jsx("span",{style:{color:"#6c7086",fontSize:10,whiteSpace:"nowrap"},children:J(d.timestamp)})]}),f&&e.jsxs("div",{style:{marginTop:8,paddingLeft:20},children:[d.fromStateId&&e.jsxs("div",{style:{color:"#6c7086",fontSize:11,marginBottom:2},children:[e.jsx("span",{style:{fontWeight:600,fontSize:10,textTransform:"uppercase"},children:"From: "}),e.jsx("span",{style:{fontFamily:"monospace"},children:d.fromStateId})]}),d.details&&e.jsxs("div",{style:{marginTop:6},children:[e.jsx("div",{style:{color:"#6c7086",fontSize:10,fontWeight:600,textTransform:"uppercase",marginBottom:4},children:"Agent Reasoning / Summary"}),e.jsx("div",{style:{padding:10,background:"#181825",borderRadius:6,border:"1px solid #313244",fontSize:12,color:"#cdd6f4",lineHeight:1.5,whiteSpace:"pre-wrap"},children:d.details})]}),(l==null?void 0:l.description)&&e.jsxs("div",{style:{marginTop:6,color:"#a6adc8",fontSize:11},children:[e.jsx("span",{style:{color:"#6c7086",fontWeight:600,fontSize:10,textTransform:"uppercase"},children:"Description: "}),l.description]}),d.variables&&Object.keys(d.variables).length>0&&e.jsxs("div",{style:{marginTop:6},children:[e.jsx("div",{style:{color:"#6c7086",fontSize:10,fontWeight:600,textTransform:"uppercase",marginBottom:4},children:"Variables at this step"}),e.jsx("pre",{style:a.detail,children:JSON.stringify(d.variables,null,2)})]}),(l==null?void 0:l.action)&&e.jsxs("div",{style:{marginTop:6},children:[e.jsxs("div",{style:{color:"#6c7086",fontSize:10,fontWeight:600,textTransform:"uppercase",marginBottom:4},children:["Action (",l.action.type,")"]}),e.jsx("pre",{style:a.detail,children:JSON.stringify(l.action,null,2)})]})]})]},b)})]})}return e.jsxs("div",{style:{padding:"12px 0"},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:12,flexWrap:"wrap"},children:[e.jsxs("select",{style:{background:"#313244",border:"1px solid #45475a",borderRadius:6,padding:"5px 10px",color:"#cdd6f4",fontSize:12,outline:"none"},value:T,onChange:t=>M(t.target.value),children:[e.jsx("option",{value:"all",children:"All Workflows"}),E.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsx("div",{style:{display:"flex",gap:4},children:["all","running","paused","completed","failed","cancelled"].map(t=>e.jsx("button",{style:{...a.timeBtn,background:n===t?t==="all"?"#89b4fa":V[t]||"#89b4fa":"transparent",color:n===t?"#1e1e2e":"#a6adc8",borderColor:n===t?"transparent":"#45475a",textTransform:"capitalize"},onClick:()=>B(t),children:t},t))}),e.jsx("input",{style:a.searchInput,placeholder:"Search instances...",value:y,onChange:t=>x(t.target.value)}),e.jsxs("span",{style:{color:"#6c7086",fontSize:11},children:[m.length,"/",W.length]})]}),m.length===0?e.jsx("div",{style:{color:"#6c7086",textAlign:"center",padding:40},children:"No workflow instances found."}):m.map(t=>{var f,u;const c=r.get(t.workflowDefId),d=V[t.status]||"#6c7086",b=c==null?void 0:c.states.find(A=>A.id===t.currentStateId),l=b&&q[b.type]||"#6c7086";return e.jsxs("div",{style:{...a.eventRow,display:"flex",alignItems:"center",gap:12,borderLeft:`3px solid ${d}`},onClick:()=>j(t.id),children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{color:"#cdd6f4",fontSize:13,fontWeight:500},children:t.workflowName}),e.jsx("span",{style:{...a.tag,background:`${d}22`,color:d},children:t.status})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:2},children:[e.jsx("span",{style:{color:"#6c7086",fontSize:10,fontFamily:"monospace"},children:t.id.slice(0,8)}),b&&e.jsxs("span",{style:{color:l,fontSize:10},children:["@ ",b.name]}),e.jsxs("span",{style:{color:"#45475a",fontSize:10},children:[((f=t.history)==null?void 0:f.length)??0," step",(((u=t.history)==null?void 0:u.length)??0)!==1?"s":""]})]})]}),e.jsx("span",{style:{color:"#6c7086",fontSize:10,whiteSpace:"nowrap"},children:de(t.updatedAt)}),e.jsx("button",{style:{background:"transparent",border:"1px solid #45475a",borderRadius:4,padding:"3px 6px",color:"#6c7086",fontSize:10,fontFamily:"monospace",cursor:"pointer"},onClick:A=>{A.stopPropagation(),$(t.id)},title:"Debug view",children:"{..}"})]},t.id)})]})}function L({label:r,value:s,color:n}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,padding:"8px 10px",background:"#313244",borderRadius:6},children:[e.jsx("span",{style:{color:"#6c7086",fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:r}),e.jsx("span",{style:{color:n||"#cdd6f4",fontSize:12,fontFamily:"monospace",wordBreak:"break-all"},children:s})]})}function de(r){return new Date(r).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function J(r){const s=new Date(r);return`${s.toLocaleDateString()} ${s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}`}const a={overlay:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4,backdropFilter:"blur(4px)"},modal:{background:"var(--surface-0, #1e1e2e)",borderRadius:12,border:"1px solid var(--border, #313244)",width:"90vw",maxWidth:1e3,height:"85vh",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.5)"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--border, #313244)",background:"var(--surface-1, #181825)"},headerTitle:{fontSize:16,fontWeight:600,color:"var(--text-primary, #cdd6f4)",display:"flex",alignItems:"center",gap:8},closeBtn:{background:"none",border:"none",color:"var(--text-secondary, #a6adc8)",fontSize:20,cursor:"pointer",padding:"4px 8px",borderRadius:6,lineHeight:1},tabs:{display:"flex",borderBottom:"1px solid var(--border, #313244)",background:"var(--surface-1, #181825)",overflowX:"auto",scrollbarWidth:"none"},tab:r=>({padding:"10px 16px",background:"none",border:"none",borderBottom:r?"2px solid var(--accent, #89b4fa)":"2px solid transparent",color:r?"var(--accent, #89b4fa)":"var(--text-secondary, #a6adc8)",fontSize:13,fontWeight:r?600:400,cursor:"pointer",display:"flex",alignItems:"center",gap:6,whiteSpace:"nowrap",transition:"color 0.15s, border-color 0.15s",flexShrink:0}),filters:{display:"flex",gap:8,alignItems:"center",padding:"10px 20px",borderBottom:"1px solid var(--border, #313244)",flexWrap:"wrap"},timeBtn:{border:"1px solid #45475a",borderRadius:4,padding:"4px 8px",fontSize:10,fontWeight:600,cursor:"pointer"},searchInput:{background:"#313244",border:"1px solid #45475a",borderRadius:6,padding:"5px 10px",color:"#cdd6f4",fontSize:12,flex:1,minWidth:120,outline:"none"},refreshBtn:{background:"transparent",border:"1px solid #45475a",borderRadius:6,padding:"5px 12px",color:"#a6adc8",fontSize:11,cursor:"pointer"},content:{flex:1,overflow:"auto",padding:"0 20px"},eventRow:{padding:"8px 12px",borderBottom:"1px solid #313244",cursor:"pointer",transition:"background 0.1s"},tag:{fontSize:10,fontWeight:600,padding:"2px 6px",borderRadius:4,whiteSpace:"nowrap"},detail:{marginTop:8,padding:10,background:"#181825",borderRadius:6,fontSize:11,fontFamily:"monospace",color:"#a6adc8",overflow:"auto",maxHeight:300,whiteSpace:"pre-wrap",wordBreak:"break-all"},footer:{padding:"8px 20px",borderTop:"1px solid #313244"},section:{marginBottom:24},sectionTitle:{color:"#a6adc8",fontSize:12,fontWeight:600,textTransform:"uppercase",letterSpacing:1,marginBottom:12,margin:0},grid:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:12},card:{background:"#313244",borderRadius:8,padding:"16px 14px",textAlign:"center"},integrationRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 12px",background:"#313244",borderRadius:6},statusBadge:{fontSize:10,fontWeight:600,padding:"3px 8px",borderRadius:4}};export{he as MonitoringModal};
|
|
1
|
+
import{r as g,V as D,w as O,j as e,s as te}from"./main-BSyGZK2z.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";const se=[{id:"triggers",label:"Triggers",icon:"⚡"},{id:"workflows",label:"Workflows",icon:"⚙️"},{id:"instances",label:"Instances",icon:"🔄"},{id:"messages",label:"Messages",icon:"💬"},{id:"stats",label:"Stats",icon:"📊"}],ae={trigger:"#89b4fa",slack:"#cba6f7",email:"#f9e2af",calendar:"#a6e3a1",document:"#fab387",jira:"#89dceb",workflow:"#f38ba8",system:"#6c7086",step:"#f38ba8",variable_change:"#cba6f7",approval:"#a6e3a1",audit:"#6c7086"},ne={trigger:"Trigger",slack:"Slack",email:"Email",calendar:"Calendar",document:"Document",jira:"Jira",workflow:"Workflow",system:"System",step:"Step",variable_change:"Variable",approval:"Approval",audit:"Audit"};function he({isOpen:r,onClose:s}){const[n,B]=g.useState("triggers"),[T,M]=g.useState([]),[y,x]=g.useState(!0),[_,j]=g.useState(null),[C,N]=g.useState("24h"),[R,$]=g.useState(""),[W,E]=g.useState(null),[m,p]=g.useState({}),[i,z]=g.useState(!1),[t,c]=g.useState(null),[d,b]=g.useState([]),l=g.useCallback(async()=>{if(!(n==="stats"||n==="instances")){x(!0);try{const o=Date.now(),h={"1h":36e5,"6h":216e5,"24h":864e5,"7d":6048e5,all:0},w=h[C]>0?String(o-h[C]):void 0;let k=[];if(n==="triggers"){const v=new URLSearchParams({limit:"200"});w&&v.set("since",w);const S=await D(O(`/api/events/triggers?${v}`));if(!S.ok){j(`HTTP ${S.status}`);return}k=((await S.json()).events||[]).map(F=>({type:"trigger",timestamp:F.firedAt,data:F}))}else if(n==="workflows"){const v=new URLSearchParams({limit:"200",category:"workflow"});w&&v.set("since",w);const S=await D(O(`/api/events/audit?${v}`));if(!S.ok){j(`HTTP ${S.status}`);return}k=((await S.json()).entries||[]).map(F=>({type:"workflow",timestamp:F.createdAt,data:F}))}else if(n==="messages"){const v=new URLSearchParams({limit:"200"}),S=new URLSearchParams({limit:"200"}),H=new URLSearchParams({limit:"200"});w&&(v.set("since",w),S.set("since",w));const[F,K,X]=await Promise.all([D(O(`/api/events/slack?${v}`)),D(O(`/api/events/email?${S}`)),D(O(`/api/events/approvals?${H}`))]);if(F.ok){const P=await F.json();for(const I of P.messages||[])k.push({type:"slack",timestamp:I.receivedAt,data:I})}if(K.ok){const P=await K.json();for(const I of P.messages||[])k.push({type:"email",timestamp:I.receivedAt,data:I})}if(X.ok){const P=await X.json();for(const I of P.events||[])k.push({type:"approval",timestamp:I.recordedAt,data:I})}k.sort((P,I)=>I.timestamp-P.timestamp)}M(k),j(null)}catch(o){j(`Failed to load events: ${o}`)}finally{x(!1)}}},[n,C]),f=g.useCallback(async()=>{x(!0);try{const[o,h]=await Promise.all([D(O("/api/events/stats")),D(O("/api/integrations"))]);if(o.ok&&c(await o.json()),h.ok){const w=await h.json();b(Array.isArray(w)?w:[])}j(null)}catch(o){j(`Failed to load stats: ${o}`)}finally{x(!1)}},[]);g.useEffect(()=>{r&&(n==="stats"?f():l())},[r,n,l,f]);const u=T.filter(o=>{if(!R)return!0;const h=R.toLowerCase();return JSON.stringify(o.data).toLowerCase().includes(h)});if(!r)return null;const A=d.filter(o=>o.status.connected).length;return e.jsx("div",{style:a.overlay,onClick:s,children:e.jsxs("div",{style:a.modal,onClick:o=>o.stopPropagation(),children:[e.jsxs("div",{style:a.header,children:[e.jsxs("div",{style:a.headerTitle,children:[e.jsx("span",{children:"📊"}),e.jsx("span",{children:"Monitoring & Logs"})]}),e.jsx("button",{style:a.closeBtn,onClick:s,title:"Close",children:"×"})]}),e.jsx("div",{style:a.tabs,children:se.map(o=>e.jsxs("button",{style:a.tab(n===o.id),onClick:()=>{B(o.id),$(""),E(null)},children:[e.jsx("span",{children:o.icon}),e.jsx("span",{children:o.label})]},o.id))}),n!=="stats"&&n!=="instances"&&e.jsxs("div",{style:a.filters,children:[e.jsx("div",{style:{display:"flex",gap:4},children:["1h","6h","24h","7d","all"].map(o=>e.jsx("button",{style:{...a.timeBtn,background:C===o?"#89b4fa":"transparent",color:C===o?"#1e1e2e":"#a6adc8"},onClick:()=>N(o),children:o},o))}),e.jsx("input",{style:a.searchInput,placeholder:"Search events...",value:R,onChange:o=>$(o.target.value)}),e.jsx("button",{style:a.refreshBtn,onClick:l,children:"Refresh"})]}),e.jsx("div",{style:a.content,children:n==="stats"?e.jsx(oe,{loading:y,error:_,stats:t,integrations:d,connectedCount:A,onRefresh:f}):n==="instances"?e.jsx(ce,{}):e.jsx(re,{loading:y,error:_,entries:u,expandedId:W,matcherResults:m,loadingMatchers:i,onToggleExpand:async(o,h)=>{var w;if(W===o){E(null);return}if(E(o),!m[o]){z(!0);try{let k="";if((h==null?void 0:h.type)==="trigger"&&((w=h==null?void 0:h.data)!=null&&w.id))k=`/api/triggers/events/${h.data.id}/matchers`;else if(h&&["slack","email","approval"].includes(h.type)){const v=h.data,S=v.ts||v.messageId||v.email_id;S&&h.type&&(k=`/api/triggers/matchers/by-source/${h.type}/${encodeURIComponent(S)}`)}if(k){const v=await D(O(k));if(v.ok){const S=await v.json();p(H=>({...H,[o]:S.matchers||[]}))}}}catch(k){console.error("Failed to fetch matchers:",k)}finally{z(!1)}}}})}),n!=="stats"&&n!=="instances"&&e.jsx("div",{style:a.footer,children:e.jsxs("span",{style:{color:"#6c7086",fontSize:11},children:[u.length," event",u.length!==1?"s":""," shown",R&&` (filtered from ${T.length})`]})})]})})}function re({loading:r,error:s,entries:n,expandedId:B,matcherResults:T,loadingMatchers:M,onToggleExpand:y}){return r?e.jsx("div",{style:{color:"#a6adc8",padding:20},children:"Loading events..."}):s?e.jsx("div",{style:{color:"#f38ba8",padding:20},children:s}):n.length===0?e.jsx("div",{style:{color:"#6c7086",textAlign:"center",padding:40},children:"No events found for the selected filters."}):e.jsx(e.Fragment,{children:n.map((x,_)=>{var W;const j=`${x.type}-${x.timestamp}-${_}`,C=B===j,N=ae[x.type]||"#6c7086",R=ie(x),$=new Date(x.timestamp);return e.jsxs("div",{style:{...a.eventRow,borderLeft:`3px solid ${N}`,background:C?"rgba(137,180,250,0.05)":"transparent"},onClick:()=>y(j,x),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{...a.tag,background:`${N}22`,color:N},children:ne[x.type]||x.type}),e.jsx("span",{style:{color:"#cdd6f4",fontSize:12,flex:1},children:R}),e.jsxs("span",{style:{color:"#6c7086",fontSize:10,whiteSpace:"nowrap"},children:[$.toLocaleTimeString()," ",$.toLocaleDateString()]})]}),C&&e.jsxs(e.Fragment,{children:[e.jsx("pre",{style:a.detail,children:JSON.stringify(x.data,null,2)}),T[j]&&e.jsxs("div",{style:{marginTop:12,borderTop:"1px solid #313244",paddingTop:12},children:[e.jsx("div",{style:{color:"#a6adc8",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:.5,marginBottom:8},children:x.type==="trigger"?"Matcher Results":"Trigger Evaluations"}),M?e.jsx("div",{style:{color:"#6c7086",fontSize:12},children:"Loading matchers..."}):((W=T[j])==null?void 0:W.length)===0?e.jsx("div",{style:{color:"#6c7086",fontSize:12},children:"No matchers evaluated"}):(()=>{const E=T[j];if(x.type!=="trigger"){const m=new Map;for(const p of E){const i=String(p.trigger_id||"unknown");m.has(i)||m.set(i,[]),m.get(i).push(p)}return Array.from(m.entries()).map(([p,i])=>{var z;return e.jsxs("div",{style:{marginBottom:12},children:[e.jsxs("div",{style:{color:"#cdd6f4",fontSize:11,fontWeight:500,marginBottom:6,paddingBottom:4,borderBottom:"1px solid #45475a"},children:["Trigger: ",String(((z=i[0])==null?void 0:z.trigger_name)||p)]}),i.map((t,c)=>{const d=t.matched===1||t.matched===!0,b=d?"#a6e3a1":"#f38ba8",l=t.confidence??null,f=String(t.matcher_name||"unknown"),u=t.reason?String(t.reason):"";return e.jsxs("div",{style:{display:"flex",gap:8,padding:"6px 10px",background:"#313244",borderRadius:4,marginBottom:4,fontSize:11},children:[e.jsx("span",{style:{color:b,fontWeight:600,minWidth:50},children:d?"✓":"✗"}),e.jsx("span",{style:{color:"#cdd6f4",flex:1},children:f}),l!==null&&e.jsxs("span",{style:{color:"#a6adc8"},children:["(",(l*100).toFixed(0),"%)"]}),u&&e.jsx("span",{style:{color:"#6c7086",fontSize:10},children:u})]},c)})]},p)})}else return E.map((m,p)=>{const i=m.matched===1||m.matched===!0,z=i?"#a6e3a1":"#f38ba8",t=m.confidence??null,c=String(m.matcher_name||"unknown"),d=m.reason?String(m.reason):"";return e.jsxs("div",{style:{display:"flex",gap:8,padding:"6px 10px",background:"#313244",borderRadius:4,marginBottom:4,fontSize:11},children:[e.jsx("span",{style:{color:z,fontWeight:600,minWidth:50},children:i?"✓ MATCH":"✗ FAIL"}),e.jsx("span",{style:{color:"#cdd6f4",flex:1},children:c}),t!==null&&e.jsxs("span",{style:{color:"#a6adc8"},children:["(",(t*100).toFixed(0),"%)"]}),d&&e.jsx("span",{style:{color:"#6c7086",fontSize:10},children:d})]},p)})})()]})]})]},j)})})}function oe({loading:r,error:s,stats:n,integrations:B,connectedCount:T,onRefresh:M}){return r?e.jsx("div",{style:{color:"#a6adc8",padding:20},children:"Loading stats..."}):s?e.jsx("div",{style:{color:"#f38ba8",padding:20},children:s}):e.jsxs("div",{style:{padding:20},children:[e.jsx("div",{style:{display:"flex",justifyContent:"flex-end",marginBottom:16},children:e.jsx("button",{style:a.refreshBtn,onClick:M,children:"Refresh"})}),n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{style:a.section,children:[e.jsx("h3",{style:a.sectionTitle,children:"Workflows"}),e.jsxs("div",{style:a.grid,children:[e.jsx(U,{label:"Active",value:n.activeWorkflows,color:"#89b4fa"}),e.jsx(U,{label:"Completed",value:n.completedWorkflows,color:"#a6e3a1"}),e.jsx(U,{label:"Failed",value:n.failedWorkflows,color:"#f38ba8"})]})]}),e.jsxs("div",{style:a.section,children:[e.jsx("h3",{style:a.sectionTitle,children:"Events (Today)"}),e.jsxs("div",{style:a.grid,children:[e.jsx(U,{label:"Triggers Fired",value:n.triggersFiredToday,color:"#f9e2af"}),e.jsx(U,{label:"Slack Messages",value:n.slackMessageCount,color:"#cba6f7"}),e.jsx(U,{label:"Emails",value:n.emailCount,color:"#fab387"})]})]}),e.jsxs("div",{style:a.section,children:[e.jsxs("h3",{style:a.sectionTitle,children:["Integrations (",T,"/",B.length," connected)"]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:6},children:[B.map(y=>e.jsxs("div",{style:a.integrationRow,children:[e.jsx("span",{style:{color:"#cdd6f4",fontSize:13},children:y.name}),e.jsx("span",{style:{...a.statusBadge,background:y.status.connected?"rgba(166,227,161,0.15)":"rgba(108,112,134,0.15)",color:y.status.connected?"#a6e3a1":"#6c7086"},children:y.status.error?"Error":y.status.connected?"Connected":"Disconnected"})]},y.id)),B.length===0&&e.jsx("div",{style:{color:"#6c7086",fontSize:12},children:"No integrations configured"})]})]})]}),!n&&e.jsx("div",{style:{color:"#6c7086",textAlign:"center",padding:40},children:"No stats available. The event store may not have any data yet."})]})}function U({label:r,value:s,color:n}){return e.jsxs("div",{style:a.card,children:[e.jsx("div",{style:{color:n,fontSize:28,fontWeight:700,lineHeight:1},children:s}),e.jsx("div",{style:{color:"#a6adc8",fontSize:11,marginTop:4},children:r})]})}function ie(r){const s=r.data;switch(r.type){case"trigger":return`Trigger "${s.triggerName||s.triggerId}" ${s.status||"fired"}`;case"slack":return`${s.direction==="outbound"?"Sent":"Received"} in #${s.channelName||s.channelId}: ${Y(s.text,60)}`;case"email":return`${s.direction==="outbound"?"Sent to":"From"} ${s.direction==="outbound"?s.toAddresses:s.fromAddress}: ${Y(s.subject,50)}`;case"approval":return`${s.approved?"Approved":"Rejected"} by ${s.approverEmail}`;case"document":return`Generated "${s.outputFilename}" from template "${s.templateName}"`;case"calendar":return`Calendar event ${s.action}: "${s.summary}"`;case"jira":return`${s.ticketKey} ${s.action}: ${Y(s.summary,50)}`;case"step":return`Workflow step: ${s.toStateName} (${s.status})`;case"variable_change":return`Variable "${s.variableName}" changed by ${s.changedBy}`;case"audit":return`[${(s.level||"info").toUpperCase()}] ${s.category}: ${s.action}`;default:return JSON.stringify(s).slice(0,80)}}function Y(r,s){return r?r.length>s?r.slice(0,s)+"...":r:""}const V={running:"#a6e3a1",paused:"#f9e2af",completed:"#89b4fa",failed:"#f38ba8",cancelled:"#6c7086"},q={action:"#89b4fa",wait:"#f9e2af",decision:"#cba6f7",end:"#6c7086"};let G=null,Q,Z;function ee(){const r=te.getState(),s=r.workflowDefinitions??new Map,n=r.workflowInstances??new Map;return G&&Q===s&&Z===n||(Q=s,Z=n,G={definitions:s,instances:n}),G}function le(){return g.useSyncExternalStore(r=>te.subscribe(r),ee,ee)}function ce(){var z;const{definitions:r,instances:s}=le(),[n,B]=g.useState("all"),[T,M]=g.useState("all"),[y,x]=g.useState(""),[_,j]=g.useState(null),[C,N]=g.useState(null),[R,$]=g.useState(null),W=g.useMemo(()=>Array.from(s.values()),[s]),E=g.useMemo(()=>Array.from(r.values()),[r]),m=g.useMemo(()=>W.filter(t=>{if(n!=="all"&&t.status!==n||T!=="all"&&t.workflowDefId!==T)return!1;if(y){const c=y.toLowerCase();return t.workflowName.toLowerCase().includes(c)||t.id.toLowerCase().includes(c)||JSON.stringify(t.variables).toLowerCase().includes(c)}return!0}).sort((t,c)=>c.updatedAt-t.updatedAt),[W,n,T,y]),p=_?s.get(_):null,i=R?s.get(R):null;if(i){const t=r.get(i.workflowDefId),c=t==null?void 0:t.states.find(f=>f.id===i.currentStateId),d=V[i.status]||"#6c7086",b={},l={};for(const[f,u]of Object.entries(i.variables))f.startsWith("wi_")?b[f]=u:l[f]=u;return e.jsxs("div",{style:{padding:"12px 0"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:12},children:[e.jsx("button",{style:{...a.refreshBtn,fontSize:12},onClick:()=>$(null),children:"Back"}),e.jsxs("span",{style:{color:"#cdd6f4",fontSize:13,fontWeight:500},children:["Debug: ",i.workflowName]}),e.jsx("span",{style:{...a.tag,background:`${d}22`,color:d},children:i.status})]}),e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:8,marginBottom:16},children:[e.jsx(L,{label:"ID",value:i.id}),e.jsx(L,{label:"Def ID",value:i.workflowDefId}),e.jsx(L,{label:"Current State",value:(c==null?void 0:c.name)||i.currentStateId}),e.jsx(L,{label:"State Type",value:(c==null?void 0:c.type)||"unknown"}),e.jsx(L,{label:"Created",value:J(i.createdAt)}),e.jsx(L,{label:"Updated",value:J(i.updatedAt)}),i.completedAt&&e.jsx(L,{label:"Completed",value:J(i.completedAt)}),i.error&&e.jsx(L,{label:"Error",value:i.error,color:"#f38ba8"}),e.jsx(L,{label:"Steps",value:String(((z=i.history)==null?void 0:z.length)??0)})]}),Object.keys(l).length>0&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{color:"#a6adc8",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:1,marginBottom:6},children:"User Variables"}),e.jsx("pre",{style:a.detail,children:JSON.stringify(l,null,2)})]}),Object.keys(b).length>0&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{color:"#a6adc8",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:1,marginBottom:6},children:"Internal Variables (wi_*)"}),e.jsx("pre",{style:a.detail,children:JSON.stringify(b,null,2)})]}),c&&c.transitions.length>0&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx("div",{style:{color:"#a6adc8",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:1,marginBottom:6},children:"Available Transitions"}),c.transitions.map(f=>{var u;return e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",padding:"4px 10px",background:"#313244",borderRadius:4,marginBottom:4},children:[e.jsx("span",{style:{color:"#cdd6f4",fontSize:12},children:f.name}),e.jsxs("span",{style:{color:"#6c7086",fontSize:10},children:[f.condition.type," → ",((u=t==null?void 0:t.states.find(A=>A.id===f.targetStateId))==null?void 0:u.name)||f.targetStateId]})]},f.id)})]}),e.jsxs("div",{children:[e.jsx("div",{style:{color:"#a6adc8",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:1,marginBottom:6},children:"Raw JSON"}),e.jsx("pre",{style:{...a.detail,maxHeight:400},children:JSON.stringify(i,null,2)})]})]})}if(p){const t=r.get(p.workflowDefId),c=V[p.status]||"#6c7086";return e.jsxs("div",{style:{padding:"12px 0"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[e.jsx("button",{style:{...a.refreshBtn,fontSize:12},onClick:()=>{j(null),N(null)},children:"Back"}),e.jsx("span",{style:{color:"#cdd6f4",fontSize:13,fontWeight:500},children:p.workflowName}),e.jsxs("span",{style:{color:"#6c7086",fontSize:10,fontFamily:"monospace"},children:["(",p.id.slice(0,8),")"]}),e.jsx("span",{style:{...a.tag,background:`${c}22`,color:c},children:p.status}),e.jsx("div",{style:{flex:1}}),e.jsx("button",{style:{...a.refreshBtn,fontFamily:"monospace",fontSize:10},onClick:()=>$(p.id),children:"{..}"})]}),e.jsxs("div",{style:{display:"flex",gap:16,color:"#6c7086",fontSize:11,marginBottom:12},children:[e.jsxs("span",{children:["Created: ",J(p.createdAt)]}),e.jsxs("span",{children:["Updated: ",J(p.updatedAt)]}),p.error&&e.jsxs("span",{style:{color:"#f38ba8"},children:["Error: ",p.error]})]}),e.jsxs("div",{style:{color:"#a6adc8",fontSize:11,fontWeight:600,textTransform:"uppercase",letterSpacing:1,marginBottom:8},children:["Timeline (",p.history.length," step",p.history.length!==1?"s":"",")"]}),p.history.length===0&&e.jsx("div",{style:{color:"#6c7086",fontSize:12,padding:16},children:"No steps recorded yet."}),p.history.map((d,b)=>{const l=t==null?void 0:t.states.find(A=>A.id===d.toStateId),f=C===b,u=l&&q[l.type]||"#6c7086";return e.jsxs("div",{style:{padding:"10px 12px",borderLeft:`3px solid ${u}`,borderBottom:"1px solid #313244",cursor:"pointer",background:f?"rgba(137,180,250,0.05)":"transparent",marginLeft:8},onClick:()=>N(f?null:b),children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[e.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:u,flexShrink:0}}),e.jsx("span",{style:{color:"#cdd6f4",fontSize:12,fontWeight:500},children:(l==null?void 0:l.name)||d.toStateId}),l&&e.jsx("span",{style:{...a.tag,background:`${u}22`,color:u},children:l.type}),d.transitionName&&e.jsxs("span",{style:{color:"#6c7086",fontSize:10},children:['via "',d.transitionName,'"']}),e.jsx("div",{style:{flex:1}}),e.jsx("span",{style:{color:"#6c7086",fontSize:10,whiteSpace:"nowrap"},children:J(d.timestamp)})]}),f&&e.jsxs("div",{style:{marginTop:8,paddingLeft:20},children:[d.fromStateId&&e.jsxs("div",{style:{color:"#6c7086",fontSize:11,marginBottom:2},children:[e.jsx("span",{style:{fontWeight:600,fontSize:10,textTransform:"uppercase"},children:"From: "}),e.jsx("span",{style:{fontFamily:"monospace"},children:d.fromStateId})]}),d.details&&e.jsxs("div",{style:{marginTop:6},children:[e.jsx("div",{style:{color:"#6c7086",fontSize:10,fontWeight:600,textTransform:"uppercase",marginBottom:4},children:"Agent Reasoning / Summary"}),e.jsx("div",{style:{padding:10,background:"#181825",borderRadius:6,border:"1px solid #313244",fontSize:12,color:"#cdd6f4",lineHeight:1.5,whiteSpace:"pre-wrap"},children:d.details})]}),(l==null?void 0:l.description)&&e.jsxs("div",{style:{marginTop:6,color:"#a6adc8",fontSize:11},children:[e.jsx("span",{style:{color:"#6c7086",fontWeight:600,fontSize:10,textTransform:"uppercase"},children:"Description: "}),l.description]}),d.variables&&Object.keys(d.variables).length>0&&e.jsxs("div",{style:{marginTop:6},children:[e.jsx("div",{style:{color:"#6c7086",fontSize:10,fontWeight:600,textTransform:"uppercase",marginBottom:4},children:"Variables at this step"}),e.jsx("pre",{style:a.detail,children:JSON.stringify(d.variables,null,2)})]}),(l==null?void 0:l.action)&&e.jsxs("div",{style:{marginTop:6},children:[e.jsxs("div",{style:{color:"#6c7086",fontSize:10,fontWeight:600,textTransform:"uppercase",marginBottom:4},children:["Action (",l.action.type,")"]}),e.jsx("pre",{style:a.detail,children:JSON.stringify(l.action,null,2)})]})]})]},b)})]})}return e.jsxs("div",{style:{padding:"12px 0"},children:[e.jsxs("div",{style:{display:"flex",gap:8,alignItems:"center",marginBottom:12,flexWrap:"wrap"},children:[e.jsxs("select",{style:{background:"#313244",border:"1px solid #45475a",borderRadius:6,padding:"5px 10px",color:"#cdd6f4",fontSize:12,outline:"none"},value:T,onChange:t=>M(t.target.value),children:[e.jsx("option",{value:"all",children:"All Workflows"}),E.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsx("div",{style:{display:"flex",gap:4},children:["all","running","paused","completed","failed","cancelled"].map(t=>e.jsx("button",{style:{...a.timeBtn,background:n===t?t==="all"?"#89b4fa":V[t]||"#89b4fa":"transparent",color:n===t?"#1e1e2e":"#a6adc8",borderColor:n===t?"transparent":"#45475a",textTransform:"capitalize"},onClick:()=>B(t),children:t},t))}),e.jsx("input",{style:a.searchInput,placeholder:"Search instances...",value:y,onChange:t=>x(t.target.value)}),e.jsxs("span",{style:{color:"#6c7086",fontSize:11},children:[m.length,"/",W.length]})]}),m.length===0?e.jsx("div",{style:{color:"#6c7086",textAlign:"center",padding:40},children:"No workflow instances found."}):m.map(t=>{var f,u;const c=r.get(t.workflowDefId),d=V[t.status]||"#6c7086",b=c==null?void 0:c.states.find(A=>A.id===t.currentStateId),l=b&&q[b.type]||"#6c7086";return e.jsxs("div",{style:{...a.eventRow,display:"flex",alignItems:"center",gap:12,borderLeft:`3px solid ${d}`},onClick:()=>j(t.id),children:[e.jsxs("div",{style:{flex:1,minWidth:0},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6},children:[e.jsx("span",{style:{color:"#cdd6f4",fontSize:13,fontWeight:500},children:t.workflowName}),e.jsx("span",{style:{...a.tag,background:`${d}22`,color:d},children:t.status})]}),e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginTop:2},children:[e.jsx("span",{style:{color:"#6c7086",fontSize:10,fontFamily:"monospace"},children:t.id.slice(0,8)}),b&&e.jsxs("span",{style:{color:l,fontSize:10},children:["@ ",b.name]}),e.jsxs("span",{style:{color:"#45475a",fontSize:10},children:[((f=t.history)==null?void 0:f.length)??0," step",(((u=t.history)==null?void 0:u.length)??0)!==1?"s":""]})]})]}),e.jsx("span",{style:{color:"#6c7086",fontSize:10,whiteSpace:"nowrap"},children:de(t.updatedAt)}),e.jsx("button",{style:{background:"transparent",border:"1px solid #45475a",borderRadius:4,padding:"3px 6px",color:"#6c7086",fontSize:10,fontFamily:"monospace",cursor:"pointer"},onClick:A=>{A.stopPropagation(),$(t.id)},title:"Debug view",children:"{..}"})]},t.id)})]})}function L({label:r,value:s,color:n}){return e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:2,padding:"8px 10px",background:"#313244",borderRadius:6},children:[e.jsx("span",{style:{color:"#6c7086",fontSize:10,textTransform:"uppercase",letterSpacing:.5},children:r}),e.jsx("span",{style:{color:n||"#cdd6f4",fontSize:12,fontFamily:"monospace",wordBreak:"break-all"},children:s})]})}function de(r){return new Date(r).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}function J(r){const s=new Date(r);return`${s.toLocaleDateString()} ${s.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",second:"2-digit"})}`}const a={overlay:{position:"fixed",inset:0,background:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e4,backdropFilter:"blur(4px)"},modal:{background:"var(--surface-0, #1e1e2e)",borderRadius:12,border:"1px solid var(--border, #313244)",width:"90vw",maxWidth:1e3,height:"85vh",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 20px 60px rgba(0, 0, 0, 0.5)"},header:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"16px 20px",borderBottom:"1px solid var(--border, #313244)",background:"var(--surface-1, #181825)"},headerTitle:{fontSize:16,fontWeight:600,color:"var(--text-primary, #cdd6f4)",display:"flex",alignItems:"center",gap:8},closeBtn:{background:"none",border:"none",color:"var(--text-secondary, #a6adc8)",fontSize:20,cursor:"pointer",padding:"4px 8px",borderRadius:6,lineHeight:1},tabs:{display:"flex",borderBottom:"1px solid var(--border, #313244)",background:"var(--surface-1, #181825)",overflowX:"auto",scrollbarWidth:"none"},tab:r=>({padding:"10px 16px",background:"none",border:"none",borderBottom:r?"2px solid var(--accent, #89b4fa)":"2px solid transparent",color:r?"var(--accent, #89b4fa)":"var(--text-secondary, #a6adc8)",fontSize:13,fontWeight:r?600:400,cursor:"pointer",display:"flex",alignItems:"center",gap:6,whiteSpace:"nowrap",transition:"color 0.15s, border-color 0.15s",flexShrink:0}),filters:{display:"flex",gap:8,alignItems:"center",padding:"10px 20px",borderBottom:"1px solid var(--border, #313244)",flexWrap:"wrap"},timeBtn:{border:"1px solid #45475a",borderRadius:4,padding:"4px 8px",fontSize:10,fontWeight:600,cursor:"pointer"},searchInput:{background:"#313244",border:"1px solid #45475a",borderRadius:6,padding:"5px 10px",color:"#cdd6f4",fontSize:12,flex:1,minWidth:120,outline:"none"},refreshBtn:{background:"transparent",border:"1px solid #45475a",borderRadius:6,padding:"5px 12px",color:"#a6adc8",fontSize:11,cursor:"pointer"},content:{flex:1,overflow:"auto",padding:"0 20px"},eventRow:{padding:"8px 12px",borderBottom:"1px solid #313244",cursor:"pointer",transition:"background 0.1s"},tag:{fontSize:10,fontWeight:600,padding:"2px 6px",borderRadius:4,whiteSpace:"nowrap"},detail:{marginTop:8,padding:10,background:"#181825",borderRadius:6,fontSize:11,fontFamily:"monospace",color:"#a6adc8",overflow:"auto",maxHeight:300,whiteSpace:"pre-wrap",wordBreak:"break-all"},footer:{padding:"8px 20px",borderTop:"1px solid #313244"},section:{marginBottom:24},sectionTitle:{color:"#a6adc8",fontSize:12,fontWeight:600,textTransform:"uppercase",letterSpacing:1,marginBottom:12,margin:0},grid:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:12},card:{background:"#313244",borderRadius:8,padding:"16px 14px",textAlign:"center"},integrationRow:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"8px 12px",background:"#313244",borderRadius:6},statusBadge:{fontSize:10,fontWeight:600,padding:"3px 8px",borderRadius:4}};export{he as MonitoringModal};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u as L,f as d,r as m,s as o,j as x}from"./main-
|
|
1
|
+
import{u as L,f as d,r as m,s as o,j as x}from"./main-BSyGZK2z.js";import{L as S}from"./LogViewerModal-Bx9IDiFM.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function $({building:t,isOpen:e,onClose:n}){var a;const{t:i}=L(["terminal"]),{streamingBuildingLogs:p,streamingBuildingIds:c}=d(),r=p.get(t.id)||"",g=c.has(t.id);m.useEffect(()=>{var s;return e&&((s=t.pm2)!=null&&s.enabled)&&o.startLogStreaming(t.id,200),()=>{t.id&&o.stopLogStreaming(t.id)}},[e,t.id,(a=t.pm2)==null?void 0:a.enabled]);const f=m.useMemo(()=>r.split(`
|
|
2
2
|
`).map((s,l)=>({text:s,lineNumber:l+1})),[r]);return x.jsx(S,{isOpen:e,onClose:n,title:`${t.name} - ${i("terminal:logs.pm2Logs")}`,icon:"📄",lines:f,isStreaming:g,onClear:()=>o.clearStreamingLogs(t.id)})}export{$ as PM2LogsModal};
|
package/dist/assets/{RestoreArchivedAreaModal-COSiM8Fi.js → RestoreArchivedAreaModal-BajWqtWn.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as m,J as f,j as e,s as d}from"./main-
|
|
1
|
+
import{u as m,J as f,j as e,s as d}from"./main-BSyGZK2z.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function N(r){const t=Date.now()-r,i=Math.floor(t/1e3),a=Math.floor(i/60),c=Math.floor(a/60),n=Math.floor(c/24);return n>0?`${n} day${n>1?"s":""} ago`:c>0?`${c} hour${c>1?"s":""} ago`:a>0?`${a} min${a>1?"s":""} ago`:"just now"}function k({isOpen:r,restorePosition:l,onClose:t,onRestored:i}){const{t:a}=m(["terminal","common"]),c=f(),n=Array.from(c.values()).filter(s=>s.archived===!0),o=(s,j)=>{const x=j?void 0:l||void 0;d.restoreArchivedArea(s,x),i==null||i(),t()},h=()=>{for(const s of n)d.restoreArchivedArea(s.id);i==null||i(),t()},v=s=>{s.target===s.currentTarget&&t()},u=s=>{s.key==="Escape"&&t()};return r?e.jsx("div",{className:`modal-overlay ${r?"visible":""}`,onClick:v,onKeyDown:u,children:e.jsxs("div",{className:"modal restore-archived-modal",children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("span",{className:"header-icon",children:"📦"}),a("terminal:areas.restoreArchivedZone")]}),e.jsx("div",{className:"modal-body restore-archived-body",children:n.length===0?e.jsx("div",{className:"archived-empty",children:a("terminal:areas.noArchivedZones")}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"restore-info",children:a("terminal:areas.restoreInfo")}),e.jsx("div",{className:"archived-list",children:n.map(s=>e.jsx(g,{area:s,onRestoreHere:()=>o(s.id,!1),onRestoreOriginal:()=>o(s.id,!0),hasRestorePosition:!!l},s.id))}),n.length>1&&e.jsx("div",{className:"restore-all-section",children:e.jsx("button",{className:"btn btn-secondary",onClick:h,children:a("terminal:areas.restoreAllOriginal")})})]})}),e.jsx("div",{className:"modal-footer",children:e.jsx("button",{className:"btn btn-secondary",onClick:t,children:a("common:buttons.cancel")})})]})}):null}function g({area:r,onRestoreHere:l,onRestoreOriginal:t,hasRestorePosition:i}){const{t:a}=m(["terminal","common"]),c=r.assignedAgentIds.length,n=r.directories.length;return e.jsxs("div",{className:"archived-item",children:[e.jsx("div",{className:"archived-item-color",style:{backgroundColor:r.color}}),e.jsxs("div",{className:"archived-item-info",children:[e.jsx("div",{className:"archived-item-name",children:r.name}),e.jsxs("div",{className:"archived-item-meta",children:[e.jsx("span",{className:"archived-item-type",children:r.type}),c>0&&e.jsx("span",{className:"archived-item-agents",children:a("terminal:areas.agentCount",{count:c})}),n>0&&e.jsx("span",{className:"archived-item-dirs",children:a("terminal:areas.folderCount",{count:n})}),r.archivedAt&&e.jsx("span",{className:"archived-item-time",children:N(r.archivedAt)})]})]}),e.jsxs("div",{className:"archived-item-actions",children:[i&&e.jsx("button",{className:"btn btn-small btn-primary",onClick:l,title:a("terminal:areas.placeAtClickedPosition"),children:a("terminal:areas.restoreHere")}),e.jsx("button",{className:"btn btn-small",onClick:t,title:a("terminal:areas.restoreToOriginal"),children:a(i?"terminal:areas.original":"terminal:areas.restore")})]})]})}export{k as RestoreArchivedAreaModal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as D,r as h,j as s}from"./main-
|
|
1
|
+
import{u as D,r as h,j as s}from"./main-BSyGZK2z.js";import"./modulepreload-polyfill-B5Qt9EMX.js";import"./vendor-react--Eh9ivFN.js";import"./vendor-three-Chj50gSY.js";function B({isOpen:t,onClose:n,agent:d,outputCount:b,trackedFiles:p,onSave:g,isSaving:l=!1,error:x}){const{t:a}=D(["terminal","common"]),m=h.useCallback(()=>{const z=new Date().toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});return`${d.name} - ${z}`},[d.name]),[r,u]=h.useState(m()),[j,N]=h.useState("");h.useEffect(()=>{t&&(u(m()),N(""))},[t,m]);const y=async e=>{e.preventDefault(),r.trim()&&await g({agentId:d.id,title:r.trim(),description:j.trim()||void 0})},w=e=>{e.key==="Escape"&&n()};if(!t)return null;const i=(p==null?void 0:p.files)||[],o=i.filter(e=>e.type==="created"),c=i.filter(e=>e.type==="modified");return s.jsx("div",{className:"modal-overlay visible",onClick:n,onKeyDown:w,children:s.jsxs("div",{className:"modal snapshot-modal",onClick:e=>e.stopPropagation(),children:[s.jsxs("div",{className:"modal-header",children:[s.jsx("span",{className:"snapshot-modal-icon",children:"⭐"}),a("terminal:snapshot.save")]}),s.jsxs("form",{onSubmit:y,children:[s.jsxs("div",{className:"modal-body",children:[s.jsxs("div",{className:"snapshot-field",children:[s.jsxs("label",{className:"snapshot-label",children:[a("common:labels.title")," ",s.jsx("span",{className:"snapshot-required",children:"*"})]}),s.jsx("input",{type:"text",className:"snapshot-input",value:r,onChange:e=>u(e.target.value),placeholder:a("terminal:snapshot.enterTitle"),autoFocus:!0,disabled:l})]}),s.jsxs("div",{className:"snapshot-field",children:[s.jsxs("label",{className:"snapshot-label",children:[a("common:labels.description")," ",s.jsx("span",{className:"snapshot-optional",children:a("common:labels.optional")})]}),s.jsx("textarea",{className:"snapshot-textarea",value:j,onChange:e=>N(e.target.value),placeholder:a("terminal:snapshot.whatWasAccomplished"),rows:3,disabled:l})]}),s.jsxs("div",{className:"snapshot-preview",children:[s.jsx("div",{className:"snapshot-preview-header",children:a("terminal:snapshot.whatWillBeCaptured")}),s.jsxs("div",{className:"snapshot-preview-stats",children:[s.jsxs("div",{className:"snapshot-stat",children:[s.jsx("span",{className:"snapshot-stat-icon",children:"💬"}),s.jsx("span",{className:"snapshot-stat-value",children:b}),s.jsx("span",{className:"snapshot-stat-label",children:a("terminal:snapshot.messages")})]}),s.jsxs("div",{className:"snapshot-stat",children:[s.jsx("span",{className:"snapshot-stat-icon",children:"📄"}),s.jsx("span",{className:"snapshot-stat-value",children:i.length}),s.jsx("span",{className:"snapshot-stat-label",children:a("terminal:snapshot.files")})]})]}),i.length>0&&s.jsxs("div",{className:"snapshot-files-preview",children:[o.length>0&&s.jsxs("div",{className:"snapshot-file-group",children:[s.jsxs("div",{className:"snapshot-file-group-label",children:[s.jsx("span",{className:"snapshot-file-type created",children:"+"}),a("terminal:snapshot.createdFiles",{count:o.length})]}),s.jsxs("div",{className:"snapshot-file-list",children:[o.slice(0,5).map(e=>s.jsxs("div",{className:"snapshot-file-item",children:[s.jsx("span",{className:"snapshot-file-path",title:e.path,children:v(e.path)}),e.size!==void 0&&s.jsx("span",{className:"snapshot-file-size",children:f(e.size)})]},e.path)),o.length>5&&s.jsx("div",{className:"snapshot-file-more",children:a("terminal:snapshot.more",{count:o.length-5})})]})]}),c.length>0&&s.jsxs("div",{className:"snapshot-file-group",children:[s.jsxs("div",{className:"snapshot-file-group-label",children:[s.jsx("span",{className:"snapshot-file-type modified",children:"~"}),a("terminal:snapshot.modifiedFiles",{count:c.length})]}),s.jsxs("div",{className:"snapshot-file-list",children:[c.slice(0,5).map(e=>s.jsxs("div",{className:"snapshot-file-item",children:[s.jsx("span",{className:"snapshot-file-path",title:e.path,children:v(e.path)}),e.size!==void 0&&s.jsx("span",{className:"snapshot-file-size",children:f(e.size)})]},e.path)),c.length>5&&s.jsx("div",{className:"snapshot-file-more",children:a("terminal:snapshot.more",{count:c.length-5})})]})]})]}),i.length===0&&s.jsx("div",{className:"snapshot-no-files",children:a("terminal:snapshot.noFilesChanged")})]}),x&&s.jsx("div",{className:"snapshot-error",children:x})]}),s.jsxs("div",{className:"modal-footer",children:[s.jsx("button",{type:"button",className:"btn btn-secondary",onClick:n,disabled:l,children:a("common:buttons.cancel")}),s.jsx("button",{type:"submit",className:"btn btn-primary",disabled:!r.trim()||l,children:l?a("terminal:snapshot.saving"):`⭐ ${a("terminal:snapshot.save")}`})]})]})]})})}function v(t){const n=t.split("/");return n[n.length-1]||t}function f(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}export{B as SaveSnapshotModal};
|