@augmentd-labs/canvas-web 2.26.19 → 2.26.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/assets/DocumentBodyEditor-CE2S2X6g.js +1 -0
  2. package/dist/assets/DocumentIcon-BS10SIP6.js +1 -0
  3. package/dist/assets/EditorOverlay-BUToR_av.js +1 -0
  4. package/dist/assets/FileForm-BxTixeDm.js +1 -0
  5. package/dist/assets/FiltersApplet-DNYAQP5F.js +1 -0
  6. package/dist/assets/HomeFab-CpTZdNyY.js +3 -0
  7. package/dist/assets/IdentityFields-C2MPM-Ab.js +1 -0
  8. package/dist/assets/LensApplet-CRa1j2WP.js +1 -0
  9. package/dist/assets/LinkToCard-BZwwE-Dv.js +1 -0
  10. package/dist/assets/LinkToSidePanel-eCy3nW4R.js +1 -0
  11. package/dist/assets/{LocationTab-BONJQfYM.js → LocationTab-DAtqAQ3l.js} +1 -1
  12. package/dist/assets/{MarkdownEditor-CkobBLtI.js → MarkdownEditor-7OqSDr7E.js} +1 -1
  13. package/dist/assets/MessageComposerDialog-DzLhkHyh.js +4 -0
  14. package/dist/assets/{NextShell-Byg6OtC2.js → NextShell-D9gvlKY2.js} +1 -1
  15. package/dist/assets/NotesApplet-CFK86JYj.js +1 -0
  16. package/dist/assets/ObjectPropertiesCard-C3jt40tM.css +1 -0
  17. package/dist/assets/ObjectPropertiesCard-DDcRLpsW.js +8 -0
  18. package/dist/assets/PathPickerField-cVs5sZuG.js +1 -0
  19. package/dist/assets/PickDocumentsCard-BlicxMqC.js +1 -0
  20. package/dist/assets/SketchApplet-D8mkYmK9.js +1 -0
  21. package/dist/assets/{SketchEditor-C9_lu3Ot.js → SketchEditor-zMrm1npg.js} +4 -4
  22. package/dist/assets/TerminalApplet-BO2HRp0z.js +20 -0
  23. package/dist/assets/TerminalApplet-BrP-ENHg.css +1 -0
  24. package/dist/assets/TextDocumentEditor-7V4aFL8i.js +1 -0
  25. package/dist/assets/TodosApplet-swdaBT-2.js +1 -0
  26. package/dist/assets/TodosWidget-BXF8fYer.js +1 -0
  27. package/dist/assets/UploadProgressList-B2xCVzFR.js +1 -0
  28. package/dist/assets/_agentId_-CHdTYJFu.js +0 -0
  29. package/dist/assets/_contextId_-m9zn5qav.js +1 -0
  30. package/dist/assets/_workspaceName_-D0z9E9Uy.js +1 -0
  31. package/dist/assets/about-pl0DXTEt.js +1 -0
  32. package/dist/assets/add-B30V-yHb.js +1 -0
  33. package/dist/assets/admin-Bhg9QBHL.js +5 -0
  34. package/dist/assets/agents-Bc7_wscP.js +1 -0
  35. package/dist/assets/agents-ClK3Y2x0.js +1 -0
  36. package/dist/assets/alert-dialog-DIA-tAP5.js +1 -0
  37. package/dist/assets/api-CA6WiiYM.js +1 -0
  38. package/dist/assets/api-tokens-O5iFESo0.js +1 -0
  39. package/dist/assets/appearance-DLo_2WH0.js +1 -0
  40. package/dist/assets/applet-target-DnTa2VAT.js +1 -0
  41. package/dist/assets/apps-DzFFo5D0.js +1 -0
  42. package/dist/assets/auth-Bx9fAZmz.js +1 -0
  43. package/dist/assets/auth-CUdpxbLV.js +1 -0
  44. package/dist/assets/backend-sync-progress-DU-e9TWi.css +1 -0
  45. package/dist/assets/backend-sync-progress-DWR42uQV.js +7 -0
  46. package/dist/assets/blobs-WiXP9QRi.js +1 -0
  47. package/dist/assets/button-Bv4zA1qr.js +1 -0
  48. package/dist/assets/chunk-62JRHF6Z-vspAGgtK.js +3 -0
  49. package/dist/assets/{chunk-K2UTITRG-zQFDOW3Q.js → chunk-K2UTITRG-BvHe9UPk.js} +3 -3
  50. package/dist/assets/code-editor-BOIngd5F.js +40 -0
  51. package/dist/assets/color-DFEH4BfK.js +1 -0
  52. package/dist/assets/content-app-view-BUi8HG1r.js +1 -0
  53. package/dist/assets/context-D_K4g9SQ.js +1 -0
  54. package/dist/assets/contexts-B6d6Axza.js +1 -0
  55. package/dist/assets/contexts-CgydYDn-2.js +1 -0
  56. package/dist/assets/date-time-picker-BZaA3M9_.js +1 -0
  57. package/dist/assets/desk-dI_FvLsK.js +1 -0
  58. package/dist/assets/devices-CAa1bRxk.js +1 -0
  59. package/dist/assets/devices-D3-_UWM0.js +1 -0
  60. package/dist/assets/document-BG_mODBn.js +1 -0
  61. package/dist/assets/document-list-BiogH4tf.js +2 -0
  62. package/dist/assets/document-list-DAYdk5vh.css +1 -0
  63. package/dist/assets/document-open-mode-DoImW-xs.js +1 -0
  64. package/dist/assets/embedding-Cjrxh6MN.js +1 -0
  65. package/dist/assets/embedding-m8SZH4oN.js +1 -0
  66. package/dist/assets/form-panel-Dz96K7Lv.js +1 -0
  67. package/dist/assets/geo-CZfs0E-x.js +1 -0
  68. package/dist/assets/home-C5IxNq_5.js +1 -0
  69. package/dist/assets/image-GAAHSSAO-CI-0hUck.js +1 -0
  70. package/dist/assets/index-D7EoeBID.css +2 -0
  71. package/dist/assets/index-DtZS4JJ4.js +16 -0
  72. package/dist/assets/inferd-config-editor-DagMmwW4.js +1 -0
  73. package/dist/assets/input-BOtCd4HP.js +1 -0
  74. package/dist/assets/key-bindings-DomR6ZNC.js +1 -0
  75. package/dist/assets/label-CNoJOoe0.js +1 -0
  76. package/dist/assets/last-path-BbXWC3b3.js +1 -0
  77. package/dist/assets/layer-style-Byl5LNFR.js +1 -0
  78. package/dist/assets/lazy-editor-Cbva8Pe2.js +2 -0
  79. package/dist/assets/logs-CdbfY8_H.js +1 -0
  80. package/dist/assets/{markdown-html-XoABNf32.js → markdown-html-CZMGihx6.js} +1 -1
  81. package/dist/assets/markdown-view-BBBZtNSR.js +2 -0
  82. package/dist/assets/note-save-status-DPz4VzL6.js +1 -0
  83. package/dist/assets/offline-BjMpUv3N.js +1 -0
  84. package/dist/assets/page-header-GtTr9Ff_.js +1 -0
  85. package/dist/assets/public-share-DT9Tgn_Y.js +1 -0
  86. package/dist/assets/query-debug-tVbB_8Z6.js +1 -0
  87. package/dist/assets/react-BHzhHVTZ.js +164 -0
  88. package/dist/assets/registry-BgnkvPjl.js +2 -0
  89. package/dist/assets/relation-events-CKio19hE.js +1 -0
  90. package/dist/assets/remotes-DR_iJClb.js +1 -0
  91. package/dist/assets/role-C5I0Plgn.js +1 -0
  92. package/dist/assets/roles-DERIgujv.js +2 -0
  93. package/dist/assets/roles-DswT1Lv0.js +2 -0
  94. package/dist/assets/settings-B4LC1yCH.js +1 -0
  95. package/dist/assets/settings-BXOyceZ3.js +1 -0
  96. package/dist/assets/settings-CUzf6xEQ.js +14 -0
  97. package/dist/assets/settings-DhoHM9AU.js +1 -0
  98. package/dist/assets/share-target-CpjVaYVl.js +1 -0
  99. package/dist/assets/shared-1dpCuibu.js +1 -0
  100. package/dist/assets/shared-B824Ibpc.js +1 -0
  101. package/dist/assets/sketch-lazy-Q58-vPF-.js +2 -0
  102. package/dist/assets/socket-CtH3EU9m.js +1 -0
  103. package/dist/assets/subtree-transfer-dialog-B7s4r78T.js +1 -0
  104. package/dist/assets/tags-YamdPoBK.js +1 -0
  105. package/dist/assets/text-documents-D_zDMyhB.js +2 -0
  106. package/dist/assets/{ui-BqHBdBU4.js → ui-BSqPn1LJ.js} +2 -2
  107. package/dist/assets/url-params-n7kU_WZ-.js +1 -0
  108. package/dist/assets/use-applet-docs-Cry2SFsG.js +1 -0
  109. package/dist/assets/use-applet-target-mkjQujx6.js +1 -0
  110. package/dist/assets/use-canvas-pins-C57Vbkrq.css +1 -0
  111. package/dist/assets/use-canvas-pins-CZBfEB5E.js +3 -0
  112. package/dist/assets/use-create-panel-DhSNIGtr.js +1 -0
  113. package/dist/assets/use-document-modal-PG8bQyIB.js +1 -0
  114. package/dist/assets/use-menu-BVkqNEIx.js +1 -0
  115. package/dist/assets/use-mobile-Db-vWu9Y.js +1 -0
  116. package/dist/assets/use-settings-back-Dk-DJEUO.js +1 -0
  117. package/dist/assets/use-sortable-data-DYIDDI8c.js +1 -0
  118. package/dist/assets/{use-theme-Bd8sb5Ox.js → use-theme-DaxpiICf.js} +1 -1
  119. package/dist/assets/use-toast-BlLDqSUO.js +1 -0
  120. package/dist/assets/use-toolbox-Ck_cLGgf.js +1 -0
  121. package/dist/assets/use-workspace-identity-BVpGHkZq.js +1 -0
  122. package/dist/assets/useAddTarget-CVRPElxz.js +1 -0
  123. package/dist/assets/useAgentModels-ndLotMWH.js +3 -0
  124. package/dist/assets/useDocumentThumbnail-C_rq2rXs.js +1 -0
  125. package/dist/assets/useEditNoteFields-Bigs9ZG8.js +1 -0
  126. package/dist/assets/useEscapeClose-DR_xKT_k.js +1 -0
  127. package/dist/assets/useSocketSubscription-ifW-vnlb.js +1 -0
  128. package/dist/assets/useToastHelpers-CRrpIIdY.js +1 -0
  129. package/dist/assets/users-C9N-O1QA.js +1 -0
  130. package/dist/assets/workspace-BydSRtST.js +1 -0
  131. package/dist/assets/workspace-CJ1PWQ29.js +1 -0
  132. package/dist/assets/workspace-access-C9nZlBBZ.js +1 -0
  133. package/dist/assets/workspace-area-menu-Ba_9bGKs.js +1 -0
  134. package/dist/assets/workspace-content-gate-D8bzGD9i.js +1 -0
  135. package/dist/assets/workspace-import-form-D5JA8gzx.js +1 -0
  136. package/dist/assets/workspaces-BBgdfAM_.js +1 -0
  137. package/dist/assets/workspaces-Dx5_N57M.js +1 -0
  138. package/dist/index.html +69 -14
  139. package/dist/sw.js +1 -1
  140. package/package.json +2 -2
  141. package/dist/assets/EditorOverlay-B384ALjA.js +0 -1
  142. package/dist/assets/TextDocumentEditor-DBVWuJaR.js +0 -1
  143. package/dist/assets/alert-dialog-BC58hyW-.js +0 -1
  144. package/dist/assets/blobs-CtDkR2hC.js +0 -1
  145. package/dist/assets/code-editor-BQnKd3jw.js +0 -40
  146. package/dist/assets/document-list-BmUv3zzK.js +0 -19
  147. package/dist/assets/document-list-r-TfV16D.css +0 -1
  148. package/dist/assets/image-GAAHSSAO-BoD-NvEF.js +0 -1
  149. package/dist/assets/index-BhcdilCi.css +0 -2
  150. package/dist/assets/index-DRji5GQn.js +0 -61
  151. package/dist/assets/react-BzqgEMSQ.js +0 -164
  152. package/dist/assets/subtree-transfer-dialog-DRz8kLqY.js +0 -1
  153. package/dist/assets/text-documents-BvR9-zf4.js +0 -3
  154. package/dist/assets/useAddTarget-CgZfKokT.js +0 -1
  155. package/dist/assets/workspace-BSXnX2Me.js +0 -1
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalApplet-BO2HRp0z.js","assets/rolldown-runtime-C0FnF6B9.js","assets/code-editor-BOIngd5F.js","assets/ui-BSqPn1LJ.js","assets/react-BHzhHVTZ.js","assets/use-applet-target-mkjQujx6.js","assets/workspace-CJ1PWQ29.js","assets/button-Bv4zA1qr.js","assets/utils-BxVxyehK.js","assets/utils-2pl1SbIp.js","assets/input-BOtCd4HP.js","assets/api-CA6WiiYM.js","assets/alert-dialog-DIA-tAP5.js","assets/use-toolbox-Ck_cLGgf.js","assets/TerminalApplet-BrP-ENHg.css","assets/NotesApplet-CFK86JYj.js","assets/useAddTarget-CVRPElxz.js","assets/context-D_K4g9SQ.js","assets/note-save-status-DPz4VzL6.js","assets/useEditNoteFields-Bigs9ZG8.js","assets/tags-YamdPoBK.js","assets/index-DtZS4JJ4.js","assets/preload-helper-Czpn1I53.js","assets/chunk-62JRHF6Z-vspAGgtK.js","assets/label-CNoJOoe0.js","assets/socket-hM4c-ZSl.js","assets/socket-CtH3EU9m.js","assets/auth-Bx9fAZmz.js","assets/use-toast-BlLDqSUO.js","assets/LinkToCard-BZwwE-Dv.js","assets/useEscapeClose-DR_xKT_k.js","assets/useToastHelpers-CRrpIIdY.js","assets/layer-style-Byl5LNFR.js","assets/color-DFEH4BfK.js","assets/DocumentIcon-BS10SIP6.js","assets/use-canvas-pins-CZBfEB5E.js","assets/TodosWidget-BXF8fYer.js","assets/ObjectPropertiesCard-DDcRLpsW.js","assets/use-mobile-Db-vWu9Y.js","assets/IdentityFields-C2MPM-Ab.js","assets/date-time-picker-BZaA3M9_.js","assets/relation-events-CKio19hE.js","assets/map-BxCwdK0d.js","assets/map-BcsP_QXj.css","assets/public-share-DT9Tgn_Y.js","assets/text-documents-D_zDMyhB.js","assets/blobs-WiXP9QRi.js","assets/useDocumentThumbnail-C_rq2rXs.js","assets/markdown-view-BBBZtNSR.js","assets/sanitize-DrVcFY1Q.js","assets/MessageComposerDialog-DzLhkHyh.js","assets/markdown-it-DRESbtwK.js","assets/punycode.es6-ZbLrB_Dn.js","assets/lazy-editor-Cbva8Pe2.js","assets/LinkToSidePanel-eCy3nW4R.js","assets/DocumentBodyEditor-CE2S2X6g.js","assets/use-document-modal-PG8bQyIB.js","assets/sketch-lazy-Q58-vPF-.js","assets/geo-CZfs0E-x.js","assets/ObjectPropertiesCard-C3jt40tM.css","assets/document-list-BiogH4tf.js","assets/document-open-mode-DoImW-xs.js","assets/PickDocumentsCard-BlicxMqC.js","assets/backend-sync-progress-DWR42uQV.js","assets/PathPickerField-cVs5sZuG.js","assets/backend-sync-progress-DU-e9TWi.css","assets/workspace-access-C9nZlBBZ.js","assets/search-COMZIxA7.js","assets/use-sortable-data-DYIDDI8c.js","assets/workspace-BydSRtST.js","assets/document-list-DAYdk5vh.css","assets/url-params-n7kU_WZ-.js","assets/use-canvas-pins-C57Vbkrq.css","assets/use-menu-BVkqNEIx.js","assets/last-path-BbXWC3b3.js","assets/workspace-area-menu-Ba_9bGKs.js","assets/workspace-content-gate-D8bzGD9i.js","assets/UploadProgressList-B2xCVzFR.js","assets/sha256-65KIjGvZ.js","assets/FileForm-BxTixeDm.js","assets/use-theme-DaxpiICf.js","assets/index-D7EoeBID.css","assets/shared-1dpCuibu.js","assets/use-applet-docs-Cry2SFsG.js","assets/TodosApplet-swdaBT-2.js","assets/LensApplet-CRa1j2WP.js","assets/FiltersApplet-DNYAQP5F.js","assets/SketchApplet-D8mkYmK9.js"])))=>i.map(i=>d[i]);
2
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{t as r}from"./preload-helper-Czpn1I53.js";import{Jr as i,St as a,ct as o,it as s,pn as c,tt as l}from"./ui-BSqPn1LJ.js";var u=e(n(),1),d=t();function f(e){let t=(0,u.lazy)(e);return function(e){return(0,d.jsx)(u.Suspense,{fallback:(0,d.jsx)(`p`,{className:`p-4 text-sm text-muted-foreground`,role:`status`,children:`Opening app…`}),children:(0,d.jsx)(t,{...e})})}}var p=f(()=>r(()=>import(`./TerminalApplet-BO2HRp0z.js`).then(e=>({default:e.TerminalApplet})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14]))),m=f(()=>r(()=>import(`./NotesApplet-CFK86JYj.js`).then(e=>({default:e.NotesApplet})),__vite__mapDeps([15,1,2,3,4,9,8,6,7,10,11,12,16,13,17,18,19,20,5,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83]))),h=f(()=>r(()=>import(`./TodosApplet-swdaBT-2.js`).then(e=>({default:e.TodosApplet})),__vite__mapDeps([84,1,2,3,4,9,8,6,7,10,11,12,16,13,17,40,20,41,5,82,29,30,31,28,32,33,34,54,83]))),g=f(()=>r(()=>import(`./LensApplet-CRa1j2WP.js`).then(e=>({default:e.LensApplet})),__vite__mapDeps([85,1,2,3,4,9,8,6,7,10,11,12,47,44,34,56,5,13,21,22,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,20,16,17,40,41,42,43,45,46,48,49,50,51,52,53,54,18,19,55,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81]))),_=f(()=>r(()=>import(`./FiltersApplet-DNYAQP5F.js`).then(e=>({default:e.FiltersApplet})),__vite__mapDeps([86,1,2,26,11,25,13,5,6,4,7,3,8,9,10,12,21,22,23,24,27,28,29,30,31,32,33,34,35,36,37,38,39,20,16,17,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,18,19,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81]))),v=f(()=>r(()=>import(`./SketchApplet-D8mkYmK9.js`).then(e=>({default:e.SketchApplet})),__vite__mapDeps([87,1,2,3,4,7,8,9,6,10,11,12,47,44,31,28,57,22,5,13,83,17]))),y=[{id:`terminal`,category:`utilities`,label:`Terminal`,icon:s,modes:[`context`],description:`Shell sessions for this context`,Component:p},{id:`filters`,category:`utilities`,label:`Filters`,icon:o,modes:[`context`,`global`],description:`Search and filter a workspace or a live context`,Component:_},{id:`notes`,category:`productivity`,label:`Notes`,icon:l,modes:[`context`],description:`All notes in the current context, editable in place`,Component:m},{id:`todo`,category:`productivity`,label:`Todos`,icon:c,modes:[`context`],description:`Todos in the current context, done items hidden by default`,Component:h},{id:`sketch`,category:`creative`,label:`Sketch`,icon:i,modes:[`context`],description:`Quick-sketch into the current context; tap a sketch to keep editing`,Component:v},{id:`lens`,category:`media`,label:`Lens`,icon:a,modes:[`context`],description:`Point a camera at things; matching documents surface live`,Component:g}];function b(e){return y.filter(t=>t.modes.includes(e))}export{b as n,y as t};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{u as t}from"./code-editor-BOIngd5F.js";var n=e(t(),1),r={enableHighAccuracy:!0,timeout:1e4,maximumAge:6e4};function i(e){let t=e.coords,n={lat:t.latitude,lon:t.longitude,source:`device`};return t.altitude!=null&&Number.isFinite(t.altitude)&&(n.alt=t.altitude),Number.isFinite(t.accuracy)&&(n.accuracy=Math.round(t.accuracy)),n}function a(){return new Promise((e,t)=>navigator.geolocation.getCurrentPosition(e,t,r))}function o(e){let t=e?.code;return t===1?`Location permission denied`:t===2?`Location unavailable; no fix right now`:t===3?`Timed out waiting for a location fix`:`Could not read your location`}function s(){let e=typeof navigator<`u`&&`geolocation`in navigator&&typeof window<`u`&&window.isSecureContext,[t,r]=(0,n.useState)(e?`prompt`:`unsupported`),[s,c]=(0,n.useState)(!1),[l,u]=(0,n.useState)(!1),[d,f]=(0,n.useState)(null),[p,m]=(0,n.useState)(null),[h,g]=(0,n.useState)(null),[_,v]=(0,n.useState)(null),y=(0,n.useRef)(!1),b=(0,n.useRef)(null),x=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(!e||!navigator.permissions?.query)return;let t=!1,n=null;return navigator.permissions.query({name:`geolocation`}).then(e=>{t||(n=e,r(e.state),e.onchange=()=>r(e.state))}).catch(()=>{}),()=>{t=!0,n&&(n.onchange=null)}},[e]);let S=(0,n.useCallback)(e=>{if(f(null),!e){x.current=null,g(null),v(null),y.current||c(!1);return}let t={lat:e.lat,lon:e.lon,source:`manual`};x.current=t,g(t),v(e.label??null),c(!0)},[]);return{supported:e,permission:t,enabled:s,busy:l,error:d,fix:p,setEnabled:(0,n.useCallback)(t=>{if(f(null),!t){y.current=!1,x.current=null,g(null),v(null),c(!1);return}x.current||e&&(y.current=!0,c(!0),u(!0),a().then(e=>{let t=i(e);b.current=t,m(t),r(`granted`)}).catch(e=>{f(o(e)),e?.code===1&&(r(`denied`),y.current=!1,c(!1))}).finally(()=>u(!1)))},[e]),manual:h,manualLabel:_,setManual:S,capture:(0,n.useCallback)(async()=>{if(x.current)return x.current;if(!y.current||!e)return null;try{return i(await a())}catch{return b.current}},[e])}}var c=`workspace:relations:refresh`;function l(){window.dispatchEvent(new CustomEvent(c))}export{l as n,s as r,c as t};
@@ -0,0 +1 @@
1
+ import{l as e}from"./code-editor-BOIngd5F.js";import{n as t}from"./page-header-GtTr9Ff_.js";var n=e();function r(){return(0,n.jsxs)(`div`,{className:`space-y-6`,children:[(0,n.jsx)(t,{title:`Remotes`,description:`Connect to remote Canvas instances`}),(0,n.jsx)(`div`,{className:`flex flex-col items-center justify-center py-12 space-y-4`,children:(0,n.jsxs)(`div`,{className:`text-center`,children:[(0,n.jsx)(`h2`,{className:`text-2xl font-semibold mb-2`,children:`Coming Soon`}),(0,n.jsx)(`p`,{className:`text-muted-foreground max-w-md`,children:`Remote connection management is currently under development. Check back later for updates.`})]})})]})}export{r as default};
@@ -0,0 +1 @@
1
+ import{c as e,t}from"./api-CA6WiiYM.js";var n={async listRoles(n){let r=new URLSearchParams;n?.type&&r.append(`type`,n.type),n?.userId&&r.append(`userId`,n.userId),n?.workspaceId&&r.append(`workspaceId`,n.workspaceId),n?.status&&r.append(`status`,n.status);let i=r.toString(),a=i?`${e.roles}?${i}`:e.roles;return(await t.get(a)).roles||[]},async getRole(n){return(await t.get(`${e.roles}/${n}`)).role},async createRole(n){return(await t.post(e.roles,n)).role},async deleteRole(n,r=!1){let i=r?`?force=true`:``;await t.delete(`${e.roles}/${n}${i}`)},async startRole(n){return(await t.post(`${e.roles}/${n}/start`,{})).role},async stopRole(n){await t.post(`${e.roles}/${n}/stop`,{})},async restartRole(n){return(await t.post(`${e.roles}/${n}/restart`,{})).role},async getRoleLogs(n,r=100){return(await t.get(`${e.roles}/${n}/logs?tail=${r}`)).logs||[]},async getRoleStats(n){return(await t.get(`${e.roles}/${n}/stats`)).stats},async getRoleHealth(n){return(await t.get(`${e.roles}/${n}/health`)).health},async listTemplates(){return(await t.get(`${e.roleTemplates}`)).templates||[]},async getTemplate(n){return(await t.get(`${e.roleTemplates}/${n}`)).template}};export{n as t};
@@ -0,0 +1,2 @@
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{Ar as r,Dr as i,Fr as a,Mt as o,Pr as s,Pt as c,_i as l,_t as u,ir as d,rt as f,wt as p}from"./ui-BSqPn1LJ.js";import{t as m}from"./button-Bv4zA1qr.js";import{t as h}from"./input-BOtCd4HP.js";import{i as g}from"./auth-Bx9fAZmz.js";import{n as _}from"./use-toast-BlLDqSUO.js";import{Pt as v}from"./workspace-CJ1PWQ29.js";import{t as y}from"./useEscapeClose-DR_xKT_k.js";import{n as b}from"./page-header-GtTr9Ff_.js";import{t as x}from"./role-C5I0Plgn.js";import{t as S}from"./form-panel-Dz96K7Lv.js";import{t as C}from"./use-create-panel-DhSNIGtr.js";var w=e(n(),1),T=t();function E({status:e}){let t={running:{icon:s,color:`text-success`,bg:`bg-success-subtle`,label:`Running`},stopped:{icon:r,color:`text-muted-foreground`,bg:`bg-muted`,label:`Stopped`},starting:{icon:i,color:`text-info`,bg:`bg-info-subtle`,label:`Starting`},stopping:{icon:i,color:`text-warning`,bg:`bg-warning-subtle`,label:`Stopping`},error:{icon:a,color:`text-destructive`,bg:`bg-destructive-subtle`,label:`Error`},created:{icon:l,color:`text-muted-foreground`,bg:`bg-muted`,label:`Created`},configured:{icon:l,color:`text-info`,bg:`bg-info-subtle`,label:`Configured`},removed:{icon:r,color:`text-destructive`,bg:`bg-destructive-subtle`,label:`Removed`}},n=t[e]||t.created,o=n.icon;return(0,T.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 rounded text-xs font-medium ${n.bg} ${n.color}`,children:[(0,T.jsx)(o,{className:`w-3 h-3`}),n.label]})}function D(){let[e,t]=(0,w.useState)([]),[n,r]=(0,w.useState)(!0),[a,s]=(0,w.useState)(null),[l,D]=(0,w.useState)(null);y(()=>D(null),l!==null);let[O,k]=C(),[A,j]=(0,w.useState)([]),[M,N]=(0,w.useState)([]),[P,F]=(0,w.useState)(``),[I,L]=(0,w.useState)(``),[R,z]=(0,w.useState)(``),[B,V]=(0,w.useState)(!1),{showToast:H}=_(),U=g(),W=(0,w.useCallback)(async()=>{try{r(!0);let e=await x.listRoles({type:`workspace`,userId:U?.id});t(e),s(null)}catch(e){let t=e instanceof Error?e.message:`Failed to fetch roles`;s(t)}finally{r(!1)}},[U?.id]);(0,w.useEffect)(()=>{let e=()=>W();e();let t=setInterval(e,3e4);return()=>clearInterval(t)},[W]),(0,w.useEffect)(()=>{O&&(x.listTemplates().then(e=>{let t=e.filter(e=>e.type===`workspace`);j(t),F(e=>e||t[0]?.id||``)}).catch(()=>j([])),v().then(e=>{N(e),z(t=>t||e[0]?.id||``)}).catch(()=>N([])))},[O]);let G=async e=>{if(e.preventDefault(),!(!P||!I.trim()||!R)){V(!0);try{let e=await x.createRole({template:P,name:I.trim(),type:`workspace`,userId:U?.id,workspaceId:R});L(``),k(!1),await W(),H({title:`Created`,description:`Role "${e.name}" created`})}catch(e){H({title:`Error`,description:e instanceof Error?e.message:`Failed to create role`,variant:`destructive`})}finally{V(!1)}}},K=async e=>{try{await x.startRole(e.id),H({title:`Success`,description:`Role "${e.name}" started successfully`}),W()}catch(e){let t=e instanceof Error?e.message:`Failed to start role`;H({title:`Error`,description:t,variant:`destructive`})}},q=async e=>{try{await x.stopRole(e.id),H({title:`Success`,description:`Role "${e.name}" stopped successfully`}),W()}catch(e){let t=e instanceof Error?e.message:`Failed to stop role`;H({title:`Error`,description:t,variant:`destructive`})}},J=async e=>{try{await x.restartRole(e.id),H({title:`Success`,description:`Role "${e.name}" restarted successfully`}),W()}catch(e){let t=e instanceof Error?e.message:`Failed to restart role`;H({title:`Error`,description:t,variant:`destructive`})}},Y=async e=>{try{let t=await x.getRoleLogs(e.id,100);D({role:e,logs:t})}catch(e){let t=e instanceof Error?e.message:`Failed to fetch logs`;H({title:`Error`,description:t,variant:`destructive`})}};return(0,T.jsxs)(`div`,{className:`space-y-6`,children:[(0,T.jsx)(b,{title:`My Roles`,description:`Manage your workspace roles and services`,actions:(0,T.jsxs)(T.Fragment,{children:[!O&&(0,T.jsxs)(m,{onClick:()=>k(!0),children:[(0,T.jsx)(o,{className:`mr-2 h-4 w-4`}),`Create Role`]}),(0,T.jsxs)(m,{onClick:W,variant:`outline`,children:[(0,T.jsx)(p,{className:`mr-2 h-4 w-4`}),`Refresh`]})]})}),O&&(0,T.jsx)(S,{title:`Create New Role`,onClose:()=>k(!1),children:(0,T.jsxs)(`form`,{onSubmit:G,className:`space-y-4`,children:[(0,T.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`label`,{htmlFor:`role-template`,className:`mb-1 block text-sm font-medium`,children:`Template`}),(0,T.jsxs)(`select`,{id:`role-template`,className:`w-full rounded-md border border-border bg-background px-3 py-2`,value:P,onChange:e=>F(e.target.value),disabled:B||A.length===0,children:[A.length===0&&(0,T.jsx)(`option`,{value:``,children:`No workspace templates available`}),A.map(e=>(0,T.jsxs)(`option`,{value:e.id,children:[e.name,` - `,e.description]},e.id))]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`label`,{htmlFor:`role-name`,className:`mb-1 block text-sm font-medium`,children:`Role Name`}),(0,T.jsx)(h,{id:`role-name`,value:I,onChange:e=>L(e.target.value),placeholder:`e.g., canvas-sshd`,disabled:B})]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`label`,{htmlFor:`role-workspace`,className:`mb-1 block text-sm font-medium`,children:`Workspace`}),(0,T.jsxs)(`select`,{id:`role-workspace`,className:`w-full rounded-md border border-border bg-background px-3 py-2`,value:R,onChange:e=>z(e.target.value),disabled:B||M.length===0,children:[M.length===0&&(0,T.jsx)(`option`,{value:``,children:`No workspaces available. Create one first.`}),M.map(e=>(0,T.jsx)(`option`,{value:e.id,children:e.label||e.name},e.id))]})]}),(0,T.jsxs)(m,{type:`submit`,disabled:B||!P||!I.trim()||!R,children:[(0,T.jsx)(o,{className:`mr-2 h-4 w-4`}),B?`Creating…`:`Create Role`]})]})}),n?(0,T.jsx)(`div`,{className:`text-center py-8`,children:`Loading roles...`}):a?(0,T.jsx)(`div`,{className:`text-center py-8 text-destructive`,children:a}):e.length===0?(0,T.jsxs)(`div`,{className:`text-center py-12 border rounded-lg`,children:[(0,T.jsx)(u,{className:`w-12 h-12 mx-auto text-muted-foreground mb-4`}),(0,T.jsx)(`p`,{className:`text-muted-foreground`,children:`You don't have any workspace roles yet`}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground mt-2`,children:`Contact your administrator to set up roles for your workspaces`})]}):(0,T.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:e.map(e=>(0,T.jsxs)(`div`,{className:`border rounded-lg p-6 space-y-4 hover:shadow-elevation-2 transition-shadow`,children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,T.jsxs)(`div`,{className:`flex-1`,children:[(0,T.jsx)(`h3`,{className:`font-semibold text-lg`,children:e.name}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.template})]}),(0,T.jsx)(E,{status:e.status})]}),e.container&&(0,T.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:(0,T.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,T.jsx)(u,{className:`w-3 h-3`}),(0,T.jsx)(`span`,{className:`truncate`,children:e.container.name})]})}),(0,T.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[e.status===`stopped`||e.status===`created`?(0,T.jsxs)(m,{size:`sm`,variant:`outline`,onClick:()=>K(e),className:`flex-1`,children:[(0,T.jsx)(c,{className:`w-4 h-4 mr-2`}),`Start`]}):e.status===`running`?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(m,{size:`sm`,variant:`outline`,onClick:()=>q(e),className:`flex-1`,children:[(0,T.jsx)(f,{className:`w-4 h-4 mr-2`}),`Stop`]}),(0,T.jsxs)(m,{size:`sm`,variant:`outline`,onClick:()=>J(e),className:`flex-1`,children:[(0,T.jsx)(p,{className:`w-4 h-4 mr-2`}),`Restart`]})]}):(0,T.jsxs)(m,{size:`sm`,variant:`outline`,disabled:!0,className:`flex-1`,children:[(0,T.jsx)(i,{className:`w-4 h-4 mr-2`}),e.status]}),(0,T.jsx)(m,{size:`sm`,variant:`outline`,onClick:()=>Y(e),title:`View Logs`,children:(0,T.jsx)(d,{className:`w-4 h-4`})})]})]},e.id))}),(0,T.jsxs)(`div`,{className:`border-t pt-6`,children:[(0,T.jsx)(`h2`,{className:`text-lg font-semibold mb-4`,children:`Global Services`}),(0,T.jsxs)(`div`,{className:`text-sm text-muted-foreground space-y-2`,children:[(0,T.jsx)(`p`,{children:`Global roles are server-wide services managed by your administrator. These include services like SSH access, storage, and other shared infrastructure.`}),(0,T.jsx)(`p`,{children:`To check the status of global services, contact your system administrator.`})]})]}),l&&(0,T.jsx)(`div`,{className:`fixed inset-0 bg-scrim flex items-center justify-center z-50`,children:(0,T.jsxs)(`div`,{className:`bg-background rounded-lg shadow-elevation-3 max-w-4xl w-full mx-4 max-h-viewport-modal flex flex-col`,children:[(0,T.jsxs)(`div`,{className:`p-6 border-b`,children:[(0,T.jsxs)(`h2`,{className:`text-xl font-bold`,children:[l.role.name,` - Logs`]}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:l.role.template})]}),(0,T.jsx)(`div`,{className:`flex-1 overflow-y-auto p-6`,children:(0,T.jsx)(`div`,{"data-scheme":`dark`,className:`bg-background text-success p-4 rounded font-mono text-xs overflow-x-auto`,children:l.logs.length===0?(0,T.jsx)(`div`,{className:`text-muted-foreground`,children:`No logs available`}):(0,T.jsx)(`pre`,{children:l.logs.join(`
2
+ `)})})}),(0,T.jsx)(`div`,{className:`p-4 border-t flex justify-end`,children:(0,T.jsx)(m,{onClick:()=>D(null),children:`Close`})})]})})]})}export{D as default};
@@ -0,0 +1,2 @@
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{Ar as r,Dr as i,Fr as a,L as o,Mt as s,Pr as c,Pt as l,Y as u,_i as d,_t as f,ir as p,rt as ee,wt as m}from"./ui-BSqPn1LJ.js";import{t as h}from"./button-Bv4zA1qr.js";import{t as g}from"./input-BOtCd4HP.js";import{t as _}from"./label-CNoJOoe0.js";import{i as v}from"./auth-Bx9fAZmz.js";import{n as y}from"./use-toast-BlLDqSUO.js";import{t as b}from"./useEscapeClose-DR_xKT_k.js";import{n as x}from"./page-header-GtTr9Ff_.js";import{t as S}from"./use-settings-back-Dk-DJEUO.js";import{t as C}from"./role-C5I0Plgn.js";var w=e(n(),1),T=t();function te({status:e}){let t={running:{icon:c,color:`text-success`,bg:`bg-success-subtle`,label:`Running`},stopped:{icon:r,color:`text-muted-foreground`,bg:`bg-muted`,label:`Stopped`},starting:{icon:i,color:`text-info`,bg:`bg-info-subtle`,label:`Starting`},stopping:{icon:i,color:`text-warning`,bg:`bg-warning-subtle`,label:`Stopping`},error:{icon:a,color:`text-destructive`,bg:`bg-destructive-subtle`,label:`Error`},created:{icon:d,color:`text-muted-foreground`,bg:`bg-muted`,label:`Created`},configured:{icon:d,color:`text-info`,bg:`bg-info-subtle`,label:`Configured`},removed:{icon:r,color:`text-destructive`,bg:`bg-destructive-subtle`,label:`Removed`}},n=t[e]||t.created,o=n.icon;return(0,T.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 rounded text-xs font-medium ${n.bg} ${n.color}`,children:[(0,T.jsx)(o,{className:`w-3 h-3`}),n.label]})}function E({type:e}){return(0,T.jsxs)(`span`,{className:`inline-flex items-center gap-1 px-2 py-1 rounded text-xs font-medium ${e===`global`?`bg-accent text-primary`:`bg-info-subtle text-info`}`,children:[(0,T.jsx)(f,{className:`w-3 h-3`}),e===`global`?`Global`:`Workspace`]})}function D(){let e=S(),t=v()?.userType===`admin`,[n,r]=(0,w.useState)([]),[i,a]=(0,w.useState)([]),[c,d]=(0,w.useState)(t),[D,O]=(0,w.useState)(t?null:`Access denied. Admin privileges required.`),[k,A]=(0,w.useState)(!1);b(()=>A(!1),k);let[j,M]=(0,w.useState)(null),[N,P]=(0,w.useState)(!1);b(()=>P(!1),N);let[F,ne]=(0,w.useState)([]),[I,L]=(0,w.useState)({type:``,status:``,search:``}),[R,z]=(0,w.useState)({template:``,name:``,type:`global`}),{showToast:B}=y(),V=(0,w.useRef)(I);(0,w.useEffect)(()=>{V.current=I},[I]);let H=(0,w.useCallback)(async()=>{try{d(!0);let{type:e,status:t}=V.current,n=await C.listRoles({type:e||void 0,status:t||void 0});r(n),O(null)}catch(e){let t=e instanceof Error?e.message:`Failed to fetch roles`;O(t)}finally{d(!1)}},[]),U=(0,w.useCallback)(async()=>{try{let e=await C.listTemplates();a(e)}catch(e){console.error(`Failed to fetch templates:`,e)}},[]);(0,w.useEffect)(()=>{t&&(H(),U())},[t,H,U]);let W=async()=>{if(!R.template||!R.name){B({title:`Validation Error`,description:`Template and name are required`,variant:`destructive`});return}try{await C.createRole(R),B({title:`Success`,description:`Role "${R.name}" created successfully`}),A(!1),X(),H()}catch(e){let t=e instanceof Error?e.message:`Failed to create role`;B({title:`Error`,description:t,variant:`destructive`})}},G=async e=>{try{await C.startRole(e.id),B({title:`Success`,description:`Role "${e.name}" started successfully`}),H()}catch(e){let t=e instanceof Error?e.message:`Failed to start role`;B({title:`Error`,description:t,variant:`destructive`})}},K=async e=>{try{await C.stopRole(e.id),B({title:`Success`,description:`Role "${e.name}" stopped successfully`}),H()}catch(e){let t=e instanceof Error?e.message:`Failed to stop role`;B({title:`Error`,description:t,variant:`destructive`})}},q=async e=>{try{await C.restartRole(e.id),B({title:`Success`,description:`Role "${e.name}" restarted successfully`}),H()}catch(e){let t=e instanceof Error?e.message:`Failed to restart role`;B({title:`Error`,description:t,variant:`destructive`})}},J=async e=>{if(confirm(`Are you sure you want to delete role "${e.name}"?`))try{await C.deleteRole(e.id,e.status===`running`),B({title:`Success`,description:`Role "${e.name}" deleted successfully`}),H()}catch(e){let t=e instanceof Error?e.message:`Failed to delete role`;B({title:`Error`,description:t,variant:`destructive`})}},Y=async e=>{try{let t=await C.getRoleLogs(e.id,100);ne(t),M(e),P(!0)}catch(e){let t=e instanceof Error?e.message:`Failed to fetch logs`;B({title:`Error`,description:t,variant:`destructive`})}},X=()=>{z({template:``,name:``,type:`global`})},Z=()=>{X(),A(!0)},Q=()=>{A(!1),X()},$=n.filter(e=>!I.search||e.name.toLowerCase().includes(I.search.toLowerCase())||e.template.toLowerCase().includes(I.search.toLowerCase()));return t?D&&!t?(0,T.jsx)(`div`,{className:`text-center space-y-4`,children:(0,T.jsx)(`div`,{className:`text-destructive`,children:D})}):(0,T.jsxs)(`div`,{className:`space-y-6`,children:[(0,T.jsx)(x,{onBack:e,title:`Role Management`,description:`Manage global and workspace roles for Canvas services`,actions:(0,T.jsxs)(h,{onClick:Z,className:`gap-2`,children:[(0,T.jsx)(s,{className:`w-4 h-4`}),`Create Role`]})}),(0,T.jsxs)(`div`,{className:`flex gap-4 items-end`,children:[(0,T.jsxs)(`div`,{className:`flex-1`,children:[(0,T.jsx)(_,{htmlFor:`search`,children:`Search`}),(0,T.jsx)(g,{id:`search`,placeholder:`Search by name or template...`,value:I.search,onChange:e=>L({...I,search:e.target.value})})]}),(0,T.jsxs)(`div`,{className:`w-48`,children:[(0,T.jsx)(_,{htmlFor:`type`,children:`Type`}),(0,T.jsxs)(`select`,{id:`type`,className:`w-full px-3 py-2 border rounded-md bg-background`,value:I.type,onChange:e=>L({...I,type:e.target.value}),children:[(0,T.jsx)(`option`,{value:``,children:`All Types`}),(0,T.jsx)(`option`,{value:`global`,children:`Global`}),(0,T.jsx)(`option`,{value:`workspace`,children:`Workspace`})]})]}),(0,T.jsxs)(`div`,{className:`w-48`,children:[(0,T.jsx)(_,{htmlFor:`status`,children:`Status`}),(0,T.jsxs)(`select`,{id:`status`,className:`w-full px-3 py-2 border rounded-md bg-background`,value:I.status,onChange:e=>L({...I,status:e.target.value}),children:[(0,T.jsx)(`option`,{value:``,children:`All Statuses`}),(0,T.jsx)(`option`,{value:`running`,children:`Running`}),(0,T.jsx)(`option`,{value:`stopped`,children:`Stopped`}),(0,T.jsx)(`option`,{value:`starting`,children:`Starting`}),(0,T.jsx)(`option`,{value:`error`,children:`Error`})]})]}),(0,T.jsxs)(h,{onClick:H,variant:`outline`,children:[(0,T.jsx)(m,{className:`w-4 h-4 mr-2`}),`Refresh`]})]}),c?(0,T.jsx)(`div`,{className:`text-center py-8`,children:`Loading roles...`}):$.length===0?(0,T.jsxs)(`div`,{className:`text-center py-8 border rounded-lg`,children:[(0,T.jsx)(f,{className:`w-12 h-12 mx-auto text-muted-foreground mb-4`}),(0,T.jsx)(`p`,{className:`text-muted-foreground`,children:I.search||I.type||I.status?`No roles match your filters`:`No roles created yet`}),!I.search&&!I.type&&!I.status&&(0,T.jsxs)(h,{onClick:Z,variant:`outline`,className:`mt-4`,children:[(0,T.jsx)(s,{className:`w-4 h-4 mr-2`}),`Create Your First Role`]})]}):(0,T.jsx)(`div`,{className:`border rounded-lg`,children:(0,T.jsxs)(`table`,{className:`w-full`,children:[(0,T.jsx)(`thead`,{className:`bg-muted/50`,children:(0,T.jsxs)(`tr`,{children:[(0,T.jsx)(`th`,{className:`text-left p-4 font-medium`,children:`Name`}),(0,T.jsx)(`th`,{className:`text-left p-4 font-medium`,children:`Template`}),(0,T.jsx)(`th`,{className:`text-left p-4 font-medium`,children:`Type`}),(0,T.jsx)(`th`,{className:`text-left p-4 font-medium`,children:`Status`}),(0,T.jsx)(`th`,{className:`text-left p-4 font-medium`,children:`Container`}),(0,T.jsx)(`th`,{className:`text-left p-4 font-medium`,children:`Created`}),(0,T.jsx)(`th`,{className:`text-right p-4 font-medium`,children:`Actions`})]})}),(0,T.jsx)(`tbody`,{className:`divide-y`,children:$.map(e=>(0,T.jsxs)(`tr`,{className:`hover:bg-muted/50`,children:[(0,T.jsx)(`td`,{className:`p-4 font-medium`,children:e.name}),(0,T.jsx)(`td`,{className:`p-4 text-sm text-muted-foreground`,children:e.template}),(0,T.jsx)(`td`,{className:`p-4`,children:(0,T.jsx)(E,{type:e.type})}),(0,T.jsx)(`td`,{className:`p-4`,children:(0,T.jsx)(te,{status:e.status})}),(0,T.jsx)(`td`,{className:`p-4 text-sm text-muted-foreground`,children:e.container?.name||`-`}),(0,T.jsx)(`td`,{className:`p-4 text-sm text-muted-foreground`,children:new Date(e.createdAt).toLocaleDateString()}),(0,T.jsx)(`td`,{className:`p-4`,children:(0,T.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[e.status===`stopped`||e.status===`created`?(0,T.jsx)(h,{size:`sm`,variant:`outline`,onClick:()=>G(e),title:`Start`,children:(0,T.jsx)(l,{className:`w-4 h-4`})}):e.status===`running`?(0,T.jsx)(h,{size:`sm`,variant:`outline`,onClick:()=>K(e),title:`Stop`,children:(0,T.jsx)(ee,{className:`w-4 h-4`})}):null,e.status===`running`&&(0,T.jsx)(h,{size:`sm`,variant:`outline`,onClick:()=>q(e),title:`Restart`,children:(0,T.jsx)(m,{className:`w-4 h-4`})}),(0,T.jsx)(h,{size:`sm`,variant:`outline`,onClick:()=>Y(e),title:`View Logs`,children:(0,T.jsx)(p,{className:`w-4 h-4`})}),(0,T.jsx)(h,{size:`sm`,variant:`outline`,onClick:()=>J(e),title:`Delete`,className:`text-destructive hover:text-destructive`,children:(0,T.jsx)(u,{className:`w-4 h-4`})})]})})]},e.id))})]})}),k&&(0,T.jsx)(`div`,{className:`fixed inset-0 bg-scrim flex items-center justify-center z-50`,children:(0,T.jsx)(`div`,{className:`bg-background rounded-lg shadow-elevation-3 max-w-lg w-full mx-4 max-h-viewport-modal overflow-y-auto`,children:(0,T.jsxs)(`div`,{className:`p-6 space-y-4`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,T.jsx)(`h2`,{className:`text-xl font-bold`,children:`Create New Role`}),(0,T.jsx)(h,{size:`sm`,variant:`ghost`,onClick:Q,children:(0,T.jsx)(o,{className:`w-4 h-4`})})]}),(0,T.jsxs)(`div`,{className:`space-y-4`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(_,{htmlFor:`template`,children:`Template *`}),(0,T.jsxs)(`select`,{id:`template`,className:`w-full px-3 py-2 border rounded-md bg-background mt-1`,value:R.template,onChange:e=>z({...R,template:e.target.value}),children:[(0,T.jsx)(`option`,{value:``,children:`Select a template...`}),i.map(e=>(0,T.jsxs)(`option`,{value:e.id,children:[e.name,` - `,e.description]},e.id))]})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(_,{htmlFor:`name`,children:`Role Name *`}),(0,T.jsx)(g,{id:`name`,placeholder:`e.g., canvas-sshd`,value:R.name,onChange:e=>z({...R,name:e.target.value})})]}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(_,{htmlFor:`roleType`,children:`Type *`}),(0,T.jsxs)(`select`,{id:`roleType`,className:`w-full px-3 py-2 border rounded-md bg-background mt-1`,value:R.type,onChange:e=>z({...R,type:e.target.value}),children:[(0,T.jsx)(`option`,{value:`global`,children:`Global (Server-wide)`}),(0,T.jsx)(`option`,{value:`workspace`,children:`Workspace (User-scoped)`})]})]}),R.template&&(0,T.jsxs)(`div`,{className:`p-4 bg-muted rounded-lg`,children:[(0,T.jsx)(`h3`,{className:`font-medium mb-2`,children:`Template Info`}),i.find(e=>e.id===R.template)&&(0,T.jsxs)(`div`,{className:`text-sm space-y-1 text-muted-foreground`,children:[(0,T.jsxs)(`p`,{children:[(0,T.jsx)(`strong`,{children:`Image:`}),` `,i.find(e=>e.id===R.template)?.container.image]}),(0,T.jsxs)(`p`,{children:[(0,T.jsx)(`strong`,{children:`Category:`}),` `,i.find(e=>e.id===R.template)?.category]}),i.find(e=>e.id===R.template)?.documentation?.readme&&(0,T.jsx)(`p`,{className:`mt-2`,children:i.find(e=>e.id===R.template)?.documentation?.readme})]})]})]}),(0,T.jsxs)(`div`,{className:`flex justify-end gap-2 pt-4 border-t`,children:[(0,T.jsx)(h,{variant:`outline`,onClick:Q,children:`Cancel`}),(0,T.jsx)(h,{onClick:W,children:`Create Role`})]})]})})}),N&&j&&(0,T.jsx)(`div`,{className:`fixed inset-0 bg-scrim flex items-center justify-center z-50`,children:(0,T.jsxs)(`div`,{className:`bg-background rounded-lg shadow-elevation-3 max-w-4xl w-full mx-4 max-h-viewport-modal flex flex-col`,children:[(0,T.jsxs)(`div`,{className:`p-6 border-b flex items-center justify-between`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h2`,{className:`text-xl font-bold`,children:`Role Logs`}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:j.name})]}),(0,T.jsx)(h,{size:`sm`,variant:`ghost`,onClick:()=>P(!1),children:(0,T.jsx)(o,{className:`w-4 h-4`})})]}),(0,T.jsx)(`div`,{className:`flex-1 overflow-y-auto p-6`,children:(0,T.jsx)(`div`,{"data-scheme":`dark`,className:`bg-background text-success p-4 rounded font-mono text-xs overflow-x-auto`,children:F.length===0?(0,T.jsx)(`div`,{className:`text-muted-foreground`,children:`No logs available`}):(0,T.jsx)(`pre`,{children:F.join(`
2
+ `)})})}),(0,T.jsx)(`div`,{className:`p-4 border-t flex justify-end`,children:(0,T.jsx)(h,{onClick:()=>P(!1),children:`Close`})})]})})]}):(0,T.jsx)(`div`,{className:`text-center space-y-4`,children:(0,T.jsx)(`div`,{className:`text-destructive`,children:`Access denied. Admin privileges required.`})})}export{D as default};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{_ as r,g as ee}from"./chunk-62JRHF6Z-vspAGgtK.js";import{X as i}from"./ui-BSqPn1LJ.js";import{t as a}from"./button-Bv4zA1qr.js";import{t as o}from"./input-BOtCd4HP.js";import{n as te}from"./use-toast-BlLDqSUO.js";import{Pt as ne}from"./workspace-CJ1PWQ29.js";import{t as re}from"./use-mobile-Db-vWu9Y.js";import{p as ie}from"./context-D_K4g9SQ.js";import{t as s}from"./color-DFEH4BfK.js";import{i as ae}from"./use-menu-BVkqNEIx.js";import{B as oe,G as se,J as ce,K as le,L as ue,V as de,W as fe,X as pe,Y as me,Z as he,et as ge,ft as _e,ht as ve}from"./index-DtZS4JJ4.js";import{n as ye}from"./page-header-GtTr9Ff_.js";import{n as be,r as xe,t as Se}from"./useAgentModels-ndLotMWH.js";var c=e(n(),1),l=t(),Ce={anthropic:`claude-3-5-sonnet-20241022`,openai:`gpt-4o`,ollama:`qwen2.5-coder:latest`,"lm-studio":``,vllm:``,custom:``},u={anthropic:`https://api.anthropic.com`,openai:`https://api.openai.com/v1`,ollama:`http://localhost:11434/v1`,"lm-studio":`http://localhost:1234/v1`,vllm:`http://localhost:8000/v1`,custom:``};function d(e){return u[e]||``}function f({label:e,hint:t,children:n}){return(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`label`,{className:`text-sm font-medium`,children:e}),t&&(0,l.jsx)(`p`,{className:`mb-1 mt-0.5 text-xs text-muted-foreground`,children:t}),(0,l.jsx)(`div`,{className:t?void 0:`mt-1`,children:n})]})}var p=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring resize-y`,m=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring`;function h(){let{agentId:e,tab:t}=r(),n=ee(),{showToast:u}=te(),{selectEntity:h,goBack:we}=ae(),Te=re(),g=ve(t);(0,c.useEffect)(()=>{t!==g&&e&&n(`/agents/${encodeURIComponent(e)}/settings/${g}`,{replace:!0})},[t,g,e,n]);let[_,v]=(0,c.useState)(null),[Ee,De]=(0,c.useState)(!0),[Oe,ke]=(0,c.useState)(null),[Ae,je]=(0,c.useState)(!1),[Me,Ne]=(0,c.useState)(!1),[Pe,Fe]=(0,c.useState)(``),[Ie,Le]=(0,c.useState)(``),[Re,ze]=(0,c.useState)(``),[Be,y]=(0,c.useState)(s()),[b,Ve]=(0,c.useState)(``),[x,He]=(0,c.useState)(``),[S,Ue]=(0,c.useState)(``),[C,We]=(0,c.useState)(``),[w,Ge]=(0,c.useState)(`anthropic`),[T,E]=(0,c.useState)(``),[D,O]=(0,c.useState)(``),[k,A]=(0,c.useState)(``),[Ke,qe]=(0,c.useState)(.7),[Je,j]=(0,c.useState)(4096),[Ye,Xe]=(0,c.useState)(1),Ze=Se(w,T,D,_?.id),Qe=Ze.models.find(e=>e.id===k),[$e,M]=(0,c.useState)([]),[N,P]=(0,c.useState)(``),[et,F]=(0,c.useState)(``),[I,L]=(0,c.useState)(``),[R,z]=(0,c.useState)(``),[tt,nt]=(0,c.useState)(!1),[rt,it]=(0,c.useState)(null),[B,V]=(0,c.useState)(null),[at,ot]=(0,c.useState)(null),[H,U]=(0,c.useState)(!1),[W,G]=(0,c.useState)(null),[K,st]=(0,c.useState)(`context`),[q,ct]=(0,c.useState)(``),[lt,ut]=(0,c.useState)(`/`),[J,dt]=(0,c.useState)(``),[ft,pt]=(0,c.useState)(!0),[Y,mt]=(0,c.useState)(!1),[ht,gt]=(0,c.useState)([]),[_t,vt]=(0,c.useState)([]),[X,yt]=(0,c.useState)(null),[bt,Z]=(0,c.useState)(`{}`),[xt,Q]=(0,c.useState)(null),[St,Ct]=(0,c.useState)(e);St!==e&&(Ct(e),De(!0),v(null)),(0,c.useEffect)(()=>{if(!e)return;let t=!1;return oe(e).then(async e=>{if(t)return;let n=e.config?.identity||{};v(e),h(e.id),Fe(e.name||``),Le(e.label||``),ze(e.description||``),y(e.color||s()),Ve(n.role||``),He(n.identity||``),Ue(n.instructions||``),We(e.config?.prompts?.system||``),Ge(e.llmProvider||`anthropic`),E(e.config?.apiKey||``),O(e.config?.baseUrl||d(e.llmProvider)),A(e.model||Ce[e.llmProvider]||``);let r=e.config?.connectors?.[e.llmProvider];r&&(qe(r.temperature??.7),j(r.maxTokens??4096),Xe(r.topP??1)),Z(JSON.stringify(e.config?.tools??{},null,2)),Q(null),ke(null);try{M(await le(e.id))}catch{M([])}}).catch(e=>{t||ke(e instanceof Error?e.message:`Failed to load agent`)}).finally(()=>{t||De(!1)}),()=>{t=!0}},[e,h]),(0,c.useEffect)(()=>{if(g!==`access`&&g!==`tools`||!_?.id)return;let e=_.id,t=!1;return Promise.all([de(_.id).catch(()=>null),ne().catch(()=>[]),ie().catch(()=>[]),fe(_.id).catch(()=>null)]).then(([n,r,ee,i])=>{t||(V(n),gt(r),vt(ee),yt(i?i.tools:[]),n&&(st(n.binding.type),ct(n.binding.workspace||``),ut(n.binding.path||`/`),dt(n.binding.context||``),pt(n.permissions.includes(`read`)),mt(n.permissions.includes(`write`))),ot(e))}),()=>{t=!0}},[g,_?.id]);let wt=()=>{let e=xe(b,x,S),t;try{let e=JSON.parse(bt);e&&typeof e==`object`&&!Array.isArray(e)&&(t=e)}catch{}return{...t===void 0?{}:{tools:t},name:Pe.trim(),label:Ie.trim(),description:Re.trim()||void 0,color:Be,llmProvider:w,model:k,apiKey:T.trim()||(w===_?.llmProvider?void 0:``),baseUrl:D||void 0,config:{type:w,model:k,identity:{role:b.trim()||void 0,identity:x.trim()||void 0,instructions:S.trim()||void 0},prompts:C.trim()||e?{system:C.trim()||e}:void 0,connectors:{[w]:{...w===`anthropic`?{}:{temperature:Ke},maxTokens:Je,topP:Ye}}}}},Tt=async e=>{if(e.preventDefault(),_){je(!0);try{let e=await ge(_.id,wt());v(e),window.dispatchEvent(new CustomEvent(`agents:refresh`)),u({title:`Saved`,description:`Agent updated`}),e.name&&e.name!==_.name&&n(`/agents/${encodeURIComponent(e.name)}/settings/${g}`,{replace:!0})}catch(e){u({title:`Error`,description:e instanceof Error?e.message:`Save failed`,variant:`destructive`})}finally{je(!1)}}},Et=async()=>{if(_&&window.confirm(`Delete agent "${_.label||_.name}"? This cannot be undone.`)){Ne(!0);try{await ue(_.id),window.dispatchEvent(new CustomEvent(`agents:refresh`)),u({title:`Deleted`,description:`Agent removed`}),n(`/agents`)}catch(e){u({title:`Error`,description:e instanceof Error?e.message:`Delete failed`,variant:`destructive`})}finally{Ne(!1)}}},$=()=>{P(``),F(``),L(``),z(``)},Dt=async()=>{if(!(!_||!R.trim()&&!I.trim())){nt(!0);try{let e=await se(_.id,R.trim()?{source:R.trim()}:{name:N,description:et,content:I});M(e),$(),window.dispatchEvent(new CustomEvent(`agents:refresh`)),u({title:`Installed`,description:`Skill saved`})}catch(e){u({title:`Error`,description:e instanceof Error?e.message:`Skill install failed`,variant:`destructive`})}finally{nt(!1)}}},Ot=async e=>{if(_){it(e);try{let t=await ce(_.id,e);M(t),(N===e||R===e)&&$(),window.dispatchEvent(new CustomEvent(`agents:refresh`)),u({title:`Removed`,description:`Skill "${e}" removed`})}catch(e){u({title:`Error`,description:e instanceof Error?e.message:`Skill remove failed`,variant:`destructive`})}finally{it(null)}}},kt=()=>K===`global`?{type:`global`}:K===`context`?J?{type:`context`,context:J}:null:q?K===`path`?{type:`path`,workspace:q,path:lt.trim()||`/`}:{type:`workspace`,workspace:q}:null,At=async()=>{if(!_||H)return;let e=kt(),t=[];if(ft&&t.push(`read`),Y&&t.push(`write`),!e||t.length===0){u({title:`Invalid binding`,description:`Pick a scope target and at least one permission`,variant:`destructive`});return}if(!(e.type===`global`&&!window.confirm(`Global scope lets this agent ${Y?`read and write`:`read`} ALL your workspaces. Continue?`))){U(!0);try{let n=await he(_.id,{binding:e,permissions:t});V(n.access),G(n.token),u({title:`Bound`,description:`Access bound — copy the token now, it is not shown again`})}catch(e){u({title:`Error`,description:e instanceof Error?e.message:`Bind failed`,variant:`destructive`})}finally{U(!1)}}},jt=async()=>{if(!(!_||H)){U(!0);try{let e=await pe(_.id);V(e.access),G(e.token),u({title:`Rotated`,description:`New token minted — the previous one no longer works`})}catch(e){u({title:`Error`,description:e instanceof Error?e.message:`Rotate failed`,variant:`destructive`})}finally{U(!1)}}},Mt=async()=>{if(!(!_||H)&&window.confirm(`Revoke this agent's canvas access? Its token stops working immediately.`)){U(!0);try{await me(_.id),V(null),G(null),u({title:`Revoked`,description:`Agent access removed`})}catch(e){u({title:`Error`,description:e instanceof Error?e.message:`Revoke failed`,variant:`destructive`})}finally{U(!1)}}},Nt=e=>{if(e.type===`global`)return`Global — all workspaces`;if(e.type===`context`){let t=_t.find(t=>t.id===e.context);return`Context ${t?`${t.id} (${t.url})`:e.context} — follows the context live`}let t=e.workspaceName||e.workspace;return e.type===`path`?`Workspace ${t}, path ${e.path||`/`}`:`Workspace ${t} (whole tree)`};if(Ee)return(0,l.jsx)(`div`,{className:`p-6 text-sm text-muted-foreground`,children:`Loading...`});if(!_||Oe)return(0,l.jsx)(`div`,{className:`p-6 text-sm text-destructive`,children:Oe||`Agent not found`});let Pt=_e.find(e=>e.id===g),Ft=encodeURIComponent(_.name||_.id),It=g===`identity`||g===`provider`||g===`models`||g===`tools`;return(0,l.jsx)(`div`,{className:`h-full min-h-0 overflow-y-auto`,children:(0,l.jsxs)(`div`,{className:`mx-auto max-w-5xl p-6 pb-12 max-md:px-4 max-md:pb-rail-stack`,children:[(0,l.jsx)(ye,{compact:!0,className:`mb-6 border-b pb-4`,title:`${Pt.label} - ${_.label||_.name}`,description:Pt.description,backTo:`/agents/${Ft}`,onBack:Te?we:void 0}),(0,l.jsxs)(`form`,{onSubmit:Tt,className:`space-y-6`,children:[g===`identity`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`section`,{className:`space-y-4 rounded-lg border p-4`,children:[(0,l.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,l.jsx)(f,{label:`Name`,hint:`ID: ${_.id}`,children:(0,l.jsx)(o,{value:Pe,onChange:e=>Fe(e.target.value),placeholder:`lucy`})}),(0,l.jsx)(f,{label:`Label`,children:(0,l.jsx)(o,{value:Ie,onChange:e=>Le(e.target.value),placeholder:`Display name`})})]}),(0,l.jsx)(f,{label:`Description`,children:(0,l.jsx)(o,{value:Re,onChange:e=>ze(e.target.value),placeholder:`Short description`})}),(0,l.jsx)(f,{label:`Color`,children:(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(o,{type:`color`,value:Be,onChange:e=>y(e.target.value),className:`h-10 w-16 p-1`}),(0,l.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>y(s()),children:`Randomize`})]})})]}),(0,l.jsxs)(`section`,{className:`space-y-4 rounded-lg border p-4`,children:[(0,l.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Persona`}),(0,l.jsx)(f,{label:`Role`,children:(0,l.jsx)(o,{value:b,onChange:e=>Ve(e.target.value),placeholder:`e.g. Software Engineer`})}),(0,l.jsx)(f,{label:`Identity`,children:(0,l.jsx)(`textarea`,{value:x,onChange:e=>He(e.target.value),placeholder:`Who this agent is…`,className:`${p} min-h-[80px]`})}),(0,l.jsx)(f,{label:`Instructions`,children:(0,l.jsx)(`textarea`,{value:S,onChange:e=>Ue(e.target.value),placeholder:`Behavioral instructions…`,className:`${p} min-h-[80px]`})}),(0,l.jsx)(f,{label:`System Prompt`,hint:`Compiled from Role + Identity + Instructions. Override manually.`,children:(0,l.jsx)(`textarea`,{value:C,onChange:e=>We(e.target.value),placeholder:`System prompt sent to the LLM…`,className:`${p} min-h-[140px] font-mono text-xs`})})]}),(0,l.jsxs)(`section`,{className:`rounded-lg border border-destructive/30 p-4`,children:[(0,l.jsx)(`h2`,{className:`mb-3 text-sm font-semibold text-destructive`,children:`Danger Zone`}),(0,l.jsxs)(a,{type:`button`,variant:`destructive`,disabled:Me,onClick:Et,children:[(0,l.jsx)(i,{className:`mr-2 h-4 w-4`}),Me?`Deleting...`:`Delete Agent`]})]})]}),g===`provider`&&(0,l.jsxs)(`section`,{className:`space-y-4 rounded-lg border p-4`,children:[(0,l.jsx)(f,{label:`Provider`,children:(0,l.jsxs)(`select`,{value:w,onChange:e=>{let t=e.target.value;Ge(t),E(``),A(Ce[t]||``),O(d(t))},className:`w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring`,children:[(0,l.jsx)(`option`,{value:`anthropic`,children:`Anthropic Claude`}),(0,l.jsx)(`option`,{value:`openai`,children:`OpenAI GPT`}),(0,l.jsx)(`option`,{value:`ollama`,children:`Ollama (Local)`}),(0,l.jsx)(`option`,{value:`lm-studio`,children:`LM Studio (Local)`}),(0,l.jsx)(`option`,{value:`vllm`,children:`vLLM (Local)`}),(0,l.jsx)(`option`,{value:`custom`,children:`Custom`})]})}),(0,l.jsx)(f,{label:`API Key`,hint:[`ollama`,`lm-studio`,`vllm`].includes(w)?`Any value works for local providers.`:void 0,children:(0,l.jsx)(o,{type:`password`,value:T,onChange:e=>E(e.target.value),placeholder:w===`ollama`?`ollama`:w===`lm-studio`?`lm-studio`:`sk-…`})}),(0,l.jsx)(f,{label:`Host / Base URL`,children:(0,l.jsx)(o,{value:D,onChange:e=>O(e.target.value),placeholder:d(w)||`https://api.example.com`})})]}),g===`models`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`section`,{className:`space-y-4 rounded-lg border p-4`,children:[(0,l.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Main Model`}),(0,l.jsx)(f,{label:`Model`,children:(0,l.jsx)(be,{value:k,onChange:(e,t)=>{A(e),t?.maxTokens&&j(t.maxTokens)},...Ze})}),(0,l.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-3`,children:[w!==`anthropic`&&(0,l.jsx)(f,{label:`Temperature`,children:(0,l.jsx)(o,{type:`number`,min:0,max:2,step:.1,value:Ke,onChange:e=>qe(Number.isNaN(e.target.valueAsNumber)?.7:e.target.valueAsNumber)})}),(0,l.jsx)(f,{label:`Max Output Tokens`,children:(0,l.jsx)(o,{type:`number`,min:1,max:Qe?.maxTokens,value:Je,onChange:e=>j(parseInt(e.target.value)||4096)})}),(0,l.jsx)(f,{label:`Top P`,children:(0,l.jsx)(o,{type:`number`,min:0,max:1,step:.1,value:Ye,onChange:e=>Xe(Number.isNaN(e.target.valueAsNumber)?1:e.target.valueAsNumber)})})]})]}),[`Governance`,`Memory Management`,`Subagent / Tool Use`].map(e=>(0,l.jsxs)(`section`,{className:`rounded-lg border border-dashed p-4`,children:[(0,l.jsxs)(`h2`,{className:`text-sm font-semibold text-muted-foreground`,children:[e,` Model`]}),(0,l.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Coming soon`})]},e))]}),g===`tools`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`section`,{className:`space-y-3 rounded-lg border p-4`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Runtime Tools`}),(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Injected at start (pi defineTool): coding tools plus canvas tools scoped by the token binding (Access / ACL). Definitions live in the runtime — read-only here until the agent-runtime workspace lands.`})]}),X===null?(0,l.jsx)(`div`,{className:`rounded-md border border-dashed p-4 text-sm text-muted-foreground`,children:`Loading…`}):X.length===0?(0,l.jsx)(`div`,{className:`rounded-md border border-dashed p-4 text-sm text-muted-foreground`,children:`No tools resolved.`}):(0,l.jsx)(`div`,{className:`space-y-1.5`,children:X.map(e=>(0,l.jsxs)(`details`,{className:`rounded-md border px-3 py-2`,children:[(0,l.jsxs)(`summary`,{className:`cursor-pointer text-sm`,children:[(0,l.jsx)(`code`,{className:`font-mono text-xs font-medium`,children:e.name}),(0,l.jsx)(`span`,{className:`ml-2 rounded bg-muted px-1.5 py-0.5 text-[10px] uppercase text-muted-foreground`,children:e.source})]}),e.description&&(0,l.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-xs text-muted-foreground`,children:e.description}),e.parameters!=null&&(0,l.jsx)(`pre`,{className:`mt-2 overflow-x-auto rounded bg-muted p-2 font-mono text-[11px]`,children:JSON.stringify(e.parameters,null,2)})]},e.name))}),(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:B?Nt(B.binding):`Unbound — no canvas tools are injected. Bind under Access / ACL.`})]}),(0,l.jsxs)(`section`,{className:`space-y-3 rounded-lg border p-4`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Tools Config`}),(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`config.tools JSON, merged server-side — e.g. {"canvas": {"enabled": false}} gates the canvas tools. Saved with Save Changes.`})]}),(0,l.jsx)(`textarea`,{value:bt,onChange:e=>{Z(e.target.value);try{JSON.parse(e.target.value),Q(null)}catch(e){Q(e instanceof Error?e.message:`Invalid JSON`)}},className:`${p} min-h-[120px] font-mono text-xs`}),xt&&(0,l.jsxs)(`p`,{className:`text-xs text-destructive`,children:[`Invalid JSON (not saved): `,xt]})]}),(0,l.jsxs)(`section`,{className:`space-y-3 rounded-lg border p-4`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Skills`}),(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Installed skills are saved immediately, independent of Save Changes.`})]}),$e.length===0?(0,l.jsx)(`div`,{className:`rounded-md border border-dashed p-4 text-sm text-muted-foreground`,children:`No skills installed.`}):$e.map(e=>(0,l.jsxs)(`div`,{className:`flex items-start justify-between gap-3 rounded-md border p-3`,children:[(0,l.jsxs)(`div`,{className:`min-w-0`,children:[(0,l.jsx)(`div`,{className:`truncate text-sm font-medium`,children:e.name}),(0,l.jsx)(`div`,{className:`truncate text-xs text-muted-foreground`,children:e.package?e.source:e.description||`No description`})]}),(0,l.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,l.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>{P(e.name),F(e.description||``),L(e.content||``),z(e.source||``)},children:`Edit`}),(0,l.jsx)(a,{type:`button`,variant:`destructive`,size:`sm`,disabled:rt===(e.source||e.name),onClick:()=>Ot(e.source||e.name),children:rt===(e.source||e.name)?`Removing…`:`Remove`})]})]},e.name)),(0,l.jsxs)(`div`,{className:`space-y-4 rounded-md border p-4`,children:[(0,l.jsx)(f,{label:`Package Source`,hint:`Use this for whole pi packages. Leave empty to save inline SKILL.md content.`,children:(0,l.jsx)(o,{value:R,onChange:e=>z(e.target.value),placeholder:`npm:@foo/pi-tools or git:github.com/badlogic/pi-doom`})}),(0,l.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[(0,l.jsx)(f,{label:`Name`,children:(0,l.jsx)(o,{value:N,onChange:e=>P(e.target.value),placeholder:`skill-name, or read from frontmatter`,disabled:!!R.trim()})}),(0,l.jsx)(f,{label:`Description`,children:(0,l.jsx)(o,{value:et,onChange:e=>F(e.target.value),placeholder:`What this skill helps with`,disabled:!!R.trim()})})]}),(0,l.jsx)(f,{label:`SKILL.md Content`,children:(0,l.jsx)(`textarea`,{value:I,onChange:e=>L(e.target.value),placeholder:`# Skill instructions…`,disabled:!!R.trim(),className:`${p} min-h-[160px] font-mono text-xs`})}),(0,l.jsxs)(`div`,{className:`flex gap-2`,children:[(0,l.jsx)(a,{type:`button`,disabled:tt||!R.trim()&&!I.trim(),onClick:Dt,children:tt?`Saving…`:`Install / Update Skill`}),(0,l.jsx)(a,{type:`button`,variant:`outline`,onClick:$,children:`Clear`})]})]})]}),(0,l.jsxs)(`section`,{className:`space-y-3 rounded-lg border p-4`,children:[(0,l.jsx)(`h2`,{className:`text-sm font-semibold`,children:`MCP Servers`}),(_.config?.mcp?.servers||[]).length===0?(0,l.jsx)(`div`,{className:`rounded-md border border-dashed p-4 text-sm text-muted-foreground`,children:`No MCP servers configured.`}):(_.config?.mcp?.servers||[]).map((e,t)=>(0,l.jsxs)(`div`,{className:`rounded-md border p-3`,children:[(0,l.jsx)(`div`,{className:`text-sm font-medium`,children:e.name}),(0,l.jsxs)(`div`,{className:`font-mono text-xs text-muted-foreground`,children:[e.command,` `,(e.args||[]).join(` `)]})]},t))]})]}),g===`access`&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)(`section`,{className:`space-y-3 rounded-lg border p-4`,children:[(0,l.jsxs)(`div`,{children:[(0,l.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Canvas Access`}),(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`The agent talks to canvas through its own scoped token; the server clamps every request to the binding. Bind, rotate and revoke apply immediately.`})]}),at===_.id?B?(0,l.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,children:[(0,l.jsx)(`div`,{className:`text-sm font-medium`,children:Nt(B.binding)}),(0,l.jsxs)(`div`,{className:`text-xs text-muted-foreground`,children:[`Permissions: `,B.permissions.join(`, `)||`none`,B.boundAt?` · bound ${new Date(B.boundAt).toLocaleString()}`:``,B.rotatedAt?` · token rotated ${new Date(B.rotatedAt).toLocaleString()}`:``]}),(0,l.jsxs)(`div`,{className:`flex gap-2 pt-1`,children:[(0,l.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,disabled:H,onClick:jt,children:`Rotate Token`}),(0,l.jsx)(a,{type:`button`,variant:`destructive`,size:`sm`,disabled:H,onClick:Mt,children:`Revoke Access`})]})]}):(0,l.jsx)(`div`,{className:`rounded-md border border-dashed p-4 text-sm text-muted-foreground`,children:`Unbound — this agent has no canvas access.`}):(0,l.jsx)(`div`,{className:`rounded-md border border-dashed p-4 text-sm text-muted-foreground`,children:`Loading…`}),W&&(0,l.jsxs)(`div`,{className:`space-y-2 rounded-md border border-warning/50 bg-warning/10 p-3`,children:[(0,l.jsx)(`div`,{className:`text-xs font-medium`,children:`Agent token — shown once, store it now`}),(0,l.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`code`,{className:`flex-1 truncate rounded bg-background px-2 py-1 font-mono text-xs`,children:W}),(0,l.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>navigator.clipboard?.writeText(W),children:`Copy`}),(0,l.jsx)(a,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>G(null),children:`Dismiss`})]}),(0,l.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`In-process agents receive it automatically (canvas.env); external runtimes (agentd) take it as CANVAS_TOKEN.`})]})]}),(0,l.jsxs)(`section`,{className:`space-y-4 rounded-lg border p-4`,children:[(0,l.jsx)(`h2`,{className:`text-sm font-semibold`,children:B?`Rebind`:`Bind`}),(0,l.jsx)(f,{label:`Scope`,hint:`Context bindings follow the context live; global spans all workspaces.`,children:(0,l.jsxs)(`select`,{value:K,onChange:e=>st(e.target.value),className:m,children:[(0,l.jsx)(`option`,{value:`context`,children:`Context (follows live)`}),(0,l.jsx)(`option`,{value:`workspace`,children:`Workspace`}),(0,l.jsx)(`option`,{value:`path`,children:`Workspace path`}),(0,l.jsx)(`option`,{value:`global`,children:`Global (all workspaces)`})]})}),K===`context`&&(0,l.jsx)(f,{label:`Context`,children:(0,l.jsxs)(`select`,{value:J,onChange:e=>dt(e.target.value),className:m,children:[(0,l.jsx)(`option`,{value:``,children:`Select a context…`}),_t.map(e=>(0,l.jsxs)(`option`,{value:e.id,children:[e.id,` — `,e.url]},e.id))]})}),(K===`workspace`||K===`path`)&&(0,l.jsx)(f,{label:`Workspace`,children:(0,l.jsxs)(`select`,{value:q,onChange:e=>ct(e.target.value),className:m,children:[(0,l.jsx)(`option`,{value:``,children:`Select a workspace…`}),ht.map(e=>(0,l.jsx)(`option`,{value:e.name||e.id,children:e.label||e.name},e.id))]})}),K===`path`&&(0,l.jsx)(f,{label:`Base path`,hint:`The agent is clamped to this subtree.`,children:(0,l.jsx)(o,{value:lt,onChange:e=>ut(e.target.value),placeholder:`/work/projects/foo`})}),(0,l.jsx)(f,{label:`Permissions`,children:(0,l.jsxs)(`div`,{className:`flex gap-4 text-sm`,children:[(0,l.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`input`,{type:`checkbox`,checked:ft,onChange:e=>pt(e.target.checked)}),` read`]}),(0,l.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,l.jsx)(`input`,{type:`checkbox`,checked:Y,onChange:e=>mt(e.target.checked)}),` write`]})]})}),(0,l.jsx)(a,{type:`button`,disabled:H,onClick:At,children:H?`Working…`:B?`Rebind & Mint Token`:`Bind & Mint Token`})]})]}),g===`memory`&&(0,l.jsxs)(`section`,{className:`rounded-lg border border-dashed p-6 text-center`,children:[(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground`,children:`Memory Engine`}),(0,l.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Loop-based memory management. Settings coming soon.`})]}),g===`integrations`&&(0,l.jsxs)(`section`,{className:`rounded-lg border border-dashed p-6 text-center`,children:[(0,l.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground`,children:`Integrations`}),(0,l.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`IMAP, chat, SQL and REST API accounts. Coming soon.`})]}),It&&(0,l.jsx)(a,{type:`submit`,disabled:Ae,children:Ae?`Saving…`:`Save Changes`})]})]})})}export{h as default};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{l as t,u as n}from"./code-editor-BOIngd5F.js";import{r}from"./chunk-62JRHF6Z-vspAGgtK.js";import{ci as i}from"./ui-BSqPn1LJ.js";import{t as a}from"./input-BOtCd4HP.js";import{Pt as o}from"./workspace-CJ1PWQ29.js";import{p as s}from"./context-D_K4g9SQ.js";import{i as c,m as l,p as u}from"./use-menu-BVkqNEIx.js";import{ft as d,mt as f,pt as p,q as m}from"./index-DtZS4JJ4.js";import{n as h}from"./page-header-GtTr9Ff_.js";var g=e(n(),1),_=t(),v=[{id:`workspace`,label:`Workspace`,path:`workspaces`,description:`Files, search, devices and sharing for one workspace. These settings override account defaults.`,sections:f,load:async()=>(await o()).map(e=>({id:e.name,label:e.label||e.name}))},{id:`context`,label:`Context`,path:`contexts`,description:`Choose the tree and path a context opens, and who can access that view. File storage belongs to its workspace.`,sections:p,load:async()=>(await s()).map(e=>({id:e.id,label:e.name||e.id}))},{id:`agent`,label:`Agent`,path:`agents`,description:`Configure one assistant: its instructions, chat model, tools and access to Canvas.`,sections:d,load:async()=>(await m()).map(e=>({id:e.id,label:e.label||e.name}))}];function y({to:e,label:t,description:n,icon:a}){return(0,_.jsxs)(r,{to:e,className:`group flex items-start gap-3 rounded-lg border bg-card p-4 transition-colors hover:border-primary/50 hover:bg-accent/30 focus-visible:outline focus-visible:outline-2 focus-visible:outline-primary`,children:[(0,_.jsx)(a,{className:`mt-0.5 h-5 w-5 shrink-0 text-muted-foreground`}),(0,_.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,_.jsx)(`span`,{className:`block text-sm font-semibold`,children:t}),(0,_.jsx)(`span`,{className:`mt-1 block text-sm leading-relaxed text-muted-foreground`,children:n})]}),(0,_.jsx)(i,{className:`mt-0.5 h-4 w-4 shrink-0 text-muted-foreground group-hover:text-primary`})]})}function b({group:e,query:t}){let[n,r]=(0,g.useState)([]),[i,a]=(0,g.useState)(``),[o,s]=(0,g.useState)(`loading`),[c,u]=(0,g.useState)(0);(0,g.useEffect)(()=>{let t=!1;return e.load().then(e=>{t||(r(e),s(`ready`))}).catch(()=>{t||s(`error`)}),()=>{t=!0}},[e,c]);let d=e.sections.filter(n=>l(t,e.label,n.label,n.description));return d.length?(0,_.jsxs)(`section`,{id:e.id,className:`scroll-mt-6 space-y-3`,children:[(0,_.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.label}),(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),(0,_.jsxs)(`label`,{className:`block max-w-md text-sm font-medium`,children:[`Choose a `,e.label.toLowerCase(),(0,_.jsxs)(`select`,{className:`mt-2 h-10 w-full rounded-md border bg-background px-3 text-sm`,value:i,disabled:o!==`ready`||!n.length,onChange:e=>a(e.target.value),children:[(0,_.jsx)(`option`,{value:``,children:o===`loading`?`Loading…`:o===`error`?`Unable to load list`:n.length?`Select ${e.label.toLowerCase()}…`:`No ${e.path} available`}),n.map(e=>(0,_.jsx)(`option`,{value:e.id,children:e.label},e.id))]})]}),o===`error`&&(0,_.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`The list could not be loaded. `,(0,_.jsx)(`button`,{type:`button`,className:`underline`,onClick:()=>{s(`loading`),u(e=>e+1)},children:`Retry`})]}),(0,_.jsxs)(`details`,{open:!!(i||t.trim()),children:[(0,_.jsx)(`summary`,{className:`cursor-pointer py-2 text-sm text-muted-foreground`,children:i?`Settings for ${n.find(e=>e.id===i)?.label||i}`:`What you can configure (${d.length})`}),(0,_.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,16rem),1fr))] gap-3`,children:d.map(t=>i?(0,_.jsx)(y,{to:`/${e.path}/${encodeURIComponent(i)}/settings/${t.id}`,...t},t.id):(0,_.jsxs)(`div`,{className:`rounded-lg border border-dashed p-4`,children:[(0,_.jsx)(`p`,{className:`text-sm font-medium`,children:t.label}),(0,_.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:t.description})]},t.id))})]})]}):null}function x(){let{state:e}=c(),[t,n]=(0,g.useState)(``),r=u.filter(t=>t.id!==`server`||e.user?.userType===`admin`).map(e=>({...e,items:e.items.filter(n=>l(t,e.label,n.label,n.description))})).filter(e=>e.items.length),i=v.some(e=>e.sections.some(n=>l(t,e.label,n.label,n.description)));return(0,_.jsxs)(`div`,{className:`mx-auto max-w-6xl space-y-8 pb-8 max-md:pb-rail-stack`,children:[(0,_.jsx)(h,{title:`Settings`,description:`Start with what you want to change. Each section explains where your changes apply.`}),(0,_.jsx)(a,{type:`search`,className:`max-w-xl`,"aria-label":`Search all settings`,placeholder:`Find a setting: offline, folders, models, sharing…`,value:t,onChange:e=>n(e.target.value)}),r.filter(e=>e.id===`device`||e.id===`account`).map(e=>(0,_.jsxs)(`section`,{className:`space-y-3`,children:[(0,_.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.label}),(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),(0,_.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,16rem),1fr))] gap-3`,children:e.items.map(e=>(0,_.jsx)(y,{to:e.path,...e},e.path))})]},e.id)),v.map(e=>(0,_.jsx)(b,{group:e,query:t},e.id)),r.filter(e=>e.id===`server`||e.id===`information`).map(e=>(0,_.jsxs)(`section`,{className:`space-y-3`,children:[(0,_.jsx)(`h2`,{className:`text-lg font-semibold`,children:e.label}),(0,_.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.description}),(0,_.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(min(100%,16rem),1fr))] gap-3`,children:e.items.map(e=>(0,_.jsx)(y,{to:e.path,...e},e.path))})]},e.id)),!r.length&&!i&&(0,_.jsxs)(`p`,{role:`status`,className:`text-sm text-muted-foreground`,children:[`No settings match “`,t,`”. Try a shorter phrase or clear the search.`]})]})}export{x as default};