@overlordai/server 1.0.51 → 1.0.53

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 (53) hide show
  1. package/dist/web/pty.gateway.d.ts.map +1 -1
  2. package/dist/web/pty.gateway.js +10 -4
  3. package/dist/web/pty.gateway.js.map +1 -1
  4. package/package.json +2 -2
  5. package/public/assets/{AccessTokensPage-DypSjrzB.js → AccessTokensPage-Cb5hGBfN.js} +1 -1
  6. package/public/assets/{AdminPage-BY1ub8Ur.js → AdminPage-C7Xytkfo.js} +1 -1
  7. package/public/assets/{ApiReferencePage-X0c9Bj31.js → ApiReferencePage-DLGVc4xN.js} +1 -1
  8. package/public/assets/{AuditLogPage-B0bBeD2B.js → AuditLogPage-BgqsUJ7x.js} +1 -1
  9. package/public/assets/{BotManage-D7UIzmUX.js → BotManage-Ds9DYQZA.js} +1 -1
  10. package/public/assets/{CliReferencePage-DAqUe3dC.js → CliReferencePage-WXinn_69.js} +1 -1
  11. package/public/assets/{DeveloperManage-Df4qgJ4d.js → DeveloperManage-saSq3Hfx.js} +1 -1
  12. package/public/assets/{EditProjectPage-B05CUiFx.js → EditProjectPage-C4xWYLTo.js} +1 -1
  13. package/public/assets/{EmptyState-BOXPalWI.js → EmptyState-CvmhFgWJ.js} +1 -1
  14. package/public/assets/{HomePage-YM1Wcq5V.js → HomePage-y20pQ52r.js} +1 -1
  15. package/public/assets/{LandingPage-Dn64_5F4.js → LandingPage-CB5BBbdI.js} +1 -1
  16. package/public/assets/{LoginPage-CcBF1jm-.js → LoginPage-DLljhJkQ.js} +1 -1
  17. package/public/assets/{MachineDetailPage-BHzHO-jG.js → MachineDetailPage-CPm9tfdp.js} +1 -1
  18. package/public/assets/{MachineListPage-sTx1mDtP.js → MachineListPage-D-nhVz-m.js} +1 -1
  19. package/public/assets/{NotFoundPage-griwga5q.js → NotFoundPage-BuiAS4g4.js} +1 -1
  20. package/public/assets/{PipelineEditorPage-CZQJn5Qd.js → PipelineEditorPage-B9GgqAju.js} +1 -1
  21. package/public/assets/{ProfilePage-CM-HnNqC.js → ProfilePage-DASpeJq6.js} +1 -1
  22. package/public/assets/{ProjectDetailPage-d59hpM1f.js → ProjectDetailPage-DWZyNwTV.js} +1 -1
  23. package/public/assets/{ProjectListPage-j4xLknRG.js → ProjectListPage-BUMX3Dxa.js} +1 -1
  24. package/public/assets/{QuickAuth-vbGZYKLu.js → QuickAuth-B9mvq7ht.js} +1 -1
  25. package/public/assets/{RemoveMemberConfirmDialog-I3k9sPON.js → RemoveMemberConfirmDialog-DS9z6jQT.js} +1 -1
  26. package/public/assets/{Select-CmUwVfWJ.js → Select-A7PXobk_.js} +1 -1
  27. package/public/assets/{SettingsPage-CDTheJqk.js → SettingsPage-WGzxUbGp.js} +1 -1
  28. package/public/assets/{Skeleton-0JE10nwo.js → Skeleton-CcVqz28_.js} +1 -1
  29. package/public/assets/{SkillPage-ClOtPiNe.js → SkillPage-BIt2kF3W.js} +1 -1
  30. package/public/assets/{TaskDetailPage-CG8zmgwV.js → TaskDetailPage-CePyNfp6.js} +2 -2
  31. package/public/assets/{TaskListPage-BUjNGBKm.js → TaskListPage-MO4_PSve.js} +1 -1
  32. package/public/assets/{TaskStatusBadge-C8TEMiVe.js → TaskStatusBadge-QtQUDscM.js} +1 -1
  33. package/public/assets/{TokenManage-U3YbhV_d.js → TokenManage-Sf0RGymw.js} +1 -1
  34. package/public/assets/{TotpSetupPage-BlRM2OEF.js → TotpSetupPage-D-rbEYLf.js} +1 -1
  35. package/public/assets/{WorkerSetupGuidePage-BUTz9NXE.js → WorkerSetupGuidePage-D6Fv1MQo.js} +1 -1
  36. package/public/assets/{arrow-left-C-OTbm1J.js → arrow-left-CVKez32c.js} +1 -1
  37. package/public/assets/{arrow-right-B5aaHrGs.js → arrow-right-g7hTftEi.js} +1 -1
  38. package/public/assets/{bot-KMbKzBkt.js → bot-DYvBcsZn.js} +1 -1
  39. package/public/assets/{chevron-right-CVPdQ-cP.js → chevron-right-COxU2yxz.js} +1 -1
  40. package/public/assets/{copy-Dd1cNNWz.js → copy-BGttVgA1.js} +1 -1
  41. package/public/assets/{external-link-F-d1_j4T.js → external-link-DXlCfUjE.js} +1 -1
  42. package/public/assets/{index-DJxZmj6O.js → index-CDBuOPx4.js} +2 -2
  43. package/public/assets/{key-CT_RkMPI.js → key-3eDVdGih.js} +1 -1
  44. package/public/assets/{loader-circle-BnJr5Xpn.js → loader-circle-DPm92ETj.js} +1 -1
  45. package/public/assets/{pencil-Srq1Z7Yh.js → pencil-Bs3PwH2W.js} +1 -1
  46. package/public/assets/{plus-Ry_MQV9O.js → plus-d-PLzbVX.js} +1 -1
  47. package/public/assets/{rotate-ccw-B1ZO6xeO.js → rotate-ccw-Cus8CABi.js} +1 -1
  48. package/public/assets/{scroll-text-CP6Z7Xff.js → scroll-text-CV3wlIy2.js} +1 -1
  49. package/public/assets/{settings-Ac7uhvR0.js → settings-Ccijf48b.js} +1 -1
  50. package/public/assets/{task.store-DSX--5cK.js → task.store-CvjSr507.js} +1 -1
  51. package/public/assets/{trash-2-DWv3OoER.js → trash-2-bRJ-xwtq.js} +1 -1
  52. package/public/assets/{users-BsM5ZXj8.js → users-LNQqKSEN.js} +1 -1
  53. package/public/index.html +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"pty.gateway.d.ts","sourceRoot":"","sources":["../../src/web/pty.gateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAc/B,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAA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,CAAC,aAAa;CAatB"}
@@ -337,11 +337,17 @@ let PtyGateway = PtyGateway_1 = class PtyGateway {
337
337
  }
338
338
  }
339
339
  extractTaskId(url) {
340
- // Match /ws/pty/:taskId or /api/workers/pty/:taskId
341
- const match = /\/(?:ws\/pty|api\/workers\/pty)\/(\d+)/.exec(url);
342
- if (!match)
340
+ // Try query parameter first: /ws/pty?taskId=123
341
+ const queryMatch = /[?&]taskId=(\d+)/.exec(url);
342
+ if (queryMatch) {
343
+ const id = parseInt(queryMatch[1], 10);
344
+ return isNaN(id) ? null : id;
345
+ }
346
+ // Fallback: path parameter /ws/pty/:taskId or /api/workers/pty/:taskId
347
+ const pathMatch = /\/(?:ws\/pty|api\/workers\/pty)\/(\d+)/.exec(url);
348
+ if (!pathMatch)
343
349
  return null;
344
- const id = parseInt(match[1], 10);
350
+ const id = parseInt(pathMatch[1], 10);
345
351
  return isNaN(id) ? null : id;
346
352
  }
347
353
  };
