@shawnstack/quickforge 1.7.5 → 1.7.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/assets/AgentProfilesPage-Dl5Peqov.js +1 -0
  2. package/dist/assets/ChatPanelHost-D3987TUJ.js +307 -0
  3. package/dist/assets/CloudAccountSettingsPage-BG5Nn3bq.js +1 -0
  4. package/dist/assets/PluginsPage-BDKYfLna.js +1 -0
  5. package/dist/assets/ScheduledTasksPage--GAki3lB.js +2 -0
  6. package/dist/assets/SettingsWorkspacePage-DSy66Tuw.js +1696 -0
  7. package/dist/assets/ShareLinksSettingsPage-BQQMsvJo.js +1 -0
  8. package/dist/assets/SharedConversationPage-B9BUVCri.js +1 -0
  9. package/dist/assets/TerminalDock-CT1nYo7P.js +2 -0
  10. package/dist/assets/{WorkspaceInspector-D9kdnLDd.js → WorkspaceInspector-BnfDLf9a.js} +5 -5
  11. package/dist/assets/{dist-DLKC_odd.js → dist-yDHbi5ux.js} +1 -1
  12. package/dist/assets/{esm-Df4edDpj.js → esm-sdsK6gaB.js} +2 -2
  13. package/dist/assets/{icons-CXPP1fFT.js → icons-2D18YbSI.js} +1 -1
  14. package/dist/assets/index-1ei6nhs-.css +3 -0
  15. package/dist/assets/index-BivLuZvX.js +65 -0
  16. package/dist/assets/{mcp-servers-dialog-BUSPvaqI.js → mcp-servers-dialog-BEV4_TXC.js} +2 -2
  17. package/dist/assets/{logger-8REuLPGK.js → model-display-label-C6-0eDxF.js} +1 -1
  18. package/dist/assets/{monaco-D6OhXgjg.js → monaco-DvXErxp2.js} +1 -1
  19. package/dist/assets/{react-vendor-1KC5PyRx.js → react-vendor-3UaA-C9W.js} +1 -1
  20. package/dist/assets/{skills-dialog-BThnIUBs.js → skills-dialog-BTJ7mzk_.js} +3 -3
  21. package/dist/assets/{web-DoV8MSMn.js → web-B5qgZJRv.js} +1 -1
  22. package/dist/index.html +8 -8
  23. package/dist/sw.js +17 -0
  24. package/package.json +2 -1
  25. package/runtime-assets/agent/darwin-arm64/qf-agent +0 -0
  26. package/runtime-assets/agent/darwin-x64/qf-agent +0 -0
  27. package/runtime-assets/agent/linux-arm64/qf-agent +0 -0
  28. package/runtime-assets/agent/linux-x64/qf-agent +0 -0
  29. package/runtime-assets/agent/win32-x64/qf-agent.exe +0 -0
  30. package/server/access-policy.mjs +11 -0
  31. package/server/agent-manager.mjs +349 -48
  32. package/server/agent-profiles.mjs +27 -8
  33. package/server/auto-compaction.mjs +35 -8
  34. package/server/cloud/client.mjs +4 -7
  35. package/server/cloud/config.mjs +6 -5
  36. package/server/cloud/credential-store.mjs +10 -3
  37. package/server/cloud/identity.mjs +17 -60
  38. package/server/cloud/models.mjs +1 -1
  39. package/server/cloud/qf-agent-process.mjs +571 -0
  40. package/server/cloud/runtime.mjs +11 -5
  41. package/server/cloud/service-config.mjs +8 -4
  42. package/server/index.mjs +96 -37
  43. package/server/mcp/registry.mjs +8 -7
  44. package/server/message-converters.mjs +40 -19
  45. package/server/model-catalog.mjs +11 -4
  46. package/server/opencode-acp-agent.mjs +1151 -0
  47. package/server/public-api.mjs +11 -5
  48. package/server/routes/agent-profiles.mjs +6 -3
  49. package/server/routes/agent.mjs +43 -3
  50. package/server/routes/backup.mjs +5 -4
  51. package/server/routes/cloud.mjs +54 -35
  52. package/server/routes/shares.mjs +7 -8
  53. package/server/routes/storage.mjs +9 -24
  54. package/server/routes/system.mjs +7 -4
  55. package/server/utils/process-tree.mjs +78 -0
  56. package/dist/assets/AgentProfilesPage-XNjuqJs7.js +0 -1
  57. package/dist/assets/ChatPanelHost-CuF-PZpc.js +0 -292
  58. package/dist/assets/CloudAccountSettingsPage-GJSoi6sO.js +0 -1
  59. package/dist/assets/PluginsPage-BQgp0qN-.js +0 -1
  60. package/dist/assets/ScheduledTasksPage-DdekATzq.js +0 -2
  61. package/dist/assets/SettingsWorkspacePage-Cb54Ic91.js +0 -1639
  62. package/dist/assets/ShareLinksSettingsPage-C75WJpaF.js +0 -1
  63. package/dist/assets/SharedConversationPage-CjMtSQTW.js +0 -1
  64. package/dist/assets/TerminalDock-D4zJBJc4.js +0 -2
  65. package/dist/assets/index-_ZhK6bvp.js +0 -65
  66. package/dist/assets/index-iVV2bP_f.css +0 -3
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,Nt as n,Rt as r,Wt as i,d as a,mt as o,qt as s,s as ee}from"./icons-2D18YbSI.js";import{i as c,n as l}from"./react-vendor-3UaA-C9W.js";import{t as u}from"./model-display-label-C6-0eDxF.js";import{n as d,t as te}from"./model-reference-o41fJ6jQ.js";import{$t as ne,Qt as re,Tt as ie,at as ae,fn as f,ln as p,mn as m,nn as oe,tn as se,yn as h}from"./index-BivLuZvX.js";import{i as ce,r as le,t as ue}from"./model-identity-CgA6_Pbm.js";var g=e(s(),1),de=c(),_=l(),fe=144,pe=82,me=4,v=8;function y(e){return JSON.stringify(d(e))}function b(e){if(!e)return{mode:`inherit`};try{return{mode:`fixed`,...JSON.parse(e)}}catch{return{mode:`inherit`}}}function x(e){return!e||e.mode!==`fixed`?``:e.source===`cloud`?JSON.stringify({version:1,source:`cloud`,catalogId:e.catalogId}):e.source===`custom`?JSON.stringify({version:1,source:`custom`,providerId:e.providerId,modelId:e.modelId}):JSON.stringify({version:1,source:`legacy-custom`,provider:e.provider,modelId:e.modelId,...e.api?{api:e.api}:{},...e.baseUrl?{baseUrl:e.baseUrl}:{}})}function S(){return{name:``,label:``,description:``,systemPrompt:``,allowedTools:[`read_file`,`grep_files`],maxRuntimeMs:`3600000`,maxToolCalls:`300`,enabledAsSubagent:!0,modelMode:`inherit`,fixedModelValue:``,thinkingLevel:`inherit`}}function he(e){return{name:e.name,label:e.label,description:e.description??``,systemPrompt:e.systemPrompt??``,allowedTools:e.allowedTools??[],maxRuntimeMs:String(e.maxRuntimeMs??36e5),maxToolCalls:String(e.maxToolCalls??300),enabledAsSubagent:e.enabledAsSubagent,modelMode:e.model?.mode===`fixed`?`fixed`:`inherit`,fixedModelValue:x(e.model),thinkingLevel:e.thinkingLevel??`inherit`}}function ge(e){return{name:e.name.trim().toLowerCase(),label:e.label.trim(),description:e.description.trim(),systemPrompt:e.systemPrompt.trim(),allowedTools:e.allowedTools,maxRuntimeMs:Number(e.maxRuntimeMs||36e5),maxToolCalls:Number(e.maxToolCalls||300),enabledAsSubagent:e.enabledAsSubagent,model:e.modelMode===`fixed`?b(e.fixedModelValue):{mode:`inherit`},thinkingLevel:e.thinkingLevel}}function C(e){return!!(e.name.trim()&&e.label.trim()&&e.allowedTools.length>0)}async function w(e,t){let n=await fetch(e,{...t,headers:{"content-type":`application/json`,...t?.headers}}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||`请求失败`);return r}function T(){let[e,s]=(0,g.useState)([]),[c,l]=(0,g.useState)([]),[T,E]=(0,g.useState)(!1),[D,O]=(0,g.useState)(null),[k,A]=(0,g.useState)(()=>S()),[j,M]=(0,g.useState)(!1),[N,P]=(0,g.useState)(``),[F,I]=(0,g.useState)(!1),[L,_e]=(0,g.useState)(),[R,ve]=(0,g.useState)([]),[ye,be]=(0,g.useState)(`off`),[z,B]=(0,g.useState)(``),[V,H]=(0,g.useState)(null),[U,W]=(0,g.useState)(null);async function xe(){let[e,t]=await Promise.all([w(`/api/agent-profiles`),w(`/api/agent-profiles/available-tools`)]);s(e.agents),l(t.tools)}(0,g.useEffect)(()=>{let e=!1;async function t(){try{let[t,n]=await Promise.all([w(`/api/agent-profiles`),w(`/api/agent-profiles/available-tools`)]);if(e)return;s(t.agents),l(n.tools)}catch(t){e||B(t instanceof Error?t.message:h(`requestFailed`))}}return t(),()=>{e=!0}},[]),(0,g.useEffect)(()=>{let e=!1;async function t(){try{let t=await se(),[n,r]=await Promise.all([ne(t),te().catch(()=>[])]),i=r.length?r:n;ve(i);let a=i.filter(p),o=await oe(t),s=(o.model&&p(o.model)?a.find(e=>ce(e,o.model)):void 0)??a[0];if(e)return;_e(s),be(o.thinkingLevel??re(s))}catch{}}return t(),()=>{e=!0}},[]),(0,g.useEffect)(()=>{if(!V)return;let e=()=>{H(null),W(null)},t=t=>{t.key===`Escape`&&e()};return window.addEventListener(`click`,e),window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),window.addEventListener(`scroll`,e,!0),document.addEventListener(`keydown`,t),()=>{window.removeEventListener(`click`,e),window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e),window.removeEventListener(`scroll`,e,!0),document.removeEventListener(`keydown`,t)}},[V]);let G=(0,g.useMemo)(()=>e.find(e=>e.id===D)??null,[e,D]),K=(0,g.useMemo)(()=>e.find(e=>e.id===V)??null,[e,V]),q=!!G?.readonly,J=!!(G?.readonly&&!G?.builtin),Y=(0,g.useMemo)(()=>{let e=b(k.fixedModelValue);if(e.mode!==`fixed`)return;let t=x(e);return R.find(e=>y(e)===t)??(`provider`in e?R.find(t=>le(t,e)):void 0)},[k.fixedModelValue,R]),Se=(0,g.useMemo)(()=>R.filter(p),[R]),Ce=(0,g.useMemo)(()=>ue(Se,Y),[Se,Y]),we=Y?y(Y):k.fixedModelValue,X=k.modelMode===`fixed`&&!!Y&&Y?.reasoning!==!0;function Te(e,t){if(e.stopPropagation(),V===t){H(null),W(null);return}let n=e.currentTarget.getBoundingClientRect(),r=Math.max(v,Math.min(n.right-fe,window.innerWidth-fe-v)),i=n.bottom+me,a=n.top-me-pe;W({left:r,top:i+pe<=window.innerHeight-v?i:Math.max(v,a)}),H(t)}function Z(e,t){A(n=>({...n,[e]:t}))}function Ee(e){ae(Y??null,Ce,e=>Z(`fixedModelValue`,e?y(e):``),{anchor:e.currentTarget,noneLabel:h(`agentModelInherit`)})}function De(e){A(t=>({...t,allowedTools:t.allowedTools.includes(e)?t.allowedTools.filter(t=>t!==e):[...t.allowedTools,e]}))}function Oe(){O(null),A(S()),P(``),B(``),E(!0)}function Q(e){O(e.id),A(he(e)),P(``),B(``),E(!0)}function $(){j||F||(E(!1),O(null),A(S()),P(``))}async function ke(){let e=N.trim();if(!e){B(h(`aiFillAgentInputRequired`));return}if(!L){B(h(`aiFillAgentNoModel`));return}I(!0),B(``);try{let t=await w(`/api/agent-profiles/ai-fill`,{method:`POST`,body:JSON.stringify({instruction:e,modelRef:d(L),model:L,thinkingLevel:ye})});A(e=>({...e,name:t.agent.name,label:t.agent.label,description:t.agent.description,systemPrompt:t.agent.systemPrompt}))}catch(e){B(e instanceof Error?e.message:h(`aiFillAgentFailed`))}finally{I(!1)}}async function Ae(){if(!C(k))return;M(!0),B(``);let e=X&&k.thinkingLevel!==`inherit`?`off`:k.thinkingLevel;try{let t=G?.builtin?{model:k.modelMode===`fixed`?b(k.fixedModelValue):{mode:`inherit`},thinkingLevel:e}:ge({...k,thinkingLevel:e});D?await w(`/api/agent-profiles/${encodeURIComponent(D)}`,{method:`PATCH`,body:JSON.stringify(t)}):await w(`/api/agent-profiles`,{method:`POST`,body:JSON.stringify(t)}),$(),await xe()}catch(e){B(e instanceof Error?e.message:h(`requestFailed`))}finally{M(!1)}}async function je(e){if(e.builtin||e.readonly)return;let t=!e.enabledAsSubagent,n=e.enabledAsSubagent;s(n=>n.map(n=>n.id===e.id?{...n,enabledAsSubagent:t}:n)),H(null);try{await w(`/api/agent-profiles/${encodeURIComponent(e.id)}`,{method:`PATCH`,body:JSON.stringify({enabledAsSubagent:t})})}catch(t){s(t=>t.map(t=>t.id===e.id?{...t,enabledAsSubagent:n}:t)),B(t instanceof Error?t.message:h(`requestFailed`))}}async function Me(e){if(!(e.builtin||e.readonly)&&await ie({description:h(`confirmDeleteAgent`),confirmLabel:h(`confirmDelete`),cancelLabel:h(`cancel`),variant:`destructive`})){B(``);try{await w(`/api/agent-profiles/${encodeURIComponent(e.id)}`,{method:`DELETE`}),await xe()}catch(e){B(e instanceof Error?e.message:h(`requestFailed`))}}}return T?(0,_.jsxs)(`div`,{className:`quickforge-settings-stack`,children:[(0,_.jsx)(`div`,{className:`quickforge-settings-heading`,children:(0,_.jsxs)(`h3`,{className:`quickforge-settings-title`,children:[G?.builtin?h(`builtinAgentModelSettings`):h(G?`editAgent`:`createAgent`),(0,_.jsx)(f,{label:G?.builtin?h(`builtinAgentModelOnly`):G?.readonly?h(`readonlyAgentDescription`):h(`agentsDescription`)})]})}),(0,_.jsxs)(`section`,{className:`quickforge-settings-section`,"aria-label":h(G?`editAgent`:`createAgent`),children:[(0,_.jsxs)(`div`,{className:`quickforge-settings-toolbar`,children:[(0,_.jsxs)(`button`,{className:`quickforge-settings-button quickforge-settings-button-secondary`,type:`button`,onClick:$,disabled:j||F,children:[(0,_.jsx)(i,{className:`mr-2 size-4`}),h(`back`)]}),(0,_.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,_.jsx)(`div`,{className:`quickforge-settings-row-title`,children:G?.builtin?h(`builtinAgentModelSettings`):h(G?`editAgent`:`createAgent`)}),G?.builtin?(0,_.jsx)(`div`,{className:`quickforge-settings-row-description`,children:h(`builtinAgentModelOnly`)}):G?.readonly?(0,_.jsx)(`div`,{className:`quickforge-settings-row-description`,children:h(`readonlyAgentDescription`)}):null]})]}),(0,_.jsx)(`div`,{className:`px-5 py-4`,children:(0,_.jsxs)(`div`,{className:`space-y-4`,children:[(0,_.jsxs)(`div`,{className:`rounded-2xl border border-border bg-muted/20 p-3`,children:[(0,_.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-sm font-medium text-foreground`,children:[(0,_.jsx)(a,{className:`size-4 text-primary`}),h(`aiFillAgent`),(0,_.jsx)(f,{label:h(`aiFillAgentDescription`)})]}),(0,_.jsx)(`textarea`,{className:`min-h-20 w-full resize-y rounded-xl border border-input bg-background px-3 py-2 text-sm outline-none transition-colors placeholder:text-muted-foreground/65 focus:border-ring disabled:opacity-60`,value:N,disabled:q||F,onChange:e=>P(e.target.value),placeholder:h(`aiFillAgentPlaceholder`)}),(0,_.jsx)(`div`,{className:`mt-2 flex justify-end`,children:(0,_.jsxs)(m,{variant:`outline`,size:`sm`,onClick:()=>void ke(),disabled:q||F||!N.trim(),children:[(0,_.jsx)(a,{className:`mr-1 size-3.5`}),h(F?`aiFillAgentLoading`:`aiFillAgent`)]})})]}),(0,_.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,_.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[h(`agentName`),(0,_.jsx)(`input`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:k.name,disabled:q,onChange:e=>Z(`name`,e.target.value),placeholder:`reviewer`})]}),(0,_.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[h(`agentLabel`),(0,_.jsx)(`input`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:k.label,disabled:q,onChange:e=>Z(`label`,e.target.value),placeholder:h(`agentLabelPlaceholder`)})]})]}),G?(0,_.jsxs)(`div`,{className:`rounded-xl border border-border bg-muted/20 px-3 py-2 text-sm`,children:[(0,_.jsx)(`div`,{className:`text-xs font-medium text-muted-foreground`,children:h(`agentSourcePath`)}),(0,_.jsx)(`div`,{className:`mt-1 truncate font-mono text-xs text-foreground`,title:G.source?`${G.source}${G.relativePath?` · ${G.relativePath}`:``}`:void 0,children:G.source?`${G.source}${G.relativePath?` · ${G.relativePath}`:``}`:G.builtin?h(`builtinAgent`):`-`})]}):null,(0,_.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[h(`agentDescription`),(0,_.jsx)(`input`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:k.description,disabled:q,onChange:e=>Z(`description`,e.target.value)})]}),(0,_.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[h(`agentSystemPrompt`),(0,_.jsx)(`textarea`,{className:`mt-1 min-h-36 w-full resize-y rounded-xl border border-input bg-background px-3 py-2 text-sm outline-none focus:border-ring disabled:opacity-60`,value:k.systemPrompt,disabled:q,onChange:e=>Z(`systemPrompt`,e.target.value)})]}),(0,_.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,_.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[h(`agentModelMode`),(0,_.jsxs)(`select`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:k.modelMode,disabled:J,onChange:e=>Z(`modelMode`,e.target.value),children:[(0,_.jsx)(`option`,{value:`inherit`,children:h(`agentModelInherit`)}),(0,_.jsx)(`option`,{value:`fixed`,children:h(`agentModelFixed`)})]})]}),(0,_.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[h(`agentFixedModel`),(0,_.jsxs)(`select`,{className:`quickforge-model-select-desktop mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:we,disabled:J||k.modelMode!==`fixed`,onChange:e=>Z(`fixedModelValue`,e.target.value),children:[(0,_.jsx)(`option`,{value:``,children:h(`agentModelInherit`)}),Ce.map(e=>(0,_.jsx)(`option`,{value:y(e),children:u(e)},y(e)))]}),(0,_.jsxs)(`button`,{type:`button`,className:`quickforge-model-select-mobile mt-1 flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 text-sm text-left outline-none focus:border-ring disabled:opacity-60`,disabled:J||k.modelMode!==`fixed`,onClick:Ee,children:[(0,_.jsx)(`span`,{className:`truncate`,children:Y?u(Y):h(`agentModelInherit`)}),(0,_.jsx)(n,{className:`ml-2 size-4 shrink-0 text-muted-foreground`})]})]})]}),(0,_.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[h(`agentThinkingLevel`),(0,_.jsxs)(`select`,{className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:X&&k.thinkingLevel!==`inherit`?`off`:k.thinkingLevel,disabled:J||X,onChange:e=>Z(`thinkingLevel`,e.target.value),children:[(0,_.jsx)(`option`,{value:`inherit`,children:h(`agentThinkingInherit`)}),(0,_.jsx)(`option`,{value:`off`,children:h(`thinkingOff`)}),(0,_.jsx)(`option`,{value:`low`,children:h(`thinkingLow`)}),(0,_.jsx)(`option`,{value:`medium`,children:h(`thinkingMedium`)}),(0,_.jsx)(`option`,{value:`high`,children:h(`thinkingHigh`)}),(0,_.jsx)(`option`,{value:`xhigh`,children:h(`thinkingXHigh`)})]}),(0,_.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:h(X?`agentThinkingUnsupported`:`agentThinkingDescription`)})]}),(0,_.jsxs)(`div`,{children:[(0,_.jsx)(`div`,{className:`mb-2 text-sm font-medium text-foreground`,children:h(`allowedTools`)}),(0,_.jsx)(`div`,{className:`grid gap-2 sm:grid-cols-2`,children:c.map(e=>(0,_.jsxs)(`label`,{className:`flex items-start gap-2 rounded-xl border border-border bg-muted/20 p-3 text-sm disabled:opacity-60`,children:[(0,_.jsx)(`input`,{type:`checkbox`,className:`mt-1`,disabled:q,checked:k.allowedTools.includes(e.name),onChange:()=>De(e.name)}),(0,_.jsxs)(`span`,{children:[(0,_.jsx)(`span`,{className:`font-medium text-foreground`,children:e.label}),(0,_.jsx)(`span`,{className:`ml-2 font-mono text-xs text-muted-foreground`,children:e.name}),e.riskLevel===`dangerous`?(0,_.jsx)(`span`,{className:`ml-2 rounded-full bg-amber-500/10 px-2 py-0.5 text-xs text-amber-700`,children:h(`highRiskTool`)}):null,(0,_.jsx)(`span`,{className:`mt-1 block text-xs text-muted-foreground`,children:e.description})]})]},e.name))})]}),(0,_.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,_.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[h(`maxRuntimeMs`),(0,_.jsx)(`input`,{type:`number`,className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:k.maxRuntimeMs,disabled:q,onChange:e=>Z(`maxRuntimeMs`,e.target.value)})]}),(0,_.jsxs)(`label`,{className:`block text-sm font-medium text-foreground`,children:[h(`maxToolCalls`),(0,_.jsx)(`input`,{type:`number`,className:`mt-1 h-10 w-full rounded-md border border-input bg-background px-3 text-sm outline-none focus:border-ring disabled:opacity-60`,value:k.maxToolCalls,disabled:q,onChange:e=>Z(`maxToolCalls`,e.target.value)})]})]}),(0,_.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-foreground`,children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:k.enabledAsSubagent,disabled:q,onChange:e=>Z(`enabledAsSubagent`,e.target.checked)}),h(`enabledAsSubagent`)]}),z?(0,_.jsx)(`div`,{className:`rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive`,children:z}):null]})}),(0,_.jsxs)(`div`,{className:`quickforge-settings-divider flex justify-end gap-2 px-5 py-4`,children:[(0,_.jsx)(m,{variant:`outline`,onClick:$,disabled:j||F,children:h(`cancel`)}),(0,_.jsx)(m,{onClick:Ae,disabled:j||F||J||!G?.builtin&&!C(k)||k.modelMode===`fixed`&&!k.fixedModelValue,children:h(`save`)})]})]})]}):(0,_.jsxs)(`div`,{className:`quickforge-settings-stack`,children:[(0,_.jsxs)(`section`,{className:`quickforge-settings-section`,"aria-label":h(`agentsTab`),children:[(0,_.jsxs)(`div`,{className:`quickforge-settings-toolbar`,children:[(0,_.jsxs)(`div`,{className:`quickforge-settings-row-main`,children:[(0,_.jsxs)(`div`,{className:`quickforge-settings-row-title`,children:[(0,_.jsx)(r,{className:`size-4 text-primary`}),h(`agentsTab`)]}),(0,_.jsx)(`div`,{className:`quickforge-settings-row-description`,children:h(`agentsDescription`)})]}),(0,_.jsx)(`button`,{className:`quickforge-settings-button quickforge-settings-button-primary`,type:`button`,onClick:Oe,children:h(`createAgent`)})]}),z?(0,_.jsx)(`div`,{className:`quickforge-settings-alert quickforge-settings-warning-attached`,children:z}):null,e.length===0?(0,_.jsx)(`div`,{className:`quickforge-settings-empty-row`,children:h(`loading`)}):e.map(e=>(0,_.jsxs)(`div`,{className:`quickforge-settings-list-item quickforge-agent-profile-row`,role:`button`,tabIndex:0,onClick:()=>Q(e),onKeyDown:t=>{t.target===t.currentTarget&&(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),Q(e))},children:[(0,_.jsx)(`div`,{className:`quickforge-settings-list-item-main quickforge-agent-profile-row-main`,children:(0,_.jsxs)(`div`,{className:`quickforge-agent-profile-summary`,children:[(0,_.jsx)(`span`,{className:`quickforge-agent-profile-label`,title:e.label,children:e.label}),e.description?(0,_.jsx)(`span`,{className:`quickforge-agent-profile-description`,title:e.description,children:e.description}):null]})}),(0,_.jsxs)(`div`,{className:`quickforge-settings-list-item-actions`,onClick:e=>e.stopPropagation(),children:[(0,_.jsxs)(`label`,{className:`quickforge-settings-switch`,"aria-disabled":e.builtin||e.readonly?`true`:`false`,title:e.enabledAsSubagent?h(`disableAsSubagent`):h(`enableAsSubagent`),children:[(0,_.jsx)(`input`,{type:`checkbox`,checked:e.enabledAsSubagent,disabled:e.builtin||e.readonly,onChange:()=>void je(e)}),(0,_.jsx)(`span`,{"aria-hidden":`true`})]}),(0,_.jsx)(`button`,{className:`quickforge-settings-icon-action`,type:`button`,onClick:t=>Te(t,e.id),title:h(`moreActions`),"aria-label":h(`moreActions`),"aria-haspopup":`menu`,"aria-expanded":V===e.id,children:(0,_.jsx)(o,{className:`size-4`})})]})]},e.id))]}),K&&U?(0,de.createPortal)((0,_.jsxs)(`div`,{className:`fixed z-50 w-36 overflow-hidden rounded-xl border border-border bg-popover py-1 text-sm shadow-quickforge`,style:{left:U.left,top:U.top},role:`menu`,"aria-label":h(`moreActions`),onClick:e=>e.stopPropagation(),children:[(0,_.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,type:`button`,role:`menuitem`,disabled:K.readonly&&!K.builtin,onClick:()=>{H(null),W(null),Q(K)},children:[(0,_.jsx)(t,{className:`size-3.5`}),K.builtin?h(`builtinAgentModelSettings`):h(`editTask`)]}),(0,_.jsxs)(`button`,{className:`flex w-full items-center gap-2 px-3 py-2 text-left text-destructive hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50`,type:`button`,role:`menuitem`,disabled:K.builtin||K.readonly,onClick:()=>{H(null),W(null),Me(K)},children:[(0,_.jsx)(ee,{className:`size-3.5`}),h(`delete`)]})]}),document.body):null]})}export{T as AgentProfilesPage};