@puddle-code/cli 0.4.8 → 0.4.9
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/CHANGELOG.md +60 -8
- package/README.md +19 -4
- package/dist/host-control.mjs +75 -17
- package/dist/index.js +640 -143
- package/dist/install.sh +28 -0
- package/dist/public/assets/App-UQXXCAJF.js +65 -0
- package/dist/public/assets/{CompilationCommandForm-Csg3VkC6.js → CompilationCommandForm-CipGdjjH.js} +1 -1
- package/dist/public/assets/Dashboard-6pSi_1fH.js +1 -0
- package/dist/public/assets/EditorTabClose-TixDVxvl.js +1 -0
- package/dist/public/assets/LazyTerminal-B88WIvyh.js +2 -0
- package/dist/public/assets/{ModelRefcount-CHKuXiJY.js → ModelRefcount-BeuZdwWp.js} +1 -1
- package/dist/public/assets/NewProjectDialog-C1TVzOvJ.js +1 -0
- package/dist/public/assets/{NotebookWidget-CCRsiBIE.js → NotebookWidget-Bcavj7Lb.js} +2 -2
- package/dist/public/assets/PaneEditorBody-DRA4WG0A.js +284 -0
- package/dist/public/assets/{PdfViewer-BX025YLW.js → PdfViewer-Cr5306nr.js} +1 -1
- package/dist/public/assets/SettingsDialog-BvaE3Ue8.js +8 -0
- package/dist/public/assets/Terminal-Bo8hyZj7.js +67 -0
- package/dist/public/assets/Workspace-Bf2zQC6v.js +20 -0
- package/dist/public/assets/{api-BOuyloUi.js → api-B90WKMKj.js} +1 -1
- package/dist/public/assets/{auth-olLlgxc3.js → auth-CdosKReE.js} +1 -1
- package/dist/public/assets/{buffer-store-DIOiWz9q.js → buffer-store-Bh2IilxW.js} +3 -3
- package/dist/public/assets/{context-CSOKgBuW.js → context-CG70lLa4.js} +1 -1
- package/dist/public/assets/control-tray-CG26TqqQ.css +1 -0
- package/dist/public/assets/control-tray-c9uXOo-i.js +1 -0
- package/dist/public/assets/{cssMode-CSjHtANE.js → cssMode-C63oO3vc.js} +1 -1
- package/dist/public/assets/{editor.api2-4X9Vh9Zw.js → editor.api2-DTL_SiN1.js} +2 -2
- package/dist/public/assets/errors-tuvbq1a_.js +1 -0
- package/dist/public/assets/forward-link-BspnTVuc.js +1 -0
- package/dist/public/assets/{freemarker2-DsOTa0Uq.js → freemarker2-DKWtaCtp.js} +1 -1
- package/dist/public/assets/{handlebars-DGS-lUwt.js → handlebars-uU1ujPOt.js} +1 -1
- package/dist/public/assets/{html-eVYoRhea.js → html-CrP_wDJ5.js} +1 -1
- package/dist/public/assets/{htmlMode-CIHMS93l.js → htmlMode-lNJ18wA0.js} +1 -1
- package/dist/public/assets/index-4XrK4Fes.css +2 -0
- package/dist/public/assets/index-Doe7MhnI.js +10 -0
- package/dist/public/assets/{javascript-Cq9FwqGi.js → javascript-WHxEzdgn.js} +1 -1
- package/dist/public/assets/{jsonMode-BijgXT6I.js → jsonMode-xHnT5kRj.js} +1 -1
- package/dist/public/assets/{liquid-BcLxSFu3.js → liquid-B1ddyofJ.js} +1 -1
- package/dist/public/assets/{lspLanguageFeatures-x2nWJpem.js → lspLanguageFeatures-CCO_e4_t.js} +1 -1
- package/dist/public/assets/markdown-mermaid-TizVRNLQ.js +2 -0
- package/dist/public/assets/{mdx-BDgbCiou.js → mdx-m1X3FtyX.js} +1 -1
- package/dist/public/assets/media-refresh-store-CiyvSvEu.js +1 -0
- package/dist/public/assets/{monaco.contribution-C0TYpF88.js → monaco.contribution-BXkMDWX9.js} +2 -2
- package/dist/public/assets/notification-delivery-BZzMYzIP.css +1 -0
- package/dist/public/assets/notification-delivery-CegOQxcZ.js +1 -0
- package/dist/public/assets/{protocol-support-BApsXw77.js → protocol-support-TSI4Ig6W.js} +1 -1
- package/dist/public/assets/{python-D5mUty3a.js → python-CRTN4ovU.js} +1 -1
- package/dist/public/assets/{razor-DAAn8j2s.js → razor-Cj7Cr6Fr.js} +1 -1
- package/dist/public/assets/{scroll-restoration-CwXbvZvT.js → scroll-restoration-6GVbekSz.js} +1 -1
- package/dist/public/assets/{selection-actions-Cm0Oytya.js → selection-actions-CvYaucrm.js} +1 -1
- package/dist/public/assets/{session-order-2oedrwDu.js → session-order-CiDVvIU5.js} +1 -1
- package/dist/public/assets/{switch-OMx-_DY7.js → switch-oBD5uCTu.js} +1 -1
- package/dist/public/assets/theme-swfNLod9.js +1 -0
- package/dist/public/assets/{tsMode-B7q3gz7a.js → tsMode-D0nEO9DL.js} +1 -1
- package/dist/public/assets/{typescript-DvKdOnR-.js → typescript-CQjjq4UE.js} +1 -1
- package/dist/public/assets/use-ui-state-D4FsRK2R.js +1 -0
- package/dist/public/assets/{view-state-store-Cy9sQJoZ.js → view-state-store-DbQ7YOPe.js} +1 -1
- package/dist/public/assets/{workers-Ck67TJT4.js → workers-m2qsiPbB.js} +1 -1
- package/dist/public/assets/ws-Cp1eCJaM.js +1 -0
- package/dist/public/assets/{xml-DDMTG7kD.js → xml-Ci2P6_gm.js} +1 -1
- package/dist/public/assets/{yaml-hCGJvPOb.js → yaml-76T3bIWj.js} +1 -1
- package/dist/public/index.html +4 -3
- package/dist/pudl.js +118 -75
- package/package.json +1 -1
- package/dist/public/assets/App-D-hMqX7b.js +0 -13
- package/dist/public/assets/Dashboard-C0AvtM5m.js +0 -1
- package/dist/public/assets/EditorTabClose-QgdaqA1X.js +0 -1
- package/dist/public/assets/LazyTerminal-Dp2CN0Y8.js +0 -2
- package/dist/public/assets/NewProjectDialog-DMixZDC_.js +0 -1
- package/dist/public/assets/PaneEditorBody-DD8UshBi.js +0 -284
- package/dist/public/assets/SettingsDialog-DgMm212x.js +0 -8
- package/dist/public/assets/Terminal-CYeh8_uU.js +0 -66
- package/dist/public/assets/Workspace-CrZkK55U.js +0 -20
- package/dist/public/assets/control-tray-CdoVaVhT.js +0 -1
- package/dist/public/assets/control-tray-DE2RhHP3.css +0 -1
- package/dist/public/assets/forward-link-DMvLf0Xw.js +0 -1
- package/dist/public/assets/hotkeys-Cu0t6sbz.js +0 -1
- package/dist/public/assets/index-BqOVeoIr.js +0 -10
- package/dist/public/assets/index-LpAqnBR3.css +0 -2
- package/dist/public/assets/markdown-mermaid-SyDYdSZz.js +0 -2
- package/dist/public/assets/media-refresh-store-NSkvkBxN.js +0 -1
- package/dist/public/assets/notification-delivery-BBt_CJ19.js +0 -1
- package/dist/public/assets/use-ui-state-DdnTFosh.js +0 -1
- package/dist/public/assets/ws-Dgc69_w8.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{i as n,n as r,o as i,r as a}from"./auth-CdosKReE.js";import{n as o}from"./dist-BOS6OKSE.js";var s=e(t(),1);function c(){return window.puddleDesktop}function l(){let[e,t]=(0,s.useState)({fullScreen:!1,animate:!1});return(0,s.useEffect)(()=>{let e=c();if(!e)return;let n=!0;e.isFullScreen?.()?.then(e=>{n&&t({fullScreen:e,animate:!1})});let r=e.onFullScreenChange?.(e=>t({fullScreen:e,animate:!0}));return()=>{n=!1,r?.()}},[]),e}var u=n(`puddle.profile-id`);function d(){let e=(0,s.useSyncExternalStore)(u.subscribe,u.get);return e!==null&&/^[0-9a-f]{10}$/.test(e)?e:null}function f(e){window.location.pathname!==`/`&&window.history.replaceState(null,``,`/`),u.set(e)}var p=[`Layout & tabs`,`Editor`,`Left sidebar`,`Right sidebar`],m=[{id:`host.peek`,label:`Show host identity (hold)`,group:`Layout & tabs`,defaultBinding:typeof navigator<`u`&&/Mac/.test(navigator.platform)?`alt+meta+Slash`:`ctrl+alt+Slash`,hold:!0},{id:`palette.toggle`,label:`Command palette`,group:`Layout & tabs`,defaultBinding:`meta+KeyK`},{id:`tab.close`,label:`Close current tab`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+KeyW`,desktopBinding:`meta+KeyW`},{id:`tab.reopen`,label:`Reopen last closed tab`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+KeyT`,desktopBinding:`shift+meta+KeyT`},{id:`tab.newUntitled`,label:`New untitled file`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+KeyN`,desktopBinding:`meta+KeyN`},{id:`tab.next`,label:`Next tab in pane`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+BracketRight`,desktopBinding:`ctrl+Tab`},{id:`tab.prev`,label:`Previous tab in pane`,group:`Layout & tabs`,defaultBinding:`ctrl+alt+BracketLeft`,desktopBinding:`ctrl+shift+Tab`},{id:`window.close`,label:`Close window`,group:`Layout & tabs`,defaultBinding:`meta+KeyW`,desktopBinding:`shift+meta+KeyW`},{id:`sidebar.left`,label:`Toggle left sidebar`,group:`Layout & tabs`,defaultBinding:`alt+meta+Comma`,desktopBinding:`meta+KeyB`},{id:`sidebar.right`,label:`Toggle right sidebar`,group:`Layout & tabs`,defaultBinding:`alt+meta+Period`,desktopBinding:`shift+meta+KeyB`},{id:`editor.save`,label:`Save`,group:`Editor`,defaultBinding:`meta+KeyS`,editor:!0},{id:`editor.wordWrap`,label:`Toggle word wrap`,group:`Editor`,defaultBinding:`alt+KeyZ`,editor:!0},{id:`nav.files`,label:`Open Files`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyE`},{id:`nav.search`,label:`Open Search`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyF`},{id:`nav.changes`,label:`Open Changes`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyV`},{id:`nav.worktrees`,label:`Open Worktrees`,group:`Left sidebar`,defaultBinding:`alt+meta+KeyB`},{id:`session.newAgent`,label:`New agent`,group:`Right sidebar`,defaultBinding:`ctrl+alt+Backquote`,desktopBinding:`meta+KeyT`},{id:`session.newTerminal`,label:`New terminal`,group:`Right sidebar`,defaultBinding:`ctrl+Backquote`},{id:`scratchpad.toggle`,label:`Toggle Scratchpad`,group:`Right sidebar`,defaultBinding:`alt+meta+KeyS`},{id:`layouts.toggle`,label:`Toggle Layouts`,group:`Right sidebar`,defaultBinding:`alt+meta+KeyL`}],h=new Map(m.map(e=>[e.id,e])),g=typeof window<`u`&&c()!==void 0;function _(e,t=g){return t&&e.desktopBinding?e.desktopBinding:e.defaultBinding}function v(e){let t=e.code;if(!t||/^(Control|Alt|Shift|Meta)(Left|Right)$/.test(t))return null;let n=[];return e.ctrlKey&&n.push(`ctrl`),e.altKey&&n.push(`alt`),e.shiftKey&&n.push(`shift`),e.metaKey&&n.push(`meta`),n.length===0?null:(n.push(t),n.join(`+`))}var y={ctrl:`⌃`,alt:`⌥`,shift:`⇧`,meta:`⌘`},b={Comma:`,`,Period:`.`,Backquote:"`",Slash:`/`,Backslash:`\\`,Minus:`-`,Equal:`=`,Space:`␣`,Enter:`↵`,Escape:`Esc`,Tab:`⇥`,BracketLeft:`[`,BracketRight:`]`};function x(e){return e.startsWith(`Key`)?e.slice(3):e.startsWith(`Digit`)?e.slice(5):b[e]??e}function S(e){if(!e)return`—`;let t=e.split(`+`),n=t.pop()??``;return t.map(e=>y[e]??e).join(``)+x(n)}var C=new Map;function w(e,t){return C.set(e,t),()=>{C.get(e)===t&&C.delete(e)}}var T=e=>C.get(e),E=e=>h.get(e);function D(e,t){return e.hold===!0||e.id===`editor.save`||t&&e.editor!==!0}var O={},k=new Set,A=j();function j(){let e={};for(let t of m)e[t.id]=O[t.id]||_(t);return e}function M(e){O=e??{},A=j(),k.forEach(e=>e())}var N=e=>A[e]??``;function P(e){for(let[t,n]of Object.entries(A))if(n===e)return t}function F(e){return S(I()[e]??``)}function I(){return(0,s.useSyncExternalStore)(e=>(k.add(e),()=>k.delete(e)),()=>A)}var L=500,R=1e4;function z(e,t){return`${e} ${t}`}var B=new class{ws=null;open=!1;backoff=L;reconnectTimer=null;theme=null;terminals=new Map;notificationListeners=new Set;statusListeners=new Set;renameListeners=new Set;accountListeners=new Set;switchListeners=new Set;sessionsChangedListeners=new Set;hostUpdatesListeners=new Set;connectionListeners=new Set;shellWaiters=new Map;attach(e,t,n,r,i){let a={session:e,term:t,cols:n,rows:r,handlers:i,ready:!1,live:!1,pendingResize:!1};return this.terminals.set(z(e,t),a),this.ensureConnected(),this.open&&this.send({t:`attach`,session:e,term:t,cols:n,rows:r}),()=>this.detach(e,t)}detach(e,t){this.terminals.delete(z(e,t))&&this.open&&this.send({t:`detach`,session:e,term:t})}write(e,t,n){this.open&&this.terminals.get(z(e,t))?.ready&&this.send({t:`stdin`,session:e,term:t,data:n})}resize(e,t,n,r){let i=this.terminals.get(z(e,t));i&&(i.cols=n,i.rows=r,this.open&&i.ready?this.send({t:`resize`,session:e,term:t,cols:n,rows:r}):i.pendingResize=!0)}spawnShell(e){return this.ensureConnected(),this.open?new Promise((t,n)=>{let r=this.shellWaiters.get(e)??[];r.push({resolve:t,reject:n}),this.shellWaiters.set(e,r),this.open&&this.send({t:`spawn-shell`,session:e})}):Promise.reject(Error(`Connection is unavailable`))}killShell(e,t){this.open&&this.send({t:`kill-shell`,session:e,term:t})}onStatus(e){return this.statusListeners.add(e),this.ensureConnected(),()=>this.statusListeners.delete(e)}onAgentNotification(e){return this.notificationListeners.add(e),this.ensureConnected(),()=>this.notificationListeners.delete(e)}onRenamed(e){return this.renameListeners.add(e),this.ensureConnected(),()=>this.renameListeners.delete(e)}onAccount(e){return this.accountListeners.add(e),this.ensureConnected(),()=>this.accountListeners.delete(e)}onSessionSwitched(e){return this.switchListeners.add(e),this.ensureConnected(),()=>this.switchListeners.delete(e)}onSessionsChanged(e){return this.sessionsChangedListeners.add(e),this.ensureConnected(),()=>this.sessionsChangedListeners.delete(e)}onConnectionChange(e){return this.connectionListeners.add(e),()=>this.connectionListeners.delete(e)}onHostUpdatesChanged(e){return this.hostUpdatesListeners.add(e),this.ensureConnected(),()=>this.hostUpdatesListeners.delete(e)}isConnected(){return this.open}reportTheme(e,t){this.theme&&this.theme.fg===e&&this.theme.bg===t||(this.theme={fg:e,bg:t},this.open&&this.send({t:`theme`,fg:e,bg:t}))}reset(){this.ws?.close()}switchHost(){let e=this.ws;this.ws=null,this.open=!1,this.reconnectTimer&&clearTimeout(this.reconnectTimer),this.reconnectTimer=null,this.terminals.clear();for(let e of this.shellWaiters.values())for(let t of e)t.reject(Error(`Host changed`));this.shellWaiters.clear(),e?.close();for(let e of this.connectionListeners)e(!1)}ensureConnected(){this.ws||this.reconnectTimer||this.connect()}connect(){let e=a.get(),t=i();if(!e&&!t)return;let n=window.location.protocol===`https:`?`wss`:`ws`,o=t?t.socket():new WebSocket(`${n}://${window.location.host}/ws`);this.ws=o,o.addEventListener(`open`,()=>{if(this.ws!==o){o.close();return}t||o.send(JSON.stringify({t:`auth`,token:e}))}),o.addEventListener(`message`,e=>{if(this.ws!==o)return;let t;try{t=JSON.parse(String(e.data))}catch{return}if(t.t===`authenticated`){if(this.open)return;this.open=!0,this.backoff=L,this.send({t:`subscribe-status`}),this.theme&&this.send({t:`theme`,...this.theme});for(let e of this.terminals.values()){e.ready=!1,e.pendingResize=!1;let{session:t,term:n,cols:r,rows:i}=e;this.send({t:`attach`,session:t,term:n,cols:r,rows:i})}for(let e of this.connectionListeners)e(!0)}else this.open&&this.handle(t)}),o.addEventListener(`close`,e=>{if(this.ws!==o)return;let t=this.open;this.open=!1,this.ws=null;for(let e of this.shellWaiters.values())for(let t of e)t.reject(Error(`Connection lost; operation outcome is unknown`));if(this.shellWaiters.clear(),t)for(let e of this.connectionListeners)e(!1);if(e.code===4401&&e.reason===`browser_rejected`){r();return}this.scheduleReconnect()})}scheduleReconnect(){this.reconnectTimer||this.terminals.size===0&&this.statusListeners.size===0&&this.notificationListeners.size===0&&this.renameListeners.size===0&&this.accountListeners.size===0&&this.switchListeners.size===0&&this.sessionsChangedListeners.size===0||(this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},this.backoff),this.backoff=Math.min(this.backoff*2,R))}send(e){this.open&&this.ws?.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(e))}handle(e){switch(e.t){case`agent-notification`:for(let t of this.notificationListeners)t(e);break;case`replay`:{let t=this.terminals.get(z(e.session,e.term));if(!t)break;if(t.ready=!0,t.pendingResize){t.pendingResize=!1;let{session:e,term:n,cols:r,rows:i}=t;this.send({t:`resize`,session:e,term:n,cols:r,rows:i})}t.handlers.onData(e.data,e.t);break}case`output`:this.terminals.get(z(e.session,e.term))?.handlers.onData(e.data,e.t);break;case`exit`:{let t=this.terminals.get(z(e.session,e.term));t&&(t.ready=!1,t.handlers.onExit?.(e.code)),e.term===`agent`&&t&&(t.live=!1);break}case`status`:{let t=[`starting`,`running`,`waiting_input`].includes(e.status);for(let n of this.terminals.values())if(!(n.session!==e.session||n.term!==`agent`)){if(t&&!n.live){n.ready=!1,n.pendingResize=!1;let{session:e,term:t,cols:r,rows:i}=n;this.send({t:`attach`,session:e,term:t,cols:r,rows:i})}n.live=t}for(let t of this.statusListeners)t({session:e.session,status:e.status,last_activity_at:e.last_activity_at});break}case`renamed`:for(let t of this.renameListeners)t({session:e.session,title:e.title,agent_title:e.agent_title,osc_title:e.osc_title});break;case`account`:for(let t of this.accountListeners)t({account_id:e.account_id,profile_id:e.profile_id,logged_in:e.logged_in});break;case`session-switched`:for(let t of this.switchListeners)t(e);break;case`sessions-changed`:for(let t of this.sessionsChangedListeners)t(e);break;case`host-updates-changed`:for(let e of this.hostUpdatesListeners)e();break;case`shell-spawned`:{let t=this.shellWaiters.get(e.session)?.shift();t&&t.resolve(e.term);break}case`notice`:(e.level===`warning`?o.warning:o.error)(e.title,{...e.detail===void 0?{}:{description:e.detail},duration:12e3});break;case`error`:o.error(`Connection error`,{description:e.message});break}}};export{f as _,v as a,l as b,T as c,w as d,M as f,u as g,F as h,P as i,N as l,I as m,m as n,S as o,_ as p,p as r,E as s,B as t,D as u,d as v,c as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e}from"./editor.api2-
|
|
1
|
+
import{h as e}from"./editor.api2-DTL_SiN1.js";var t={comments:{blockComment:[`<!--`,`-->`]},brackets:[[`<`,`>`]],autoClosingPairs:[{open:`<`,close:`>`},{open:`'`,close:`'`},{open:`"`,close:`"`}],surroundingPairs:[{open:`<`,close:`>`},{open:`'`,close:`'`},{open:`"`,close:`"`}],onEnterRules:[{beforeText:RegExp(`<([_:\\w][_:\\w-.\\d]*)([^/>]*(?!/)>)[^<]*$`,`i`),afterText:/^<\/([_:\w][_:\w-.\d]*)\s*>$/i,action:{indentAction:e.IndentAction.IndentOutdent}},{beforeText:RegExp(`<(\\w[\\w\\d]*)([^/>]*(?!/)>)[^<]*$`,`i`),action:{indentAction:e.IndentAction.Indent}}]},n={defaultToken:``,tokenPostfix:`.xml`,ignoreCase:!0,qualifiedName:/(?:[\w\.\-]+:)?[\w\.\-]+/,tokenizer:{root:[[/[^<&]+/,``],{include:`@whitespace`},[/(<)(@qualifiedName)/,[{token:`delimiter`},{token:`tag`,next:`@tag`}]],[/(<\/)(@qualifiedName)(\s*)(>)/,[{token:`delimiter`},{token:`tag`},``,{token:`delimiter`}]],[/(<\?)(@qualifiedName)/,[{token:`delimiter`},{token:`metatag`,next:`@tag`}]],[/(<\!)(@qualifiedName)/,[{token:`delimiter`},{token:`metatag`,next:`@tag`}]],[/<\!\[CDATA\[/,{token:`delimiter.cdata`,next:`@cdata`}],[/&\w+;/,`string.escape`]],cdata:[[/[^\]]+/,``],[/\]\]>/,{token:`delimiter.cdata`,next:`@pop`}],[/\]/,``]],tag:[[/[ \t\r\n]+/,``],[/(@qualifiedName)(\s*=\s*)("[^"]*"|'[^']*')/,[`attribute.name`,``,`attribute.value`]],[/(@qualifiedName)(\s*=\s*)("[^">?\/]*|'[^'>?\/]*)(?=[\?\/]\>)/,[`attribute.name`,``,`attribute.value`]],[/(@qualifiedName)(\s*=\s*)("[^">]*|'[^'>]*)/,[`attribute.name`,``,`attribute.value`]],[/@qualifiedName/,`attribute.name`],[/\?>/,{token:`delimiter`,next:`@pop`}],[/(\/)(>)/,[{token:`tag`},{token:`delimiter`,next:`@pop`}]],[/>/,{token:`delimiter`,next:`@pop`}]],whitespace:[[/[ \t\r\n]+/,``],[/<!--/,{token:`comment`,next:`@comment`}]],comment:[[/[^<\-]+/,`comment.content`],[/-->/,{token:`comment`,next:`@pop`}],[/<!--/,`comment.content.invalid`],[/[<\-]/,`comment.content`]]}};export{t as conf,n as language};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e}from"./editor.api2-
|
|
1
|
+
import{h as e}from"./editor.api2-DTL_SiN1.js";var t={comments:{lineComment:`#`},brackets:[[`{`,`}`],[`[`,`]`],[`(`,`)`]],autoClosingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`(`,close:`)`},{open:`"`,close:`"`},{open:`'`,close:`'`}],surroundingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`(`,close:`)`},{open:`"`,close:`"`},{open:`'`,close:`'`}],folding:{offSide:!0},onEnterRules:[{beforeText:/:\s*$/,action:{indentAction:e.IndentAction.Indent}}]},n={tokenPostfix:`.yaml`,brackets:[{token:`delimiter.bracket`,open:`{`,close:`}`},{token:`delimiter.square`,open:`[`,close:`]`}],keywords:[`true`,`True`,`TRUE`,`false`,`False`,`FALSE`,`null`,`Null`,`Null`,`~`],numberInteger:/(?:0|[+-]?[0-9]+)/,numberFloat:/(?:0|[+-]?[0-9]+)(?:\.[0-9]+)?(?:e[-+][1-9][0-9]*)?/,numberOctal:/0o[0-7]+/,numberHex:/0x[0-9a-fA-F]+/,numberInfinity:/[+-]?\.(?:inf|Inf|INF)/,numberNaN:/\.(?:nan|Nan|NAN)/,numberDate:/\d{4}-\d\d-\d\d([Tt ]\d\d:\d\d:\d\d(\.\d+)?(( ?[+-]\d\d?(:\d\d)?)|Z)?)?/,escapes:/\\(?:[btnfr\\"']|[0-7][0-7]?|[0-3][0-7]{2})/,tokenizer:{root:[{include:`@whitespace`},{include:`@comment`},[/%[^ ]+.*$/,`meta.directive`],[/---/,`operators.directivesEnd`],[/\.{3}/,`operators.documentEnd`],[/[-?:](?= )/,`operators`],{include:`@anchor`},{include:`@tagHandle`},{include:`@flowCollections`},{include:`@blockStyle`},[/@numberInteger(?![ \t]*\S+)/,`number`],[/@numberFloat(?![ \t]*\S+)/,`number.float`],[/@numberOctal(?![ \t]*\S+)/,`number.octal`],[/@numberHex(?![ \t]*\S+)/,`number.hex`],[/@numberInfinity(?![ \t]*\S+)/,`number.infinity`],[/@numberNaN(?![ \t]*\S+)/,`number.nan`],[/@numberDate(?![ \t]*\S+)/,`number.date`],[/(".*?"|'.*?'|[^#'"]*?)([ \t]*)(:)( |$)/,[`type`,`white`,`operators`,`white`]],{include:`@flowScalars`},[/.+?(?=(\s+#|$))/,{cases:{"@keywords":`keyword`,"@default":`string`}}]],object:[{include:`@whitespace`},{include:`@comment`},[/\}/,`@brackets`,`@pop`],[/,/,`delimiter.comma`],[/:(?= )/,`operators`],[/(?:".*?"|'.*?'|[^,\{\[]+?)(?=: )/,`type`],{include:`@flowCollections`},{include:`@flowScalars`},{include:`@tagHandle`},{include:`@anchor`},{include:`@flowNumber`},[/[^\},]+/,{cases:{"@keywords":`keyword`,"@default":`string`}}]],array:[{include:`@whitespace`},{include:`@comment`},[/\]/,`@brackets`,`@pop`],[/,/,`delimiter.comma`],{include:`@flowCollections`},{include:`@flowScalars`},{include:`@tagHandle`},{include:`@anchor`},{include:`@flowNumber`},[/[^\],]+/,{cases:{"@keywords":`keyword`,"@default":`string`}}]],multiString:[[/^( +).+$/,`string`,`@multiStringContinued.$1`]],multiStringContinued:[[/^( *).+$/,{cases:{"$1==$S2":`string`,"@default":{token:`@rematch`,next:`@popall`}}}]],whitespace:[[/[ \t\r\n]+/,`white`]],comment:[[/#.*$/,`comment`]],flowCollections:[[/\[/,`@brackets`,`@array`],[/\{/,`@brackets`,`@object`]],flowScalars:[[/"([^"\\]|\\.)*$/,`string.invalid`],[/'([^'\\]|\\.)*$/,`string.invalid`],[/'[^']*'/,`string`],[/"/,`string`,`@doubleQuotedString`]],doubleQuotedString:[[/[^\\"]+/,`string`],[/@escapes/,`string.escape`],[/\\./,`string.escape.invalid`],[/"/,`string`,`@pop`]],blockStyle:[[/[>|][0-9]*[+-]?$/,`operators`,`@multiString`]],flowNumber:[[/@numberInteger(?=[ \t]*[,\]\}])/,`number`],[/@numberFloat(?=[ \t]*[,\]\}])/,`number.float`],[/@numberOctal(?=[ \t]*[,\]\}])/,`number.octal`],[/@numberHex(?=[ \t]*[,\]\}])/,`number.hex`],[/@numberInfinity(?=[ \t]*[,\]\}])/,`number.infinity`],[/@numberNaN(?=[ \t]*[,\]\}])/,`number.nan`],[/@numberDate(?=[ \t]*[,\]\}])/,`number.date`]],tagHandle:[[/\![^ ]*/,`tag`]],anchor:[[/[&*][^ ]+/,`namespace`]]}};export{t as conf,n as language};
|
package/dist/public/index.html
CHANGED
|
@@ -47,15 +47,16 @@
|
|
|
47
47
|
// Storage disabled or unreadable: the module's own init still runs.
|
|
48
48
|
}
|
|
49
49
|
</script>
|
|
50
|
-
<script type="module" crossorigin src="/assets/index-
|
|
50
|
+
<script type="module" crossorigin src="/assets/index-Doe7MhnI.js"></script>
|
|
51
51
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-QTnfLwEv.js">
|
|
52
52
|
<link rel="modulepreload" crossorigin href="/assets/react-CZI7_Jkm.js">
|
|
53
53
|
<link rel="modulepreload" crossorigin href="/assets/react-dom-cJyBB_A4.js">
|
|
54
|
-
<link rel="modulepreload" crossorigin href="/assets/auth-
|
|
54
|
+
<link rel="modulepreload" crossorigin href="/assets/auth-CdosKReE.js">
|
|
55
55
|
<link rel="modulepreload" crossorigin href="/assets/client-settings-DhfHheKR.js">
|
|
56
|
+
<link rel="modulepreload" crossorigin href="/assets/theme-swfNLod9.js">
|
|
56
57
|
<link rel="modulepreload" crossorigin href="/assets/jsx-runtime-By8HlURe.js">
|
|
57
58
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-Czpn1I53.js">
|
|
58
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
59
|
+
<link rel="stylesheet" crossorigin href="/assets/index-4XrK4Fes.css">
|
|
59
60
|
</head>
|
|
60
61
|
<body>
|
|
61
62
|
<div id="root"></div>
|
package/dist/pudl.js
CHANGED
|
@@ -14,7 +14,7 @@ import { parseArgs } from "node:util";
|
|
|
14
14
|
import { setTimeout as delay } from "node:timers/promises";
|
|
15
15
|
|
|
16
16
|
// ../shared/src/protocol.ts
|
|
17
|
-
var PROTOCOL_VERSION = { major: 26, minor:
|
|
17
|
+
var PROTOCOL_VERSION = { major: 26, minor: 3 };
|
|
18
18
|
function supportsApplicationFeature(peer, introduced, client = PROTOCOL_VERSION) {
|
|
19
19
|
return peer?.major === client.major && (peer.major > introduced.major || peer.major === introduced.major && peer.minor >= introduced.minor);
|
|
20
20
|
}
|
|
@@ -14759,10 +14759,15 @@ function hostUpdateTerminal(phase) {
|
|
|
14759
14759
|
|
|
14760
14760
|
// ../shared/src/installation/catalogue.ts
|
|
14761
14761
|
var releaseRepositorySchema = external_exports.string().max(201).regex(/^[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9_.-]+$/).refine((value) => ![".", ".."].includes(value.split("/")[1]));
|
|
14762
|
+
var availableRelease = external_exports.object({
|
|
14763
|
+
version: external_exports.string().max(64).regex(/^[0-9]+\.[0-9]+\.[0-9]+$/),
|
|
14764
|
+
host_asset: external_exports.boolean()
|
|
14765
|
+
}).strict();
|
|
14762
14766
|
var timestamp2 = external_exports.number().int().nonnegative().safe();
|
|
14763
14767
|
var hostReleaseCheckSchema = external_exports.object({
|
|
14764
14768
|
repository: releaseRepositorySchema.nullable(),
|
|
14765
14769
|
state: external_exports.enum(["unconfigured", "checking", "ready", "failed"]),
|
|
14770
|
+
components: external_exports.object({ daemon: availableRelease, runtime: availableRelease }).strict().optional(),
|
|
14766
14771
|
checked_at: timestamp2.nullable(),
|
|
14767
14772
|
succeeded_at: timestamp2.nullable(),
|
|
14768
14773
|
latest: external_exports.object({
|
|
@@ -14803,7 +14808,8 @@ var hostUpdateCommandSchema = external_exports.discriminatedUnion("action", [
|
|
|
14803
14808
|
/** Recorded continuation metadata, capability-detected from application 25.12. */
|
|
14804
14809
|
include_recovery: external_exports.literal(true).optional(),
|
|
14805
14810
|
/** Host-wide versions and coalesced release discovery (25.14), never admission evidence. */
|
|
14806
|
-
include_catalogue: external_exports.literal(true).optional()
|
|
14811
|
+
include_catalogue: external_exports.literal(true).optional(),
|
|
14812
|
+
include_component_releases: external_exports.literal(true).optional()
|
|
14807
14813
|
}).strict().refine(
|
|
14808
14814
|
(command) => !command.adoption_nonce || command.id !== void 0,
|
|
14809
14815
|
"Adoption inspection requires an exact operation"
|
|
@@ -15032,6 +15038,9 @@ var sessionDefaultsSchema = external_exports.looseObject({
|
|
|
15032
15038
|
terminal: sessionSeedSchema.optional()
|
|
15033
15039
|
});
|
|
15034
15040
|
var profileSettingsSchema = external_exports.looseObject({
|
|
15041
|
+
/** Host identity for this profile on this daemon; deliberately excluded from sync. */
|
|
15042
|
+
hostIcon: external_exports.string().max(64).nullable().optional(),
|
|
15043
|
+
hostColour: external_exports.enum(PROFILE_ICON_COLOURS).nullable().optional(),
|
|
15035
15044
|
allowSkipPermissions: external_exports.boolean().default(false),
|
|
15036
15045
|
/**
|
|
15037
15046
|
* Captured session environment (SPEC §4): whether this profile's session
|
|
@@ -16159,7 +16168,7 @@ var cockpitHostUpdateRequestSchema = external_exports.discriminatedUnion("action
|
|
|
16159
16168
|
...onlineHostUpdateRequestSchema.options,
|
|
16160
16169
|
external_exports.object({ action: external_exports.literal("continue-offline"), reference: hostUpdateReferenceSchema }).strict()
|
|
16161
16170
|
]);
|
|
16162
|
-
var cockpitHostUpdateQuerySchema = external_exports.object({ id: external_exports.uuid().optional() }).strict();
|
|
16171
|
+
var cockpitHostUpdateQuerySchema = external_exports.object({ id: external_exports.uuid().optional(), components: external_exports.literal("1").optional() }).strict();
|
|
16163
16172
|
var operation = hostUpdateOperationSchema.shape;
|
|
16164
16173
|
var cockpitHostUpdateOperationSchema = external_exports.object({
|
|
16165
16174
|
id: operation.id,
|
|
@@ -16205,7 +16214,11 @@ var cockpitHostUpdateStatusSchema = external_exports.object({
|
|
|
16205
16214
|
|
|
16206
16215
|
// ../shared/src/api/connection/host-maintenance.ts
|
|
16207
16216
|
var hostMaintenanceCommandSchema = external_exports.discriminatedUnion("action", [
|
|
16208
|
-
external_exports.object({
|
|
16217
|
+
external_exports.object({
|
|
16218
|
+
action: external_exports.literal("status"),
|
|
16219
|
+
id: external_exports.uuid().optional(),
|
|
16220
|
+
include_component_releases: external_exports.literal(true).optional()
|
|
16221
|
+
}).strict(),
|
|
16209
16222
|
...onlineHostUpdateRequestSchema.options
|
|
16210
16223
|
]);
|
|
16211
16224
|
var hostMaintenanceReplySchema = external_exports.discriminatedUnion("kind", [
|
|
@@ -16947,10 +16960,22 @@ var notebookExecutionSchema = external_exports.object({
|
|
|
16947
16960
|
input: notebookInputSchema.optional(),
|
|
16948
16961
|
error: external_exports.string().max(32768).optional()
|
|
16949
16962
|
});
|
|
16950
|
-
var
|
|
16963
|
+
var notebookRevisionSchema = external_exports.object({
|
|
16964
|
+
id: external_exports.string().uuid(),
|
|
16965
|
+
revision: external_exports.number().int().nonnegative()
|
|
16966
|
+
}).nullable();
|
|
16967
|
+
var notebookExecutionRequestSchema = external_exports.object({
|
|
16968
|
+
source: compilationFileTargetSchema,
|
|
16969
|
+
/** Opt in to an unchanged reply; omission always asks for a full snapshot. */
|
|
16970
|
+
known: notebookRevisionSchema.optional()
|
|
16971
|
+
});
|
|
16951
16972
|
var notebookExecutionResponseSchema = external_exports.object({
|
|
16952
16973
|
execution: notebookExecutionSchema.nullable()
|
|
16953
16974
|
});
|
|
16975
|
+
var notebookObservationResponseSchema = external_exports.union([
|
|
16976
|
+
notebookExecutionResponseSchema,
|
|
16977
|
+
external_exports.object({ unchanged: external_exports.literal(true) })
|
|
16978
|
+
]);
|
|
16954
16979
|
var notebookInputReplySchema = external_exports.object({
|
|
16955
16980
|
source: compilationFileTargetSchema,
|
|
16956
16981
|
run_id: external_exports.string().uuid(),
|
|
@@ -17855,6 +17880,39 @@ var hostReleaseCapabilitiesSchema = external_exports.object({
|
|
|
17855
17880
|
database_schema_version: external_exports.number().int().nonnegative().max(2 ** 31 - 1).optional()
|
|
17856
17881
|
}).strict();
|
|
17857
17882
|
|
|
17883
|
+
// ../shared/src/installation/release-manifest.ts
|
|
17884
|
+
var releaseVersionSchema = external_exports.string().max(64).regex(/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$/);
|
|
17885
|
+
var releaseComponentSchema = external_exports.enum(["cockpit", "daemon", "runtime"]);
|
|
17886
|
+
var releaseManifestSchema = external_exports.object({
|
|
17887
|
+
format: external_exports.literal(1),
|
|
17888
|
+
version: releaseVersionSchema,
|
|
17889
|
+
components: external_exports.object({
|
|
17890
|
+
cockpit: releaseVersionSchema,
|
|
17891
|
+
daemon: releaseVersionSchema,
|
|
17892
|
+
runtime: releaseVersionSchema
|
|
17893
|
+
}).strict()
|
|
17894
|
+
}).strict().superRefine((manifest, context) => {
|
|
17895
|
+
if (![manifest.version, ...Object.values(manifest.components)].every(
|
|
17896
|
+
(version2) => releaseVersionSchema.safeParse(version2).success
|
|
17897
|
+
))
|
|
17898
|
+
return;
|
|
17899
|
+
for (const [component2, version2] of Object.entries(manifest.components)) {
|
|
17900
|
+
if (compareReleaseVersions(version2, manifest.version) > 0)
|
|
17901
|
+
context.addIssue({ code: "custom", message: `${component2} points beyond its release` });
|
|
17902
|
+
}
|
|
17903
|
+
if (manifest.components.cockpit !== manifest.version)
|
|
17904
|
+
context.addIssue({ code: "custom", message: "Every release publishes its cockpit" });
|
|
17905
|
+
});
|
|
17906
|
+
function compareReleaseVersions(a, b) {
|
|
17907
|
+
const left = a.split(".").map(BigInt);
|
|
17908
|
+
const right = b.split(".").map(BigInt);
|
|
17909
|
+
for (let i = 0; i < 3; i++) {
|
|
17910
|
+
if (left[i] < right[i]) return -1;
|
|
17911
|
+
if (left[i] > right[i]) return 1;
|
|
17912
|
+
}
|
|
17913
|
+
return 0;
|
|
17914
|
+
}
|
|
17915
|
+
|
|
17858
17916
|
// ../shared/src/installation/removal/services.ts
|
|
17859
17917
|
var service = hostServiceReplacementSchema.shape;
|
|
17860
17918
|
var target = external_exports.object({ kind: service.kind, name: service.name, domain: service.domain }).strict();
|
|
@@ -18069,6 +18127,18 @@ var hostPurgeApplySchema = external_exports.object({
|
|
|
18069
18127
|
attempt_id: external_exports.uuid()
|
|
18070
18128
|
}).strict();
|
|
18071
18129
|
|
|
18130
|
+
// ../shared/src/node/releases/github.ts
|
|
18131
|
+
var assetSchema = external_exports.object({
|
|
18132
|
+
name: external_exports.string().min(1).max(256),
|
|
18133
|
+
browser_download_url: external_exports.string().max(2048).url().refine((value) => value.startsWith("https://"))
|
|
18134
|
+
});
|
|
18135
|
+
var releaseSchema = external_exports.object({
|
|
18136
|
+
tag_name: external_exports.string().max(129).regex(/^v?[0-9]+\.[0-9]+\.[0-9]+$/),
|
|
18137
|
+
draft: external_exports.literal(false).optional(),
|
|
18138
|
+
prerelease: external_exports.literal(false).optional(),
|
|
18139
|
+
assets: external_exports.array(assetSchema).max(1024).default([])
|
|
18140
|
+
});
|
|
18141
|
+
|
|
18072
18142
|
// ../shared/src/node/control/update-authority.ts
|
|
18073
18143
|
var HostUpdateOnlyScope = class {
|
|
18074
18144
|
outgoing;
|
|
@@ -18233,18 +18303,6 @@ import { execFile } from "node:child_process";
|
|
|
18233
18303
|
import { promisify } from "node:util";
|
|
18234
18304
|
var execute = promisify(execFile);
|
|
18235
18305
|
|
|
18236
|
-
// ../shared/src/node/releases/github.ts
|
|
18237
|
-
var assetSchema = external_exports.object({
|
|
18238
|
-
name: external_exports.string().min(1).max(256),
|
|
18239
|
-
browser_download_url: external_exports.string().max(2048).url().refine((value) => value.startsWith("https://"))
|
|
18240
|
-
});
|
|
18241
|
-
var releaseSchema = external_exports.object({
|
|
18242
|
-
tag_name: external_exports.string().max(129).regex(/^v?[0-9]+\.[0-9]+\.[0-9]+$/),
|
|
18243
|
-
draft: external_exports.literal(false).optional(),
|
|
18244
|
-
prerelease: external_exports.literal(false).optional(),
|
|
18245
|
-
assets: external_exports.array(assetSchema).max(1024).default([])
|
|
18246
|
-
});
|
|
18247
|
-
|
|
18248
18306
|
// ../shared/src/node/control/requests.ts
|
|
18249
18307
|
import { randomUUID } from "node:crypto";
|
|
18250
18308
|
var HOST_CONTROL_REQUEST_LIMITS = {
|
|
@@ -18625,6 +18683,43 @@ var hostPaths = {
|
|
|
18625
18683
|
pid: `${HOST_HOME}/puddled.pid`
|
|
18626
18684
|
};
|
|
18627
18685
|
|
|
18686
|
+
// src/lib/transport/exec-output.ts
|
|
18687
|
+
var STDERR_TAIL_LENGTH = 64 * 1024;
|
|
18688
|
+
function collectExecOutput(child, opts) {
|
|
18689
|
+
return new Promise((resolve2) => {
|
|
18690
|
+
let stdout = "";
|
|
18691
|
+
let stderr = "";
|
|
18692
|
+
const appendStderr = (text2) => {
|
|
18693
|
+
stderr += text2;
|
|
18694
|
+
if (opts.capture === "stream") stderr = stderr.slice(-STDERR_TAIL_LENGTH);
|
|
18695
|
+
};
|
|
18696
|
+
let timer;
|
|
18697
|
+
if (opts.timeoutMs !== void 0) {
|
|
18698
|
+
timer = setTimeout(() => child.kill("SIGKILL"), opts.timeoutMs);
|
|
18699
|
+
timer.unref();
|
|
18700
|
+
}
|
|
18701
|
+
child.stdout.setEncoding("utf8");
|
|
18702
|
+
child.stderr.setEncoding("utf8");
|
|
18703
|
+
child.stdout.on("data", (text2) => {
|
|
18704
|
+
if (opts.capture !== "stream") stdout += text2;
|
|
18705
|
+
opts.onStdout?.(text2);
|
|
18706
|
+
});
|
|
18707
|
+
child.stderr.on("data", appendStderr);
|
|
18708
|
+
child.on("error", (err) => {
|
|
18709
|
+
if (timer) clearTimeout(timer);
|
|
18710
|
+
appendStderr(String(err));
|
|
18711
|
+
resolve2({ code: -1, stdout, stderr });
|
|
18712
|
+
});
|
|
18713
|
+
child.on("close", (code) => {
|
|
18714
|
+
if (timer) clearTimeout(timer);
|
|
18715
|
+
resolve2({ code: code ?? -1, stdout, stderr });
|
|
18716
|
+
});
|
|
18717
|
+
child.stdin.on("error", () => {
|
|
18718
|
+
});
|
|
18719
|
+
child.stdin.end(opts.stdin);
|
|
18720
|
+
});
|
|
18721
|
+
}
|
|
18722
|
+
|
|
18628
18723
|
// src/lib/transport/ssh.ts
|
|
18629
18724
|
var SshTransport = class {
|
|
18630
18725
|
constructor(host, opts = {}) {
|
|
@@ -18746,37 +18841,11 @@ var SshTransport = class {
|
|
|
18746
18841
|
});
|
|
18747
18842
|
}
|
|
18748
18843
|
exec(command, opts = {}) {
|
|
18749
|
-
|
|
18750
|
-
|
|
18751
|
-
|
|
18752
|
-
env: this.spawnEnv()
|
|
18753
|
-
});
|
|
18754
|
-
let stdout = "";
|
|
18755
|
-
let stderr = "";
|
|
18756
|
-
let timer;
|
|
18757
|
-
if (opts.timeoutMs !== void 0) {
|
|
18758
|
-
timer = setTimeout(() => child.kill("SIGKILL"), opts.timeoutMs);
|
|
18759
|
-
timer.unref();
|
|
18760
|
-
}
|
|
18761
|
-
child.stdout.on("data", (chunk) => {
|
|
18762
|
-
const text2 = chunk.toString();
|
|
18763
|
-
stdout += text2;
|
|
18764
|
-
opts.onStdout?.(text2);
|
|
18765
|
-
});
|
|
18766
|
-
child.stderr.on("data", (chunk) => stderr += chunk.toString());
|
|
18767
|
-
child.on("error", (err) => {
|
|
18768
|
-
if (timer) clearTimeout(timer);
|
|
18769
|
-
resolve2({ code: -1, stdout, stderr: stderr + String(err) });
|
|
18770
|
-
});
|
|
18771
|
-
child.on("close", (code) => {
|
|
18772
|
-
if (timer) clearTimeout(timer);
|
|
18773
|
-
resolve2({ code: code ?? -1, stdout, stderr });
|
|
18774
|
-
});
|
|
18775
|
-
child.stdin.on("error", () => {
|
|
18776
|
-
});
|
|
18777
|
-
if (opts.stdin !== void 0) child.stdin.end(opts.stdin);
|
|
18778
|
-
else child.stdin.end();
|
|
18844
|
+
const child = spawn(this.ssh, this.args(this.host, "--", `sh -c ${shellQuote(command)}`), {
|
|
18845
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
18846
|
+
env: this.spawnEnv()
|
|
18779
18847
|
});
|
|
18848
|
+
return collectExecOutput(child, opts);
|
|
18780
18849
|
}
|
|
18781
18850
|
/**
|
|
18782
18851
|
* Run a command through a live SSH channel instead of waiting for a detached
|
|
@@ -18973,34 +19042,8 @@ var LocalTransport = class {
|
|
|
18973
19042
|
kind = "local";
|
|
18974
19043
|
label = "this machine";
|
|
18975
19044
|
exec(command, opts = {}) {
|
|
18976
|
-
|
|
18977
|
-
|
|
18978
|
-
let stdout = "";
|
|
18979
|
-
let stderr = "";
|
|
18980
|
-
let timer;
|
|
18981
|
-
if (opts.timeoutMs !== void 0) {
|
|
18982
|
-
timer = setTimeout(() => child.kill("SIGKILL"), opts.timeoutMs);
|
|
18983
|
-
timer.unref();
|
|
18984
|
-
}
|
|
18985
|
-
child.stdout.on("data", (chunk) => {
|
|
18986
|
-
const text2 = chunk.toString();
|
|
18987
|
-
stdout += text2;
|
|
18988
|
-
opts.onStdout?.(text2);
|
|
18989
|
-
});
|
|
18990
|
-
child.stderr.on("data", (chunk) => stderr += chunk.toString());
|
|
18991
|
-
child.on("error", (err) => {
|
|
18992
|
-
if (timer) clearTimeout(timer);
|
|
18993
|
-
resolve2({ code: -1, stdout, stderr: stderr + String(err) });
|
|
18994
|
-
});
|
|
18995
|
-
child.on("close", (code) => {
|
|
18996
|
-
if (timer) clearTimeout(timer);
|
|
18997
|
-
resolve2({ code: code ?? -1, stdout, stderr });
|
|
18998
|
-
});
|
|
18999
|
-
child.stdin.on("error", () => {
|
|
19000
|
-
});
|
|
19001
|
-
if (opts.stdin !== void 0) child.stdin.end(opts.stdin);
|
|
19002
|
-
else child.stdin.end();
|
|
19003
|
-
});
|
|
19045
|
+
const child = spawn2("sh", ["-c", command], { stdio: ["pipe", "pipe", "pipe"] });
|
|
19046
|
+
return collectExecOutput(child, opts);
|
|
19004
19047
|
}
|
|
19005
19048
|
readFile(path2) {
|
|
19006
19049
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@puddle-code/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "puddle \u2014 self-hosted orchestrator for CLI coding agents: serves the cockpit UI and connects it to local or SSH hosts.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/PerceptronV/puddle-code#readme",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ReleaseNotesDialog-CbFYKoYM.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-By8HlURe.js","assets/purify.es-D8QhFVkO.js","assets/dialog-D-Axqpzg.js","assets/react-dom-cJyBB_A4.js","assets/x-Dq6POV20.js","assets/createLucideIcon-C9A1vLE-.js","assets/dialog-BX0tebJL.css","assets/queue-BlrQxHDl.js","assets/markdown-it-CWoG9_Dn.js","assets/markdown-CMSzQtLp.js","assets/math-CSw6sgCC.js","assets/math-delimiters-BCnTi7Ii.js","assets/SettingsDialog-DgMm212x.js","assets/protocol-support-BApsXw77.js","assets/auth-olLlgxc3.js","assets/api-BOuyloUi.js","assets/LazyTerminal-Dp2CN0Y8.js","assets/preload-helper-Czpn1I53.js","assets/chevron-right-BEy-IXEZ.js","assets/notification-delivery-BBt_CJ19.js","assets/hotkeys-Cu0t6sbz.js","assets/switch-OMx-_DY7.js","assets/dist-Dge3wHdO.js","assets/ws-Dgc69_w8.js","assets/dist-BOS6OKSE.js","assets/client-settings-DhfHheKR.js","assets/index-BqOVeoIr.js","assets/index-LpAqnBR3.css","assets/button-C_Rvtcwg.js","assets/select-p5KTVHbg.js","assets/chevron-down-HQLVE6o5.js","assets/dist-Cq-O0n8n.js","assets/code-Cf4ftdOa.js","assets/rotate-ccw-BI2k_h3A.js","assets/control-tray-CdoVaVhT.js","assets/control-tray-DE2RhHP3.css","assets/use-debounced-value-C86N-mOK.js","assets/popover-D-jcaKGN.js","assets/CompilationCommandForm-Csg3VkC6.js","assets/SettingsDialog-CJX0gDhJ.css","assets/Dashboard-C0AvtM5m.js","assets/session-order-2oedrwDu.js","assets/context-menu-D3ZhKA9s.js","assets/dist-BmSuHjIq.js","assets/NewProjectDialog-DMixZDC_.js","assets/Workspace-CrZkK55U.js","assets/forward-link-DMvLf0Xw.js","assets/media-refresh-store-NSkvkBxN.js","assets/use-ui-state-DdnTFosh.js","assets/preview-kind-CPkO-rSz.js","assets/debounce-B9DrqirV.js","assets/motion-OSLfKoC0.js","assets/selection-actions-Cm0Oytya.js","assets/copy-D0Theg4Q.js","assets/view-state-store-Cy9sQJoZ.js","assets/drafts-B_tChlzR.js","assets/buffer-logic-BAkSBQT7.js","assets/scroll-restoration-CwXbvZvT.js","assets/Workspace-Bf0VMnaa.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./react-dom-cJyBB_A4.js";import{$ as r,D as i,E as a,Et as o,Ft as s,Ht as c,I as l,It as u,J as d,Lt as f,M as p,Mt as m,N as h,Nt as g,Ot as _,Pt as v,Q as y,R as b,Rt as x,S,St as C,T as ee,Tt as w,U as te,Ut as T,V as ne,Vt as E,Wt as D,Y as O,at as k,b as re,ct as ie,et as ae,it as oe,jt as se,mt as ce,o as le,ot as ue,q as de,st as fe,tt as pe,vt as me,w as he,wt as ge,x as _e,y as ve,zt as ye}from"./protocol-support-BApsXw77.js";import{$ as be,F as xe,K as Se,Q as Ce,T as we,Y as Te,o as A,p as Ee,r as De,z as Oe}from"./auth-olLlgxc3.js";import{a as j,c as ke,o as Ae}from"./LazyTerminal-Dp2CN0Y8.js";import{C as je,D as Me,E as Ne,O as Pe,_ as Fe,a as Ie,d as Le,g as Re,h as ze,i as Be,l as Ve,m as He,o as Ue,p as We,s as Ge,t as Ke,u as qe,w as Je}from"./notification-delivery-BBt_CJ19.js";import{i as Ye,r as Xe,t as Ze}from"./client-settings-DhfHheKR.js";import{t as Qe}from"./jsx-runtime-By8HlURe.js";import{t as $e}from"./preload-helper-Czpn1I53.js";import{a as et,n as tt,o as nt,r as rt,t as it}from"./index-BqOVeoIr.js";import{n as M}from"./api-BOuyloUi.js";import{_ as N,d as at,g as P,h as ot,i as st,l as ct,m as lt,o as ut,p as dt,r as ft,s as pt,u as mt,v as ht}from"./hotkeys-Cu0t6sbz.js";import{t as gt}from"./forward-link-DMvLf0Xw.js";import{a as _t,c as vt,d as yt,f as bt,l as xt,m as St,p as Ct,r as wt,s as Tt,u as Et}from"./session-order-2oedrwDu.js";import{n as F,t as Dt}from"./dist-BOS6OKSE.js";import{i as Ot,n as I,p as L,r as kt}from"./chevron-right-BEy-IXEZ.js";import{n as At,r as R}from"./dist-Dge3wHdO.js";import{$ as jt,G as Mt,J as Nt,K as Pt,U as Ft,W as It,X as Lt,Y as Rt,Z as zt,at as z,d as Bt,et as Vt,f as Ht,h as B,i as Ut,it as V,m as Wt,nt as Gt,ot as Kt,p as qt,q as Jt,r as Yt,rt as Xt,st as H,t as Zt,tt as Qt}from"./use-ui-state-DdnTFosh.js";import{n as U,t as W}from"./createLucideIcon-C9A1vLE-.js";import{n as $t,t as G}from"./button-C_Rvtcwg.js";import{c as en,d as tn,i as nn,l as rn,o as an,t as on}from"./switch-OMx-_DY7.js";import{t as sn}from"./copy-D0Theg4Q.js";import{n as cn,t as ln}from"./NewProjectDialog-DMixZDC_.js";import{t as un}from"./control-tray-CdoVaVhT.js";import{r as K,t as q}from"./ws-Dgc69_w8.js";import{a as dn,c as fn,i as pn,n as mn,o as hn,r as gn,s as _n}from"./command-BV8ZEhQz.js";import{n as vn,r as yn,t as bn}from"./popover-D-jcaKGN.js";import{n as xn,r as Sn,t as Cn}from"./queue-BlrQxHDl.js";var J=e(t(),1),Y=Qe();function wn(){let[e,t]=(0,J.useState)(`Opening forwarded application…`);return(0,J.useEffect)(()=>{if(!/^\/forward\/([^/]+)\/(\d+)$/.exec(window.location.pathname)){t(`This forwarding link is invalid.`);return}let e=!0;return gt(new URL(window.location.href)).then(t=>{e&&window.location.replace(t)}).catch(()=>{e&&t(`The application is unavailable. Reconnect to Puddle and open this link again.`)}),()=>{e=!1}},[]),(0,Y.jsx)(`p`,{className:`p-8 text-sm text-fg-secondary`,children:e})}var Tn=class extends D{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new o({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=En(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=En(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=En(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=En(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){m.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>u(t,e))}findAll(e={}){return this.getAll().filter(t=>u(e,t))}notify(e){m.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return m.batch(()=>Promise.all(e.map(e=>e.continue().catch(x))))}};function En(e){return e.options.scope?.id}var Dn=class extends D{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??s(r,t),a=this.get(i);return a||(a=new _({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){m.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>f(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>f(e,t)):t}notify(e){m.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){m.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){m.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},On=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Dn,this.#t=e.mutationCache||new Tn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=T.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=se.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(E(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=g(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return m.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;m.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return m.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=m.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(x).catch(x)}invalidateQueries(e,t={}){return m.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=m.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(x)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(x)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(E(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(x).catch(x)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(x).catch(x)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return se.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(v(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{ye(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(v(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{ye(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=s(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===c&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},kn=class extends J.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidUpdate(e){this.state.error!==null&&e.resetOn!==this.props.resetOn&&this.setState({error:null})}componentDidCatch(e,t){console.error(`Puddle: the ${this.props.scope} crashed`,e,t.componentStack)}render(){let{error:e}=this.state;return e===null?this.props.children:(0,Y.jsxs)(`div`,{className:`flex h-full min-h-40 flex-col items-center justify-center gap-4 px-8 py-10 text-center`,children:[(0,Y.jsxs)(`p`,{className:`text-sm text-fg`,children:[`The `,this.props.scope,` stopped rendering.`]}),(0,Y.jsx)(`p`,{className:`max-w-lg font-mono text-2xs leading-relaxed text-interrupted`,children:e.message||String(e)}),(0,Y.jsx)(`p`,{className:`max-w-sm text-2xs leading-relaxed text-fg-muted`,children:`Your sessions and their worktrees are on the daemon and untouched; the layout is saved. The console has the full stack.`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:()=>this.setState({error:null}),className:`text-2xs font-medium text-fg-gold transition-colors hover:underline`,children:`Try again`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>window.location.reload(),className:`text-2xs text-fg-muted transition-colors hover:text-fg`,children:`Reload`})]})]})}};function An(){return(0,Y.jsx)(Dt,{theme:(0,J.useSyncExternalStore)(et,rt),position:`bottom-right`,toastOptions:{style:{background:`var(--bg-elevated)`,border:`none`,boxShadow:`var(--ui-overlay-shadow)`,borderRadius:`var(--ui-surface-radius)`,outline:`1px solid var(--border)`,color:`var(--text-primary)`},classNames:{description:`whitespace-pre-wrap break-words font-mono text-2xs leading-snug max-h-40 overflow-y-auto`}}})}function jn(){return(0,Y.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-ground`,children:(0,Y.jsxs)(`div`,{className:`flex w-full max-w-md flex-col gap-10 px-8 pb-24`,children:[(0,Y.jsx)(`h1`,{className:`font-mono text-2xl font-semibold text-fg`,children:`Puddle`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3 text-sm leading-relaxed text-fg-secondary`,children:[(0,Y.jsxs)(`p`,{children:[`Authorise this browser by running`,` `,(0,Y.jsx)(`span`,{className:`font-mono text-accent`,children:`puddle launch`}),` in a terminal.`]}),(0,Y.jsx)(`p`,{children:`Use the link it opens. Your sessions, drafts and layouts stay in place.`})]})]})})}var Mn=e(n(),1),Nn=`a, button, [role="button"], [role="slider"], input, select, textarea, summary, label, [onclick], .cursor-pointer`,Pn=`.monaco-editor`;function Fn(e,t){return e?.closest(Pn)&&!e.closest(t)?`text`:e?.closest(Nn)?`interactive`:`default`}function In(e,t=`.no-custom-caret`){(0,J.useEffect)(()=>{let n=e.current;if(!n)return;let r=window.matchMedia(`(pointer: fine)`),i=()=>{n.style.opacity=`0`},a=e=>{if(e.pointerType===`touch`||!r.matches){i();return}n.style.transform=`translate3d(${e.clientX}px, ${e.clientY}px, 0) translate(-50%, -50%)`;let a=e.target instanceof Element?e.target:null;if(a instanceof HTMLIFrameElement){i();return}n.style.opacity=`1`;let o=a?.closest(Pn),s=Fn(a,t),c=s===`text`,l=s===`interactive`,u=c;if(c&&o){let e=getComputedStyle(o);n.style.setProperty(`--custom-cursor-caret-height`,`${Math.round(Number.parseFloat(e.fontSize)*1.3)}px`)}else if(!l&&a&&!a.closest(t)&&Array.from(a.childNodes).some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())){let e=getComputedStyle(a);e.userSelect!==`none`&&(u=!0,n.style.setProperty(`--custom-cursor-caret-height`,`${Math.round(Number.parseFloat(e.fontSize)*1.3)}px`))}n.classList.toggle(`is-interactive`,l),n.classList.toggle(`is-text`,u)};return window.addEventListener(`pointermove`,a,{passive:!0}),document.documentElement.addEventListener(`pointerleave`,i),window.addEventListener(`blur`,i),()=>{window.removeEventListener(`pointermove`,a),document.documentElement.removeEventListener(`pointerleave`,i),window.removeEventListener(`blur`,i)}},[t,e])}var Ln=[`top`,`right`,`bottom`,`left`];function Rn(){let e=(0,J.useRef)(null);return In(e),(0,Y.jsx)(`div`,{ref:e,className:`custom-cursor drafting-cursor`,"aria-hidden":`true`,children:Ln.map(e=>(0,Y.jsx)(`span`,{className:`drafting-cursor-tick`,"data-side":e},e))})}function zn(){let e=(0,J.useRef)(null);return In(e),(0,Y.jsx)(`div`,{ref:e,className:`custom-cursor invert-cursor`,"aria-hidden":`true`})}var Bn=`h1, h2, h3, h4, h5, h6, .no-rangefinder-caret`,X=40.5,Z=4.05,Vn=Z*Math.sqrt(3)/2;function Hn(){let e=[],t=[],n=X/2,r=Math.ceil(n/Vn)+1,i=e=>Math.round(e*100)/100,a=e=>`M${e.map(([e,t])=>`${i(e)} ${i(t)}`).join(`L`)}Z`;for(let i=-r;i<r;i+=1){let o=n+i*Vn,s=o+Vn,c=(i%2+2)%2*(Z/2);for(let i=-r;i<r;i+=1){let r=n+i*Z+c,l=[[r+Z/2,o],[r,s],[r+Z,s]],u=[[r+Z/2,o],[r+3*Z/2,o],[r+Z,s]],d=e=>{let t=e.map(([e])=>e),n=e.map(([,e])=>e);return Math.max(...t)>0&&Math.min(...t)<X&&Math.max(...n)>0&&Math.min(...n)<X};d(l)&&e.push(a(l)),d(u)&&t.push(a(u))}}return{light:e.join(``),dark:t.join(``)}}var Un=Hn();function Wn(){let e=(0,J.useRef)(null);return In(e,Bn),(0,Y.jsx)(`div`,{ref:e,className:`custom-cursor rangefinder-cursor`,"aria-hidden":`true`,children:(0,Y.jsxs)(`svg`,{className:`rangefinder-cursor-facets`,viewBox:`0 0 ${X} ${X}`,focusable:`false`,children:[(0,Y.jsx)(`path`,{className:`rangefinder-cursor-facet-light`,d:Un.light}),(0,Y.jsx)(`path`,{className:`rangefinder-cursor-facet-dark`,d:Un.dark})]})})}function Gn(){let{cursorPackage:e}=Ye(),t=null;switch(e){case`rangefinder`:t=(0,Y.jsx)(Wn,{});break;case`drafting`:t=(0,Y.jsx)(Rn,{});break;case`invert`:t=(0,Y.jsx)(zn,{});break;case`system`:return null}return(0,Mn.createPortal)(t,document.body)}var Kn=W(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),qn=W(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),Jn=W(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),Yn=W(`notebook-pen`,[[`path`,{d:`M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4`,key:`re6nr2`}],[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`path`,{d:`M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z`,key:`pqwjuv`}]]),Xn=W(`save`,[[`path`,{d:`M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z`,key:`1c8476`}],[`path`,{d:`M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7`,key:`1ydtos`}],[`path`,{d:`M7 3v4a1 1 0 0 0 1 1h7`,key:`t51u73`}]]),Zn=W(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),Qn=W(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]);function $n(){let e=ue(),t=h(),[n,r]=(0,J.useState)(``),[i,a]=(0,J.useState)(Oe),o=()=>{n.trim()&&t.mutate({name:n.trim(),branch_prefix:i.trim()},{onSuccess:e=>ot(e.id)})},s=(e.data?.length??0)>0;return(0,Y.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-ground`,children:(0,Y.jsxs)(`div`,{className:`flex w-full max-w-md flex-col gap-10 px-8 pb-16`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(`h1`,{className:`font-mono text-2xl font-semibold text-fg`,children:`Puddle`}),(0,Y.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`Who is working?`})]}),s&&(0,Y.jsx)(`div`,{className:`flex flex-col`,children:e.data.map(e=>(0,Y.jsxs)(`button`,{onClick:()=>ot(e.id),className:`flex items-center gap-3 rounded-md px-3 py-2.5 text-left transition-colors hover:bg-elevated active:bg-border/70`,children:[(0,Y.jsx)(Je,{icon:e.icon,colour:e.icon_colour,className:`size-5`}),(0,Y.jsx)(`span`,{className:U(`text-base`,j(e.icon_colour)||`text-fg`),children:e.name}),e.branch_prefix&&(0,Y.jsxs)(`span`,{className:`ml-auto text-2xs text-fg-muted`,children:[e.branch_prefix,`…`]})]},e.id))}),(0,Y.jsxs)(`form`,{className:`flex flex-col gap-5`,onSubmit:e=>{e.preventDefault(),o()},children:[s&&(0,Y.jsx)(`p`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:`or create a profile`}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(ke,{htmlFor:`profile-name`,children:`Name`}),(0,Y.jsx)(I,{id:`profile-name`,placeholder:`e.g. alice`,value:n,onChange:e=>r(e.target.value),className:`h-10`,autoFocus:!s})]}),(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(ke,{htmlFor:`branch-prefix`,children:`Branch prefix`}),(0,Y.jsx)(I,{id:`branch-prefix`,placeholder:`no prefix`,value:i,onChange:e=>a(e.target.value),className:`h-10`})]}),t.error&&(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:t.error.message}),(0,Y.jsx)(G,{type:`submit`,size:`lg`,className:`self-start px-6`,disabled:!n.trim()||t.isPending,children:`Create profile`})]})]})})}function er(){let e=b().data?.protocol,t=e!==void 0&&(e.major>25||e.major===25&&e.minor>=5),{data:n}=C({queryKey:[`storage`],queryFn:()=>M(`GET`,`/api/storage`),enabled:t&&!A(),refetchInterval:1e4,retry:!1});if(!t||A()||!n)return null;let r=n.volumes.filter(e=>e.level!==`ok`);if(!n.logs_degraded&&!n.database_degraded&&r.length===0)return null;let i=r.some(e=>e.level===`critical`);return(0,Y.jsxs)(`div`,{role:`status`,className:`flex shrink-0 items-start gap-2 px-3 py-2 text-xs text-warning`,children:[(0,Y.jsx)(Xt,{className:`mt-0.5 size-3.5 shrink-0`,"aria-hidden":`true`}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[n.database_degraded&&(0,Y.jsx)(`p`,{children:`Storage is full. Changes cannot be saved. Live session status may be unsaved.`}),n.logs_degraded&&(0,Y.jsx)(`p`,{children:`Terminal history is temporarily not being saved. Live terminals remain connected.`}),i&&(0,Y.jsx)(`p`,{children:`Storage is critically low. Free space or inodes before starting new sessions or worktrees.`}),r.length>0&&(0,Y.jsx)(an,{summary:`${r.length} storage ${r.length===1?`location needs`:`locations need`} attention`,children:(0,Y.jsx)(`div`,{className:`max-h-32 overflow-y-auto pl-4`,children:r.map(e=>(0,Y.jsxs)(`p`,{className:`break-all text-fg-secondary`,children:[e.level===`unknown`?`Could not check storage`:`Low storage`,` at`,` `,e.path,e.available_bytes!==null&&` · ${Math.round(e.available_bytes/1024**2).toLocaleString()} MiB available`,e.available_inodes!==null&&` · ${e.available_inodes.toLocaleString()} inodes available`]},e.path))})})]})]})}var tr=new class{transport;reload;pause;phase=`idle`;pending=null;constructor(e=fetch,t=()=>window.location.reload(),n=e=>new Promise(t=>setTimeout(t,e))){this.transport=e,this.reload=t,this.pause=n}refresh(e=12e4){return this.pending||=this.run(e).finally(()=>{this.pending=null}),this.pending}async run(e){this.phase=`requesting`;let t={authorization:`Bearer ${De.get()??``}`,"content-type":`application/json`};try{let n=await this.transport(`/cockpit/refresh`,{method:`POST`,headers:t,signal:AbortSignal.timeout(1e4),body:JSON.stringify({refreshId:crypto.randomUUID()})});if(n.status!==202)throw Error(`refresh rejected`);let r=we.parse(await n.json());this.phase=`waiting`;let i=Date.now()+e;for(;Date.now()<i;){await this.pause(1e3);try{let e=await this.transport(`/cockpit/status`,{headers:t,cache:`no-store`,signal:AbortSignal.timeout(3e3)});if(!e.ok)continue;let n=Ee.parse(await e.json());if(n.instance===r.instance||n.refreshId!==r.refreshId||n.upstream!==`ready`)continue;return this.phase=`complete`,this.reload(),!0}catch{}}}catch{}return this.phase=`failed`,!1}},Q=null;function nr(e){return Q=e,()=>{Q===e&&(Q=null)}}function rr(){Q?.()}var ir=new Set;function ar(){return[...ir].flatMap(e=>e())}function or({onNewSession:e,onNewProject:t}){let[n,r]=(0,J.useState)(!1),[i,a]=(0,J.useState)(`commands`),[o,s]=(0,J.useState)(``),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1),f=Ct(),p=St(),m=P(),h=p.id,g=ie(m??void 0),_=k(m??void 0),v=me(h),y=Lt();(0,J.useEffect)(()=>mt(`palette.toggle`,()=>r(e=>!e)),[]),(0,J.useEffect)(()=>Vt(()=>r(!0)),[]),(0,J.useEffect)(()=>{n||(a(`commands`),s(``),l(null),d(!1))},[n]);let b=(0,J.useMemo)(()=>{let n=[],r=wt((g.data??[]).filter(e=>!e.archived),_.data?.projectOrder??[]);for(let e of r)n.push({id:`project-${e.id}`,group:`Projects`,label:e.name,icon:cn,keywords:`switch project open`,run:()=>void f(`/project/${e.id}`)});for(let e of v.data??[])e.status!==`archived`&&n.push({id:`session-${e.id}`,group:`Sessions`,label:y(e),icon:_t,keywords:`switch session ${e.branch}`,run:()=>void f(`/project/${e.project_id}/session/${e.id}`)});return h!==void 0&&e&&n.push({id:`new-agent`,group:`Actions`,label:`New agent`,icon:tn,keywords:`new agent create start session`,run:()=>e()},{id:`new-terminal`,group:`Actions`,label:`New terminal`,icon:_t,keywords:`new terminal create start shell session`,run:()=>e({kind:`terminal`})}),h!==void 0&&n.push({id:`open-path`,group:`Actions`,label:`Open path`,icon:cn,keywords:`open path file directory folder editor tree browse absolute relative home`,closeOnRun:!1,run:()=>{s(``),l(null),a(`path`)}}),t&&n.push({id:`new-project`,group:`Actions`,label:`New project`,icon:R,keywords:`new project open create repository repo workspace`,run:t}),n.push({id:`theme-dark`,group:`Theme`,label:`Switch theme: dark`,icon:Me,keywords:`switch theme dark appearance`,run:()=>void it(`dark`)},{id:`theme-light`,group:`Theme`,label:`Switch theme: light`,icon:Ne,keywords:`switch theme light appearance`,run:()=>void it(`light`)},{id:`theme-system`,group:`Theme`,label:`Switch theme: system`,icon:Jn,keywords:`switch theme system appearance`,run:()=>void it(`system`)},{id:`open-settings`,group:`Actions`,label:`Settings`,icon:Qn,keywords:`open settings preferences options configure`,run:()=>nn()},{id:`switch-profile`,group:`Actions`,label:`Switch profile`,icon:en,keywords:`switch profile identity user change`,run:()=>lt.set(null)},{id:`refresh-connection`,group:`Actions`,label:`Refresh connection`,icon:rn,keywords:`refresh connection reconnect restart cockpit tunnel ssh daemon`,run:()=>rr()}),[...n,...ar()]},[g.data,_.data?.projectOrder,v.data,h,f,e,t,y]),x=(0,J.useMemo)(()=>{let e=new Map;for(let t of b){let n=e.get(t.group)??[];n.push(t),e.set(t.group,n)}return[...e.entries()]},[b]),S=async()=>{let e=o.trim();if(!(e===``||u)){d(!0),l(null);try{await zt(e),r(!1)}catch(e){l(e instanceof Error?e.message:`Could not open that path.`)}finally{d(!1)}}};return(0,Y.jsxs)(mn,{open:n,onOpenChange:r,children:[(0,Y.jsx)(dn,{value:o,onValueChange:e=>{s(e),l(null)},placeholder:i===`path`?`Enter a path…`:`Type a command or search…`,onKeyDown:e=>{i===`path`&&(e.key===`Enter`?(e.preventDefault(),e.stopPropagation(),S()):e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),a(`commands`),s(``),l(null)))}}),i===`path`?(0,Y.jsx)(_n,{children:(0,Y.jsxs)(`div`,{className:`px-3 py-3 text-xs text-fg-muted`,children:[(0,Y.jsx)(`p`,{children:`Relative paths start from the bound worktree or project. Absolute and ~ paths work too.`}),(0,Y.jsx)(`p`,{className:c?`mt-2 text-danger`:`mt-2`,"aria-live":`polite`,children:c??(u?`Opening…`:`Press Enter to open.`)})]})}):(0,Y.jsxs)(_n,{children:[(0,Y.jsx)(gn,{children:`Nothing matches.`}),x.map(([e,t])=>(0,Y.jsx)(pn,{heading:e,children:t.map(e=>{let t=e.icon;return(0,Y.jsxs)(hn,{value:`${e.label} ${e.keywords??``}`,onSelect:()=>{e.closeOnRun!==!1&&r(!1),e.run()},children:[t&&(0,Y.jsx)(t,{}),e.label,e.shortcut&&(0,Y.jsx)(fn,{children:e.shortcut})]},e.id)})},e))]})]})}function sr(){let e=document.activeElement;return e instanceof Element&&e.closest(`.xterm`)!==null}function cr(){let e=document.activeElement;return e instanceof Element&&e.closest(`.monaco-editor`)!==null}function lr(){let e=k(P()??void 0).data?.hotkeys;return(0,J.useEffect)(()=>{at(e&&typeof e==`object`?e:void 0)},[e]),(0,J.useEffect)(()=>mt(`window.close`,()=>{let e=N();e?.closeWindow?e.closeWindow():window.close()}),[]),(0,J.useEffect)(()=>{let e=e=>{let t=st(e);if(!t)return;let n=ft(t);if(!n)return;let r=ut(n);if(!r||!ct(r,cr()))return;let i=pt(n);i&&(e.preventDefault(),e.stopPropagation(),i())},t=e=>{let t=st(e);if(!t)return;let n=ft(t);if(!n)return;let r=ut(n);if(!r||r.editor&&cr()||r.deferInTerminal&&sr())return;let i=pt(n);i&&(e.preventDefault(),i())};return window.addEventListener(`keydown`,e,!0),window.addEventListener(`keydown`,t),()=>{window.removeEventListener(`keydown`,e,!0),window.removeEventListener(`keydown`,t)}},[]),null}var ur=4e3;function dr(){let[e,t]=(0,J.useState)(`hidden`),n=(0,J.useRef)(e);n.current=e,(0,J.useEffect)(()=>{let e=null,r=q.onConnectionChange(r=>{if(r){e!==null&&clearTimeout(e),e=null,n.current===`lost`&&t(`hidden`);return}e!==null||n.current!==`hidden`||(e=setTimeout(()=>{e=null,n.current===`hidden`&&t(`lost`)},ur))});return()=>{r(),e!==null&&clearTimeout(e)}},[]);let r=(0,J.useCallback)(async()=>{n.current!==`refreshing`&&(t(`refreshing`),await tr.refresh()||(F.error(`The cockpit has not come back — it may need a terminal (ssh re-auth): puddle refresh`),t(q.isConnected()?`hidden`:`lost`)))},[]);return(0,J.useEffect)(()=>nr(()=>void r()),[r]),e===`hidden`?null:(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 bg-elevated px-3 py-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:e===`refreshing`?`Restarting the cockpit.`:`Connection to the daemon lost.`}),e===`lost`&&(0,Y.jsxs)(G,{size:`sm`,className:`ml-auto`,onClick:()=>void r(),children:[(0,Y.jsx)(rn,{}),`Refresh connection`]})]})}function fr({label:e,percentage:t,hint:n}){let r=Math.max(0,Math.min(100,t));return(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`w-24 shrink-0 truncate text-2xs text-fg-muted`,title:e,children:e}),(0,Y.jsx)(`span`,{className:`relative h-1.5 min-w-0 flex-1 overflow-hidden rounded-full bg-border`,children:(0,Y.jsx)(`span`,{className:`absolute inset-y-0 left-0 rounded-full ${r>=90?`bg-danger`:r>=75?`bg-warning`:`bg-action`}`,style:{width:`${r}%`}})}),(0,Y.jsxs)(`span`,{className:`shrink-0 text-2xs tabular-nums text-fg-muted`,children:[Math.round(r),`%`,n?` · ${n}`:``]})]})}function pr(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function mr(e){if(e===null)return`never`;let t=new Date(e).getTime(),n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}function hr({account:e,onLogin:t,onStartSession:n,installed:r=!0}){let i=he(e.id),a=e.logged_in?n:r?t:null,o=i.data?.subscription;return(0,Y.jsxs)(`div`,{className:`rounded-md px-2 py-2 transition-colors hover:bg-elevated`,children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:a===null,onClick:()=>a?.(),className:`flex w-full items-center gap-3 text-left disabled:cursor-default`,children:[(0,Y.jsx)(`span`,{className:`size-2 shrink-0 rounded-full ${e.logged_in?`bg-success`:`bg-idle`}`,"aria-hidden":!0}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block truncate text-sm text-fg`,children:e.label}),(0,Y.jsxs)(`span`,{className:`block text-2xs text-fg-muted`,children:[e.logged_in?`logged in`:`logged out`,i.data&&(0,Y.jsxs)(Y.Fragment,{children:[` · `,i.data.session_count,` session`,i.data.session_count===1?``:`s`,i.data.active_session_count>0&&` (${i.data.active_session_count} active)`,` · `,`last `,mr(i.data.last_activity_at)]})]}),i.data?.agent_usage&&(0,Y.jsxs)(`span`,{className:`block text-2xs text-fg-muted`,children:[pr(i.data.agent_usage.input_tokens),` in ·`,` `,pr(i.data.agent_usage.output_tokens),` out ·`,` `,pr(i.data.agent_usage.cache_read_input_tokens),` cached ·`,` `,i.data.agent_usage.message_count,` msgs`]}),i.data?.live_usage?.context_used_percentage!=null&&(0,Y.jsx)(`span`,{className:`mt-1 block`,children:(0,Y.jsx)(fr,{label:`context`,percentage:i.data.live_usage.context_used_percentage})})]}),(0,Y.jsx)(`span`,{className:`shrink-0 text-2xs text-fg-muted`,children:r?e.logged_in?n?`new agent`:``:(0,Y.jsxs)(`span`,{className:`flex items-center gap-1 text-warning`,children:[(0,Y.jsx)(Pe,{className:`size-3`}),`sign in`]}):`unavailable`})]}),o!=null&&o.windows.length>0&&(0,Y.jsx)(`div`,{className:`mt-2 flex flex-col gap-1 pl-5`,children:o.windows.map(e=>(0,Y.jsx)(fr,{label:e.label,percentage:e.used_percentage,hint:e.resets==null?void 0:`resets ${e.resets}`},e.key))})]})}function gr(){let[e,t]=(0,J.useState)(!1),[n,r]=(0,J.useState)(!1),i=P(),o=ue(),s=ae(),c=o.data?.find(e=>e.id===i),l=ee(i??void 0),u=a(),d=O(),{open:f,handler:p}=Rt(),[m,h]=(0,J.useState)(null),g=e=>d.mutate(e.id,{onSuccess:t=>h({stream:t.stream,label:`${e.agent_type}/${e.label}`}),onError:e=>K(e)}),_=e=>{t(!1),f({accountId:e.id})},v=e=>{r(!1);let t=e.trim();!i||!t||t===c?.name||s.mutate({id:i,name:t},{onError:e=>K(e)})},y=`profile-trigger font-sans compact:h-7 compact:px-1.5`;return n&&c?(0,Y.jsxs)(`div`,{className:$t({variant:`ghost`,size:`sm`,className:y}),children:[(0,Y.jsx)(Je,{icon:c.icon,colour:c.icon_colour}),(0,Y.jsx)(Qt,{initial:c.name,maxLength:100,fitContent:!0,className:j(c.icon_colour),onCommit:v,onCancel:()=>r(!1)})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(bn,{open:e,onOpenChange:t,children:[(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{asChild:!0,children:(0,Y.jsx)(yn,{asChild:!0,children:(0,Y.jsxs)(G,{variant:`ghost`,size:`sm`,className:y,children:[(0,Y.jsx)(Je,{icon:c?.icon,colour:c?.icon_colour}),(0,Y.jsx)(`span`,{className:j(c?.icon_colour),...Gt(()=>{t(!1),r(!0)}),children:c?.name??`…`})]})})}),(0,Y.jsx)(z,{children:`Profile`})]}),(0,Y.jsxs)(vn,{className:`w-[28rem] max-w-[calc(100vw-1rem)]`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(u.data??[]).map(e=>{let t=l.data?.filter(t=>t.agent_type===e.id)??[];if(t.length===0)return null;let n=e.available!==!1;return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,Y.jsxs)(`span`,{className:`px-2 text-2xs font-medium uppercase tracking-wide text-fg-muted`,children:[e.display_name,!n&&(0,Y.jsxs)(`span`,{className:`ml-2 normal-case tracking-normal text-fg-muted`,children:[`not installed — no `,e.binary??e.id,` on PATH`]})]}),t.map(e=>(0,Y.jsx)(hr,{account:e,onLogin:()=>g(e),onStartSession:p&&n?()=>_(e):null,installed:n},e.id))]},e.id)}),l.data?.length===0&&(0,Y.jsx)(`p`,{className:`px-2 text-sm text-fg-muted`,children:`No accounts yet — add one in settings.`})]}),(0,Y.jsxs)(`div`,{className:`mt-4 flex items-center gap-2`,children:[(0,Y.jsxs)(G,{variant:`ghost`,size:`sm`,onClick:()=>{t(!1),nn(`accounts`)},children:[(0,Y.jsx)(R,{}),`Add account`]}),(0,Y.jsxs)(G,{variant:`ghost`,size:`sm`,className:`ml-auto`,onClick:()=>{t(!1),lt.set(null)},children:[(0,Y.jsx)(Zn,{}),`Switch profile`]})]})]})]}),m&&(0,Y.jsx)(je,{stream:m.stream,label:m.label,onClose:()=>h(null)})]})}var _r=`desktop-update`;function vr(){let e=(0,J.useRef)(null);return(0,J.useEffect)(()=>{let t=N();if(t?.updateReady===void 0||t.onUpdateReady===void 0)return;let n=t=>{e.current!==t&&(e.current=t,F(`Puddle ${t} is downloaded and ready.`,{id:_r,duration:1/0,closeButton:!0,action:{label:`Restart to update`,onClick:()=>{N()?.installUpdate?.(),F.loading(`Restarting into Puddle ${t}…`,{id:`${_r}-restarting`,duration:1/0})}}}))};return t.updateReady().then(e=>{e!==null&&n(e)}),t.onUpdateReady(n)},[]),null}var yr=new Re;function br({onReview:e}={}){let t=He(),n=Le(),r=_e(de().data),i=ze();return We(),(0,J.useEffect)(()=>{if(!(!n||!r||t.isError))for(let n of yr.take(i,Fe(t.data))){let t=n.component===`daemon`?`Daemon`:`Runtime software`,a=`host-update-${i}-${n.component}-${n.version}`;F(`${r}: ${t} ${n.version} is available.`,{id:a,duration:1/0,closeButton:!0,action:{label:`Review update`,onClick:e??(()=>nn(`host`))}})}},[t.data,t.isError,r,n,i,e]),null}function xr({hostKey:e,enabled:t=!0}){let n=C({queryKey:[`host`],queryFn:async({signal:e})=>Se.parse(await M(`GET`,`/api/host`,void 0,e)),staleTime:1/0,enabled:t&&!e,retry:!1}),r=e??(n.data?Cn(n.data):void 0),i=A(),a=i?.generation,o=C({queryKey:[`release-notes`,r],queryFn:async({signal:e})=>{let t=Te.parse(await M(`GET`,`/api/release-notes`,void 0,e));if(A()!==i||i?.generation!==a)throw Error(`Release notes connection changed`);return t},enabled:t&&!!r,staleTime:1/0,retry:!1});return(0,J.useEffect)(()=>{t&&r&&o.data&&!o.isError&&Sn(r,o.data)},[t,r,o.data,o.isError]),null}var Sr=(0,J.lazy)(()=>$e(()=>import(`./ReleaseNotesDialog-CbFYKoYM.js`).then(e=>({default:e.ReleaseNotesDialog})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])));function Cr({remote:e=!1}){let t=(0,J.useSyncExternalStore)(xn.subscribe,xn.snapshot)[0];return(0,J.useEffect)(()=>{let t=e?[`cockpit`,`remote`]:[`cockpit`];xn.enqueue(`browser`,t.map(e=>({component:e,version:`0.4.8`,markdown:`## [0.4.8] — 2026-11-05
|
|
3
|
-
|
|
4
|
-
### Cockpit
|
|
5
|
-
|
|
6
|
-
- Avoid connection-error toasts from automatic terminal focus reports when viewing terminated sessions.
|
|
7
|
-
- Unify menu, field, mobile tray and native prompt styling with the shared island palette, geometry and optional motion; retain readable gold selection text and keyboard access to floating tab actions.
|
|
8
|
-
- Keep the hostname in the standard primary text colour independently of project colour, and group collapsed sessions into one scrollable island with project dividers above the bottom archive button.
|
|
9
|
-
- Preserve tray selection continuity across remounts and use rounded facing-edge feedback for internal resize handles, including keyboard resizing.
|
|
10
|
-
- Align folder and file staging actions in a fixed column in Changes.
|
|
11
|
-
- Show lone tabs as full panes with a top-edge path tooltip; opening or dropping a second file restores the tab strip. Keep floating action tooltips above the pane and inside the window.
|
|
12
|
-
- Slide session hover feedback between rows in both expanded and collapsed sidebars, respecting reduced motion.
|
|
13
|
-
`})))},[e]),t?(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(Sr,{current:t})}):null}function wr(){let e=P(),t=ue().data?.find(t=>t.id===e),n=k(e??void 0),r=ce(e??void 0,void 0),i=Ye(),a=Ue(),o=Ge(),s=pe(e??``),c=ae(),u=l(),[d,f]=(0,J.useReducer)(e=>e+1,0);(0,J.useEffect)(()=>et(()=>f()),[]);let p=(0,J.useRef)(null);(0,J.useEffect)(()=>{p.current=null},[t?.name]);let m=a.data?.available===!0?a.data.file:void 0,h=t!==void 0&&e!==null&&n.data!==void 0&&r.data!==void 0&&m!==void 0,g=t&&m?Ie(m,t.name):void 0,_=s.isPending||c.isPending||u.isPending||o.isPending||n.isFetching||r.isFetching;(0,J.useEffect)(()=>{if(!h||!g?.enabled||_)return;let a={client:i,theme:nt(),profileSettings:n.data,profile:t,scratchpad:r.data},l={setClient:e=>Xe(e),setTheme:e=>{typeof e==`string`&&it(e)},patchProfileSettings:e=>s.mutate(e),patchProfileColumns:t=>c.mutate({id:e,...t}),createScratchpad:t=>{for(let n of t)u.mutate({profile_id:e,scope:`profile`,title:n.title??void 0,body:n.body,tags:n.tags,agent_type:n.agent_type??void 0})}},d=JSON.stringify(g.doc);if(p.current!==d){p.current=d,Ve(g.doc,l,a,g.groups);return}let f=qe(g.groups,a),m=JSON.stringify(f);m!==d&&(p.current=m,o.mutate({profile:t.name,entry:{...g,doc:f,updatedAt:new Date().toISOString()}}))})}function Tr(e){let t=t=>{let n=be.safeParse(t);n.success&&e(n.data)},n=N()?.onNotificationClick?.((e,n)=>t(n)),r=e=>{e.data?.t===`notification-click`&&t(e.data.target)};return navigator.serviceWorker?.addEventListener(`message`,r),()=>{n?.(),navigator.serviceWorker?.removeEventListener(`message`,r)}}var Er=5e3,Dr=`[data-notification-session]`;function Or(e){let t=null,n=()=>{t=null},r=e=>e.target instanceof Element?e.target.closest(Dr):null,i=e=>{if(!e.isTrusted)return;let n=r(e),i=n?.dataset.notificationSession;t=n&&i?{element:n,session:i,at:performance.now()}:null},a=e=>{r(e)!==t?.element&&n()},o=[`pointerdown`,`keydown`,`input`,`paste`];for(let t of o)e.addEventListener(t,i,!0);return e.addEventListener(`focusin`,a,!0),e.addEventListener(`visibilitychange`,n),e.defaultView?.addEventListener(`blur`,n),{isInteracting(n){return t!==null&&t.session===n&&performance.now()-t.at<Er&&e.visibilityState===`visible`&&e.hasFocus()&&t.element.isConnected&&t.element.dataset.notificationSession===n&&t.element.getClientRects().length>0},dispose(){n();for(let t of o)e.removeEventListener(t,i,!0);e.removeEventListener(`focusin`,a,!0),e.removeEventListener(`visibilitychange`,n),e.defaultView?.removeEventListener(`blur`,n)}}}var kr=new Set,Ar=e=>!!e&&kr.has(e),jr=Ce.parse({});function Mr(e){return e.prefs.muted_projects.includes(e.projectId)?{desktop:!1,sound:!1}:{desktop:e.prefs.desktop&&(e.permission===`granted`||e.permission===`unverified`)&&(e.prefs.when_focused||!e.sessionFocused),sound:e.prefs.sound}}function Nr(e,t){for(let[,n]of e.getQueriesData({queryKey:[`sessions`]})){let e=n?.find(e=>e.id===t);if(e)return e}for(let[,n]of e.getQueriesData({queryKey:[`project`]})){let e=n?.sessions.find(e=>e.id===t);if(e)return e}}function Pr(e){return e.title??e.agent_title??e.osc_title??e.id.slice(0,8)}function Fr(){try{let e=new AudioContext,t=e.createGain();t.gain.value=.04,t.connect(e.destination);for(let[n,r]of[[880,0],[1318.5,.09]]){let i=e.createOscillator();i.type=`sine`,i.frequency.value=n,i.connect(t),i.start(e.currentTime+r),i.stop(e.currentTime+r+.12)}setTimeout(()=>void e.close(),400)}catch{}}function Ir(){let e=Ct(),t=(0,J.useRef)(null);(0,J.useEffect)(()=>{let e=Or(document);return t.current=e,()=>{t.current=null,e.dispose()}},[]),(0,J.useEffect)(()=>Tr(t=>{t.host||e(`/project/${t.project}/session/${t.session}`,{state:{notificationSession:t.session}})}),[e]),Lr(t=>{e(`/project/${t.project_id}/session/${t.id}`,{state:{notificationSession:t.id}})},e=>t.current?.isInteracting(e.id)??!1)}function Lr(e,t=()=>document.hasFocus()){let n=w(),r=(0,J.useRef)(e);r.current=e;let i=(0,J.useRef)(t);i.current=t;let a=_e(de().data)??`Puddle`,o=(0,J.useRef)(a);(0,J.useEffect)(()=>{document.title===o.current&&(document.title=a),o.current=a},[a]),(0,J.useEffect)(()=>{let e=new Set,t=()=>{document.title=e.size>0?`(${e.size}) ${o.current}`:o.current},a=!0,s=async e=>{let t=Nr(n,e.session);if(!t)try{t=(await ve(n)).find(t=>t.id===e.session)}catch{return}if(!a||!t)return;let s=t,c,l;try{let e=await n.fetchQuery({queryKey:[`project`,s.project_id],queryFn:()=>M(`GET`,`/api/projects/${s.project_id}`),staleTime:1e4});if(!a)return;l=e.project;let t=l.profile_id,r=await n.fetchQuery({queryKey:[`profile-settings`,t],queryFn:()=>M(`GET`,`/api/profiles/${t}/settings`),staleTime:1e4});c=Ce.catch(jr).parse(r.notifications??{})}catch{return}if(!a)return;let u=Mr({prefs:c,projectId:s.project_id,sessionFocused:i.current(s),permission:Be()});u.sound&&Fr(),u.desktop&&!Ar(A()?.scope)&&await Ke({id:e.id?`puddle-event-${e.id}`:`puddle-agent-${s.id}`,title:e.content?.title??Pr(s).slice(0,160),body:e.content?.body??(e.reason===`exited`?`Agent finished running`:`Waiting for your input`),target:{project:s.project_id,session:s.id,...A()?.notificationHost?{host:A().notificationHost}:{}}},()=>{a&&r.current(s)},{host:o.current,project:l})},c=q.onAgentNotification(e=>{s(e)}),l=q.onStatus(r=>{let i=e.has(r.session);r.status===`waiting_input`?e.add(r.session):e.delete(r.session),t(),!(r.status!==`waiting_input`||i)&&n.fetchQuery({queryKey:[`version`],queryFn:()=>M(`GET`,`/api/version`),staleTime:1/0}).then(e=>{if(!(e.protocol.major>22||e.protocol.major===22&&e.protocol.minor>=3))return s({session:r.session,reason:`waiting_input`})}).catch(()=>{})});return()=>{a=!1,l(),c(),document.title=o.current}},[n])}function Rr({initial:e,defaultScope:t,allowProject:n=!0,agents:r,onSave:i,onCancel:a}){let[o,s]=(0,J.useState)(e?.title??``),[c,l]=(0,J.useState)(e?.body??``),[u,d]=(0,J.useState)(n?e?.scope??t:`profile`),[f,p]=(0,J.useState)((e?.tags??[]).join(`, `)),[m,h]=(0,J.useState)(e?.agent_type??null),g=()=>{let e=c.trim();e&&i({title:o.trim()||null,body:e,scope:u,tags:f.split(`,`).map(e=>e.trim()).filter(Boolean),agent_type:m})};return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(I,{value:o,placeholder:`Title (optional)`,spellCheck:!1,onChange:e=>s(e.target.value),onKeyDown:e=>e.stopPropagation(),className:`h-9 text-sm font-medium`}),(0,Y.jsx)(kt,{autoFocus:!0,value:c,placeholder:`Prompt or note…`,spellCheck:!1,rows:10,onChange:e=>l(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`?a():e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&g()},className:`resize-y text-sm leading-relaxed`}),(0,Y.jsx)(I,{value:f,placeholder:`tags, comma, separated`,spellCheck:!1,onChange:e=>p(e.target.value),onKeyDown:e=>e.stopPropagation(),className:`h-8 text-xs`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n&&(0,Y.jsxs)(`label`,{className:`flex items-center gap-1.5 text-2xs text-fg-secondary`,children:[(0,Y.jsx)(on,{checked:u===`profile`,onCheckedChange:e=>d(e?`profile`:`project`)}),`Profile-wide`]}),(0,Y.jsx)(`div`,{className:`ml-auto flex items-center gap-1`,children:r.map(e=>(0,Y.jsxs)(`button`,{type:`button`,title:e.display_name,"aria-pressed":m===e.id,onClick:()=>h(t=>t===e.id?null:e.id),className:U(`rounded-md p-1 transition-colors`,m===e.id?`bg-surface text-fg`:`text-fg-gold hover:bg-surface hover:text-fg`),children:[(0,Y.jsx)(Jt,{type:e.id,className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:e.display_name})]},e.id))})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,onClick:a,children:`Cancel`}),(0,Y.jsx)(G,{size:`sm`,disabled:!c.trim(),onClick:g,children:`Save`})]})]})}function zr(){let e=Pt(),t=P(),n=St().id,r=ce(t??void 0,n).data??[],i=a().data??[],o=l(),s=oe(),c=te(),u=Mt(),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(null),[y,b]=(0,J.useState)(null);(0,J.useEffect)(()=>mt(`scratchpad.toggle`,It),[]),(0,J.useEffect)(()=>{e||(f(null),m(null),g(null))},[e]);let x=(0,J.useMemo)(()=>[...new Set(r.flatMap(e=>e.tags))].sort((e,t)=>e.localeCompare(t)),[r]),S=(0,J.useMemo)(()=>[...new Set(r.map(e=>e.agent_type).filter(e=>e!==null))],[r]),C=p!==null||h!==null,ee=r.filter(e=>(p===null||e.tags.includes(p))&&(h===null||e.agent_type===h)),w=C?ee:y??r,T=e=>{t&&(o.mutate({profile_id:t,scope:e.scope,project_id:e.scope===`project`?n:void 0,title:e.title??void 0,body:e.body,tags:e.tags,agent_type:e.agent_type??void 0}),f(null))},ne=(e,t)=>{s.mutate({id:e,scope:t.scope,project_id:t.scope===`project`?n??null:null,title:t.title,body:t.body,tags:t.tags,agent_type:t.agent_type}),f(null)},E=(e,t)=>{let n=y??r,i=n.findIndex(t=>t.id===e),a=n.findIndex(e=>e.id===t);if(i===-1||a===-1||i===a)return;let o=n.slice(),[s]=o.splice(i,1);o.splice(a,0,s),b(o)},D=()=>{let e=_,t=y;if(v(null),b(null),e===null||!t)return;let n=t.findIndex(t=>t.id===e);if(n===-1)return;let r=t[n-1],i=t[n+1],a=r?i?(r.position+i.position)/2:r.position+1:(i?i.position:0)-1;s.mutate({id:e,position:a})},O=e=>{navigator.clipboard?.writeText(e.body),F.success(`Copied to clipboard`)};return(0,Y.jsxs)(bn,{open:e,onOpenChange:Ft,children:[(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{asChild:!0,children:(0,Y.jsx)(yn,{asChild:!0,children:(0,Y.jsxs)(G,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,children:[(0,Y.jsx)(Yn,{}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Scratchpad`})]})})}),(0,Y.jsx)(z,{children:`Scratchpad`})]}),(0,Y.jsxs)(vn,{className:`w-[34rem] max-w-[calc(100vw-1rem)] p-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-5 pb-2 pt-4`,children:[(0,Y.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Scratchpad`}),(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>f(d===`new`?null:`new`),className:U(Ot,`ml-auto`),children:[(0,Y.jsx)(R,{className:`size-4`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`New entry`})]})]}),(x.length>0||S.length>0)&&(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 px-5 pb-2`,children:[x.map(e=>(0,Y.jsx)(`button`,{type:`button`,onClick:()=>m(t=>t===e?null:e),className:U(`rounded-full px-2 py-0.5 text-2xs transition-colors`,p===e?`bg-action text-action-ink`:`bg-surface text-fg-secondary hover:text-fg`),children:e},e)),S.map(e=>(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":h===e,onClick:()=>g(t=>t===e?null:e),className:U(`rounded-md p-1 transition-colors`,h===e?`bg-action text-action-ink`:`text-fg-gold hover:bg-surface`),children:(0,Y.jsx)(Jt,{type:e,className:`size-3.5`})},e))]}),(0,Y.jsxs)(`div`,{className:`no-scrollbar max-h-[65vh] overflow-y-auto px-2 pb-3`,children:[d===`new`&&(0,Y.jsx)(`div`,{className:`px-3 py-2`,children:(0,Y.jsx)(Rr,{defaultScope:n?`project`:`profile`,allowProject:n!==void 0,agents:i,onSave:T,onCancel:()=>f(null)})}),w.length===0&&d!==`new`&&(0,Y.jsx)(`p`,{className:`px-3 py-3 text-sm text-fg-muted`,children:C?`Nothing matches this filter.`:`No entries yet — press + to add a reusable prompt or note.`}),(0,Y.jsx)(`ul`,{className:`flex flex-col`,children:w.map(e=>d===e.id?(0,Y.jsx)(`li`,{className:`px-3 py-2`,children:(0,Y.jsx)(Rr,{initial:e,defaultScope:e.scope,allowProject:n!==void 0||e.scope===`project`,agents:i,onSave:t=>ne(e.id,t),onCancel:()=>f(null)})},e.id):(0,Y.jsx)(`li`,{draggable:!C&&d===null,onDragStart:t=>{t.dataTransfer.effectAllowed=`move`,v(e.id)},onDragOver:t=>{_!==null&&(t.preventDefault(),_!==e.id&&E(_,e.id))},onDragEnd:D,className:U(`transition-opacity`,_===e.id&&`opacity-50`),children:(0,Y.jsx)(Br,{entry:e,onInsert:u?()=>{u(e.body),Ft(!1)}:null,onCopy:()=>O(e),onEdit:()=>f(e.id),onDelete:()=>c.mutate(e.id)})},e.id))})]})]})]})}function Br({entry:e,onInsert:t,onCopy:n,onEdit:r,onDelete:i}){let[a,o]=(0,J.useState)(!1);return(0,Y.jsxs)(`div`,{onClick:e=>{e.target.closest(`button`)||r()},className:`cursor-pointer rounded-md px-3 py-2.5 transition-colors hover:bg-surface`,children:[e.title&&(0,Y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,Y.jsx)(`p`,{className:U(`line-clamp-3 whitespace-pre-wrap text-sm text-fg-secondary`,e.title&&`mt-0.5`),children:e.body}),a?(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:`Delete this entry? This can’t be undone.`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{o(!1),i()},className:U(L,`text-danger`),children:`Delete`}),(0,Y.jsx)(`button`,{type:`button`,onClick:()=>o(!1),className:L,children:`Cancel`})]}):(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:e.scope===`profile`?`Profile-wide`:`Project`}),e.agent_type&&(0,Y.jsx)(Jt,{type:e.agent_type,className:`size-3 text-fg-gold`}),e.tags.map(e=>(0,Y.jsx)(`span`,{className:`rounded-full bg-surface px-1.5 text-2xs text-fg-secondary`,children:e},e)),(0,Y.jsxs)(un,{label:`Scratchpad entry actions`,className:`ml-auto`,children:[t&&(0,Y.jsx)(Vr,{icon:Kn,label:`Insert into focused terminal`,onClick:t}),(0,Y.jsx)(Vr,{icon:sn,label:`Copy`,onClick:n}),(0,Y.jsx)(Vr,{icon:Ae,label:`Edit`,onClick:r}),(0,Y.jsx)(Vr,{icon:At,label:`Delete`,onClick:()=>o(!0)})]})]})]})}function Vr({icon:e,label:t,onClick:n}){return(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:Ot,children:[(0,Y.jsx)(e,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,Y.jsx)(z,{children:t})]})}var Hr=xe.parse({});function Ur(e,t){let[n,r]=(0,J.useState)(null),a=i(t).data,o=ie(e??void 0,t&&e!==null).data;return(0,J.useEffect)(()=>{if(!t||e===null){r(null);return}let n=!1,i;try{i=Zt(sessionStorage.getItem(Yt(e)))}catch{i={kind:`absent`}}if(i.kind===`present`){r(i.snapshot);return}return re(e).then(e=>{n||r(e?e.ui_state:Hr)}).catch(()=>{n||r(Hr)}),()=>{n=!0}},[t,e]),(0,J.useMemo)(()=>{if(!t||e===null||n===null)return null;let i=t=>{if(!a||!o)return!1;let{patch:i,projectBased:s}=Ut(n,t,{alive:new Set(a.filter(e=>e.status!==`archived`).map(e=>e.id)),sessionProject:new Map(a.map(e=>[e.id,e.project_id])),projectIds:o.map(e=>e.id),currentProject:null}),c={...n,...i};r(c),S(e,c).catch(e=>console.warn(`ui-state save failed: ${e.message}`));try{sessionStorage.setItem(Yt(e),JSON.stringify(c))}catch(e){console.warn(`ui-state write failed: ${e.message}`)}return Ze().projectBasedLayout!==s&&Xe({projectBasedLayout:s}),!0},s=Object.fromEntries(Object.entries(n.project_layouts).map(([e,t])=>[e,{layoutRef:t.layout_ref,signature:B(t.layout_tree)}]));return(n.layout_mode??`profile`)===`project`?{headless:!0,scope:`project`,projectId:``,layoutRef:null,signature:B(null),slices:s,capture:()=>({layout_tree:null,active_session:null}),apply:i}:{scope:`profile`,projectId:``,layoutRef:n.layout_ref,signature:B(n.layout_tree),slices:s,capture:()=>({layout_tree:n.layout_tree,active_session:n.active_session}),apply:i}},[t,e,n,a,o])}var Wr=B(null);function Gr(){let e=Wt(),t=Ct(),n=P(),i=qt(),a=Ur(n,e&&i===null),o=i??a,s=d(n??void 0,void 0).data??[],c=ie(n??void 0,e&&n!==null).data??[],l=p(),u=r(),f=ne(),[m,h]=(0,J.useState)(``),[g,_]=(0,J.useState)(!1),[v,y]=(0,J.useState)(null);(0,J.useEffect)(()=>mt(`layouts.toggle`,Ht),[]),(0,J.useEffect)(()=>{e||(h(``),_(!1),y(null))},[e]);let b=o?.headless===!0,x=o===null||b?null:s.find(e=>e.id===o.layoutRef)??null,S=o!==null&&!b&&(x===null?o.signature!==Wr:B(x.layout_tree)!==o.signature),C=e=>{let t=o?.slices?.[e];if(!t)return!1;let n=t.layoutRef===null?null:s.find(e=>e.id===t.layoutRef)??null;return n?B(n.layout_tree)!==t.signature:t.signature!==Wr},ee=e=>o===null?!1:e.scope===`profile`?o.scope===`profile`&&S:e.project_id===null?!1:o.scope===`project`?!b&&e.project_id===o.projectId?S:C(e.project_id):S||C(e.project_id),w=e=>x!==null&&e.id===x.id,te=e=>(e===null?void 0:c.find(t=>t.id===e)?.name)??`Project`,T=o!==null&&!b&&o.scope===`project`?s.filter(e=>e.scope===`profile`||e.project_id===o.projectId):s,E=[...T.some(e=>e.scope===`profile`)?[{key:`profile`,name:`Profile-wide`}]:[],...[...new Set(T.flatMap(e=>e.project_id===null?[]:[e.project_id]))].map(e=>({key:e,name:te(e)})).sort((e,t)=>e.name.localeCompare(t.name))],D=v===null?T:v===`profile`?T.filter(e=>e.scope===`profile`):T.filter(e=>e.project_id===v),O=e=>o!==null&&e.scope===o.scope&&(o.scope===`profile`||e.project_id===o.projectId),k=(e,t,r)=>{!o||!n||l.mutate({profile_id:n,scope:o.scope,project_id:o.scope===`project`?o.projectId:void 0,name:e,...t},{onSuccess:e=>{r&&o.apply(e)},onError:e=>K(e)})},re=e=>{if(!o)return;let t=O(e)?e:s.find(t=>t.name===e.name&&O(t));if(!t){k(e.name,o.capture(),!0);return}u.mutate({id:t.id,...o.capture()},{onSuccess:e=>o.apply(e),onError:e=>K(e)})},ae=(e,t)=>k(t,{layout_tree:e.layout_tree,active_session:e.active_session},!1),oe=e=>{if(o){if(!o.apply(e)){F.error(`Workspace is still loading — try again in a moment`);return}e.project_id!==null&&e.project_id!==o.projectId&&t(`/project/${e.project_id}`),Bt(!1)}};return(0,Y.jsxs)(bn,{open:e,onOpenChange:Bt,children:[(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{asChild:!0,children:(0,Y.jsx)(yn,{asChild:!0,children:(0,Y.jsxs)(G,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,children:[(0,Y.jsx)(qn,{}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Layouts`})]})})}),(0,Y.jsx)(z,{children:`Layouts`})]}),(0,Y.jsxs)(vn,{className:`w-[26rem] max-w-[calc(100vw-1rem)] p-0`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2 px-5 pb-2 pt-4`,children:[(0,Y.jsx)(`span`,{className:`text-2xs font-medium uppercase tracking-wide text-fg-gold`,children:`Layouts`}),o!==null&&!b&&(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>_(e=>!e),className:U(`inline-flex size-[var(--ui-control-height)] shrink-0 cursor-pointer items-center justify-center rounded-[var(--ui-radius)] text-fg transition-colors hover:bg-elevated disabled:pointer-events-none disabled:opacity-50`,`ml-auto`),children:[(0,Y.jsx)(R,{className:`size-4`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Save the current layout as a new layout`})]})]}),o===null?(0,Y.jsx)(`p`,{className:`px-5 pb-3 text-sm text-fg-muted`,children:`Loading the profile’s layout state…`}):b?(0,Y.jsx)(`p`,{className:`px-5 pb-3 text-sm text-fg-muted`,children:`Project-based layout is on — every project keeps its own layout. Open a project to name or save it; loading works from here.`}):(x===null||g)&&(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2 px-5 pb-3`,children:[x===null&&(0,Y.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:`Unnamed layout`}),(0,Y.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:o.scope===`profile`?`Profile-wide`:`Project`}),(0,Y.jsx)(`span`,{className:`ml-auto text-2xs text-interrupted`,children:`Unsaved`})]}),(0,Y.jsxs)(`form`,{className:`flex items-center gap-1.5`,onSubmit:e=>{e.preventDefault();let t=m.trim();t&&(k(t,o.capture(),!0),h(``),_(!1))},children:[(0,Y.jsx)(I,{autoFocus:g,value:m,placeholder:x===null?`Name this layout…`:`Save as a new layout…`,spellCheck:!1,onChange:e=>h(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&_(!1)},className:`h-8 flex-1 text-sm`}),(0,Y.jsx)(G,{size:`sm`,type:`submit`,disabled:!m.trim(),children:`Save`}),x!==null&&(0,Y.jsx)(G,{variant:`ghost`,size:`sm`,onClick:()=>_(!1),children:`Cancel`})]})]}),E.length>1&&(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-1 px-5 pb-2`,children:E.map(e=>(0,Y.jsx)(Jr,{active:v===e.key,onClick:()=>y(t=>t===e.key?null:e.key),children:e.name},e.key))}),(0,Y.jsxs)(`div`,{className:`no-scrollbar max-h-[60vh] overflow-y-auto px-2 pb-3`,children:[D.length===0&&(0,Y.jsx)(`p`,{className:`px-3 py-3 text-sm text-fg-muted`,children:v===null?`No layouts yet — name and save the current layout to keep it.`:`Nothing matches this filter.`}),(0,Y.jsx)(`ul`,{className:`flex flex-col`,children:D.map(e=>(0,Y.jsx)(`li`,{children:(0,Y.jsx)(Kr,{layout:e,projectLabel:e.scope===`profile`?null:te(e.project_id),isCurrent:w(e),dirty:S,loadable:o!==null,savable:o!==null&&!b,confirmBeforeLoad:ee(e),overwrites:O(e),onLoad:()=>oe(e),onRename:t=>u.mutate({id:e.id,name:t}),onDelete:()=>f.mutate(e.id),onSaveAs:()=>re(e),onDuplicate:t=>ae(e,t)})},e.id))})]})]})]})}function Kr({layout:e,projectLabel:t,isCurrent:n,dirty:r,loadable:i,savable:a,confirmBeforeLoad:o,overwrites:s,onLoad:c,onRename:l,onDelete:u,onSaveAs:d,onDuplicate:f}){let[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(null),[_,v]=(0,J.useState)(e.name),y=()=>{if(!(!i||h!==null)){if(o&&p!==`load`){m(`load`);return}m(null),c()}},b=t=>{m(null),v(t===`rename`?e.name:`${e.name} copy`),g(t)},x=()=>{if(n){d();return}m(`save`)},S=n?r?`unsaved`:`active`:null;return(0,Y.jsxs)(`div`,{onClick:e=>{e.target.closest(`button, input`)||y()},className:U(`rounded-md px-3 py-2.5 transition-colors`,i&&`cursor-pointer hover:bg-surface`),children:[h===null?(0,Y.jsxs)(`p`,{className:U(`flex items-baseline gap-2 text-sm font-medium`,S===`active`?`text-success`:S===`unsaved`?`text-interrupted`:`text-fg`),children:[e.name,S!==null&&(0,Y.jsx)(`span`,{className:`text-2xs font-normal`,children:S===`active`?`Active`:`Unsaved`})]}):(0,Y.jsxs)(`form`,{className:`flex items-center gap-1.5`,onSubmit:t=>{t.preventDefault();let n=_.trim();n&&(h===`rename`?n!==e.name&&l(n):f(n)),g(null)},children:[(0,Y.jsx)(I,{autoFocus:!0,value:_,spellCheck:!1,onChange:e=>v(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&g(null)},className:`h-7 flex-1 text-sm`}),(0,Y.jsx)(G,{size:`sm`,type:`submit`,disabled:!_.trim(),children:h===`rename`?`Rename`:`Save`})]}),p===`save`?(0,Y.jsx)(qr,{question:s?`Overwrite “${e.name}” with the current layout?`:`Save the current layout as “${e.name}” here?`,verb:s?`Overwrite`:`Save`,onConfirm:()=>{m(null),d()},onCancel:()=>m(null)}):p===`delete`?(0,Y.jsx)(qr,{question:`Delete this layout? This can’t be undone.`,verb:`Delete`,onConfirm:()=>{m(null),u()},onCancel:()=>m(null)}):p===`load`?(0,Y.jsx)(qr,{question:`Loading discards unsaved layout changes.`,verb:`Load`,onConfirm:y,onCancel:()=>m(null)}):(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5`,children:[t!==null&&(0,Y.jsx)(`span`,{className:`text-2xs uppercase tracking-wide text-fg-muted`,children:t}),(0,Y.jsxs)(un,{label:`Layout actions`,className:`ml-auto`,children:[a&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(Yr,{icon:Xn,label:n?`Save`:`Save the current layout as “${e.name}”`,onClick:x}),(0,Y.jsx)(Yr,{icon:sn,label:`Duplicate`,onClick:()=>b(`duplicate`)})]}),(0,Y.jsx)(Yr,{icon:Ae,label:`Rename`,onClick:()=>b(`rename`)}),(0,Y.jsx)(Yr,{icon:At,label:`Delete`,onClick:()=>m(`delete`)})]})]})]})}function qr({question:e,verb:t,onConfirm:n,onCancel:r}){return(0,Y.jsxs)(`div`,{className:`mt-2 flex items-center gap-3`,children:[(0,Y.jsx)(`span`,{className:`text-2xs text-fg-muted`,children:e}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:U(L,`text-danger`),children:t}),(0,Y.jsx)(`button`,{type:`button`,onClick:r,className:L,children:`Cancel`})]})}function Jr({active:e,onClick:t,children:n}){return(0,Y.jsx)(`button`,{type:`button`,"aria-pressed":e,onClick:t,className:U(`rounded-full px-2 py-0.5 text-2xs transition-colors`,e?`bg-action text-action-ink`:`bg-surface text-fg-secondary hover:text-fg`),children:n})}function Yr({icon:e,label:t,onClick:n}){return(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{asChild:!0,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:Ot,children:[(0,Y.jsx)(e,{className:`size-3.5`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:t})]})}),(0,Y.jsx)(z,{children:t})]})}var $=N()!==void 0&&/Mac/.test(navigator.platform),Xr=(0,J.lazy)(()=>$e(()=>import(`./SettingsDialog-DgMm212x.js`).then(e=>({default:e.SettingsDialog})),__vite__mapDeps([15,1,2,16,17,3,18,19,20,5,6,7,8,9,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42])));function Zr(){let e=w();(0,J.useEffect)(()=>{let t=t=>{for(let[n,r]of e.getQueriesData({queryKey:[`sessions`]}))r&&e.setQueryData(n,r.map(t));for(let[n,r]of e.getQueriesData({queryKey:[`project`]}))r&&e.setQueryData(n,{...r,sessions:r.sessions.map(t)})},n=q.onStatus(e=>t(t=>t.id===e.session?{...t,status:e.status,last_activity_at:e.last_activity_at}:t)),r=q.onRenamed(e=>t(t=>t.id===e.session?{...t,title:e.title,agent_title:`agent_title`in e?e.agent_title:t.agent_title,osc_title:`osc_title`in e?e.osc_title:t.osc_title}:t)),i=q.onAccount(t=>{for(let[n,r]of e.getQueriesData({queryKey:[`accounts`]}))r&&e.setQueryData(n,r.map(e=>e.id===t.account_id?{...e,logged_in:t.logged_in}:e))}),a=t=>{e.invalidateQueries({queryKey:[`sessions`]});for(let n of t)e.invalidateQueries({queryKey:[`project`,n]})},o=q.onSessionsChanged(e=>a(e.project_ids)),s=q.onSessionSwitched(e=>a([e.target_project]));return()=>{n(),r(),i(),o(),s()}},[e])}function Qr(){let e=de(),t=y(),[n,r]=(0,J.useState)(!1),i=_e(e.data),a=n=>{r(!1);let a=n.trim();a!==i&&t.mutate({displayName:a===e.data?.hostname?``:a},{onError:e=>K(e)})},o=!$&&(0,Y.jsx)(`img`,{src:`/puddle.svg`,alt:`Puddle`,className:`size-4`}),s=U(`flex h-full shrink-0 items-center gap-2 px-4`,$&&`[-webkit-app-region:no-drag]`),c=`truncate font-sans text-xs font-normal text-fg`;return n&&i!==void 0?(0,Y.jsxs)(`div`,{className:s,children:[o,(0,Y.jsx)(Qt,{initial:e.data?.displayName??i,maxLength:64,className:U(c,`w-40`),onCommit:a,onCancel:()=>r(!1)})]}):(0,Y.jsxs)(vt,{to:`/`,className:U(s,`hover:bg-elevated focus-visible:bg-elevated`),title:`All projects`,children:[o,i!==void 0&&(0,Y.jsx)(`span`,{className:c,...Gt(()=>r(!0)),children:i})]})}function $r(){let e=St(),t=dt(`palette.toggle`),n=fe(e.id).data?.project,r=n!==void 0&&n.id===e.id?n.name:void 0;return(0,Y.jsx)(`button`,{type:`button`,onClick:jt,className:U(`flex h-full min-w-0 w-full cursor-pointer items-center justify-center gap-2 bg-transparent px-2 font-normal text-fg-muted transition-colors hover:bg-elevated focus-visible:bg-elevated`,$&&`[-webkit-app-region:no-drag]`),children:(0,Y.jsxs)(`span`,{className:U(`pointer-events-none absolute left-1/2 top-1/2 flex max-w-[40%] -translate-x-1/2 -translate-y-1/2 items-center gap-2`,r&&j(n?.colour)),children:[(0,Y.jsx)(`span`,{className:`truncate text-xs`,children:r??`Puddle`}),(0,Y.jsx)(`span`,{className:`shrink-0 text-2xs`,children:t})]})})}function ei(){let{fullScreen:e,animate:t}=ht(),n=$&&!e;return(0,Y.jsxs)(`header`,{onClick:e=>{let t=e.target;e.currentTarget.contains(t)&&(t.closest(`[data-header-section], [aria-label="Workspace controls"], button, a, input`)||jt())},className:U(`island-outline relative grid shrink-0 cursor-pointer grid-cols-[auto_1px_minmax(0,1fr)_1px_auto] items-center overflow-hidden rounded-[var(--ui-surface-radius)] bg-surface`,`h-9`,!$&&`mx-1.5 mt-1.5`,n&&`pl-[84px] [-webkit-app-region:drag]`,t&&`transition-[padding] duration-200 ease-out`),children:[n&&(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute left-[84px] top-1/2 h-5 w-px -translate-y-1/2 bg-border`}),(0,Y.jsx)(`div`,{"data-header-section":!0,className:`flex h-full min-w-0 cursor-default items-center overflow-hidden`,children:(0,Y.jsx)(Qr,{})}),(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`h-5 w-px bg-border`}),(0,Y.jsx)($r,{}),(0,Y.jsx)(`div`,{"aria-hidden":`true`,className:`h-5 w-px bg-border`}),(0,Y.jsxs)(un,{label:`Workspace controls`,className:U(`shell-header-actions h-full justify-self-end rounded-none!`,$&&`[-webkit-app-region:no-drag]`),children:[(0,Y.jsxs)(V,{children:[(0,Y.jsx)(H,{asChild:!0,children:(0,Y.jsxs)(G,{variant:`ghost`,size:`icon`,className:`compact:h-7 compact:w-7`,onClick:()=>nn(),children:[(0,Y.jsx)(Qn,{}),(0,Y.jsx)(`span`,{className:`sr-only`,children:`Settings`})]})}),(0,Y.jsx)(z,{children:`Settings`})]}),(0,Y.jsx)(Gr,{}),(0,Y.jsx)(zr,{}),(0,Y.jsx)(gr,{})]})]})}function ti(){Zr(),wr(),Ir();let{handler:e}=Rt(),t=P(),{pathname:n}=bt(),[r,i]=(0,J.useState)(!1),a=b(),o=a.data!==void 0&&le(a.data.protocol);return(0,J.useEffect)(()=>{if(!o)return;let e=()=>{let e=tt();q.reportTheme(e(`--text-primary`),e(`--bg-base`))};return e(),et(e)},[o]),(0,Y.jsxs)(`div`,{className:`flex h-screen flex-col overflow-hidden overscroll-y-none bg-ground`,children:[(0,Y.jsx)(ei,{}),(0,Y.jsx)(`main`,{className:`min-h-0 flex-1`,children:(0,Y.jsx)(kn,{resetOn:n,scope:n.startsWith(`/project/`)?`workspace`:`view`,children:(0,Y.jsx)(xt,{})})}),(0,Y.jsx)(er,{}),(0,Y.jsx)(dr,{}),(0,Y.jsx)(vr,{}),(0,Y.jsx)(br,{}),(0,Y.jsx)(xr,{}),(0,Y.jsx)(Cr,{}),(0,Y.jsx)(or,{onNewSession:e??void 0,onNewProject:()=>i(!0)}),t!==null&&(0,Y.jsx)(ln,{profileId:t,open:r,onOpenChange:i}),(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(Xr,{})}),(0,Y.jsx)(lr,{})]})}function ni(){return(0,Y.jsx)(Nt,{children:(0,Y.jsx)(ti,{})})}var ri=(0,J.lazy)(()=>$e(()=>import(`./Dashboard-C0AvtM5m.js`).then(e=>({default:e.Dashboard})),__vite__mapDeps([43,1,2,16,17,3,18,19,20,5,6,7,8,9,21,23,44,31,45,46,34,47,39,26,27]))),ii=(0,J.lazy)(()=>$e(()=>import(`./Workspace-CrZkK55U.js`).then(e=>({default:e.Workspace})),__vite__mapDeps([48,1,2,6,16,17,3,18,19,20,5,7,8,9,21,28,29,30,23,49,50,27,46,34,44,25,51,24,52,53,31,45,54,32,33,55,56,26,37,38,57,58,59,60,41,61]))),ai=new On({defaultOptions:{queries:{retry:1,staleTime:5e3}},mutationCache:new Tn({onError:e=>K(e)})});function oi(){let e=P(),t=ue(),n=e!==null&&t.data!==void 0&&!t.data.some(t=>t.id===e);return e===null||n?(0,Y.jsx)($n,{}):(0,Y.jsx)(Tt,{useTransitions:!1,children:(0,Y.jsx)(J.Suspense,{fallback:null,children:(0,Y.jsx)(yt,{children:(0,Y.jsxs)(Et,{element:(0,Y.jsx)(ni,{}),children:[(0,Y.jsx)(Et,{path:`/`,element:(0,Y.jsx)(ri,{})}),(0,Y.jsx)(Et,{path:`/project/:id`,element:(0,Y.jsx)(ii,{})}),(0,Y.jsx)(Et,{path:`/project/:id/session/:sid`,element:(0,Y.jsx)(ii,{})})]})})})})}function si(){let e=(0,J.useSyncExternalStore)(De.subscribe,De.get);return(0,Y.jsx)(ge,{client:ai,children:(0,Y.jsxs)(Kt,{delayDuration:300,children:[(0,Y.jsx)(Gn,{}),(0,Y.jsx)(kn,{scope:`app`,children:e?window.location.pathname.startsWith(`/forward/`)?(0,Y.jsx)(wn,{}):(0,Y.jsx)(oi,{}):(0,Y.jsx)(jn,{})}),(0,Y.jsx)(An,{})]})})}export{si as App};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{R as n,at as r,ct as i,h as a,nt as o,pt as s,tt as c,vt as l}from"./protocol-support-BApsXw77.js";import{b as u}from"./auth-olLlgxc3.js";import{a as d,c as f,d as p,i as m,o as h,s as g,t as _,u as v}from"./LazyTerminal-Dp2CN0Y8.js";import{t as y}from"./jsx-runtime-By8HlURe.js";import{g as b,p as x}from"./hotkeys-Cu0t6sbz.js";import{a as S,c as C,i as w,r as T}from"./session-order-2oedrwDu.js";import{a as E,o as D,r as O,s as k,t as A}from"./dialog-D-Axqpzg.js";import{n as j,t as M}from"./chevron-right-BEy-IXEZ.js";import{n as N}from"./createLucideIcon-C9A1vLE-.js";import{t as P}from"./button-C_Rvtcwg.js";import{c as F,d as I,n as L,r as R,t as z,u as B}from"./context-menu-D3ZhKA9s.js";import{n as V,t as H}from"./NewProjectDialog-DMixZDC_.js";import{r as U,t as W}from"./ws-Dgc69_w8.js";var G=e(t(),1),K=y(),q=!1;function J(){let[e,t]=(0,G.useState)(q),[n,r]=(0,G.useState)(null);(0,G.useEffect)(()=>{if(!e)return;let t=!1;return W.spawnShell(u).then(e=>{t||r(e)}),()=>{t=!0}},[e]);let i=()=>{q=!1,t(!1),r(null)};return{open:e,term:n,toggle:()=>{e?(n&&W.killShell(u,n),i()):(q=!0,t(!0))},onExit:i}}function Y({term:e,onExit:t}){return(0,K.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,K.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:(0,K.jsx)(`div`,{className:`workspace-surface island-outline size-full bg-surface p-1`,children:(0,K.jsx)(`div`,{className:`size-full overflow-hidden rounded-[var(--ui-radius)] bg-ground p-1`,children:e!==null&&(0,K.jsx)(_,{stream:`home`,term:e,onExit:t})})})})})}var X=`group block w-full island-outline rounded-[var(--ui-surface-radius)] bg-surface p-4 text-left transition-colors hover:bg-elevated`,ee=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function te({project:e,repoPath:t,sessions:n}){let r=n.filter(e=>e.status!==`archived`);return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`h2`,{className:N(`truncate pr-16 text-base font-semibold`,d(e.colour)||`text-fg group-hover:text-accent`),children:e.name}),(0,K.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:t??`…`}),(0,K.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,K.jsxs)(`span`,{children:[r.length,` session`,r.length===1?``:`s`]}),ee.map(({status:e,colour:t})=>{let n=r.filter(t=>t.status===e).length;return n>0?(0,K.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,K.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),n,` `,e.replace(`_`,` `)]},e):null})]})]})}function Z({icon:e,label:t,onClick:n}){return(0,K.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:`flex items-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-ground hover:text-fg`,children:(0,K.jsx)(e,{className:`size-4`})})}function Q({project:e,repoPath:t,draggable:r,dragging:i,onDragStart:s,onDragEnd:c,onDragOver:u}){let g=o(),_=a(n().data?.protocol),y=l(e.id),[b,x]=(0,G.useState)(!1),[S,w]=(0,G.useState)(e.name),[T,M]=(0,G.useState)(p(e)),[V,H]=(0,G.useState)(e.colour??null),W=t=>g.mutate({id:e.id,archived:t},{onError:e=>U(e)}),q=()=>{w(e.name),H(e.colour??null),M(p(e)),x(!0)},J=()=>{let t=S.trim(),n=v(T);if(!t){x(!1);return}let r={...t===e.name?{}:{name:t},...n&&n!==p(e)?{abbrev:n}:{},..._&&V!==(e.colour??null)?{colour:V}:{}};if(Object.keys(r).length===0){x(!1);return}g.mutate({id:e.id,...r},{onSuccess:()=>x(!1),onError:e=>U(e)})};return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(z,{children:[(0,K.jsx)(F,{asChild:!0,children:(0,K.jsxs)(`div`,{draggable:r,onDragStart:s,onDragEnd:c,onDragOver:u,className:N(`group relative transition-opacity`,i&&`opacity-50`),children:[(0,K.jsx)(C,{draggable:!1,to:`/project/${e.id}`,className:X,children:(0,K.jsx)(te,{project:e,repoPath:t,sessions:y.data??[]})}),(0,K.jsx)(`div`,{className:`absolute right-2 top-2 hidden gap-0.5 group-hover:flex has-[[data-state=open]]:flex pointer-coarse:flex`,children:e.archived?(0,K.jsx)(Z,{icon:I,label:`Reopen project`,onClick:()=>W(!1)}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(Z,{icon:h,label:`Edit project`,onClick:q}),(0,K.jsx)(Z,{icon:B,label:`Archive project`,onClick:()=>W(!0)})]})})]})}),(0,K.jsx)(L,{children:e.archived?(0,K.jsxs)(R,{onSelect:()=>W(!1),children:[(0,K.jsx)(I,{}),` Reopen`]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(R,{onSelect:q,children:[(0,K.jsx)(h,{}),` Edit`]}),(0,K.jsxs)(R,{onSelect:()=>W(!0),children:[(0,K.jsx)(B,{}),` Archive`]})]})})]}),(0,K.jsx)(A,{open:b,onOpenChange:x,children:(0,K.jsxs)(O,{children:[(0,K.jsx)(D,{children:(0,K.jsx)(k,{children:`Edit project`})}),(0,K.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),J()},children:[(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(f,{htmlFor:`project-name-${e.id}`,children:`Name`}),(0,K.jsx)(j,{id:`project-name-${e.id}`,value:S,className:d(V),onChange:e=>w(e.target.value),autoFocus:!0})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(f,{htmlFor:`project-abbrev-${e.id}`,children:`Abbreviation`}),(0,K.jsx)(j,{id:`project-abbrev-${e.id}`,maxLength:5,value:T,onChange:e=>M(v(e.target.value)),className:`w-24 uppercase`}),(0,K.jsxs)(`p`,{className:`text-2xs text-fg-muted`,children:[`Up to `,5,` characters — the label on the collapsed sidebar rail.`]})]}),_&&(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,K.jsx)(`span`,{className:`text-xs text-fg-secondary`,children:`Colour`}),(0,K.jsx)(m,{value:V,onChange:H,label:`Project colour`})]}),(0,K.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,K.jsx)(f,{className:`text-fg-muted`,children:`Path`}),(0,K.jsx)(`p`,{className:`truncate text-2xs text-fg-muted`,children:t??`…`})]}),(0,K.jsxs)(E,{children:[(0,K.jsx)(P,{type:`button`,variant:`ghost`,onClick:()=>x(!1),children:`Cancel`}),(0,K.jsx)(P,{type:`submit`,disabled:!S.trim()||g.isPending,children:`Save`})]})]})]})})]})}function $({icon:e,label:t,hint:n,onClick:r}){return(0,K.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col island-outline rounded-[var(--ui-surface-radius)] bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,K.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,K.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,K.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function ne(){let e=b(),t=i(e??void 0),n=s(),a=r(e??void 0),o=c(e??``),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(!1),h=J(),_=x(`palette.toggle`),v=e=>n.data?.find(t=>t.id===e)?.path,y=t.data??[],C=a.data?.projectOrder??[],E=T(y.filter(e=>!e.archived),C),D=y.filter(e=>e.archived),O=(e,t)=>{e!==t&&o.mutate({projectOrder:w(E.map(e=>e.id),e,t)})};return(0,K.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,K.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,K.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[y.length===0&&(0,K.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,K.jsx)(g,{className:`size-8 text-fg-muted`}),(0,K.jsxs)(`p`,{className:`text-sm text-fg-secondary`,children:[`No projects yet — open one below, or press `,_,`.`]})]}),(0,K.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[E.map(e=>(0,K.jsx)(Q,{project:e,repoPath:v(e.repo_id),draggable:!0,dragging:d===e.id,onDragStart:()=>f(e.id),onDragEnd:()=>f(null),onDragOver:t=>{t.preventDefault(),d&&d!==e.id&&O(d,e.id)}},e.id)),(0,K.jsx)($,{icon:V,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>u(!0)}),(0,K.jsx)($,{icon:S,label:h.open?`Close terminal`:`Open terminal`,hint:h.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:h.toggle})]}),D.length>0&&(0,K.jsxs)(`div`,{className:`mt-6`,children:[(0,K.jsxs)(`button`,{type:`button`,onClick:()=>m(e=>!e),className:`flex items-center gap-1.5 px-1 py-1.5 text-2xs uppercase tracking-wide text-fg-muted transition-colors hover:text-fg`,children:[(0,K.jsx)(M,{className:N(`size-3 transition-transform`,p&&`rotate-90`)}),(0,K.jsx)(B,{className:`size-3`}),(0,K.jsx)(`span`,{children:`Archived`}),(0,K.jsx)(`span`,{className:`tabular-nums`,children:D.length})]}),p&&(0,K.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:D.map(e=>(0,K.jsx)(Q,{project:e,repoPath:v(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),h.open&&(0,K.jsx)(Y,{term:h.term,onExit:h.onExit}),e!==null&&(0,K.jsx)(H,{profileId:e,open:l,onOpenChange:u})]})}export{ne as Dashboard};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-By8HlURe.js";import{a as r,i,o as a,r as o,s,t as c}from"./dialog-D-Axqpzg.js";import{t as l}from"./x-Dq6POV20.js";import{t as u}from"./createLucideIcon-C9A1vLE-.js";import{t as d}from"./button-C_Rvtcwg.js";import{i as f,t as p,u as m}from"./buffer-store-DIOiWz9q.js";import{t as h}from"./drafts-B_tChlzR.js";import{t as g}from"./editor-sync-W1bamxAP.js";var _=u(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),v=e(t(),1),y=n();function b(e,t,n){let r=p(e,t,n);return(0,v.useSyncExternalStore)((0,v.useCallback)(e=>m(r,e),[r]),()=>f(r))}function x({session:e,path:t,kind:n,root:r}){return b(e,t,r)&&n!==`commit`?(0,y.jsx)(_,{"aria-hidden":!0,className:`size-2 shrink-0 fill-current text-fg-muted group-hover:invisible group-focus-within:invisible`}):null}function S({session:e,path:t,kind:n,root:u,label:f,onClose:p}){let m=b(e,t,u)&&n!==`commit`,[_,x]=(0,v.useState)(!1),S=()=>m?x(!0):p();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`button`,{onClick:e=>{e.stopPropagation(),S()},className:`hidden size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg group-hover:flex group-focus-within:flex pointer-coarse:flex`,"aria-label":`Close ${f}`,children:(0,y.jsx)(l,{className:`size-3`})}),(0,y.jsx)(c,{open:_,onOpenChange:e=>!e&&x(!1),children:(0,y.jsxs)(o,{children:[(0,y.jsxs)(a,{children:[(0,y.jsxs)(s,{children:[`Discard changes to `,f,`?`]}),(0,y.jsx)(i,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,y.jsxs)(r,{children:[(0,y.jsx)(d,{variant:`ghost`,onClick:()=>x(!1),children:`Keep editing`}),(0,y.jsx)(d,{variant:`danger`,onClick:()=>{h(e,t,u),g(e,t,u),x(!1),p()},children:`Discard`})]})]})})]})}export{x as EditorDirtyDot,S as EditorTabClose};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-CYeh8_uU.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/react-dom-cJyBB_A4.js","assets/protocol-support-BApsXw77.js","assets/auth-olLlgxc3.js","assets/jsx-runtime-By8HlURe.js","assets/api-BOuyloUi.js","assets/client-settings-DhfHheKR.js","assets/preload-helper-Czpn1I53.js","assets/index-BqOVeoIr.js","assets/index-LpAqnBR3.css","assets/hotkeys-Cu0t6sbz.js","assets/forward-link-DMvLf0Xw.js","assets/dist-BOS6OKSE.js","assets/createLucideIcon-C9A1vLE-.js","assets/motion-OSLfKoC0.js","assets/FindWidget-DG1YP6Zx.js","assets/x-Dq6POV20.js","assets/chevron-down-HQLVE6o5.js","assets/selection-actions-Cm0Oytya.js","assets/button-C_Rvtcwg.js","assets/copy-D0Theg4Q.js","assets/ws-Dgc69_w8.js","assets/code-Cf4ftdOa.js","assets/math-delimiters-BCnTi7Ii.js","assets/Terminal-BrP-ENHg.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{W as n}from"./auth-olLlgxc3.js";import{t as r}from"./jsx-runtime-By8HlURe.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{C as a}from"./dialog-D-Axqpzg.js";import{n as o}from"./chevron-right-BEy-IXEZ.js";import{n as s,t as c}from"./createLucideIcon-C9A1vLE-.js";function l(e){return e.trim().slice(0,5).toUpperCase()}function u(e){return e.abbrev??l(e.name)}function d(e){return e.trim().toUpperCase().slice(0,5)}var f=e(t(),1),p=r(),m=`Label`,h=f.forwardRef((e,t)=>(0,p.jsx)(a.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));h.displayName=m;var g=h;function _({className:e,...t}){return(0,p.jsx)(g,{className:s(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var v=c(`folder-git-2`,[[`path`,{d:`M18 19a5 5 0 0 1-5-5v8`,key:`sz5oeg`}],[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5`,key:`1w6njk`}],[`circle`,{cx:`13`,cy:`12`,r:`2`,key:`1j92g6`}],[`circle`,{cx:`20`,cy:`19`,r:`2`,key:`1obnsp`}]]),y=c(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),b={navy:`text-fg`,gold:`text-fg-gold`,blue:`text-icon-blue`,green:`text-icon-green`,amber:`text-icon-amber`,red:`text-icon-red`,violet:`text-icon-violet`,cyan:`text-icon-cyan`,accent:`text-accent`};function x(e){return e&&b[e]||``}function S({value:e,onChange:t,disabled:r=!1,label:i=`Colour`}){return(0,p.jsx)(`div`,{role:`group`,"aria-label":i,className:`flex flex-wrap items-center gap-1`,children:[null,...n].map(n=>(0,p.jsx)(`button`,{type:`button`,title:n??`Default`,"aria-label":n??`Default colour`,"aria-pressed":(e??null)===n,disabled:r,onClick:()=>t(n),className:s(`flex size-7 cursor-pointer items-center justify-center rounded-md transition-colors hover:bg-border/50 focus-visible:bg-border/50 disabled:cursor-default disabled:opacity-50`,(e??null)===n&&`bg-border/50`),children:(0,p.jsx)(`span`,{className:s(`size-3.5 rounded-full`,n?s(`bg-current`,x(n)):`bg-fg-muted`)})},n??`default`))})}function C({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:a,className:c,hintsClassName:l,autoFocus:u}){let[d,m]=(0,f.useState)(!1),[h,g]=(0,f.useState)(0),_=e=>{n(e.value),r?.(e),m(!1)};return(0,p.jsxs)(`div`,{className:`relative`,children:[(0,p.jsx)(o,{id:e,value:t,onChange:e=>{n(e.target.value),m(!0),g(0)},onFocus:()=>m(!0),onBlur:()=>m(!1),onKeyDown:e=>{if(!(!d||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),g(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),g(e=>(e-1+i.length)%i.length);else if(e.key===`Enter`||e.key===`Tab`){let t=i[h]??i[0];t&&(e.preventDefault(),_(t))}else e.key===`Escape`&&(e.stopPropagation(),m(!1))},placeholder:a,className:c,autoComplete:`off`,spellCheck:!1,autoFocus:u}),d&&i.length>0&&(0,p.jsx)(`ul`,{className:s(`absolute top-full z-10 mt-1 max-h-56 overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,l??`w-full`),children:i.map((e,t)=>(0,p.jsx)(`li`,{children:(0,p.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),_(e)},onMouseEnter:()=>g(t),className:s(`relative flex cursor-pointer select-none items-center gap-2 rounded-[var(--ui-menu-radius)] px-2 py-1.5 text-sm text-fg outline-none transition-colors`,`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,`w-full text-xs`),"data-selected":t===h,children:[(0,p.jsx)(`span`,{className:`truncate`,children:e.label??e.value}),e.badge&&(0,p.jsx)(`span`,{className:`ml-auto shrink-0 text-2xs opacity-70`,children:e.badge})]})},e.value))})]})}var w=(0,f.lazy)(()=>i(()=>import(`./Terminal-CYeh8_uU.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]))),T=null;async function E(){T=(await i(()=>import(`./Terminal-CYeh8_uU.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]))).Terminal}function D(e){return T?(0,p.jsx)(T,{...e}):(0,p.jsx)(f.Suspense,{fallback:(0,p.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,p.jsx)(w,{...e})})}export{x as a,_ as c,u as d,S as i,l,E as n,y as o,C as r,v as s,D as t,d as u};
|