bazilion 0.14.2 → 0.16.0

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 (122) hide show
  1. package/dist/cli.js +1752 -825
  2. package/dist/cli.js.map +1 -1
  3. package/dist/daemon.js +16624 -9803
  4. package/dist/daemon.js.map +1 -1
  5. package/dist/migrations/0001_init.sql +218 -3
  6. package/dist/web/client/assets/ChatPane-CQZzxOir.js +76 -0
  7. package/dist/web/client/assets/{ConfirmDialog-_bmG-wVG.js → ConfirmDialog-MicTTwdy.js} +1 -1
  8. package/dist/web/client/assets/{FieldRow-Do1cBkRc.js → FieldRow-DJ2Gx4Du.js} +1 -1
  9. package/dist/web/client/assets/{ProductionTeamPolicyEditor-XP-QJul4.js → ProductionTeamPolicyEditor-DqUnN_ce.js} +1 -1
  10. package/dist/web/client/assets/{ProfileCommunicationEditor-CwdFPdpk.js → ProfileCommunicationEditor-DArXub0b.js} +1 -1
  11. package/dist/web/client/assets/ResultCard-Cps_lXVN.js +1 -0
  12. package/dist/web/client/assets/ResultSourceConversation-CtzJ8QA-.js +1 -0
  13. package/dist/web/client/assets/TeamTabs-DbIk5vvT.js +1 -0
  14. package/dist/web/client/assets/{TemplatesTabs-D4WHvs6b.js → TemplatesTabs-CatJIjGi.js} +1 -1
  15. package/dist/web/client/assets/{UnsavedChangesGuard-B1aLqiK5.js → UnsavedChangesGuard-BCsLw-mU.js} +1 -1
  16. package/dist/web/client/assets/_id-B5Ov7cdO.js +1 -0
  17. package/dist/web/client/assets/{_id-BH3v_vI_.js → _id-BEDmIXVf.js} +1 -1
  18. package/dist/web/client/assets/_id-BFM_tn_s.js +1 -0
  19. package/dist/web/client/assets/_id-CrnEVcw8.js +1 -0
  20. package/dist/web/client/assets/{_id-3w4PFfma.js → _id-DxopIW-y.js} +1 -1
  21. package/dist/web/client/assets/{activity-A_HrG1Tv.js → activity-CrG8Bg60.js} +1 -1
  22. package/dist/web/client/assets/{agents-C8OVKq3N.js → agents-CMPOFcs-.js} +1 -1
  23. package/dist/web/client/assets/{agents-BeeFCt2c.js → agents-O4soKZND.js} +1 -1
  24. package/dist/web/client/assets/{approvals-BIdZ9BSn.js → approvals-CwDu_lrA.js} +1 -1
  25. package/dist/web/client/assets/{attention-B9bUrxiU.js → attention-BY8MMuM_.js} +1 -1
  26. package/dist/web/client/assets/chevron-right-Cf6vKeLq.js +1 -0
  27. package/dist/web/client/assets/{config-By86S7k-.js → config-Cn4iBJFz.js} +1 -1
  28. package/dist/web/client/assets/{inbox-DlXQCJLe.js → inbox-CWXql0K3.js} +1 -1
  29. package/dist/web/client/assets/{index-CLdmsmiN.js → index-Bq2zrG2_.js} +2 -2
  30. package/dist/web/client/assets/{learning-BqZIw2nA.js → learning-DAm4dyyc.js} +1 -1
  31. package/dist/web/client/assets/login-BsABI8Ux.js +1 -0
  32. package/dist/web/client/assets/{mcp-DKSY2yVa.js → mcp-loLB0wuh.js} +1 -1
  33. package/dist/web/client/assets/{members-9GuOiq6J.js → members-BJ0ikkTl.js} +1 -1
  34. package/dist/web/client/assets/{memory-DiGMI6FC.js → memory-Drn9Gv53.js} +1 -1
  35. package/dist/web/client/assets/{policy-TBGQffw5.js → policy-pQadZyk0.js} +1 -1
  36. package/dist/web/client/assets/results-9exU6f7m.js +1 -0
  37. package/dist/web/client/assets/routes-jw1PuqiR.js +1 -0
  38. package/dist/web/client/assets/{services-1Z398CES.js → services-BLso1BhA.js} +1 -1
  39. package/dist/web/client/assets/{skills-BP2gciFt.js → skills-BodqX3OI.js} +1 -1
  40. package/dist/web/client/assets/styles-d1yjBpud.css +2 -0
  41. package/dist/web/client/assets/{teams-DBIivGT7.js → teams-ByQedXZi.js} +1 -1
  42. package/dist/web/client/assets/{teams-tNoMDJ_M.js → teams-SYsF1bOR.js} +1 -1
  43. package/dist/web/client/assets/telegram-DC9PLFbB.js +1 -0
  44. package/dist/web/client/assets/{tokens-eDWCGQQ2.js → tokens-DGy8Ijpo.js} +1 -1
  45. package/dist/web/client/assets/{triggers-DZME3IcK.js → triggers-BXpVmHDG.js} +1 -1
  46. package/dist/web/client/assets/{welcome-B49sh_uf.js → welcome-BKsnsCxJ.js} +1 -1
  47. package/dist/web/client/assets/wire-constants-CBD-lTaa.js +1 -0
  48. package/dist/web/client/assets/{x-CHc7_-TH.js → x-BK4xNCzS.js} +1 -1
  49. package/dist/web/server/assets/ChatPane-CS5oI7ef.js +2666 -0
  50. package/dist/web/server/assets/ResultCard-B3zD9N0t.js +143 -0
  51. package/dist/web/server/assets/ResultSourceConversation-BpVWBRYq.js +64 -0
  52. package/dist/web/server/assets/{TeamTabs-Co3n2exj.js → TeamTabs-TCKjCvMA.js} +4 -0
  53. package/dist/web/server/assets/{_id-sNu5aXZt.js → _id-5pgKoid8.js} +2 -1
  54. package/dist/web/server/assets/_id-BDEpe6k0.js +6 -0
  55. package/dist/web/server/assets/{_id-DxCnEFpm.js → _id-BG2nkGxa.js} +3 -4
  56. package/dist/web/server/assets/{_id-BqWTB8Wl.js → _id-B_-CDHOi2.js} +1 -1
  57. package/dist/web/server/assets/{_id-BeKhPKw3.js → _id-BnqodC1c2.js} +7 -3
  58. package/dist/web/server/assets/{_id-DvlDkk04.js → _id-CeyHEsCZ.js} +1 -1
  59. package/dist/web/server/assets/{_id-BYKpT2Tu.js → _id-DFHB9JFQ.js} +1 -1
  60. package/dist/web/server/assets/{_id-DYU6uIBx.js → _id-DOnInzLb.js} +1 -1
  61. package/dist/web/server/assets/{_id-HMy7jM3P.js → _id-DrB9uR1b.js} +1 -1
  62. package/dist/web/server/assets/{_id-BAA9KJBU.js → _id-DtIYuJJX.js} +1 -1
  63. package/dist/web/server/assets/_id-DwZXhLlL.js +779 -0
  64. package/dist/web/server/assets/_id-wyjrf0JG.js +17 -0
  65. package/dist/web/server/assets/{_tanstack-start-manifest_v-Duhf0z7H.js → _tanstack-start-manifest_v-D7gKv6m6.js} +97 -70
  66. package/dist/web/server/assets/{activity-9VP6QDTH.js → activity-0VUkStOu.js} +1 -1
  67. package/dist/web/server/assets/{activity-BWv1goK6.js → activity-5fWKPDxj.js} +2 -2
  68. package/dist/web/server/assets/{activity-LjpblbDL.js → activity-C88qrNqv.js} +1 -1
  69. package/dist/web/server/assets/{agents-DjyQk94u.js → agents-C86K6HvS.js} +1 -1
  70. package/dist/web/server/assets/{agents-BJAv919x.js → agents-CSXLaM2W.js} +1 -1
  71. package/dist/web/server/assets/{approvals-BYi84gwl.js → approvals-C3MysI6l.js} +1 -1
  72. package/dist/web/server/assets/{approvals-7JOoBchn.js → approvals-DTdrltyk.js} +1 -1
  73. package/dist/web/server/assets/{approvals-Bz123liE.js → approvals-DXoN-T57.js} +15 -1
  74. package/dist/web/server/assets/{attention-UhqPK_Ro.js → attention-DLeLCKah.js} +1 -1
  75. package/dist/web/server/assets/{auth-7BHTH-KS.js → auth-CDZp9aEk.js} +1 -1
  76. package/dist/web/server/assets/{config-BMiajTZP.js → config-BVTHvljR.js} +1 -1
  77. package/dist/web/server/assets/{daemon-client-CI5NHwNC.js → daemon-client-xWyYKAcx.js} +59 -0
  78. package/dist/web/server/assets/{inbox-Dv55rGYq.js → inbox-PQTrjtOw.js} +1 -1
  79. package/dist/web/server/assets/{learning-C2upa1CE.js → learning-K0cmDsZR.js} +1 -1
  80. package/dist/web/server/assets/{login-BNj3U6ok.js → login-B_-9L8TU.js} +7 -2
  81. package/dist/web/server/assets/{login-Be8eP4Jp.js → login-rDox7PRD.js} +5 -2
  82. package/dist/web/server/assets/{mcp-BvnvlVFd.js → mcp-Rtraochg.js} +1 -1
  83. package/dist/web/server/assets/{members-DiYtr-zm.js → members-CD3GiTfF.js} +1 -1
  84. package/dist/web/server/assets/{members-DHYTVgwb.js → members-cc5SeEaW.js} +2 -2
  85. package/dist/web/server/assets/{members-BP3UTqu1.js → members-grAKFWgv.js} +1 -1
  86. package/dist/web/server/assets/{memory-CkXUgf5s.js → memory-C5i_GxlY.js} +2 -2
  87. package/dist/web/server/assets/{memory-DTFEmfF3.js → memory-CVqnyUaM.js} +1 -1
  88. package/dist/web/server/assets/{memory-BqV-Afy1.js → memory-egFpBD1g.js} +1 -1
  89. package/dist/web/server/assets/{policy-Bvvav8fh.js → policy-Dgjb0_gK.js} +2 -2
  90. package/dist/web/server/assets/{policy-BddK4xom.js → policy-bLKwvnja.js} +1 -1
  91. package/dist/web/server/assets/{policy-18fdTFO4.js → policy-ooSBgiDS.js} +1 -1
  92. package/dist/web/server/assets/results-CfNsFncJ.js +173 -0
  93. package/dist/web/server/assets/results-DXdYtHaq.js +12 -0
  94. package/dist/web/server/assets/results-N-kP4iFT.js +12 -0
  95. package/dist/web/server/assets/{router-CY_pCgP1.js → router-B6g_s7W3.js} +60 -43
  96. package/dist/web/server/assets/{routes-COtkyZG1.js → routes-BqSaZvlu.js} +3 -3
  97. package/dist/web/server/assets/{routes-BgHisAxH.js → routes-Dsh8F_7i.js} +2 -2
  98. package/dist/web/server/assets/{routes-DAU2g7Uz.js → routes-pcRy_Sf8.js} +1 -1
  99. package/dist/web/server/assets/{services-DozuJtzX.js → services-DlZA8fRL.js} +1 -1
  100. package/dist/web/server/assets/{skills-DfGSJTCB.js → skills-i2duvgW-.js} +1 -1
  101. package/dist/web/server/assets/{teams-be05ci17.js → teams-6RYIj1Xm.js} +1 -1
  102. package/dist/web/server/assets/{teams-DPnAX4wD.js → teams-B1AI3NfN.js} +1 -1
  103. package/dist/web/server/assets/{telegram-1AWL6lFw.js → telegram-C4q0YTVn.js} +1 -1
  104. package/dist/web/server/assets/{telegram-Dj4Wwhd6.js → telegram-CoNeOgqZ.js} +465 -1
  105. package/dist/web/server/assets/{telegram-DbOFpTFm.js → telegram-Zd1rIZxg.js} +1 -1
  106. package/dist/web/server/assets/{tokens-DjM8GsgS.js → tokens-RFquA2Bx.js} +1 -1
  107. package/dist/web/server/assets/{triggers-Nezfw-Bd.js → triggers-DVD-iE-N.js} +1 -1
  108. package/dist/web/server/server.js +31 -27
  109. package/dist/worker.js +1765 -710
  110. package/dist/worker.js.map +1 -1
  111. package/package.json +3 -3
  112. package/dist/web/client/assets/TeamTabs-DIRiKcqx.js +0 -1
  113. package/dist/web/client/assets/_id-Cx7o4Zmf.js +0 -1
  114. package/dist/web/client/assets/_id-DIiVVxBl.js +0 -1
  115. package/dist/web/client/assets/chevron-right-VWrk_dTX.js +0 -1
  116. package/dist/web/client/assets/login-CCMPXiny.js +0 -1
  117. package/dist/web/client/assets/routes-g3yUOhCb.js +0 -1
  118. package/dist/web/client/assets/styles-B5vcgXln.css +0 -2
  119. package/dist/web/client/assets/telegram-CJG_DFdI.js +0 -1
  120. package/dist/web/client/assets/wire-constants-zZ7Wjb9C.js +0 -74
  121. package/dist/web/server/assets/ChatPane-CgSe7tsy.js +0 -1429
  122. package/dist/web/server/assets/_id-ndxFHx0t.js +0 -381
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./ConfirmDialog-_bmG-wVG.js";import{_ as a}from"./index-CLdmsmiN.js";import{t as o}from"./Button-ByiV6fpd.js";import{t as s}from"./ConfigPage-BCLp-FUC.js";var c=e(n()),l=t();function u(e){return new Date(e).toISOString().slice(0,16).replace(`T`,` `)}function d(){let{tokens:e,sessions:t}=a.useLoaderData(),{all:n}=a.useSearch(),d=n===`1`,f=r(),[p,m]=(0,c.useState)(``),[h,g]=(0,c.useState)(null),[_,v]=(0,c.useState)(`90`),[y,b]=(0,c.useState)(null),[x,S]=(0,c.useState)(!1),[C,w]=(0,c.useState)(null),[T,E]=(0,c.useState)(null);async function D(e){e.preventDefault(),b(null),S(!0);try{let e=await fetch(`/api/tokens`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({label:p,expiresInDays:Number(_)})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`${e.status} ${e.statusText}`)}g((await e.json()).token),m(``),await f.invalidate()}catch(e){b(e.message)}finally{S(!1)}}async function O(e,t){let n=await fetch(`/api/tokens/${encodeURIComponent(e)}`,{method:`DELETE`});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>({}));throw Error(e.error??`Could not revoke API token`)}t?window.location.assign(`/login`):await f.invalidate()}async function k(e,t){let n=await fetch(`/api/sessions/${encodeURIComponent(e)}`,{method:`DELETE`});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`Could not revoke browser session`)}t?window.location.assign(`/login`):await f.invalidate()}return(0,l.jsxs)(s,{active:`tokens`,title:`API tokens`,description:(0,l.jsxs)(l.Fragment,{children:[`Manage per-client credentials for the HTTP API and CLI. The`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:`bootstrap`}),` token from`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:`~/.bazilion/auth.json`}),` remains protected; mint separate credentials for mobile, LAN, and remote clients.`]}),children:[(0,l.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,l.jsx)(`h3`,{className:`font-serif text-xl mb-3`,children:`Mint a new token`}),(0,l.jsxs)(`form`,{onSubmit:D,className:`mb-3 flex flex-col items-stretch gap-2 sm:flex-row sm:items-end`,children:[(0,l.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Label`,(0,l.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),required:!0,placeholder:`e.g. laptop-tailscale`,autoComplete:`off`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-72`})]}),(0,l.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Expires in days`,(0,l.jsx)(`input`,{type:`number`,min:1,max:365,value:_,onChange:e=>v(e.target.value),required:!0,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-36`})]}),(0,l.jsx)(o,{variant:`primary`,type:`submit`,disabled:x,children:x?`creating…`:`create`})]}),h&&(0,l.jsxs)(`div`,{className:`rounded-md border border-warning/25 bg-warning/10 p-3`,children:[(0,l.jsx)(`p`,{className:`text-xs text-warning mb-1`,children:`copy this token now — it is not recoverable later.`}),(0,l.jsx)(`pre`,{className:`font-mono text-xs whitespace-pre-wrap break-all`,children:h})]}),y&&(0,l.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:y})]}),(0,l.jsx)(`div`,{children:(0,l.jsxs)(`label`,{className:`text-sm flex items-center gap-2`,children:[(0,l.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>{window.location.assign(e.target.checked?`/config/tokens?all=1`:`/config/tokens`)}}),`show revoked`]})}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[720px] text-sm`,children:[(0,l.jsx)(`thead`,{className:`text-left text-muted-foreground border-b`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:`py-2`,children:`label`}),(0,l.jsx)(`th`,{children:`kind`}),(0,l.jsx)(`th`,{children:`id`}),(0,l.jsx)(`th`,{children:`state`}),(0,l.jsx)(`th`,{children:`created`}),(0,l.jsx)(`th`,{children:`last used`}),(0,l.jsx)(`th`,{children:`expires`}),(0,l.jsx)(`th`,{})]})}),(0,l.jsxs)(`tbody`,{children:[e.length===0&&(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:8,className:`py-6 text-center text-muted-foreground italic`,children:`no tokens yet — mint one above`})}),e.map(e=>{let t=e.kind===`bootstrap`;return(0,l.jsxs)(`tr`,{className:`border-b last:border-0 hover:bg-accent/30`,children:[(0,l.jsxs)(`td`,{className:`py-2`,children:[e.label,t&&(0,l.jsx)(`span`,{className:`ml-2 text-[0.7em] uppercase tracking-wide text-muted-foreground`,children:`auth.json`})]}),(0,l.jsx)(`td`,{children:e.kind}),(0,l.jsx)(`td`,{children:(0,l.jsx)(`code`,{className:`font-mono text-xs`,children:e.id})}),(0,l.jsx)(`td`,{children:e.revokedAt?(0,l.jsx)(`span`,{className:`text-muted-foreground`,children:`revoked`}):(0,l.jsx)(`span`,{className:`text-success`,children:`active`})}),(0,l.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:u(e.createdAt)}),(0,l.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:e.lastUsedAt?u(e.lastUsedAt):`(never)`}),(0,l.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:e.expiresAt?u(e.expiresAt):`(never)`}),(0,l.jsx)(`td`,{children:!e.revokedAt&&!t&&(0,l.jsx)(o,{variant:`danger`,className:`text-xs`,onClick:()=>{b(null),w(e)},children:`revoke`})})]},e.id)})]})]})}),(0,l.jsxs)(`section`,{className:`space-y-3`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h3`,{className:`font-serif text-xl`,children:`Browser sessions`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Sessions expire after 12 idle hours or seven days absolute. Revoking a device also revokes every session created from it.`})]}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[720px] text-sm`,children:[(0,l.jsx)(`thead`,{className:`border-b text-left text-muted-foreground`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:`py-2`,children:`device`}),(0,l.jsx)(`th`,{children:`session`}),(0,l.jsx)(`th`,{children:`last seen`}),(0,l.jsx)(`th`,{children:`idle expiry`}),(0,l.jsx)(`th`,{children:`absolute expiry`}),(0,l.jsx)(`th`,{})]})}),(0,l.jsxs)(`tbody`,{children:[t.length===0&&(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:6,className:`py-6 text-center italic text-muted-foreground`,children:`no active browser sessions`})}),t.map(e=>(0,l.jsxs)(`tr`,{className:`border-b last:border-0 hover:bg-accent/30`,children:[(0,l.jsxs)(`td`,{className:`py-2`,children:[e.deviceLabel,` `,e.current&&(0,l.jsx)(`span`,{className:`text-xs text-success`,children:`current`})]}),(0,l.jsx)(`td`,{children:(0,l.jsx)(`code`,{className:`font-mono text-xs`,children:e.id})}),(0,l.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:u(e.lastSeenAt)}),(0,l.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:u(e.idleExpiresAt)}),(0,l.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:u(e.absoluteExpiresAt)}),(0,l.jsx)(`td`,{children:(0,l.jsx)(o,{variant:`danger`,className:`text-xs`,onClick:()=>{b(null),E(e)},children:`revoke`})})]},e.id))]})]})})]}),(0,l.jsx)(i,{open:C!==null,title:`Revoke ${C?.label??``}?`,description:(0,l.jsxs)(`p`,{children:[`This permanently revokes device token`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:C?.id}),` and every browser session created from it. Clients using it will be signed out and cannot reconnect with this credential.`,t.some(e=>e.current&&e.deviceTokenId===C?.id)&&` This includes the browser session you are using now.`]}),confirmLabel:`revoke token and sessions`,onConfirm:async()=>{if(C)try{await O(C.id,t.some(e=>e.current&&e.deviceTokenId===C.id))}catch(e){throw b(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||w(null)}}),(0,l.jsx)(i,{open:T!==null,title:`Revoke ${T?.deviceLabel??``} browser session?`,description:(0,l.jsxs)(`p`,{children:[`This ends browser session `,(0,l.jsx)(`code`,{className:`font-mono`,children:T?.id}),T?.current?` and signs this browser out immediately.`:`. The device token remains active for future logins.`]}),confirmLabel:T?.current?`sign out this browser`:`revoke session`,onConfirm:async()=>{if(T)try{await k(T.id,T.current)}catch(e){throw b(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||E(null)}})]})}export{d as component};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./ConfirmDialog-MicTTwdy.js";import{v as a}from"./index-Bq2zrG2_.js";import{t as o}from"./Button-ByiV6fpd.js";import{t as s}from"./ConfigPage-BCLp-FUC.js";var c=e(n()),l=t();function u(e){return new Date(e).toISOString().slice(0,16).replace(`T`,` `)}function d(){let{tokens:e,sessions:t}=a.useLoaderData(),{all:n}=a.useSearch(),d=n===`1`,f=r(),[p,m]=(0,c.useState)(``),[h,g]=(0,c.useState)(null),[_,v]=(0,c.useState)(`90`),[y,b]=(0,c.useState)(null),[x,S]=(0,c.useState)(!1),[C,w]=(0,c.useState)(null),[T,E]=(0,c.useState)(null);async function D(e){e.preventDefault(),b(null),S(!0);try{let e=await fetch(`/api/tokens`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({label:p,expiresInDays:Number(_)})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.error??`${e.status} ${e.statusText}`)}g((await e.json()).token),m(``),await f.invalidate()}catch(e){b(e.message)}finally{S(!1)}}async function O(e,t){let n=await fetch(`/api/tokens/${encodeURIComponent(e)}`,{method:`DELETE`});if(!n.ok&&n.status!==204){let e=await n.json().catch(()=>({}));throw Error(e.error??`Could not revoke API token`)}t?window.location.assign(`/login`):await f.invalidate()}async function k(e,t){let n=await fetch(`/api/sessions/${encodeURIComponent(e)}`,{method:`DELETE`});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error??`Could not revoke browser session`)}t?window.location.assign(`/login`):await f.invalidate()}return(0,l.jsxs)(s,{active:`tokens`,title:`API tokens`,description:(0,l.jsxs)(l.Fragment,{children:[`Manage per-client credentials for the HTTP API and CLI. The`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:`bootstrap`}),` token from`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:`~/.bazilion/auth.json`}),` remains protected; mint separate credentials for mobile, LAN, and remote clients.`]}),children:[(0,l.jsxs)(`section`,{className:`rounded-lg border bg-card p-5`,children:[(0,l.jsx)(`h3`,{className:`font-serif text-xl mb-3`,children:`Mint a new token`}),(0,l.jsxs)(`form`,{onSubmit:D,className:`mb-3 flex flex-col items-stretch gap-2 sm:flex-row sm:items-end`,children:[(0,l.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Label`,(0,l.jsx)(`input`,{type:`text`,value:p,onChange:e=>m(e.target.value),required:!0,placeholder:`e.g. laptop-tailscale`,autoComplete:`off`,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-72`})]}),(0,l.jsxs)(`label`,{className:`w-full text-sm sm:w-auto`,children:[`Expires in days`,(0,l.jsx)(`input`,{type:`number`,min:1,max:365,value:_,onChange:e=>v(e.target.value),required:!0,className:`mt-1 block w-full rounded-md border bg-background px-3 py-2 text-sm sm:w-36`})]}),(0,l.jsx)(o,{variant:`primary`,type:`submit`,disabled:x,children:x?`creating…`:`create`})]}),h&&(0,l.jsxs)(`div`,{className:`rounded-md border border-warning/25 bg-warning/10 p-3`,children:[(0,l.jsx)(`p`,{className:`text-xs text-warning mb-1`,children:`copy this token now — it is not recoverable later.`}),(0,l.jsx)(`pre`,{className:`font-mono text-xs whitespace-pre-wrap break-all`,children:h})]}),y&&(0,l.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:y})]}),(0,l.jsx)(`div`,{children:(0,l.jsxs)(`label`,{className:`text-sm flex items-center gap-2`,children:[(0,l.jsx)(`input`,{type:`checkbox`,checked:d,onChange:e=>{window.location.assign(e.target.checked?`/config/tokens?all=1`:`/config/tokens`)}}),`show revoked`]})}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[720px] text-sm`,children:[(0,l.jsx)(`thead`,{className:`text-left text-muted-foreground border-b`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:`py-2`,children:`label`}),(0,l.jsx)(`th`,{children:`kind`}),(0,l.jsx)(`th`,{children:`id`}),(0,l.jsx)(`th`,{children:`state`}),(0,l.jsx)(`th`,{children:`created`}),(0,l.jsx)(`th`,{children:`last used`}),(0,l.jsx)(`th`,{children:`expires`}),(0,l.jsx)(`th`,{})]})}),(0,l.jsxs)(`tbody`,{children:[e.length===0&&(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:8,className:`py-6 text-center text-muted-foreground italic`,children:`no tokens yet — mint one above`})}),e.map(e=>{let t=e.kind===`bootstrap`;return(0,l.jsxs)(`tr`,{className:`border-b last:border-0 hover:bg-accent/30`,children:[(0,l.jsxs)(`td`,{className:`py-2`,children:[e.label,t&&(0,l.jsx)(`span`,{className:`ml-2 text-[0.7em] uppercase tracking-wide text-muted-foreground`,children:`auth.json`})]}),(0,l.jsx)(`td`,{children:e.kind}),(0,l.jsx)(`td`,{children:(0,l.jsx)(`code`,{className:`font-mono text-xs`,children:e.id})}),(0,l.jsx)(`td`,{children:e.revokedAt?(0,l.jsx)(`span`,{className:`text-muted-foreground`,children:`revoked`}):(0,l.jsx)(`span`,{className:`text-success`,children:`active`})}),(0,l.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:u(e.createdAt)}),(0,l.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:e.lastUsedAt?u(e.lastUsedAt):`(never)`}),(0,l.jsx)(`td`,{className:`text-muted-foreground text-xs`,children:e.expiresAt?u(e.expiresAt):`(never)`}),(0,l.jsx)(`td`,{children:!e.revokedAt&&!t&&(0,l.jsx)(o,{variant:`danger`,className:`text-xs`,onClick:()=>{b(null),w(e)},children:`revoke`})})]},e.id)})]})]})}),(0,l.jsxs)(`section`,{className:`space-y-3`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h3`,{className:`font-serif text-xl`,children:`Browser sessions`}),(0,l.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Sessions expire after 12 idle hours or seven days absolute. Revoking a device also revokes every session created from it.`})]}),(0,l.jsx)(`div`,{className:`overflow-x-auto`,children:(0,l.jsxs)(`table`,{className:`w-full min-w-[720px] text-sm`,children:[(0,l.jsx)(`thead`,{className:`border-b text-left text-muted-foreground`,children:(0,l.jsxs)(`tr`,{children:[(0,l.jsx)(`th`,{className:`py-2`,children:`device`}),(0,l.jsx)(`th`,{children:`session`}),(0,l.jsx)(`th`,{children:`last seen`}),(0,l.jsx)(`th`,{children:`idle expiry`}),(0,l.jsx)(`th`,{children:`absolute expiry`}),(0,l.jsx)(`th`,{})]})}),(0,l.jsxs)(`tbody`,{children:[t.length===0&&(0,l.jsx)(`tr`,{children:(0,l.jsx)(`td`,{colSpan:6,className:`py-6 text-center italic text-muted-foreground`,children:`no active browser sessions`})}),t.map(e=>(0,l.jsxs)(`tr`,{className:`border-b last:border-0 hover:bg-accent/30`,children:[(0,l.jsxs)(`td`,{className:`py-2`,children:[e.deviceLabel,` `,e.current&&(0,l.jsx)(`span`,{className:`text-xs text-success`,children:`current`})]}),(0,l.jsx)(`td`,{children:(0,l.jsx)(`code`,{className:`font-mono text-xs`,children:e.id})}),(0,l.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:u(e.lastSeenAt)}),(0,l.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:u(e.idleExpiresAt)}),(0,l.jsx)(`td`,{className:`text-xs text-muted-foreground`,children:u(e.absoluteExpiresAt)}),(0,l.jsx)(`td`,{children:(0,l.jsx)(o,{variant:`danger`,className:`text-xs`,onClick:()=>{b(null),E(e)},children:`revoke`})})]},e.id))]})]})})]}),(0,l.jsx)(i,{open:C!==null,title:`Revoke ${C?.label??``}?`,description:(0,l.jsxs)(`p`,{children:[`This permanently revokes device token`,` `,(0,l.jsx)(`code`,{className:`font-mono`,children:C?.id}),` and every browser session created from it. Clients using it will be signed out and cannot reconnect with this credential.`,t.some(e=>e.current&&e.deviceTokenId===C?.id)&&` This includes the browser session you are using now.`]}),confirmLabel:`revoke token and sessions`,onConfirm:async()=>{if(C)try{await O(C.id,t.some(e=>e.current&&e.deviceTokenId===C.id))}catch(e){throw b(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||w(null)}}),(0,l.jsx)(i,{open:T!==null,title:`Revoke ${T?.deviceLabel??``} browser session?`,description:(0,l.jsxs)(`p`,{children:[`This ends browser session `,(0,l.jsx)(`code`,{className:`font-mono`,children:T?.id}),T?.current?` and signs this browser out immediately.`:`. The device token remains active for future logins.`]}),confirmLabel:T?.current?`sign out this browser`:`revoke session`,onConfirm:async()=>{if(T)try{await k(T.id,T.current)}catch(e){throw b(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||E(null)}})]})}export{d as component};
@@ -1 +1 @@
1
- import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./ConfirmDialog-_bmG-wVG.js";import{a}from"./index-CLdmsmiN.js";import{r as o}from"./Page-NV96O47A.js";import{t as s}from"./AgentTabs-BcmmwYJc.js";import{t as c}from"./Button-ByiV6fpd.js";var l=e(n()),u=t();function d(){let{resolved:e,triggers:t,dispatches:n}=a.useLoaderData(),d=r(),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(null),[_,v]=(0,l.useState)(null);async function y(e){v(e.id),g(null);try{let t=await fetch(`/api/triggers/${encodeURIComponent(e.id)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:!e.enabled})});if(!t.ok){let n=await t.json().catch(()=>null);throw Error(n?.error??`Could not ${e.enabled?`disable`:`enable`} trigger`)}await d.invalidate()}catch(e){g(e instanceof Error?e.message:String(e))}finally{v(null)}}async function b(e){let t=await fetch(`/api/triggers/${encodeURIComponent(e)}`,{method:`DELETE`});if(!t.ok&&t.status!==204){let e=await t.json().catch(()=>null);throw Error(e?.error??`Could not delete trigger`)}await d.invalidate()}return(0,u.jsxs)(o,{children:[(0,u.jsx)(`header`,{className:`mb-6`,children:(0,u.jsx)(`h1`,{children:e.agent.name})}),(0,u.jsx)(s,{agentId:e.agent.id,active:`triggers`,archived:e.agent.status===`archived`}),(0,u.jsx)(f,{agentId:e.agent.id,onAdded:()=>d.invalidate()}),h&&(0,u.jsx)(`p`,{role:`alert`,className:`err mt-4`,children:h}),(0,u.jsx)(`h3`,{className:`mb-3 mt-6 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:`Active triggers`}),t.length===0?(0,u.jsx)(`p`,{className:`muted`,children:`no triggers yet — add one above.`}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:`grid gap-3 md:hidden`,children:t.map(e=>{let t=e.kind===`interval`?`every ${e.intervalSec}s`:e.cronExpr,n=e.lastFiredAt?new Date(e.lastFiredAt).toLocaleString():`Never`;return(0,u.jsxs)(`article`,{className:`card min-w-0 ${e.enabled?``:`opacity-60`}`,children:[(0,u.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,u.jsxs)(`div`,{className:`min-w-0`,children:[(0,u.jsx)(`p`,{className:`m-0 break-all font-mono text-xs text-muted-foreground`,children:e.id}),(0,u.jsx)(`p`,{className:`mb-0 mt-1 font-medium text-foreground`,children:t})]}),(0,u.jsx)(`span`,{className:`shrink-0 rounded-sm border border-frost bg-ivory px-2 py-0.5 font-mono text-xs text-mocha`,children:e.kind})]}),(0,u.jsx)(`p`,{className:`my-3 break-words text-sm text-foreground`,children:e.message}),(0,u.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[`Last fired: `,n]}),(0,u.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,u.jsx)(c,{variant:`ghost`,disabled:_===e.id,onClick:()=>void y(e),children:_===e.id?`Working…`:e.enabled?`Disable`:`Enable`}),(0,u.jsx)(c,{variant:`danger`,disabled:_===e.id,onClick:()=>{g(null),m(e)},children:`Delete`})]})]},e.id)})}),(0,u.jsx)(`div`,{className:`hidden overflow-x-auto md:block`,children:(0,u.jsxs)(`table`,{className:`min-w-full`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`id`}),(0,u.jsx)(`th`,{children:`kind`}),(0,u.jsx)(`th`,{children:`spec`}),(0,u.jsx)(`th`,{children:`message`}),(0,u.jsx)(`th`,{children:`last fired`}),(0,u.jsx)(`th`,{})]})}),(0,u.jsx)(`tbody`,{children:t.map(e=>{let t=e.kind===`interval`?`every ${e.intervalSec}s`:e.cronExpr,n=e.lastFiredAt?new Date(e.lastFiredAt).toLocaleString():`(never)`;return(0,u.jsxs)(`tr`,{className:e.enabled?``:`opacity-60`,children:[(0,u.jsx)(`td`,{children:(0,u.jsxs)(`code`,{children:[e.id.slice(0,8),`…`]})}),(0,u.jsx)(`td`,{children:(0,u.jsx)(`span`,{className:`inline-block rounded-sm border border-frost bg-ivory px-2 py-0.5 font-mono text-[0.8em] text-mocha`,children:e.kind})}),(0,u.jsx)(`td`,{children:(0,u.jsx)(`code`,{children:t})}),(0,u.jsx)(`td`,{children:e.message.length>60?`${e.message.slice(0,60)}…`:e.message}),(0,u.jsx)(`td`,{className:`text-[0.82em] text-mocha-light`,children:n}),(0,u.jsx)(`td`,{children:(0,u.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,u.jsx)(c,{variant:`ghost`,disabled:_===e.id,onClick:()=>void y(e),children:_===e.id?`working…`:e.enabled?`disable`:`enable`}),(0,u.jsx)(c,{variant:`danger`,disabled:_===e.id,onClick:()=>{g(null),m(e)},children:`delete`})]})})]},e.id)})})]})})]}),(0,u.jsx)(`h3`,{className:`mb-3 mt-8 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:`Recent dispatches`}),n.length===0?(0,u.jsx)(`p`,{className:`muted`,children:`no scheduled occurrences yet.`}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:`grid gap-3 md:hidden`,children:n.map(e=>(0,u.jsxs)(`article`,{className:`card min-w-0`,children:[(0,u.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,u.jsx)(`time`,{className:`text-sm text-foreground`,children:new Date(e.scheduledAt).toLocaleString()}),(0,u.jsx)(`code`,{className:`shrink-0`,children:e.status})]}),(0,u.jsxs)(`p`,{className:`mb-0 mt-2 text-xs text-muted-foreground`,children:[e.attemptCount,` attempt`,e.attemptCount===1?``:`s`]}),e.lastError&&(0,u.jsx)(`p`,{className:`mb-0 mt-2 break-words text-sm text-danger`,children:e.lastError})]},e.id))}),(0,u.jsx)(`div`,{className:`hidden overflow-x-auto md:block`,children:(0,u.jsxs)(`table`,{className:`min-w-full`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`scheduled`}),(0,u.jsx)(`th`,{children:`status`}),(0,u.jsx)(`th`,{children:`attempts`}),(0,u.jsx)(`th`,{children:`error`})]})}),(0,u.jsx)(`tbody`,{children:n.map(e=>(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`td`,{className:`text-[0.82em]`,children:new Date(e.scheduledAt).toLocaleString()}),(0,u.jsx)(`td`,{children:(0,u.jsx)(`code`,{children:e.status})}),(0,u.jsx)(`td`,{children:e.attemptCount}),(0,u.jsx)(`td`,{className:`text-[0.82em] text-mocha-light`,children:e.lastError??`—`})]},e.id))})]})})]}),(0,u.jsx)(i,{open:p!==null,title:`Delete ${p?.kind??``} trigger?`,description:(0,u.jsxs)(`p`,{children:[`This permanently removes trigger`,` `,(0,u.jsx)(`code`,{className:`font-mono`,children:p?.id}),`, its recorded dispatch history, and every future scheduled occurrence for `,e.agent.name,`. The Agent itself is not deleted.`]}),confirmLabel:`delete trigger and history`,onConfirm:async()=>{if(p)try{await b(p.id)}catch(e){throw g(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||m(null)}})]})}function f({agentId:e,onAdded:t}){let[n,r]=(0,l.useState)(`interval`),[i,a]=(0,l.useState)(300),[o,s]=(0,l.useState)(``),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(!1);async function _(r){if(r.preventDefault(),m(null),!d.trim()){m(`message is required`);return}if(n===`interval`&&(!Number.isFinite(i)||i<=0)){m(`interval must be a positive number`);return}if(n===`cron`&&!o.trim()){m(`cron expression is required`);return}g(!0);try{let r={kind:n,message:d.trim()};n===`interval`?r.intervalSec=i:r.cronExpr=o.trim();let c=await fetch(`/api/agents/${encodeURIComponent(e)}/triggers`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!c.ok){let e=await c.json().catch(()=>null);throw Error(e?.error??c.statusText)}f(``),s(``),a(300),t()}catch(e){m(e.message)}finally{g(!1)}}return(0,u.jsxs)(`form`,{className:`card`,onSubmit:_,children:[(0,u.jsx)(`h3`,{children:`Add trigger`}),(0,u.jsxs)(`div`,{className:`mb-3 flex gap-3`,children:[(0,u.jsxs)(`label`,{className:`m-0 inline-flex cursor-pointer items-center gap-1`,children:[(0,u.jsx)(`input`,{type:`radio`,checked:n===`interval`,onChange:()=>r(`interval`)}),`interval (every N seconds)`]}),(0,u.jsxs)(`label`,{className:`m-0 inline-flex cursor-pointer items-center gap-1`,children:[(0,u.jsx)(`input`,{type:`radio`,checked:n===`cron`,onChange:()=>r(`cron`)}),`cron (5-field)`]})]}),n===`interval`?(0,u.jsxs)(`label`,{children:[`interval (seconds)`,(0,u.jsx)(`input`,{type:`number`,min:1,value:i,onChange:e=>a(Number(e.target.value))})]}):(0,u.jsxs)(`label`,{children:[`cron expression (minute hour dom month dow)`,(0,u.jsx)(`input`,{type:`text`,placeholder:`*/15 * * * *`,value:o,onChange:e=>s(e.target.value)})]}),(0,u.jsxs)(`label`,{children:[`message`,(0,u.jsx)(`textarea`,{placeholder:`e.g. check your inbox and act on anything new`,value:d,onChange:e=>f(e.target.value),className:`font-mono text-[0.9em] min-h-[80px]`})]}),(0,u.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,u.jsx)(c,{variant:`primary`,type:`submit`,disabled:h,children:h?`adding…`:`add`}),p&&(0,u.jsx)(`span`,{role:`alert`,className:`text-[0.85em] text-danger`,children:p})]})]})}export{d as component};
1
+ import{r as e,t}from"./jsx-runtime-DGeXAQPT.js";import{t as n}from"./react-3W8R1pOO.js";import{d as r}from"./preload-helper-bztXdkDj.js";import{t as i}from"./ConfirmDialog-MicTTwdy.js";import{a}from"./index-Bq2zrG2_.js";import{r as o}from"./Page-NV96O47A.js";import{t as s}from"./AgentTabs-BcmmwYJc.js";import{t as c}from"./Button-ByiV6fpd.js";var l=e(n()),u=t();function d(){let{resolved:e,triggers:t,dispatches:n}=a.useLoaderData(),d=r(),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(null),[_,v]=(0,l.useState)(null);async function y(e){v(e.id),g(null);try{let t=await fetch(`/api/triggers/${encodeURIComponent(e.id)}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({enabled:!e.enabled})});if(!t.ok){let n=await t.json().catch(()=>null);throw Error(n?.error??`Could not ${e.enabled?`disable`:`enable`} trigger`)}await d.invalidate()}catch(e){g(e instanceof Error?e.message:String(e))}finally{v(null)}}async function b(e){let t=await fetch(`/api/triggers/${encodeURIComponent(e)}`,{method:`DELETE`});if(!t.ok&&t.status!==204){let e=await t.json().catch(()=>null);throw Error(e?.error??`Could not delete trigger`)}await d.invalidate()}return(0,u.jsxs)(o,{children:[(0,u.jsx)(`header`,{className:`mb-6`,children:(0,u.jsx)(`h1`,{children:e.agent.name})}),(0,u.jsx)(s,{agentId:e.agent.id,active:`triggers`,archived:e.agent.status===`archived`}),(0,u.jsx)(f,{agentId:e.agent.id,onAdded:()=>d.invalidate()}),h&&(0,u.jsx)(`p`,{role:`alert`,className:`err mt-4`,children:h}),(0,u.jsx)(`h3`,{className:`mb-3 mt-6 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:`Active triggers`}),t.length===0?(0,u.jsx)(`p`,{className:`muted`,children:`no triggers yet — add one above.`}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:`grid gap-3 md:hidden`,children:t.map(e=>{let t=e.kind===`interval`?`every ${e.intervalSec}s`:e.cronExpr,n=e.lastFiredAt?new Date(e.lastFiredAt).toLocaleString():`Never`;return(0,u.jsxs)(`article`,{className:`card min-w-0 ${e.enabled?``:`opacity-60`}`,children:[(0,u.jsxs)(`div`,{className:`flex min-w-0 items-start justify-between gap-3`,children:[(0,u.jsxs)(`div`,{className:`min-w-0`,children:[(0,u.jsx)(`p`,{className:`m-0 break-all font-mono text-xs text-muted-foreground`,children:e.id}),(0,u.jsx)(`p`,{className:`mb-0 mt-1 font-medium text-foreground`,children:t})]}),(0,u.jsx)(`span`,{className:`shrink-0 rounded-sm border border-frost bg-ivory px-2 py-0.5 font-mono text-xs text-mocha`,children:e.kind})]}),(0,u.jsx)(`p`,{className:`my-3 break-words text-sm text-foreground`,children:e.message}),(0,u.jsxs)(`p`,{className:`mb-3 text-xs text-muted-foreground`,children:[`Last fired: `,n]}),(0,u.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,u.jsx)(c,{variant:`ghost`,disabled:_===e.id,onClick:()=>void y(e),children:_===e.id?`Working…`:e.enabled?`Disable`:`Enable`}),(0,u.jsx)(c,{variant:`danger`,disabled:_===e.id,onClick:()=>{g(null),m(e)},children:`Delete`})]})]},e.id)})}),(0,u.jsx)(`div`,{className:`hidden overflow-x-auto md:block`,children:(0,u.jsxs)(`table`,{className:`min-w-full`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`id`}),(0,u.jsx)(`th`,{children:`kind`}),(0,u.jsx)(`th`,{children:`spec`}),(0,u.jsx)(`th`,{children:`message`}),(0,u.jsx)(`th`,{children:`last fired`}),(0,u.jsx)(`th`,{})]})}),(0,u.jsx)(`tbody`,{children:t.map(e=>{let t=e.kind===`interval`?`every ${e.intervalSec}s`:e.cronExpr,n=e.lastFiredAt?new Date(e.lastFiredAt).toLocaleString():`(never)`;return(0,u.jsxs)(`tr`,{className:e.enabled?``:`opacity-60`,children:[(0,u.jsx)(`td`,{children:(0,u.jsxs)(`code`,{children:[e.id.slice(0,8),`…`]})}),(0,u.jsx)(`td`,{children:(0,u.jsx)(`span`,{className:`inline-block rounded-sm border border-frost bg-ivory px-2 py-0.5 font-mono text-[0.8em] text-mocha`,children:e.kind})}),(0,u.jsx)(`td`,{children:(0,u.jsx)(`code`,{children:t})}),(0,u.jsx)(`td`,{children:e.message.length>60?`${e.message.slice(0,60)}…`:e.message}),(0,u.jsx)(`td`,{className:`text-[0.82em] text-mocha-light`,children:n}),(0,u.jsx)(`td`,{children:(0,u.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,u.jsx)(c,{variant:`ghost`,disabled:_===e.id,onClick:()=>void y(e),children:_===e.id?`working…`:e.enabled?`disable`:`enable`}),(0,u.jsx)(c,{variant:`danger`,disabled:_===e.id,onClick:()=>{g(null),m(e)},children:`delete`})]})})]},e.id)})})]})})]}),(0,u.jsx)(`h3`,{className:`mb-3 mt-8 font-body text-[0.85em] font-semibold uppercase tracking-wider text-mocha-light`,children:`Recent dispatches`}),n.length===0?(0,u.jsx)(`p`,{className:`muted`,children:`no scheduled occurrences yet.`}):(0,u.jsxs)(u.Fragment,{children:[(0,u.jsx)(`div`,{className:`grid gap-3 md:hidden`,children:n.map(e=>(0,u.jsxs)(`article`,{className:`card min-w-0`,children:[(0,u.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,u.jsx)(`time`,{className:`text-sm text-foreground`,children:new Date(e.scheduledAt).toLocaleString()}),(0,u.jsx)(`code`,{className:`shrink-0`,children:e.status})]}),(0,u.jsxs)(`p`,{className:`mb-0 mt-2 text-xs text-muted-foreground`,children:[e.attemptCount,` attempt`,e.attemptCount===1?``:`s`]}),e.lastError&&(0,u.jsx)(`p`,{className:`mb-0 mt-2 break-words text-sm text-danger`,children:e.lastError})]},e.id))}),(0,u.jsx)(`div`,{className:`hidden overflow-x-auto md:block`,children:(0,u.jsxs)(`table`,{className:`min-w-full`,children:[(0,u.jsx)(`thead`,{children:(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`th`,{children:`scheduled`}),(0,u.jsx)(`th`,{children:`status`}),(0,u.jsx)(`th`,{children:`attempts`}),(0,u.jsx)(`th`,{children:`error`})]})}),(0,u.jsx)(`tbody`,{children:n.map(e=>(0,u.jsxs)(`tr`,{children:[(0,u.jsx)(`td`,{className:`text-[0.82em]`,children:new Date(e.scheduledAt).toLocaleString()}),(0,u.jsx)(`td`,{children:(0,u.jsx)(`code`,{children:e.status})}),(0,u.jsx)(`td`,{children:e.attemptCount}),(0,u.jsx)(`td`,{className:`text-[0.82em] text-mocha-light`,children:e.lastError??`—`})]},e.id))})]})})]}),(0,u.jsx)(i,{open:p!==null,title:`Delete ${p?.kind??``} trigger?`,description:(0,u.jsxs)(`p`,{children:[`This permanently removes trigger`,` `,(0,u.jsx)(`code`,{className:`font-mono`,children:p?.id}),`, its recorded dispatch history, and every future scheduled occurrence for `,e.agent.name,`. The Agent itself is not deleted.`]}),confirmLabel:`delete trigger and history`,onConfirm:async()=>{if(p)try{await b(p.id)}catch(e){throw g(e instanceof Error?e.message:String(e)),e}},onOpenChange:e=>{e||m(null)}})]})}function f({agentId:e,onAdded:t}){let[n,r]=(0,l.useState)(`interval`),[i,a]=(0,l.useState)(300),[o,s]=(0,l.useState)(``),[d,f]=(0,l.useState)(``),[p,m]=(0,l.useState)(null),[h,g]=(0,l.useState)(!1);async function _(r){if(r.preventDefault(),m(null),!d.trim()){m(`message is required`);return}if(n===`interval`&&(!Number.isFinite(i)||i<=0)){m(`interval must be a positive number`);return}if(n===`cron`&&!o.trim()){m(`cron expression is required`);return}g(!0);try{let r={kind:n,message:d.trim()};n===`interval`?r.intervalSec=i:r.cronExpr=o.trim();let c=await fetch(`/api/agents/${encodeURIComponent(e)}/triggers`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(r)});if(!c.ok){let e=await c.json().catch(()=>null);throw Error(e?.error??c.statusText)}f(``),s(``),a(300),t()}catch(e){m(e.message)}finally{g(!1)}}return(0,u.jsxs)(`form`,{className:`card`,onSubmit:_,children:[(0,u.jsx)(`h3`,{children:`Add trigger`}),(0,u.jsxs)(`div`,{className:`mb-3 flex gap-3`,children:[(0,u.jsxs)(`label`,{className:`m-0 inline-flex cursor-pointer items-center gap-1`,children:[(0,u.jsx)(`input`,{type:`radio`,checked:n===`interval`,onChange:()=>r(`interval`)}),`interval (every N seconds)`]}),(0,u.jsxs)(`label`,{className:`m-0 inline-flex cursor-pointer items-center gap-1`,children:[(0,u.jsx)(`input`,{type:`radio`,checked:n===`cron`,onChange:()=>r(`cron`)}),`cron (5-field)`]})]}),n===`interval`?(0,u.jsxs)(`label`,{children:[`interval (seconds)`,(0,u.jsx)(`input`,{type:`number`,min:1,value:i,onChange:e=>a(Number(e.target.value))})]}):(0,u.jsxs)(`label`,{children:[`cron expression (minute hour dom month dow)`,(0,u.jsx)(`input`,{type:`text`,placeholder:`*/15 * * * *`,value:o,onChange:e=>s(e.target.value)})]}),(0,u.jsxs)(`label`,{children:[`message`,(0,u.jsx)(`textarea`,{placeholder:`e.g. check your inbox and act on anything new`,value:d,onChange:e=>f(e.target.value),className:`font-mono text-[0.9em] min-h-[80px]`})]}),(0,u.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,u.jsx)(c,{variant:`primary`,type:`submit`,disabled:h,children:h?`adding…`:`add`}),p&&(0,u.jsx)(`span`,{role:`alert`,className:`text-[0.85em] text-danger`,children:p})]})]})}export{d as component};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{q as t}from"./index-CLdmsmiN.js";import{i as n,n as r,r as i}from"./Page-NV96O47A.js";var a=t(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),o=e();function s(){return(0,o.jsxs)(i,{size:`narrow`,children:[(0,o.jsx)(r,{eyebrow:`First run`,title:`Welcome to bazilion`,description:`Configure one model provider to prepare your defaults, then test it before the first conversation.`}),(0,o.jsxs)(n,{title:`Three steps to your first conversation`,children:[(0,o.jsxs)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:[`Before you can spawn agents, enable a provider and save at least one concrete model id. Bazilion then creates a `,(0,o.jsx)(`code`,{children:`default`}),` Agent template and `,(0,o.jsx)(`code`,{children:`default`}),` Team. Send the small connection test before relying on that model.`]}),(0,o.jsxs)(`ol`,{className:`my-5 space-y-4`,children:[(0,o.jsxs)(c,{n:1,children:[(0,o.jsx)(`strong`,{children:`Choose a provider.`}),` Head to the`,` `,(0,o.jsx)(`a`,{href:`/config`,children:`providers tab`}),`, pick a provider, and set credentials or a local endpoint if that provider needs one. Local providers like Ollama and LM Studio can use their default loopback URLs.`]}),(0,o.jsxs)(c,{n:2,children:[(0,o.jsx)(`strong`,{children:`Enable it and save a model.`}),` Flip the provider's toggle on, then click a catalog chip or type one exact model id (for example`,` `,(0,o.jsx)(`code`,{children:`claude-opus-5`}),`, `,(0,o.jsx)(`code`,{children:`gpt-6-astra`}),`, or `,(0,o.jsx)(`code`,{children:`llama3.3`}),`) and press `,(0,o.jsx)(`em`,{children:`save models`}),`.`]}),(0,o.jsxs)(c,{n:3,children:[(0,o.jsx)(`strong`,{children:`Verify and spawn.`}),` Send the short real-model test. When setup is configured, the page gives you a direct action to spawn the first agent from the`,` `,(0,o.jsx)(`code`,{children:`default`}),` template.`]})]}),(0,o.jsxs)(`a`,{href:`/config`,className:`btn-primary no-underline`,children:[`Configure providers `,(0,o.jsx)(a,{className:`h-4 w-4`,"aria-hidden":`true`})]})]})]})}function c({n:e,children:t}){return(0,o.jsxs)(`li`,{className:`grid grid-cols-[2rem_1fr] gap-3 border-t border-frost pt-3 first:border-t-0 first:pt-0`,children:[(0,o.jsx)(`span`,{className:`text-center font-display text-xl text-sapphire`,children:e}),(0,o.jsx)(`div`,{className:`text-[0.92em] leading-relaxed text-mocha`,children:t})]})}export{s as component};
1
+ import{t as e}from"./jsx-runtime-DGeXAQPT.js";import{Y as t}from"./index-Bq2zrG2_.js";import{i as n,n as r,r as i}from"./Page-NV96O47A.js";var a=t(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),o=e();function s(){return(0,o.jsxs)(i,{size:`narrow`,children:[(0,o.jsx)(r,{eyebrow:`First run`,title:`Welcome to bazilion`,description:`Configure one model provider to prepare your defaults, then test it before the first conversation.`}),(0,o.jsxs)(n,{title:`Three steps to your first conversation`,children:[(0,o.jsxs)(`p`,{className:`text-sm leading-6 text-muted-foreground`,children:[`Before you can spawn agents, enable a provider and save at least one concrete model id. Bazilion then creates a `,(0,o.jsx)(`code`,{children:`default`}),` Agent template and `,(0,o.jsx)(`code`,{children:`default`}),` Team. Send the small connection test before relying on that model.`]}),(0,o.jsxs)(`ol`,{className:`my-5 space-y-4`,children:[(0,o.jsxs)(c,{n:1,children:[(0,o.jsx)(`strong`,{children:`Choose a provider.`}),` Head to the`,` `,(0,o.jsx)(`a`,{href:`/config`,children:`providers tab`}),`, pick a provider, and set credentials or a local endpoint if that provider needs one. Local providers like Ollama and LM Studio can use their default loopback URLs.`]}),(0,o.jsxs)(c,{n:2,children:[(0,o.jsx)(`strong`,{children:`Enable it and save a model.`}),` Flip the provider's toggle on, then click a catalog chip or type one exact model id (for example`,` `,(0,o.jsx)(`code`,{children:`claude-opus-5`}),`, `,(0,o.jsx)(`code`,{children:`gpt-6-astra`}),`, or `,(0,o.jsx)(`code`,{children:`llama3.3`}),`) and press `,(0,o.jsx)(`em`,{children:`save models`}),`.`]}),(0,o.jsxs)(c,{n:3,children:[(0,o.jsx)(`strong`,{children:`Verify and spawn.`}),` Send the short real-model test. When setup is configured, the page gives you a direct action to spawn the first agent from the`,` `,(0,o.jsx)(`code`,{children:`default`}),` template.`]})]}),(0,o.jsxs)(`a`,{href:`/config`,className:`btn-primary no-underline`,children:[`Configure providers `,(0,o.jsx)(a,{className:`h-4 w-4`,"aria-hidden":`true`})]})]})]})}function c({n:e,children:t}){return(0,o.jsxs)(`li`,{className:`grid grid-cols-[2rem_1fr] gap-3 border-t border-frost pt-3 first:border-t-0 first:pt-0`,children:[(0,o.jsx)(`span`,{className:`text-center font-display text-xl text-sapphire`,children:e}),(0,o.jsx)(`div`,{className:`text-[0.92em] leading-relaxed text-mocha`,children:t})]})}export{s as component};
@@ -0,0 +1 @@
1
+ var e=`default`,t=`default`,n=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];export{t as n,n as r,e as t};
@@ -1 +1 @@
1
- import{q as e}from"./index-CLdmsmiN.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),n=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t as n,n as t};
1
+ import{Y as e}from"./index-Bq2zrG2_.js";var t=e(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),n=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t as n,n as t};