@@ -1 +1 @@
1
- {"version":3,"file":"pty.gateway.js","sourceRoot":"","sources":["../../src/web/pty.gateway.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,mDAI4B;AAC5B,2CAAwC;AAExC,2BAA+B;AAC/B,+BAAoC;AAEpC,mDAAsE;AAWtE,uDAAmD;AACnD,uEAAkE;AAClE,0DAAsD;AACtD,wFAAoF;AACpF,oFAAgF;AAChF,8EAA0E;AAqBnE,IAAM,UAAU,kBAAhB,MAAM,UAAU;IAMF;IACA;IACA;IACA;IACA;IACA;IAVF,MAAM,GAAG,IAAI,eAAM,CAAC,YAAU,CAAC,IAAI,CAAC,CAAC;IACrC,aAAa,GAAG,IAAI,GAAG,EAAqC,CAAC;IAC7D,eAAe,GAAG,MAAM,CAAC;IAE1C,YACmB,WAAwB,EACxB,eAAgC,EAChC,KAAmB,EACnB,aAAkC,EAClC,WAA8B,EAC9B,QAAwB;QALxB,gBAAW,GAAX,WAAW,CAAa;QACxB,oBAAe,GAAf,eAAe,CAAiB;QAChC,UAAK,GA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CACd,sCAAsC,WAAW,qBAAqB,CACvE,CAAC;YACF,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;IAEO,aAAa,CAAC,GAAW;QAC/B,gDAAgD;QAChD,MAAM,UAAU,GAAG,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAChD,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,EAAE,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvC,OAAO,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QAC/B,CAAC;QACD,uEAAuE;QACvE,MAAM,SAAS,GAAG,wCAAwC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrE,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QAC5B,MAAM,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACtC,OAAO,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/B,CAAC;CACF,CAAA;AA7bY,gCAAU;qBAAV,UAAU;IADtB,IAAA,6BAAgB,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;qCAOJ,0BAAW;QACP,mCAAe;QACzB,4BAAY;QACJ,0CAAmB;QACrB,sCAAiB;QACpB,gCAAc;GAXhC,UAAU,CA6btB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overlordai/server",
3
- "version": "1.0.51",
3
+ "version": "1.0.53",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist",
@@ -26,7 +26,7 @@
26
26
  "@nestjs/platform-express": "^10.4.0",
27
27
  "@nestjs/platform-ws": "^10.4.0",
28
28
  "@nestjs/websockets": "^10.4.0",
29
- "@overlordai/protocol": "1.0.51",
29
+ "@overlordai/protocol": "1.0.53",
30
30
  "bcrypt": "^6.0.0",
31
31
  "better-sqlite3": "^11.0.0",
32
32
  "bullmq": "^5.0.0",
@@ -1 +1 @@
1
- import{a as _,r as o,j as e,f as j,l as w,h as C,t as y,o as T,K as S}from"./index-DJxZmj6O.js";import{S as D}from"./Select-CmUwVfWJ.js";import{E as A}from"./EmptyState-BOXPalWI.js";import{T as E}from"./Skeleton-0JE10nwo.js";import{P as L}from"./plus-Ry_MQV9O.js";import{C as R}from"./copy-Dd1cNNWz.js";import{T as M}from"./trash-2-DWv3OoER.js";function O({isOpen:t,onClose:i,onCreated:m}){const{t:s}=_(),[c,n]=o.useState(""),[d,x]=o.useState("never"),[u,v]=o.useState(!1),[p,l]=o.useState(""),b=[{value:"never",label:s("access_tokens.no_expiry")},{value:"30",label:s("access_tokens.days_30")},{value:"90",label:s("access_tokens.days_90")},{value:"365",label:s("access_tokens.days_365")}],h=()=>{n(""),x("never"),l(""),i()},f=async()=>{if(l(""),!c.trim()){l(s("access_tokens.token_label_required"));return}try{v(!0);const a=await j.post("web/profile/tokens",{json:{label:c.trim(),...d!=="never"&&{expiresAt:new Date(Date.now()+parseInt(d,10)*864e5).toISOString()}}}).json();n(""),x("never"),m({token:a.token,name:a.name})}catch(a){const k=a instanceof Error?a.message:s("access_tokens.failed_to_create_token");l(k)}finally{v(!1)}};return t?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-40 bg-[var(--modal-backdrop)]",onClick:h}),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] shadow-lg",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"border-b border-[var(--border)] px-5 py-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--text-primary)]",children:s("access_tokens.create_personal_access_token")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("access_tokens.tokens_authenticate_desc")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-5",children:[p&&e.jsx("div",{className:"rounded-[4px] border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2 text-xs text-[var(--destructive)]",children:p}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("access_tokens.token_name")}),e.jsx("input",{type:"text",placeholder:s("access_tokens.token_name_placeholder"),value:c,onChange:a=>n(a.target.value),onKeyDown:a=>{a.key==="Enter"&&f()},className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("access_tokens.expires")}),e.jsx(D,{value:d,onChange:x,options:b})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{onClick:h,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:s("common.cancel")}),e.jsx("button",{onClick:f,disabled:u,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-medium text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:s(u?"common.creating":"access_tokens.create_token")})]})]})})]}):null}function P({isOpen:t,onClose:i,onConfirm:m,tokenLabel:s,isLoading:c}){const{t:n}=_();return e.jsx(w,{isOpen:t,onClose:i,onConfirm:m,title:n("access_tokens.revoke_token_title"),message:n("access_tokens.revoke_confirm",{name:s}),confirmLabel:n("access_tokens.revoke"),confirmVariant:"danger",isLoading:c})}function $(t){if(!t)return"-";const i=new Date(t).getTime();if(Number.isNaN(i))return"-";const m=Date.now()-i,s=Math.floor(m/1e3);if(s<60)return`${s}s ago`;const c=Math.floor(s/60);if(c<60)return`${c}m ago`;const n=Math.floor(c/60);return n<24?`${n} hours ago`:`${Math.floor(n/24)}d ago`}function V(){const{t}=_(),[i,m]=o.useState([]),[s,c]=o.useState(!0),[n,d]=o.useState(!1),[x,u]=o.useState(null),[v,p]=o.useState(!1),[l,b]=o.useState(null),[h,f]=o.useState(null);C(o.useMemo(()=>e.jsxs("button",{onClick:()=>d(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black transition-opacity hover:opacity-90",children:[e.jsx(L,{className:"h-3.5 w-3.5"}),t("access_tokens.create_token")]}),[t]));const a=o.useCallback(async()=>{try{c(!0);const r=await j.get("web/profile/tokens").json();m(r)}catch{y.error(t("access_tokens.failed_to_load_tokens"))}finally{c(!1)}},[t]);o.useEffect(()=>{a()},[a]);const k=r=>{d(!1),u(r.token),p(!1),a()},g=async()=>{if(x)try{await navigator.clipboard.writeText(x),p(!0),setTimeout(()=>p(!1),2e3)}catch{}},N=async()=>{if(l)try{f(l.id),await j.post(`web/profile/tokens/${l.id}/revoke`),y.success(t("access_tokens.token_revoked")),b(null),a()}catch{y.error(t("access_tokens.failed_to_revoke_token"))}finally{f(null)}};return e.jsxs("div",{className:"mx-auto max-w-4xl px-6 py-8 font-mono lowercase",children:[x&&e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--warning)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsx("p",{className:"mb-2 text-xs font-medium text-[var(--warning)]",children:t("access_tokens.copy_token_warning")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 break-all rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 text-xs text-[var(--text-primary)]",children:x}),e.jsxs("button",{onClick:g,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:[v?e.jsx(T,{className:"h-3.5 w-3.5 text-[var(--accent)]"}):e.jsx(R,{className:"h-3.5 w-3.5"}),t(v?"common.copied":"common.copy")]})]}),e.jsx("div",{className:"mt-2 flex justify-end",children:e.jsx("button",{onClick:()=>u(null),className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:t("common.dismiss")})})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:s?e.jsx("div",{className:"p-4",children:e.jsx(E,{rows:3})}):i.length===0?e.jsx(A,{icon:S,title:t("access_tokens.no_tokens"),description:t("access_tokens.create_token_desc"),actionLabel:t("access_tokens.create_token"),onAction:()=>d(!0)}):e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("common.name")}),e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("common.status")}),e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("access_tokens.created")}),e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("access_tokens.last_used")}),e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("access_tokens.expires")}),e.jsx("th",{className:"px-4 py-2.5 font-normal text-right",children:t("common.actions")})]})}),e.jsx("tbody",{children:i.map(r=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] last:border-b-0 hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"px-4 py-3 text-[var(--text-primary)]",children:r.label}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:r.status==="active"?"text-green-400":"text-[var(--text-muted)]",children:r.status})}),e.jsx("td",{className:"px-4 py-3 text-[var(--text-secondary)]",children:new Date(r.createdAt).toLocaleDateString()}),e.jsx("td",{className:"px-4 py-3 text-[var(--text-secondary)]",children:r.lastUsedAt?$(r.lastUsedAt):t("common.never")}),e.jsx("td",{className:"px-4 py-3 text-[var(--text-secondary)]",children:r.expiresAt?new Date(r.expiresAt).toLocaleDateString():t("common.never")}),e.jsx("td",{className:"px-4 py-3 text-right",children:r.status==="active"&&e.jsxs("button",{onClick:()=>b(r),disabled:h===r.id,className:"inline-flex items-center gap-1 text-xs text-[var(--destructive)] hover:underline disabled:opacity-50",children:[e.jsx(M,{className:"h-3 w-3"}),t("access_tokens.revoke")]})})]},r.id))})]})}),e.jsx(O,{isOpen:n,onClose:()=>d(!1),onCreated:k}),e.jsx(P,{isOpen:!!l,onClose:()=>b(null),onConfirm:N,tokenLabel:(l==null?void 0:l.label)??"",isLoading:h!==null})]})}export{V as default};
1
+ import{a as _,r as o,j as e,f as j,l as w,h as C,t as y,o as T,K as S}from"./index-CDBuOPx4.js";import{S as D}from"./Select-A7PXobk_.js";import{E as A}from"./EmptyState-CvmhFgWJ.js";import{T as E}from"./Skeleton-CcVqz28_.js";import{P as L}from"./plus-d-PLzbVX.js";import{C as R}from"./copy-BGttVgA1.js";import{T as M}from"./trash-2-bRJ-xwtq.js";function O({isOpen:t,onClose:i,onCreated:m}){const{t:s}=_(),[c,n]=o.useState(""),[d,x]=o.useState("never"),[u,v]=o.useState(!1),[p,l]=o.useState(""),b=[{value:"never",label:s("access_tokens.no_expiry")},{value:"30",label:s("access_tokens.days_30")},{value:"90",label:s("access_tokens.days_90")},{value:"365",label:s("access_tokens.days_365")}],h=()=>{n(""),x("never"),l(""),i()},f=async()=>{if(l(""),!c.trim()){l(s("access_tokens.token_label_required"));return}try{v(!0);const a=await j.post("web/profile/tokens",{json:{label:c.trim(),...d!=="never"&&{expiresAt:new Date(Date.now()+parseInt(d,10)*864e5).toISOString()}}}).json();n(""),x("never"),m({token:a.token,name:a.name})}catch(a){const k=a instanceof Error?a.message:s("access_tokens.failed_to_create_token");l(k)}finally{v(!1)}};return t?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-40 bg-[var(--modal-backdrop)]",onClick:h}),e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] shadow-lg",onClick:a=>a.stopPropagation(),children:[e.jsxs("div",{className:"border-b border-[var(--border)] px-5 py-4",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--text-primary)]",children:s("access_tokens.create_personal_access_token")}),e.jsx("p",{className:"mt-1 text-xs text-[var(--text-muted)]",children:s("access_tokens.tokens_authenticate_desc")})]}),e.jsxs("div",{className:"space-y-4 px-5 py-5",children:[p&&e.jsx("div",{className:"rounded-[4px] border border-[var(--destructive)]/30 bg-[var(--destructive)]/5 px-3 py-2 text-xs text-[var(--destructive)]",children:p}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("access_tokens.token_name")}),e.jsx("input",{type:"text",placeholder:s("access_tokens.token_name_placeholder"),value:c,onChange:a=>n(a.target.value),onKeyDown:a=>{a.key==="Enter"&&f()},className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:s("access_tokens.expires")}),e.jsx(D,{value:d,onChange:x,options:b})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{onClick:h,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:s("common.cancel")}),e.jsx("button",{onClick:f,disabled:u,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-medium text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:s(u?"common.creating":"access_tokens.create_token")})]})]})})]}):null}function P({isOpen:t,onClose:i,onConfirm:m,tokenLabel:s,isLoading:c}){const{t:n}=_();return e.jsx(w,{isOpen:t,onClose:i,onConfirm:m,title:n("access_tokens.revoke_token_title"),message:n("access_tokens.revoke_confirm",{name:s}),confirmLabel:n("access_tokens.revoke"),confirmVariant:"danger",isLoading:c})}function $(t){if(!t)return"-";const i=new Date(t).getTime();if(Number.isNaN(i))return"-";const m=Date.now()-i,s=Math.floor(m/1e3);if(s<60)return`${s}s ago`;const c=Math.floor(s/60);if(c<60)return`${c}m ago`;const n=Math.floor(c/60);return n<24?`${n} hours ago`:`${Math.floor(n/24)}d ago`}function V(){const{t}=_(),[i,m]=o.useState([]),[s,c]=o.useState(!0),[n,d]=o.useState(!1),[x,u]=o.useState(null),[v,p]=o.useState(!1),[l,b]=o.useState(null),[h,f]=o.useState(null);C(o.useMemo(()=>e.jsxs("button",{onClick:()=>d(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black transition-opacity hover:opacity-90",children:[e.jsx(L,{className:"h-3.5 w-3.5"}),t("access_tokens.create_token")]}),[t]));const a=o.useCallback(async()=>{try{c(!0);const r=await j.get("web/profile/tokens").json();m(r)}catch{y.error(t("access_tokens.failed_to_load_tokens"))}finally{c(!1)}},[t]);o.useEffect(()=>{a()},[a]);const k=r=>{d(!1),u(r.token),p(!1),a()},g=async()=>{if(x)try{await navigator.clipboard.writeText(x),p(!0),setTimeout(()=>p(!1),2e3)}catch{}},N=async()=>{if(l)try{f(l.id),await j.post(`web/profile/tokens/${l.id}/revoke`),y.success(t("access_tokens.token_revoked")),b(null),a()}catch{y.error(t("access_tokens.failed_to_revoke_token"))}finally{f(null)}};return e.jsxs("div",{className:"mx-auto max-w-4xl px-6 py-8 font-mono lowercase",children:[x&&e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--warning)] bg-[var(--bg-card)] px-4 py-3",children:[e.jsx("p",{className:"mb-2 text-xs font-medium text-[var(--warning)]",children:t("access_tokens.copy_token_warning")}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"flex-1 break-all rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 text-xs text-[var(--text-primary)]",children:x}),e.jsxs("button",{onClick:g,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:[v?e.jsx(T,{className:"h-3.5 w-3.5 text-[var(--accent)]"}):e.jsx(R,{className:"h-3.5 w-3.5"}),t(v?"common.copied":"common.copy")]})]}),e.jsx("div",{className:"mt-2 flex justify-end",children:e.jsx("button",{onClick:()=>u(null),className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)]",children:t("common.dismiss")})})]}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:s?e.jsx("div",{className:"p-4",children:e.jsx(E,{rows:3})}):i.length===0?e.jsx(A,{icon:S,title:t("access_tokens.no_tokens"),description:t("access_tokens.create_token_desc"),actionLabel:t("access_tokens.create_token"),onAction:()=>d(!0)}):e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border)] text-left text-[var(--text-muted)]",children:[e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("common.name")}),e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("common.status")}),e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("access_tokens.created")}),e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("access_tokens.last_used")}),e.jsx("th",{className:"px-4 py-2.5 font-normal",children:t("access_tokens.expires")}),e.jsx("th",{className:"px-4 py-2.5 font-normal text-right",children:t("common.actions")})]})}),e.jsx("tbody",{children:i.map(r=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] last:border-b-0 hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"px-4 py-3 text-[var(--text-primary)]",children:r.label}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:r.status==="active"?"text-green-400":"text-[var(--text-muted)]",children:r.status})}),e.jsx("td",{className:"px-4 py-3 text-[var(--text-secondary)]",children:new Date(r.createdAt).toLocaleDateString()}),e.jsx("td",{className:"px-4 py-3 text-[var(--text-secondary)]",children:r.lastUsedAt?$(r.lastUsedAt):t("common.never")}),e.jsx("td",{className:"px-4 py-3 text-[var(--text-secondary)]",children:r.expiresAt?new Date(r.expiresAt).toLocaleDateString():t("common.never")}),e.jsx("td",{className:"px-4 py-3 text-right",children:r.status==="active"&&e.jsxs("button",{onClick:()=>b(r),disabled:h===r.id,className:"inline-flex items-center gap-1 text-xs text-[var(--destructive)] hover:underline disabled:opacity-50",children:[e.jsx(M,{className:"h-3 w-3"}),t("access_tokens.revoke")]})})]},r.id))})]})}),e.jsx(O,{isOpen:n,onClose:()=>d(!1),onCreated:k}),e.jsx(P,{isOpen:!!l,onClose:()=>b(null),onConfirm:N,tokenLabel:(l==null?void 0:l.label)??"",isLoading:h!==null})]})}export{V as default};
@@ -1 +1 @@
1
- import{a as d,e as l,d as c,K as p,r as b,j as e,w as x,O as v}from"./index-DJxZmj6O.js";import{U as f}from"./users-BsM5ZXj8.js";import{B as u}from"./bot-KMbKzBkt.js";import{S as g}from"./scroll-text-CP6Z7Xff.js";import{S as h}from"./settings-Ac7uhvR0.js";function S(){const{t:a}=d(),t=l(),o=c(),r=[{to:"/admin/developers",label:a("admin.tab_developers"),icon:f},{to:"/admin/bots",label:a("admin.tab_bots"),icon:u},{to:"/admin/tokens",label:a("admin.tab_tokens"),icon:p},{to:"/admin/audit-logs",label:a("admin.tab_audit_logs"),icon:g},{to:"/admin/settings",label:a("admin.tab_settings"),icon:h}];return b.useEffect(()=>{(t.pathname==="/admin"||t.pathname==="/admin/")&&o("/admin/developers",{replace:!0})},[t.pathname,o]),e.jsxs("div",{children:[e.jsx("div",{className:"mb-6 flex flex-nowrap gap-2 overflow-x-auto border-b border-[var(--border)] no-scrollbar",children:r.map(({to:s,label:n,icon:i})=>e.jsxs(x,{to:s,className:({isActive:m})=>`flex shrink-0 items-center gap-2 border-b-2 px-4 py-2 text-sm transition-colors ${m?"border-[var(--accent)] text-[var(--accent)]":"border-transparent text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:[e.jsx(i,{size:16}),n]},s))}),e.jsx(v,{})]})}export{S as default};
1
+ import{a as d,e as l,d as c,K as p,r as b,j as e,w as x,O as v}from"./index-CDBuOPx4.js";import{U as f}from"./users-LNQqKSEN.js";import{B as u}from"./bot-DYvBcsZn.js";import{S as g}from"./scroll-text-CV3wlIy2.js";import{S as h}from"./settings-Ccijf48b.js";function S(){const{t:a}=d(),t=l(),o=c(),r=[{to:"/admin/developers",label:a("admin.tab_developers"),icon:f},{to:"/admin/bots",label:a("admin.tab_bots"),icon:u},{to:"/admin/tokens",label:a("admin.tab_tokens"),icon:p},{to:"/admin/audit-logs",label:a("admin.tab_audit_logs"),icon:g},{to:"/admin/settings",label:a("admin.tab_settings"),icon:h}];return b.useEffect(()=>{(t.pathname==="/admin"||t.pathname==="/admin/")&&o("/admin/developers",{replace:!0})},[t.pathname,o]),e.jsxs("div",{children:[e.jsx("div",{className:"mb-6 flex flex-nowrap gap-2 overflow-x-auto border-b border-[var(--border)] no-scrollbar",children:r.map(({to:s,label:n,icon:i})=>e.jsxs(x,{to:s,className:({isActive:m})=>`flex shrink-0 items-center gap-2 border-b-2 px-4 py-2 text-sm transition-colors ${m?"border-[var(--accent)] text-[var(--accent)]":"border-transparent text-[var(--text-secondary)] hover:text-[var(--text-primary)]"}`,children:[e.jsx(i,{size:16}),n]},s))}),e.jsx(v,{})]})}export{S as default};
@@ -1 +1 @@
1
- import{d,a as n,h as p,r as o,j as t}from"./index-DJxZmj6O.js";import{Q as c}from"./QuickAuth-vbGZYKLu.js";import{P as h}from"./plus-Ry_MQV9O.js";import"./copy-Dd1cNNWz.js";const l={GET:"text-green-400",POST:"text-blue-400",PUT:"text-yellow-400",DELETE:"text-red-400"},m=[{title:"authentication",prefix:"/api/auth",endpoints:[{method:"POST",path:"/login",description:"authenticate with username + password (optional totpCode)",auth:"none",body:'{ "username": "string", "password": "string", "totpCode?": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/refresh",description:"refresh access token (rotates refresh token)",auth:"none",body:'{ "refreshToken": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/logout",description:"invalidate refresh token",auth:"jwt",body:'{ "refreshToken": "string" }'}]},{title:"tasks",prefix:"/api/web/tasks",endpoints:[{method:"GET",path:"",description:"list tasks with optional filters",auth:"jwt",response:'[ { "id": 1, "description": "...", "status": "RUNNING", ... } ]'},{method:"POST",path:"",description:"create a new task",auth:"jwt",body:'{ "projectKey": "string", "description": "string", "machineId?": "string" }'},{method:"GET",path:"/:id",description:"get task details",auth:"jwt"},{method:"POST",path:"/:id/cancel",description:"cancel a running task",auth:"jwt"},{method:"POST",path:"/:id/retry",description:"retry a failed task",auth:"jwt"},{method:"POST",path:"/:id/confirm-stage",description:"confirm/choose/input for suspended stage",auth:"jwt",body:'{ "stageIndex": "number", "result": "string" }'},{method:"POST",path:"/:id/pty-token",description:"get pty websocket token",auth:"jwt"}]},{title:"machines",prefix:"/api/web/machines",endpoints:[{method:"GET",path:"",description:"list all machines",auth:"jwt"},{method:"GET",path:"/:id",description:"get machine details",auth:"jwt"},{method:"GET",path:"/:id/tasks",description:"list tasks assigned to a machine",auth:"jwt"},{method:"POST",path:"/:id/drain",description:"start draining a machine",auth:"jwt"},{method:"POST",path:"/:id/undrain",description:"cancel machine drain",auth:"jwt"}]},{title:"projects",prefix:"/api/web/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"GET",path:"/:key",description:"get project details",auth:"jwt"}]},{title:"profile",prefix:"/api/web/profile",endpoints:[{method:"GET",path:"",description:"get current user profile",auth:"jwt"},{method:"PUT",path:"",description:"update profile (gitName, gitEmail)",auth:"jwt",body:'{ "gitName?": "string", "gitEmail?": "string" }'},{method:"PUT",path:"/password",description:"change password",auth:"jwt",body:'{ "currentPassword": "string", "newPassword": "string" }'},{method:"POST",path:"/totp/setup",description:"initialize totp setup",auth:"jwt"},{method:"POST",path:"/totp/verify",description:"verify totp setup code",auth:"jwt",body:'{ "code": "string" }'},{method:"GET",path:"/tokens",description:"list personal access tokens",auth:"jwt"},{method:"POST",path:"/tokens",description:"create a personal access token",auth:"jwt",body:'{ "label": "string", "expiresAt?": "string" }'},{method:"POST",path:"/tokens/:id/revoke",description:"revoke a token",auth:"jwt"}]},{title:"workspaces & tunnels",prefix:"/api/web",endpoints:[{method:"GET",path:"/workspaces/:taskId",description:"get workspace for a task",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/start",description:"start a cursor remote tunnel",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/stop",description:"stop a running tunnel",auth:"jwt"},{method:"GET",path:"/workspace-tunnel/:taskId/status",description:"get tunnel status",auth:"jwt"}]},{title:"dashboard",prefix:"/api/web/dashboard",endpoints:[{method:"GET",path:"/stats",description:"get dashboard statistics",auth:"jwt"},{method:"GET",path:"/recent-tasks",description:"get recent tasks for dashboard",auth:"jwt"},{method:"GET",path:"/recent-activity",description:"get recent activity feed",auth:"jwt"}]},{title:"notifications",prefix:"/api/web/notifications",endpoints:[{method:"GET",path:"",description:"list notifications with cursor pagination",auth:"jwt"},{method:"POST",path:"/:id/read",description:"mark a notification as read",auth:"jwt"},{method:"POST",path:"/read-all",description:"mark all notifications as read",auth:"jwt"}]},{title:"search",prefix:"/api/web",endpoints:[{method:"GET",path:"/search?q=query",description:"global search across tasks, machines, projects",auth:"jwt"}]},{title:"admin — developers",prefix:"/api/admin/developers",endpoints:[{method:"GET",path:"",description:"list all developers",auth:"jwt"},{method:"POST",path:"",description:"create a developer",auth:"jwt",body:'{ "name": "string", "password": "string", "role": "string", "gitName": "string", "gitEmail": "string" }'},{method:"PUT",path:"/:id",description:"update developer",auth:"jwt"},{method:"PUT",path:"/:id/reset-totp",description:"reset developer totp",auth:"jwt"}]},{title:"admin — projects",prefix:"/api/admin/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"POST",path:"",description:"create a project",auth:"jwt"},{method:"PUT",path:"/:key",description:"update project (including pipeline)",auth:"jwt"},{method:"DELETE",path:"/:key",description:"delete a project",auth:"jwt"},{method:"GET",path:"/:key/members",description:"get project members",auth:"jwt"},{method:"POST",path:"/:key/members",description:"add project member",auth:"jwt"},{method:"DELETE",path:"/:key/members?developerId=N",description:"remove project member",auth:"jwt"}]},{title:"admin — worker tokens",prefix:"/api/admin/worker-tokens",endpoints:[{method:"GET",path:"",description:"list all worker enrollment tokens",auth:"jwt"},{method:"POST",path:"",description:"generate a new worker token",auth:"jwt"},{method:"POST",path:"/:id/revoke",description:"revoke a worker token",auth:"jwt"},{method:"GET",path:"/:id/status",description:"get token status and linked machine",auth:"jwt"}]},{title:"admin — machines",prefix:"/api/admin/machines",endpoints:[{method:"GET",path:"",description:"list all machines (admin)",auth:"jwt"},{method:"PUT",path:"/:id",description:"update machine status",auth:"jwt",body:'{ "status?": "string" }'}]},{title:"admin — bots",prefix:"/api/admin/bots",endpoints:[{method:"GET",path:"",description:"list bot instances",auth:"jwt"},{method:"POST",path:"",description:"create a bot instance",auth:"jwt"},{method:"GET",path:"/:id/bindings",description:"get chat bindings for a bot",auth:"jwt"},{method:"POST",path:"/:id/bindings",description:"create a chat binding",auth:"jwt"},{method:"DELETE",path:"/:id/bindings",description:"delete a chat binding",auth:"jwt"}]},{title:"admin — audit & settings",prefix:"/api/admin",endpoints:[{method:"GET",path:"/audit-logs",description:"query audit log with filters",auth:"jwt"},{method:"GET",path:"/settings",description:"get all system settings",auth:"jwt"},{method:"PUT",path:"/settings",description:"update system settings",auth:"jwt"}]},{title:"websocket",prefix:"",endpoints:[{method:"GET",path:"WS /ws/pty/:taskId",description:'pty terminal websocket — first obtain a channel token via POST /api/web/tasks/:taskId/pty-token, then send an auth frame after connection: { type: "auth", token: "<jwt>", channelToken: "<channel-token>" }',auth:"jwt"},{method:"GET",path:"WS /api/workers/pty/:taskId",description:'worker pty websocket — auth via frame: { type: "auth", workerJwt: "<worker-jwt>", channelToken: "<channel-token>" }',auth:"worker-token"}]}];function x({ep:e,prefix:s}){const[a,i]=o.useState(!1),{t:r}=n();return t.jsxs("div",{className:"border-b border-[var(--border-row)] last:border-b-0",children:[t.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-[var(--bg-input)]",onClick:()=>i(!a),children:[t.jsx("span",{className:`w-12 shrink-0 text-xs font-bold ${l[e.method]}`,children:e.method}),t.jsxs("code",{className:"flex-1 text-xs text-[var(--text-primary)] truncate",children:[s,e.path]}),t.jsxs("span",{className:"text-xs text-[var(--text-muted)] hidden sm:inline truncate max-w-[200px]",children:["// ",e.description]})]}),a&&t.jsxs("div",{className:"border-t border-[var(--border-row)] bg-[var(--bg-primary)] px-4 py-3 space-y-2",children:[t.jsxs("p",{className:"text-xs text-[var(--text-secondary)]",children:["// ",e.description]}),t.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[t.jsx("span",{className:"text-[var(--text-muted)]",children:"auth:"}),t.jsx("span",{className:e.auth==="none"?"text-[var(--text-muted)]":"text-[var(--accent)]",children:e.auth})]}),e.body&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:r("docs.request_body")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.body})]}),e.response&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:r("docs.response")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.response})]})]})]})}function g(){const e=d(),{t:s}=n();return p(o.useMemo(()=>t.jsxs("button",{onClick:()=>e("/access-tokens"),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[t.jsx(h,{className:"h-3.5 w-3.5"}),s("access_tokens.create_token")]}),[e,s])),t.jsxs("div",{className:"mx-auto max-w-4xl px-6 py-8 font-mono lowercase",children:[t.jsx("div",{className:"mb-8",children:t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("docs.api_base_url_desc",{url:"http://localhost:9000"})})}),t.jsx(c,{mode:"api"}),t.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("docs.authentication")}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"jwt"}),t.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:["obtained via /api/auth/login — pass as ",t.jsx("code",{children:"authorization: bearer <token>"})]})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"pat"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"personal access token — same header format, for cli/api usage"})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-yellow-400",children:"worker-token"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"enrollment token for worker registration — used during initial handshake"})]})]}),t.jsx("div",{className:"space-y-6",children:m.map(a=>t.jsxs("div",{children:[t.jsxs("h2",{className:"mb-2 text-sm text-[var(--accent)]",children:["> ",a.title]}),t.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:a.endpoints.map((i,r)=>t.jsx(x,{ep:i,prefix:a.prefix},`${i.method}-${i.path}-${r}`))})]},a.title))})]})}export{g as default};
1
+ import{d,a as n,h as p,r as o,j as t}from"./index-CDBuOPx4.js";import{Q as c}from"./QuickAuth-B9mvq7ht.js";import{P as h}from"./plus-d-PLzbVX.js";import"./copy-BGttVgA1.js";const l={GET:"text-green-400",POST:"text-blue-400",PUT:"text-yellow-400",DELETE:"text-red-400"},m=[{title:"authentication",prefix:"/api/auth",endpoints:[{method:"POST",path:"/login",description:"authenticate with username + password (optional totpCode)",auth:"none",body:'{ "username": "string", "password": "string", "totpCode?": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/refresh",description:"refresh access token (rotates refresh token)",auth:"none",body:'{ "refreshToken": "string" }',response:'{ "accessToken": "string", "refreshToken": "string" }'},{method:"POST",path:"/logout",description:"invalidate refresh token",auth:"jwt",body:'{ "refreshToken": "string" }'}]},{title:"tasks",prefix:"/api/web/tasks",endpoints:[{method:"GET",path:"",description:"list tasks with optional filters",auth:"jwt",response:'[ { "id": 1, "description": "...", "status": "RUNNING", ... } ]'},{method:"POST",path:"",description:"create a new task",auth:"jwt",body:'{ "projectKey": "string", "description": "string", "machineId?": "string" }'},{method:"GET",path:"/:id",description:"get task details",auth:"jwt"},{method:"POST",path:"/:id/cancel",description:"cancel a running task",auth:"jwt"},{method:"POST",path:"/:id/retry",description:"retry a failed task",auth:"jwt"},{method:"POST",path:"/:id/confirm-stage",description:"confirm/choose/input for suspended stage",auth:"jwt",body:'{ "stageIndex": "number", "result": "string" }'},{method:"POST",path:"/:id/pty-token",description:"get pty websocket token",auth:"jwt"}]},{title:"machines",prefix:"/api/web/machines",endpoints:[{method:"GET",path:"",description:"list all machines",auth:"jwt"},{method:"GET",path:"/:id",description:"get machine details",auth:"jwt"},{method:"GET",path:"/:id/tasks",description:"list tasks assigned to a machine",auth:"jwt"},{method:"POST",path:"/:id/drain",description:"start draining a machine",auth:"jwt"},{method:"POST",path:"/:id/undrain",description:"cancel machine drain",auth:"jwt"}]},{title:"projects",prefix:"/api/web/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"GET",path:"/:key",description:"get project details",auth:"jwt"}]},{title:"profile",prefix:"/api/web/profile",endpoints:[{method:"GET",path:"",description:"get current user profile",auth:"jwt"},{method:"PUT",path:"",description:"update profile (gitName, gitEmail)",auth:"jwt",body:'{ "gitName?": "string", "gitEmail?": "string" }'},{method:"PUT",path:"/password",description:"change password",auth:"jwt",body:'{ "currentPassword": "string", "newPassword": "string" }'},{method:"POST",path:"/totp/setup",description:"initialize totp setup",auth:"jwt"},{method:"POST",path:"/totp/verify",description:"verify totp setup code",auth:"jwt",body:'{ "code": "string" }'},{method:"GET",path:"/tokens",description:"list personal access tokens",auth:"jwt"},{method:"POST",path:"/tokens",description:"create a personal access token",auth:"jwt",body:'{ "label": "string", "expiresAt?": "string" }'},{method:"POST",path:"/tokens/:id/revoke",description:"revoke a token",auth:"jwt"}]},{title:"workspaces & tunnels",prefix:"/api/web",endpoints:[{method:"GET",path:"/workspaces/:taskId",description:"get workspace for a task",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/start",description:"start a cursor remote tunnel",auth:"jwt"},{method:"POST",path:"/workspace-tunnel/:taskId/stop",description:"stop a running tunnel",auth:"jwt"},{method:"GET",path:"/workspace-tunnel/:taskId/status",description:"get tunnel status",auth:"jwt"}]},{title:"dashboard",prefix:"/api/web/dashboard",endpoints:[{method:"GET",path:"/stats",description:"get dashboard statistics",auth:"jwt"},{method:"GET",path:"/recent-tasks",description:"get recent tasks for dashboard",auth:"jwt"},{method:"GET",path:"/recent-activity",description:"get recent activity feed",auth:"jwt"}]},{title:"notifications",prefix:"/api/web/notifications",endpoints:[{method:"GET",path:"",description:"list notifications with cursor pagination",auth:"jwt"},{method:"POST",path:"/:id/read",description:"mark a notification as read",auth:"jwt"},{method:"POST",path:"/read-all",description:"mark all notifications as read",auth:"jwt"}]},{title:"search",prefix:"/api/web",endpoints:[{method:"GET",path:"/search?q=query",description:"global search across tasks, machines, projects",auth:"jwt"}]},{title:"admin — developers",prefix:"/api/admin/developers",endpoints:[{method:"GET",path:"",description:"list all developers",auth:"jwt"},{method:"POST",path:"",description:"create a developer",auth:"jwt",body:'{ "name": "string", "password": "string", "role": "string", "gitName": "string", "gitEmail": "string" }'},{method:"PUT",path:"/:id",description:"update developer",auth:"jwt"},{method:"PUT",path:"/:id/reset-totp",description:"reset developer totp",auth:"jwt"}]},{title:"admin — projects",prefix:"/api/admin/projects",endpoints:[{method:"GET",path:"",description:"list all projects",auth:"jwt"},{method:"POST",path:"",description:"create a project",auth:"jwt"},{method:"PUT",path:"/:key",description:"update project (including pipeline)",auth:"jwt"},{method:"DELETE",path:"/:key",description:"delete a project",auth:"jwt"},{method:"GET",path:"/:key/members",description:"get project members",auth:"jwt"},{method:"POST",path:"/:key/members",description:"add project member",auth:"jwt"},{method:"DELETE",path:"/:key/members?developerId=N",description:"remove project member",auth:"jwt"}]},{title:"admin — worker tokens",prefix:"/api/admin/worker-tokens",endpoints:[{method:"GET",path:"",description:"list all worker enrollment tokens",auth:"jwt"},{method:"POST",path:"",description:"generate a new worker token",auth:"jwt"},{method:"POST",path:"/:id/revoke",description:"revoke a worker token",auth:"jwt"},{method:"GET",path:"/:id/status",description:"get token status and linked machine",auth:"jwt"}]},{title:"admin — machines",prefix:"/api/admin/machines",endpoints:[{method:"GET",path:"",description:"list all machines (admin)",auth:"jwt"},{method:"PUT",path:"/:id",description:"update machine status",auth:"jwt",body:'{ "status?": "string" }'}]},{title:"admin — bots",prefix:"/api/admin/bots",endpoints:[{method:"GET",path:"",description:"list bot instances",auth:"jwt"},{method:"POST",path:"",description:"create a bot instance",auth:"jwt"},{method:"GET",path:"/:id/bindings",description:"get chat bindings for a bot",auth:"jwt"},{method:"POST",path:"/:id/bindings",description:"create a chat binding",auth:"jwt"},{method:"DELETE",path:"/:id/bindings",description:"delete a chat binding",auth:"jwt"}]},{title:"admin — audit & settings",prefix:"/api/admin",endpoints:[{method:"GET",path:"/audit-logs",description:"query audit log with filters",auth:"jwt"},{method:"GET",path:"/settings",description:"get all system settings",auth:"jwt"},{method:"PUT",path:"/settings",description:"update system settings",auth:"jwt"}]},{title:"websocket",prefix:"",endpoints:[{method:"GET",path:"WS /ws/pty/:taskId",description:'pty terminal websocket — first obtain a channel token via POST /api/web/tasks/:taskId/pty-token, then send an auth frame after connection: { type: "auth", token: "<jwt>", channelToken: "<channel-token>" }',auth:"jwt"},{method:"GET",path:"WS /api/workers/pty/:taskId",description:'worker pty websocket — auth via frame: { type: "auth", workerJwt: "<worker-jwt>", channelToken: "<channel-token>" }',auth:"worker-token"}]}];function x({ep:e,prefix:s}){const[a,i]=o.useState(!1),{t:r}=n();return t.jsxs("div",{className:"border-b border-[var(--border-row)] last:border-b-0",children:[t.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors hover:bg-[var(--bg-input)]",onClick:()=>i(!a),children:[t.jsx("span",{className:`w-12 shrink-0 text-xs font-bold ${l[e.method]}`,children:e.method}),t.jsxs("code",{className:"flex-1 text-xs text-[var(--text-primary)] truncate",children:[s,e.path]}),t.jsxs("span",{className:"text-xs text-[var(--text-muted)] hidden sm:inline truncate max-w-[200px]",children:["// ",e.description]})]}),a&&t.jsxs("div",{className:"border-t border-[var(--border-row)] bg-[var(--bg-primary)] px-4 py-3 space-y-2",children:[t.jsxs("p",{className:"text-xs text-[var(--text-secondary)]",children:["// ",e.description]}),t.jsxs("div",{className:"flex items-center gap-2 text-[10px]",children:[t.jsx("span",{className:"text-[var(--text-muted)]",children:"auth:"}),t.jsx("span",{className:e.auth==="none"?"text-[var(--text-muted)]":"text-[var(--accent)]",children:e.auth})]}),e.body&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:r("docs.request_body")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.body})]}),e.response&&t.jsxs("div",{children:[t.jsx("p",{className:"text-[10px] uppercase tracking-wider text-[var(--text-muted)] mb-1",children:r("docs.response")}),t.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-card)] px-3 py-2 text-xs text-[var(--text-secondary)] overflow-x-auto",children:e.response})]})]})]})}function g(){const e=d(),{t:s}=n();return p(o.useMemo(()=>t.jsxs("button",{onClick:()=>e("/access-tokens"),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-mono text-black transition-opacity hover:opacity-90",children:[t.jsx(h,{className:"h-3.5 w-3.5"}),s("access_tokens.create_token")]}),[e,s])),t.jsxs("div",{className:"mx-auto max-w-4xl px-6 py-8 font-mono lowercase",children:[t.jsx("div",{className:"mb-8",children:t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("docs.api_base_url_desc",{url:"http://localhost:9000"})})}),t.jsx(c,{mode:"api"}),t.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4 space-y-2",children:[t.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("docs.authentication")}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"jwt"}),t.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:["obtained via /api/auth/login — pass as ",t.jsx("code",{children:"authorization: bearer <token>"})]})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-[var(--accent)]",children:"pat"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"personal access token — same header format, for cli/api usage"})]}),t.jsxs("div",{className:"flex items-start gap-3",children:[t.jsx("code",{className:"shrink-0 text-xs text-yellow-400",children:"worker-token"}),t.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:"enrollment token for worker registration — used during initial handshake"})]})]}),t.jsx("div",{className:"space-y-6",children:m.map(a=>t.jsxs("div",{children:[t.jsxs("h2",{className:"mb-2 text-sm text-[var(--accent)]",children:["> ",a.title]}),t.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:a.endpoints.map((i,r)=>t.jsx(x,{ep:i,prefix:a.prefix},`${i.method}-${i.path}-${r}`))})]},a.title))})]})}export{g as default};
@@ -1,4 +1,4 @@
1
- import{c as C,a as S,r,f as k,j as e,i as L}from"./index-DJxZmj6O.js";import{S as E}from"./Select-CmUwVfWJ.js";import{E as T}from"./EmptyState-BOXPalWI.js";import{T as F}from"./Skeleton-0JE10nwo.js";import{S as A}from"./scroll-text-CP6Z7Xff.js";import{C as P}from"./chevron-right-CVPdQ-cP.js";/**
1
+ import{c as C,a as S,r,f as k,j as e,i as L}from"./index-CDBuOPx4.js";import{S as E}from"./Select-A7PXobk_.js";import{E as T}from"./EmptyState-CvmhFgWJ.js";import{T as F}from"./Skeleton-CcVqz28_.js";import{S as A}from"./scroll-text-CV3wlIy2.js";import{C as P}from"./chevron-right-COxU2yxz.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as M,a as B,r as a,j as e,X as I,f as _,l as z,t as K}from"./index-DJxZmj6O.js";import{S as P}from"./Select-CmUwVfWJ.js";import{T as $}from"./trash-2-DWv3OoER.js";import{P as D}from"./plus-Ry_MQV9O.js";import{E as q}from"./EmptyState-BOXPalWI.js";import{T}from"./Skeleton-0JE10nwo.js";import{B as F}from"./bot-KMbKzBkt.js";import{P as O}from"./pencil-Srq1Z7Yh.js";/**
1
+ import{c as M,a as B,r as a,j as e,X as I,f as _,l as z,t as K}from"./index-CDBuOPx4.js";import{S as P}from"./Select-A7PXobk_.js";import{T as $}from"./trash-2-bRJ-xwtq.js";import{P as D}from"./plus-d-PLzbVX.js";import{E as q}from"./EmptyState-CvmhFgWJ.js";import{T}from"./Skeleton-CcVqz28_.js";import{B as F}from"./bot-DYvBcsZn.js";import{P as O}from"./pencil-Bs3PwH2W.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{d as l,a as c,h as p,r as d,j as e,C as m}from"./index-DJxZmj6O.js";import{Q as x}from"./QuickAuth-vbGZYKLu.js";import{P as u}from"./plus-Ry_MQV9O.js";import{C as v}from"./copy-Dd1cNNWz.js";const g=[{command:"ov setup",description:"quick setup — configure server connection and authenticate in one step",usage:"ov setup [--server <url>] [--token <token>]",flags:[{flag:"--server <url>",desc:"overlord server url"},{flag:"--token <token>",desc:"personal access token (skips prompt)"}],example:`ov setup
1
+ import{d as l,a as c,h as p,r as d,j as e,C as m}from"./index-CDBuOPx4.js";import{Q as x}from"./QuickAuth-B9mvq7ht.js";import{P as u}from"./plus-d-PLzbVX.js";import{C as v}from"./copy-BGttVgA1.js";const g=[{command:"ov setup",description:"quick setup — configure server connection and authenticate in one step",usage:"ov setup [--server <url>] [--token <token>]",flags:[{flag:"--server <url>",desc:"overlord server url"},{flag:"--token <token>",desc:"personal access token (skips prompt)"}],example:`ov setup
2
2
  > Overlord server URL: http://localhost:9000
3
3
  > Personal Access Token: ov_pat_xxxxx
4
4
  ✓ Connected to http://localhost:9000
@@ -1,4 +1,4 @@
1
- import{c as k,a as _,r as s,j as e,X as S,f as w,u as E,i as M}from"./index-DJxZmj6O.js";import{S as D}from"./Select-CmUwVfWJ.js";import{E as O}from"./EmptyState-BOXPalWI.js";import{T}from"./Skeleton-0JE10nwo.js";import{P}from"./plus-Ry_MQV9O.js";import{U as q}from"./users-BsM5ZXj8.js";import{P as $}from"./pencil-Srq1Z7Yh.js";import{R as F}from"./rotate-ccw-B1ZO6xeO.js";/**
1
+ import{c as k,a as _,r as s,j as e,X as S,f as w,u as E,i as M}from"./index-CDBuOPx4.js";import{S as D}from"./Select-A7PXobk_.js";import{E as O}from"./EmptyState-CvmhFgWJ.js";import{T}from"./Skeleton-CcVqz28_.js";import{P}from"./plus-d-PLzbVX.js";import{U as q}from"./users-LNQqKSEN.js";import{P as $}from"./pencil-Bs3PwH2W.js";import{R as F}from"./rotate-ccw-Cus8CABi.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,2 +1,2 @@
1
- import{m as le,d as ce,a as de,r as a,f as u,j as e,L as ie,t as N}from"./index-DJxZmj6O.js";import{G as m,A as d}from"./protocol-C5uQmiiB.js";import{S as Q}from"./Select-CmUwVfWJ.js";import{U as pe,A as xe,R as ue}from"./RemoveMemberConfirmDialog-I3k9sPON.js";import{P as me}from"./plus-Ry_MQV9O.js";function fe(){const{key:o}=le(),l=ce(),{t:r}=de(),[n,V]=a.useState(null),[b,Y]=a.useState([]),[Z,ee]=a.useState(!0),[C,v]=a.useState(!1),[j,w]=a.useState(""),[h,_]=a.useState(""),[S,k]=a.useState(""),[M,T]=a.useState(m.GITHUB),[U,O]=a.useState(""),[P,I]=a.useState(d.CLAUDE),[R,A]=a.useState(""),[D,$]=a.useState("50"),[E,G]=a.useState(""),[L,B]=a.useState(""),[F,J]=a.useState(""),[q,z]=a.useState("0"),[g,H]=a.useState(!1),[i,f]=a.useState(""),[te,K]=a.useState(!1),[c,y]=a.useState(null),[re,W]=a.useState(!1),p=a.useCallback(async()=>{if(o)try{const[t,x]=await Promise.all([u.get(`web/projects/${o}`).json(),u.get(`web/projects/${o}/members`).json().catch(()=>[])]);if(V(t),Y(x),w(t.name),_(t.repoUrl),k(t.sshUrl??""),T(t.gitPlatform),O(t.defaultBranch),I(t.agentType),A(t.agentCommand??""),$(String(t.maxTurns)),G(t.workspaceRoot??""),B(t.setupCommands??""),J(t.testCommand??""),z(String(t.ptyOutputFilter??0)),H(t.isDefault),t.pipeline)try{f(JSON.stringify(JSON.parse(t.pipeline),null,2))}catch{f(t.pipeline)}}catch{}finally{ee(!1)}},[o]);a.useEffect(()=>{p()},[p]);async function ae(t){if(t.preventDefault(),!n)return;v(!0);let x=null;if(i.trim())try{JSON.parse(i),x=i.trim()}catch{N.error(r("projects.invalid_pipeline_json")),v(!1);return}try{await u.put(`web/projects/${n.key}`,{json:{name:j,repoUrl:h,sshUrl:S||null,defaultBranch:U,gitPlatform:M,agentType:P,agentCommand:R||null,maxTurns:parseInt(D,10)||50,workspaceRoot:E||null,setupCommands:L||null,testCommand:F||null,ptyOutputFilter:parseInt(q,10)||0,pipeline:x}}),N.success(r("projects.project_saved")),l(`/projects/${n.key}`)}catch(X){const oe=X instanceof Error?X.message:r("projects.failed_to_save_project");N.error(oe)}finally{v(!1)}}function se(){l(`/projects/${o}`)}async function ne(){if(!(!n||!c)){W(!0);try{await u.delete(`web/projects/${n.key}/members`,{searchParams:{developerId:String(c.developerId)}}),await p()}catch{}finally{W(!1),y(null)}}}return Z?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-[var(--border)] border-t-[var(--accent)]"})}):n?e.jsxs("form",{onSubmit:ae,className:"mx-auto max-w-6xl px-6 py-8",children:[e.jsxs("div",{className:"mb-2 text-xs text-[var(--text-muted)]",children:[e.jsx("span",{className:"cursor-pointer hover:text-[var(--text-secondary)]",onClick:()=>l("/projects"),children:r("projects.title")})," / ",e.jsx("span",{className:"cursor-pointer hover:text-[var(--text-secondary)]",onClick:()=>l(`/projects/${n.key}`),children:n.key})," / ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:r("common.edit")})]}),e.jsx("h1",{className:"text-lg font-bold text-[var(--text-primary)] mb-4",children:r("projects.edit_project_title")}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[1fr_400px]",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.basic_info")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(s,{label:r("projects.key"),children:e.jsx("input",{type:"text",value:n.key,readOnly:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-muted)] outline-none opacity-60 cursor-not-allowed"})}),e.jsx(s,{label:r("projects.name"),children:e.jsx("input",{type:"text",value:j,onChange:t=>w(t.target.value),required:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(s,{label:r("projects.repo_url"),children:e.jsx("input",{type:"text",value:h,onChange:t=>_(t.target.value),required:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsxs(s,{label:r("projects.ssh_url"),children:[e.jsx("input",{type:"text",value:S,onChange:t=>k(t.target.value),placeholder:r("projects.ssh_url_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:r("projects.ssh_url_hint")})]}),e.jsx(s,{label:r("projects.git_platform"),children:e.jsx(Q,{value:M,onChange:t=>T(t),options:[{value:m.GITHUB,label:r("projects.github")},{value:m.GITLAB,label:r("projects.gitlab")},{value:m.GITEA,label:r("projects.gitea")}]})}),e.jsx(s,{label:r("projects.default_branch"),children:e.jsx("input",{type:"text",value:U,onChange:t=>O(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.agent_config")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(s,{label:r("projects.agent_type"),children:e.jsx(Q,{value:P,onChange:t=>I(t),options:[{value:d.CLAUDE,label:r("projects.claude")},{value:d.CURSOR,label:r("projects.cursor")},{value:d.CODEX,label:r("projects.codex")},{value:d.CUSTOM,label:r("projects.custom")}]})}),e.jsx(s,{label:r("projects.agent_command"),children:e.jsx("input",{type:"text",value:R,onChange:t=>A(t.target.value),placeholder:"custom agent command",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(s,{label:r("projects.max_turns"),children:e.jsx("input",{type:"number",value:D,onChange:t=>$(t.target.value),min:1,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(s,{label:r("projects.workspace_root"),children:e.jsx("input",{type:"text",value:E,onChange:t=>G(t.target.value),placeholder:"/path/to/workspace",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.environment")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(s,{label:r("projects.setup_commands"),children:e.jsx("textarea",{value:L,onChange:t=>B(t.target.value),rows:3,placeholder:`npm install
1
+ import{m as le,d as ce,a as de,r as a,f as u,j as e,L as ie,t as N}from"./index-CDBuOPx4.js";import{G as m,A as d}from"./protocol-C5uQmiiB.js";import{S as Q}from"./Select-A7PXobk_.js";import{U as pe,A as xe,R as ue}from"./RemoveMemberConfirmDialog-DS9z6jQT.js";import{P as me}from"./plus-d-PLzbVX.js";function fe(){const{key:o}=le(),l=ce(),{t:r}=de(),[n,V]=a.useState(null),[b,Y]=a.useState([]),[Z,ee]=a.useState(!0),[C,v]=a.useState(!1),[j,w]=a.useState(""),[h,_]=a.useState(""),[S,k]=a.useState(""),[M,T]=a.useState(m.GITHUB),[U,O]=a.useState(""),[P,I]=a.useState(d.CLAUDE),[R,A]=a.useState(""),[D,$]=a.useState("50"),[E,G]=a.useState(""),[L,B]=a.useState(""),[F,J]=a.useState(""),[q,z]=a.useState("0"),[g,H]=a.useState(!1),[i,f]=a.useState(""),[te,K]=a.useState(!1),[c,y]=a.useState(null),[re,W]=a.useState(!1),p=a.useCallback(async()=>{if(o)try{const[t,x]=await Promise.all([u.get(`web/projects/${o}`).json(),u.get(`web/projects/${o}/members`).json().catch(()=>[])]);if(V(t),Y(x),w(t.name),_(t.repoUrl),k(t.sshUrl??""),T(t.gitPlatform),O(t.defaultBranch),I(t.agentType),A(t.agentCommand??""),$(String(t.maxTurns)),G(t.workspaceRoot??""),B(t.setupCommands??""),J(t.testCommand??""),z(String(t.ptyOutputFilter??0)),H(t.isDefault),t.pipeline)try{f(JSON.stringify(JSON.parse(t.pipeline),null,2))}catch{f(t.pipeline)}}catch{}finally{ee(!1)}},[o]);a.useEffect(()=>{p()},[p]);async function ae(t){if(t.preventDefault(),!n)return;v(!0);let x=null;if(i.trim())try{JSON.parse(i),x=i.trim()}catch{N.error(r("projects.invalid_pipeline_json")),v(!1);return}try{await u.put(`web/projects/${n.key}`,{json:{name:j,repoUrl:h,sshUrl:S||null,defaultBranch:U,gitPlatform:M,agentType:P,agentCommand:R||null,maxTurns:parseInt(D,10)||50,workspaceRoot:E||null,setupCommands:L||null,testCommand:F||null,ptyOutputFilter:parseInt(q,10)||0,pipeline:x}}),N.success(r("projects.project_saved")),l(`/projects/${n.key}`)}catch(X){const oe=X instanceof Error?X.message:r("projects.failed_to_save_project");N.error(oe)}finally{v(!1)}}function se(){l(`/projects/${o}`)}async function ne(){if(!(!n||!c)){W(!0);try{await u.delete(`web/projects/${n.key}/members`,{searchParams:{developerId:String(c.developerId)}}),await p()}catch{}finally{W(!1),y(null)}}}return Z?e.jsx("div",{className:"flex justify-center py-20",children:e.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-[var(--border)] border-t-[var(--accent)]"})}):n?e.jsxs("form",{onSubmit:ae,className:"mx-auto max-w-6xl px-6 py-8",children:[e.jsxs("div",{className:"mb-2 text-xs text-[var(--text-muted)]",children:[e.jsx("span",{className:"cursor-pointer hover:text-[var(--text-secondary)]",onClick:()=>l("/projects"),children:r("projects.title")})," / ",e.jsx("span",{className:"cursor-pointer hover:text-[var(--text-secondary)]",onClick:()=>l(`/projects/${n.key}`),children:n.key})," / ",e.jsx("span",{className:"text-[var(--text-secondary)]",children:r("common.edit")})]}),e.jsx("h1",{className:"text-lg font-bold text-[var(--text-primary)] mb-4",children:r("projects.edit_project_title")}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-[1fr_400px]",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.basic_info")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(s,{label:r("projects.key"),children:e.jsx("input",{type:"text",value:n.key,readOnly:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-muted)] outline-none opacity-60 cursor-not-allowed"})}),e.jsx(s,{label:r("projects.name"),children:e.jsx("input",{type:"text",value:j,onChange:t=>w(t.target.value),required:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(s,{label:r("projects.repo_url"),children:e.jsx("input",{type:"text",value:h,onChange:t=>_(t.target.value),required:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsxs(s,{label:r("projects.ssh_url"),children:[e.jsx("input",{type:"text",value:S,onChange:t=>k(t.target.value),placeholder:r("projects.ssh_url_placeholder"),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:r("projects.ssh_url_hint")})]}),e.jsx(s,{label:r("projects.git_platform"),children:e.jsx(Q,{value:M,onChange:t=>T(t),options:[{value:m.GITHUB,label:r("projects.github")},{value:m.GITLAB,label:r("projects.gitlab")},{value:m.GITEA,label:r("projects.gitea")}]})}),e.jsx(s,{label:r("projects.default_branch"),children:e.jsx("input",{type:"text",value:U,onChange:t=>O(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.agent_config")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(s,{label:r("projects.agent_type"),children:e.jsx(Q,{value:P,onChange:t=>I(t),options:[{value:d.CLAUDE,label:r("projects.claude")},{value:d.CURSOR,label:r("projects.cursor")},{value:d.CODEX,label:r("projects.codex")},{value:d.CUSTOM,label:r("projects.custom")}]})}),e.jsx(s,{label:r("projects.agent_command"),children:e.jsx("input",{type:"text",value:R,onChange:t=>A(t.target.value),placeholder:"custom agent command",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(s,{label:r("projects.max_turns"),children:e.jsx("input",{type:"number",value:D,onChange:t=>$(t.target.value),min:1,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(s,{label:r("projects.workspace_root"),children:e.jsx("input",{type:"text",value:E,onChange:t=>G(t.target.value),placeholder:"/path/to/workspace",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.environment")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(s,{label:r("projects.setup_commands"),children:e.jsx("textarea",{value:L,onChange:t=>B(t.target.value),rows:3,placeholder:`npm install
2
2
  npm run build`,className:"w-full resize-y rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(s,{label:r("projects.post_command"),children:e.jsx("input",{type:"text",value:F,onChange:t=>J(t.target.value),placeholder:"npm test",className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})})]})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("h2",{className:"mb-4 text-sm font-semibold text-[var(--accent)]",children:r("projects.security")}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(s,{label:r("projects.pty_output_filter"),children:e.jsx("input",{type:"text",value:q,onChange:t=>z(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]"})}),e.jsx(s,{label:r("projects.git_clean"),children:e.jsx("button",{type:"button",onClick:()=>H(!g),className:`relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full transition-colors ${g?"bg-[var(--accent)]":"bg-[var(--border)]"}`,children:e.jsx("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform ${g?"translate-x-6":"translate-x-1"}`})})})]})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--accent)]",children:r("projects.pipeline_section")}),e.jsx(ie,{to:"/projects/"+o+"/pipeline",className:"text-xs text-[var(--accent)] hover:underline",children:r("projects.edit_pipeline")})]}),e.jsx("textarea",{value:i,onChange:t=>f(t.target.value),rows:20,spellCheck:!1,placeholder:'{"stages": [], "defaults": {}}',className:"w-full resize-y rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] outline-none focus:border-[var(--accent)]",style:{fontFamily:'"JetBrains Mono", monospace',textTransform:"none"}})]}),e.jsxs("section",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsx("h2",{className:"text-sm font-semibold text-[var(--accent)]",children:r("projects.members")}),e.jsxs("button",{type:"button",onClick:()=>K(!0),className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs font-medium text-black",children:[e.jsx(me,{className:"h-3.5 w-3.5"}),r("projects.add_member")]})]}),b.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-6",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:r("projects.no_members_yet")})]}):e.jsx("div",{className:"space-y-2",children:b.map(t=>e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-[var(--accent)]/20 text-xs font-bold text-[var(--accent)]",children:(t.developerName??String(t.developerId)).charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:t.developerName??`#${t.developerId}`}),e.jsx("span",{className:"ml-2 rounded-[4px] px-1.5 py-0.5 text-[10px] font-medium",style:{color:t.role==="maintainer"?"var(--warning)":"var(--text-secondary)",background:t.role==="maintainer"?"rgba(245,158,11,0.1)":"rgba(163,163,163,0.1)"},children:t.role})]})]}),e.jsx("button",{type:"button",onClick:()=>y(t),className:"text-[var(--destructive)] hover:opacity-70 transition-opacity","aria-label":r("projects.remove_member"),children:e.jsx(pe,{className:"h-3.5 w-3.5"})})]},t.developerId))})]})]})]}),e.jsxs("div",{className:"mt-8 flex items-center justify-end gap-3 border-t border-[var(--border)] pt-6",children:[e.jsx("button",{type:"button",onClick:se,className:"rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:r("common.discard")}),e.jsx("button",{type:"submit",disabled:C||!j||!h,className:"rounded-[4px] bg-[var(--accent)] px-4 py-2 text-xs font-medium text-black hover:opacity-90 transition-opacity disabled:opacity-50",children:r(C?"common.saving":"projects.save_changes")})]}),e.jsx(xe,{isOpen:te,onClose:()=>K(!1),projectKey:n.key,existingMemberIds:b.map(t=>t.developerId),onAdded:p}),e.jsx(ue,{isOpen:!!c,onClose:()=>y(null),onConfirm:ne,memberName:c?c.developerName??`#${c.developerId}`:"",loading:re})]}):e.jsxs("div",{className:"mx-auto max-w-4xl px-6 py-8 text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:r("projects.project_not_found")}),e.jsx("button",{onClick:()=>l("/projects"),className:"mt-4 rounded-[4px] border border-[var(--border)] bg-transparent px-4 py-2 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)]",children:r("projects.back_to_projects")})]})}function s({label:o,children:l}){return e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("label",{className:"w-36 shrink-0 pt-2 text-xs text-[var(--text-muted)]",children:o}),e.jsx("div",{className:"flex-1",children:l})]})}export{fe as default};
@@ -1,4 +1,4 @@
1
- import{c as o,j as e}from"./index-DJxZmj6O.js";/**
1
+ import{c as o,j as e}from"./index-CDBuOPx4.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{u as I,r as n,j as e,X as z,C as X,L as N,d as Q,a as $,f as u}from"./index-DJxZmj6O.js";import{M as h}from"./protocol-C5uQmiiB.js";import{T}from"./TaskStatusBadge-C8TEMiVe.js";import{T as w}from"./Skeleton-0JE10nwo.js";import{C as U}from"./chevron-right-CVPdQ-cP.js";import{A as S}from"./arrow-right-B5aaHrGs.js";function W(){return[{id:"admin_create_project",title:"create your first project",description:"set up a project with a git repo and pipeline",link:"/projects",linkLabel:"go to projects",autoDetect:!0},{id:"admin_register_worker",title:"register a worker machine",description:"generate a token and set up a worker to run tasks",link:"/machines",linkLabel:"go to machines",autoDetect:!0},{id:"admin_create_developer",title:"create a developer account",description:"add team members who can create and monitor tasks",link:"/admin/developers",linkLabel:"manage developers",autoDetect:!0},{id:"admin_first_task",title:"create your first task",description:"verify the full pipeline works end-to-end",link:"/tasks",linkLabel:"go to tasks",autoDetect:!0}]}function Z(){return[{id:"lead_view_projects",title:"view your projects",description:"check the projects assigned to you",link:"/projects",linkLabel:"go to projects"},{id:"lead_configure_pipeline",title:"configure a pipeline",description:"set up stages for your project workflow",link:"/projects",linkLabel:"go to projects"},{id:"lead_add_member",title:"add a team member",description:"invite developers to your project",link:"/projects",linkLabel:"go to projects"},{id:"lead_first_task",title:"create your first task",description:"submit a task and watch it execute",link:"/tasks",linkLabel:"go to tasks"}]}function ee(){return[{id:"dev_install_cli",title:"install the ov cli",description:"npm install -g @overlordai/developer-cli",link:"/docs/cli",linkLabel:"cli"},{id:"dev_setup_cli",title:"run ov setup",description:"connect to the server and authenticate",link:"/docs/cli",linkLabel:"setup guide"},{id:"dev_view_projects",title:"explore projects",description:"browse available projects and their pipelines",link:"/projects",linkLabel:"go to projects"},{id:"dev_first_task",title:"create your first task",description:"submit a task via web or cli",link:"/tasks",linkLabel:"go to tasks",autoDetect:!0}]}const O="overlord_onboarding";function te(){try{const r=localStorage.getItem(O);if(r)return JSON.parse(r)}catch{}return{dismissed:!1,completed:{}}}function E(r){localStorage.setItem(O,JSON.stringify(r))}function se({data:r}){const s=I(i=>{var c;return(c=i.user)==null?void 0:c.role}),[o,a]=n.useState(te),d=s==="admin"?W():s==="lead"||s==="maintainer"?Z():ee(),l=n.useCallback(i=>{if(o.completed[i.id])return!0;if(!i.autoDetect)return!1;switch(i.id){case"admin_create_project":return r.totalProjects>0;case"admin_register_worker":return r.totalMachines>0;case"admin_create_developer":return r.totalDevelopers>1;case"admin_first_task":case"dev_first_task":return r.activeTasks>0;default:return!1}},[o.completed,r]),x=d.filter(l).length,p=x===d.length,k=n.useCallback(i=>{a(c=>{const f={...c,completed:{...c.completed,[i]:!c.completed[i]}};return E(f),f})},[]),v=n.useCallback(()=>{a(i=>{const c={...i,dismissed:!0};return E(c),c})},[]);if(o.dismissed)return null;const b=Math.round(x/d.length*100);return e.jsxs("div",{className:"mb-6 md:mb-8 rounded-[4px] border border-[var(--accent)]/30 bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:"// getting started"}),e.jsxs("span",{className:"text-[10px] text-[var(--text-muted)]",children:[x,"/",d.length," completed"]})]}),e.jsx("button",{onClick:v,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",title:"dismiss",children:e.jsx(z,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"h-0.5 bg-[var(--border)]",children:e.jsx("div",{className:"h-full bg-[var(--accent)] transition-all duration-500",style:{width:`${b}%`}})}),e.jsx("div",{className:"divide-y divide-[var(--border)]",children:d.map(i=>{const c=l(i);return e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 transition-colors hover:bg-[var(--bg-input)]",children:[e.jsx("button",{onClick:()=>!i.autoDetect&&k(i.id),className:`flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border transition-colors ${c?"border-[var(--accent)] bg-[var(--accent)]":"border-[var(--border)] hover:border-[var(--text-muted)]"} ${i.autoDetect?"cursor-default":"cursor-pointer"}`,children:c&&e.jsx(X,{className:"h-2.5 w-2.5 text-black"})}),e.jsxs("div",{className:"flex flex-1 items-center justify-between min-w-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:`text-xs ${c?"text-[var(--text-muted)] line-through":"text-[var(--text-primary)]"}`,children:i.title}),e.jsx("p",{className:"text-[10px] text-[var(--text-muted)] truncate",children:i.description})]}),i.link&&!c&&e.jsxs(N,{to:i.link,className:"ml-3 flex shrink-0 items-center gap-1 text-[10px] text-[var(--accent)] hover:underline",children:[i.linkLabel," ",e.jsx(U,{className:"h-3 w-3"})]})]})]},i.id)})}),p&&e.jsxs("div",{className:"border-t border-[var(--border)] px-4 py-3 text-center",children:[e.jsx("span",{className:"text-xs text-[var(--accent)]",children:"all set! you're ready to go."}),e.jsx("button",{onClick:v,className:"ml-3 text-[10px] text-[var(--text-muted)] underline hover:text-[var(--text-primary)]",children:"dismiss"})]})]})}const ae=3e4,re=[{key:"active_tasks",labelKey:"dashboard.active_tasks"},{key:"queued_tasks",labelKey:"dashboard.queued_tasks"},{key:"online_workers",labelKey:"dashboard.online_workers"},{key:"completed_today",labelKey:"dashboard.completed_today"}],ie=["mon","tue","wed","thu","fri","sat","sun"];function L(r){if(!r)return"-";const s=new Date(r).getTime();if(Number.isNaN(s))return"-";const o=Date.now()-s,a=Math.floor(o/6e4);if(a<1)return"just now";if(a<60)return`${a}m ago`;const d=Math.floor(a/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}function ne(r,s){return r.length<=s?r:r.slice(0,s)+"..."}function le({dailyRates:r,overallRate:s}){const{t:o}=$(),a=ie.map((l,x)=>({label:l,value:r[x]??0})),d=Math.max(...a.map(l=>l.value),1);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-2xl font-bold text-[var(--text-primary)]",children:[s,"%"]}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:o("dashboard.last_7_days")})]}),e.jsx("div",{className:"flex gap-2",style:{height:80},children:a.map(l=>{const x=d>0?Math.max(l.value/d*100,4):4;return e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1",children:[e.jsx("div",{className:"relative w-full h-full rounded-[4px]",style:{backgroundColor:"rgba(34,197,94,0.1)"},children:e.jsx("div",{className:"absolute bottom-0 left-0 right-0 rounded-[4px]",style:{height:`${x}%`,backgroundColor:l.value>=80?"var(--accent)":l.value>=50?"var(--warning)":"var(--destructive)"}})}),e.jsx("span",{className:"shrink-0 text-[10px] text-[var(--text-muted)]",children:l.label})]},l.label)})})]})}function he(){const r=Q(),{t:s}=$(),o=I(t=>{var m;return((m=t.user)==null?void 0:m.role)==="admin"}),[a,d]=n.useState(null),[l,x]=n.useState([]),[p,k]=n.useState([]),[v,b]=n.useState([]),[i,c]=n.useState(0),[f,F]=n.useState(0),[C,K]=n.useState(!0),[P,G]=n.useState(!0),[q,B]=n.useState(!0),[H,J]=n.useState(!0),j=n.useCallback(async()=>{try{const t=await u.get("web/dashboard/stats").json();d(t)}catch{}finally{K(!1)}},[]),g=n.useCallback(async()=>{try{const t=await u.get("web/dashboard/recent-tasks",{searchParams:{limit:"5"}}).json();x(t)}catch{}finally{G(!1)}},[]),D=n.useCallback(async()=>{try{const t=await u.get("web/machines").json();k(t)}catch{}finally{B(!1)}},[]),M=n.useCallback(async()=>{try{const t=await u.get("web/dashboard/recent-activity").json();b(t)}catch{b([])}finally{J(!1)}},[]);n.useEffect(()=>{j(),g(),D(),M(),u.get("web/projects").json().then(t=>c(t.length)).catch(()=>{}),o&&u.get("admin/developers").json().then(t=>F(t.length)).catch(()=>{})},[j,g,D,M,o]);const y=n.useRef(null);n.useEffect(()=>(y.current=setInterval(()=>{j(),g()},ae),()=>{y.current&&clearInterval(y.current)}),[j,g]);const A=(a==null?void 0:a.success_rate_daily)??null,R=(a==null?void 0:a.task_success_rate_7d)??0;function V(t){switch(t){case h.ONLINE:return"var(--accent)";case h.DRAINING:return"var(--warning)";case h.OFFLINE:default:return"var(--text-muted)"}}function Y(t){switch(t){case h.ONLINE:return s("dashboard.online");case h.DRAINING:return s("dashboard.idle");case h.OFFLINE:default:return s("dashboard.offline")}}return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-6 md:py-8 font-mono",children:[e.jsx("div",{className:"mb-4 md:hidden",children:e.jsxs("span",{className:"text-base font-bold text-[var(--accent)]",children:["// ",s("dashboard.title")]})}),e.jsx("div",{className:"mb-6 md:mb-8 grid grid-cols-2 gap-3 md:gap-4 lg:grid-cols-4",children:re.map(({key:t,labelKey:m})=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:p-4",children:[e.jsxs("span",{className:"text-[9px] md:text-xs text-[var(--text-muted)]",children:[s(m),":"]}),C?e.jsx("div",{className:"mt-1 h-6 md:h-8 w-12 md:w-16 animate-pulse rounded bg-[var(--bg-input)]"}):e.jsx("div",{className:"mt-1 flex items-baseline gap-2",children:e.jsx("span",{className:"text-2xl md:text-3xl font-bold text-[var(--text-primary)]",children:(a==null?void 0:a[t])??0})})]},t))}),e.jsx(se,{data:{activeTasks:((a==null?void 0:a.active_tasks)??0)+((a==null?void 0:a.queued_tasks)??0),totalMachines:p.length,totalProjects:i,totalDevelopers:f}}),e.jsxs("div",{className:"mb-6 grid gap-6 lg:grid-cols-3 items-stretch",children:[e.jsx("div",{className:"hidden md:flex flex-col gap-6 lg:col-span-2",children:e.jsxs("div",{className:"flex flex-1 flex-col rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("div",{className:"border-b border-[var(--border)] px-5 py-3",children:e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:s("dashboard.task_success_rate")})}),e.jsx("div",{className:"flex flex-1 flex-col justify-center p-5",children:C?e.jsx("div",{className:"h-24 animate-pulse rounded bg-[var(--bg-input)]"}):A?e.jsx(le,{dailyRates:A,overallRate:R}):e.jsxs("div",{className:"flex flex-col items-center gap-2 py-6",children:[e.jsxs("span",{className:"text-2xl font-bold text-[var(--text-primary)]",children:[R,"%"]}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s("dashboard.daily_breakdown_not_available")})]})})]})}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] md:border",children:[e.jsxs("div",{className:"hidden md:flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:s("dashboard.recent_tasks")}),e.jsxs(N,{to:"/tasks",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[s("common.view_all")," ",e.jsx(S,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"flex md:hidden items-center justify-between px-3 py-3",children:e.jsx("h2",{className:"text-xs font-bold text-[var(--accent)]",children:s("dashboard.recent_tasks")})}),e.jsx("div",{className:"px-3 pb-3 md:p-4",children:P?e.jsx(w,{rows:4}):l.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s("dashboard.no_tasks_yet")})]}):e.jsx("div",{className:"flex flex-col gap-2 md:gap-0",children:l.map(t=>e.jsxs("div",{onClick:()=>r(`/tasks/${t.id}`),className:"flex cursor-pointer items-center gap-3 rounded-[4px] border border-[var(--border)] p-3 transition-colors hover:bg-[var(--bg-input)] md:rounded-none md:border-0 md:border-b md:border-[var(--border-row)] md:p-0 md:py-2.5 last:md:border-b-0",children:[e.jsxs("div",{className:"flex-1 min-w-0 md:hidden",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[10px] text-[var(--text-primary)] leading-tight",style:{wordBreak:"break-word"},children:["#",t.id," ",t.description]}),e.jsx("span",{className:"shrink-0",children:e.jsx(T,{status:t.status})})]}),e.jsx("span",{className:"text-[9px] text-[var(--text-muted)] mt-1 block",children:L(t.createdAt)})]}),e.jsxs("span",{className:"hidden md:inline shrink-0 text-xs text-[var(--text-muted)]",children:["#",t.id]}),e.jsx("span",{className:"hidden md:inline flex-1 text-xs text-[var(--text-primary)] truncate",children:ne(t.description,40)}),e.jsx("span",{className:"hidden md:inline",children:e.jsx(T,{status:t.status})}),e.jsx("span",{className:"hidden md:inline shrink-0 text-xs text-[var(--text-muted)]",children:L(t.createdAt)})]},t.id))})})]})]}),e.jsxs("div",{className:"hidden md:grid gap-6 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:s("dashboard.worker_status")}),e.jsxs(N,{to:"/machines",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[s("common.view_all")," ",e.jsx(S,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-4",children:q?e.jsx(w,{rows:3}):p.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s("dashboard.no_workers_registered")})]}):e.jsx("div",{className:"flex flex-col",children:p.map(t=>e.jsxs("div",{onClick:()=>r(`/machines/${t.id}`),className:"flex cursor-pointer items-center justify-between border-b border-[var(--border-row)] py-2.5 transition-colors hover:bg-[var(--bg-input)] last:border-b-0",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:t.name}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:t.host??"--"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:[t.activeSlots,"/",t.maxSlots," ",s("dashboard.slots")]}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs",style:{color:V(t.status)},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),Y(t.status)]})]})]},t.id))})})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:s("dashboard.recent_activity")}),o&&e.jsxs(N,{to:"/admin/audit-logs",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[s("common.view_all")," ",e.jsx(S,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-4",children:H?e.jsx(w,{rows:4}):v.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s("dashboard.no_recent_activity")})]}):e.jsx("div",{className:"flex flex-col",children:v.map(t=>{const m=t.message.match(/task\s*#?(\d+)/i),_=m?m[1]:null;return e.jsxs("div",{className:`flex items-start gap-3 border-b border-[var(--border-row)] py-2 last:border-b-0 ${_?"cursor-pointer hover:bg-[var(--bg-input)] transition-colors":""}`,onClick:()=>_&&r(`/tasks/${_}`),children:[e.jsx("span",{className:"shrink-0 text-xs text-[var(--text-muted)]",children:L(t.timestamp)}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:t.message})]},t.id)})})})]})]})]})}export{he as default};
1
+ import{u as I,r as n,j as e,X as z,C as X,L as N,d as Q,a as $,f as u}from"./index-CDBuOPx4.js";import{M as h}from"./protocol-C5uQmiiB.js";import{T}from"./TaskStatusBadge-QtQUDscM.js";import{T as w}from"./Skeleton-CcVqz28_.js";import{C as U}from"./chevron-right-COxU2yxz.js";import{A as S}from"./arrow-right-g7hTftEi.js";function W(){return[{id:"admin_create_project",title:"create your first project",description:"set up a project with a git repo and pipeline",link:"/projects",linkLabel:"go to projects",autoDetect:!0},{id:"admin_register_worker",title:"register a worker machine",description:"generate a token and set up a worker to run tasks",link:"/machines",linkLabel:"go to machines",autoDetect:!0},{id:"admin_create_developer",title:"create a developer account",description:"add team members who can create and monitor tasks",link:"/admin/developers",linkLabel:"manage developers",autoDetect:!0},{id:"admin_first_task",title:"create your first task",description:"verify the full pipeline works end-to-end",link:"/tasks",linkLabel:"go to tasks",autoDetect:!0}]}function Z(){return[{id:"lead_view_projects",title:"view your projects",description:"check the projects assigned to you",link:"/projects",linkLabel:"go to projects"},{id:"lead_configure_pipeline",title:"configure a pipeline",description:"set up stages for your project workflow",link:"/projects",linkLabel:"go to projects"},{id:"lead_add_member",title:"add a team member",description:"invite developers to your project",link:"/projects",linkLabel:"go to projects"},{id:"lead_first_task",title:"create your first task",description:"submit a task and watch it execute",link:"/tasks",linkLabel:"go to tasks"}]}function ee(){return[{id:"dev_install_cli",title:"install the ov cli",description:"npm install -g @overlordai/developer-cli",link:"/docs/cli",linkLabel:"cli"},{id:"dev_setup_cli",title:"run ov setup",description:"connect to the server and authenticate",link:"/docs/cli",linkLabel:"setup guide"},{id:"dev_view_projects",title:"explore projects",description:"browse available projects and their pipelines",link:"/projects",linkLabel:"go to projects"},{id:"dev_first_task",title:"create your first task",description:"submit a task via web or cli",link:"/tasks",linkLabel:"go to tasks",autoDetect:!0}]}const O="overlord_onboarding";function te(){try{const r=localStorage.getItem(O);if(r)return JSON.parse(r)}catch{}return{dismissed:!1,completed:{}}}function E(r){localStorage.setItem(O,JSON.stringify(r))}function se({data:r}){const s=I(i=>{var c;return(c=i.user)==null?void 0:c.role}),[o,a]=n.useState(te),d=s==="admin"?W():s==="lead"||s==="maintainer"?Z():ee(),l=n.useCallback(i=>{if(o.completed[i.id])return!0;if(!i.autoDetect)return!1;switch(i.id){case"admin_create_project":return r.totalProjects>0;case"admin_register_worker":return r.totalMachines>0;case"admin_create_developer":return r.totalDevelopers>1;case"admin_first_task":case"dev_first_task":return r.activeTasks>0;default:return!1}},[o.completed,r]),x=d.filter(l).length,p=x===d.length,k=n.useCallback(i=>{a(c=>{const f={...c,completed:{...c.completed,[i]:!c.completed[i]}};return E(f),f})},[]),v=n.useCallback(()=>{a(i=>{const c={...i,dismissed:!0};return E(c),c})},[]);if(o.dismissed)return null;const b=Math.round(x/d.length*100);return e.jsxs("div",{className:"mb-6 md:mb-8 rounded-[4px] border border-[var(--accent)]/30 bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs font-bold text-[var(--accent)]",children:"// getting started"}),e.jsxs("span",{className:"text-[10px] text-[var(--text-muted)]",children:[x,"/",d.length," completed"]})]}),e.jsx("button",{onClick:v,className:"text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",title:"dismiss",children:e.jsx(z,{className:"h-3.5 w-3.5"})})]}),e.jsx("div",{className:"h-0.5 bg-[var(--border)]",children:e.jsx("div",{className:"h-full bg-[var(--accent)] transition-all duration-500",style:{width:`${b}%`}})}),e.jsx("div",{className:"divide-y divide-[var(--border)]",children:d.map(i=>{const c=l(i);return e.jsxs("div",{className:"flex items-center gap-3 px-4 py-3 transition-colors hover:bg-[var(--bg-input)]",children:[e.jsx("button",{onClick:()=>!i.autoDetect&&k(i.id),className:`flex h-4 w-4 shrink-0 items-center justify-center rounded-[4px] border transition-colors ${c?"border-[var(--accent)] bg-[var(--accent)]":"border-[var(--border)] hover:border-[var(--text-muted)]"} ${i.autoDetect?"cursor-default":"cursor-pointer"}`,children:c&&e.jsx(X,{className:"h-2.5 w-2.5 text-black"})}),e.jsxs("div",{className:"flex flex-1 items-center justify-between min-w-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:`text-xs ${c?"text-[var(--text-muted)] line-through":"text-[var(--text-primary)]"}`,children:i.title}),e.jsx("p",{className:"text-[10px] text-[var(--text-muted)] truncate",children:i.description})]}),i.link&&!c&&e.jsxs(N,{to:i.link,className:"ml-3 flex shrink-0 items-center gap-1 text-[10px] text-[var(--accent)] hover:underline",children:[i.linkLabel," ",e.jsx(U,{className:"h-3 w-3"})]})]})]},i.id)})}),p&&e.jsxs("div",{className:"border-t border-[var(--border)] px-4 py-3 text-center",children:[e.jsx("span",{className:"text-xs text-[var(--accent)]",children:"all set! you're ready to go."}),e.jsx("button",{onClick:v,className:"ml-3 text-[10px] text-[var(--text-muted)] underline hover:text-[var(--text-primary)]",children:"dismiss"})]})]})}const ae=3e4,re=[{key:"active_tasks",labelKey:"dashboard.active_tasks"},{key:"queued_tasks",labelKey:"dashboard.queued_tasks"},{key:"online_workers",labelKey:"dashboard.online_workers"},{key:"completed_today",labelKey:"dashboard.completed_today"}],ie=["mon","tue","wed","thu","fri","sat","sun"];function L(r){if(!r)return"-";const s=new Date(r).getTime();if(Number.isNaN(s))return"-";const o=Date.now()-s,a=Math.floor(o/6e4);if(a<1)return"just now";if(a<60)return`${a}m ago`;const d=Math.floor(a/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}function ne(r,s){return r.length<=s?r:r.slice(0,s)+"..."}function le({dailyRates:r,overallRate:s}){const{t:o}=$(),a=ie.map((l,x)=>({label:l,value:r[x]??0})),d=Math.max(...a.map(l=>l.value),1);return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-baseline gap-2",children:[e.jsxs("span",{className:"text-2xl font-bold text-[var(--text-primary)]",children:[s,"%"]}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:o("dashboard.last_7_days")})]}),e.jsx("div",{className:"flex gap-2",style:{height:80},children:a.map(l=>{const x=d>0?Math.max(l.value/d*100,4):4;return e.jsxs("div",{className:"flex flex-1 flex-col items-center gap-1",children:[e.jsx("div",{className:"relative w-full h-full rounded-[4px]",style:{backgroundColor:"rgba(34,197,94,0.1)"},children:e.jsx("div",{className:"absolute bottom-0 left-0 right-0 rounded-[4px]",style:{height:`${x}%`,backgroundColor:l.value>=80?"var(--accent)":l.value>=50?"var(--warning)":"var(--destructive)"}})}),e.jsx("span",{className:"shrink-0 text-[10px] text-[var(--text-muted)]",children:l.label})]},l.label)})})]})}function he(){const r=Q(),{t:s}=$(),o=I(t=>{var m;return((m=t.user)==null?void 0:m.role)==="admin"}),[a,d]=n.useState(null),[l,x]=n.useState([]),[p,k]=n.useState([]),[v,b]=n.useState([]),[i,c]=n.useState(0),[f,F]=n.useState(0),[C,K]=n.useState(!0),[P,G]=n.useState(!0),[q,B]=n.useState(!0),[H,J]=n.useState(!0),j=n.useCallback(async()=>{try{const t=await u.get("web/dashboard/stats").json();d(t)}catch{}finally{K(!1)}},[]),g=n.useCallback(async()=>{try{const t=await u.get("web/dashboard/recent-tasks",{searchParams:{limit:"5"}}).json();x(t)}catch{}finally{G(!1)}},[]),D=n.useCallback(async()=>{try{const t=await u.get("web/machines").json();k(t)}catch{}finally{B(!1)}},[]),M=n.useCallback(async()=>{try{const t=await u.get("web/dashboard/recent-activity").json();b(t)}catch{b([])}finally{J(!1)}},[]);n.useEffect(()=>{j(),g(),D(),M(),u.get("web/projects").json().then(t=>c(t.length)).catch(()=>{}),o&&u.get("admin/developers").json().then(t=>F(t.length)).catch(()=>{})},[j,g,D,M,o]);const y=n.useRef(null);n.useEffect(()=>(y.current=setInterval(()=>{j(),g()},ae),()=>{y.current&&clearInterval(y.current)}),[j,g]);const A=(a==null?void 0:a.success_rate_daily)??null,R=(a==null?void 0:a.task_success_rate_7d)??0;function V(t){switch(t){case h.ONLINE:return"var(--accent)";case h.DRAINING:return"var(--warning)";case h.OFFLINE:default:return"var(--text-muted)"}}function Y(t){switch(t){case h.ONLINE:return s("dashboard.online");case h.DRAINING:return s("dashboard.idle");case h.OFFLINE:default:return s("dashboard.offline")}}return e.jsxs("div",{className:"mx-auto max-w-6xl px-2 py-4 md:px-6 md:py-8 font-mono",children:[e.jsx("div",{className:"mb-4 md:hidden",children:e.jsxs("span",{className:"text-base font-bold text-[var(--accent)]",children:["// ",s("dashboard.title")]})}),e.jsx("div",{className:"mb-6 md:mb-8 grid grid-cols-2 gap-3 md:gap-4 lg:grid-cols-4",children:re.map(({key:t,labelKey:m})=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-3 md:p-4",children:[e.jsxs("span",{className:"text-[9px] md:text-xs text-[var(--text-muted)]",children:[s(m),":"]}),C?e.jsx("div",{className:"mt-1 h-6 md:h-8 w-12 md:w-16 animate-pulse rounded bg-[var(--bg-input)]"}):e.jsx("div",{className:"mt-1 flex items-baseline gap-2",children:e.jsx("span",{className:"text-2xl md:text-3xl font-bold text-[var(--text-primary)]",children:(a==null?void 0:a[t])??0})})]},t))}),e.jsx(se,{data:{activeTasks:((a==null?void 0:a.active_tasks)??0)+((a==null?void 0:a.queued_tasks)??0),totalMachines:p.length,totalProjects:i,totalDevelopers:f}}),e.jsxs("div",{className:"mb-6 grid gap-6 lg:grid-cols-3 items-stretch",children:[e.jsx("div",{className:"hidden md:flex flex-col gap-6 lg:col-span-2",children:e.jsxs("div",{className:"flex flex-1 flex-col rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("div",{className:"border-b border-[var(--border)] px-5 py-3",children:e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:s("dashboard.task_success_rate")})}),e.jsx("div",{className:"flex flex-1 flex-col justify-center p-5",children:C?e.jsx("div",{className:"h-24 animate-pulse rounded bg-[var(--bg-input)]"}):A?e.jsx(le,{dailyRates:A,overallRate:R}):e.jsxs("div",{className:"flex flex-col items-center gap-2 py-6",children:[e.jsxs("span",{className:"text-2xl font-bold text-[var(--text-primary)]",children:[R,"%"]}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s("dashboard.daily_breakdown_not_available")})]})})]})}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] md:border",children:[e.jsxs("div",{className:"hidden md:flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:s("dashboard.recent_tasks")}),e.jsxs(N,{to:"/tasks",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[s("common.view_all")," ",e.jsx(S,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"flex md:hidden items-center justify-between px-3 py-3",children:e.jsx("h2",{className:"text-xs font-bold text-[var(--accent)]",children:s("dashboard.recent_tasks")})}),e.jsx("div",{className:"px-3 pb-3 md:p-4",children:P?e.jsx(w,{rows:4}):l.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s("dashboard.no_tasks_yet")})]}):e.jsx("div",{className:"flex flex-col gap-2 md:gap-0",children:l.map(t=>e.jsxs("div",{onClick:()=>r(`/tasks/${t.id}`),className:"flex cursor-pointer items-center gap-3 rounded-[4px] border border-[var(--border)] p-3 transition-colors hover:bg-[var(--bg-input)] md:rounded-none md:border-0 md:border-b md:border-[var(--border-row)] md:p-0 md:py-2.5 last:md:border-b-0",children:[e.jsxs("div",{className:"flex-1 min-w-0 md:hidden",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("span",{className:"text-[10px] text-[var(--text-primary)] leading-tight",style:{wordBreak:"break-word"},children:["#",t.id," ",t.description]}),e.jsx("span",{className:"shrink-0",children:e.jsx(T,{status:t.status})})]}),e.jsx("span",{className:"text-[9px] text-[var(--text-muted)] mt-1 block",children:L(t.createdAt)})]}),e.jsxs("span",{className:"hidden md:inline shrink-0 text-xs text-[var(--text-muted)]",children:["#",t.id]}),e.jsx("span",{className:"hidden md:inline flex-1 text-xs text-[var(--text-primary)] truncate",children:ne(t.description,40)}),e.jsx("span",{className:"hidden md:inline",children:e.jsx(T,{status:t.status})}),e.jsx("span",{className:"hidden md:inline shrink-0 text-xs text-[var(--text-muted)]",children:L(t.createdAt)})]},t.id))})})]})]}),e.jsxs("div",{className:"hidden md:grid gap-6 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:s("dashboard.worker_status")}),e.jsxs(N,{to:"/machines",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[s("common.view_all")," ",e.jsx(S,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-4",children:q?e.jsx(w,{rows:3}):p.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s("dashboard.no_workers_registered")})]}):e.jsx("div",{className:"flex flex-col",children:p.map(t=>e.jsxs("div",{onClick:()=>r(`/machines/${t.id}`),className:"flex cursor-pointer items-center justify-between border-b border-[var(--border-row)] py-2.5 transition-colors hover:bg-[var(--bg-input)] last:border-b-0",children:[e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx("span",{className:"text-xs text-[var(--text-primary)]",children:t.name}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:t.host??"--"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:[t.activeSlots,"/",t.maxSlots," ",s("dashboard.slots")]}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs",style:{color:V(t.status)},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),Y(t.status)]})]})]},t.id))})})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-3",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:s("dashboard.recent_activity")}),o&&e.jsxs(N,{to:"/admin/audit-logs",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[s("common.view_all")," ",e.jsx(S,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-4",children:H?e.jsx(w,{rows:4}):v.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-8",children:[e.jsx("span",{className:"text-xl font-bold text-[var(--border)]",children:"[ ]"}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s("dashboard.no_recent_activity")})]}):e.jsx("div",{className:"flex flex-col",children:v.map(t=>{const m=t.message.match(/task\s*#?(\d+)/i),_=m?m[1]:null;return e.jsxs("div",{className:`flex items-start gap-3 border-b border-[var(--border-row)] py-2 last:border-b-0 ${_?"cursor-pointer hover:bg-[var(--bg-input)] transition-colors":""}`,onClick:()=>_&&r(`/tasks/${_}`),children:[e.jsx("span",{className:"shrink-0 text-xs text-[var(--text-muted)]",children:L(t.timestamp)}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:t.message})]},t.id)})})})]})]})]})}export{he as default};
@@ -1,4 +1,4 @@
1
- import{c as n,u as m,a as h,j as e,T as p,L as l,b as x,S as y,r as g,C as v}from"./index-DJxZmj6O.js";import{A as c}from"./arrow-right-B5aaHrGs.js";import{B as u}from"./bot-KMbKzBkt.js";import{U as b}from"./users-BsM5ZXj8.js";import{C as j}from"./copy-Dd1cNNWz.js";/**
1
+ import{c as n,u as m,a as h,j as e,T as p,L as l,b as x,S as y,r as g,C as v}from"./index-CDBuOPx4.js";import{A as c}from"./arrow-right-g7hTftEi.js";import{B as u}from"./bot-DYvBcsZn.js";import{U as b}from"./users-LNQqKSEN.js";import{C as j}from"./copy-BGttVgA1.js";/**
2
2
  * @license lucide-react v0.469.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{d as W,e as q,u as m,a as I,r as c,j as t,N as k}from"./index-DJxZmj6O.js";function P(){var w,B;const h=W(),y=q(),x=m(e=>e.login),v=m(e=>e.requireTotpSetup),_=m(e=>e.user),{t:n}=I(),[C,S]=c.useState("credentials"),[u,F]=c.useState(""),[p,z]=c.useState(""),[i,b]=c.useState(""),[l,g]=c.useState(!1),[j,d]=c.useState(""),f=c.useRef([]);if(_&&!v){let e=(B=(w=y.state)==null?void 0:w.from)==null?void 0:B.pathname;return(e==="/totp-setup"||e==="/login")&&(e=void 0),t.jsx(k,{to:e??"/home",replace:!0})}if(v)return t.jsx(k,{to:"/totp-setup",replace:!0});const M=async e=>{var r,o;if(e.preventDefault(),d(""),!u.trim()||!p.trim()){d(n("auth.username_and_password_required"));return}g(!0);try{await x({username:u.trim(),password:p});const a=m.getState();if(a.requireTotpSetup)return;if(a.user){let s=(o=(r=y.state)==null?void 0:r.from)==null?void 0:o.pathname;(s==="/totp-setup"||s==="/login")&&(s=void 0),h(s??"/home",{replace:!0})}}catch(a){const s=a instanceof Error?a.message:n("auth.login_failed");s==="TOTP_REQUIRED"?(S("totp"),d("")):d(s)}finally{g(!1)}},J=async e=>{var r,o;if(e.preventDefault(),d(""),!i.trim()||i.trim().length!==6){d(n("auth.please_enter_valid_6_digit_code"));return}g(!0);try{if(await x({username:u.trim(),password:p,totpCode:i.trim()}),m.getState().user){let s=(o=(r=y.state)==null?void 0:r.from)==null?void 0:o.pathname;(s==="/totp-setup"||s==="/login")&&(s=void 0),h(s??"/home",{replace:!0})}}catch(a){const s=a instanceof Error?a.message:n("auth.invalid_totp_code");d(s)}finally{g(!1)}},R=()=>{S("credentials"),b(""),d("")},T=(e,r)=>{var s;const o=r.replace(/\D/g,"").slice(-1),a=i.split("");for(;a.length<6;)a.push("");a[e]=o,b(a.join("")),o&&e<5&&((s=f.current[e+1])==null||s.focus())},D=(e,r)=>{var o;r.key==="Backspace"&&!i[e]&&e>0&&((o=f.current[e-1])==null||o.focus())},E=e=>{var a;e.preventDefault();const r=e.clipboardData.getData("text").replace(/\D/g,"").slice(0,6);b(r);const o=Math.min(r.length,5);(a=f.current[o])==null||a.focus()};return t.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--bg-primary)",padding:"1rem",fontFamily:"'JetBrains Mono', monospace"},children:t.jsxs("div",{style:{width:"100%",maxWidth:"400px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"2rem"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.625rem",marginBottom:"0.25rem"},children:[t.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"2rem",height:"2rem",borderRadius:"4px",backgroundColor:"var(--accent)",fontFamily:"'JetBrains Mono', monospace"},"aria-hidden":!0,children:t.jsx("span",{style:{fontSize:"1.25rem",fontWeight:600,color:"#0C0C0C"},children:"~"})}),t.jsx("span",{style:{fontSize:"1.25rem",fontWeight:700,color:"var(--text-primary)",fontFamily:"'JetBrains Mono', monospace"},children:n("landing.overlord")})]}),t.jsx("div",{style:{textAlign:"center",color:"var(--text-muted)",fontSize:"0.75rem",marginBottom:"2rem",fontFamily:"'JetBrains Mono', monospace"},children:n(C==="credentials"?"auth.ai_powered_development_system":"auth.two_factor_verification")}),j&&t.jsx("div",{style:{marginBottom:"1rem",padding:"0.5rem 0.75rem",borderRadius:"4px",backgroundColor:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.3)",color:"var(--destructive)",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",overflowWrap:"break-word",wordBreak:"break-word"},children:j}),C==="credentials"?t.jsxs("form",{onSubmit:M,style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t.jsxs("div",{children:[t.jsx("label",{style:{display:"block",color:"var(--text-secondary)",fontSize:"0.75rem",marginBottom:"0.375rem",fontFamily:"'JetBrains Mono', monospace"},children:n("auth.username")}),t.jsx("input",{type:"text",placeholder:n("auth.enter_username"),value:u,onChange:e=>F(e.target.value),autoFocus:!0,autoComplete:"username",required:!0,style:{width:"100%",padding:"0.625rem 0.75rem",backgroundColor:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--text-primary)",fontSize:"0.875rem",fontFamily:"'JetBrains Mono', monospace",outline:"none",boxSizing:"border-box"},onFocus:e=>e.target.style.borderColor="var(--accent)",onBlur:e=>e.target.style.borderColor="var(--border)"})]}),t.jsxs("div",{children:[t.jsx("label",{style:{display:"block",color:"var(--text-secondary)",fontSize:"0.75rem",marginBottom:"0.375rem",fontFamily:"'JetBrains Mono', monospace"},children:n("auth.password")}),t.jsx("input",{type:"password",placeholder:n("auth.enter_password"),value:p,onChange:e=>z(e.target.value),autoComplete:"current-password",required:!0,style:{width:"100%",padding:"0.625rem 0.75rem",backgroundColor:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--text-primary)",fontSize:"0.875rem",fontFamily:"'JetBrains Mono', monospace",outline:"none",boxSizing:"border-box"},onFocus:e=>e.target.style.borderColor="var(--accent)",onBlur:e=>e.target.style.borderColor="var(--border)"})]}),t.jsx("button",{type:"submit",disabled:l,style:{width:"100%",padding:"0.625rem",backgroundColor:"var(--accent)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.875rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:l?"not-allowed":"pointer",opacity:l?.7:1,marginTop:"0.5rem"},children:n(l?"common.signing_in":"auth.sign_in")}),t.jsx("button",{type:"button",onClick:()=>h("/"),style:{width:"100%",padding:"0.5rem",backgroundColor:"transparent",border:"none",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:n("common.back")})]},"credentials"):t.jsxs("form",{onSubmit:J,style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t.jsxs("div",{children:[t.jsx("label",{style:{display:"block",color:"var(--text-secondary)",fontSize:"0.75rem",marginBottom:"0.5rem",fontFamily:"'JetBrains Mono', monospace",textAlign:"center"},children:n("auth.enter_totp_code")}),t.jsx("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"center"},onPaste:E,children:Array.from({length:6}).map((e,r)=>t.jsx("input",{ref:o=>{f.current[r]=o},type:"text",inputMode:"numeric",maxLength:1,value:i[r]||"",onChange:o=>T(r,o.target.value),onKeyDown:o=>D(r,o),autoFocus:r===0,autoComplete:r===0?"one-time-code":"off",style:{width:"2.75rem",height:"3rem",textAlign:"center",backgroundColor:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--text-primary)",fontSize:"1.25rem",fontFamily:"'JetBrains Mono', monospace",fontWeight:600,outline:"none",boxSizing:"border-box"},onFocus:o=>o.target.style.borderColor="var(--accent)",onBlur:o=>o.target.style.borderColor="var(--border)"},r))})]}),t.jsx("button",{type:"submit",disabled:l||i.length!==6,style:{width:"100%",padding:"0.625rem",backgroundColor:"var(--accent)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.875rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:l||i.length!==6?"not-allowed":"pointer",opacity:l||i.length!==6?.7:1,marginTop:"0.5rem"},children:n(l?"common.verifying":"auth.verify")}),t.jsx("button",{type:"button",onClick:R,style:{width:"100%",padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:n("common.back")})]},"totp")]})})}export{P as default};
1
+ import{d as W,e as q,u as m,a as I,r as c,j as t,N as k}from"./index-CDBuOPx4.js";function P(){var w,B;const h=W(),y=q(),x=m(e=>e.login),v=m(e=>e.requireTotpSetup),_=m(e=>e.user),{t:n}=I(),[C,S]=c.useState("credentials"),[u,F]=c.useState(""),[p,z]=c.useState(""),[i,b]=c.useState(""),[l,g]=c.useState(!1),[j,d]=c.useState(""),f=c.useRef([]);if(_&&!v){let e=(B=(w=y.state)==null?void 0:w.from)==null?void 0:B.pathname;return(e==="/totp-setup"||e==="/login")&&(e=void 0),t.jsx(k,{to:e??"/home",replace:!0})}if(v)return t.jsx(k,{to:"/totp-setup",replace:!0});const M=async e=>{var r,o;if(e.preventDefault(),d(""),!u.trim()||!p.trim()){d(n("auth.username_and_password_required"));return}g(!0);try{await x({username:u.trim(),password:p});const a=m.getState();if(a.requireTotpSetup)return;if(a.user){let s=(o=(r=y.state)==null?void 0:r.from)==null?void 0:o.pathname;(s==="/totp-setup"||s==="/login")&&(s=void 0),h(s??"/home",{replace:!0})}}catch(a){const s=a instanceof Error?a.message:n("auth.login_failed");s==="TOTP_REQUIRED"?(S("totp"),d("")):d(s)}finally{g(!1)}},J=async e=>{var r,o;if(e.preventDefault(),d(""),!i.trim()||i.trim().length!==6){d(n("auth.please_enter_valid_6_digit_code"));return}g(!0);try{if(await x({username:u.trim(),password:p,totpCode:i.trim()}),m.getState().user){let s=(o=(r=y.state)==null?void 0:r.from)==null?void 0:o.pathname;(s==="/totp-setup"||s==="/login")&&(s=void 0),h(s??"/home",{replace:!0})}}catch(a){const s=a instanceof Error?a.message:n("auth.invalid_totp_code");d(s)}finally{g(!1)}},R=()=>{S("credentials"),b(""),d("")},T=(e,r)=>{var s;const o=r.replace(/\D/g,"").slice(-1),a=i.split("");for(;a.length<6;)a.push("");a[e]=o,b(a.join("")),o&&e<5&&((s=f.current[e+1])==null||s.focus())},D=(e,r)=>{var o;r.key==="Backspace"&&!i[e]&&e>0&&((o=f.current[e-1])==null||o.focus())},E=e=>{var a;e.preventDefault();const r=e.clipboardData.getData("text").replace(/\D/g,"").slice(0,6);b(r);const o=Math.min(r.length,5);(a=f.current[o])==null||a.focus()};return t.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"var(--bg-primary)",padding:"1rem",fontFamily:"'JetBrains Mono', monospace"},children:t.jsxs("div",{style:{width:"100%",maxWidth:"400px",backgroundColor:"var(--bg-card)",border:"1px solid var(--border)",borderRadius:"4px",padding:"2rem"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:"0.625rem",marginBottom:"0.25rem"},children:[t.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:"2rem",height:"2rem",borderRadius:"4px",backgroundColor:"var(--accent)",fontFamily:"'JetBrains Mono', monospace"},"aria-hidden":!0,children:t.jsx("span",{style:{fontSize:"1.25rem",fontWeight:600,color:"#0C0C0C"},children:"~"})}),t.jsx("span",{style:{fontSize:"1.25rem",fontWeight:700,color:"var(--text-primary)",fontFamily:"'JetBrains Mono', monospace"},children:n("landing.overlord")})]}),t.jsx("div",{style:{textAlign:"center",color:"var(--text-muted)",fontSize:"0.75rem",marginBottom:"2rem",fontFamily:"'JetBrains Mono', monospace"},children:n(C==="credentials"?"auth.ai_powered_development_system":"auth.two_factor_verification")}),j&&t.jsx("div",{style:{marginBottom:"1rem",padding:"0.5rem 0.75rem",borderRadius:"4px",backgroundColor:"rgba(239, 68, 68, 0.1)",border:"1px solid rgba(239, 68, 68, 0.3)",color:"var(--destructive)",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",overflowWrap:"break-word",wordBreak:"break-word"},children:j}),C==="credentials"?t.jsxs("form",{onSubmit:M,style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t.jsxs("div",{children:[t.jsx("label",{style:{display:"block",color:"var(--text-secondary)",fontSize:"0.75rem",marginBottom:"0.375rem",fontFamily:"'JetBrains Mono', monospace"},children:n("auth.username")}),t.jsx("input",{type:"text",placeholder:n("auth.enter_username"),value:u,onChange:e=>F(e.target.value),autoFocus:!0,autoComplete:"username",required:!0,style:{width:"100%",padding:"0.625rem 0.75rem",backgroundColor:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--text-primary)",fontSize:"0.875rem",fontFamily:"'JetBrains Mono', monospace",outline:"none",boxSizing:"border-box"},onFocus:e=>e.target.style.borderColor="var(--accent)",onBlur:e=>e.target.style.borderColor="var(--border)"})]}),t.jsxs("div",{children:[t.jsx("label",{style:{display:"block",color:"var(--text-secondary)",fontSize:"0.75rem",marginBottom:"0.375rem",fontFamily:"'JetBrains Mono', monospace"},children:n("auth.password")}),t.jsx("input",{type:"password",placeholder:n("auth.enter_password"),value:p,onChange:e=>z(e.target.value),autoComplete:"current-password",required:!0,style:{width:"100%",padding:"0.625rem 0.75rem",backgroundColor:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--text-primary)",fontSize:"0.875rem",fontFamily:"'JetBrains Mono', monospace",outline:"none",boxSizing:"border-box"},onFocus:e=>e.target.style.borderColor="var(--accent)",onBlur:e=>e.target.style.borderColor="var(--border)"})]}),t.jsx("button",{type:"submit",disabled:l,style:{width:"100%",padding:"0.625rem",backgroundColor:"var(--accent)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.875rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:l?"not-allowed":"pointer",opacity:l?.7:1,marginTop:"0.5rem"},children:n(l?"common.signing_in":"auth.sign_in")}),t.jsx("button",{type:"button",onClick:()=>h("/"),style:{width:"100%",padding:"0.5rem",backgroundColor:"transparent",border:"none",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},className:"text-xs text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",children:n("common.back")})]},"credentials"):t.jsxs("form",{onSubmit:J,style:{display:"flex",flexDirection:"column",gap:"1rem"},children:[t.jsxs("div",{children:[t.jsx("label",{style:{display:"block",color:"var(--text-secondary)",fontSize:"0.75rem",marginBottom:"0.5rem",fontFamily:"'JetBrains Mono', monospace",textAlign:"center"},children:n("auth.enter_totp_code")}),t.jsx("div",{style:{display:"flex",gap:"0.5rem",justifyContent:"center"},onPaste:E,children:Array.from({length:6}).map((e,r)=>t.jsx("input",{ref:o=>{f.current[r]=o},type:"text",inputMode:"numeric",maxLength:1,value:i[r]||"",onChange:o=>T(r,o.target.value),onKeyDown:o=>D(r,o),autoFocus:r===0,autoComplete:r===0?"one-time-code":"off",style:{width:"2.75rem",height:"3rem",textAlign:"center",backgroundColor:"var(--bg-input)",border:"1px solid var(--border)",borderRadius:"4px",color:"var(--text-primary)",fontSize:"1.25rem",fontFamily:"'JetBrains Mono', monospace",fontWeight:600,outline:"none",boxSizing:"border-box"},onFocus:o=>o.target.style.borderColor="var(--accent)",onBlur:o=>o.target.style.borderColor="var(--border)"},r))})]}),t.jsx("button",{type:"submit",disabled:l||i.length!==6,style:{width:"100%",padding:"0.625rem",backgroundColor:"var(--accent)",color:"#0C0C0C",border:"none",borderRadius:"4px",fontSize:"0.875rem",fontWeight:600,fontFamily:"'JetBrains Mono', monospace",cursor:l||i.length!==6?"not-allowed":"pointer",opacity:l||i.length!==6?.7:1,marginTop:"0.5rem"},children:n(l?"common.verifying":"auth.verify")}),t.jsx("button",{type:"button",onClick:R,style:{width:"100%",padding:"0.5rem",backgroundColor:"transparent",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:"4px",fontSize:"0.75rem",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer"},children:n("common.back")})]},"totp")]})})}export{P as default};