@runfusion/fusion 0.50.0 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +815 -352
- package/dist/client/.vite/manifest.json +242 -241
- package/dist/client/assets/{AgentDetailView-D2oYUApl.js → AgentDetailView-CjwOlcMI.js} +1 -1
- package/dist/client/assets/{AgentPermissionPolicyEditor-DGgx46f3.js → AgentPermissionPolicyEditor-CD8znNHS.js} +1 -1
- package/dist/client/assets/{AgentsView-Dhf5Vq_T.js → AgentsView-CTjNaKu-.js} +3 -3
- package/dist/client/assets/ChatView-DCWypaw3.js +19 -0
- package/dist/client/assets/{CommandCenter-DzQhGq_J.js → CommandCenter-C4v0FMxx.js} +9 -9
- package/dist/client/assets/{DevServerView-DjJYp6Jj.js → DevServerView-BE_o7v9j.js} +1 -1
- package/dist/client/assets/{DirectoryPicker-CYPYp9T4.js → DirectoryPicker-BpcPo65A.js} +1 -1
- package/dist/client/assets/{DocumentsView-CeQVRVdp.js → DocumentsView-Cpma23hu.js} +1 -1
- package/dist/client/assets/{EvalsView-D250mVR5.js → EvalsView-DYSobhb7.js} +1 -1
- package/dist/client/assets/{ExperimentalAgentOnboardingModal-B1EEY_bl.js → ExperimentalAgentOnboardingModal-D_iQqD-n.js} +1 -1
- package/dist/client/assets/{GoalsView-CUh8JBnJ.css → GoalsView-4-eEOeqw.css} +1 -1
- package/dist/client/assets/{GoalsView-MftVwE9g.js → GoalsView-B6Wfxk59.js} +1 -1
- package/dist/client/assets/{InsightsView-CbWItYe8.js → InsightsView-DZyMvYQ8.js} +1 -1
- package/dist/client/assets/{MemoryView-Ct0nOTES.js → MemoryView-B9Z6cRma.js} +1 -1
- package/dist/client/assets/{PiExtensionsManager-DSQwngX-.js → PiExtensionsManager-BQt3JU60.js} +1 -1
- package/dist/client/assets/{PluginManager-DqLxCiNg.js → PluginManager-DEsUstVo.js} +1 -1
- package/dist/client/assets/PullRequestView-B7k8ogy4.js +6 -0
- package/dist/client/assets/PullRequestView-NkeImY1n.css +1 -0
- package/dist/client/assets/{ResearchView-CJQL9XKC.js → ResearchView-BseF58_R.js} +1 -1
- package/dist/client/assets/{SecretsView-ChN9aTbi.js → SecretsView-bkNS5VBC.js} +1 -1
- package/dist/client/assets/{SessionTerminal-BVon9kbr.js → SessionTerminal-BSllyqgF.js} +1 -1
- package/dist/client/assets/{SettingsModal-CIC5jhgo.js → SettingsModal-DAH7LuLw.js} +1 -1
- package/dist/client/assets/SettingsModal-Dso0K76J.js +21 -0
- package/dist/client/assets/{SetupWizardModal-C6EGjmbd.js → SetupWizardModal-Bm6bG31V.js} +2 -2
- package/dist/client/assets/{ShadcnColorPicker-4e_aXoGX.js → ShadcnColorPicker-CLiOvo7W.js} +1 -1
- package/dist/client/assets/{SkillsView-Dz8dDwfP.js → SkillsView-D_UEJY_f.js} +1 -1
- package/dist/client/assets/{TodoView-DvJFzoOv.js → TodoView-CMCoPep1.js} +1 -1
- package/dist/client/assets/{WorkflowNodeEditor-DrdTCstS.js → WorkflowNodeEditor-BeQcn0Wa.js} +1 -1
- package/dist/client/assets/{agentSkills-B2dD5Nm5.js → agentSkills-BiipFw1z.js} +1 -1
- package/dist/client/assets/{app-D27ewSC0.js → app-A1yCJR4Q.js} +3 -3
- package/dist/client/assets/{app-BYq4S7Cb.js → app-Bfiafek7.js} +3 -3
- package/dist/client/assets/{app-OPrfgjjn.js → app-Bh-Xj32t.js} +3 -3
- package/dist/client/assets/{app-k1K9zAjp.js → app-DxJHfzxz.js} +3 -3
- package/dist/client/assets/{app-dATBczl3.js → app-T5iMjZpX.js} +2 -2
- package/dist/client/assets/{app-DFLDkeOE.js → app-zR_n4GL2.js} +3 -3
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-ClO0MnzR.js → architectureDiagram-3BPJPVTR-glwWkaDt.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-C4cyy4WE.js → blockDiagram-GPEHLZMM-C8DhxwG4.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-NHPC9TJo.js → c4Diagram-AAUBKEIU-CQXf6PzI.js} +1 -1
- package/dist/client/assets/channel-BY6zFSV1.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-CGYIKTVR.js → chunk-2J33WTMH-kak65s83.js} +1 -1
- package/dist/client/assets/{chunk-4BX2VUAB-BkCCD0tE.js → chunk-4BX2VUAB-B_yEpoxU.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-Be3yOIDe.js → chunk-55IACEB6-C9lQVeH5.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-DxjyMaQQ.js → chunk-727SXJPM-D4SVzqNs.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-BC0PjN0W.js → chunk-AQP2D5EJ-DBHuj4BH.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-DoWxmM8k.js → chunk-FMBD7UC4-BJ3ghjau.js} +1 -1
- package/dist/client/assets/{chunk-ND2GUHAM-EOpuc9pP.js → chunk-ND2GUHAM-CE4tkh6e.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-DiRyx9QZ.js → chunk-QZHKN3VN-DmVw_cEu.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-CeX_WCiC.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-CeX_WCiC.js +1 -0
- package/dist/client/assets/{cose-bilkent-S5V4N54A-CfVoUUxT.js → cose-bilkent-S5V4N54A-DI_-BOYE.js} +1 -1
- package/dist/client/assets/{dagre-BM42HDAG-BfILvxLb.js → dagre-BM42HDAG-ywUbHZxt.js} +1 -1
- package/dist/client/assets/{dashboard-view-wFC1pe4d.js → dashboard-view-DJvdban3.js} +1 -1
- package/dist/client/assets/{dashboard-view-C9YIcx-O.js → dashboard-view-r4NTTh_X.js} +1633 -1633
- package/dist/client/assets/{diagram-2AECGRRQ-6mdmbH-5.js → diagram-2AECGRRQ-CAGucHCe.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-CY7MMwO1.js → diagram-5GNKFQAL-D_1uzVtW.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-D05XnQqd.js → diagram-KO2AKTUF-D7zY4Nlm.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-B18FTOJG.js → diagram-LMA3HP47-C1T9eOzA.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-xmXlYf5m.js → diagram-OG6HWLK6-sWxhPvzU.js} +1 -1
- package/dist/client/assets/{erDiagram-TEJ5UH35-4XlgVLCs.js → erDiagram-TEJ5UH35-DfHtnaNg.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-BYl3ps7f.js → flowDiagram-I6XJVG4X-Brbb_Jlh.js} +1 -1
- package/dist/client/assets/{folder-open-BH6FwmO7.js → folder-open-BLwukrE0.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-4vxuH9Dx.js → ganttDiagram-6RSMTGT7-CLvZ7891.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-BESmFgXT.js → gitGraphDiagram-PVQCEYII-DD56Jsa3.js} +1 -1
- package/dist/client/assets/index-DAv17W73.js +1317 -0
- package/dist/client/assets/index-DhBnj8YN.css +1 -0
- package/dist/client/assets/{infoDiagram-5YYISTIA-DvjdjtwB.js → infoDiagram-5YYISTIA-uXai801q.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-Cis5IoEm.js → ishikawaDiagram-YF4QCWOH-C_bWlUP_.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-C20pB1W8.js → journeyDiagram-JHISSGLW-B2kB9niE.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-CiVfCeU3.js → kanban-definition-UN3LZRKU-BJwlpR9z.js} +1 -1
- package/dist/client/assets/{mermaid.core-CW0vCXA6.js → mermaid.core-0hUjZF5S.js} +4 -4
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-E5rPHUdw.js → mindmap-definition-RKZ34NQL-DsTgTpX-.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-DVIFbPjH.js → pieDiagram-4H26LBE5-BUQsNWHN.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-C8qPRe_x.js → quadrantDiagram-W4KKPZXB-DOYWgfAz.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-DQ-pwXh3.js → requirementDiagram-4Y6WPE33-DUnPKaMd.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-BnghLuUc.js → sankeyDiagram-5OEKKPKP-Btl4NRo-.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-ChlGxGVk.js → sequenceDiagram-3UESZ5HK-b0hyJ_Wr.js} +1 -1
- package/dist/client/assets/{shield-alert-BfOnDO6O.js → shield-alert-yWvC7t2v.js} +1 -1
- package/dist/client/assets/{stateDiagram-AJRCARHV-ByUvNEch.js → stateDiagram-AJRCARHV-orREjkd9.js} +1 -1
- package/dist/client/assets/{stateDiagram-v2-BHNVJYJU-Df38ITSP.js → stateDiagram-v2-BHNVJYJU-DYJRRNh-.js} +1 -1
- package/dist/client/assets/{timeline-definition-PNZ67QCA-bsAGc83D.js → timeline-definition-PNZ67QCA-DZga7lqO.js} +1 -1
- package/dist/client/assets/{upload-BK1crTqn.js → upload-BsYRkl_8.js} +1 -1
- package/dist/client/assets/{users-DW8jC2Z9.js → users-dyoJEvrM.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-BBIj6LFN.js → vennDiagram-CIIHVFJN-C2P26V71.js} +1 -1
- package/dist/client/assets/{wardley-L42UT6IY-De6JFroy.js → wardley-L42UT6IY-ckctH9bL.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-P1LOLx0_.js → wardleyDiagram-YWT4CUSO-9It3QAYs.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-v1G4ki6U.js → xychartDiagram-2RQKCTM6-Dj3sSBqg.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 +584 -296
- package/dist/pi-claude-cli/package.json +1 -1
- package/dist/plugin-sdk/index.d.ts +6 -0
- package/dist/plugins/fusion-plugin-acp-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-cli-printing-press/package.json +1 -1
- package/dist/plugins/fusion-plugin-compound-engineering/bundled.js +1 -1
- package/dist/plugins/fusion-plugin-compound-engineering/manifest.json +1 -1
- package/dist/plugins/fusion-plugin-compound-engineering/package.json +1 -1
- package/dist/plugins/fusion-plugin-cursor-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-dependency-graph/package.json +1 -1
- package/dist/plugins/fusion-plugin-droid-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-hermes-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-openclaw-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-paperclip-runtime/package.json +1 -1
- package/dist/plugins/fusion-plugin-reports/package.json +1 -1
- package/dist/plugins/fusion-plugin-roadmap/package.json +1 -1
- package/dist/plugins/fusion-plugin-whatsapp-chat/package.json +1 -1
- package/package.json +1 -1
- package/skill/fusion/references/best-practices.md +3 -3
- package/skill/fusion/references/extension-tools.md +1 -1
- package/skill/fusion/references/fusion-capabilities.md +1 -1
- package/skill/fusion/workflows/task-management.md +1 -1
- package/dist/client/assets/ChatView-DpgpxHva.js +0 -19
- package/dist/client/assets/PullRequestView-CpdE3Yo_.css +0 -1
- package/dist/client/assets/PullRequestView-D0WgwdAi.js +0 -6
- package/dist/client/assets/SettingsModal-B4WANQnu.js +0 -21
- package/dist/client/assets/channel-Q2WKocEP.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-CPFl2Aqd.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-CPFl2Aqd.js +0 -1
- package/dist/client/assets/index-B9jtBwFy.css +0 -1
- package/dist/client/assets/index-DFeBJ3GM.js +0 -1302
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{V as ue,B as he,R as q,P as me,D as G,F as Y,G as ye,H as xe,I as ve,J as be,o as je,C as fe}from"./index-DFeBJ3GM.js";import{u as Se}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-Bg-Qjzh8.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";const ge="__sync_passphrase__",L={key:"",value:"",description:"",scope:"project",accessPolicy:"prompt",envExportable:!1,envExportKey:""},n={className:"secrets-action-icon","aria-hidden":!0,style:{width:"1em",height:"1em"}},Ne={...n,className:"secrets-action-icon spin"},Re=({addToast:d})=>{const{t:a}=Se("app"),[R,z]=c.useState([]),[T,M]=c.useState(!0),[A,D]=c.useState(null),[K,b]=c.useState(null),[p,O]=c.useState(null),[U,y]=c.useState(!1),[Q,g]=c.useState(null),[t,l]=c.useState(L),[N,C]=c.useState(!1),[V,j]=c.useState({}),[W,B]=c.useState(null),[u,X]=c.useState(!1),[Z,_]=c.useState(!1),[f,F]=c.useState(""),[P,H]=c.useState(""),[ee,I]=c.useState(!1),[E,se]=c.useState(!1),m=c.useRef(new Map),w=c.useRef(new Map),o=c.useCallback(async(s,r)=>{const i=await fetch(s,{...r,headers:{"Content-Type":"application/json",...r?.headers??{}}});if(!i.ok){const h=await i.json().catch(()=>({error:"Request failed"}));throw new Error(String(h?.error??"Request failed"))}if(i.status!==204)return i.json()},[]),x=c.useCallback(async()=>{M(!0),D(null);try{const s=await o("/api/secrets");z(s.secrets)}catch(s){D(s instanceof Error?s.message:String(s))}finally{M(!1)}},[o]),S=c.useCallback(async()=>{try{const s=await o("/api/secrets/sync-passphrase");X(!!s.configured)}catch(s){d?.(a("secrets.errorLoadSyncStatus","Failed to load sync passphrase status: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}},[d,o]);c.useEffect(()=>(x(),S(),()=>{m.current.forEach(s=>clearTimeout(s)),w.current.forEach(s=>clearTimeout(s))}),[x,S]);const k=()=>{_(!1),F(""),H("")},ae=async s=>{await o("/api/secrets/sync-passphrase",{method:"PUT",body:JSON.stringify({passphrase:s})})},re=async()=>{I(!0);try{await ae(f),d?.(u?a("secrets.syncPassphraseRotated","Sync passphrase rotated"):a("secrets.syncPassphraseSet","Sync passphrase set"),"success"),k(),await S()}catch(s){d?.(a("secrets.errorSaveSyncPassphrase","Failed to save sync passphrase: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{I(!1)}},te=async()=>{if(window.confirm(a("secrets.confirmClearSyncPassphrase","Clear the cross-node sync passphrase? Existing sync pairs will stop working until you set a new passphrase.")))try{await o("/api/secrets/sync-passphrase",{method:"DELETE"}),d?.(a("secrets.syncPassphraseCleared","Sync passphrase cleared"),"success"),await S()}catch(r){d?.(a("secrets.errorClearSyncPassphrase","Failed to clear sync passphrase: {{error}}",{error:r instanceof Error?r.message:String(r)}),"error")}},ce=()=>{O(null),l(L),y(!0),C(!1),b(null)},le=s=>{O(s),l({key:s.key,value:"",description:s.description??"",scope:s.scope,accessPolicy:s.accessPolicy,envExportable:s.envExportable,envExportKey:s.envExportKey??""}),y(!0),C(!1),b(null)},ne=async()=>{b(null);try{if(p){const s={key:t.key,description:t.description||null,accessPolicy:t.accessPolicy,envExportable:t.envExportable,envExportKey:t.envExportable&&t.envExportKey||null};t.value&&(s.value=t.value),await o(`/api/secrets/${p.scope}/${p.id}`,{method:"PATCH",body:JSON.stringify(s)})}else await o("/api/secrets",{method:"POST",body:JSON.stringify({scope:t.scope,key:t.key,value:t.value,description:t.description||null,accessPolicy:t.accessPolicy,envExportable:t.envExportable,envExportKey:t.envExportable&&t.envExportKey||null})});y(!1),l(L),await x()}catch(s){b(s instanceof Error?s.message:String(s))}},oe=s=>{const r=m.current.get(s.id);r&&(clearTimeout(r),m.current.delete(s.id)),j(i=>({...i,[s.id]:null}))},ie=async s=>{const r=await o(`/api/secrets/${s.scope}/${s.id}/reveal`,{method:"POST"});j(v=>({...v,[s.id]:r.value})),d?.(a("secrets.revealed","Revealed"),"success");const i=setTimeout(()=>{j(v=>({...v,[s.id]:null})),m.current.delete(s.id)},3e4),h=m.current.get(s.id);h&&clearTimeout(h),m.current.set(s.id,i)},de=async s=>{const r=V[s.id];if(!r)return;await navigator.clipboard.writeText(r),B(s.id),d?.(a("secrets.copied","Copied"),"success");const i=setTimeout(()=>{B(null),j(v=>({...v,[s.id]:null}))},1500),h=w.current.get(s.id);h&&clearTimeout(h),w.current.set(s.id,i)},pe=async s=>{await o(`/api/secrets/${s.scope}/${s.id}`,{method:"DELETE"}),g(null),await x()},$=c.useMemo(()=>[...R].filter(s=>!(s.scope==="global"&&s.key===ge)).sort((s,r)=>s.key.localeCompare(r.key)),[R]),J=f.length>0&&f===P;return e.jsxs("section",{className:"secrets-view",children:[e.jsx(ue,{icon:he,title:a("secrets.title","Secrets"),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void x(),children:[e.jsx(q,{...n})," ",a("secrets.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:ce,children:[e.jsx(me,{...n})," ",a("secrets.addSecret","Add Secret")]})]})}),A?e.jsx("div",{className:"form-error",children:A}):null,T?e.jsxs("div",{className:"secrets-loading",children:[e.jsx(q,{...Ne})," ",a("secrets.loading","Loading…")]}):null,!T&&$.length===0?e.jsx("div",{className:"secrets-empty",children:a("secrets.empty","No secrets found.")}):null,e.jsx("div",{className:"secrets-list",children:$.map(s=>{const r=V[s.id];return e.jsxs("article",{className:"card secrets-row",children:[e.jsxs("div",{className:"secrets-row-main",children:[e.jsx("div",{className:"secrets-row-key",children:s.key}),e.jsxs("div",{className:"secrets-row-meta",children:[e.jsx("span",{className:"secrets-chip",children:s.scope}),e.jsx("span",{className:"secrets-chip",children:s.accessPolicy}),s.envExportable?e.jsx("span",{className:"secrets-chip",children:a("secrets.envExportableChip","env exportable")}):null]}),r?e.jsx("pre",{className:"secrets-revealed",children:r}):null]}),e.jsxs("div",{className:"secrets-row-side",children:[e.jsx("span",{className:"secrets-row-read",children:s.lastReadAt?new Date(s.lastReadAt).toLocaleString():a("secrets.neverRead","Never read")}),e.jsxs("div",{className:"secrets-row-actions",children:[e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>{if(r){oe(s);return}ie(s)},"aria-label":r?a("secrets.hideAriaLabel","Hide"):a("secrets.revealAriaLabel","Reveal"),children:r?e.jsx(G,{...n}):e.jsx(Y,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>void de(s),"aria-label":a("secrets.copyAriaLabel","Copy"),disabled:!r,children:W===s.id?e.jsx(ye,{...n}):e.jsx(xe,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>le(s),"aria-label":a("secrets.editAriaLabel","Edit"),children:e.jsx(ve,{...n})}),e.jsx("button",{className:"btn btn-icon btn-danger",onClick:()=>g(s.id),"aria-label":a("secrets.deleteAriaLabel","Delete"),children:e.jsx(be,{...n})})]}),Q===s.id?e.jsxs("div",{className:"secrets-confirm",children:[e.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>void pe(s),children:a("secrets.confirmDelete","Confirm")}),e.jsx("button",{className:"btn btn-sm",onClick:()=>g(null),children:a("secrets.cancelDelete","Cancel")})]}):null]})]},s.id)})}),e.jsxs("article",{className:"card secrets-sync-card secrets-sync-disclosure",children:[e.jsxs("button",{type:"button",className:"secrets-sync-disclosure-toggle","data-testid":"secrets-passphrase-disclosure","aria-expanded":E,"aria-controls":"secrets-sync-disclosure-panel",onClick:()=>se(s=>!s),children:[E?e.jsx(je,{size:16,"aria-hidden":"true"}):e.jsx(fe,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:a("secrets.syncPassphraseTitle","Cross-Node Sync Passphrase")})]}),E?e.jsxs("div",{id:"secrets-sync-disclosure-panel",className:"secrets-sync-disclosure-panel",children:[e.jsxs("div",{className:"secrets-sync-header",children:[e.jsxs("p",{className:"secrets-sync-status",children:[e.jsx("span",{className:`status-dot ${u?"status-dot--online":"status-dot--pending"}`,"aria-hidden":"true"})," ",u?a("secrets.syncConfigured","Configured"):a("secrets.syncNotConfigured","Not configured")]}),e.jsxs("div",{className:"secrets-sync-actions",children:[e.jsx("button",{className:"btn",onClick:()=>_(!0),children:u?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")}),u?e.jsx("button",{className:"btn btn-danger",onClick:()=>void te(),children:a("secrets.clearSyncPassphrase","Clear")}):null]})]}),e.jsx("p",{className:"secrets-sync-copy",children:a("secrets.syncPassphraseDescription","Shared passphrase used to wrap cross-node secret bundles. Both nodes in a sync pair must share the same value. Stored locally only; never transmitted.")})]}):null]}),Z?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase")}),e.jsx("button",{className:"modal-close",onClick:k,"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.passphraseLabel","Passphrase")}),e.jsx("input",{"aria-label":a("secrets.passphraseLabel","Passphrase"),className:"input",type:"password",autoComplete:"new-password",value:f,onChange:s=>F(s.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.confirmPassphraseLabel","Confirm passphrase")}),e.jsx("input",{"aria-label":a("secrets.confirmPassphraseLabel","Confirm passphrase"),className:"input",type:"password",autoComplete:"new-password",value:P,onChange:s=>H(s.target.value)})]}),!J&&P.length>0?e.jsx("div",{className:"form-error",children:a("secrets.passphraseMustMatch","Passphrases must match.")}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:k,children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void re(),disabled:!J||ee,children:u?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")})]})})]})}):null,U?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":p?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:p?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret")}),e.jsx("button",{className:"modal-close",onClick:()=>y(!1),"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.keyLabel","Key")}),e.jsx("input",{className:"input",value:t.key,onChange:s=>l(r=>({...r,key:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.valueLabel","Value")}),e.jsxs("div",{className:"secrets-value-row",children:[e.jsx("input",{className:"input",type:N?"text":"password",autoComplete:"off",spellCheck:!1,value:t.value,onChange:s=>l(r=>({...r,value:s.target.value}))}),e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>C(s=>!s),"aria-label":N?a("secrets.hideValueAriaLabel","Hide value"):a("secrets.showValueAriaLabel","Show value"),children:N?e.jsx(G,{...n}):e.jsx(Y,{...n})})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.descriptionLabel","Description")}),e.jsx("textarea",{className:"input",value:t.description,onChange:s=>l(r=>({...r,description:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.scopeLabel","Scope")}),e.jsxs("div",{className:"secrets-radio-row",children:[e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t.scope==="project",onChange:()=>l(s=>({...s,scope:"project"})),disabled:!!p})," ",a("secrets.scopeProject","Project")]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t.scope==="global",onChange:()=>l(s=>({...s,scope:"global"})),disabled:!!p})," ",a("secrets.scopeGlobal","Global")]})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.accessPolicyLabel","Access policy")}),e.jsxs("select",{className:"select",value:t.accessPolicy,onChange:s=>l(r=>({...r,accessPolicy:s.target.value})),children:[e.jsx("option",{value:"auto",children:a("secrets.accessPolicyAuto","auto")}),e.jsx("option",{value:"prompt",children:a("secrets.accessPolicyPrompt","prompt")}),e.jsx("option",{value:"deny",children:a("secrets.accessPolicyDeny","deny")})]})]}),e.jsx("div",{className:"form-group",children:e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.envExportable,onChange:s=>l(r=>({...r,envExportable:s.target.checked}))})," ",a("secrets.exportToEnvLabel","Export to env")]})}),t.envExportable?e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.envKeyLabel","Env key")}),e.jsx("input",{className:"input",value:t.envExportKey,onChange:s=>l(r=>({...r,envExportKey:s.target.value}))})]}):null,K?e.jsx("div",{className:"form-error",children:K}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:()=>y(!1),children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void ne(),children:p?a("secrets.saveBtn","Save"):a("secrets.createBtn","Create")})]})})]})}):null]})};export{Re as SecretsView};
|
|
1
|
+
import{r as c,j as e}from"./vendor-react-SZ_qB27O.js";import{V as ue,B as he,R as q,P as me,D as G,F as Y,G as ye,H as xe,I as ve,J as be,o as je,C as fe}from"./index-DAv17W73.js";import{u as Se}from"./vendor-i18n-GF3RlKbq.js";import"./vendor-reactflow-Bg-Qjzh8.js";import"./vendor-xterm-BNq00GSj.js";import"./vendor-codemirror-jBKmHyH0.js";const ge="__sync_passphrase__",L={key:"",value:"",description:"",scope:"project",accessPolicy:"prompt",envExportable:!1,envExportKey:""},n={className:"secrets-action-icon","aria-hidden":!0,style:{width:"1em",height:"1em"}},Ne={...n,className:"secrets-action-icon spin"},Re=({addToast:d})=>{const{t:a}=Se("app"),[R,z]=c.useState([]),[T,M]=c.useState(!0),[A,D]=c.useState(null),[K,b]=c.useState(null),[p,O]=c.useState(null),[U,y]=c.useState(!1),[Q,g]=c.useState(null),[t,l]=c.useState(L),[N,C]=c.useState(!1),[V,j]=c.useState({}),[W,B]=c.useState(null),[u,X]=c.useState(!1),[Z,_]=c.useState(!1),[f,F]=c.useState(""),[P,H]=c.useState(""),[ee,I]=c.useState(!1),[E,se]=c.useState(!1),m=c.useRef(new Map),w=c.useRef(new Map),o=c.useCallback(async(s,r)=>{const i=await fetch(s,{...r,headers:{"Content-Type":"application/json",...r?.headers??{}}});if(!i.ok){const h=await i.json().catch(()=>({error:"Request failed"}));throw new Error(String(h?.error??"Request failed"))}if(i.status!==204)return i.json()},[]),x=c.useCallback(async()=>{M(!0),D(null);try{const s=await o("/api/secrets");z(s.secrets)}catch(s){D(s instanceof Error?s.message:String(s))}finally{M(!1)}},[o]),S=c.useCallback(async()=>{try{const s=await o("/api/secrets/sync-passphrase");X(!!s.configured)}catch(s){d?.(a("secrets.errorLoadSyncStatus","Failed to load sync passphrase status: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}},[d,o]);c.useEffect(()=>(x(),S(),()=>{m.current.forEach(s=>clearTimeout(s)),w.current.forEach(s=>clearTimeout(s))}),[x,S]);const k=()=>{_(!1),F(""),H("")},ae=async s=>{await o("/api/secrets/sync-passphrase",{method:"PUT",body:JSON.stringify({passphrase:s})})},re=async()=>{I(!0);try{await ae(f),d?.(u?a("secrets.syncPassphraseRotated","Sync passphrase rotated"):a("secrets.syncPassphraseSet","Sync passphrase set"),"success"),k(),await S()}catch(s){d?.(a("secrets.errorSaveSyncPassphrase","Failed to save sync passphrase: {{error}}",{error:s instanceof Error?s.message:String(s)}),"error")}finally{I(!1)}},te=async()=>{if(window.confirm(a("secrets.confirmClearSyncPassphrase","Clear the cross-node sync passphrase? Existing sync pairs will stop working until you set a new passphrase.")))try{await o("/api/secrets/sync-passphrase",{method:"DELETE"}),d?.(a("secrets.syncPassphraseCleared","Sync passphrase cleared"),"success"),await S()}catch(r){d?.(a("secrets.errorClearSyncPassphrase","Failed to clear sync passphrase: {{error}}",{error:r instanceof Error?r.message:String(r)}),"error")}},ce=()=>{O(null),l(L),y(!0),C(!1),b(null)},le=s=>{O(s),l({key:s.key,value:"",description:s.description??"",scope:s.scope,accessPolicy:s.accessPolicy,envExportable:s.envExportable,envExportKey:s.envExportKey??""}),y(!0),C(!1),b(null)},ne=async()=>{b(null);try{if(p){const s={key:t.key,description:t.description||null,accessPolicy:t.accessPolicy,envExportable:t.envExportable,envExportKey:t.envExportable&&t.envExportKey||null};t.value&&(s.value=t.value),await o(`/api/secrets/${p.scope}/${p.id}`,{method:"PATCH",body:JSON.stringify(s)})}else await o("/api/secrets",{method:"POST",body:JSON.stringify({scope:t.scope,key:t.key,value:t.value,description:t.description||null,accessPolicy:t.accessPolicy,envExportable:t.envExportable,envExportKey:t.envExportable&&t.envExportKey||null})});y(!1),l(L),await x()}catch(s){b(s instanceof Error?s.message:String(s))}},oe=s=>{const r=m.current.get(s.id);r&&(clearTimeout(r),m.current.delete(s.id)),j(i=>({...i,[s.id]:null}))},ie=async s=>{const r=await o(`/api/secrets/${s.scope}/${s.id}/reveal`,{method:"POST"});j(v=>({...v,[s.id]:r.value})),d?.(a("secrets.revealed","Revealed"),"success");const i=setTimeout(()=>{j(v=>({...v,[s.id]:null})),m.current.delete(s.id)},3e4),h=m.current.get(s.id);h&&clearTimeout(h),m.current.set(s.id,i)},de=async s=>{const r=V[s.id];if(!r)return;await navigator.clipboard.writeText(r),B(s.id),d?.(a("secrets.copied","Copied"),"success");const i=setTimeout(()=>{B(null),j(v=>({...v,[s.id]:null}))},1500),h=w.current.get(s.id);h&&clearTimeout(h),w.current.set(s.id,i)},pe=async s=>{await o(`/api/secrets/${s.scope}/${s.id}`,{method:"DELETE"}),g(null),await x()},$=c.useMemo(()=>[...R].filter(s=>!(s.scope==="global"&&s.key===ge)).sort((s,r)=>s.key.localeCompare(r.key)),[R]),J=f.length>0&&f===P;return e.jsxs("section",{className:"secrets-view",children:[e.jsx(ue,{icon:he,title:a("secrets.title","Secrets"),actions:e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"btn btn-sm",onClick:()=>void x(),children:[e.jsx(q,{...n})," ",a("secrets.refresh","Refresh")]}),e.jsxs("button",{className:"btn btn-primary btn-sm",onClick:ce,children:[e.jsx(me,{...n})," ",a("secrets.addSecret","Add Secret")]})]})}),A?e.jsx("div",{className:"form-error",children:A}):null,T?e.jsxs("div",{className:"secrets-loading",children:[e.jsx(q,{...Ne})," ",a("secrets.loading","Loading…")]}):null,!T&&$.length===0?e.jsx("div",{className:"secrets-empty",children:a("secrets.empty","No secrets found.")}):null,e.jsx("div",{className:"secrets-list",children:$.map(s=>{const r=V[s.id];return e.jsxs("article",{className:"card secrets-row",children:[e.jsxs("div",{className:"secrets-row-main",children:[e.jsx("div",{className:"secrets-row-key",children:s.key}),e.jsxs("div",{className:"secrets-row-meta",children:[e.jsx("span",{className:"secrets-chip",children:s.scope}),e.jsx("span",{className:"secrets-chip",children:s.accessPolicy}),s.envExportable?e.jsx("span",{className:"secrets-chip",children:a("secrets.envExportableChip","env exportable")}):null]}),r?e.jsx("pre",{className:"secrets-revealed",children:r}):null]}),e.jsxs("div",{className:"secrets-row-side",children:[e.jsx("span",{className:"secrets-row-read",children:s.lastReadAt?new Date(s.lastReadAt).toLocaleString():a("secrets.neverRead","Never read")}),e.jsxs("div",{className:"secrets-row-actions",children:[e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>{if(r){oe(s);return}ie(s)},"aria-label":r?a("secrets.hideAriaLabel","Hide"):a("secrets.revealAriaLabel","Reveal"),children:r?e.jsx(G,{...n}):e.jsx(Y,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>void de(s),"aria-label":a("secrets.copyAriaLabel","Copy"),disabled:!r,children:W===s.id?e.jsx(ye,{...n}):e.jsx(xe,{...n})}),e.jsx("button",{className:"btn btn-icon",onClick:()=>le(s),"aria-label":a("secrets.editAriaLabel","Edit"),children:e.jsx(ve,{...n})}),e.jsx("button",{className:"btn btn-icon btn-danger",onClick:()=>g(s.id),"aria-label":a("secrets.deleteAriaLabel","Delete"),children:e.jsx(be,{...n})})]}),Q===s.id?e.jsxs("div",{className:"secrets-confirm",children:[e.jsx("button",{className:"btn btn-sm btn-danger",onClick:()=>void pe(s),children:a("secrets.confirmDelete","Confirm")}),e.jsx("button",{className:"btn btn-sm",onClick:()=>g(null),children:a("secrets.cancelDelete","Cancel")})]}):null]})]},s.id)})}),e.jsxs("article",{className:"card secrets-sync-card secrets-sync-disclosure",children:[e.jsxs("button",{type:"button",className:"secrets-sync-disclosure-toggle","data-testid":"secrets-passphrase-disclosure","aria-expanded":E,"aria-controls":"secrets-sync-disclosure-panel",onClick:()=>se(s=>!s),children:[E?e.jsx(je,{size:16,"aria-hidden":"true"}):e.jsx(fe,{size:16,"aria-hidden":"true"}),e.jsx("span",{children:a("secrets.syncPassphraseTitle","Cross-Node Sync Passphrase")})]}),E?e.jsxs("div",{id:"secrets-sync-disclosure-panel",className:"secrets-sync-disclosure-panel",children:[e.jsxs("div",{className:"secrets-sync-header",children:[e.jsxs("p",{className:"secrets-sync-status",children:[e.jsx("span",{className:`status-dot ${u?"status-dot--online":"status-dot--pending"}`,"aria-hidden":"true"})," ",u?a("secrets.syncConfigured","Configured"):a("secrets.syncNotConfigured","Not configured")]}),e.jsxs("div",{className:"secrets-sync-actions",children:[e.jsx("button",{className:"btn",onClick:()=>_(!0),children:u?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")}),u?e.jsx("button",{className:"btn btn-danger",onClick:()=>void te(),children:a("secrets.clearSyncPassphrase","Clear")}):null]})]}),e.jsx("p",{className:"secrets-sync-copy",children:a("secrets.syncPassphraseDescription","Shared passphrase used to wrap cross-node secret bundles. Both nodes in a sync pair must share the same value. Stored locally only; never transmitted.")})]}):null]}),Z?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:u?a("secrets.rotateSyncPassphraseModalTitle","Rotate sync passphrase"):a("secrets.setSyncPassphraseModalTitle","Set sync passphrase")}),e.jsx("button",{className:"modal-close",onClick:k,"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.passphraseLabel","Passphrase")}),e.jsx("input",{"aria-label":a("secrets.passphraseLabel","Passphrase"),className:"input",type:"password",autoComplete:"new-password",value:f,onChange:s=>F(s.target.value)})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.confirmPassphraseLabel","Confirm passphrase")}),e.jsx("input",{"aria-label":a("secrets.confirmPassphraseLabel","Confirm passphrase"),className:"input",type:"password",autoComplete:"new-password",value:P,onChange:s=>H(s.target.value)})]}),!J&&P.length>0?e.jsx("div",{className:"form-error",children:a("secrets.passphraseMustMatch","Passphrases must match.")}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:k,children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void re(),disabled:!J||ee,children:u?a("secrets.rotateSyncPassphrase","Rotate"):a("secrets.setPassphrase","Set passphrase")})]})})]})}):null,U?e.jsx("div",{className:"modal-overlay open",role:"presentation",children:e.jsxs("div",{className:"modal",role:"dialog","aria-modal":"true","aria-label":p?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret"),children:[e.jsxs("div",{className:"modal-header",children:[e.jsx("h3",{children:p?a("secrets.editSecretModalTitle","Edit secret"):a("secrets.addSecretModalTitle","Add secret")}),e.jsx("button",{className:"modal-close",onClick:()=>y(!1),"aria-label":a("secrets.closeAriaLabel","Close"),children:"×"})]}),e.jsxs("div",{className:"secrets-modal-body",children:[e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.keyLabel","Key")}),e.jsx("input",{className:"input",value:t.key,onChange:s=>l(r=>({...r,key:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.valueLabel","Value")}),e.jsxs("div",{className:"secrets-value-row",children:[e.jsx("input",{className:"input",type:N?"text":"password",autoComplete:"off",spellCheck:!1,value:t.value,onChange:s=>l(r=>({...r,value:s.target.value}))}),e.jsx("button",{type:"button",className:"btn btn-icon secrets-visibility-toggle",onClick:()=>C(s=>!s),"aria-label":N?a("secrets.hideValueAriaLabel","Hide value"):a("secrets.showValueAriaLabel","Show value"),children:N?e.jsx(G,{...n}):e.jsx(Y,{...n})})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.descriptionLabel","Description")}),e.jsx("textarea",{className:"input",value:t.description,onChange:s=>l(r=>({...r,description:s.target.value}))})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.scopeLabel","Scope")}),e.jsxs("div",{className:"secrets-radio-row",children:[e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t.scope==="project",onChange:()=>l(s=>({...s,scope:"project"})),disabled:!!p})," ",a("secrets.scopeProject","Project")]}),e.jsxs("label",{children:[e.jsx("input",{type:"radio",checked:t.scope==="global",onChange:()=>l(s=>({...s,scope:"global"})),disabled:!!p})," ",a("secrets.scopeGlobal","Global")]})]})]}),e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.accessPolicyLabel","Access policy")}),e.jsxs("select",{className:"select",value:t.accessPolicy,onChange:s=>l(r=>({...r,accessPolicy:s.target.value})),children:[e.jsx("option",{value:"auto",children:a("secrets.accessPolicyAuto","auto")}),e.jsx("option",{value:"prompt",children:a("secrets.accessPolicyPrompt","prompt")}),e.jsx("option",{value:"deny",children:a("secrets.accessPolicyDeny","deny")})]})]}),e.jsx("div",{className:"form-group",children:e.jsxs("label",{className:"checkbox-label",children:[e.jsx("input",{type:"checkbox",checked:t.envExportable,onChange:s=>l(r=>({...r,envExportable:s.target.checked}))})," ",a("secrets.exportToEnvLabel","Export to env")]})}),t.envExportable?e.jsxs("div",{className:"form-group",children:[e.jsx("label",{children:a("secrets.envKeyLabel","Env key")}),e.jsx("input",{className:"input",value:t.envExportKey,onChange:s=>l(r=>({...r,envExportKey:s.target.value}))})]}):null,K?e.jsx("div",{className:"form-error",children:K}):null]}),e.jsx("div",{className:"modal-actions",children:e.jsxs("div",{className:"modal-actions-right",children:[e.jsx("button",{className:"btn",onClick:()=>y(!1),children:a("secrets.cancelBtn","Cancel")}),e.jsx("button",{className:"btn btn-primary",onClick:()=>void ne(),children:p?a("secrets.saveBtn","Save"):a("secrets.createBtn","Create")})]})})]})}):null]})};export{Re as SecretsView};
|
|
@@ -1,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{W as fe,Y as K,$ as te,a0 as $,a1 as ye,a2 as be,F as he,a3 as U,a4 as we,a5 as _e,a6 as Se,_ as A,a7 as ke,a8 as ve}from"./index-DFeBJ3GM.js";import{r as n,j as e}from"./vendor-react-SZ_qB27O.js";import"./vendor-xterm-BNq00GSj.js";import{u as Ee}from"./vendor-i18n-GF3RlKbq.js";import{S as Te}from"./shield-alert-BfOnDO6O.js";import"./vendor-reactflow-Bg-Qjzh8.js";import"./vendor-codemirror-jBKmHyH0.js";const Ce=32*1024,xe=100,ge="\x1B",Ne=" ",Re="",je="\x1B[A",De="\x1B[B",Pe="\x1B[C",Me="\x1B[D",L={ctrl:"Ctrl",escape:"Esc",tab:"Tab",ctrlC:"^C"};function ne(d){if(d.length!==1)return null;const i=d.toUpperCase().charCodeAt(0);return i>=64&&i<=95?String.fromCharCode(i&31):null}function Ae(){const[d,r]=n.useState(()=>U());return n.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const i=window.matchMedia(we),s=()=>r(U());return s(),typeof i.addEventListener=="function"?(i.addEventListener("change",s),()=>i.removeEventListener("change",s)):(i.addListener(s),()=>i.removeListener(s))},[]),d}function Le(d,r){if(typeof window>"u")return"";const s=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/cli-sessions/ws?sessionId=${encodeURIComponent(d)}&ticket=${encodeURIComponent(r)}`;return ve(s)}function Be(d){if(typeof window<"u"&&typeof window.atob=="function"){const r=window.atob(d),i=new Uint8Array(r.length);for(let s=0;s<r.length;s++)i[s]=r.charCodeAt(s);return new TextDecoder("utf-8").decode(i)}return Buffer.from(d,"base64").toString("utf8")}function Ve({sessionId:d,readOnly:r=!1,posture:i,mode:s="live",projectId:B,onConfirmAdvance:S,showConfirmAdvance:F=!1,onOpenAdapterSettings:Q}){const{t:a}=Ee("app"),k=n.useRef(null),x=n.useRef(null),g=n.useRef(null),_=n.useRef(null),[V,Y]=n.useState(!1),[ie,O]=n.useState(!1),[J,G]=n.useState(!1),v=Ae(),{keyboardOpen:N,keyboardOverlap:se}=fe({enabled:v}),oe=n.useRef(null),[b,H]=n.useState(""),[E,R]=n.useState(!1),f=n.useCallback(t=>{if(!t)return;const o=_.current;o?.readyState===WebSocket.OPEN&&o.send(JSON.stringify({type:"input",data:t}))},[]),T=n.useCallback(t=>{if(E){const o=ne(t);if(R(!1),o){f(o);return}}f(t)},[E,f]),c=n.useCallback(t=>{t.preventDefault()},[]),Z=n.useCallback(t=>{t?.preventDefault?.(),b&&f(b),f("\r"),H("")},[b,f]),ae=n.useCallback(t=>{if(E&&t.length>b.length){const o=t.slice(b.length,b.length+1),h=ne(o);if(R(!1),h){f(h);return}}H(t)},[E,b,f]);n.useEffect(()=>{F&&O(!1)},[F,d]);const q=n.useCallback(()=>{const t=x.current;if(!t)return;const o=K();t.options.fontFamily=te(o.fontFamily),k.current?.style.setProperty("--terminal-glyph-font-family",$(o.fontFamily)),t.options.fontSize=o.fontSize,t.options.cursorStyle=o.cursorStyle,t.options.cursorBlink=o.cursorBlink&&!r&&s==="live";try{g.current?.fit?.()}catch{}},[s,r]);n.useEffect(()=>{if(typeof window>"u")return;const t=o=>{o.key===_e&&q()};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[q]),n.useEffect(()=>{if(!d||typeof window>"u")return;let t=!1,o=null,h=null,D=0;const z=(u,y)=>{const P=_.current;P?.readyState===WebSocket.OPEN&&P.send(JSON.stringify({type:"resize",cols:u,rows:y}))},de=u=>{if(D+=u,D<Ce)return;const y=_.current;y?.readyState===WebSocket.OPEN&&y.send(JSON.stringify({type:"ack",bytes:D})),D=0};return(async()=>{let u;try{u=await Se(`/cli-sessions/${encodeURIComponent(d)}/attach-ticket`,{method:"POST",body:JSON.stringify(B?{projectId:B}:{})})}catch{return}if(t)return;const[{Terminal:y},{FitAddon:P},{Unicode11Addon:ue}]=await Promise.all([A(()=>import("./vendor-xterm-BNq00GSj.js").then(m=>m.x),__vite__mapDeps([0,1,2])),A(()=>import("./addon-fit-C1WQXRvu.js").then(m=>m.a),__vite__mapDeps([3,1])),A(()=>import("./addon-unicode11-BVmNDUBM.js").then(m=>m.a),__vite__mapDeps([4,1]))]);if(t||!k.current)return;const w=K(),I=te(w.fontFamily);k.current.style.setProperty("--terminal-glyph-font-family",$(w.fontFamily));const l=new y({convertEol:!1,cursorBlink:w.cursorBlink&&!r&&s==="live",cursorStyle:w.cursorStyle,disableStdin:r,scrollback:1e4,fontFamily:I,fontSize:w.fontSize}),C=new P;l.loadAddon(C);const me=new ue;if(l.loadAddon(me),l.unicode.activeVersion="11",l.open(k.current),x.current=l,g.current=C,w.renderer==="auto"&&!U())try{const{WebglAddon:m}=await A(async()=>{const{WebglAddon:p}=await import("./addon-webgl-uLc0RKcC.js").then(M=>M.a);return{WebglAddon:p}},__vite__mapDeps([5,1]));if(!t){const p=new m;p.onContextLoss(()=>{try{p.dispose()}catch{}}),l.loadAddon(p)}}catch{}try{C.fit()}catch{}(async()=>{if(!(!await ke(w.fontSize,I)||t||x.current!==l||g.current!==C))try{l.options.fontFamily=I,l.options.fontSize=w.fontSize,C.fit(),z(l.cols,l.rows),l.refresh(0,Math.max(0,l.rows-1))}catch{}})(),r||l.onData(m=>{const p=_.current;p?.readyState===WebSocket.OPEN&&p.send(JSON.stringify({type:"input",data:m}))}),o=new ResizeObserver(()=>{h&&clearTimeout(h),h=setTimeout(()=>{try{C.fit(),z(l.cols,l.rows)}catch{}},xe)}),o.observe(k.current);const W=new WebSocket(Le(d,u.ticket));_.current=W,W.onopen=()=>{z(l.cols,l.rows)},W.onmessage=m=>{let p;try{p=JSON.parse(typeof m.data=="string"?m.data:"")}catch{return}switch(p.type){case"scrollback":case"data":{if(typeof p.data!="string")return;const M=Be(p.data),pe=M.length;l.write(M,()=>de(pe));break}}}})(),()=>{t=!0,h&&clearTimeout(h),o&&o.disconnect();const u=_.current;if(u){u.onopen=null,u.onmessage=null,u.onclose=null,u.onerror=null;try{u.close()}catch{}_.current=null}const y=x.current;if(y){try{y.dispose()}catch{}x.current=null}g.current=null}},[d,r,s,B]);const X=n.useMemo(()=>s==="idle"?a("cliTerminal.replayIdle","Session idle"):s==="ended"?a("cliTerminal.replayEnded","Session ended"):null,[s,a]),le=n.useCallback(async()=>{if(S){G(!0);try{await S("advance"),O(!0)}finally{G(!1)}}},[S]),re=n.useCallback(async()=>{S&&await S("not-yet"),O(!0)},[S]),j=!!i?.elevated,ee=i?.elevatedFlags?.join(", "),ce={"--terminal-glyph-font-family":$(K().fontFamily)};return e.jsxs("div",{className:`cli-session-terminal${v?" cli-session-terminal--mobile":""}${v&&N?" cli-session-terminal--keyboard-open":""}`,"data-mode":s,"data-read-only":r,"data-mobile":v,"data-keyboard-open":v&&N,children:[e.jsxs("header",{className:"cli-session-terminal__header",children:[i&&e.jsxs("div",{className:"cli-session-terminal__posture-wrap",children:[e.jsxs("button",{type:"button",className:`cli-posture-chip${j?" cli-posture-chip--elevated":""}`,"data-elevated":j,"aria-expanded":V,onClick:()=>Y(t=>!t),children:[j?e.jsx(Te,{size:13,"aria-hidden":"true"}):e.jsx(ye,{size:13,"aria-hidden":"true"}),e.jsx("span",{className:"cli-posture-chip__name",children:i.adapterName}),i.mode&&e.jsx("span",{className:"cli-posture-chip__mode",children:i.mode}),j&&ee&&e.jsx("span",{className:"cli-posture-chip__flag",children:ee})]}),V&&e.jsxs("div",{className:"cli-posture-tooltip",role:"tooltip",children:[e.jsx("p",{className:"cli-posture-tooltip__title",children:a("cliTerminal.postureResolved","Resolved posture")}),e.jsxs("ul",{className:"cli-posture-tooltip__list",children:[(i.resolved??[]).map((t,o)=>e.jsx("li",{children:t},o)),(i.resolved??[]).length===0&&e.jsx("li",{children:i.mode??a("cliTerminal.postureBaseline","Baseline")})]}),Q&&e.jsxs("button",{type:"button",className:"cli-posture-tooltip__settings",onClick:()=>{Y(!1),Q()},children:[e.jsx(be,{size:12,"aria-hidden":"true"}),a("cliTerminal.adapterSettings","Adapter settings")]})]})]}),r&&e.jsxs("span",{className:"cli-session-terminal__readonly-badge",children:[e.jsx(he,{size:12,"aria-hidden":"true"}),a("cliTerminal.readOnly","Read-only")]}),X&&e.jsx("span",{className:"cli-session-terminal__replay-badge","data-replay-mode":s,children:X})]}),e.jsx("div",{className:"cli-session-terminal__viewport",ref:k,"data-testid":"cli-terminal-viewport",style:ce}),F&&!ie&&e.jsxs("div",{className:"cli-session-terminal__advance-strip",role:"region",children:[e.jsx("span",{className:"cli-session-terminal__advance-copy",children:a("cliTerminal.advancePrompt","This session looks idle — advance to review?")}),e.jsxs("div",{className:"cli-session-terminal__advance-actions",children:[e.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn",disabled:J,onClick:le,children:a("cliTerminal.advance","Advance")}),e.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn cli-session-terminal__advance-btn--secondary",disabled:J,onClick:re,children:a("cliTerminal.notYet","Not yet")})]})]}),v&&!r&&e.jsxs("div",{className:`cli-session-terminal__mobile-bar${N?" cli-session-terminal__mobile-bar--keyboard-open":""}`,"data-testid":"cli-terminal-mobile-bar",style:N?{bottom:`${se}px`}:void 0,children:[e.jsxs("div",{className:"cli-session-terminal__key-row","data-testid":"cli-terminal-key-bar",children:[e.jsx("button",{type:"button",className:`cli-terminal-key cli-terminal-key--ctrl${E?" cli-terminal-key--active":""}`,"data-testid":"cli-key-ctrl","aria-label":a("cliTerminal.mobileKeyCtrl","Sticky Ctrl modifier"),"aria-pressed":E,onPointerDown:c,onMouseDown:c,onClick:()=>R(t=>!t),children:L.ctrl}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-esc","aria-label":a("cliTerminal.mobileKeyEsc","Send Escape"),onPointerDown:c,onMouseDown:c,onClick:()=>T(ge),children:L.escape}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-tab","aria-label":a("cliTerminal.mobileKeyTab","Send Tab"),onPointerDown:c,onMouseDown:c,onClick:()=>T(Ne),children:L.tab}),e.jsx("button",{type:"button",className:"cli-terminal-key cli-terminal-key--ctrlc","data-testid":"cli-key-ctrl-c","aria-label":a("cliTerminal.mobileKeyCtrlC","Send Ctrl-C"),onPointerDown:c,onMouseDown:c,onClick:()=>{R(!1),f(Re)},children:L.ctrlC}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-up","aria-label":a("cliTerminal.mobileKeyArrowUp","Cursor up"),onPointerDown:c,onMouseDown:c,onClick:()=>T(je),children:"↑"}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-down","aria-label":a("cliTerminal.mobileKeyArrowDown","Cursor down"),onPointerDown:c,onMouseDown:c,onClick:()=>T(De),children:"↓"}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-left","aria-label":a("cliTerminal.mobileKeyArrowLeft","Cursor left"),onPointerDown:c,onMouseDown:c,onClick:()=>T(Me),children:"←"}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-right","aria-label":a("cliTerminal.mobileKeyArrowRight","Cursor right"),onPointerDown:c,onMouseDown:c,onClick:()=>T(Pe),children:"→"})]}),e.jsxs("form",{className:"cli-session-terminal__input-row",onSubmit:Z,children:[e.jsx("input",{ref:oe,type:"text",className:"cli-session-terminal__mobile-input","data-testid":"cli-terminal-mobile-input",value:b,placeholder:a("cliTerminal.mobileInputPlaceholder","Type to send to the session…"),autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,onChange:t=>ae(t.target.value)}),e.jsx("button",{type:"submit",className:"cli-session-terminal__mobile-send","data-testid":"cli-terminal-mobile-send","aria-label":a("cliTerminal.mobileSend","Send"),onPointerDown:c,onMouseDown:c,onClick:()=>Z(),children:a("cliTerminal.mobileSend","Send")})]})]})]})}export{Ve as SessionTerminal};
|
|
2
|
+
import{W as fe,Y as K,$ as te,a0 as $,a1 as ye,a2 as be,F as he,a3 as U,a4 as we,a5 as _e,a6 as Se,_ as A,a7 as ke,a8 as ve}from"./index-DAv17W73.js";import{r as n,j as e}from"./vendor-react-SZ_qB27O.js";import"./vendor-xterm-BNq00GSj.js";import{u as Ee}from"./vendor-i18n-GF3RlKbq.js";import{S as Te}from"./shield-alert-yWvC7t2v.js";import"./vendor-reactflow-Bg-Qjzh8.js";import"./vendor-codemirror-jBKmHyH0.js";const Ce=32*1024,xe=100,ge="\x1B",Ne=" ",Re="",je="\x1B[A",De="\x1B[B",Pe="\x1B[C",Me="\x1B[D",L={ctrl:"Ctrl",escape:"Esc",tab:"Tab",ctrlC:"^C"};function ne(d){if(d.length!==1)return null;const i=d.toUpperCase().charCodeAt(0);return i>=64&&i<=95?String.fromCharCode(i&31):null}function Ae(){const[d,r]=n.useState(()=>U());return n.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const i=window.matchMedia(we),s=()=>r(U());return s(),typeof i.addEventListener=="function"?(i.addEventListener("change",s),()=>i.removeEventListener("change",s)):(i.addListener(s),()=>i.removeListener(s))},[]),d}function Le(d,r){if(typeof window>"u")return"";const s=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/api/cli-sessions/ws?sessionId=${encodeURIComponent(d)}&ticket=${encodeURIComponent(r)}`;return ve(s)}function Be(d){if(typeof window<"u"&&typeof window.atob=="function"){const r=window.atob(d),i=new Uint8Array(r.length);for(let s=0;s<r.length;s++)i[s]=r.charCodeAt(s);return new TextDecoder("utf-8").decode(i)}return Buffer.from(d,"base64").toString("utf8")}function Ve({sessionId:d,readOnly:r=!1,posture:i,mode:s="live",projectId:B,onConfirmAdvance:S,showConfirmAdvance:F=!1,onOpenAdapterSettings:Q}){const{t:a}=Ee("app"),k=n.useRef(null),x=n.useRef(null),g=n.useRef(null),_=n.useRef(null),[V,Y]=n.useState(!1),[ie,O]=n.useState(!1),[J,G]=n.useState(!1),v=Ae(),{keyboardOpen:N,keyboardOverlap:se}=fe({enabled:v}),oe=n.useRef(null),[b,H]=n.useState(""),[E,R]=n.useState(!1),f=n.useCallback(t=>{if(!t)return;const o=_.current;o?.readyState===WebSocket.OPEN&&o.send(JSON.stringify({type:"input",data:t}))},[]),T=n.useCallback(t=>{if(E){const o=ne(t);if(R(!1),o){f(o);return}}f(t)},[E,f]),c=n.useCallback(t=>{t.preventDefault()},[]),Z=n.useCallback(t=>{t?.preventDefault?.(),b&&f(b),f("\r"),H("")},[b,f]),ae=n.useCallback(t=>{if(E&&t.length>b.length){const o=t.slice(b.length,b.length+1),h=ne(o);if(R(!1),h){f(h);return}}H(t)},[E,b,f]);n.useEffect(()=>{F&&O(!1)},[F,d]);const q=n.useCallback(()=>{const t=x.current;if(!t)return;const o=K();t.options.fontFamily=te(o.fontFamily),k.current?.style.setProperty("--terminal-glyph-font-family",$(o.fontFamily)),t.options.fontSize=o.fontSize,t.options.cursorStyle=o.cursorStyle,t.options.cursorBlink=o.cursorBlink&&!r&&s==="live";try{g.current?.fit?.()}catch{}},[s,r]);n.useEffect(()=>{if(typeof window>"u")return;const t=o=>{o.key===_e&&q()};return window.addEventListener("storage",t),()=>window.removeEventListener("storage",t)},[q]),n.useEffect(()=>{if(!d||typeof window>"u")return;let t=!1,o=null,h=null,D=0;const z=(u,y)=>{const P=_.current;P?.readyState===WebSocket.OPEN&&P.send(JSON.stringify({type:"resize",cols:u,rows:y}))},de=u=>{if(D+=u,D<Ce)return;const y=_.current;y?.readyState===WebSocket.OPEN&&y.send(JSON.stringify({type:"ack",bytes:D})),D=0};return(async()=>{let u;try{u=await Se(`/cli-sessions/${encodeURIComponent(d)}/attach-ticket`,{method:"POST",body:JSON.stringify(B?{projectId:B}:{})})}catch{return}if(t)return;const[{Terminal:y},{FitAddon:P},{Unicode11Addon:ue}]=await Promise.all([A(()=>import("./vendor-xterm-BNq00GSj.js").then(m=>m.x),__vite__mapDeps([0,1,2])),A(()=>import("./addon-fit-C1WQXRvu.js").then(m=>m.a),__vite__mapDeps([3,1])),A(()=>import("./addon-unicode11-BVmNDUBM.js").then(m=>m.a),__vite__mapDeps([4,1]))]);if(t||!k.current)return;const w=K(),I=te(w.fontFamily);k.current.style.setProperty("--terminal-glyph-font-family",$(w.fontFamily));const l=new y({convertEol:!1,cursorBlink:w.cursorBlink&&!r&&s==="live",cursorStyle:w.cursorStyle,disableStdin:r,scrollback:1e4,fontFamily:I,fontSize:w.fontSize}),C=new P;l.loadAddon(C);const me=new ue;if(l.loadAddon(me),l.unicode.activeVersion="11",l.open(k.current),x.current=l,g.current=C,w.renderer==="auto"&&!U())try{const{WebglAddon:m}=await A(async()=>{const{WebglAddon:p}=await import("./addon-webgl-uLc0RKcC.js").then(M=>M.a);return{WebglAddon:p}},__vite__mapDeps([5,1]));if(!t){const p=new m;p.onContextLoss(()=>{try{p.dispose()}catch{}}),l.loadAddon(p)}}catch{}try{C.fit()}catch{}(async()=>{if(!(!await ke(w.fontSize,I)||t||x.current!==l||g.current!==C))try{l.options.fontFamily=I,l.options.fontSize=w.fontSize,C.fit(),z(l.cols,l.rows),l.refresh(0,Math.max(0,l.rows-1))}catch{}})(),r||l.onData(m=>{const p=_.current;p?.readyState===WebSocket.OPEN&&p.send(JSON.stringify({type:"input",data:m}))}),o=new ResizeObserver(()=>{h&&clearTimeout(h),h=setTimeout(()=>{try{C.fit(),z(l.cols,l.rows)}catch{}},xe)}),o.observe(k.current);const W=new WebSocket(Le(d,u.ticket));_.current=W,W.onopen=()=>{z(l.cols,l.rows)},W.onmessage=m=>{let p;try{p=JSON.parse(typeof m.data=="string"?m.data:"")}catch{return}switch(p.type){case"scrollback":case"data":{if(typeof p.data!="string")return;const M=Be(p.data),pe=M.length;l.write(M,()=>de(pe));break}}}})(),()=>{t=!0,h&&clearTimeout(h),o&&o.disconnect();const u=_.current;if(u){u.onopen=null,u.onmessage=null,u.onclose=null,u.onerror=null;try{u.close()}catch{}_.current=null}const y=x.current;if(y){try{y.dispose()}catch{}x.current=null}g.current=null}},[d,r,s,B]);const X=n.useMemo(()=>s==="idle"?a("cliTerminal.replayIdle","Session idle"):s==="ended"?a("cliTerminal.replayEnded","Session ended"):null,[s,a]),le=n.useCallback(async()=>{if(S){G(!0);try{await S("advance"),O(!0)}finally{G(!1)}}},[S]),re=n.useCallback(async()=>{S&&await S("not-yet"),O(!0)},[S]),j=!!i?.elevated,ee=i?.elevatedFlags?.join(", "),ce={"--terminal-glyph-font-family":$(K().fontFamily)};return e.jsxs("div",{className:`cli-session-terminal${v?" cli-session-terminal--mobile":""}${v&&N?" cli-session-terminal--keyboard-open":""}`,"data-mode":s,"data-read-only":r,"data-mobile":v,"data-keyboard-open":v&&N,children:[e.jsxs("header",{className:"cli-session-terminal__header",children:[i&&e.jsxs("div",{className:"cli-session-terminal__posture-wrap",children:[e.jsxs("button",{type:"button",className:`cli-posture-chip${j?" cli-posture-chip--elevated":""}`,"data-elevated":j,"aria-expanded":V,onClick:()=>Y(t=>!t),children:[j?e.jsx(Te,{size:13,"aria-hidden":"true"}):e.jsx(ye,{size:13,"aria-hidden":"true"}),e.jsx("span",{className:"cli-posture-chip__name",children:i.adapterName}),i.mode&&e.jsx("span",{className:"cli-posture-chip__mode",children:i.mode}),j&&ee&&e.jsx("span",{className:"cli-posture-chip__flag",children:ee})]}),V&&e.jsxs("div",{className:"cli-posture-tooltip",role:"tooltip",children:[e.jsx("p",{className:"cli-posture-tooltip__title",children:a("cliTerminal.postureResolved","Resolved posture")}),e.jsxs("ul",{className:"cli-posture-tooltip__list",children:[(i.resolved??[]).map((t,o)=>e.jsx("li",{children:t},o)),(i.resolved??[]).length===0&&e.jsx("li",{children:i.mode??a("cliTerminal.postureBaseline","Baseline")})]}),Q&&e.jsxs("button",{type:"button",className:"cli-posture-tooltip__settings",onClick:()=>{Y(!1),Q()},children:[e.jsx(be,{size:12,"aria-hidden":"true"}),a("cliTerminal.adapterSettings","Adapter settings")]})]})]}),r&&e.jsxs("span",{className:"cli-session-terminal__readonly-badge",children:[e.jsx(he,{size:12,"aria-hidden":"true"}),a("cliTerminal.readOnly","Read-only")]}),X&&e.jsx("span",{className:"cli-session-terminal__replay-badge","data-replay-mode":s,children:X})]}),e.jsx("div",{className:"cli-session-terminal__viewport",ref:k,"data-testid":"cli-terminal-viewport",style:ce}),F&&!ie&&e.jsxs("div",{className:"cli-session-terminal__advance-strip",role:"region",children:[e.jsx("span",{className:"cli-session-terminal__advance-copy",children:a("cliTerminal.advancePrompt","This session looks idle — advance to review?")}),e.jsxs("div",{className:"cli-session-terminal__advance-actions",children:[e.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn",disabled:J,onClick:le,children:a("cliTerminal.advance","Advance")}),e.jsx("button",{type:"button",className:"cli-session-terminal__advance-btn cli-session-terminal__advance-btn--secondary",disabled:J,onClick:re,children:a("cliTerminal.notYet","Not yet")})]})]}),v&&!r&&e.jsxs("div",{className:`cli-session-terminal__mobile-bar${N?" cli-session-terminal__mobile-bar--keyboard-open":""}`,"data-testid":"cli-terminal-mobile-bar",style:N?{bottom:`${se}px`}:void 0,children:[e.jsxs("div",{className:"cli-session-terminal__key-row","data-testid":"cli-terminal-key-bar",children:[e.jsx("button",{type:"button",className:`cli-terminal-key cli-terminal-key--ctrl${E?" cli-terminal-key--active":""}`,"data-testid":"cli-key-ctrl","aria-label":a("cliTerminal.mobileKeyCtrl","Sticky Ctrl modifier"),"aria-pressed":E,onPointerDown:c,onMouseDown:c,onClick:()=>R(t=>!t),children:L.ctrl}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-esc","aria-label":a("cliTerminal.mobileKeyEsc","Send Escape"),onPointerDown:c,onMouseDown:c,onClick:()=>T(ge),children:L.escape}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-tab","aria-label":a("cliTerminal.mobileKeyTab","Send Tab"),onPointerDown:c,onMouseDown:c,onClick:()=>T(Ne),children:L.tab}),e.jsx("button",{type:"button",className:"cli-terminal-key cli-terminal-key--ctrlc","data-testid":"cli-key-ctrl-c","aria-label":a("cliTerminal.mobileKeyCtrlC","Send Ctrl-C"),onPointerDown:c,onMouseDown:c,onClick:()=>{R(!1),f(Re)},children:L.ctrlC}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-up","aria-label":a("cliTerminal.mobileKeyArrowUp","Cursor up"),onPointerDown:c,onMouseDown:c,onClick:()=>T(je),children:"↑"}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-down","aria-label":a("cliTerminal.mobileKeyArrowDown","Cursor down"),onPointerDown:c,onMouseDown:c,onClick:()=>T(De),children:"↓"}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-left","aria-label":a("cliTerminal.mobileKeyArrowLeft","Cursor left"),onPointerDown:c,onMouseDown:c,onClick:()=>T(Me),children:"←"}),e.jsx("button",{type:"button",className:"cli-terminal-key","data-testid":"cli-key-arrow-right","aria-label":a("cliTerminal.mobileKeyArrowRight","Cursor right"),onPointerDown:c,onMouseDown:c,onClick:()=>T(Pe),children:"→"})]}),e.jsxs("form",{className:"cli-session-terminal__input-row",onSubmit:Z,children:[e.jsx("input",{ref:oe,type:"text",className:"cli-session-terminal__mobile-input","data-testid":"cli-terminal-mobile-input",value:b,placeholder:a("cliTerminal.mobileInputPlaceholder","Type to send to the session…"),autoCapitalize:"off",autoCorrect:"off",autoComplete:"off",spellCheck:!1,onChange:t=>ae(t.target.value)}),e.jsx("button",{type:"submit",className:"cli-session-terminal__mobile-send","data-testid":"cli-terminal-mobile-send","aria-label":a("cliTerminal.mobileSend","Send"),onPointerDown:c,onMouseDown:c,onClick:()=>Z(),children:a("cliTerminal.mobileSend","Send")})]})]})]})}export{Ve as SessionTerminal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./vendor-react-SZ_qB27O.js";import{z as C}from"./index-
|
|
1
|
+
import{r as e}from"./vendor-react-SZ_qB27O.js";import{z as C}from"./index-DAv17W73.js";function L(k={}){const{projectId:d,pollInterval:b=6e4,autoRefresh:p=!1,enabled:t=!0}=k,[S,o]=e.useState(null),[m,l]=e.useState(t),[E,c]=e.useState(null),[R,v]=e.useState(null),r=e.useRef(null),n=e.useRef(null),a=e.useRef(!0),s=e.useCallback(async()=>{if(!t){l(!1),c(null),o(null);return}r.current&&r.current.abort(),r.current=new AbortController,l(!0),c(null),o(null);try{const u=await C(d);if(!a.current)return;o(u),c(null),v(new Date),l(!1)}catch(u){if(u instanceof Error&&u.name==="AbortError"||!a.current)return;const A=u instanceof Error?u.message:"Failed to fetch memory backend status";c(A),l(!1)}},[t,d]);e.useEffect(()=>(a.current=!0,t?(s(),()=>{a.current=!1}):(r.current&&r.current.abort(),o(null),c(null),l(!1),()=>{a.current=!1})),[t,s]),e.useEffect(()=>{if(!(!t||!p))return n.current=setInterval(()=>{s()},b),()=>{n.current&&(clearInterval(n.current),n.current=null)}},[t,p,b,s]),e.useEffect(()=>()=>{a.current=!1,r.current&&r.current.abort(),n.current&&(clearInterval(n.current),n.current=null)},[]);const h=e.useCallback(()=>s(),[s]),f=m?null:S,B=f?.currentBackend??null,i=f?.capabilities??null,y=f?.availableBackends??[],I=i?.readable??!1,g=i?.writable??!1,w=i?.supportsAtomicWrite??!1;return{status:f,currentBackend:B,capabilities:i,availableBackends:y,isReadable:I,isWritable:g,supportsAtomicWrite:w,loading:m,error:E,lastUpdated:R,refresh:h}}export{L as u};
|