@cartanova/qgrid-cli 2.7.6 → 2.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/dist/application/qgrid/qgrid.frame.js +67 -30
- package/bundle/dist/application/qgrid/qgrid.types.js +6 -3
- package/bundle/dist/application/qgrid/token-trigger-setup.js +3 -2
- package/bundle/dist/application/qgrid/token-window-keepalive.js +10 -4
- package/bundle/dist/application/request-log/request-log.model.js +2 -2
- package/bundle/dist/application/setting/setting.constant.js +8 -4
- package/bundle/dist/application/setting/setting.model.js +4 -3
- package/bundle/dist/application/setting/setting.store.js +2 -2
- package/bundle/dist/application/setting/setting.types.js +4 -2
- package/bundle/dist/application/sonamu.generated.js +5 -3
- package/bundle/dist/application/sonamu.generated.sso.js +3 -2
- package/bundle/dist/application/token/token.model.js +7 -2
- package/bundle/dist/application/token/token.types.js +3 -2
- package/bundle/dist/i18n/sd.generated.js +2 -1
- package/bundle/dist/migrations/20260820153531_alter_tokens_add1_alter1.js +15 -0
- package/bundle/dist/sonamu.config.js +3 -1
- package/bundle/dist/utils/providers/openai/openai-callback-relay.js +86 -0
- package/bundle/dist/utils/providers/openai/openai-quota.js +4 -3
- package/bundle/src/application/qgrid/qgrid-oauth-redirect.test.ts +71 -8
- package/bundle/src/application/qgrid/qgrid.frame.test.ts +52 -0
- package/bundle/src/application/qgrid/qgrid.frame.ts +74 -26
- package/bundle/src/application/qgrid/qgrid.types.ts +4 -1
- package/bundle/src/application/qgrid/token-trigger-setup.test.ts +6 -0
- package/bundle/src/application/qgrid/token-trigger-setup.ts +2 -1
- package/bundle/src/application/qgrid/token-window-keepalive.test.ts +23 -2
- package/bundle/src/application/qgrid/token-window-keepalive.ts +13 -3
- package/bundle/src/application/request-log/request-log.model.test.ts +25 -0
- package/bundle/src/application/request-log/request-log.model.ts +3 -1
- package/bundle/src/application/setting/setting.constant.test.ts +2 -2
- package/bundle/src/application/setting/setting.constant.ts +8 -3
- package/bundle/src/application/setting/setting.model.ts +13 -2
- package/bundle/src/application/setting/setting.store.ts +2 -2
- package/bundle/src/application/setting/setting.types.ts +2 -0
- package/bundle/src/application/sonamu.generated.http +9 -4
- package/bundle/src/application/sonamu.generated.sso.ts +1 -0
- package/bundle/src/application/sonamu.generated.ts +3 -0
- package/bundle/src/application/token/token.entity.json +8 -1
- package/bundle/src/application/token/token.model.test.ts +29 -0
- package/bundle/src/application/token/token.model.ts +10 -1
- package/bundle/src/application/token/token.types.test.ts +10 -0
- package/bundle/src/application/token/token.types.ts +1 -0
- package/bundle/src/i18n/sd.generated.ts +1 -0
- package/bundle/src/migrations/20260820153531_alter_tokens_add1_alter1.ts +15 -0
- package/bundle/src/sonamu.config.ts +2 -0
- package/bundle/src/utils/providers/openai/openai-callback-relay.test.ts +109 -0
- package/bundle/src/utils/providers/openai/openai-callback-relay.ts +105 -0
- package/bundle/src/utils/providers/openai/openai-quota.test.ts +31 -0
- package/bundle/src/utils/providers/openai/openai-quota.ts +8 -2
- package/bundle/web-dist/client/assets/index-BshX4Gd8.css +1 -0
- package/bundle/web-dist/client/assets/{index-BbOyk01G.js → index-D59Q_9Z4.js} +4 -4
- package/bundle/web-dist/client/assets/{logs-B7Pc88bf.js → logs-BHVfI8ut.js} +1 -1
- package/bundle/web-dist/client/assets/{monit-CzMV4lZf.js → monit-EkLxH1oN.js} +1 -1
- package/bundle/web-dist/client/assets/{routes-COWTRxZo.js → routes-Kbvuclip.js} +2 -2
- package/bundle/web-dist/client/assets/{services.generated-CA7oRRYY.js → services.generated-Da1Eq5_R.js} +1 -1
- package/bundle/web-dist/client/assets/settings-B4uTFP3J.js +1 -0
- package/bundle/web-dist/client/assets/{show-YvdybkKd.js → show-BjIdSPTd.js} +1 -1
- package/bundle/web-dist/client/assets/tokens-BbCSxbFu.js +1 -0
- package/bundle/web-dist/client/assets/use-oauth-login-flow-4OltfVAd.js +1 -0
- package/bundle/web-dist/client/assets/use-update-token-mutation-CZ57EKA1.js +1 -0
- package/bundle/web-dist/client/index.html +3 -3
- package/bundle/web-dist/server/assets/{lazyRouteComponent-tS-rTksX.js → lazyRouteComponent-V1S8gqMS.js} +2 -2
- package/bundle/web-dist/server/assets/{logs-ttf79emP.js → logs-2Tkqcncq.js} +2 -2
- package/bundle/web-dist/server/assets/{monit-CJBUH0l6.js → monit-DrJ15xJL.js} +2 -2
- package/bundle/web-dist/server/assets/{plus-BuSuoeon.js → plus-DCai02Na.js} +1 -1
- package/bundle/web-dist/server/assets/{react-dom-7_SqhNWR.js → react-dom-BFiG5Daf.js} +1 -1
- package/bundle/web-dist/server/assets/{routes-z79f1sOM.js → routes-Ct3I9263.js} +7 -5
- package/bundle/web-dist/server/assets/{services.generated-B5UkNmgc.js → services.generated-y7xVOTCo.js} +4 -2
- package/bundle/web-dist/server/assets/{settings-CIYR7h3G.js → settings-JznSjwGQ.js} +79 -5
- package/bundle/web-dist/server/assets/{show-CLrA4ZQ-.js → show-D8kuAFbc.js} +2 -2
- package/bundle/web-dist/server/assets/{tokens-BwlkZELV.js → tokens-PR42jF1J.js} +6 -4
- package/bundle/web-dist/server/assets/{use-oauth-login-flow-B2QllVMi.js → use-oauth-login-flow-C-33Z5HA.js} +18 -17
- package/bundle/web-dist/server/assets/use-update-token-mutation-BNaRPVaX.js +7 -0
- package/bundle/web-dist/server/entry-server.generated.js +10 -10
- package/dist/cli.js +10 -11
- package/package.json +1 -1
- package/skills/qgrid/references/ai-sdk-provider-contract.md +2 -0
- package/skills/qgrid/references/cli-env-and-server-boot.md +2 -1
- package/skills/qgrid/references/openai-codex-runtime.md +12 -5
- package/skills/qgrid/references/request-log-run-lifecycle.md +2 -0
- package/skills/qgrid/references/sonamu-api-web-flow.md +2 -0
- package/skills/qgrid/references/token-auth-quota-lifecycle.md +27 -1
- package/bundle/web-dist/client/assets/index-D9xE_tO7.css +0 -1
- package/bundle/web-dist/client/assets/settings-Dpaosy-o.js +0 -1
- package/bundle/web-dist/client/assets/tokens-DynVDx0c.js +0 -1
- package/bundle/web-dist/client/assets/use-oauth-login-flow-OzmHElsE.js +0 -1
- /package/bundle/web-dist/client/assets/{plus-DqBd6gHk.js → plus-p4vtg6LN.js} +0 -0
|
@@ -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-BbOyk01G.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={qgrid:`Qgrid`,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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{y as t}from"./vendor-tanstack-DJRQAbrY.js";import{i as n,r}from"./vendor-react-DH4kUfK2.js";import{n as i,o as a}from"./services.generated-CA7oRRYY.js";import{i as o,u as s}from"./index-BbOyk01G.js";import{n as c,r as l,t as u}from"./use-oauth-login-flow-OzmHElsE.js";import{t as d}from"./plus-DqBd6gHk.js";var f=e(n(),1),p=r();function m(){let[e,t]=(0,f.useState)(!1),[n,r]=(0,f.useState)(``),i=u(),a=()=>{t(!1),r(``),i.reset()},l=async e=>{await i.submitCode(e)&&a()};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(`button`,{type:`button`,className:`px-3.5 py-1.5 text-[12px] font-medium rounded-lg bg-sienna-500 text-white hover:bg-sienna-600 disabled:opacity-50 transition-all duration-150 active:scale-[0.97] flex items-center gap-1.5 shadow-sm`,onClick:()=>t(!0),children:[(0,p.jsx)(d,{className:`size-3.5`}),`Add Token`]}),e&&(0,p.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:a,onKeyDown:()=>{}}),(0,p.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-md mx-4`,children:[(0,p.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/50`,children:(0,p.jsx)(`h2`,{className:`text-base font-medium text-sand-900`,children:`Add Token`})}),(0,p.jsxs)(`div`,{className:`px-5 py-4 space-y-4`,children:[(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{htmlFor:`token-name`,className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Name *`}),(0,p.jsx)(o,{value:n,onChange:e=>r(e.target.value),placeholder:`e.g. your-token-name`,className:`mt-1 w-full border border-sand-200 rounded-md px-3 py-2 text-sm text-sand-900 bg-white placeholder:text-sand-300 focus:outline-none focus:border-sienna-300`})]}),i.codeEntry?(0,p.jsx)(c,{isPending:i.completeMutation.isPending,isError:i.completeMutation.isError,onSubmit:e=>void l(e),onRestart:i.reset}):(0,p.jsxs)(`div`,{className:`space-y-2`,children:[(0,p.jsx)(`button`,{type:`button`,className:`w-full py-2.5 text-sm font-medium rounded-md bg-sand-900 text-white hover:bg-sand-800 disabled:opacity-50 transition-colors duration-150 flex items-center justify-center gap-2`,disabled:!n.trim()||i.loadingProvider!==null,onClick:()=>void i.start(`openai`,n),children:i.loadingProvider===`openai`?(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,p.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin`}),`Waiting for login...`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s,{className:`size-4`}),`Login with OpenAI`]})}),(0,p.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,p.jsx)(`div`,{className:`flex-1 h-px bg-sand-200`}),(0,p.jsx)(`span`,{className:`text-[10px] text-sand-400 uppercase`,children:`or`}),(0,p.jsx)(`div`,{className:`flex-1 h-px bg-sand-200`})]}),(0,p.jsx)(`button`,{type:`button`,className:`w-full py-2.5 text-sm font-medium rounded-md border border-sand-300 text-sand-700 hover:bg-sand-100 disabled:opacity-50 transition-colors duration-150 flex items-center justify-center gap-2`,disabled:!n.trim()||i.loadingProvider!==null,onClick:()=>void i.start(`anthropic`,n),children:i.loadingProvider===`anthropic`?(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,p.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-sand-400 border-t-transparent rounded-full animate-spin`}),`Waiting for login...`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(s,{className:`size-4`}),`Login with Claude`]})})]})]}),(0,p.jsx)(`div`,{className:`px-5 py-3 border-t border-sand-100/50 flex items-center justify-end gap-2`,children:(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:a,children:`Cancel`})})]})]})]})}var h=e=>(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,p.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497zM15 5l4 4`})}),g=e=>(0,p.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`1.2em`,height:`1.2em`,...e,children:(0,p.jsx)(`path`,{fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M10 11v6m4-6v6m5-11v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`})});function _(e){let t=e.credentials;return`expiresAt`in t&&typeof t.expiresAt==`number`?t.expiresAt:`accessTokenExpiresAt`in t&&typeof t.accessTokenExpiresAt==`number`?t.accessTokenExpiresAt:null}function v(e){if(!e)return{text:``,color:``};let t=e-Date.now();if(t<=0)return{text:`expired`,color:`text-red-500`};let n=Math.floor(t/36e5),r=Math.floor(t%36e5/6e4),i=n>0?`${n}h ${r}m`:`${r}m`;return t<36e5?{text:i,color:`text-amber-500`}:{text:i,color:`text-sand-400`}}function y(e){let t=e.credentials.accessToken;return t.length<=12?t:`${t.slice(0,8)}...${t.slice(-4)}`}function b({data:e,isLoading:n}){let[r,a]=(0,f.useState)(null),[s,c]=(0,f.useState)(null),[u,d]=(0,f.useState)(``),m=t(),b=i.useRemoveTokenMutation(),x=l(),S=i.useToggleTokenMutation(),C=()=>Promise.all([m.invalidateQueries({queryKey:[`Token`]}),m.invalidateQueries({queryKey:[`Qgrid`]})]),w=async e=>{await S.mutateAsync({id:e.id}),await C()},T=async()=>{r&&(await b.mutateAsync({id:r.id}),await C(),a(null))},E=e=>{c(e),d(e.name??``)},D=async()=>{s&&(await x.mutateAsync({id:s.id,name:u.trim()}),await C(),c(null))};if(n)return(0,p.jsx)(`div`,{className:`space-y-2`,children:Array.from({length:3}).map((e,t)=>(0,p.jsx)(`div`,{className:`h-12 bg-sand-100 rounded-md animate-pulse`},`skeleton-${t}`))});let O=e??[];return O.length===0?(0,p.jsxs)(`div`,{className:`text-sand-400 text-center py-16 text-sm`,children:[`No tokens registered. Click `,(0,p.jsx)(`strong`,{className:`text-sand-600`,children:`Add Token`}),` to get started.`]}):(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`div`,{className:`panel overflow-hidden`,children:(0,p.jsx)(`div`,{className:`overflow-x-auto`,children:(0,p.jsxs)(`table`,{className:`w-full min-w-[640px] text-[13px]`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{className:`panel-header`,children:[(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Provider`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Name`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Token`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Status`}),(0,p.jsx)(`th`,{className:`text-left px-5 py-2.5 text-[10px] uppercase tracking-wider text-sand-400 font-medium`,children:`Expires`}),(0,p.jsx)(`th`,{className:`w-20 px-3 py-2.5`})]})}),(0,p.jsx)(`tbody`,{className:`divide-y divide-sand-100/80`,children:O.map(e=>{let t=v(_(e));return(0,p.jsxs)(`tr`,{className:`transition-colors duration-150 hover:bg-sand-100/60 ${e.active?``:`opacity-50`}`,children:[(0,p.jsx)(`td`,{className:`px-5 py-3`,children:(0,p.jsx)(`span`,{className:`text-xs font-medium text-sand-500 uppercase`,children:e.provider})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:e.name?(0,p.jsx)(`span`,{className:`text-sm text-sand-700`,children:e.name}):(0,p.jsx)(`span`,{className:`text-[11px] text-sand-400`,children:`—`})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:(0,p.jsx)(`code`,{className:`text-[13px] font-mono text-sand-800`,children:y(e)})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:(0,p.jsx)(`button`,{type:`button`,className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors duration-200 ${e.active?`bg-sage-400`:`bg-sand-300`}`,onClick:()=>w(e),disabled:S.isPending,children:(0,p.jsx)(`span`,{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform duration-200 ${e.active?`translate-x-4.5`:`translate-x-0.5`}`})})}),(0,p.jsx)(`td`,{className:`px-5 py-3`,children:t.text&&(0,p.jsx)(`span`,{className:`text-xs ${t.color}`,children:t.text})}),(0,p.jsx)(`td`,{className:`px-3 py-3`,children:(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,p.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-sienna-500 transition-colors duration-150`,onClick:()=>E(e),children:(0,p.jsx)(h,{className:`size-4`})}),(0,p.jsx)(`button`,{type:`button`,className:`p-1 rounded text-sand-400 hover:text-red-500 transition-colors duration-150`,onClick:()=>a(e),children:(0,p.jsx)(g,{className:`size-4`})})]})})]},e.id)})})]})})}),s&&(0,p.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:()=>c(null),onKeyDown:()=>{}}),(0,p.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-sm mx-4`,children:[(0,p.jsx)(`div`,{className:`px-5 py-4 border-b border-sand-100/60`,children:(0,p.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:`Edit Token`})}),(0,p.jsx)(`div`,{className:`px-5 py-4 space-y-3`,children:(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`label`,{htmlFor:`token-name`,className:`text-[10px] uppercase tracking-wider text-sand-500 font-medium`,children:`Name`}),(0,p.jsx)(o,{value:u,onChange:e=>d(e.target.value),placeholder:`e.g. prod, dev, team-a`,className:`mt-1 w-full border border-sand-200 rounded-md px-3 py-2 text-sm text-sand-900 bg-white placeholder:text-sand-300 focus:outline-none focus:border-sienna-300`})]})}),(0,p.jsxs)(`div`,{className:`px-5 py-3 border-t border-sand-100/60 flex items-center justify-end gap-2`,children:[(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:()=>c(null),children:`Cancel`}),(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md bg-sienna-400 text-white hover:bg-sienna-500 disabled:opacity-50 transition-colors duration-150`,disabled:x.isPending,onClick:D,children:x.isPending?`Saving...`:`Save`})]})]})]}),r&&(0,p.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[15vh]`,children:[(0,p.jsx)(`div`,{className:`absolute inset-0 bg-sand-900/8 backdrop-blur-sm`,onClick:()=>a(null),onKeyDown:()=>{}}),(0,p.jsxs)(`div`,{className:`relative panel shadow-xl w-full max-w-sm mx-4`,children:[(0,p.jsxs)(`div`,{className:`px-5 py-4`,children:[(0,p.jsx)(`h3`,{className:`text-base font-medium text-sand-900`,children:`Remove Token`}),(0,p.jsxs)(`p`,{className:`text-sm text-sand-700 mt-2`,children:[`Are you sure you want to remove`,` `,(0,p.jsx)(`code`,{className:`text-[13px] font-mono text-sand-800`,children:y(r)}),r.name&&(0,p.jsxs)(`span`,{className:`text-sand-500`,children:[` (`,r.name,`)`]}),`?`]})]}),(0,p.jsxs)(`div`,{className:`px-5 py-3 border-t border-sand-100/60 flex items-center justify-end gap-2`,children:[(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md border border-sand-200 text-sand-600 hover:bg-sand-100 transition-colors duration-150`,onClick:()=>a(null),children:`Cancel`}),(0,p.jsx)(`button`,{type:`button`,className:`px-3 py-1 text-xs font-medium rounded-md bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 transition-colors duration-150`,disabled:b.isPending,onClick:T,children:b.isPending?`Removing...`:`Remove`})]})]})]})]})}function x(){let{data:e,isLoading:t}=a.useTokens(`A`);return(0,p.jsxs)(`div`,{className:`max-w-6xl mx-auto space-y-4`,children:[(0,p.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,p.jsx)(m,{})}),(0,p.jsx)(b,{data:e?.rows,isLoading:t})]})}export{x as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{m as t,y as n}from"./vendor-tanstack-DJRQAbrY.js";import{i as r,r as i}from"./vendor-react-DH4kUfK2.js";import{n as a}from"./services.generated-CA7oRRYY.js";import{i as o}from"./index-BbOyk01G.js";function s(){return t({mutationFn:({id:e,name:t,quotaThreshold:n,weight:r})=>a.updateToken(e,t,n,r)})}var c=e(r(),1),l=i();function u({isPending:e,isError:t,onSubmit:n,onRestart:r}){let[i,a]=(0,c.useState)(``);return(0,l.jsxs)(`div`,{className:`space-y-2`,children:[(0,l.jsx)(`p`,{className:`text-[12px] text-sand-600 leading-relaxed`,children:`새 탭에서 Claude 로그인을 완료하면 코드가 표시됩니다. 코드 전체를 아래에 붙여넣으세요.`}),(0,l.jsx)(o,{value:i,onChange:e=>a(e.target.value),placeholder:`code#state`,className:`w-full border border-sand-200 rounded-md px-3 py-2 text-sm font-mono text-sand-900 bg-white placeholder:text-sand-300 focus:outline-none focus:border-sienna-300`}),t&&(0,l.jsx)(`p`,{className:`text-[11px] text-red-500`,children:`코드 확인에 실패했습니다 — 표시된 코드 전체를 다시 붙여넣거나 로그인을 다시 시작하세요.`}),(0,l.jsx)(`button`,{type:`button`,className:`w-full py-2.5 text-sm font-medium rounded-md bg-sand-900 text-white hover:bg-sand-800 disabled:opacity-50 transition-colors duration-150 flex items-center justify-center gap-2`,disabled:!i.trim()||e,onClick:()=>n(i),children:e?(0,l.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,l.jsx)(`span`,{className:`w-3.5 h-3.5 border-2 border-white border-t-transparent rounded-full animate-spin`}),`Verifying...`]}):`Complete login`}),(0,l.jsx)(`button`,{type:`button`,className:`w-full py-1.5 text-[12px] text-sand-500 hover:text-sand-700 transition-colors duration-150`,onClick:()=>{a(``),r()},children:`처음부터 다시 시작`})]})}var d=3e3,f=3e5;function p(e){let t=0;for(let n of e.getQueryCache().findAll({queryKey:[`Token`]})){let e=n.state.data?.rows;Array.isArray(e)&&(t=Math.max(t,e.length))}return t}function m(){let[e,t]=(0,c.useState)(null),[r,i]=(0,c.useState)(!1),o=n(),s=a.useOauthStartMutation(),l=a.useOauthStartOpenAIMutation(),u=a.useOauthCompleteMutation(),m=(0,c.useRef)({}),h=()=>{m.current.interval!==void 0&&clearInterval(m.current.interval),m.current.timeout!==void 0&&clearTimeout(m.current.timeout),m.current={}};(0,c.useEffect)(()=>h,[]);let g=()=>Promise.all([o.invalidateQueries({queryKey:[`Token`]}),o.invalidateQueries({queryKey:[`Qgrid`]})]);return{loadingProvider:e,codeEntry:r,start:async(e,n)=>{let r=n.trim();if(!r)return;let a=window.open(`about:blank`,`_blank`);t(e);try{if(e===`openai`){let{authUrl:e}=await l.mutateAsync({name:r});a?a.location.href=e:window.open(e,`_blank`);let n=p(o);h(),m.current.interval=window.setInterval(()=>{g().then(()=>{p(o)>n&&(h(),t(null))})},d),m.current.timeout=window.setTimeout(()=>{h(),t(null)},f);return}let{authUrl:n,mode:c}=await s.mutateAsync({name:r});c===`code`?(a?a.location.href=n:window.open(n,`_blank`),i(!0),t(null)):(a?.close(),window.location.href=n)}catch(e){a?.close(),console.error(`OAuth start failed:`,e),t(null)}},submitCode:async e=>{let t=e.trim();if(!t)return!1;try{await u.mutateAsync({pastedCode:t})}catch(e){return console.error(`OAuth complete failed:`,e),!1}return await g(),!0},reset:()=>{h(),t(null),i(!1),u.reset()},completeMutation:u}}export{u as n,s as r,m as t};
|
|
File without changes
|