@runfusion/fusion 0.54.0 → 0.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/bin.js +9137 -2087
  2. package/dist/client/.vite/manifest.json +364 -332
  3. package/dist/client/assets/AgentDetailView-BPzzEIn1.js +18 -0
  4. package/dist/client/assets/{AgentDetailView-BzSyldiW.css → AgentDetailView-D7UY2Tup.css} +1 -1
  5. package/dist/client/assets/{AgentPermissionPolicyEditor-D2AQ6swg.js → AgentPermissionPolicyEditor-CqlLF0pf.js} +1 -1
  6. package/dist/client/assets/{AgentsView-DwEFPKuN.js → AgentsView-C4uCWzdt.js} +3 -3
  7. package/dist/client/assets/ChatView-BGV9F2K0.js +6 -0
  8. package/dist/client/assets/{CommandCenter-BABqoSkg.js → CommandCenter-BhIfVVjz.js} +16 -16
  9. package/dist/client/assets/{DevServerView-DlgOzRdC.js → DevServerView-Bd86MWUa.js} +1 -1
  10. package/dist/client/assets/DirectoryPicker-BDe9G84f.js +1 -0
  11. package/dist/client/assets/DocumentsView-BkAHMt19.js +1 -0
  12. package/dist/client/assets/{EvalsView-CQBNrO5n.js → EvalsView-BxxCVaJ8.js} +1 -1
  13. package/dist/client/assets/{ExperimentalAgentOnboardingModal-2SDqP2lc.js → ExperimentalAgentOnboardingModal-7-BD6W1v.js} +1 -1
  14. package/dist/client/assets/{GoalsView-BgkX-_SB.js → GoalsView-B3KICwNu.js} +1 -1
  15. package/dist/client/assets/{InsightsView-CJY4eZcO.js → InsightsView-DO8qefU1.js} +2 -2
  16. package/dist/client/assets/{MemoryView-5Crtfanz.js → MemoryView-urkPdqTn.js} +1 -1
  17. package/dist/client/assets/{PiExtensionsManager-COmzskVa.js → PiExtensionsManager-BwVKjJIo.js} +2 -2
  18. package/dist/client/assets/PluginManager-C-OuqDLa.js +1 -0
  19. package/dist/client/assets/{PullRequestView-DAHh0FVM.js → PullRequestView-B4q4X5WV.js} +2 -2
  20. package/dist/client/assets/{ResearchView-cSUka3sd.js → ResearchView-DlW6z3sm.js} +1 -1
  21. package/dist/client/assets/{SecretsView-ChFAfFRY.js → SecretsView-C-3eC0KB.js} +1 -1
  22. package/dist/client/assets/{SessionTerminal-D4R3ScvQ.css → SessionTerminal-BvK8A98c.css} +1 -1
  23. package/dist/client/assets/SessionTerminal-DVfyVeS2.js +2 -0
  24. package/dist/client/assets/SettingsModal-BC_2Y56_.css +1 -0
  25. package/dist/client/assets/{SettingsModal-pAz_hOoN.js → SettingsModal-BzXctrhu.js} +1 -1
  26. package/dist/client/assets/SettingsModal-qs8w3rov.js +21 -0
  27. package/dist/client/assets/SetupWizardModal-DDJ8PCkH.js +2 -0
  28. package/dist/client/assets/{ShadcnColorPicker-CsfgWpf6.js → ShadcnColorPicker-BcD5fZ_P.js} +1 -1
  29. package/dist/client/assets/{SkillsView-BSUplEYb.js → SkillsView-DojlvxFh.js} +1 -1
  30. package/dist/client/assets/TodoView-BKZ07WxZ.js +6 -0
  31. package/dist/client/assets/WorkflowNodeEditor-BJNbi4_V.js +8 -0
  32. package/dist/client/assets/{agentSkills-qVb0x_G3.js → agentSkills-NbIIJy87.js} +1 -1
  33. package/dist/client/assets/app-0jcSCRQr.js +13 -0
  34. package/dist/client/assets/app-BPzPEE6G.js +13 -0
  35. package/dist/client/assets/app-BSZU5Uns.js +13 -0
  36. package/dist/client/assets/app-CEtD1B9K.js +13 -0
  37. package/dist/client/assets/app-CVyRSEUX.js +13 -0
  38. package/dist/client/assets/app-DoLz_4Dg.js +13 -0
  39. package/dist/client/assets/{architectureDiagram-3BPJPVTR-DEt4eIEQ.js → architectureDiagram-3BPJPVTR-CJu9RVXs.js} +1 -1
  40. package/dist/client/assets/{blockDiagram-GPEHLZMM-CJuX0UM_.js → blockDiagram-GPEHLZMM-crZsLLTq.js} +1 -1
  41. package/dist/client/assets/{c4Diagram-AAUBKEIU-a46Lm113.js → c4Diagram-AAUBKEIU-D5mmJKvW.js} +1 -1
  42. package/dist/client/assets/channel-Zfk0yRN2.js +1 -0
  43. package/dist/client/assets/{chunk-2J33WTMH-iBhwyS0c.js → chunk-2J33WTMH-BZIDltTX.js} +1 -1
  44. package/dist/client/assets/{chunk-4BX2VUAB-C7lS5wER.js → chunk-4BX2VUAB-ND_SzhUa.js} +1 -1
  45. package/dist/client/assets/{chunk-55IACEB6-CQ6YOncn.js → chunk-55IACEB6-C3n-Nisk.js} +1 -1
  46. package/dist/client/assets/{chunk-727SXJPM-CveMaMKK.js → chunk-727SXJPM-DfiPA7wv.js} +1 -1
  47. package/dist/client/assets/{chunk-AQP2D5EJ-DErjGUEk.js → chunk-AQP2D5EJ-CDE0u57Z.js} +1 -1
  48. package/dist/client/assets/{chunk-FMBD7UC4-DXUvEFfJ.js → chunk-FMBD7UC4-COR53PTE.js} +1 -1
  49. package/dist/client/assets/{chunk-ND2GUHAM-w5RqSj1J.js → chunk-ND2GUHAM-CbcTdl7C.js} +1 -1
  50. package/dist/client/assets/{chunk-QZHKN3VN-CAi0lJ7V.js → chunk-QZHKN3VN-DiB3PReK.js} +1 -1
  51. package/dist/client/assets/classDiagram-4FO5ZUOK-BehQ-wnv.js +1 -0
  52. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-BehQ-wnv.js +1 -0
  53. package/dist/client/assets/{cose-bilkent-S5V4N54A-Ck2h4uV5.js → cose-bilkent-S5V4N54A-Dg3YVyLX.js} +1 -1
  54. package/dist/client/assets/createLucideIcon-CshVyKO4.js +21 -0
  55. package/dist/client/assets/{dagre-BM42HDAG-BCRTXNj6.js → dagre-BM42HDAG-D2bK3gNb.js} +1 -1
  56. package/dist/client/assets/dashboard-view-BcbTWSCe.js +1 -0
  57. package/dist/client/assets/dashboard-view-Bsdq3OM4.css +1 -0
  58. package/dist/client/assets/dashboard-view-DafOfnxI.js +1 -0
  59. package/dist/client/assets/{dashboard-view-D9rF_PCq.js → dashboard-view-t2UfQxck.js} +1320 -1335
  60. package/dist/client/assets/{diagram-2AECGRRQ-DTTk-DYO.js → diagram-2AECGRRQ-BWT8KaEl.js} +1 -1
  61. package/dist/client/assets/{diagram-5GNKFQAL-jDc9kMi2.js → diagram-5GNKFQAL-DWfJlASD.js} +1 -1
  62. package/dist/client/assets/{diagram-KO2AKTUF-CcLmzlGr.js → diagram-KO2AKTUF-DE3hFbLT.js} +1 -1
  63. package/dist/client/assets/{diagram-LMA3HP47-DCW8XKQj.js → diagram-LMA3HP47-CYCFeD4B.js} +1 -1
  64. package/dist/client/assets/{diagram-OG6HWLK6-wbbKquPs.js → diagram-OG6HWLK6-C0C8lEGv.js} +1 -1
  65. package/dist/client/assets/{erDiagram-TEJ5UH35-Fo933Mo7.js → erDiagram-TEJ5UH35-kSo7RjKA.js} +1 -1
  66. package/dist/client/assets/{flowDiagram-I6XJVG4X-Dfum7HZP.js → flowDiagram-I6XJVG4X-DxRf1SVH.js} +1 -1
  67. package/dist/client/assets/{folder-open-B8vOwFeP.js → folder-open-DO1rnCxq.js} +1 -1
  68. package/dist/client/assets/{ganttDiagram-6RSMTGT7-BzEBCn01.js → ganttDiagram-6RSMTGT7-CGtxSeWq.js} +1 -1
  69. package/dist/client/assets/{gitGraphDiagram-PVQCEYII-CgovghHs.js → gitGraphDiagram-PVQCEYII-BNZv_DFY.js} +1 -1
  70. package/dist/client/assets/index-BCf32Sgx.css +1 -0
  71. package/dist/client/assets/index-D7eX7QJk.js +2511 -0
  72. package/dist/client/assets/{infoDiagram-5YYISTIA-BzpU4Wys.js → infoDiagram-5YYISTIA-DailohMo.js} +1 -1
  73. package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-cpp5pozu.js → ishikawaDiagram-YF4QCWOH-Cy3shDZP.js} +1 -1
  74. package/dist/client/assets/{journeyDiagram-JHISSGLW-BVjcw6oo.js → journeyDiagram-JHISSGLW-B1rU18Qx.js} +1 -1
  75. package/dist/client/assets/{kanban-definition-UN3LZRKU-4unAhBzo.js → kanban-definition-UN3LZRKU-CRNUDgkO.js} +1 -1
  76. package/dist/client/assets/loader-circle-CMNcxXXr.js +16 -0
  77. package/dist/client/assets/{mermaid.core-DzIyUj9t.js → mermaid.core-Cg0po76i.js} +4 -4
  78. package/dist/client/assets/{mindmap-definition-RKZ34NQL-Be_yfVir.js → mindmap-definition-RKZ34NQL-CEjwlhOe.js} +1 -1
  79. package/dist/client/assets/{pieDiagram-4H26LBE5-Cfnw2aji.js → pieDiagram-4H26LBE5-70T-php2.js} +1 -1
  80. package/dist/client/assets/{quadrantDiagram-W4KKPZXB-BFlC-_Uo.js → quadrantDiagram-W4KKPZXB-ChcpRG7l.js} +1 -1
  81. package/dist/client/assets/{requirementDiagram-4Y6WPE33-DpVPzCOx.js → requirementDiagram-4Y6WPE33-9Pzb_Cot.js} +1 -1
  82. package/dist/client/assets/{sankeyDiagram-5OEKKPKP-DM-gKKP0.js → sankeyDiagram-5OEKKPKP-Bx6DkeKq.js} +1 -1
  83. package/dist/client/assets/{sequenceDiagram-3UESZ5HK-DjhZCZhd.js → sequenceDiagram-3UESZ5HK-emWPkPv7.js} +1 -1
  84. package/dist/client/assets/{shield-alert-DCfkjjYc.js → shield-alert-BdAjnDkU.js} +1 -1
  85. package/dist/client/assets/{stateDiagram-AJRCARHV-BCA96rdI.js → stateDiagram-AJRCARHV-B_X2-VQy.js} +1 -1
  86. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-DvQssSEq.js +1 -0
  87. package/dist/client/assets/{timeline-definition-PNZ67QCA-CHW2OQRw.js → timeline-definition-PNZ67QCA-CkyhunuI.js} +1 -1
  88. package/dist/client/assets/{upload-EJc5PJPz.js → upload-D9-yuO2D.js} +1 -1
  89. package/dist/client/assets/{users-C-e-99Vp.js → users-B4aebngl.js} +1 -1
  90. package/dist/client/assets/{vennDiagram-CIIHVFJN-shGh4eBY.js → vennDiagram-CIIHVFJN-8OGD6Vb7.js} +1 -1
  91. package/dist/client/assets/{wardley-L42UT6IY-l0RGrVhn.js → wardley-L42UT6IY-MnRFGNPm.js} +1 -1
  92. package/dist/client/assets/{wardleyDiagram-YWT4CUSO-C-USmO8A.js → wardleyDiagram-YWT4CUSO-BAEzb08c.js} +1 -1
  93. package/dist/client/assets/{xychartDiagram-2RQKCTM6-CHX9Umta.js → xychartDiagram-2RQKCTM6-DUxideKC.js} +1 -1
  94. package/dist/client/assets/zoom-out-DzDzWQt1.js +21 -0
  95. package/dist/client/index.html +14 -5
  96. package/dist/client/version.json +1 -1
  97. package/dist/droid-cli/package.json +1 -1
  98. package/dist/extension.js +6720 -1170
  99. package/dist/pi-claude-cli/package.json +1 -1
  100. package/dist/plugin-sdk/index.d.ts +108 -4
  101. package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
  102. package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
  103. package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
  104. package/dist/plugins/fusion-plugin-cursor-runtime/bundled.js +70 -25
  105. package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
  106. package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
  107. package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
  108. package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
  109. package/dist/plugins/fusion-plugin-linear-import/bundled.js +658 -0
  110. package/dist/plugins/fusion-plugin-linear-import/manifest.json +48 -0
  111. package/dist/plugins/fusion-plugin-linear-import/package.json +11 -0
  112. package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
  113. package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
  114. package/dist/plugins/fusion-plugin-reports/package.json +1 -1
  115. package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
  116. package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
  117. package/package.json +2 -1
  118. package/skill/fusion/SKILL.md +2 -2
  119. package/skill/fusion/references/engine-tools.md +1 -0
  120. package/skill/fusion/references/extension-tools.md +81 -0
  121. package/skill/fusion/references/fusion-capabilities.md +7 -0
  122. package/dist/client/assets/AgentDetailView-BJditQat.js +0 -18
  123. package/dist/client/assets/ChatView-B4bjPXFN.js +0 -6
  124. package/dist/client/assets/DirectoryPicker-BwMSmxYS.js +0 -1
  125. package/dist/client/assets/DocumentsView-BfaRXFg5.js +0 -1
  126. package/dist/client/assets/PluginManager-CGWXqZMa.js +0 -1
  127. package/dist/client/assets/SessionTerminal-CtQKDaqI.js +0 -2
  128. package/dist/client/assets/SettingsModal-BYaotQ2o.js +0 -21
  129. package/dist/client/assets/SettingsModal-BzZNPNIh.css +0 -1
  130. package/dist/client/assets/SetupWizardModal-eHZHi8VP.js +0 -2
  131. package/dist/client/assets/TodoView-DhBseLvM.js +0 -6
  132. package/dist/client/assets/WorkflowNodeEditor-Bi12CNif.js +0 -8
  133. package/dist/client/assets/app-5S4z84u5.js +0 -13
  134. package/dist/client/assets/app-B1VYocx2.js +0 -13
  135. package/dist/client/assets/app-BhtYYxin.js +0 -13
  136. package/dist/client/assets/app-Cts0__Vx.js +0 -13
  137. package/dist/client/assets/app-DczBmsP4.js +0 -13
  138. package/dist/client/assets/app-_GFUqcMK.js +0 -13
  139. package/dist/client/assets/channel-BGI9APMr.js +0 -1
  140. package/dist/client/assets/classDiagram-4FO5ZUOK-g6hCcufy.js +0 -1
  141. package/dist/client/assets/classDiagram-v2-Q7XG4LA2-g6hCcufy.js +0 -1
  142. package/dist/client/assets/dashboard-view-BfLJ60Kd.js +0 -1
  143. package/dist/client/assets/index-BjELA24x.js +0 -1336
  144. package/dist/client/assets/index-DwGW7OJh.css +0 -1
  145. package/dist/client/assets/stateDiagram-v2-BHNVJYJU-DHds08RS.js +0 -1
  146. package/dist/client/assets/zoom-out-NWbVkreR.js +0 -41
