@runfusion/fusion 0.75.0-beta.0 → 0.75.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +2858 -1801
- package/dist/child-process-worker.js +2650 -1824
- package/dist/client/.vite/manifest.json +249 -249
- package/dist/client/assets/{AgentDetailView-lS4k3-0w.js → AgentDetailView-C4Xpag_i.js} +1 -1
- package/dist/client/assets/{AgentPermissionPolicyEditor-D7LB_f1m.js → AgentPermissionPolicyEditor-D-Fp7-sy.js} +1 -1
- package/dist/client/assets/{AgentsView-DwCNc9_x.js → AgentsView-BmFsoY1Q.js} +3 -3
- package/dist/client/assets/{ChatView-CVxDxKOu.js → ChatView-5KsB3BVO.js} +1 -1
- package/dist/client/assets/{CommandCenter-Da3AiDs-.js → CommandCenter-CacGI8AV.js} +1 -1
- package/dist/client/assets/{DevServerView-C0UWmEhO.js → DevServerView-DufjauVn.js} +1 -1
- package/dist/client/assets/{DirectoryPicker-JH2ahFj8.js → DirectoryPicker-DvwqfQDS.js} +1 -1
- package/dist/client/assets/{DocumentsView-BA4Pqnfr.js → DocumentsView-BbYJFIQ1.js} +1 -1
- package/dist/client/assets/{EvalsView-DW88MPta.js → EvalsView-NBC8kOc-.js} +1 -1
- package/dist/client/assets/{ExperimentalAgentOnboardingModal-DOih_5nN.js → ExperimentalAgentOnboardingModal-C809yXXY.js} +1 -1
- package/dist/client/assets/{GoalsView-DDIorLyM.js → GoalsView-CpNO9eI0.js} +1 -1
- package/dist/client/assets/{InsightsView-B5VUUsmJ.js → InsightsView-Cahy5FcR.js} +1 -1
- package/dist/client/assets/{MemoryView-sDMj6cEL.js → MemoryView-BNJAQjqn.js} +1 -1
- package/dist/client/assets/{PiExtensionsManager-SpcPEzpg.js → PiExtensionsManager-DCHTyOmJ.js} +1 -1
- package/dist/client/assets/{PluginManager-lIMMAJYt.js → PluginManager-CBt-CqUz.js} +1 -1
- package/dist/client/assets/{PullRequestView-BfAHOr3-.js → PullRequestView-Dsb9RwmX.js} +1 -1
- package/dist/client/assets/{ReportModal-6RDeUqQG.js → ReportModal-8FjZOcbC.js} +1 -1
- package/dist/client/assets/{ResearchView-BUGq2GsN.js → ResearchView-DlSG7dOd.js} +1 -1
- package/dist/client/assets/{SecretsView-CTwukpAq.js → SecretsView-BSajNE-f.js} +1 -1
- package/dist/client/assets/{SessionTerminal-Dspbb2NO.js → SessionTerminal-M2fIpHrL.js} +1 -1
- package/dist/client/assets/{SettingsModal-B6guaVe8.js → SettingsModal-DLcvlp44.js} +3 -3
- package/dist/client/assets/{SettingsModal-D2DahTWc.js → SettingsModal-z6gOf7dG.js} +1 -1
- package/dist/client/assets/{SettingsTextareaRow-BZZnVXGb.js → SettingsTextareaRow-DeC19053.js} +1 -1
- package/dist/client/assets/{SetupWizardModal-xTlxjulj.js → SetupWizardModal-BOjMePFh.js} +2 -2
- package/dist/client/assets/{SkillsView-CMG1fM0H.js → SkillsView-BSBEC-Xm.js} +1 -1
- package/dist/client/assets/{WorkflowNodeEditor-BBrY5D7F.js → WorkflowNodeEditor-DZ9-RBqo.js} +1 -1
- package/dist/client/assets/{agent-import-generation-DV3YE8Rc.js → agent-import-generation-COItiXMT.js} +1 -1
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-gMbSnyDo.js → architectureDiagram-3BPJPVTR-BwlCePoB.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-BRPa9ADn.js → blockDiagram-GPEHLZMM-KKrLi9v4.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-BZhZDOqG.js → c4Diagram-AAUBKEIU-CkIDt_8M.js} +1 -1
- package/dist/client/assets/channel-CeYcnOtQ.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-bcODs8jt.js → chunk-2J33WTMH-D9sbdaqY.js} +1 -1
- package/dist/client/assets/{chunk-4BX2VUAB-BRVq7S5r.js → chunk-4BX2VUAB-D3DtFoAY.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-Cl7bhvca.js → chunk-55IACEB6-gxblxRIN.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-B9loHJy3.js → chunk-727SXJPM-D0AEDoHN.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-CFA8hWsC.js → chunk-AQP2D5EJ-BweoM7qY.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-Buu3h7wx.js → chunk-FMBD7UC4-sjblhrjI.js} +1 -1
- package/dist/client/assets/{chunk-ND2GUHAM-DN_GDbIs.js → chunk-ND2GUHAM-CYuRENSs.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-1t7Gs0aF.js → chunk-QZHKN3VN-CFKJr4kG.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-CZwh2k1X.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-CZwh2k1X.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-QqcFhiY1.js → cose-bilkent-S5V4N54A-6Jb6SgHM.js} +1 -1
- package/dist/client/assets/{dagre-BM42HDAG-DjGM9BIi.js → dagre-BM42HDAG-FQJ87Ol3.js} +1 -1
- package/dist/client/assets/{dashboard-view-BO_R8jyX.js → dashboard-view-B1Rq2-73.js} +1 -1
- package/dist/client/assets/{dashboard-view-CxXlYApd.js → dashboard-view-DH1Zo0m4.js} +1 -1
- package/dist/client/assets/{dashboard-view-UqmC6VTb.js → dashboard-view-DVMZNVoc.js} +1 -1
- package/dist/client/assets/{dashboard-view-C6rmfIOU.js → dashboard-view-DgLbkn5n.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-BmCGpU8P.js → diagram-2AECGRRQ-CKYOu9to.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-CKRL1dki.js → diagram-5GNKFQAL-DPwjFnde.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-DE9deYyi.js → diagram-KO2AKTUF-DzZS9Nk3.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-BmUGF67J.js → diagram-LMA3HP47-DW9e5YSP.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-DLUATSuY.js → diagram-OG6HWLK6-C7V3Mj63.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-nl31ZyQ8.js → erDiagram-TEJ5UH35-DSQzBA0e.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-BZdpCw1-.js → flowDiagram-I6XJVG4X-BUuOq9tO.js} +1 -1
- package/dist/client/assets/{folder-open-DKvxGzrx.js → folder-open-DXNu4ED4.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-DLsqztRx.js → ganttDiagram-6RSMTGT7-Bc32G_Ef.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-Dk_Sy9NG.js → gitGraphDiagram-PVQCEYII-Cvfa0W6a.js} +1 -1
- package/dist/client/assets/index-C5YdAqNQ.js +2767 -0
- package/dist/client/assets/index-DHk_s6rA.css +1 -0
- package/dist/client/assets/{infoDiagram-5YYISTIA-DoQ0ID21.js → infoDiagram-5YYISTIA-TqRUTfvy.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-By5pgTzr.js → ishikawaDiagram-YF4QCWOH-D33iop1_.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-296a-u4u.js → journeyDiagram-JHISSGLW-DH-TDR5Y.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-CgcRr3lQ.js → kanban-definition-UN3LZRKU-CAcebzyW.js} +1 -1
- package/dist/client/assets/{mermaid.core-BMcqO-oY.js → mermaid.core-C3Nh1Sak.js} +4 -4
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-C6poaNyh.js → mindmap-definition-RKZ34NQL-CSIccWV8.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-D5kkHa4c.js → pieDiagram-4H26LBE5-hXJ3G3MR.js} +1 -1
- package/dist/client/assets/{puzzle-Dn0zAogb.js → puzzle-DI3elldh.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-XYE61FOQ.js → quadrantDiagram-W4KKPZXB-B3wpvneC.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-ChSV14Ej.js → requirementDiagram-4Y6WPE33-DPpYL2ca.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-ToxhxAPY.js → sankeyDiagram-5OEKKPKP-BS9QXSEF.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-shNTGnMF.js → sequenceDiagram-3UESZ5HK-C_fqU0MW.js} +1 -1
- package/dist/client/assets/{shield-alert-DoqrZ4qS.js → shield-alert-CzZYSqmH.js} +1 -1
- package/dist/client/assets/{standing-instructions-template-CbBEfZ8s.js → standing-instructions-template-CsXA4WMZ.js} +1 -1
- package/dist/client/assets/{stateDiagram-AJRCARHV-CRNXfwiP.js → stateDiagram-AJRCARHV-DbSZrprS.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-atxeIHh0.js → stateDiagram-v2-BHNVJYJU-Cf_ckwmM.js} +1 -1
- package/dist/client/assets/{timeline-definition-PNZ67QCA-CguHqKR6.js → timeline-definition-PNZ67QCA-B1ohvKjs.js} +1 -1
- package/dist/client/assets/{upload-BF3YtpBl.js → upload-D7nNe9wD.js} +1 -1
- package/dist/client/assets/{users-CN7wFV_l.js → users-B79Dvre4.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-BpgXesnN.js → vennDiagram-CIIHVFJN-CxZYCQ72.js} +1 -1
- package/dist/client/assets/{wardley-L42UT6IY-4QN1B18l.js → wardley-L42UT6IY-clJem8VU.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-BuYjCimN.js → wardleyDiagram-YWT4CUSO-zE8lyaWe.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-DL8viWGe.js → xychartDiagram-2RQKCTM6-DsdjuSxQ.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/client/version.json +1 -1
- package/dist/droid-cli/package.json +1 -1
- package/dist/extension.js +2594 -1746
- package/dist/migrations/0000_initial.sql +1 -0
- package/dist/migrations/0043_fn8768_dispatch_dedupe.sql +17 -0
- package/dist/migrations/0044_fn_8785_queued_episode_signature.sql +3 -0
- package/dist/pi-claude-cli/package.json +1 -1
- package/dist/plugin-sdk/index.d.ts +38 -1
- package/dist/plugin-sdk/index.js +71 -20
- package/dist/plugins/fusion-plugin-acp-runtime/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-claude-runtime/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-claude-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-cli-printing-press/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
- package/dist/plugins/fusion-plugin-compound-engineering/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
- package/dist/plugins/fusion-plugin-cursor-runtime/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-dependency-graph/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
- package/dist/plugins/fusion-plugin-droid-runtime/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-grok-runtime/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-grok-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-hermes-runtime/.bundled.reload-3.js +19167 -0
- package/dist/plugins/fusion-plugin-hermes-runtime/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-linear-import/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-linear-import/package.json +1 -1
- package/dist/plugins/fusion-plugin-omp-runtime/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-omp-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-openclaw-runtime/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-paperclip-runtime/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-quality/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-quality/package.json +1 -1
- package/dist/plugins/fusion-plugin-reports/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-reports/package.json +1 -1
- package/dist/plugins/fusion-plugin-roadmap/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
- package/dist/plugins/fusion-plugin-todos/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-todos/package.json +1 -1
- package/dist/plugins/fusion-plugin-whatsapp-chat/bundled.js +71 -20
- package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
- package/package.json +1 -1
- package/dist/client/assets/channel-CcVVD2V-.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-Bdeei39Q.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-Bdeei39Q.js +0 -1
- package/dist/client/assets/index-DTimvpMD.js +0 -2685
- package/dist/client/assets/index-DjY0GTMz.css +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-DTimvpMD.js";import{u as Ne}from"./vendor-i18n-Duky4gdQ.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.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-C5YdAqNQ.js";import{u as Ne}from"./vendor-i18n-Duky4gdQ.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.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{K as Pe,N as z,O as de,Q as J,U as ue,W as F,Y as je,_ as Me,p as Le,$ as De,a0 as Y,a1 as Oe,a2 as Ae,a as ze,a3 as K,a4 as Fe,a5 as Be}from"./index-DTimvpMD.js";import{r as i,j as t}from"./vendor-react-SZ_qB27O.js";import"./vendor-xterm-BNq00GSj.js";import{u as Ie}from"./vendor-i18n-Duky4gdQ.js";import{S as Ke}from"./shield-alert-DoqrZ4qS.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.js";const We=32*1024,$e=1e4,Ue=100,Qe="\x1B",Ve=" ",Je="",Ye="\x1B[A",Ge="\x1B[B",He="\x1B[C",qe="\x1B[D",W={ctrl:"Ctrl",escape:"Esc",tab:"Tab",ctrlC:"^C"};function me(m){if(m.length!==1)return null;const o=m.toUpperCase().charCodeAt(0);return o>=64&&o<=95?String.fromCharCode(o&31):null}function Ze(){const[m,f]=i.useState(()=>Y());return i.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const o=window.matchMedia(Oe),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 Xe(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 Be(a)}function et(){return/Mac|iPhone|iPad|iPod/i.test(navigator.platform)}function tt(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 ut({sessionId:m,readOnly:f=!1,posture:o,mode:a="live",projectId:y,onConfirmAdvance:g,showConfirmAdvance:$=!1,onOpenAdapterSettings:G,active:H=!0}){const{t:r}=Ie("app"),x=i.useRef(null),v=i.useRef(null),N=i.useRef(null),R=i.useRef(null),h=i.useRef(null),[q,Z]=i.useState(!1),[fe,U]=i.useState(!1),[X,ee]=i.useState(!1),P=Ze(),{keyboardOpen:B,keyboardOverlap:pe}=Pe({enabled:P}),ye=i.useRef(null),[_,te]=i.useState(""),[j,D]=i.useState(!1),[be,he]=i.useState(()=>z().customShortcuts),[ne,ie]=i.useState(null),se=f||ne===!0,O=!f&&ne===!1&&a==="live",b=i.useCallback(e=>{if(!e||!O)return;const n=h.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify({type:"input",data:e}))},[O]),M=i.useCallback(e=>{if(j){const n=me(e);if(D(!1),n){b(n);return}}b(e)},[j,b]),c=i.useCallback(e=>{e.preventDefault()},[]),we=i.useCallback(e=>{e?.preventDefault?.(),_&&b(_),b("\r"),te("")},[_,b]),Se=i.useCallback(e=>{if(j&&e.length>_.length){const n=e.slice(_.length,_.length+1),l=me(n);if(D(!1),l){b(l);return}}te(e)},[j,_,b]);i.useEffect(()=>{$&&U(!1)},[$,m]);const E=i.useCallback((e,n)=>{const l=h.current;l?.readyState===WebSocket.OPEN&&l.send(JSON.stringify({type:"resize",cols:e,rows:n}))},[]),oe=i.useCallback(()=>{const e=v.current;if(!e)return;const n=z(),l=de(n.fontFamily);e.options.fontFamily=l,x.current?.style.setProperty("--terminal-glyph-font-family",J(n.fontFamily)),e.options.fontSize=n.fontSize,e.options.cursorStyle=n.cursorStyle,e.options.cursorBlink=n.cursorBlink&&O;try{N.current?.fit?.(),E(e.cols,e.rows)}catch{}ue(n.fontSize,l).then(k=>{if(!(!k||v.current!==e||e.options.fontSize!==n.fontSize||e.options.fontFamily!==l)){F(e,l),e.options.fontSize=n.fontSize;try{N.current?.fit?.(),E(e.cols,e.rows),F(e,l),e.refresh(0,Math.max(0,e.rows-1))}catch{}}},()=>{})},[O,E]);i.useEffect(()=>{if(typeof window>"u")return;const e=n=>{n.key===Ae&&(oe(),he(z().customShortcuts))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[oe]);const[_e,ke]=i.useState(0);i.useEffect(()=>{if(!H)return;const e=v.current,n=N.current;if(e&&n?.fit)try{n.fit(),E(e.cols,e.rows),F(e,String(e.options.fontFamily??"")),e.refresh(0,Math.max(0,e.rows-1))}catch{}const l=h.current;l&&l.readyState!==WebSocket.OPEN&&l.readyState!==WebSocket.CONNECTING&&ke(k=>k+1)},[H,E]),i.useEffect(()=>{if(!m||typeof window>"u")return;let e=!1,n=null,l=null,k=0;ie(null);const Q=E,Te=p=>{if(k+=p,k<We)return;const w=h.current;w?.readyState===WebSocket.OPEN&&w.send(JSON.stringify({type:"ack",bytes:k})),k=0};return(async()=>{let p;try{p=await ze(`/cli-sessions/${encodeURIComponent(m)}/attach-ticket`,{method:"POST",body:JSON.stringify(y?{projectId:y}:{})})}catch{return}if(e)return;ie(p.readOnly);const w=!f&&!p.readOnly&&a==="live",[{Terminal:ge},{FitAddon:xe},{Unicode11Addon:Ne}]=await Promise.all([K(()=>import("./vendor-xterm-BNq00GSj.js").then(d=>d.x),__vite__mapDeps([0,1,2])),K(()=>import("./addon-fit-C1WQXRvu.js").then(d=>d.a),__vite__mapDeps([3,1])),K(()=>import("./addon-unicode11-BVmNDUBM.js").then(d=>d.a),__vite__mapDeps([4,1]))]);if(e||!x.current)return;const S=z(),A=de(S.fontFamily);x.current.style.setProperty("--terminal-glyph-font-family",J(S.fontFamily));const s=new ge({convertEol:!1,cursorBlink:S.cursorBlink&&w,cursorStyle:S.cursorStyle,disableStdin:!w,scrollback:$e,fontFamily:A,fontSize:S.fontSize}),L=new xe;s.loadAddon(L);const Re=new Ne;if(s.loadAddon(Re),s.unicode.activeVersion="11",Fe(()=>{s.open(x.current)}),v.current=s,N.current=L,S.renderer==="auto"&&!Y())try{const{WebglAddon:d}=await K(async()=>{const{WebglAddon:u}=await import("./addon-webgl-uLc0RKcC.js").then(C=>C.a);return{WebglAddon:u}},__vite__mapDeps([5,1]));if(!e){const u=new d;u.onContextLoss(()=>{try{u.dispose()}catch{}R.current===u&&(R.current=null)}),s.loadAddon(u),R.current=u}}catch{}try{L.fit()}catch{}(async()=>{if(!(!await ue(S.fontSize,A)||e||v.current!==s||N.current!==L||s.options.fontSize!==S.fontSize||s.options.fontFamily!==A))try{F(s,A),s.options.fontSize=S.fontSize,L.fit(),Q(s.cols,s.rows),F(s,A),s.refresh(0,Math.max(0,s.rows-1))}catch{}})(),w&&(s.onData(d=>{const u=h.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"input",data:d}))}),s.attachCustomKeyEventHandler(d=>{if(d.type!=="keydown"||!(et()?d.metaKey:d.ctrlKey)||d.altKey||d.shiftKey)return!0;const C=d.key.toLowerCase();if(C==="c"){const T=s.hasSelection()?s.getSelection():"";return T?(navigator.clipboard?.writeText(T).catch(()=>{}),!1):!0}if(C==="v"){const T=navigator.clipboard?.readText;return T&&T.call(navigator.clipboard).then(le=>{if(!le)return;const ce=h.current;ce?.readyState===WebSocket.OPEN&&ce.send(JSON.stringify({type:"input",data:le}))}).catch(()=>{}),!1}return!0})),n=new ResizeObserver(()=>{l&&clearTimeout(l),l=setTimeout(()=>{try{L.fit(),Q(s.cols,s.rows),s.refresh(0,Math.max(0,s.rows-1))}catch{}},Ue)}),n.observe(x.current);const V=new WebSocket(Xe(m,p.ticket));h.current=V,V.onopen=()=>{Q(s.cols,s.rows)},V.onmessage=d=>{let u;try{u=JSON.parse(typeof d.data=="string"?d.data:"")}catch{return}switch(u.type){case"scrollback":case"data":{if(typeof u.data!="string")return;const C=tt(u.data),T=C.length;s.write(C,()=>Te(T));break}}}})(),()=>{e=!0,l&&clearTimeout(l),n&&n.disconnect();const p=h.current;if(p){p.onopen=null,p.onmessage=null,p.onclose=null,p.onerror=null;try{p.close()}catch{}h.current=null}if(R.current){try{R.current.dispose()}catch{}R.current=null}const w=v.current;if(w){try{w.dispose()}catch{}v.current=null}N.current=null}},[m,f,a,y,E,_e]);const ae=i.useMemo(()=>a==="idle"?r("cliTerminal.replayIdle","Session idle"):a==="ended"?r("cliTerminal.replayEnded","Session ended"):null,[a,r]),ve=i.useCallback(async()=>{if(g){ee(!0);try{await g("advance"),U(!0)}finally{ee(!1)}}},[g]),Ee=i.useCallback(async()=>{g&&await g("not-yet"),U(!0)},[g]),I=!!o?.elevated,re=o?.elevatedFlags?.join(", "),Ce={"--terminal-glyph-font-family":J(z().fontFamily)};return t.jsxs("div",{className:`cli-session-terminal${P?" cli-session-terminal--mobile":""}${P&&B?" cli-session-terminal--keyboard-open":""}`,"data-mode":a,"data-read-only":se,"data-mobile":P,"data-keyboard-open":P&&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${I?" cli-posture-chip--elevated":""}`,"data-elevated":I,"aria-expanded":q,onClick:()=>Z(e=>!e),children:[I?t.jsx(Ke,{size:13,"aria-hidden":"true"}):t.jsx(je,{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}),I&&re&&t.jsx("span",{className:"cli-posture-chip__flag",children:re})]}),q&&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")})]}),G&&t.jsxs("button",{type:"button",className:"cli-posture-tooltip__settings",onClick:()=>{Z(!1),G()},children:[t.jsx(Me,{size:12,"aria-hidden":"true"}),r("cliTerminal.adapterSettings","Adapter settings")]})]})]}),se&&t.jsxs("span",{className:"cli-session-terminal__readonly-badge",children:[t.jsx(Le,{size:12,"aria-hidden":"true"}),r("cliTerminal.readOnly","Read-only")]}),ae&&t.jsx("span",{className:"cli-session-terminal__replay-badge","data-replay-mode":a,children:ae})]}),t.jsx("div",{className:"cli-session-terminal__viewport-shell",children:t.jsx("div",{className:"cli-session-terminal__viewport",ref:x,"data-testid":"cli-terminal-viewport",style:Ce})}),$&&!fe&&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:X,onClick:ve,children:r("cliTerminal.advance","Advance")}),t.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn cli-session-terminal__advance-btn--secondary",disabled:X,onClick:Ee,children:r("cliTerminal.notYet","Not yet")})]})]}),P&&O&&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:`${pe}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${j?" cli-terminal-key--active":""}`,"data-testid":"cli-key-ctrl","aria-label":r("cliTerminal.mobileKeyCtrl","Sticky Ctrl modifier"),"aria-pressed":j,onPointerDown:c,onMouseDown:c,onClick:()=>D(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:c,onMouseDown:c,onClick:()=>M(Qe),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:c,onMouseDown:c,onClick:()=>M(Ve),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:c,onMouseDown:c,onClick:()=>{D(!1),b(Je)},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:c,onMouseDown:c,onClick:()=>M(Ye),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:()=>M(Ge),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:()=>M(qe),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:()=>M(He),children:"→"}),be.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:c,onMouseDown:c,onClick:()=>{D(!1),b(De(e.value))},children:e.label},e.id))]}),t.jsxs("form",{className:"cli-session-terminal__input-row",onSubmit:we,children:[t.jsx("input",{ref:ye,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=>Se(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{ut as SessionTerminal};
|
|
2
|
+
import{K as Pe,N as z,O as de,Q as J,U as ue,W as F,Y as je,_ as Me,p as Le,$ as De,a0 as Y,a1 as Oe,a2 as Ae,a as ze,a3 as K,a4 as Fe,a5 as Be}from"./index-C5YdAqNQ.js";import{r as i,j as t}from"./vendor-react-SZ_qB27O.js";import"./vendor-xterm-BNq00GSj.js";import{u as Ie}from"./vendor-i18n-Duky4gdQ.js";import{S as Ke}from"./shield-alert-CzZYSqmH.js";import"./vendor-codemirror-CcrtqoCy.js";import"./vendor-reactflow-BlIeoTu4.js";const We=32*1024,$e=1e4,Ue=100,Qe="\x1B",Ve=" ",Je="",Ye="\x1B[A",Ge="\x1B[B",He="\x1B[C",qe="\x1B[D",W={ctrl:"Ctrl",escape:"Esc",tab:"Tab",ctrlC:"^C"};function me(m){if(m.length!==1)return null;const o=m.toUpperCase().charCodeAt(0);return o>=64&&o<=95?String.fromCharCode(o&31):null}function Ze(){const[m,f]=i.useState(()=>Y());return i.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const o=window.matchMedia(Oe),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 Xe(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 Be(a)}function et(){return/Mac|iPhone|iPad|iPod/i.test(navigator.platform)}function tt(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 ut({sessionId:m,readOnly:f=!1,posture:o,mode:a="live",projectId:y,onConfirmAdvance:g,showConfirmAdvance:$=!1,onOpenAdapterSettings:G,active:H=!0}){const{t:r}=Ie("app"),x=i.useRef(null),v=i.useRef(null),N=i.useRef(null),R=i.useRef(null),h=i.useRef(null),[q,Z]=i.useState(!1),[fe,U]=i.useState(!1),[X,ee]=i.useState(!1),P=Ze(),{keyboardOpen:B,keyboardOverlap:pe}=Pe({enabled:P}),ye=i.useRef(null),[_,te]=i.useState(""),[j,D]=i.useState(!1),[be,he]=i.useState(()=>z().customShortcuts),[ne,ie]=i.useState(null),se=f||ne===!0,O=!f&&ne===!1&&a==="live",b=i.useCallback(e=>{if(!e||!O)return;const n=h.current;n?.readyState===WebSocket.OPEN&&n.send(JSON.stringify({type:"input",data:e}))},[O]),M=i.useCallback(e=>{if(j){const n=me(e);if(D(!1),n){b(n);return}}b(e)},[j,b]),c=i.useCallback(e=>{e.preventDefault()},[]),we=i.useCallback(e=>{e?.preventDefault?.(),_&&b(_),b("\r"),te("")},[_,b]),Se=i.useCallback(e=>{if(j&&e.length>_.length){const n=e.slice(_.length,_.length+1),l=me(n);if(D(!1),l){b(l);return}}te(e)},[j,_,b]);i.useEffect(()=>{$&&U(!1)},[$,m]);const E=i.useCallback((e,n)=>{const l=h.current;l?.readyState===WebSocket.OPEN&&l.send(JSON.stringify({type:"resize",cols:e,rows:n}))},[]),oe=i.useCallback(()=>{const e=v.current;if(!e)return;const n=z(),l=de(n.fontFamily);e.options.fontFamily=l,x.current?.style.setProperty("--terminal-glyph-font-family",J(n.fontFamily)),e.options.fontSize=n.fontSize,e.options.cursorStyle=n.cursorStyle,e.options.cursorBlink=n.cursorBlink&&O;try{N.current?.fit?.(),E(e.cols,e.rows)}catch{}ue(n.fontSize,l).then(k=>{if(!(!k||v.current!==e||e.options.fontSize!==n.fontSize||e.options.fontFamily!==l)){F(e,l),e.options.fontSize=n.fontSize;try{N.current?.fit?.(),E(e.cols,e.rows),F(e,l),e.refresh(0,Math.max(0,e.rows-1))}catch{}}},()=>{})},[O,E]);i.useEffect(()=>{if(typeof window>"u")return;const e=n=>{n.key===Ae&&(oe(),he(z().customShortcuts))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)},[oe]);const[_e,ke]=i.useState(0);i.useEffect(()=>{if(!H)return;const e=v.current,n=N.current;if(e&&n?.fit)try{n.fit(),E(e.cols,e.rows),F(e,String(e.options.fontFamily??"")),e.refresh(0,Math.max(0,e.rows-1))}catch{}const l=h.current;l&&l.readyState!==WebSocket.OPEN&&l.readyState!==WebSocket.CONNECTING&&ke(k=>k+1)},[H,E]),i.useEffect(()=>{if(!m||typeof window>"u")return;let e=!1,n=null,l=null,k=0;ie(null);const Q=E,Te=p=>{if(k+=p,k<We)return;const w=h.current;w?.readyState===WebSocket.OPEN&&w.send(JSON.stringify({type:"ack",bytes:k})),k=0};return(async()=>{let p;try{p=await ze(`/cli-sessions/${encodeURIComponent(m)}/attach-ticket`,{method:"POST",body:JSON.stringify(y?{projectId:y}:{})})}catch{return}if(e)return;ie(p.readOnly);const w=!f&&!p.readOnly&&a==="live",[{Terminal:ge},{FitAddon:xe},{Unicode11Addon:Ne}]=await Promise.all([K(()=>import("./vendor-xterm-BNq00GSj.js").then(d=>d.x),__vite__mapDeps([0,1,2])),K(()=>import("./addon-fit-C1WQXRvu.js").then(d=>d.a),__vite__mapDeps([3,1])),K(()=>import("./addon-unicode11-BVmNDUBM.js").then(d=>d.a),__vite__mapDeps([4,1]))]);if(e||!x.current)return;const S=z(),A=de(S.fontFamily);x.current.style.setProperty("--terminal-glyph-font-family",J(S.fontFamily));const s=new ge({convertEol:!1,cursorBlink:S.cursorBlink&&w,cursorStyle:S.cursorStyle,disableStdin:!w,scrollback:$e,fontFamily:A,fontSize:S.fontSize}),L=new xe;s.loadAddon(L);const Re=new Ne;if(s.loadAddon(Re),s.unicode.activeVersion="11",Fe(()=>{s.open(x.current)}),v.current=s,N.current=L,S.renderer==="auto"&&!Y())try{const{WebglAddon:d}=await K(async()=>{const{WebglAddon:u}=await import("./addon-webgl-uLc0RKcC.js").then(C=>C.a);return{WebglAddon:u}},__vite__mapDeps([5,1]));if(!e){const u=new d;u.onContextLoss(()=>{try{u.dispose()}catch{}R.current===u&&(R.current=null)}),s.loadAddon(u),R.current=u}}catch{}try{L.fit()}catch{}(async()=>{if(!(!await ue(S.fontSize,A)||e||v.current!==s||N.current!==L||s.options.fontSize!==S.fontSize||s.options.fontFamily!==A))try{F(s,A),s.options.fontSize=S.fontSize,L.fit(),Q(s.cols,s.rows),F(s,A),s.refresh(0,Math.max(0,s.rows-1))}catch{}})(),w&&(s.onData(d=>{const u=h.current;u?.readyState===WebSocket.OPEN&&u.send(JSON.stringify({type:"input",data:d}))}),s.attachCustomKeyEventHandler(d=>{if(d.type!=="keydown"||!(et()?d.metaKey:d.ctrlKey)||d.altKey||d.shiftKey)return!0;const C=d.key.toLowerCase();if(C==="c"){const T=s.hasSelection()?s.getSelection():"";return T?(navigator.clipboard?.writeText(T).catch(()=>{}),!1):!0}if(C==="v"){const T=navigator.clipboard?.readText;return T&&T.call(navigator.clipboard).then(le=>{if(!le)return;const ce=h.current;ce?.readyState===WebSocket.OPEN&&ce.send(JSON.stringify({type:"input",data:le}))}).catch(()=>{}),!1}return!0})),n=new ResizeObserver(()=>{l&&clearTimeout(l),l=setTimeout(()=>{try{L.fit(),Q(s.cols,s.rows),s.refresh(0,Math.max(0,s.rows-1))}catch{}},Ue)}),n.observe(x.current);const V=new WebSocket(Xe(m,p.ticket));h.current=V,V.onopen=()=>{Q(s.cols,s.rows)},V.onmessage=d=>{let u;try{u=JSON.parse(typeof d.data=="string"?d.data:"")}catch{return}switch(u.type){case"scrollback":case"data":{if(typeof u.data!="string")return;const C=tt(u.data),T=C.length;s.write(C,()=>Te(T));break}}}})(),()=>{e=!0,l&&clearTimeout(l),n&&n.disconnect();const p=h.current;if(p){p.onopen=null,p.onmessage=null,p.onclose=null,p.onerror=null;try{p.close()}catch{}h.current=null}if(R.current){try{R.current.dispose()}catch{}R.current=null}const w=v.current;if(w){try{w.dispose()}catch{}v.current=null}N.current=null}},[m,f,a,y,E,_e]);const ae=i.useMemo(()=>a==="idle"?r("cliTerminal.replayIdle","Session idle"):a==="ended"?r("cliTerminal.replayEnded","Session ended"):null,[a,r]),ve=i.useCallback(async()=>{if(g){ee(!0);try{await g("advance"),U(!0)}finally{ee(!1)}}},[g]),Ee=i.useCallback(async()=>{g&&await g("not-yet"),U(!0)},[g]),I=!!o?.elevated,re=o?.elevatedFlags?.join(", "),Ce={"--terminal-glyph-font-family":J(z().fontFamily)};return t.jsxs("div",{className:`cli-session-terminal${P?" cli-session-terminal--mobile":""}${P&&B?" cli-session-terminal--keyboard-open":""}`,"data-mode":a,"data-read-only":se,"data-mobile":P,"data-keyboard-open":P&&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${I?" cli-posture-chip--elevated":""}`,"data-elevated":I,"aria-expanded":q,onClick:()=>Z(e=>!e),children:[I?t.jsx(Ke,{size:13,"aria-hidden":"true"}):t.jsx(je,{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}),I&&re&&t.jsx("span",{className:"cli-posture-chip__flag",children:re})]}),q&&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")})]}),G&&t.jsxs("button",{type:"button",className:"cli-posture-tooltip__settings",onClick:()=>{Z(!1),G()},children:[t.jsx(Me,{size:12,"aria-hidden":"true"}),r("cliTerminal.adapterSettings","Adapter settings")]})]})]}),se&&t.jsxs("span",{className:"cli-session-terminal__readonly-badge",children:[t.jsx(Le,{size:12,"aria-hidden":"true"}),r("cliTerminal.readOnly","Read-only")]}),ae&&t.jsx("span",{className:"cli-session-terminal__replay-badge","data-replay-mode":a,children:ae})]}),t.jsx("div",{className:"cli-session-terminal__viewport-shell",children:t.jsx("div",{className:"cli-session-terminal__viewport",ref:x,"data-testid":"cli-terminal-viewport",style:Ce})}),$&&!fe&&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:X,onClick:ve,children:r("cliTerminal.advance","Advance")}),t.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn cli-session-terminal__advance-btn--secondary",disabled:X,onClick:Ee,children:r("cliTerminal.notYet","Not yet")})]})]}),P&&O&&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:`${pe}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${j?" cli-terminal-key--active":""}`,"data-testid":"cli-key-ctrl","aria-label":r("cliTerminal.mobileKeyCtrl","Sticky Ctrl modifier"),"aria-pressed":j,onPointerDown:c,onMouseDown:c,onClick:()=>D(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:c,onMouseDown:c,onClick:()=>M(Qe),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:c,onMouseDown:c,onClick:()=>M(Ve),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:c,onMouseDown:c,onClick:()=>{D(!1),b(Je)},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:c,onMouseDown:c,onClick:()=>M(Ye),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:()=>M(Ge),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:()=>M(qe),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:()=>M(He),children:"→"}),be.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:c,onMouseDown:c,onClick:()=>{D(!1),b(De(e.value))},children:e.label},e.id))]}),t.jsxs("form",{className:"cli-session-terminal__input-row",onSubmit:we,children:[t.jsx("input",{ref:ye,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=>Se(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{ut as SessionTerminal};
|