@cartanova/qgrid-cli 2.7.4 → 2.7.6

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 (47) hide show
  1. package/bundle/dist/application/qgrid/qgrid.dispatcher.js +7 -3
  2. package/bundle/dist/application/qgrid/qgrid.frame.js +27 -11
  3. package/bundle/dist/application/qgrid/qgrid.types.js +2 -1
  4. package/bundle/dist/application/qgrid/token-subscriber.js +19 -1
  5. package/bundle/dist/application/qgrid/token-window-keepalive.js +153 -0
  6. package/bundle/dist/application/setting/setting.constant.js +11 -1
  7. package/bundle/dist/application/token/token.model.js +18 -1
  8. package/bundle/dist/migrations/20260819102011_alter_tokens_alter1.js +13 -0
  9. package/bundle/dist/sonamu.config.js +9 -1
  10. package/bundle/dist/utils/providers/anthropic/anthropic-dispatcher.js +7 -4
  11. package/bundle/dist/utils/providers/openai/openai-dispatcher.js +11 -3
  12. package/bundle/src/application/qgrid/qgrid.dispatcher.test.ts +51 -0
  13. package/bundle/src/application/qgrid/qgrid.dispatcher.ts +14 -4
  14. package/bundle/src/application/qgrid/qgrid.frame.test.ts +58 -0
  15. package/bundle/src/application/qgrid/qgrid.frame.ts +39 -12
  16. package/bundle/src/application/qgrid/qgrid.types.ts +2 -0
  17. package/bundle/src/application/qgrid/token-subscriber.test.ts +112 -0
  18. package/bundle/src/application/qgrid/token-subscriber.ts +35 -0
  19. package/bundle/src/application/qgrid/token-window-keepalive.test.ts +223 -0
  20. package/bundle/src/application/qgrid/token-window-keepalive.ts +227 -0
  21. package/bundle/src/application/setting/setting.constant.test.ts +10 -0
  22. package/bundle/src/application/setting/setting.constant.ts +11 -1
  23. package/bundle/src/application/sonamu.generated.http +2 -0
  24. package/bundle/src/application/token/token.entity.json +8 -1
  25. package/bundle/src/application/token/token.model.test.ts +37 -0
  26. package/bundle/src/application/token/token.model.ts +20 -0
  27. package/bundle/src/migrations/20260819102011_alter_tokens_alter1.ts +13 -0
  28. package/bundle/src/sonamu.config.ts +14 -0
  29. package/bundle/src/utils/providers/anthropic/anthropic-dispatcher.test.ts +46 -0
  30. package/bundle/src/utils/providers/anthropic/anthropic-dispatcher.ts +13 -4
  31. package/bundle/src/utils/providers/common/provider-dispatcher.ts +2 -0
  32. package/bundle/src/utils/providers/openai/openai-dispatcher.test.ts +30 -0
  33. package/bundle/src/utils/providers/openai/openai-dispatcher.ts +17 -1
  34. package/bundle/web-dist/client/assets/index-BbOyk01G.js +106 -0
  35. package/bundle/web-dist/client/assets/{logs-UlTjUAUB.js → logs-B7Pc88bf.js} +1 -1
  36. package/bundle/web-dist/client/assets/{monit-CVNZnd8j.js → monit-CzMV4lZf.js} +1 -1
  37. package/bundle/web-dist/client/assets/{routes-CF7Jlmfi.js → routes-COWTRxZo.js} +1 -1
  38. package/bundle/web-dist/client/assets/settings-Dpaosy-o.js +1 -0
  39. package/bundle/web-dist/client/assets/{show-CGhg0fbn.js → show-YvdybkKd.js} +1 -1
  40. package/bundle/web-dist/client/assets/{tokens-DaEtcsoL.js → tokens-DynVDx0c.js} +1 -1
  41. package/bundle/web-dist/client/assets/{use-oauth-login-flow-Eovfx07A.js → use-oauth-login-flow-OzmHElsE.js} +1 -1
  42. package/bundle/web-dist/client/index.html +1 -1
  43. package/bundle/web-dist/server/assets/{settings-nCv71sax.js → settings-CIYR7h3G.js} +1 -0
  44. package/bundle/web-dist/server/entry-server.generated.js +96 -51
  45. package/package.json +3 -2
  46. package/bundle/web-dist/client/assets/index-CPYQIUqO.js +0 -106
  47. package/bundle/web-dist/client/assets/settings-N-8sXHl6.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{_ as t,y as n}from"./vendor-tanstack-DJRQAbrY.js";import{i as r,r as i}from"./vendor-react-DH4kUfK2.js";import{a,c as o,g as s,n as c}from"./services.generated-CA7oRRYY.js";import{s as l}from"./index-CPYQIUqO.js";import{t as u}from"./plus-DqBd6gHk.js";var d=e(r()),f=i(),p=e=>(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,f.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,f.jsx)(`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 19.876 0a1 1 0 0 1 0 .696a10.75 10.75 0 0 1-19.876 0`}),(0,f.jsx)(`circle`,{cx:12,cy:12,r:3})]})}),m=e=>(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,f.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,f.jsx)(`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575a1 1 0 0 1 0 .696a10.8 10.8 0 0 1-1.444 2.49m-6.41-.679a3 3 0 0 1-4.242-4.242`}),(0,f.jsx)(`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151a1 1 0 0 1 0-.696a10.75 10.75 0 0 1 4.446-5.143M2 2l20 20`})]})}),h=e=>(0,f.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,f.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M5 12h14`})}),g={slack:`Slack 알림`,slackConnection:`Slack 연결`},_=180*1e3;function v(e){return e?e.length<=12?`•`.repeat(e.length):`${e.slice(0,8)}${`•`.repeat(12)}${e.slice(-4)}`:``}function y({value:e,min:t,max:n,step:r,disabled:i,onChange:a}){let o=Number(e),s=Number.isFinite(o),c=t??-1/0,l=n??1/0,d=e=>{let n=Math.min(Math.max((s?o:t??0)+e,c),l);a(String(Number(n.toFixed(2))))};return(0,f.jsxs)(`div`,{className:`inline-flex items-center rounded-lg border border-sand-200/80 bg-white overflow-hidden`,children:[(0,f.jsx)(`button`,{type:`button`,"aria-label":`감소`,onClick:()=>d(-r),disabled:i||s&&o<=c,className:`size-7 grid place-items-center text-sand-500 hover:bg-sand-100 disabled:opacity-30 disabled:hover:bg-transparent transition-colors duration-150`,children:(0,f.jsx)(h,{className:`size-3`})}),(0,f.jsx)(`input`,{value:e,onChange:e=>a(e.target.value),disabled:i,inputMode:`decimal`,className:`w-12 text-center text-[12px] tabular-nums text-sand-800 bg-transparent border-x border-sand-200/80 py-1 focus:outline-none focus:bg-sand-50`}),(0,f.jsx)(`button`,{type:`button`,"aria-label":`증가`,onClick:()=>d(r),disabled:i||s&&o>=l,className:`size-7 grid place-items-center text-sand-500 hover:bg-sand-100 disabled:opacity-30 disabled:hover:bg-transparent transition-colors duration-150`,children:(0,f.jsx)(u,{className:`size-3`})})]})}function b({value:e,presets:t,disabled:n,onChange:r}){let i=Number(e);return(0,f.jsx)(`div`,{className:`segmented-control inline-flex`,children:t.map(e=>(0,f.jsx)(`button`,{type:`button`,disabled:n,"data-active":i===e,onClick:()=>r(String(e)),className:`rounded-[6px] px-2.5 py-1 text-[11px] font-medium tabular-nums text-sand-500 transition-colors hover:text-sand-800 disabled:opacity-50 data-[active=true]:text-sand-900`,children:e>=60?`${e/60}시간`:`${e}분`},e))})}function x({source:e}){return(0,f.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.5 rounded ${e===`db`?`bg-sienna-50 text-sienna-600`:`bg-sand-100 text-sand-500`}`,children:e===`db`?`저장값`:e===`env`?`환경변수`:`기본값`})}function S({on:e,disabled:t,onChange:n}){return(0,f.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,disabled:t,onClick:()=>n(!e),className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors duration-200 disabled:opacity-50 ${e?`bg-sage-400`:`bg-sand-300`}`,children:(0,f.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform duration-200 ${e?`translate-x-4.5`:`translate-x-0.5`}`})})}function C({item:e}){let[t,r]=(0,d.useState)(null),[i,o]=(0,d.useState)(!1),[s,c]=(0,d.useState)(null),u=n(),h=a.useUpdateSettingMutation(),g=a.useResetSettingMutation(),_=h.isPending||g.isPending,C=t??e.value,w=t!==null&&t!==e.value,T=()=>u.invalidateQueries({queryKey:a.getSettingListQueryOptions().queryKey}),E=async t=>{c(null);try{await h.mutateAsync({key:e.key,value:t}),await T(),r(null)}catch(e){c(e.message)}},D=async()=>{c(null);try{await g.mutateAsync({key:e.key}),await T(),r(null)}catch(e){c(e.message)}},O=e.kind===`secret`;return(0,f.jsxs)(`div`,{className:`px-4 py-3 sm:px-5`,children:[(0,f.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,f.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`text-[13px] text-sand-800`,children:e.label}),(0,f.jsx)(x,{source:e.source}),e.applies===`restart`&&(0,f.jsx)(`span`,{className:`text-[10px] text-caution-500`,title:`저장해도 다음 재시작부터 반영됩니다`,children:`재시작 필요`})]}),e.help&&(0,f.jsx)(`p`,{className:`mt-0.5 text-[11px] text-sand-500`,children:e.help})]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-1.5 shrink-0`,children:[e.kind===`boolean`&&(0,f.jsx)(S,{on:C===`true`,disabled:_,onChange:e=>void E(String(e))}),e.kind===`preset`&&(0,f.jsx)(b,{value:C,presets:e.presets,disabled:_,onChange:e=>void E(e)}),(e.kind===`integer`||e.kind===`number`)&&(0,f.jsx)(y,{value:C,min:e.min,max:e.max,step:e.kind===`integer`?1:.5,disabled:_,onChange:r}),(e.kind===`string`||O)&&(0,f.jsxs)(`div`,{className:`relative`,children:[(0,f.jsx)(`input`,{value:O&&!i?v(C):C,onChange:e=>r(e.target.value),onFocus:()=>O&&o(!0),disabled:_,className:`w-48 sm:w-64 rounded-lg border border-sand-200/80 bg-white py-1.5 pl-2.5 text-[12px] text-sand-800 focus:outline-none focus:border-sienna-300 ${O?`pr-8 font-mono`:`pr-2.5`}`}),O&&(0,f.jsx)(`button`,{type:`button`,"aria-label":i?`값 숨기기`:`값 보기`,onClick:()=>o(e=>!e),className:`absolute right-1.5 top-1/2 -translate-y-1/2 size-6 grid place-items-center text-sand-400 hover:text-sand-600 transition-colors duration-150`,children:i?(0,f.jsx)(m,{className:`size-3.5`}):(0,f.jsx)(p,{className:`size-3.5`})})]}),w&&(0,f.jsx)(`button`,{type:`button`,onClick:()=>void E(C),disabled:_,className:`px-2.5 py-1.5 text-[11px] font-medium rounded-lg bg-sienna-400 text-white hover:bg-sienna-500 disabled:opacity-50 transition-colors duration-150`,children:h.isPending?`저장 중`:`저장`}),!w&&e.source===`db`&&(0,f.jsx)(`button`,{type:`button`,title:`저장값을 지웁니다 — 환경변수 또는 기본값으로 돌아갑니다`,onClick:()=>void D(),disabled:_,className:`size-7 grid place-items-center rounded-lg text-sand-400 hover:text-sand-600 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150`,children:(0,f.jsx)(l,{className:`size-3.5`})})]})]}),s&&(0,f.jsx)(`p`,{className:`mt-1.5 text-[11px] text-red-500`,children:s})]})}function w(){let[e,t]=(0,d.useState)(null),n=a.useTriggerExpiryReminderMutation(),r=async()=>{t(null);try{let{sent:e}=await n.mutateAsync();t(e===0?`재로그인이 필요한 토큰이 없습니다`:`${e}건 발송`)}catch(e){t(e.message)}};return(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e&&(0,f.jsx)(`span`,{className:`text-[11px] text-sand-500`,children:e}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>void r(),disabled:n.isPending,className:`px-2 py-1 text-[11px] rounded-lg border border-sand-200/80 text-sand-600 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150`,children:n.isPending?`보내는 중`:`지금 보내기`})]})}function T({supervisor:e}){let[r,i]=(0,d.useState)(!1),[l,u]=(0,d.useState)(!1),[p,m]=(0,d.useState)(null),[h,g]=(0,d.useState)(!1),[v,y]=(0,d.useState)(!1),[b,x]=(0,d.useState)(null),S=(0,d.useRef)(!1),C=(0,d.useRef)(0),w=n(),T=a.useRestartServerMutation(),E=T.reset,D=t({...c.healthQueryOptions(),enabled:l&&!v,refetchInterval:l&&!v?1e3:!1,refetchIntervalInBackground:!0,retry:!1});(0,d.useEffect)(()=>{if(!l||p===null||v)return;let e=Math.max(0,_-(Date.now()-p)),t=window.setTimeout(()=>{C.current+=1,E(),i(!1),u(!1),m(null),g(!1),x(`재시작 후 3분 안에 서버 준비를 확인하지 못했습니다. 상태를 확인한 뒤 다시 시도하세요.`)},e);return()=>window.clearTimeout(t)},[v,E,l,p]),(0,d.useEffect)(()=>{if(!l||p===null)return;let e=D.isError&&D.errorUpdatedAt>=p,t=D.isSuccess&&D.dataUpdatedAt>=p;if(e||t&&!D.data.ready){g(!0);return}!h||!t||!D.data.ready||S.current||(S.current=!0,y(!0),w.invalidateQueries({queryKey:a.getSettingListQueryOptions().queryKey}).then(()=>{C.current+=1,E(),i(!1),u(!1),m(null),g(!1)}).catch(e=>{C.current+=1,E(),i(!1),u(!1),m(null),g(!1),x(`서버는 준비됐지만 설정을 새로고침하지 못했습니다: ${e.message}`)}).finally(()=>{S.current=!1,y(!1)}))},[D.dataUpdatedAt,D.data?.ready,D.errorUpdatedAt,D.isError,D.isSuccess,w,E,p,l,h]);let O=async()=>{let e=C.current+1;C.current=e,x(null),g(!1),y(!1),S.current=!1,u(!0),m(Date.now());try{await T.mutateAsync()}catch(t){if(C.current!==e)return;(o(t)?t.code>=400&&t.code<500:s(t)&&t.response!==void 0&&t.response.status>=400&&t.response.status<500)&&(C.current+=1,E(),i(!1),u(!1),m(null),x(t.message||`재시작 요청이 거부되었습니다.`))}},k=()=>{l||(i(!1),x(null))};return(0,f.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,f.jsx)(`div`,{className:`panel-header px-4 py-2.5 sm:px-5`,children:(0,f.jsx)(`span`,{className:`text-[13px] font-medium text-sand-700`,children:`서버 제어`})}),(0,f.jsxs)(`div`,{className:`px-4 py-3 sm:px-5 flex items-start justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`min-w-0`,children:[(0,f.jsx)(`p`,{className:`text-[13px] text-sand-800`,children:`qgrid 재시작`}),(0,f.jsx)(`p`,{className:`mt-0.5 text-[11px] text-sand-500`,children:e?`재시작 필요 설정을 반영하고 qgrid·Codex·Claude CLI를 확인합니다`:`로컬 실행 환경에서는 재시작할 수 없습니다`})]}),(0,f.jsx)(`button`,{type:`button`,disabled:!e||l||T.isPending,onClick:()=>i(!0),className:`shrink-0 px-2.5 py-1.5 text-[11px] font-medium rounded-lg border border-red-200 text-red-600 hover:bg-red-50 disabled:opacity-40 disabled:hover:bg-transparent transition-colors duration-150`,children:`재시작`})]}),b&&(0,f.jsx)(`p`,{className:`px-4 pb-3 sm:px-5 text-[11px] text-red-500`,children:b}),r&&(0,f.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,f.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:k,onKeyDown:()=>{}}),(0,f.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-sm mx-4`,children:[(0,f.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/60`,children:(0,f.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:l?T.isPending?`재시작 요청 중`:`서버 재연결 중`:`qgrid 재시작`})}),(0,f.jsxs)(`div`,{className:`px-5 py-4 space-y-2`,children:[(0,f.jsxs)(`p`,{className:`text-[13px] text-sand-700`,children:[`워커가 다시 뜰 때까지 `,(0,f.jsx)(`strong`,{className:`text-sand-900`,children:`1~2분간 요청이 실패`}),`합니다.`]}),(0,f.jsx)(`p`,{className:`text-[12px] text-sand-500`,children:`서버를 종료하면 모니터링 도구가 다시 띄웁니다. 이때 재시작 필요 설정을 반영하고, qgrid와 Codex CLI·Claude Code의 최신 버전을 확인합니다.`}),l&&(0,f.jsx)(`p`,{className:`text-[12px] font-medium text-sienna-600`,children:T.isPending?`종료 요청을 처리하고 있습니다…`:h?`새 서버가 준비될 때까지 연결을 확인하고 있습니다…`:`서버 종료를 기다리고 있습니다…`})]}),(0,f.jsxs)(`div`,{className:`px-5 py-3 border-t border-sand-100/60 flex justify-end gap-2`,children:[!l&&(0,f.jsx)(`button`,{type:`button`,onClick:k,className:`px-3 py-1.5 text-[12px] rounded-lg text-sand-600 hover:bg-sand-100 transition-colors duration-150`,children:`취소`}),(0,f.jsx)(`button`,{type:`button`,disabled:l||T.isPending,onClick:()=>void O(),className:`px-3 py-1.5 text-[12px] font-medium rounded-lg bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 transition-colors duration-150`,children:l?T.isPending?`요청 중`:`재연결 중`:`재시작`})]})]})]})]})}function E(){let e=a.useSettingList(),{data:t,isLoading:n}=e;if(n)return(0,f.jsx)(`div`,{className:`space-y-4`,children:[0,1].map(e=>(0,f.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,f.jsx)(`div`,{className:`panel-header px-4 py-2.5 sm:px-5`,children:(0,f.jsx)(`div`,{className:`h-3 w-24 rounded bg-sand-200 animate-pulse`})}),(0,f.jsx)(`div`,{className:`divide-y divide-sand-100/80`,children:[0,1,2].map(e=>(0,f.jsxs)(`div`,{className:`px-4 py-3 sm:px-5 flex items-center justify-between gap-4`,children:[(0,f.jsx)(`div`,{className:`h-3 w-40 rounded bg-sand-100 animate-pulse`}),(0,f.jsx)(`div`,{className:`h-7 w-24 rounded-lg bg-sand-100 animate-pulse`})]},e))})]},e))});if(e.isError&&!t)return(0,f.jsxs)(`div`,{className:`panel px-5 py-6 text-center`,children:[(0,f.jsx)(`p`,{className:`text-[13px] font-medium text-sand-800`,children:`설정을 불러오지 못했습니다`}),(0,f.jsx)(`p`,{className:`mt-1 text-[11px] text-red-500`,children:e.error.message}),(0,f.jsx)(`button`,{type:`button`,onClick:()=>void e.refetch(),disabled:e.isFetching,className:`mt-3 px-3 py-1.5 text-[12px] rounded-lg border border-sand-200 text-sand-600 hover:bg-sand-100 disabled:opacity-50`,children:e.isFetching?`다시 불러오는 중`:`다시 시도`})]});let r=t?.settings??[],i=t?.runtime??[],o=[...new Set(r.map(e=>e.group))];return(0,f.jsxs)(`div`,{className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`panel-header flex items-center justify-between px-4 py-2.5 sm:px-5`,children:[(0,f.jsx)(`span`,{className:`text-[13px] font-medium text-sand-700`,children:`환경`}),(0,f.jsx)(`span`,{className:`text-[11px] text-sand-400`,children:`기동 시점 값`})]}),(0,f.jsx)(`dl`,{className:`px-4 py-3 sm:px-5 grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-1.5`,children:i.map(e=>(0,f.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3 min-w-0`,children:[(0,f.jsx)(`dt`,{className:`text-[11px] text-sand-500 shrink-0`,children:e.label}),(0,f.jsx)(`dd`,{className:`text-[12px] font-mono text-sand-700 truncate`,children:e.value})]},e.label))})]}),o.map(e=>{let t=r.filter(t=>t.group===e);return(0,f.jsxs)(`div`,{className:`panel overflow-hidden`,children:[(0,f.jsxs)(`div`,{className:`panel-header flex items-center justify-between px-4 py-2.5 sm:px-5`,children:[(0,f.jsx)(`span`,{className:`text-[13px] font-medium text-sand-700`,children:g[e]??e}),e===`slack`&&(0,f.jsx)(w,{})]}),(0,f.jsx)(`div`,{className:`divide-y divide-sand-100/80`,children:t.map(e=>(0,f.jsx)(C,{item:e},e.key))})]},e)}),(0,f.jsx)(T,{supervisor:t?.supervisor??null})]})}function D(){return(0,f.jsx)(`div`,{className:`max-w-4xl mx-auto`,children:(0,f.jsx)(E,{})})}export{D as component};