@@ -1 +1 @@
1
- import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{ay as z,az as de,aA as ue,bB as he,bS as xe,aD as ae,bT as ye,ai as ge,bU as X,bV as Re,bW as _e,bX as Se,bY as je,bZ as we,b_ as Ne,bF as ke,b$ as Ee,c0 as Ce,aR as Ae,c1 as Te,V as Le,aK as me,L as Pe,al as Fe}from"./index-BjELA24x.js";import{u as be}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";const Ie="builtin",Q={pageFetch:!0,github:!1,localDocs:!0,llmSynthesis:!0};function ne(n){const a=n?.researchGlobalDefaults,i=n?.researchSettings;return{enabled:i?.enabled??n?.researchEnabled??n?.researchGlobalEnabled??!0,searchProvider:i?.searchProvider??a?.searchProvider??n?.researchGlobalWebSearchProvider??Ie,synthesisProvider:i?.synthesisProvider??a?.synthesisProvider,synthesisModelId:i?.synthesisModelId??a?.synthesisModelId,enabledSources:{webSearch:!0,pageFetch:i?.enabledSources?.pageFetch??a?.enabledSources?.pageFetch??Q.pageFetch,github:i?.enabledSources?.github??a?.enabledSources?.github??Q.github,localDocs:i?.enabledSources?.localDocs??a?.enabledSources?.localDocs??Q.localDocs,llmSynthesis:i?.enabledSources?.llmSynthesis??a?.enabledSources?.llmSynthesis??Q.llmSynthesis},limits:{maxConcurrentRuns:i?.limits?.maxConcurrentRuns??n?.researchMaxConcurrentRuns??n?.researchGlobalMaxConcurrentRuns??3,maxSourcesPerRun:i?.limits?.maxSourcesPerRun??a?.maxSourcesPerRun??n?.researchMaxSourcesPerRun??n?.researchGlobalMaxSourcesPerRun??20,maxDurationMs:i?.limits?.maxDurationMs??n?.researchDefaultTimeout??n?.researchGlobalDefaultTimeout??3e5,requestTimeoutMs:i?.limits?.requestTimeoutMs??n?.researchGlobalFetchTimeoutMs??3e4},defaultExportFormat:a?.defaultExportFormat??"markdown"}}const Me=300,De=4e3,He=["queued","running","cancelling","retry_waiting"];function ce(n,a){if(n instanceof ke){const i=n;return{message:n.message,status:n.status,code:i.researchCode??"INTERNAL_ERROR",setupHint:i.setupHint,retryable:i.retryable}}return n instanceof Error?{message:n.message,code:"INTERNAL_ERROR"}:{message:a,code:"INTERNAL_ERROR"}}function qe(n){if(!n)return{cancelable:!1,retryable:!1,isTransitioning:!1,blockingReason:"No run selected"};const a=He.includes(n.status),i=n.status==="queued"||n.status==="running",v=n.lifecycle?.retryable,s=n.status==="failed"||n.status==="timed_out",_=!!(s&&v);let g;return!i&&a?g="Run is already transitioning":!i&&n.status==="completed"?g="Completed runs cannot be cancelled":!i&&n.status==="cancelled"?g="Run is already cancelled":!i&&n.status==="retry_exhausted"?g="Retry attempts exhausted":!i&&n.status==="failed"?g="Failed runs cannot be cancelled":!i&&n.status==="timed_out"&&(g="Timed out runs cannot be cancelled"),!_&&s&&v===!1&&(g=n.lifecycle?.errorCode==="RETRY_EXHAUSTED"?"Retry attempts exhausted":"Run is not retryable"),{cancelable:i,retryable:_,isTransitioning:a,blockingReason:g}}function Ue(n){const a=n?.projectId,i=a??"",v=`${ue.RESEARCH_RUNS_PREFIX}${i}`,s=`${ue.RESEARCH_SELECTED_ID_PREFIX}${i}`,_=z(v,{maxAgeMs:de}),g=z(s,{maxAgeMs:he}),r=c.useRef(Array.isArray(_)&&_.length>0),[F,P]=c.useState(()=>Array.isArray(_)?_:[]),[h,E]=c.useState(g??null),[A,N]=c.useState(null),[q,I]=c.useState({available:!0}),[M,T]=c.useState(!(Array.isArray(_)&&_.length>0)),[V,U]=c.useState(null),[$,S]=c.useState(null),[w,k]=c.useState(""),x=c.useRef(0),d=c.useRef(0),D=c.useRef(a);c.useEffect(()=>{D.current!==a&&(D.current=a,d.current++);const l=z(v,{maxAgeMs:de}),o=z(s,{maxAgeMs:he}),p=Array.isArray(l)&&l.length>0;P(Array.isArray(l)?l:[]),E(o??null),N(null),T(!p),r.current=p},[a,v,s]);const b=c.useCallback(async(l=w)=>{const o=++x.current,p=a;r.current||T(!0),U(null),S(null);try{const R=await xe({q:l||void 0,limit:100},p);if(o!==x.current||p!==a)return;P(R.runs),ae(v,R.runs,{maxBytes:5e5}),r.current=!0,I(R.availability),h&&!R.runs.some(y=>y.id===h)&&(E(null),ae(s,null,{maxBytes:5e5}),N(null))}catch(R){if(o!==x.current||p!==a)return;const y=ce(R,"Failed to load research runs");U(y.message),S(y)}finally{o===x.current&&T(!1)}},[a,v,w,s,h]),H=c.useCallback(async l=>{const o=await ye(l,a);return N(o.run),I(o.availability),o.run},[a]);c.useEffect(()=>{r.current||T(!0);const l=window.setTimeout(()=>{b(w)},Me);return()=>window.clearTimeout(l)},[b,w]),c.useEffect(()=>{if(!h){N(null);return}H(h)},[H,h]),c.useEffect(()=>{const l=d.current,o=()=>d.current!==l,p=a?`?projectId=${encodeURIComponent(a)}`:"";let R=!0;const y=()=>{!R||o()||(b(),h&&H(h))},j=`/api/events${p}`,O=ge(j,{events:{"research:run:created":y,"research:run:updated":y,"research:run:completed":y,"research:run:failed":y,"research:run:cancelled":y},onReconnect:()=>{X({view:"useResearch",trigger:"sse-reconnect",projectId:a,replayAttempted:!1,sseChannel:j}),y()}});X({view:"useResearch",trigger:"sse-open",projectId:a,replayAttempted:!1,sseChannel:j});const L=window.setInterval(y,De);return()=>{R=!1,O(),window.clearInterval(L)}},[a,b,h,H]);const B=c.useCallback(l=>{E(l),ae(s,l,{maxBytes:5e5})},[s]);return{runs:F,selectedRun:A,selectedRunId:h,setSelectedRunId:B,availability:q,loading:M,error:V,searchQuery:w,setSearchQuery:k,refresh:b,createRun:l=>Ne(l,a),cancelRun:async l=>{try{S(null);const o=await we(l,a);return h===l&&N(o.run),await b(),o}catch(o){const p=ce(o,"Failed to cancel run");throw S(p),p}},retryRun:async l=>{try{S(null);const o=await je(l,a);return h===l&&N(o.run),await b(),o}catch(o){const p=ce(o,"Failed to retry run");throw S(p),p}},exportRun:(l,o)=>Se(l,o,a),createTaskFromRun:(l,o,p,R,y,j)=>_e(l,{title:o,findingId:p,description:R,priority:y,attachExport:j},a),attachRunToTask:(l,o,p,R)=>Re(l,{taskId:o,findingId:p,attachExport:R},a),uiError:$,runActionState:qe(A),statusCounts:F.reduce((l,o)=>(l[o.status]+=1,l),{queued:0,running:0,cancelling:0,retry_waiting:0,completed:0,failed:0,cancelled:0,timed_out:0,retry_exhausted:0})}}function Oe({open:n,mode:a,run:i,finding:v,projectId:s,onClose:_,onConfirm:g}){const{t:r}=be("app");Ee(n);const[F,P]=c.useState(!1),[h,E]=c.useState(""),[A,N]=c.useState(""),[q,I]=c.useState("normal"),[M,T]=c.useState(""),[V,U]=c.useState([]),[$,S]=c.useState(!1),[w,k]=c.useState(!1),x=c.useMemo(()=>{const d=(v.content??"").split(/(?<=[.!?])\s+/)[0]??"";return`${v.heading||r("research.defaultFindingHeading","Research finding")} — ${d}`.trim()},[v.content,v.heading,r]);return c.useEffect(()=>{n&&(P(!1),E(`Research: ${v.heading||i.title}`),N(x),I("normal"),T(""),a==="enrich"&&(S(!0),Ce(50,0,s).then(d=>U(d.filter(D=>D.column!=="archived"))).finally(()=>S(!1))))},[n,a,s,v.heading,x,i.title]),n?e.jsx("div",{className:"modal-overlay open",role:"presentation",onClick:_,children:e.jsxs("div",{className:"modal modal-lg research-task-action-modal",role:"dialog","aria-modal":"true",onClick:d=>d.stopPropagation(),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:a==="create"?r("research.createTaskTitle","Create task from finding"):r("research.enrichTaskTitle","Enrich existing task")}),e.jsx("button",{className:"modal-close",type:"button","aria-label":r("actions.close","Close"),onClick:_,children:"×"})]}),e.jsxs("div",{className:"research-task-action-modal__body",children:[e.jsxs("div",{className:"card research-task-action-modal__preview",children:[e.jsxs("p",{children:[e.jsxs("strong",{children:[r("research.runLabel","Run:")," "]})," ",i.id]}),e.jsxs("p",{children:[e.jsxs("strong",{children:[r("research.findingLabel","Finding:")," "]})," ",v.id,v.heading?` — ${v.heading}`:""]}),e.jsx("p",{children:x||r("research.noPreview","No preview available.")})]}),a==="create"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.titleLabel","Title"),e.jsx("input",{className:"input",value:h,onChange:d=>E(d.target.value)})]}),e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.descriptionLabel","Description"),e.jsx("textarea",{className:"input research-task-action-modal__textarea",value:A,onChange:d=>N(d.target.value)})]}),e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.priorityLabel","Priority"),e.jsxs("select",{className:"select",value:q,onChange:d=>I(d.target.value),children:[e.jsx("option",{value:"low",children:r("research.priorityLow","Low")}),e.jsx("option",{value:"normal",children:r("research.priorityNormal","Normal")}),e.jsx("option",{value:"high",children:r("research.priorityHigh","High")}),e.jsx("option",{value:"urgent",children:r("research.priorityUrgent","Urgent")})]})]})]}):e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.targetTaskLabel","Target task"),e.jsx("input",{className:"input",list:"research-task-action-task-list",value:M,placeholder:$?r("research.loadingTasks","Loading tasks…"):r("research.enterTaskId","Enter task ID"),onChange:d=>T(d.target.value)}),e.jsx("datalist",{id:"research-task-action-task-list",children:V.map(d=>e.jsx("option",{value:d.id,children:d.title},d.id))})]}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:F,onChange:d=>P(d.target.checked)}),e.jsx("span",{children:r("research.attachExport","Attach markdown export artifact")})]})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:_,children:r("actions.cancel","Cancel")}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:w||a==="enrich"&&!M,onClick:()=>{k(!0),g({taskId:a==="enrich"?M:void 0,title:a==="create"?h.trim():void 0,description:a==="create"?A.trim():void 0,priority:a==="create"?q:void 0,attachExport:F}).finally(()=>k(!1))},children:a==="create"?r("research.createTaskButton","Create Task"):r("research.enrichTaskButton","Enrich Task")})]})]})}):null}const Ve=["web-search","page-fetch","github","local-docs","llm-synthesis"],$e={"web-search":"webSearch","page-fetch":"pageFetch",github:"github","local-docs":"localDocs","llm-synthesis":"llmSynthesis"};function Ge(n){return{"web-search":n("research.providerWebSearch","Web Search"),"page-fetch":n("research.providerPageFetch","Page Fetch"),github:n("research.providerGitHub","GitHub"),"local-docs":n("research.providerLocalDocs","Local Docs"),"llm-synthesis":n("research.providerLlmSynthesis","LLM Synthesis")}}let ie=!1;function Je({projectId:n,addToast:a,onOpenSettings:i,readinessVersion:v=0}){const{t:s}=be("app"),_=Ge(s);c.useEffect(()=>(X({view:"ResearchView",trigger:ie?"route-active":"remount",projectId:n,replayAttempted:!1}),ie=!1,()=>{ie=!0,X({view:"ResearchView",trigger:"route-inactive",projectId:n,replayAttempted:!1})}),[n]);const{runs:g,selectedRun:r,selectedRunId:F,setSelectedRunId:P,availability:h,loading:E,error:A,searchQuery:N,setSearchQuery:q,createRun:I,cancelRun:M,retryRun:T,exportRun:V,createTaskFromRun:U,attachRunToTask:$,statusCounts:S,refresh:w,uiError:k,runActionState:x}=Ue({projectId:n}),[d,D]=c.useState(""),[b,H]=c.useState(()=>ne(void 0)),[B,l]=c.useState([]),[o,p]=c.useState(!1),[R,y]=c.useState([]),[j,O]=c.useState(null),[L,K]=c.useState(null),Y=h.supportedProviders??Ve,J=b.searchProvider,Z=t=>t==="web-search"?!0:b.enabledSources[$e[t]];c.useEffect(()=>{const t=Y.filter(u=>Z(u));y(u=>{const f=u.filter(m=>t.includes(m));return f.length>0?f:t})},[b.enabledSources,Y]),c.useEffect(()=>{let t=!1;return Promise.all([Ae(n),Te().catch(()=>({providers:[]}))]).then(([u,f])=>{t||(H(ne(u)),l(f.providers.filter(m=>m.type==="api_key").map(m=>({id:m.id,authenticated:m.authenticated}))))}).catch(()=>{t||H(ne(void 0))}),()=>{t=!0}},[n,v]);const pe=c.useMemo(()=>r?r.status:s("research.noRunSelected","No run selected"),[r,s]),fe=c.useMemo(()=>r?r.status==="queued"||r.status==="retry_waiting"?"status-dot status-dot--pending":r.status==="running"?"status-dot status-dot--connecting":r.status==="completed"?"status-dot status-dot--online":r.status==="failed"||r.status==="cancelled"?"status-dot status-dot--error":"status-dot":"status-dot",[r]),ee=h.supportedExportFormats??["markdown","json","html"],se=c.useMemo(()=>new Map(B.map(t=>[t.id,t.authenticated])),[B]),re=c.useMemo(()=>{const t=new Set;return b.enabledSources.webSearch&&J&&t.add(J),b.enabledSources.llmSynthesis&&b.synthesisProvider&&t.add(b.synthesisProvider),[...t].filter(u=>se.has(u))},[b.enabledSources.llmSynthesis,b.enabledSources.webSearch,b.synthesisProvider,J,se]).find(t=>se.get(t)!==!0),G=c.useMemo(()=>h.available?b.enabled?re?{reason:s("research.missingApiKey","Missing API key for {{provider}}.",{provider:re}),details:s("research.addCredentialsHint","Add provider credentials in Authentication settings."),settingsSection:"authentication"}:null:{reason:s("research.disabled","Research is disabled for this project."),details:s("research.enableResearchHint","Enable project research settings to create runs."),settingsSection:"research-project"}:{reason:h.reason??s("research.unavailable","Research is unavailable for this project."),details:h.setupInstructions,settingsSection:"research-project"},[h.available,h.reason,h.setupInstructions,b.enabled,re,s]),W=async(t,u,f)=>{O(t);try{await u(),a?.(f,"success"),await w()}catch(m){a?.(m instanceof Error?m.message:s("research.actionFailed","Action failed"),"error")}finally{O(null)}},te=async t=>{if(r){O(`export-${t}`);try{const u=await V(r.id,t),f=new Blob([u.content],{type:"text/plain;charset=utf-8"}),m=URL.createObjectURL(f),C=document.createElement("a");C.href=m,C.download=u.filename,document.body.appendChild(C),C.click(),C.remove(),URL.revokeObjectURL(m),a?.(s("research.exportedFile","Exported {{filename}}",{filename:u.filename}),"success")}catch(u){a?.(u instanceof Error?u.message:s("research.exportFailed","Export failed"),"error")}finally{O(null)}}},ve=async()=>{if(d.trim()){p(!0);try{const t=R.filter(f=>Z(f));if(t.length===0){p(!1),a?.(s("research.noSourcesAvailable","No enabled research sources are available for this project."),"error");return}const u=await I({query:d.trim(),providers:t});P(u.run.id),D(""),a?.(s("research.runCreated","Research run created"),"success"),await w()}catch(t){a?.(t instanceof Error?t.message:s("research.createRunFailed","Failed to create run"),"error")}finally{p(!1)}}};return e.jsxs("section",{className:"research-view","aria-label":s("research.viewLabel","Research view"),children:[e.jsx(Le,{icon:me,title:s("research.title","Research"),actions:e.jsx("button",{className:"btn",type:"button",onClick:()=>void w(),children:s("actions.refresh","Refresh")})}),e.jsx("p",{className:"research-view__subtitle",children:s("research.subtitle","Cited search and synthesis runs: gather sources, fetch content, and synthesize findings.")}),G?e.jsxs("div",{className:"research-view__state research-view__state--error card","data-testid":"research-state-unavailable",children:[e.jsx("p",{children:G.reason}),G.details&&e.jsx("p",{children:G.details}),e.jsx("p",{children:s("research.currentDefaults","Current defaults: provider {{provider}}, max sources {{maxSources}}",{provider:b.searchProvider??s("research.notSet","(not set)"),maxSources:b.limits.maxSourcesPerRun})}),e.jsxs("div",{className:"research-view__actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:()=>void w(),children:s("actions.refresh","Refresh")}),e.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>i?.(G.settingsSection),children:s("actions.openSettings","Open Settings")})]})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"research-view__layout",children:[e.jsx("aside",{className:"research-view__sidebar card",children:e.jsxs("div",{className:"research-view__sidebar-content",children:[e.jsxs("div",{className:"research-view__form",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"research-query",children:s("research.queryLabel","Query")}),e.jsx("textarea",{id:"research-query",className:"input research-view__textarea",value:d,onChange:t=>D(t.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:s("research.providersLabel","Providers")}),e.jsx("div",{className:"research-view__providers",children:Y.map(t=>{const u=Z(t),f=t==="web-search";return e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:f||R.includes(t),disabled:f||!u,onChange:()=>{f||!u||y(m=>m.includes(t)?m.filter(C=>C!==t):[...m,t])}}),e.jsxs("span",{children:[_[t]??t,f?e.jsx("span",{className:"research-view__provider-lock",children:s("research.alwaysOn","Always on")}):null]})]},t)})})]}),e.jsxs("button",{className:"btn btn-primary",type:"button",disabled:!d.trim()||o,onClick:()=>void ve(),children:[o?e.jsx(Pe,{className:"animate-spin",size:14}):null,s("research.createRun","Create Run")]})]}),e.jsxs("div",{className:"research-view__history-header form-group",children:[e.jsx("label",{htmlFor:"research-run-search",children:s("actions.search","Search")}),e.jsxs("div",{className:"research-view__history-search-row",children:[e.jsx(me,{size:14}),e.jsx("input",{id:"research-run-search",className:"input",placeholder:s("research.searchRunsPlaceholder","Search runs"),value:N,onChange:t=>q(t.target.value)})]})]}),e.jsx("div",{className:"research-view__history","data-testid":"research-state-running",children:g.map(t=>e.jsxs("button",{type:"button",className:`research-view__history-item card${F===t.id?" research-view__history-item--active":""}`,onClick:()=>P(t.id),children:[e.jsx("span",{className:"card-id",children:t.id}),e.jsx("span",{children:t.title})]},t.id))})]})}),e.jsxs("div",{className:"research-view__reader card",children:[E&&e.jsx("p",{"data-testid":"research-state-loading",children:e.jsx(Fe,{label:s("research.loadingRuns","Loading research runs…")})}),!E&&A&&e.jsx("p",{"data-testid":"research-state-error",children:A}),!E&&!A&&g.length===0&&e.jsx("p",{"data-testid":"research-state-empty",children:s("research.noRunsYet","No research runs yet")}),e.jsxs("div",{className:"research-view__reader-content",children:[r&&e.jsxs("div",{className:"research-view__run-detail",children:[e.jsxs("div",{className:"research-view__status-row",children:[e.jsx("span",{className:fe}),e.jsx("strong",{children:pe})]}),e.jsx("h3",{className:"research-view__run-title",children:r.title}),e.jsx("p",{className:"research-view__run-query",children:r.query}),e.jsx("p",{className:"research-view__run-summary","data-testid":"research-state-results",children:r.results?.summary??s("research.noSummaryYet","No summary yet.")}),e.jsxs("div",{className:"research-view__actions",children:[e.jsx("button",{className:"btn",type:"button",title:x.cancelable?void 0:x.blockingReason,disabled:j==="cancel"||j==="retry"||!x.cancelable,onClick:()=>void W("cancel",()=>M(r.id),s("research.runCancelled","Run cancelled")),children:s("actions.cancel","Cancel")}),e.jsx("button",{className:"btn",type:"button",title:x.retryable?void 0:x.blockingReason,disabled:j==="cancel"||j==="retry"||!x.retryable,onClick:()=>void W("retry",()=>T(r.id),s("research.runRetried","Run retried")),children:s("actions.retry","Retry")}),ee.includes("markdown")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-markdown",onClick:()=>void te("markdown"),children:s("research.exportMd","Export MD")}),ee.includes("json")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-json",onClick:()=>void te("json"),children:s("research.exportJson","Export JSON")}),ee.includes("html")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-html",onClick:()=>void te("html"),children:s("research.exportHtml","Export HTML")})]}),r.error&&e.jsx("p",{className:"research-view__error",children:r.error}),k&&e.jsxs("div",{className:"form-error",role:"alert",children:[e.jsx("p",{children:k.message}),k.setupHint&&e.jsx("p",{children:k.setupHint}),k.code==="MISSING_CREDENTIALS"&&e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>i?.("authentication"),children:s("research.openAuthSettings","Open Authentication Settings")}),k.code==="FEATURE_DISABLED"&&e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>i?.("research-project"),children:s("research.openResearchSettings","Open Research Settings")})]}),x.blockingReason&&e.jsx("p",{className:"research-view__run-query",children:x.blockingReason}),Array.isArray(r.results?.findings)&&r.results.findings.length>0&&e.jsx("div",{className:"research-view__findings",children:r.results.findings.map((t,u)=>{const m=t.id?.trim()||`finding-${u+1}`;return e.jsxs("article",{className:"research-view__finding card",children:[e.jsx("h4",{children:t.heading}),e.jsx("p",{children:t.content}),e.jsxs("div",{className:"research-view__actions research-view__finding-actions",children:[e.jsx("button",{className:"btn btn-primary btn-sm",type:"button",onClick:()=>K({mode:"create",findingId:m}),children:s("research.createTask","Create Task")}),e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>K({mode:"enrich",findingId:m}),children:s("research.enrichTask","Enrich Task")})]})]},m)})}),Array.isArray(r.results?.citations)&&r.results.citations.length>0&&e.jsx("ul",{className:"research-view__citations",children:r.results.citations.map(t=>e.jsx("li",{children:e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",children:t})},t))}),r.events.length>0&&e.jsxs("details",{children:[e.jsx("summary",{children:s("research.runHistory","Run history")}),e.jsx("ul",{className:"research-view__events",children:r.events.map(t=>e.jsx("li",{children:t.message},t.id))})]})]}),!r&&g.length>0&&e.jsx("p",{children:s("research.selectRunToViewDetails","Select a run to view details.")}),e.jsxs("div",{className:"research-view__stats",children:[e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statRunning","Running")}),e.jsx("div",{className:"research-view__stat-value",children:S.running})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statCompleted","Completed")}),e.jsx("div",{className:"research-view__stat-value",children:S.completed})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statFailed","Failed")}),e.jsx("div",{className:"research-view__stat-value",children:S.failed})]})]})]})]})]})}),r&&L&&(()=>{const t=r.results?.findings?.findIndex((f,m)=>(f.id?.trim()||`finding-${m+1}`)===L.findingId)??-1,u=t>=0?r.results.findings[t]:null;return u?e.jsx(Oe,{open:!0,mode:L.mode,run:r,finding:{id:L.findingId,heading:u.heading,content:u.content},projectId:n,onClose:()=>K(null),onConfirm:async({taskId:f,title:m,description:C,priority:le,attachExport:oe})=>{L.mode==="create"?await W("create-task",()=>U(r.id,m,L.findingId,C,le,oe),s("research.taskCreatedFromResearch","Task created from research")):f&&await W("attach-task",()=>$(r.id,f,L.findingId,oe),s("research.taskEnrichedFromResearch","Task enriched from research")),K(null)}}):null})()]})}export{Je as ResearchView};
1
+ import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{az as K,aA as de,aB as ue,bD as he,bU as xe,aE as ae,bV as ye,aj as ge,bW as X,bX as Re,bY as _e,bZ as Se,b_ as je,b$ as we,c0 as Ne,bH as ke,c1 as Ee,c2 as Ce,aT as Ae,c3 as Te,V as Le,aL as me,L as Pe,am as Fe}from"./index-D7eX7QJk.js";import{u as be}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-xterm-BNq00GSj.js";const Ie="builtin",Q={pageFetch:!0,github:!1,localDocs:!0,llmSynthesis:!0};function ne(n){const a=n?.researchGlobalDefaults,i=n?.researchSettings;return{enabled:i?.enabled??n?.researchEnabled??n?.researchGlobalEnabled??!0,searchProvider:i?.searchProvider??a?.searchProvider??n?.researchGlobalWebSearchProvider??Ie,synthesisProvider:i?.synthesisProvider??a?.synthesisProvider,synthesisModelId:i?.synthesisModelId??a?.synthesisModelId,enabledSources:{webSearch:!0,pageFetch:i?.enabledSources?.pageFetch??a?.enabledSources?.pageFetch??Q.pageFetch,github:i?.enabledSources?.github??a?.enabledSources?.github??Q.github,localDocs:i?.enabledSources?.localDocs??a?.enabledSources?.localDocs??Q.localDocs,llmSynthesis:i?.enabledSources?.llmSynthesis??a?.enabledSources?.llmSynthesis??Q.llmSynthesis},limits:{maxConcurrentRuns:i?.limits?.maxConcurrentRuns??n?.researchMaxConcurrentRuns??n?.researchGlobalMaxConcurrentRuns??3,maxSourcesPerRun:i?.limits?.maxSourcesPerRun??a?.maxSourcesPerRun??n?.researchMaxSourcesPerRun??n?.researchGlobalMaxSourcesPerRun??20,maxDurationMs:i?.limits?.maxDurationMs??n?.researchDefaultTimeout??n?.researchGlobalDefaultTimeout??3e5,requestTimeoutMs:i?.limits?.requestTimeoutMs??n?.researchGlobalFetchTimeoutMs??3e4},defaultExportFormat:a?.defaultExportFormat??"markdown"}}const Me=300,De=4e3,He=["queued","running","cancelling","retry_waiting"];function ce(n,a){if(n instanceof ke){const i=n;return{message:n.message,status:n.status,code:i.researchCode??"INTERNAL_ERROR",setupHint:i.setupHint,retryable:i.retryable}}return n instanceof Error?{message:n.message,code:"INTERNAL_ERROR"}:{message:a,code:"INTERNAL_ERROR"}}function qe(n){if(!n)return{cancelable:!1,retryable:!1,isTransitioning:!1,blockingReason:"No run selected"};const a=He.includes(n.status),i=n.status==="queued"||n.status==="running",v=n.lifecycle?.retryable,s=n.status==="failed"||n.status==="timed_out",_=!!(s&&v);let g;return!i&&a?g="Run is already transitioning":!i&&n.status==="completed"?g="Completed runs cannot be cancelled":!i&&n.status==="cancelled"?g="Run is already cancelled":!i&&n.status==="retry_exhausted"?g="Retry attempts exhausted":!i&&n.status==="failed"?g="Failed runs cannot be cancelled":!i&&n.status==="timed_out"&&(g="Timed out runs cannot be cancelled"),!_&&s&&v===!1&&(g=n.lifecycle?.errorCode==="RETRY_EXHAUSTED"?"Retry attempts exhausted":"Run is not retryable"),{cancelable:i,retryable:_,isTransitioning:a,blockingReason:g}}function Ue(n){const a=n?.projectId,i=a??"",v=`${ue.RESEARCH_RUNS_PREFIX}${i}`,s=`${ue.RESEARCH_SELECTED_ID_PREFIX}${i}`,_=K(v,{maxAgeMs:de}),g=K(s,{maxAgeMs:he}),r=c.useRef(Array.isArray(_)&&_.length>0),[F,P]=c.useState(()=>Array.isArray(_)?_:[]),[h,E]=c.useState(g??null),[A,N]=c.useState(null),[q,I]=c.useState({available:!0}),[M,T]=c.useState(!(Array.isArray(_)&&_.length>0)),[V,U]=c.useState(null),[$,S]=c.useState(null),[w,k]=c.useState(""),x=c.useRef(0),d=c.useRef(0),D=c.useRef(a);c.useEffect(()=>{D.current!==a&&(D.current=a,d.current++);const l=K(v,{maxAgeMs:de}),o=K(s,{maxAgeMs:he}),p=Array.isArray(l)&&l.length>0;P(Array.isArray(l)?l:[]),E(o??null),N(null),T(!p),r.current=p},[a,v,s]);const b=c.useCallback(async(l=w)=>{const o=++x.current,p=a;r.current||T(!0),U(null),S(null);try{const R=await xe({q:l||void 0,limit:100},p);if(o!==x.current||p!==a)return;P(R.runs),ae(v,R.runs,{maxBytes:5e5}),r.current=!0,I(R.availability),h&&!R.runs.some(y=>y.id===h)&&(E(null),ae(s,null,{maxBytes:5e5}),N(null))}catch(R){if(o!==x.current||p!==a)return;const y=ce(R,"Failed to load research runs");U(y.message),S(y)}finally{o===x.current&&T(!1)}},[a,v,w,s,h]),H=c.useCallback(async l=>{const o=await ye(l,a);return N(o.run),I(o.availability),o.run},[a]);c.useEffect(()=>{r.current||T(!0);const l=window.setTimeout(()=>{b(w)},Me);return()=>window.clearTimeout(l)},[b,w]),c.useEffect(()=>{if(!h){N(null);return}H(h)},[H,h]),c.useEffect(()=>{const l=d.current,o=()=>d.current!==l,p=a?`?projectId=${encodeURIComponent(a)}`:"";let R=!0;const y=()=>{!R||o()||(b(),h&&H(h))},j=`/api/events${p}`,O=ge(j,{events:{"research:run:created":y,"research:run:updated":y,"research:run:completed":y,"research:run:failed":y,"research:run:cancelled":y},onReconnect:()=>{X({view:"useResearch",trigger:"sse-reconnect",projectId:a,replayAttempted:!1,sseChannel:j}),y()}});X({view:"useResearch",trigger:"sse-open",projectId:a,replayAttempted:!1,sseChannel:j});const L=window.setInterval(y,De);return()=>{R=!1,O(),window.clearInterval(L)}},[a,b,h,H]);const B=c.useCallback(l=>{E(l),ae(s,l,{maxBytes:5e5})},[s]);return{runs:F,selectedRun:A,selectedRunId:h,setSelectedRunId:B,availability:q,loading:M,error:V,searchQuery:w,setSearchQuery:k,refresh:b,createRun:l=>Ne(l,a),cancelRun:async l=>{try{S(null);const o=await we(l,a);return h===l&&N(o.run),await b(),o}catch(o){const p=ce(o,"Failed to cancel run");throw S(p),p}},retryRun:async l=>{try{S(null);const o=await je(l,a);return h===l&&N(o.run),await b(),o}catch(o){const p=ce(o,"Failed to retry run");throw S(p),p}},exportRun:(l,o)=>Se(l,o,a),createTaskFromRun:(l,o,p,R,y,j)=>_e(l,{title:o,findingId:p,description:R,priority:y,attachExport:j},a),attachRunToTask:(l,o,p,R)=>Re(l,{taskId:o,findingId:p,attachExport:R},a),uiError:$,runActionState:qe(A),statusCounts:F.reduce((l,o)=>(l[o.status]+=1,l),{queued:0,running:0,cancelling:0,retry_waiting:0,completed:0,failed:0,cancelled:0,timed_out:0,retry_exhausted:0})}}function Oe({open:n,mode:a,run:i,finding:v,projectId:s,onClose:_,onConfirm:g}){const{t:r}=be("app");Ee(n);const[F,P]=c.useState(!1),[h,E]=c.useState(""),[A,N]=c.useState(""),[q,I]=c.useState("normal"),[M,T]=c.useState(""),[V,U]=c.useState([]),[$,S]=c.useState(!1),[w,k]=c.useState(!1),x=c.useMemo(()=>{const d=(v.content??"").split(/(?<=[.!?])\s+/)[0]??"";return`${v.heading||r("research.defaultFindingHeading","Research finding")} — ${d}`.trim()},[v.content,v.heading,r]);return c.useEffect(()=>{n&&(P(!1),E(`Research: ${v.heading||i.title}`),N(x),I("normal"),T(""),a==="enrich"&&(S(!0),Ce(50,0,s).then(d=>U(d.filter(D=>D.column!=="archived"))).finally(()=>S(!1))))},[n,a,s,v.heading,x,i.title]),n?e.jsx("div",{className:"modal-overlay open",role:"presentation",onClick:_,children:e.jsxs("div",{className:"modal modal-lg research-task-action-modal",role:"dialog","aria-modal":"true",onClick:d=>d.stopPropagation(),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:a==="create"?r("research.createTaskTitle","Create task from finding"):r("research.enrichTaskTitle","Enrich existing task")}),e.jsx("button",{className:"modal-close",type:"button","aria-label":r("actions.close","Close"),onClick:_,children:"×"})]}),e.jsxs("div",{className:"research-task-action-modal__body",children:[e.jsxs("div",{className:"card research-task-action-modal__preview",children:[e.jsxs("p",{children:[e.jsxs("strong",{children:[r("research.runLabel","Run:")," "]})," ",i.id]}),e.jsxs("p",{children:[e.jsxs("strong",{children:[r("research.findingLabel","Finding:")," "]})," ",v.id,v.heading?` — ${v.heading}`:""]}),e.jsx("p",{children:x||r("research.noPreview","No preview available.")})]}),a==="create"?e.jsxs(e.Fragment,{children:[e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.titleLabel","Title"),e.jsx("input",{className:"input",value:h,onChange:d=>E(d.target.value)})]}),e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.descriptionLabel","Description"),e.jsx("textarea",{className:"input research-task-action-modal__textarea",value:A,onChange:d=>N(d.target.value)})]}),e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.priorityLabel","Priority"),e.jsxs("select",{className:"select",value:q,onChange:d=>I(d.target.value),children:[e.jsx("option",{value:"low",children:r("research.priorityLow","Low")}),e.jsx("option",{value:"normal",children:r("research.priorityNormal","Normal")}),e.jsx("option",{value:"high",children:r("research.priorityHigh","High")}),e.jsx("option",{value:"urgent",children:r("research.priorityUrgent","Urgent")})]})]})]}):e.jsxs("label",{className:"research-task-action-modal__field",children:[r("research.targetTaskLabel","Target task"),e.jsx("input",{className:"input",list:"research-task-action-task-list",value:M,placeholder:$?r("research.loadingTasks","Loading tasks…"):r("research.enterTaskId","Enter task ID"),onChange:d=>T(d.target.value)}),e.jsx("datalist",{id:"research-task-action-task-list",children:V.map(d=>e.jsx("option",{value:d.id,children:d.title},d.id))})]}),e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:F,onChange:d=>P(d.target.checked)}),e.jsx("span",{children:r("research.attachExport","Attach markdown export artifact")})]})]}),e.jsxs("div",{className:"modal-actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:_,children:r("actions.cancel","Cancel")}),e.jsx("button",{className:"btn btn-primary",type:"button",disabled:w||a==="enrich"&&!M,onClick:()=>{k(!0),g({taskId:a==="enrich"?M:void 0,title:a==="create"?h.trim():void 0,description:a==="create"?A.trim():void 0,priority:a==="create"?q:void 0,attachExport:F}).finally(()=>k(!1))},children:a==="create"?r("research.createTaskButton","Create Task"):r("research.enrichTaskButton","Enrich Task")})]})]})}):null}const Ve=["web-search","page-fetch","github","local-docs","llm-synthesis"],$e={"web-search":"webSearch","page-fetch":"pageFetch",github:"github","local-docs":"localDocs","llm-synthesis":"llmSynthesis"};function Ge(n){return{"web-search":n("research.providerWebSearch","Web Search"),"page-fetch":n("research.providerPageFetch","Page Fetch"),github:n("research.providerGitHub","GitHub"),"local-docs":n("research.providerLocalDocs","Local Docs"),"llm-synthesis":n("research.providerLlmSynthesis","LLM Synthesis")}}let ie=!1;function Je({projectId:n,addToast:a,onOpenSettings:i,readinessVersion:v=0}){const{t:s}=be("app"),_=Ge(s);c.useEffect(()=>(X({view:"ResearchView",trigger:ie?"route-active":"remount",projectId:n,replayAttempted:!1}),ie=!1,()=>{ie=!0,X({view:"ResearchView",trigger:"route-inactive",projectId:n,replayAttempted:!1})}),[n]);const{runs:g,selectedRun:r,selectedRunId:F,setSelectedRunId:P,availability:h,loading:E,error:A,searchQuery:N,setSearchQuery:q,createRun:I,cancelRun:M,retryRun:T,exportRun:V,createTaskFromRun:U,attachRunToTask:$,statusCounts:S,refresh:w,uiError:k,runActionState:x}=Ue({projectId:n}),[d,D]=c.useState(""),[b,H]=c.useState(()=>ne(void 0)),[B,l]=c.useState([]),[o,p]=c.useState(!1),[R,y]=c.useState([]),[j,O]=c.useState(null),[L,W]=c.useState(null),Y=h.supportedProviders??Ve,J=b.searchProvider,Z=t=>t==="web-search"?!0:b.enabledSources[$e[t]];c.useEffect(()=>{const t=Y.filter(u=>Z(u));y(u=>{const f=u.filter(m=>t.includes(m));return f.length>0?f:t})},[b.enabledSources,Y]),c.useEffect(()=>{let t=!1;return Promise.all([Ae(n),Te().catch(()=>({providers:[]}))]).then(([u,f])=>{t||(H(ne(u)),l(f.providers.filter(m=>m.type==="api_key").map(m=>({id:m.id,authenticated:m.authenticated}))))}).catch(()=>{t||H(ne(void 0))}),()=>{t=!0}},[n,v]);const pe=c.useMemo(()=>r?r.status:s("research.noRunSelected","No run selected"),[r,s]),fe=c.useMemo(()=>r?r.status==="queued"||r.status==="retry_waiting"?"status-dot status-dot--pending":r.status==="running"?"status-dot status-dot--connecting":r.status==="completed"?"status-dot status-dot--online":r.status==="failed"||r.status==="cancelled"?"status-dot status-dot--error":"status-dot":"status-dot",[r]),ee=h.supportedExportFormats??["markdown","json","html"],se=c.useMemo(()=>new Map(B.map(t=>[t.id,t.authenticated])),[B]),re=c.useMemo(()=>{const t=new Set;return b.enabledSources.webSearch&&J&&t.add(J),b.enabledSources.llmSynthesis&&b.synthesisProvider&&t.add(b.synthesisProvider),[...t].filter(u=>se.has(u))},[b.enabledSources.llmSynthesis,b.enabledSources.webSearch,b.synthesisProvider,J,se]).find(t=>se.get(t)!==!0),G=c.useMemo(()=>h.available?b.enabled?re?{reason:s("research.missingApiKey","Missing API key for {{provider}}.",{provider:re}),details:s("research.addCredentialsHint","Add provider credentials in Authentication settings."),settingsSection:"authentication"}:null:{reason:s("research.disabled","Research is disabled for this project."),details:s("research.enableResearchHint","Enable project research settings to create runs."),settingsSection:"research-project"}:{reason:h.reason??s("research.unavailable","Research is unavailable for this project."),details:h.setupInstructions,settingsSection:"research-project"},[h.available,h.reason,h.setupInstructions,b.enabled,re,s]),z=async(t,u,f)=>{O(t);try{await u(),a?.(f,"success"),await w()}catch(m){a?.(m instanceof Error?m.message:s("research.actionFailed","Action failed"),"error")}finally{O(null)}},te=async t=>{if(r){O(`export-${t}`);try{const u=await V(r.id,t),f=new Blob([u.content],{type:"text/plain;charset=utf-8"}),m=URL.createObjectURL(f),C=document.createElement("a");C.href=m,C.download=u.filename,document.body.appendChild(C),C.click(),C.remove(),URL.revokeObjectURL(m),a?.(s("research.exportedFile","Exported {{filename}}",{filename:u.filename}),"success")}catch(u){a?.(u instanceof Error?u.message:s("research.exportFailed","Export failed"),"error")}finally{O(null)}}},ve=async()=>{if(d.trim()){p(!0);try{const t=R.filter(f=>Z(f));if(t.length===0){p(!1),a?.(s("research.noSourcesAvailable","No enabled research sources are available for this project."),"error");return}const u=await I({query:d.trim(),providers:t});P(u.run.id),D(""),a?.(s("research.runCreated","Research run created"),"success"),await w()}catch(t){a?.(t instanceof Error?t.message:s("research.createRunFailed","Failed to create run"),"error")}finally{p(!1)}}};return e.jsxs("section",{className:"research-view","aria-label":s("research.viewLabel","Research view"),children:[e.jsx(Le,{icon:me,title:s("research.title","Research"),actions:e.jsx("button",{className:"btn",type:"button",onClick:()=>void w(),children:s("actions.refresh","Refresh")})}),e.jsx("p",{className:"research-view__subtitle",children:s("research.subtitle","Cited search and synthesis runs: gather sources, fetch content, and synthesize findings.")}),G?e.jsxs("div",{className:"research-view__state research-view__state--error card","data-testid":"research-state-unavailable",children:[e.jsx("p",{children:G.reason}),G.details&&e.jsx("p",{children:G.details}),e.jsx("p",{children:s("research.currentDefaults","Current defaults: provider {{provider}}, max sources {{maxSources}}",{provider:b.searchProvider??s("research.notSet","(not set)"),maxSources:b.limits.maxSourcesPerRun})}),e.jsxs("div",{className:"research-view__actions",children:[e.jsx("button",{className:"btn",type:"button",onClick:()=>void w(),children:s("actions.refresh","Refresh")}),e.jsx("button",{className:"btn btn-primary",type:"button",onClick:()=>i?.(G.settingsSection),children:s("actions.openSettings","Open Settings")})]})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"research-view__layout",children:[e.jsx("aside",{className:"research-view__sidebar card",children:e.jsxs("div",{className:"research-view__sidebar-content",children:[e.jsxs("div",{className:"research-view__form",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{htmlFor:"research-query",children:s("research.queryLabel","Query")}),e.jsx("textarea",{id:"research-query",className:"input research-view__textarea",value:d,onChange:t=>D(t.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:s("research.providersLabel","Providers")}),e.jsx("div",{className:"research-view__providers",children:Y.map(t=>{const u=Z(t),f=t==="web-search";return e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:f||R.includes(t),disabled:f||!u,onChange:()=>{f||!u||y(m=>m.includes(t)?m.filter(C=>C!==t):[...m,t])}}),e.jsxs("span",{children:[_[t]??t,f?e.jsx("span",{className:"research-view__provider-lock",children:s("research.alwaysOn","Always on")}):null]})]},t)})})]}),e.jsxs("button",{className:"btn btn-primary",type:"button",disabled:!d.trim()||o,onClick:()=>void ve(),children:[o?e.jsx(Pe,{className:"animate-spin",size:14}):null,s("research.createRun","Create Run")]})]}),e.jsxs("div",{className:"research-view__history-header form-group",children:[e.jsx("label",{htmlFor:"research-run-search",children:s("actions.search","Search")}),e.jsxs("div",{className:"research-view__history-search-row",children:[e.jsx(me,{size:14}),e.jsx("input",{id:"research-run-search",className:"input",placeholder:s("research.searchRunsPlaceholder","Search runs"),value:N,onChange:t=>q(t.target.value)})]})]}),e.jsx("div",{className:"research-view__history","data-testid":"research-state-running",children:g.map(t=>e.jsxs("button",{type:"button",className:`research-view__history-item card${F===t.id?" research-view__history-item--active":""}`,onClick:()=>P(t.id),children:[e.jsx("span",{className:"card-id",children:t.id}),e.jsx("span",{children:t.title})]},t.id))})]})}),e.jsxs("div",{className:"research-view__reader card",children:[E&&e.jsx("p",{"data-testid":"research-state-loading",children:e.jsx(Fe,{label:s("research.loadingRuns","Loading research runs…")})}),!E&&A&&e.jsx("p",{"data-testid":"research-state-error",children:A}),!E&&!A&&g.length===0&&e.jsx("p",{"data-testid":"research-state-empty",children:s("research.noRunsYet","No research runs yet")}),e.jsxs("div",{className:"research-view__reader-content",children:[r&&e.jsxs("div",{className:"research-view__run-detail",children:[e.jsxs("div",{className:"research-view__status-row",children:[e.jsx("span",{className:fe}),e.jsx("strong",{children:pe})]}),e.jsx("h3",{className:"research-view__run-title",children:r.title}),e.jsx("p",{className:"research-view__run-query",children:r.query}),e.jsx("p",{className:"research-view__run-summary","data-testid":"research-state-results",children:r.results?.summary??s("research.noSummaryYet","No summary yet.")}),e.jsxs("div",{className:"research-view__actions",children:[e.jsx("button",{className:"btn",type:"button",title:x.cancelable?void 0:x.blockingReason,disabled:j==="cancel"||j==="retry"||!x.cancelable,onClick:()=>void z("cancel",()=>M(r.id),s("research.runCancelled","Run cancelled")),children:s("actions.cancel","Cancel")}),e.jsx("button",{className:"btn",type:"button",title:x.retryable?void 0:x.blockingReason,disabled:j==="cancel"||j==="retry"||!x.retryable,onClick:()=>void z("retry",()=>T(r.id),s("research.runRetried","Run retried")),children:s("actions.retry","Retry")}),ee.includes("markdown")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-markdown",onClick:()=>void te("markdown"),children:s("research.exportMd","Export MD")}),ee.includes("json")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-json",onClick:()=>void te("json"),children:s("research.exportJson","Export JSON")}),ee.includes("html")&&e.jsx("button",{className:"btn",type:"button",disabled:j==="export-html",onClick:()=>void te("html"),children:s("research.exportHtml","Export HTML")})]}),r.error&&e.jsx("p",{className:"research-view__error",children:r.error}),k&&e.jsxs("div",{className:"form-error",role:"alert",children:[e.jsx("p",{children:k.message}),k.setupHint&&e.jsx("p",{children:k.setupHint}),k.code==="MISSING_CREDENTIALS"&&e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>i?.("authentication"),children:s("research.openAuthSettings","Open Authentication Settings")}),k.code==="FEATURE_DISABLED"&&e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>i?.("research-project"),children:s("research.openResearchSettings","Open Research Settings")})]}),x.blockingReason&&e.jsx("p",{className:"research-view__run-query",children:x.blockingReason}),Array.isArray(r.results?.findings)&&r.results.findings.length>0&&e.jsx("div",{className:"research-view__findings",children:r.results.findings.map((t,u)=>{const m=t.id?.trim()||`finding-${u+1}`;return e.jsxs("article",{className:"research-view__finding card",children:[e.jsx("h4",{children:t.heading}),e.jsx("p",{children:t.content}),e.jsxs("div",{className:"research-view__actions research-view__finding-actions",children:[e.jsx("button",{className:"btn btn-primary btn-sm",type:"button",onClick:()=>W({mode:"create",findingId:m}),children:s("research.createTask","Create Task")}),e.jsx("button",{className:"btn btn-sm",type:"button",onClick:()=>W({mode:"enrich",findingId:m}),children:s("research.enrichTask","Enrich Task")})]})]},m)})}),Array.isArray(r.results?.citations)&&r.results.citations.length>0&&e.jsx("ul",{className:"research-view__citations",children:r.results.citations.map(t=>e.jsx("li",{children:e.jsx("a",{href:t,target:"_blank",rel:"noreferrer",children:t})},t))}),r.events.length>0&&e.jsxs("details",{children:[e.jsx("summary",{children:s("research.runHistory","Run history")}),e.jsx("ul",{className:"research-view__events",children:r.events.map(t=>e.jsx("li",{children:t.message},t.id))})]})]}),!r&&g.length>0&&e.jsx("p",{children:s("research.selectRunToViewDetails","Select a run to view details.")}),e.jsxs("div",{className:"research-view__stats",children:[e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statRunning","Running")}),e.jsx("div",{className:"research-view__stat-value",children:S.running})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statCompleted","Completed")}),e.jsx("div",{className:"research-view__stat-value",children:S.completed})]}),e.jsxs("div",{className:"research-view__stat-card",children:[e.jsx("div",{className:"research-view__stat-label",children:s("research.statFailed","Failed")}),e.jsx("div",{className:"research-view__stat-value",children:S.failed})]})]})]})]})]})}),r&&L&&(()=>{const t=r.results?.findings?.findIndex((f,m)=>(f.id?.trim()||`finding-${m+1}`)===L.findingId)??-1,u=t>=0?r.results.findings[t]:null;return u?e.jsx(Oe,{open:!0,mode:L.mode,run:r,finding:{id:L.findingId,heading:u.heading,content:u.content},projectId:n,onClose:()=>W(null),onConfirm:async({taskId:f,title:m,description:C,priority:le,attachExport:oe})=>{L.mode==="create"?await z("create-task",()=>U(r.id,m,L.findingId,C,le,oe),s("research.taskCreatedFromResearch","Task created from research")):f&&await z("attach-task",()=>$(r.id,f,L.findingId,oe),s("research.taskEnrichedFromResearch","Task enriched from research")),W(null)}}):null})()]})}export{Je as ResearchView};
@@ -1 +1 @@
1
- import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{V as ue,B as he,R as q,P as me,D as G,F as Y,G as ye,H as xe,I as ve,J as be,o as je,C as fe}from"./index-BjELA24x.js";import{u as Se}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";const ge="__sync_passphrase__",L={key:"",value:"",description:"",scope:"project",accessPolicy:"prompt",envExportable:!1,envExportKey:""},n={className:"secrets-action-icon","aria-hidden":!0,style:{width:"1em",height:"1em"}},Ne={...n,className:"secrets-action-icon spin"},Re=({addToast:d})=>{const{t:a}=Se("app"),[R,z]=c.useState([]),[T,M]=c.useState(!0),[A,D]=c.useState(null),[K,b]=c.useState(null),[p,O]=c.useState(null),[U,y]=c.useState(!1),[Q,g]=c.useState(null),[t,l]=c.useState(L),[N,C]=c.useState(!1),[V,j]=c.useState({}),[W,B]=c.useState(null),[u,X]=c.useState(!1),[Z,_]=c.useState(!1),[f,F]=c.useState(""),[P,H]=c.useState(""),[ee,I]=c.useState(!1),[E,se]=c.useState(!1),m=c.useRef(new Map),w=c.useRef(new Map),o=c.useCallback(async(s,r)=>{const i=await fetch(s,{...r,headers:{"Content-Type":"application/json",...r?.headers??{}}});if(!i.ok){const h=await i.json().catch(()=>({error:"Request failed"}));throw new Error(String(h?.error??"Request failed"))}if(i.status!==204)return i.json()},[]),x=c.useCallback(async()=>{M(!0),D(null);try{const s=await o("/api/secrets");z(s.secrets)}catch(s){D(s instanceof Error?s.message:String(s))}finally{M(!1)}},[o]),S=c.useCallback(async()=>{try{const s=await o("/api/secrets/sync-passphrase");X(!!s.configured)}catch(s){d?.(a("secrets.errorLoadSyncStatus","Failed to load sync passphrase status: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}},[d,o]);c.useEffect(()=>(x(),S(),()=>{m.current.forEach(s=>clearTimeout(s)),w.current.forEach(s=>clearTimeout(s))}),[x,S]);const k=()=>{_(!1),F(""),H("")},ae=async s=>{await o("/api/secrets/sync-passphrase",{method:"PUT",body:JSON.stringify({passphrase:s})})},re=async()=>{I(!0);try{await ae(f),d?.(u?a("secrets.syncPassphraseRotated","Sync passphrase rotated"):a("secrets.syncPassphraseSet","Sync passphrase set"),"success"),k(),await S()}catch(s){d?.(a("secrets.errorSaveSyncPassphrase","Failed to save sync passphrase: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{I(!1)}},te=async()=>{if(window.confirm(a("secrets.confirmClearSyncPassphrase","Clear the cross-node sync passphrase? Existing sync pairs will stop working until you set a new passphrase.")))try{await o("/api/secrets/sync-passphrase",{method:"DELETE"}),d?.(a("secrets.syncPassphraseCleared","Sync passphrase cleared"),"success"),await S()}catch(r){d?.(a("secrets.errorClearSyncPassphrase","Failed to clear sync passphrase: {{error}}",{error:r instanceof Error?r.message:String(r)}),"error")}},ce=()=>{O(null),l(L),y(!0),C(!1),b(null)},le=s=>{O(s),l({key:s.key,value:"",description:s.description??"",scope:s.scope,accessPolicy:s.accessPolicy,envExportable:s.envExportable,envExportKey:s.envExportKey??""}),y(!0),C(!1),b(null)},ne=async()=>{b(null);try{if(p){const s={key:t.key,description:t.description||null,accessPolicy:t.accessPolicy,envExportable:t.envExportable,envExportKey:t.envExportable&&t.envExportKey||null};t.value&&(s.value=t.value),await o(`/api/secrets/${p.scope}/${p.id}`,{method:"PATCH",body:JSON.stringify(s)})}else await o("/api/secrets",{method:"POST",body:JSON.stringify({scope:t.scope,key:t.key,value:t.value,description:t.description||null,accessPolicy:t.accessPolicy,envExportable:t.envExportable,envExportKey:t.envExportable&&t.envExportKey||null})});y(!1),l(L),await x()}catch(s){b(s instanceof Error?s.message:String(s))}},oe=s=>{const r=m.current.get(s.id);r&&(clearTimeout(r),m.current.delete(s.id)),j(i=>({...i,[s.id]:null}))},ie=async s=>{const r=await o(`/api/secrets/${s.scope}/${s.id}/reveal`,{method:"POST"});j(v=>({...v,[s.id]:r.value})),d?.(a("secrets.revealed","Revealed"),"success");const i=setTimeout(()=>{j(v=>({...v,[s.id]:null})),m.current.delete(s.id)},3e4),h=m.current.get(s.id);h&&clearTimeout(h),m.current.set(s.id,i)},de=async s=>{const r=V[s.id];if(!r)return;await navigator.clipboard.writeText(r),B(s.id),d?.(a("secrets.copied","Copied"),"success");const i=setTimeout(()=>{B(null),j(v=>({...v,[s.id]:null}))},1500),h=w.current.get(s.id);h&&clearTimeout(h),w.current.set(s.id,i)},pe=async s=>{await o(`/api/secrets/${s.scope}/${s.id}`,{method:"DELETE"}),g(null),await x()},$=c.useMemo(()=>[...R].filter(s=>!(s.scope==="global"&&s.key===ge)).sort((s,r)=>s.key.localeCompare(r.key)),[R]),J=f.length>0&&f===P;return e.jsxs("section",{className:"secrets-view",children:[e.jsx(ue,{icon:he,title:a("secrets.title","Secrets"),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void x(),children:[e.jsx(q,{...n})," ",a("secrets.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:ce,children:[e.jsx(me,{...n})," ",a("secrets.addSecret","Add Secret")]})]})}),A?e.jsx("div",{className:"form-error",children:A}):null,T?e.jsxs("div",{className:"secrets-loading",children:[e.jsx(q,{...Ne})," ",a("secrets.loading","Loading…")]}):null,!T&&$.length===0?e.jsx("div",{className:"secrets-empty",children:a("secrets.empty","No secrets found.")}):null,e.jsx("div",{className:"secrets-list",children:$.map(s=>{const r=V[s.id];return e.jsxs("article",{className:"card secrets-row",children:[e.jsxs("div",{className:"secrets-row-main",children:[e.jsx("div",{className:"secrets-row-key",children:s.key}),e.jsxs("div",{className:"secrets-row-meta",children:[e.jsx("span",{className:"secrets-chip",children:s.scope}),e.jsx("span",{className:"secrets-chip",children:s.accessPolicy}),s.envExportable?e.jsx("span",{className:"secrets-chip",children:a("secrets.envExportableChip","env exportable")}):null]}),r?e.jsx("pre",{className:"secrets-revealed",children:r}):null]}),e.jsxs("div",{className:"secrets-row-side",children:[e.jsx("span",{className:"secrets-row-read",children:s.lastReadAt?new Date(s.lastReadAt).toLocaleString():a("secrets.neverRead","Never read")}),e.jsxs("div",{className:"secrets-row-actions",children:[e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>{if(r){oe(s);return}ie(s)},"aria-label":r?a("secrets.hideAriaLabel","Hide"):a("secrets.revealAriaLabel","Reveal"),children:r?e.jsx(G,{...n}):e.jsx(Y,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>void de(s),"aria-label":a("secrets.copyAriaLabel","Copy"),disabled:!r,children:W===s.id?e.jsx(ye,{...n}):e.jsx(xe,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>le(s),"aria-label":a("secrets.editAriaLabel","Edit"),children:e.jsx(ve,{...n})}),e.jsx("button",{className:"btn btn-icon btn-danger",onClick:()=>g(s.id),"aria-label":a("secrets.deleteAriaLabel","Delete"),children:e.jsx(be,{...n})})]}),Q===s.id?e.jsxs("div",{className:"secrets-confirm",children:[e.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>void pe(s),children:a("secrets.confirmDelete","Confirm")}),e.jsx("button",{className:"btn btn-sm",onClick:()=>g(null),children:a("secrets.cancelDelete","Cancel")})]}):null]})]},s.id)})}),e.jsxs("article",{className:"card secrets-sync-card secrets-sync-disclosure",children:[e.jsxs("button",{type:"button",className:"secrets-sync-disclosure-toggle","data-testid":"secrets-passphrase-disclosure","aria-expanded":E,"aria-controls":"secrets-sync-disclosure-panel",onClick:()=>se(s=>!s),children:[E?e.jsx(je,{size:16,"aria-hidden":"true"}):e.jsx(fe,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:a("secrets.syncPassphraseTitle","Cross-Node Sync Passphrase")})]}),E?e.jsxs("div",{id:"secrets-sync-disclosure-panel",className:"secrets-sync-disclosure-panel",children:[e.jsxs("div",{className:"secrets-sync-header",children:[e.jsxs("p",{className:"secrets-sync-status",children:[e.jsx("span",{className:`status-dot ${u?"status-dot--online":"status-dot--pending"}`,"aria-hidden":"true"})," ",u?a("secrets.syncConfigured","Configured"):a("secrets.syncNotConfigured","Not configured")]}),e.jsxs("div",{className:"secrets-sync-actions",children:[e.jsx("button",{className:"btn",onClick:()=>_(!0),children:u?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")}),u?e.jsx("button",{className:"btn btn-danger",onClick:()=>void te(),children:a("secrets.clearSyncPassphrase","Clear")}):null]})]}),e.jsx("p",{className:"secrets-sync-copy",children:a("secrets.syncPassphraseDescription","Shared passphrase used to wrap cross-node secret bundles. Both nodes in a sync pair must share the same value. Stored locally only; never transmitted.")})]}):null]}),Z?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase")}),e.jsx("button",{className:"modal-close",onClick:k,"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.passphraseLabel","Passphrase")}),e.jsx("input",{"aria-label":a("secrets.passphraseLabel","Passphrase"),className:"input",type:"password",autoComplete:"new-password",value:f,onChange:s=>F(s.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.confirmPassphraseLabel","Confirm passphrase")}),e.jsx("input",{"aria-label":a("secrets.confirmPassphraseLabel","Confirm passphrase"),className:"input",type:"password",autoComplete:"new-password",value:P,onChange:s=>H(s.target.value)})]}),!J&&P.length>0?e.jsx("div",{className:"form-error",children:a("secrets.passphraseMustMatch","Passphrases must match.")}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:k,children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void re(),disabled:!J||ee,children:u?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")})]})})]})}):null,U?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":p?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:p?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret")}),e.jsx("button",{className:"modal-close",onClick:()=>y(!1),"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.keyLabel","Key")}),e.jsx("input",{className:"input",value:t.key,onChange:s=>l(r=>({...r,key:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.valueLabel","Value")}),e.jsxs("div",{className:"secrets-value-row",children:[e.jsx("input",{className:"input",type:N?"text":"password",autoComplete:"off",spellCheck:!1,value:t.value,onChange:s=>l(r=>({...r,value:s.target.value}))}),e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>C(s=>!s),"aria-label":N?a("secrets.hideValueAriaLabel","Hide value"):a("secrets.showValueAriaLabel","Show value"),children:N?e.jsx(G,{...n}):e.jsx(Y,{...n})})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.descriptionLabel","Description")}),e.jsx("textarea",{className:"input",value:t.description,onChange:s=>l(r=>({...r,description:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.scopeLabel","Scope")}),e.jsxs("div",{className:"secrets-radio-row",children:[e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t.scope==="project",onChange:()=>l(s=>({...s,scope:"project"})),disabled:!!p})," ",a("secrets.scopeProject","Project")]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t.scope==="global",onChange:()=>l(s=>({...s,scope:"global"})),disabled:!!p})," ",a("secrets.scopeGlobal","Global")]})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.accessPolicyLabel","Access policy")}),e.jsxs("select",{className:"select",value:t.accessPolicy,onChange:s=>l(r=>({...r,accessPolicy:s.target.value})),children:[e.jsx("option",{value:"auto",children:a("secrets.accessPolicyAuto","auto")}),e.jsx("option",{value:"prompt",children:a("secrets.accessPolicyPrompt","prompt")}),e.jsx("option",{value:"deny",children:a("secrets.accessPolicyDeny","deny")})]})]}),e.jsx("div",{className:"form-group",children:e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.envExportable,onChange:s=>l(r=>({...r,envExportable:s.target.checked}))})," ",a("secrets.exportToEnvLabel","Export to env")]})}),t.envExportable?e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.envKeyLabel","Env key")}),e.jsx("input",{className:"input",value:t.envExportKey,onChange:s=>l(r=>({...r,envExportKey:s.target.value}))})]}):null,K?e.jsx("div",{className:"form-error",children:K}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:()=>y(!1),children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void ne(),children:p?a("secrets.saveBtn","Save"):a("secrets.createBtn","Create")})]})})]})}):null]})};export{Re as SecretsView};
1
+ import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{V as ue,B as he,R as q,P as me,D as G,F as Y,G as ye,H as xe,I as ve,J as be,o as je,C as fe}from"./index-D7eX7QJk.js";import{u as Se}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-xterm-BNq00GSj.js";const ge="__sync_passphrase__",L={key:"",value:"",description:"",scope:"project",accessPolicy:"prompt",envExportable:!1,envExportKey:""},n={className:"secrets-action-icon","aria-hidden":!0,style:{width:"1em",height:"1em"}},Ne={...n,className:"secrets-action-icon spin"},Re=({addToast:d})=>{const{t:a}=Se("app"),[R,z]=c.useState([]),[T,M]=c.useState(!0),[A,D]=c.useState(null),[K,b]=c.useState(null),[p,O]=c.useState(null),[U,y]=c.useState(!1),[Q,g]=c.useState(null),[t,l]=c.useState(L),[N,C]=c.useState(!1),[V,j]=c.useState({}),[W,B]=c.useState(null),[u,X]=c.useState(!1),[Z,_]=c.useState(!1),[f,F]=c.useState(""),[P,H]=c.useState(""),[ee,I]=c.useState(!1),[E,se]=c.useState(!1),m=c.useRef(new Map),w=c.useRef(new Map),o=c.useCallback(async(s,r)=>{const i=await fetch(s,{...r,headers:{"Content-Type":"application/json",...r?.headers??{}}});if(!i.ok){const h=await i.json().catch(()=>({error:"Request failed"}));throw new Error(String(h?.error??"Request failed"))}if(i.status!==204)return i.json()},[]),x=c.useCallback(async()=>{M(!0),D(null);try{const s=await o("/api/secrets");z(s.secrets)}catch(s){D(s instanceof Error?s.message:String(s))}finally{M(!1)}},[o]),S=c.useCallback(async()=>{try{const s=await o("/api/secrets/sync-passphrase");X(!!s.configured)}catch(s){d?.(a("secrets.errorLoadSyncStatus","Failed to load sync passphrase status: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}},[d,o]);c.useEffect(()=>(x(),S(),()=>{m.current.forEach(s=>clearTimeout(s)),w.current.forEach(s=>clearTimeout(s))}),[x,S]);const k=()=>{_(!1),F(""),H("")},ae=async s=>{await o("/api/secrets/sync-passphrase",{method:"PUT",body:JSON.stringify({passphrase:s})})},re=async()=>{I(!0);try{await ae(f),d?.(u?a("secrets.syncPassphraseRotated","Sync passphrase rotated"):a("secrets.syncPassphraseSet","Sync passphrase set"),"success"),k(),await S()}catch(s){d?.(a("secrets.errorSaveSyncPassphrase","Failed to save sync passphrase: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{I(!1)}},te=async()=>{if(window.confirm(a("secrets.confirmClearSyncPassphrase","Clear the cross-node sync passphrase? Existing sync pairs will stop working until you set a new passphrase.")))try{await o("/api/secrets/sync-passphrase",{method:"DELETE"}),d?.(a("secrets.syncPassphraseCleared","Sync passphrase cleared"),"success"),await S()}catch(r){d?.(a("secrets.errorClearSyncPassphrase","Failed to clear sync passphrase: {{error}}",{error:r instanceof Error?r.message:String(r)}),"error")}},ce=()=>{O(null),l(L),y(!0),C(!1),b(null)},le=s=>{O(s),l({key:s.key,value:"",description:s.description??"",scope:s.scope,accessPolicy:s.accessPolicy,envExportable:s.envExportable,envExportKey:s.envExportKey??""}),y(!0),C(!1),b(null)},ne=async()=>{b(null);try{if(p){const s={key:t.key,description:t.description||null,accessPolicy:t.accessPolicy,envExportable:t.envExportable,envExportKey:t.envExportable&&t.envExportKey||null};t.value&&(s.value=t.value),await o(`/api/secrets/${p.scope}/${p.id}`,{method:"PATCH",body:JSON.stringify(s)})}else await o("/api/secrets",{method:"POST",body:JSON.stringify({scope:t.scope,key:t.key,value:t.value,description:t.description||null,accessPolicy:t.accessPolicy,envExportable:t.envExportable,envExportKey:t.envExportable&&t.envExportKey||null})});y(!1),l(L),await x()}catch(s){b(s instanceof Error?s.message:String(s))}},oe=s=>{const r=m.current.get(s.id);r&&(clearTimeout(r),m.current.delete(s.id)),j(i=>({...i,[s.id]:null}))},ie=async s=>{const r=await o(`/api/secrets/${s.scope}/${s.id}/reveal`,{method:"POST"});j(v=>({...v,[s.id]:r.value})),d?.(a("secrets.revealed","Revealed"),"success");const i=setTimeout(()=>{j(v=>({...v,[s.id]:null})),m.current.delete(s.id)},3e4),h=m.current.get(s.id);h&&clearTimeout(h),m.current.set(s.id,i)},de=async s=>{const r=V[s.id];if(!r)return;await navigator.clipboard.writeText(r),B(s.id),d?.(a("secrets.copied","Copied"),"success");const i=setTimeout(()=>{B(null),j(v=>({...v,[s.id]:null}))},1500),h=w.current.get(s.id);h&&clearTimeout(h),w.current.set(s.id,i)},pe=async s=>{await o(`/api/secrets/${s.scope}/${s.id}`,{method:"DELETE"}),g(null),await x()},$=c.useMemo(()=>[...R].filter(s=>!(s.scope==="global"&&s.key===ge)).sort((s,r)=>s.key.localeCompare(r.key)),[R]),J=f.length>0&&f===P;return e.jsxs("section",{className:"secrets-view",children:[e.jsx(ue,{icon:he,title:a("secrets.title","Secrets"),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void x(),children:[e.jsx(q,{...n})," ",a("secrets.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:ce,children:[e.jsx(me,{...n})," ",a("secrets.addSecret","Add Secret")]})]})}),A?e.jsx("div",{className:"form-error",children:A}):null,T?e.jsxs("div",{className:"secrets-loading",children:[e.jsx(q,{...Ne})," ",a("secrets.loading","Loading…")]}):null,!T&&$.length===0?e.jsx("div",{className:"secrets-empty",children:a("secrets.empty","No secrets found.")}):null,e.jsx("div",{className:"secrets-list",children:$.map(s=>{const r=V[s.id];return e.jsxs("article",{className:"card secrets-row",children:[e.jsxs("div",{className:"secrets-row-main",children:[e.jsx("div",{className:"secrets-row-key",children:s.key}),e.jsxs("div",{className:"secrets-row-meta",children:[e.jsx("span",{className:"secrets-chip",children:s.scope}),e.jsx("span",{className:"secrets-chip",children:s.accessPolicy}),s.envExportable?e.jsx("span",{className:"secrets-chip",children:a("secrets.envExportableChip","env exportable")}):null]}),r?e.jsx("pre",{className:"secrets-revealed",children:r}):null]}),e.jsxs("div",{className:"secrets-row-side",children:[e.jsx("span",{className:"secrets-row-read",children:s.lastReadAt?new Date(s.lastReadAt).toLocaleString():a("secrets.neverRead","Never read")}),e.jsxs("div",{className:"secrets-row-actions",children:[e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>{if(r){oe(s);return}ie(s)},"aria-label":r?a("secrets.hideAriaLabel","Hide"):a("secrets.revealAriaLabel","Reveal"),children:r?e.jsx(G,{...n}):e.jsx(Y,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>void de(s),"aria-label":a("secrets.copyAriaLabel","Copy"),disabled:!r,children:W===s.id?e.jsx(ye,{...n}):e.jsx(xe,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>le(s),"aria-label":a("secrets.editAriaLabel","Edit"),children:e.jsx(ve,{...n})}),e.jsx("button",{className:"btn btn-icon btn-danger",onClick:()=>g(s.id),"aria-label":a("secrets.deleteAriaLabel","Delete"),children:e.jsx(be,{...n})})]}),Q===s.id?e.jsxs("div",{className:"secrets-confirm",children:[e.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>void pe(s),children:a("secrets.confirmDelete","Confirm")}),e.jsx("button",{className:"btn btn-sm",onClick:()=>g(null),children:a("secrets.cancelDelete","Cancel")})]}):null]})]},s.id)})}),e.jsxs("article",{className:"card secrets-sync-card secrets-sync-disclosure",children:[e.jsxs("button",{type:"button",className:"secrets-sync-disclosure-toggle","data-testid":"secrets-passphrase-disclosure","aria-expanded":E,"aria-controls":"secrets-sync-disclosure-panel",onClick:()=>se(s=>!s),children:[E?e.jsx(je,{size:16,"aria-hidden":"true"}):e.jsx(fe,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:a("secrets.syncPassphraseTitle","Cross-Node Sync Passphrase")})]}),E?e.jsxs("div",{id:"secrets-sync-disclosure-panel",className:"secrets-sync-disclosure-panel",children:[e.jsxs("div",{className:"secrets-sync-header",children:[e.jsxs("p",{className:"secrets-sync-status",children:[e.jsx("span",{className:`status-dot ${u?"status-dot--online":"status-dot--pending"}`,"aria-hidden":"true"})," ",u?a("secrets.syncConfigured","Configured"):a("secrets.syncNotConfigured","Not configured")]}),e.jsxs("div",{className:"secrets-sync-actions",children:[e.jsx("button",{className:"btn",onClick:()=>_(!0),children:u?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")}),u?e.jsx("button",{className:"btn btn-danger",onClick:()=>void te(),children:a("secrets.clearSyncPassphrase","Clear")}):null]})]}),e.jsx("p",{className:"secrets-sync-copy",children:a("secrets.syncPassphraseDescription","Shared passphrase used to wrap cross-node secret bundles. Both nodes in a sync pair must share the same value. Stored locally only; never transmitted.")})]}):null]}),Z?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase")}),e.jsx("button",{className:"modal-close",onClick:k,"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.passphraseLabel","Passphrase")}),e.jsx("input",{"aria-label":a("secrets.passphraseLabel","Passphrase"),className:"input",type:"password",autoComplete:"new-password",value:f,onChange:s=>F(s.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.confirmPassphraseLabel","Confirm passphrase")}),e.jsx("input",{"aria-label":a("secrets.confirmPassphraseLabel","Confirm passphrase"),className:"input",type:"password",autoComplete:"new-password",value:P,onChange:s=>H(s.target.value)})]}),!J&&P.length>0?e.jsx("div",{className:"form-error",children:a("secrets.passphraseMustMatch","Passphrases must match.")}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:k,children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void re(),disabled:!J||ee,children:u?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")})]})})]})}):null,U?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":p?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:p?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret")}),e.jsx("button",{className:"modal-close",onClick:()=>y(!1),"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.keyLabel","Key")}),e.jsx("input",{className:"input",value:t.key,onChange:s=>l(r=>({...r,key:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.valueLabel","Value")}),e.jsxs("div",{className:"secrets-value-row",children:[e.jsx("input",{className:"input",type:N?"text":"password",autoComplete:"off",spellCheck:!1,value:t.value,onChange:s=>l(r=>({...r,value:s.target.value}))}),e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>C(s=>!s),"aria-label":N?a("secrets.hideValueAriaLabel","Hide value"):a("secrets.showValueAriaLabel","Show value"),children:N?e.jsx(G,{...n}):e.jsx(Y,{...n})})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.descriptionLabel","Description")}),e.jsx("textarea",{className:"input",value:t.description,onChange:s=>l(r=>({...r,description:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.scopeLabel","Scope")}),e.jsxs("div",{className:"secrets-radio-row",children:[e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t.scope==="project",onChange:()=>l(s=>({...s,scope:"project"})),disabled:!!p})," ",a("secrets.scopeProject","Project")]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t.scope==="global",onChange:()=>l(s=>({...s,scope:"global"})),disabled:!!p})," ",a("secrets.scopeGlobal","Global")]})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.accessPolicyLabel","Access policy")}),e.jsxs("select",{className:"select",value:t.accessPolicy,onChange:s=>l(r=>({...r,accessPolicy:s.target.value})),children:[e.jsx("option",{value:"auto",children:a("secrets.accessPolicyAuto","auto")}),e.jsx("option",{value:"prompt",children:a("secrets.accessPolicyPrompt","prompt")}),e.jsx("option",{value:"deny",children:a("secrets.accessPolicyDeny","deny")})]})]}),e.jsx("div",{className:"form-group",children:e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.envExportable,onChange:s=>l(r=>({...r,envExportable:s.target.checked}))})," ",a("secrets.exportToEnvLabel","Export to env")]})}),t.envExportable?e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.envKeyLabel","Env key")}),e.jsx("input",{className:"input",value:t.envExportKey,onChange:s=>l(r=>({...r,envExportKey:s.target.value}))})]}):null,K?e.jsx("div",{className:"form-error",children:K}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:()=>y(!1),children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void ne(),children:p?a("secrets.saveBtn","Save"):a("secrets.createBtn","Create")})]})})]})}):null]})};export{Re as SecretsView};
@@ -1 +1 @@
1
- @font-face{font-family:Fusion Terminal Nerd Font Symbols;src:url(/fonts/SymbolsNerdFontMono-Regular.ttf) format("truetype");font-display:swap;unicode-range:U+23FB-23FE,U+2665,U+26A1,U+2B58,U+E000-E00A,U+E0A0-E0D7,U+E200-E2A9,U+E300-E3E3,U+E5FA-E6B7,U+E700-E8EF,U+EA60-EC1E,U+ED00-F2FF,U+F300-F533,U+F0001-F1AF0}.cli-session-terminal{display:flex;flex-direction:column;min-height:0;height:100%;background:var(--terminal-bg, var(--bg));border:1px solid var(--border);border-radius:var(--radius-md);overflow:hidden}.cli-session-terminal__header{display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-xs) var(--space-sm);background:var(--surface);border-bottom:1px solid var(--border);flex-wrap:wrap}.cli-session-terminal__posture-wrap{position:relative}.cli-posture-chip{display:inline-flex;align-items:center;gap:var(--space-xs);padding:2px var(--space-sm);font-size:.75rem;line-height:1.4;color:var(--text);background:var(--card);border:1px solid var(--border);border-radius:var(--radius-sm);cursor:pointer;transition:background var(--transition-fast, .12s) ease}.cli-posture-chip:hover{background:var(--card-hover)}.cli-posture-chip--elevated{color:var(--color-warning);border-color:var(--color-warning)}.cli-posture-chip__mode{color:var(--text-muted)}.cli-posture-chip__flag{font-weight:600}.cli-posture-tooltip{position:absolute;top:calc(100% + var(--space-xs));left:0;z-index:10;min-width:220px;padding:var(--space-sm);background:var(--card);border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:var(--shadow-md)}.cli-posture-tooltip__title{margin:0 0 var(--space-xs);font-size:.75rem;font-weight:600;color:var(--text)}.cli-posture-tooltip__list{margin:0;padding-left:var(--space-md);font-size:.75rem;color:var(--text-muted)}.cli-posture-tooltip__settings{display:inline-flex;align-items:center;gap:var(--space-xs);margin-top:var(--space-sm);padding:2px var(--space-sm);font-size:.75rem;color:var(--accent);background:transparent;border:1px solid var(--border);border-radius:var(--radius-sm);cursor:pointer}.cli-session-terminal__readonly-badge,.cli-session-terminal__replay-badge{display:inline-flex;align-items:center;gap:var(--space-xs);padding:2px var(--space-sm);font-size:.7rem;color:var(--text-muted);background:var(--card);border:1px solid var(--border);border-radius:var(--radius-sm)}.cli-session-terminal__replay-badge[data-replay-mode=ended]{color:var(--text-muted)}.cli-session-terminal__viewport{flex:1 1 auto;min-height:0;padding:var(--space-xs);background:var(--terminal-bg, var(--bg))}.cli-session-terminal__viewport,.cli-session-terminal__viewport *{-webkit-text-size-adjust:100%;text-size-adjust:100%}.cli-session-terminal__viewport .xterm-rows span{font-family:var(--terminal-glyph-font-family, inherit)!important}.cli-session-terminal__advance-strip{display:flex;align-items:center;justify-content:space-between;gap:var(--space-sm);padding:var(--space-sm);background:var(--surface);border-top:1px solid var(--border);flex-wrap:wrap}.cli-session-terminal__advance-copy{font-size:.8125rem;color:var(--text)}.cli-session-terminal__advance-actions{display:flex;gap:var(--space-xs)}.cli-session-terminal__advance-btn{padding:4px var(--space-md);font-size:.8125rem;color:var(--accent-text);background:var(--accent);border:1px solid transparent;border-radius:var(--radius-sm);cursor:pointer}.cli-session-terminal__advance-btn:disabled{opacity:.6;cursor:default}.cli-session-terminal__advance-btn--secondary{color:var(--text);background:var(--card);border-color:var(--border)}.cli-session-terminal__mobile-bar{position:sticky;bottom:0;z-index:5;display:flex;flex-direction:column;gap:var(--space-xs);padding:var(--space-xs) var(--space-sm) calc(var(--space-sm) + env(safe-area-inset-bottom,0px));background:var(--surface);border-top:1px solid var(--border)}.cli-session-terminal__mobile-bar--keyboard-open{position:fixed;left:0;right:0;padding-bottom:var(--space-sm)}.cli-session-terminal__key-row{display:flex;gap:var(--space-xs);overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}.cli-session-terminal__key-row::-webkit-scrollbar{display:none}.cli-terminal-key{flex:0 0 auto;min-width:40px;min-height:36px;padding:var(--space-xs) var(--space-sm);font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,monospace;font-size:.8125rem;color:var(--text);background:var(--card);border:1px solid var(--border);border-radius:var(--radius-sm);cursor:pointer;touch-action:manipulation}.cli-terminal-key:active{background:var(--card-hover)}.cli-terminal-key--ctrl.cli-terminal-key--active{color:var(--accent-text);background:var(--accent);border-color:var(--accent)}.cli-terminal-key--ctrlc{color:var(--color-warning);border-color:var(--color-warning)}.cli-session-terminal__input-row{display:flex;gap:var(--space-xs)}.cli-session-terminal__mobile-input{flex:1 1 auto;min-width:0;min-height:38px;padding:var(--space-xs) var(--space-sm);font-size:16px;color:var(--text);background:var(--surface-1);border:1px solid var(--border);border-radius:var(--radius-sm)}.cli-session-terminal__mobile-input:focus{outline:none;border-color:var(--accent)}.cli-session-terminal__mobile-send{flex:0 0 auto;min-height:38px;padding:var(--space-xs) var(--space-md);font-size:.8125rem;color:var(--accent-text);background:var(--accent);border:1px solid transparent;border-radius:var(--radius-sm);cursor:pointer;touch-action:manipulation}@media(max-width:768px),(max-height:480px){.cli-session-terminal__viewport{-webkit-overflow-scrolling:touch}}
1
+ @font-face{font-family:Fusion Terminal Nerd Font Symbols;src:url(/fonts/SymbolsNerdFontMono-Regular.ttf) format("truetype");font-display:swap;unicode-range:U+23FB-23FE,U+2665,U+26A1,U+2B58,U+E000-E00A,U+E0A0-E0D7,U+E200-E2A9,U+E300-E3E3,U+E5FA-E6B7,U+E700-E8EF,U+EA60-EC1E,U+ED00-F2FF,U+F300-F533,U+F0001-F1AF0}.cli-session-terminal{display:flex;flex-direction:column;min-height:0;height:100%;background:var(--terminal-bg, var(--bg));border:1px solid var(--border);border-radius:var(--radius-md);overflow:hidden}.cli-session-terminal__header{display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-xs) var(--space-sm);background:var(--surface);border-bottom:1px solid var(--border);flex-wrap:wrap}.cli-session-terminal__posture-wrap{position:relative}.cli-posture-chip{display:inline-flex;align-items:center;gap:var(--space-xs);padding:2px var(--space-sm);font-size:.75rem;line-height:1.4;color:var(--text);background:var(--card);border:1px solid var(--border);border-radius:var(--radius-sm);cursor:pointer;transition:background var(--transition-fast, .12s) ease}.cli-posture-chip:hover{background:var(--card-hover)}.cli-posture-chip--elevated{color:var(--color-warning);border-color:var(--color-warning)}.cli-posture-chip__mode{color:var(--text-muted)}.cli-posture-chip__flag{font-weight:600}.cli-posture-tooltip{position:absolute;top:calc(100% + var(--space-xs));left:0;z-index:10;min-width:220px;padding:var(--space-sm);background:var(--card);border:1px solid var(--border);border-radius:var(--radius-md);box-shadow:var(--shadow-md)}.cli-posture-tooltip__title{margin:0 0 var(--space-xs);font-size:.75rem;font-weight:600;color:var(--text)}.cli-posture-tooltip__list{margin:0;padding-left:var(--space-md);font-size:.75rem;color:var(--text-muted)}.cli-posture-tooltip__settings{display:inline-flex;align-items:center;gap:var(--space-xs);margin-top:var(--space-sm);padding:2px var(--space-sm);font-size:.75rem;color:var(--accent);background:transparent;border:1px solid var(--border);border-radius:var(--radius-sm);cursor:pointer}.cli-session-terminal__readonly-badge,.cli-session-terminal__replay-badge{display:inline-flex;align-items:center;gap:var(--space-xs);padding:2px var(--space-sm);font-size:.7rem;color:var(--text-muted);background:var(--card);border:1px solid var(--border);border-radius:var(--radius-sm)}.cli-session-terminal__replay-badge[data-replay-mode=ended]{color:var(--text-muted)}.cli-session-terminal__viewport{flex:1 1 auto;min-height:0;padding:var(--space-xs);background:var(--terminal-bg, var(--bg))}.cli-session-terminal__viewport,.cli-session-terminal__viewport *{-webkit-text-size-adjust:none;text-size-adjust:none}.cli-session-terminal__viewport .xterm-rows span{font-family:var(--terminal-glyph-font-family, inherit)!important}.cli-session-terminal__advance-strip{display:flex;align-items:center;justify-content:space-between;gap:var(--space-sm);padding:var(--space-sm);background:var(--surface);border-top:1px solid var(--border);flex-wrap:wrap}.cli-session-terminal__advance-copy{font-size:.8125rem;color:var(--text)}.cli-session-terminal__advance-actions{display:flex;gap:var(--space-xs)}.cli-session-terminal__advance-btn{padding:4px var(--space-md);font-size:.8125rem;color:var(--accent-text);background:var(--accent);border:1px solid transparent;border-radius:var(--radius-sm);cursor:pointer}.cli-session-terminal__advance-btn:disabled{opacity:.6;cursor:default}.cli-session-terminal__advance-btn--secondary{color:var(--text);background:var(--card);border-color:var(--border)}.cli-session-terminal__mobile-bar{position:sticky;bottom:0;z-index:5;display:flex;flex-direction:column;gap:var(--space-xs);padding:var(--space-xs) var(--space-sm) calc(var(--space-sm) + env(safe-area-inset-bottom,0px));background:var(--surface);border-top:1px solid var(--border)}.cli-session-terminal__mobile-bar--keyboard-open{position:fixed;left:0;right:0;padding-bottom:var(--space-sm)}.cli-session-terminal__key-row{display:flex;gap:var(--space-xs);overflow-x:auto;-webkit-overflow-scrolling:touch;scrollbar-width:none}.cli-session-terminal__key-row::-webkit-scrollbar{display:none}.cli-terminal-key{flex:0 0 auto;min-width:40px;min-height:36px;padding:var(--space-xs) var(--space-sm);font-family:ui-monospace,SFMono-Regular,SF Mono,Menlo,Consolas,monospace;font-size:.8125rem;color:var(--text);background:var(--card);border:1px solid var(--border);border-radius:var(--radius-sm);cursor:pointer;touch-action:manipulation}.cli-terminal-key:active{background:var(--card-hover)}.cli-terminal-key--ctrl.cli-terminal-key--active{color:var(--accent-text);background:var(--accent);border-color:var(--accent)}.cli-terminal-key--ctrlc{color:var(--color-warning);border-color:var(--color-warning)}.cli-session-terminal__input-row{display:flex;gap:var(--space-xs)}.cli-session-terminal__mobile-input{flex:1 1 auto;min-width:0;min-height:38px;padding:var(--space-xs) var(--space-sm);font-size:16px;color:var(--text);background:var(--surface-1);border:1px solid var(--border);border-radius:var(--radius-sm)}.cli-session-terminal__mobile-input:focus{outline:none;border-color:var(--accent)}.cli-session-terminal__mobile-send{flex:0 0 auto;min-height:38px;padding:var(--space-xs) var(--space-md);font-size:.8125rem;color:var(--accent-text);background:var(--accent);border:1px solid transparent;border-radius:var(--radius-sm);cursor:pointer;touch-action:manipulation}@media(max-width:768px),(max-height:480px){.cli-session-terminal__viewport{-webkit-overflow-scrolling:touch}}
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-xterm-BNq00GSj.js","assets/vendor-react-SZ_qB27O.js","assets/vendor-xterm-LZoznX6r.css","assets/addon-fit-C1WQXRvu.js","assets/addon-unicode11-BVmNDUBM.js","assets/addon-webgl-uLc0RKcC.js"])))=>i.map(i=>d[i]);
2
+ import{W as Te,Y as Q,$ as le,a0 as V,a1 as ce,a2 as F,a3 as ge,a4 as Ce,F as xe,a5 as J,a6 as Ne,a7 as Re,a8 as Pe,_ as B,a9 as je}from"./index-D7eX7QJk.js";import{r as i,j as t}from"./vendor-react-SZ_qB27O.js";import"./vendor-xterm-BNq00GSj.js";import{u as Me}from"./vendor-i18n-GF3RlKbq.js";import{S as De}from"./shield-alert-BdAjnDkU.js";import"./vendor-reactflow-CnI7NMXG.js";import"./vendor-codemirror-jBKmHyH0.js";const Le=32*1024,Oe=100,Ae="\x1B",ze=" ",Fe="",Be="\x1B[A",Ie="\x1B[B",Ke="\x1B[C",We="\x1B[D",I={ctrl:"Ctrl",escape:"Esc",tab:"Tab",ctrlC:"^C"};function de(u){if(u.length!==1)return null;const o=u.toUpperCase().charCodeAt(0);return o>=64&&o<=95?String.fromCharCode(o&31):null}function $e(){const[u,f]=i.useState(()=>J());return i.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const o=window.matchMedia(Ne),a=window.visualViewport,y=()=>f(J());return y(),typeof a?.addEventListener=="function"&&a.addEventListener("resize",y),typeof o.addEventListener=="function"?(o.addEventListener("change",y),()=>{o.removeEventListener("change",y),typeof a?.removeEventListener=="function"&&a.removeEventListener("resize",y)}):(o.addListener(y),()=>{o.removeListener(y),typeof a?.removeEventListener=="function"&&a.removeEventListener("resize",y)})},[]),u}function Ue(u,f){if(typeof window>"u")return"";const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/cli-sessions/ws?sessionId=${encodeURIComponent(u)}&ticket=${encodeURIComponent(f)}`;return je(a)}function Qe(){return/Mac|iPhone|iPad|iPod/i.test(navigator.platform)}function Ve(u){if(typeof window<"u"&&typeof window.atob=="function"){const f=window.atob(u),o=new Uint8Array(f.length);for(let a=0;a<f.length;a++)o[a]=f.charCodeAt(a);return new TextDecoder("utf-8").decode(o)}return Buffer.from(u,"base64").toString("utf8")}function nt({sessionId:u,readOnly:f=!1,posture:o,mode:a="live",projectId:y,onConfirmAdvance:E,showConfirmAdvance:K=!1,onOpenAdapterSettings:Y}){const{t:r}=Me("app"),T=i.useRef(null),g=i.useRef(null),j=i.useRef(null),_=i.useRef(null),[H,G]=i.useState(!1),[ue,W]=i.useState(!1),[Z,q]=i.useState(!1),C=$e(),{keyboardOpen:O,keyboardOverlap:me}=Te({enabled:C}),fe=i.useRef(null),[S,X]=i.useState(""),[x,A]=i.useState(!1),[ee,te]=i.useState(null),ne=f||ee===!0,M=!f&&ee===!1&&a==="live",b=i.useCallback(e=>{if(!e||!M)return;const n=_.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify({type:"input",data:e}))},[M]),N=i.useCallback(e=>{if(x){const n=de(e);if(A(!1),n){b(n);return}}b(e)},[x,b]),c=i.useCallback(e=>{e.preventDefault()},[]),pe=i.useCallback(e=>{e?.preventDefault?.(),S&&b(S),b("\r"),X("")},[S,b]),ye=i.useCallback(e=>{if(x&&e.length>S.length){const n=e.slice(S.length,S.length+1),d=de(n);if(A(!1),d){b(d);return}}X(e)},[x,S,b]);i.useEffect(()=>{K&&W(!1)},[K,u]);const D=i.useCallback((e,n)=>{const d=_.current;d?.readyState===WebSocket.OPEN&&d.send(JSON.stringify({type:"resize",cols:e,rows:n}))},[]),ie=i.useCallback(()=>{const e=g.current;if(!e)return;const n=Q(),d=le(n.fontFamily);e.options.fontFamily=d,T.current?.style.setProperty("--terminal-glyph-font-family",V(n.fontFamily)),e.options.fontSize=n.fontSize,e.options.cursorStyle=n.cursorStyle,e.options.cursorBlink=n.cursorBlink&&M;try{j.current?.fit?.(),D(e.cols,e.rows)}catch{}ce(n.fontSize,d).then(R=>{if(!(!R||g.current!==e||e.options.fontSize!==n.fontSize||e.options.fontFamily!==d)){F(e,d),e.options.fontSize=n.fontSize;try{j.current?.fit?.(),D(e.cols,e.rows),F(e,d),e.refresh(0,Math.max(0,e.rows-1))}catch{}}},()=>{})},[M,D]);i.useEffect(()=>{if(typeof window>"u")return;const e=n=>{n.key===Re&&ie()};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[ie]),i.useEffect(()=>{if(!u||typeof window>"u")return;let e=!1,n=null,d=null,R=0;te(null);const $=D,_e=p=>{if(R+=p,R<Le)return;const h=_.current;h?.readyState===WebSocket.OPEN&&h.send(JSON.stringify({type:"ack",bytes:R})),R=0};return(async()=>{let p;try{p=await Pe(`/cli-sessions/${encodeURIComponent(u)}/attach-ticket`,{method:"POST",body:JSON.stringify(y?{projectId:y}:{})})}catch{return}if(e)return;te(p.readOnly);const h=!f&&!p.readOnly&&a==="live",[{Terminal:Se},{FitAddon:ke},{Unicode11Addon:ve}]=await Promise.all([B(()=>import("./vendor-xterm-BNq00GSj.js").then(l=>l.x),__vite__mapDeps([0,1,2])),B(()=>import("./addon-fit-C1WQXRvu.js").then(l=>l.a),__vite__mapDeps([3,1])),B(()=>import("./addon-unicode11-BVmNDUBM.js").then(l=>l.a),__vite__mapDeps([4,1]))]);if(e||!T.current)return;const w=Q(),L=le(w.fontFamily);T.current.style.setProperty("--terminal-glyph-font-family",V(w.fontFamily));const s=new Se({convertEol:!1,cursorBlink:w.cursorBlink&&h,cursorStyle:w.cursorStyle,disableStdin:!h,scrollback:1e4,fontFamily:L,fontSize:w.fontSize}),P=new ke;s.loadAddon(P);const Ee=new ve;if(s.loadAddon(Ee),s.unicode.activeVersion="11",s.open(T.current),g.current=s,j.current=P,w.renderer==="auto"&&!J())try{const{WebglAddon:l}=await B(async()=>{const{WebglAddon:m}=await import("./addon-webgl-uLc0RKcC.js").then(k=>k.a);return{WebglAddon:m}},__vite__mapDeps([5,1]));if(!e){const m=new l;m.onContextLoss(()=>{try{m.dispose()}catch{}}),s.loadAddon(m)}}catch{}try{P.fit()}catch{}(async()=>{if(!(!await ce(w.fontSize,L)||e||g.current!==s||j.current!==P||s.options.fontSize!==w.fontSize||s.options.fontFamily!==L))try{F(s,L),s.options.fontSize=w.fontSize,P.fit(),$(s.cols,s.rows),F(s,L),s.refresh(0,Math.max(0,s.rows-1))}catch{}})(),h&&(s.onData(l=>{const m=_.current;m?.readyState===WebSocket.OPEN&&m.send(JSON.stringify({type:"input",data:l}))}),s.attachCustomKeyEventHandler(l=>{if(l.type!=="keydown"||!(Qe()?l.metaKey:l.ctrlKey)||l.altKey||l.shiftKey)return!0;const k=l.key.toLowerCase();if(k==="c"){const v=s.hasSelection()?s.getSelection():"";return v?(navigator.clipboard?.writeText(v).catch(()=>{}),!1):!0}if(k==="v"){const v=navigator.clipboard?.readText;return v&&v.call(navigator.clipboard).then(ae=>{if(!ae)return;const re=_.current;re?.readyState===WebSocket.OPEN&&re.send(JSON.stringify({type:"input",data:ae}))}).catch(()=>{}),!1}return!0})),n=new ResizeObserver(()=>{d&&clearTimeout(d),d=setTimeout(()=>{try{P.fit(),$(s.cols,s.rows)}catch{}},Oe)}),n.observe(T.current);const U=new WebSocket(Ue(u,p.ticket));_.current=U,U.onopen=()=>{$(s.cols,s.rows)},U.onmessage=l=>{let m;try{m=JSON.parse(typeof l.data=="string"?l.data:"")}catch{return}switch(m.type){case"scrollback":case"data":{if(typeof m.data!="string")return;const k=Ve(m.data),v=k.length;s.write(k,()=>_e(v));break}}}})(),()=>{e=!0,d&&clearTimeout(d),n&&n.disconnect();const p=_.current;if(p){p.onopen=null,p.onmessage=null,p.onclose=null,p.onerror=null;try{p.close()}catch{}_.current=null}const h=g.current;if(h){try{h.dispose()}catch{}g.current=null}j.current=null}},[u,f,a,y,D]);const se=i.useMemo(()=>a==="idle"?r("cliTerminal.replayIdle","Session idle"):a==="ended"?r("cliTerminal.replayEnded","Session ended"):null,[a,r]),be=i.useCallback(async()=>{if(E){q(!0);try{await E("advance"),W(!0)}finally{q(!1)}}},[E]),he=i.useCallback(async()=>{E&&await E("not-yet"),W(!0)},[E]),z=!!o?.elevated,oe=o?.elevatedFlags?.join(", "),we={"--terminal-glyph-font-family":V(Q().fontFamily)};return t.jsxs("div",{className:`cli-session-terminal${C?" cli-session-terminal--mobile":""}${C&&O?" cli-session-terminal--keyboard-open":""}`,"data-mode":a,"data-read-only":ne,"data-mobile":C,"data-keyboard-open":C&&O,children:[t.jsxs("header",{className:"cli-session-terminal__header",children:[o&&t.jsxs("div",{className:"cli-session-terminal__posture-wrap",children:[t.jsxs("button",{type:"button",className:`cli-posture-chip${z?" cli-posture-chip--elevated":""}`,"data-elevated":z,"aria-expanded":H,onClick:()=>G(e=>!e),children:[z?t.jsx(De,{size:13,"aria-hidden":"true"}):t.jsx(ge,{size:13,"aria-hidden":"true"}),t.jsx("span",{className:"cli-posture-chip__name",children:o.adapterName}),o.mode&&t.jsx("span",{className:"cli-posture-chip__mode",children:o.mode}),z&&oe&&t.jsx("span",{className:"cli-posture-chip__flag",children:oe})]}),H&&t.jsxs("div",{className:"cli-posture-tooltip",role:"tooltip",children:[t.jsx("p",{className:"cli-posture-tooltip__title",children:r("cliTerminal.postureResolved","Resolved posture")}),t.jsxs("ul",{className:"cli-posture-tooltip__list",children:[(o.resolved??[]).map((e,n)=>t.jsx("li",{children:e},n)),(o.resolved??[]).length===0&&t.jsx("li",{children:o.mode??r("cliTerminal.postureBaseline","Baseline")})]}),Y&&t.jsxs("button",{type:"button",className:"cli-posture-tooltip__settings",onClick:()=>{G(!1),Y()},children:[t.jsx(Ce,{size:12,"aria-hidden":"true"}),r("cliTerminal.adapterSettings","Adapter settings")]})]})]}),ne&&t.jsxs("span",{className:"cli-session-terminal__readonly-badge",children:[t.jsx(xe,{size:12,"aria-hidden":"true"}),r("cliTerminal.readOnly","Read-only")]}),se&&t.jsx("span",{className:"cli-session-terminal__replay-badge","data-replay-mode":a,children:se})]}),t.jsx("div",{className:"cli-session-terminal__viewport",ref:T,"data-testid":"cli-terminal-viewport",style:we}),K&&!ue&&t.jsxs("div",{className:"cli-session-terminal__advance-strip",role:"region",children:[t.jsx("span",{className:"cli-session-terminal__advance-copy",children:r("cliTerminal.advancePrompt","This session looks idle — advance to review?")}),t.jsxs("div",{className:"cli-session-terminal__advance-actions",children:[t.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn",disabled:Z,onClick:be,children:r("cliTerminal.advance","Advance")}),t.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn cli-session-terminal__advance-btn--secondary",disabled:Z,onClick:he,children:r("cliTerminal.notYet","Not yet")})]})]}),C&&M&&t.jsxs("div",{className:`cli-session-terminal__mobile-bar${O?" cli-session-terminal__mobile-bar--keyboard-open":""}`,"data-testid":"cli-terminal-mobile-bar",style:O?{bottom:`${me}px`}:void 0,children:[t.jsxs("div",{className:"cli-session-terminal__key-row","data-testid":"cli-terminal-key-bar",children:[t.jsx("button",{type:"button",className:`cli-terminal-key cli-terminal-key--ctrl${x?" cli-terminal-key--active":""}`,"data-testid":"cli-key-ctrl","aria-label":r("cliTerminal.mobileKeyCtrl","Sticky Ctrl modifier"),"aria-pressed":x,onPointerDown:c,onMouseDown:c,onClick:()=>A(e=>!e),children:I.ctrl}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-esc","aria-label":r("cliTerminal.mobileKeyEsc","Send Escape"),onPointerDown:c,onMouseDown:c,onClick:()=>N(Ae),children:I.escape}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-tab","aria-label":r("cliTerminal.mobileKeyTab","Send Tab"),onPointerDown:c,onMouseDown:c,onClick:()=>N(ze),children:I.tab}),t.jsx("button",{type:"button",className:"cli-terminal-key cli-terminal-key--ctrlc","data-testid":"cli-key-ctrl-c","aria-label":r("cliTerminal.mobileKeyCtrlC","Send Ctrl-C"),onPointerDown:c,onMouseDown:c,onClick:()=>{A(!1),b(Fe)},children:I.ctrlC}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-up","aria-label":r("cliTerminal.mobileKeyArrowUp","Cursor up"),onPointerDown:c,onMouseDown:c,onClick:()=>N(Be),children:"↑"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-down","aria-label":r("cliTerminal.mobileKeyArrowDown","Cursor down"),onPointerDown:c,onMouseDown:c,onClick:()=>N(Ie),children:"↓"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-left","aria-label":r("cliTerminal.mobileKeyArrowLeft","Cursor left"),onPointerDown:c,onMouseDown:c,onClick:()=>N(We),children:"←"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-right","aria-label":r("cliTerminal.mobileKeyArrowRight","Cursor right"),onPointerDown:c,onMouseDown:c,onClick:()=>N(Ke),children:"→"})]}),t.jsxs("form",{className:"cli-session-terminal__input-row",onSubmit:pe,children:[t.jsx("input",{ref:fe,type:"text",className:"cli-session-terminal__mobile-input","data-testid":"cli-terminal-mobile-input",value:S,placeholder:r("cliTerminal.mobileInputPlaceholder","Type to send to the session…"),autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,onChange:e=>ye(e.target.value)}),t.jsx("button",{type:"submit",className:"cli-session-terminal__mobile-send","data-testid":"cli-terminal-mobile-send","aria-label":r("cliTerminal.mobileSend","Send"),onPointerDown:c,onMouseDown:c,children:r("cliTerminal.mobileSend","Send")})]})]})]})}export{nt as SessionTerminal};
@@ -0,0 +1 @@
1
+ .settings-header-actions{--settings-header-action-height: calc(var(--space-md) * 2 + var(--space-xs) / 2);display:flex;align-items:stretch;gap:var(--space-xs);margin-left:auto;margin-right:var(--space-sm)}.settings-header-actions>.settings-github-star-btn,.settings-header-actions>.settings-header-discord-btn{height:var(--settings-header-action-height);box-sizing:border-box}.settings-header-discord-btn,.settings-footer-help-btn{display:inline-flex;align-items:center}@media(max-width:768px){.settings-modal .modal-header{flex-wrap:nowrap;align-items:center;column-gap:var(--space-sm)}.settings-modal-heading{flex:1 1 0;min-width:0}.settings-header-actions{margin-left:auto;margin-right:var(--space-sm)}}.settings-github-star-btn{display:inline-flex;align-items:stretch;border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-pill);background:var(--card);color:var(--text);font-size:12px;font-weight:500;text-decoration:none;overflow:hidden;transition:border-color var(--transition-fast),background var(--transition-fast)}.settings-github-star-btn:hover{border-color:var(--text-muted);background:var(--card-hover)}.settings-github-star-btn:focus-visible{outline:none;box-shadow:var(--focus-ring-strong);border-color:var(--todo)}.settings-github-star-btn__action{display:inline-flex;align-items:center;gap:var(--space-xs);padding:var(--space-xs) calc(var(--space-sm) + var(--space-xs) / 2)}.settings-github-star-btn__count{display:inline-flex;align-items:center;padding:var(--space-xs) calc(var(--space-sm) + var(--space-xs) / 4);border-left:var(--btn-border-width) solid var(--border);background:color-mix(in srgb,var(--surface) 60%,var(--card));color:var(--text-muted);font-variant-numeric:tabular-nums}.settings-modal{width:min(95vw,1100px);max-width:95vw;min-width:520px;height:80vh;min-height:480px;max-height:calc(100dvh - var(--overlay-padding-top, 10vh) - 16px);overflow:hidden;resize:both}.settings-embedded.right-dock-embedded-view{display:flex;flex:1;width:100%;height:100%;min-height:0;padding:0;overflow:hidden}.settings-embedded .settings-modal--embedded{flex:1;width:100%;max-width:none;min-width:0;height:100%;min-height:0;max-height:none;resize:none;box-shadow:none;border:none;border-radius:0;background:transparent;position:static}.settings-modal--embedded .modal-header--embedded{box-sizing:border-box;display:flex;align-items:center;gap:var(--space-sm);min-height:var(--view-header-min-height);padding:var(--space-lg) var(--space-xl);background:var(--surface);border-bottom:none;flex-shrink:0}.settings-modal--embedded .modal-header--embedded .settings-header-actions{margin-left:auto}.settings-modal--embedded .modal-header--embedded .settings-modal-heading h3{display:flex;align-items:center;gap:var(--space-sm);font-size:1.125rem;font-weight:600;color:var(--text);letter-spacing:normal}.settings-modal--embedded .modal-header--embedded .settings-modal-heading svg{color:var(--todo);flex-shrink:0}.settings-modal--embedded .modal-actions{background:transparent;flex-shrink:0;padding-bottom:var(--space-sm)}@media(max-width:768px){.modal-overlay.settings-modal-overlay,.modal-overlay:has(.settings-modal:not(.settings-modal--embedded)){padding:0;inset:0;align-items:stretch;justify-content:stretch}.modal.settings-modal:not(.settings-modal--embedded){width:100vw;min-width:0;max-width:100vw;height:100dvh;min-height:100dvh;max-height:100dvh;margin:0;border:none;border-radius:0;resize:none;flex:1 1 auto}.modal.settings-modal:not(.settings-modal--embedded)[style*=--keyboard-overlap]{height:var(--vv-height, 100dvh);min-height:var(--vv-height, 100dvh);max-height:var(--vv-height, 100dvh);transform:translateY(var(--vv-offset-top, 0px));will-change:transform}.settings-embedded.right-dock-embedded-view{padding:var(--space-sm)}.settings-embedded .settings-modal--embedded{width:100%;height:100%}}.settings-modal-heading{display:flex;flex-direction:column;gap:var(--space-xs)}.settings-modal-heading h3{margin:0}.settings-modal-version{margin:0;font-size:.85rem;color:var(--text-muted);font-weight:500}.settings-modal-footer-version{display:flex;align-items:center;gap:var(--space-xs);margin-right:var(--space-sm);min-width:0}.settings-update-check{display:flex;align-items:center;gap:var(--space-sm);min-width:0}@media(max-width:768px){.settings-modal-footer-version{flex:1 1 100%;margin-right:0}.settings-update-check{flex-wrap:wrap;row-gap:var(--space-xs)}.settings-update-result{flex:1 1 100%}.settings-footer-help-btn{flex-shrink:0}}.settings-version-check-btn{--settings-inline-touch-target: calc(var(--space-lg) + var(--space-lg) + var(--space-xs));display:inline-flex;align-items:center;gap:var(--space-xs);margin:0;min-height:var(--settings-inline-touch-target);padding:var(--space-xs) var(--space-sm);border:none;background:transparent;color:var(--text-muted);cursor:pointer;transition:opacity var(--transition-fast),box-shadow var(--transition-fast)}.settings-version-check-btn:hover:not(:disabled){opacity:.85}.settings-version-check-btn:focus-visible{outline:none;box-shadow:var(--focus-ring-strong);border-radius:var(--radius-sm)}.settings-version-check-btn:disabled{cursor:default;opacity:.7}.settings-version-check-btn svg{color:var(--text-muted)}.settings-version-check-btn svg.spinning{animation:settings-update-spin 1s linear infinite}.settings-update-result{display:inline-flex;align-items:center;flex-wrap:wrap;gap:var(--space-xs);font-size:.85rem;font-weight:500}.settings-update-result--up-to-date{color:var(--color-success)}.settings-update-result--available{color:var(--color-info)}.settings-update-result--error{color:var(--color-error)}.settings-update-result-link{color:var(--color-info);text-decoration:underline;transition:color var(--transition-fast),box-shadow var(--transition-fast)}.settings-update-result-link:hover{color:color-mix(in srgb,var(--color-info) 80%,var(--text))}.settings-update-result-link:focus-visible{outline:none;box-shadow:var(--focus-ring-strong);border-radius:var(--radius-sm)}.settings-update-now-btn{display:inline-flex;align-items:center;gap:var(--space-xs);min-height:calc(var(--space-lg) + var(--space-sm));color:var(--text)}.settings-update-now-btn:disabled{color:var(--color-warning)}.settings-update-now-btn svg.spinning{animation:settings-update-spin 1s linear infinite}.settings-update-install-status{color:var(--text-muted)}.settings-update-install-status--success{color:var(--color-success)}.settings-update-install-status--error{color:var(--color-error)}@keyframes settings-update-spin{to{transform:rotate(360deg)}}.backup-stats{display:flex;align-items:center;gap:var(--space-lg);padding:var(--space-sm) var(--space-md);border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);background:color-mix(in srgb,var(--surface) 85%,transparent)}.backup-stat{display:flex;flex:1 1 0;flex-direction:column;align-items:center;gap:var(--space-xs);min-width:0}.backup-stat-value{color:var(--text);font-size:1rem;font-weight:600;font-variant-numeric:tabular-nums}.backup-stat-label{color:var(--text-muted);font-size:.75rem;font-weight:600;letter-spacing:.04em;text-transform:uppercase}.backup-list{margin-top:var(--space-sm)}.backup-list summary{padding:var(--space-sm) 0;color:var(--text-muted);cursor:pointer;transition:color var(--transition-fast)}.backup-list summary:hover{color:var(--text)}.backup-list summary:focus-visible{outline:none;border-radius:var(--radius-sm);box-shadow:var(--focus-ring-strong)}.backup-list ul{display:flex;flex-direction:column;gap:var(--space-xs);margin:0;margin-top:var(--space-sm);padding:0;list-style:none}.backup-list li{display:flex;align-items:center;justify-content:space-between;gap:var(--space-sm);padding:var(--space-sm) 0;border-top:var(--btn-border-width) solid color-mix(in srgb,var(--border) 80%,transparent)}.backup-list li code{min-width:0;color:var(--text);font-family:var(--font-mono);font-size:.75rem;white-space:nowrap;overflow-x:auto}.backup-size{color:var(--text-muted);font-family:var(--font-mono);font-size:.75rem;text-align:right;white-space:nowrap}@media(max-width:768px){.backup-stats{flex-direction:column;align-items:stretch;gap:var(--space-sm)}.backup-stat{align-items:flex-start}.backup-list ul{max-height:calc(var(--space-xl) * 9 + var(--space-md));overflow-y:auto;-webkit-overflow-scrolling:touch}.backup-list li code{white-space:normal;overflow-wrap:anywhere;word-break:normal}}.settings-layout{display:flex;flex:1;flex-direction:row;min-height:0;overflow:hidden}.settings-navigation{width:calc(var(--space-xl) * 7 + var(--space-sm));min-width:calc(var(--space-xl) * 7 + var(--space-sm));border-right:var(--btn-border-width) solid var(--border);display:flex;flex-direction:column;min-height:0;background:color-mix(in srgb,var(--text) 10%,transparent)}.settings-search{display:flex;flex-direction:column;gap:var(--space-xs);padding:var(--space-sm);border-bottom:var(--btn-border-width) solid var(--border)}.settings-search-label{color:var(--text-muted);font-size:.75rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em}.settings-search-input-wrap{display:flex;align-items:center;gap:var(--space-xs);min-width:0}.settings-search-input{min-width:0;width:100%}.settings-search-clear{flex-shrink:0}.settings-search-results,.settings-search-empty-hint{color:var(--text-muted);font-size:.75rem;margin:0}.settings-search-empty{display:flex;flex-direction:column;gap:var(--space-sm);padding:var(--space-md);color:var(--text-muted)}.settings-search-empty p,.settings-search-content-empty p{margin:0}.settings-search-content-empty{gap:var(--space-md)}.settings-mobile-section-picker{display:none}.settings-sidebar{display:flex;flex:1;flex-direction:column;min-height:0;overflow-y:auto;padding:var(--space-sm) var(--space-sm);gap:calc(var(--space-xs) / 2);scrollbar-color:var(--border) transparent;scrollbar-width:thin}.settings-sidebar::-webkit-scrollbar{width:6px}.settings-sidebar::-webkit-scrollbar-track{background:transparent}.settings-sidebar::-webkit-scrollbar-thumb{background:var(--border);border-radius:var(--radius-sm)}.settings-sidebar::-webkit-scrollbar-thumb:hover{background:var(--text-muted)}.settings-research-source-locked{cursor:default;color:var(--text-muted)!important}.settings-research-source-locked input[type=checkbox]{cursor:not-allowed}.settings-research-source-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-sm);min-width:0}.settings-research-source-grid>*{min-width:0}.settings-research-limits-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--space-sm);min-width:0}.settings-research-limits-grid>*{min-width:0}.settings-research-limit-field{display:flex;flex-direction:column;gap:var(--space-xs);min-width:0}.settings-research-limits-error{grid-column:1 / -1}@media(max-width:768px){.settings-research-source-grid,.settings-research-limits-grid{grid-template-columns:1fr}}.settings-nav-item{display:block;width:100%;padding:var(--space-sm) var(--space-md);font-size:13px;font-weight:500;color:var(--text-muted);background:none;border:none;border-left:3px solid transparent;border-radius:0 var(--radius-md) var(--radius-md) 0;cursor:pointer;text-align:left;transition:background var(--transition-fast),color var(--transition-fast),border-color var(--transition-fast)}.settings-nav-item:hover{background:var(--bg);color:var(--text);border-left-color:var(--border)}.settings-nav-item:focus-visible{box-shadow:var(--focus-ring-strong);outline:none}.settings-nav-item.active{background:var(--bg);color:var(--todo);font-weight:600;border-left-color:var(--todo)}.settings-group-header{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--text-muted);padding:var(--space-md) var(--space-md) var(--space-xs);margin-top:var(--space-sm);user-select:none}.settings-group-header:first-child{margin-top:0}.settings-content{flex:1;overflow-x:hidden;overflow-y:auto;padding:var(--space-md) var(--space-xl) var(--space-lg);scrollbar-color:var(--border) transparent;scrollbar-width:thin}.settings-content::-webkit-scrollbar{width:6px}.settings-content::-webkit-scrollbar-track{background:transparent}.settings-content::-webkit-scrollbar-thumb{background:var(--border);border-radius:var(--radius-sm)}.settings-content::-webkit-scrollbar-thumb:hover{background:var(--text-muted)}.settings-content>*{animation:settingsFadeIn var(--duration-normal) ease}@keyframes settingsFadeIn{0%{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}.settings-section-heading{font-size:14px;font-weight:600;padding:var(--space-lg) 0 var(--space-md);margin:0 0 var(--space-md);color:var(--text)}.settings-content>.settings-section-heading:first-child,.settings-modal-section>.settings-section-heading:first-child{padding-top:var(--space-md)}.settings-section-heading--spaced{margin-top:var(--space-lg)}.settings-section-description{margin:0;margin-bottom:var(--space-sm);color:var(--text-muted);font-size:13px;line-height:1.5}.settings-plugins-subsection-toggle{display:inline-flex;gap:var(--space-xs);margin:var(--space-md) 0}.settings-plugins-subsection-btn{display:inline-flex;align-items:center;justify-content:center;border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-pill);background:var(--surface);color:var(--text-muted);font-size:.85rem;font-weight:600;padding:var(--space-xs) var(--space-md);cursor:pointer;transition:background var(--transition-fast),color var(--transition-fast),border-color var(--transition-fast),box-shadow var(--transition-fast)}.settings-plugins-subsection-btn:hover{background:var(--surface-hover, color-mix(in srgb, var(--text) 6%, transparent));color:var(--text)}.settings-plugins-subsection-btn:focus-visible{outline:none;box-shadow:var(--focus-ring-strong)}.settings-plugins-subsection-btn.active{background:color-mix(in srgb,var(--todo) 14%,transparent);border-color:color-mix(in srgb,var(--todo) 45%,var(--border));color:var(--todo)}.settings-plugins-subsection-panel{padding-bottom:var(--space-md)}.settings-scope-icon{margin-right:6px;display:inline-flex;vertical-align:middle;color:var(--text-muted)}.settings-scope-banner{display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-sm) var(--space-xl);margin:0 var(--space-xl) var(--space-xs);font-size:12px;border-radius:var(--radius-md);color:var(--text-muted)}.settings-scope-global{background:color-mix(in srgb,var(--color-info) 8%,transparent);border-left:3px solid color-mix(in srgb,var(--color-info) 40%,transparent)}.settings-scope-project{background:color-mix(in srgb,var(--color-success) 8%,transparent);border-left:3px solid color-mix(in srgb,var(--color-success) 40%,transparent)}.settings-scope-mixed{background:color-mix(in srgb,var(--triage) 8%,transparent);border-left:3px solid color-mix(in srgb,var(--triage) 40%,transparent)}.settings-note{display:block;padding:0 var(--space-xl);margin-top:var(--space-xs);font-size:12px;color:var(--text-muted)}.form-inline-group{display:flex;align-items:center;gap:var(--space-sm)}.form-inline-group .input{flex:1;min-width:0}.btn-link{background:none;border:none;padding:0;font-size:12px;color:var(--accent, #4a90e2);cursor:pointer;text-decoration:underline;white-space:nowrap}.btn-link:hover{text-decoration:none}.settings-overlap-ignore-group code{font-family:var(--font-mono);font-size:.9em}.settings-button-row{display:flex;flex-wrap:wrap;gap:var(--space-sm);margin-top:var(--space-sm)}.settings-raw-output{margin:var(--space-sm) 0 0;padding:var(--space-sm);border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--surface);color:var(--text-muted);max-height:calc(var(--space-2xl) * 7);overflow:auto;font-family:var(--font-mono);font-size:calc(var(--space-sm) + var(--space-xs))}.settings-url-output{display:block;margin-top:var(--space-xs);padding:var(--space-sm);border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--surface);color:var(--text-muted);font-family:var(--font-mono);font-size:calc(var(--space-sm) + var(--space-xs));overflow-wrap:anywhere;word-break:break-word;overflow-x:auto;max-width:100%}.settings-qr-preview{margin-top:var(--space-sm);display:flex;flex-direction:column;gap:var(--space-sm)}.settings-qr-preview-label{margin:0;font-size:calc(var(--space-sm) + var(--space-xs));color:var(--text-muted)}.settings-qr-preview-image-wrap{width:fit-content;max-width:100%;padding:var(--space-sm);border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--card)}.settings-qr-preview-image{display:block;width:min(calc(var(--space-2xl) * 6),100%);height:auto;aspect-ratio:1 / 1}.remote-provider-selector{display:flex;gap:var(--space-xs);border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);padding:var(--space-xs);background:var(--surface)}.remote-provider-option{position:relative;flex:1;cursor:pointer}.remote-provider-option input{position:absolute;opacity:0;width:0;height:0}.remote-provider-option span{display:block;padding:var(--space-sm) var(--space-md);text-align:center;border-radius:var(--radius-sm);border:var(--btn-border-width) solid transparent;color:var(--text-muted);transition:background var(--transition-fast),color var(--transition-fast),border-color var(--transition-fast)}.remote-provider-option-content{display:inline-flex;align-items:center;gap:var(--space-xs)}.remote-provider-option input:checked+span{background:var(--card);color:var(--text);border-color:var(--border)}.remote-provider-option input:focus-visible+span{box-shadow:var(--focus-ring-strong)}.remote-status-bar{--status-color: var(--text-muted);display:flex;align-items:center;gap:var(--space-sm);padding:var(--space-sm) var(--space-md);border-radius:var(--radius-md);margin:0 var(--space-xl) var(--space-md);background:color-mix(in srgb,var(--status-color) 10%,transparent)}.remote-status-bar--running{--status-color: var(--color-success)}.remote-status-bar--starting{--status-color: var(--color-warning)}.remote-status-bar--error{--status-color: var(--color-error)}.remote-status-bar--stopped{--status-color: var(--text-muted)}.remote-share-block{display:flex;flex-direction:column;gap:var(--space-sm);margin:0 var(--space-xl) var(--space-md);padding:var(--space-sm) var(--space-md);border:1px solid var(--border);border-radius:var(--radius-md);background:color-mix(in srgb,var(--text-muted) 5%,transparent)}.remote-share-row{display:flex;flex-direction:column;gap:var(--space-xs)}.remote-share-row .settings-qr-preview-image{margin-top:var(--space-xs)}.remote-status-dot{width:var(--space-sm);height:var(--space-sm);border-radius:50%;display:inline-block;flex-shrink:0}.remote-status-dot--running{background:var(--color-success)}.remote-status-dot--starting{background:var(--color-warning)}.remote-status-dot--error{background:var(--color-error)}.remote-status-dot--stopped{background:var(--text-muted)}.remote-status-url{margin-left:auto;font-family:var(--font-mono);overflow-wrap:anywhere;word-break:break-word;user-select:all}.remote-provider-settings{display:flex;flex-direction:column;gap:var(--space-sm)}.remote-cli-detection{display:flex;align-items:flex-start;gap:var(--space-sm);margin:0 var(--space-xl) var(--space-md);padding:var(--space-sm) var(--space-md);border-radius:var(--radius-sm)}.remote-cli-detection--available{background:color-mix(in srgb,var(--color-success) 10%,transparent);color:var(--color-success)}.remote-cli-detection--missing{background:color-mix(in srgb,var(--color-warning) 10%,transparent);color:var(--color-warning)}.remote-cli-detection-content{display:flex;flex-direction:column;gap:var(--space-xs);color:var(--text)}.remote-cli-detection .btn{align-self:flex-start}.remote-cli-install-error{color:var(--color-error)}.remote-cli-manual{color:var(--text-dim)}.remote-external-tunnel-panel{display:flex;flex-direction:column;gap:var(--space-sm);margin:0 var(--space-xl) var(--space-md);padding:var(--space-sm) var(--space-md);border:1px solid var(--border);border-radius:var(--radius-md);background:color-mix(in srgb,var(--color-info) 10%,transparent)}.remote-external-tunnel-header{display:flex;align-items:center;gap:var(--space-sm);color:var(--color-info)}.remote-external-tunnel-qr{display:flex;flex-direction:column;gap:var(--space-xs)}.remote-external-tunnel-actions{display:flex;flex-direction:column;gap:var(--space-sm)}.remote-advanced-details{margin:var(--space-lg) var(--space-xl) 0;border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);padding:var(--space-md);background:var(--surface)}.remote-advanced-details>summary{cursor:pointer;color:var(--text-muted);font-size:calc(var(--space-sm) + var(--space-xs));list-style:none}.remote-advanced-details>summary::-webkit-details-marker{display:none}.remote-advanced-details>summary:before{content:"▸";margin-right:var(--space-xs)}.remote-advanced-details[open]>summary:before{content:"▾"}.settings-option-details{margin-top:var(--space-xs)}.settings-research-provider-group{display:flex;flex-direction:column;gap:var(--space-sm);min-width:0}.settings-research-provider-advanced-details{min-width:0;padding-inline-start:var(--space-md)}.settings-research-provider-advanced-body{display:flex;flex-direction:column;gap:var(--space-sm);min-width:0;padding-top:var(--space-sm)}.settings-research-provider-advanced-body>.form-group{margin-top:0;padding:0;min-width:0}.settings-research-provider-advanced-body .input{width:100%;min-width:0}.settings-research-empty-state{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-sm);min-width:0}@media(max-width:768px){.settings-research-provider-advanced-details{padding-inline-start:0}}.settings-option-details>summary{cursor:pointer;color:var(--text-muted);font-size:calc(var(--space-sm) + var(--space-xs));list-style:none}.settings-option-details>summary::-webkit-details-marker{display:none}.settings-option-details>summary:before{content:"▸";margin-right:var(--space-xs)}.settings-option-details[open]>summary:before{content:"▾"}.settings-gitlab-disclosure{display:flex;flex-direction:column;gap:var(--space-sm);margin-top:var(--space-md);padding:var(--space-md);border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);background:var(--surface-secondary)}.settings-gitlab-disclosure>summary{display:flex;align-items:center;justify-content:space-between;gap:var(--space-md);cursor:pointer;list-style:none;color:var(--text-primary)}.settings-gitlab-disclosure>summary::-webkit-details-marker{display:none}.settings-gitlab-disclosure>summary:before{content:"▸";color:var(--text-muted)}.settings-gitlab-disclosure[open]>summary:before{content:"▾"}.settings-gitlab-disclosure__title{flex:1 1 auto;font-weight:var(--font-weight-semibold);min-width:0}.settings-gitlab-disclosure__toggle{flex:0 0 auto}.settings-gitlab-disclosure__body{display:flex;flex-direction:column;gap:var(--space-sm);margin-top:var(--space-sm);min-width:0}.settings-gitlab-disclosure__body>.form-group{margin-top:0;padding:0}@media(max-width:768px){.settings-gitlab-disclosure{padding:var(--space-sm)}.settings-gitlab-disclosure>summary{align-items:flex-start;flex-wrap:wrap;gap:var(--space-sm)}.settings-gitlab-disclosure__toggle{flex-basis:100%}}.remote-cf-advanced-details{margin-top:var(--space-xs)}.remote-cf-advanced-details>summary{cursor:pointer;color:var(--text-muted);font-size:calc(var(--space-sm) + var(--space-xs));list-style:none}.remote-cf-advanced-details>summary::-webkit-details-marker{display:none}.remote-cf-advanced-details>summary:before{content:"▸";margin-right:var(--space-xs)}.remote-cf-advanced-details[open]>summary:before{content:"▾"}.remote-cf-advanced-fields{display:flex;flex-direction:column;gap:var(--space-sm);margin-top:var(--space-sm)}.remote-tunnel-actions{margin-top:var(--space-md)}.remote-tunnel-actions .btn{width:100%}.settings-overlap-ignore-list{display:flex;flex-direction:column;gap:var(--space-sm);margin:var(--space-sm) 0}.settings-overlap-ignore-row,.settings-overlap-ignore-path-controls{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:var(--space-sm);align-items:center}.settings-overlap-path-picker-modal{max-width:min(960px,calc(100vw - var(--space-2xl)))}.settings-overlap-path-picker-body{display:flex;flex-direction:column;gap:var(--space-sm);max-height:min(70vh,720px)}.settings-overlap-path-picker-note{margin:0;font-size:12px;color:var(--text-muted)}.settings-section-divider{border-top:1px solid var(--border);margin:var(--space-lg) var(--space-xl)}.settings-reset-dialog__choice{display:flex;flex-direction:column;gap:var(--space-xs);margin-block-end:var(--space-md)}.settings-reset-dialog__choice-btn{align-self:flex-start;width:100%}.settings-reset-dialog__ineligible-reason{color:var(--text-muted)}@media(max-width:768px){.settings-reset-dialog{max-width:calc(100vw - var(--space-md))}.settings-reset-dialog__choice-btn{width:100%}}@media(max-width:768px){.settings-note{padding:0 var(--space-lg)}.settings-overlap-ignore-row,.settings-overlap-ignore-path-controls{grid-template-columns:minmax(0,1fr)}.settings-overlap-ignore-row>.btn{justify-self:start}.settings-overlap-path-picker-modal{max-width:calc(100vw - var(--space-md))}.remote-provider-selector{flex-direction:column}.remote-status-bar{flex-wrap:wrap;margin:0 var(--space-lg) var(--space-md)}.remote-share-block{margin:0 var(--space-lg) var(--space-md)}.remote-status-url{width:100%;margin-left:0;font-size:.8em}.remote-provider-option,.remote-tunnel-actions .btn{min-height:36px}.remote-cli-detection,.remote-external-tunnel-panel{margin:0 var(--space-lg) var(--space-md)}}.ntfy-advanced-disclosure{margin-top:var(--space-md);border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);background:var(--surface)}.ntfy-advanced-disclosure>summary{cursor:pointer;list-style:none;padding:var(--space-sm) var(--space-md);font-size:12px;font-weight:600;color:var(--text)}.ntfy-advanced-disclosure>summary::-webkit-details-marker{display:none}.ntfy-advanced-content{padding:0 var(--space-md) var(--space-md);display:flex;flex-direction:column;gap:var(--space-sm)}.settings-inline-link{color:var(--todo);text-decoration:none;transition:text-decoration var(--transition-fast)}.settings-inline-link:hover{text-decoration:underline}.settings-inline-link:focus-visible{outline:none;box-shadow:var(--focus-ring-strong);border-radius:var(--radius-sm)}.notification-provider-card{border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-lg);background:var(--surface);margin:0 var(--space-xl) var(--space-lg);overflow:hidden}.notification-provider-header{display:flex;align-items:center;justify-content:space-between;padding:var(--space-md) var(--space-lg);border-bottom:var(--btn-border-width) solid var(--border)}.notification-provider-body{padding:var(--space-lg);display:flex;flex-direction:column;gap:var(--space-lg)}.notification-provider-actions{display:flex;flex-wrap:wrap;gap:var(--space-sm);padding-top:var(--space-md);border-top:var(--btn-border-width) solid var(--border);margin-top:var(--space-md)}.notification-test-feedback{display:flex;flex-direction:column;gap:var(--space-xs);margin-top:var(--space-sm)}.notification-test-feedback-item{border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-sm);padding:var(--space-xs) var(--space-sm)}.notification-test-feedback-item--success{border-color:color-mix(in srgb,var(--color-success) 45%,var(--border));background:color-mix(in srgb,var(--color-success) 8%,transparent);color:var(--color-success)}.notification-test-feedback-item--error{border-color:color-mix(in srgb,var(--color-error) 45%,var(--border));background:color-mix(in srgb,var(--color-error) 8%,transparent);color:var(--color-error)}@media(max-width:768px){.notification-provider-actions{flex-direction:column}.notification-provider-actions .btn{width:100%}}.memory-status-message{display:flex;gap:var(--space-md);align-items:center;justify-content:space-between;margin-bottom:var(--space-md)}.memory-status-message span{min-width:0}.memory-retrieval-test{margin-top:var(--space-lg)}.memory-test-result{margin:0 var(--space-xl) var(--space-lg);padding:var(--space-md);border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);background:var(--card)}.memory-test-result strong,.memory-test-result span{color:var(--text);font-size:12px}.memory-test-result small{display:block;margin-top:var(--space-xs);color:var(--text-muted);font-size:12px}.memory-test-result ul{margin:var(--space-md) 0 0;padding:0;list-style:none}.memory-test-result li{padding-top:var(--space-sm);border-top:var(--btn-border-width) solid var(--border)}.memory-test-result li+li{margin-top:var(--space-sm)}.memory-test-result p{margin:var(--space-xs) 0 0;color:var(--text-muted);font-size:12px;line-height:1.5;overflow-wrap:anywhere}.memory-editor-section{margin-top:var(--space-lg);display:flex;flex:1 1 auto;flex-direction:column;min-height:0}.memory-editor-form-group{display:flex;flex:1 1 auto;flex-direction:column;min-height:0}.memory-file-summary{display:grid;grid-template-columns:auto minmax(0,1fr);gap:var(--space-xs) var(--space-md);align-items:center;margin:0 var(--space-xl) var(--space-md);padding:var(--space-md);border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);background:var(--card)}.memory-file-summary span{display:inline-flex;align-items:center;justify-content:center;padding:var(--space-xs) var(--space-sm);border-radius:var(--radius-pill);color:var(--color-info);background:color-mix(in srgb,var(--color-info) 12%,transparent);font-size:11px;font-weight:600}.memory-file-summary strong{min-width:0;overflow-wrap:anywhere;color:var(--text);font-family:var(--font-mono);font-size:12px}.memory-file-summary small{grid-column:2;color:var(--text-muted);font-size:12px}.memory-editor-frame{min-height:50vh;border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);overflow:hidden;display:flex;flex:1 1 auto;flex-direction:column;min-width:0}.auth-panel-body{padding-inline:var(--space-md)}.auth-section-hint{padding:var(--space-md) var(--space-lg);margin-bottom:var(--space-md);background:var(--bg-tertiary);border-radius:var(--radius-md);font-size:13px;color:var(--text-muted);border-left:3px solid var(--text-muted)}.auth-provider-group{margin-bottom:calc(var(--space-sm) + var(--space-xs) / 2)}.auth-group-label{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.5px;color:var(--text-muted);margin-bottom:var(--space-xs);padding:0 4px}.auth-provider-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);margin-bottom:var(--space-xs);overflow:hidden;transition:border-color var(--transition-fast),box-shadow var(--transition-fast)}.auth-provider-card:hover{border-color:var(--text-dim)}.auth-provider-card--authenticated{border-color:color-mix(in srgb,var(--color-success) 40%,var(--border));background:color-mix(in srgb,var(--color-success) 5%,var(--surface))}.auth-provider-card--authenticated:hover{border-color:color-mix(in srgb,var(--color-success) 60%,var(--border))}.auth-provider-header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;padding:var(--space-sm) var(--space-md);gap:12px}.auth-provider-info{display:flex;align-items:center;gap:10px;flex-wrap:wrap;flex:1;min-width:0}.auth-provider-info strong{font-weight:500;color:var(--text)}.auth-provider-icon-slot{display:inline-flex;align-items:center;justify-content:center;inline-size:calc(var(--space-md) + var(--space-xs) * 2);block-size:calc(var(--space-md) + var(--space-xs) * 2);flex-shrink:0}.auth-provider-icon-slot .provider-icon{display:inline-flex}.auth-hint{display:block;padding:12px 4px 0;font-size:12px;color:var(--text-muted);border-top:1px solid var(--border);margin-top:8px}.auth-apikey-section{display:flex;flex-direction:column;gap:var(--space-xs);align-items:flex-end;flex-shrink:0}.auth-apikey-input-row{display:flex;gap:6px;align-items:center}.auth-apikey-input{background:var(--surface-1);border:1px solid var(--border);border-radius:6px;color:var(--text);padding:6px 10px;font-size:13px;width:180px;font-family:monospace}.auth-apikey-input:focus{outline:none;border-color:var(--todo);box-shadow:var(--focus-ring)}.auth-apikey-input:disabled{opacity:.6}.auth-apikey-progress{font-size:calc(var(--space-sm) + var(--space-xs) * .75);color:var(--text-muted);padding-right:4px}.auth-apikey-error{font-size:11px;color:var(--color-error);padding-right:4px}.auth-provider-actions-row{display:flex;width:100%;align-items:center;gap:var(--space-sm)}.auth-device-code-panel{width:100%;margin-top:var(--space-sm);padding:var(--space-sm);border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);background:color-mix(in srgb,var(--surface) 85%,transparent);display:flex;flex-direction:column;gap:var(--space-sm)}.auth-device-code-pill{font-family:var(--font-mono);font-size:calc(var(--space-md) + var(--space-xs) * .5);letter-spacing:var(--space-xs);padding:var(--space-sm) var(--space-md);border-radius:var(--radius-pill);border:var(--btn-border-width) solid var(--border);background:var(--card);color:var(--text);display:flex;align-self:stretch}.auth-key-hint{font-family:var(--font-mono);font-size:12px;color:var(--text-muted);display:inline-block;margin-top:var(--space-xs);user-select:none}.settings-lane-badge{display:inline-flex;align-items:center;padding:2px 8px;border-radius:10px;font-size:11px;font-weight:500;white-space:nowrap}.settings-lane-badge--override{background-color:color-mix(in srgb,var(--todo) 20%,transparent);color:var(--todo)}.settings-lane-badge--inherited{background-color:color-mix(in srgb,var(--text-muted) 15%,transparent);color:var(--text-muted)}.settings-scope-group{margin-top:var(--space-md)}.settings-scope-group-header{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-sm)}.settings-scope-group-header .settings-section-heading{padding-bottom:0;margin-bottom:0}.settings-scope-badge{display:inline-flex;align-items:center;padding:2px 8px;border-radius:10px;font-size:11px;font-weight:500;white-space:nowrap}.settings-scope-badge--global{background-color:color-mix(in srgb,var(--accent, #4a90e2) 18%,transparent);color:var(--accent, #4a90e2)}.settings-scope-badge--project{background-color:color-mix(in srgb,var(--text-muted) 15%,transparent);color:var(--text-muted)}.settings-scope-caption{display:block;margin:var(--space-xs) 0 var(--space-md);color:var(--text-muted);font-size:12px;line-height:1.4}.settings-description{font-size:13px;color:var(--text-dim);padding-inline:var(--space-xl);margin-block:0 var(--space-md);line-height:1.5}.settings-token-cap-row{display:flex;align-items:center;gap:var(--space-sm)}.settings-model-lane-label-row{display:flex;align-items:center;gap:var(--space-sm);margin-bottom:var(--space-xs)}.settings-model-lane-control-row{display:flex;align-items:center;gap:var(--space-sm)}.settings-model-lane-control-main{flex:1}.settings-model-lane-actions{display:flex;flex-wrap:wrap;align-items:center;gap:var(--space-sm);padding:var(--space-md) var(--space-xl) var(--space-lg);margin-block:var(--space-sm) var(--space-lg);border-bottom:var(--btn-border-width) solid var(--border)}.settings-error{color:var(--color-error)}.settings-summarization-actions{justify-content:flex-start}.settings-model-presets{display:flex;flex-direction:column;gap:var(--space-md)}.settings-preset-list{display:flex;flex-direction:column;gap:var(--space-sm)}.settings-preset-item{display:flex;align-items:flex-start;justify-content:space-between;gap:var(--space-md);padding:var(--space-md);border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);background:var(--card)}.settings-preset-item-meta{display:flex;flex-direction:column;gap:var(--space-xs);min-width:0}.settings-preset-item-meta strong{color:var(--text);overflow-wrap:anywhere}.settings-preset-summary{font-size:12px;overflow-wrap:anywhere}.settings-preset-item-actions{display:flex;gap:var(--space-xs);flex-wrap:wrap;justify-content:flex-end}.settings-preset-actions{display:flex;justify-content:flex-start}.settings-preset-editor{display:flex;flex-direction:column;gap:var(--space-md);padding:var(--space-md);border:var(--btn-border-width) solid var(--border);border-radius:var(--radius-md);background:color-mix(in srgb,var(--surface) 85%,var(--card))}.settings-preset-editor-fields{display:flex;flex-direction:column;gap:var(--space-sm)}.settings-preset-editor .form-group{padding:0}.settings-preset-editor-actions{justify-content:flex-start;margin-top:0;padding:0}.settings-preset-auto-select{margin-top:var(--space-sm)}.settings-preset-size-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--space-sm)}.settings-preset-size-row{padding:0}@media(max-width:768px){.settings-layout{flex-direction:column;min-height:0}.settings-navigation{width:100%;min-width:0;flex:0 0 auto;border-right:none;border-bottom:var(--btn-border-width) solid var(--border);background:var(--surface)}.settings-search{padding:var(--space-md) var(--space-lg) var(--space-sm)}.settings-search-input-wrap{align-items:stretch}.settings-search-input{font-size:16px}.settings-mobile-section-picker{display:flex;flex-direction:column;gap:var(--space-xs);padding:var(--space-sm) var(--space-lg) var(--space-md);border-bottom:none;background:var(--surface)}.settings-mobile-section-picker label{color:var(--text-muted);font-weight:600;text-transform:uppercase}.settings-mobile-section-picker select{width:100%}.settings-mobile-section-picker select:focus-visible{outline:none;border-color:var(--todo);box-shadow:var(--focus-ring-strong)}.settings-sidebar{display:none}.settings-nav-item{display:flex;align-items:center;justify-content:center;gap:var(--space-xs);border-left:none;border-bottom:2px solid transparent;border-radius:var(--radius-md) var(--radius-md) 0 0;padding:calc(var(--space-xs) + var(--space-xs) / 2) var(--space-md);white-space:nowrap}.settings-nav-item:hover{border-left-color:transparent;border-bottom-color:var(--border)}.settings-nav-item.active{border-left-color:transparent;border-bottom-color:var(--todo)}.settings-group-header{display:none}.notification-provider-card{margin:0 var(--space-lg) var(--space-md)}.notification-provider-header{padding:var(--space-sm) var(--space-md)}.notification-provider-body{padding:var(--space-md)}.settings-scope-icon{margin-right:0}.settings-content{flex:1;min-height:0;overflow-x:hidden;overflow-y:auto}.settings-content .form-group small{overflow-wrap:break-word;word-break:normal}.settings-content input,.settings-content select,.settings-content textarea{font-size:16px}.settings-section-heading{padding:var(--space-lg) var(--space-lg) var(--space-md);margin:0 0 var(--space-md)}.settings-plugins-subsection-toggle{display:flex;width:100%;padding:0 var(--space-lg)}.settings-plugins-subsection-btn{flex:1;min-height:36px}.settings-plugins-subsection-panel{padding-left:var(--space-lg);padding-right:var(--space-lg)}.form-group{padding:0 calc(var(--space-md) + var(--space-xs) / 2)}.settings-scope-banner{padding:var(--space-sm) var(--space-lg)}.memory-editor-frame{min-height:65vh}.memory-file-summary{grid-template-columns:1fr;margin:0 var(--space-lg) var(--space-md)}.memory-status-message{align-items:stretch;flex-direction:column}.memory-file-summary span{justify-content:flex-start}.memory-file-summary small{grid-column:auto}.settings-description{padding:0 var(--space-lg)}.settings-model-lane-actions{align-items:stretch;flex-direction:column;padding-inline:calc(var(--space-md) + var(--space-xs) / 2)}.settings-content .btn,.settings-preset-item-actions .btn{min-height:36px}.auth-provider-row{flex-wrap:wrap;padding:var(--space-md) calc(var(--space-md) + var(--space-xs) / 2);gap:var(--space-sm)}.auth-section-hint{margin:0 calc(var(--space-md) + var(--space-xs) / 2) var(--space-md);padding:calc(var(--space-sm) + var(--space-xs) / 2) calc(var(--space-md) + var(--space-xs) / 2)}.auth-provider-group{margin-bottom:var(--space-md)}.auth-group-label{padding:0 calc(var(--space-md) + var(--space-xs) / 2)}.auth-provider-card{margin:0 calc(var(--space-md) + var(--space-xs) / 2) var(--space-sm)}.auth-provider-header{flex-wrap:wrap;padding:calc(var(--space-sm) + var(--space-xs) / 2) calc(var(--space-md) + var(--space-xs) / 2);gap:10px}.auth-provider-header>div:not(.auth-provider-info):not(.auth-apikey-section){margin-left:auto}.auth-provider-actions-row{width:100%;justify-content:flex-end}.auth-device-code-panel{width:100%}.auth-device-code-pill{max-width:100%;overflow-wrap:anywhere}.auth-provider-info{width:100%;flex-basis:100%}.auth-apikey-section{width:100%;flex-basis:100%;align-items:flex-end}.auth-apikey-input-row{width:100%;flex-wrap:wrap;justify-content:flex-end}.auth-apikey-input{flex:1;min-width:120px;width:auto}.auth-apikey-input-row .btn{flex-shrink:0;margin-left:auto}.auth-hint{padding:var(--space-md) calc(var(--space-md) + var(--space-xs) / 2) 0}.settings-model-presets{gap:var(--space-sm)}.settings-preset-item{flex-direction:column;align-items:stretch;padding:var(--space-sm) var(--space-md)}.settings-preset-item-actions{justify-content:flex-start}.settings-preset-editor{padding:var(--space-sm) var(--space-md)}.settings-preset-editor-actions{flex-wrap:wrap}.settings-preset-size-grid{grid-template-columns:1fr;gap:var(--space-xs)}.settings-node-routing-note{padding:var(--space-sm) var(--space-md);font-size:12px}}.settings-node-routing-note{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-md);padding:var(--space-md) var(--space-lg);margin-top:var(--space-sm);color:var(--text-muted);font-size:13px;line-height:1.5}.settings-node-status{display:inline-flex;align-items:center;gap:var(--space-xs);margin-top:var(--space-sm);font-size:12px;color:var(--text-muted)}.auth-advanced-disclosure{margin-top:var(--space-md);border:1px solid var(--border);border-radius:var(--radius-md);background:var(--surface)}.auth-advanced-disclosure>summary{cursor:pointer;padding:var(--space-sm) var(--space-md)}.auth-advanced-content{display:flex;flex-direction:column;gap:var(--space-sm);padding:0 var(--space-md) var(--space-md)}.auth-custom-provider-item{display:flex;justify-content:space-between;align-items:center;gap:var(--space-sm)}.auth-custom-provider-actions{display:flex;gap:var(--space-sm)}.settings-warning-banner{margin-top:var(--space-sm);padding:var(--space-sm) var(--space-md);border:1px solid var(--color-warning);border-radius:var(--radius-md);background:color-mix(in srgb,var(--color-warning) 12%,transparent);color:var(--text);font-size:.875rem;line-height:1.4}.settings-warning-banner strong{color:var(--color-warning);margin-right:var(--space-xs)}.settings-sync-workflow-note{margin-top:var(--space-md);font-size:.875rem;color:var(--text-muted)}@media(max-width:768px){.auth-custom-provider-item{flex-direction:column;align-items:flex-start}.settings-warning-banner{padding:var(--space-sm)}}.shortcut-category{margin-top:var(--space-lg)}.shortcut-category:first-of-type{margin-top:0}.shortcut-row{display:flex;flex-direction:column;gap:var(--space-xs);padding:var(--space-sm) 0;border-bottom:1px solid var(--color-border)}.shortcut-row:last-child{border-bottom:0}.shortcut-capture{display:flex;align-items:center;gap:var(--space-sm);flex-wrap:wrap}.shortcut-capture__input{flex:1 1 auto;min-width:0}.shortcut-capture__input--invalid{border-color:var(--color-error)}.shortcut-capture__record--active{color:var(--color-warning)}.shortcut-conflict-banner{color:var(--color-error)}@media(max-width:768px){.shortcut-capture{flex-direction:column;align-items:stretch}.shortcut-capture__input{width:100%}}
@@ -1 +1 @@
1
- import{r as e}from"./vendor-react-SZ_qB27O.js";import{z as C}from"./index-BjELA24x.js";function L(k={}){const{projectId:d,pollInterval:b=6e4,autoRefresh:p=!1,enabled:t=!0}=k,[S,o]=e.useState(null),[m,l]=e.useState(t),[E,c]=e.useState(null),[R,v]=e.useState(null),r=e.useRef(null),n=e.useRef(null),a=e.useRef(!0),s=e.useCallback(async()=>{if(!t){l(!1),c(null),o(null);return}r.current&&r.current.abort(),r.current=new AbortController,l(!0),c(null),o(null);try{const u=await C(d);if(!a.current)return;o(u),c(null),v(new Date),l(!1)}catch(u){if(u instanceof Error&&u.name==="AbortError"||!a.current)return;const A=u instanceof Error?u.message:"Failed to fetch memory backend status";c(A),l(!1)}},[t,d]);e.useEffect(()=>(a.current=!0,t?(s(),()=>{a.current=!1}):(r.current&&r.current.abort(),o(null),c(null),l(!1),()=>{a.current=!1})),[t,s]),e.useEffect(()=>{if(!(!t||!p))return n.current=setInterval(()=>{s()},b),()=>{n.current&&(clearInterval(n.current),n.current=null)}},[t,p,b,s]),e.useEffect(()=>()=>{a.current=!1,r.current&&r.current.abort(),n.current&&(clearInterval(n.current),n.current=null)},[]);const h=e.useCallback(()=>s(),[s]),f=m?null:S,B=f?.currentBackend??null,i=f?.capabilities??null,y=f?.availableBackends??[],I=i?.readable??!1,g=i?.writable??!1,w=i?.supportsAtomicWrite??!1;return{status:f,currentBackend:B,capabilities:i,availableBackends:y,isReadable:I,isWritable:g,supportsAtomicWrite:w,loading:m,error:E,lastUpdated:R,refresh:h}}export{L as u};
1
+ import{r as e}from"./vendor-react-SZ_qB27O.js";import{z as C}from"./index-D7eX7QJk.js";function L(k={}){const{projectId:d,pollInterval:b=6e4,autoRefresh:p=!1,enabled:t=!0}=k,[S,o]=e.useState(null),[m,l]=e.useState(t),[E,c]=e.useState(null),[R,v]=e.useState(null),r=e.useRef(null),n=e.useRef(null),a=e.useRef(!0),s=e.useCallback(async()=>{if(!t){l(!1),c(null),o(null);return}r.current&&r.current.abort(),r.current=new AbortController,l(!0),c(null),o(null);try{const u=await C(d);if(!a.current)return;o(u),c(null),v(new Date),l(!1)}catch(u){if(u instanceof Error&&u.name==="AbortError"||!a.current)return;const A=u instanceof Error?u.message:"Failed to fetch memory backend status";c(A),l(!1)}},[t,d]);e.useEffect(()=>(a.current=!0,t?(s(),()=>{a.current=!1}):(r.current&&r.current.abort(),o(null),c(null),l(!1),()=>{a.current=!1})),[t,s]),e.useEffect(()=>{if(!(!t||!p))return n.current=setInterval(()=>{s()},b),()=>{n.current&&(clearInterval(n.current),n.current=null)}},[t,p,b,s]),e.useEffect(()=>()=>{a.current=!1,r.current&&r.current.abort(),n.current&&(clearInterval(n.current),n.current=null)},[]);const h=e.useCallback(()=>s(),[s]),f=m?null:S,B=f?.currentBackend??null,i=f?.capabilities??null,y=f?.availableBackends??[],I=i?.readable??!1,g=i?.writable??!1,w=i?.supportsAtomicWrite??!1;return{status:f,currentBackend:B,capabilities:i,availableBackends:y,isReadable:I,isWritable:g,supportsAtomicWrite:w,loading:m,error:E,lastUpdated:R,refresh:h}}export{L as u};