@debian777/kairos-mcp 3.3.0-rc.1 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. package/dist/embed-docs/mem/00000000-0000-0000-0000-000000002001.md +1 -1
  2. package/dist/embed-docs/mem/00000000-0000-0000-0000-000000002002.md +1 -1
  3. package/dist/ui/assets/{AccountPage-CYiR4YZC.js → AccountPage-xcULo_Ht.js} +1 -1
  4. package/dist/ui/assets/{ErrorAlert-CsC_23Jf.js → ErrorAlert-Bp_BC2t_.js} +1 -1
  5. package/dist/ui/assets/{HomePage-C9uFEU57.js → HomePage-YaKMlhFN.js} +1 -1
  6. package/dist/ui/assets/{KairosPage-CHWhntju.js → KairosPage-DgO58pOn.js} +1 -1
  7. package/dist/ui/assets/NotFoundPage-BnEJbefZ.js +1 -0
  8. package/dist/ui/assets/{ProtocolDetailPage-llVWn_BC.js → ProtocolDetailPage-D93cKbME.js} +1 -1
  9. package/dist/ui/assets/{ProtocolEditPage-CL5NbGFt.js → ProtocolEditPage-CCwQy6yl.js} +1 -1
  10. package/dist/ui/assets/{RenderedMarkdown-DqlM_8b-.js → RenderedMarkdown-Dd_bDNwz.js} +1 -1
  11. package/dist/ui/assets/{RunGuidedPage-oWV9k9yz.js → RunGuidedPage-CcTlI5HF.js} +1 -1
  12. package/dist/ui/assets/{RunsPage-Cext9vPR.js → RunsPage-BjSaeOq_.js} +1 -1
  13. package/dist/ui/assets/{SkillBundlePage--Gk1KQkj.js → SkillBundlePage-D2cJwwA1.js} +1 -1
  14. package/dist/ui/assets/{index-D7GLLuUc.js → index-Dj9XLtnR.js} +3 -3
  15. package/dist/ui/assets/{tiptap-jJ77DAJU.js → tiptap-BEg0BoNB.js} +6 -6
  16. package/dist/ui/assets/{useProtocol-DLLnPZMe.js → useProtocol-D_32bpf9.js} +1 -1
  17. package/dist/ui/assets/{useSpaces-B_fSEZZd.js → useSpaces-DdE67BYD.js} +1 -1
  18. package/dist/ui/assets/{vendor-D3iZlvlL.js → vendor-BxD5ItEO.js} +19 -19
  19. package/dist/ui/index.html +3 -3
  20. package/package.json +14 -7
  21. package/dist/ui/assets/NotFoundPage-DD7CJj29.js +0 -1
@@ -1,5 +1,5 @@
1
1
  ---
2
- version: "3.3.0-rc.1"
2
+ version: "3.3.0"
3
3
 
4
4
  title: Create New KAIROS Protocol Chain
5
5
  ---
@@ -1,5 +1,5 @@
1
1
  ---
2
- version: "3.3.0-rc.1"
2
+ version: "3.3.0"
3
3
 
4
4
  title: Get help refining your search
5
5
  ---
