@overlordai/server 1.0.14 → 1.0.15

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 (57) hide show
  1. package/dist/common/error-filter.d.ts.map +1 -1
  2. package/dist/common/error-filter.js +16 -0
  3. package/dist/common/error-filter.js.map +1 -1
  4. package/dist/main.js +3 -2
  5. package/dist/main.js.map +1 -1
  6. package/package.json +4 -3
  7. package/public/assets/AccessTokensPage-BNaz9M2D.js +1 -0
  8. package/public/assets/AdminPage-BK3yXUTo.js +1 -0
  9. package/public/assets/ApiReferencePage-B5840y13.js +1 -0
  10. package/public/assets/AuditLogPage-CTyPeBTm.js +11 -0
  11. package/public/assets/BotManage-CfcannzE.js +6 -0
  12. package/public/assets/CliReferencePage-BkFni7kH.js +4 -0
  13. package/public/assets/DeveloperManage-qek3ScKE.js +16 -0
  14. package/public/assets/EditProjectPage-BJ1h9Teb.js +2 -0
  15. package/public/assets/EmptyState-BPAoLpts.js +6 -0
  16. package/public/assets/HomePage-BolSOHNk.js +1 -0
  17. package/public/assets/LandingPage-Bd51R0zG.js +26 -0
  18. package/public/assets/LoginPage-pvTUbSIt.js +1 -0
  19. package/public/assets/MachineDetailPage-BH-KZK-O.js +1 -0
  20. package/public/assets/MachineListPage-DKuE_lOr.js +6 -0
  21. package/public/assets/NotFoundPage-CEkbHGWM.js +1 -0
  22. package/public/assets/PipelineEditorPage-C-PHUced.js +3 -0
  23. package/public/assets/ProfilePage-9A1i3I4h.js +1 -0
  24. package/public/assets/ProjectDetailPage-DFmRizSR.js +7 -0
  25. package/public/assets/ProjectListPage-Dbj2OlMz.js +6 -0
  26. package/public/assets/QuickAuth-DRYnjdDV.js +1 -0
  27. package/public/assets/RemoveMemberConfirmDialog-B1Wfe6qD.js +6 -0
  28. package/public/assets/Select-Coph7K6I.js +6 -0
  29. package/public/assets/SettingsPage-YG6bu8P-.js +6 -0
  30. package/public/assets/Skeleton-DTD8fr3E.js +1 -0
  31. package/public/assets/TaskDetailPage-Beg8tuEN.css +32 -0
  32. package/public/assets/TaskDetailPage-DXSxtOVO.js +44 -0
  33. package/public/assets/TaskListPage-t4Dv8BDy.js +1 -0
  34. package/public/assets/TaskStatusBadge-CTYxCsEO.js +1 -0
  35. package/public/assets/TokenManage-CUQ3wwfj.js +1 -0
  36. package/public/assets/TotpSetupPage--DR3X8Ic.js +9 -0
  37. package/public/assets/WorkerSetupGuidePage-HEUz68fc.js +16 -0
  38. package/public/assets/arrow-left-EPKSp1wq.js +6 -0
  39. package/public/assets/arrow-right-CW48svkF.js +6 -0
  40. package/public/assets/bot-BlE3obwB.js +6 -0
  41. package/public/assets/copy-CljRO0MZ.js +6 -0
  42. package/public/assets/external-link-BOPlNQYO.js +6 -0
  43. package/public/assets/index-CluWJF_4.js +207 -0
  44. package/public/assets/index-DeEHxWoz.css +1 -0
  45. package/public/assets/key-OMhi1y8r.js +6 -0
  46. package/public/assets/loader-circle-DEx7RlNw.js +6 -0
  47. package/public/assets/pencil-BgpOCLzp.js +6 -0
  48. package/public/assets/plus-DMsT-oJS.js +6 -0
  49. package/public/assets/protocol-C4f2G7mk.js +1 -0
  50. package/public/assets/rotate-ccw-D8Wc0cH7.js +6 -0
  51. package/public/assets/scroll-text-B0kPxzfj.js +6 -0
  52. package/public/assets/settings-D3F-dJby.js +6 -0
  53. package/public/assets/task.store-bgSaXfA1.js +1 -0
  54. package/public/assets/trash-2-CpNRRu-J.js +6 -0
  55. package/public/assets/users-D0C2zcU6.js +6 -0
  56. package/public/favicon.svg +4 -0
  57. package/public/index.html +20 -0
