tracer-sh 0.2.8 → 0.3.1
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/README.md +58 -6
- package/package.json +4 -3
- package/packages/server/dist/{chunk-WOL2ZWU7.js → chunk-5GQDB6U7.js} +4 -0
- package/packages/server/dist/chunk-IAWOYD5E.js +4793 -0
- package/packages/server/dist/{chunk-WUFQGSGW.js → chunk-YL5JSOUN.js} +1 -1
- package/packages/server/dist/dist-ZMUHFP5T.js +1257 -0
- package/packages/server/dist/{domain-knowledge-4AAER546.js → domain-knowledge-B2IREATL.js} +1 -1
- package/packages/server/dist/{domain-knowledge-CAD7MDFJ.js → domain-knowledge-K3OB4NDB.js} +1 -1
- package/packages/server/dist/{domain-knowledge-A3WXZ55R.js → domain-knowledge-U2RLSFM2.js} +1 -1
- package/packages/server/dist/index.js +58498 -41044
- package/packages/server/dist/multipart-parser-ONCUQ5VA.js +372 -0
- package/packages/server/dist/src-434DTNEL.js +1409 -0
- package/packages/server/dist/{token-QV5VOVJ4.js → token-4YFRZJYT.js} +2 -2
- package/packages/server/dist/{token-util-DLXYCJR4.js → token-util-CTKMWUIG.js} +2 -2
- package/packages/web/dist/assets/{SearchableSelect-CUhWd9KY.js → SearchableSelect-cW8CAuj_.js} +1 -1
- package/packages/web/dist/assets/Settings-CBO58Ysm.js +1 -0
- package/packages/web/dist/assets/{highlighted-body-OFNGDK62-I1fFFO4T.js → highlighted-body-OFNGDK62-C09rPU2r.js} +1 -1
- package/packages/web/dist/assets/{index-C2C5Z4gB.js → index-BrLT4CJt.js} +10 -10
- package/packages/web/dist/assets/index-CZnFdes-.css +1 -0
- package/packages/web/dist/assets/{mermaid-GHXKKRXX--cj8bwjs.js → mermaid-GHXKKRXX-fHfNJrVx.js} +3 -3
- package/packages/web/dist/index.html +2 -2
- package/packages/web/dist/assets/Settings-BlhaU_HT.js +0 -1
- package/packages/web/dist/assets/index-B4Hwftt4.css +0 -1
|
@@ -2,10 +2,10 @@ import { createRequire as __createRequire } from 'module'; const require = __cre
|
|
|
2
2
|
import {
|
|
3
3
|
require_token_error,
|
|
4
4
|
require_token_util
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YL5JSOUN.js";
|
|
6
6
|
import {
|
|
7
7
|
__commonJS
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-5GQDB6U7.js";
|
|
9
9
|
|
|
10
10
|
// ../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token.js
|
|
11
11
|
var require_token = __commonJS({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
require_token_util
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-YL5JSOUN.js";
|
|
5
|
+
import "./chunk-5GQDB6U7.js";
|
|
6
6
|
export default require_token_util();
|
package/packages/web/dist/assets/{SearchableSelect-CUhWd9KY.js → SearchableSelect-cW8CAuj_.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as q,r as s,j as r}from"./index-
|
|
1
|
+
import{a as q,r as s,j as r}from"./index-BrLT4CJt.js";var P=q();function $(c){const n=c?`tracer:starred:${c}`:null,[i,S]=s.useState(()=>{if(!n)return new Set;try{const a=localStorage.getItem(n);return a?new Set(JSON.parse(a)):new Set}catch{return new Set}});return[i,a=>{S(u=>{const t=new Set(u);return t.has(a)?t.delete(a):t.add(a),n&&localStorage.setItem(n,JSON.stringify([...t])),t})}]}function I({options:c,value:n,onChange:i,placeholder:S="Select...",storageKey:v,fitContent:a,disabled:u}){const[t,l]=s.useState(!1),[w,y]=s.useState(""),f=s.useRef(null),j=s.useRef(null),N=s.useRef(null),g=s.useRef(null),[x,C]=$(v),[m,L]=s.useState({top:0,left:0,minWidth:0});s.useEffect(()=>{if(!t)return;const e=d=>{f.current?.contains(d.target)||j.current?.contains(d.target)||l(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[t]);const R=s.useCallback(()=>{if(!f.current)return;const e=f.current.getBoundingClientRect();L({top:e.bottom+4,left:e.left,minWidth:e.width})},[]);s.useEffect(()=>{t&&(R(),y(""),requestAnimationFrame(()=>N.current?.focus()))},[t,R]);const h=c.find(e=>e.value===n),p=s.useMemo(()=>{const e=w.toLowerCase();return[...e?c.filter(o=>o.label.toLowerCase().includes(e)||o.value.toLowerCase().includes(e)):c].sort((o,b)=>{const k=x.has(o.value)?0:1,E=x.has(b.value)?0:1;return k!==E?k-E:o.label.localeCompare(b.label)})},[c,w,x]);s.useEffect(()=>{if(t&&n&&g.current){const e=g.current.querySelector(`[data-value="${CSS.escape(n)}"]`);e&&e.scrollIntoView({block:"nearest"})}},[t,n]);const W=t?P.createPortal(r.jsxs("div",{ref:j,className:"fixed z-[100] bg-white border border-[#d4d2cd] rounded shadow-lg",style:{top:m.top,left:m.left,minWidth:m.minWidth,width:a?"max-content":m.minWidth},children:[r.jsx("div",{className:"p-1.5 border-b border-[#e8e6e1]",children:r.jsx("input",{ref:N,type:"text",value:w,onChange:e=>y(e.target.value),placeholder:"Search...",className:"w-full px-2 py-1.5 text-xs text-[#2c2c2c] font-sans bg-[#f5f4f0] border border-[#e8e6e1] rounded focus:outline-none focus:border-[#2b5ea7] placeholder:text-[#9c9890]",onKeyDown:e=>{e.key==="Escape"&&l(!1),e.key==="Enter"&&p.length>0&&(i(p[0].value),l(!1))}})}),r.jsx("div",{ref:g,className:"max-h-[280px] overflow-y-auto",children:p.length===0?r.jsx("div",{className:"px-3 py-3 text-xs text-[#9c9890] text-center",children:"No projects found"}):p.map(e=>{const d=e.value===n,o=x.has(e.value);return r.jsxs("div",{"data-value":e.value,className:`flex items-center gap-1.5 px-2 py-1.5 text-xs font-sans cursor-pointer transition-colors ${d?"bg-[#2b5ea7]/10 text-[#2b5ea7]":"text-[#2c2c2c] hover:bg-[#f5f4f0]"}`,onClick:()=>{i(e.value),l(!1)},children:[r.jsx("button",{type:"button",onClick:b=>{b.stopPropagation(),C(e.value)},className:`shrink-0 w-4 h-4 flex items-center justify-center text-[10px] transition-colors ${o?"text-[#d4a017]":"text-[#d4d2cd] hover:text-[#9c9890]"}`,title:o?"Unstar":"Star to pin to top",children:o?"★":"☆"}),r.jsx("span",{className:a?"whitespace-nowrap":"truncate flex-1",children:e.label})]},e.value)})})]}),document.body):null;return r.jsxs(r.Fragment,{children:[r.jsxs("button",{ref:f,type:"button",onClick:()=>!u&&l(!t),disabled:u,className:"w-full bg-white border border-[#d4d2cd] rounded px-3 py-2 text-xs text-[#2c2c2c] font-sans text-left flex items-center justify-between focus:outline-none focus:border-[#2b5ea7] hover:border-[#b0ada6] transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:[r.jsx("span",{className:h?"text-[#2c2c2c] truncate":"text-[#9c9890]",children:h?h.displayLabel??h.label:S}),r.jsx("span",{className:"text-[#9c9890] text-[10px] ml-2 shrink-0 transition-transform duration-200",style:{transform:t?"rotate(180deg)":"rotate(0deg)"},children:"▾"})]}),W]})}export{I as S,P as r,$ as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as u,r as v,j as e,S as I,c as Q,b as i,C as E,u as W,W as G,A as Y,d as re,g as ce,m as $,p as z,e as X,M as de}from"./index-BrLT4CJt.js";import{S as ee}from"./SearchableSelect-cW8CAuj_.js";function H({type:s,label:t}){const o=u.useUtils(),{data:a,isLoading:l}=u.settings.getApiKey.useQuery(s),c=u.settings.saveApiKey.useMutation({onSuccess:()=>o.settings.getApiKey.invalidate(s)}),g=u.settings.removeApiKey.useMutation({onSuccess:()=>o.settings.getApiKey.invalidate(s)}),[d,m]=v.useState(!1),[r,h]=v.useState(""),[p,f]=v.useState(!1);async function b(){await c.mutateAsync({type:s,apiKey:r}),h(""),m(!1)}async function x(){await g.mutateAsync(s),m(!1),f(!1)}return l?e.jsx("div",{className:"px-4 py-3",children:e.jsx(I,{size:"sm"})}):e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("span",{className:"text-sm font-medium w-24 shrink-0",children:t}),e.jsx("span",{className:i.maskedKey+" flex-1 truncate",style:a?{color:Q.success}:void 0,children:a?a.maskedApiKey:"Not configured"}),!d&&e.jsx("button",{onClick:()=>{h(""),m(!0)},className:i.secondaryBtn+" text-xs px-3 py-1",children:a?"Edit":"Add"})]}),d&&e.jsxs("div",{className:"mt-3 pt-3 border-t border-[#e8e6e1] space-y-2",children:[e.jsx("input",{type:r?"password":"text",value:r,onChange:y=>h(y.target.value),placeholder:a?.maskedApiKey??"Enter API key",className:i.input}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:b,disabled:!r||c.isPending,className:i.primaryBtn+" text-xs px-3 py-1",children:c.isPending?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(I,{size:"sm"})," Saving..."]}):"Save"}),e.jsx("button",{onClick:()=>m(!1),disabled:c.isPending,className:i.secondaryBtn+" text-xs px-3 py-1",children:"Cancel"}),a&&e.jsx("button",{onClick:()=>f(!0),disabled:g.isPending,className:i.dangerBtn+" text-xs px-3 py-1",children:"Remove"})]})]}),e.jsx(E,{open:p,title:"Remove API key",message:`Remove the ${t} API key?`,confirmLabel:"Remove",onConfirm:x,onCancel:()=>f(!1)})]})}function J({checked:s,onChange:t,disabled:o,"aria-label":a}){return e.jsx("button",{type:"button",role:"switch","aria-checked":s,"aria-label":a,disabled:o,onClick:()=>t(!s),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors ${s?"bg-[#2b5ea7]":"bg-[#d4d2cd]"} ${o?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white transition-transform ${s?"translate-x-[18px]":"translate-x-[3px]"}`})})}function _({status:s,label:t}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`inline-block h-2 w-2 rounded-full ${i.statusDot[s]}`}),t&&e.jsx("span",{className:i.statusLabel,children:t})]})}function ue(){const s=u.useUtils(),{data:t,isLoading:o}=u.settings.getVertexConfig.useQuery(),a=W(),l=!!t,c=a.data,g=c?.ok??!1,d=l&&g,m=()=>{s.settings.getVertexConfig.invalidate(),s.provider.listVertexModels.invalidate()},r=u.settings.saveVertexConfig.useMutation({onSuccess:m}),h=u.settings.removeVertexConfig.useMutation({onSuccess:m}),p=r.isPending||h.isPending,[f,b]=v.useState(!1),{data:x,isLoading:y}=u.provider.listGcpProjects.useQuery(void 0,{staleTime:G.updateCheckStaleTimeMs,enabled:d}),S=v.useMemo(()=>(x??[]).map(N=>({value:N.projectId,label:N.name?`${N.name} (${N.projectId})`:N.projectId,displayLabel:N.name||N.projectId})),[x]);function A(N){N?r.mutate({}):b(!0)}function w(){h.mutate(),b(!1)}function j(N){N!==t?.projectId&&r.mutate({projectId:N})}return o?e.jsx("div",{className:"px-4 py-3",children:e.jsx(I,{size:"sm"})}):e.jsxs("div",{className:"px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(J,{checked:l,onChange:A,disabled:p,"aria-label":"Enable Vertex AI"}),e.jsx("span",{className:"text-sm font-medium",children:"Vertex AI"}),l?e.jsx(_,{status:d?"connected":"disconnected"}):e.jsx("span",{className:"text-xs opacity-40",children:"Not configured"})]}),l&&e.jsx("div",{className:"mt-3 pt-3 border-t border-[#e8e6e1]",children:a.isLoading?e.jsxs("div",{className:"flex items-center gap-2 text-xs text-[#666666]",children:[e.jsx(I,{size:"sm"})," Checking authentication…"]}):g?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-[#666666] whitespace-nowrap w-14",children:"Project"}),e.jsx("div",{className:"flex-1",children:e.jsx(ee,{options:S,value:t?.projectId??"",onChange:j,placeholder:y?"Loading...":"Select project...",storageKey:"gcp-projectId",fitContent:!0,disabled:y||p})})]}),e.jsx(me,{value:t?.location??"global",onCommit:N=>{const P=N.trim()||"global";P!==t?.location&&r.mutate({location:P})},disabled:p})]}):e.jsx("p",{className:i.warnText,children:c&&!c.ok?c.message:"Not authenticated. Run: gcloud auth application-default login"})}),e.jsx(E,{open:f,title:"Disable Vertex AI",message:"Disable Vertex AI? Your project selection will be removed.",confirmLabel:"Disable",onConfirm:w,onCancel:()=>b(!1)})]})}function me({value:s,onCommit:t,disabled:o}){const[a,l]=v.useState(s);return v.useEffect(()=>l(s),[s]),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-xs text-[#666666] whitespace-nowrap w-14",children:"Location"}),e.jsx("input",{type:"text",value:a,onChange:c=>l(c.target.value),onBlur:()=>t(a),onKeyDown:c=>{c.key==="Enter"&&c.currentTarget.blur()},placeholder:"global",disabled:o,className:i.input})]})}function xe({configuredProviders:s}){return e.jsx("div",{className:"border-t border-[#e8e6e1]",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:i.tableHeaderRow,children:[e.jsx("th",{className:i.tableHeaderCell+" text-xs py-2",children:"Model"}),e.jsx("th",{className:i.tableHeaderCell+" text-xs py-2",children:"Provider"}),e.jsx("th",{className:i.tableHeaderCell+" text-xs py-2 text-right",children:"Input ($/M)"}),e.jsx("th",{className:i.tableHeaderCell+" text-xs py-2 text-right",children:"Output ($/M)"})]})}),e.jsx("tbody",{className:"divide-y divide-[#e8e6e1]",children:Y.map(t=>{const o=s.has(t.provider);return e.jsxs("tr",{style:o?{color:Q.success}:{color:Q.inkFaint},children:[e.jsx("td",{className:"px-4 py-2 font-mono text-xs",children:t.modelId}),e.jsx("td",{className:"px-4 py-2 capitalize",children:t.provider}),e.jsxs("td",{className:"px-4 py-2 text-right font-mono text-xs",children:["$",t.inputPrice.toFixed(2)]}),e.jsxs("td",{className:"px-4 py-2 text-right font-mono text-xs",children:["$",t.outputPrice.toFixed(2)]})]},t.modelId)})})]})})}function pe(){const[s,t]=v.useState(!1),o=re();return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"max-w-lg bg-white border border-[#d4d2cd] rounded divide-y divide-[#e8e6e1] overflow-hidden",children:[e.jsx(H,{type:"anthropic",label:"Anthropic"}),e.jsx(H,{type:"google",label:"Google AI"}),e.jsx(ue,{})]}),e.jsxs("div",{className:"bg-white border border-[#d4d2cd] rounded overflow-hidden",children:[e.jsxs("button",{onClick:()=>t(!s),className:"w-full flex items-center justify-between px-4 py-3 text-sm text-[#666666] hover:bg-[#f5f4f0] transition-colors font-sans",children:[e.jsx("span",{className:"font-medium",children:"Model Pricing"}),e.jsx("span",{className:"text-xs transition-transform duration-200",style:{transform:s?"rotate(180deg)":"rotate(0deg)"},children:"▾"})]}),s&&e.jsx(xe,{configuredProviders:o})]})]})}function se({value:s,models:t,onChange:o,loading:a,disabled:l,label:c="Model"}){const g=ce(t),d=$(s),r=!t.some(p=>$(p)===d)&&!a;function h(p){const f=p.indexOf(":");o({provider:p.slice(0,f),modelId:p.slice(f+1)})}return e.jsxs("div",{className:"flex items-start gap-3 mt-3 pt-3 border-t border-[#d4d2cd]",children:[e.jsx("span",{className:"text-xs text-[#666666] whitespace-nowrap w-14 mt-2",children:c}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"shrink-0 inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium bg-[#f0eee9] text-[#666666] border border-[#d4d2cd]",children:z(s.provider)}),e.jsxs("div",{className:"relative flex-1",children:[e.jsxs("select",{value:d,onChange:p=>h(p.target.value),disabled:l,className:"w-full appearance-none bg-white border border-[#d4d2cd] rounded px-3 py-2 pr-7 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-sans disabled:opacity-50 disabled:cursor-not-allowed",children:[r&&e.jsx("optgroup",{label:"Unavailable",children:e.jsxs("option",{value:d,children:[z(s.provider)," · ",s.modelId]})}),g.map(p=>e.jsx("optgroup",{label:p.label,children:p.models.map(f=>e.jsx("option",{value:$(f),children:f.modelId},$(f)))},p.provider))]}),e.jsx("span",{className:"pointer-events-none absolute right-2 top-1/2 -translate-y-1/2 text-[#9c9890] text-[10px]",children:"▾"})]})]}),r&&e.jsxs("p",{className:i.warnText+" mt-1.5",children:[z(s.provider)," · ",s.modelId," isn’t available. Configure its provider or pick another model."]})]})]})}const ge=Y[0];function he({providerType:s}){const t=u.useUtils(),{data:o,isLoading:a}=u.settings.getSubAgentModel.useQuery(s),l=u.settings.saveSubAgentModel.useMutation({onSuccess:()=>t.settings.getSubAgentModel.invalidate(s)}),{models:c,isLoading:g}=X();if(a)return null;const d=o??ge;return e.jsx(se,{value:d,models:c,loading:g,disabled:l.isPending,onChange:m=>l.mutate({providerType:s,model:{provider:m.provider,modelId:m.modelId}})})}function fe({existingConfig:s}){const t=u.useUtils(),o=W(),{data:a,isLoading:l}=u.provider.listGcpProjects.useQuery(void 0,{staleTime:G.updateCheckStaleTimeMs}),c=u.provider.saveConfig.useMutation({onSuccess:()=>{t.provider.getConfigs.invalidate(),t.provider.list.invalidate()}}),g=v.useMemo(()=>(a??[]).map(r=>({value:r.projectId,label:r.name?`${r.name} (${r.projectId})`:r.projectId,displayLabel:r.name||r.projectId})),[a]),d=s.projectId??"";if(o.data&&!o.data.ok)return null;function m(r){r!==d&&c.mutate({type:"gcp",config:{...s,projectId:r}})}return e.jsxs("div",{className:"flex items-center gap-3 mt-3 pt-3 border-t border-[#d4d2cd]",children:[e.jsx("span",{className:"text-xs text-[#666666] whitespace-nowrap w-14",children:"Project"}),e.jsx("div",{className:"flex-1",children:e.jsx(ee,{options:g,value:d,onChange:m,placeholder:l?"Loading...":"Select project...",storageKey:"gcp-projectId",fitContent:!0,disabled:l||c.isPending})})]})}function ve({type:s,label:t,connected:o,configured:a,onConfigure:l,onToggle:c,togglePending:g,toggleError:d,pingError:m,hasConfigFields:r,existingConfig:h}){const p=a||o;return e.jsxs("div",{className:i.settingsCard+" w-80",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{checked:a,onChange:f=>{f&&r?l():c(f)},disabled:g}),e.jsx("span",{className:"font-medium",children:t}),p?e.jsx(_,{status:o?"connected":"disconnected"}):e.jsx("span",{className:"text-xs opacity-40",children:"Not configured"})]}),e.jsx("button",{onClick:l,className:`${i.secondaryBtn} ${a&&r?"":"invisible"}`,children:"Edit"})]}),p&&e.jsx(he,{providerType:s}),p&&s==="gcp"&&h&&e.jsx(fe,{existingConfig:h}),m&&!o&&e.jsx("p",{className:i.warnText+" mt-2",children:m}),d&&e.jsx("p",{className:i.errorText+" mt-2",children:d})]})}function q(s,t){return!!s&&!!t&&s===t}function te({open:s,label:t,configFields:o,formValues:a,onFormChange:l,existingConfig:c,saveResult:g,savePending:d,configured:m,onSave:r,onClose:h,onRemove:p}){const f=o.some(x=>x.required!==!1&&x.type==="password"&&q(a[x.key],c?.[x.key])),b=o.some(x=>x.required!==!1&&!a[x.key]);return e.jsxs(de,{open:s,onClose:h,children:[e.jsxs("div",{className:i.dialogTitle+" text-base mb-4",children:["Configure ",t]}),e.jsx("div",{className:"space-y-3",children:o.map(x=>{const y=x.type==="password"&&q(a[x.key],c?.[x.key]);return e.jsxs("div",{children:[e.jsxs("label",{className:i.sectionTitle,children:[x.label,x.required===!1&&e.jsx("span",{className:"text-xs opacity-40 ml-1",children:"(optional)"})]}),e.jsx("input",{type:x.type==="password"&&a[x.key]&&!y?"password":"text",value:a[x.key]??"",onChange:S=>l(x.key,S.target.value),onFocus:S=>{y&&S.target.select()},placeholder:`Enter ${x.label.toLowerCase()}`,className:`${i.input} ${y?"!text-[#999] !border-l-2 !border-l-amber-400":""}`})]},x.key)})}),e.jsxs("div",{className:"flex items-center gap-2 mt-4 pt-4 border-t border-[#d4d2cd]",children:[e.jsx("button",{onClick:r,disabled:b||f||d,className:i.primaryBtn,children:d?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(I,{size:"sm"})," Saving..."]}):"Save & Test"}),e.jsx("button",{onClick:h,disabled:d,className:i.secondaryBtn,children:"Cancel"}),m&&e.jsx("button",{onClick:p,disabled:d,className:i.dangerBtn,children:"Remove"})]}),f&&!d&&!g&&e.jsx("p",{className:"mt-2 text-xs text-amber-600",children:"Re-enter highlighted fields to save"}),g&&e.jsx("div",{className:`mt-3 ${g.success?i.successText:i.errorText}`,children:g.success?"Connected successfully":g.error||"Connection failed"})]})}function je(s,t){const o={};for(const a of s)o[a.key]=t?.[a.key]??"";return o}function be(){const s=u.useUtils(),{data:t,isLoading:o}=u.provider.list.useQuery(),{data:a,isLoading:l}=u.provider.getConfigs.useQuery(),{data:c,isLoading:g}=u.provider.getRegisteredTypes.useQuery(),{data:d}=u.provider.ping.useQuery(void 0,{staleTime:G.sessionStaleTimeMs,refetchOnMount:"always"}),m=u.provider.saveConfig.useMutation({onSuccess:()=>{s.provider.list.invalidate(),s.provider.getConfigs.invalidate(),s.provider.ping.invalidate()}}),r=u.provider.removeConfig.useMutation({onSuccess:()=>{s.provider.list.invalidate(),s.provider.getConfigs.invalidate(),s.provider.ping.invalidate()}}),[h,p]=v.useState(null),[f,b]=v.useState({}),[x,y]=v.useState(null),[S,A]=v.useState(null),[w,j]=v.useState({});function N(n){const C=a?.find(M=>M.type===n),k=c?.find(M=>M.type===n);b(je(k?.configFields??[],C?.config)),y(null),p(n)}function P(){p(null),b({}),y(null)}async function F(n){y(null);try{const C=await m.mutateAsync({type:n,config:f});y(C),C.success&&(p(null),b({}))}catch{y({success:!1,error:"Failed to save configuration"})}}async function K(n,C){if(C){j(k=>{const M={...k};return delete M[n],M});try{const k=await m.mutateAsync({type:n,config:{}});k.success||j(M=>({...M,[n]:k.error??"Connection failed"}))}catch{j(k=>({...k,[n]:"Failed to save configuration"}))}}else A(n)}async function U(n){await r.mutateAsync(n),p(null),b({}),y(null),A(null)}const O=o||l||g,D=c??[];if(O)return e.jsx(I,{size:"lg",centered:!0});const L=h?D.find(n=>n.type===h):null,R=h?a?.find(n=>n.type===h):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap gap-3",children:D.map(({type:n,label:C,configFields:k})=>{const M=t?.find(T=>T.type===n),Z=a?.find(T=>T.type===n),ae=!!Z,B=d?.find(T=>T.type===n),ie=B?B.ok:!!M?.connected,oe=k.length>0,le=B&&!B.ok?B.error:void 0;return e.jsx(ve,{type:n,label:C,connected:ie,configured:ae,onConfigure:()=>N(n),onToggle:T=>K(n,T),togglePending:m.isPending||r.isPending,toggleError:w[n],pingError:le,hasConfigFields:oe,existingConfig:Z?.config},n)})}),h&&L&&e.jsx(te,{open:!0,label:L.label,configFields:L.configFields,formValues:f,onFormChange:(n,C)=>b(k=>({...k,[n]:C})),existingConfig:R?.config??null,saveResult:x,savePending:m.isPending,configured:!!R,onSave:()=>F(h),onClose:P,onRemove:()=>A(h)}),e.jsx(E,{open:S!==null,title:"Disable provider",message:`Disable ${D.find(n=>n.type===S)?.label??S}?`,confirmLabel:"Disable",onConfirm:()=>{S&&U(S)},onCancel:()=>A(null)})]})}const ye=[{key:"domain",label:"Domain (yourco → yourco.atlassian.net)",type:"text"},{key:"email",label:"Email",type:"text"},{key:"apiToken",label:"API Token",type:"password"}];function Ne(){const s=u.useUtils(),{data:t,isLoading:o}=u.integrations.getJira.useQuery(),a=u.integrations.saveJira.useMutation({onSuccess:()=>s.integrations.getJira.invalidate()}),l=u.integrations.removeJira.useMutation({onSuccess:()=>s.integrations.getJira.invalidate()}),[c,g]=v.useState(!1),[d,m]=v.useState({}),[r,h]=v.useState(null),[p,f]=v.useState(!1),b=!!t?.configured,x=t?.config??null;function y(){m({domain:x?.domain??"",email:x?.email??"",apiToken:x?.apiToken??""}),h(null),g(!0)}function S(){g(!1),m({}),h(null)}async function A(){h(null);try{const j=await a.mutateAsync({domain:d.domain??"",email:d.email??"",apiToken:d.apiToken??""});h(j),j.success&&S()}catch{h({success:!1,error:"Failed to save configuration"})}}async function w(){await l.mutateAsync(),f(!1),S()}return o?e.jsx(I,{size:"lg",centered:!0}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-wrap gap-3",children:e.jsx("div",{className:i.settingsCard+" w-80",children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(J,{checked:b,onChange:j=>{j?y():f(!0)},disabled:a.isPending||l.isPending}),e.jsx("span",{className:"font-medium",children:"Jira"}),b?e.jsx(_,{status:"connected"}):e.jsx("span",{className:"text-xs opacity-40",children:"Not configured"})]}),e.jsx("button",{onClick:y,className:`${i.secondaryBtn} ${b?"":"invisible"}`,children:"Edit"})]})})}),c&&e.jsx(te,{open:!0,label:"Jira",configFields:ye,formValues:d,onFormChange:(j,N)=>m(P=>({...P,[j]:N})),existingConfig:x,saveResult:r,savePending:a.isPending,configured:b,onSave:A,onClose:S,onRemove:()=>f(!0)}),e.jsx(E,{open:p,title:"Disable Jira",message:"Disable the Jira integration?",confirmLabel:"Disable",onConfirm:w,onCancel:()=>f(!1)})]})}function Ce({memory:s,editingId:t,editNote:o,setEditNote:a,onUpdate:l,onCancelEdit:c,onStartEdit:g,onDelete:d,updatePending:m,removePending:r}){return e.jsxs("li",{className:"flex items-start justify-between gap-3 py-1.5 border-b border-[#d4d2cd] last:border-b-0",children:[e.jsx("div",{className:"flex-1 min-w-0",children:t===s.id?e.jsxs("div",{className:"space-y-2",children:[e.jsx("input",{type:"text",value:o,onChange:h=>a(h.target.value),className:i.input}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>l(s.id),disabled:!o||m,className:i.primaryBtn,children:"Save"}),e.jsx("button",{onClick:c,disabled:m,className:i.secondaryBtn,children:"Cancel"})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-sm text-[#444444]",children:s.note}),s.reviewNote&&e.jsx("p",{className:"text-xs text-[#9c9890] italic mt-0.5",children:s.reviewNote}),e.jsx("p",{className:"text-xs text-[#666666] mt-0.5",children:new Date(s.createdAt*1e3).toLocaleDateString()})]})}),t!==s.id&&e.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.jsx("button",{onClick:()=>g(s.id,s.note),className:i.secondaryBtn,children:"Edit"}),e.jsx("button",{onClick:()=>d(s.id),disabled:r,className:i.dangerBtn,children:"Delete"})]})]})}function Se(){const s=u.useUtils(),{data:t,isLoading:o}=u.memory.list.useQuery(),{data:a}=u.provider.getRegisteredTypes.useQuery(),l=u.memory.create.useMutation({onSuccess:()=>{s.memory.list.invalidate(),P(""),j("unified"),A(!1)}}),c=u.memory.update.useMutation({onSuccess:()=>s.memory.list.invalidate()}),g=u.memory.remove.useMutation({onSuccess:()=>s.memory.list.invalidate()}),[d,m]=v.useState(null),r=u.memory.optimize.useMutation({onSuccess:n=>{s.memory.list.invalidate(),m(n.stats)}}),[h,p]=v.useState(null),[f,b]=v.useState(""),[x,y]=v.useState(null),[S,A]=v.useState(!1),[w,j]=v.useState("unified"),[N,P]=v.useState("");function F(n,C){p(n),b(C)}async function K(n){await c.mutateAsync({id:n,note:f}),p(null),b("")}function U(){p(null),b("")}const O=[{value:"unified",label:"Unified"},...(a??[]).map(n=>({value:n.type,label:n.label}))],D=5;if(o)return e.jsx(I,{size:"lg",centered:!0});const L=new Map;if(t)for(const n of t){const C=L.get(n.toolName)??[];C.push(n),L.set(n.toolName,C)}const R={editingId:h,editNote:f,setEditNote:b,onUpdate:K,onCancelEdit:U,onStartEdit:F,onDelete:n=>y(n),updatePending:c.isPending,removePending:g.isPending};return e.jsxs("div",{className:"space-y-4",children:[S?e.jsxs("div",{className:i.settingsCard+" space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("label",{className:"text-sm font-medium text-[#666666] font-sans",children:"Provider"}),e.jsx("select",{value:w,onChange:n=>{j(n.target.value),n.target.blur()},className:"bg-white border border-[#d4d2cd] rounded px-3 py-2 pr-8 text-sm text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-sans appearance-none bg-[length:16px_16px] bg-[right_8px_center] bg-no-repeat",style:{backgroundImage:`url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E")`},children:O.map(n=>e.jsx("option",{value:n.value,children:n.label},n.value))})]}),e.jsxs("div",{children:[e.jsx("label",{className:i.sectionTitle,children:"Note"}),e.jsx("input",{type:"text",value:N,onChange:n=>P(n.target.value),onKeyDown:n=>{n.key==="Enter"&&N.trim()&&!l.isPending&&l.mutate({toolName:w,note:N})},placeholder:"Reusable lesson or pattern...",className:i.input})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>l.mutate({toolName:w,note:N}),disabled:!N.trim()||l.isPending,className:i.primaryBtn,children:l.isPending?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(I,{size:"sm"})," Saving..."]}):"Save"}),e.jsx("button",{onClick:()=>{A(!1),P(""),j("unified")},disabled:l.isPending,className:i.secondaryBtn,children:"Cancel"})]})]}):e.jsx("button",{onClick:()=>A(!0),className:i.secondaryBtn,children:"+ Add Memory"}),L.size===0&&e.jsx("div",{className:i.settingsCard,children:e.jsx("p",{className:"text-sm text-[#666666]",children:"No memories yet. The agent will save notes here as it learns from tool usage."})}),[...L.entries()].map(([n,C])=>{const k=C.length>D;return e.jsxs("div",{className:i.settingsCard,children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("span",{className:`${i.badge} ${i.badgeVariants.info}`,children:n}),k&&e.jsxs("span",{className:"text-xs text-[#666666]",children:[C.length," memories"]}),e.jsx("button",{onClick:()=>r.mutate({toolName:n}),disabled:r.isPending||C.length===0,className:`ml-auto ${i.outlineBtn}`,title:"Optimize memories with AI",children:r.isPending&&r.variables?.toolName===n?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(I,{size:"sm"})," Optimizing..."]}):"Optimize"})]}),e.jsx("ul",{className:`space-y-2${k?" max-h-64 overflow-y-auto":""}`,children:C.map(M=>e.jsx(Ce,{memory:M,...R},M.id))})]},n)}),e.jsx(E,{open:x!==null,title:"Delete memory",message:"Delete this agent memory?",onConfirm:()=>{x!==null&&g.mutate({id:x}),y(null)},onCancel:()=>y(null)}),e.jsx(E,{open:d!==null,title:"Optimization Complete",message:d&&e.jsxs("div",{className:"space-y-1.5 text-sm text-[#444444]",children:[e.jsxs("p",{children:["Kept: ",e.jsx("span",{className:"font-medium",children:d.kept})]}),e.jsxs("p",{children:["Updated: ",e.jsx("span",{className:"font-medium",children:d.updated})]}),e.jsxs("p",{children:["Deleted: ",e.jsx("span",{className:"font-medium",children:d.deleted})]})]}),confirmLabel:"OK",cancelLabel:null,confirmStyle:"primary",onConfirm:()=>m(null),onCancel:()=>m(null)})]})}function we(){const s=u.useUtils(),{data:t,isLoading:o}=u.settings.getChatModel.useQuery(),a=u.settings.saveChatModel.useMutation({onSuccess:()=>s.settings.getChatModel.invalidate()}),{models:l,isLoading:c}=X();return o||!t?null:e.jsx(se,{value:t,models:l,loading:c,disabled:a.isPending,onChange:g=>a.mutate({provider:g.provider,modelId:g.modelId})})}const V=["Pacific/Auckland","Australia/Sydney","Asia/Tokyo","Asia/Shanghai","Asia/Kolkata","Asia/Dubai","Europe/Moscow","Europe/Berlin","UTC","Europe/London","America/Sao_Paulo","America/New_York","America/Chicago","America/Denver","America/Los_Angeles","Pacific/Honolulu"];function ne(s){try{const t=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"short"}).formatToParts(new Date).find(a=>a.type==="timeZoneName")?.value??"",o=new Intl.DateTimeFormat("en-US",{timeZone:s,timeZoneName:"shortOffset"}).formatToParts(new Date).find(a=>a.type==="timeZoneName")?.value??"";return`${t} (${o})`}catch{return s}}const ke=new Map(V.map(s=>[s,ne(s)]));function Ae(){const s=u.useUtils(),{data:t,isLoading:o}=u.settings.getAgentConfig.useQuery(),a=u.settings.saveAgentConfig.useMutation({onSuccess:()=>{s.settings.getAgentConfig.invalidate(),y(!1)}}),[l,c]=v.useState(""),[g,d]=v.useState(100),[m,r]=v.useState(50),[h,p]=v.useState(1024),[f,b]=v.useState(1e4),[x,y]=v.useState(!1);if(v.useEffect(()=>{t&&(c(t.timezone),d(t.directModeMaxSteps),r(t.subAgentMaxSteps),p(t.thinkingBudgetGoogle),b(t.thinkingBudgetAnthropic),y(!1))},[t]),o||!t)return null;const S=x&&(l!==t.timezone||g!==t.directModeMaxSteps||m!==t.subAgentMaxSteps||h!==t.thinkingBudgetGoogle||f!==t.thinkingBudgetAnthropic);function A(){a.mutate({timezone:l,directModeMaxSteps:g,subAgentMaxSteps:m,thinkingBudgetGoogle:h,thinkingBudgetAnthropic:f})}function w(){y(!0)}return e.jsxs("div",{className:"max-w-lg space-y-3",children:[e.jsxs("div",{className:i.settingsCard,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"Unified mode model"}),e.jsx("span",{className:"text-xs opacity-40",children:"used when chat scope is “ALL”"})]}),e.jsx(we,{})]}),e.jsxs("div",{className:i.settingsCard,children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Timezone"}),e.jsxs("select",{value:l,onChange:j=>{c(j.target.value),w()},className:"appearance-none bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-sans",children:[V.map(j=>e.jsx("option",{value:j,children:ke.get(j)??j},j)),!V.includes(l)&&e.jsx("option",{value:l,children:ne(l)})]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Direct mode max steps"}),e.jsx("input",{type:"number",min:1,max:500,value:g,onChange:j=>{d(Number(j.target.value)),w()},className:"w-20 bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-mono"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Sub-agent max steps"}),e.jsx("input",{type:"number",min:1,max:500,value:m,onChange:j=>{r(Number(j.target.value)),w()},className:"w-20 bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-mono"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Google thinking budget"}),e.jsx("input",{type:"number",min:0,max:1e5,step:256,value:h,onChange:j=>{p(Number(j.target.value)),w()},className:"w-24 bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-mono"}),e.jsx("span",{className:"text-[10px] text-[#9c9890]",children:"tokens"})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("label",{className:"text-xs text-[#666666] w-44 shrink-0",children:"Anthropic thinking budget"}),e.jsx("input",{type:"number",min:0,max:1e5,step:1e3,value:f,onChange:j=>{b(Number(j.target.value)),w()},className:"w-24 bg-white border border-[#d4d2cd] rounded px-3 py-1.5 text-xs text-[#2c2c2c] focus:outline-none focus:border-[#2b5ea7] font-mono"}),e.jsx("span",{className:"text-[10px] text-[#9c9890]",children:"tokens"})]})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-4 pt-3 border-t border-[#e8e6e1]",children:[e.jsx("button",{onClick:A,disabled:!S||a.isPending,className:i.primaryBtn,children:a.isPending?"Saving...":"Save"}),a.isSuccess&&!x&&e.jsx("span",{className:i.successText,children:"Saved"})]})]})]})}function Ie(){return e.jsxs("div",{className:i.page,children:[e.jsxs("div",{children:[e.jsx("h3",{className:i.sectionTitle,children:"LLM API Keys"}),e.jsx(pe,{})]}),e.jsxs("div",{children:[e.jsx("h3",{className:i.sectionTitle,children:"Data Providers"}),e.jsx(be,{})]}),e.jsxs("div",{children:[e.jsx("h3",{className:i.sectionTitle,children:"Integrations"}),e.jsx(Ne,{})]}),e.jsxs("div",{children:[e.jsx("h3",{className:i.sectionTitle,children:"Agent Configuration"}),e.jsx(Ae,{})]}),e.jsxs("div",{children:[e.jsx("h3",{className:i.sectionTitle,children:"Agent Memory"}),e.jsx(Se,{})]})]})}export{Ie as Settings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{R as p,L as x,A as d}from"./mermaid-GHXKKRXX
|
|
1
|
+
import{R as p,L as x,A as d}from"./mermaid-GHXKKRXX-fHfNJrVx.js";import{r,j as f}from"./index-BrLT4CJt.js";import"./SearchableSelect-cW8CAuj_.js";var j=({code:i,language:e,raw:t,className:m,startLine:u,lineNumbers:n,...g})=>{let{shikiTheme:o}=r.useContext(p),a=x(),[h,s]=r.useState(t);return r.useEffect(()=>{if(!a){s(t);return}let l=a.highlight({code:i,language:e,themes:o},c=>{s(c)});l&&s(l)},[i,e,o,a,t]),f.jsx(d,{className:m,language:e,lineNumbers:n,result:h,startLine:u,...g})};export{j as HighlightedCodeBlockBody};
|