@@ -1 +1 @@
1
- import{g as e,y as t}from"./vendor-D3iZlvlL.js";import{t as n}from"./react-BdWJx0XL.js";import"./tiptap-jJ77DAJU.js";import{t as r}from"./api-D88c6lbH.js";async function i(){let e=await r(`/api/me`);if(!e.ok){let t=await e.json().catch(()=>({})),n=Error(t.message??e.statusText);throw n.statusCode=e.status,n}return e.json()}function a(){return e({queryKey:[`me`],queryFn:i,retry:!1})}var o=n();function s(){let{t:e}=t(),{data:n,isLoading:r,isError:i}=a();return r?(0,o.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`account.loading`)}):i||!n?(0,o.jsxs)(`div`,{children:[(0,o.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-4`,children:e(`account.title`)}),(0,o.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`account.notSignedIn`)}),(0,o.jsx)(`a`,{href:`/auth/callback`,className:`mt-4 min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`account.signIn`)})]}):(0,o.jsxs)(`div`,{children:[(0,o.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-6`,children:e(`account.title`)}),(0,o.jsx)(`p`,{className:`text-[var(--color-text-muted)] mb-6`,children:e(`account.intro`)}),(0,o.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,children:[(0,o.jsxs)(`div`,{className:`mb-4`,children:[(0,o.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.name`)}),(0,o.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.name??n.sub})]}),n.email&&(0,o.jsxs)(`div`,{className:`mb-4`,children:[(0,o.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.email`)}),(0,o.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.email})]}),(0,o.jsx)(`div`,{className:`mt-6 flex gap-2 flex-wrap`,children:(0,o.jsx)(`a`,{href:`/auth/logout`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-transparent no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`account.logOut`)})})]})]})}export{s as AccountPage};
1
+ import{g as e,y as t}from"./vendor-BxD5ItEO.js";import{t as n}from"./react-BdWJx0XL.js";import"./tiptap-BEg0BoNB.js";import{t as r}from"./api-D88c6lbH.js";async function i(){let e=await r(`/api/me`);if(!e.ok){let t=await e.json().catch(()=>({})),n=Error(t.message??e.statusText);throw n.statusCode=e.status,n}return e.json()}function a(){return e({queryKey:[`me`],queryFn:i,retry:!1})}var o=n();function s(){let{t:e}=t(),{data:n,isLoading:r,isError:i}=a();return r?(0,o.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`account.loading`)}):i||!n?(0,o.jsxs)(`div`,{children:[(0,o.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-4`,children:e(`account.title`)}),(0,o.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`account.notSignedIn`)}),(0,o.jsx)(`a`,{href:`/auth/callback`,className:`mt-4 min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`account.signIn`)})]}):(0,o.jsxs)(`div`,{children:[(0,o.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-6`,children:e(`account.title`)}),(0,o.jsx)(`p`,{className:`text-[var(--color-text-muted)] mb-6`,children:e(`account.intro`)}),(0,o.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,children:[(0,o.jsxs)(`div`,{className:`mb-4`,children:[(0,o.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.name`)}),(0,o.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.name??n.sub})]}),n.email&&(0,o.jsxs)(`div`,{className:`mb-4`,children:[(0,o.jsx)(`span`,{className:`block text-xs uppercase tracking-wider text-[var(--color-text-muted)] mb-1`,children:e(`account.email`)}),(0,o.jsx)(`span`,{className:`text-[var(--color-text-heading)]`,children:n.email})]}),(0,o.jsx)(`div`,{className:`mt-6 flex gap-2 flex-wrap`,children:(0,o.jsx)(`a`,{href:`/auth/logout`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-transparent no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`account.logOut`)})})]})]})}export{s as AccountPage};
@@ -1 +1 @@
1
- import{a as e,y as t}from"./vendor-D3iZlvlL.js";import{t as n}from"./react-BdWJx0XL.js";var r=n();function i({message:n,nextAction:i,onRetry:a,showGoBack:o=!0,supportLink:s}){let{t:c}=t();return(0,r.jsxs)(`div`,{className:`p-4 rounded-[var(--radius-md)] border border-[var(--color-error)] bg-[var(--color-error-bg)]`,role:`alert`,children:[(0,r.jsx)(`h2`,{className:`text-base font-semibold text-[var(--color-error)] mb-2`,children:c(`error.title`)}),(0,r.jsx)(`p`,{className:`text-[var(--color-text)]`,children:n}),i&&(0,r.jsx)(`p`,{className:`mt-4 pt-4 border-t border-[var(--color-border)] font-medium`,children:i}),(0,r.jsxs)(`div`,{className:`flex flex-wrap gap-2 mt-4`,children:[a&&(0,r.jsx)(`button`,{type:`button`,onClick:a,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:c(`error.retry`)}),o&&(0,r.jsx)(e,{to:`/`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:c(`error.goBack`)}),s&&(0,r.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:c(`error.support`)})]})]})}export{i as t};
1
+ import{a as e,y as t}from"./vendor-BxD5ItEO.js";import{t as n}from"./react-BdWJx0XL.js";var r=n();function i({message:n,nextAction:i,onRetry:a,showGoBack:o=!0,supportLink:s}){let{t:c}=t();return(0,r.jsxs)(`div`,{className:`p-4 rounded-[var(--radius-md)] border border-[var(--color-error)] bg-[var(--color-error-bg)]`,role:`alert`,children:[(0,r.jsx)(`h2`,{className:`text-base font-semibold text-[var(--color-error)] mb-2`,children:c(`error.title`)}),(0,r.jsx)(`p`,{className:`text-[var(--color-text)]`,children:n}),i&&(0,r.jsx)(`p`,{className:`mt-4 pt-4 border-t border-[var(--color-border)] font-medium`,children:i}),(0,r.jsxs)(`div`,{className:`flex flex-wrap gap-2 mt-4`,children:[a&&(0,r.jsx)(`button`,{type:`button`,onClick:a,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:c(`error.retry`)}),o&&(0,r.jsx)(e,{to:`/`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:c(`error.goBack`)}),s&&(0,r.jsx)(`a`,{href:s,target:`_blank`,rel:`noopener noreferrer`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:c(`error.support`)})]})]})}export{i as t};
@@ -1 +1 @@
1
- import{a as e,d as t,y as n}from"./vendor-D3iZlvlL.js";import{t as r}from"./react-BdWJx0XL.js";import"./tiptap-jJ77DAJU.js";import{t as i}from"./useSpaces-B_fSEZZd.js";var a=r();function o(){let{t:r}=n(),o=t(),{data:s,isLoading:c,isError:l}=i(),u=e=>{e.preventDefault();let t=e.currentTarget.querySelector(`input[name="q"]`)?.value?.trim()??``;o(t?`/kairos?q=${encodeURIComponent(t)}`:`/kairos`)},d=s?.spaces??[],f=c||l||d.length===0;return(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:r(`home.title`)}),(0,a.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-8`,children:r(`home.tagline`)}),(0,a.jsxs)(`form`,{onSubmit:u,className:`mb-8 max-w-xl`,"aria-label":r(`home.searchLabel`),children:[(0,a.jsx)(`label`,{htmlFor:`home-search-query`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`home.searchLabel`)}),(0,a.jsx)(`input`,{id:`home-search-query`,name:`q`,type:`search`,autoComplete:`off`,placeholder:r(`home.searchPlaceholder`),"aria-describedby":`home-search-hint`,className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,a.jsx)(`p`,{id:`home-search-hint`,className:`text-sm text-[var(--color-text-muted)] mt-2`,children:r(`home.searchHint`)})]}),(0,a.jsxs)(`div`,{className:`flex gap-4 flex-wrap mb-8`,"aria-label":r(`home.statsLabel`),children:[f&&d.length===0?(0,a.jsxs)(`div`,{className:`min-w-[7rem] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:[(0,a.jsx)(`span`,{className:`text-2xl font-semibold text-[var(--color-text-heading)]`,children:`—`}),(0,a.jsx)(`span`,{className:`block text-xs uppercase tracking-wide text-[var(--color-text-muted)] mt-1`,children:r(`home.stats.spacesLabel`)})]}):null,d.map(e=>(0,a.jsxs)(`div`,{className:`min-w-[7rem] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:[(0,a.jsx)(`span`,{className:`block font-semibold text-[var(--color-text-heading)]`,children:e.name}),(0,a.jsx)(`span`,{className:`block text-sm text-[var(--color-text-muted)] mt-1`,children:c?`—`:r(`home.stats.protocolCount`,{count:e.chain_count})})]},e.name))]}),(0,a.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:[r(`home.ctaPre`),` `,(0,a.jsx)(e,{to:`/kairos`,className:`text-[var(--color-primary)] font-medium underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`nav.kairos`)}),r(`home.ctaSuffix`)]})]})}export{o as HomePage};
1
+ import{a as e,d as t,y as n}from"./vendor-BxD5ItEO.js";import{t as r}from"./react-BdWJx0XL.js";import"./tiptap-BEg0BoNB.js";import{t as i}from"./useSpaces-DdE67BYD.js";var a=r();function o(){let{t:r}=n(),o=t(),{data:s,isLoading:c,isError:l}=i(),u=e=>{e.preventDefault();let t=e.currentTarget.querySelector(`input[name="q"]`)?.value?.trim()??``;o(t?`/kairos?q=${encodeURIComponent(t)}`:`/kairos`)},d=s?.spaces??[],f=c||l||d.length===0;return(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:r(`home.title`)}),(0,a.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-8`,children:r(`home.tagline`)}),(0,a.jsxs)(`form`,{onSubmit:u,className:`mb-8 max-w-xl`,"aria-label":r(`home.searchLabel`),children:[(0,a.jsx)(`label`,{htmlFor:`home-search-query`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`home.searchLabel`)}),(0,a.jsx)(`input`,{id:`home-search-query`,name:`q`,type:`search`,autoComplete:`off`,placeholder:r(`home.searchPlaceholder`),"aria-describedby":`home-search-hint`,className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,a.jsx)(`p`,{id:`home-search-hint`,className:`text-sm text-[var(--color-text-muted)] mt-2`,children:r(`home.searchHint`)})]}),(0,a.jsxs)(`div`,{className:`flex gap-4 flex-wrap mb-8`,"aria-label":r(`home.statsLabel`),children:[f&&d.length===0?(0,a.jsxs)(`div`,{className:`min-w-[7rem] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:[(0,a.jsx)(`span`,{className:`text-2xl font-semibold text-[var(--color-text-heading)]`,children:`—`}),(0,a.jsx)(`span`,{className:`block text-xs uppercase tracking-wide text-[var(--color-text-muted)] mt-1`,children:r(`home.stats.spacesLabel`)})]}):null,d.map(e=>(0,a.jsxs)(`div`,{className:`min-w-[7rem] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:[(0,a.jsx)(`span`,{className:`block font-semibold text-[var(--color-text-heading)]`,children:e.name}),(0,a.jsx)(`span`,{className:`block text-sm text-[var(--color-text-muted)] mt-1`,children:c?`—`:r(`home.stats.protocolCount`,{count:e.chain_count})})]},e.name))]}),(0,a.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:[r(`home.ctaPre`),` `,(0,a.jsx)(e,{to:`/kairos`,className:`text-[var(--color-primary)] font-medium underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`nav.kairos`)}),r(`home.ctaSuffix`)]})]})}export{o as HomePage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,g as n,p as r,y as i}from"./vendor-D3iZlvlL.js";import{i as a,t as o}from"./react-BdWJx0XL.js";import"./tiptap-jJ77DAJU.js";import{t as s}from"./api-D88c6lbH.js";import{t as c}from"./useSpaces-B_fSEZZd.js";import{t as l}from"./ErrorAlert-CsC_23Jf.js";var u=e(a(),1);async function d(e){let t=await s(`/api/kairos_search`,{method:`POST`,body:JSON.stringify({query:e.trim()})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return t.json()}function f(e,t){return n({queryKey:[`search`,e],queryFn:()=>d(e),enabled:t&&e.trim().length>0})}var p=o();function m(){return(0,p.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-hidden":`true`,children:[1,2,3].map(e=>(0,p.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4 flex justify-between items-start gap-4`,children:[(0,p.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-2`,children:[(0,p.jsx)(`div`,{className:`h-5 w-3/4 rounded bg-[var(--color-border)] animate-pulse`}),(0,p.jsx)(`div`,{className:`h-4 w-1/2 rounded bg-[var(--color-border)] animate-pulse`}),(0,p.jsx)(`div`,{className:`h-5 w-16 rounded bg-[var(--color-border)] animate-pulse`})]}),(0,p.jsx)(`div`,{className:`h-10 w-20 rounded-[var(--radius-md)] bg-[var(--color-border)] animate-pulse flex-shrink-0`})]},e))})}var h={match:`bg-[#dcfce7] text-[#166534]`,refine:`bg-[#dbeafe] text-[#1e40af]`,create:`bg-[#fef3c7] text-[#92400e]`},g=`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``),_=`kairos://mem/`;function v(){let{t:e}=i(),[n,a]=r(),o=n.get(`q`)??``,[s,d]=(0,u.useState)(o),[v,y]=(0,u.useState)(o),[b,x]=(0,u.useState)(null),{data:S,isLoading:C,isError:w,error:T,refetch:E}=f(v,!!v),D=!v,{data:O,isLoading:k,isError:A,error:j,refetch:M}=c(D,{includeChainTitles:!0});(0,u.useEffect)(()=>{let e=n.get(`q`)??``;d(e),y(e)},[n]);let N=e=>{e.preventDefault(),y(s),a(s?{q:s}:{},{replace:!0})},P=S?.choices??[],F={match:0,refine:1,create:2},I=P.slice().sort((e,t)=>{let n=(F[e.role]??99)-(F[t.role]??99);if(n!==0)return n;let r=e.score??-1;return(t.score??-1)-r}),L=I.length>0?Math.max(...I.map(e=>e.score==null?0:e.score*100)):null,{browseChains:R,countsByLetter:z}=(0,u.useMemo)(()=>{let e=[];for(let t of O?.spaces??[])for(let n of t.chains??[])e.push({chain_id:n.chain_id,title:n.title,step_count:n.step_count});let t={};for(let e of g)t[e]=0;for(let n of e){let e=(n.title??``).trim().charAt(0).toUpperCase();g.includes(e)&&(t[e]=(t[e]??0)+1)}return{browseChains:e,countsByLetter:t}},[O?.spaces]),B=(0,u.useMemo)(()=>b?R.filter(e=>(e.title??``).trim().charAt(0).toUpperCase()===b):[],[R,b]);return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:e(`kairos.title`)}),(0,p.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-8`,children:e(`kairos.searchHint`)}),(0,p.jsxs)(`section`,{className:`mb-8`,"aria-labelledby":`browse-search-label`,children:[(0,p.jsx)(`h2`,{id:`browse-search-label`,className:`sr-only`,children:e(`kairos.searchLabel`)}),(0,p.jsxs)(`form`,{onSubmit:N,className:`mb-6 max-w-xl`,"aria-label":e(`kairos.searchLabel`),children:[(0,p.jsx)(`label`,{htmlFor:`kairos-search-query`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:e(`kairos.searchLabel`)}),(0,p.jsx)(`input`,{id:`kairos-search-query`,type:`search`,value:s,onChange:e=>d(e.target.value),placeholder:e(`kairos.searchPlaceholder`),"aria-describedby":`kairos-search-hint`,className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,p.jsx)(`p`,{id:`kairos-search-hint`,className:`text-sm text-[var(--color-text-muted)] mt-2`,children:e(`kairos.searchHint`)}),(0,p.jsx)(`button`,{type:`submit`,className:`mt-3 min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.search`)})]})]}),w&&(0,p.jsx)(l,{message:T instanceof Error?T.message:String(T),onRetry:()=>E(),showGoBack:!0}),D&&A&&(0,p.jsx)(l,{message:j instanceof Error?j.message:String(j),onRetry:()=>M(),showGoBack:!0}),C&&v&&(0,p.jsxs)(`div`,{className:`mb-4`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,p.jsx)(`p`,{className:`sr-only`,children:e(`kairos.loading`)}),(0,p.jsx)(m,{})]}),D&&k&&(0,p.jsxs)(`div`,{className:`mb-4`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,p.jsx)(`p`,{className:`sr-only`,children:e(`kairos.loading`)}),(0,p.jsx)(m,{})]}),!C&&!w&&!(D&&A)&&(0,p.jsx)(p.Fragment,{children:v?I.length===0?(0,p.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,role:`status`,"aria-live":`polite`,children:[(0,p.jsx)(`p`,{className:`text-[var(--color-text-muted)] mb-4`,children:e(`kairos.empty`)}),(0,p.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,p.jsx)(t,{to:`/kairos`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.refineSearch`)}),(0,p.jsx)(t,{to:`/protocols/new`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.createNew`)})]})]}):v?(0,p.jsxs)(p.Fragment,{children:[I.length>0&&(0,p.jsx)(`p`,{id:`kairos-results-summary`,className:`text-sm text-[var(--color-text-muted)] mb-4`,"aria-live":`polite`,role:`status`,children:e(`kairos.foundMatches`,{count:I.length,top:L==null?0:Math.round(L)})}),(0,p.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-label":e(`kairos.resultsLabel`),children:I.map(n=>(0,p.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 flex justify-between items-start gap-4`,children:[(0,p.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,p.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)] block`,children:n.label}),(0,p.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:[n.chain_label??(n.role===`refine`?e(`kairos.refineMeta`):n.role===`create`?e(`kairos.createMeta`):``),n.score!=null&&` · ${e(`kairos.score`)}: ${Math.round(n.score*100)}%`,n.protocol_version&&` · ${e(`kairos.version`)}: ${n.protocol_version}`]}),(0,p.jsx)(`span`,{className:`inline-block mt-1 text-xs uppercase tracking-wide px-2 py-0.5 rounded ${h[n.role]??`bg-[var(--color-surface)] text-[var(--color-text-muted)]`}`,"aria-label":`Role: ${n.role}`,children:n.role}),n.tags?.length>0&&(0,p.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,"aria-label":e(`kairos.tagsLabel`),children:n.tags.slice(0,8).map(e=>(0,p.jsx)(`span`,{className:`inline-block text-xs px-2 py-0.5 rounded bg-[var(--color-surface)] border border-[var(--color-border)] text-[var(--color-text-muted)]`,children:e},e))})]}),(0,p.jsxs)(`div`,{className:`flex-shrink-0`,children:[n.role===`match`&&(0,p.jsx)(t,{to:`/protocols/${encodeURIComponent(n.uri)}`,"aria-label":e(`kairos.viewProtocol`,{title:n.label}),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.view`)}),n.role===`refine`&&(0,p.jsx)(t,{to:`/protocols/${encodeURIComponent(n.uri)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.refineSearch`)}),n.role===`create`&&(0,p.jsx)(t,{to:`/protocols/new`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.createNew`)})]})]},n.uri))})]}):null:(0,p.jsxs)(`section`,{"aria-labelledby":`browse-by-label-heading`,children:[(0,p.jsx)(`h2`,{id:`browse-by-label-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-3`,children:e(`kairos.browseByLabel`)}),(0,p.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-4`,children:e(`kairos.browseByLetterHint`)}),!k&&(0,p.jsx)(`div`,{className:`flex flex-wrap gap-2 mb-4`,role:`group`,"aria-label":e(`kairos.browseByLabel`),children:g.map(t=>{let n=z[t]??0;return(0,p.jsxs)(`button`,{type:`button`,onClick:()=>x(e=>e===t?null:t),"aria-expanded":b===t,"aria-controls":`browse-letter-panel-${t}`,"aria-pressed":b===t,"aria-label":e(`kairos.letterCount`,{letter:t,count:n}),className:`min-h-[var(--layout-touch-target)] min-w-[var(--layout-touch-target)] inline-flex items-center justify-center rounded-[var(--radius-md)] border px-3 py-2 text-sm font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 ${b===t?`border-[var(--color-primary)] bg-[var(--color-surface-elevated)] text-[var(--color-primary)]`:`border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)]`}`,children:[t,`: `,n]},t)})}),b&&!k&&(0,p.jsxs)(`div`,{id:`browse-letter-panel-${b}`,role:`region`,"aria-labelledby":`browse-letter-panel-heading`,"aria-live":`polite`,className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:[(0,p.jsx)(`h3`,{id:`browse-letter-panel-heading`,className:`text-base font-semibold text-[var(--color-text-heading)] mb-3`,children:e(`kairos.labelsStartingWith`,{letter:b})}),B.length===0?(0,p.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`kairos.noLabelsForLetter`)}):(0,p.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-label":e(`kairos.labelsStartingWith`,{letter:b}),children:B.map(n=>{let r=`${_}${n.chain_id}`;return(0,p.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,p.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:n.title}),(0,p.jsx)(t,{to:`/protocols/${encodeURIComponent(r)}`,"aria-label":e(`kairos.viewProtocol`,{title:n.title}),className:`min-h-[var(--layout-touch-target)] min-w-[var(--layout-touch-target)] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.view`)})]},n.chain_id)})})]})]})})]})}export{v as KairosPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,g as n,p as r,y as i}from"./vendor-BxD5ItEO.js";import{i as a,t as o}from"./react-BdWJx0XL.js";import"./tiptap-BEg0BoNB.js";import{t as s}from"./api-D88c6lbH.js";import{t as c}from"./useSpaces-DdE67BYD.js";import{t as l}from"./ErrorAlert-Bp_BC2t_.js";var u=e(a(),1);async function d(e){let t=await s(`/api/kairos_search`,{method:`POST`,body:JSON.stringify({query:e.trim()})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return t.json()}function f(e,t){return n({queryKey:[`search`,e],queryFn:()=>d(e),enabled:t&&e.trim().length>0})}var p=o();function m(){return(0,p.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-hidden":`true`,children:[1,2,3].map(e=>(0,p.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4 flex justify-between items-start gap-4`,children:[(0,p.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-2`,children:[(0,p.jsx)(`div`,{className:`h-5 w-3/4 rounded bg-[var(--color-border)] animate-pulse`}),(0,p.jsx)(`div`,{className:`h-4 w-1/2 rounded bg-[var(--color-border)] animate-pulse`}),(0,p.jsx)(`div`,{className:`h-5 w-16 rounded bg-[var(--color-border)] animate-pulse`})]}),(0,p.jsx)(`div`,{className:`h-10 w-20 rounded-[var(--radius-md)] bg-[var(--color-border)] animate-pulse flex-shrink-0`})]},e))})}var h={match:`bg-[#dcfce7] text-[#166534]`,refine:`bg-[#dbeafe] text-[#1e40af]`,create:`bg-[#fef3c7] text-[#92400e]`},g=`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``),_=`kairos://mem/`;function v(){let{t:e}=i(),[n,a]=r(),o=n.get(`q`)??``,[s,d]=(0,u.useState)(o),[v,y]=(0,u.useState)(o),[b,x]=(0,u.useState)(null),{data:S,isLoading:C,isError:w,error:T,refetch:E}=f(v,!!v),D=!v,{data:O,isLoading:k,isError:A,error:j,refetch:M}=c(D,{includeChainTitles:!0});(0,u.useEffect)(()=>{let e=n.get(`q`)??``;d(e),y(e)},[n]);let N=e=>{e.preventDefault(),y(s),a(s?{q:s}:{},{replace:!0})},P=S?.choices??[],F={match:0,refine:1,create:2},I=P.slice().sort((e,t)=>{let n=(F[e.role]??99)-(F[t.role]??99);if(n!==0)return n;let r=e.score??-1;return(t.score??-1)-r}),L=I.length>0?Math.max(...I.map(e=>e.score==null?0:e.score*100)):null,{browseChains:R,countsByLetter:z}=(0,u.useMemo)(()=>{let e=[];for(let t of O?.spaces??[])for(let n of t.chains??[])e.push({chain_id:n.chain_id,title:n.title,step_count:n.step_count});let t={};for(let e of g)t[e]=0;for(let n of e){let e=(n.title??``).trim().charAt(0).toUpperCase();g.includes(e)&&(t[e]=(t[e]??0)+1)}return{browseChains:e,countsByLetter:t}},[O?.spaces]),B=(0,u.useMemo)(()=>b?R.filter(e=>(e.title??``).trim().charAt(0).toUpperCase()===b):[],[R,b]);return(0,p.jsxs)(`div`,{children:[(0,p.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:e(`kairos.title`)}),(0,p.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-8`,children:e(`kairos.searchHint`)}),(0,p.jsxs)(`section`,{className:`mb-8`,"aria-labelledby":`browse-search-label`,children:[(0,p.jsx)(`h2`,{id:`browse-search-label`,className:`sr-only`,children:e(`kairos.searchLabel`)}),(0,p.jsxs)(`form`,{onSubmit:N,className:`mb-6 max-w-xl`,"aria-label":e(`kairos.searchLabel`),children:[(0,p.jsx)(`label`,{htmlFor:`kairos-search-query`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:e(`kairos.searchLabel`)}),(0,p.jsx)(`input`,{id:`kairos-search-query`,type:`search`,value:s,onChange:e=>d(e.target.value),placeholder:e(`kairos.searchPlaceholder`),"aria-describedby":`kairos-search-hint`,className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,p.jsx)(`p`,{id:`kairos-search-hint`,className:`text-sm text-[var(--color-text-muted)] mt-2`,children:e(`kairos.searchHint`)}),(0,p.jsx)(`button`,{type:`submit`,className:`mt-3 min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.search`)})]})]}),w&&(0,p.jsx)(l,{message:T instanceof Error?T.message:String(T),onRetry:()=>E(),showGoBack:!0}),D&&A&&(0,p.jsx)(l,{message:j instanceof Error?j.message:String(j),onRetry:()=>M(),showGoBack:!0}),C&&v&&(0,p.jsxs)(`div`,{className:`mb-4`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,p.jsx)(`p`,{className:`sr-only`,children:e(`kairos.loading`)}),(0,p.jsx)(m,{})]}),D&&k&&(0,p.jsxs)(`div`,{className:`mb-4`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,p.jsx)(`p`,{className:`sr-only`,children:e(`kairos.loading`)}),(0,p.jsx)(m,{})]}),!C&&!w&&!(D&&A)&&(0,p.jsx)(p.Fragment,{children:v?I.length===0?(0,p.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,role:`status`,"aria-live":`polite`,children:[(0,p.jsx)(`p`,{className:`text-[var(--color-text-muted)] mb-4`,children:e(`kairos.empty`)}),(0,p.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,p.jsx)(t,{to:`/kairos`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.refineSearch`)}),(0,p.jsx)(t,{to:`/protocols/new`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.createNew`)})]})]}):v?(0,p.jsxs)(p.Fragment,{children:[I.length>0&&(0,p.jsx)(`p`,{id:`kairos-results-summary`,className:`text-sm text-[var(--color-text-muted)] mb-4`,"aria-live":`polite`,role:`status`,children:e(`kairos.foundMatches`,{count:I.length,top:L==null?0:Math.round(L)})}),(0,p.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-label":e(`kairos.resultsLabel`),children:I.map(n=>(0,p.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 flex justify-between items-start gap-4`,children:[(0,p.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,p.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)] block`,children:n.label}),(0,p.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:[n.chain_label??(n.role===`refine`?e(`kairos.refineMeta`):n.role===`create`?e(`kairos.createMeta`):``),n.score!=null&&` · ${e(`kairos.score`)}: ${Math.round(n.score*100)}%`,n.protocol_version&&` · ${e(`kairos.version`)}: ${n.protocol_version}`]}),(0,p.jsx)(`span`,{className:`inline-block mt-1 text-xs uppercase tracking-wide px-2 py-0.5 rounded ${h[n.role]??`bg-[var(--color-surface)] text-[var(--color-text-muted)]`}`,"aria-label":`Role: ${n.role}`,children:n.role}),n.tags?.length>0&&(0,p.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2`,"aria-label":e(`kairos.tagsLabel`),children:n.tags.slice(0,8).map(e=>(0,p.jsx)(`span`,{className:`inline-block text-xs px-2 py-0.5 rounded bg-[var(--color-surface)] border border-[var(--color-border)] text-[var(--color-text-muted)]`,children:e},e))})]}),(0,p.jsxs)(`div`,{className:`flex-shrink-0`,children:[n.role===`match`&&(0,p.jsx)(t,{to:`/protocols/${encodeURIComponent(n.uri)}`,"aria-label":e(`kairos.viewProtocol`,{title:n.label}),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.view`)}),n.role===`refine`&&(0,p.jsx)(t,{to:`/protocols/${encodeURIComponent(n.uri)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.refineSearch`)}),n.role===`create`&&(0,p.jsx)(t,{to:`/protocols/new`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.createNew`)})]})]},n.uri))})]}):null:(0,p.jsxs)(`section`,{"aria-labelledby":`browse-by-label-heading`,children:[(0,p.jsx)(`h2`,{id:`browse-by-label-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-3`,children:e(`kairos.browseByLabel`)}),(0,p.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-4`,children:e(`kairos.browseByLetterHint`)}),!k&&(0,p.jsx)(`div`,{className:`flex flex-wrap gap-2 mb-4`,role:`group`,"aria-label":e(`kairos.browseByLabel`),children:g.map(t=>{let n=z[t]??0;return(0,p.jsxs)(`button`,{type:`button`,onClick:()=>x(e=>e===t?null:t),"aria-expanded":b===t,"aria-controls":`browse-letter-panel-${t}`,"aria-pressed":b===t,"aria-label":e(`kairos.letterCount`,{letter:t,count:n}),className:`min-h-[var(--layout-touch-target)] min-w-[var(--layout-touch-target)] inline-flex items-center justify-center rounded-[var(--radius-md)] border px-3 py-2 text-sm font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 ${b===t?`border-[var(--color-primary)] bg-[var(--color-surface-elevated)] text-[var(--color-primary)]`:`border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)]`}`,children:[t,`: `,n]},t)})}),b&&!k&&(0,p.jsxs)(`div`,{id:`browse-letter-panel-${b}`,role:`region`,"aria-labelledby":`browse-letter-panel-heading`,"aria-live":`polite`,className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:[(0,p.jsx)(`h3`,{id:`browse-letter-panel-heading`,className:`text-base font-semibold text-[var(--color-text-heading)] mb-3`,children:e(`kairos.labelsStartingWith`,{letter:b})}),B.length===0?(0,p.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`kairos.noLabelsForLetter`)}):(0,p.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,role:`list`,"aria-label":e(`kairos.labelsStartingWith`,{letter:b}),children:B.map(n=>{let r=`${_}${n.chain_id}`;return(0,p.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-3 rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,p.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:n.title}),(0,p.jsx)(t,{to:`/protocols/${encodeURIComponent(r)}`,"aria-label":e(`kairos.viewProtocol`,{title:n.title}),className:`min-h-[var(--layout-touch-target)] min-w-[var(--layout-touch-target)] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`kairos.view`)})]},n.chain_id)})})]})]})})]})}export{v as KairosPage};
@@ -0,0 +1 @@
1
+ import{y as e}from"./vendor-BxD5ItEO.js";import{t}from"./react-BdWJx0XL.js";import"./tiptap-BEg0BoNB.js";import{t as n}from"./ErrorAlert-Bp_BC2t_.js";var r=t();function i(){let{t}=e();return(0,r.jsxs)(`div`,{children:[(0,r.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-4`,children:t(`notFound.title`)}),(0,r.jsx)(n,{message:t(`notFound.message`),showGoBack:!0})]})}export{i as NotFoundPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,f as n,y as r}from"./vendor-D3iZlvlL.js";import{i,t as a}from"./react-BdWJx0XL.js";import"./tiptap-jJ77DAJU.js";import{i as o,n as s}from"./useProtocol-DLLnPZMe.js";import{t as c}from"./RenderedMarkdown-DqlM_8b-.js";var l=e(i(),1),u=a();function d({value:e,label:t,className:n}){let{t:i}=r(),[a,o]=(0,l.useState)(!1);return(0,u.jsx)(`button`,{type:`button`,onClick:(0,l.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},[e]),className:n,"aria-label":a?i(`run.copied`):t,title:t,children:i(a?`run.copied`:`run.copy`)})}var f={shell:`bg-[#fef3c7] text-[#92400e]`,mcp:`bg-[#dbeafe] text-[#1e40af]`,user_input:`bg-[#ede9fe] text-[#5b21b6]`,comment:`bg-[#e2e8f0] text-[#334155]`},p={shell:`Shell command`,mcp:`MCP tool call`,user_input:`User input`,comment:`Comment`};function m(){let{t:e}=r(),{uri:i}=n(),{data:a,isLoading:m,isError:h,error:g}=o(i?decodeURIComponent(i):void 0,!0),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(!1),x=(0,l.useRef)(null);if((0,l.useEffect)(()=>{if(!y)return;let e=e=>{x.current&&!x.current.contains(e.target)&&b(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[y]),m&&!a)return(0,u.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});if(h||!a)return(0,u.jsxs)(`div`,{role:`alert`,className:`p-4 rounded-[var(--radius-md)] bg-[var(--color-error-bg)] text-[var(--color-error)]`,children:[g instanceof Error?g.message:e(`protocol.notFound`),(0,u.jsx)(t,{to:`/`,className:`block mt-2 text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`notFound.goHome`)})]});let{title:S,steps:C,triggers:w,completion:T}=s(a.markdown_doc),E=()=>{let e=S.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`protocol`,t=new Blob([a.markdown_doc],{type:`text/markdown;charset=utf-8`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e}.md`,r.click(),URL.revokeObjectURL(n),b(!1)},D=()=>{let e=S.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`protocol`,t=`# ${S}\n\n${a.markdown_doc}`,n=new Blob([t],{type:`text/markdown;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e}-skill.md`,i.click(),URL.revokeObjectURL(r),b(!1)};return(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-3`,children:S}),(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-6`,children:[(0,u.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:[(0,u.jsxs)(`span`,{className:`sr-only`,children:[e(`protocol.uri`),`: `]}),(0,u.jsx)(`code`,{className:`text-xs bg-[var(--color-surface-elevated)] px-2 py-0.5 rounded break-all`,children:a.uri}),(0,u.jsxs)(`span`,{className:`ml-2`,children:[`· `,e(`protocol.readOnly`)]})]}),(0,u.jsx)(d,{value:a.uri,label:e(`protocol.copyUri`),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,u.jsxs)(`div`,{className:`relative`,ref:x,children:[(0,u.jsx)(`button`,{type:`button`,onClick:()=>b(e=>!e),"aria-expanded":y,"aria-haspopup":`true`,"aria-label":e(`protocol.download`),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.download`)}),y&&(0,u.jsxs)(`div`,{className:`absolute left-0 top-full z-10 mt-1 min-w-[12rem] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] py-1 shadow-sm`,role:`menu`,children:[(0,u.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:E,className:`flex w-full min-h-[44px] items-center justify-between px-3 py-2 text-left text-sm text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus:bg-[var(--color-surface-elevated)] focus:outline-none`,children:[e(`protocol.downloadAsMarkdown`),(0,u.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`.md`})]}),(0,u.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:D,className:`flex w-full min-h-[44px] items-center justify-between px-3 py-2 text-left text-sm text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus:bg-[var(--color-surface-elevated)] focus:outline-none`,children:[e(`protocol.downloadAsSkill`),(0,u.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`.md`})]})]})]}),(0,u.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/skill`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.editAsSkill`)})]}),(0,u.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-8`,children:[(0,u.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/run`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.runGuided`)}),(0,u.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/edit`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.edit`)}),(0,u.jsx)(t,{to:`/protocols/new`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.duplicate`)})]}),(0,u.jsxs)(`section`,{"aria-labelledby":`steps-heading`,className:`mb-8`,children:[(0,u.jsx)(`h2`,{id:`steps-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.steps`)}),(0,u.jsx)(`ul`,{className:`list-none p-0 m-0 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] divide-y divide-[var(--color-border)]`,children:C.map((t,n)=>(0,u.jsxs)(`li`,{className:`p-5`,children:[(0,u.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsxs)(`span`,{className:`block text-sm font-medium text-[var(--color-text)]`,children:[`Step `,n+1,`: `,t.label]}),(0,u.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1 break-words`,children:t.summary}),(0,u.jsx)(`span`,{className:`inline-block mt-1 text-xs uppercase tracking-wide px-2 py-0.5 rounded ${f[t.type]??`bg-[var(--color-surface)] text-[var(--color-text-muted)]`}`,"aria-label":`Challenge type: ${p[t.type]??t.type}`,children:p[t.type]??t.type})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,u.jsx)(d,{value:t.body||t.summary,label:`${e(`run.copy`)} ${t.label}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),t.body?(0,u.jsx)(`button`,{type:`button`,onClick:()=>v(_===n?null:n),"aria-expanded":_===n,"aria-controls":`step-detail-${n}`,id:`step-toggle-${n}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(_===n?`protocol.collapse`:`protocol.expand`)}):null]})]}),t.body?(0,u.jsx)(`div`,{id:`step-detail-${n}`,role:`region`,"aria-labelledby":`step-toggle-${n}`,hidden:_!==n,className:`mt-3 pt-3 border-t border-[var(--color-border)]`,children:(0,u.jsx)(c,{content:t.body})}):null]},n))})]}),w&&(0,u.jsxs)(`section`,{"aria-labelledby":`triggers-heading`,className:`mb-8`,children:[(0,u.jsx)(`h2`,{id:`triggers-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.triggers`)}),(0,u.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,u.jsx)(c,{content:w})})]}),T&&(0,u.jsxs)(`section`,{"aria-labelledby":`completion-heading`,className:`mb-8`,children:[(0,u.jsx)(`h2`,{id:`completion-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.completion`)}),(0,u.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,u.jsx)(c,{content:T})})]}),(0,u.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 mt-8`,role:`region`,"aria-labelledby":`how-to-use-heading`,children:[(0,u.jsx)(`h2`,{id:`how-to-use-heading`,className:`text-base font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.howToUse`)}),(0,u.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-2`,children:e(`protocol.howToUseInProduct`)}),(0,u.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:[e(`protocol.howToUseCopy`),` `,(0,u.jsx)(`a`,{href:`https://github.com/debian777/kairos-mcp#readme`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.docsLink`)})]})]})]})}export{m as ProtocolDetailPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,f as n,y as r}from"./vendor-BxD5ItEO.js";import{i,t as a}from"./react-BdWJx0XL.js";import"./tiptap-BEg0BoNB.js";import{i as o,n as s}from"./useProtocol-D_32bpf9.js";import{t as c}from"./RenderedMarkdown-Dd_bDNwz.js";var l=e(i(),1),u=a();function d({value:e,label:t,className:n}){let{t:i}=r(),[a,o]=(0,l.useState)(!1);return(0,u.jsx)(`button`,{type:`button`,onClick:(0,l.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),o(!0),setTimeout(()=>o(!1),2e3)}catch{}},[e]),className:n,"aria-label":a?i(`run.copied`):t,title:t,children:i(a?`run.copied`:`run.copy`)})}var f={shell:`bg-[#fef3c7] text-[#92400e]`,mcp:`bg-[#dbeafe] text-[#1e40af]`,user_input:`bg-[#ede9fe] text-[#5b21b6]`,comment:`bg-[#e2e8f0] text-[#334155]`},p={shell:`Shell command`,mcp:`MCP tool call`,user_input:`User input`,comment:`Comment`};function m(){let{t:e}=r(),{uri:i}=n(),{data:a,isLoading:m,isError:h,error:g}=o(i?decodeURIComponent(i):void 0,!0),[_,v]=(0,l.useState)(null),[y,b]=(0,l.useState)(!1),x=(0,l.useRef)(null);if((0,l.useEffect)(()=>{if(!y)return;let e=e=>{x.current&&!x.current.contains(e.target)&&b(!1)};return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[y]),m&&!a)return(0,u.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});if(h||!a)return(0,u.jsxs)(`div`,{role:`alert`,className:`p-4 rounded-[var(--radius-md)] bg-[var(--color-error-bg)] text-[var(--color-error)]`,children:[g instanceof Error?g.message:e(`protocol.notFound`),(0,u.jsx)(t,{to:`/`,className:`block mt-2 text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`notFound.goHome`)})]});let{title:S,steps:C,triggers:w,completion:T}=s(a.markdown_doc),E=()=>{let e=S.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`protocol`,t=new Blob([a.markdown_doc],{type:`text/markdown;charset=utf-8`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${e}.md`,r.click(),URL.revokeObjectURL(n),b(!1)},D=()=>{let e=S.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`protocol`,t=`# ${S}\n\n${a.markdown_doc}`,n=new Blob([t],{type:`text/markdown;charset=utf-8`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${e}-skill.md`,i.click(),URL.revokeObjectURL(r),b(!1)};return(0,u.jsxs)(`div`,{children:[(0,u.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-3`,children:S}),(0,u.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 mb-6`,children:[(0,u.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:[(0,u.jsxs)(`span`,{className:`sr-only`,children:[e(`protocol.uri`),`: `]}),(0,u.jsx)(`code`,{className:`text-xs bg-[var(--color-surface-elevated)] px-2 py-0.5 rounded break-all`,children:a.uri}),(0,u.jsxs)(`span`,{className:`ml-2`,children:[`· `,e(`protocol.readOnly`)]})]}),(0,u.jsx)(d,{value:a.uri,label:e(`protocol.copyUri`),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),(0,u.jsxs)(`div`,{className:`relative`,ref:x,children:[(0,u.jsx)(`button`,{type:`button`,onClick:()=>b(e=>!e),"aria-expanded":y,"aria-haspopup":`true`,"aria-label":e(`protocol.download`),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.download`)}),y&&(0,u.jsxs)(`div`,{className:`absolute left-0 top-full z-10 mt-1 min-w-[12rem] rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] py-1 shadow-sm`,role:`menu`,children:[(0,u.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:E,className:`flex w-full min-h-[44px] items-center justify-between px-3 py-2 text-left text-sm text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus:bg-[var(--color-surface-elevated)] focus:outline-none`,children:[e(`protocol.downloadAsMarkdown`),(0,u.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`.md`})]}),(0,u.jsxs)(`button`,{type:`button`,role:`menuitem`,onClick:D,className:`flex w-full min-h-[44px] items-center justify-between px-3 py-2 text-left text-sm text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus:bg-[var(--color-surface-elevated)] focus:outline-none`,children:[e(`protocol.downloadAsSkill`),(0,u.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`.md`})]})]})]}),(0,u.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/skill`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.editAsSkill`)})]}),(0,u.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-8`,children:[(0,u.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/run`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.runGuided`)}),(0,u.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}/edit`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.edit`)}),(0,u.jsx)(t,{to:`/protocols/new`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.duplicate`)})]}),(0,u.jsxs)(`section`,{"aria-labelledby":`steps-heading`,className:`mb-8`,children:[(0,u.jsx)(`h2`,{id:`steps-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.steps`)}),(0,u.jsx)(`ul`,{className:`list-none p-0 m-0 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] divide-y divide-[var(--color-border)]`,children:C.map((t,n)=>(0,u.jsxs)(`li`,{className:`p-5`,children:[(0,u.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,u.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,u.jsxs)(`span`,{className:`block text-sm font-medium text-[var(--color-text)]`,children:[`Step `,n+1,`: `,t.label]}),(0,u.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1 break-words`,children:t.summary}),(0,u.jsx)(`span`,{className:`inline-block mt-1 text-xs uppercase tracking-wide px-2 py-0.5 rounded ${f[t.type]??`bg-[var(--color-surface)] text-[var(--color-text-muted)]`}`,"aria-label":`Challenge type: ${p[t.type]??t.type}`,children:p[t.type]??t.type})]}),(0,u.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,u.jsx)(d,{value:t.body||t.summary,label:`${e(`run.copy`)} ${t.label}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`}),t.body?(0,u.jsx)(`button`,{type:`button`,onClick:()=>v(_===n?null:n),"aria-expanded":_===n,"aria-controls":`step-detail-${n}`,id:`step-toggle-${n}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-3 py-1.5 text-sm font-medium rounded-[var(--radius-md)] border border-[var(--color-border)] text-[var(--color-text)] bg-[var(--color-surface)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(_===n?`protocol.collapse`:`protocol.expand`)}):null]})]}),t.body?(0,u.jsx)(`div`,{id:`step-detail-${n}`,role:`region`,"aria-labelledby":`step-toggle-${n}`,hidden:_!==n,className:`mt-3 pt-3 border-t border-[var(--color-border)]`,children:(0,u.jsx)(c,{content:t.body})}):null]},n))})]}),w&&(0,u.jsxs)(`section`,{"aria-labelledby":`triggers-heading`,className:`mb-8`,children:[(0,u.jsx)(`h2`,{id:`triggers-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.triggers`)}),(0,u.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,u.jsx)(c,{content:w})})]}),T&&(0,u.jsxs)(`section`,{"aria-labelledby":`completion-heading`,className:`mb-8`,children:[(0,u.jsx)(`h2`,{id:`completion-heading`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.completion`)}),(0,u.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,u.jsx)(c,{content:T})})]}),(0,u.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 mt-8`,role:`region`,"aria-labelledby":`how-to-use-heading`,children:[(0,u.jsx)(`h2`,{id:`how-to-use-heading`,className:`text-base font-semibold text-[var(--color-text-heading)] mb-2`,children:e(`protocol.howToUse`)}),(0,u.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-2`,children:e(`protocol.howToUseInProduct`)}),(0,u.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:[e(`protocol.howToUseCopy`),` `,(0,u.jsx)(`a`,{href:`https://github.com/debian777/kairos-mcp#readme`,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.docsLink`)})]})]})]})}export{m as ProtocolDetailPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,d as n,f as r,t as i,y as a}from"./vendor-D3iZlvlL.js";import{i as o,t as s}from"./react-BdWJx0XL.js";import{a as c,c as l,i as u,l as d,n as f,o as p,r as m,s as h,t as g}from"./tiptap-jJ77DAJU.js";import{t as _}from"./api-D88c6lbH.js";import{i as v,n as y,r as b,t as x}from"./useProtocol-DLLnPZMe.js";var S=e(o(),1),C=s(),w=`min-h-[11rem] px-4 py-3 text-sm leading-6 text-[var(--color-text)] focus:outline-none prose prose-sm max-w-none [&_table]:my-3 [&_table]:w-full [&_table]:border-collapse [&_th]:border [&_th]:border-[var(--color-border)] [&_th]:bg-[var(--color-surface-elevated)] [&_th]:px-2 [&_th]:py-1.5 [&_td]:border [&_td]:border-[var(--color-border)] [&_td]:px-2 [&_td]:py-1.5`;function T({children:e,className:t=`h-4 w-4`}){return(0,C.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:e})}function E(){return(0,C.jsxs)(T,{children:[(0,C.jsx)(`circle`,{cx:`3`,cy:`4`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,C.jsx)(`circle`,{cx:`3`,cy:`8`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,C.jsx)(`circle`,{cx:`3`,cy:`12`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,C.jsx)(`path`,{d:`M6 4h7`}),(0,C.jsx)(`path`,{d:`M6 8h7`}),(0,C.jsx)(`path`,{d:`M6 12h7`})]})}function D(){return(0,C.jsxs)(T,{children:[(0,C.jsx)(`path`,{d:`M6 10L4.5 11.5a2.5 2.5 0 1 1-3.5-3.5L2.5 6.5`}),(0,C.jsx)(`path`,{d:`M10 6l1.5-1.5a2.5 2.5 0 1 1 3.5 3.5L13.5 9.5`}),(0,C.jsx)(`path`,{d:`M5.5 10.5l5-5`})]})}function O(){return(0,C.jsxs)(T,{children:[(0,C.jsx)(`path`,{d:`M5.5 5.5A2.5 2.5 0 0 0 3 8v2.5h3V8H4.5`}),(0,C.jsx)(`path`,{d:`M11.5 5.5A2.5 2.5 0 0 0 9 8v2.5h3V8h-1.5`})]})}function k(){return(0,C.jsxs)(T,{children:[(0,C.jsx)(`path`,{d:`M6 5.5l2 5-2 5`}),(0,C.jsx)(`path`,{d:`M10 5.5l2 5-2 5`})]})}function A(){return(0,C.jsxs)(T,{children:[(0,C.jsx)(`path`,{d:`M6 4L2.5 8L6 12`}),(0,C.jsx)(`path`,{d:`M10 4l3.5 4L10 12`}),(0,C.jsx)(`path`,{d:`M8.75 3.5L7.25 12.5`})]})}function j(){return(0,C.jsxs)(T,{children:[(0,C.jsx)(`path`,{d:`M2 3h12v2H2V3z`}),(0,C.jsx)(`path`,{d:`M2 7h12v1H2V7z`}),(0,C.jsx)(`path`,{d:`M2 11h12v1H2v-1z`}),(0,C.jsx)(`path`,{d:`M2 15h12v1H2v-1z`}),(0,C.jsx)(`path`,{d:`M2 4v11`}),(0,C.jsx)(`path`,{d:`M6 4v11`}),(0,C.jsx)(`path`,{d:`M10 4v11`}),(0,C.jsx)(`path`,{d:`M14 4v11`})]})}function M({label:e,ariaLabel:t,active:n,onClick:r}){return(0,C.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:r,className:`inline-flex min-h-[36px] min-w-[36px] items-center justify-center rounded-[var(--radius-sm)] border px-3 text-xs font-medium transition-colors ${n?`border-[var(--color-primary)] bg-[var(--color-primary)] text-white`:`border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text-muted)] hover:bg-[var(--color-surface)] hover:text-[var(--color-text)]`}`,children:e})}function N({editor:e}){return e?(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2 border-b border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-3 py-2`,children:[(0,C.jsx)(M,{label:(0,C.jsx)(`span`,{className:`text-base leading-none`,children:`¶`}),ariaLabel:`Paragraph`,active:e.isActive(`paragraph`),onClick:()=>e.chain().focus().setParagraph().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(`strong`,{className:`text-sm font-semibold`,children:`B`}),ariaLabel:`Bold`,active:e.isActive(`bold`),onClick:()=>e.chain().focus().toggleBold().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(`em`,{className:`text-sm`,children:`I`}),ariaLabel:`Italic`,active:e.isActive(`italic`),onClick:()=>e.chain().focus().toggleItalic().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(E,{}),ariaLabel:`Bullet list`,active:e.isActive(`bulletList`),onClick:()=>e.chain().focus().toggleBulletList().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(`span`,{className:`text-sm font-semibold`,children:`1.`}),ariaLabel:`Numbered list`,active:e.isActive(`orderedList`),onClick:()=>e.chain().focus().toggleOrderedList().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(D,{}),ariaLabel:`Link`,active:e.isActive(`link`),onClick:()=>{let t=e.getAttributes(`link`).href,n=window.prompt(`Enter URL`,t??`https://`);if(n==null)return;let r=n.trim();if(!r){e.chain().focus().unsetLink().run();return}e.chain().focus().extendMarkRange(`link`).setLink({href:r}).run()}}),(0,C.jsx)(M,{label:(0,C.jsx)(O,{}),ariaLabel:`Quote`,active:e.isActive(`blockquote`),onClick:()=>e.chain().focus().toggleBlockquote().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(k,{}),ariaLabel:`Inline code`,active:e.isActive(`code`),onClick:()=>e.chain().focus().toggleCode().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(A,{}),ariaLabel:`Code block`,active:e.isActive(`codeBlock`),onClick:()=>e.chain().focus().toggleCodeBlock().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(j,{}),ariaLabel:`Insert table`,active:e.isActive(`table`),onClick:()=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()})]}):null}function P({value:e,onChange:t,label:n,hint:r,id:i,contentKey:a}){let o=(0,S.useRef)(a),s=d({key:a??`default`,immediatelyRender:!1,extensions:[p.configure({heading:!1,link:!1}),h.configure({openOnClick:!1,autolink:!1}),g.configure({resizable:!1}),u,f,m,c],content:e,contentType:`markdown`,editorProps:{attributes:{class:w}},onUpdate:({editor:n})=>{let r=n.getMarkdown?.()??``;r!==e&&t(r)}});return(0,S.useEffect)(()=>{!s||a===o.current||(o.current=a,s.commands.setContent(e,!1,{contentType:`markdown`,preserveWhitespace:`full`}))},[a,e,s]),(0,C.jsxs)(`div`,{children:[n&&(0,C.jsx)(`label`,{htmlFor:i,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:n}),(0,C.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)]`,children:[(0,C.jsx)(N,{editor:s}),(0,C.jsx)(l,{editor:s})]}),r&&(0,C.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:r})]})}var F=i().min(1,`Protocol content is required`).refine(e=>e.includes(`# `),`Protocol must have an H1 title`).refine(e=>/(^|\n)##\s+Natural language triggers\b/i.test(e),`Include a "Natural language triggers" section (H2)`).refine(e=>/(^|\n)##\s+Completion rule\b/i.test(e),`Include a "Completion rule" section (H2)`),I={label:`Step`,bodyMarkdown:`What the user or agent does in this step.`,type:`comment`,comment:{min_length:10}},L=[`shell`,`mcp`,`user_input`,`comment`];function R(){let{t:e}=a(),{uri:i}=r(),o=n(),s=i?decodeURIComponent(i):void 0,c=!s,{data:l,isLoading:u}=v(s,!c),[d,f]=(0,S.useState)({protocolLabel:``,triggersMarkdown:``,steps:[{...I}],completionMarkdown:``}),[p,m]=(0,S.useState)(()=>String(Date.now())),[h,g]=(0,S.useState)(!1),[w,T]=(0,S.useState)(null),[E,D]=(0,S.useState)(null),O=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(l?.markdown_doc)try{f(b(l.markdown_doc)),m(String(Date.now()))}catch{f({protocolLabel:l.label||`Protocol`,triggersMarkdown:``,steps:[{...I}],completionMarkdown:``})}},[l]);let k=e=>{let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>{let e=typeof n.result==`string`?n.result:``;try{f(b(e)),m(String(Date.now())),D(null),T(null)}catch{T(`Could not parse the uploaded file. Use valid protocol markdown.`)}},n.readAsText(t,`UTF-8`),e.target.value=``},A=(e,t)=>{f(n=>({...n,[e]:t}))},j=(e,t)=>{f(n=>({...n,steps:n.steps.map((n,r)=>r===e?typeof t==`function`?t(n):{...n,...t}:n)}))},M=()=>{f(e=>({...e,steps:[...e.steps,{...I,label:`Step ${e.steps.length+1}`}]}))},N=e=>{f(t=>({...t,steps:t.steps.filter((t,n)=>n!==e)}))},R=async e=>{e.preventDefault(),T(null),D(null);let t=x(d),n=F.safeParse(t);if(!n.success){D(n.error.errors[0]?.message??`Invalid`);return}g(!0);try{if(c){let e=await _(`/api/kairos_mint/raw`,{method:`POST`,headers:{"Content-Type":`text/markdown`},body:t});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.message??e.statusText)}let n=(await e.json()).items?.[0]?.uri;o(n?`/protocols/${encodeURIComponent(n)}`:`/`)}else{let e=await _(`/api/kairos_update`,{method:`POST`,body:JSON.stringify({uris:[s],markdown_doc:[t]})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.message??e.statusText)}o(`/protocols/${encodeURIComponent(s)}`)}}catch(e){T(e instanceof Error?e.message:String(e))}finally{g(!1)}},z=(()=>{try{return y(x(d))}catch{return{title:d.protocolLabel||`Protocol`,steps:[],triggers:``,completion:``}}})();if(!c&&u&&!l)return(0,C.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});let B={shell:e(`protocolEdit.challengeShell`),mcp:e(`protocolEdit.challengeMcp`),user_input:e(`protocolEdit.challengeUserInput`),comment:e(`protocolEdit.challengeComment`)};return(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h1`,{className:`mb-1 text-2xl font-semibold text-[var(--color-text-heading)]`,children:!c&&d.protocolLabel.trim()?d.protocolLabel.trim():e(c?`protocolEdit.newTitle`:`protocolEdit.editTitle`)}),(0,C.jsx)(`p`,{className:`mb-6 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.hint`)}),(0,C.jsxs)(`div`,{className:`mb-8 flex flex-wrap items-center justify-between gap-3 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:`Import existing content`}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.uploadHint`)})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsx)(`input`,{ref:O,type:`file`,accept:`.md,text/markdown`,onChange:k,className:`sr-only`,id:`protocol-upload`,"aria-label":e(`protocolEdit.upload`)}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>O.current?.click(),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocolEdit.upload`)}),!c&&s&&(0,C.jsx)(t,{to:`/protocols/${encodeURIComponent(s)}/skill`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.editAsSkill`)})]})]}),(0,C.jsx)(`form`,{onSubmit:R,"aria-label":e(`protocolEdit.formLabel`),children:(0,C.jsxs)(`div`,{className:`mb-6 grid gap-6 xl:grid-cols-[1.6fr_1fr]`,children:[(0,C.jsxs)(`div`,{className:`space-y-6`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`protocol-label`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.protocolLabel`)}),(0,C.jsx)(`input`,{id:`protocol-label`,type:`text`,value:d.protocolLabel,onChange:e=>A(`protocolLabel`,e.target.value),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,C.jsx)(P,{label:e(`protocolEdit.triggersLabel`),hint:e(`protocolEdit.triggersHint`),value:d.triggersMarkdown,onChange:e=>A(`triggersMarkdown`,e),contentKey:p}),d.steps.map((t,n)=>(0,C.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 space-y-5`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,C.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[`Step `,n+1,t.label.trim()?`: ${t.label.trim()}`:``]}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>N(n),disabled:d.steps.length<=1,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:opacity-50`,children:e(`protocolEdit.removeStep`)})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.stepLabel`)}),(0,C.jsx)(`input`,{type:`text`,value:t.label,onChange:e=>j(n,{label:e.target.value}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`mb-2 font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.challengeType`)}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:L.map(e=>(0,C.jsx)(`button`,{type:`button`,"aria-pressed":t.type===e,onClick:()=>j(n,{type:e,shell:e===`shell`?{cmd:t.shell?.cmd??``}:void 0,mcp:e===`mcp`?{tool_name:t.mcp?.tool_name??``}:void 0,user_input:e===`user_input`?{prompt:t.user_input?.prompt??``}:void 0,comment:e===`comment`?{min_length:t.comment?.min_length??10}:void 0}),className:`min-h-[44px] rounded-[var(--radius-md)] px-4 text-sm font-medium ${t.type===e?`bg-[var(--color-primary)] text-white`:`border border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)]`}`,children:B[e]},e))})]}),(0,C.jsx)(`div`,{children:(0,C.jsx)(P,{label:e(`protocolEdit.stepContent`),value:t.bodyMarkdown,onChange:e=>j(n,{bodyMarkdown:e}),contentKey:p})}),(0,C.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,C.jsx)(`div`,{className:`mb-3 text-sm font-medium text-[var(--color-text-heading)]`,children:`Challenge fields`}),(0,C.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[t.type===`shell`&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellCmd`)}),(0,C.jsx)(`input`,{type:`text`,value:t.shell?.cmd??``,onChange:e=>j(n,{shell:{cmd:e.target.value}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),t.type===`mcp`&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.mcpToolName`)}),(0,C.jsx)(`input`,{type:`text`,value:t.mcp?.tool_name??``,onChange:e=>j(n,{mcp:{tool_name:e.target.value}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),t.type===`user_input`&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.userInputPrompt`)}),(0,C.jsx)(`input`,{type:`text`,value:t.user_input?.prompt??``,onChange:e=>j(n,{user_input:{prompt:e.target.value}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),t.type===`comment`&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.commentMinLength`)}),(0,C.jsx)(`input`,{type:`number`,min:1,value:t.comment?.min_length??10,onChange:e=>j(n,{comment:{min_length:Math.max(1,parseInt(e.target.value,10)||10)}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]})]})]})]},n)),(0,C.jsx)(`button`,{type:`button`,onClick:M,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocolEdit.addStep`)}),(0,C.jsx)(P,{label:e(`protocolEdit.completionLabel`),value:d.completionMarkdown,onChange:e=>A(`completionMarkdown`,e),contentKey:p}),E&&(0,C.jsx)(`p`,{className:`text-sm text-[var(--color-error)]`,role:`alert`,children:E}),w&&(0,C.jsx)(`div`,{className:`rounded-[var(--radius-md)] bg-[var(--color-error-bg)] p-4 text-[var(--color-error)]`,role:`alert`,children:w}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsx)(`button`,{type:`submit`,disabled:h,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] bg-[var(--color-primary)] px-4 py-2 font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:opacity-60`,children:e(h?`protocolEdit.saving`:`protocolEdit.save`)}),(0,C.jsx)(t,{to:c?`/`:`/protocols/${encodeURIComponent(s)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocolEdit.cancel`)})]})]}),(0,C.jsx)(`div`,{"aria-label":e(`protocolEdit.previewLabel`),children:(0,C.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,C.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.previewTitle`)}),(0,C.jsx)(`div`,{className:`mt-1 text-lg font-semibold text-[var(--color-text-heading)]`,children:z.title}),(0,C.jsxs)(`div`,{className:`mt-4`,children:[(0,C.jsx)(`div`,{className:`mb-2 text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.previewSteps`)}),z.steps.length===0?(0,C.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.previewNoSteps`)}):(0,C.jsx)(`ul`,{className:`m-0 list-none space-y-2 p-0`,children:z.steps.slice(0,20).map((e,t)=>(0,C.jsxs)(`li`,{className:`rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,C.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:e.label}),(0,C.jsx)(`div`,{className:`mt-1 text-sm text-[var(--color-text-muted)]`,children:e.summary})]},`${e.label}:${t}`))})]}),(0,C.jsxs)(`div`,{className:`mt-4`,children:[(0,C.jsx)(`div`,{className:`mb-2 text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.previewSections`)}),(0,C.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`strong`,{className:`text-[var(--color-text-heading)]`,children:[e(`protocol.triggers`),`:`]}),` `,z.triggers?e(`protocolEdit.present`):e(`protocolEdit.missing`)]}),(0,C.jsxs)(`div`,{className:`mt-1`,children:[(0,C.jsxs)(`strong`,{className:`text-[var(--color-text-heading)]`,children:[e(`protocol.completion`),`:`]}),` `,z.completion?e(`protocolEdit.present`):e(`protocolEdit.missing`)]})]})]})]})})]})})]})}export{R as ProtocolEditPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,d as n,f as r,t as i,y as a}from"./vendor-BxD5ItEO.js";import{i as o,t as s}from"./react-BdWJx0XL.js";import{a as c,c as l,i as u,l as d,n as f,o as p,r as m,s as h,t as g}from"./tiptap-BEg0BoNB.js";import{t as _}from"./api-D88c6lbH.js";import{i as v,n as y,r as b,t as x}from"./useProtocol-D_32bpf9.js";var S=e(o(),1),C=s(),w=`min-h-[11rem] px-4 py-3 text-sm leading-6 text-[var(--color-text)] focus:outline-none prose prose-sm max-w-none [&_table]:my-3 [&_table]:w-full [&_table]:border-collapse [&_th]:border [&_th]:border-[var(--color-border)] [&_th]:bg-[var(--color-surface-elevated)] [&_th]:px-2 [&_th]:py-1.5 [&_td]:border [&_td]:border-[var(--color-border)] [&_td]:px-2 [&_td]:py-1.5`;function T({children:e,className:t=`h-4 w-4`}){return(0,C.jsx)(`svg`,{"aria-hidden":`true`,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,children:e})}function E(){return(0,C.jsxs)(T,{children:[(0,C.jsx)(`circle`,{cx:`3`,cy:`4`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,C.jsx)(`circle`,{cx:`3`,cy:`8`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,C.jsx)(`circle`,{cx:`3`,cy:`12`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,C.jsx)(`path`,{d:`M6 4h7`}),(0,C.jsx)(`path`,{d:`M6 8h7`}),(0,C.jsx)(`path`,{d:`M6 12h7`})]})}function D(){return(0,C.jsxs)(T,{children:[(0,C.jsx)(`path`,{d:`M6 10L4.5 11.5a2.5 2.5 0 1 1-3.5-3.5L2.5 6.5`}),(0,C.jsx)(`path`,{d:`M10 6l1.5-1.5a2.5 2.5 0 1 1 3.5 3.5L13.5 9.5`}),(0,C.jsx)(`path`,{d:`M5.5 10.5l5-5`})]})}function O(){return(0,C.jsxs)(T,{children:[(0,C.jsx)(`path`,{d:`M5.5 5.5A2.5 2.5 0 0 0 3 8v2.5h3V8H4.5`}),(0,C.jsx)(`path`,{d:`M11.5 5.5A2.5 2.5 0 0 0 9 8v2.5h3V8h-1.5`})]})}function k(){return(0,C.jsxs)(T,{children:[(0,C.jsx)(`path`,{d:`M6 5.5l2 5-2 5`}),(0,C.jsx)(`path`,{d:`M10 5.5l2 5-2 5`})]})}function A(){return(0,C.jsxs)(T,{children:[(0,C.jsx)(`path`,{d:`M6 4L2.5 8L6 12`}),(0,C.jsx)(`path`,{d:`M10 4l3.5 4L10 12`}),(0,C.jsx)(`path`,{d:`M8.75 3.5L7.25 12.5`})]})}function j(){return(0,C.jsxs)(T,{children:[(0,C.jsx)(`path`,{d:`M2 3h12v2H2V3z`}),(0,C.jsx)(`path`,{d:`M2 7h12v1H2V7z`}),(0,C.jsx)(`path`,{d:`M2 11h12v1H2v-1z`}),(0,C.jsx)(`path`,{d:`M2 15h12v1H2v-1z`}),(0,C.jsx)(`path`,{d:`M2 4v11`}),(0,C.jsx)(`path`,{d:`M6 4v11`}),(0,C.jsx)(`path`,{d:`M10 4v11`}),(0,C.jsx)(`path`,{d:`M14 4v11`})]})}function M({label:e,ariaLabel:t,active:n,onClick:r}){return(0,C.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:r,className:`inline-flex min-h-[36px] min-w-[36px] items-center justify-center rounded-[var(--radius-sm)] border px-3 text-xs font-medium transition-colors ${n?`border-[var(--color-primary)] bg-[var(--color-primary)] text-white`:`border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text-muted)] hover:bg-[var(--color-surface)] hover:text-[var(--color-text)]`}`,children:e})}function N({editor:e}){return e?(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2 border-b border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-3 py-2`,children:[(0,C.jsx)(M,{label:(0,C.jsx)(`span`,{className:`text-base leading-none`,children:`¶`}),ariaLabel:`Paragraph`,active:e.isActive(`paragraph`),onClick:()=>e.chain().focus().setParagraph().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(`strong`,{className:`text-sm font-semibold`,children:`B`}),ariaLabel:`Bold`,active:e.isActive(`bold`),onClick:()=>e.chain().focus().toggleBold().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(`em`,{className:`text-sm`,children:`I`}),ariaLabel:`Italic`,active:e.isActive(`italic`),onClick:()=>e.chain().focus().toggleItalic().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(E,{}),ariaLabel:`Bullet list`,active:e.isActive(`bulletList`),onClick:()=>e.chain().focus().toggleBulletList().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(`span`,{className:`text-sm font-semibold`,children:`1.`}),ariaLabel:`Numbered list`,active:e.isActive(`orderedList`),onClick:()=>e.chain().focus().toggleOrderedList().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(D,{}),ariaLabel:`Link`,active:e.isActive(`link`),onClick:()=>{let t=e.getAttributes(`link`).href,n=window.prompt(`Enter URL`,t??`https://`);if(n==null)return;let r=n.trim();if(!r){e.chain().focus().unsetLink().run();return}e.chain().focus().extendMarkRange(`link`).setLink({href:r}).run()}}),(0,C.jsx)(M,{label:(0,C.jsx)(O,{}),ariaLabel:`Quote`,active:e.isActive(`blockquote`),onClick:()=>e.chain().focus().toggleBlockquote().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(k,{}),ariaLabel:`Inline code`,active:e.isActive(`code`),onClick:()=>e.chain().focus().toggleCode().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(A,{}),ariaLabel:`Code block`,active:e.isActive(`codeBlock`),onClick:()=>e.chain().focus().toggleCodeBlock().run()}),(0,C.jsx)(M,{label:(0,C.jsx)(j,{}),ariaLabel:`Insert table`,active:e.isActive(`table`),onClick:()=>e.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()})]}):null}function P({value:e,onChange:t,label:n,hint:r,id:i,contentKey:a}){let o=(0,S.useRef)(a),s=d({key:a??`default`,immediatelyRender:!1,extensions:[p.configure({heading:!1,link:!1}),h.configure({openOnClick:!1,autolink:!1}),g.configure({resizable:!1}),u,f,m,c],content:e,contentType:`markdown`,editorProps:{attributes:{class:w}},onUpdate:({editor:n})=>{let r=n.getMarkdown?.()??``;r!==e&&t(r)}});return(0,S.useEffect)(()=>{!s||a===o.current||(o.current=a,s.commands.setContent(e,!1,{contentType:`markdown`,preserveWhitespace:`full`}))},[a,e,s]),(0,C.jsxs)(`div`,{children:[n&&(0,C.jsx)(`label`,{htmlFor:i,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:n}),(0,C.jsxs)(`div`,{className:`overflow-hidden rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)]`,children:[(0,C.jsx)(N,{editor:s}),(0,C.jsx)(l,{editor:s})]}),r&&(0,C.jsx)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:r})]})}var F=i().min(1,`Protocol content is required`).refine(e=>e.includes(`# `),`Protocol must have an H1 title`).refine(e=>/(^|\n)##\s+Natural language triggers\b/i.test(e),`Include a "Natural language triggers" section (H2)`).refine(e=>/(^|\n)##\s+Completion rule\b/i.test(e),`Include a "Completion rule" section (H2)`),I={label:`Step`,bodyMarkdown:`What the user or agent does in this step.`,type:`comment`,comment:{min_length:10}},L=[`shell`,`mcp`,`user_input`,`comment`];function R(){let{t:e}=a(),{uri:i}=r(),o=n(),s=i?decodeURIComponent(i):void 0,c=!s,{data:l,isLoading:u}=v(s,!c),[d,f]=(0,S.useState)({protocolLabel:``,triggersMarkdown:``,steps:[{...I}],completionMarkdown:``}),[p,m]=(0,S.useState)(()=>String(Date.now())),[h,g]=(0,S.useState)(!1),[w,T]=(0,S.useState)(null),[E,D]=(0,S.useState)(null),O=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(l?.markdown_doc)try{f(b(l.markdown_doc)),m(String(Date.now()))}catch{f({protocolLabel:l.label||`Protocol`,triggersMarkdown:``,steps:[{...I}],completionMarkdown:``})}},[l]);let k=e=>{let t=e.target.files?.[0];if(!t)return;let n=new FileReader;n.onload=()=>{let e=typeof n.result==`string`?n.result:``;try{f(b(e)),m(String(Date.now())),D(null),T(null)}catch{T(`Could not parse the uploaded file. Use valid protocol markdown.`)}},n.readAsText(t,`UTF-8`),e.target.value=``},A=(e,t)=>{f(n=>({...n,[e]:t}))},j=(e,t)=>{f(n=>({...n,steps:n.steps.map((n,r)=>r===e?typeof t==`function`?t(n):{...n,...t}:n)}))},M=()=>{f(e=>({...e,steps:[...e.steps,{...I,label:`Step ${e.steps.length+1}`}]}))},N=e=>{f(t=>({...t,steps:t.steps.filter((t,n)=>n!==e)}))},R=async e=>{e.preventDefault(),T(null),D(null);let t=x(d),n=F.safeParse(t);if(!n.success){D(n.error.errors[0]?.message??`Invalid`);return}g(!0);try{if(c){let e=await _(`/api/kairos_mint/raw`,{method:`POST`,headers:{"Content-Type":`text/markdown`},body:t});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.message??e.statusText)}let n=(await e.json()).items?.[0]?.uri;o(n?`/protocols/${encodeURIComponent(n)}`:`/`)}else{let e=await _(`/api/kairos_update`,{method:`POST`,body:JSON.stringify({uris:[s],markdown_doc:[t]})});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.message??e.statusText)}o(`/protocols/${encodeURIComponent(s)}`)}}catch(e){T(e instanceof Error?e.message:String(e))}finally{g(!1)}},z=(()=>{try{return y(x(d))}catch{return{title:d.protocolLabel||`Protocol`,steps:[],triggers:``,completion:``}}})();if(!c&&u&&!l)return(0,C.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});let B={shell:e(`protocolEdit.challengeShell`),mcp:e(`protocolEdit.challengeMcp`),user_input:e(`protocolEdit.challengeUserInput`),comment:e(`protocolEdit.challengeComment`)};return(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h1`,{className:`mb-1 text-2xl font-semibold text-[var(--color-text-heading)]`,children:!c&&d.protocolLabel.trim()?d.protocolLabel.trim():e(c?`protocolEdit.newTitle`:`protocolEdit.editTitle`)}),(0,C.jsx)(`p`,{className:`mb-6 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.hint`)}),(0,C.jsxs)(`div`,{className:`mb-8 flex flex-wrap items-center justify-between gap-3 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:`Import existing content`}),(0,C.jsx)(`p`,{className:`mt-1 text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.uploadHint`)})]}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsx)(`input`,{ref:O,type:`file`,accept:`.md,text/markdown`,onChange:k,className:`sr-only`,id:`protocol-upload`,"aria-label":e(`protocolEdit.upload`)}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>O.current?.click(),className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocolEdit.upload`)}),!c&&s&&(0,C.jsx)(t,{to:`/protocols/${encodeURIComponent(s)}/skill`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocol.editAsSkill`)})]})]}),(0,C.jsx)(`form`,{onSubmit:R,"aria-label":e(`protocolEdit.formLabel`),children:(0,C.jsxs)(`div`,{className:`mb-6 grid gap-6 xl:grid-cols-[1.6fr_1fr]`,children:[(0,C.jsxs)(`div`,{className:`space-y-6`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{htmlFor:`protocol-label`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.protocolLabel`)}),(0,C.jsx)(`input`,{id:`protocol-label`,type:`text`,value:d.protocolLabel,onChange:e=>A(`protocolLabel`,e.target.value),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,C.jsx)(P,{label:e(`protocolEdit.triggersLabel`),hint:e(`protocolEdit.triggersHint`),value:d.triggersMarkdown,onChange:e=>A(`triggersMarkdown`,e),contentKey:p}),d.steps.map((t,n)=>(0,C.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-5 space-y-5`,children:[(0,C.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,C.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[`Step `,n+1,t.label.trim()?`: ${t.label.trim()}`:``]}),(0,C.jsx)(`button`,{type:`button`,onClick:()=>N(n),disabled:d.steps.length<=1,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:opacity-50`,children:e(`protocolEdit.removeStep`)})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.stepLabel`)}),(0,C.jsx)(`input`,{type:`text`,value:t.label,onChange:e=>j(n,{label:e.target.value}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`mb-2 font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.challengeType`)}),(0,C.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:L.map(e=>(0,C.jsx)(`button`,{type:`button`,"aria-pressed":t.type===e,onClick:()=>j(n,{type:e,shell:e===`shell`?{cmd:t.shell?.cmd??``}:void 0,mcp:e===`mcp`?{tool_name:t.mcp?.tool_name??``}:void 0,user_input:e===`user_input`?{prompt:t.user_input?.prompt??``}:void 0,comment:e===`comment`?{min_length:t.comment?.min_length??10}:void 0}),className:`min-h-[44px] rounded-[var(--radius-md)] px-4 text-sm font-medium ${t.type===e?`bg-[var(--color-primary)] text-white`:`border border-[var(--color-border)] bg-[var(--color-surface)] text-[var(--color-text)]`}`,children:B[e]},e))})]}),(0,C.jsx)(`div`,{children:(0,C.jsx)(P,{label:e(`protocolEdit.stepContent`),value:t.bodyMarkdown,onChange:e=>j(n,{bodyMarkdown:e}),contentKey:p})}),(0,C.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,C.jsx)(`div`,{className:`mb-3 text-sm font-medium text-[var(--color-text-heading)]`,children:`Challenge fields`}),(0,C.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2`,children:[t.type===`shell`&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.shellCmd`)}),(0,C.jsx)(`input`,{type:`text`,value:t.shell?.cmd??``,onChange:e=>j(n,{shell:{cmd:e.target.value}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),t.type===`mcp`&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.mcpToolName`)}),(0,C.jsx)(`input`,{type:`text`,value:t.mcp?.tool_name??``,onChange:e=>j(n,{mcp:{tool_name:e.target.value}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),t.type===`user_input`&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.userInputPrompt`)}),(0,C.jsx)(`input`,{type:`text`,value:t.user_input?.prompt??``,onChange:e=>j(n,{user_input:{prompt:e.target.value}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),t.type===`comment`&&(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.commentMinLength`)}),(0,C.jsx)(`input`,{type:`number`,min:1,value:t.comment?.min_length??10,onChange:e=>j(n,{comment:{min_length:Math.max(1,parseInt(e.target.value,10)||10)}}),className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]})]})]})]},n)),(0,C.jsx)(`button`,{type:`button`,onClick:M,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 text-sm font-medium text-[var(--color-text)] hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocolEdit.addStep`)}),(0,C.jsx)(P,{label:e(`protocolEdit.completionLabel`),value:d.completionMarkdown,onChange:e=>A(`completionMarkdown`,e),contentKey:p}),E&&(0,C.jsx)(`p`,{className:`text-sm text-[var(--color-error)]`,role:`alert`,children:E}),w&&(0,C.jsx)(`div`,{className:`rounded-[var(--radius-md)] bg-[var(--color-error-bg)] p-4 text-[var(--color-error)]`,role:`alert`,children:w}),(0,C.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,C.jsx)(`button`,{type:`submit`,disabled:h,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] bg-[var(--color-primary)] px-4 py-2 font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2 disabled:opacity-60`,children:e(h?`protocolEdit.saving`:`protocolEdit.save`)}),(0,C.jsx)(t,{to:c?`/`:`/protocols/${encodeURIComponent(s)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`protocolEdit.cancel`)})]})]}),(0,C.jsx)(`div`,{"aria-label":e(`protocolEdit.previewLabel`),children:(0,C.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,C.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.previewTitle`)}),(0,C.jsx)(`div`,{className:`mt-1 text-lg font-semibold text-[var(--color-text-heading)]`,children:z.title}),(0,C.jsxs)(`div`,{className:`mt-4`,children:[(0,C.jsx)(`div`,{className:`mb-2 text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.previewSteps`)}),z.steps.length===0?(0,C.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`protocolEdit.previewNoSteps`)}):(0,C.jsx)(`ul`,{className:`m-0 list-none space-y-2 p-0`,children:z.steps.slice(0,20).map((e,t)=>(0,C.jsxs)(`li`,{className:`rounded-[var(--radius-sm)] border border-[var(--color-border)] bg-[var(--color-surface)] p-3`,children:[(0,C.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:e.label}),(0,C.jsx)(`div`,{className:`mt-1 text-sm text-[var(--color-text-muted)]`,children:e.summary})]},`${e.label}:${t}`))})]}),(0,C.jsxs)(`div`,{className:`mt-4`,children:[(0,C.jsx)(`div`,{className:`mb-2 text-sm font-medium text-[var(--color-text-heading)]`,children:e(`protocolEdit.previewSections`)}),(0,C.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`strong`,{className:`text-[var(--color-text-heading)]`,children:[e(`protocol.triggers`),`:`]}),` `,z.triggers?e(`protocolEdit.present`):e(`protocolEdit.missing`)]}),(0,C.jsxs)(`div`,{className:`mt-1`,children:[(0,C.jsxs)(`strong`,{className:`text-[var(--color-text-heading)]`,children:[e(`protocol.completion`),`:`]}),` `,z.completion?e(`protocolEdit.present`):e(`protocolEdit.missing`)]})]})]})]})})]})})]})}export{R as ProtocolEditPage};
@@ -1 +1 @@
1
- import{n as e,r as t}from"./vendor-D3iZlvlL.js";import{t as n}from"./react-BdWJx0XL.js";var r=n(),i=`text-sm leading-6 text-[var(--color-text)] [&_p]:mt-0 [&_p:first-child]:mt-0 [&_p+p]:mt-3 [&_ul]:my-3 [&_ul]:pl-6 [&_ol]:my-3 [&_ol]:pl-6 [&_li]:my-0.5 [&_strong]:font-semibold [&_strong]:text-[var(--color-text-heading)] [&_code]:rounded [&_code]:bg-[var(--color-surface-elevated)] [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:text-xs [&_code]:font-mono [&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-[var(--radius-md)] [&_pre]:bg-[var(--color-surface-elevated)] [&_pre]:p-3 [&_pre]:text-sm [&_pre]:font-mono [&_pre]:whitespace-pre-wrap [&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_pre_code]:text-inherit [&_a]:text-[var(--color-primary)] [&_a]:underline [&_a:hover]:no-underline [&_a:focus-visible]:outline [&_a:focus-visible]:outline-2 [&_a:focus-visible]:outline-[var(--color-focus-ring)] [&_a:focus-visible]:outline-offset-2 [&_blockquote]:border-l-4 [&_blockquote]:border-[var(--color-border)] [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:text-[var(--color-text-muted)] [&_h1]:text-xl [&_h1]:font-semibold [&_h1]:text-[var(--color-text-heading)] [&_h1]:mt-4 [&_h1]:mb-2 [&_h2]:text-lg [&_h2]:font-semibold [&_h2]:text-[var(--color-text-heading)] [&_h2]:mt-4 [&_h2]:mb-2 [&_h3]:text-base [&_h3]:font-medium [&_h3]:text-[var(--color-text-heading)] [&_h3]:mt-3 [&_h3]:mb-1 [&_table]:my-4 [&_table]:w-full [&_table]:border-collapse [&_table]:text-left [&_th]:border [&_th]:border-[var(--color-border)] [&_th]:bg-[var(--color-surface-elevated)] [&_th]:px-3 [&_th]:py-2 [&_th]:font-semibold [&_th]:text-[var(--color-text-heading)] [&_td]:border [&_td]:border-[var(--color-border)] [&_td]:px-3 [&_td]:py-2 [&_tr]:border-b [&_tr]:border-[var(--color-border)] [&_tr:last-child]:border-b-0`;function a({content:n,className:a=``}){return n.trim()?(0,r.jsx)(`div`,{className:`${i} ${a}`.trim(),children:(0,r.jsx)(t,{remarkPlugins:[e],children:n})}):null}export{a as t};
1
+ import{n as e,r as t}from"./vendor-BxD5ItEO.js";import{t as n}from"./react-BdWJx0XL.js";var r=n(),i=`text-sm leading-6 text-[var(--color-text)] [&_p]:mt-0 [&_p:first-child]:mt-0 [&_p+p]:mt-3 [&_ul]:my-3 [&_ul]:pl-6 [&_ol]:my-3 [&_ol]:pl-6 [&_li]:my-0.5 [&_strong]:font-semibold [&_strong]:text-[var(--color-text-heading)] [&_code]:rounded [&_code]:bg-[var(--color-surface-elevated)] [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:text-xs [&_code]:font-mono [&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-[var(--radius-md)] [&_pre]:bg-[var(--color-surface-elevated)] [&_pre]:p-3 [&_pre]:text-sm [&_pre]:font-mono [&_pre]:whitespace-pre-wrap [&_pre_code]:bg-transparent [&_pre_code]:p-0 [&_pre_code]:text-inherit [&_a]:text-[var(--color-primary)] [&_a]:underline [&_a:hover]:no-underline [&_a:focus-visible]:outline [&_a:focus-visible]:outline-2 [&_a:focus-visible]:outline-[var(--color-focus-ring)] [&_a:focus-visible]:outline-offset-2 [&_blockquote]:border-l-4 [&_blockquote]:border-[var(--color-border)] [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:text-[var(--color-text-muted)] [&_h1]:text-xl [&_h1]:font-semibold [&_h1]:text-[var(--color-text-heading)] [&_h1]:mt-4 [&_h1]:mb-2 [&_h2]:text-lg [&_h2]:font-semibold [&_h2]:text-[var(--color-text-heading)] [&_h2]:mt-4 [&_h2]:mb-2 [&_h3]:text-base [&_h3]:font-medium [&_h3]:text-[var(--color-text-heading)] [&_h3]:mt-3 [&_h3]:mb-1 [&_table]:my-4 [&_table]:w-full [&_table]:border-collapse [&_table]:text-left [&_th]:border [&_th]:border-[var(--color-border)] [&_th]:bg-[var(--color-surface-elevated)] [&_th]:px-3 [&_th]:py-2 [&_th]:font-semibold [&_th]:text-[var(--color-text-heading)] [&_td]:border [&_td]:border-[var(--color-border)] [&_td]:px-3 [&_td]:py-2 [&_tr]:border-b [&_tr]:border-[var(--color-border)] [&_tr:last-child]:border-b-0`;function a({content:n,className:a=``}){return n.trim()?(0,r.jsx)(`div`,{className:`${i} ${a}`.trim(),children:(0,r.jsx)(t,{remarkPlugins:[e],children:n})}):null}export{a as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,f as n,h as r,p as i,y as a}from"./vendor-D3iZlvlL.js";import{i as o,t as s}from"./react-BdWJx0XL.js";import"./tiptap-jJ77DAJU.js";import{t as c}from"./api-D88c6lbH.js";import{t as l}from"./ErrorAlert-CsC_23Jf.js";import{t as u}from"./RenderedMarkdown-DqlM_8b-.js";import{n as d,t as f}from"./useRunSession-CciNdgs6.js";var p=e(o(),1),m=s();function h(e){let t=e.trim();return t?JSON.parse(t):null}function g({challenge:e,disabled:t,onSubmit:n}){let{t:r}=a(),i=e.type,[o,s]=(0,p.useState)(0),[c,l]=(0,p.useState)(``),[u,d]=(0,p.useState)(``),f=e.mcp?.tool_name??``,[g,_]=(0,p.useState)(!0),[v,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(``),S=e.user_input?.prompt??``,[C,w]=(0,p.useState)(``),T=e.comment?.min_length??10,[E,D]=(0,p.useState)(``),[O,k]=(0,p.useState)(null);(0,p.useEffect)(()=>{k(null),s(0),l(``),d(``),_(!0),y(``),x(``),w(``),D(``)},[i,f,S,T]);let A=(0,p.useMemo)(()=>i===`shell`?Number.isFinite(o):i===`mcp`?f.trim().length>0:i===`user_input`?C.trim().length>0:i===`comment`?E.trim().length>=T:!1,[i,o,f,C,E,T]);return(0,m.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),k(null),A)try{if(i===`shell`){n({type:i,shell:{exit_code:o,...c.trim()?{stdout:c}:{},...u.trim()?{stderr:u}:{}}});return}if(i===`mcp`){let e=h(v),t=h(b);n({type:i,mcp:{tool_name:f,...e===null?{}:{arguments:e},result:t,success:g}});return}if(i===`user_input`){n({type:i,user_input:{confirmation:C.trim(),timestamp:new Date().toISOString()}});return}if(i===`comment`){n({type:i,comment:{text:E.trim()}});return}}catch(e){k(e instanceof Error?e.message:String(e))}},"aria-label":r(`run.solutionFormLabel`),children:[O&&(0,m.jsx)(`div`,{className:`mb-4 p-4 rounded-[var(--radius-md)] bg-[var(--color-error-bg)] text-[var(--color-error)]`,role:`alert`,children:O}),i===`shell`&&(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-shell-exit-code`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.exitCode`)}),(0,m.jsx)(`input`,{id:`run-shell-exit-code`,type:`number`,inputMode:`numeric`,value:o,onChange:e=>s(Number(e.target.value)),className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,disabled:t,required:!0})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-shell-stdout`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.stdout`)}),(0,m.jsx)(`textarea`,{id:`run-shell-stdout`,value:c,onChange:e=>l(e.target.value),className:`w-full min-h-[8rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-shell-stderr`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.stderr`)}),(0,m.jsx)(`textarea`,{id:`run-shell-stderr`,value:u,onChange:e=>d(e.target.value),className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]})]}),i===`mcp`&&(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:r(`run.mcp.toolName`)}),(0,m.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)] break-all`,children:f||r(`run.mcp.toolMissing`)})]}),(0,m.jsxs)(`label`,{className:`inline-flex items-center gap-2 min-h-[44px]`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),disabled:t,className:`h-4 w-4`}),(0,m.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:r(`run.mcp.success`)})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-mcp-args`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.mcp.arguments`)}),(0,m.jsx)(`textarea`,{id:`run-mcp-args`,value:v,onChange:e=>y(e.target.value),placeholder:`{ "example": true }`,className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-mcp-result`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.mcp.result`)}),(0,m.jsx)(`textarea`,{id:`run-mcp-result`,value:b,onChange:e=>x(e.target.value),placeholder:`{ "ok": true }`,className:`w-full min-h-[10rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t,required:!0})]})]}),i===`user_input`&&(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:r(`run.userInput.prompt`)}),(0,m.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:S||r(`run.userInput.promptMissing`)})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-user-confirmation`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.userInput.confirmation`)}),(0,m.jsx)(`textarea`,{id:`run-user-confirmation`,value:C,onChange:e=>w(e.target.value),className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y`,disabled:t,required:!0})]})]}),i===`comment`&&(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[r(`run.comment.minLength`,{count:T}),` · `,r(`run.comment.count`,{count:E.length})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-comment-text`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.comment.text`)}),(0,m.jsx)(`textarea`,{id:`run-comment-text`,value:E,onChange:e=>D(e.target.value),className:`w-full min-h-[10rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y`,disabled:t,required:!0,"aria-invalid":E.trim().length>0&&E.trim().length<T})]})]}),(0,m.jsx)(`button`,{type:`submit`,disabled:t||!A,className:`mt-4 min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`run.submitStep`)})]})}function _({run:e,attestOutcome:t,setAttestOutcome:n,attestMessage:r,setAttestMessage:i,copyStatus:o,onCopy:s,onSubmitStep:c,onAttest:l,isNextPending:d,isBeginPending:f,isAttestPending:p}){let{t:h}=a();return(0,m.jsxs)(m.Fragment,{children:[e.status===`running`&&(0,m.jsx)(`div`,{className:`mb-4 flex items-center gap-2 text-sm text-[var(--color-text-muted)]`,role:`status`,"aria-live":`polite`,children:(0,m.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:h(`run.stepperProgress`,{completed:e.history.length})})}),e.last_message&&(0,m.jsxs)(`div`,{className:`mb-4 p-4 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)]`,role:`status`,"aria-live":`polite`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:h(`run.serverMessage`)}),(0,m.jsx)(`div`,{className:`text-[var(--color-text)]`,children:e.last_message})]}),(0,m.jsxs)(`section`,{"aria-labelledby":`run-current-step`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-current-step`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.currentStep`)}),(0,m.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:e.current_step?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mb-2`,children:[h(`run.stepUri`),`: `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.current_step.uri})]}),e.current_step.content?(0,m.jsx)(u,{content:e.current_step.content}):(0,m.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:h(`run.noStepContent`)})]}):(0,m.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:h(`run.noStepContent`)})})]}),(0,m.jsxs)(`section`,{"aria-labelledby":`run-challenge`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-challenge`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.challenge`)}),(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,m.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:h(`run.challengeType`)}),(0,m.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:e.challenge.type})]}),(0,m.jsxs)(`details`,{className:`text-sm`,children:[(0,m.jsx)(`summary`,{className:`cursor-pointer text-[var(--color-primary)]`,children:h(`run.advanced`)}),(0,m.jsxs)(`div`,{className:`mt-2 space-y-1 text-[var(--color-text-muted)]`,children:[e.challenge.nonce&&(0,m.jsxs)(`div`,{children:[h(`run.nonce`),`: `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.challenge.nonce})]}),e.challenge.proof_hash&&(0,m.jsxs)(`div`,{children:[h(`run.proofHash`),`: `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.challenge.proof_hash})]}),e.previous_proof_hash&&(0,m.jsxs)(`div`,{children:[h(`run.previousProofHash`),`: `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.previous_proof_hash})]})]})]})]}),e.challenge.description&&(0,m.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mt-3`,children:e.challenge.description}),e.challenge.type===`shell`&&e.challenge.shell?.cmd&&(0,m.jsxs)(`div`,{className:`mt-4 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:h(`run.shell.command`)}),(0,m.jsx)(`div`,{className:`font-mono text-sm text-[var(--color-text)] break-all`,children:e.challenge.shell.cmd})]}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>s(e.challenge.shell.cmd),className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-transparent flex-shrink-0 hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:h(`run.copy`)})]}),o&&(0,m.jsx)(`div`,{className:`text-xs text-[var(--color-text-muted)] mt-2`,children:o})]})]})]}),e.status!==`completed`&&e.status!==`ready_to_attest`&&(0,m.jsxs)(`section`,{"aria-labelledby":`run-solution`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-solution`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.solution`)}),(0,m.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,m.jsx)(g,{challenge:e.challenge,disabled:d||f,onSubmit:c})})]}),e.status===`ready_to_attest`&&(0,m.jsxs)(`section`,{"aria-labelledby":`run-attest`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-attest`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.attest.title`)}),(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)] mb-4`,children:h(`run.attest.subtitle`)}),(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-4 mb-4`,role:`radiogroup`,"aria-label":h(`run.attest.outcomeLabel`),children:[(0,m.jsxs)(`label`,{className:`inline-flex items-center gap-2 min-h-[44px]`,children:[(0,m.jsx)(`input`,{type:`radio`,name:`attest-outcome`,value:`success`,checked:t===`success`,onChange:()=>n(`success`)}),(0,m.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:h(`run.attest.success`)})]}),(0,m.jsxs)(`label`,{className:`inline-flex items-center gap-2 min-h-[44px]`,children:[(0,m.jsx)(`input`,{type:`radio`,name:`attest-outcome`,value:`failure`,checked:t===`failure`,onChange:()=>n(`failure`)}),(0,m.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:h(`run.attest.failure`)})]})]}),(0,m.jsxs)(`div`,{className:`mb-4`,children:[(0,m.jsx)(`label`,{htmlFor:`run-attest-message`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:h(`run.attest.message`)}),(0,m.jsx)(`textarea`,{id:`run-attest-message`,value:r,onChange:e=>i(e.target.value),className:`w-full min-h-[8rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,m.jsx)(`button`,{type:`button`,onClick:l,disabled:p,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:h(p?`run.attest.submitting`:`run.attest.submit`)})]})]}),e.history.length>0&&(0,m.jsxs)(`section`,{"aria-labelledby":`run-history`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-history`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.history`)}),(0,m.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,"aria-label":h(`run.historyLabel`),children:e.history.slice().reverse().map((e,t)=>(0,m.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,m.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[new Date(e.submitted_at).toLocaleString(),` · `,e.challenge.type,` ·`,` `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.step.uri})]}),e.server_message&&(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text)] mt-1`,children:e.server_message})]},`${e.step.uri}:${t}`))})]}),e.status===`completed`&&(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[#dcfce7] text-[#166534] p-4`,children:[(0,m.jsx)(`strong`,{className:`block`,children:h(`run.completed`)}),e.last_message&&(0,m.jsx)(`div`,{className:`text-sm mt-1`,children:e.last_message})]})]})}async function v(e){let t=await c(`/api/kairos_begin`,{method:`POST`,body:JSON.stringify({uri:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return t.json()}function y(){return r({mutationFn:e=>v(e)})}async function b(e){let t=await c(`/api/kairos_next`,{method:`POST`,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return t.json()}function x(){return r({mutationFn:e=>b(e)})}async function S(e){let t=await c(`/api/kairos_attest`,{method:`POST`,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return t.json()}function C(){return r({mutationFn:e=>S(e)})}function w(e){if(e)return e.match(/kairos:\/\/mem\/[0-9a-fA-F-]{36}/)?.[0]}function T(){return new Date().toISOString()}function E(){let{t:e}=a(),{uri:r}=n(),[o]=i(),s=r?decodeURIComponent(r):void 0,{session:c}=f(o.get(`session`)),{upsert:u}=d(),h=y(),g=x(),v=C(),[b,S]=(0,p.useState)(null),[E,D]=(0,p.useState)(`success`),[O,k]=(0,p.useState)(``),[A,j]=(0,p.useState)(null);(0,p.useEffect)(()=>{c&&!b&&(S(c),D(`success`),k(``))},[c,b]);let M=e=>{S(e),u(e)},N=async()=>{if(s)try{let e=await h.mutateAsync(s),t=T(),n=`${s}:${t}`,r=e.next_action?.includes(`kairos_attest`)?`ready_to_attest`:`running`,i=w(e.next_action);M({id:n,protocol_uri:s,started_at:t,updated_at:t,status:r,current_step:e.current_step??null,challenge:e.challenge,next_action:e.next_action,last_message:e.message,previous_proof_hash:e.proof_hash,attest_uri:r===`ready_to_attest`?i:void 0,history:[]})}catch{S(null)}};return s?(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:e(`run.title`)}),(0,m.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-4`,children:[e(`run.protocolUri`),`:`,` `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:s})]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-6`,children:[(0,m.jsx)(t,{to:`/protocols/${encodeURIComponent(s)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`run.backToProtocol`)}),!b&&(0,m.jsx)(`button`,{type:`button`,onClick:N,disabled:h.isPending,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:h.isPending?e(`run.starting`):e(`run.start`)})]}),(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4 mb-6`,children:[(0,m.jsx)(`strong`,{className:`block text-[var(--color-text-heading)] mb-1`,children:e(`run.safety.title`)}),(0,m.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`run.safety.copy`)})]}),h.isError&&(0,m.jsx)(l,{message:h.error instanceof Error?h.error.message:String(h.error),onRetry:()=>N(),showGoBack:!0}),b?.status===`error`&&b.last_message&&(0,m.jsx)(`div`,{className:`mb-6`,children:(0,m.jsx)(l,{message:b.last_message,onRetry:()=>N(),showGoBack:!0})}),b&&b.status!==`error`&&(0,m.jsx)(_,{run:b,attestOutcome:E,setAttestOutcome:D,attestMessage:O,setAttestMessage:k,copyStatus:A,onCopy:async t=>{j(null);try{await navigator.clipboard.writeText(t),j(e(`run.copied`)),setTimeout(()=>j(null),1500)}catch(e){j(e instanceof Error?e.message:String(e))}},onSubmitStep:async e=>{if(!b?.current_step)return;let t=b.challenge.nonce,n=b.previous_proof_hash??b.challenge.proof_hash,r={...e,...t?{nonce:t}:{},...n?{proof_hash:n}:{}};try{let e=await g.mutateAsync({uri:b.current_step.uri,solution:r}),t=T(),n=e.next_action?.includes(`kairos_attest`)||(e.message?.toLowerCase().includes(`call kairos_attest`)??!1),i=w(e.next_action)??b.attest_uri;M({...b,updated_at:t,status:n?`ready_to_attest`:`running`,current_step:e.current_step??null,challenge:e.challenge,next_action:e.next_action,last_message:e.message,previous_proof_hash:e.proof_hash??b.previous_proof_hash,attest_uri:n?i:void 0,history:[...b.history,{step:b.current_step,challenge:b.challenge,solution:r,submitted_at:t,proof_hash:e.proof_hash,server_message:e.message}]})}catch(e){M({...b,updated_at:T(),status:`error`,last_message:e instanceof Error?e.message:String(e)})}},onAttest:async()=>{if(!b)return;let t=b.attest_uri??b.current_step?.uri;if(t)try{let n=await v.mutateAsync({uri:t,outcome:E,message:O.trim()||e(`run.attest.defaultMessage`)});M({...b,updated_at:T(),status:`completed`,last_message:n.results[0]?.message??b.last_message})}catch(e){M({...b,updated_at:T(),status:`error`,last_message:e instanceof Error?e.message:String(e)})}},isNextPending:g.isPending,isBeginPending:h.isPending,isAttestPending:v.isPending})]}):(0,m.jsx)(l,{message:e(`run.missingUri`),showGoBack:!0})}export{E as RunGuidedPage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,f as n,h as r,p as i,y as a}from"./vendor-BxD5ItEO.js";import{i as o,t as s}from"./react-BdWJx0XL.js";import"./tiptap-BEg0BoNB.js";import{t as c}from"./api-D88c6lbH.js";import{t as l}from"./ErrorAlert-Bp_BC2t_.js";import{t as u}from"./RenderedMarkdown-Dd_bDNwz.js";import{n as d,t as f}from"./useRunSession-CciNdgs6.js";var p=e(o(),1),m=s();function h(e){let t=e.trim();return t?JSON.parse(t):null}function g({challenge:e,disabled:t,onSubmit:n}){let{t:r}=a(),i=e.type,[o,s]=(0,p.useState)(0),[c,l]=(0,p.useState)(``),[u,d]=(0,p.useState)(``),f=e.mcp?.tool_name??``,[g,_]=(0,p.useState)(!0),[v,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(``),S=e.user_input?.prompt??``,[C,w]=(0,p.useState)(``),T=e.comment?.min_length??10,[E,D]=(0,p.useState)(``),[O,k]=(0,p.useState)(null);(0,p.useEffect)(()=>{k(null),s(0),l(``),d(``),_(!0),y(``),x(``),w(``),D(``)},[i,f,S,T]);let A=(0,p.useMemo)(()=>i===`shell`?Number.isFinite(o):i===`mcp`?f.trim().length>0:i===`user_input`?C.trim().length>0:i===`comment`?E.trim().length>=T:!1,[i,o,f,C,E,T]);return(0,m.jsxs)(`form`,{onSubmit:e=>{if(e.preventDefault(),k(null),A)try{if(i===`shell`){n({type:i,shell:{exit_code:o,...c.trim()?{stdout:c}:{},...u.trim()?{stderr:u}:{}}});return}if(i===`mcp`){let e=h(v),t=h(b);n({type:i,mcp:{tool_name:f,...e===null?{}:{arguments:e},result:t,success:g}});return}if(i===`user_input`){n({type:i,user_input:{confirmation:C.trim(),timestamp:new Date().toISOString()}});return}if(i===`comment`){n({type:i,comment:{text:E.trim()}});return}}catch(e){k(e instanceof Error?e.message:String(e))}},"aria-label":r(`run.solutionFormLabel`),children:[O&&(0,m.jsx)(`div`,{className:`mb-4 p-4 rounded-[var(--radius-md)] bg-[var(--color-error-bg)] text-[var(--color-error)]`,role:`alert`,children:O}),i===`shell`&&(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-shell-exit-code`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.exitCode`)}),(0,m.jsx)(`input`,{id:`run-shell-exit-code`,type:`number`,inputMode:`numeric`,value:o,onChange:e=>s(Number(e.target.value)),className:`w-full min-h-[44px] px-4 py-2 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,disabled:t,required:!0})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-shell-stdout`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.stdout`)}),(0,m.jsx)(`textarea`,{id:`run-shell-stdout`,value:c,onChange:e=>l(e.target.value),className:`w-full min-h-[8rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-shell-stderr`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.shell.stderr`)}),(0,m.jsx)(`textarea`,{id:`run-shell-stderr`,value:u,onChange:e=>d(e.target.value),className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]})]}),i===`mcp`&&(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:r(`run.mcp.toolName`)}),(0,m.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)] break-all`,children:f||r(`run.mcp.toolMissing`)})]}),(0,m.jsxs)(`label`,{className:`inline-flex items-center gap-2 min-h-[44px]`,children:[(0,m.jsx)(`input`,{type:`checkbox`,checked:g,onChange:e=>_(e.target.checked),disabled:t,className:`h-4 w-4`}),(0,m.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:r(`run.mcp.success`)})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-mcp-args`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.mcp.arguments`)}),(0,m.jsx)(`textarea`,{id:`run-mcp-args`,value:v,onChange:e=>y(e.target.value),placeholder:`{ "example": true }`,className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-mcp-result`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.mcp.result`)}),(0,m.jsx)(`textarea`,{id:`run-mcp-result`,value:b,onChange:e=>x(e.target.value),placeholder:`{ "ok": true }`,className:`w-full min-h-[10rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] font-mono text-sm resize-y`,disabled:t,required:!0})]})]}),i===`user_input`&&(0,m.jsxs)(`div`,{className:`space-y-4`,children:[(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:r(`run.userInput.prompt`)}),(0,m.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:S||r(`run.userInput.promptMissing`)})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-user-confirmation`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.userInput.confirmation`)}),(0,m.jsx)(`textarea`,{id:`run-user-confirmation`,value:C,onChange:e=>w(e.target.value),className:`w-full min-h-[6rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y`,disabled:t,required:!0})]})]}),i===`comment`&&(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[r(`run.comment.minLength`,{count:T}),` · `,r(`run.comment.count`,{count:E.length})]}),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{htmlFor:`run-comment-text`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:r(`run.comment.text`)}),(0,m.jsx)(`textarea`,{id:`run-comment-text`,value:E,onChange:e=>D(e.target.value),className:`w-full min-h-[10rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y`,disabled:t,required:!0,"aria-invalid":E.trim().length>0&&E.trim().length<T})]})]}),(0,m.jsx)(`button`,{type:`submit`,disabled:t||!A,className:`mt-4 min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:r(`run.submitStep`)})]})}function _({run:e,attestOutcome:t,setAttestOutcome:n,attestMessage:r,setAttestMessage:i,copyStatus:o,onCopy:s,onSubmitStep:c,onAttest:l,isNextPending:d,isBeginPending:f,isAttestPending:p}){let{t:h}=a();return(0,m.jsxs)(m.Fragment,{children:[e.status===`running`&&(0,m.jsx)(`div`,{className:`mb-4 flex items-center gap-2 text-sm text-[var(--color-text-muted)]`,role:`status`,"aria-live":`polite`,children:(0,m.jsx)(`span`,{className:`font-medium text-[var(--color-text-heading)]`,children:h(`run.stepperProgress`,{completed:e.history.length})})}),e.last_message&&(0,m.jsxs)(`div`,{className:`mb-4 p-4 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)]`,role:`status`,"aria-live":`polite`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:h(`run.serverMessage`)}),(0,m.jsx)(`div`,{className:`text-[var(--color-text)]`,children:e.last_message})]}),(0,m.jsxs)(`section`,{"aria-labelledby":`run-current-step`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-current-step`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.currentStep`)}),(0,m.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:e.current_step?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mb-2`,children:[h(`run.stepUri`),`: `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.current_step.uri})]}),e.current_step.content?(0,m.jsx)(u,{content:e.current_step.content}):(0,m.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:h(`run.noStepContent`)})]}):(0,m.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] m-0`,children:h(`run.noStepContent`)})})]}),(0,m.jsxs)(`section`,{"aria-labelledby":`run-challenge`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-challenge`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.challenge`)}),(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,m.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:h(`run.challengeType`)}),(0,m.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)]`,children:e.challenge.type})]}),(0,m.jsxs)(`details`,{className:`text-sm`,children:[(0,m.jsx)(`summary`,{className:`cursor-pointer text-[var(--color-primary)]`,children:h(`run.advanced`)}),(0,m.jsxs)(`div`,{className:`mt-2 space-y-1 text-[var(--color-text-muted)]`,children:[e.challenge.nonce&&(0,m.jsxs)(`div`,{children:[h(`run.nonce`),`: `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.challenge.nonce})]}),e.challenge.proof_hash&&(0,m.jsxs)(`div`,{children:[h(`run.proofHash`),`: `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.challenge.proof_hash})]}),e.previous_proof_hash&&(0,m.jsxs)(`div`,{children:[h(`run.previousProofHash`),`: `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.previous_proof_hash})]})]})]})]}),e.challenge.description&&(0,m.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mt-3`,children:e.challenge.description}),e.challenge.type===`shell`&&e.challenge.shell?.cmd&&(0,m.jsxs)(`div`,{className:`mt-4 rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] p-4`,children:[(0,m.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,m.jsxs)(`div`,{className:`min-w-0`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:h(`run.shell.command`)}),(0,m.jsx)(`div`,{className:`font-mono text-sm text-[var(--color-text)] break-all`,children:e.challenge.shell.cmd})]}),(0,m.jsx)(`button`,{type:`button`,onClick:()=>s(e.challenge.shell.cmd),className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-transparent flex-shrink-0 hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:h(`run.copy`)})]}),o&&(0,m.jsx)(`div`,{className:`text-xs text-[var(--color-text-muted)] mt-2`,children:o})]})]})]}),e.status!==`completed`&&e.status!==`ready_to_attest`&&(0,m.jsxs)(`section`,{"aria-labelledby":`run-solution`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-solution`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.solution`)}),(0,m.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:(0,m.jsx)(g,{challenge:e.challenge,disabled:d||f,onSubmit:c})})]}),e.status===`ready_to_attest`&&(0,m.jsxs)(`section`,{"aria-labelledby":`run-attest`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-attest`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.attest.title`)}),(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)] mb-4`,children:h(`run.attest.subtitle`)}),(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-4 mb-4`,role:`radiogroup`,"aria-label":h(`run.attest.outcomeLabel`),children:[(0,m.jsxs)(`label`,{className:`inline-flex items-center gap-2 min-h-[44px]`,children:[(0,m.jsx)(`input`,{type:`radio`,name:`attest-outcome`,value:`success`,checked:t===`success`,onChange:()=>n(`success`)}),(0,m.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:h(`run.attest.success`)})]}),(0,m.jsxs)(`label`,{className:`inline-flex items-center gap-2 min-h-[44px]`,children:[(0,m.jsx)(`input`,{type:`radio`,name:`attest-outcome`,value:`failure`,checked:t===`failure`,onChange:()=>n(`failure`)}),(0,m.jsx)(`span`,{className:`text-sm text-[var(--color-text)]`,children:h(`run.attest.failure`)})]})]}),(0,m.jsxs)(`div`,{className:`mb-4`,children:[(0,m.jsx)(`label`,{htmlFor:`run-attest-message`,className:`block font-medium text-[var(--color-text-heading)] mb-2`,children:h(`run.attest.message`)}),(0,m.jsx)(`textarea`,{id:`run-attest-message`,value:r,onChange:e=>i(e.target.value),className:`w-full min-h-[8rem] px-4 py-3 border border-[var(--color-border)] rounded-[var(--radius-md)] text-[var(--color-text)] bg-[var(--color-surface)] resize-y focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,m.jsx)(`button`,{type:`button`,onClick:l,disabled:p,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:h(p?`run.attest.submitting`:`run.attest.submit`)})]})]}),e.history.length>0&&(0,m.jsxs)(`section`,{"aria-labelledby":`run-history`,className:`mb-6`,children:[(0,m.jsx)(`h2`,{id:`run-history`,className:`text-lg font-semibold text-[var(--color-text-heading)] mb-2`,children:h(`run.history`)}),(0,m.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,"aria-label":h(`run.historyLabel`),children:e.history.slice().reverse().map((e,t)=>(0,m.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,m.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)]`,children:[new Date(e.submitted_at).toLocaleString(),` · `,e.challenge.type,` ·`,` `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:e.step.uri})]}),e.server_message&&(0,m.jsx)(`div`,{className:`text-sm text-[var(--color-text)] mt-1`,children:e.server_message})]},`${e.step.uri}:${t}`))})]}),e.status===`completed`&&(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[#dcfce7] text-[#166534] p-4`,children:[(0,m.jsx)(`strong`,{className:`block`,children:h(`run.completed`)}),e.last_message&&(0,m.jsx)(`div`,{className:`text-sm mt-1`,children:e.last_message})]})]})}async function v(e){let t=await c(`/api/kairos_begin`,{method:`POST`,body:JSON.stringify({uri:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return t.json()}function y(){return r({mutationFn:e=>v(e)})}async function b(e){let t=await c(`/api/kairos_next`,{method:`POST`,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return t.json()}function x(){return r({mutationFn:e=>b(e)})}async function S(e){let t=await c(`/api/kairos_attest`,{method:`POST`,body:JSON.stringify(e)});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message??t.statusText)}return t.json()}function C(){return r({mutationFn:e=>S(e)})}function w(e){if(e)return e.match(/kairos:\/\/mem\/[0-9a-fA-F-]{36}/)?.[0]}function T(){return new Date().toISOString()}function E(){let{t:e}=a(),{uri:r}=n(),[o]=i(),s=r?decodeURIComponent(r):void 0,{session:c}=f(o.get(`session`)),{upsert:u}=d(),h=y(),g=x(),v=C(),[b,S]=(0,p.useState)(null),[E,D]=(0,p.useState)(`success`),[O,k]=(0,p.useState)(``),[A,j]=(0,p.useState)(null);(0,p.useEffect)(()=>{c&&!b&&(S(c),D(`success`),k(``))},[c,b]);let M=e=>{S(e),u(e)},N=async()=>{if(s)try{let e=await h.mutateAsync(s),t=T(),n=`${s}:${t}`,r=e.next_action?.includes(`kairos_attest`)?`ready_to_attest`:`running`,i=w(e.next_action);M({id:n,protocol_uri:s,started_at:t,updated_at:t,status:r,current_step:e.current_step??null,challenge:e.challenge,next_action:e.next_action,last_message:e.message,previous_proof_hash:e.proof_hash,attest_uri:r===`ready_to_attest`?i:void 0,history:[]})}catch{S(null)}};return s?(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:e(`run.title`)}),(0,m.jsxs)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-4`,children:[e(`run.protocolUri`),`:`,` `,(0,m.jsx)(`span`,{className:`font-mono break-all`,children:s})]}),(0,m.jsxs)(`div`,{className:`flex flex-wrap gap-2 mb-6`,children:[(0,m.jsx)(t,{to:`/protocols/${encodeURIComponent(s)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`run.backToProtocol`)}),!b&&(0,m.jsx)(`button`,{type:`button`,onClick:N,disabled:h.isPending,className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white border-0 cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:h.isPending?e(`run.starting`):e(`run.start`)})]}),(0,m.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4 mb-6`,children:[(0,m.jsx)(`strong`,{className:`block text-[var(--color-text-heading)] mb-1`,children:e(`run.safety.title`)}),(0,m.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)]`,children:e(`run.safety.copy`)})]}),h.isError&&(0,m.jsx)(l,{message:h.error instanceof Error?h.error.message:String(h.error),onRetry:()=>N(),showGoBack:!0}),b?.status===`error`&&b.last_message&&(0,m.jsx)(`div`,{className:`mb-6`,children:(0,m.jsx)(l,{message:b.last_message,onRetry:()=>N(),showGoBack:!0})}),b&&b.status!==`error`&&(0,m.jsx)(_,{run:b,attestOutcome:E,setAttestOutcome:D,attestMessage:O,setAttestMessage:k,copyStatus:A,onCopy:async t=>{j(null);try{await navigator.clipboard.writeText(t),j(e(`run.copied`)),setTimeout(()=>j(null),1500)}catch(e){j(e instanceof Error?e.message:String(e))}},onSubmitStep:async e=>{if(!b?.current_step)return;let t=b.challenge.nonce,n=b.previous_proof_hash??b.challenge.proof_hash,r={...e,...t?{nonce:t}:{},...n?{proof_hash:n}:{}};try{let e=await g.mutateAsync({uri:b.current_step.uri,solution:r}),t=T(),n=e.next_action?.includes(`kairos_attest`)||(e.message?.toLowerCase().includes(`call kairos_attest`)??!1),i=w(e.next_action)??b.attest_uri;M({...b,updated_at:t,status:n?`ready_to_attest`:`running`,current_step:e.current_step??null,challenge:e.challenge,next_action:e.next_action,last_message:e.message,previous_proof_hash:e.proof_hash??b.previous_proof_hash,attest_uri:n?i:void 0,history:[...b.history,{step:b.current_step,challenge:b.challenge,solution:r,submitted_at:t,proof_hash:e.proof_hash,server_message:e.message}]})}catch(e){M({...b,updated_at:T(),status:`error`,last_message:e instanceof Error?e.message:String(e)})}},onAttest:async()=>{if(!b)return;let t=b.attest_uri??b.current_step?.uri;if(t)try{let n=await v.mutateAsync({uri:t,outcome:E,message:O.trim()||e(`run.attest.defaultMessage`)});M({...b,updated_at:T(),status:`completed`,last_message:n.results[0]?.message??b.last_message})}catch(e){M({...b,updated_at:T(),status:`error`,last_message:e instanceof Error?e.message:String(e)})}},isNextPending:g.isPending,isBeginPending:h.isPending,isAttestPending:v.isPending})]}):(0,m.jsx)(l,{message:e(`run.missingUri`),showGoBack:!0})}export{E as RunGuidedPage};
@@ -1 +1 @@
1
- import{a as e,y as t}from"./vendor-D3iZlvlL.js";import{t as n}from"./react-BdWJx0XL.js";import"./tiptap-jJ77DAJU.js";import{n as r}from"./useRunSession-CciNdgs6.js";var i=n();function a(){let{t:n}=t(),{sessions:a,remove:o}=r();return(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:n(`runs.title`)}),(0,i.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-6`,children:n(`runs.subtitle`)}),a.length===0?(0,i.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,children:(0,i.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:n(`runs.empty`)})}):(0,i.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,"aria-label":n(`runs.listLabel`),children:a.map(t=>(0,i.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4 flex items-start justify-between gap-4`,children:[(0,i.jsxs)(`div`,{className:`min-w-0`,children:[(0,i.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)] truncate`,children:t.protocol_uri}),(0,i.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:[n(`runs.status`),`: `,t.status,` · `,n(`runs.updated`),`: `,new Date(t.updated_at).toLocaleString(),` · `,n(`runs.stepsDone`,{count:t.history.length})]}),t.last_message&&(0,i.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:t.last_message})]}),(0,i.jsxs)(`div`,{className:`flex flex-wrap gap-2 flex-shrink-0`,children:[(0,i.jsx)(e,{to:`/protocols/${encodeURIComponent(t.protocol_uri)}/run?session=${encodeURIComponent(t.id)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:n(`runs.resume`)}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>o(t.id),className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-transparent hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:n(`runs.remove`)})]})]},t.id))})]})}export{a as RunsPage};
1
+ import{a as e,y as t}from"./vendor-BxD5ItEO.js";import{t as n}from"./react-BdWJx0XL.js";import"./tiptap-BEg0BoNB.js";import{n as r}from"./useRunSession-CciNdgs6.js";var i=n();function a(){let{t:n}=t(),{sessions:a,remove:o}=r();return(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h1`,{className:`text-[var(--color-text-heading)] text-2xl font-semibold mb-1`,children:n(`runs.title`)}),(0,i.jsx)(`p`,{className:`text-sm text-[var(--color-text-muted)] mb-6`,children:n(`runs.subtitle`)}),a.length===0?(0,i.jsx)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-6`,children:(0,i.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:n(`runs.empty`)})}):(0,i.jsx)(`ul`,{className:`list-none p-0 m-0 space-y-2`,"aria-label":n(`runs.listLabel`),children:a.map(t=>(0,i.jsxs)(`li`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4 flex items-start justify-between gap-4`,children:[(0,i.jsxs)(`div`,{className:`min-w-0`,children:[(0,i.jsx)(`div`,{className:`font-medium text-[var(--color-text-heading)] truncate`,children:t.protocol_uri}),(0,i.jsxs)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:[n(`runs.status`),`: `,t.status,` · `,n(`runs.updated`),`: `,new Date(t.updated_at).toLocaleString(),` · `,n(`runs.stepsDone`,{count:t.history.length})]}),t.last_message&&(0,i.jsx)(`div`,{className:`text-sm text-[var(--color-text-muted)] mt-1`,children:t.last_message})]}),(0,i.jsxs)(`div`,{className:`flex flex-wrap gap-2 flex-shrink-0`,children:[(0,i.jsx)(e,{to:`/protocols/${encodeURIComponent(t.protocol_uri)}/run?session=${encodeURIComponent(t.id)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center px-4 py-2 rounded-[var(--radius-md)] font-medium bg-[var(--color-primary)] text-white no-underline hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:n(`runs.resume`)}),(0,i.jsx)(`button`,{type:`button`,onClick:()=>o(t.id),className:`min-h-[44px] min-w-[44px] px-4 py-2 rounded-[var(--radius-md)] font-medium border border-[var(--color-border)] text-[var(--color-text)] bg-transparent hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:n(`runs.remove`)})]})]},t.id))})]})}export{a as RunsPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,f as n,y as r}from"./vendor-D3iZlvlL.js";import{i,t as a}from"./react-BdWJx0XL.js";import"./tiptap-jJ77DAJU.js";import{i as o,n as s}from"./useProtocol-DLLnPZMe.js";var c=e(i(),1),l=a();function u(){let{t:e}=r(),{uri:i}=n(),{data:a,isLoading:u,isError:d,error:f}=o(i?decodeURIComponent(i):void 0,!0),[p,m]=(0,c.useState)(``),[h,g]=(0,c.useState)(``),[_,v]=(0,c.useState)(``),[y,b]=(0,c.useState)(!0);if(u&&!a)return(0,l.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});if(d||!a)return(0,l.jsxs)(`div`,{role:`alert`,className:`rounded-[var(--radius-md)] bg-[var(--color-error-bg)] p-4 text-[var(--color-error)]`,children:[f instanceof Error?f.message:e(`protocol.notFound`),(0,l.jsx)(t,{to:`/`,className:`mt-2 block text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`notFound.goHome`)})]});let{title:x}=s(a.markdown_doc),S=p.trim()||x,C=S.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`skill`;return(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h1`,{className:`mb-1 text-2xl font-semibold text-[var(--color-text-heading)]`,children:e(`skill.title`)}),(0,l.jsx)(`p`,{className:`mb-6 text-sm text-[var(--color-text-muted)]`,children:e(`skill.subtitle`)}),(0,l.jsxs)(`div`,{className:`mb-6 grid gap-4 xl:grid-cols-[1.3fr_1fr]`,children:[(0,l.jsxs)(`div`,{className:`space-y-4`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`skill-name`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`skill.skillName`)}),(0,l.jsx)(`input`,{id:`skill-name`,type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:x,className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`skill-desc`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`skill.description`)}),(0,l.jsx)(`textarea`,{id:`skill-desc`,value:h,onChange:e=>g(e.target.value),placeholder:x,rows:3,className:`w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`skill-when`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`skill.whenToUse`)}),(0,l.jsx)(`textarea`,{id:`skill-when`,value:_,onChange:e=>v(e.target.value),placeholder:`e.g. deploy and test, run tests before release`,rows:2,className:`w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`input`,{id:`skill-refs`,type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`h-4 w-4 rounded border-[var(--color-border)] text-[var(--color-primary)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)]`}),(0,l.jsx)(`label`,{htmlFor:`skill-refs`,className:`text-sm text-[var(--color-text)]`,children:e(`skill.includeReferences`)})]}),(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,l.jsx)(`button`,{type:`button`,onClick:()=>{let e=`# ${S}\n\n${h.trim()||x}\n\n## When to use it\n\n${_.trim()||`Use when this protocol applies.`}\n\n## Protocol\n\n${a.markdown_doc}`,t=new Blob([e],{type:`text/markdown;charset=utf-8`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${C}-skill.md`,r.click(),URL.revokeObjectURL(n)},className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] bg-[var(--color-primary)] px-4 py-2 font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`skill.downloadAsSkill`)}),(0,l.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`skill.backToProtocol`)})]})]}),(0,l.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,l.jsx)(`div`,{className:`text-sm font-medium text-[var(--color-text-heading)]`,children:`Bundle preview`}),(0,l.jsxs)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:[C,`-skill.md (and optionally references/) will be included in the download. Full ZIP packaging can be added later.`]})]})]})]})}export{u as SkillBundlePage};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{a as t,f as n,y as r}from"./vendor-BxD5ItEO.js";import{i,t as a}from"./react-BdWJx0XL.js";import"./tiptap-BEg0BoNB.js";import{i as o,n as s}from"./useProtocol-D_32bpf9.js";var c=e(i(),1),l=a();function u(){let{t:e}=r(),{uri:i}=n(),{data:a,isLoading:u,isError:d,error:f}=o(i?decodeURIComponent(i):void 0,!0),[p,m]=(0,c.useState)(``),[h,g]=(0,c.useState)(``),[_,v]=(0,c.useState)(``),[y,b]=(0,c.useState)(!0);if(u&&!a)return(0,l.jsx)(`p`,{className:`text-[var(--color-text-muted)]`,children:e(`protocol.loading`)});if(d||!a)return(0,l.jsxs)(`div`,{role:`alert`,className:`rounded-[var(--radius-md)] bg-[var(--color-error-bg)] p-4 text-[var(--color-error)]`,children:[f instanceof Error?f.message:e(`protocol.notFound`),(0,l.jsx)(t,{to:`/`,className:`mt-2 block text-[var(--color-primary)] underline hover:no-underline focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`notFound.goHome`)})]});let{title:x}=s(a.markdown_doc),S=p.trim()||x,C=S.replace(/[^a-zA-Z0-9]+/g,`-`).replace(/^-|-$/g,``)||`skill`;return(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h1`,{className:`mb-1 text-2xl font-semibold text-[var(--color-text-heading)]`,children:e(`skill.title`)}),(0,l.jsx)(`p`,{className:`mb-6 text-sm text-[var(--color-text-muted)]`,children:e(`skill.subtitle`)}),(0,l.jsxs)(`div`,{className:`mb-6 grid gap-4 xl:grid-cols-[1.3fr_1fr]`,children:[(0,l.jsxs)(`div`,{className:`space-y-4`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`skill-name`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`skill.skillName`)}),(0,l.jsx)(`input`,{id:`skill-name`,type:`text`,value:p,onChange:e=>m(e.target.value),placeholder:x,className:`min-h-[44px] w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`skill-desc`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`skill.description`)}),(0,l.jsx)(`textarea`,{id:`skill-desc`,value:h,onChange:e=>g(e.target.value),placeholder:x,rows:3,className:`w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{htmlFor:`skill-when`,className:`mb-2 block font-medium text-[var(--color-text-heading)]`,children:e(`skill.whenToUse`)}),(0,l.jsx)(`textarea`,{id:`skill-when`,value:_,onChange:e=>v(e.target.value),placeholder:`e.g. deploy and test, run tests before release`,rows:2,className:`w-full rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-3 text-sm text-[var(--color-text)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`})]}),(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`input`,{id:`skill-refs`,type:`checkbox`,checked:y,onChange:e=>b(e.target.checked),className:`h-4 w-4 rounded border-[var(--color-border)] text-[var(--color-primary)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)]`}),(0,l.jsx)(`label`,{htmlFor:`skill-refs`,className:`text-sm text-[var(--color-text)]`,children:e(`skill.includeReferences`)})]}),(0,l.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,l.jsx)(`button`,{type:`button`,onClick:()=>{let e=`# ${S}\n\n${h.trim()||x}\n\n## When to use it\n\n${_.trim()||`Use when this protocol applies.`}\n\n## Protocol\n\n${a.markdown_doc}`,t=new Blob([e],{type:`text/markdown;charset=utf-8`}),n=URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`${C}-skill.md`,r.click(),URL.revokeObjectURL(n)},className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] bg-[var(--color-primary)] px-4 py-2 font-medium text-white hover:bg-[var(--color-primary-hover)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`skill.downloadAsSkill`)}),(0,l.jsx)(t,{to:`/protocols/${encodeURIComponent(a.uri)}`,className:`min-h-[44px] min-w-[44px] inline-flex items-center justify-center rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface)] px-4 py-2 font-medium text-[var(--color-text)] no-underline hover:bg-[var(--color-surface-elevated)] focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] focus-visible:outline-offset-2`,children:e(`skill.backToProtocol`)})]})]}),(0,l.jsxs)(`div`,{className:`rounded-[var(--radius-md)] border border-[var(--color-border)] bg-[var(--color-surface-elevated)] p-4`,children:[(0,l.jsx)(`div`,{className:`text-sm font-medium text-[var(--color-text-heading)]`,children:`Bundle preview`}),(0,l.jsxs)(`p`,{className:`mt-2 text-sm text-[var(--color-text-muted)]`,children:[C,`-skill.md (and optionally references/) will be included in the download. Full ZIP packaging can be added later.`]})]})]})]})}export{u as SkillBundlePage};
@@ -1,8 +1,8 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-C9uFEU57.js","assets/vendor-D3iZlvlL.js","assets/rolldown-runtime-Dw2cE7zH.js","assets/tiptap-jJ77DAJU.js","assets/react-BdWJx0XL.js","assets/useSpaces-B_fSEZZd.js","assets/api-D88c6lbH.js","assets/KairosPage-CHWhntju.js","assets/ErrorAlert-CsC_23Jf.js","assets/RunsPage-Cext9vPR.js","assets/useRunSession-CciNdgs6.js","assets/ProtocolEditPage-CL5NbGFt.js","assets/useProtocol-DLLnPZMe.js","assets/RunGuidedPage-oWV9k9yz.js","assets/RenderedMarkdown-DqlM_8b-.js","assets/SkillBundlePage--Gk1KQkj.js","assets/ProtocolDetailPage-llVWn_BC.js","assets/AccountPage-CYiR4YZC.js","assets/NotFoundPage-DD7CJj29.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{_ as t,b as n,c as r,i,l as a,m as o,o as s,s as c,u as l,v as u,x as d,y as f}from"./vendor-D3iZlvlL.js";import{i as p,n as m,t as h}from"./react-BdWJx0XL.js";import"./tiptap-jJ77DAJU.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var g=`Skip to main content`,_={"nav.home":`Home`,"nav.kairos":`Browse`,"nav.create":`Create`,"nav.runs":`Test Run`,"nav.account":`Account`,skipToMain:g,"home.title":`Home`,"home.tagline":`Overview of your spaces and protocols.`,"home.searchLabel":`Search protocols`,"home.searchPlaceholder":`e.g. deploy and test`,"home.searchHint":`Enter a query to find protocols. Results open in the KAIROS tab.`,"home.statsLabel":`Space and protocol counts`,"home.stats.personalProtocols":`—`,"home.stats.personalProtocolsLabel":`Personal protocols`,"home.stats.kairosApp":`—`,"home.stats.kairosAppLabel":`Kairos app`,"home.stats.spaces":`—`,"home.stats.spacesLabel":`Spaces`,"home.stats.protocolCount":`{{count}} protocol`,"home.stats.protocolCount_plural":`{{count}} protocols`,"home.ctaPre":`Search and manage protocols in`,"home.ctaSuffix":`.`,"kairos.title":`Browse`,"kairos.searchLabel":`Search protocols`,"kairos.searchPlaceholder":`e.g. deploy and test`,"kairos.searchHint":`Search or browse by label. Enter a query to find protocols.`,"kairos.browseByLabel":`Browse by label`,"kairos.browseByLetterHint":`Click a letter to show protocols whose label starts with that letter.`,"kairos.letterCount":`Letter {{letter}}, {{count}} protocols`,"kairos.labelsStartingWith":`Labels starting with {{letter}}`,"kairos.noLabelsForLetter":`No protocols starting with this letter.`,"kairos.enterQueryHint":`Enter a query above to find protocols. Results appear below when you search.`,"kairos.search":`Search`,"kairos.loading":`Searching…`,"kairos.empty":`No protocols found`,"kairos.foundMatches":`Found {{count}} matches (top confidence: {{top}}%). View one, refine your search, or create a new protocol.`,"kairos.resultsLabel":`Search results`,"kairos.score":`Score`,"kairos.version":`Version`,"kairos.tagsLabel":`Tags`,"kairos.refineMeta":`Refine query`,"kairos.createMeta":`Start from scratch`,"kairos.view":`View`,"kairos.viewProtocol":`View {{title}}`,"kairos.refineSearch":`Refine search`,"kairos.createNew":`Create new`,"protocol.loading":`Loading protocol…`,"protocol.notFound":`Protocol not found`,"protocol.uri":`URI`,"protocol.readOnly":`Read-only`,"protocol.copyUri":`Copy URI`,"protocol.download":`Download`,"protocol.downloadAsMarkdown":`Download as Markdown`,"protocol.downloadAsSkill":`Download as Skill`,"protocol.editAsSkill":`Edit as Skill`,"protocol.expand":`Expand`,"protocol.collapse":`Collapse`,"protocol.edit":`Edit`,"protocol.duplicate":`Duplicate`,"protocol.runGuided":`Test Run`,"protocol.steps":`Steps`,"protocol.triggers":`Natural language triggers`,"protocol.completion":`Completion rule`,"protocol.howToUse":`How to use this protocol`,"protocol.howToUseInProduct":`Use Test Run from the button above to step through this protocol in the browser. For agents or CLI, use the documentation link below.`,"protocol.howToUseCopy":`Use in Cursor (MCP) or via CLI. See`,"protocol.docsLink":`documentation`,"runs.title":`Test Run`,"runs.subtitle":`Continue a test run you started earlier on this device.`,"runs.empty":`No runs yet.`,"runs.listLabel":`Test Run list`,"runs.status":`Status`,"runs.updated":`Updated`,"runs.stepsDone":`{{count}} steps completed`,"runs.resume":`Resume`,"runs.remove":`Remove`,"run.title":`Test Run`,"run.protocolUri":`Protocol URI`,"run.backToProtocol":`Back to protocol`,"run.start":`Start run`,"run.starting":`Starting…`,"run.safety.title":`Safe by default`,"run.safety.copy":`This guided run never executes shell commands in your browser. For shell challenges, run the command yourself and paste the real results.`,"run.serverMessage":`Server message`,"run.currentStep":`Current step`,"run.stepUri":`Step URI`,"run.noStepContent":`(No step content)`,"run.challenge":`Challenge`,"run.challengeType":`Type`,"run.advanced":`Advanced`,"run.nonce":`Nonce`,"run.proofHash":`Challenge proof_hash`,"run.previousProofHash":`Previous proof_hash`,"run.copy":`Copy`,"run.copied":`Copied`,"run.solution":`Solution`,"run.solutionFormLabel":`Submit solution`,"run.submitStep":`Submit step`,"run.shell.command":`Command`,"run.shell.exitCode":`Exit code`,"run.shell.stdout":`Stdout`,"run.shell.stderr":`Stderr`,"run.mcp.toolName":`Tool`,"run.mcp.toolMissing":`(Missing tool name)`,"run.mcp.success":`Success`,"run.mcp.arguments":`Arguments (JSON)`,"run.mcp.result":`Result (JSON)`,"run.userInput.prompt":`Prompt`,"run.userInput.promptMissing":`(Missing prompt)`,"run.userInput.confirmation":`User confirmation`,"run.comment.minLength":`Minimum {{count}} characters`,"run.comment.count":`{{count}} typed`,"run.comment.text":`Comment`,"run.attest.title":`Attest completion`,"run.attest.subtitle":`Finalize the run outcome for quality feedback.`,"run.attest.outcomeLabel":`Outcome`,"run.attest.success":`Success`,"run.attest.failure":`Failure`,"run.attest.message":`Message`,"run.attest.submit":`Submit attestation`,"run.attest.submitting":`Submitting…`,"run.attest.defaultMessage":`Completed guided run.`,"run.stepperProgress":`{{completed}} step(s) completed`,"run.history":`History`,"run.historyLabel":`Run history`,"run.completed":`Run completed`,"run.missingUri":`Missing protocol URI.`,"protocolEdit.newTitle":`New protocol`,"protocolEdit.editTitle":`Edit protocol`,"protocolEdit.hint":`Write as a human. The editor renders text and keeps the saved format compatible with generic Markdown.`,"protocolEdit.formLabel":`Protocol form`,"protocolEdit.protocolLabel":`Protocol label`,"protocolEdit.triggersLabel":`Natural language triggers`,"protocolEdit.triggersHint":`Describe when this protocol should run (e.g. deploy and test).`,"protocolEdit.stepLabel":`Step label`,"protocolEdit.stepContent":`Step content`,"protocolEdit.challengeType":`Challenge type`,"protocolEdit.addStep":`Add step`,"protocolEdit.removeStep":`Remove step`,"protocolEdit.completionLabel":`Completion rule`,"protocolEdit.challengeShell":`Shell command`,"protocolEdit.challengeMcp":`MCP tool call`,"protocolEdit.challengeUserInput":`User input`,"protocolEdit.challengeComment":`Comment`,"protocolEdit.shellCmd":`Command`,"protocolEdit.mcpToolName":`Tool name`,"protocolEdit.userInputPrompt":`Prompt`,"protocolEdit.commentMinLength":`Minimum length (characters)`,"protocolEdit.uploadHint":`Uploading a .md file fills this form. It does not publish until you save.`,"protocolEdit.contentLabel":`Protocol content (markdown)`,"protocolEdit.previewLabel":`Protocol preview`,"protocolEdit.previewTitle":`Live preview`,"protocolEdit.previewSteps":`Steps`,"protocolEdit.previewNoSteps":`No steps yet.`,"protocolEdit.previewSections":`Key sections`,"protocolEdit.present":`present`,"protocolEdit.missing":`missing`,"protocolEdit.insertTemplate":`Insert template`,"protocolEdit.upload":`Upload .md file`,"skill.title":`Edit as Skill`,"skill.subtitle":`Prepare a skill bundle for external AI tools. Customize metadata then download.`,"skill.skillName":`Skill name`,"skill.description":`Skill description`,"skill.whenToUse":`When to use it`,"skill.includeReferences":`Include references folder`,"skill.downloadAsSkill":`Download as Skill`,"skill.backToProtocol":`Back to protocol`,"protocolEdit.placeholder":`# Protocol title
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/HomePage-YaKMlhFN.js","assets/vendor-BxD5ItEO.js","assets/rolldown-runtime-Dw2cE7zH.js","assets/tiptap-BEg0BoNB.js","assets/react-BdWJx0XL.js","assets/useSpaces-DdE67BYD.js","assets/api-D88c6lbH.js","assets/KairosPage-DgO58pOn.js","assets/ErrorAlert-Bp_BC2t_.js","assets/RunsPage-BjSaeOq_.js","assets/useRunSession-CciNdgs6.js","assets/ProtocolEditPage-CCwQy6yl.js","assets/useProtocol-D_32bpf9.js","assets/RunGuidedPage-CcTlI5HF.js","assets/RenderedMarkdown-Dd_bDNwz.js","assets/SkillBundlePage-D2cJwwA1.js","assets/ProtocolDetailPage-D93cKbME.js","assets/AccountPage-xcULo_Ht.js","assets/NotFoundPage-BnEJbefZ.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{_ as t,b as n,c as r,i,l as a,m as o,o as s,s as c,u as l,v as u,x as d,y as f}from"./vendor-BxD5ItEO.js";import{i as p,n as m,t as h}from"./react-BdWJx0XL.js";import"./tiptap-BEg0BoNB.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var g=`Skip to main content`,_={"nav.home":`Home`,"nav.kairos":`Browse`,"nav.create":`Create`,"nav.runs":`Test Run`,"nav.account":`Account`,skipToMain:g,"home.title":`Home`,"home.tagline":`Overview of your spaces and protocols.`,"home.searchLabel":`Search protocols`,"home.searchPlaceholder":`e.g. deploy and test`,"home.searchHint":`Enter a query to find protocols. Results open in the KAIROS tab.`,"home.statsLabel":`Space and protocol counts`,"home.stats.personalProtocols":`—`,"home.stats.personalProtocolsLabel":`Personal protocols`,"home.stats.kairosApp":`—`,"home.stats.kairosAppLabel":`Kairos app`,"home.stats.spaces":`—`,"home.stats.spacesLabel":`Spaces`,"home.stats.protocolCount":`{{count}} protocol`,"home.stats.protocolCount_plural":`{{count}} protocols`,"home.ctaPre":`Search and manage protocols in`,"home.ctaSuffix":`.`,"kairos.title":`Browse`,"kairos.searchLabel":`Search protocols`,"kairos.searchPlaceholder":`e.g. deploy and test`,"kairos.searchHint":`Search or browse by label. Enter a query to find protocols.`,"kairos.browseByLabel":`Browse by label`,"kairos.browseByLetterHint":`Click a letter to show protocols whose label starts with that letter.`,"kairos.letterCount":`Letter {{letter}}, {{count}} protocols`,"kairos.labelsStartingWith":`Labels starting with {{letter}}`,"kairos.noLabelsForLetter":`No protocols starting with this letter.`,"kairos.enterQueryHint":`Enter a query above to find protocols. Results appear below when you search.`,"kairos.search":`Search`,"kairos.loading":`Searching…`,"kairos.empty":`No protocols found`,"kairos.foundMatches":`Found {{count}} matches (top confidence: {{top}}%). View one, refine your search, or create a new protocol.`,"kairos.resultsLabel":`Search results`,"kairos.score":`Score`,"kairos.version":`Version`,"kairos.tagsLabel":`Tags`,"kairos.refineMeta":`Refine query`,"kairos.createMeta":`Start from scratch`,"kairos.view":`View`,"kairos.viewProtocol":`View {{title}}`,"kairos.refineSearch":`Refine search`,"kairos.createNew":`Create new`,"protocol.loading":`Loading protocol…`,"protocol.notFound":`Protocol not found`,"protocol.uri":`URI`,"protocol.readOnly":`Read-only`,"protocol.copyUri":`Copy URI`,"protocol.download":`Download`,"protocol.downloadAsMarkdown":`Download as Markdown`,"protocol.downloadAsSkill":`Download as Skill`,"protocol.editAsSkill":`Edit as Skill`,"protocol.expand":`Expand`,"protocol.collapse":`Collapse`,"protocol.edit":`Edit`,"protocol.duplicate":`Duplicate`,"protocol.runGuided":`Test Run`,"protocol.steps":`Steps`,"protocol.triggers":`Natural language triggers`,"protocol.completion":`Completion rule`,"protocol.howToUse":`How to use this protocol`,"protocol.howToUseInProduct":`Use Test Run from the button above to step through this protocol in the browser. For agents or CLI, use the documentation link below.`,"protocol.howToUseCopy":`Use in Cursor (MCP) or via CLI. See`,"protocol.docsLink":`documentation`,"runs.title":`Test Run`,"runs.subtitle":`Continue a test run you started earlier on this device.`,"runs.empty":`No runs yet.`,"runs.listLabel":`Test Run list`,"runs.status":`Status`,"runs.updated":`Updated`,"runs.stepsDone":`{{count}} steps completed`,"runs.resume":`Resume`,"runs.remove":`Remove`,"run.title":`Test Run`,"run.protocolUri":`Protocol URI`,"run.backToProtocol":`Back to protocol`,"run.start":`Start run`,"run.starting":`Starting…`,"run.safety.title":`Safe by default`,"run.safety.copy":`This guided run never executes shell commands in your browser. For shell challenges, run the command yourself and paste the real results.`,"run.serverMessage":`Server message`,"run.currentStep":`Current step`,"run.stepUri":`Step URI`,"run.noStepContent":`(No step content)`,"run.challenge":`Challenge`,"run.challengeType":`Type`,"run.advanced":`Advanced`,"run.nonce":`Nonce`,"run.proofHash":`Challenge proof_hash`,"run.previousProofHash":`Previous proof_hash`,"run.copy":`Copy`,"run.copied":`Copied`,"run.solution":`Solution`,"run.solutionFormLabel":`Submit solution`,"run.submitStep":`Submit step`,"run.shell.command":`Command`,"run.shell.exitCode":`Exit code`,"run.shell.stdout":`Stdout`,"run.shell.stderr":`Stderr`,"run.mcp.toolName":`Tool`,"run.mcp.toolMissing":`(Missing tool name)`,"run.mcp.success":`Success`,"run.mcp.arguments":`Arguments (JSON)`,"run.mcp.result":`Result (JSON)`,"run.userInput.prompt":`Prompt`,"run.userInput.promptMissing":`(Missing prompt)`,"run.userInput.confirmation":`User confirmation`,"run.comment.minLength":`Minimum {{count}} characters`,"run.comment.count":`{{count}} typed`,"run.comment.text":`Comment`,"run.attest.title":`Attest completion`,"run.attest.subtitle":`Finalize the run outcome for quality feedback.`,"run.attest.outcomeLabel":`Outcome`,"run.attest.success":`Success`,"run.attest.failure":`Failure`,"run.attest.message":`Message`,"run.attest.submit":`Submit attestation`,"run.attest.submitting":`Submitting…`,"run.attest.defaultMessage":`Completed guided run.`,"run.stepperProgress":`{{completed}} step(s) completed`,"run.history":`History`,"run.historyLabel":`Run history`,"run.completed":`Run completed`,"run.missingUri":`Missing protocol URI.`,"protocolEdit.newTitle":`New protocol`,"protocolEdit.editTitle":`Edit protocol`,"protocolEdit.hint":`Write as a human. The editor renders text and keeps the saved format compatible with generic Markdown.`,"protocolEdit.formLabel":`Protocol form`,"protocolEdit.protocolLabel":`Protocol label`,"protocolEdit.triggersLabel":`Natural language triggers`,"protocolEdit.triggersHint":`Describe when this protocol should run (e.g. deploy and test).`,"protocolEdit.stepLabel":`Step label`,"protocolEdit.stepContent":`Step content`,"protocolEdit.challengeType":`Challenge type`,"protocolEdit.addStep":`Add step`,"protocolEdit.removeStep":`Remove step`,"protocolEdit.completionLabel":`Completion rule`,"protocolEdit.challengeShell":`Shell command`,"protocolEdit.challengeMcp":`MCP tool call`,"protocolEdit.challengeUserInput":`User input`,"protocolEdit.challengeComment":`Comment`,"protocolEdit.shellCmd":`Command`,"protocolEdit.mcpToolName":`Tool name`,"protocolEdit.userInputPrompt":`Prompt`,"protocolEdit.commentMinLength":`Minimum length (characters)`,"protocolEdit.uploadHint":`Uploading a .md file fills this form. It does not publish until you save.`,"protocolEdit.contentLabel":`Protocol content (markdown)`,"protocolEdit.previewLabel":`Protocol preview`,"protocolEdit.previewTitle":`Live preview`,"protocolEdit.previewSteps":`Steps`,"protocolEdit.previewNoSteps":`No steps yet.`,"protocolEdit.previewSections":`Key sections`,"protocolEdit.present":`present`,"protocolEdit.missing":`missing`,"protocolEdit.insertTemplate":`Insert template`,"protocolEdit.upload":`Upload .md file`,"skill.title":`Edit as Skill`,"skill.subtitle":`Prepare a skill bundle for external AI tools. Customize metadata then download.`,"skill.skillName":`Skill name`,"skill.description":`Skill description`,"skill.whenToUse":`When to use it`,"skill.includeReferences":`Include references folder`,"skill.downloadAsSkill":`Download as Skill`,"skill.backToProtocol":`Back to protocol`,"protocolEdit.placeholder":`# Protocol title
3
3
 
4
4
  ## Natural language triggers
5
5
  ...
6
6
 
7
7
  ## Step 1
8
- ...`,"protocolEdit.contentHint":`Include: Natural language triggers (first H2), steps (H2 + optional challenge block), Completion rule (last H2).`,"protocolEdit.save":`Save`,"protocolEdit.saving":`Saving…`,"protocolEdit.cancel":`Cancel`,"account.title":`Account`,"account.intro":`You are signed in. Sign out below or use the options to manage your profile.`,"account.loading":`Loading…`,"account.notSignedIn":`You are not signed in.`,"account.signIn":`Sign in`,"account.name":`Name`,"account.email":`Email`,"account.logOut":`Log out`,"notFound.title":`Page not found`,"notFound.message":`The page you requested could not be found.`,"notFound.goHome":`Go to Home`,"error.title":`Something went wrong`,"error.retry":`Retry`,"error.goBack":`Go to Home`,"error.support":`Support`};d.use(n).init({lng:`en`,fallbackLng:`en`,ns:[`translation`],defaultNS:`translation`,resources:{en:{translation:_}},interpolation:{escapeValue:!1}});var v=m(),y=e(p(),1),b=`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='512'%20height='512'%20viewBox='0%200%20512%20512'%3e%3ctitle%3eKAIROS%20Logo%2016%20-%20Deterministic%20Path%3c/title%3e%3cdefs%3e%3clinearGradient%20id='grad-a'%20x1='64'%20y1='64'%20x2='448'%20y2='448'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%237C3AED'/%3e%3cstop%20offset='0.5'%20stop-color='%2306B6D4'/%3e%3cstop%20offset='1'%20stop-color='%2322C55E'/%3e%3c/linearGradient%3e%3clinearGradient%20id='grad-b'%20x1='96'%20y1='416'%20x2='416'%20y2='96'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23F97316'/%3e%3cstop%20offset='1'%20stop-color='%23FACC15'/%3e%3c/linearGradient%3e%3c/defs%3e%3crect%20width='512'%20height='512'%20rx='112'%20fill='%2308111F'/%3e%3cpath%20d='M118%20336c48%200%2048-160%2096-160s48%20160%2096%20160s48-160%2096-160'%20fill='none'%20stroke='%23223454'%20stroke-width='24'%20stroke-linecap='round'/%3e%3cpath%20d='M118%20336c48%200%2048-160%2096-160s48%20160%2096%20160s48-160%2096-160'%20fill='none'%20stroke='url(%23grad-a)'%20stroke-width='12'%20stroke-linecap='round'/%3e%3cg%3e%3ccircle%20cx='118'%20cy='336'%20r='20'%20fill='%23F8FAFC'/%3e%3ccircle%20cx='214'%20cy='176'%20r='20'%20fill='%23F97316'/%3e%3ccircle%20cx='310'%20cy='336'%20r='20'%20fill='%2306B6D4'/%3e%3ccircle%20cx='406'%20cy='176'%20r='20'%20fill='%2322C55E'/%3e%3c/g%3e%3c/svg%3e`,x=h(),S=e=>e.startsWith(`/protocols`)||e.startsWith(`/runs`);function C(){let{t:e}=f(),t=l().pathname,n=({isActive:e})=>`min-h-[var(--layout-touch-target)] flex items-center px-4 py-3 text-[var(--color-text)] no-underline border-l-[3px] border-transparent outline-offset-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] hover:bg-[var(--color-surface)] hover:text-[var(--color-text-heading)] ${e?`font-semibold text-[var(--color-primary)] border-l-[var(--color-primary)] bg-[var(--color-surface)]`:``}`,r=S(t)?`min(100%, var(--layout-main-max), var(--layout-main-wide))`:`min(100%, var(--layout-main-max), var(--layout-main-narrow))`;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`a`,{href:`#main`,className:`skip-link`,children:e(`skipToMain`)}),(0,x.jsxs)(`div`,{className:`flex min-h-screen`,children:[(0,x.jsxs)(`aside`,{className:`w-[var(--layout-sidebar-width)] flex-shrink-0 border-r border-[var(--color-border)] bg-[var(--color-surface-elevated)] py-4`,"aria-label":`Main navigation`,children:[(0,x.jsx)(`div`,{className:`px-4 pb-4`,children:(0,x.jsxs)(s,{to:`/`,end:!0,className:`flex min-h-[var(--layout-touch-target)] min-w-[var(--layout-touch-target)] items-center gap-3 rounded-md outline-offset-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)]`,children:[(0,x.jsx)(`img`,{src:b,alt:``,className:`h-10 w-10 flex-shrink-0 rounded-lg object-contain`,width:`40`,height:`40`}),(0,x.jsxs)(`span`,{className:`flex flex-col leading-tight`,children:[(0,x.jsx)(`span`,{className:`font-bold text-[var(--color-text-heading)] text-lg`,children:`Kairos`}),(0,x.jsx)(`span`,{className:`font-bold text-[var(--color-text-muted)] text-xs uppercase tracking-wide`,children:`MCP`})]})]})}),(0,x.jsxs)(`nav`,{className:`flex flex-col gap-0.5`,children:[(0,x.jsx)(s,{to:`/`,end:!0,"aria-current":t===`/`?`page`:void 0,className:n,children:e(`nav.home`)}),(0,x.jsx)(s,{to:`/kairos`,"aria-current":t===`/kairos`?`page`:void 0,className:n,children:e(`nav.kairos`)}),(0,x.jsx)(s,{to:`/protocols/new`,"aria-current":t===`/protocols/new`?`page`:void 0,className:n,children:e(`nav.create`)}),(0,x.jsx)(s,{to:`/runs`,"aria-current":t===`/runs`?`page`:void 0,className:n,children:e(`nav.runs`)}),(0,x.jsx)(s,{to:`/account`,"aria-current":t===`/account`?`page`:void 0,className:n,children:e(`nav.account`)})]})]}),(0,x.jsx)(`main`,{id:`main`,className:`flex-1 mx-auto w-full py-[var(--layout-main-padding-y)] px-[var(--layout-main-padding-x)]`,style:{maxWidth:r},tabIndex:-1,children:(0,x.jsx)(c,{})})]})]})}var w=(0,y.lazy)(()=>o(()=>import(`./HomePage-C9uFEU57.js`).then(e=>({default:e.HomePage})),__vite__mapDeps([0,1,2,3,4,5,6]))),T=(0,y.lazy)(()=>o(()=>import(`./KairosPage-CHWhntju.js`).then(e=>({default:e.KairosPage})),__vite__mapDeps([7,2,1,3,4,8,5,6]))),E=(0,y.lazy)(()=>o(()=>import(`./RunsPage-Cext9vPR.js`).then(e=>({default:e.RunsPage})),__vite__mapDeps([9,1,2,3,4,10]))),D=(0,y.lazy)(()=>o(()=>import(`./ProtocolEditPage-CL5NbGFt.js`).then(e=>({default:e.ProtocolEditPage})),__vite__mapDeps([11,2,1,3,4,12,6]))),O=(0,y.lazy)(()=>o(()=>import(`./RunGuidedPage-oWV9k9yz.js`).then(e=>({default:e.RunGuidedPage})),__vite__mapDeps([13,2,1,3,4,8,14,10,6]))),k=(0,y.lazy)(()=>o(()=>import(`./SkillBundlePage--Gk1KQkj.js`).then(e=>({default:e.SkillBundlePage})),__vite__mapDeps([15,2,1,3,4,12,6]))),A=(0,y.lazy)(()=>o(()=>import(`./ProtocolDetailPage-llVWn_BC.js`).then(e=>({default:e.ProtocolDetailPage})),__vite__mapDeps([16,2,1,3,4,14,12,6]))),j=(0,y.lazy)(()=>o(()=>import(`./AccountPage-CYiR4YZC.js`).then(e=>({default:e.AccountPage})),__vite__mapDeps([17,1,2,3,4,6]))),M=(0,y.lazy)(()=>o(()=>import(`./NotFoundPage-DD7CJj29.js`).then(e=>({default:e.NotFoundPage})),__vite__mapDeps([18,1,2,3,4,8])));function N(){return(0,x.jsx)(`div`,{className:`flex min-h-[12rem] items-center justify-center text-[var(--color-text-muted)]`,"aria-busy":`true`,children:`Loading…`})}function P(){return(0,x.jsx)(a,{children:(0,x.jsxs)(r,{path:`/`,element:(0,x.jsx)(C,{}),children:[(0,x.jsx)(r,{index:!0,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(w,{})})}),(0,x.jsx)(r,{path:`kairos`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(T,{})})}),(0,x.jsx)(r,{path:`runs`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(E,{})})}),(0,x.jsx)(r,{path:`protocols/new`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(D,{})})}),(0,x.jsx)(r,{path:`protocols/:uri/edit`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(D,{})})}),(0,x.jsx)(r,{path:`protocols/:uri/run`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(O,{})})}),(0,x.jsx)(r,{path:`protocols/:uri/skill`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(k,{})})}),(0,x.jsx)(r,{path:`protocols/:uri`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(A,{})})}),(0,x.jsx)(r,{path:`account`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(j,{})})}),(0,x.jsx)(r,{path:`*`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(M,{})})})]})})}function F(){return(0,x.jsx)(i,{basename:`/ui`,children:(0,x.jsx)(P,{})})}var I=new u;(0,v.createRoot)(document.getElementById(`root`)).render((0,x.jsx)(y.StrictMode,{children:(0,x.jsx)(t,{client:I,children:(0,x.jsx)(F,{})})}));
8
+ ...`,"protocolEdit.contentHint":`Include: Natural language triggers (first H2), steps (H2 + optional challenge block), Completion rule (last H2).`,"protocolEdit.save":`Save`,"protocolEdit.saving":`Saving…`,"protocolEdit.cancel":`Cancel`,"account.title":`Account`,"account.intro":`You are signed in. Sign out below or use the options to manage your profile.`,"account.loading":`Loading…`,"account.notSignedIn":`You are not signed in.`,"account.signIn":`Sign in`,"account.name":`Name`,"account.email":`Email`,"account.logOut":`Log out`,"notFound.title":`Page not found`,"notFound.message":`The page you requested could not be found.`,"notFound.goHome":`Go to Home`,"error.title":`Something went wrong`,"error.retry":`Retry`,"error.goBack":`Go to Home`,"error.support":`Support`};d.use(n).init({lng:`en`,fallbackLng:`en`,ns:[`translation`],defaultNS:`translation`,resources:{en:{translation:_}},interpolation:{escapeValue:!1}});var v=m(),y=e(p(),1),b=`data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='512'%20height='512'%20viewBox='0%200%20512%20512'%3e%3ctitle%3eKAIROS%20Logo%2016%20-%20Deterministic%20Path%3c/title%3e%3cdefs%3e%3clinearGradient%20id='grad-a'%20x1='64'%20y1='64'%20x2='448'%20y2='448'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%237C3AED'/%3e%3cstop%20offset='0.5'%20stop-color='%2306B6D4'/%3e%3cstop%20offset='1'%20stop-color='%2322C55E'/%3e%3c/linearGradient%3e%3clinearGradient%20id='grad-b'%20x1='96'%20y1='416'%20x2='416'%20y2='96'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0'%20stop-color='%23F97316'/%3e%3cstop%20offset='1'%20stop-color='%23FACC15'/%3e%3c/linearGradient%3e%3c/defs%3e%3crect%20width='512'%20height='512'%20rx='112'%20fill='%2308111F'/%3e%3cpath%20d='M118%20336c48%200%2048-160%2096-160s48%20160%2096%20160s48-160%2096-160'%20fill='none'%20stroke='%23223454'%20stroke-width='24'%20stroke-linecap='round'/%3e%3cpath%20d='M118%20336c48%200%2048-160%2096-160s48%20160%2096%20160s48-160%2096-160'%20fill='none'%20stroke='url(%23grad-a)'%20stroke-width='12'%20stroke-linecap='round'/%3e%3cg%3e%3ccircle%20cx='118'%20cy='336'%20r='20'%20fill='%23F8FAFC'/%3e%3ccircle%20cx='214'%20cy='176'%20r='20'%20fill='%23F97316'/%3e%3ccircle%20cx='310'%20cy='336'%20r='20'%20fill='%2306B6D4'/%3e%3ccircle%20cx='406'%20cy='176'%20r='20'%20fill='%2322C55E'/%3e%3c/g%3e%3c/svg%3e`,x=h(),S=e=>e.startsWith(`/protocols`)||e.startsWith(`/runs`);function C(){let{t:e}=f(),t=l().pathname,n=({isActive:e})=>`min-h-[var(--layout-touch-target)] flex items-center px-4 py-3 text-[var(--color-text)] no-underline border-l-[3px] border-transparent outline-offset-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)] hover:bg-[var(--color-surface)] hover:text-[var(--color-text-heading)] ${e?`font-semibold text-[var(--color-primary)] border-l-[var(--color-primary)] bg-[var(--color-surface)]`:``}`,r=S(t)?`min(100%, var(--layout-main-max), var(--layout-main-wide))`:`min(100%, var(--layout-main-max), var(--layout-main-narrow))`;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`a`,{href:`#main`,className:`skip-link`,children:e(`skipToMain`)}),(0,x.jsxs)(`div`,{className:`flex min-h-screen`,children:[(0,x.jsxs)(`aside`,{className:`w-[var(--layout-sidebar-width)] flex-shrink-0 border-r border-[var(--color-border)] bg-[var(--color-surface-elevated)] py-4`,"aria-label":`Main navigation`,children:[(0,x.jsx)(`div`,{className:`px-4 pb-4`,children:(0,x.jsxs)(s,{to:`/`,end:!0,className:`flex min-h-[var(--layout-touch-target)] min-w-[var(--layout-touch-target)] items-center gap-3 rounded-md outline-offset-2 focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--color-focus-ring)]`,children:[(0,x.jsx)(`img`,{src:b,alt:``,className:`h-10 w-10 flex-shrink-0 rounded-lg object-contain`,width:`40`,height:`40`}),(0,x.jsxs)(`span`,{className:`flex flex-col leading-tight`,children:[(0,x.jsx)(`span`,{className:`font-bold text-[var(--color-text-heading)] text-lg`,children:`Kairos`}),(0,x.jsx)(`span`,{className:`font-bold text-[var(--color-text-muted)] text-xs uppercase tracking-wide`,children:`MCP`})]})]})}),(0,x.jsxs)(`nav`,{className:`flex flex-col gap-0.5`,children:[(0,x.jsx)(s,{to:`/`,end:!0,"aria-current":t===`/`?`page`:void 0,className:n,children:e(`nav.home`)}),(0,x.jsx)(s,{to:`/kairos`,"aria-current":t===`/kairos`?`page`:void 0,className:n,children:e(`nav.kairos`)}),(0,x.jsx)(s,{to:`/protocols/new`,"aria-current":t===`/protocols/new`?`page`:void 0,className:n,children:e(`nav.create`)}),(0,x.jsx)(s,{to:`/runs`,"aria-current":t===`/runs`?`page`:void 0,className:n,children:e(`nav.runs`)}),(0,x.jsx)(s,{to:`/account`,"aria-current":t===`/account`?`page`:void 0,className:n,children:e(`nav.account`)})]})]}),(0,x.jsx)(`main`,{id:`main`,className:`flex-1 mx-auto w-full py-[var(--layout-main-padding-y)] px-[var(--layout-main-padding-x)]`,style:{maxWidth:r},tabIndex:-1,children:(0,x.jsx)(c,{})})]})]})}var w=(0,y.lazy)(()=>o(()=>import(`./HomePage-YaKMlhFN.js`).then(e=>({default:e.HomePage})),__vite__mapDeps([0,1,2,3,4,5,6]))),T=(0,y.lazy)(()=>o(()=>import(`./KairosPage-DgO58pOn.js`).then(e=>({default:e.KairosPage})),__vite__mapDeps([7,2,1,3,4,8,5,6]))),E=(0,y.lazy)(()=>o(()=>import(`./RunsPage-BjSaeOq_.js`).then(e=>({default:e.RunsPage})),__vite__mapDeps([9,1,2,3,4,10]))),D=(0,y.lazy)(()=>o(()=>import(`./ProtocolEditPage-CCwQy6yl.js`).then(e=>({default:e.ProtocolEditPage})),__vite__mapDeps([11,2,1,3,4,12,6]))),O=(0,y.lazy)(()=>o(()=>import(`./RunGuidedPage-CcTlI5HF.js`).then(e=>({default:e.RunGuidedPage})),__vite__mapDeps([13,2,1,3,4,8,14,10,6]))),k=(0,y.lazy)(()=>o(()=>import(`./SkillBundlePage-D2cJwwA1.js`).then(e=>({default:e.SkillBundlePage})),__vite__mapDeps([15,2,1,3,4,12,6]))),A=(0,y.lazy)(()=>o(()=>import(`./ProtocolDetailPage-D93cKbME.js`).then(e=>({default:e.ProtocolDetailPage})),__vite__mapDeps([16,2,1,3,4,14,12,6]))),j=(0,y.lazy)(()=>o(()=>import(`./AccountPage-xcULo_Ht.js`).then(e=>({default:e.AccountPage})),__vite__mapDeps([17,1,2,3,4,6]))),M=(0,y.lazy)(()=>o(()=>import(`./NotFoundPage-BnEJbefZ.js`).then(e=>({default:e.NotFoundPage})),__vite__mapDeps([18,1,2,3,4,8])));function N(){return(0,x.jsx)(`div`,{className:`flex min-h-[12rem] items-center justify-center text-[var(--color-text-muted)]`,"aria-busy":`true`,children:`Loading…`})}function P(){return(0,x.jsx)(a,{children:(0,x.jsxs)(r,{path:`/`,element:(0,x.jsx)(C,{}),children:[(0,x.jsx)(r,{index:!0,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(w,{})})}),(0,x.jsx)(r,{path:`kairos`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(T,{})})}),(0,x.jsx)(r,{path:`runs`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(E,{})})}),(0,x.jsx)(r,{path:`protocols/new`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(D,{})})}),(0,x.jsx)(r,{path:`protocols/:uri/edit`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(D,{})})}),(0,x.jsx)(r,{path:`protocols/:uri/run`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(O,{})})}),(0,x.jsx)(r,{path:`protocols/:uri/skill`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(k,{})})}),(0,x.jsx)(r,{path:`protocols/:uri`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(A,{})})}),(0,x.jsx)(r,{path:`account`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(j,{})})}),(0,x.jsx)(r,{path:`*`,element:(0,x.jsx)(y.Suspense,{fallback:(0,x.jsx)(N,{}),children:(0,x.jsx)(M,{})})})]})})}function F(){return(0,x.jsx)(i,{basename:`/ui`,children:(0,x.jsx)(P,{})})}var I=new u;(0,v.createRoot)(document.getElementById(`root`)).render((0,x.jsx)(y.StrictMode,{children:(0,x.jsx)(t,{client:I,children:(0,x.jsx)(F,{})})}));