@engenty/wizards-runtime 0.12.1 → 0.12.2
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/apps/runtime/dist/agents/studio-assistant.js +17 -1
- package/apps/runtime/dist/app.js +4 -2
- package/apps/runtime/dist/db/live-triggers.js +13 -3
- package/apps/runtime/dist/db/migrations/tenant/0027_space_skill.sql +48 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0027_snapshot.json +4120 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +7 -0
- package/apps/runtime/dist/db/schema.js +31 -0
- package/apps/runtime/dist/docs/dev/skills.md +116 -0
- package/apps/runtime/dist/docs/user-guide/skills.md +85 -0
- package/apps/runtime/dist/engine/steps.js +10 -1
- package/apps/runtime/dist/harness/model.js +4 -0
- package/apps/runtime/dist/live/views.js +2 -0
- package/apps/runtime/dist/models.js +4 -0
- package/apps/runtime/dist/prompts/goose.md +7 -0
- package/apps/runtime/dist/prompts/step.md +19 -1
- package/apps/runtime/dist/prompts/tools.md +33 -0
- package/apps/runtime/dist/routes/skills.js +84 -0
- package/apps/runtime/dist/services/skills-registry.js +209 -0
- package/apps/runtime/dist/services/skills.js +478 -0
- package/apps/runtime/dist/sync/records.js +81 -1
- package/apps/runtime/dist/texts.js +39 -0
- package/apps/runtime/dist/tools/index.js +4 -2
- package/apps/runtime/dist/tools/net-guard.js +8 -4
- package/apps/runtime/dist/tools/skills.js +197 -0
- package/apps/web/dist/assets/{AboutDialog-uGYGy2R2.js → AboutDialog-CLgnoYTI.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-BWaEdlt3.js → ChangelogDialog-CKLgFL6r.js} +1 -1
- package/apps/web/dist/assets/CodeEditor-B3nto_26.js +2 -0
- package/apps/web/dist/assets/EditorPage-D9JDdAAI.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-DXpzFBRj.js → FlowPreview-zJCtixSi.js} +1 -1
- package/apps/web/dist/assets/Marketplace-D4e0Oac9.js +2 -0
- package/apps/web/dist/assets/{NewWizardChannels-B5wuTm7J.js → NewWizardChannels-B4N7GIYh.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-Ci1ZsTJk.js → NewWizardPage-Dpt0Mzk8.js} +1 -1
- package/apps/web/dist/assets/{OnboardingPage-QkdluEZk.js → OnboardingPage-CDoYVjRC.js} +1 -1
- package/apps/web/dist/assets/PreviewPane-DPB5nEd5.js +10 -0
- package/apps/web/dist/assets/ProjectPage-408YOoNa.js +10 -0
- package/apps/web/dist/assets/{PublicRunner-Bt8gMxit.js → PublicRunner-BZ66xdRX.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-Cap_e5ke.js → ReadOnly-C9oGMkUB.js} +1 -1
- package/apps/web/dist/assets/{SettingsPage-C2rmXm_Q.js → SettingsPage-Dq3AZwJS.js} +2 -2
- package/apps/web/dist/assets/{SetupPage-CbqGgFPZ.js → SetupPage-CP3lbyZc.js} +1 -1
- package/apps/web/dist/assets/{SharePage-DEeVGatD.js → SharePage-DdMm1Y8K.js} +1 -1
- package/apps/web/dist/assets/SkillEditor-b5NMFB90.js +1 -0
- package/apps/web/dist/assets/changelog-82-DHogQ.js +1 -0
- package/apps/web/dist/assets/code-xml-Hx7YxCg0.js +1 -0
- package/apps/web/dist/assets/{dist-BwhPmMDu.js → dist-BdDd1FxP.js} +1 -1
- package/apps/web/dist/assets/dist-EBVTpvRr.js +10 -0
- package/apps/web/dist/assets/dist-GlRRx9Xl.js +1 -0
- package/apps/web/dist/assets/dist-H1UN89OA.js +1 -0
- package/apps/web/dist/assets/eye-BkMFLnYu.js +1 -0
- package/apps/web/dist/assets/i18n-CKKh3Pn0.js +55 -0
- package/apps/web/dist/assets/index-Cy2NHzAx.js +49 -0
- package/apps/web/dist/assets/index-wR_-1hfN.css +1 -0
- package/apps/web/dist/assets/json-CEsfHdlZ.js +1 -0
- package/apps/web/dist/assets/{lock-D-CjMpqn.js → lock-CGXM95Mi.js} +1 -1
- package/apps/web/dist/assets/markdown-5-I9_izp.js +29 -0
- package/apps/web/dist/assets/{oss-credits-CUpVhKSr.js → oss-credits-DpRWUPjD.js} +1 -1
- package/apps/web/dist/assets/{phone-CXSrxw3H.js → phone-DMfwuh9V.js} +1 -1
- package/apps/web/dist/assets/{runners-D71NjXtA.js → runners-D5qz6b_s.js} +1 -1
- package/apps/web/dist/assets/{session-B2LtqeDq.js → session-DRy0k0nh.js} +1 -1
- package/apps/web/dist/assets/{theme-Dab079EV.js → theme-DNPm6r4e.js} +2 -2
- package/apps/web/dist/assets/{ui-DQX_CQ7c.js → ui-CwFQAfE-.js} +2 -2
- package/apps/web/dist/assets/{upload-hLkuT3Q6.js → upload-DQJwLSGj.js} +1 -1
- package/apps/web/dist/assets/{useMutation-C3XBoSVf.js → useMutation-C20c2EH3.js} +1 -1
- package/apps/web/dist/assets/{volume-2-DIxdTlaA.js → volume-2-CC5qamYT.js} +1 -1
- package/apps/web/dist/index.html +9 -8
- package/apps/web/dist/mcp/flow.html +66 -66
- package/node_modules/@engenty/wizards/dist/plugin/studio.d.ts +3 -2
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +6 -0
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +6 -0
- package/node_modules/@engenty/wizards-shared/dist/live.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +1 -0
- package/node_modules/@engenty/wizards-shared/dist/run.js +2 -0
- package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +165 -0
- package/node_modules/@engenty/wizards-shared/dist/skills.js +346 -0
- package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +4 -2
- package/node_modules/@engenty/wizards-shared/dist/sync.js +2 -1
- package/package.json +7 -7
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/web/dist/assets/CodeEditor-B5hV1IvK.js +0 -2
- package/apps/web/dist/assets/EditorPage-j9BOx5-V.js +0 -3
- package/apps/web/dist/assets/Marketplace-DSo6uZF6.js +0 -2
- package/apps/web/dist/assets/PreviewPane-swAH89un.js +0 -10
- package/apps/web/dist/assets/ProjectPage-Djv5EOYU.js +0 -1
- package/apps/web/dist/assets/changelog-DAY6ZEyy.js +0 -1
- package/apps/web/dist/assets/dist-DVpDdhG9.js +0 -1
- package/apps/web/dist/assets/dist-DzdNG7Sf.js +0 -10
- package/apps/web/dist/assets/i18n-B3J2ypKu.js +0 -55
- package/apps/web/dist/assets/index-Dxwbli0m.css +0 -1
- package/apps/web/dist/assets/index-WY5lJ_-h.js +0 -49
- package/apps/web/dist/assets/json-D2GVvTXK.js +0 -1
- package/apps/web/dist/assets/markdown-DwdMW7q0.js +0 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{G as r,Jn as i,Mr as a,Un as o,Wt as s,_n as ee,ir as te,on as c,qn as l}from"./ui-DQX_CQ7c.js";import{t as u}from"./useMutation-C3XBoSVf.js";import{D as ne,d as re,g as ie,w as ae,x as d,y as oe}from"./session-B2LtqeDq.js";import{t as f}from"./logo-CGNoptDg.js";import{n as p,s as m}from"./i18n-B3J2ypKu.js";import{B as se,Ft as h,L as ce,M as g,N as _,Pt as le,at as ue,ct as v,ln as y,ot as b,st as de}from"./index-WY5lJ_-h.js";var x=e(t(),1),S=e(n(),1),C=`oklch(50% 0.2 262)`,w=`oklch(32% 0.15 262)`,T=`oklch(90% 0.1 80)`,E=`var(--step-done)`,D=`var(--step-now)`,O=`color-mix(in oklab, var(--on) 38%, transparent)`,fe={"--on":`white`,"--tile":`rgb(255 255 255 / 0.1)`,"--tile-hover":`rgb(255 255 255 / 0.15)`,"--tile-ring":`rgb(255 255 255 / 0.15)`,"--panel":`rgb(255 255 255 / 0.07)`,"--panel-ring":`rgb(255 255 255 / 0.12)`,"--pick":`white`,"--pick-ink":w,"--pick-mark":w,"--dot":T,"--step-done":`oklch(88% 0.17 150)`,"--step-now":`oklch(88% 0.14 80)`,"--ready-ink":`oklch(27% 0.09 150)`,"--ink-2":`oklch(96% 0.02 262)`,"--ink-3":`oklch(90% 0.035 262)`,"--ink-4":`oklch(82% 0.05 262)`,"--moss":`oklch(90% 0.14 150)`,"--rose":`oklch(89% 0.09 45)`},pe={"--on":`var(--ink)`,"--tile":`var(--card)`,"--tile-hover":`var(--paper-2)`,"--tile-ring":`var(--border-soft)`,"--panel":`var(--card)`,"--panel-ring":`var(--border-soft)`,"--pick":C,"--pick-ink":`white`,"--pick-mark":`white`,"--dot":C,"--step-done":`oklch(52% 0.15 150)`,"--step-now":`oklch(60% 0.15 65)`,"--ready-ink":`white`},k=`ease-[cubic-bezier(0.3,0.7,0.2,1)]`,me=220,he={codex:`dome`,claude:`oval`,antigravity:`wedge`,cursor:`sprout`,own:`bean`,account:`drop`,apple:`pebble`};function ge(e){if(e.available)return m(`models.optAppleNote`);switch(e.reason){case`off`:return m(`models.appleOff`);case`loading`:return m(`models.appleLoading`);default:return m(`models.appleDevice`)}}var A=`relative w-fit max-w-full transition-[left,translate] duration-700 ease-[cubic-bezier(0.3,0.7,0.2,1)] motion-reduce:transition-none`,j=`left-1/2 -translate-x-1/2 text-center`,M=`max-lg:left-1/2 max-lg:-translate-x-1/2 max-lg:text-center lg:left-0 lg:translate-x-0 lg:text-left`;function N(){window.matchMedia(`(max-width: 1023px)`).matches&&window.scrollTo({top:0})}var P=`wizards.setup.own`;function _e(){try{return sessionStorage.getItem(P)===`1`}catch{return!1}}function ve(e){try{e?sessionStorage.setItem(P,`1`):sessionStorage.removeItem(P)}catch{}}function ye(){return(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,S.jsx)(f,{size:28}),(0,S.jsxs)(`span`,{className:`font-display font-semibold text-[1.0625rem] tracking-tight`,children:[`engenty`,(0,S.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em] text-(color:--dot)`,children:`.`}),(0,S.jsx)(`span`,{className:`font-normal text-(color:--on)/70`,children:`wizards`})]})]})}function F({selected:e,title:t,description:n,badge:r,note:i,onPick:a}){return(0,S.jsxs)(`button`,{type:`button`,onClick:a,"aria-pressed":e,className:c(`group relative flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left transition-[background-color,color,box-shadow] duration-300`,e?`bg-(color:--pick) text-(color:--pick-ink) shadow-elevated`:`bg-(color:--tile) ring-(color:--tile-ring) ring-1 hover:bg-(color:--tile-hover)`),children:[r?(0,S.jsx)(`span`,{className:`absolute -top-2.5 right-4 rounded-full px-2.5 py-[3px] font-semibold text-[0.6875rem] leading-none tracking-wide shadow-[0_2px_8px_oklch(0%_0_0/0.22)]`,style:{background:T,color:w},children:r}):null,(0,S.jsx)(`span`,{className:c(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors duration-300`,e?`border-transparent bg-(color:--pick-mark)`:`border-(color:--on)/40`),children:e?(0,S.jsx)(o,{className:`size-3.5 text-(color:--pick)`}):null}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`span`,{className:`block font-medium text-[0.9375rem]`,children:t}),(0,S.jsx)(`span`,{className:c(`mt-0.5 block truncate text-[0.8125rem]`,e?`opacity-70`:`text-(color:--on)/65`),children:n})]}),i?(0,S.jsx)(`span`,{className:c(`shrink-0 text-[0.75rem]`,e?`opacity-70`:`text-(color:--on)/65`),children:i}):null,(0,S.jsx)(l,{className:c(`size-4 shrink-0 transition`,e?`opacity-70`:`text-(color:--on)/40 group-hover:translate-x-0.5 group-hover:text-(color:--on)/80`)})]})}function be({name:e,at:t,done:n}){let r=[m(`setup.stage.connect`),m(`setup.stage.test`),m(`setup.stage.done`)],i=n?r.length:t+1;return(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 font-medium text-[0.75rem] uppercase tracking-[0.14em]`,children:[(0,S.jsx)(`span`,{className:`text-(color:--on)/70`,children:e}),(0,S.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:r.map((e,r)=>{let i=n||r<t;return(0,S.jsxs)(`li`,{"aria-current":!i&&r===t?`step`:void 0,className:`flex items-center gap-1 transition-colors duration-500`,style:{color:i?E:r===t?D:O},children:[i?(0,S.jsx)(o,{className:`size-3.5`,strokeWidth:3}):null,e]},e)})}),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1.5`,children:r.map((e,t)=>(0,S.jsx)(`span`,{className:`h-[3px] w-5 rounded-full transition-colors duration-500`,style:{background:t<i?n?E:D:`color-mix(in oklab, var(--on) 22%, transparent)`}},e))})]})}function xe({href:e,children:t}){return(0,S.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`transition hover:text-(color:--on)`,onClick:t=>{t.preventDefault(),v(e)},children:t})}function Se({source:e,signedIn:t,onLocal:n}){let r=_(t),{link:i}=r;return(0,x.useEffect)(()=>{t&&n()},[t,n]),(0,S.jsxs)(`section`,{className:`mx-auto flex w-full max-w-[32rem] animate-rise flex-col items-center text-center`,children:[(0,S.jsx)(d,{kind:`drop`,size:132,fluffy:!0,coat:`fur`}),(0,S.jsxs)(`span`,{className:`mt-4 inline-flex items-center gap-1.5 rounded-full px-3 py-1 font-medium text-[0.75rem]`,style:{color:E,background:`color-mix(in oklab, var(--step-done) 20%, transparent)`},children:[(0,S.jsx)(o,{className:`size-3.5`,strokeWidth:3}),m(`setup.connected`,{name:e})]}),(0,S.jsx)(`h1`,{className:`mt-3 font-display font-semibold text-[1.75rem] leading-[1.08] tracking-[-0.02em]`,children:m(`setup.accountAsk`)}),(0,S.jsx)(`p`,{className:`mt-2.5 text-balance text-(color:--on)/75 text-[0.9375rem] leading-relaxed`,children:m(`setup.accountAskText`)}),(0,S.jsxs)(`div`,{className:`mt-7 flex w-full flex-col gap-4 rounded-2xl bg-(color:--panel) p-5 text-left ring-(color:--panel-ring) ring-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3.5`,children:[(0,S.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-(color:--pick) text-(color:--pick-ink)`,children:(0,S.jsx)(y,{className:`size-4.5`})}),(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`p`,{className:`font-medium text-[0.9375rem]`,children:m(`setup.account`)}),(0,S.jsx)(`p`,{className:`text-(color:--on)/75 text-[0.8125rem] leading-snug`,children:m(`setup.accountText`)})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,S.jsx)(s,{style:{background:`var(--pick)`,color:`var(--pick-ink)`},busy:i.isPending&&!i.variables?.signup,onClick:()=>i.mutate({}),children:m(`account.signIn`)}),(0,S.jsx)(s,{variant:`secondary`,busy:i.isPending&&!!i.variables?.signup,onClick:()=>i.mutate({signup:!0}),children:m(`account.create`)})]}),(0,S.jsx)(g,{...r})]}),(0,S.jsxs)(`button`,{type:`button`,onClick:n,className:`group mt-7 inline-flex items-center gap-1.5 font-medium text-[0.9375rem] underline decoration-(color:--on)/40 underline-offset-4 transition hover:decoration-(color:--on)`,children:[m(`setup.localContinue`),(0,S.jsx)(l,{className:`size-4 transition-transform group-hover:translate-x-0.5`})]}),(0,S.jsx)(`p`,{className:`mt-2 max-w-[44ch] text-balance text-(color:--on)/65 text-[0.8125rem] leading-snug`,children:m(`setup.localContinueNote`)})]})}function Ce(){let e=h(`site`),t=ne()!==`light`;ae(t?C:null);let n=ie(),l=a(),f=te(),v=le(),T=h(`account`),{project:D}=re(),O=_(!!n.data?.account?.signedIn),[P,Ce]=(0,x.useState)(_e),[I,L]=(0,x.useState)(!1),[R,we]=(0,x.useState)(!1),z=u({mutationFn:e=>r.put(`/api/studio/local/models`,e===`apple`?{bindings:{classifier:`apple:default`,low:`apple:default`}}:e===`own`?{source:`own`,bindings:{classifier:``,low:``}}:{source:e,bindings:oe(n.data?.models?.bindings??{})}),onSuccess:async(e,t)=>{await l.invalidateQueries({queryKey:[`me`]}),Ce(!0),L(!1),N(),ve(t===`own`)}}),B=u({mutationFn:()=>Promise.all((n.data?.harnesses??[]).map(e=>r.post(`/api/studio/local/harness/${e.id}/detect`))),onSuccess:()=>l.invalidateQueries({queryKey:[`me`]})});if(!n.data?.models)return null;let V=n.data.models,H=e=>(e.version===null?2:0)+ +!e.app,U=[...n.data.harnesses].sort((e,t)=>H(e)-H(t)),Te=U.filter(e=>e.version!==null),W=n.data.apple,G=V.bindings.low?.startsWith(`apple:`)?`apple`:P||n.data.setupDone||V.source!==`own`?V.source:null,K=n.data.harnesses.find(e=>e.id===G),q=V.source===`account`?m(`models.creditsName`):n.data.harnesses.find(e=>e.id===V.source)?.name??null,J=n.data.setupDone,Y=Object.values(V.keys).some(Boolean),Ee=J?2:K?K.auth===`none`?0:1:G===`apple`||G===`account`||Y?1:0,X=J?m(`setup.h.done`):K?K.version===null?m(`setup.h.install`,{name:K.name}):K.auth===`none`?m(`setup.h.signIn`,{name:K.name}):m(`setup.h.test`):m(G===`apple`||G===`account`||Y?`setup.h.test`:`setup.h.keys`),Z=e?v.data?.site:null,Q=G!==null&&!I,$=z.isPending?z.variables??G:G,De=!!n.data.account?.signedIn,Oe=K?.name??m(G===`apple`?`models.optApple`:G===`account`?`setup.creditsChoice`:`local.sourceOwn`),ke=()=>f(`/`,{replace:!0});return(0,S.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-(color:--on) sm:px-10`,style:t?fe:pe,children:[(0,S.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,S.jsx)(ye,{}),(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(ce,{tone:t?`ground`:`surface`}),(0,S.jsx)(se,{tone:t?`ground`:`surface`,ink:w})]})]}),(0,S.jsxs)(`main`,{className:`relative mx-auto flex w-full max-w-6xl flex-1 flex-col pt-6 pb-10 lg:pt-[6vh]`,children:[R?(0,S.jsx)(Se,{source:Oe,signedIn:De,onLocal:ke}):null,(0,S.jsx)(`div`,{"aria-hidden":`true`,className:c(`absolute top-6 left-1/2 z-10 origin-top -translate-x-1/2 transition-[opacity,scale,left] duration-500 motion-reduce:transition-none lg:top-[calc(6vh+5.25rem)] lg:origin-center lg:translate-x-0`,k,G?`lg:pointer-events-none lg:left-[calc(50%-560px)] lg:scale-75 lg:opacity-0`:`lg:left-[calc(50%-508px)] lg:scale-100 lg:opacity-100`,Q?`max-lg:pointer-events-none max-lg:scale-[0.4] max-lg:opacity-0`:`max-lg:scale-[0.6] max-lg:opacity-100`),children:(0,S.jsx)(`div`,{className:`animate-rise`,children:(0,S.jsx)(d,{kind:`drop`,size:me,fluffy:!0,coat:`fur`})})}),(0,S.jsx)(`div`,{"aria-hidden":`true`,className:c(`shrink-0 transition-[height] duration-500 motion-reduce:transition-none lg:h-0`,k,Q?`max-lg:h-0`:`max-lg:h-[148px]`)}),(0,S.jsxs)(`div`,{className:c(`flex flex-col gap-10 lg:flex-row lg:items-start lg:gap-14`,R?`hidden`:``),children:[(0,S.jsxs)(`section`,{className:c(`flex w-full shrink-0 animate-rise flex-col lg:w-[32rem] lg:transition-[margin] lg:duration-700 motion-reduce:transition-none`,k,G?`lg:ml-0`:`lg:ml-[calc(50%-16rem)]`,Q?`max-lg:hidden`:``),children:[(0,S.jsxs)(`div`,{className:`flex flex-col lg:min-h-[6.5rem]`,children:[(0,S.jsx)(`p`,{className:c(A,`font-medium text-(color:--on)/70 text-[0.75rem] uppercase tracking-[0.16em]`,G?M:j),children:m(`setup.title`)}),(0,S.jsx)(`h1`,{className:c(A,`mt-2 font-display font-semibold text-[1.625rem] leading-[1.08] tracking-[-0.02em] sm:text-[1.75rem]`,G?M:j),children:m(`setup.source`)}),(0,S.jsx)(`p`,{className:c(A,`mt-2.5 text-(color:--on)/75 text-[0.9375rem] leading-relaxed`,G?M:j),children:m(`setup.sub`)})]}),T?(0,S.jsxs)(`div`,{className:`mt-5 flex items-center gap-3.5 rounded-2xl bg-(color:--panel) px-4 py-3.5 ring-(color:--panel-ring) ring-1`,children:[(0,S.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-(color:--pick) font-semibold text-(color:--pick-ink) text-[0.9375rem]`,children:n.data.account?.signedIn?(n.data.account.name||n.data.account.email).slice(0,1).toUpperCase():(0,S.jsx)(y,{className:`size-4.5`})}),(0,S.jsx)(`div`,{className:`min-w-0 flex-1`,children:n.data.account?.signedIn?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`p`,{className:`font-medium text-[0.9375rem]`,children:m(`setup.accountLinked`,{name:n.data.account.name||n.data.account.email})}),(0,S.jsx)(`p`,{className:`text-(color:--on)/75 text-[0.8125rem]`,children:[n.data.account.organization,n.data.account.credits===null?null:m(`setup.accountCredits`,{credits:n.data.account.credits.toLocaleString(p)})].filter(Boolean).join(` · `)})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`p`,{className:`font-medium text-[0.9375rem]`,children:m(`setup.account`)}),(0,S.jsx)(`p`,{className:`text-(color:--on)/75 text-[0.8125rem] leading-snug`,children:m(`setup.accountText`)}),(0,S.jsx)(g,{...O})]})}),n.data.account?.signedIn?null:(0,S.jsx)(s,{variant:`secondary`,size:`sm`,busy:O.link.isPending,onClick:()=>O.link.mutate({}),children:m(`account.signIn`)})]}):null,n.data.account?.signedIn?(0,S.jsx)(`div`,{className:`mt-2.5`,children:(0,S.jsx)(F,{selected:$===`account`,title:m(`setup.creditsChoice`),description:m(`setup.creditsDesc`),note:n.data.account.credits===null?void 0:m(`setup.accountCredits`,{credits:n.data.account.credits.toLocaleString(p)}),onPick:()=>z.mutate(`account`)})}):null,T?(0,S.jsxs)(`div`,{className:`mt-7`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,S.jsx)(`span`,{className:`h-px flex-1 bg-(color:--on)/25`}),(0,S.jsx)(`span`,{className:`font-medium text-(color:--on)/80 text-[0.75rem] uppercase tracking-[0.14em]`,children:m(`setup.localDivider`)}),(0,S.jsx)(`span`,{className:`h-px flex-1 bg-(color:--on)/25`})]}),(0,S.jsx)(`p`,{className:`mt-2 text-center text-(color:--on)/65 text-[0.8125rem] leading-snug`,children:m(`setup.localNote`)})]}):null,(0,S.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[U.map((e,t)=>(0,S.jsx)(F,{selected:$===e.id,title:e.name,description:m(`harness.desc.${e.id}`),badge:t===0?m(`setup.recommended`):void 0,note:e.version===null?m(`harness.notInstalled`):e.auth===`subscription`?m(`harness.ready`):void 0,onPick:()=>z.mutate(e.id)},e.id)),W?.supported?(0,S.jsx)(F,{selected:$===`apple`,title:m(`models.optApple`),description:m(`setup.appleDesc`),note:ge(W),onPick:()=>z.mutate(`apple`)}):null,(0,S.jsx)(F,{selected:$===`own`,title:m(`local.sourceOwn`),description:m(`setup.ownDesc`),onPick:()=>z.mutate(`own`)})]}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-(color:--on)/60 text-[0.8125rem]`,children:[(0,S.jsx)(`span`,{children:Te.length?null:m(`setup.noHarness`)}),(0,S.jsxs)(s,{variant:`ghost`,size:`sm`,busy:B.isPending,onClick:()=>B.mutate(),children:[(0,S.jsx)(ee,{className:`size-3.5`}),` `,m(`local.recheck`)]})]})]}),G?(0,S.jsxs)(`section`,{className:c(`min-w-0 flex-1 animate-settle`,I?`max-lg:hidden`:``),children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>{L(!0),N()},className:`-ml-1.5 mb-5 inline-flex items-center gap-1.5 rounded-full px-1.5 py-1 text-(color:--on)/80 text-[0.875rem] transition hover:text-(color:--on) lg:hidden`,children:[(0,S.jsx)(i,{className:`size-4`}),` `,m(`run.back`)]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{"aria-hidden":`true`,className:`absolute top-6 right-2 z-10`,children:(0,S.jsx)(d,{kind:he[G],size:120,fluffy:!0,coat:`fur`})}),(0,S.jsxs)(`div`,{className:`min-h-[6.5rem]`,children:[(0,S.jsx)(be,{name:Oe,at:Ee,done:J}),(0,S.jsx)(`h2`,{className:`mt-2 animate-rise pr-32 font-display font-semibold text-[clamp(28px,3vw,40px)] leading-[1.06] tracking-[-0.03em]`,children:X},X)]}),(0,S.jsx)(`div`,{className:`mt-5 rounded-2xl bg-(color:--panel) p-5 ring-(color:--panel-ring) ring-1 sm:p-6`,children:K?(0,S.jsx)(ue,{me:n.data,id:K.id,autoTest:!J}):G===`apple`?(0,S.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,S.jsx)(`p`,{className:`text-[0.875rem] text-ink-2 leading-relaxed`,children:q?m(`setup.appleHintKeeps`,{way:q}):m(`setup.appleHint`)}),(0,S.jsx)(b,{auto:!J&&W?.available===!0})]}):G===`account`?(0,S.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,S.jsx)(`p`,{className:`text-[0.875rem] text-ink-2 leading-relaxed`,children:m(`setup.creditsDesc`)}),(0,S.jsx)(b,{auto:!J})]}):(0,S.jsx)(de,{models:V})}),(0,S.jsxs)(`div`,{className:`mt-9`,children:[J?(0,S.jsxs)(`p`,{className:`mb-3 flex animate-rise items-center gap-2 font-medium text-[0.9375rem]`,style:{color:E},children:[(0,S.jsx)(o,{className:`size-4`,strokeWidth:3}),m(`setup.ready`)]}):null,(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,S.jsxs)(`button`,{type:`button`,disabled:!J,onClick:()=>{T&&!De?(we(!0),window.scrollTo({top:0})):ke()},className:c(`group inline-flex h-12 items-center gap-2.5 rounded-full px-6 font-semibold text-[1rem] transition-[background-color,color,box-shadow,filter] duration-300`,J?`shadow-[0_6px_24px_oklch(88%_0.17_150/0.35)] hover:brightness-105`:`cursor-not-allowed bg-(color:--on)/20 text-(color:--on)/65`),style:J?{background:E,color:`var(--ready-ink)`}:void 0,children:[m(`setup.done`),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-enabled:group-hover:translate-x-0.5`,children:`→`})]}),J?null:(0,S.jsx)(`span`,{className:`text-(color:--on)/65 text-[0.8125rem]`,children:m(`setup.untilWorks`)})]})]})]})]},G):null]})]}),(0,S.jsxs)(`footer`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between gap-4 pb-6 text-(color:--on)/55 text-[0.75rem] sm:pb-8`,children:[(0,S.jsxs)(`span`,{children:[`engenty ·`,` `,n.data.account?.signedIn?m(`setup.thisComputer`,{space:D?.name??``,organization:n.data.account.organization??n.data.account.name}):m(`setup.local`)]}),(0,S.jsxs)(`span`,{className:`flex items-center gap-5`,children:[Z?(0,S.jsx)(xe,{href:Z,children:new URL(Z).host}):null,(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`size-[3px] bg-(color:--dot)`})]})]})]})}export{Ce as SetupPage};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{G as r,Jn as i,Mr as a,Un as o,Wt as s,_n as ee,ir as te,on as c,qn as l}from"./ui-CwFQAfE-.js";import{t as u}from"./useMutation-C20c2EH3.js";import{D as ne,d as re,g as ie,w as ae,x as d,y as oe}from"./session-DRy0k0nh.js";import{t as f}from"./logo-CGNoptDg.js";import{n as p,s as m}from"./i18n-CKKh3Pn0.js";import{B as se,Ft as h,L as ce,M as g,N as _,Pt as le,at as ue,ct as v,dn as y,ot as b,st as de}from"./index-Cy2NHzAx.js";var x=e(t(),1),S=e(n(),1),C=`oklch(50% 0.2 262)`,w=`oklch(32% 0.15 262)`,T=`oklch(90% 0.1 80)`,E=`var(--step-done)`,D=`var(--step-now)`,O=`color-mix(in oklab, var(--on) 38%, transparent)`,fe={"--on":`white`,"--tile":`rgb(255 255 255 / 0.1)`,"--tile-hover":`rgb(255 255 255 / 0.15)`,"--tile-ring":`rgb(255 255 255 / 0.15)`,"--panel":`rgb(255 255 255 / 0.07)`,"--panel-ring":`rgb(255 255 255 / 0.12)`,"--pick":`white`,"--pick-ink":w,"--pick-mark":w,"--dot":T,"--step-done":`oklch(88% 0.17 150)`,"--step-now":`oklch(88% 0.14 80)`,"--ready-ink":`oklch(27% 0.09 150)`,"--ink-2":`oklch(96% 0.02 262)`,"--ink-3":`oklch(90% 0.035 262)`,"--ink-4":`oklch(82% 0.05 262)`,"--moss":`oklch(90% 0.14 150)`,"--rose":`oklch(89% 0.09 45)`},pe={"--on":`var(--ink)`,"--tile":`var(--card)`,"--tile-hover":`var(--paper-2)`,"--tile-ring":`var(--border-soft)`,"--panel":`var(--card)`,"--panel-ring":`var(--border-soft)`,"--pick":C,"--pick-ink":`white`,"--pick-mark":`white`,"--dot":C,"--step-done":`oklch(52% 0.15 150)`,"--step-now":`oklch(60% 0.15 65)`,"--ready-ink":`white`},k=`ease-[cubic-bezier(0.3,0.7,0.2,1)]`,me=220,he={codex:`dome`,claude:`oval`,antigravity:`wedge`,cursor:`sprout`,own:`bean`,account:`drop`,apple:`pebble`};function ge(e){if(e.available)return m(`models.optAppleNote`);switch(e.reason){case`off`:return m(`models.appleOff`);case`loading`:return m(`models.appleLoading`);default:return m(`models.appleDevice`)}}var A=`relative w-fit max-w-full transition-[left,translate] duration-700 ease-[cubic-bezier(0.3,0.7,0.2,1)] motion-reduce:transition-none`,j=`left-1/2 -translate-x-1/2 text-center`,M=`max-lg:left-1/2 max-lg:-translate-x-1/2 max-lg:text-center lg:left-0 lg:translate-x-0 lg:text-left`;function N(){window.matchMedia(`(max-width: 1023px)`).matches&&window.scrollTo({top:0})}var P=`wizards.setup.own`;function _e(){try{return sessionStorage.getItem(P)===`1`}catch{return!1}}function ve(e){try{e?sessionStorage.setItem(P,`1`):sessionStorage.removeItem(P)}catch{}}function ye(){return(0,S.jsxs)(`span`,{className:`inline-flex items-center gap-2.5`,children:[(0,S.jsx)(f,{size:28}),(0,S.jsxs)(`span`,{className:`font-display font-semibold text-[1.0625rem] tracking-tight`,children:[`engenty`,(0,S.jsx)(`span`,{className:`mr-[0.09em] ml-[0.06em] text-(color:--dot)`,children:`.`}),(0,S.jsx)(`span`,{className:`font-normal text-(color:--on)/70`,children:`wizards`})]})]})}function F({selected:e,title:t,description:n,badge:r,note:i,onPick:a}){return(0,S.jsxs)(`button`,{type:`button`,onClick:a,"aria-pressed":e,className:c(`group relative flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left transition-[background-color,color,box-shadow] duration-300`,e?`bg-(color:--pick) text-(color:--pick-ink) shadow-elevated`:`bg-(color:--tile) ring-(color:--tile-ring) ring-1 hover:bg-(color:--tile-hover)`),children:[r?(0,S.jsx)(`span`,{className:`absolute -top-2.5 right-4 rounded-full px-2.5 py-[3px] font-semibold text-[0.6875rem] leading-none tracking-wide shadow-[0_2px_8px_oklch(0%_0_0/0.22)]`,style:{background:T,color:w},children:r}):null,(0,S.jsx)(`span`,{className:c(`flex size-5 shrink-0 items-center justify-center rounded-full border transition-colors duration-300`,e?`border-transparent bg-(color:--pick-mark)`:`border-(color:--on)/40`),children:e?(0,S.jsx)(o,{className:`size-3.5 text-(color:--pick)`}):null}),(0,S.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`span`,{className:`block font-medium text-[0.9375rem]`,children:t}),(0,S.jsx)(`span`,{className:c(`mt-0.5 block truncate text-[0.8125rem]`,e?`opacity-70`:`text-(color:--on)/65`),children:n})]}),i?(0,S.jsx)(`span`,{className:c(`shrink-0 text-[0.75rem]`,e?`opacity-70`:`text-(color:--on)/65`),children:i}):null,(0,S.jsx)(l,{className:c(`size-4 shrink-0 transition`,e?`opacity-70`:`text-(color:--on)/40 group-hover:translate-x-0.5 group-hover:text-(color:--on)/80`)})]})}function be({name:e,at:t,done:n}){let r=[m(`setup.stage.connect`),m(`setup.stage.test`),m(`setup.stage.done`)],i=n?r.length:t+1;return(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-2 font-medium text-[0.75rem] uppercase tracking-[0.14em]`,children:[(0,S.jsx)(`span`,{className:`text-(color:--on)/70`,children:e}),(0,S.jsx)(`ol`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:r.map((e,r)=>{let i=n||r<t;return(0,S.jsxs)(`li`,{"aria-current":!i&&r===t?`step`:void 0,className:`flex items-center gap-1 transition-colors duration-500`,style:{color:i?E:r===t?D:O},children:[i?(0,S.jsx)(o,{className:`size-3.5`,strokeWidth:3}):null,e]},e)})}),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`flex gap-1.5`,children:r.map((e,t)=>(0,S.jsx)(`span`,{className:`h-[3px] w-5 rounded-full transition-colors duration-500`,style:{background:t<i?n?E:D:`color-mix(in oklab, var(--on) 22%, transparent)`}},e))})]})}function xe({href:e,children:t}){return(0,S.jsx)(`a`,{href:e,target:`_blank`,rel:`noreferrer`,className:`transition hover:text-(color:--on)`,onClick:t=>{t.preventDefault(),v(e)},children:t})}function Se({source:e,signedIn:t,onLocal:n}){let r=_(t),{link:i}=r;return(0,x.useEffect)(()=>{t&&n()},[t,n]),(0,S.jsxs)(`section`,{className:`mx-auto flex w-full max-w-[32rem] animate-rise flex-col items-center text-center`,children:[(0,S.jsx)(d,{kind:`drop`,size:132,fluffy:!0,coat:`fur`}),(0,S.jsxs)(`span`,{className:`mt-4 inline-flex items-center gap-1.5 rounded-full px-3 py-1 font-medium text-[0.75rem]`,style:{color:E,background:`color-mix(in oklab, var(--step-done) 20%, transparent)`},children:[(0,S.jsx)(o,{className:`size-3.5`,strokeWidth:3}),m(`setup.connected`,{name:e})]}),(0,S.jsx)(`h1`,{className:`mt-3 font-display font-semibold text-[1.75rem] leading-[1.08] tracking-[-0.02em]`,children:m(`setup.accountAsk`)}),(0,S.jsx)(`p`,{className:`mt-2.5 text-balance text-(color:--on)/75 text-[0.9375rem] leading-relaxed`,children:m(`setup.accountAskText`)}),(0,S.jsxs)(`div`,{className:`mt-7 flex w-full flex-col gap-4 rounded-2xl bg-(color:--panel) p-5 text-left ring-(color:--panel-ring) ring-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3.5`,children:[(0,S.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-(color:--pick) text-(color:--pick-ink)`,children:(0,S.jsx)(y,{className:`size-4.5`})}),(0,S.jsxs)(`div`,{className:`min-w-0`,children:[(0,S.jsx)(`p`,{className:`font-medium text-[0.9375rem]`,children:m(`setup.account`)}),(0,S.jsx)(`p`,{className:`text-(color:--on)/75 text-[0.8125rem] leading-snug`,children:m(`setup.accountText`)})]})]}),(0,S.jsxs)(`div`,{className:`flex flex-wrap gap-2.5`,children:[(0,S.jsx)(s,{style:{background:`var(--pick)`,color:`var(--pick-ink)`},busy:i.isPending&&!i.variables?.signup,onClick:()=>i.mutate({}),children:m(`account.signIn`)}),(0,S.jsx)(s,{variant:`secondary`,busy:i.isPending&&!!i.variables?.signup,onClick:()=>i.mutate({signup:!0}),children:m(`account.create`)})]}),(0,S.jsx)(g,{...r})]}),(0,S.jsxs)(`button`,{type:`button`,onClick:n,className:`group mt-7 inline-flex items-center gap-1.5 font-medium text-[0.9375rem] underline decoration-(color:--on)/40 underline-offset-4 transition hover:decoration-(color:--on)`,children:[m(`setup.localContinue`),(0,S.jsx)(l,{className:`size-4 transition-transform group-hover:translate-x-0.5`})]}),(0,S.jsx)(`p`,{className:`mt-2 max-w-[44ch] text-balance text-(color:--on)/65 text-[0.8125rem] leading-snug`,children:m(`setup.localContinueNote`)})]})}function Ce(){let e=h(`site`),t=ne()!==`light`;ae(t?C:null);let n=ie(),l=a(),f=te(),v=le(),T=h(`account`),{project:D}=re(),O=_(!!n.data?.account?.signedIn),[P,Ce]=(0,x.useState)(_e),[I,L]=(0,x.useState)(!1),[R,we]=(0,x.useState)(!1),z=u({mutationFn:e=>r.put(`/api/studio/local/models`,e===`apple`?{bindings:{classifier:`apple:default`,low:`apple:default`}}:e===`own`?{source:`own`,bindings:{classifier:``,low:``}}:{source:e,bindings:oe(n.data?.models?.bindings??{})}),onSuccess:async(e,t)=>{await l.invalidateQueries({queryKey:[`me`]}),Ce(!0),L(!1),N(),ve(t===`own`)}}),B=u({mutationFn:()=>Promise.all((n.data?.harnesses??[]).map(e=>r.post(`/api/studio/local/harness/${e.id}/detect`))),onSuccess:()=>l.invalidateQueries({queryKey:[`me`]})});if(!n.data?.models)return null;let V=n.data.models,H=e=>(e.version===null?2:0)+ +!e.app,U=[...n.data.harnesses].sort((e,t)=>H(e)-H(t)),Te=U.filter(e=>e.version!==null),W=n.data.apple,G=V.bindings.low?.startsWith(`apple:`)?`apple`:P||n.data.setupDone||V.source!==`own`?V.source:null,K=n.data.harnesses.find(e=>e.id===G),q=V.source===`account`?m(`models.creditsName`):n.data.harnesses.find(e=>e.id===V.source)?.name??null,J=n.data.setupDone,Y=Object.values(V.keys).some(Boolean),Ee=J?2:K?K.auth===`none`?0:1:G===`apple`||G===`account`||Y?1:0,X=J?m(`setup.h.done`):K?K.version===null?m(`setup.h.install`,{name:K.name}):K.auth===`none`?m(`setup.h.signIn`,{name:K.name}):m(`setup.h.test`):m(G===`apple`||G===`account`||Y?`setup.h.test`:`setup.h.keys`),Z=e?v.data?.site:null,Q=G!==null&&!I,$=z.isPending?z.variables??G:G,De=!!n.data.account?.signedIn,Oe=K?.name??m(G===`apple`?`models.optApple`:G===`account`?`setup.creditsChoice`:`local.sourceOwn`),ke=()=>f(`/`,{replace:!0});return(0,S.jsxs)(`div`,{className:`flex min-h-dvh flex-col px-6 text-(color:--on) sm:px-10`,style:t?fe:pe,children:[(0,S.jsxs)(`header`,{className:`flex items-center justify-between pt-6 sm:pt-8`,children:[(0,S.jsx)(ye,{}),(0,S.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(ce,{tone:t?`ground`:`surface`}),(0,S.jsx)(se,{tone:t?`ground`:`surface`,ink:w})]})]}),(0,S.jsxs)(`main`,{className:`relative mx-auto flex w-full max-w-6xl flex-1 flex-col pt-6 pb-10 lg:pt-[6vh]`,children:[R?(0,S.jsx)(Se,{source:Oe,signedIn:De,onLocal:ke}):null,(0,S.jsx)(`div`,{"aria-hidden":`true`,className:c(`absolute top-6 left-1/2 z-10 origin-top -translate-x-1/2 transition-[opacity,scale,left] duration-500 motion-reduce:transition-none lg:top-[calc(6vh+5.25rem)] lg:origin-center lg:translate-x-0`,k,G?`lg:pointer-events-none lg:left-[calc(50%-560px)] lg:scale-75 lg:opacity-0`:`lg:left-[calc(50%-508px)] lg:scale-100 lg:opacity-100`,Q?`max-lg:pointer-events-none max-lg:scale-[0.4] max-lg:opacity-0`:`max-lg:scale-[0.6] max-lg:opacity-100`),children:(0,S.jsx)(`div`,{className:`animate-rise`,children:(0,S.jsx)(d,{kind:`drop`,size:me,fluffy:!0,coat:`fur`})})}),(0,S.jsx)(`div`,{"aria-hidden":`true`,className:c(`shrink-0 transition-[height] duration-500 motion-reduce:transition-none lg:h-0`,k,Q?`max-lg:h-0`:`max-lg:h-[148px]`)}),(0,S.jsxs)(`div`,{className:c(`flex flex-col gap-10 lg:flex-row lg:items-start lg:gap-14`,R?`hidden`:``),children:[(0,S.jsxs)(`section`,{className:c(`flex w-full shrink-0 animate-rise flex-col lg:w-[32rem] lg:transition-[margin] lg:duration-700 motion-reduce:transition-none`,k,G?`lg:ml-0`:`lg:ml-[calc(50%-16rem)]`,Q?`max-lg:hidden`:``),children:[(0,S.jsxs)(`div`,{className:`flex flex-col lg:min-h-[6.5rem]`,children:[(0,S.jsx)(`p`,{className:c(A,`font-medium text-(color:--on)/70 text-[0.75rem] uppercase tracking-[0.16em]`,G?M:j),children:m(`setup.title`)}),(0,S.jsx)(`h1`,{className:c(A,`mt-2 font-display font-semibold text-[1.625rem] leading-[1.08] tracking-[-0.02em] sm:text-[1.75rem]`,G?M:j),children:m(`setup.source`)}),(0,S.jsx)(`p`,{className:c(A,`mt-2.5 text-(color:--on)/75 text-[0.9375rem] leading-relaxed`,G?M:j),children:m(`setup.sub`)})]}),T?(0,S.jsxs)(`div`,{className:`mt-5 flex items-center gap-3.5 rounded-2xl bg-(color:--panel) px-4 py-3.5 ring-(color:--panel-ring) ring-1`,children:[(0,S.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-full bg-(color:--pick) font-semibold text-(color:--pick-ink) text-[0.9375rem]`,children:n.data.account?.signedIn?(n.data.account.name||n.data.account.email).slice(0,1).toUpperCase():(0,S.jsx)(y,{className:`size-4.5`})}),(0,S.jsx)(`div`,{className:`min-w-0 flex-1`,children:n.data.account?.signedIn?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`p`,{className:`font-medium text-[0.9375rem]`,children:m(`setup.accountLinked`,{name:n.data.account.name||n.data.account.email})}),(0,S.jsx)(`p`,{className:`text-(color:--on)/75 text-[0.8125rem]`,children:[n.data.account.organization,n.data.account.credits===null?null:m(`setup.accountCredits`,{credits:n.data.account.credits.toLocaleString(p)})].filter(Boolean).join(` · `)})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`p`,{className:`font-medium text-[0.9375rem]`,children:m(`setup.account`)}),(0,S.jsx)(`p`,{className:`text-(color:--on)/75 text-[0.8125rem] leading-snug`,children:m(`setup.accountText`)}),(0,S.jsx)(g,{...O})]})}),n.data.account?.signedIn?null:(0,S.jsx)(s,{variant:`secondary`,size:`sm`,busy:O.link.isPending,onClick:()=>O.link.mutate({}),children:m(`account.signIn`)})]}):null,n.data.account?.signedIn?(0,S.jsx)(`div`,{className:`mt-2.5`,children:(0,S.jsx)(F,{selected:$===`account`,title:m(`setup.creditsChoice`),description:m(`setup.creditsDesc`),note:n.data.account.credits===null?void 0:m(`setup.accountCredits`,{credits:n.data.account.credits.toLocaleString(p)}),onPick:()=>z.mutate(`account`)})}):null,T?(0,S.jsxs)(`div`,{className:`mt-7`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,S.jsx)(`span`,{className:`h-px flex-1 bg-(color:--on)/25`}),(0,S.jsx)(`span`,{className:`font-medium text-(color:--on)/80 text-[0.75rem] uppercase tracking-[0.14em]`,children:m(`setup.localDivider`)}),(0,S.jsx)(`span`,{className:`h-px flex-1 bg-(color:--on)/25`})]}),(0,S.jsx)(`p`,{className:`mt-2 text-center text-(color:--on)/65 text-[0.8125rem] leading-snug`,children:m(`setup.localNote`)})]}):null,(0,S.jsxs)(`div`,{className:`mt-5 flex flex-col gap-2.5`,children:[U.map((e,t)=>(0,S.jsx)(F,{selected:$===e.id,title:e.name,description:m(`harness.desc.${e.id}`),badge:t===0?m(`setup.recommended`):void 0,note:e.version===null?m(`harness.notInstalled`):e.auth===`subscription`?m(`harness.ready`):void 0,onPick:()=>z.mutate(e.id)},e.id)),W?.supported?(0,S.jsx)(F,{selected:$===`apple`,title:m(`models.optApple`),description:m(`setup.appleDesc`),note:ge(W),onPick:()=>z.mutate(`apple`)}):null,(0,S.jsx)(F,{selected:$===`own`,title:m(`local.sourceOwn`),description:m(`setup.ownDesc`),onPick:()=>z.mutate(`own`)})]}),(0,S.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-center gap-x-2 gap-y-1 text-(color:--on)/60 text-[0.8125rem]`,children:[(0,S.jsx)(`span`,{children:Te.length?null:m(`setup.noHarness`)}),(0,S.jsxs)(s,{variant:`ghost`,size:`sm`,busy:B.isPending,onClick:()=>B.mutate(),children:[(0,S.jsx)(ee,{className:`size-3.5`}),` `,m(`local.recheck`)]})]})]}),G?(0,S.jsxs)(`section`,{className:c(`min-w-0 flex-1 animate-settle`,I?`max-lg:hidden`:``),children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>{L(!0),N()},className:`-ml-1.5 mb-5 inline-flex items-center gap-1.5 rounded-full px-1.5 py-1 text-(color:--on)/80 text-[0.875rem] transition hover:text-(color:--on) lg:hidden`,children:[(0,S.jsx)(i,{className:`size-4`}),` `,m(`run.back`)]}),(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{"aria-hidden":`true`,className:`absolute top-6 right-2 z-10`,children:(0,S.jsx)(d,{kind:he[G],size:120,fluffy:!0,coat:`fur`})}),(0,S.jsxs)(`div`,{className:`min-h-[6.5rem]`,children:[(0,S.jsx)(be,{name:Oe,at:Ee,done:J}),(0,S.jsx)(`h2`,{className:`mt-2 animate-rise pr-32 font-display font-semibold text-[clamp(28px,3vw,40px)] leading-[1.06] tracking-[-0.03em]`,children:X},X)]}),(0,S.jsx)(`div`,{className:`mt-5 rounded-2xl bg-(color:--panel) p-5 ring-(color:--panel-ring) ring-1 sm:p-6`,children:K?(0,S.jsx)(ue,{me:n.data,id:K.id,autoTest:!J}):G===`apple`?(0,S.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,S.jsx)(`p`,{className:`text-[0.875rem] text-ink-2 leading-relaxed`,children:q?m(`setup.appleHintKeeps`,{way:q}):m(`setup.appleHint`)}),(0,S.jsx)(b,{auto:!J&&W?.available===!0})]}):G===`account`?(0,S.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,S.jsx)(`p`,{className:`text-[0.875rem] text-ink-2 leading-relaxed`,children:m(`setup.creditsDesc`)}),(0,S.jsx)(b,{auto:!J})]}):(0,S.jsx)(de,{models:V})}),(0,S.jsxs)(`div`,{className:`mt-9`,children:[J?(0,S.jsxs)(`p`,{className:`mb-3 flex animate-rise items-center gap-2 font-medium text-[0.9375rem]`,style:{color:E},children:[(0,S.jsx)(o,{className:`size-4`,strokeWidth:3}),m(`setup.ready`)]}):null,(0,S.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,S.jsxs)(`button`,{type:`button`,disabled:!J,onClick:()=>{T&&!De?(we(!0),window.scrollTo({top:0})):ke()},className:c(`group inline-flex h-12 items-center gap-2.5 rounded-full px-6 font-semibold text-[1rem] transition-[background-color,color,box-shadow,filter] duration-300`,J?`shadow-[0_6px_24px_oklch(88%_0.17_150/0.35)] hover:brightness-105`:`cursor-not-allowed bg-(color:--on)/20 text-(color:--on)/65`),style:J?{background:E,color:`var(--ready-ink)`}:void 0,children:[m(`setup.done`),(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`transition-transform group-enabled:group-hover:translate-x-0.5`,children:`→`})]}),J?null:(0,S.jsx)(`span`,{className:`text-(color:--on)/65 text-[0.8125rem]`,children:m(`setup.untilWorks`)})]})]})]})]},G):null]})]}),(0,S.jsxs)(`footer`,{className:`mx-auto flex w-full max-w-6xl items-center justify-between gap-4 pb-6 text-(color:--on)/55 text-[0.75rem] sm:pb-8`,children:[(0,S.jsxs)(`span`,{children:[`engenty ·`,` `,n.data.account?.signedIn?m(`setup.thisComputer`,{space:D?.name??``,organization:n.data.account.organization??n.data.account.name}):m(`setup.local`)]}),(0,S.jsxs)(`span`,{className:`flex items-center gap-5`,children:[Z?(0,S.jsx)(xe,{href:Z,children:new URL(Z).host}):null,(0,S.jsx)(`span`,{"aria-hidden":`true`,className:`size-[3px] bg-(color:--dot)`})]})]})]})}export{Ce as SetupPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{G as r,Gt as i,Q as a,Rt as o,Wt as s,ar as c,bt as l,gt as u,qn as d,sr as f,tn as p}from"./ui-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{G as r,Gt as i,Q as a,Rt as o,Wt as s,ar as c,bt as l,gt as u,qn as d,sr as f,tn as p}from"./ui-CwFQAfE-.js";import{d as m,n as h}from"./theme-DNPm6r4e.js";import{O as g,b as _,x as v}from"./session-DRy0k0nh.js";import{n as y,s as b}from"./i18n-CKKh3Pn0.js";import{BrandHeader as x}from"./PublicRunner-BZ66xdRX.js";var S=e(t(),1),C=e(n(),1);function w(){let{token:e}=c(),t=f({queryKey:[`share`,e],queryFn:()=>r.get(`/api/shares/${e}`),retry:(e,t)=>o(t)&&e<3});if(h(t.data?.brand.theme),g(t.data?.wizard.avatar),(0,S.useEffect)(()=>{t.data&&(document.title=`${t.data.title} · ${t.data.wizard.title}`)},[t.data]),t.isLoading)return(0,C.jsx)(`div`,{className:`flex min-h-dvh items-center justify-center text-ink-4`,children:(0,C.jsx)(p,{})});let n=t.data;if(!n)return(0,C.jsxs)(`div`,{className:`flex min-h-dvh flex-col items-center justify-center gap-4 px-6 text-center`,children:[(0,C.jsx)(v,{kind:`pebble`,size:80}),(0,C.jsx)(`p`,{className:`max-w-sm text-ink-3`,children:b(o(t.error)?`common.offline`:`sharePage.gone`)}),o(t.error)?(0,C.jsx)(s,{variant:`secondary`,onClick:()=>void t.refetch(),children:b(`common.retry`)}):null]});let w=`/api/shares/${n.token}`,T=e=>new Intl.DateTimeFormat(y,{dateStyle:`long`}).format(new Date(e));return(0,C.jsxs)(`div`,{className:`wizard-page flex min-h-dvh flex-col`,children:[(0,C.jsx)(m,{effects:n.brand.theme.effects}),(0,C.jsx)(x,{brand:n.brand}),(0,C.jsxs)(`main`,{className:`mx-auto w-full max-w-3xl flex-1 animate-rise px-4 pt-6 pb-12 sm:px-6`,children:[(0,C.jsxs)(`div`,{className:`mb-8 flex flex-wrap items-center gap-4`,children:[(0,C.jsx)(v,{kind:n.wizard.avatar,costume:n.wizard.costume,size:64}),(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`p`,{className:`text-[0.8125rem] text-ink-4`,children:n.expiresAt?b(`sharePage.until`,{date:T(n.expiresAt)}):b(`sharePage.shared`,{date:T(n.createdAt)})}),(0,C.jsx)(`h1`,{className:`font-display font-semibold text-[1.75rem] leading-tight tracking-tight sm:text-[2rem]`,children:n.title}),n.message?(0,C.jsx)(`p`,{className:`mt-1 text-[0.9375rem] text-ink-3`,children:n.message}):null]})]}),(0,C.jsx)(`div`,{className:`flex flex-col gap-6`,children:n.shown.map(({step:e,output:t,formats:n,label:r})=>(0,C.jsxs)(i,{className:`p-4 sm:p-5`,children:[(0,C.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center justify-between gap-3`,children:[(0,C.jsx)(`h2`,{className:`font-display font-semibold text-[1.0625rem]`,children:r??e.title}),(0,C.jsx)(u,{base:w,stepId:e.id,formats:n,title:r??e.title})]}),(0,C.jsx)(l,{base:w,step:e,output:t})]},e.id))}),n.wizardUrl?(0,C.jsxs)(`a`,{href:n.wizardUrl,className:`mt-10 flex items-center gap-4 rounded-2xl bg-card p-5 shadow-soft ring-1 ring-border-soft transition hover:shadow-elevated`,children:[(0,C.jsx)(v,{kind:n.wizard.avatar,costume:n.wizard.costume,size:44,interactive:!1}),(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`font-display font-semibold text-[1rem]`,children:n.wizard.title}),n.wizard.description?(0,C.jsx)(`div`,{className:`truncate text-[0.875rem] text-ink-3`,children:n.wizard.description}):null]}),(0,C.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 font-medium text-[0.875rem] text-ember-strong`,children:[b(`sharePage.own`),` `,(0,C.jsx)(d,{className:`size-4`})]})]}):null]}),(0,C.jsx)(`footer`,{className:`safe-bottom pt-6 text-center text-[0.75rem] text-ink-4`,children:(0,C.jsx)(`a`,{href:`${a}/`,className:`inline-block py-3.5 hover:text-ink-2`,children:b(`run.madeWith`).replace(`engenty wizards`,_.name)})})]})}export{w as SharePage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-BNakU3Ej.js";import{B as r,G as i,Gt as a,In as o,Mn as s,Mr as c,Rn as l,W as u,Wt as d,Xn as f,Xt as p,Yt as m,Zt as h,_n as g,h as _,on as v,ot as y,qt as b,rn as x,sr as S,tn as C,un as w,yn as ee,yt as T}from"./ui-CwFQAfE-.js";import{t as E}from"./useMutation-C20c2EH3.js";import{C as D}from"./PreviewPane-DPB5nEd5.js";import{t as O}from"./code-xml-Hx7YxCg0.js";import{t as k}from"./eye-BkMFLnYu.js";import{n as A,s as j}from"./i18n-CKKh3Pn0.js";import{Ut as te,ln as M}from"./index-Cy2NHzAx.js";import{a as N,c as P,i as ne,n as F,o as I,r as L,s as R,t as z}from"./ProjectPage-408YOoNa.js";import{N as B,a as V,r as H,t as U}from"./dist-EBVTpvRr.js";var W={name:`file-archive`,size:24,node:[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]};W.node;var re=f(W),G=e(t(),1),K=U.line({class:`cm-frontmatter`});function q(e){let t=new B,n=e.state.doc;if(n.lines>1&&n.line(1).text.trim()===`---`){for(let e=2;e<=Math.min(n.lines,80);e++)if(n.line(e).text.trim()===`---`){for(let r=1;r<=e;r++)t.add(n.line(r).from,n.line(r).from,K);break}}return t.finish()}function J(){return[V.fromClass(class{decorations;constructor(e){this.decorations=q(e)}update(e){e.docChanged&&(this.decorations=q(e.view))}},{decorations:e=>e.decorations}),H.theme({".cm-frontmatter, .cm-frontmatter *":{fontFamily:`var(--f-mono)`,fontSize:`0.8125rem !important`,fontWeight:`400 !important`,color:`var(--ink-3) !important`,textDecoration:`none !important`}})]}var Y=e(n(),1),X=[`always`,`demand`,`off`],ie=J();function ae(e){return S({queryKey:u.skill(e),queryFn:()=>i.get(`/api/studio/skills/${e}`)})}function oe({value:e,onChange:t,disabled:n}){return(0,Y.jsx)(`fieldset`,{"aria-label":j(`skills.modeLabel`),className:`m-0 min-w-0 border-0 p-0 flex flex-col gap-2`,children:X.map(r=>{let i=r===e,a=F[r];return(0,Y.jsxs)(`button`,{type:`button`,"aria-pressed":i,disabled:n,onClick:()=>!i&&t(r),className:v(`flex items-start gap-3 rounded-xl bg-card p-3 text-left ring-1 transition disabled:pointer-events-none`,i?`ring-ember shadow-[0_0_0_3px] shadow-ember-tint`:`ring-border-soft hover:ring-ink-4`,n&&!i&&`opacity-60`),children:[(0,Y.jsx)(`span`,{className:v(`flex size-8 shrink-0 items-center justify-center rounded-lg`,i?`bg-ember-tint text-ember-strong`:`bg-paper-2 text-ink-3`),children:(0,Y.jsx)(a,{className:`size-4`})}),(0,Y.jsxs)(`span`,{className:`min-w-0`,children:[(0,Y.jsx)(`span`,{className:`block font-medium text-[0.8125rem]`,children:j(`skills.mode.${r}`)}),(0,Y.jsx)(`span`,{className:`block text-[0.75rem] text-ink-3 leading-snug`,children:j(`skills.modeHint.${r}`)})]})]},r)})})}function se({skill:e}){let t=c(),n=E({mutationFn:t=>i.patch(`/api/studio/skills/${e.id}`,{runScripts:t}),onSuccess:async()=>{await t.invalidateQueries({queryKey:u.skill(e.id)}),await t.invalidateQueries({queryKey:u.skills(e.projectId)})}}),r=e.source!==`own`&&!e.official;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(L,{title:j(`skills.scriptsTitle`)}),(0,Y.jsxs)(a,{className:`flex flex-col gap-2 p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`flex-1 font-medium text-[0.8125rem]`,children:j(`skills.runScripts`)}),(0,Y.jsx)(x,{checked:e.runScripts,label:j(`skills.runScripts`),disabled:e.readOnly||n.isPending,onChange:e=>n.mutate(e)})]}),(0,Y.jsx)(`p`,{className:`text-[0.75rem] text-ink-3 leading-snug`,children:j(`skills.runScriptsHint`)}),r?(0,Y.jsx)(`p`,{className:`rounded-lg bg-amber-tint px-3 py-2 text-[0.75rem] text-ink-2 leading-snug`,children:j(`skills.runScriptsWarn`)}):null,n.error?(0,Y.jsx)(`p`,{className:`text-[0.75rem] text-rose`,children:n.error.message}):null]})]})}function Z({code:e,onChange:t}){return(0,Y.jsxs)(d,{variant:`secondary`,size:`sm`,"aria-pressed":e,onClick:()=>t(!e),children:[e?(0,Y.jsx)(k,{className:`size-4`}):(0,Y.jsx)(O,{className:`size-4`}),j(e?`skills.rendered`:`skills.code`)]})}var Q=e=>`${(e/1e3).toLocaleString(A,{maximumFractionDigits:1})} KB`,$=e=>Q(new TextEncoder().encode(e).length),ce=e=>/\.(md|markdown|mdx)$/i.test(e);function le({file:e,readOnly:t,onChange:n,onDelete:r,onClose:i}){let[o,c]=(0,G.useState)(!1),l=e?ce(e.path):!1,u=o||!l;return(0,Y.jsx)(b,{open:e!==null,onClose:i,wide:!0,height:`tall`,title:e?(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(s,{className:`size-4 shrink-0 text-ink-3`}),(0,Y.jsx)(`span`,{className:`truncate font-mono text-[0.9375rem]`,children:e.path})]}):null,children:e?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`flex-1 text-[0.75rem] text-ink-3`,children:$(e.text)}),l?(0,Y.jsx)(Z,{code:o,onChange:c}):null]}),(0,Y.jsx)(a,{className:`overflow-hidden`,children:u?(0,Y.jsx)(D,{value:e.text,onChange:n,readOnly:t,language:`markdown`,ariaLabel:e.path,className:`min-h-[50vh] [&_.cm-editor]:min-h-[50vh]`}):(0,Y.jsx)(`div`,{className:`p-5`,children:(0,Y.jsx)(T,{text:e.text})})}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[t?null:(0,Y.jsxs)(d,{variant:`danger`,size:`sm`,onClick:r,children:[(0,Y.jsx)(w,{className:`size-4`}),` `,j(`skills.deleteFile`)]}),(0,Y.jsx)(`span`,{className:`flex-1`}),(0,Y.jsx)(d,{size:`sm`,onClick:i,children:j(`skills.done`)})]})]}):null})}function ue({open:e,taken:t,onClose:n,onMade:r}){let[i,a]=(0,G.useState)(``),o=i.trim().replace(/^\.?\//,``),s=P(o)&&o!==`SKILL.md`&&!t.includes(o);return(0,Y.jsx)(b,{open:e,onClose:n,title:j(`skills.newFile`),children:(0,Y.jsxs)(`form`,{className:`flex flex-col gap-4`,onSubmit:e=>{e.preventDefault(),s&&(r(o),a(``))},children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(h,{children:j(`skills.filePath`)}),(0,Y.jsx)(p,{"data-autofocus":!0,value:i,placeholder:j(`skills.filePathHint`),onChange:e=>a(e.target.value),className:`font-mono`})]}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Y.jsx)(d,{variant:`ghost`,onClick:n,children:j(`common.cancel`)}),(0,Y.jsx)(d,{type:`submit`,disabled:!s,children:j(`skills.create`)})]})]})})}function de({items:e}){let[t,n]=(0,G.useState)(!1),r=(0,G.useRef)(null);return(0,G.useEffect)(()=>{if(!t)return;let e=e=>{r.current?.contains(e.target)||n(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[t]),(0,Y.jsxs)(`div`,{className:`relative`,ref:r,children:[(0,Y.jsx)(m,{label:j(`skills.more`),"aria-haspopup":`menu`,"aria-expanded":t,onClick:()=>n(e=>!e),className:`ring-1 ring-border`,children:(0,Y.jsx)(M,{className:`size-4`})}),t?(0,Y.jsx)(`div`,{role:`menu`,className:`absolute top-11 right-0 z-50 w-56 animate-rise rounded-xl bg-card p-1.5 shadow-overlay ring-1 ring-border-soft`,children:e.map(e=>(0,Y.jsx)(`button`,{type:`button`,role:`menuitem`,onClick:()=>{n(!1),e.onPick()},className:v(`w-full rounded-lg px-2.5 py-2 text-left text-[0.8125rem] transition hover:bg-accent`,e.danger&&`text-rose`),children:e.label},e.label))}):null]})}function fe({skill:e}){let t=c(),[n,r]=(0,G.useState)(!1),o=S({queryKey:[`skill-update`,e.id,e.originHash],queryFn:()=>i.get(`/api/studio/skills/${e.id}/update`),staleTime:6e5,retry:!1}),s=E({mutationFn:t=>i.post(`/api/studio/skills/${e.id}/update`,{hash:t}),onSuccess:async()=>{r(!1),await t.invalidateQueries({queryKey:u.skill(e.id)}),await t.invalidateQueries({queryKey:u.skills(e.projectId)})}}),l=o.data?.update;return!l||e.readOnly?null:(0,Y.jsxs)(a,{className:`flex flex-wrap items-center gap-3 px-4 py-3`,children:[(0,Y.jsx)(g,{className:`size-4 shrink-0 text-ember`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 text-[0.8125rem]`,children:j(`skills.updateAvailable`)}),(0,Y.jsx)(d,{variant:`secondary`,size:`sm`,onClick:()=>r(!0),children:j(`skills.showChanges`)}),(0,Y.jsx)(b,{open:n,onClose:()=>r(!1),wide:!0,height:`tall`,title:j(`skills.updateTitle`,{name:e.name}),children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(`p`,{className:`text-[0.875rem] text-ink-2`,children:l.description}),(0,Y.jsx)(`div`,{className:`rounded-lg bg-paper-2 p-4`,children:(0,Y.jsx)(T,{text:l.body})}),(0,Y.jsx)(`ul`,{className:`flex flex-col gap-0.5 text-[0.8125rem]`,children:l.fileList.map(e=>(0,Y.jsx)(`li`,{className:`font-mono`,children:e.path},e.path))}),(0,Y.jsx)(z,{files:l.fileList,skipped:l.skipped}),s.error?(0,Y.jsx)(`p`,{className:`text-[0.875rem] text-rose`,children:s.error.message}):null,(0,Y.jsx)(`div`,{className:`flex justify-end`,children:(0,Y.jsx)(d,{busy:s.isPending,onClick:()=>s.mutate(l.hash),children:j(`skills.takeUpdate`)})})]})})]})}function pe({skillId:e,onGone:t,onOpen:n}){let r=ae(e);return r.error?(0,Y.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:r.error.message}):r.data?(0,Y.jsx)(me,{skill:r.data,onGone:t,onOpen:n},r.data.id):(0,Y.jsx)(`div`,{className:`flex justify-center py-16`,children:(0,Y.jsx)(C,{className:`size-5`})})}function me({skill:e,onGone:t,onOpen:n}){let f=c(),p=e.source===`skills.sh`,m=e.readOnly||p,[h,g]=(0,G.useState)({name:e.name,description:e.description,body:e.body,meta:e.meta,files:e.fileList}),[v,b]=(0,G.useState)(!1),[x,S]=(0,G.useState)(null),[w,O]=(0,G.useState)(!1),[k,M]=(0,G.useState)(null),[P,F]=(0,G.useState)(!1),z=r(h,async t=>{m||(await i.patch(`/api/studio/skills/${e.id}`,t),await f.invalidateQueries({queryKey:u.skills(e.projectId)}))}),B=E({mutationFn:t=>i.patch(`/api/studio/skills/${e.id}`,{mode:t}),onSuccess:async()=>{await f.invalidateQueries({queryKey:u.skill(e.id)}),await f.invalidateQueries({queryKey:u.skills(e.projectId)})}}),V=E({mutationFn:()=>i.del(`/api/studio/skills/${e.id}`),onSuccess:async()=>{await f.invalidateQueries({queryKey:u.skills(e.projectId)}),t()}}),H=E({mutationFn:()=>i.post(`/api/studio/skills/${e.id}/copy`),onSuccess:async({id:t})=>{await f.invalidateQueries({queryKey:u.skills(e.projectId)}),n(`k:${t}`)}}),U=h.files.find(e=>e.path===k)??null,W=x??R(h),K=e=>g(t=>({...t,...e})),q=()=>{let t=p?`skills.removeConfirm`:`skills.deleteConfirm`;window.confirm(j(t,{name:e.name}))&&V.mutate()},J=z.error??B.error?.message??null,X=typeof e.meta.license==`string`?e.meta.license:null;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-5 pb-20`,children:[(0,Y.jsxs)(`header`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Y.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-ember-tint text-ember-strong`,children:(0,Y.jsx)(te,{className:`size-6`})}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2.5`,children:[m?(0,Y.jsx)(`h1`,{className:`font-medium font-mono text-2xl`,children:h.name}):(0,Y.jsx)(_,{fit:!0,value:h.name,label:j(`skills.name`),placeholder:j(`skills.namePlaceholder`),maxLength:N.name,onChange:e=>{S(null),K({name:e.toLowerCase().replace(/[^a-z0-9-]/g,`-`)})},className:`font-medium font-mono text-2xl`}),(0,Y.jsx)(ne,{skill:e}),z.state===`saving`?(0,Y.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 text-[0.75rem] text-ink-3`,children:[(0,Y.jsx)(C,{className:`size-3`}),` `,j(`project.saving`)]}):z.state===`saved`?(0,Y.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:j(`settings.saved`)}):null]}),m?(0,Y.jsx)(`p`,{className:`mt-1 max-w-3xl text-[0.9375rem] text-ink-2 leading-relaxed`,children:h.description}):(0,Y.jsx)(`textarea`,{value:h.description,"aria-label":j(`skills.description`),placeholder:j(`skills.descPlaceholder`),maxLength:N.description,rows:2,onChange:e=>{S(null),K({description:e.target.value})},className:`-mx-1 mt-1 block w-full max-w-3xl resize-none rounded-md bg-transparent px-1 py-0.5 text-[0.9375rem] text-ink-2 leading-relaxed outline-none transition placeholder:text-ink-4 hover:bg-paper-2 focus:bg-card focus:text-ink focus:ring-1 focus:ring-border`}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-[0.75rem] text-ink-3`,children:j(`skills.descHint`)})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 pt-1`,children:[(0,Y.jsxs)(`a`,{href:y(`/api/studio/skills/${e.id}/zip`),download:!0,className:`inline-flex h-8 items-center gap-2 rounded-full bg-card px-3 font-medium text-[0.8125rem] ring-1 ring-border transition hover:bg-accent`,children:[(0,Y.jsx)(o,{className:`size-4`}),` `,j(`skills.download`)]}),e.readOnly?null:(0,Y.jsx)(de,{items:[...p?[]:[{label:j(`skills.copy`),onPick:()=>H.mutate()}],{label:j(p?`skills.remove`:`skills.delete`),danger:!0,onPick:q}]})]})]}),p?(0,Y.jsx)(fe,{skill:e}):null,J?(0,Y.jsx)(`p`,{className:`px-1 text-[0.875rem] text-rose`,children:J}):null,(0,Y.jsxs)(`div`,{className:`grid gap-6 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,Y.jsxs)(`section`,{className:`flex min-w-0 flex-col gap-2`,children:[(0,Y.jsxs)(L,{title:j(`skills.instructions`),children:[(0,Y.jsx)(`span`,{className:`text-[0.75rem] text-ink-3`,children:j(`skills.chars`,{n:h.body.length.toLocaleString(A)})}),(0,Y.jsx)(Z,{code:v,onChange:b})]}),(0,Y.jsx)(a,{className:`overflow-hidden`,children:v?(0,Y.jsx)(D,{value:W,readOnly:m,onChange:e=>{S(e);try{let t=I(e);O(!1),K({...t,files:h.files})}catch{O(!0)}},language:`markdown`,ariaLabel:`SKILL.md`,extensions:ie,className:`min-h-[55vh] [&_.cm-editor]:min-h-[55vh] sm:[&_.cm-content]:py-5 sm:[&_.cm-line]:px-5`}):(0,Y.jsx)(`div`,{className:`min-h-40 p-5 sm:px-8 sm:py-6`,children:h.body.trim()?(0,Y.jsx)(T,{text:h.body}):(0,Y.jsx)(`p`,{className:`text-[0.875rem] text-ink-3`,children:j(`skills.emptyBody`)})})}),v&&w?(0,Y.jsx)(`p`,{className:`px-1 text-[0.8125rem] text-rose`,children:j(`skills.mdError`)}):null,p?(0,Y.jsx)(`p`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:j(`skills.readOnlyNote`)}):null]}),(0,Y.jsxs)(`aside`,{className:`flex flex-col gap-6`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(L,{title:j(`skills.when`)}),(0,Y.jsx)(oe,{value:e.mode,onChange:e=>B.mutate(e),disabled:e.readOnly||B.isPending})]}),(0,Y.jsx)(se,{skill:e}),p?(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(L,{title:j(`skills.origin`)}),(0,Y.jsx)(a,{className:`p-4`,children:(0,Y.jsxs)(`dl`,{className:`grid grid-cols-[6rem_minmax(0,1fr)] gap-y-2 text-[0.8125rem]`,children:[(0,Y.jsx)(`dt`,{className:`text-ink-3`,children:j(`skills.source`)}),(0,Y.jsx)(`dd`,{children:(0,Y.jsx)(`a`,{href:`https://skills.sh/${e.origin}`,target:`_blank`,rel:`noreferrer`,className:`break-all underline hover:text-ink`,children:e.origin})}),X?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-ink-3`,children:j(`skills.license`)}),(0,Y.jsx)(`dd`,{className:`break-words`,children:X})]}):null,e.originHash?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`dt`,{className:`text-ink-3`,children:j(`skills.version`)}),(0,Y.jsx)(`dd`,{className:`font-mono text-[0.75rem]`,children:e.originHash.slice(0,12)})]}):null]})}),e.readOnly?null:(0,Y.jsxs)(d,{variant:`secondary`,size:`sm`,className:`self-start`,busy:H.isPending,onClick:()=>H.mutate(),children:[(0,Y.jsx)(l,{className:`size-4`}),` `,j(`skills.copy`)]})]}):null,(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(L,{title:j(`skills.filesTitle`),children:m?null:(0,Y.jsxs)(d,{variant:`secondary`,size:`sm`,onClick:()=>F(!0),children:[(0,Y.jsx)(ee,{className:`size-4`}),` `,j(`skills.addFile`)]})}),h.files.length||e.blobList.length?(0,Y.jsxs)(a,{className:`flex flex-col divide-y divide-border-soft overflow-hidden`,children:[h.files.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>M(e.path),className:`flex items-center gap-2.5 px-3 py-2.5 text-left transition hover:bg-accent`,children:[(0,Y.jsx)(s,{className:`size-4 shrink-0 text-ink-3`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[0.8125rem]`,children:e.path}),(0,Y.jsx)(`span`,{className:`shrink-0 text-[0.75rem] text-ink-3`,children:$(e.text)})]},e.path)),e.blobList.map(e=>(0,Y.jsxs)(`div`,{className:`flex items-center gap-2.5 px-3 py-2.5`,children:[(0,Y.jsx)(re,{className:`size-4 shrink-0 text-ink-3`}),(0,Y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-[0.8125rem]`,children:e.path}),(0,Y.jsxs)(`span`,{className:`shrink-0 text-[0.75rem] text-ink-3`,children:[j(`skills.forScripts`),` · `,Q(e.bytes)]})]},e.path))]}):(0,Y.jsx)(`p`,{className:`px-1 text-[0.8125rem] text-ink-3`,children:j(`skills.noFiles`)}),(0,Y.jsx)(`p`,{className:`px-1 text-[0.75rem] text-ink-3`,children:j(`skills.filesHint`)}),e.blobList.length?(0,Y.jsx)(`p`,{className:`px-1 text-[0.75rem] text-ink-3`,children:j(`skills.blobHint`)}):null]})]})]}),(0,Y.jsx)(le,{file:U,readOnly:m,onClose:()=>M(null),onChange:e=>K({files:h.files.map(t=>t.path===k?{...t,text:e}:t)}),onDelete:()=>{K({files:h.files.filter(e=>e.path!==k)}),M(null)}}),(0,Y.jsx)(ue,{open:P,taken:h.files.map(e=>e.path),onClose:()=>F(!1),onMade:e=>{K({files:[...h.files,{path:e,text:``}].sort((e,t)=>e.path.localeCompare(t.path))}),F(!1),M(e)}})]})}export{pe as SkillEditor};
|