@@ -1 +1 @@
1
- {"version":3,"file":"error-filter.d.ts","sourceRoot":"","sources":["../../src/common/error-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,aAAa,EAEd,MAAM,gBAAgB,CAAC;AAIxB,qBACa,qBAAsB,YAAW,eAAe;IAC3D,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI;IA4CpD,OAAO,CAAC,gBAAgB;CAoBzB"}
1
+ {"version":3,"file":"error-filter.d.ts","sourceRoot":"","sources":["../../src/common/error-filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EACf,aAAa,EAGd,MAAM,gBAAgB,CAAC;AASxB,qBACa,qBAAsB,YAAW,eAAe;IAC3D,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,GAAG,IAAI;IA2DpD,OAAO,CAAC,gBAAgB;CAoBzB"}
@@ -8,11 +8,27 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.GlobalExceptionFilter = void 0;
10
10
  const common_1 = require("@nestjs/common");
11
+ const fs_1 = require("fs");
12
+ const path_1 = require("path");
11
13
  const sensitive_filter_1 = require("./sensitive-filter");
14
+ const SPA_INDEX = (0, path_1.join)(__dirname, '..', '..', 'public', 'index.html');
15
+ const HAS_SPA = (0, fs_1.existsSync)(SPA_INDEX);
12
16
  let GlobalExceptionFilter = class GlobalExceptionFilter {
13
17
  catch(exception, host) {
14
18
  const ctx = host.switchToHttp();
19
+ const request = ctx.getRequest();
15
20
  const response = ctx.getResponse();
21
+ // SPA fallback: serve index.html for 404 GET requests on non-API paths
22
+ if (HAS_SPA &&
23
+ exception instanceof common_1.NotFoundException &&
24
+ request.method === 'GET' &&
25
+ !request.url.startsWith('/api/') &&
26
+ !request.url.startsWith('/webhook/') &&
27
+ !request.url.startsWith('/ws/') &&
28
+ request.url !== '/healthz') {
29
+ response.sendFile(SPA_INDEX);
30
+ return;
31
+ }
16
32
  let statusCode;
17
33
  let code;
18
34
  let message;
@@ -1 +1 @@
1
- {"version":3,"file":"error-filter.js","sourceRoot":"","sources":["../../src/common/error-filter.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAKwB;AAExB,yDAA8C;AAGvC,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,KAAK,CAAC,SAAkB,EAAE,IAAmB;QAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;QAEnC,IAAI,UAAkB,CAAC;QACvB,IAAI,IAAY,CAAC;QACjB,IAAI,OAAe,CAAC;QAEpB,IAAI,SAAS,YAAY,sBAAa,EAAE,CAAC;YACvC,UAAU,GAAG,SAAS,CAAC,SAAS,EAAE,CAAC;YACnC,MAAM,iBAAiB,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;YAClD,IAAI,OAAO,iBAAiB,KAAK,QAAQ,EAAE,CAAC;gBAC1C,OAAO,GAAG,iBAAiB,CAAC;YAC9B,CAAC;iBAAM,IACL,OAAO,iBAAiB,KAAK,QAAQ;gBACrC,iBAAiB,KAAK,IAAI;gBAC1B,SAAS,IAAI,iBAAiB,EAC9B,CAAC;gBACD,MAAM,GAAG,GAAI,iBAA6C,CAAC,OAAO,CAAC;gBACnE,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC9D,CAAC;iBAAM,CAAC;gBACN,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;YAC9B,CAAC;YACD,IAAI,GAAG,UAAU,IAAI,GAAG,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;QAClF,CAAC;aAAM,CAAC;YACN,UAAU,GAAG,GAAG,CAAC;YACjB,IAAI,GAAG,gBAAgB,CAAC;YACxB,OAAO;gBACL,SAAS,YAAY,KAAK;oBACxB,CAAC,CAAC,SAAS,CAAC,OAAO;oBACnB,CAAC,CAAC,8BAA8B,CAAC;QACvC,CAAC;QAED,MAAM,IAAI,GAAa;YACrB,KAAK,EAAE;gBACL,IAAI;gBACJ,OAAO,EAAE,IAAA,2BAAQ,EAAC,OAAO,CAAC;gBAC1B,UAAU;aACX;SACF,CAAC;QAEF,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAEO,gBAAgB,CAAC,MAAc;QACrC,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,GAAG;gBACN,OAAO,aAAa,CAAC;YACvB,KAAK,GAAG;gBACN,OAAO,cAAc,CAAC;YACxB,KAAK,GAAG;gBACN,OAAO,WAAW,CAAC;YACrB,KAAK,GAAG;gBACN,OAAO,WAAW,CAAC;YACrB,KAAK,GAAG;gBACN,OAAO,UAAU,CAAC;YACpB,KAAK,GAAG;gBACN,OAAO,sBAAsB,CAAC;YAChC,KAAK,GAAG;gBACN,OAAO,mBAAmB,CAAC;YAC7B;gBACE,OAAO,OAAO,CAAC;QACnB,CAAC;IACH,CAAC;CACF,CAAA;AAjEY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,cAAK,GAAE;GACK,qBAAqB,CAiEjC"}
1
+ {"version":3,"file":"error-filter.js","sourceRoot":"","sources":["../../src/common/error-filter.ts"],"names":[],"mappings":"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"}
package/dist/main.js CHANGED
@@ -25,8 +25,9 @@ async function bootstrap() {
25
25
  });
26
26
  // Body parser with 1MB limit
27
27
  app.use((0, express_1.json)({ limit: '1mb' }));
28
- // Static file serving from public/ directory
29
- app.useStaticAssets((0, path_1.join)(__dirname, '..', 'public'));
28
+ // Static file serving — SPA frontend from public/ directory
29
+ const publicDir = (0, path_1.join)(__dirname, '..', 'public');
30
+ app.useStaticAssets(publicDir);
30
31
  // Global exception filter
31
32
  app.useGlobalFilters(new error_filter_1.GlobalExceptionFilter());
32
33
  // NOTE: Do NOT call app.enableShutdownHooks() here.
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"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"}
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@overlordai/server",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist",
7
- "database"
7
+ "database",
8
+ "public"
8
9
  ],
9
10
  "bin": {
10
11
  "overlord-server": "dist/main.js"
@@ -30,7 +31,7 @@
30
31
  "reflect-metadata": "^0.2.2",
31
32
  "rxjs": "^7.8.0",
32
33
  "uuid": "^11.1.0",
33
- "@overlordai/protocol": "1.0.14"
34
+ "@overlordai/protocol": "1.0.15"
34
35
  },
35
36
  "devDependencies": {
36
37
  "@nestjs/testing": "^10.4.0",
@@ -0,0 +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-CluWJF_4.js";import{S as D}from"./Select-Coph7K6I.js";import{E as A}from"./EmptyState-BPAoLpts.js";import{T as E}from"./Skeleton-DTD8fr3E.js";import{P as L}from"./plus-DMsT-oJS.js";import{C as R}from"./copy-CljRO0MZ.js";import{T as M}from"./trash-2-CpNRRu-J.js";function O({isOpen:t,onClose:d,onCreated:l}){const{t:s}=_(),[n,i]=o.useState(""),[x,m]=o.useState("never"),[u,v]=o.useState(!1),[p,c]=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=()=>{i(""),m("never"),c(""),d()},f=async()=>{if(c(""),!n.trim()){c(s("access_tokens.token_label_required"));return}try{v(!0);const a=await j.post("web/profile/tokens",{json:{label:n.trim(),...x!=="never"&&{expiresAt:new Date(Date.now()+parseInt(x,10)*864e5).toISOString()}}}).json();i(""),m("never"),l({token:a.token,name:a.name})}catch(a){const k=a instanceof Error?a.message:s("access_tokens.failed_to_create_token");c(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:n,onChange:a=>i(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:x,onChange:m,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:d,onConfirm:l,tokenLabel:s,isLoading:n}){const{t:i}=_();return e.jsx(w,{isOpen:t,onClose:d,onConfirm:l,title:i("access_tokens.revoke_token_title"),message:i("access_tokens.revoke_confirm",{name:s}),confirmLabel:i("access_tokens.revoke"),confirmVariant:"danger",isLoading:n})}function $(t){const d=Date.now()-new Date(t).getTime(),l=Math.floor(d/1e3);if(l<60)return`${l}s ago`;const s=Math.floor(l/60);if(s<60)return`${s}m ago`;const n=Math.floor(s/60);return n<24?`${n} hours ago`:`${Math.floor(n/24)}d ago`}function V(){const{t}=_(),[d,l]=o.useState([]),[s,n]=o.useState(!0),[i,x]=o.useState(!1),[m,u]=o.useState(null),[v,p]=o.useState(!1),[c,b]=o.useState(null),[h,f]=o.useState(null);C(o.useMemo(()=>e.jsxs("button",{onClick:()=>x(!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{n(!0);const r=await j.get("web/profile/tokens").json();l(r)}catch{y.error(t("access_tokens.failed_to_load_tokens"))}finally{n(!1)}},[t]);o.useEffect(()=>{a()},[a]);const k=r=>{x(!1),u(r.token),p(!1),a()},g=async()=>{if(m)try{await navigator.clipboard.writeText(m),p(!0),setTimeout(()=>p(!1),2e3)}catch{}},N=async()=>{if(c)try{f(c.id),await j.post(`web/profile/tokens/${c.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:[m&&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:m}),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})}):d.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:()=>x(!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:d.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:i,onClose:()=>x(!1),onCreated:k}),e.jsx(P,{isOpen:!!c,onClose:()=>b(null),onConfirm:N,tokenLabel:(c==null?void 0:c.label)??"",isLoading:h!==null})]})}export{V as default};
@@ -0,0 +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-CluWJF_4.js";import{U as f}from"./users-D0C2zcU6.js";import{B as u}from"./bot-BlE3obwB.js";import{S as g}from"./scroll-text-B0kPxzfj.js";import{S as h}from"./settings-D3F-dJby.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};
@@ -0,0 +1 @@
1
+ import{d,a as n,h as p,r as o,j as t,K as c}from"./index-CluWJF_4.js";import{Q as h}from"./QuickAuth-DRYnjdDV.js";import"./copy-CljRO0MZ.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 k(){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(c,{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(h,{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{k as default};
@@ -0,0 +1,11 @@
1
+ import{c as h,a as S,r,f as k,j as e,i as L}from"./index-CluWJF_4.js";import{S as E}from"./Select-Coph7K6I.js";import{E as T}from"./EmptyState-BPAoLpts.js";import{T as F}from"./Skeleton-DTD8fr3E.js";import{S as A}from"./scroll-text-B0kPxzfj.js";/**
2
+ * @license lucide-react v0.469.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const P=h("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
7
+ * @license lucide-react v0.469.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const I=h("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);function U(){const{t:a}=S(),v=[{value:"",label:a("admin.all_actions")},{value:"login",label:a("admin.action_login")},{value:"logout",label:a("admin.action_logout")},{value:"create",label:a("admin.action_create")},{value:"update",label:a("admin.action_update")},{value:"delete",label:a("admin.action_delete")},{value:"revoke",label:a("admin.action_revoke")},{value:"reset_2fa",label:a("admin.action_reset_2fa")},{value:"generate_token",label:a("admin.action_generate_token")}],[d,b]=r.useState([]),[f,u]=r.useState(!0),[o,g]=r.useState(""),[n,j]=r.useState(""),[N,c]=r.useState(void 0),[x,m]=r.useState([]),[l,y]=r.useState(void 0),i=r.useCallback(async t=>{try{u(!0);const s={limit:"50"};t&&(s.cursor=t),o&&(s.action=o),n&&(s.user=n);const p=await k.get("admin/audit-logs",{searchParams:s}).json();b(p.data),y(p.nextCursor)}catch{}finally{u(!1)}},[o,n]);r.useEffect(()=>{c(void 0),m([]),i()},[i]);const _=()=>{l&&(m(t=>[...t,N??""]),c(l),i(l))},w=()=>{if(x.length===0)return;const t=[...x],s=t.pop();m(t),c(s||void 0),i(s||void 0)},C=t=>t.startsWith("delete")||t==="revoke"?"text-red-400":t.startsWith("create")||t==="generate_token"?"text-green-400":t.startsWith("update")||t==="reset_2fa"?"text-yellow-400":t==="login"?"text-blue-400":"text-[var(--text-secondary)]";return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("admin.audit_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.audit_subtitle")})]}),e.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[e.jsx(E,{value:o,onChange:g,options:v}),e.jsxs("div",{className:"relative max-w-xs",children:[e.jsx(L,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:a("admin.filter_by_user"),value:n,onChange:t=>j(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]})]}),f?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(F,{rows:5})}):d.length===0?e.jsx(T,{icon:A,title:a("admin.no_audit_entries"),description:a("admin.audit_logs_appear")}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"overflow-x-auto",children: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:"pb-2 pr-4 font-normal",children:a("admin.timestamp")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.user_id")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.action")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.resource")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.detail")}),e.jsx("th",{className:"pb-2 font-normal",children:a("admin.ip")})]})}),e.jsx("tbody",{children:d.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"whitespace-nowrap py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleString()}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.userId}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:C(t.action),children:t.action})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.resource}),e.jsx("td",{className:"max-w-xs truncate py-2.5 pr-4 text-[var(--text-muted)]",children:t.detail}),e.jsx("td",{className:"py-2.5 text-[var(--text-muted)]",children:t.ip})]},t.id))})]})}),e.jsxs("div",{className:"mt-4 flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("admin.showing_entries",{count:String(d.length)})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",disabled:x.length===0,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",onClick:w,children:[e.jsx(P,{className:"h-3.5 w-3.5"}),a("common.previous")]}),e.jsxs("button",{type:"button",disabled:!l,className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] disabled:opacity-30 disabled:cursor-not-allowed transition-colors",onClick:_,children:[a("common.next"),e.jsx(I,{className:"h-3.5 w-3.5"})]})]})]})]})]})}export{U as default};
@@ -0,0 +1,6 @@
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-CluWJF_4.js";import{S as P}from"./Select-Coph7K6I.js";import{T as $}from"./trash-2-CpNRRu-J.js";import{P as D}from"./plus-DMsT-oJS.js";import{E as q}from"./EmptyState-BPAoLpts.js";import{T}from"./Skeleton-DTD8fr3E.js";import{B as F}from"./bot-BlE3obwB.js";import{P as O}from"./pencil-BgpOCLzp.js";/**
2
+ * @license lucide-react v0.469.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const R=M("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]),U=[{value:"lark",label:"lark_(feishu)"},{value:"slack",label:"slack"}];function H({isOpen:t,onClose:h,onCreated:S,editBot:x,onEditClose:n}){const{t:o}=B(),d=!!x,[w,p]=a.useState(""),[v,j]=a.useState("lark"),[f,b]=a.useState(""),[c,u]=a.useState(""),[y,g]=a.useState(""),[N,k]=a.useState(!1),[L,m]=a.useState("");a.useEffect(()=>{t&&(x?(p(x.name),j(x.platform),b(x.appId),u(""),g("")):(p(""),j("lark"),b(""),u(""),g("")),k(!1),m(""))},[x,t]);const i=()=>{d&&n?n():h()},C=async()=>{if(m(""),!w.trim()||!f.trim()){m(o("admin.name_and_app_id_required"));return}if(!d&&!c.trim()){m(o("admin.app_secret_required"));return}const l={name:w.trim(),platform:v,appId:f.trim()};c.trim()&&(l.appSecret=c.trim()),y.trim()&&(l.webhookToken=y.trim());try{k(!0),d?await _.put(`admin/bots/${x.id}`,{json:l}).json():await _.post("admin/bots",{json:l}).json(),i(),S()}catch(E){const s=E instanceof Error?E.message:o(d?"admin.failed_to_update_bot":"admin.failed_to_create_bot");m(s)}finally{k(!1)}};return t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]",onClick:i}),e.jsxs("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsx("h3",{className:"text-sm text-[var(--text-primary)]",children:d?`// ${o("admin.edit_bot")}`:`// ${o("admin.create_bot")}`}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:i,children:e.jsx(I,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-4 px-5 py-5",children:[L&&e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:L}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:o("admin.bot_name")}),e.jsx("input",{type:"text",placeholder:"e.g. overlord lark bot",value:w,onChange:l=>p(l.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)] placeholder:text-[var(--text-muted)] focus: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:o("admin.platform")}),e.jsx(P,{value:v,onChange:j,options:U,disabled:d})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:o("admin.app_id")}),e.jsx("input",{type:"text",placeholder:"platform application id",value:f,onChange:l=>b(l.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)] placeholder:text-[var(--text-muted)] focus: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:o(d?"admin.app_secret_keep_current":"admin.app_secret")}),e.jsx("input",{type:"password",placeholder:"platform application secret",value:c,onChange:l=>u(l.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)] placeholder:text-[var(--text-muted)] focus: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:o("admin.webhook_url_optional")}),e.jsx("textarea",{placeholder:"https://...",value:y,onChange:l=>g(l.target.value),rows:2,className:"w-full resize-none rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",onClick:i,children:o("common.cancel")}),e.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:N,onClick:C,children:o(N?d?"common.saving":"common.creating":d?"common.save_changes":"common.create")})]})]})]}):null}function V({isOpen:t,bot:h,onClose:S,onUpdated:x}){const{t:n}=B(),[o,d]=a.useState([]),[w,p]=a.useState([]),[v,j]=a.useState(!1),[f,b]=a.useState(!1),[c,u]=a.useState(""),[y,g]=a.useState(""),[N,k]=a.useState(""),[L,m]=a.useState(""),i=a.useCallback(async()=>{try{const s=await _.get(`admin/bots/${h.id}/bindings`).json();d(s)}catch{}},[h.id]);a.useEffect(()=>{t&&i()},[t,i]);const C=a.useCallback(async()=>{try{const s=await _.get("web/projects").json();p(s)}catch{}},[]);a.useEffect(()=>{t&&C()},[t,C]);const l=async()=>{if(m(""),!c.trim()||!y.trim()||!N){m(n("admin.chat_binding_all_fields_required"));return}try{j(!0),await _.post(`admin/bots/${h.id}/bindings`,{json:{platformChatId:c.trim(),chatName:y.trim(),projectKey:N}}).json(),u(""),g(""),k(""),b(!1),x()}catch(s){const r=s instanceof Error?s.message:n("admin.failed_to_add_binding");m(r)}finally{j(!1)}},E=async s=>{try{await _.delete(`admin/bots/${h.id}/bindings/${s}`),d(r=>r.filter(A=>A.id!==s)),x()}catch{}};return t?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]",onClick:S}),e.jsxs("div",{className:"relative z-10 w-full max-w-[600px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsx("h3",{className:"text-sm text-[var(--text-primary)]",children:n("admin.chat_binding_title",{name:h.name})}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:S,children:e.jsx(I,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"px-5 py-5",children:[L&&e.jsx("div",{className:"mb-4 rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:L}),o.length===0&&!f?e.jsx("p",{className:"py-4 text-center text-xs text-[var(--text-muted)]",children:n("admin.chat_binding_no_bindings")}):e.jsx("div",{className:"overflow-x-auto",children: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:"pb-2 pr-4 font-normal",children:n("admin.chat_name")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:n("admin.chat_id")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:n("admin.project")}),e.jsx("th",{className:"pb-2 font-normal",children:n("common.remove")})]})}),e.jsx("tbody",{children:o.map(s=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:s.chatName}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:s.platformChatId}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:s.projectKey}),e.jsx("td",{className:"py-2.5",children:e.jsx("button",{type:"button",className:"rounded-[4px] p-1.5 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",onClick:()=>E(s.id),children:e.jsx($,{className:"h-3.5 w-3.5"})})})]},s.id))})]})}),f&&e.jsxs("div",{className:"mt-4 space-y-3 rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] p-4",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:n("admin.chat_binding_add")}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:n("admin.chat_id")}),e.jsx("input",{type:"text",placeholder:n("admin.chat_binding_id_placeholder"),value:c,onChange:s=>u(s.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)] placeholder:text-[var(--text-muted)] focus: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:n("admin.chat_name")}),e.jsx("input",{type:"text",placeholder:n("admin.chat_binding_name_placeholder"),value:y,onChange:s=>g(s.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)] placeholder:text-[var(--text-muted)] focus: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:n("admin.project")}),e.jsx(P,{value:N,onChange:k,options:w.map(s=>({value:s.key,label:`${s.name} (${s.key})`})),placeholder:n("admin.chat_binding_select_project")})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",onClick:()=>b(!1),children:n("common.cancel")}),e.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:v,onClick:l,children:n(v?"admin.chat_binding_adding":"admin.add_binding")})]})]})]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-[var(--border)] px-5 py-4",children:[e.jsx("div",{children:!f&&e.jsxs("button",{type:"button",className:"flex items-center gap-1 rounded-[4px] border border-[var(--border)] px-2.5 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:border-[var(--accent)] transition-colors",onClick:()=>b(!0),children:[e.jsx(D,{className:"h-3.5 w-3.5"}),n("admin.add_binding")]})}),e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",onClick:S,children:n("common.close")})]})]})]}):null}function te(){const{t}=B(),[h,S]=a.useState([]),[x,n]=a.useState(!0),[o,d]=a.useState(!1),[w,p]=a.useState(null),[v,j]=a.useState(null),[f,b]=a.useState(!1),[c,u]=a.useState(null),[y,g]=a.useState(!1),[N,k]=a.useState([]),[L,m]=a.useState(!0),i=a.useCallback(async()=>{try{n(!0);const r=await _.get("admin/bots").json();S(r)}catch{}finally{n(!1)}},[]),C=a.useCallback(async()=>{try{m(!0);const r=await _.get("admin/bots/all-bindings").json();k(r)}catch{}finally{m(!1)}},[]);a.useEffect(()=>{i(),C()},[i,C]);const l=async()=>{if(c){g(!0);try{await _.delete(`admin/bots/${c.id}`),b(!1),u(null),i()}catch{K.error(t("admin.failed_to_delete_bot"))}finally{g(!1)}}},E=r=>{switch(r){case"lark":return"text-blue-400";case"slack":return"text-yellow-400";default:return"text-[var(--text-secondary)]"}},s=r=>{switch(r){case"active":return"text-green-400";case"inactive":return"text-[var(--text-muted)]";case"error":return"text-red-400";default:return"text-[var(--text-muted)]"}};return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:t("admin.bots_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:t("admin.bots_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>{p(null),d(!0)},children:[e.jsx(D,{className:"h-3.5 w-3.5"}),t("admin.create_bot")]})]}),x?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(T,{rows:3})}):h.length===0?e.jsx(q,{icon:F,title:t("admin.no_bots_configured"),description:t("admin.add_bot_desc"),actionLabel:t("admin.create_bot"),onAction:()=>{p(null),d(!0)}}):e.jsx("div",{className:"overflow-x-auto",children: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:"pb-2 pr-4 font-normal",children:t("admin.bot_name")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:t("admin.platform")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:t("admin.app_id")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:t("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:t("common.created_at")}),e.jsx("th",{className:"pb-2 font-normal",children:t("common.actions")})]})}),e.jsx("tbody",{children:h.map(r=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:r.name}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:E(r.platform),children:r.platform})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:r.appId}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:s(r.status),children:r.status})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(r.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5",children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{type:"button",className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-white/[0.05] transition-colors",title:t("common.edit"),onClick:()=>p(r),children:e.jsx(O,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-white/[0.05] transition-colors",title:t("admin.chat_bindings"),onClick:()=>j(r),children:e.jsx(R,{className:"h-3.5 w-3.5"})}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1.5 text-red-400 hover:text-red-300 hover:bg-white/[0.05] transition-colors",title:t("common.delete"),onClick:()=>{u(r),b(!0)},children:e.jsx($,{className:"h-3.5 w-3.5"})})]})})]},r.id))})]})}),e.jsx(H,{isOpen:o||!!w,onClose:()=>{d(!1),p(null)},onCreated:i,editBot:w,onEditClose:()=>p(null)}),v&&e.jsx(V,{isOpen:!!v,bot:v,onClose:()=>j(null),onUpdated:()=>{i(),C()}}),e.jsx(z,{isOpen:f,onClose:()=>{b(!1),u(null)},onConfirm:l,title:t("admin.delete_bot"),message:t("admin.delete_bot_confirm",{name:(c==null?void 0:c.name)??""}),confirmLabel:t("common.delete"),confirmVariant:"danger",isLoading:y}),e.jsxs("div",{className:"mt-8",children:[e.jsxs("h2",{className:"mb-4 text-sm text-[var(--text-primary)]",children:[t("admin.chat_bindings"),e.jsx("span",{className:"ml-2 text-[var(--text-muted)]",children:t("admin.chat_bindings_subtitle")})]}),L?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(T,{rows:3})}):N.length===0?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-8 text-center",children:e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:t("admin.no_chat_bindings")})}):e.jsx("div",{className:"overflow-x-auto",children: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:"pb-2 pr-4 font-normal",children:t("admin.bot")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:t("admin.platform")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:t("admin.chat_id")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:t("admin.chat_name")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:t("admin.project")}),e.jsx("th",{className:"pb-2 font-normal",children:t("common.created_at")})]})}),e.jsx("tbody",{children:N.map(r=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:r.botName}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:E(r.platform),children:r.platform})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:r.platformChatId}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:r.chatName??"-"}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:r.projectKey??"-"}),e.jsx("td",{className:"py-2.5 text-[var(--text-muted)]",children:new Date(r.createdAt).toLocaleDateString()})]},r.id))})]})})]})]})}export{te as default};
@@ -0,0 +1,4 @@
1
+ import{d as l,a as i,h as m,r as n,j as e,K as p,C as v}from"./index-CluWJF_4.js";import{Q as u}from"./QuickAuth-DRYnjdDV.js";import{C as g}from"./copy-CljRO0MZ.js";const x=[{command:"ov login",description:"authenticate with the overlord server using a personal access token",usage:"ov login",example:`ov login
2
+ > Enter server URL: http://localhost:9000
3
+ > Enter PAT: ov_pat_xxxxx
4
+ ✓ Logged in as admin`},{command:"ov logout",description:"clear stored credentials",usage:"ov logout"},{command:"ov whoami",description:"show current authenticated user",usage:"ov whoami"},{command:"ov task create",description:"create a new task",usage:"ov task create -d <description> [-p <project>] [--on <machine>]",flags:[{flag:"-d, --description",desc:"task description (required unless -f)"},{flag:"-p, --project",desc:"project key to assign the task to"},{flag:"--on",desc:"target machine id (optional)"},{flag:"-f, --file",desc:"create task from yaml file"}],example:'ov task create -d "fix login bug" -p overlord'},{command:"ov task list",description:"list all tasks with optional filters",usage:"ov task list [--status <status>] [-p <project>]",flags:[{flag:"--status",desc:"filter by status (RUNNING, QUEUED, COMPLETED, FAILED, CANCELLED)"},{flag:"-p, --project",desc:"filter by project key"}]},{command:"ov task show <id>",description:"show detailed information about a task",usage:"ov task show <task_id>"},{command:"ov task cancel <id>",description:"cancel a running or queued task",usage:"ov task cancel <task_id>"},{command:"ov task retry <id>",description:"retry a failed task",usage:"ov task retry <task_id>"},{command:"ov task logs <id>",description:"view task logs (streams via pty if active, fetches historical otherwise)",usage:"ov task logs <task_id> [--json]",flags:[{flag:"--json",desc:"output as json"}]},{command:"ov task confirm <id>",description:"confirm a suspended task stage",usage:"ov task confirm <task_id> --stage <index>",flags:[{flag:"--stage <index>",desc:"stage index to confirm (required)"}]},{command:"ov task choose <id> <option>",description:"submit a choice for a suspended task",usage:"ov task choose <task_id> <option> --stage <index>",flags:[{flag:"--stage <index>",desc:"stage index to respond to (required)"}]},{command:"ov task input <id> <text>",description:"submit text input for a suspended task",usage:"ov task input <task_id> <text> --stage <index>",flags:[{flag:"--stage <index>",desc:"stage index to respond to (required)"}]},{command:"ov attach <id>",description:"connect to a task pty terminal",usage:"ov attach <task_id> [--watch] [--takeover] [--session <id>]",flags:[{flag:"--watch",desc:"read-only observer mode"},{flag:"--takeover",desc:"take over pty control from current user"},{flag:"--session <id>",desc:"session id for takeover"}]},{command:"ov project list",description:"list all projects",usage:"ov project list"},{command:"ov project show <key>",description:"show project details",usage:"ov project show <project_key>"},{command:"ov machine list",description:"list all registered machines",usage:"ov machine list"},{command:"ov machine show <id>",description:"show machine details",usage:"ov machine show <machine_id>"},{command:"ov notifications",description:"view your notifications",usage:"ov notifications [--all] [--json]",flags:[{flag:"--all",desc:"show all notifications (including read)"},{flag:"--json",desc:"output as json"}]},{command:"ov notifications read <id>",description:"mark a notification as read",usage:"ov notifications read <notification_id>"},{command:"ov search <query>",description:"search across tasks, machines, and projects",usage:"ov search <query>"},{command:"ov config set <key> <value>",description:"set a configuration value",usage:"ov config set <key> <value>",flags:[{flag:"server",desc:"overlord server url"},{flag:"default-project",desc:"default project key"},{flag:"output-format",desc:"output format (table, json)"},{flag:"color",desc:"enable/disable color (true/false)"}]},{command:"ov config get <key>",description:"get a configuration value",usage:"ov config get <key>"},{command:"ov config list",description:"list all configuration values",usage:"ov config list [--json]"}],f=[{command:"overlord install",description:"interactive server installation wizard — checks environment, configures database, creates admin account",usage:"overlord install"},{command:"overlord setup worker",description:"interactive worker setup wizard — configures connection, writes .env, registers service",usage:"overlord setup worker"},{command:"overlord start [component]",description:"start server or worker services (systemd / launchd)",usage:"overlord start [server|worker]"},{command:"overlord stop [component]",description:"stop running processes",usage:"overlord stop [server|worker]"},{command:"overlord status",description:"show process status table (pid, cpu, memory, uptime)",usage:"overlord status"},{command:"overlord logs [component]",description:"view server or worker logs",usage:"overlord logs [server|worker] [--lines <n>]"},{command:"overlord doctor",description:"run system diagnostics",usage:"overlord doctor"},{command:"overlord upgrade",description:"upgrade to latest release with sha256 verification",usage:"overlord upgrade [--version <tag>]"}];function d({text:a}){const[t,o]=n.useState(!1),{t:s}=i();return e.jsx("button",{onClick:async()=>{await navigator.clipboard.writeText(a),o(!0),setTimeout(()=>o(!1),2e3)},className:"rounded-[4px] p-1 text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",title:s("common.copy"),children:t?e.jsx(v,{className:"h-3 w-3 text-[var(--accent)]"}):e.jsx(g,{className:"h-3 w-3"})})}function c({title:a,commands:t}){const{t:o}=i();return e.jsxs("div",{children:[e.jsxs("h2",{className:"mb-4 text-sm text-[var(--accent)]",children:["> ",a]}),e.jsx("div",{className:"space-y-3",children:t.map(s=>e.jsxs("details",{className:"group rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)]",children:[e.jsx("summary",{className:"flex cursor-pointer items-center justify-between px-4 py-3 hover:bg-[var(--bg-input)] transition-colors",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("code",{className:"text-xs text-[var(--accent)]",children:s.command}),e.jsxs("span",{className:"text-xs text-[var(--text-muted)]",children:["// ",s.description]})]})}),e.jsxs("div",{className:"border-t border-[var(--border)] px-4 py-3 space-y-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:o("docs.usage")}),e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"text-xs text-[var(--text-primary)]",children:s.usage}),e.jsx(d,{text:s.usage})]})]}),s.flags&&s.flags.length>0&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:o("docs.flags")}),e.jsx("div",{className:"space-y-1",children:s.flags.map(r=>e.jsxs("div",{className:"flex items-start gap-3 text-xs",children:[e.jsx("code",{className:"shrink-0 text-[var(--accent)]",children:r.flag}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:r.desc})]},r.flag))})]}),s.example&&e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-[10px] uppercase tracking-wider text-[var(--text-muted)]",children:o("docs.example")}),e.jsx("pre",{className:"rounded-[4px] bg-[var(--bg-primary)] px-3 py-2 text-xs text-[var(--text-secondary)] whitespace-pre-wrap",children:s.example})]})]})]},s.command))})]})}function y(){const a=l(),{t}=i();return m(n.useMemo(()=>e.jsxs("button",{onClick:()=>a("/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:[e.jsx(p,{className:"h-3.5 w-3.5"}),t("access_tokens.create_token")]}),[a,t])),e.jsxs("div",{className:"mx-auto max-w-4xl px-6 py-8 font-mono lowercase",children:[e.jsx("div",{className:"mb-8",children:e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:t("docs.cli_tools_desc",{ov:"ov",overlord:"overlord"})})}),e.jsx(u,{mode:"cli"}),e.jsxs("div",{className:"mb-8 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("p",{className:"mb-2 text-xs text-[var(--text-muted)]",children:t("docs.quick_install")}),e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] bg-[var(--bg-primary)] px-3 py-2",children:[e.jsx("code",{className:"text-xs text-[var(--accent)]",children:"npm install -g @overlordai/developer-cli"}),e.jsx(d,{text:"npm install -g @overlordai/developer-cli"})]})]}),e.jsxs("div",{className:"space-y-8",children:[e.jsx(c,{title:t("docs.developer_cli"),commands:x}),e.jsx(c,{title:t("docs.admin_cli"),commands:f})]})]})}export{y as default};
@@ -0,0 +1,16 @@
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-CluWJF_4.js";import{S as D}from"./Select-Coph7K6I.js";import{E as O}from"./EmptyState-BPAoLpts.js";import{T}from"./Skeleton-DTD8fr3E.js";import{P}from"./plus-DMsT-oJS.js";import{U as q}from"./users-D0C2zcU6.js";import{P as $}from"./pencil-BgpOCLzp.js";import{R as F}from"./rotate-ccw-D8Wc0cH7.js";/**
2
+ * @license lucide-react v0.469.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const U=k("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
7
+ * @license lucide-react v0.469.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const X=k("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/**
12
+ * @license lucide-react v0.469.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const G=k("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]),H=[{value:"developer",label:"developer"},{value:"lead",label:"lead"},{value:"admin",label:"admin"}];function Z({isOpen:a,onClose:n,onCreated:c}){const{t:o}=_(),[r,x]=s.useState(""),[l,b]=s.useState(""),[m,p]=s.useState(""),[d,v]=s.useState(""),[y,u]=s.useState("developer"),[h,g]=s.useState(!1),[N,i]=s.useState(""),t=()=>{x(""),b(""),p(""),v(""),u("developer"),i("")},j=()=>{t(),n()},z=async()=>{if(i(""),!r.trim()||!l.trim()||!m.trim()||!d.trim()){i(o("admin.all_fields_required"));return}if(d.length<10||d.length>20){i(o("admin.password_length_error"));return}const f=/[a-zA-Z]/.test(d),L=/\d/.test(d),R=/[^a-zA-Z0-9]/.test(d);if(!f||!L||!R){i(o("admin.password_complexity_error"));return}try{g(!0),await w.post("admin/developers",{json:{name:r.trim(),gitName:l.trim(),gitEmail:m.trim(),password:d,role:y}}).json(),j(),c()}catch(C){const A=C instanceof Error?C.message:o("admin.failed_to_create_developer");i(A)}finally{g(!1)}};return a?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]",onClick:j}),e.jsxs("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsxs("h3",{className:"text-sm text-[var(--text-primary)]",children:["// ",o("admin.create_developer_title")]}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:j,children:e.jsx(S,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-4 px-5 py-5",children:[N&&e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:N}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:o("common.name")}),e.jsx("input",{type:"text",placeholder:"e.g. jdoe",value:r,onChange:f=>x(f.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)] placeholder:text-[var(--text-muted)] focus: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:o("profile.git_name")}),e.jsx("input",{type:"text",placeholder:"e.g. John Doe",value:l,onChange:f=>b(f.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)] placeholder:text-[var(--text-muted)] focus: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:o("profile.git_email")}),e.jsx("input",{type:"email",placeholder:"e.g. john@example.com",value:m,onChange:f=>p(f.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)] placeholder:text-[var(--text-muted)] focus: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:o("auth.password")}),e.jsx("input",{type:"password",placeholder:"10-20 chars, letters + digits + special",value:d,onChange:f=>v(f.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)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"}),e.jsx("p",{className:"mt-1 text-[10px] text-[var(--text-muted)]",children:o("admin.password_hint")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:o("common.role")}),e.jsx(D,{value:y,onChange:u,options:H})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",onClick:j,children:o("common.cancel")}),e.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:h,onClick:z,children:o(h?"common.creating":"common.create")})]})]})]}):null}const I=[{value:"developer",label:"developer"},{value:"lead",label:"lead"},{value:"admin",label:"admin"}];function J({isOpen:a,developer:n,onClose:c,onUpdated:o}){const{t:r}=_(),x=E(i=>i.user),[l,b]=s.useState(n.name),[m,p]=s.useState(n.role),[d,v]=s.useState(!1),[y,u]=s.useState(""),g=n.id===(x==null?void 0:x.id)&&n.role==="admin"&&m!=="admin";s.useEffect(()=>{b(n.name),p(n.role),u("")},[n]);const N=async()=>{if(u(""),!l.trim()){u(r("admin.display_name_required"));return}g&&u(r("admin.demote_self_warning"));try{v(!0),await w.put(`admin/developers/${n.id}`,{json:{name:l.trim(),role:m}}).json(),c(),o()}catch(i){const t=i instanceof Error?i.message:r("admin.failed_to_update_developer");u(t)}finally{v(!1)}};return a?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]",onClick:c}),e.jsxs("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsxs("h3",{className:"text-sm text-[var(--text-primary)]",children:["// ",r("admin.edit_developer_title")]}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:c,children:e.jsx(S,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-4 px-5 py-5",children:[y&&e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:y}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:r("common.name")}),e.jsx("input",{type:"text",value:n.name,readOnly:!0,disabled:!0,className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] px-3 py-2 text-xs text-[var(--text-muted)] opacity-60"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs text-[var(--text-muted)]",children:r("admin.display_name")}),e.jsx("input",{type:"text",value:l,onChange:i=>b(i.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)] placeholder:text-[var(--text-muted)] focus: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:r("common.role")}),e.jsx(D,{value:m,onChange:p,options:I}),g&&e.jsx("div",{className:"mt-2 rounded-[4px] border border-[var(--warning)] bg-[var(--warning)]/10 px-3 py-2 text-xs text-[var(--warning)]",children:r("admin.demote_self_inline_warning")})]})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",onClick:c,children:r("common.cancel")}),e.jsx("button",{type:"button",className:"rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity disabled:opacity-50",disabled:d,onClick:N,children:r(d?"common.saving":"common.save_changes")})]})]})]}):null}function V({isOpen:a,developer:n,onClose:c,onConfirmed:o}){const{t:r}=_(),[x,l]=s.useState(!1),[b,m]=s.useState(""),p=async()=>{m("");try{l(!0),await w.put(`admin/developers/${n.id}/reset-totp`),c(),o()}catch(d){const v=d instanceof Error?d.message:r("admin.failed_to_reset_2fa");m(v)}finally{l(!1)}};return a?e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{backdropFilter:"blur(2px)"},children:[e.jsx("div",{className:"fixed inset-0 bg-[var(--modal-backdrop)]",onClick:c}),e.jsxs("div",{className:"relative z-10 w-full max-w-[480px] rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] px-5 py-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(U,{className:"h-4 w-4 text-yellow-400"}),e.jsxs("h3",{className:"text-sm text-[var(--text-primary)]",children:["// ",r("admin.reset_2fa")]})]}),e.jsx("button",{type:"button",className:"rounded-[4px] p-1 text-[var(--text-muted)] hover:text-[var(--text-primary)] transition-colors",onClick:c,children:e.jsx(S,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-3 px-5 py-5",children:[b&&e.jsx("div",{className:"rounded-[4px] border border-red-500/30 bg-red-500/10 px-3 py-2 text-xs text-red-400",children:b}),e.jsxs("p",{className:"text-xs text-[var(--text-primary)]",children:[r("admin.reset_2fa_confirm_message")," ",e.jsx("span",{className:"text-[var(--accent)]",children:n.name}),"?"]}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:r("admin.reset_2fa_audit_note")})]}),e.jsxs("div",{className:"flex items-center justify-end gap-2 border-t border-[var(--border)] px-5 py-4",children:[e.jsx("button",{type:"button",className:"rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",onClick:c,children:r("common.cancel")}),e.jsx("button",{type:"button",className:"rounded-[4px] bg-yellow-600 px-3 py-1.5 text-xs text-white hover:opacity-90 transition-opacity disabled:opacity-50",disabled:x,onClick:p,children:r(x?"admin.resetting":"admin.reset_2fa")})]})]})]}):null}function re(){const{t:a}=_(),n=E(t=>t.user),[c,o]=s.useState([]),[r,x]=s.useState(!0),[l,b]=s.useState(""),[m,p]=s.useState(!1),[d,v]=s.useState(null),[y,u]=s.useState(null),h=s.useCallback(async()=>{try{x(!0);const t={};l&&(t.q=l);const j=await w.get("admin/developers",{searchParams:t}).json();o(j)}catch{}finally{x(!1)}},[l]);s.useEffect(()=>{h()},[h]);const g=async t=>{const j=t.status==="active"?"suspended":"active";try{await w.put(`admin/developers/${t.id}`,{json:{status:j}}),h()}catch{}},N=t=>{switch(t){case"active":return"text-green-400";case"inactive":return"text-[var(--text-muted)]";case"suspended":return"text-red-400";default:return"text-[var(--text-muted)]"}},i=t=>{switch(t){case"admin":return"text-yellow-400";case"developer":return"text-blue-400";default:return"text-[var(--text-secondary)]"}};return e.jsxs("div",{className:"font-mono",children:[e.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm text-[var(--text-primary)]",children:a("admin.developers_title")}),e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:a("admin.developers_subtitle")})]}),e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-[4px] bg-[var(--accent)] px-3 py-1.5 text-xs text-black hover:opacity-90 transition-opacity",onClick:()=>p(!0),children:[e.jsx(P,{className:"h-3.5 w-3.5"}),a("admin.create_developer")]})]}),e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"relative max-w-xs",children:[e.jsx(M,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--text-muted)]"}),e.jsx("input",{type:"text",placeholder:a("admin.search_developers"),value:l,onChange:t=>b(t.target.value),className:"w-full rounded-[4px] border border-[var(--border)] bg-[var(--bg-input)] py-1.5 pl-8 pr-3 text-xs text-[var(--text-primary)] placeholder:text-[var(--text-muted)] focus:outline-none focus:border-[var(--accent)]"})]})}),r?e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx(T,{rows:4})}):c.length===0?e.jsx(O,{icon:q,title:a(l?"admin.no_matching_developers":"admin.no_developers_found"),description:a(l?"admin.try_adjusting_search":"admin.create_first_developer"),actionLabel:l?void 0:a("admin.create_developer"),onAction:l?void 0:()=>p(!0)}):e.jsx("div",{className:"overflow-x-auto",children: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:"pb-2 pr-4 font-normal",children:a("admin.dev_name")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.display_name")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.role")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.status")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("admin.totp")}),e.jsx("th",{className:"pb-2 pr-4 font-normal",children:a("common.created_at")}),e.jsx("th",{className:"pb-2 font-normal",children:a("common.actions")})]})}),e.jsx("tbody",{children:c.map(t=>e.jsxs("tr",{className:"border-b border-[var(--border-row)] hover:bg-white/[0.02] transition-colors",children:[e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-primary)]",children:t.name}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-secondary)]",children:t.gitName}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:i(t.role),children:t.role})}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:N(t.status),children:t.status})}),e.jsx("td",{className:"py-2.5 pr-4",children:e.jsx("span",{className:t.totpEnabled?"text-green-400":"text-[var(--text-muted)]",children:t.totpEnabled?a("common.enabled"):a("common.disabled")})}),e.jsx("td",{className:"py-2.5 pr-4 text-[var(--text-muted)]",children:new Date(t.createdAt).toLocaleDateString()}),e.jsx("td",{className:"py-2.5",children:e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{type:"button",className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-white/[0.05] transition-colors",title:a("common.edit"),onClick:()=>v(t),children:e.jsx($,{className:"h-3.5 w-3.5"})}),t.id!==(n==null?void 0:n.id)&&e.jsx("button",{type:"button",className:"rounded-[4px] p-1.5 text-[var(--text-secondary)] hover:text-[var(--text-primary)] hover:bg-white/[0.05] transition-colors",title:a("admin.reset_2fa"),onClick:()=>u(t),children:e.jsx(F,{className:"h-3.5 w-3.5"})}),t.id!==(n==null?void 0:n.id)&&e.jsx("button",{type:"button",className:`rounded-[4px] p-1.5 transition-colors hover:bg-white/[0.05] ${t.status==="active"?"text-red-400 hover:text-red-300":"text-green-400 hover:text-green-300"}`,title:t.status==="active"?a("admin.deactivate"):a("admin.activate"),onClick:()=>g(t),children:t.status==="active"?e.jsx(G,{className:"h-3.5 w-3.5"}):e.jsx(X,{className:"h-3.5 w-3.5"})})]})})]},t.id))})]})}),e.jsx(Z,{isOpen:m,onClose:()=>p(!1),onCreated:h}),d&&e.jsx(J,{isOpen:!!d,developer:d,onClose:()=>v(null),onUpdated:h}),y&&e.jsx(V,{isOpen:!!y,developer:y,onClose:()=>u(null),onConfirmed:h})]})}export{re as default};
@@ -0,0 +1,2 @@
1
+ import{m as ne,d as oe,a as le,r as a,f as u,j as e,L as ce,t as y}from"./index-CluWJF_4.js";import{G as m,A as d}from"./protocol-C4f2G7mk.js";import{S as W}from"./Select-Coph7K6I.js";import{U as de,A as ie,R as pe}from"./RemoveMemberConfirmDialog-B1Wfe6qD.js";import{P as xe}from"./plus-DMsT-oJS.js";function ge(){const{key:o}=ne(),l=oe(),{t:r}=le(),[n,X]=a.useState(null),[N,Q]=a.useState([]),[V,Y]=a.useState(!0),[C,b]=a.useState(!1),[v,w]=a.useState(""),[j,S]=a.useState(""),[_,k]=a.useState(m.GITHUB),[T,M]=a.useState(""),[O,P]=a.useState(d.CLAUDE),[R,A]=a.useState(""),[I,U]=a.useState("50"),[D,E]=a.useState(""),[$,G]=a.useState(""),[L,B]=a.useState(""),[F,J]=a.useState("0"),[g,q]=a.useState(!1),[i,h]=a.useState(""),[Z,z]=a.useState(!1),[c,f]=a.useState(null),[ee,H]=a.useState(!1),p=a.useCallback(async()=>{if(o)try{const[t,x]=await Promise.all([u.get(`web/projects/${o}`).json(),u.get(`admin/projects/${o}/members`).json().catch(()=>[])]);if(X(t),Q(x),w(t.name),S(t.repoUrl),k(t.gitPlatform),M(t.defaultBranch),P(t.agentType),A(t.agentCommand??""),U(String(t.maxTurns)),E(t.workspaceRoot??""),G(t.setupCommands??""),B(t.testCommand??""),J(String(t.ptyOutputFilter??0)),q(t.isDefault),t.pipeline)try{h(JSON.stringify(JSON.parse(t.pipeline),null,2))}catch{h(t.pipeline)}}catch{}finally{Y(!1)}},[o]);a.useEffect(()=>{p()},[p]);async function te(t){if(t.preventDefault(),!n)return;b(!0);let x=null;if(i.trim())try{JSON.parse(i),x=i.trim()}catch{y.error(r("projects.invalid_pipeline_json")),b(!1);return}try{await u.put(`admin/projects/${n.key}`,{json:{name:v,repoUrl:j,defaultBranch:T,gitPlatform:_,agentType:O,agentCommand:R||null,maxTurns:parseInt(I,10)||50,workspaceRoot:D||null,setupCommands:$||null,testCommand:L||null,ptyOutputFilter:parseInt(F,10)||0,pipeline:x}}),y.success(r("projects.project_saved")),l(`/projects/${n.key}`)}catch(K){const se=K instanceof Error?K.message:r("projects.failed_to_save_project");y.error(se)}finally{b(!1)}}function re(){l(`/projects/${o}`)}async function ae(){if(!(!n||!c)){H(!0);try{await u.delete(`admin/projects/${n.key}/members`,{searchParams:{developerId:String(c.developerId)}}),await p()}catch{}finally{H(!1),f(null)}}}return V?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:te,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:v,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:j,onChange:t=>S(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.git_platform"),children:e.jsx(W,{value:_,onChange:t=>k(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:T,onChange:t=>M(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(W,{value:O,onChange:t=>P(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:I,onChange:t=>U(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:D,onChange:t=>E(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:$,onChange:t=>G(t.target.value),rows:3,placeholder:`npm install
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:L,onChange:t=>B(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:F,onChange:t=>J(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:()=>q(!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(ce,{to:"/projects/"+o+"/pipeline",className:"text-xs text-[var(--accent)] hover:underline",children:r("projects.edit_pipeline")})]}),e.jsx("textarea",{value:i,onChange:t=>h(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:()=>z(!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(xe,{className:"h-3.5 w-3.5"}),r("projects.add_member")]})]}),N.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:N.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:String(t.developerId).charAt(0).toUpperCase()}),e.jsxs("div",{children:[e.jsxs("span",{className:"text-xs text-[var(--text-primary)]",children:["#",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:()=>f(t),className:"text-[var(--destructive)] hover:opacity-70 transition-opacity","aria-label":r("projects.remove_member"),children:e.jsx(de,{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:re,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||!v||!j,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(ie,{isOpen:Z,onClose:()=>z(!1),projectKey:n.key,onAdded:p}),e.jsx(pe,{isOpen:!!c,onClose:()=>f(null),onConfirm:ae,memberName:c?String(c.developerId):"",loading:ee})]}):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{ge as default};
@@ -0,0 +1,6 @@
1
+ import{c as o,j as e}from"./index-CluWJF_4.js";/**
2
+ * @license lucide-react v0.469.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const n=o("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);function l({icon:s=n,title:x,description:t,actionLabel:a,onAction:r,action:d,compact:c=!1}){return e.jsxs("div",{className:`flex flex-col items-center justify-center gap-4 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] font-mono ${c?"py-8 px-6":"py-16 px-8"}`,children:[e.jsx(s,{className:"h-8 w-8 text-[var(--border)]",strokeWidth:1.5}),e.jsxs("span",{className:"text-sm font-bold text-[var(--text-muted)]",children:["// ",x]}),t&&e.jsx("p",{className:"max-w-sm text-center text-xs text-[var(--text-muted)]",children:t}),a&&r&&e.jsx("button",{type:"button",onClick:r,className:"rounded-[4px] bg-[var(--accent)] px-5 py-2 text-[11px] font-bold text-black",children:a}),d]})}export{l as E};
@@ -0,0 +1 @@
1
+ import{d as H,a as A,u as q,r,f as b,j as e,L as p}from"./index-CluWJF_4.js";import{M as o}from"./protocol-C4f2G7mk.js";import{T as R}from"./TaskStatusBadge-CTYxCsEO.js";import{T as f}from"./Skeleton-DTD8fr3E.js";import{A as j}from"./arrow-right-CW48svkF.js";const G=3e4,P=[{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"}],V=["mon","tue","wed","thu","fri","sat","sun"];function g(l){const a=Date.now(),x=new Date(l).getTime(),d=a-x,n=Math.floor(d/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const t=Math.floor(n/60);return t<24?`${t}h ago`:`${Math.floor(t/24)}d ago`}function z(l,a){return l.length<=a?l:l.slice(0,a)+"..."}function Y({dailyRates:l,overallRate:a}){const{t:x}=A(),d=V.map((t,i)=>({label:t,value:l[i]??0})),n=Math.max(...d.map(t=>t.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:[a,"%"]}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:x("dashboard.last_7_days")})]}),e.jsx("div",{className:"flex gap-2",style:{height:80},children:d.map(t=>{const i=n>0?Math.max(t.value/n*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:`${i}%`,backgroundColor:t.value>=80?"var(--accent)":t.value>=50?"var(--warning)":"var(--destructive)"}})}),e.jsx("span",{className:"shrink-0 text-[10px] text-[var(--text-muted)]",children:t.label})]},t.label)})})]})}function Z(){const l=H(),{t:a}=A(),x=q(s=>{var c;return((c=s.user)==null?void 0:c.role)==="admin"}),[d,n]=r.useState(null),[t,i]=r.useState([]),[N,T]=r.useState([]),[y,w]=r.useState([]),[k,C]=r.useState(!0),[E,I]=r.useState(!0),[D,$]=r.useState(!0),[F,K]=r.useState(!0),m=r.useCallback(async()=>{try{const s=await b.get("web/dashboard/stats").json();n(s)}catch{}finally{C(!1)}},[]),h=r.useCallback(async()=>{try{const s=await b.get("web/dashboard/recent-tasks",{searchParams:{limit:"5"}}).json();i(s)}catch{}finally{I(!1)}},[]),_=r.useCallback(async()=>{try{const s=await b.get("web/machines").json();T(s)}catch{}finally{$(!1)}},[]),S=r.useCallback(async()=>{try{const s=await b.get("web/dashboard/recent-activity").json();w(s)}catch{w([])}finally{K(!1)}},[]);r.useEffect(()=>{m(),h(),_(),S()},[m,h,_,S]);const u=r.useRef(null);r.useEffect(()=>(u.current=setInterval(()=>{m(),h()},G),()=>{u.current&&clearInterval(u.current)}),[m,h]);const L=(d==null?void 0:d.success_rate_daily)??null,M=(d==null?void 0:d.task_success_rate_7d)??0;function O(s){switch(s){case o.ONLINE:return"var(--accent)";case o.DRAINING:return"var(--warning)";case o.OFFLINE:default:return"var(--text-muted)"}}function B(s){switch(s){case o.ONLINE:return a("dashboard.online");case o.DRAINING:return a("dashboard.idle");case o.OFFLINE:default:return a("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:["// ",a("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:P.map(({key:s,labelKey:c})=>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:[a(c),":"]}),k?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:(d==null?void 0:d[s])??0})})]},s))}),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:a("dashboard.task_success_rate")})}),e.jsx("div",{className:"flex flex-1 flex-col justify-center p-5",children:k?e.jsx("div",{className:"h-24 animate-pulse rounded bg-[var(--bg-input)]"}):L?e.jsx(Y,{dailyRates:L,overallRate:M}):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:[M,"%"]}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:a("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:a("dashboard.recent_tasks")}),e.jsxs(p,{to:"/tasks",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[a("common.view_all")," ",e.jsx(j,{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:a("dashboard.recent_tasks")})}),e.jsx("div",{className:"px-3 pb-3 md:p-4",children:E?e.jsx(f,{rows:4}):t.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:a("dashboard.no_tasks_yet")})]}):e.jsx("div",{className:"flex flex-col gap-2 md:gap-0",children:t.map(s=>e.jsxs("div",{onClick:()=>l(`/tasks/${s.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:["#",s.id," ",s.description]}),e.jsx("span",{className:"shrink-0",children:e.jsx(R,{status:s.status})})]}),e.jsx("span",{className:"text-[9px] text-[var(--text-muted)] mt-1 block",children:g(s.created_at)})]}),e.jsxs("span",{className:"hidden md:inline shrink-0 text-xs text-[var(--text-muted)]",children:["#",s.id]}),e.jsx("span",{className:"hidden md:inline flex-1 text-xs text-[var(--text-primary)] truncate",children:z(s.description,40)}),e.jsx("span",{className:"hidden md:inline",children:e.jsx(R,{status:s.status})}),e.jsx("span",{className:"hidden md:inline shrink-0 text-xs text-[var(--text-muted)]",children:g(s.created_at)})]},s.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:a("dashboard.worker_status")}),e.jsxs(p,{to:"/machines",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[a("common.view_all")," ",e.jsx(j,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-4",children:D?e.jsx(f,{rows:3}):N.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:a("dashboard.no_workers_registered")})]}):e.jsx("div",{className:"flex flex-col",children:N.map(s=>e.jsxs("div",{onClick:()=>l(`/machines/${s.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:s.name}),e.jsx("span",{className:"text-xs text-[var(--text-muted)]",children:s.host??"--"})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-xs text-[var(--text-secondary)]",children:[s.activeSlots,"/",s.maxSlots," ",a("dashboard.slots")]}),e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs",style:{color:O(s.status)},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),B(s.status)]})]})]},s.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:a("dashboard.recent_activity")}),x&&e.jsxs(p,{to:"/admin/audit-logs",className:"flex items-center gap-1 text-xs text-[var(--accent)] hover:underline",children:[a("common.view_all")," ",e.jsx(j,{className:"h-3 w-3"})]})]}),e.jsx("div",{className:"p-4",children:F?e.jsx(f,{rows:4}):y.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:a("dashboard.no_recent_activity")})]}):e.jsx("div",{className:"flex flex-col",children:y.map(s=>{const c=s.message.match(/task\s*#?(\d+)/i),v=c?c[1]:null;return e.jsxs("div",{className:`flex items-start gap-3 border-b border-[var(--border-row)] py-2 last:border-b-0 ${v?"cursor-pointer hover:bg-[var(--bg-input)] transition-colors":""}`,onClick:()=>v&&l(`/tasks/${v}`),children:[e.jsx("span",{className:"shrink-0 text-xs text-[var(--text-muted)]",children:g(s.timestamp)}),e.jsx("span",{className:"text-xs text-[var(--text-secondary)]",children:s.message})]},s.id)})})})]})]})]})}export{Z as default};
@@ -0,0 +1,26 @@
1
+ import{c as s,r as m,u as h,a as p,j as e,T as g,L as r,b as y,S as v,C as b}from"./index-CluWJF_4.js";import{A as l}from"./arrow-right-CW48svkF.js";import{B as u}from"./bot-BlE3obwB.js";import{U as f}from"./users-D0C2zcU6.js";import{C as j}from"./copy-CljRO0MZ.js";/**
2
+ * @license lucide-react v0.469.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const N=s("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
7
+ * @license lucide-react v0.469.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const _=s("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
12
+ * @license lucide-react v0.469.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const k=s("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/**
17
+ * @license lucide-react v0.469.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const w=s("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
22
+ * @license lucide-react v0.469.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const K=s("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),d=[{icon:_,titleKey:"landing.step_define",descKey:"landing.step_define_desc"},{icon:k,titleKey:"landing.step_dispatch",descKey:"landing.step_dispatch_desc"},{icon:N,titleKey:"landing.step_monitor",descKey:"landing.step_monitor_desc"}],C=[{icon:y,titleKey:"landing.feature_terminal",descKey:"landing.feature_terminal_desc"},{icon:u,titleKey:"landing.feature_multi_agent",descKey:"landing.feature_multi_agent_desc"},{icon:w,titleKey:"landing.feature_routing",descKey:"landing.feature_routing_desc"},{icon:K,titleKey:"landing.feature_pipeline",descKey:"landing.feature_pipeline_desc"},{icon:f,titleKey:"landing.feature_collab",descKey:"landing.feature_collab_desc"},{icon:v,titleKey:"landing.feature_security",descKey:"landing.feature_security_desc"}];function q(){const[x,c]=m.useState(!1),n=h(a=>a.user)?"/home":"/login",{t}=p(),o=async()=>{try{await navigator.clipboard.writeText("npm install -g @overlordai/developer-cli"),c(!0),setTimeout(()=>c(!1),2e3)}catch{}};return e.jsxs("div",{className:"min-h-screen bg-[var(--bg-primary)]",children:[e.jsx("nav",{className:"sticky top-0 z-50 border-b border-[var(--border)] bg-[var(--bg-primary)]/80 backdrop-blur-md",children:e.jsxs("div",{className:"mx-auto flex h-14 max-w-6xl items-center justify-between px-4 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-[4px] bg-[var(--accent)]","aria-hidden":!0,style:{fontFamily:"'JetBrains Mono', monospace"},children:e.jsx("span",{className:"text-xl font-semibold",style:{color:"#0C0C0C"},children:"~"})}),e.jsx("span",{className:"text-lg font-bold text-[var(--text-primary)]",style:{fontSize:"20px",fontFamily:"'JetBrains Mono', monospace"},children:t("landing.overlord")})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(g,{}),e.jsx(r,{to:n,className:"text-xs font-medium text-[var(--accent)] transition-colors hover:opacity-80",children:t("landing.go_to_app")})]})]})}),e.jsxs("section",{className:"relative overflow-hidden",children:[e.jsx("div",{"aria-hidden":!0,className:"pointer-events-none absolute -top-40 left-1/2 h-[600px] w-[900px] -translate-x-1/2 rounded-full opacity-20 blur-3xl",style:{background:"radial-gradient(ellipse at center, var(--accent), transparent 70%)"}}),e.jsxs("div",{className:"relative mx-auto max-w-5xl px-4 pb-20 pt-24 text-center sm:px-6 sm:pb-28 sm:pt-32",children:[e.jsx("div",{className:"mb-6 inline-flex items-center rounded-full border border-[var(--accent)]/20 bg-[var(--accent)]/5 px-4 py-1.5 text-xs text-[var(--accent)]",children:t("landing.version_badge")}),e.jsxs("h1",{className:"text-3xl font-extrabold leading-tight tracking-tight text-[var(--text-primary)] sm:text-4xl md:text-5xl",children:[t("landing.hero_line1"),e.jsx("br",{}),e.jsx("span",{className:"text-[var(--accent)]",children:t("landing.hero_highlight")})]}),e.jsx("p",{className:"mx-auto mt-6 max-w-3xl text-sm leading-relaxed text-[var(--text-secondary)] sm:text-base",children:t("landing.hero_desc")}),e.jsxs("div",{className:"mt-10",children:[e.jsxs(r,{to:n,className:"inline-flex items-center gap-2 rounded-[4px] bg-[var(--accent)] px-8 py-3 text-sm font-semibold text-black shadow-lg shadow-[var(--accent)]/25 transition-all hover:brightness-110 active:scale-[0.98]",children:[t("landing.get_started"),e.jsx(l,{size:16})]}),e.jsxs(r,{to:"/docs/cli",className:"ml-4 inline-flex items-center gap-1 text-sm text-[var(--text-muted)] transition-colors hover:text-[var(--text-primary)]",children:[t("landing.read_docs")," ",e.jsx(l,{size:14})]})]})]})]}),e.jsx("section",{className:"border-t border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("div",{className:"mx-auto max-w-5xl px-4 py-20 sm:px-6 sm:py-28",children:[e.jsx("h2",{className:"text-center text-xl font-bold text-[var(--text-primary)] sm:text-2xl",children:t("landing.how_it_works")}),e.jsx("p",{className:"mx-auto mt-3 max-w-xl text-center text-sm text-[var(--text-secondary)]",children:t("landing.three_steps")}),e.jsx("div",{className:"mt-14 grid gap-8 sm:grid-cols-3",children:d.map((a,i)=>e.jsxs("div",{className:"relative text-center",children:[i<d.length-1&&e.jsx("div",{"aria-hidden":!0,className:"absolute right-0 top-8 hidden h-px w-8 translate-x-full bg-[var(--border)] sm:block"}),e.jsx("div",{className:"mx-auto flex h-14 w-14 items-center justify-center rounded-full bg-[var(--accent)]/10 text-[var(--accent)] text-sm font-bold",children:String(i+1).padStart(2,"0")}),e.jsx("div",{className:"mt-1 text-[10px] font-semibold uppercase tracking-widest text-[var(--text-muted)]",children:t("landing.step_n",{n:i+1})}),e.jsx("h3",{className:"mt-2 text-sm font-semibold text-[var(--text-primary)]",children:t(a.titleKey)}),e.jsx("p",{className:"mt-2 text-xs leading-relaxed text-[var(--text-secondary)]",children:t(a.descKey)})]},a.titleKey))})]})}),e.jsx("section",{className:"border-t border-[var(--border)]",children:e.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-20 sm:px-6 sm:py-28",children:[e.jsx("h2",{className:"text-center text-xl font-bold text-[var(--text-primary)] sm:text-2xl",children:t("landing.everything_you_need")}),e.jsx("p",{className:"mx-auto mt-3 max-w-xl text-center text-sm text-[var(--text-secondary)]",children:t("landing.complete_platform")}),e.jsx("div",{className:"mt-14 grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:C.map(a=>e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5 transition-shadow hover:shadow-md",children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-[4px] bg-[var(--accent)]/10 text-[var(--accent)]",children:e.jsx(a.icon,{size:18})}),e.jsx("h3",{className:"mt-3 text-sm font-semibold text-[var(--text-primary)]",children:t(a.titleKey)}),e.jsx("p",{className:"mt-1.5 text-xs leading-relaxed text-[var(--text-secondary)]",children:t(a.descKey)})]},a.titleKey))})]})}),e.jsx("section",{className:"border-t border-[var(--border)] bg-[var(--bg-card)]",children:e.jsxs("div",{className:"mx-auto max-w-2xl px-4 py-20 text-center sm:px-6 sm:py-28",children:[e.jsx("h2",{className:"text-xl font-bold text-[var(--text-primary)] sm:text-2xl",children:t("landing.install_title")}),e.jsx("p",{className:"mt-3 text-sm text-[var(--text-secondary)]",children:t("landing.install_desc")}),e.jsx("div",{className:"relative mx-auto mt-10 max-w-lg",children:e.jsxs("div",{className:"flex items-center justify-between rounded-[4px] border border-[var(--border)] bg-[var(--bg-primary)] px-5 py-3 text-xs text-[var(--text-primary)]",children:[e.jsxs("span",{style:{textTransform:"none"},children:[e.jsxs("span",{className:"select-none text-[var(--text-secondary)]",children:["$"," "]}),t("landing.install_command")]}),e.jsx("button",{onClick:o,className:"ml-4 flex-shrink-0 rounded-[4px] p-1.5 text-[var(--text-secondary)] transition-colors hover:bg-[var(--border)]","aria-label":t("landing.copy_install_command"),children:x?e.jsx(b,{size:14,className:"text-[var(--accent)]"}):e.jsx(j,{size:14})})]})}),e.jsx("div",{className:"mt-10",children:e.jsxs(r,{to:n,className:"inline-flex items-center gap-2 rounded-[4px] bg-[var(--accent)] px-8 py-3 text-sm font-semibold text-black shadow-lg shadow-[var(--accent)]/25 transition-all hover:brightness-110 active:scale-[0.98]",children:[t("landing.get_started"),e.jsx(l,{size:16})]})})]})}),e.jsx("footer",{className:"border-t border-[var(--border)]",children:e.jsxs("div",{className:"mx-auto flex max-w-6xl flex-col items-center gap-4 px-4 py-8 text-xs text-[var(--text-secondary)] sm:flex-row sm:justify-between sm:px-6",children:[e.jsxs("span",{children:["© ",new Date().getFullYear()," ",t("landing.overlord")]}),e.jsxs("div",{className:"flex gap-6",children:[e.jsx("a",{href:"/docs/cli",className:"transition-colors hover:text-[var(--text-primary)]",children:t("landing.documentation")}),e.jsx("a",{href:"/docs/api",className:"transition-colors hover:text-[var(--text-primary)]",children:t("landing.api")})]})]})})]})}export{q as default};
@@ -0,0 +1 @@
1
+ import{d as W,e as q,u as m,a as I,r as c,j as t,N as _}from"./index-CluWJF_4.js";function P(){var w,B;const h=W(),y=q(),x=m(e=>e.login),v=m(e=>e.requireTotpSetup),k=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(k&&!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(_,{to:e??"/home",replace:!0})}if(v)return t.jsx(_,{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_to_site")})]},"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};
@@ -0,0 +1 @@
1
+ import{a as S,j as e,l as I,m as M,d as T,r as x,h as A,f as v,L as G,s as U}from"./index-CluWJF_4.js";import{M as o,T as d}from"./protocol-C4f2G7mk.js";import{A as w}from"./arrow-left-EPKSp1wq.js";function _({isOpen:t,onClose:r,onConfirm:s,machineName:a,isDraining:i,loading:m}){const{t:l}=S();return e.jsx(I,{isOpen:t,onClose:r,onConfirm:s,title:l(i?"machines.undrain_machine_title":"machines.drain_machine_title"),message:i?l("machines.undrain_confirm",{name:a}):l("machines.drain_confirm",{name:a}),confirmLabel:l(i?"machines.undrain":"machines.drain"),confirmVariant:i?"accent":"warning",isLoading:m})}const O={[o.ONLINE]:"var(--accent)",[o.OFFLINE]:"var(--destructive)",[o.DRAINING]:"var(--warning)"},F={[d.QUEUED]:"var(--text-muted)",[d.ASSIGNED]:"#60a5fa",[d.RUNNING]:"var(--accent)",[d.SUSPENDED]:"var(--warning)",[d.COMPLETED]:"var(--accent)",[d.FAILED]:"var(--destructive)",[d.CANCELLED]:"var(--text-muted)"};function k(t){return t?new Date(t).toLocaleString():"n/a"}function R(t){if(!t)return"never";const r=Date.now()-new Date(t).getTime(),s=Math.floor(r/1e3);if(s<60)return`${s}s ago`;const a=Math.floor(s/60);if(a<60)return`${a}m ago`;const i=Math.floor(a/60);return i<24?`${i}h ago`:`${Math.floor(i/24)}d ago`}function D(t){return t>80?"var(--destructive)":t>60?"var(--warning)":"var(--accent)"}function B(){const{id:t}=M(),r=T(),{t:s}=S(),[a,i]=x.useState(null),[m,l]=x.useState([]),[L,E]=x.useState(!0),[g,h]=x.useState(!1),[N,f]=x.useState(!1);A(x.useMemo(()=>!a||a.status===o.OFFLINE||a.status===o.DRAINING?null:e.jsxs("button",{onClick:()=>h(!0),className:"rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",s("machines.drain")]}),[a,s]));const u=x.useCallback(async()=>{if(t)try{const[c,$]=await Promise.all([v.get(`web/machines/${t}`).json(),v.get(`web/machines/${t}/tasks`).json().catch(()=>[])]);i(c),l($)}catch{}finally{E(!1)}},[t]);x.useEffect(()=>{u()},[u]);async function y(){if(a){f(!0);try{const c=a.status===o.DRAINING?"undrain":"drain";await v.post(`web/machines/${a.id}/${c}`),await u()}catch{}finally{f(!1),h(!1)}}}if(L)return e.jsx("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono",children:e.jsx("p",{className:"text-sm text-[var(--text-muted)]",children:s("machines.loading_machine")})});if(!a)return e.jsxs("div",{className:"mx-auto max-w-5xl px-6 py-8 font-mono lowercase text-center",children:[e.jsx("p",{className:"text-sm text-[var(--text-secondary)]",children:s("machines.machine_not_found")}),e.jsxs("button",{onClick:()=>r("/machines"),className:"mt-4 rounded-[4px] border border-[var(--border)] px-3 py-1.5 text-xs text-[var(--text-secondary)] hover:text-[var(--text-primary)] transition-colors",children:["< ",s("machines.back_to_machines")]})]});const b=a.status===o.DRAINING;return b?e.jsxs("div",{className:"mx-auto max-w-5xl font-mono lowercase",children:[e.jsxs("div",{className:"flex items-center gap-3 border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[e.jsx("button",{onClick:()=>r("/machines"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(w,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:a.name})]}),e.jsxs("div",{className:"px-6 py-8",children:[e.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx(G,{to:"/machines",className:"text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:s("machines.title")}),e.jsx("span",{className:"text-[var(--text-muted)]",children:"/"}),e.jsx("span",{className:"text-[var(--text-secondary)]",children:a.name})]}),e.jsxs("button",{onClick:()=>h(!0),className:"rounded-[4px] border border-[var(--accent)] px-4 py-1.5 text-xs text-[var(--accent)] hover:bg-[var(--accent)]/10 transition-colors",children:["> ",s("machines.undrain")]})]}),e.jsx("div",{className:"mb-4",children:e.jsx("span",{className:"rounded-[4px] bg-[var(--warning)]/20 px-2.5 py-1 text-xs font-medium text-[var(--warning)]",children:s("machines.draining")})}),e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--warning)]/40 bg-[var(--warning)]/10 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(U,{className:"h-3.5 w-3.5 text-[var(--warning)]"}),e.jsx("span",{className:"text-xs text-[var(--warning)]",children:s("machines.draining_warning")})]}),e.jsx("p",{className:"text-xs text-[var(--warning)]/70 ml-5.5",children:s("machines.draining_active_tasks")})]}),e.jsxs("div",{className:"mb-6 grid grid-cols-2 gap-4",children:[e.jsx(p,{label:s("machines.cpu"),value:a.cpuUsage,unit:"%"}),e.jsx(p,{label:s("machines.memory"),value:a.memoryUsage,unit:"%"}),e.jsx(p,{label:s("machines.disk"),value:a.diskUsage,unit:"%"}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("machines.slots")}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[a.activeSlots,"/",a.maxSlots]})]})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:s("machines.active_tasks")}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:m.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:s("machines.no_active_tasks")})]}):e.jsx(C,{tasks:m,navigate:r,t:s})})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:s("machines.capabilities")}),a.capabilities.length>0?e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:a.capabilities.map(c=>e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:e.jsx("p",{className:"text-xs text-[var(--text-primary)]",children:c})},c))}):e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:s("machines.no_capabilities_short")})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("h2",{className:"mb-4 text-sm font-medium text-[var(--accent)]",children:s("machines.machine_info")}),e.jsx("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(n,{label:s("machines.host"),value:a.host}),e.jsx(n,{label:s("machines.port"),value:String(a.port)}),e.jsx(n,{label:s("machines.os"),value:a.os??s("machines.unknown")}),e.jsx(n,{label:s("machines.cpu_cores"),value:a.cpuCores!=null?String(a.cpuCores):s("machines.n_a")}),e.jsx(n,{label:s("machines.memory"),value:a.memoryGb!=null?`${a.memoryGb} gb`:s("machines.n_a")}),e.jsx(n,{label:s("machines.last_heartbeat_label"),value:k(a.lastHeartbeat)}),e.jsx(n,{label:s("machines.slots"),value:`${a.activeSlots}/${a.maxSlots}`}),e.jsx(n,{label:s("machines.status_label"),value:a.status.toLowerCase()})]})})]}),e.jsx(_,{isOpen:g,onClose:()=>h(!1),onConfirm:y,machineName:a.name,isDraining:b,loading:N})]})]}):e.jsxs("div",{className:"mx-auto max-w-5xl font-mono lowercase",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-[var(--border)] bg-[var(--bg-primary)] px-4 shrink-0 md:hidden",style:{height:56},children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("button",{onClick:()=>r("/machines"),className:"shrink-0 text-[var(--text-muted)]",children:e.jsx(w,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-sm font-medium text-[var(--text-primary)]",children:a.name})]}),a.status!==o.OFFLINE&&e.jsxs("button",{onClick:()=>h(!0),className:"shrink-0 rounded-[4px] border border-[var(--warning)]/40 px-3 py-1.5 text-xs text-[var(--warning)] hover:bg-[var(--warning)]/10 transition-colors",children:["> ",s("machines.drain")]})]}),e.jsxs("div",{className:"px-6 py-8",children:[e.jsxs("button",{onClick:()=>r("/machines"),className:"mb-4 text-xs text-[var(--text-muted)] hover:text-[var(--text-secondary)] transition-colors",children:["< ",s("machines.back_to_machines")]}),e.jsxs("h1",{className:"mb-2 text-lg font-bold text-[var(--text-primary)] flex items-center gap-2",children:[a.name,e.jsxs("span",{className:"flex items-center gap-1.5 text-sm font-normal",style:{color:O[a.status]},children:[e.jsx("span",{style:{fontSize:"0.5rem"},children:"●"}),a.status.toLowerCase()]})]}),e.jsx("p",{className:"mb-6 text-xs text-[var(--text-muted)]",children:s("machines.last_heartbeat",{time:R(a.lastHeartbeat)})}),e.jsxs("div",{className:"mb-6 grid gap-4 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:s("machines.resource_usage")}),e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx(j,{label:s("machines.cpu"),value:a.cpuUsage}),e.jsx(j,{label:s("machines.mem"),value:a.memoryUsage}),e.jsx(j,{label:s("machines.disk"),value:a.diskUsage})]})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:s("machines.connection_info")}),e.jsxs("div",{className:"flex flex-col gap-2 text-xs",children:[e.jsx(n,{label:s("machines.host"),value:a.host}),e.jsx(n,{label:s("machines.port"),value:String(a.port)}),e.jsx(n,{label:s("machines.os"),value:a.os??s("machines.unknown")}),e.jsx(n,{label:s("machines.cpu_cores"),value:a.cpuCores!=null?String(a.cpuCores):s("machines.n_a")}),e.jsx(n,{label:s("machines.memory"),value:a.memoryGb!=null?`${a.memoryGb} gb`:s("machines.n_a")}),e.jsx(n,{label:s("machines.last_heartbeat_label"),value:k(a.lastHeartbeat)}),e.jsx(n,{label:s("machines.slots"),value:`${a.activeSlots}/${a.maxSlots}`})]})]})]}),a.capabilities.length>0&&e.jsxs("div",{className:"mb-6 rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsx("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:s("machines.capabilities")}),e.jsx("div",{className:"flex flex-wrap gap-2",children:a.capabilities.map(c=>e.jsx("span",{className:"rounded-[4px] border border-[var(--border)] px-2.5 py-1 text-xs text-[var(--text-secondary)]",children:c},c))})]}),e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-4",children:[e.jsxs("h2",{className:"mb-3 text-xs text-[var(--text-muted)]",children:[s("machines.current_tasks")," (",m.length,")"]}),m.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:s("machines.no_active_tasks")})]}):e.jsx(C,{tasks:m,navigate:r,t:s})]}),e.jsx(_,{isOpen:g,onClose:()=>h(!1),onConfirm:y,machineName:a.name,isDraining:b,loading:N})]})]})}function C({tasks:t,navigate:r,t:s}){return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full text-xs",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-[var(--border-row)]",children:[e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:s("machines.id")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:s("machines.description")}),e.jsx("th",{className:"py-2 pr-4 text-left font-normal text-[var(--text-muted)]",children:s("machines.status_label")}),e.jsx("th",{className:"py-2 text-left font-normal text-[var(--text-muted)]",children:s("machines.stage")})]})}),e.jsx("tbody",{children:t.map(a=>e.jsxs("tr",{onClick:()=>r(`/tasks/${a.id}`),className:"cursor-pointer border-b border-[var(--border-row)] hover:bg-[var(--bg-input)] transition-colors",children:[e.jsxs("td",{className:"py-2 pr-4 text-[var(--text-primary)]",children:["#",a.id]}),e.jsx("td",{className:"max-w-xs truncate py-2 pr-4 text-[var(--text-secondary)]",children:a.description}),e.jsx("td",{className:"py-2 pr-4",children:e.jsxs("span",{style:{color:F[a.status]},children:["● ",a.status.toLowerCase()]})}),e.jsx("td",{className:"py-2 text-[var(--text-secondary)]",children:a.currentStage??"-"})]},a.id))})]})})}function p({label:t,value:r,unit:s}){return e.jsxs("div",{className:"rounded-[4px] border border-[var(--border)] bg-[var(--bg-card)] p-5",children:[e.jsx("p",{className:"text-xs text-[var(--text-muted)]",children:t}),e.jsxs("p",{className:"mt-2 text-lg font-semibold text-[var(--text-primary)]",children:[r,s]}),e.jsx("div",{className:"mt-3 h-1.5 w-full rounded-sm bg-[var(--bg-input)]",children:e.jsx("div",{className:"h-full rounded-sm transition-all",style:{width:`${r}%`,backgroundColor:D(r)}})})]})}function j({label:t,value:r}){return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-[var(--text-secondary)]",children:t}),e.jsxs("span",{className:"text-[var(--text-primary)]",children:[r,"%"]})]}),e.jsx("div",{className:"h-1.5 w-full rounded-sm bg-[var(--bg-input)]",children:e.jsx("div",{className:"h-full rounded-sm transition-all",style:{width:`${r}%`,backgroundColor:D(r)}})})]})}function n({label:t,value:r}){return e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-[var(--text-muted)]",children:t}),e.jsx("span",{className:"truncate text-[var(--text-primary)]",children:r})]})}export{B as default};