@runfusion/fusion 0.74.0-beta.4 → 0.74.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +114 -75
- package/dist/child-process-worker.js +11 -1
- package/dist/client/.vite/manifest.json +244 -244
- package/dist/client/assets/{AgentDetailView-BGXTnuBR.js → AgentDetailView-GYleZQ4I.js} +1 -1
- package/dist/client/assets/{AgentPermissionPolicyEditor-DswM202p.js → AgentPermissionPolicyEditor-pJIXpqOG.js} +1 -1
- package/dist/client/assets/{AgentsView-CEpZDrmC.js → AgentsView-C9uiOLPs.js} +3 -3
- package/dist/client/assets/{ChatView-BXXX0q6G.js → ChatView-B7_4jt9R.js} +1 -1
- package/dist/client/assets/{CommandCenter-CqjN1-9X.js → CommandCenter-gGvdPmZx.js} +1 -1
- package/dist/client/assets/{DevServerView-BUO7JRi6.js → DevServerView-CL7axVX8.js} +1 -1
- package/dist/client/assets/{DirectoryPicker-CiP4h5C7.js → DirectoryPicker-mm9__9xY.js} +1 -1
- package/dist/client/assets/{DocumentsView-DwLD0h2S.js → DocumentsView-DKSB8mQI.js} +1 -1
- package/dist/client/assets/{EvalsView-C9juKffD.js → EvalsView-CtwfGg6y.js} +1 -1
- package/dist/client/assets/{ExperimentalAgentOnboardingModal-DYvw9TEh.js → ExperimentalAgentOnboardingModal-DGjpLPWm.js} +1 -1
- package/dist/client/assets/{GoalsView-BD1AkfVN.js → GoalsView-CUtFV16M.js} +1 -1
- package/dist/client/assets/{InsightsView-Q0mu759R.js → InsightsView-Bt4n-gFZ.js} +1 -1
- package/dist/client/assets/{MemoryView-DCTqPpCG.js → MemoryView-0p84QjWE.js} +1 -1
- package/dist/client/assets/{PiExtensionsManager-CSe_uGfa.js → PiExtensionsManager-CwnPvrvv.js} +1 -1
- package/dist/client/assets/{PluginManager-DPm8YQC0.js → PluginManager-D7scUBUh.js} +1 -1
- package/dist/client/assets/{PullRequestView-BpJgNDLH.js → PullRequestView-op1QyrvF.js} +1 -1
- package/dist/client/assets/{ReportModal-iGmTZqiF.js → ReportModal-Cixa37L8.js} +1 -1
- package/dist/client/assets/{ResearchView-BfgKB-6z.js → ResearchView-48hx_Nnj.js} +1 -1
- package/dist/client/assets/{SecretsView-CqvQLK7z.js → SecretsView-CpIDlLXB.js} +1 -1
- package/dist/client/assets/{SessionTerminal-A9di8GAo.js → SessionTerminal-BlrHptKP.js} +1 -1
- package/dist/client/assets/{SettingsModal-D-iyPGZE.js → SettingsModal-BN4z8V64.js} +1 -1
- package/dist/client/assets/{SettingsModal-BsCUsAXe.js → SettingsModal-CYhXaN9Q.js} +4 -4
- package/dist/client/assets/{SettingsTextareaRow-DwgHxMMY.js → SettingsTextareaRow-DbbwaFZB.js} +1 -1
- package/dist/client/assets/{SetupWizardModal-CrSnLN44.js → SetupWizardModal-sX6F_tuR.js} +2 -2
- package/dist/client/assets/{SkillsView-C_STy7KI.js → SkillsView-BNQIeoyG.js} +1 -1
- package/dist/client/assets/{TodoView-BJJNGNLq.js → TodoView-Bu4UuFO2.js} +1 -1
- package/dist/client/assets/{WorkflowNodeEditor-Jp5i_Vxu.js → WorkflowNodeEditor-BVTqe9-2.js} +3 -3
- package/dist/client/assets/{agent-import-generation-DbVrl8ou.js → agent-import-generation-ChGufJzG.js} +1 -1
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-Ctz8GX1N.js → architectureDiagram-3BPJPVTR-Cl5gNo7p.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-WI_YPphw.js → blockDiagram-GPEHLZMM-B3E7DFJJ.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-BLwS5Zfh.js → c4Diagram-AAUBKEIU-Bj_ZPoFn.js} +1 -1
- package/dist/client/assets/channel-Cm54mhSQ.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-DeXlX12-.js → chunk-2J33WTMH-B0P5K-xu.js} +1 -1
- package/dist/client/assets/{chunk-4BX2VUAB-zvCEraJR.js → chunk-4BX2VUAB-CEu45ByZ.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-BgZq96DR.js → chunk-55IACEB6-Cr6VuM7S.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-CayoVGXL.js → chunk-727SXJPM-D3Hy6AmL.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-BmaktpVP.js → chunk-AQP2D5EJ-CuVcS6BO.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-qYWgZPF8.js → chunk-FMBD7UC4-Q_8Erd5R.js} +1 -1
- package/dist/client/assets/{chunk-ND2GUHAM-DIovauCc.js → chunk-ND2GUHAM-fUBj411G.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-DXWnr9LE.js → chunk-QZHKN3VN-CzAtr8Ei.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-BiGEx_wa.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-BiGEx_wa.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-Dee9mTjK.js → cose-bilkent-S5V4N54A-KF3Fhd8n.js} +1 -1
- package/dist/client/assets/{dagre-BM42HDAG-CU-v2zoi.js → dagre-BM42HDAG-DG7Zy0Tp.js} +1 -1
- package/dist/client/assets/{dashboard-view-COary9sK.js → dashboard-view-7fNoNaKi.js} +1 -1
- package/dist/client/assets/{dashboard-view-BM790i02.js → dashboard-view-BWLS6upM.js} +1 -1
- package/dist/client/assets/{dashboard-view-CG4rzThC.js → dashboard-view-Br-VgdfF.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-DIqdnJ5B.js → diagram-2AECGRRQ-5JY32FOH.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-ChpdUlpb.js → diagram-5GNKFQAL-DCAL8s3z.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-BxmzOp-c.js → diagram-KO2AKTUF-C-Gl3KqY.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-DLEx-0rl.js → diagram-LMA3HP47-56_y6YB_.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-DEpkJ3cG.js → diagram-OG6HWLK6-7XM6PUCA.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-C3Rjr78a.js → erDiagram-TEJ5UH35-fkpo67d9.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-aPbBbeiH.js → flowDiagram-I6XJVG4X-CjkKXpvy.js} +1 -1
- package/dist/client/assets/{folder-open-BnNbfyzc.js → folder-open-B0zT7pjM.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-BEzAwvJ4.js → ganttDiagram-6RSMTGT7-DCxj33Ce.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-Y4hB2swQ.js → gitGraphDiagram-PVQCEYII-D0XYFbBv.js} +1 -1
- package/dist/client/assets/{index-8wtfjIkg.js → index-Ck-7DP8n.js} +293 -293
- package/dist/client/assets/{infoDiagram-5YYISTIA-pd3J7fRT.js → infoDiagram-5YYISTIA-ICfcKKPN.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-B968vfOH.js → ishikawaDiagram-YF4QCWOH-B5fIfqcH.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-V4crhYKX.js → journeyDiagram-JHISSGLW-DurQl3Lk.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-Cl8LxR6k.js → kanban-definition-UN3LZRKU-Dc-aAsvK.js} +1 -1
- package/dist/client/assets/{mermaid.core-rb_bKdHH.js → mermaid.core-ZpeafUdD.js} +4 -4
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-Cnu-LPHz.js → mindmap-definition-RKZ34NQL-qc5mxYep.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-C6hPYepr.js → pieDiagram-4H26LBE5-BeBCrwxa.js} +1 -1
- package/dist/client/assets/{puzzle-C8AvcmuM.js → puzzle-DoN20Wf8.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-CUImgAi-.js → quadrantDiagram-W4KKPZXB-BAOR__9f.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-DzDLxIYz.js → requirementDiagram-4Y6WPE33-xztcPYl8.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-DSr_oIy8.js → sankeyDiagram-5OEKKPKP-BYnQyDFr.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-DO2E98Hv.js → sequenceDiagram-3UESZ5HK-2xXQOg29.js} +1 -1
- package/dist/client/assets/{shield-alert-Byjz1VmT.js → shield-alert-B5s2Ap6u.js} +1 -1
- package/dist/client/assets/{standing-instructions-template-Cf9fZ8bv.js → standing-instructions-template-CWOJ5vao.js} +1 -1
- package/dist/client/assets/{stateDiagram-AJRCARHV-BYPlDS4u.js → stateDiagram-AJRCARHV-BnpAA816.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-Ce_6vh1Q.js → stateDiagram-v2-BHNVJYJU-CRCjYzah.js} +1 -1
- package/dist/client/assets/{timeline-definition-PNZ67QCA-CG1FeaKV.js → timeline-definition-PNZ67QCA-rjWi6Lwp.js} +1 -1
- package/dist/client/assets/{upload-yPsE_DRN.js → upload-BZmWcUph.js} +1 -1
- package/dist/client/assets/{users-C_YmWx9d.js → users-cNoQdJGl.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-JLUXqFyb.js → vennDiagram-CIIHVFJN-Dz0AdEKB.js} +1 -1
- package/dist/client/assets/{wardley-L42UT6IY-D_UBzrZ2.js → wardley-L42UT6IY-Boky1mhD.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-BzwMrdpL.js → wardleyDiagram-YWT4CUSO-C5edajak.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-C5TjbAcZ.js → xychartDiagram-2RQKCTM6-cVjJqGUH.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/client/version.json +1 -1
- package/dist/extension.js +11 -1
- package/package.json +1 -1
- package/dist/client/assets/channel-CMMrQrQu.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-CqxyehbN.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-CqxyehbN.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{V as he,o as me,R as J,P as ye,E as Y,p as z,q as xe,u as ve,v as be,x as je,C as fe,g as Se,y as ge}from"./index-8wtfjIkg.js";import{u as Ne}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-xterm-BNq00GSj.js";const Ce="__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"}},Pe={...n,className:"secrets-action-icon spin"},Me=({addToast:i})=>{const{t:a}=Ne("app"),[R,G]=c.useState([]),[T,M]=c.useState(!0),[A,D]=c.useState(null),[K,b]=c.useState(null),[p,O]=c.useState(null),[U,x]=c.useState(!1),[Q,g]=c.useState(null),[t,l]=c.useState(L),[N,C]=c.useState(!1),[V,j]=c.useState({}),[W,F]=c.useState(null),[u,X]=c.useState(!1),[Z,_]=c.useState(!1),[f,B]=c.useState(""),[P,$]=c.useState(""),[ee,H]=c.useState(!1),[E,se]=c.useState(!1),h=c.useRef(new Map),w=c.useRef(new Map),o=c.useCallback(async(s,r)=>{const d=await fetch(s,{...r,headers:{"Content-Type":"application/json",...r?.headers??{}}});if(!d.ok){const m=await d.json().catch(()=>({error:"Request failed"}));throw new Error(String(m?.error??"Request failed"))}if(d.status!==204)return d.json()},[]),v=c.useCallback(async()=>{M(!0),D(null);try{const s=await o("/api/secrets");G(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){i?.(a("secrets.errorLoadSyncStatus","Failed to load sync passphrase status: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}},[i,o]);c.useEffect(()=>(v(),S(),()=>{h.current.forEach(s=>clearTimeout(s)),w.current.forEach(s=>clearTimeout(s))}),[v,S]);const k=()=>{_(!1),B(""),$("")},ae=async s=>{await o("/api/secrets/sync-passphrase",{method:"PUT",body:JSON.stringify({passphrase:s})})},re=async()=>{H(!0);try{await ae(f),i?.(u?a("secrets.syncPassphraseRotated","Sync passphrase rotated"):a("secrets.syncPassphraseSet","Sync passphrase set"),"success"),k(),await S()}catch(s){i?.(a("secrets.errorSaveSyncPassphrase","Failed to save sync passphrase: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{H(!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"}),i?.(a("secrets.syncPassphraseCleared","Sync passphrase cleared"),"success"),await S()}catch(r){i?.(a("secrets.errorClearSyncPassphrase","Failed to clear sync passphrase: {{error}}",{error:r instanceof Error?r.message:String(r)}),"error")}},ce=()=>{O(null),l(L),x(!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??""}),x(!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})});x(!1),l(L),await v()}catch(s){b(s instanceof Error?s.message:String(s))}},oe=s=>{const r=h.current.get(s.id);r&&(clearTimeout(r),h.current.delete(s.id)),j(d=>({...d,[s.id]:null}))},ie=async s=>{const r=await o(`/api/secrets/${s.scope}/${s.id}/reveal`,{method:"POST"});j(y=>({...y,[s.id]:r.value})),i?.(a("secrets.revealed","Revealed"),"success");const d=setTimeout(()=>{j(y=>({...y,[s.id]:null})),h.current.delete(s.id)},3e4),m=h.current.get(s.id);m&&clearTimeout(m),h.current.set(s.id,d)},de=async s=>{const r=V[s.id];if(!r)return;if(!await ge(r)){i?.(a("secrets.copyFailed","Failed to copy secret"),"error");return}F(s.id),i?.(a("secrets.copied","Copied"),"success");const m=setTimeout(()=>{F(null),j(ue=>({...ue,[s.id]:null}))},1500),y=w.current.get(s.id);y&&clearTimeout(y),w.current.set(s.id,m)},pe=async s=>{await o(`/api/secrets/${s.scope}/${s.id}`,{method:"DELETE"}),g(null),await v()},I=c.useMemo(()=>[...R].filter(s=>!(s.scope==="global"&&s.key===Ce)).sort((s,r)=>s.key.localeCompare(r.key)),[R]),q=f.length>0&&f===P;return e.jsxs("section",{className:"secrets-view",children:[e.jsx(he,{icon:me,title:a("secrets.title","Secrets"),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void v(),children:[e.jsx(J,{...n})," ",a("secrets.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:ce,children:[e.jsx(ye,{...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(J,{...Pe})," ",a("secrets.loading","Loading…")]}):null,!T&&I.length===0?e.jsx("div",{className:"secrets-empty",children:a("secrets.empty","No secrets found.")}):null,e.jsx("div",{className:"secrets-list",children:I.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(Y,{...n}):e.jsx(z,{...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(xe,{...n}):e.jsx(ve,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>le(s),"aria-label":a("secrets.editAriaLabel","Edit"),children:e.jsx(be,{...n})}),e.jsx("button",{className:"btn btn-icon btn-danger",onClick:()=>g(s.id),"aria-label":a("secrets.deleteAriaLabel","Delete"),children:e.jsx(je,{...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(fe,{size:16,"aria-hidden":"true"}):e.jsx(Se,{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=>B(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=>$(s.target.value)})]}),!q&&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:!q||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:()=>x(!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(Y,{...n}):e.jsx(z,{...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:()=>x(!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{Me as SecretsView};
|
|
1
|
+
import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{V as he,o as me,R as J,P as ye,E as Y,p as z,q as xe,u as ve,v as be,x as je,C as fe,g as Se,y as ge}from"./index-Ck-7DP8n.js";import{u as Ne}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";import"./vendor-xterm-BNq00GSj.js";const Ce="__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"}},Pe={...n,className:"secrets-action-icon spin"},Me=({addToast:i})=>{const{t:a}=Ne("app"),[R,G]=c.useState([]),[T,M]=c.useState(!0),[A,D]=c.useState(null),[K,b]=c.useState(null),[p,O]=c.useState(null),[U,x]=c.useState(!1),[Q,g]=c.useState(null),[t,l]=c.useState(L),[N,C]=c.useState(!1),[V,j]=c.useState({}),[W,F]=c.useState(null),[u,X]=c.useState(!1),[Z,_]=c.useState(!1),[f,B]=c.useState(""),[P,$]=c.useState(""),[ee,H]=c.useState(!1),[E,se]=c.useState(!1),h=c.useRef(new Map),w=c.useRef(new Map),o=c.useCallback(async(s,r)=>{const d=await fetch(s,{...r,headers:{"Content-Type":"application/json",...r?.headers??{}}});if(!d.ok){const m=await d.json().catch(()=>({error:"Request failed"}));throw new Error(String(m?.error??"Request failed"))}if(d.status!==204)return d.json()},[]),v=c.useCallback(async()=>{M(!0),D(null);try{const s=await o("/api/secrets");G(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){i?.(a("secrets.errorLoadSyncStatus","Failed to load sync passphrase status: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}},[i,o]);c.useEffect(()=>(v(),S(),()=>{h.current.forEach(s=>clearTimeout(s)),w.current.forEach(s=>clearTimeout(s))}),[v,S]);const k=()=>{_(!1),B(""),$("")},ae=async s=>{await o("/api/secrets/sync-passphrase",{method:"PUT",body:JSON.stringify({passphrase:s})})},re=async()=>{H(!0);try{await ae(f),i?.(u?a("secrets.syncPassphraseRotated","Sync passphrase rotated"):a("secrets.syncPassphraseSet","Sync passphrase set"),"success"),k(),await S()}catch(s){i?.(a("secrets.errorSaveSyncPassphrase","Failed to save sync passphrase: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{H(!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"}),i?.(a("secrets.syncPassphraseCleared","Sync passphrase cleared"),"success"),await S()}catch(r){i?.(a("secrets.errorClearSyncPassphrase","Failed to clear sync passphrase: {{error}}",{error:r instanceof Error?r.message:String(r)}),"error")}},ce=()=>{O(null),l(L),x(!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??""}),x(!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})});x(!1),l(L),await v()}catch(s){b(s instanceof Error?s.message:String(s))}},oe=s=>{const r=h.current.get(s.id);r&&(clearTimeout(r),h.current.delete(s.id)),j(d=>({...d,[s.id]:null}))},ie=async s=>{const r=await o(`/api/secrets/${s.scope}/${s.id}/reveal`,{method:"POST"});j(y=>({...y,[s.id]:r.value})),i?.(a("secrets.revealed","Revealed"),"success");const d=setTimeout(()=>{j(y=>({...y,[s.id]:null})),h.current.delete(s.id)},3e4),m=h.current.get(s.id);m&&clearTimeout(m),h.current.set(s.id,d)},de=async s=>{const r=V[s.id];if(!r)return;if(!await ge(r)){i?.(a("secrets.copyFailed","Failed to copy secret"),"error");return}F(s.id),i?.(a("secrets.copied","Copied"),"success");const m=setTimeout(()=>{F(null),j(ue=>({...ue,[s.id]:null}))},1500),y=w.current.get(s.id);y&&clearTimeout(y),w.current.set(s.id,m)},pe=async s=>{await o(`/api/secrets/${s.scope}/${s.id}`,{method:"DELETE"}),g(null),await v()},I=c.useMemo(()=>[...R].filter(s=>!(s.scope==="global"&&s.key===Ce)).sort((s,r)=>s.key.localeCompare(r.key)),[R]),q=f.length>0&&f===P;return e.jsxs("section",{className:"secrets-view",children:[e.jsx(he,{icon:me,title:a("secrets.title","Secrets"),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void v(),children:[e.jsx(J,{...n})," ",a("secrets.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:ce,children:[e.jsx(ye,{...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(J,{...Pe})," ",a("secrets.loading","Loading…")]}):null,!T&&I.length===0?e.jsx("div",{className:"secrets-empty",children:a("secrets.empty","No secrets found.")}):null,e.jsx("div",{className:"secrets-list",children:I.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(Y,{...n}):e.jsx(z,{...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(xe,{...n}):e.jsx(ve,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>le(s),"aria-label":a("secrets.editAriaLabel","Edit"),children:e.jsx(be,{...n})}),e.jsx("button",{className:"btn btn-icon btn-danger",onClick:()=>g(s.id),"aria-label":a("secrets.deleteAriaLabel","Delete"),children:e.jsx(je,{...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(fe,{size:16,"aria-hidden":"true"}):e.jsx(Se,{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=>B(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=>$(s.target.value)})]}),!q&&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:!q||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:()=>x(!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(Y,{...n}):e.jsx(z,{...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:()=>x(!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{Me as SecretsView};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
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{J as xe,K as z,N as ce,O as J,Q as de,U as I,W as Ne,Y as Re,p as Pe,_ as je,$ as Y,a0 as Me,a1 as Le,a as De,a2 as K,a3 as Oe,a4 as Ae}from"./index-8wtfjIkg.js";import{r as n,j as t}from"./vendor-react-SZ_qB27O.js";import"./vendor-xterm-BNq00GSj.js";import{u as ze}from"./vendor-i18n-GF3RlKbq.js";import{S as Be}from"./shield-alert-Byjz1VmT.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";const Fe=32*1024,Ie=1e4,Ke=100,We="\x1B",$e=" ",Ue="",Qe="\x1B[A",Ve="\x1B[B",Je="\x1B[C",Ye="\x1B[D",W={ctrl:"Ctrl",escape:"Esc",tab:"Tab",ctrlC:"^C"};function ue(m){if(m.length!==1)return null;const o=m.toUpperCase().charCodeAt(0);return o>=64&&o<=95?String.fromCharCode(o&31):null}function He(){const[m,f]=n.useState(()=>Y());return n.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const o=window.matchMedia(Me),a=window.visualViewport,y=()=>f(Y());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)})},[]),m}function Ge(m,f){if(typeof window>"u")return"";const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/cli-sessions/ws?sessionId=${encodeURIComponent(m)}&ticket=${encodeURIComponent(f)}`;return Ae(a)}function qe(){return/Mac|iPhone|iPad|iPod/i.test(navigator.platform)}function Ze(m){if(typeof window<"u"&&typeof window.atob=="function"){const f=window.atob(m),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(m,"base64").toString("utf8")}function lt({sessionId:m,readOnly:f=!1,posture:o,mode:a="live",projectId:y,onConfirmAdvance:E,showConfirmAdvance:$=!1,onOpenAdapterSettings:H}){const{t:r}=ze("app"),C=n.useRef(null),T=n.useRef(null),M=n.useRef(null),g=n.useRef(null),S=n.useRef(null),[G,q]=n.useState(!1),[me,U]=n.useState(!1),[Z,X]=n.useState(!1),x=He(),{keyboardOpen:B,keyboardOverlap:fe}=xe({enabled:x}),pe=n.useRef(null),[_,ee]=n.useState(""),[N,L]=n.useState(!1),[ye,be]=n.useState(()=>z().customShortcuts),[te,ne]=n.useState(null),ie=f||te===!0,D=!f&&te===!1&&a==="live",b=n.useCallback(e=>{if(!e||!D)return;const i=S.current;i?.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"input",data:e}))},[D]),R=n.useCallback(e=>{if(N){const i=ue(e);if(L(!1),i){b(i);return}}b(e)},[N,b]),l=n.useCallback(e=>{e.preventDefault()},[]),he=n.useCallback(e=>{e?.preventDefault?.(),_&&b(_),b("\r"),ee("")},[_,b]),we=n.useCallback(e=>{if(N&&e.length>_.length){const i=e.slice(_.length,_.length+1),d=ue(i);if(L(!1),d){b(d);return}}ee(e)},[N,_,b]);n.useEffect(()=>{$&&U(!1)},[$,m]);const O=n.useCallback((e,i)=>{const d=S.current;d?.readyState===WebSocket.OPEN&&d.send(JSON.stringify({type:"resize",cols:e,rows:i}))},[]),se=n.useCallback(()=>{const e=T.current;if(!e)return;const i=z(),d=ce(i.fontFamily);e.options.fontFamily=d,C.current?.style.setProperty("--terminal-glyph-font-family",J(i.fontFamily)),e.options.fontSize=i.fontSize,e.options.cursorStyle=i.cursorStyle,e.options.cursorBlink=i.cursorBlink&&D;try{M.current?.fit?.(),O(e.cols,e.rows)}catch{}de(i.fontSize,d).then(P=>{if(!(!P||T.current!==e||e.options.fontSize!==i.fontSize||e.options.fontFamily!==d)){I(e,d),e.options.fontSize=i.fontSize;try{M.current?.fit?.(),O(e.cols,e.rows),I(e,d),e.refresh(0,Math.max(0,e.rows-1))}catch{}}},()=>{})},[D,O]);n.useEffect(()=>{if(typeof window>"u")return;const e=i=>{i.key===Le&&(se(),be(z().customShortcuts))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[se]),n.useEffect(()=>{if(!m||typeof window>"u")return;let e=!1,i=null,d=null,P=0;ne(null);const Q=O,ve=p=>{if(P+=p,P<Fe)return;const h=S.current;h?.readyState===WebSocket.OPEN&&h.send(JSON.stringify({type:"ack",bytes:P})),P=0};return(async()=>{let p;try{p=await De(`/cli-sessions/${encodeURIComponent(m)}/attach-ticket`,{method:"POST",body:JSON.stringify(y?{projectId:y}:{})})}catch{return}if(e)return;ne(p.readOnly);const h=!f&&!p.readOnly&&a==="live",[{Terminal:Ee},{FitAddon:Ce},{Unicode11Addon:Te}]=await Promise.all([K(()=>import("./vendor-xterm-BNq00GSj.js").then(c=>c.x),__vite__mapDeps([0,1,2])),K(()=>import("./addon-fit-C1WQXRvu.js").then(c=>c.a),__vite__mapDeps([3,1])),K(()=>import("./addon-unicode11-BVmNDUBM.js").then(c=>c.a),__vite__mapDeps([4,1]))]);if(e||!C.current)return;const w=z(),A=ce(w.fontFamily);C.current.style.setProperty("--terminal-glyph-font-family",J(w.fontFamily));const s=new Ee({convertEol:!1,cursorBlink:w.cursorBlink&&h,cursorStyle:w.cursorStyle,disableStdin:!h,scrollback:Ie,fontFamily:A,fontSize:w.fontSize}),j=new Ce;s.loadAddon(j);const ge=new Te;if(s.loadAddon(ge),s.unicode.activeVersion="11",Oe(()=>{s.open(C.current)}),T.current=s,M.current=j,w.renderer==="auto"&&!Y())try{const{WebglAddon:c}=await K(async()=>{const{WebglAddon:u}=await import("./addon-webgl-uLc0RKcC.js").then(k=>k.a);return{WebglAddon:u}},__vite__mapDeps([5,1]));if(!e){const u=new c;u.onContextLoss(()=>{try{u.dispose()}catch{}g.current===u&&(g.current=null)}),s.loadAddon(u),g.current=u}}catch{}try{j.fit()}catch{}(async()=>{if(!(!await de(w.fontSize,A)||e||T.current!==s||M.current!==j||s.options.fontSize!==w.fontSize||s.options.fontFamily!==A))try{I(s,A),s.options.fontSize=w.fontSize,j.fit(),Q(s.cols,s.rows),I(s,A),s.refresh(0,Math.max(0,s.rows-1))}catch{}})(),h&&(s.onData(c=>{const u=S.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"input",data:c}))}),s.attachCustomKeyEventHandler(c=>{if(c.type!=="keydown"||!(qe()?c.metaKey:c.ctrlKey)||c.altKey||c.shiftKey)return!0;const k=c.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(re=>{if(!re)return;const le=S.current;le?.readyState===WebSocket.OPEN&&le.send(JSON.stringify({type:"input",data:re}))}).catch(()=>{}),!1}return!0})),i=new ResizeObserver(()=>{d&&clearTimeout(d),d=setTimeout(()=>{try{j.fit(),Q(s.cols,s.rows),s.refresh(0,Math.max(0,s.rows-1))}catch{}},Ke)}),i.observe(C.current);const V=new WebSocket(Ge(m,p.ticket));S.current=V,V.onopen=()=>{Q(s.cols,s.rows)},V.onmessage=c=>{let u;try{u=JSON.parse(typeof c.data=="string"?c.data:"")}catch{return}switch(u.type){case"scrollback":case"data":{if(typeof u.data!="string")return;const k=Ze(u.data),v=k.length;s.write(k,()=>ve(v));break}}}})(),()=>{e=!0,d&&clearTimeout(d),i&&i.disconnect();const p=S.current;if(p){p.onopen=null,p.onmessage=null,p.onclose=null,p.onerror=null;try{p.close()}catch{}S.current=null}if(g.current){try{g.current.dispose()}catch{}g.current=null}const h=T.current;if(h){try{h.dispose()}catch{}T.current=null}M.current=null}},[m,f,a,y,O]);const oe=n.useMemo(()=>a==="idle"?r("cliTerminal.replayIdle","Session idle"):a==="ended"?r("cliTerminal.replayEnded","Session ended"):null,[a,r]),Se=n.useCallback(async()=>{if(E){X(!0);try{await E("advance"),U(!0)}finally{X(!1)}}},[E]),_e=n.useCallback(async()=>{E&&await E("not-yet"),U(!0)},[E]),F=!!o?.elevated,ae=o?.elevatedFlags?.join(", "),ke={"--terminal-glyph-font-family":J(z().fontFamily)};return t.jsxs("div",{className:`cli-session-terminal${x?" cli-session-terminal--mobile":""}${x&&B?" cli-session-terminal--keyboard-open":""}`,"data-mode":a,"data-read-only":ie,"data-mobile":x,"data-keyboard-open":x&&B,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${F?" cli-posture-chip--elevated":""}`,"data-elevated":F,"aria-expanded":G,onClick:()=>q(e=>!e),children:[F?t.jsx(Be,{size:13,"aria-hidden":"true"}):t.jsx(Ne,{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}),F&&ae&&t.jsx("span",{className:"cli-posture-chip__flag",children:ae})]}),G&&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,i)=>t.jsx("li",{children:e},i)),(o.resolved??[]).length===0&&t.jsx("li",{children:o.mode??r("cliTerminal.postureBaseline","Baseline")})]}),H&&t.jsxs("button",{type:"button",className:"cli-posture-tooltip__settings",onClick:()=>{q(!1),H()},children:[t.jsx(Re,{size:12,"aria-hidden":"true"}),r("cliTerminal.adapterSettings","Adapter settings")]})]})]}),ie&&t.jsxs("span",{className:"cli-session-terminal__readonly-badge",children:[t.jsx(Pe,{size:12,"aria-hidden":"true"}),r("cliTerminal.readOnly","Read-only")]}),oe&&t.jsx("span",{className:"cli-session-terminal__replay-badge","data-replay-mode":a,children:oe})]}),t.jsx("div",{className:"cli-session-terminal__viewport",ref:C,"data-testid":"cli-terminal-viewport",style:ke}),$&&!me&&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:Se,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:_e,children:r("cliTerminal.notYet","Not yet")})]})]}),x&&D&&t.jsxs("div",{className:`cli-session-terminal__mobile-bar${B?" cli-session-terminal__mobile-bar--keyboard-open":""}`,"data-testid":"cli-terminal-mobile-bar",style:B?{bottom:`${fe}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${N?" cli-terminal-key--active":""}`,"data-testid":"cli-key-ctrl","aria-label":r("cliTerminal.mobileKeyCtrl","Sticky Ctrl modifier"),"aria-pressed":N,onPointerDown:l,onMouseDown:l,onClick:()=>L(e=>!e),children:W.ctrl}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-esc","aria-label":r("cliTerminal.mobileKeyEsc","Send Escape"),onPointerDown:l,onMouseDown:l,onClick:()=>R(We),children:W.escape}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-tab","aria-label":r("cliTerminal.mobileKeyTab","Send Tab"),onPointerDown:l,onMouseDown:l,onClick:()=>R($e),children:W.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:l,onMouseDown:l,onClick:()=>{L(!1),b(Ue)},children:W.ctrlC}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-up","aria-label":r("cliTerminal.mobileKeyArrowUp","Cursor up"),onPointerDown:l,onMouseDown:l,onClick:()=>R(Qe),children:"↑"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-down","aria-label":r("cliTerminal.mobileKeyArrowDown","Cursor down"),onPointerDown:l,onMouseDown:l,onClick:()=>R(Ve),children:"↓"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-left","aria-label":r("cliTerminal.mobileKeyArrowLeft","Cursor left"),onPointerDown:l,onMouseDown:l,onClick:()=>R(Ye),children:"←"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-right","aria-label":r("cliTerminal.mobileKeyArrowRight","Cursor right"),onPointerDown:l,onMouseDown:l,onClick:()=>R(Je),children:"→"}),ye.map(e=>t.jsx("button",{type:"button",className:"cli-terminal-key cli-terminal-key--custom","data-testid":`cli-terminal-custom-shortcut-${e.id}`,title:e.label,"aria-label":e.label,onPointerDown:l,onMouseDown:l,onClick:()=>{L(!1),b(je(e.value))},children:e.label},e.id))]}),t.jsxs("form",{className:"cli-session-terminal__input-row",onSubmit:he,children:[t.jsx("input",{ref:pe,type:"text",className:"cli-session-terminal__mobile-input","data-testid":"cli-terminal-mobile-input",value:_,placeholder:r("cliTerminal.mobileInputPlaceholder","Type to send to the session…"),autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,onChange:e=>we(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:l,onMouseDown:l,children:r("cliTerminal.mobileSend","Send")})]})]})]})}export{lt as SessionTerminal};
|
|
2
|
+
import{J as xe,K as z,N as ce,O as J,Q as de,U as I,W as Ne,Y as Re,p as Pe,_ as je,$ as Y,a0 as Me,a1 as Le,a as De,a2 as K,a3 as Oe,a4 as Ae}from"./index-Ck-7DP8n.js";import{r as n,j as t}from"./vendor-react-SZ_qB27O.js";import"./vendor-xterm-BNq00GSj.js";import{u as ze}from"./vendor-i18n-GF3RlKbq.js";import{S as Be}from"./shield-alert-B5s2Ap6u.js";import"./vendor-codemirror-jBKmHyH0.js";import"./vendor-reactflow-9C3XTE7_.js";const Fe=32*1024,Ie=1e4,Ke=100,We="\x1B",$e=" ",Ue="",Qe="\x1B[A",Ve="\x1B[B",Je="\x1B[C",Ye="\x1B[D",W={ctrl:"Ctrl",escape:"Esc",tab:"Tab",ctrlC:"^C"};function ue(m){if(m.length!==1)return null;const o=m.toUpperCase().charCodeAt(0);return o>=64&&o<=95?String.fromCharCode(o&31):null}function He(){const[m,f]=n.useState(()=>Y());return n.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const o=window.matchMedia(Me),a=window.visualViewport,y=()=>f(Y());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)})},[]),m}function Ge(m,f){if(typeof window>"u")return"";const a=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/cli-sessions/ws?sessionId=${encodeURIComponent(m)}&ticket=${encodeURIComponent(f)}`;return Ae(a)}function qe(){return/Mac|iPhone|iPad|iPod/i.test(navigator.platform)}function Ze(m){if(typeof window<"u"&&typeof window.atob=="function"){const f=window.atob(m),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(m,"base64").toString("utf8")}function lt({sessionId:m,readOnly:f=!1,posture:o,mode:a="live",projectId:y,onConfirmAdvance:E,showConfirmAdvance:$=!1,onOpenAdapterSettings:H}){const{t:r}=ze("app"),C=n.useRef(null),T=n.useRef(null),M=n.useRef(null),g=n.useRef(null),S=n.useRef(null),[G,q]=n.useState(!1),[me,U]=n.useState(!1),[Z,X]=n.useState(!1),x=He(),{keyboardOpen:B,keyboardOverlap:fe}=xe({enabled:x}),pe=n.useRef(null),[_,ee]=n.useState(""),[N,L]=n.useState(!1),[ye,be]=n.useState(()=>z().customShortcuts),[te,ne]=n.useState(null),ie=f||te===!0,D=!f&&te===!1&&a==="live",b=n.useCallback(e=>{if(!e||!D)return;const i=S.current;i?.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"input",data:e}))},[D]),R=n.useCallback(e=>{if(N){const i=ue(e);if(L(!1),i){b(i);return}}b(e)},[N,b]),l=n.useCallback(e=>{e.preventDefault()},[]),he=n.useCallback(e=>{e?.preventDefault?.(),_&&b(_),b("\r"),ee("")},[_,b]),we=n.useCallback(e=>{if(N&&e.length>_.length){const i=e.slice(_.length,_.length+1),d=ue(i);if(L(!1),d){b(d);return}}ee(e)},[N,_,b]);n.useEffect(()=>{$&&U(!1)},[$,m]);const O=n.useCallback((e,i)=>{const d=S.current;d?.readyState===WebSocket.OPEN&&d.send(JSON.stringify({type:"resize",cols:e,rows:i}))},[]),se=n.useCallback(()=>{const e=T.current;if(!e)return;const i=z(),d=ce(i.fontFamily);e.options.fontFamily=d,C.current?.style.setProperty("--terminal-glyph-font-family",J(i.fontFamily)),e.options.fontSize=i.fontSize,e.options.cursorStyle=i.cursorStyle,e.options.cursorBlink=i.cursorBlink&&D;try{M.current?.fit?.(),O(e.cols,e.rows)}catch{}de(i.fontSize,d).then(P=>{if(!(!P||T.current!==e||e.options.fontSize!==i.fontSize||e.options.fontFamily!==d)){I(e,d),e.options.fontSize=i.fontSize;try{M.current?.fit?.(),O(e.cols,e.rows),I(e,d),e.refresh(0,Math.max(0,e.rows-1))}catch{}}},()=>{})},[D,O]);n.useEffect(()=>{if(typeof window>"u")return;const e=i=>{i.key===Le&&(se(),be(z().customShortcuts))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[se]),n.useEffect(()=>{if(!m||typeof window>"u")return;let e=!1,i=null,d=null,P=0;ne(null);const Q=O,ve=p=>{if(P+=p,P<Fe)return;const h=S.current;h?.readyState===WebSocket.OPEN&&h.send(JSON.stringify({type:"ack",bytes:P})),P=0};return(async()=>{let p;try{p=await De(`/cli-sessions/${encodeURIComponent(m)}/attach-ticket`,{method:"POST",body:JSON.stringify(y?{projectId:y}:{})})}catch{return}if(e)return;ne(p.readOnly);const h=!f&&!p.readOnly&&a==="live",[{Terminal:Ee},{FitAddon:Ce},{Unicode11Addon:Te}]=await Promise.all([K(()=>import("./vendor-xterm-BNq00GSj.js").then(c=>c.x),__vite__mapDeps([0,1,2])),K(()=>import("./addon-fit-C1WQXRvu.js").then(c=>c.a),__vite__mapDeps([3,1])),K(()=>import("./addon-unicode11-BVmNDUBM.js").then(c=>c.a),__vite__mapDeps([4,1]))]);if(e||!C.current)return;const w=z(),A=ce(w.fontFamily);C.current.style.setProperty("--terminal-glyph-font-family",J(w.fontFamily));const s=new Ee({convertEol:!1,cursorBlink:w.cursorBlink&&h,cursorStyle:w.cursorStyle,disableStdin:!h,scrollback:Ie,fontFamily:A,fontSize:w.fontSize}),j=new Ce;s.loadAddon(j);const ge=new Te;if(s.loadAddon(ge),s.unicode.activeVersion="11",Oe(()=>{s.open(C.current)}),T.current=s,M.current=j,w.renderer==="auto"&&!Y())try{const{WebglAddon:c}=await K(async()=>{const{WebglAddon:u}=await import("./addon-webgl-uLc0RKcC.js").then(k=>k.a);return{WebglAddon:u}},__vite__mapDeps([5,1]));if(!e){const u=new c;u.onContextLoss(()=>{try{u.dispose()}catch{}g.current===u&&(g.current=null)}),s.loadAddon(u),g.current=u}}catch{}try{j.fit()}catch{}(async()=>{if(!(!await de(w.fontSize,A)||e||T.current!==s||M.current!==j||s.options.fontSize!==w.fontSize||s.options.fontFamily!==A))try{I(s,A),s.options.fontSize=w.fontSize,j.fit(),Q(s.cols,s.rows),I(s,A),s.refresh(0,Math.max(0,s.rows-1))}catch{}})(),h&&(s.onData(c=>{const u=S.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"input",data:c}))}),s.attachCustomKeyEventHandler(c=>{if(c.type!=="keydown"||!(qe()?c.metaKey:c.ctrlKey)||c.altKey||c.shiftKey)return!0;const k=c.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(re=>{if(!re)return;const le=S.current;le?.readyState===WebSocket.OPEN&&le.send(JSON.stringify({type:"input",data:re}))}).catch(()=>{}),!1}return!0})),i=new ResizeObserver(()=>{d&&clearTimeout(d),d=setTimeout(()=>{try{j.fit(),Q(s.cols,s.rows),s.refresh(0,Math.max(0,s.rows-1))}catch{}},Ke)}),i.observe(C.current);const V=new WebSocket(Ge(m,p.ticket));S.current=V,V.onopen=()=>{Q(s.cols,s.rows)},V.onmessage=c=>{let u;try{u=JSON.parse(typeof c.data=="string"?c.data:"")}catch{return}switch(u.type){case"scrollback":case"data":{if(typeof u.data!="string")return;const k=Ze(u.data),v=k.length;s.write(k,()=>ve(v));break}}}})(),()=>{e=!0,d&&clearTimeout(d),i&&i.disconnect();const p=S.current;if(p){p.onopen=null,p.onmessage=null,p.onclose=null,p.onerror=null;try{p.close()}catch{}S.current=null}if(g.current){try{g.current.dispose()}catch{}g.current=null}const h=T.current;if(h){try{h.dispose()}catch{}T.current=null}M.current=null}},[m,f,a,y,O]);const oe=n.useMemo(()=>a==="idle"?r("cliTerminal.replayIdle","Session idle"):a==="ended"?r("cliTerminal.replayEnded","Session ended"):null,[a,r]),Se=n.useCallback(async()=>{if(E){X(!0);try{await E("advance"),U(!0)}finally{X(!1)}}},[E]),_e=n.useCallback(async()=>{E&&await E("not-yet"),U(!0)},[E]),F=!!o?.elevated,ae=o?.elevatedFlags?.join(", "),ke={"--terminal-glyph-font-family":J(z().fontFamily)};return t.jsxs("div",{className:`cli-session-terminal${x?" cli-session-terminal--mobile":""}${x&&B?" cli-session-terminal--keyboard-open":""}`,"data-mode":a,"data-read-only":ie,"data-mobile":x,"data-keyboard-open":x&&B,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${F?" cli-posture-chip--elevated":""}`,"data-elevated":F,"aria-expanded":G,onClick:()=>q(e=>!e),children:[F?t.jsx(Be,{size:13,"aria-hidden":"true"}):t.jsx(Ne,{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}),F&&ae&&t.jsx("span",{className:"cli-posture-chip__flag",children:ae})]}),G&&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,i)=>t.jsx("li",{children:e},i)),(o.resolved??[]).length===0&&t.jsx("li",{children:o.mode??r("cliTerminal.postureBaseline","Baseline")})]}),H&&t.jsxs("button",{type:"button",className:"cli-posture-tooltip__settings",onClick:()=>{q(!1),H()},children:[t.jsx(Re,{size:12,"aria-hidden":"true"}),r("cliTerminal.adapterSettings","Adapter settings")]})]})]}),ie&&t.jsxs("span",{className:"cli-session-terminal__readonly-badge",children:[t.jsx(Pe,{size:12,"aria-hidden":"true"}),r("cliTerminal.readOnly","Read-only")]}),oe&&t.jsx("span",{className:"cli-session-terminal__replay-badge","data-replay-mode":a,children:oe})]}),t.jsx("div",{className:"cli-session-terminal__viewport",ref:C,"data-testid":"cli-terminal-viewport",style:ke}),$&&!me&&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:Se,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:_e,children:r("cliTerminal.notYet","Not yet")})]})]}),x&&D&&t.jsxs("div",{className:`cli-session-terminal__mobile-bar${B?" cli-session-terminal__mobile-bar--keyboard-open":""}`,"data-testid":"cli-terminal-mobile-bar",style:B?{bottom:`${fe}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${N?" cli-terminal-key--active":""}`,"data-testid":"cli-key-ctrl","aria-label":r("cliTerminal.mobileKeyCtrl","Sticky Ctrl modifier"),"aria-pressed":N,onPointerDown:l,onMouseDown:l,onClick:()=>L(e=>!e),children:W.ctrl}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-esc","aria-label":r("cliTerminal.mobileKeyEsc","Send Escape"),onPointerDown:l,onMouseDown:l,onClick:()=>R(We),children:W.escape}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-tab","aria-label":r("cliTerminal.mobileKeyTab","Send Tab"),onPointerDown:l,onMouseDown:l,onClick:()=>R($e),children:W.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:l,onMouseDown:l,onClick:()=>{L(!1),b(Ue)},children:W.ctrlC}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-up","aria-label":r("cliTerminal.mobileKeyArrowUp","Cursor up"),onPointerDown:l,onMouseDown:l,onClick:()=>R(Qe),children:"↑"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-down","aria-label":r("cliTerminal.mobileKeyArrowDown","Cursor down"),onPointerDown:l,onMouseDown:l,onClick:()=>R(Ve),children:"↓"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-left","aria-label":r("cliTerminal.mobileKeyArrowLeft","Cursor left"),onPointerDown:l,onMouseDown:l,onClick:()=>R(Ye),children:"←"}),t.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-right","aria-label":r("cliTerminal.mobileKeyArrowRight","Cursor right"),onPointerDown:l,onMouseDown:l,onClick:()=>R(Je),children:"→"}),ye.map(e=>t.jsx("button",{type:"button",className:"cli-terminal-key cli-terminal-key--custom","data-testid":`cli-terminal-custom-shortcut-${e.id}`,title:e.label,"aria-label":e.label,onPointerDown:l,onMouseDown:l,onClick:()=>{L(!1),b(je(e.value))},children:e.label},e.id))]}),t.jsxs("form",{className:"cli-session-terminal__input-row",onSubmit:he,children:[t.jsx("input",{ref:pe,type:"text",className:"cli-session-terminal__mobile-input","data-testid":"cli-terminal-mobile-input",value:_,placeholder:r("cliTerminal.mobileInputPlaceholder","Type to send to the session…"),autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,onChange:e=>we(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:l,onMouseDown:l,children:r("cliTerminal.mobileSend","Send")})]})]})]})}export{lt as SessionTerminal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r}from"./vendor-react-SZ_qB27O.js";import{a as n,w as s}from"./index-
|
|
1
|
+
import{r}from"./vendor-react-SZ_qB27O.js";import{a as n,w as s}from"./index-Ck-7DP8n.js";function x(e){return n(s("/memory/files",e))}function C(e,t){const c=`path=${encodeURIComponent(e)}`;return n(s(`/memory/file?${c}`,t))}function F(e,t,c){return n(s("/memory/file",c),{method:"PUT",body:JSON.stringify({path:e,content:t})})}function J(e,t){return n(s("/memory/compact",t),{method:"POST",body:JSON.stringify(e?{path:e}:{})})}function N(e){return n(s("/memory/dream",e),{method:"POST"})}function W(e){return n(s("/memory/insights",e))}function j(e,t){return n(s("/memory/insights",t),{method:"PUT",body:JSON.stringify({content:e})})}function q(e){return n(s("/memory/extract",e),{method:"POST"})}function D(e){return n(s("/memory/audit",e))}function B(e){return n(s("/memory/backend",e))}function L(e){return n(s("/memory/install-qmd",e),{method:"POST"})}function $(e,t){return n(s("/memory/test",t),{method:"POST",body:JSON.stringify({query:e})})}function Q(e={}){const{projectId:t,pollInterval:c=6e4,autoRefresh:p=!1,enabled:a=!0}=e,[S,y]=r.useState(null),[g,m]=r.useState(a),[M,d]=r.useState(null),[k,v]=r.useState(null),o=r.useRef(null),u=r.useRef(null),l=r.useRef(!0),i=r.useCallback(async()=>{if(!a){m(!1),d(null),y(null);return}o.current&&o.current.abort(),o.current=new AbortController,m(!0),d(null),y(null);try{const f=await B(t);if(!l.current)return;y(f),d(null),v(new Date),m(!1)}catch(f){if(f instanceof Error&&f.name==="AbortError"||!l.current)return;const w=f instanceof Error?f.message:"Failed to fetch memory backend status";d(w),m(!1)}},[a,t]);r.useEffect(()=>(l.current=!0,a?(i(),()=>{l.current=!1}):(o.current&&o.current.abort(),y(null),d(null),m(!1),()=>{l.current=!1})),[a,i]),r.useEffect(()=>{if(!(!a||!p))return u.current=setInterval(()=>{i()},c),()=>{u.current&&(clearInterval(u.current),u.current=null)}},[a,p,c,i]),r.useEffect(()=>()=>{l.current=!1,o.current&&o.current.abort(),u.current&&(clearInterval(u.current),u.current=null)},[]);const I=r.useCallback(()=>i(),[i]),b=g?null:S,R=b?.currentBackend??null,h=b?.capabilities??null,E=b?.availableBackends??[],O=h?.readable??!1,P=h?.writable??!1,T=h?.supportsAtomicWrite??!1;return{status:b,currentBackend:R,capabilities:h,availableBackends:E,isReadable:O,isWritable:P,supportsAtomicWrite:T,loading:g,error:M,lastUpdated:k,refresh:I}}export{x as a,D as b,W as c,j as d,q as e,C as f,N as g,J as h,L as i,F as s,$ as t,Q as u};
|