@kaitranntt/ccs 7.59.0 → 7.60.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ui/assets/{accounts-DnzveTIg.js → accounts-DMUoqqhT.js} +1 -1
- package/dist/ui/assets/{alert-dialog-CqQcipwF.js → alert-dialog-B_dqaWsT.js} +1 -1
- package/dist/ui/assets/api-CIyeonZ1.js +4 -0
- package/dist/ui/assets/{auth-section-CK7SfYKq.js → auth-section-D_TfW2-_.js} +1 -1
- package/dist/ui/assets/{backups-section-De3KlBrA.js → backups-section-Dgydey89.js} +1 -1
- package/dist/ui/assets/{channels-CRlRFwvd.js → channels-spHiV1Ue.js} +1 -1
- package/dist/ui/assets/{checkbox-W_mD9BCs.js → checkbox-jhdR_fIK.js} +1 -1
- package/dist/ui/assets/{claude-extension-DxjcZZL5.js → claude-extension-C8W6Yb3R.js} +1 -1
- package/dist/ui/assets/{cliproxy-CPwWnjT3.js → cliproxy-DS6LvM1n.js} +1 -1
- package/dist/ui/assets/{cliproxy-ai-providers-C8CUgJhH.js → cliproxy-ai-providers-VAxFHC4K.js} +1 -1
- package/dist/ui/assets/{cliproxy-control-panel-K9JxzDOV.js → cliproxy-control-panel-Bd80kVsY.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-C08GVQeW.js → confirm-dialog-BE-5hP8L.js} +1 -1
- package/dist/ui/assets/{copilot-C4XZF2YP.js → copilot-BTZxWOED.js} +1 -1
- package/dist/ui/assets/{cursor-DRrkMWnh.js → cursor-l2ZM09W9.js} +1 -1
- package/dist/ui/assets/{droid-j6d2smDi.js → droid-BWdAXhtv.js} +1 -1
- package/dist/ui/assets/{globalenv-section-BwEWsqjH.js → globalenv-section-C84bxTwY.js} +1 -1
- package/dist/ui/assets/{health-Bbklj-as.js → health-ow5fF7nc.js} +1 -1
- package/dist/ui/assets/{index-Cs3Ix-L0.js → index-BSRCIA1G.js} +1 -1
- package/dist/ui/assets/{index-DCep6C4H.js → index-CWIXuEF6.js} +1 -1
- package/dist/ui/assets/{index-DJnNc45j.js → index-DqflCpiA.js} +1 -1
- package/dist/ui/assets/index-iR1nbsvS.js +1 -0
- package/dist/ui/assets/{index-DGQBqqm7.js → index-lttPkZpv.js} +2 -2
- package/dist/ui/assets/masked-input-VQBwZqNw.js +1 -0
- package/dist/ui/assets/{proxy-status-widget-TwnYYu-T.js → proxy-status-widget-CoE2yaWW.js} +1 -1
- package/dist/ui/assets/{searchable-select-BBxZH26w.js → searchable-select-z_lKd8bq.js} +1 -1
- package/dist/ui/assets/{separator-B2f66ffq.js → separator-DL9wgY_Q.js} +1 -1
- package/dist/ui/assets/{shared-CJCcZUC1.js → shared-BtcUBeFK.js} +1 -1
- package/dist/ui/assets/{switch-DC_QYIUM.js → switch-hUEOHCrU.js} +1 -1
- package/dist/ui/assets/{updates-Bx19ENeN.js → updates-D2jZT4GP.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/dist/utils/websearch/index.d.ts +2 -0
- package/dist/utils/websearch/index.d.ts.map +1 -1
- package/dist/utils/websearch/index.js +4 -1
- package/dist/utils/websearch/index.js.map +1 -1
- package/dist/utils/websearch/provider-secrets.d.ts +18 -0
- package/dist/utils/websearch/provider-secrets.d.ts.map +1 -0
- package/dist/utils/websearch/provider-secrets.js +83 -0
- package/dist/utils/websearch/provider-secrets.js.map +1 -0
- package/dist/utils/websearch/status.d.ts.map +1 -1
- package/dist/utils/websearch/status.js +17 -15
- package/dist/utils/websearch/status.js.map +1 -1
- package/dist/web-server/routes/websearch-routes.d.ts.map +1 -1
- package/dist/web-server/routes/websearch-routes.js +51 -5
- package/dist/web-server/routes/websearch-routes.js.map +1 -1
- package/package.json +1 -1
- package/dist/ui/assets/api-DX4ScJUv.js +0 -4
- package/dist/ui/assets/index-BpfehVeJ.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as n}from"./radix-ui-Dt3edmE5.js";import{r as a}from"./react-vendor-CNOkPC89.js";import{e as P,f as Q,d as $,c as w,g as B,I as G,n as H}from"./index-
|
|
1
|
+
import{j as n}from"./radix-ui-Dt3edmE5.js";import{r as a}from"./react-vendor-CNOkPC89.js";import{e as P,f as Q,d as $,c as w,g as B,I as G,n as H}from"./index-lttPkZpv.js";import{aJ as J,al as L,l as V}from"./icons-EbXCUruD.js";function S(o){return o.trim().toLowerCase()}function M(o,h){return`${o}-option-${h.replace(/[^a-z0-9_-]+/gi,"-")}`}function ee({value:o,onChange:h,options:d,groups:g,placeholder:j,searchPlaceholder:k,emptyText:E,disabled:F,className:q,triggerClassName:K,contentClassName:R}){const[l,T]=a.useState(!1),[y,A]=a.useState(""),[i,u]=a.useState(),m=a.useId(),I=a.useRef(null),N=a.useRef({}),O=a.useMemo(()=>d.find(e=>e.value===o),[d,o]),f=a.useMemo(()=>{const e=S(y);return e?d.filter(t=>[t.searchText,...t.keywords??[]].some(c=>S(c).includes(e))):d},[d,y]),z=a.useMemo(()=>{const e=new Map((g??[]).map(r=>[r.key,r])),t=f.filter(r=>!r.groupKey||!e.has(r.groupKey)),c=(g??[]).map(r=>({...r,options:f.filter(x=>x.groupKey===r.key)})).filter(r=>r.options.length>0);return t.length===0?c:[{key:"__default",options:t},...c]},[f,g]),s=a.useMemo(()=>f.filter(e=>!e.disabled),[f]),D=O?.triggerContent??O?.itemContent,v=e=>{T(e),e||(A(""),u(void 0))},b=()=>I.current?.focus();a.useEffect(()=>{if(l){if(s.length===0){u(void 0);return}u(e=>e&&s.some(t=>t.value===e)?e:s.find(t=>t.value===o)?.value??s[0]?.value)}},[s,l,o]),a.useEffect(()=>{!l||!i||N.current[i]?.scrollIntoView({block:"nearest"})},[i,l]);const p=e=>{if(s.length===0)return;if(e==="first"){u(s[0]?.value);return}if(e==="last"){u(s.at(-1)?.value);return}const t=s.findIndex(_=>_.value===i),c=e==="next"?-1:s.length,r=t>=0?t:c,x=e==="next"?Math.min(r+1,s.length-1):Math.max(r-1,0);u(s[x]?.value)},C=e=>{h(e),v(!1)},U=()=>{if(!i)return;const e=s.find(t=>t.value===i);e&&C(e.value)};return n.jsxs(P,{open:l,onOpenChange:v,children:[n.jsx(Q,{asChild:!0,children:n.jsxs($,{type:"button",variant:"outline","aria-expanded":l,"aria-controls":l?m:void 0,"aria-haspopup":"dialog",disabled:F,onKeyDown:e=>{if(e.key!=="ArrowDown"&&e.key!=="ArrowUp")return;e.preventDefault(),v(!0);const t=()=>{b(),p(e.key==="ArrowDown"?"first":"last")};if(typeof requestAnimationFrame=="function"){requestAnimationFrame(t);return}setTimeout(t,0)},className:w("w-full justify-between font-normal",q,K,!D&&"text-muted-foreground"),children:[n.jsx("div",{className:"min-w-0 flex-1 text-left",children:D??n.jsx("span",{children:j})}),n.jsx(J,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),n.jsxs(B,{align:"start",className:w("w-[var(--radix-popover-trigger-width)] p-0",R),onOpenAutoFocus:e=>{if(e.preventDefault(),typeof requestAnimationFrame=="function"){requestAnimationFrame(b);return}setTimeout(b,0)},children:[n.jsx("div",{className:"border-b p-2",children:n.jsxs("div",{className:"relative",children:[n.jsx(L,{className:"text-muted-foreground absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2"}),n.jsx(G,{ref:I,value:y,onChange:e=>A(e.target.value),role:"combobox","aria-label":k,"aria-autocomplete":"list","aria-expanded":l,"aria-controls":m,"aria-activedescendant":i?M(m,i):void 0,onKeyDown:e=>{if(e.key==="ArrowDown"){e.preventDefault(),p("next");return}if(e.key==="ArrowUp"){e.preventDefault(),p("previous");return}if(e.key==="Home"){e.preventDefault(),p("first");return}if(e.key==="End"){e.preventDefault(),p("last");return}if(e.key==="Enter"){e.preventDefault(),U();return}e.key==="Escape"&&(e.preventDefault(),v(!1))},placeholder:k,className:"pl-8"})]})}),n.jsx(H,{className:"max-h-72",children:f.length===0?n.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:E}):n.jsx("div",{id:m,role:"listbox","aria-label":j,className:"p-1",children:z.map(e=>n.jsxs("div",{children:[e.label&&n.jsx("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground",children:e.label}),e.options.map(t=>{const c=t.value===i,r=t.value===o;return n.jsxs("button",{id:M(m,t.value),type:"button",role:"option","aria-selected":r,disabled:t.disabled,tabIndex:-1,ref:x=>{N.current[t.value]=x},onMouseMove:()=>{t.disabled||u(t.value)},onFocus:()=>{t.disabled||u(t.value)},onClick:()=>C(t.value),className:w("hover:bg-accent hover:text-accent-foreground flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm outline-none","focus-visible:ring-ring focus-visible:ring-1",c&&"bg-accent text-accent-foreground",r&&"bg-accent text-accent-foreground",t.disabled&&"pointer-events-none opacity-50"),children:[n.jsx("div",{className:"min-w-0 flex-1",children:t.itemContent}),r&&n.jsx(V,{className:"h-4 w-4 shrink-0"})]},t.value)})]},e.key))})})]})]})}export{ee as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i,_ as n}from"./radix-ui-Dt3edmE5.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-
|
|
1
|
+
import{j as i,_ as n}from"./radix-ui-Dt3edmE5.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-lttPkZpv.js";function m({className:t,orientation:a="horizontal",decorative:o=!0,...r}){return i.jsx(n,{"data-slot":"separator",decorative:o,orientation:a,className:e("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",t),...r})}export{m as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{a as Q,bh as ee,bi as se,bj as te,Q as ae,R as re,U as ne,B as $,ba as S,bb as M,bc as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-DGQBqqm7.js";import{$ as ce,a4 as oe,aW as me,T as E,R as T,F as he,al as ue,x as xe}from"./icons-EbXCUruD.js";import"./tanstack-B8i0evp-.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Se(){const{t:s}=Q(),[a,l]=j.useState("commands"),t={commands:s("sharedPage.commands"),skills:s("sharedPage.skills"),agents:s("sharedPage.agents")},[r,d]=j.useState(""),[n,o]=j.useState(null),{data:c,isError:h,error:p,refetch:w}=ee(),{data:m,isLoading:x,isFetching:y,isError:g,error:q,refetch:D}=se(a),N=m?.items??[],C=r.trim().toLowerCase(),b=r.trim(),u=j.useMemo(()=>{const i=m?.items??[];return C?i.filter(v=>[v.name,v.description,v.path].some(Y=>Y.toLowerCase().includes(C))):i},[m,C]),f=j.useMemo(()=>u.length===0?null:n?u.find(i=>i.path===n)??u[0]:u[0],[u,n]),{data:P,isLoading:O,isError:W,error:_,refetch:V}=te(a,f?.path??null),z=[{id:"commands",label:t.commands,icon:ce,count:c?.commands??0},{id:"skills",label:t.skills,icon:oe,count:c?.skills??0},{id:"agents",label:t.agents,icon:me,count:c?.agents??0}],H=z.reduce((i,v)=>i+v.count,0),K=!x&&!g&&N.length===0,Z=!x&&!g&&N.length>0&&u.length===0,G=A(p,"Shared item totals could not be loaded. Listing still works."),J=A(q,`Unable to fetch shared ${a}. Please try again.`),X=A(_,`Unable to load content for ${f?.name??"selected item"}.`);return e.jsxs("div",{className:"h-full overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 pb-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("sharedPage.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("sharedPage.subtitle")})]}),e.jsx(ae,{value:a,onValueChange:i=>{l(i),d(""),o(null)},children:e.jsx(re,{className:"h-auto flex-wrap justify-start",children:z.map(i=>e.jsxs(ne,{value:i.id,className:"flex items-center gap-2",children:[e.jsx(i.icon,{className:"w-4 h-4"}),e.jsx("span",{children:i.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",i.count,")"]})]},i.id))})})]}),e.jsxs("div",{className:"flex flex-col gap-2 lg:items-end",children:[e.jsxs("div",{className:"grid w-full gap-2 sm:w-auto sm:min-w-[340px] sm:grid-cols-3",children:[e.jsx(F,{label:s("sharedPage.totalShared"),value:H}),e.jsx(F,{label:t[a],value:N.length}),e.jsx(F,{label:s("sharedPage.visible"),value:u.length})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx($,{variant:"secondary",children:s("sharedPage.markdownDetail")}),b?e.jsxs($,{variant:"outline",children:[s("sharedPage.filterPrefix")," ",b]}):null]})]})]}),c&&!c.symlinkStatus.valid&&e.jsxs(S,{variant:"warning",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.configurationRequired")}),e.jsxs(L,{children:[c.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),h&&e.jsxs(S,{variant:"info",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.countsUnavailable")}),e.jsxs(L,{children:[e.jsx("p",{children:G}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{w()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryCounts")]})})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.jsx("div",{className:"h-full rounded-lg border overflow-hidden bg-background",children:e.jsxs("div",{className:"grid h-full min-h-0 lg:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"min-h-0 border-b lg:border-b-0 lg:border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(he,{className:"w-4 h-4 text-primary shrink-0"}),e.jsx("h2",{className:"font-semibold truncate",children:t[a]})]}),!x&&!g&&e.jsxs($,{variant:"outline",className:"text-[10px] h-5",children:[u.length,"/",N.length]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ue,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{value:r,onChange:i=>d(i.target.value),placeholder:s("sharedPage.filterPlaceholder",{tab:a}),"aria-label":s("sharedPage.filterPlaceholder",{tab:a}),className:"pl-8 h-9"})]}),!x&&!g&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sharedPage.showing",{visible:u.length,total:N.length,tab:a}),b?s("sharedPage.showingQuery",{query:b}):"",y?s("sharedPage.refreshing"):""]})]}),e.jsx(B,{className:"flex-1 min-h-0",children:x?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.loadingShared",{tab:a})}):g?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(xe,{className:"w-10 h-10 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("sharedPage.failedLoadShared",{tab:a})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:J})]}),e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{D()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retry")]})]})}):K?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noSharedFound",{tab:a})}):Z?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noMatch",{tab:a,query:b})}):e.jsx("div",{className:"p-2 space-y-1",children:u.map(i=>e.jsxs("button",{type:"button",onClick:()=>o(i.path),className:U("w-full text-left p-3 rounded-md border transition-colors",f?.path===i.path?"bg-primary/10 border-primary/30":"bg-background hover:bg-muted border-transparent"),children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:i.description}),e.jsx("p",{className:"text-[11px] text-muted-foreground/90 mt-2 font-mono truncate",children:i.path})]},`${i.type}:${i.path}`))})})]}),e.jsx("div",{className:"min-w-0 min-h-0 flex flex-col bg-muted/20",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-4 py-3 border-b bg-background",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-semibold truncate",children:f.name}),e.jsx($,{variant:"outline",className:"uppercase text-[10px]",children:f.type})]})}),e.jsxs("div",{className:"p-4 space-y-4 min-h-0 flex-1 flex flex-col",children:[e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(R,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(R,{label:s("sharedPage.resolvedSource"),value:P.contentPath,mono:!0})]})}),e.jsx(ie,{className:"min-h-0 flex-1",children:e.jsx(de,{className:"p-0 h-full",children:e.jsx(B,{className:"h-full px-5 py-4",children:O?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("sharedPage.loadingMarkdown")}):W?e.jsxs(S,{variant:"destructive",className:"max-w-2xl",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.failedLoadContent")}),e.jsxs(L,{children:[e.jsx("p",{children:X}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{V()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryContent")]})})]})]}):e.jsx(pe,{content:P?.content??""})})})})]})]}):e.jsx("div",{className:"min-h-[320px] flex items-center justify-center p-6 text-center text-muted-foreground",children:s("sharedPage.selectOne",{tab:a.slice(0,-1)})})})]})})})]})}function F({label:s,value:a}){return e.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:"text-lg font-semibold leading-tight mt-1",children:a})]})}function R({label:s,value:a,mono:l=!1}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:U("text-xs mt-1 break-words",l?"font-mono":"text-sm"),children:a})]})}function A(s,a){if(!(s instanceof Error))return a;const l=s.message.toLowerCase();return l.includes("failed to fetch")||l.includes("network")?"Connection to dashboard server lost or restarting. Keep `ccs config` running, then retry.":s.message||a}function pe({content:s}){const{t:a}=Q(),l=j.useMemo(()=>fe(s),[s]);return l.blocks.length===0&&l.frontmatter.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sharedPage.noMarkdown")}):e.jsxs("div",{className:"space-y-5",children:[l.frontmatter.length>0?e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:l.frontmatter.map(t=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:ge(t.key)}),e.jsx("p",{className:"text-xs mt-1 break-words",children:t.value})]},`${t.key}:${t.value}`))})}):null,l.blocks.map((t,r)=>{if(t.type==="heading"){const d=t.level<=1?"text-xl font-semibold":t.level===2?"text-lg font-semibold":"text-base font-semibold";return e.jsx("h3",{className:d,children:k(t.text,`heading-${r}`)},`heading-${r}`)}return t.type==="paragraph"?e.jsx("p",{className:"text-sm leading-6 whitespace-pre-wrap",children:k(t.text,`paragraph-${r}`)},`paragraph-${r}`):t.type==="unordered-list"?e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ul-item-${r}-${n}`)},`ul-item-${r}-${n}`))},`ul-${r}`):t.type==="ordered-list"?e.jsx("ol",{className:"list-decimal pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ol-item-${r}-${n}`)},`ol-item-${r}-${n}`))},`ol-${r}`):e.jsxs("div",{className:"rounded-md border bg-muted/60 p-3 font-mono text-xs leading-5 overflow-x-auto",children:[t.language&&e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-2",children:t.language}),e.jsx("pre",{className:"whitespace-pre-wrap break-words m-0",children:t.content})]},`code-${r}`)})]})}function ge(s){return s.replace(/[-_]/g," ")}function k(s,a){const l=/(\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*|\[([^\]]+)\]\(([^)]+)\))/g,t=[];let r=0,d=0;for(const n of s.matchAll(l)){const o=n[0],c=n.index??0;if(c>r&&t.push(s.slice(r,c)),n[2])t.push(e.jsx("strong",{className:"font-semibold",children:n[2]},`${a}-strong-${d}`));else if(n[3])t.push(e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.82em]",children:n[3]},`${a}-code-${d}`));else if(n[4])t.push(e.jsx("em",{className:"italic",children:n[4]},`${a}-em-${d}`));else if(n[5]&&n[6]){const h=n[6].trim();/^(https?:\/\/|mailto:)/i.test(h)?t.push(e.jsx("a",{href:h,target:"_blank",rel:"noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-90",children:n[5]},`${a}-link-${d}`)):t.push(n[5])}else t.push(o);r=c+o.length,d+=1}return r<s.length&&t.push(s.slice(r)),t.length===0?[s]:t}function fe(s){const a=s.replace(/\r\n/g,`
|
|
1
|
+
import{j as e}from"./radix-ui-Dt3edmE5.js";import{r as j}from"./react-vendor-CNOkPC89.js";import{a as Q,bh as ee,bi as se,bj as te,Q as ae,R as re,U as ne,B as $,ba as S,bb as M,bc as L,d as I,I as le,n as B,c as U,C as ie,b as de}from"./index-lttPkZpv.js";import{$ as ce,a4 as oe,aW as me,T as E,R as T,F as he,al as ue,x as xe}from"./icons-EbXCUruD.js";import"./tanstack-B8i0evp-.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";function Se(){const{t:s}=Q(),[a,l]=j.useState("commands"),t={commands:s("sharedPage.commands"),skills:s("sharedPage.skills"),agents:s("sharedPage.agents")},[r,d]=j.useState(""),[n,o]=j.useState(null),{data:c,isError:h,error:p,refetch:w}=ee(),{data:m,isLoading:x,isFetching:y,isError:g,error:q,refetch:D}=se(a),N=m?.items??[],C=r.trim().toLowerCase(),b=r.trim(),u=j.useMemo(()=>{const i=m?.items??[];return C?i.filter(v=>[v.name,v.description,v.path].some(Y=>Y.toLowerCase().includes(C))):i},[m,C]),f=j.useMemo(()=>u.length===0?null:n?u.find(i=>i.path===n)??u[0]:u[0],[u,n]),{data:P,isLoading:O,isError:W,error:_,refetch:V}=te(a,f?.path??null),z=[{id:"commands",label:t.commands,icon:ce,count:c?.commands??0},{id:"skills",label:t.skills,icon:oe,count:c?.skills??0},{id:"agents",label:t.agents,icon:me,count:c?.agents??0}],H=z.reduce((i,v)=>i+v.count,0),K=!x&&!g&&N.length===0,Z=!x&&!g&&N.length>0&&u.length===0,G=A(p,"Shared item totals could not be loaded. Listing still works."),J=A(q,`Unable to fetch shared ${a}. Please try again.`),X=A(_,`Unable to load content for ${f?.name??"selected item"}.`);return e.jsxs("div",{className:"h-full overflow-hidden flex flex-col",children:[e.jsxs("div",{className:"p-6 pb-4 space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-end lg:justify-between",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:s("sharedPage.title")}),e.jsx("p",{className:"text-muted-foreground",children:s("sharedPage.subtitle")})]}),e.jsx(ae,{value:a,onValueChange:i=>{l(i),d(""),o(null)},children:e.jsx(re,{className:"h-auto flex-wrap justify-start",children:z.map(i=>e.jsxs(ne,{value:i.id,className:"flex items-center gap-2",children:[e.jsx(i.icon,{className:"w-4 h-4"}),e.jsx("span",{children:i.label}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",i.count,")"]})]},i.id))})})]}),e.jsxs("div",{className:"flex flex-col gap-2 lg:items-end",children:[e.jsxs("div",{className:"grid w-full gap-2 sm:w-auto sm:min-w-[340px] sm:grid-cols-3",children:[e.jsx(F,{label:s("sharedPage.totalShared"),value:H}),e.jsx(F,{label:t[a],value:N.length}),e.jsx(F,{label:s("sharedPage.visible"),value:u.length})]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsx($,{variant:"secondary",children:s("sharedPage.markdownDetail")}),b?e.jsxs($,{variant:"outline",children:[s("sharedPage.filterPrefix")," ",b]}):null]})]})]}),c&&!c.symlinkStatus.valid&&e.jsxs(S,{variant:"warning",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.configurationRequired")}),e.jsxs(L,{children:[c.symlinkStatus.message,". Run `ccs sync` to configure."]})]}),h&&e.jsxs(S,{variant:"info",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.countsUnavailable")}),e.jsxs(L,{children:[e.jsx("p",{children:G}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{w()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryCounts")]})})]})]})]}),e.jsx("div",{className:"flex-1 min-h-0 px-6 pb-6",children:e.jsx("div",{className:"h-full rounded-lg border overflow-hidden bg-background",children:e.jsxs("div",{className:"grid h-full min-h-0 lg:grid-cols-[320px_minmax(0,1fr)]",children:[e.jsxs("div",{className:"min-h-0 border-b lg:border-b-0 lg:border-r flex flex-col bg-muted/30",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx(he,{className:"w-4 h-4 text-primary shrink-0"}),e.jsx("h2",{className:"font-semibold truncate",children:t[a]})]}),!x&&!g&&e.jsxs($,{variant:"outline",className:"text-[10px] h-5",children:[u.length,"/",N.length]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(ue,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(le,{value:r,onChange:i=>d(i.target.value),placeholder:s("sharedPage.filterPlaceholder",{tab:a}),"aria-label":s("sharedPage.filterPlaceholder",{tab:a}),className:"pl-8 h-9"})]}),!x&&!g&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[s("sharedPage.showing",{visible:u.length,total:N.length,tab:a}),b?s("sharedPage.showingQuery",{query:b}):"",y?s("sharedPage.refreshing"):""]})]}),e.jsx(B,{className:"flex-1 min-h-0",children:x?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.loadingShared",{tab:a})}):g?e.jsx("div",{className:"p-4 text-center",children:e.jsxs("div",{className:"space-y-3 py-8",children:[e.jsx(xe,{className:"w-10 h-10 mx-auto text-destructive/50"}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:s("sharedPage.failedLoadShared",{tab:a})}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:J})]}),e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{D()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retry")]})]})}):K?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noSharedFound",{tab:a})}):Z?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:s("sharedPage.noMatch",{tab:a,query:b})}):e.jsx("div",{className:"p-2 space-y-1",children:u.map(i=>e.jsxs("button",{type:"button",onClick:()=>o(i.path),className:U("w-full text-left p-3 rounded-md border transition-colors",f?.path===i.path?"bg-primary/10 border-primary/30":"bg-background hover:bg-muted border-transparent"),children:[e.jsx("p",{className:"text-sm font-medium truncate",children:i.name}),e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:i.description}),e.jsx("p",{className:"text-[11px] text-muted-foreground/90 mt-2 font-mono truncate",children:i.path})]},`${i.type}:${i.path}`))})})]}),e.jsx("div",{className:"min-w-0 min-h-0 flex flex-col bg-muted/20",children:f?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-4 py-3 border-b bg-background",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-base font-semibold truncate",children:f.name}),e.jsx($,{variant:"outline",className:"uppercase text-[10px]",children:f.type})]})}),e.jsxs("div",{className:"p-4 space-y-4 min-h-0 flex-1 flex flex-col",children:[e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(R,{label:s("sharedPage.pathLabel"),value:f.path,mono:!0}),P?.contentPath&&P.contentPath!==f.path&&e.jsx(R,{label:s("sharedPage.resolvedSource"),value:P.contentPath,mono:!0})]})}),e.jsx(ie,{className:"min-h-0 flex-1",children:e.jsx(de,{className:"p-0 h-full",children:e.jsx(B,{className:"h-full px-5 py-4",children:O?e.jsx("p",{className:"text-sm text-muted-foreground",children:s("sharedPage.loadingMarkdown")}):W?e.jsxs(S,{variant:"destructive",className:"max-w-2xl",children:[e.jsx(E,{className:"h-4 w-4"}),e.jsx(M,{children:s("sharedPage.failedLoadContent")}),e.jsxs(L,{children:[e.jsx("p",{children:X}),e.jsx("div",{className:"mt-3",children:e.jsxs(I,{size:"sm",variant:"outline",onClick:()=>{V()},children:[e.jsx(T,{className:"w-4 h-4 mr-2"}),s("sharedPage.retryContent")]})})]})]}):e.jsx(pe,{content:P?.content??""})})})})]})]}):e.jsx("div",{className:"min-h-[320px] flex items-center justify-center p-6 text-center text-muted-foreground",children:s("sharedPage.selectOne",{tab:a.slice(0,-1)})})})]})})})]})}function F({label:s,value:a}){return e.jsxs("div",{className:"rounded-md border bg-muted/30 px-3 py-2",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:"text-lg font-semibold leading-tight mt-1",children:a})]})}function R({label:s,value:a,mono:l=!1}){return e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:s}),e.jsx("p",{className:U("text-xs mt-1 break-words",l?"font-mono":"text-sm"),children:a})]})}function A(s,a){if(!(s instanceof Error))return a;const l=s.message.toLowerCase();return l.includes("failed to fetch")||l.includes("network")?"Connection to dashboard server lost or restarting. Keep `ccs config` running, then retry.":s.message||a}function pe({content:s}){const{t:a}=Q(),l=j.useMemo(()=>fe(s),[s]);return l.blocks.length===0&&l.frontmatter.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:a("sharedPage.noMarkdown")}):e.jsxs("div",{className:"space-y-5",children:[l.frontmatter.length>0?e.jsx("div",{className:"rounded-md border bg-muted/35 p-3",children:e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 xl:grid-cols-3",children:l.frontmatter.map(t=>e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:ge(t.key)}),e.jsx("p",{className:"text-xs mt-1 break-words",children:t.value})]},`${t.key}:${t.value}`))})}):null,l.blocks.map((t,r)=>{if(t.type==="heading"){const d=t.level<=1?"text-xl font-semibold":t.level===2?"text-lg font-semibold":"text-base font-semibold";return e.jsx("h3",{className:d,children:k(t.text,`heading-${r}`)},`heading-${r}`)}return t.type==="paragraph"?e.jsx("p",{className:"text-sm leading-6 whitespace-pre-wrap",children:k(t.text,`paragraph-${r}`)},`paragraph-${r}`):t.type==="unordered-list"?e.jsx("ul",{className:"list-disc pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ul-item-${r}-${n}`)},`ul-item-${r}-${n}`))},`ul-${r}`):t.type==="ordered-list"?e.jsx("ol",{className:"list-decimal pl-5 space-y-1 text-sm leading-6",children:t.items.map((d,n)=>e.jsx("li",{children:k(d,`ol-item-${r}-${n}`)},`ol-item-${r}-${n}`))},`ol-${r}`):e.jsxs("div",{className:"rounded-md border bg-muted/60 p-3 font-mono text-xs leading-5 overflow-x-auto",children:[t.language&&e.jsx("div",{className:"text-[10px] uppercase tracking-wide text-muted-foreground mb-2",children:t.language}),e.jsx("pre",{className:"whitespace-pre-wrap break-words m-0",children:t.content})]},`code-${r}`)})]})}function ge(s){return s.replace(/[-_]/g," ")}function k(s,a){const l=/(\*\*([^*]+)\*\*|`([^`]+)`|\*([^*]+)\*|\[([^\]]+)\]\(([^)]+)\))/g,t=[];let r=0,d=0;for(const n of s.matchAll(l)){const o=n[0],c=n.index??0;if(c>r&&t.push(s.slice(r,c)),n[2])t.push(e.jsx("strong",{className:"font-semibold",children:n[2]},`${a}-strong-${d}`));else if(n[3])t.push(e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.82em]",children:n[3]},`${a}-code-${d}`));else if(n[4])t.push(e.jsx("em",{className:"italic",children:n[4]},`${a}-em-${d}`));else if(n[5]&&n[6]){const h=n[6].trim();/^(https?:\/\/|mailto:)/i.test(h)?t.push(e.jsx("a",{href:h,target:"_blank",rel:"noreferrer",className:"text-primary underline underline-offset-2 hover:opacity-90",children:n[5]},`${a}-link-${d}`)):t.push(n[5])}else t.push(o);r=c+o.length,d+=1}return r<s.length&&t.push(s.slice(r)),t.length===0?[s]:t}function fe(s){const a=s.replace(/\r\n/g,`
|
|
2
2
|
`).trim();if(!a)return{blocks:[],frontmatter:[]};let l=a;const t=[];if(l.startsWith(`---
|
|
3
3
|
`)){const r=l.indexOf(`
|
|
4
4
|
---
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as a,a1 as s,a2 as n}from"./radix-ui-Dt3edmE5.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-
|
|
1
|
+
import{j as a,a1 as s,a2 as n}from"./radix-ui-Dt3edmE5.js";import"./react-vendor-CNOkPC89.js";import{c as e}from"./index-lttPkZpv.js";function c({className:t,...r}){return a.jsx(s,{"data-slot":"switch",className:e("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...r,children:a.jsx(n,{"data-slot":"switch-thumb",className:e("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{c as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./radix-ui-Dt3edmE5.js";import{L as P,r as o}from"./react-vendor-CNOkPC89.js";import{a as p,B as y,c as k,d as x,x as E,bk as M,C as g,j,k as N,_ as w,b as v,n as b,bl as U,bm as z,I as B,bn as L}from"./index-DGQBqqm7.js";import{Y as $,Q,aX as Y,v as q,E as G,I as J,a4 as V,C as F,aY as H,al as K}from"./icons-EbXCUruD.js";import"./tanstack-B8i0evp-.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const X={new:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-300",stable:"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-300",planned:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300"};function W({status:s,className:a}){const{t}=p(),d={new:t("updates.statusNew"),stable:t("updates.statusStable"),planned:t("updates.statusPlanned")};return e.jsx(y,{variant:"outline",className:k("font-medium",X[s],a),children:d[s]})}const I="ccs:updates:notice-progress:v1";function Z(s){return s==="new"?"new":"seen"}function u(s,a){return a[s.id]??Z(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function ee(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(I);if(!s)return{};const a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))return{};const t={};for(const[d,l]of Object.entries(a))typeof d=="string"&&(l==="new"||l==="seen"||l==="done"||l==="dismissed")&&(t[d]=l);return t}catch{return{}}}function se(s){typeof window>"u"||window.localStorage.setItem(I,JSON.stringify(s))}function R({state:s,className:a}){const{t}=p(),d={new:{label:t("updates.progressNeedsAction"),className:"border-amber-300/70 bg-amber-100/70 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-300",showDot:!0},seen:{label:t("updates.progressInReview"),className:"border-blue-300/70 bg-blue-100/70 text-blue-800 dark:border-blue-500/40 dark:bg-blue-500/15 dark:text-blue-300"},done:{label:t("updates.progressDone"),className:"border-emerald-300/70 bg-emerald-100/70 text-emerald-800 dark:border-emerald-500/40 dark:bg-emerald-500/15 dark:text-emerald-300"},dismissed:{label:t("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(y,{variant:"outline",className:k("gap-1.5 border text-[10px] font-medium",d.className,a),children:[d.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),d.label]})}function ae({action:s}){const{t:a}=p();return e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),s.type==="route"&&s.path&&e.jsx(x,{size:"sm",asChild:!0,children:e.jsxs(P,{to:s.path,children:[a("updates.open"),e.jsx($,{className:"h-3.5 w-3.5"})]})})]}),s.type==="command"&&s.command&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border bg-background px-2 py-1.5",children:[e.jsx(Q,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:s.command}),e.jsx(E,{value:s.command})]})]})}function re({notice:s,progress:a,relatedEntries:t,onUpdateProgress:d}){const{t:l}=p();return s?e.jsxs("div",{className:"flex-1 min-w-0 bg-background grid grid-rows-[auto_minmax(0,1fr)] overflow-hidden",children:[e.jsxs("div",{className:"border-b bg-background px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"text-base font-semibold leading-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.summary})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a&&e.jsx(R,{state:a}),e.jsx(W,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:l("updates.published",{date:M(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>d("done"),children:[e.jsx(q,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(G,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(J,{className:"h-4 w-4"}),l("updates.reopen")]})]})]}),e.jsx("div",{className:"min-h-0 p-4",children:e.jsxs("div",{className:"grid h-full gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,1fr)] overflow-hidden",children:[e.jsxs(g,{className:"h-full overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:l("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-3",children:s.actions.map(n=>e.jsx(ae,{action:n},`${s.id}-${n.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.impactedIntegrations")}),e.jsx(w,{children:l("updates.impactedDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-medium",children:n.name}),e.jsx(y,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:U[n.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.routes[0]&&e.jsx(x,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(P,{to:n.routes[0].path,children:n.routes[0].label})}),n.commands[0]&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[e.jsx("code",{className:"truncate rounded bg-background px-1.5 py-0.5 text-[11px]",children:n.commands[0]}),e.jsx(E,{value:n.commands[0]})]})]})]},n.id))})})})]}),e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.whyMatters")}),e.jsx(w,{children:l("updates.whyMattersDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("ul",{className:"space-y-2 text-sm text-muted-foreground",children:s.highlights.map(n=>e.jsxs("li",{children:["- ",n]},`${s.id}-${n}`))})})})]})]})]})})]}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed bg-muted/20 p-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:l("updates.noUpdates")})})}function te({notice:s,progress:a,selected:t,onSelect:d}){return e.jsxs("button",{type:"button",onClick:d,className:k("w-full rounded-lg border px-3 py-3 text-left transition-colors",t?"border-primary/30 bg-primary/10":"border-transparent bg-background/40 hover:border-border hover:bg-muted/70"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:s.primaryAction})]}),e.jsx(F,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:M(s.publishedAt)}),e.jsx(R,{state:a})]})]})}function de(s,a){return a?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(d=>`${d.label} ${d.description} ${d.command||""}`),...s.routes.map(d=>d.label)].join(" ").toLowerCase().includes(a):!0}function be(){const{t:s}=p(),a=o.useMemo(()=>[...z].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,T]=o.useState(null);o.useEffect(()=>{se(c)},[c]);const h=o.useMemo(()=>{const r=l.trim().toLowerCase();return a.filter(i=>{const f=u(i,c);return de(i,r)?t==="done"?f==="done":t==="inbox"?A(f):!0:!1})},[a,c,l,t]),m=o.useMemo(()=>{const r=t==="all"?a:h;return r.find(i=>i.id===S)??r[0]??null},[a,S,t,h]),D=r=>{T(r.id),C(i=>u(r,i)!=="new"?i:{...i,[r.id]:"seen"})},O=o.useMemo(()=>a.filter(r=>A(u(r,c))).length,[a,c]),_=o.useMemo(()=>a.filter(r=>u(r,c)==="done").length,[a,c]);return e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r bg-muted/30 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("updates.inboxTitle")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("updates.inboxSubtitle")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.needsAction")}),e.jsx("p",{className:"text-base font-semibold",children:O})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.doneCount")}),e.jsx("p",{className:"text-base font-semibold",children:_})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(K,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(B,{value:l,onChange:r=>n(r.target.value),placeholder:s("updates.searchPlaceholder"),className:"h-9 pl-8"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{id:"inbox",label:s("updates.actionRequired")},{id:"done",label:s("updates.done")},{id:"all",label:s("updates.all")}].map(r=>e.jsx(x,{size:"sm",variant:t===r.id?"default":"outline",onClick:()=>d(r.id),children:r.label},r.id))})]}),e.jsx(b,{className:"flex-1",children:e.jsx("div",{className:"space-y-2 p-2",children:h.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground",children:s("updates.noNotices")}):h.map(r=>e.jsx(te,{notice:r,progress:u(r,c),selected:m?.id===r.id,onSelect:()=>D(r)},r.id))})})]}),e.jsx(re,{notice:m,progress:m?u(m,c):null,relatedEntries:m?L(m):[],onUpdateProgress:r=>{m&&C(i=>({...i,[m.id]:r}))}})]})}export{be as UpdatesPage};
|
|
1
|
+
import{j as e}from"./radix-ui-Dt3edmE5.js";import{L as P,r as o}from"./react-vendor-CNOkPC89.js";import{a as p,B as y,c as k,d as x,x as E,bk as M,C as g,j,k as N,_ as w,b as v,n as b,bl as U,bm as z,I as B,bn as L}from"./index-lttPkZpv.js";import{Y as $,Q,aX as Y,v as q,E as G,I as J,a4 as V,C as F,aY as H,al as K}from"./icons-EbXCUruD.js";import"./tanstack-B8i0evp-.js";import"./notifications-B2HqRBj7.js";import"./utils-CzKF5WmX.js";import"./form-utils-Bcoyqxpq.js";import"./code-highlight-BRUf_pqB.js";const X={new:"border-blue-200 bg-blue-50 text-blue-700 dark:border-blue-900/50 dark:bg-blue-900/20 dark:text-blue-300",stable:"border-green-200 bg-green-50 text-green-700 dark:border-green-900/50 dark:bg-green-900/20 dark:text-green-300",planned:"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/50 dark:bg-amber-900/20 dark:text-amber-300"};function W({status:s,className:a}){const{t}=p(),d={new:t("updates.statusNew"),stable:t("updates.statusStable"),planned:t("updates.statusPlanned")};return e.jsx(y,{variant:"outline",className:k("font-medium",X[s],a),children:d[s]})}const I="ccs:updates:notice-progress:v1";function Z(s){return s==="new"?"new":"seen"}function u(s,a){return a[s.id]??Z(s.status)}function A(s){return s!=="done"&&s!=="dismissed"}function ee(){if(typeof window>"u")return{};try{const s=window.localStorage.getItem(I);if(!s)return{};const a=JSON.parse(s);if(!a||typeof a!="object"||Array.isArray(a))return{};const t={};for(const[d,l]of Object.entries(a))typeof d=="string"&&(l==="new"||l==="seen"||l==="done"||l==="dismissed")&&(t[d]=l);return t}catch{return{}}}function se(s){typeof window>"u"||window.localStorage.setItem(I,JSON.stringify(s))}function R({state:s,className:a}){const{t}=p(),d={new:{label:t("updates.progressNeedsAction"),className:"border-amber-300/70 bg-amber-100/70 text-amber-800 dark:border-amber-500/40 dark:bg-amber-500/15 dark:text-amber-300",showDot:!0},seen:{label:t("updates.progressInReview"),className:"border-blue-300/70 bg-blue-100/70 text-blue-800 dark:border-blue-500/40 dark:bg-blue-500/15 dark:text-blue-300"},done:{label:t("updates.progressDone"),className:"border-emerald-300/70 bg-emerald-100/70 text-emerald-800 dark:border-emerald-500/40 dark:bg-emerald-500/15 dark:text-emerald-300"},dismissed:{label:t("updates.progressDismissed"),className:"border-muted-foreground/20 bg-muted text-muted-foreground dark:border-muted-foreground/30"}}[s];return e.jsxs(y,{variant:"outline",className:k("gap-1.5 border text-[10px] font-medium",d.className,a),children:[d.showDot&&e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-current"}),d.label]})}function ae({action:s}){const{t:a}=p();return e.jsxs("div",{className:"rounded-md border bg-muted/20 p-3",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-0.5",children:[e.jsx("p",{className:"text-sm font-medium",children:s.label}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description})]}),s.type==="route"&&s.path&&e.jsx(x,{size:"sm",asChild:!0,children:e.jsxs(P,{to:s.path,children:[a("updates.open"),e.jsx($,{className:"h-3.5 w-3.5"})]})})]}),s.type==="command"&&s.command&&e.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-md border bg-background px-2 py-1.5",children:[e.jsx(Q,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("code",{className:"min-w-0 flex-1 truncate text-[11px]",children:s.command}),e.jsx(E,{value:s.command})]})]})}function re({notice:s,progress:a,relatedEntries:t,onUpdateProgress:d}){const{t:l}=p();return s?e.jsxs("div",{className:"flex-1 min-w-0 bg-background grid grid-rows-[auto_minmax(0,1fr)] overflow-hidden",children:[e.jsxs("div",{className:"border-b bg-background px-4 py-3",children:[e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("h2",{className:"text-base font-semibold leading-tight",children:s.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.summary})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[a&&e.jsx(R,{state:a}),e.jsx(W,{status:s.status})]})]}),e.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(Y,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:l("updates.published",{date:M(s.publishedAt)})})]}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[e.jsxs(x,{size:"sm",onClick:()=>d("done"),children:[e.jsx(q,{className:"h-4 w-4"}),l("updates.markDone")]}),e.jsxs(x,{size:"sm",variant:"outline",onClick:()=>d("dismissed"),children:[e.jsx(G,{className:"h-4 w-4"}),l("updates.dismiss")]}),e.jsxs(x,{size:"sm",variant:"ghost",onClick:()=>d("new"),children:[e.jsx(J,{className:"h-4 w-4"}),l("updates.reopen")]})]})]}),e.jsx("div",{className:"min-h-0 p-4",children:e.jsxs("div",{className:"grid h-full gap-4 xl:grid-cols-[minmax(0,1.5fr)_minmax(320px,1fr)] overflow-hidden",children:[e.jsxs(g,{className:"h-full overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(V,{className:"h-4 w-4 text-primary"}),e.jsx(N,{className:"text-base",children:l("updates.doNext")})]}),e.jsx(w,{children:s.primaryAction})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-3",children:s.actions.map(n=>e.jsx(ae,{action:n},`${s.id}-${n.id}`))})})})]}),e.jsxs("div",{className:"grid h-full grid-rows-[minmax(0,1fr)_minmax(0,1fr)] gap-4 overflow-hidden",children:[e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.impactedIntegrations")}),e.jsx(w,{children:l("updates.impactedDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("div",{className:"space-y-2",children:t.map(n=>e.jsxs("div",{className:"rounded-md border bg-muted/20 p-2.5",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("p",{className:"min-w-0 truncate text-sm font-medium",children:n.name}),e.jsx(y,{variant:"outline",className:"h-5 px-1.5 text-[10px]",children:U[n.scope]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[n.routes[0]&&e.jsx(x,{size:"sm",variant:"outline",asChild:!0,children:e.jsx(P,{to:n.routes[0].path,children:n.routes[0].label})}),n.commands[0]&&e.jsxs("div",{className:"ml-auto flex min-w-0 items-center gap-1.5",children:[e.jsx("code",{className:"truncate rounded bg-background px-1.5 py-0.5 text-[11px]",children:n.commands[0]}),e.jsx(E,{value:n.commands[0]})]})]})]},n.id))})})})]}),e.jsxs(g,{className:"overflow-hidden",children:[e.jsxs(j,{className:"pb-3",children:[e.jsx(N,{className:"text-base",children:l("updates.whyMatters")}),e.jsx(w,{children:l("updates.whyMattersDesc")})]}),e.jsx(v,{className:"min-h-0",children:e.jsx(b,{className:"h-full pr-2",children:e.jsx("ul",{className:"space-y-2 text-sm text-muted-foreground",children:s.highlights.map(n=>e.jsxs("li",{children:["- ",n]},`${s.id}-${n}`))})})})]})]})]})})]}):e.jsx("div",{className:"flex h-full items-center justify-center rounded-lg border border-dashed bg-muted/20 p-6",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:l("updates.noUpdates")})})}function te({notice:s,progress:a,selected:t,onSelect:d}){return e.jsxs("button",{type:"button",onClick:d,className:k("w-full rounded-lg border px-3 py-3 text-left transition-colors",t?"border-primary/30 bg-primary/10":"border-transparent bg-background/40 hover:border-border hover:bg-muted/70"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:s.title}),e.jsx("p",{className:"line-clamp-2 text-xs text-muted-foreground",children:s.primaryAction})]}),e.jsx(F,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"})]}),e.jsxs("div",{className:"mt-2 flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-[11px] text-muted-foreground",children:M(s.publishedAt)}),e.jsx(R,{state:a})]})]})}function de(s,a){return a?[s.title,s.summary,s.primaryAction,...s.highlights,...s.commands,...s.actions.map(d=>`${d.label} ${d.description} ${d.command||""}`),...s.routes.map(d=>d.label)].join(" ").toLowerCase().includes(a):!0}function be(){const{t:s}=p(),a=o.useMemo(()=>[...z].sort((r,i)=>i.publishedAt.localeCompare(r.publishedAt)),[]),[t,d]=o.useState("inbox"),[l,n]=o.useState(""),[c,C]=o.useState(()=>ee()),[S,T]=o.useState(null);o.useEffect(()=>{se(c)},[c]);const h=o.useMemo(()=>{const r=l.trim().toLowerCase();return a.filter(i=>{const f=u(i,c);return de(i,r)?t==="done"?f==="done":t==="inbox"?A(f):!0:!1})},[a,c,l,t]),m=o.useMemo(()=>{const r=t==="all"?a:h;return r.find(i=>i.id===S)??r[0]??null},[a,S,t,h]),D=r=>{T(r.id),C(i=>u(r,i)!=="new"?i:{...i,[r.id]:"seen"})},O=o.useMemo(()=>a.filter(r=>A(u(r,c))).length,[a,c]),_=o.useMemo(()=>a.filter(r=>u(r,c)==="done").length,[a,c]);return e.jsxs("div",{className:"flex h-full min-h-0 overflow-hidden",children:[e.jsxs("div",{className:"w-80 border-r bg-muted/30 flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"p-4 border-b bg-background space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(H,{className:"h-5 w-5 text-primary"}),e.jsx("h1",{className:"font-semibold",children:s("updates.inboxTitle")})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("updates.inboxSubtitle")})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 text-xs",children:[e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.needsAction")}),e.jsx("p",{className:"text-base font-semibold",children:O})]}),e.jsxs("div",{className:"rounded-md border bg-background px-2 py-1.5",children:[e.jsx("p",{className:"text-muted-foreground",children:s("updates.doneCount")}),e.jsx("p",{className:"text-base font-semibold",children:_})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(K,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(B,{value:l,onChange:r=>n(r.target.value),placeholder:s("updates.searchPlaceholder"),className:"h-9 pl-8"})]}),e.jsx("div",{className:"flex flex-wrap gap-1.5",children:[{id:"inbox",label:s("updates.actionRequired")},{id:"done",label:s("updates.done")},{id:"all",label:s("updates.all")}].map(r=>e.jsx(x,{size:"sm",variant:t===r.id?"default":"outline",onClick:()=>d(r.id),children:r.label},r.id))})]}),e.jsx(b,{className:"flex-1",children:e.jsx("div",{className:"space-y-2 p-2",children:h.length===0?e.jsx("div",{className:"rounded-md border border-dashed p-3 text-xs text-muted-foreground",children:s("updates.noNotices")}):h.map(r=>e.jsx(te,{notice:r,progress:u(r,c),selected:m?.id===r.id,onSelect:()=>D(r)},r.id))})})]}),e.jsx(re,{notice:m,progress:m?u(m,c):null,relatedEntries:m?L(m):[],onUpdateProgress:r=>{m&&C(i=>({...i,[m.id]:r}))}})]})}export{be as UpdatesPage};
|
package/dist/ui/index.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap"
|
|
25
25
|
rel="stylesheet"
|
|
26
26
|
/>
|
|
27
|
-
<script type="module" crossorigin src="/assets/index-
|
|
27
|
+
<script type="module" crossorigin src="/assets/index-lttPkZpv.js"></script>
|
|
28
28
|
<link rel="modulepreload" crossorigin href="/assets/react-vendor-CNOkPC89.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/radix-ui-Dt3edmE5.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/tanstack-B8i0evp-.js">
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @module utils/websearch
|
|
7
7
|
*/
|
|
8
8
|
export type { GeminiCliStatus, GrokCliStatus, OpenCodeCliStatus, WebSearchReadiness, WebSearchStatus, WebSearchCliInfo, WebSearchProviderConfig, WebSearchConfig, } from './types';
|
|
9
|
+
export type { WebSearchApiKeyState } from './provider-secrets';
|
|
9
10
|
export { getGeminiCliStatus, hasGeminiCli, isGeminiAuthenticated, clearGeminiCliCache, } from './gemini-cli';
|
|
10
11
|
export { getGrokCliStatus, hasGrokCli, clearGrokCliCache } from './grok-cli';
|
|
11
12
|
export { getOpenCodeCliStatus, hasOpenCodeCli, clearOpenCodeCliCache } from './opencode-cli';
|
|
@@ -13,5 +14,6 @@ export { getHookPath, hasWebSearchHook, getWebSearchHookConfig, installWebSearch
|
|
|
13
14
|
export { removeHookConfig } from './hook-config';
|
|
14
15
|
export { getWebSearchHookEnv } from './hook-env';
|
|
15
16
|
export { getWebSearchCliProviders, hasAnyWebSearchCli, getCliInstallHints, getWebSearchReadiness, displayWebSearchStatus, } from './status';
|
|
17
|
+
export { WEBSEARCH_API_KEY_PROVIDERS, getWebSearchApiKeyStates } from './provider-secrets';
|
|
16
18
|
export { ensureProfileHooks, removeMigrationMarker } from './profile-hook-injector';
|
|
17
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/websearch/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,GAChB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/websearch/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,YAAY,EACV,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,uBAAuB,EACvB,eAAe,GAChB,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG/D,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG7E,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAG7F,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGjD,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAG3F,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @module utils/websearch
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
-
exports.removeMigrationMarker = exports.ensureProfileHooks = exports.displayWebSearchStatus = exports.getWebSearchReadiness = exports.getCliInstallHints = exports.hasAnyWebSearchCli = exports.getWebSearchCliProviders = exports.getWebSearchHookEnv = exports.removeHookConfig = exports.uninstallWebSearchHook = exports.installWebSearchHook = exports.getWebSearchHookConfig = exports.hasWebSearchHook = exports.getHookPath = exports.clearOpenCodeCliCache = exports.hasOpenCodeCli = exports.getOpenCodeCliStatus = exports.clearGrokCliCache = exports.hasGrokCli = exports.getGrokCliStatus = exports.clearGeminiCliCache = exports.isGeminiAuthenticated = exports.hasGeminiCli = exports.getGeminiCliStatus = void 0;
|
|
10
|
+
exports.removeMigrationMarker = exports.ensureProfileHooks = exports.getWebSearchApiKeyStates = exports.WEBSEARCH_API_KEY_PROVIDERS = exports.displayWebSearchStatus = exports.getWebSearchReadiness = exports.getCliInstallHints = exports.hasAnyWebSearchCli = exports.getWebSearchCliProviders = exports.getWebSearchHookEnv = exports.removeHookConfig = exports.uninstallWebSearchHook = exports.installWebSearchHook = exports.getWebSearchHookConfig = exports.hasWebSearchHook = exports.getHookPath = exports.clearOpenCodeCliCache = exports.hasOpenCodeCli = exports.getOpenCodeCliStatus = exports.clearGrokCliCache = exports.hasGrokCli = exports.getGrokCliStatus = exports.clearGeminiCliCache = exports.isGeminiAuthenticated = exports.hasGeminiCli = exports.getGeminiCliStatus = void 0;
|
|
11
11
|
// Gemini CLI
|
|
12
12
|
var gemini_cli_1 = require("./gemini-cli");
|
|
13
13
|
Object.defineProperty(exports, "getGeminiCliStatus", { enumerable: true, get: function () { return gemini_cli_1.getGeminiCliStatus; } });
|
|
@@ -44,6 +44,9 @@ Object.defineProperty(exports, "hasAnyWebSearchCli", { enumerable: true, get: fu
|
|
|
44
44
|
Object.defineProperty(exports, "getCliInstallHints", { enumerable: true, get: function () { return status_1.getCliInstallHints; } });
|
|
45
45
|
Object.defineProperty(exports, "getWebSearchReadiness", { enumerable: true, get: function () { return status_1.getWebSearchReadiness; } });
|
|
46
46
|
Object.defineProperty(exports, "displayWebSearchStatus", { enumerable: true, get: function () { return status_1.displayWebSearchStatus; } });
|
|
47
|
+
var provider_secrets_1 = require("./provider-secrets");
|
|
48
|
+
Object.defineProperty(exports, "WEBSEARCH_API_KEY_PROVIDERS", { enumerable: true, get: function () { return provider_secrets_1.WEBSEARCH_API_KEY_PROVIDERS; } });
|
|
49
|
+
Object.defineProperty(exports, "getWebSearchApiKeyStates", { enumerable: true, get: function () { return provider_secrets_1.getWebSearchApiKeyStates; } });
|
|
47
50
|
// Profile Hook Injection
|
|
48
51
|
var profile_hook_injector_1 = require("./profile-hook-injector");
|
|
49
52
|
Object.defineProperty(exports, "ensureProfileHooks", { enumerable: true, get: function () { return profile_hook_injector_1.ensureProfileHooks; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/websearch/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/websearch/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAgBH,aAAa;AACb,2CAKsB;AAJpB,gHAAA,kBAAkB,OAAA;AAClB,0GAAA,YAAY,OAAA;AACZ,mHAAA,qBAAqB,OAAA;AACrB,iHAAA,mBAAmB,OAAA;AAGrB,WAAW;AACX,uCAA6E;AAApE,4GAAA,gBAAgB,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AAExD,eAAe;AACf,+CAA6F;AAApF,oHAAA,oBAAoB,OAAA;AAAE,8GAAA,cAAc,OAAA;AAAE,qHAAA,qBAAqB,OAAA;AAEpE,oBAAoB;AACpB,mDAM0B;AALxB,6GAAA,WAAW,OAAA;AACX,kHAAA,gBAAgB,OAAA;AAChB,wHAAA,sBAAsB,OAAA;AACtB,sHAAA,oBAAoB,OAAA;AACpB,wHAAA,sBAAsB,OAAA;AAGxB,wBAAwB;AACxB,6CAAiD;AAAxC,+GAAA,gBAAgB,OAAA;AAEzB,mBAAmB;AACnB,uCAAiD;AAAxC,+GAAA,mBAAmB,OAAA;AAE5B,uBAAuB;AACvB,mCAMkB;AALhB,kHAAA,wBAAwB,OAAA;AACxB,4GAAA,kBAAkB,OAAA;AAClB,4GAAA,kBAAkB,OAAA;AAClB,+GAAA,qBAAqB,OAAA;AACrB,gHAAA,sBAAsB,OAAA;AAGxB,uDAA2F;AAAlF,+HAAA,2BAA2B,OAAA;AAAE,4HAAA,wBAAwB,OAAA;AAE9D,yBAAyB;AACzB,iEAAoF;AAA3E,2HAAA,kBAAkB,OAAA;AAAE,8HAAA,qBAAqB,OAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type WebSearchApiKeyProviderId = 'exa' | 'tavily' | 'brave';
|
|
2
|
+
export type WebSearchApiKeySource = 'global_env' | 'process_env' | 'both' | 'none';
|
|
3
|
+
export interface WebSearchApiKeyState {
|
|
4
|
+
envVar: string;
|
|
5
|
+
configured: boolean;
|
|
6
|
+
available: boolean;
|
|
7
|
+
source: WebSearchApiKeySource;
|
|
8
|
+
maskedValue?: string;
|
|
9
|
+
}
|
|
10
|
+
interface WebSearchApiKeyDescriptor {
|
|
11
|
+
envVar: string;
|
|
12
|
+
alternateEnvVar: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const WEBSEARCH_API_KEY_PROVIDERS: Record<WebSearchApiKeyProviderId, WebSearchApiKeyDescriptor>;
|
|
15
|
+
export declare function getWebSearchApiKeyStates(): Record<WebSearchApiKeyProviderId, WebSearchApiKeyState>;
|
|
16
|
+
export declare function applyWebSearchApiKeyUpdates(env: Record<string, string>, apiKeys: Partial<Record<WebSearchApiKeyProviderId, string | null>> | undefined): Record<string, string>;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=provider-secrets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-secrets.d.ts","sourceRoot":"","sources":["../../../src/utils/websearch/provider-secrets.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,yBAAyB,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;AACnE,MAAM,MAAM,qBAAqB,GAAG,YAAY,GAAG,aAAa,GAAG,MAAM,GAAG,MAAM,CAAC;AAEnF,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,UAAU,yBAAyB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAC9C,yBAAyB,EACzB,yBAAyB,CAc1B,CAAC;AAgCF,wBAAgB,wBAAwB,IAAI,MAAM,CAChD,yBAAyB,EACzB,oBAAoB,CACrB,CA6BA;AAED,wBAAgB,2BAA2B,CACzC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC3B,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,yBAAyB,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,GAAG,SAAS,GAC7E,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA2BxB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyWebSearchApiKeyUpdates = exports.getWebSearchApiKeyStates = exports.WEBSEARCH_API_KEY_PROVIDERS = void 0;
|
|
4
|
+
const unified_config_loader_1 = require("../../config/unified-config-loader");
|
|
5
|
+
const sensitive_keys_1 = require("../sensitive-keys");
|
|
6
|
+
exports.WEBSEARCH_API_KEY_PROVIDERS = {
|
|
7
|
+
exa: {
|
|
8
|
+
envVar: 'EXA_API_KEY',
|
|
9
|
+
alternateEnvVar: 'CCS_WEBSEARCH_EXA_API_KEY',
|
|
10
|
+
},
|
|
11
|
+
tavily: {
|
|
12
|
+
envVar: 'TAVILY_API_KEY',
|
|
13
|
+
alternateEnvVar: 'CCS_WEBSEARCH_TAVILY_API_KEY',
|
|
14
|
+
},
|
|
15
|
+
brave: {
|
|
16
|
+
envVar: 'BRAVE_API_KEY',
|
|
17
|
+
alternateEnvVar: 'CCS_WEBSEARCH_BRAVE_API_KEY',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
function getTrimmedEnvValue(env, names) {
|
|
21
|
+
for (const name of names) {
|
|
22
|
+
const value = env[name]?.trim();
|
|
23
|
+
if (value) {
|
|
24
|
+
return value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
function resolveSource(hasGlobalEnvValue, hasProcessEnvValue) {
|
|
30
|
+
if (hasGlobalEnvValue && hasProcessEnvValue) {
|
|
31
|
+
return 'both';
|
|
32
|
+
}
|
|
33
|
+
if (hasGlobalEnvValue) {
|
|
34
|
+
return 'global_env';
|
|
35
|
+
}
|
|
36
|
+
if (hasProcessEnvValue) {
|
|
37
|
+
return 'process_env';
|
|
38
|
+
}
|
|
39
|
+
return 'none';
|
|
40
|
+
}
|
|
41
|
+
function getWebSearchApiKeyStates() {
|
|
42
|
+
const globalEnvConfig = (0, unified_config_loader_1.getGlobalEnvConfig)();
|
|
43
|
+
const storedEnv = globalEnvConfig.env ?? {};
|
|
44
|
+
return Object.entries(exports.WEBSEARCH_API_KEY_PROVIDERS).reduce((acc, [providerId, descriptor]) => {
|
|
45
|
+
const names = [descriptor.envVar, descriptor.alternateEnvVar];
|
|
46
|
+
const globalEnvValue = getTrimmedEnvValue(storedEnv, names);
|
|
47
|
+
const processEnvValue = getTrimmedEnvValue(process.env, names);
|
|
48
|
+
const configured = Boolean(globalEnvValue || processEnvValue);
|
|
49
|
+
const available = Boolean(processEnvValue || (globalEnvConfig.enabled && globalEnvValue));
|
|
50
|
+
const visibleValue = globalEnvValue || processEnvValue;
|
|
51
|
+
acc[providerId] = {
|
|
52
|
+
envVar: descriptor.envVar,
|
|
53
|
+
configured,
|
|
54
|
+
available,
|
|
55
|
+
source: resolveSource(Boolean(globalEnvValue), Boolean(processEnvValue)),
|
|
56
|
+
maskedValue: visibleValue ? (0, sensitive_keys_1.maskSensitiveValue)(visibleValue) : undefined,
|
|
57
|
+
};
|
|
58
|
+
return acc;
|
|
59
|
+
}, {});
|
|
60
|
+
}
|
|
61
|
+
exports.getWebSearchApiKeyStates = getWebSearchApiKeyStates;
|
|
62
|
+
function applyWebSearchApiKeyUpdates(env, apiKeys) {
|
|
63
|
+
if (!apiKeys) {
|
|
64
|
+
return env;
|
|
65
|
+
}
|
|
66
|
+
const nextEnv = { ...env };
|
|
67
|
+
for (const [providerId, rawValue] of Object.entries(apiKeys)) {
|
|
68
|
+
if (rawValue === undefined) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const descriptor = exports.WEBSEARCH_API_KEY_PROVIDERS[providerId];
|
|
72
|
+
delete nextEnv[descriptor.alternateEnvVar];
|
|
73
|
+
const normalizedValue = typeof rawValue === 'string' ? rawValue.trim() : '';
|
|
74
|
+
if (!normalizedValue) {
|
|
75
|
+
delete nextEnv[descriptor.envVar];
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
nextEnv[descriptor.envVar] = normalizedValue;
|
|
79
|
+
}
|
|
80
|
+
return nextEnv;
|
|
81
|
+
}
|
|
82
|
+
exports.applyWebSearchApiKeyUpdates = applyWebSearchApiKeyUpdates;
|
|
83
|
+
//# sourceMappingURL=provider-secrets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-secrets.js","sourceRoot":"","sources":["../../../src/utils/websearch/provider-secrets.ts"],"names":[],"mappings":";;;AAAA,8EAAwE;AACxE,sDAAuD;AAkB1C,QAAA,2BAA2B,GAGpC;IACF,GAAG,EAAE;QACH,MAAM,EAAE,aAAa;QACrB,eAAe,EAAE,2BAA2B;KAC7C;IACD,MAAM,EAAE;QACN,MAAM,EAAE,gBAAgB;QACxB,eAAe,EAAE,8BAA8B;KAChD;IACD,KAAK,EAAE;QACL,MAAM,EAAE,eAAe;QACvB,eAAe,EAAE,6BAA6B;KAC/C;CACF,CAAC;AAEF,SAAS,kBAAkB,CACzB,GAAuC,EACvC,KAAe;IAEf,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,E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;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../src/utils/websearch/status.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAoEjE;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,gBAAgB,EAAE,CAsE7D;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CAW7C;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,gBAAgB,EAAE,GAC5B,eAAe,CAmCjB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAIvD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAiB7C"}
|
|
@@ -13,12 +13,10 @@ const unified_config_loader_1 = require("../../config/unified-config-loader");
|
|
|
13
13
|
const gemini_cli_1 = require("./gemini-cli");
|
|
14
14
|
const grok_cli_1 = require("./grok-cli");
|
|
15
15
|
const opencode_cli_1 = require("./opencode-cli");
|
|
16
|
+
const provider_secrets_1 = require("./provider-secrets");
|
|
16
17
|
function hasEnvValue(name) {
|
|
17
18
|
return (process.env[name] || '').trim().length > 0;
|
|
18
19
|
}
|
|
19
|
-
function hasAnyEnvValue(names) {
|
|
20
|
-
return names.some((name) => hasEnvValue(name));
|
|
21
|
-
}
|
|
22
20
|
function getLegacyProviderStatuses() {
|
|
23
21
|
const wsConfig = (0, unified_config_loader_1.getWebSearchConfig)();
|
|
24
22
|
const geminiStatus = (0, gemini_cli_1.getGeminiCliStatus)();
|
|
@@ -84,38 +82,41 @@ function getLegacyProviderStatuses() {
|
|
|
84
82
|
*/
|
|
85
83
|
function getWebSearchCliProviders() {
|
|
86
84
|
const wsConfig = (0, unified_config_loader_1.getWebSearchConfig)();
|
|
85
|
+
const apiKeyStates = (0, provider_secrets_1.getWebSearchApiKeyStates)();
|
|
87
86
|
const providers = [
|
|
88
87
|
{
|
|
89
88
|
id: 'exa',
|
|
90
89
|
kind: 'backend',
|
|
91
90
|
name: 'Exa',
|
|
92
91
|
enabled: wsConfig.providers?.exa?.enabled ?? false,
|
|
93
|
-
available: (wsConfig.providers?.exa?.enabled ?? false) &&
|
|
94
|
-
hasAnyEnvValue(['EXA_API_KEY', 'CCS_WEBSEARCH_EXA_API_KEY']),
|
|
92
|
+
available: (wsConfig.providers?.exa?.enabled ?? false) && apiKeyStates.exa.available,
|
|
95
93
|
version: null,
|
|
96
94
|
docsUrl: 'https://docs.exa.ai/reference/search',
|
|
97
95
|
requiresApiKey: true,
|
|
98
96
|
apiKeyEnvVar: 'EXA_API_KEY',
|
|
99
97
|
description: 'API-backed search with strong relevance and content extraction.',
|
|
100
|
-
detail:
|
|
98
|
+
detail: apiKeyStates.exa.available
|
|
101
99
|
? `API key detected (${wsConfig.providers?.exa?.max_results ?? 5} results)`
|
|
102
|
-
:
|
|
100
|
+
: apiKeyStates.exa.configured
|
|
101
|
+
? 'Stored in dashboard, but Global Env is disabled'
|
|
102
|
+
: 'Set EXA_API_KEY',
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
105
|
id: 'tavily',
|
|
106
106
|
kind: 'backend',
|
|
107
107
|
name: 'Tavily',
|
|
108
108
|
enabled: wsConfig.providers?.tavily?.enabled ?? false,
|
|
109
|
-
available: (wsConfig.providers?.tavily?.enabled ?? false) &&
|
|
110
|
-
hasAnyEnvValue(['TAVILY_API_KEY', 'CCS_WEBSEARCH_TAVILY_API_KEY']),
|
|
109
|
+
available: (wsConfig.providers?.tavily?.enabled ?? false) && apiKeyStates.tavily.available,
|
|
111
110
|
version: null,
|
|
112
111
|
docsUrl: 'https://docs.tavily.com/documentation/api-reference/endpoint/search',
|
|
113
112
|
requiresApiKey: true,
|
|
114
113
|
apiKeyEnvVar: 'TAVILY_API_KEY',
|
|
115
114
|
description: 'Search API optimized for agent workflows and concise web result synthesis.',
|
|
116
|
-
detail:
|
|
115
|
+
detail: apiKeyStates.tavily.available
|
|
117
116
|
? `API key detected (${wsConfig.providers?.tavily?.max_results ?? 5} results)`
|
|
118
|
-
:
|
|
117
|
+
: apiKeyStates.tavily.configured
|
|
118
|
+
? 'Stored in dashboard, but Global Env is disabled'
|
|
119
|
+
: 'Set TAVILY_API_KEY',
|
|
119
120
|
},
|
|
120
121
|
{
|
|
121
122
|
id: 'duckduckgo',
|
|
@@ -134,16 +135,17 @@ function getWebSearchCliProviders() {
|
|
|
134
135
|
kind: 'backend',
|
|
135
136
|
name: 'Brave Search',
|
|
136
137
|
enabled: wsConfig.providers?.brave?.enabled ?? false,
|
|
137
|
-
available: (wsConfig.providers?.brave?.enabled ?? false) &&
|
|
138
|
-
hasAnyEnvValue(['BRAVE_API_KEY', 'CCS_WEBSEARCH_BRAVE_API_KEY']),
|
|
138
|
+
available: (wsConfig.providers?.brave?.enabled ?? false) && apiKeyStates.brave.available,
|
|
139
139
|
version: null,
|
|
140
140
|
docsUrl: 'https://brave.com/search/api/',
|
|
141
141
|
requiresApiKey: true,
|
|
142
142
|
apiKeyEnvVar: 'BRAVE_API_KEY',
|
|
143
143
|
description: 'API-backed web search with cleaner result metadata.',
|
|
144
|
-
detail:
|
|
144
|
+
detail: apiKeyStates.brave.available
|
|
145
145
|
? `API key detected (${wsConfig.providers?.brave?.max_results ?? 5} results)`
|
|
146
|
-
:
|
|
146
|
+
: apiKeyStates.brave.configured
|
|
147
|
+
? 'Stored in dashboard, but Global Env is disabled'
|
|
148
|
+
: 'Set BRAVE_API_KEY',
|
|
147
149
|
},
|
|
148
150
|
];
|
|
149
151
|
return [...providers, ...getLegacyProviderStatuses()];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/utils/websearch/status.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,8BAA6C;AAC7C,8EAAwE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@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"websearch-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/websearch-routes.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"websearch-routes.d.ts","sourceRoot":"","sources":["../../../src/web-server/routes/websearch-routes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,QAAA,MAAM,MAAM,4CAAW,CAAC;AA4MxB,eAAe,MAAM,CAAC"}
|
|
@@ -6,7 +6,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const express_1 = require("express");
|
|
7
7
|
const unified_config_loader_1 = require("../../config/unified-config-loader");
|
|
8
8
|
const websearch_manager_1 = require("../../utils/websearch-manager");
|
|
9
|
+
const provider_secrets_1 = require("../../utils/websearch/provider-secrets");
|
|
10
|
+
const auth_middleware_1 = require("../middleware/auth-middleware");
|
|
9
11
|
const router = (0, express_1.Router)();
|
|
12
|
+
const WEBSEARCH_LOCAL_ACCESS_ERROR = 'WebSearch endpoints require localhost access when dashboard auth is disabled.';
|
|
13
|
+
const WEBSEARCH_API_KEY_PROVIDER_IDS = ['exa', 'tavily', 'brave'];
|
|
14
|
+
router.use((req, res, next) => {
|
|
15
|
+
if ((0, auth_middleware_1.requireLocalAccessWhenAuthDisabled)(req, res, WEBSEARCH_LOCAL_ACCESS_ERROR)) {
|
|
16
|
+
next();
|
|
17
|
+
}
|
|
18
|
+
});
|
|
10
19
|
/**
|
|
11
20
|
* GET /api/websearch - Get WebSearch configuration
|
|
12
21
|
* Returns: normalized WebSearch configuration
|
|
@@ -14,7 +23,10 @@ const router = (0, express_1.Router)();
|
|
|
14
23
|
router.get('/', (_req, res) => {
|
|
15
24
|
try {
|
|
16
25
|
const config = (0, unified_config_loader_1.getWebSearchConfig)();
|
|
17
|
-
res.json(
|
|
26
|
+
res.json({
|
|
27
|
+
...config,
|
|
28
|
+
apiKeys: (0, provider_secrets_1.getWebSearchApiKeyStates)(),
|
|
29
|
+
});
|
|
18
30
|
}
|
|
19
31
|
catch (error) {
|
|
20
32
|
res.status(500).json({ error: error.message });
|
|
@@ -25,19 +37,44 @@ router.get('/', (_req, res) => {
|
|
|
25
37
|
* Body: WebSearchConfig fields (enabled, providers)
|
|
26
38
|
*/
|
|
27
39
|
router.put('/', (req, res) => {
|
|
28
|
-
|
|
40
|
+
if (req.body === null ||
|
|
41
|
+
req.body === undefined ||
|
|
42
|
+
typeof req.body !== 'object' ||
|
|
43
|
+
Array.isArray(req.body)) {
|
|
44
|
+
res.status(400).json({ error: 'Invalid request body. Must be an object.' });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const { enabled, providers, apiKeys } = req.body;
|
|
29
48
|
// Validate enabled
|
|
30
49
|
if (enabled !== undefined && typeof enabled !== 'boolean') {
|
|
31
50
|
res.status(400).json({ error: 'Invalid value for enabled. Must be a boolean.' });
|
|
32
51
|
return;
|
|
33
52
|
}
|
|
34
53
|
// Validate providers if specified
|
|
35
|
-
if (providers !== undefined &&
|
|
54
|
+
if (providers !== undefined &&
|
|
55
|
+
(providers === null || Array.isArray(providers) || typeof providers !== 'object')) {
|
|
36
56
|
res.status(400).json({ error: 'Invalid value for providers. Must be an object.' });
|
|
37
57
|
return;
|
|
38
58
|
}
|
|
59
|
+
if (apiKeys !== undefined &&
|
|
60
|
+
(apiKeys === null || Array.isArray(apiKeys) || typeof apiKeys !== 'object')) {
|
|
61
|
+
res.status(400).json({ error: 'Invalid value for apiKeys. Must be an object.' });
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (apiKeys) {
|
|
65
|
+
for (const [providerId, value] of Object.entries(apiKeys)) {
|
|
66
|
+
if (!WEBSEARCH_API_KEY_PROVIDER_IDS.includes(providerId)) {
|
|
67
|
+
res.status(400).json({ error: `Unsupported WebSearch provider: ${providerId}` });
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (value !== null && value !== undefined && typeof value !== 'string') {
|
|
71
|
+
res.status(400).json({ error: `Invalid value for ${providerId} API key` });
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
39
76
|
try {
|
|
40
|
-
|
|
77
|
+
(0, unified_config_loader_1.mutateUnifiedConfig)((config) => {
|
|
41
78
|
config.websearch = {
|
|
42
79
|
enabled: enabled ?? config.websearch?.enabled ?? true,
|
|
43
80
|
providers: providers
|
|
@@ -95,10 +132,19 @@ router.put('/', (req, res) => {
|
|
|
95
132
|
}
|
|
96
133
|
: config.websearch?.providers,
|
|
97
134
|
};
|
|
135
|
+
if (apiKeys) {
|
|
136
|
+
config.global_env = {
|
|
137
|
+
enabled: config.global_env?.enabled ?? true,
|
|
138
|
+
env: (0, provider_secrets_1.applyWebSearchApiKeyUpdates)(config.global_env?.env ?? {}, apiKeys),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
98
141
|
});
|
|
99
142
|
res.json({
|
|
100
143
|
success: true,
|
|
101
|
-
websearch:
|
|
144
|
+
websearch: {
|
|
145
|
+
...(0, unified_config_loader_1.getWebSearchConfig)(),
|
|
146
|
+
apiKeys: (0, provider_secrets_1.getWebSearchApiKeyStates)(),
|
|
147
|
+
},
|
|
102
148
|
});
|
|
103
149
|
}
|
|
104
150
|
catch (error) {
|