@lobu/runtime-server 21.2.0 → 21.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/component.json +1 -1
- package/dist/owletto/dist/assets/_-CLhipgJI.js +1 -0
- package/dist/owletto/dist/assets/{_-C1iPVDAS.js → _-D0ZVGAIA.js} +2 -2
- package/dist/owletto/dist/assets/{_agentId-DvhFYLLv.js → _agentId-BLXUf3ot.js} +1 -1
- package/dist/owletto/dist/assets/_agentId-DnI66MF3.js +1 -0
- package/dist/owletto/dist/assets/{_automationId-NuFSEFlw.js → _automationId-ziwseLb7.js} +1 -1
- package/dist/owletto/dist/assets/{_connectorKey._connectionId-D_FhMGN1.js → _connectorKey._connectionId-B6V3ySFK.js} +1 -1
- package/dist/owletto/dist/assets/{_connectorKey.index-B8AZikVg.js → _connectorKey.index-CR5u_dtt.js} +1 -1
- package/dist/owletto/dist/assets/{_conversationId-D1Cx42I0.js → _conversationId-FBMYmOl8.js} +1 -1
- package/dist/owletto/dist/assets/{_deploymentId-BjtZC8Oo.js → _deploymentId-DNTXbT_m.js} +1 -1
- package/dist/owletto/dist/assets/_name-B37LKIxH.js +1 -0
- package/dist/owletto/dist/assets/{_owner-c8L8M4FP.js → _owner-BxYumqC2.js} +1 -1
- package/dist/owletto/dist/assets/_shape-Bxz-04jR.js +1 -0
- package/dist/owletto/dist/assets/_skillKey-D5MFbiw2.js +1 -0
- package/dist/owletto/dist/assets/{_slug-Nlm2ziLr.js → _slug-Dlhit09k.js} +1 -1
- package/dist/owletto/dist/assets/_viewKey-C6535i-t.js +1 -0
- package/dist/owletto/dist/assets/_viewKey-CQCtY3Y8.js +1 -0
- package/dist/owletto/dist/assets/_viewKey-CxKfKbRa.js +1 -0
- package/dist/owletto/dist/assets/{accept-invitation-BfqbITxp.js → accept-invitation-BQQwec3R.js} +1 -1
- package/dist/owletto/dist/assets/{activity-route-view-CTQEg3Us.js → activity-route-view-BwThvdGs.js} +1 -1
- package/dist/owletto/dist/assets/{agent-card-controls-49SIdmyU.js → agent-card-controls-B3RhzsPz.js} +1 -1
- package/dist/owletto/dist/assets/{agent-client-setup-list-ChwHMq4Q.js → agent-client-setup-list-BFtgRwe8.js} +1 -1
- package/dist/owletto/dist/assets/{agent-connect-pages-CJntJskO.js → agent-connect-pages-BO4wQn4L.js} +1 -1
- package/dist/owletto/dist/assets/{agent-editor-form-CEEFNek5.js → agent-editor-form-BYC4uSNz.js} +1 -1
- package/dist/owletto/dist/assets/{agent-guardrails-route-BF_RvzHv.js → agent-guardrails-route-Dp02G1AQ.js} +1 -1
- package/dist/owletto/dist/assets/{agent-loading-shells-Cve_XIMW.js → agent-loading-shells-OagauQzV.js} +1 -1
- package/dist/owletto/dist/assets/{agent-permissions-matrix-DEYa123T.js → agent-permissions-matrix-B9Ho3P1t.js} +1 -1
- package/dist/owletto/dist/assets/{agent-skill-context-DuS7Ojm_.js → agent-skill-context-BAr2Dw3F.js} +1 -1
- package/dist/owletto/dist/assets/{agent-skills-route-BItudd8s.js → agent-skills-route-B4VUnVi0.js} +1 -1
- package/dist/owletto/dist/assets/{agent-subpage-shell-BkGzpmv5.js → agent-subpage-shell-Dz8I-GUt.js} +1 -1
- package/dist/owletto/dist/assets/{agent-thread-DhCFggHZ.js → agent-thread-B9-cdkaV.js} +1 -1
- package/dist/owletto/dist/assets/agents-D0CIg4b9.js +1 -0
- package/dist/owletto/dist/assets/{agents-workbench-BZaoiFNY.js → agents-workbench-C2sr5h82.js} +1 -1
- package/dist/owletto/dist/assets/{app._appId-0fp8NC9-.js → app._appId-DLsJ_QWS.js} +1 -1
- package/dist/owletto/dist/assets/{automation-detail-content-C08Ef137.js → automation-detail-content-9Rjb_I9j.js} +1 -1
- package/dist/owletto/dist/assets/automations-D0CIg4b9.js +1 -0
- package/dist/owletto/dist/assets/{calendar-CvEqJnKS.js → calendar-DAiyi1ZL.js} +1 -1
- package/dist/owletto/dist/assets/{callback-BfjlxUcL.js → callback-CaRe2TOT.js} +1 -1
- package/dist/owletto/dist/assets/{card-MXMmjz9G.js → card-CMmh2mzo.js} +1 -1
- package/dist/owletto/dist/assets/{claim-B5igXpyF.js → claim-CYHnUF7G.js} +1 -1
- package/dist/owletto/dist/assets/{clients-DqMOcwpO.js → clients-Cp1BJ28u.js} +1 -1
- package/dist/owletto/dist/assets/{code-editor-bpbaa7f6.js → code-editor-CYsR2VBP.js} +1 -1
- package/dist/owletto/dist/assets/connect-CZip2g_B.js +1 -0
- package/dist/owletto/dist/assets/connect._clientId-CEKY8Dnv.js +1 -0
- package/dist/owletto/dist/assets/{connected._clientId-BWVr-PMm.js → connected._clientId-C5xRjxNO.js} +1 -1
- package/dist/owletto/dist/assets/{connection-D-dXA43c.js → connection-C06HZ241.js} +1 -1
- package/dist/owletto/dist/assets/{connection-feed-detail-XYK-ubKG.js → connection-feed-detail-D1whY5hL.js} +1 -1
- package/dist/owletto/dist/assets/{connector-provenance-RL_DcF2q.js → connector-provenance-BjKiUhYE.js} +1 -1
- package/dist/owletto/dist/assets/{connectors-B2_PLuXP.js → connectors-Baejya0T.js} +1 -1
- package/dist/owletto/dist/assets/{consent-CMrkyIfi.js → consent-CfYDldcF.js} +1 -1
- package/dist/owletto/dist/assets/{core.esm-BrIR85HL.js → core.esm-QA7BQgiK.js} +1 -1
- package/dist/owletto/dist/assets/create-C3P-3_8O.js +1 -0
- package/dist/owletto/dist/assets/create-CwnrPUEw.js +1 -0
- package/dist/owletto/dist/assets/{create-UTXCruIl.js → create-DOScS9Gl.js} +1 -1
- package/dist/owletto/dist/assets/{create-automation-form-BHir-pIp.js → create-automation-form-CuxiIRCF.js} +1 -1
- package/dist/owletto/dist/assets/{create._connectorKey-qjd3B6p5.js → create._connectorKey-Bjv3lCf8.js} +1 -1
- package/dist/owletto/dist/assets/{cronstrue-BwvvZn_Y.js → cronstrue-2GHCtD7h.js} +1 -1
- package/dist/owletto/dist/assets/{deployments-DHAx8TBs.js → deployments-ByBv1DW-.js} +1 -1
- package/dist/owletto/dist/assets/deployments-C-_ECORv.js +1 -0
- package/dist/owletto/dist/assets/{deployments-body-B54mJoZC.js → deployments-body-Bm2upStd.js} +1 -1
- package/dist/owletto/dist/assets/{device-Bi_9KNKQ.js → device-B0i7Xp8y.js} +1 -1
- package/dist/owletto/dist/assets/{device-pin-tombstone-Dkmmka9d.js → device-pin-tombstone-Bd6vS2zu.js} +1 -1
- package/dist/owletto/dist/assets/{device-rows-CkTAaZ3m.js → device-rows-Bwf8qDte.js} +1 -1
- package/dist/owletto/dist/assets/{device._deviceId-B_WqDhY5.js → device._deviceId-DJLAesm3.js} +1 -1
- package/dist/owletto/dist/assets/{entity-options-Bm1sbpmt.js → entity-options-CrbS6K-i.js} +1 -1
- package/dist/owletto/dist/assets/{entity-page-DZUGex-P.js → entity-page-ijZe_1-6.js} +1 -1
- package/dist/owletto/dist/assets/{entity-type-page-DSBcVv9e.js → entity-type-page-onp2Tk_E.js} +1 -1
- package/dist/owletto/dist/assets/{event-page-B837JclA.js → event-page-C0B2UDY-.js} +1 -1
- package/dist/owletto/dist/assets/{events-feed-BgvLTppV.js → events-feed-DK35T4g7.js} +1 -1
- package/dist/owletto/dist/assets/{full-page-spinner-ByBsHimW.js → full-page-spinner-Dd8eEaxq.js} +1 -1
- package/dist/owletto/dist/assets/guardrails-DKO8_J-G.js +1 -0
- package/dist/owletto/dist/assets/identity-CKM54vrM.js +1 -0
- package/dist/owletto/dist/assets/{index-DjYcFuq9.js → index--VmN5WxW.js} +1 -1
- package/dist/owletto/dist/assets/{index-GZkujXG1.js → index-B2AmRqYh.js} +1589 -1589
- package/dist/owletto/dist/assets/{index-Be5BLMwZ.js → index-B_rcEgFX.js} +1 -1
- package/dist/owletto/dist/assets/{index-Dpf0I2N4.js → index-BmhGe6-Z.js} +1 -1
- package/dist/owletto/dist/assets/index-C1dJSGrL.js +1 -0
- package/dist/owletto/dist/assets/index-CAFw4qCb.js +1 -0
- package/dist/owletto/dist/assets/{index-DBs2lhwE.js → index-CCcc_xBw.js} +1 -1
- package/dist/owletto/dist/assets/{index-DqrjJ9LB.js → index-CLU3gXVm.js} +1 -1
- package/dist/owletto/dist/assets/{index-Cane2GT3.js → index-Cf0GJoiG.js} +1 -1
- package/dist/owletto/dist/assets/index-CqQVnAY-.js +1 -0
- package/dist/owletto/dist/assets/{index-BrT0gBIi.js → index-CxT0uyIe.js} +1 -1
- package/dist/owletto/dist/assets/index-DR08e6Ec.js +1 -0
- package/dist/owletto/dist/assets/index-DYb9L5FC.js +1 -0
- package/dist/owletto/dist/assets/{index-C1MV7ajb.js → index-DlepU3cY.js} +1 -1
- package/dist/owletto/dist/assets/index-SUUcQGT-.js +1 -0
- package/dist/owletto/dist/assets/index-SdiFOfR1.js +1 -0
- package/dist/owletto/dist/assets/index-zcfi5r1l.js +1 -0
- package/dist/owletto/dist/assets/{json-diff-D6sv990W.js → json-diff-ClBBYBQD.js} +1 -1
- package/dist/owletto/dist/assets/{list-skeleton-B39wKVT1.js → list-skeleton-BtWn2eo2.js} +1 -1
- package/dist/owletto/dist/assets/{login-DxnhCvKx.js → login-d3PdO-qV.js} +1 -1
- package/dist/owletto/dist/assets/{logout-Lvib6Kk7.js → logout-DgckxwLn.js} +1 -1
- package/dist/owletto/dist/assets/{member-scope-gate-CM-GNviT.js → member-scope-gate-DXOCfx-v.js} +1 -1
- package/dist/owletto/dist/assets/{memory-browse-page-DKmyI1FJ.js → memory-browse-page-CeAnKoTR.js} +1 -1
- package/dist/owletto/dist/assets/{missing-view-CAFqvZpi.js → missing-view-DrZ8m8yo.js} +1 -1
- package/dist/owletto/dist/assets/{model-selector-BoudNhPZ.js → model-selector-CapL1ARf.js} +1 -1
- package/dist/owletto/dist/assets/models-CB8mhq7j.js +1 -0
- package/dist/owletto/dist/assets/{new-Jp_DtYBt.js → new-BBUb-VR4.js} +1 -1
- package/dist/owletto/dist/assets/{new-e3C5Yokb.js → new-CBLJ25_w.js} +1 -1
- package/dist/owletto/dist/assets/{new-CKSjnGM9.js → new-tTXB4qBW.js} +1 -1
- package/dist/owletto/dist/assets/{oauth-workspace-access-DuPiMSr2.js → oauth-workspace-access-DearynqZ.js} +1 -1
- package/dist/owletto/dist/assets/{organization-DUPBruFP.js → organization-BgdBg-PJ.js} +1 -1
- package/dist/owletto/dist/assets/{permissions-DqkX4mTH.js → permissions-h_qSft1A.js} +1 -1
- package/dist/owletto/dist/assets/{proposal-review-shell-C04RG1qM.js → proposal-review-shell-D4YNrrye.js} +1 -1
- package/dist/owletto/dist/assets/{recent-BmxCZQ8j.js → recent-JiBNvZzD.js} +1 -1
- package/dist/owletto/dist/assets/{renderer-eFSU65zm.js → renderer-DgPLyEbx.js} +1 -1
- package/dist/owletto/dist/assets/{reset-password-BinCwene.js → reset-password-B8tWPtIj.js} +1 -1
- package/dist/owletto/dist/assets/{runs-DwThk2CI.js → runs-oHveuEUB.js} +1 -1
- package/dist/owletto/dist/assets/{runs-panel-DfxWCV7K.js → runs-panel-C56GDaJm.js} +1 -1
- package/dist/owletto/dist/assets/{runs-table-Dh7FL3Va.js → runs-table-BUKDjiBc.js} +1 -1
- package/dist/owletto/dist/assets/{schema-value-normalization-CPLeOm7K.js → schema-value-normalization-3JuM_r1H.js} +1 -1
- package/dist/owletto/dist/assets/settings-DaKg6U5O.js +1 -0
- package/dist/owletto/dist/assets/{settings-DLg89oqz.js → settings-DhnRi2nq.js} +1 -1
- package/dist/owletto/dist/assets/skills-BpQncuMC.js +1 -0
- package/dist/owletto/dist/assets/{switch-Dcx3_8kM.js → switch-BQ40_DMb.js} +1 -1
- package/dist/owletto/dist/assets/{use-applied-views-BpvIIgWG.js → use-applied-views-B-Z-Weji.js} +1 -1
- package/dist/owletto/dist/assets/{use-mention-search-Vndny_Gd.js → use-mention-search-B4DfZFm5.js} +1 -1
- package/dist/owletto/dist/assets/{view-frame-DxiuLSGA.js → view-frame-C7ciEoLo.js} +1 -1
- package/dist/owletto/dist/index.html +1 -1
- package/dist/server-main.bundle.mjs +2266 -2125
- package/npm-shrinkwrap.json +5 -5
- package/package.json +1 -1
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/package.json +1 -1
- package/vendor/views/dist/api.d.ts +42 -5
- package/vendor/views/dist/api.js +63 -6
- package/vendor/views/package.json +1 -1
- package/dist/owletto/dist/assets/_-TlzPuBqI.js +0 -1
- package/dist/owletto/dist/assets/_agentId-DutmYPK7.js +0 -1
- package/dist/owletto/dist/assets/_name-DTlirHDv.js +0 -1
- package/dist/owletto/dist/assets/_shape-DQaUs_O7.js +0 -1
- package/dist/owletto/dist/assets/_skillKey-CJSEeyG0.js +0 -1
- package/dist/owletto/dist/assets/_viewKey-BK9NZs21.js +0 -1
- package/dist/owletto/dist/assets/_viewKey-D-Og614G.js +0 -1
- package/dist/owletto/dist/assets/_viewKey-DIFCFECi.js +0 -1
- package/dist/owletto/dist/assets/agents-BIA5SCAT.js +0 -1
- package/dist/owletto/dist/assets/automations-BIA5SCAT.js +0 -1
- package/dist/owletto/dist/assets/connect-DpQrbviv.js +0 -1
- package/dist/owletto/dist/assets/connect._clientId-A_F-UzTr.js +0 -1
- package/dist/owletto/dist/assets/create-DhxcVjNh.js +0 -1
- package/dist/owletto/dist/assets/create-jVkf6V76.js +0 -1
- package/dist/owletto/dist/assets/deployments-CSJHFlJz.js +0 -1
- package/dist/owletto/dist/assets/guardrails-cMGe6IIe.js +0 -1
- package/dist/owletto/dist/assets/identity-BORtpi5L.js +0 -1
- package/dist/owletto/dist/assets/index-B5lGxbbZ.js +0 -1
- package/dist/owletto/dist/assets/index-BGz-9DDG.js +0 -1
- package/dist/owletto/dist/assets/index-BrzsfXR-.js +0 -1
- package/dist/owletto/dist/assets/index-C31QOVZH.js +0 -1
- package/dist/owletto/dist/assets/index-C6USRbY8.js +0 -1
- package/dist/owletto/dist/assets/index-Dh8ubWqr.js +0 -1
- package/dist/owletto/dist/assets/index-DpgsgDFc.js +0 -1
- package/dist/owletto/dist/assets/index-pFFCzVi5.js +0 -1
- package/dist/owletto/dist/assets/models-B8BuBmLu.js +0 -1
- package/dist/owletto/dist/assets/settings-CSrpSUqR.js +0 -1
- package/dist/owletto/dist/assets/skills-PQP0fNxc.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as z,p as F,a5 as L,r,j as e,a6 as v,a7 as S,B as U,a8 as N,a9 as E}from"./index-
|
|
1
|
+
import{_ as z,p as F,a5 as L,r,j as e,a6 as v,a7 as S,B as U,a8 as N,a9 as E}from"./index-B2AmRqYh.js";import{C as A,a as I,b as T,c as k}from"./card-CMmh2mzo.js";import{F as B}from"./full-page-spinner-Dd8eEaxq.js";function c(l){return l.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function H(){const l=z(),{session:u,isReady:d}=F(),{slug:n,name:i}=L.useSearch(),[m,y]=r.useState(i||n||""),[g,h]=r.useState(n||(i?c(i):"")),[b,C]=r.useState(!!n),[x,o]=r.useState(null),[f,p]=r.useState(!1),j=r.useRef(!1);if(r.useEffect(()=>{if(!d||u||j.current)return;j.current=!0;const a=new URL("/orgs/new",window.location.origin);n&&a.searchParams.set("slug",n),i&&a.searchParams.set("name",i);const s=new URL("/auth/login",window.location.origin);s.searchParams.set("callbackUrl",`${a.pathname}${a.search}`),window.location.assign(s.toString())},[d,u,n,i]),!d||!u)return e.jsx(B,{});const P=a=>{const s=E(a);if(s.kind==="cross-host"){window.location.assign(s.href);return}l({to:s.to})},R=async a=>{a.preventDefault(),o(null);const s=m.trim(),w=(g.trim()||c(s)).trim();if(!s){o("Name is required");return}if(!w){o("Slug is required");return}p(!0);try{const t=await N.create({name:s,slug:w});if(t.error){o(t.error.message||"Failed to create organization");return}t.data&&(await N.setActive({organizationId:t.data.id}),P(t.data.slug))}catch(t){o(t instanceof Error?t.message:"An error occurred")}finally{p(!1)}};return e.jsx("div",{className:"container mx-auto max-w-md px-4 py-10",children:e.jsxs(A,{children:[e.jsx(I,{children:e.jsx(T,{children:"Create organization"})}),e.jsx(k,{children:e.jsxs("form",{onSubmit:R,className:"space-y-4",children:[x&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:x}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(v,{htmlFor:"org-name",children:["Name",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(S,{id:"org-name",value:m,onChange:a=>{y(a.target.value),b||h(c(a.target.value))},placeholder:"Acme Inc.",autoFocus:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(v,{htmlFor:"org-slug",children:["Slug",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(S,{id:"org-slug",value:g,onChange:a=>{C(!0),h(c(a.target.value))},placeholder:"acme"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used in URLs and as the org id in ",e.jsx("code",{children:"lobu.toml"}),". Lowercase letters, numbers, and hyphens."]})]}),e.jsx("div",{className:"flex justify-end",children:e.jsx(U,{type:"submit",disabled:f,children:f?"Creating…":"Create organization"})})]})})]})})}export{H as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{gJ as o,_ as p,am as x,p as b,q as h,bt as f,j as e,ba as A,gA as w,aQ as L,gB as C,L as j,gC as S,fP as N,bk as k,cd as y}from"./index-
|
|
1
|
+
import{gJ as o,_ as p,am as x,p as b,q as h,bt as f,j as e,ba as A,gA as w,aQ as L,gB as C,L as j,gC as S,fP as N,bk as k,cd as y}from"./index-B2AmRqYh.js";import{A as E}from"./agent-editor-form-BYC4uSNz.js";import"./model-selector-CapL1ARf.js";const _="flex min-h-0 flex-1 flex-col gap-3 px-4 pt-4 pb-8 lg:px-6";function q(){const{owner:a}=o.useParams(),t=o.useSearch(),r=p(),i=x(),{isAuthenticated:c}=b(),{isMember:g,isLoading:m}=h(),n=c&&g,{data:u=[],isLoading:d}=f({enabled:n});return e.jsx("div",{className:_,children:e.jsxs(A,{className:"flex flex-1 flex-col gap-6",children:[e.jsx(w,{breadcrumb:e.jsx(C,{crumbs:[e.jsx(j,{to:"/$owner/agents",params:{owner:a},className:S,children:"Agents"},"agents")]}),icon:e.jsx(L.agents.icon,{className:"h-6 w-6"}),title:"Build a managed agent",caption:"Create an agent that Lobu runs and manages for this workspace."}),m||n&&d?e.jsx(N,{rows:1}):n?e.jsx(E,{mode:{kind:"create"},existingAgentIds:u.map(s=>s.agentId),onCreated:async s=>{const l=["agents",a];if(await i.refetchQueries({queryKey:l,exact:!0}),t.platform&&t.listen){await r({to:"/$owner/automations/new",params:{owner:a},search:{...t,agent:s}});return}await r({to:"/$owner/agents/$agentId/settings",params:{owner:a,agentId:s},search:{run_id:void 0}})}}):e.jsx(k,{icon:y,title:"Workspace membership required",description:"Only workspace members can build managed agents."})]})})}export{q as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as j,q as p,a as N,r as x,j as e,B as w,eD as y,bF as _,L as b,S as f,gH as v,aS as C}from"./index-
|
|
1
|
+
import{_ as j,q as p,a as N,r as x,j as e,B as w,eD as y,bF as _,L as b,S as f,gH as v,aS as C}from"./index-B2AmRqYh.js";import{C as S,A as k}from"./create-automation-form-CuxiIRCF.js";import"./cronstrue-2GHCtD7h.js";import"./entity-options-CrbS6K-i.js";import"./connection-label-BobuYiAG.js";import"./switch-BQ40_DMb.js";import"./device-automation-BIjs7DZJ.js";import"./model-selector-CapL1ARf.js";import"./skill-editor-D_W3QlRz.js";import"./code-editor-CYsR2VBP.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./use-mention-search-B4DfZFm5.js";function A(s){return s.includes(":")?s.slice(s.indexOf(":")+1):s}function T({prefillAgentId:s,onCancel:t,initialTriggers:m}){const{org:g}=p(),[o,i]=x.useState({ready:!1,triggers:[]}),[a,l]=x.useState(),h=x.useCallback(n=>{i(u=>JSON.stringify(u)===JSON.stringify(n)?u:n)},[]),c=a??m;return e.jsx(S,{startFromScratch:!!m,organizationId:g?.id??"",prefillAgentId:s,onClose:t,onPrefillTriggers:n=>l(n.length>0?n:void 0),onSuccess:t,hideHeader:!0,hideCancel:!0,submitLabel:"Create Automation",submitDisabled:!o.ready,createFields:{triggers:o.triggers},triggerFields:e.jsx(k,{organizationId:g?.id??null,initialTriggers:c,onChange:h},JSON.stringify(c??"new"))})}function B({owner:s,prefilled:t}){const m=j(),{org:g}=p(),o=N(g?.id??null,{status:"active",limit:500}),i=!!(t?.platform&&(t.listen||t.resource)),a=x.useMemo(()=>{if(!t?.platform||!t.listen&&!t.resource)return;const c=o.data??[],n=t.connection?c.find(r=>r.slug===t.connection):(()=>{const r=c.filter(d=>d.connector_key!==t.platform?!1:t.resource?!0:d.facets.chat&&(d.external_tenant_id??"")===(t.team??""));return r.length===1?r[0]:void 0})();if(t.connection&&!n)return;const u=t.events?.split(",").map(r=>r.trim()).filter(Boolean)??[];return[{kind:"event",source:"connector",connector_key:t.platform,...n?{connection_id:n.id}:{},event_types:u.length>0?u:t.listen?["message.created"]:[],match:t.resource?{resource_ref:t.resource,...t.resource_type?{resource_type:t.resource_type}:{}}:{channel_id:A(t.listen??"")},execution:"turn",active_run:t.listen?"steer":"queue",output:t.listen?"reply_to_source":"silent",skip_if_unchanged:!t.listen}]},[o.data,t]),l=()=>void m({to:"/$owner/automations",params:{owner:s}}),h=a?t?.resource?`React to changes on ${t.label??t.resource}.`:`React to messages in ${t?.label??t?.listen}.`:i&&!o.isLoading?"Choose the matching connection and event, then define the reaction.":"Start from a template, from scratch, or clone an existing Automation.";return e.jsx("div",{className:"flex flex-1 flex-col gap-6 px-4 py-6 lg:px-6",children:e.jsxs("div",{className:"mx-auto flex w-full min-w-0 max-w-3xl flex-col gap-4",children:[e.jsx("div",{className:"flex flex-wrap items-center justify-between gap-3",children:e.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[e.jsxs(w,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-foreground",onClick:l,children:[e.jsx(y,{className:"h-3.5 w-3.5"}),"Automations"]}),e.jsxs("h1",{className:"flex min-w-0 items-center gap-2 truncate font-display text-xl font-semibold",children:[e.jsx(_,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),"New automation"]})]})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:h}),t?.listen&&a?e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Choose an agent below, or"," ",e.jsx(b,{to:"/$owner/agents/new",params:{owner:s},search:t,className:"underline underline-offset-4",children:"create an agent"})," ","and return to this conversation setup."]}):null,i&&o.isLoading?e.jsxs("div",{className:"space-y-3",children:[e.jsx(f,{className:"h-10 w-full"}),e.jsx(f,{className:"h-32 w-full"})]}):i&&t?.connection&&!a?e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"This connection is no longer available. Reopen setup from your conversation."}):e.jsx(T,{prefillAgentId:t?.agent,onCancel:l,initialTriggers:a})]})})}function W(){const{owner:s}=v.useParams(),t=v.useSearch();return e.jsx(C,{owner:s,children:()=>e.jsx(B,{owner:s,prefilled:t})})}export{W as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,ab as k,af as $,ag as E,B as R,r as p,ah as P}from"./index-GZkujXG1.js";const W=["mcp:read","mcp:write","mcp:admin"],O=[{value:"read",title:"Read only",description:"Search and view authorized workspace data."},{value:"write",title:"Read and make changes",description:"Includes read access. Create and update authorized workspace data."},{value:"admin",title:"Administer workspaces",description:"Includes read and write access. Manage administrator-only settings.",risk:"high"}],C={read:0,write:1,admin:2};function I(s){return s.includes("mcp:admin")?"admin":s.includes("mcp:write")?"write":s.includes("mcp:read")?"read":null}function F(s,n){const r=s.filter(x=>!W.includes(x));if(!n)return r;const o=I(s);return!o||C[n]>C[o]?r:["mcp:read",...n==="write"||n==="admin"?["mcp:write"]:[],...n==="admin"?["mcp:admin"]:[],...r]}function B({idPrefix:s,clientName:n,requestedScopes:r,accessLevel:o,onAccessLevelChange:x,sensitiveScopesAcknowledged:g=!1,onSensitiveScopesAcknowledgedChange:v,disabled:N=!1}){const f=I(r),j=r.includes("profile:read"),m=r.includes("device_worker:run"),i=r.includes("connections:token"),l=m||i,c=r.filter(t=>!W.includes(t)&&t!=="profile:read"&&t!=="device_worker:run"&&t!=="connections:token");return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("section",{"aria-labelledby":`${s}-application`,className:"space-y-2",children:[e.jsx("p",{id:`${s}-application`,className:"text-sm font-medium",children:"Application"}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:n||"Unnamed application"}),e.jsx(k,{variant:"destructive",children:"Unverified"})]}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"This name was supplied by the requester. Lobu has not verified the publisher."})]})]}),f&&e.jsxs("fieldset",{className:"space-y-2",disabled:N,children:[e.jsx("legend",{className:"text-sm font-medium",children:"Access level"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose the maximum access this application should receive."}),e.jsx("div",{className:"space-y-2",children:O.filter(t=>C[t.value]<=C[f]).map(t=>{const h=`${s}-access-${t.value}`,b=o===t.value;return e.jsxs("label",{htmlFor:h,className:$("flex cursor-pointer items-start gap-3 rounded-md border p-3 transition-colors",b&&"border-primary bg-primary/5"),children:[e.jsx("input",{id:h,type:"radio",name:`${s}-access-level`,value:t.value,checked:b,onChange:()=>x(t.value),className:"mt-1 h-4 w-4 accent-primary"}),e.jsxs("span",{className:"min-w-0 space-y-0.5",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium text-foreground",children:[t.title,t.risk==="high"&&e.jsx(k,{variant:"destructive",children:"High risk"})]}),e.jsx("span",{className:"block text-sm text-muted-foreground",children:t.description})]})]},t.value)})})]}),j&&e.jsxs("section",{"aria-labelledby":`${s}-profile`,className:"space-y-2",children:[e.jsx("p",{id:`${s}-profile`,className:"text-sm font-medium",children:"Account information"}),e.jsxs("div",{className:"rounded-md border p-3",children:[e.jsxs("p",{className:"flex flex-wrap items-center gap-2 text-sm font-medium text-foreground",children:["Basic profile",e.jsx(k,{variant:"secondary",children:"Included"})]}),e.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"See your basic Lobu identity and the names and slugs of workspaces you belong to."})]})]}),c.length>0&&e.jsxs("section",{"aria-labelledby":`${s}-additional`,className:"space-y-2",children:[e.jsx("p",{id:`${s}-additional`,className:"text-sm font-medium",children:"Additional permissions"}),e.jsx("ul",{className:"space-y-2",children:c.map(t=>e.jsx("li",{className:"rounded-md border p-3 font-mono text-xs text-foreground",children:t},t))})]}),l&&e.jsxs("section",{className:"space-y-3 rounded-md border border-destructive/40 bg-destructive/5 p-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Device capabilities"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"These capabilities are fixed by the device request and cannot be reduced here."})]}),e.jsxs("ul",{className:"space-y-2",children:[m&&e.jsxs("li",{className:"rounded-md bg-background/70 p-3",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Operate this device"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Run jobs and Automations through capabilities advertised by this device."})]}),i&&e.jsxs("li",{className:"rounded-md bg-background/70 p-3",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Use connected services"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Request short-lived access for services you connected to Lobu."})]})]}),e.jsxs("div",{className:"flex items-start gap-3 rounded-md border bg-background p-3",children:[e.jsx(E,{id:`${s}-sensitive-acknowledgement`,checked:g,disabled:N,onCheckedChange:t=>v?.(t===!0),className:"mt-0.5"}),e.jsx("label",{htmlFor:`${s}-sensitive-acknowledgement`,className:"cursor-pointer text-sm font-medium text-foreground",children:"I initiated this request and confirmed that the device code matches."})]})]})]})}function q({idPrefix:s,orgList:n,selectedOrgIds:r,onWorkspaceAccessChange:o,onSelectedOrgChange:x,orgsLoading:g,orgsError:v,onRetry:N,disabled:f=!1,personalRequired:j=!1,allowMultiple:m}){const i=`${s}-workspace-access-legend`,l=r.length===n.length;return g?e.jsxs("section",{"aria-labelledby":i,className:"space-y-2",children:[e.jsx("p",{id:i,className:"text-sm font-medium",children:"Workspace access"}),e.jsx("p",{role:"status","aria-live":"polite",className:"text-sm text-muted-foreground",children:"Loading your workspaces..."})]}):v?e.jsxs("section",{"aria-labelledby":i,className:"space-y-2",children:[e.jsx("p",{id:i,className:"text-sm font-medium",children:"Workspace access"}),e.jsxs("div",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:[e.jsx("p",{children:"Workspaces could not be loaded. Approval is unavailable until they load."}),e.jsx(R,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:N,children:"Retry"})]})]}):n.length===0?e.jsxs("section",{"aria-labelledby":i,className:"space-y-2",children:[e.jsx("p",{id:i,className:"text-sm font-medium",children:"Workspace access"}),e.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:"No member workspaces are available for this connection."})]}):e.jsxs("fieldset",{className:"space-y-3",disabled:f,children:[e.jsx("legend",{id:i,className:"sr-only",children:"Workspace access"}),e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Workspaces"}),e.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:m?"Choose where this application can operate.":"Choose one workspace this application can access."})]}),m&&!l&&e.jsxs(R,{type:"button",variant:"outline",size:"sm",onClick:()=>o("all_current"),children:["Select all ",n.length]})]}),j&&e.jsxs("div",{className:"rounded-md border border-primary/20 bg-primary/5 p-3 text-sm",children:[e.jsx("p",{className:"font-medium text-foreground",children:"Device home: Personal workspace"}),e.jsx("p",{className:"mt-0.5 text-muted-foreground",children:m?"Fixed for device data. Additional workspaces grant MCP access only.":"Device data stays in your personal workspace."})]}),e.jsx("div",{className:"space-y-2",children:n.map(c=>{const t=`${s}-workspace-${c.id}`,h=j&&c.isPersonal,b=r.includes(c.id);return e.jsxs("div",{className:$("flex items-start gap-3 rounded-md border p-3 transition-colors",b&&"border-primary/40 bg-primary/5"),children:[e.jsx(E,{id:t,checked:b,disabled:f||h||j&&!m,onCheckedChange:S=>x(c.id,S===!0),className:"mt-0.5"}),e.jsxs("label",{htmlFor:t,className:"min-w-0 flex-1 cursor-pointer space-y-0.5",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium text-foreground",children:[c.name,c.isPersonal&&e.jsx(k,{variant:"outline",children:"Personal"}),h&&e.jsx(k,{variant:"secondary",children:"Required"})]}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:c.slug})]})]},c.id)})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs text-muted-foreground",children:[e.jsxs("p",{"aria-live":"polite",children:[r.length," of ",n.length," workspaces selected."]}),l&&e.jsx(k,{variant:"secondary",children:"All currently available"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Workspaces you join later are not added automatically."}),r.length===0&&e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Choose at least one workspace."})]})}function D(s,n){p.useEffect(()=>{if(n||s)return;const r=new URL("/auth/login",window.location.origin);r.searchParams.set("callbackUrl",window.location.href),window.location.href=r.toString()},[s,n])}function U(s,n){return s.length===n.length&&s.every((r,o)=>r===n[o])}function T(s={}){const{requirePersonal:n=!1,allowMultiple:r=!0}=s,{data:o,error:x,isPending:g,refetch:v}=P(),[N,f]=p.useState("selected"),[j,m]=p.useState([]),i=p.useRef(!1),l=p.useMemo(()=>o?o.filter(a=>a.is_member).map(a=>({id:a.id,name:a.name,slug:a.slug,isPersonal:a.is_personal===!0})):[],[o]),c=l.find(a=>a.isPersonal)?.id??null,t=p.useRef(l);t.current=l;const h=x instanceof Error?x.message:x?"Unable to load workspaces":null;p.useEffect(()=>{if(g||h)return;const a=l.map(d=>d.id),u=new Set(a);m(d=>{const w=i.current?d.filter(A=>u.has(A)):[c??a[0]].filter(A=>!!A);return i.current=!0,U(d,w)?d:w})},[l,h,g,c]);const b=p.useCallback(a=>{if(a==="all_current"){if(!r)return;m(t.current.map(u=>u.id))}f(a)},[r]),S=p.useCallback((a,u)=>{t.current.some(d=>d.id===a)&&(n&&(a===c||!r)||(f("selected"),m(d=>u?r?d.includes(a)?d:[...d,a]:[a]:d.filter(w=>w!==a))))},[r,c,n]),y=p.useMemo(()=>{const a=new Set(j);return n&&c&&a.add(c),l.filter(u=>a.has(u.id)).map(u=>u.id)},[j,l,c,n]),L=p.useCallback(()=>{const a=t.current,u=a.find(d=>d.isPersonal)?.id??a[0]?.id;i.current=a.length>0,f("selected"),m(u?[u]:[])},[]),_=!g&&!h&&l.length>0&&y.length>0&&(r||y.length===1)&&(!n||c!==null&&y.includes(c)),M=p.useCallback(()=>{v()},[v]);return{orgList:l,workspaceAccess:N,setWorkspaceAccess:b,selectedOrgIds:y,toggleSelectedOrgId:S,resetWorkspaceSelection:L,personalOrgId:c,orgsLoading:g,orgsError:h,retryOrgs:M,workspaceSelectionReady:_}}function V(s){if(!s)return null;try{return new URL(s).pathname.match(/^\/mcp\/([^/]+)$/)?.[1]?.trim()||null}catch{return null}}export{B as A,q as W,I as a,D as b,V as g,F as s,T as u};
|
|
1
|
+
import{j as e,ab as k,af as $,ag as E,B as R,r as p,ah as P}from"./index-B2AmRqYh.js";const W=["mcp:read","mcp:write","mcp:admin"],O=[{value:"read",title:"Read only",description:"Search and view authorized workspace data."},{value:"write",title:"Read and make changes",description:"Includes read access. Create and update authorized workspace data."},{value:"admin",title:"Administer workspaces",description:"Includes read and write access. Manage administrator-only settings.",risk:"high"}],C={read:0,write:1,admin:2};function I(s){return s.includes("mcp:admin")?"admin":s.includes("mcp:write")?"write":s.includes("mcp:read")?"read":null}function F(s,n){const r=s.filter(x=>!W.includes(x));if(!n)return r;const o=I(s);return!o||C[n]>C[o]?r:["mcp:read",...n==="write"||n==="admin"?["mcp:write"]:[],...n==="admin"?["mcp:admin"]:[],...r]}function B({idPrefix:s,clientName:n,requestedScopes:r,accessLevel:o,onAccessLevelChange:x,sensitiveScopesAcknowledged:g=!1,onSensitiveScopesAcknowledgedChange:v,disabled:N=!1}){const f=I(r),j=r.includes("profile:read"),m=r.includes("device_worker:run"),i=r.includes("connections:token"),l=m||i,c=r.filter(t=>!W.includes(t)&&t!=="profile:read"&&t!=="device_worker:run"&&t!=="connections:token");return e.jsxs("div",{className:"space-y-5",children:[e.jsxs("section",{"aria-labelledby":`${s}-application`,className:"space-y-2",children:[e.jsx("p",{id:`${s}-application`,className:"text-sm font-medium",children:"Application"}),e.jsxs("div",{className:"rounded-lg border p-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold text-foreground",children:n||"Unnamed application"}),e.jsx(k,{variant:"destructive",children:"Unverified"})]}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"This name was supplied by the requester. Lobu has not verified the publisher."})]})]}),f&&e.jsxs("fieldset",{className:"space-y-2",disabled:N,children:[e.jsx("legend",{className:"text-sm font-medium",children:"Access level"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose the maximum access this application should receive."}),e.jsx("div",{className:"space-y-2",children:O.filter(t=>C[t.value]<=C[f]).map(t=>{const h=`${s}-access-${t.value}`,b=o===t.value;return e.jsxs("label",{htmlFor:h,className:$("flex cursor-pointer items-start gap-3 rounded-md border p-3 transition-colors",b&&"border-primary bg-primary/5"),children:[e.jsx("input",{id:h,type:"radio",name:`${s}-access-level`,value:t.value,checked:b,onChange:()=>x(t.value),className:"mt-1 h-4 w-4 accent-primary"}),e.jsxs("span",{className:"min-w-0 space-y-0.5",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium text-foreground",children:[t.title,t.risk==="high"&&e.jsx(k,{variant:"destructive",children:"High risk"})]}),e.jsx("span",{className:"block text-sm text-muted-foreground",children:t.description})]})]},t.value)})})]}),j&&e.jsxs("section",{"aria-labelledby":`${s}-profile`,className:"space-y-2",children:[e.jsx("p",{id:`${s}-profile`,className:"text-sm font-medium",children:"Account information"}),e.jsxs("div",{className:"rounded-md border p-3",children:[e.jsxs("p",{className:"flex flex-wrap items-center gap-2 text-sm font-medium text-foreground",children:["Basic profile",e.jsx(k,{variant:"secondary",children:"Included"})]}),e.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"See your basic Lobu identity and the names and slugs of workspaces you belong to."})]})]}),c.length>0&&e.jsxs("section",{"aria-labelledby":`${s}-additional`,className:"space-y-2",children:[e.jsx("p",{id:`${s}-additional`,className:"text-sm font-medium",children:"Additional permissions"}),e.jsx("ul",{className:"space-y-2",children:c.map(t=>e.jsx("li",{className:"rounded-md border p-3 font-mono text-xs text-foreground",children:t},t))})]}),l&&e.jsxs("section",{className:"space-y-3 rounded-md border border-destructive/40 bg-destructive/5 p-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Device capabilities"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"These capabilities are fixed by the device request and cannot be reduced here."})]}),e.jsxs("ul",{className:"space-y-2",children:[m&&e.jsxs("li",{className:"rounded-md bg-background/70 p-3",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Operate this device"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Run jobs and Automations through capabilities advertised by this device."})]}),i&&e.jsxs("li",{className:"rounded-md bg-background/70 p-3",children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Use connected services"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Request short-lived access for services you connected to Lobu."})]})]}),e.jsxs("div",{className:"flex items-start gap-3 rounded-md border bg-background p-3",children:[e.jsx(E,{id:`${s}-sensitive-acknowledgement`,checked:g,disabled:N,onCheckedChange:t=>v?.(t===!0),className:"mt-0.5"}),e.jsx("label",{htmlFor:`${s}-sensitive-acknowledgement`,className:"cursor-pointer text-sm font-medium text-foreground",children:"I initiated this request and confirmed that the device code matches."})]})]})]})}function q({idPrefix:s,orgList:n,selectedOrgIds:r,onWorkspaceAccessChange:o,onSelectedOrgChange:x,orgsLoading:g,orgsError:v,onRetry:N,disabled:f=!1,personalRequired:j=!1,allowMultiple:m}){const i=`${s}-workspace-access-legend`,l=r.length===n.length;return g?e.jsxs("section",{"aria-labelledby":i,className:"space-y-2",children:[e.jsx("p",{id:i,className:"text-sm font-medium",children:"Workspace access"}),e.jsx("p",{role:"status","aria-live":"polite",className:"text-sm text-muted-foreground",children:"Loading your workspaces..."})]}):v?e.jsxs("section",{"aria-labelledby":i,className:"space-y-2",children:[e.jsx("p",{id:i,className:"text-sm font-medium",children:"Workspace access"}),e.jsxs("div",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:[e.jsx("p",{children:"Workspaces could not be loaded. Approval is unavailable until they load."}),e.jsx(R,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:N,children:"Retry"})]})]}):n.length===0?e.jsxs("section",{"aria-labelledby":i,className:"space-y-2",children:[e.jsx("p",{id:i,className:"text-sm font-medium",children:"Workspace access"}),e.jsx("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:"No member workspaces are available for this connection."})]}):e.jsxs("fieldset",{className:"space-y-3",disabled:f,children:[e.jsx("legend",{id:i,className:"sr-only",children:"Workspace access"}),e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Workspaces"}),e.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:m?"Choose where this application can operate.":"Choose one workspace this application can access."})]}),m&&!l&&e.jsxs(R,{type:"button",variant:"outline",size:"sm",onClick:()=>o("all_current"),children:["Select all ",n.length]})]}),j&&e.jsxs("div",{className:"rounded-md border border-primary/20 bg-primary/5 p-3 text-sm",children:[e.jsx("p",{className:"font-medium text-foreground",children:"Device home: Personal workspace"}),e.jsx("p",{className:"mt-0.5 text-muted-foreground",children:m?"Fixed for device data. Additional workspaces grant MCP access only.":"Device data stays in your personal workspace."})]}),e.jsx("div",{className:"space-y-2",children:n.map(c=>{const t=`${s}-workspace-${c.id}`,h=j&&c.isPersonal,b=r.includes(c.id);return e.jsxs("div",{className:$("flex items-start gap-3 rounded-md border p-3 transition-colors",b&&"border-primary/40 bg-primary/5"),children:[e.jsx(E,{id:t,checked:b,disabled:f||h||j&&!m,onCheckedChange:S=>x(c.id,S===!0),className:"mt-0.5"}),e.jsxs("label",{htmlFor:t,className:"min-w-0 flex-1 cursor-pointer space-y-0.5",children:[e.jsxs("span",{className:"flex flex-wrap items-center gap-2 text-sm font-medium text-foreground",children:[c.name,c.isPersonal&&e.jsx(k,{variant:"outline",children:"Personal"}),h&&e.jsx(k,{variant:"secondary",children:"Required"})]}),e.jsx("span",{className:"block text-xs text-muted-foreground",children:c.slug})]})]},c.id)})}),e.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs text-muted-foreground",children:[e.jsxs("p",{"aria-live":"polite",children:[r.length," of ",n.length," workspaces selected."]}),l&&e.jsx(k,{variant:"secondary",children:"All currently available"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Workspaces you join later are not added automatically."}),r.length===0&&e.jsx("p",{role:"alert",className:"text-xs text-destructive",children:"Choose at least one workspace."})]})}function D(s,n){p.useEffect(()=>{if(n||s)return;const r=new URL("/auth/login",window.location.origin);r.searchParams.set("callbackUrl",window.location.href),window.location.href=r.toString()},[s,n])}function U(s,n){return s.length===n.length&&s.every((r,o)=>r===n[o])}function T(s={}){const{requirePersonal:n=!1,allowMultiple:r=!0}=s,{data:o,error:x,isPending:g,refetch:v}=P(),[N,f]=p.useState("selected"),[j,m]=p.useState([]),i=p.useRef(!1),l=p.useMemo(()=>o?o.filter(a=>a.is_member).map(a=>({id:a.id,name:a.name,slug:a.slug,isPersonal:a.is_personal===!0})):[],[o]),c=l.find(a=>a.isPersonal)?.id??null,t=p.useRef(l);t.current=l;const h=x instanceof Error?x.message:x?"Unable to load workspaces":null;p.useEffect(()=>{if(g||h)return;const a=l.map(d=>d.id),u=new Set(a);m(d=>{const w=i.current?d.filter(A=>u.has(A)):[c??a[0]].filter(A=>!!A);return i.current=!0,U(d,w)?d:w})},[l,h,g,c]);const b=p.useCallback(a=>{if(a==="all_current"){if(!r)return;m(t.current.map(u=>u.id))}f(a)},[r]),S=p.useCallback((a,u)=>{t.current.some(d=>d.id===a)&&(n&&(a===c||!r)||(f("selected"),m(d=>u?r?d.includes(a)?d:[...d,a]:[a]:d.filter(w=>w!==a))))},[r,c,n]),y=p.useMemo(()=>{const a=new Set(j);return n&&c&&a.add(c),l.filter(u=>a.has(u.id)).map(u=>u.id)},[j,l,c,n]),L=p.useCallback(()=>{const a=t.current,u=a.find(d=>d.isPersonal)?.id??a[0]?.id;i.current=a.length>0,f("selected"),m(u?[u]:[])},[]),_=!g&&!h&&l.length>0&&y.length>0&&(r||y.length===1)&&(!n||c!==null&&y.includes(c)),M=p.useCallback(()=>{v()},[v]);return{orgList:l,workspaceAccess:N,setWorkspaceAccess:b,selectedOrgIds:y,toggleSelectedOrgId:S,resetWorkspaceSelection:L,personalOrgId:c,orgsLoading:g,orgsError:h,retryOrgs:M,workspaceSelectionReady:_}}function V(s){if(!s)return null;try{return new URL(s).pathname.match(/^\/mcp\/([^/]+)$/)?.[1]?.trim()||null}catch{return null}}export{B as A,q as W,I as a,D as b,V as g,F as s,T as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{am as ge,r as b,bW as Ie,bX as Ke,bY as Ve,bZ as He,j as e,B as C,b_ as Ye,b$ as Ze,c0 as Ge,c1 as De,c2 as Xe,c3 as Le,c4 as Je,c5 as be,aA as ie,c6 as me,c7 as et,c8 as pe,c9 as tt,ca as st,_ as nt,ah as We,Z as it,cb as at,cc as te,U as ot,a6 as Ne,a7 as _e,cd as rt,ce as ct,cf as lt,n as Ce,bu as dt,a8 as de,cg as ut,ch as ke,ci as Se,cj as mt,a9 as pt,ck as Ae,cl as ht}from"./index-GZkujXG1.js";import{P as he,a as ne,A as gt}from"./agent-permissions-matrix-DEYa123T.js";import{C as we,a as ze,b as Oe,c as Pe}from"./card-MXMmjz9G.js";const ue=["auto","approval","deny"],xt={matched_rule:"Matching policy rules apply.",default_approval:"No rule matches; approval is required.",unresolved_principal:"The requesting agent or Automation could not be identified.",parent_approval:"Approval is inherited from the parent action.",unavailable_operation:"This action is unavailable on the connection."},qe={read:"Reads",write:"Writes",destructive:"Destructive writes",non_destructive:"Non-destructive writes",unknown:"Unclassified writes"};function ft(t){return{resource_class:"connector_action",operation_key:t.operation_key,connector_key:t.connector_key??null,connection_id:t.connection_id??null,operation_category:t.operation_category??null}}function L({label:t,value:i,onChange:a,children:r,disabled:m}){return e.jsxs("label",{className:"flex min-w-0 flex-col gap-1 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:t}),e.jsx("select",{"aria-label":t,value:i,onChange:u=>a(u.target.value),disabled:m,className:"h-9 w-full rounded-lg border bg-background px-2 text-foreground",children:r})]})}function Be(t,i){const a=i.connections?.find(r=>r.id===t.connection_id);return t.connection_id?`Connection: ${a?.display_name||a?.connector_key||"Unavailable"} (#${t.connection_id})`:t.connector_key?`Connector: ${i.connectors?.find(r=>r.key===t.connector_key)?.name||t.connector_key}`:"All connectors"}function Qe(t,i){return t.operation_key?i.connector_operations.find(a=>a.operation_key===t.operation_key)?.name||t.operation_key:t.operation_category?qe[t.operation_category]:"All actions"}function $e(t,i){return`${Be(t,i)} · ${Qe(t,i)}`}function se(t){return t.connection_id?`connection:${t.connection_id}`:t.connector_key?`connector:${t.connector_key}`:"all"}function Ee({catalog:t}){return e.jsxs(e.Fragment,{children:[e.jsx("option",{value:"all",children:"All connectors"}),e.jsx("optgroup",{label:"Connectors",children:t.connectors?.map(i=>e.jsx("option",{value:`connector:${i.key}`,children:i.name},i.key))}),e.jsx("optgroup",{label:"Connections",children:t.connections?.map(i=>e.jsxs("option",{value:`connection:${i.id}`,children:[i.display_name||i.connector_key," (#",i.id,")"]},i.id))})]})}const yt={connector_key:null,connection_id:null,operation_key:null,operation_category:null};function Te({label:t,ariaLabel:i,disabled:a,onRemove:r}){const[m,u]=b.useState(!1);return m?e.jsxs("div",{className:"flex gap-1",children:[e.jsx(C,{type:"button",variant:"destructive",size:"sm",disabled:a,"aria-label":"Confirm removal",onClick:async()=>{await r()&&u(!1)},children:"Confirm"}),e.jsx(C,{type:"button",variant:"ghost",size:"sm",disabled:a,onClick:()=>u(!1),children:"Cancel"})]}):e.jsx(C,{type:"button",variant:"ghost",size:"sm",disabled:a,"aria-label":i,onClick:()=>u(!0),children:t})}function vt({owner:t,connector:i,connection:a,agent:r}){const m=ge(),[u,N]=b.useState(r??""),A=Ie(t),o=A.data,l=o?.agents.some(s=>s.id===u)?u:"",n=Ke(t,l),g=l?n:A,[k,B]=b.useState(a?`connection:${a}`:i?`connector:${i}`:"all"),[X,Q]=b.useState(k),[M,O]=b.useState(!1),[T,U]=b.useState(""),[P,K]=b.useState("all"),[F,V]=b.useState("approval"),[d,W]=b.useState(!1),[H,q]=b.useState(null),[Y,ae]=b.useState(a?String(a):""),[R,J]=b.useState(""),E=o?.connections?.some(s=>String(s.id)===Y)?Y:"",w=Ve(t,E?Number(E):void 0,R,l||void 0);async function I(s,v){W(!0),q(null);try{const z=ft(s);let _=s;if(v){const f={...z,effects:{execute:v}};_=l?await Ge(t,l,f):await De(t,f)}else(l?await Xe(t,l,z):await Le(t,z))||q("This rule was already removed. The list has been refreshed.");return await Promise.all(["write-permissions","agent-permissions","available-operations","connector-operations","policy-explanation"].map(f=>m.invalidateQueries({queryKey:[f]}))),_}catch(z){q(z instanceof Error?z.message:"Could not save policy.")}finally{W(!1)}}const y=A.error||g.error;if(y instanceof He&&y.status===403)return e.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"Only organization owners and admins can manage policies."});if(y)return e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:["Could not load policies. ",String(A.error||g.error)]});if(!o||!g.data)return e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading policies…"});const c=g.data,S=s=>s==="all"||o.connectors?.some(v=>`connector:${v.key}`===s)||o.connections?.some(v=>`connection:${v.id}`===s)?s:"all",p=S(k),x=S(X),h=o.connections?.find(s=>`connection:${s.id}`===x),D=h?.connector_key??(x.startsWith("connector:")?x.slice(10):void 0),ee=s=>x==="all"||se(s)==="all"?!0:s.connection_id?h?s.connection_id===h.id:o.connections?.some(v=>v.id===s.connection_id&&v.connector_key===D):s.connector_key===D;function $(s){return l?s.principal_kind==="agent"&&s.principal_id===l:s.principal_kind===null}const Z=p.startsWith("connector:")?p.slice(10):p.startsWith("connection:")?o.connections?.find(s=>s.id===Number(p.slice(11)))?.connector_key:void 0,oe=o.connector_operations.filter(s=>!Z||s.connector_key===Z),re=o.connections?.find(s=>s.id===Number(E))?.connector_key,ce=o.connector_operations.filter(s=>s.connector_key===re),fe=c.agent.filter(s=>s.resource_class==="connector_action"),ye=c.floor.filter(s=>s.resource_class==="connector_action"&&ee(s)),Me={connector_key:p.startsWith("connector:")?p.slice(10):null,connection_id:p.startsWith("connection:")?Number(p.slice(11)):null,operation_key:P==="specific"?T:null,operation_category:P.startsWith("category:")?P.slice(9):null},G=fe.find(s=>$(s)&&se(s)==="all"&&!s.operation_key&&!s.operation_category),ve=fe.filter(s=>s!==G&&ee(s)),je=(s,v=!1)=>{const z=new Map;for(const _ of s){const f=se(_),j=z.get(f);j?j.push(_):z.set(f,[_])}return[...z].sort(([_],[f])=>_==="all"?-1:f==="all"?1:_.localeCompare(f)).map(([_,f])=>e.jsxs("details",{open:_==="all"||_===x,className:"group rounded-lg border",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-3 py-3 text-sm font-medium [&::-webkit-details-marker]:hidden",children:[e.jsx("span",{"aria-hidden":"true",className:"transition-transform group-open:rotate-90",children:"›"}),e.jsx("span",{className:"min-w-0 flex-1 break-words",children:Be(f[0],o)}),e.jsxs("span",{className:"shrink-0 text-xs font-normal text-muted-foreground",children:[f.length," ",f.length===1?"rule":"rules"]})]}),e.jsx("div",{className:"divide-y border-t",children:f.map(j=>{const le=!v&&$(j);return e.jsxs(he,{controls:e.jsxs(e.Fragment,{children:[e.jsx(ne,{options:ue,value:j.effects.execute??"approval",floor:"auto",compact:!0,disabled:d||!le,ariaLabel:`Policy for ${$e(j,o)}`,onChange:Ue=>void I(j,Ue)}),le&&e.jsx(Te,{label:"Remove",disabled:d,ariaLabel:`Remove rule ${j.id}: ${$e(j,o)}`,onRemove:()=>I(j)})]}),children:[e.jsx("p",{className:"text-sm break-words",children:Qe(j,o)}),!le&&e.jsx("p",{className:"text-xs text-muted-foreground",children:j.principal_kind==="agent"&&!j.principal_id?"All agents":"Inherited restriction"})]},j.id)})})]},`${x}:${_}`))};return e.jsxs("div",{className:"space-y-4",children:[(x!==X||l!==u)&&e.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"The requested scope is unavailable. Showing organization rules; install the connector or choose an available scope."}),e.jsxs("div",{className:"space-y-1 text-sm text-muted-foreground",children:[e.jsx("p",{children:"Auto runs immediately. Ask waits for human approval. Block prevents execution and hides the action from agents. Authentication and guardrails still apply."}),e.jsxs("details",{className:"space-y-2",children:[e.jsx("summary",{className:"cursor-pointer text-sm font-medium text-foreground",children:"How rules combine"}),e.jsx("p",{children:"A rule overrides another when it is narrower in target or actions and at least as narrow in the other. When rules are narrower in different ways, or use different categories, the stricter choice wins: Block, then Ask, then Auto. With no matching rule, the result is Ask. Impact categories apply only to writes."}),e.jsx("p",{children:"A connection-wide Auto does not override an organization-wide destructive Block. Add a destructive rule for that connection to make an exception."}),e.jsx("p",{children:"Agents and their Automations can only tighten organization policy. Internal browser steps inherit the parent approval; an explicit browser Block still wins."})]})]}),e.jsxs(L,{label:"Policy owner",value:l,onChange:N,disabled:d,children:[e.jsx("option",{value:"",children:"Organization"}),o.agents.map(s=>e.jsxs("option",{value:s.id,children:["Agent: ",s.name]},s.id))]}),l&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Auto adds no restriction for this agent. It inherits organization policy and cannot bypass Ask or Block."}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:l?"Default restriction":"Default"}),e.jsx("div",{className:"rounded-lg border",children:e.jsxs(he,{controls:e.jsxs(e.Fragment,{children:[e.jsx(ne,{options:ue,value:G?.effects.execute??(l?"auto":"approval"),floor:"auto",compact:!0,disabled:d,ariaLabel:l?"Agent default":"Organization default",onChange:s=>void I(yt,s)}),G&&e.jsx(Te,{label:"Reset default",disabled:d,onRemove:()=>I(G)},G.id)]}),children:[e.jsx("p",{className:"text-sm",children:"All connectors · All actions"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l?"Auto inherits organization policy. Ask or Block adds a restriction.":"Applies when no more specific rule matches."})]})})]}),e.jsx(L,{label:"Show rules for",value:x,onChange:Q,disabled:d,children:e.jsx(Ee,{catalog:o})}),l&&ye.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Inherited organization rules"}),je(ye,!0)]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h3",{className:"text-sm font-medium",children:l?"Agent exceptions":"Exceptions"}),!M&&e.jsx(C,{variant:"outline",size:"sm",disabled:d,onClick:()=>{B(x),V("approval"),K("all"),U(""),O(!0)},children:"Add exception"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[x==="all"?"Expand a group to edit its rules.":"Includes organization-wide and connector-wide rules."," ","Use all actions or a category to cover current and future actions."]}),ve.length?je(ve):e.jsx("p",{className:"text-sm text-muted-foreground",children:l?"No additional rules in this scope. The default restriction and organization policy apply.":"No exceptions in this scope. The default applies."})]}),M&&e.jsxs("form",{className:"space-y-3 border-t pt-4",onSubmit:s=>{s.preventDefault(),!d&&(P!=="specific"||T)&&I(Me,F).then(v=>{v&&(O(!1),Q(se(v)))})},children:[e.jsx("h3",{className:"text-sm font-medium",children:"Add exception"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(L,{label:"Applies to",value:p,onChange:s=>{B(s),K("all"),U("")},disabled:d,children:e.jsx(Ee,{catalog:o})}),e.jsxs(L,{label:"Actions",value:P,onChange:K,disabled:d,children:[e.jsx("option",{value:"all",children:"All actions"}),e.jsx("optgroup",{label:"Categories",children:o.operation_categories?.map(s=>e.jsx("option",{value:`category:${s}`,children:qe[s]},s))}),e.jsx("option",{value:"specific",children:"Specific action"})]})]}),P==="specific"&&e.jsxs(L,{label:"Specific action",value:T,onChange:U,disabled:d,children:[e.jsx("option",{value:"",children:"Choose action"}),oe.map(s=>e.jsxs("option",{value:s.operation_key,children:[s.connector_name,": ",s.name]},s.operation_key))]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx(ne,{options:ue,value:F,floor:"auto",compact:!0,disabled:d,ariaLabel:"New rule decision",onChange:V}),e.jsx(Ye,{onCancel:()=>O(!1),cancelDisabled:d,children:e.jsx(C,{type:"submit",disabled:d||P==="specific"&&!T,children:d?"Saving…":"Save rule"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Saving an existing scope replaces its decision. Removing a rule reveals the next matching rule."})]}),H&&e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:H}),e.jsxs("div",{className:"space-y-3 border-t pt-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Check an action"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs(L,{label:"Check connection",value:E,onChange:s=>{ae(s),J("")},children:[e.jsx("option",{value:"",children:"Choose connection"}),o.connections?.map(s=>e.jsxs("option",{value:String(s.id),children:[s.display_name||s.connector_key," (#",s.id,")"]},s.id))]}),e.jsxs(L,{label:"Check action",value:R,onChange:J,disabled:!E,children:[e.jsx("option",{value:"",children:"Choose action"}),ce.map(s=>e.jsx("option",{value:s.operation_key.slice(s.connector_key.length+2),children:s.name},s.operation_key))]})]}),w.error?e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:["Could not check policy. ",String(w.error)]}):e.jsx("p",{"aria-live":"polite",className:"text-sm",children:R?w.isPending?"Checking…":w.data?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:Ze[w.data.effect]})," ·"," ",xt[w.data.reason]??"The server evaluated this action.",w.data.rule_ids.length>0?` · Rules ${w.data.rule_ids.map(s=>`#${s}`).join(", ")}`:""]}):"":""})]})]})}const jt=[{action:"create_type",label:"Create entity types",description:"Add a new type and its initial fields."},{action:"update_type",label:"Edit entity types",description:"Change fields, write rules, event kinds, or type metadata."},{action:"delete_type",label:"Delete entity types",description:"Remove an entity-type definition."}],bt=[{action:"create_relationship_type",label:"Create relationship types",description:"Add a new kind of link between entity types."},{action:"update_relationship_type",label:"Edit relationship types",description:"Change a definition, or which types it may connect."},{action:"delete_relationship_type",label:"Delete relationship types",description:"Remove a relationship-type definition."}];function xe(t){return t.resource_class==="entity_schema"&&t.principal_kind===null&&t.entity_type_slug===null&&t.operation_key===null&&t.target_agent_id===null}function Nt(t){return t.agent.find(xe)}function _t(t,i){return{...t,agent:[...t.agent.filter(a=>!xe(a)),i]}}function Ct(t){return{...t,agent:t.agent.filter(i=>!xe(i))}}function kt({label:t,description:i,action:a,value:r,pending:m,onChange:u}){return e.jsxs(he,{controls:e.jsx(ne,{options:st("entity_schema",a),value:r,floor:"auto",disabled:m,compact:!0,ariaLabel:t,onChange:u}),children:[e.jsx("p",{children:t}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:i})]})}function Fe({title:t,actions:i,effects:a,pending:r,onChange:m}){return e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:t}),e.jsx("div",{className:"divide-y overflow-hidden rounded-lg border",children:i.map(({action:u,label:N,description:A})=>e.jsx(kt,{action:u,label:N,description:A,value:a[u]??pe.entity_schema[u]??"deny",pending:r,onChange:o=>m(u,o)},u))})]})}function St({owner:t}){const i=ge(),a=Je(t),r=Ie(t),m=be({mutationFn:n=>De(t,{resource_class:"entity_schema",effects:n}),onSuccess:n=>{i.setQueryData(a,g=>g&&_t(g,n)),i.invalidateQueries({queryKey:a})},onError:n=>{ie.error(n instanceof Error?n.message:"Failed to save schema policy")}}),u=be({mutationFn:()=>Le(t,{resource_class:"entity_schema"}),onSuccess:()=>{i.setQueryData(a,n=>n&&Ct(n)),i.invalidateQueries({queryKey:a})},onError:n=>{ie.error(n instanceof Error?n.message:"Failed to reset schema policy")}});if(r.isLoading)return e.jsx(me,{label:"schema policy",variant:"cards",cards:1});if(r.isError||!r.data)return e.jsx(et,{label:"schema policy"});const N=Nt(r.data),A=N?.effects??pe.entity_schema,o=m.isPending||u.isPending,l=(n,g)=>{m.mutate({...N?.effects??pe.entity_schema,[n]:g})};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:N?"Custom policy":"Workspace defaults"}),N?e.jsxs(C,{type:"button",variant:"outline",size:"sm",disabled:o,onClick:()=>u.mutate(),children:[e.jsx(tt,{className:"mr-1.5 h-3.5 w-3.5"}),"Remove custom policy"]}):null]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(Fe,{title:"Entity types",actions:jt,effects:A,pending:o,onChange:l}),e.jsx(Fe,{title:"Relationship types",actions:bt,effects:A,pending:o,onChange:l})]})]})}function Re(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function At(t,i,a){const r=t.split("/");return r[1]===i?(r[1]=a,r.join("/")||"/"):`/${a}`}function wt({owner:t,connector:i,connection:a,agent:r}){const m=nt(),u=ge(),{data:N,error:A}=We(),{activeOrg:o,urlOrgSlug:l}=it(),n=(N??[]).find(c=>c.slug===t&&c.is_member)??null,g=n?.id??t,k=at(g,{name:n?.name??"",slug:n?.slug??"",visibility:n?.visibility??"private"}),[B,X]=k.field("name"),[Q,M]=k.field("slug"),[O,T]=k.field("visibility"),[U,P]=te(g,!!n),[K,F]=te(g,!1),[V,d]=te(g,null),[W,H]=b.useState(!1),[q,Y]=b.useState(!1),[ae,R]=te(g,!1);if(ot(A)&&N===void 0)return e.jsxs(we,{role:"alert",children:[e.jsx(ze,{children:e.jsx(Oe,{children:"Couldn't load organizations"})}),e.jsx(Pe,{children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Please try again in a moment."})})]});if(N===void 0)return e.jsxs("div",{className:"max-w-2xl space-y-6",children:[e.jsx(me,{label:"organization",variant:"cards",cards:1}),e.jsx(me,{label:"visibility",variant:"panel"})]});if(!n)return e.jsxs(we,{children:[e.jsx(ze,{children:e.jsx(Oe,{children:"Organization not found"})}),e.jsx(Pe,{children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["You aren't a member of an organization at"," ",e.jsx("span",{className:"font-mono",children:t}),", or it has been deleted."]})})]});const J=c=>{const S=pt(c);if(S.kind==="cross-host"){window.location.assign(S.href);return}m({to:S.to})},E=c=>{if(c==="public"&&n.visibility!=="public"){F(!0);return}T(c),F(!1)},w=async()=>{if(!k.canSubmit)return;const c=B.trim();if(!c){d("Name is required");return}const S=Q.trim()||Re(c);if(!S){d("Slug is required");return}H(!0),d(null);try{const p=c!==n.name||S!==n.slug,x=O!==n.visibility;let h=n.slug;if(p){const $=await de.update({organizationId:n.id,data:{name:c,slug:S}});if($.error){d($.error.message||"Failed to update organization");return}h=$.data?.slug??S}x&&(h=(await ut(h,O)).slug),(p||x)&&(k.accept(k.values,{name:c,slug:h,visibility:O}),await u.invalidateQueries({queryKey:["organizations"]}),ie.success("Organization updated"));const D=o?.id===n.id||l===n.slug,ee=h!==n.slug;if(D&&ee){const $=ke(),Z=Se();if($===n.slug&&Z){const re=mt(window.location.pathname,n.slug)||"/",ce=`${window.location.protocol}//${h}.${Z}${re}${window.location.search}${window.location.hash}`;window.location.assign(ce);return}const oe=At(window.location.pathname,n.slug,h);m({to:`${oe}${window.location.search}${window.location.hash}`});return}}catch(p){d(p instanceof Error?p.message:"Failed to update organization")}finally{H(!1)}},I=async()=>{Y(!0),d(null);try{const c=await de.delete({organizationId:n.id});if(c.error){d(c.error.message||"Failed to delete organization");return}await u.invalidateQueries({queryKey:["organizations"]}),ie.success("Organization deleted");const p=(N??[]).filter(h=>h.is_member).find(h=>h.id!==n.id)??null,x=o?.id===n.id||l===n.slug;if(x&&p){await de.setActive({organizationId:p.id}),J(p.slug);return}if(x){const h=ke(),D=Se();if(h===n.slug&&D){window.location.assign(`${window.location.protocol}//app.${D}/`);return}m({to:"/"});return}m({to:"/"})}catch(c){d(c instanceof Error?c.message:"Failed to delete organization")}finally{Y(!1),R(!1)}},y=W||q;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"space-y-4",children:[e.jsx("h2",{className:"text-base font-semibold leading-none",children:"Identity"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ne,{htmlFor:"org-name",children:"Name"}),e.jsx(_e,{id:"org-name",value:B,onChange:c=>{X(c.target.value),U||M(Re(c.target.value))},placeholder:"e.g. My Team",disabled:y})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ne,{htmlFor:"org-slug",children:"Slug"}),e.jsx(_e,{id:"org-slug",value:Q,onChange:c=>{P(!0),M(c.target.value)},placeholder:"e.g. my-team",disabled:y}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Changing the slug rewrites this workspace's URL. Existing links to"," ",e.jsxs("span",{className:"font-mono",children:["/",n.slug]})," redirect for a grace period."]})]})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold leading-none",children:"Workspace visibility"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Choose who can browse this workspace and its public pages."})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[e.jsxs("button",{type:"button",onClick:()=>E("private"),disabled:y,className:`flex items-start gap-3 rounded-lg border p-3 text-left transition-colors ${O==="private"?"border-primary bg-primary/5":"border-border hover:bg-muted/40"}`,children:[e.jsx(rt,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Private"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Only members can access this workspace."})]})]}),e.jsxs("button",{type:"button",onClick:()=>E("public"),disabled:y,className:`flex items-start gap-3 rounded-lg border p-3 text-left transition-colors ${O==="public"?"border-primary bg-primary/5":"border-border hover:bg-muted/40"}`,children:[e.jsx(ct,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Public"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Anyone can browse public pages for this workspace."})]})]})]}),K&&e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm",children:[e.jsx("p",{className:"text-foreground",children:"Make this workspace public? Catalog-style content may become visible outside the membership."}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(C,{type:"button",size:"sm",onClick:()=>{T("public"),F(!1)},disabled:y,children:"Confirm public"}),e.jsx(C,{type:"button",size:"sm",variant:"ghost",onClick:()=>F(!1),disabled:y,children:"Cancel"})]})]})]}),V&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:V}),e.jsx(lt,{visible:k.hasConflict,onReload:k.reset}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(C,{variant:"outline",onClick:()=>void m({to:`/${t}`}),disabled:y,children:"Cancel"}),e.jsxs(C,{onClick:w,disabled:y||!k.canSubmit,children:[W?e.jsx(Ce,{size:"lg",className:"mr-1.5"}):null,W?"Saving...":"Save changes"]})]}),e.jsxs("section",{id:"policies",className:"scroll-mt-6 space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Policies"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Control connector actions across the organization. Changes to existing rules save automatically."})]}),e.jsx(vt,{owner:t,connector:i,connection:a,agent:r},`${t}:${r??""}:${i??""}:${a??""}`)]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Agent write defaults"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Set the defaults agents inherit for entities and agents. Changes save automatically; agents can only tighten them."})]}),e.jsx(gt,{owner:t,variant:"org-floor"})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Schema governance"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Control structural changes by agents and connected AI clients. Changes save automatically."})]}),e.jsx(St,{owner:t})]}),e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4",children:[e.jsx("p",{className:"text-sm font-medium",children:n.is_personal?"Personal workspace":"Delete this organization"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n.is_personal?"Your personal workspace can't be deleted — your devices and personal connections are bound to it.":"Permanently removes the organization and all members' workspace access. This cannot be undone."}),!n.is_personal&&e.jsx("div",{className:"mt-3",children:ae?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(C,{variant:"destructive",size:"sm",onClick:I,disabled:y,children:[q?e.jsx(Ce,{className:"mr-1.5"}):null,"Confirm delete"]}),e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>R(!1),disabled:y,children:"Cancel"})]}):e.jsxs(C,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>R(!0),disabled:y,children:[e.jsx(dt,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete organization"]})})]})]})}function $t(){const{owner:t}=Ae.useParams(),i=Ae.useSearch(),{data:a}=We(),r=(a??[]).find(m=>m.slug===t&&m.is_member)?.name;return e.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-1 flex-col gap-6 px-4 py-6 lg:px-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ht,{className:"h-7 w-7"}),e.jsx("h1",{className:"text-3xl font-semibold leading-tight",children:"Organization settings"})]}),r?e.jsx("p",{className:"text-base font-medium text-foreground",children:r}):null]}),e.jsx(wt,{owner:t,...i})]})}export{$t as component};
|
|
1
|
+
import{am as ge,r as b,bW as Ie,bX as Ke,bY as Ve,bZ as He,j as e,B as C,b_ as Ye,b$ as Ze,c0 as Ge,c1 as De,c2 as Xe,c3 as Le,c4 as Je,c5 as be,aA as ie,c6 as me,c7 as et,c8 as pe,c9 as tt,ca as st,_ as nt,ah as We,Z as it,cb as at,cc as te,U as ot,a6 as Ne,a7 as _e,cd as rt,ce as ct,cf as lt,n as Ce,bu as dt,a8 as de,cg as ut,ch as ke,ci as Se,cj as mt,a9 as pt,ck as Ae,cl as ht}from"./index-B2AmRqYh.js";import{P as he,a as ne,A as gt}from"./agent-permissions-matrix-B9Ho3P1t.js";import{C as we,a as ze,b as Oe,c as Pe}from"./card-CMmh2mzo.js";const ue=["auto","approval","deny"],xt={matched_rule:"Matching policy rules apply.",default_approval:"No rule matches; approval is required.",unresolved_principal:"The requesting agent or Automation could not be identified.",parent_approval:"Approval is inherited from the parent action.",unavailable_operation:"This action is unavailable on the connection."},qe={read:"Reads",write:"Writes",destructive:"Destructive writes",non_destructive:"Non-destructive writes",unknown:"Unclassified writes"};function ft(t){return{resource_class:"connector_action",operation_key:t.operation_key,connector_key:t.connector_key??null,connection_id:t.connection_id??null,operation_category:t.operation_category??null}}function L({label:t,value:i,onChange:a,children:r,disabled:m}){return e.jsxs("label",{className:"flex min-w-0 flex-col gap-1 text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:t}),e.jsx("select",{"aria-label":t,value:i,onChange:u=>a(u.target.value),disabled:m,className:"h-9 w-full rounded-lg border bg-background px-2 text-foreground",children:r})]})}function Be(t,i){const a=i.connections?.find(r=>r.id===t.connection_id);return t.connection_id?`Connection: ${a?.display_name||a?.connector_key||"Unavailable"} (#${t.connection_id})`:t.connector_key?`Connector: ${i.connectors?.find(r=>r.key===t.connector_key)?.name||t.connector_key}`:"All connectors"}function Qe(t,i){return t.operation_key?i.connector_operations.find(a=>a.operation_key===t.operation_key)?.name||t.operation_key:t.operation_category?qe[t.operation_category]:"All actions"}function $e(t,i){return`${Be(t,i)} · ${Qe(t,i)}`}function se(t){return t.connection_id?`connection:${t.connection_id}`:t.connector_key?`connector:${t.connector_key}`:"all"}function Ee({catalog:t}){return e.jsxs(e.Fragment,{children:[e.jsx("option",{value:"all",children:"All connectors"}),e.jsx("optgroup",{label:"Connectors",children:t.connectors?.map(i=>e.jsx("option",{value:`connector:${i.key}`,children:i.name},i.key))}),e.jsx("optgroup",{label:"Connections",children:t.connections?.map(i=>e.jsxs("option",{value:`connection:${i.id}`,children:[i.display_name||i.connector_key," (#",i.id,")"]},i.id))})]})}const yt={connector_key:null,connection_id:null,operation_key:null,operation_category:null};function Te({label:t,ariaLabel:i,disabled:a,onRemove:r}){const[m,u]=b.useState(!1);return m?e.jsxs("div",{className:"flex gap-1",children:[e.jsx(C,{type:"button",variant:"destructive",size:"sm",disabled:a,"aria-label":"Confirm removal",onClick:async()=>{await r()&&u(!1)},children:"Confirm"}),e.jsx(C,{type:"button",variant:"ghost",size:"sm",disabled:a,onClick:()=>u(!1),children:"Cancel"})]}):e.jsx(C,{type:"button",variant:"ghost",size:"sm",disabled:a,"aria-label":i,onClick:()=>u(!0),children:t})}function vt({owner:t,connector:i,connection:a,agent:r}){const m=ge(),[u,N]=b.useState(r??""),A=Ie(t),o=A.data,l=o?.agents.some(s=>s.id===u)?u:"",n=Ke(t,l),g=l?n:A,[k,B]=b.useState(a?`connection:${a}`:i?`connector:${i}`:"all"),[X,Q]=b.useState(k),[M,O]=b.useState(!1),[T,U]=b.useState(""),[P,K]=b.useState("all"),[F,V]=b.useState("approval"),[d,W]=b.useState(!1),[H,q]=b.useState(null),[Y,ae]=b.useState(a?String(a):""),[R,J]=b.useState(""),E=o?.connections?.some(s=>String(s.id)===Y)?Y:"",w=Ve(t,E?Number(E):void 0,R,l||void 0);async function I(s,v){W(!0),q(null);try{const z=ft(s);let _=s;if(v){const f={...z,effects:{execute:v}};_=l?await Ge(t,l,f):await De(t,f)}else(l?await Xe(t,l,z):await Le(t,z))||q("This rule was already removed. The list has been refreshed.");return await Promise.all(["write-permissions","agent-permissions","available-operations","connector-operations","policy-explanation"].map(f=>m.invalidateQueries({queryKey:[f]}))),_}catch(z){q(z instanceof Error?z.message:"Could not save policy.")}finally{W(!1)}}const y=A.error||g.error;if(y instanceof He&&y.status===403)return e.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"Only organization owners and admins can manage policies."});if(y)return e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:["Could not load policies. ",String(A.error||g.error)]});if(!o||!g.data)return e.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading policies…"});const c=g.data,S=s=>s==="all"||o.connectors?.some(v=>`connector:${v.key}`===s)||o.connections?.some(v=>`connection:${v.id}`===s)?s:"all",p=S(k),x=S(X),h=o.connections?.find(s=>`connection:${s.id}`===x),D=h?.connector_key??(x.startsWith("connector:")?x.slice(10):void 0),ee=s=>x==="all"||se(s)==="all"?!0:s.connection_id?h?s.connection_id===h.id:o.connections?.some(v=>v.id===s.connection_id&&v.connector_key===D):s.connector_key===D;function $(s){return l?s.principal_kind==="agent"&&s.principal_id===l:s.principal_kind===null}const Z=p.startsWith("connector:")?p.slice(10):p.startsWith("connection:")?o.connections?.find(s=>s.id===Number(p.slice(11)))?.connector_key:void 0,oe=o.connector_operations.filter(s=>!Z||s.connector_key===Z),re=o.connections?.find(s=>s.id===Number(E))?.connector_key,ce=o.connector_operations.filter(s=>s.connector_key===re),fe=c.agent.filter(s=>s.resource_class==="connector_action"),ye=c.floor.filter(s=>s.resource_class==="connector_action"&&ee(s)),Me={connector_key:p.startsWith("connector:")?p.slice(10):null,connection_id:p.startsWith("connection:")?Number(p.slice(11)):null,operation_key:P==="specific"?T:null,operation_category:P.startsWith("category:")?P.slice(9):null},G=fe.find(s=>$(s)&&se(s)==="all"&&!s.operation_key&&!s.operation_category),ve=fe.filter(s=>s!==G&&ee(s)),je=(s,v=!1)=>{const z=new Map;for(const _ of s){const f=se(_),j=z.get(f);j?j.push(_):z.set(f,[_])}return[...z].sort(([_],[f])=>_==="all"?-1:f==="all"?1:_.localeCompare(f)).map(([_,f])=>e.jsxs("details",{open:_==="all"||_===x,className:"group rounded-lg border",children:[e.jsxs("summary",{className:"flex cursor-pointer list-none items-center gap-2 px-3 py-3 text-sm font-medium [&::-webkit-details-marker]:hidden",children:[e.jsx("span",{"aria-hidden":"true",className:"transition-transform group-open:rotate-90",children:"›"}),e.jsx("span",{className:"min-w-0 flex-1 break-words",children:Be(f[0],o)}),e.jsxs("span",{className:"shrink-0 text-xs font-normal text-muted-foreground",children:[f.length," ",f.length===1?"rule":"rules"]})]}),e.jsx("div",{className:"divide-y border-t",children:f.map(j=>{const le=!v&&$(j);return e.jsxs(he,{controls:e.jsxs(e.Fragment,{children:[e.jsx(ne,{options:ue,value:j.effects.execute??"approval",floor:"auto",compact:!0,disabled:d||!le,ariaLabel:`Policy for ${$e(j,o)}`,onChange:Ue=>void I(j,Ue)}),le&&e.jsx(Te,{label:"Remove",disabled:d,ariaLabel:`Remove rule ${j.id}: ${$e(j,o)}`,onRemove:()=>I(j)})]}),children:[e.jsx("p",{className:"text-sm break-words",children:Qe(j,o)}),!le&&e.jsx("p",{className:"text-xs text-muted-foreground",children:j.principal_kind==="agent"&&!j.principal_id?"All agents":"Inherited restriction"})]},j.id)})})]},`${x}:${_}`))};return e.jsxs("div",{className:"space-y-4",children:[(x!==X||l!==u)&&e.jsx("p",{role:"status",className:"text-sm text-muted-foreground",children:"The requested scope is unavailable. Showing organization rules; install the connector or choose an available scope."}),e.jsxs("div",{className:"space-y-1 text-sm text-muted-foreground",children:[e.jsx("p",{children:"Auto runs immediately. Ask waits for human approval. Block prevents execution and hides the action from agents. Authentication and guardrails still apply."}),e.jsxs("details",{className:"space-y-2",children:[e.jsx("summary",{className:"cursor-pointer text-sm font-medium text-foreground",children:"How rules combine"}),e.jsx("p",{children:"A rule overrides another when it is narrower in target or actions and at least as narrow in the other. When rules are narrower in different ways, or use different categories, the stricter choice wins: Block, then Ask, then Auto. With no matching rule, the result is Ask. Impact categories apply only to writes."}),e.jsx("p",{children:"A connection-wide Auto does not override an organization-wide destructive Block. Add a destructive rule for that connection to make an exception."}),e.jsx("p",{children:"Agents and their Automations can only tighten organization policy. Internal browser steps inherit the parent approval; an explicit browser Block still wins."})]})]}),e.jsxs(L,{label:"Policy owner",value:l,onChange:N,disabled:d,children:[e.jsx("option",{value:"",children:"Organization"}),o.agents.map(s=>e.jsxs("option",{value:s.id,children:["Agent: ",s.name]},s.id))]}),l&&e.jsx("p",{className:"text-sm text-muted-foreground",children:"Auto adds no restriction for this agent. It inherits organization policy and cannot bypass Ask or Block."}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:l?"Default restriction":"Default"}),e.jsx("div",{className:"rounded-lg border",children:e.jsxs(he,{controls:e.jsxs(e.Fragment,{children:[e.jsx(ne,{options:ue,value:G?.effects.execute??(l?"auto":"approval"),floor:"auto",compact:!0,disabled:d,ariaLabel:l?"Agent default":"Organization default",onChange:s=>void I(yt,s)}),G&&e.jsx(Te,{label:"Reset default",disabled:d,onRemove:()=>I(G)},G.id)]}),children:[e.jsx("p",{className:"text-sm",children:"All connectors · All actions"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:l?"Auto inherits organization policy. Ask or Block adds a restriction.":"Applies when no more specific rule matches."})]})})]}),e.jsx(L,{label:"Show rules for",value:x,onChange:Q,disabled:d,children:e.jsx(Ee,{catalog:o})}),l&&ye.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Inherited organization rules"}),je(ye,!0)]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("h3",{className:"text-sm font-medium",children:l?"Agent exceptions":"Exceptions"}),!M&&e.jsx(C,{variant:"outline",size:"sm",disabled:d,onClick:()=>{B(x),V("approval"),K("all"),U(""),O(!0)},children:"Add exception"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[x==="all"?"Expand a group to edit its rules.":"Includes organization-wide and connector-wide rules."," ","Use all actions or a category to cover current and future actions."]}),ve.length?je(ve):e.jsx("p",{className:"text-sm text-muted-foreground",children:l?"No additional rules in this scope. The default restriction and organization policy apply.":"No exceptions in this scope. The default applies."})]}),M&&e.jsxs("form",{className:"space-y-3 border-t pt-4",onSubmit:s=>{s.preventDefault(),!d&&(P!=="specific"||T)&&I(Me,F).then(v=>{v&&(O(!1),Q(se(v)))})},children:[e.jsx("h3",{className:"text-sm font-medium",children:"Add exception"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsx(L,{label:"Applies to",value:p,onChange:s=>{B(s),K("all"),U("")},disabled:d,children:e.jsx(Ee,{catalog:o})}),e.jsxs(L,{label:"Actions",value:P,onChange:K,disabled:d,children:[e.jsx("option",{value:"all",children:"All actions"}),e.jsx("optgroup",{label:"Categories",children:o.operation_categories?.map(s=>e.jsx("option",{value:`category:${s}`,children:qe[s]},s))}),e.jsx("option",{value:"specific",children:"Specific action"})]})]}),P==="specific"&&e.jsxs(L,{label:"Specific action",value:T,onChange:U,disabled:d,children:[e.jsx("option",{value:"",children:"Choose action"}),oe.map(s=>e.jsxs("option",{value:s.operation_key,children:[s.connector_name,": ",s.name]},s.operation_key))]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx(ne,{options:ue,value:F,floor:"auto",compact:!0,disabled:d,ariaLabel:"New rule decision",onChange:V}),e.jsx(Ye,{onCancel:()=>O(!1),cancelDisabled:d,children:e.jsx(C,{type:"submit",disabled:d||P==="specific"&&!T,children:d?"Saving…":"Save rule"})})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Saving an existing scope replaces its decision. Removing a rule reveals the next matching rule."})]}),H&&e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:H}),e.jsxs("div",{className:"space-y-3 border-t pt-4",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Check an action"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs(L,{label:"Check connection",value:E,onChange:s=>{ae(s),J("")},children:[e.jsx("option",{value:"",children:"Choose connection"}),o.connections?.map(s=>e.jsxs("option",{value:String(s.id),children:[s.display_name||s.connector_key," (#",s.id,")"]},s.id))]}),e.jsxs(L,{label:"Check action",value:R,onChange:J,disabled:!E,children:[e.jsx("option",{value:"",children:"Choose action"}),ce.map(s=>e.jsx("option",{value:s.operation_key.slice(s.connector_key.length+2),children:s.name},s.operation_key))]})]}),w.error?e.jsxs("p",{role:"alert",className:"text-sm text-destructive",children:["Could not check policy. ",String(w.error)]}):e.jsx("p",{"aria-live":"polite",className:"text-sm",children:R?w.isPending?"Checking…":w.data?e.jsxs(e.Fragment,{children:[e.jsx("strong",{children:Ze[w.data.effect]})," ·"," ",xt[w.data.reason]??"The server evaluated this action.",w.data.rule_ids.length>0?` · Rules ${w.data.rule_ids.map(s=>`#${s}`).join(", ")}`:""]}):"":""})]})]})}const jt=[{action:"create_type",label:"Create entity types",description:"Add a new type and its initial fields."},{action:"update_type",label:"Edit entity types",description:"Change fields, write rules, event kinds, or type metadata."},{action:"delete_type",label:"Delete entity types",description:"Remove an entity-type definition."}],bt=[{action:"create_relationship_type",label:"Create relationship types",description:"Add a new kind of link between entity types."},{action:"update_relationship_type",label:"Edit relationship types",description:"Change a definition, or which types it may connect."},{action:"delete_relationship_type",label:"Delete relationship types",description:"Remove a relationship-type definition."}];function xe(t){return t.resource_class==="entity_schema"&&t.principal_kind===null&&t.entity_type_slug===null&&t.operation_key===null&&t.target_agent_id===null}function Nt(t){return t.agent.find(xe)}function _t(t,i){return{...t,agent:[...t.agent.filter(a=>!xe(a)),i]}}function Ct(t){return{...t,agent:t.agent.filter(i=>!xe(i))}}function kt({label:t,description:i,action:a,value:r,pending:m,onChange:u}){return e.jsxs(he,{controls:e.jsx(ne,{options:st("entity_schema",a),value:r,floor:"auto",disabled:m,compact:!0,ariaLabel:t,onChange:u}),children:[e.jsx("p",{children:t}),e.jsx("p",{className:"text-xs leading-5 text-muted-foreground",children:i})]})}function Fe({title:t,actions:i,effects:a,pending:r,onChange:m}){return e.jsxs("section",{className:"space-y-2",children:[e.jsx("h3",{className:"text-sm font-medium",children:t}),e.jsx("div",{className:"divide-y overflow-hidden rounded-lg border",children:i.map(({action:u,label:N,description:A})=>e.jsx(kt,{action:u,label:N,description:A,value:a[u]??pe.entity_schema[u]??"deny",pending:r,onChange:o=>m(u,o)},u))})]})}function St({owner:t}){const i=ge(),a=Je(t),r=Ie(t),m=be({mutationFn:n=>De(t,{resource_class:"entity_schema",effects:n}),onSuccess:n=>{i.setQueryData(a,g=>g&&_t(g,n)),i.invalidateQueries({queryKey:a})},onError:n=>{ie.error(n instanceof Error?n.message:"Failed to save schema policy")}}),u=be({mutationFn:()=>Le(t,{resource_class:"entity_schema"}),onSuccess:()=>{i.setQueryData(a,n=>n&&Ct(n)),i.invalidateQueries({queryKey:a})},onError:n=>{ie.error(n instanceof Error?n.message:"Failed to reset schema policy")}});if(r.isLoading)return e.jsx(me,{label:"schema policy",variant:"cards",cards:1});if(r.isError||!r.data)return e.jsx(et,{label:"schema policy"});const N=Nt(r.data),A=N?.effects??pe.entity_schema,o=m.isPending||u.isPending,l=(n,g)=>{m.mutate({...N?.effects??pe.entity_schema,[n]:g})};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:N?"Custom policy":"Workspace defaults"}),N?e.jsxs(C,{type:"button",variant:"outline",size:"sm",disabled:o,onClick:()=>u.mutate(),children:[e.jsx(tt,{className:"mr-1.5 h-3.5 w-3.5"}),"Remove custom policy"]}):null]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(Fe,{title:"Entity types",actions:jt,effects:A,pending:o,onChange:l}),e.jsx(Fe,{title:"Relationship types",actions:bt,effects:A,pending:o,onChange:l})]})]})}function Re(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function At(t,i,a){const r=t.split("/");return r[1]===i?(r[1]=a,r.join("/")||"/"):`/${a}`}function wt({owner:t,connector:i,connection:a,agent:r}){const m=nt(),u=ge(),{data:N,error:A}=We(),{activeOrg:o,urlOrgSlug:l}=it(),n=(N??[]).find(c=>c.slug===t&&c.is_member)??null,g=n?.id??t,k=at(g,{name:n?.name??"",slug:n?.slug??"",visibility:n?.visibility??"private"}),[B,X]=k.field("name"),[Q,M]=k.field("slug"),[O,T]=k.field("visibility"),[U,P]=te(g,!!n),[K,F]=te(g,!1),[V,d]=te(g,null),[W,H]=b.useState(!1),[q,Y]=b.useState(!1),[ae,R]=te(g,!1);if(ot(A)&&N===void 0)return e.jsxs(we,{role:"alert",children:[e.jsx(ze,{children:e.jsx(Oe,{children:"Couldn't load organizations"})}),e.jsx(Pe,{children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Please try again in a moment."})})]});if(N===void 0)return e.jsxs("div",{className:"max-w-2xl space-y-6",children:[e.jsx(me,{label:"organization",variant:"cards",cards:1}),e.jsx(me,{label:"visibility",variant:"panel"})]});if(!n)return e.jsxs(we,{children:[e.jsx(ze,{children:e.jsx(Oe,{children:"Organization not found"})}),e.jsx(Pe,{children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["You aren't a member of an organization at"," ",e.jsx("span",{className:"font-mono",children:t}),", or it has been deleted."]})})]});const J=c=>{const S=pt(c);if(S.kind==="cross-host"){window.location.assign(S.href);return}m({to:S.to})},E=c=>{if(c==="public"&&n.visibility!=="public"){F(!0);return}T(c),F(!1)},w=async()=>{if(!k.canSubmit)return;const c=B.trim();if(!c){d("Name is required");return}const S=Q.trim()||Re(c);if(!S){d("Slug is required");return}H(!0),d(null);try{const p=c!==n.name||S!==n.slug,x=O!==n.visibility;let h=n.slug;if(p){const $=await de.update({organizationId:n.id,data:{name:c,slug:S}});if($.error){d($.error.message||"Failed to update organization");return}h=$.data?.slug??S}x&&(h=(await ut(h,O)).slug),(p||x)&&(k.accept(k.values,{name:c,slug:h,visibility:O}),await u.invalidateQueries({queryKey:["organizations"]}),ie.success("Organization updated"));const D=o?.id===n.id||l===n.slug,ee=h!==n.slug;if(D&&ee){const $=ke(),Z=Se();if($===n.slug&&Z){const re=mt(window.location.pathname,n.slug)||"/",ce=`${window.location.protocol}//${h}.${Z}${re}${window.location.search}${window.location.hash}`;window.location.assign(ce);return}const oe=At(window.location.pathname,n.slug,h);m({to:`${oe}${window.location.search}${window.location.hash}`});return}}catch(p){d(p instanceof Error?p.message:"Failed to update organization")}finally{H(!1)}},I=async()=>{Y(!0),d(null);try{const c=await de.delete({organizationId:n.id});if(c.error){d(c.error.message||"Failed to delete organization");return}await u.invalidateQueries({queryKey:["organizations"]}),ie.success("Organization deleted");const p=(N??[]).filter(h=>h.is_member).find(h=>h.id!==n.id)??null,x=o?.id===n.id||l===n.slug;if(x&&p){await de.setActive({organizationId:p.id}),J(p.slug);return}if(x){const h=ke(),D=Se();if(h===n.slug&&D){window.location.assign(`${window.location.protocol}//app.${D}/`);return}m({to:"/"});return}m({to:"/"})}catch(c){d(c instanceof Error?c.message:"Failed to delete organization")}finally{Y(!1),R(!1)}},y=W||q;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("section",{className:"space-y-4",children:[e.jsx("h2",{className:"text-base font-semibold leading-none",children:"Identity"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ne,{htmlFor:"org-name",children:"Name"}),e.jsx(_e,{id:"org-name",value:B,onChange:c=>{X(c.target.value),U||M(Re(c.target.value))},placeholder:"e.g. My Team",disabled:y})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(Ne,{htmlFor:"org-slug",children:"Slug"}),e.jsx(_e,{id:"org-slug",value:Q,onChange:c=>{P(!0),M(c.target.value)},placeholder:"e.g. my-team",disabled:y}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Changing the slug rewrites this workspace's URL. Existing links to"," ",e.jsxs("span",{className:"font-mono",children:["/",n.slug]})," redirect for a grace period."]})]})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold leading-none",children:"Workspace visibility"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Choose who can browse this workspace and its public pages."})]}),e.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[e.jsxs("button",{type:"button",onClick:()=>E("private"),disabled:y,className:`flex items-start gap-3 rounded-lg border p-3 text-left transition-colors ${O==="private"?"border-primary bg-primary/5":"border-border hover:bg-muted/40"}`,children:[e.jsx(rt,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Private"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Only members can access this workspace."})]})]}),e.jsxs("button",{type:"button",onClick:()=>E("public"),disabled:y,className:`flex items-start gap-3 rounded-lg border p-3 text-left transition-colors ${O==="public"?"border-primary bg-primary/5":"border-border hover:bg-muted/40"}`,children:[e.jsx(ct,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium",children:"Public"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Anyone can browse public pages for this workspace."})]})]})]}),K&&e.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm",children:[e.jsx("p",{className:"text-foreground",children:"Make this workspace public? Catalog-style content may become visible outside the membership."}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(C,{type:"button",size:"sm",onClick:()=>{T("public"),F(!1)},disabled:y,children:"Confirm public"}),e.jsx(C,{type:"button",size:"sm",variant:"ghost",onClick:()=>F(!1),disabled:y,children:"Cancel"})]})]})]}),V&&e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:V}),e.jsx(lt,{visible:k.hasConflict,onReload:k.reset}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(C,{variant:"outline",onClick:()=>void m({to:`/${t}`}),disabled:y,children:"Cancel"}),e.jsxs(C,{onClick:w,disabled:y||!k.canSubmit,children:[W?e.jsx(Ce,{size:"lg",className:"mr-1.5"}):null,W?"Saving...":"Save changes"]})]}),e.jsxs("section",{id:"policies",className:"scroll-mt-6 space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Policies"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Control connector actions across the organization. Changes to existing rules save automatically."})]}),e.jsx(vt,{owner:t,connector:i,connection:a,agent:r},`${t}:${r??""}:${i??""}:${a??""}`)]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Agent write defaults"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Set the defaults agents inherit for entities and agents. Changes save automatically; agents can only tighten them."})]}),e.jsx(gt,{owner:t,variant:"org-floor"})]}),e.jsxs("section",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h2",{className:"text-sm font-medium",children:"Schema governance"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Control structural changes by agents and connected AI clients. Changes save automatically."})]}),e.jsx(St,{owner:t})]}),e.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4",children:[e.jsx("p",{className:"text-sm font-medium",children:n.is_personal?"Personal workspace":"Delete this organization"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:n.is_personal?"Your personal workspace can't be deleted — your devices and personal connections are bound to it.":"Permanently removes the organization and all members' workspace access. This cannot be undone."}),!n.is_personal&&e.jsx("div",{className:"mt-3",children:ae?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(C,{variant:"destructive",size:"sm",onClick:I,disabled:y,children:[q?e.jsx(Ce,{className:"mr-1.5"}):null,"Confirm delete"]}),e.jsx(C,{variant:"ghost",size:"sm",onClick:()=>R(!1),disabled:y,children:"Cancel"})]}):e.jsxs(C,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>R(!0),disabled:y,children:[e.jsx(dt,{className:"mr-1.5 h-3.5 w-3.5"}),"Delete organization"]})})]})]})}function $t(){const{owner:t}=Ae.useParams(),i=Ae.useSearch(),{data:a}=We(),r=(a??[]).find(m=>m.slug===t&&m.is_member)?.name;return e.jsxs("div",{className:"mx-auto flex w-full max-w-4xl flex-1 flex-col gap-6 px-4 py-6 lg:px-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ht,{className:"h-7 w-7"}),e.jsx("h1",{className:"text-3xl font-semibold leading-tight",children:"Organization settings"})]}),r?e.jsx("p",{className:"text-base font-medium text-foreground",children:r}):null]}),e.jsx(wt,{owner:t,...i})]})}export{$t as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Z as i,fL as r,j as e,i5 as m}from"./index-
|
|
1
|
+
import{Z as i,fL as r,j as e,i5 as m}from"./index-B2AmRqYh.js";import{A as c}from"./agent-permissions-matrix-B9Ho3P1t.js";import{A as l}from"./agent-subpage-shell-Dz8I-GUt.js";function x({owner:s,agentId:t}){const{orgContext:n}=i(),{isAdmin:a,isLoading:o}=r(n.organizationId);return e.jsx(l,{owner:s,agentId:t,backLabel:"Permissions",backTo:"/$owner/agents/$agentId/permissions",children:a?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Control which data, agent settings, and connector actions this agent may use automatically, with approval, or not at all."}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx(c,{owner:s,agentId:t})})]}):o?null:e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"Only organization admins can view or change agent permissions."})})}function p(){const{owner:s,agentId:t}=m.useParams();return e.jsx(x,{owner:s,agentId:t})}export{p as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e6 as w,dA as f,dB as y,r as N,j as e,bD as k,B as d,a6 as A,dY as C}from"./index-
|
|
1
|
+
import{e6 as w,dA as f,dB as y,r as N,j as e,bD as k,B as d,a6 as A,dY as C}from"./index-B2AmRqYh.js";import{u as P}from"./runs-oHveuEUB.js";function B({resource:g,runId:t,children:h,onDone:l}){const c=!!t,{data:a,isLoading:E,isError:u,refetch:v}=P(g,c?t:void 0),s=w({isReview:c,isError:u,status:a?.status}),m=a?.status==="pending"?a.proposal:null,n=f(),i=y(),[p,x]=N.useState(""),o=n.isPending||i.isPending,j=s==="active"||s==="loading"||s==="error",b=()=>{t&&n.mutate({run_id:t},{onSuccess:()=>l?.()})},R=()=>{if(!t)return;const r=p.trim();i.mutate({run_id:t,...r?{reason:r}:{}},{onSuccess:()=>l?.()})};return e.jsxs("div",{className:"grid content-start gap-4",children:[s==="active"?e.jsx("div",{className:"rounded-lg border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(k,{className:"mt-0.5 h-4 w-4 shrink-0"}),e.jsxs("p",{children:["Review the change the builder agent proposed. The values below show the proposed change — ",e.jsx("strong",{children:"Approve"})," to apply, or"," ",e.jsx("strong",{children:"Reject"}),"."]})]})}):null,s==="gone"?e.jsx("div",{className:"rounded-lg border bg-muted/30 p-3 text-sm text-muted-foreground",children:"This change is no longer pending (it may have been approved or rejected already)."}):null,s==="error"?e.jsx("div",{className:"rounded-lg border border-destructive/40 bg-destructive/5 p-3 text-sm",children:e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("p",{className:"text-destructive",children:"Couldn't load the proposed change to review. Editing is disabled until it loads — retry, or reopen the link."}),e.jsx(d,{type:"button",variant:"outline",size:"sm",onClick:()=>void v(),children:"Retry"})]})}):null,h({reviewMode:s,proposal:m,controlsDisabled:j}),s==="active"?e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(A,{htmlFor:"review-reject-reason",children:"Reason (optional)"}),e.jsx(C,{id:"review-reject-reason",rows:2,value:p,onChange:r=>x(r.target.value),placeholder:"Why you're rejecting — shared back to the requester.",disabled:o})]}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-end",children:[e.jsx(d,{type:"button",variant:"outline",onClick:R,disabled:o,children:i.isPending?"Rejecting...":"Reject"}),e.jsx(d,{type:"button",onClick:b,disabled:o,children:n.isPending?"Approving...":"Approve"})]})]}):null]})}export{B as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aQ as t,j as e,aR as o,aS as d,aT as m,aU as h}from"./index-
|
|
1
|
+
import{aQ as t,j as e,aR as o,aS as d,aT as m,aU as h}from"./index-B2AmRqYh.js";function p({section:s,icon:a,title:i,description:n,action:l}){const c=s?t[s]:null,x=s!==void 0?t[s].icon:a,r=i??c?.label??"";return e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(x,{className:"h-7 w-7 shrink-0","aria-hidden":!0}),e.jsx("h1",{className:"font-display text-3xl font-semibold leading-tight",children:r})]}),n?e.jsx("p",{className:"text-sm text-muted-foreground",children:n}):null]}),l?e.jsx("div",{className:"shrink-0",children:l}):null]})}function u(){const{owner:s}=o.useParams();return e.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-3 px-4 pt-4 pb-8 lg:px-6",children:e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:e.jsx(d,{owner:s,children:a=>e.jsxs("div",{className:"mx-auto flex min-h-0 w-full min-w-0 max-w-3xl flex-1 flex-col gap-4",children:[e.jsx(p,{icon:m,title:"Recent",description:"Chats, connected apps, and Automations you used last."}),e.jsx(h,{owner:a.ownerSlug,tone:"page",empty:"message"})]})})})})}export{u as component};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as Ge,j as $,B as qc,E as II,eS as jN,eT as KN,eU as pp,eV as JN,c$ as QN,ev as eB,fj as tB,eW as rB,eX as Cx,af as LI,Q as nB,dj as aB,aP as iB,ec as oB,aI as sB}from"./index-
|
|
1
|
+
import{r as Ge,j as $,B as qc,E as II,eS as jN,eT as KN,eU as pp,eV as JN,c$ as QN,ev as eB,fj as tB,eW as rB,eX as Cx,af as LI,Q as nB,dj as aB,aP as iB,ec as oB,aI as sB}from"./index-B2AmRqYh.js";import{c as lB,d as uB,b as fB,a as vB,C as cB}from"./card-CMmh2mzo.js";const hB=r=>r!=null;function dB(r,e,t=hB){let n=r;for(const a of e.replace(/\[(\d+)\]/g,".$1").split(".")){if(!t(n))return;n=n[a]}return n}function pB(r,e,t){return typeof r!="string"?r:r.startsWith("@")?e?.[r.slice(1)]:r.startsWith("{{")&&r.endsWith("}}")&&r.indexOf("}}")===r.length-2?t(r.slice(2,-2).trim()):r.replace(/\{\{(.+?)\}\}/g,(n,a)=>{const i=t(a.trim());return i===void 0?"":String(i)})}const gB=new Set(["type","children","props","path","fallback","key"]);function yB(r,e){const t={};for(const[n,a]of Object.entries(r))gB.has(n)||(t[n]=a);return Object.assign(t,e)}const mB=/^\d{4}-\d{2}-\d{2}(?:[tT ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,_B=/^\d{4}-\d{2}-\d{2}$/;function SB(r){return mB.test(r)}function jc(r){if(!/^https?:\/\//i.test(r))return!1;try{const e=new URL(r);return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function PI(r){return r.replace(/[-_]/g," ").replace(/\s+/g," ").trim().replace(/\b\w/g,e=>e.toUpperCase())}function Tx(r){return new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:r>=1e3?"compact":"standard",maximumFractionDigits:r>=1e9?1:0}).format(r)}function Ax(r){return new Intl.NumberFormat("en-US",{maximumFractionDigits:Number.isInteger(r)?0:2}).format(r)}function Mx(r){const e=new Date(_B.test(r)?`${r}T00:00:00`:r);return Number.isNaN(e.getTime())?r:e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function Dx(r){try{const e=new URL(r),t=e.hostname.replace(/^www\./i,""),n=e.pathname&&e.pathname!=="/"?e.pathname.replace(/\/$/,""):"";return`${t}${n}`}catch{return r}}function fm(r){return r==null?"":typeof r=="string"?r:typeof r=="number"||typeof r=="boolean"?String(RI(r)):Array.isArray(r)?r.some(e=>typeof e=="object"&&e!==null)?r.map((e,t)=>`${t+1}. ${fm(e)}`).join(`
|
|
2
2
|
`):JSON.stringify(r):typeof r=="object"?Object.entries(r).filter(([,t])=>t!=null&&t!=="").map(([t,n])=>`${PI(t)}: ${fm(n)}`).join("; "):JSON.stringify(r)}function RI(r,e){if(r==null)return"";if(typeof r=="boolean")return r?"Yes":"No";if(typeof r=="number")return e==="currency"?Tx(r):e===void 0||e==="text"?String(r):Ax(r);if(typeof r!="string")return fm(r);switch(e){case"currency":return Tx(Number(r));case"date":return Mx(r);case"url":return Dx(r);case"enum":return PI(r);case"number":return Ax(Number(r));case"auto":return jc(r)?Dx(r):SB(r)?Mx(r):r;default:return r}}function xB(r){return r==null?null:typeof r=="string"||typeof r=="number"||typeof r=="boolean"?String(r):null}function EI(r,e){return typeof r!="string"||!r.startsWith("@")||r.length===1?null:{action:r.slice(1),value:xB(e)}}/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ai as v,r as a,j as e,L as h,aj as j,ac as y,ak as N}from"./index-
|
|
1
|
+
import{ai as v,r as a,j as e,L as h,aj as j,ac as y,ak as N}from"./index-B2AmRqYh.js";import{C as k,a as C,b as S,c as L}from"./card-CMmh2mzo.js";function R(){const{token:n,error:x}=v.useSearch(),[o,p]=a.useState(""),[i,f]=a.useState(""),[d,s]=a.useState(null),[l,c]=a.useState(!1),[u,g]=a.useState(!1),w=async t=>{if(t.preventDefault(),!n){s("This reset link is invalid or expired.");return}if(o.length<8){s("Password must be at least 8 characters.");return}if(o!==i){s("Passwords do not match.");return}c(!0),s(null);try{const r=await j(`${y}/api/auth/reset-password`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:n,newPassword:o})});if(!r.ok)throw await N(r);g(!0)}catch(r){s(r instanceof Error?r.message:"Failed to reset password")}finally{c(!1)}},b=!n||x==="INVALID_TOKEN",m={callbackUrl:void 0,mode:void 0,error:void 0,errorDescription:void 0,loginHint:void 0,invitationOrg:void 0,intent:void 0};return e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center",children:e.jsxs("div",{className:"w-full max-w-md p-8",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"mx-auto mb-6 h-8 w-auto"}),e.jsxs(k,{children:[e.jsx(C,{children:e.jsx(S,{asChild:!0,children:e.jsx("h1",{className:"text-center text-2xl",children:"Reset your password"})})}),e.jsx(L,{children:b&&!u?e.jsxs("div",{className:"mt-6 space-y-4 text-center",children:[e.jsx("p",{className:"text-sm text-destructive",children:"This reset link is invalid or expired."}),e.jsx(h,{to:"/auth/login",search:m,className:"text-sm text-primary hover:underline",children:"Back to sign in"})]}):u?e.jsxs("div",{className:"mt-6 space-y-4 text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your password has been reset successfully."}),e.jsx(h,{to:"/auth/login",search:m,className:"text-sm text-primary hover:underline",children:"Continue to sign in"})]}):e.jsxs("form",{onSubmit:w,className:"mt-6 space-y-4",children:[d&&e.jsx("div",{className:"p-3 text-sm text-destructive bg-destructive/10 rounded-lg",children:d}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"new-password",className:"block text-sm font-medium",children:"New password"}),e.jsx("input",{id:"new-password",type:"password",value:o,onChange:t=>p(t.target.value),minLength:8,required:!0,className:"mt-1 block h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirm-password",className:"block text-sm font-medium",children:"Confirm new password"}),e.jsx("input",{id:"confirm-password",type:"password",value:i,onChange:t=>f(t.target.value),minLength:8,required:!0,className:"mt-1 block h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"})]}),e.jsx("button",{type:"submit",disabled:l,className:"flex h-10 w-full items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50",children:l?"Resetting password...":"Reset password"})]})})]})]})})}export{R as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cw as s,cx as d,f3 as c,cy as l,aj as f,f4 as g}from"./index-
|
|
1
|
+
import{cw as s,cx as d,f3 as c,cy as l,aj as f,f4 as g}from"./index-B2AmRqYh.js";const y=30,_=new Set(["running","pending","claimed"]);function I(n){return"connectionId"in n?["connection",n.connectionId]:"deviceId"in n?["device",n.deviceId]:"connectorKey"in n?["connector",n.connectorKey]:["feed",n.feedId]}function m(n){return"connectionId"in n?{connection_ids:[n.connectionId]}:"deviceId"in n?{device_worker_id:n.deviceId}:"connectorKey"in n?{connector_key:n.connectorKey}:{feed_ids:[n.feedId]}}function v(n,t,i){return c({queryKey:["runs-infinite",i??null,n?I(n):null,t.runTypes??null,t.status??null],queryFn:async({pageParam:e})=>{const a=e;return l("manage_operations",{action:"list_runs",...m(n),...t.runTypes&&t.runTypes.length>0?{run_types:t.runTypes}:{},...t.status?{status:t.status}:{},...a?{before_id:a.before_id,before_created_at:a.before_created_at}:{},limit:y},i?{slug:i}:void 0)},initialPageParam:null,getNextPageParam:e=>{if(!e.has_more)return;const a=e.runs[e.runs.length-1];if(a)return{before_id:a.id,before_created_at:a.created_at}},refetchInterval:e=>(e.state.data?.pages??[]).some(o=>o.runs.some(u=>_.has(u.status)))?5e3:!1,enabled:!!n,staleTime:15e3})}function p(n,t){return n.kind==="agent"?n.agentId?`/${n.agentId}/config/pending/${t}`:null:n.agentId&&n.automationId?`/${n.agentId}/automations/${n.automationId}/pending/${t}`:null}function T(n,t){const{slug:i}=s(),e=t!=null?p(n,t):null,a=n.kind==="agent"?["agent",n.agentId]:["automation",n.agentId,n.automationId];return d({queryKey:["pending-proposal",i,...a,t],queryFn:async()=>{const r=await f(g(i,e),{credentials:"include"});if(r.status===404)return{status:"gone"};if(!r.ok)throw new Error(`Failed to fetch pending proposal: ${r.status}`);return{status:"pending",proposal:await r.json()}},enabled:!!i&&!!e&&!!t,staleTime:0,retry:!1})}export{v as a,T as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,af as h,bR as T,bS as k,bT as w,bU as A,bV as C,S as l,r,n as I}from"./index-
|
|
1
|
+
import{j as e,af as h,bR as T,bS as k,bT as w,bU as A,bV as C,S as l,r,n as I}from"./index-B2AmRqYh.js";import{a as P}from"./runs-oHveuEUB.js";import{R as E}from"./runs-table-BUKDjiBc.js";const f=[{value:"all",label:"All"},{value:"sync",label:"Sync",runTypes:["sync"]},{value:"action",label:"Action",runTypes:["action"]},{value:"auth",label:"Auth",runTypes:["auth"]}];function F(s){return f.find(t=>t.value===s)?.runTypes}const B=[{value:"all",label:"All statuses"},{value:"running",label:"Running"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"},{value:"pending",label:"Pending"}];function L({bucket:s,status:t,onBucketChange:a,onStatusChange:u}){return e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("div",{className:"inline-flex rounded-md border bg-muted/30 p-0.5 text-sm",children:f.map(n=>e.jsx("button",{type:"button",onClick:()=>a(n.value),className:h("rounded px-3 py-1 transition-colors",s===n.value?"bg-background text-foreground ":"text-muted-foreground hover:text-foreground"),children:n.label},n.value))}),e.jsxs(T,{value:t,onValueChange:u,children:[e.jsx(k,{className:"w-[150px]",children:e.jsx(w,{})}),e.jsx(A,{children:B.map(n=>e.jsx(C,{value:n.value,children:n.label},n.value))})]})]})}function M({labels:s,className:t}){return e.jsx("div",{className:h("inline-flex rounded-md border bg-muted/30 p-0.5 text-sm",t),children:s.map((a,u)=>e.jsx("span",{className:u===0?"rounded bg-background px-3 py-1 text-foreground ":"px-3 py-1 text-muted-foreground",children:a},a))})}function b({rows:s=6}){return e.jsxs("div",{className:"rounded-lg border",role:"status","aria-label":"Loading runs",children:[e.jsx("div",{className:"border-b px-3 py-2",children:e.jsx(l,{className:"h-3 w-1/4"})}),e.jsx("div",{className:"divide-y",children:Array.from({length:s}).map((t,a)=>e.jsxs("div",{className:"flex items-center gap-3 px-3 py-2.5",children:[e.jsx(l,{className:"h-3.5 w-3.5 rounded-full shrink-0"}),e.jsx(l,{className:"h-3 w-20"}),e.jsx(l,{className:"h-3 w-16"}),e.jsx(l,{className:"ml-auto h-3 w-12 shrink-0"}),e.jsx(l,{className:"h-7 w-7 rounded-md shrink-0"})]},a))})]})}function _({rows:s=6}){return e.jsxs("div",{className:"space-y-4",role:"status","aria-label":"Loading runs",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(M,{labels:["All","Sync","Action","Auth"]}),e.jsx("div",{className:"h-9 w-[150px] rounded-md border border-input"})]}),e.jsx(b,{rows:s})]})}function K({scope:s,ownerSlug:t}){const[a,u]=r.useState("all"),[n,v]=r.useState("all"),j=r.useMemo(()=>({runTypes:F(a),status:n==="all"?void 0:n}),[a,n]),{data:i,isLoading:N,isError:y,hasNextPage:o,isFetchingNextPage:d,fetchNextPage:x}=P(s,j,t),m=r.useMemo(()=>i?.pages.flatMap(c=>c.runs)??[],[i]),S={runType:a==="all",feed:!0,connection:"deviceId"in s||"connectorKey"in s},p=r.useRef(null);return r.useEffect(()=>{const c=p.current;if(!c||!o)return;const g=new IntersectionObserver(R=>{R[0]?.isIntersecting&&!d&&x()},{rootMargin:"200px"});return g.observe(c),()=>g.disconnect()},[o,d,x]),e.jsxs("div",{className:"space-y-3",children:[e.jsx(L,{bucket:a,status:n,onBucketChange:u,onStatusChange:v}),N?e.jsx(b,{}):y?e.jsx("p",{className:"rounded-lg border bg-destructive/5 px-3 py-6 text-center text-xs text-destructive",children:"Failed to load runs."}):m.length===0?e.jsx("p",{className:"rounded-lg border bg-muted/20 px-3 py-6 text-center text-xs text-muted-foreground",children:"No runs yet."}):e.jsxs(e.Fragment,{children:[e.jsx(E,{runs:m,ownerSlug:t,columns:S}),e.jsx("div",{ref:p,className:"h-1"}),d&&e.jsx("div",{className:"flex justify-center py-3",children:e.jsx(I,{size:"lg",className:"text-muted-foreground"})})]})]})}export{K as R,_ as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,af as g,o as v,eM as w,S as f,eN as k,i as C,eO as B,bk as F,eP as O,B as S,L as j,P as D,x as T,dj as H,aO as $,cZ as U,cM as q,cN as z,cO as M,eQ as W,eR as K,eS as X,eT as Y,eU as _,eV as u,eW as G,eX as x,en as J,ab as Q,eY as Z,ei as ee,aw as te,n as se,bH as ne,r as L,cp as R,cq as A,ct as E}from"./index-GZkujXG1.js";import{c as ae}from"./connection-label-BobuYiAG.js";const re={amber:"bg-amber-500",muted:"bg-muted-foreground/40",destructive:"bg-destructive"};function V({tone:t}){return e.jsx("span",{"aria-hidden":t===null,className:g("h-1.5 w-1.5 shrink-0 rounded-full",t===null?"bg-transparent":re[t])})}function I(t){switch(t.attention){case"needs_auth":return"Needs authentication";case"setup_required":return t.attention_reason?.trim()||"Setup required";case"paused":return"Paused";case"misconfigured":return"Configuration error";case"device_offline":return`Waiting for ${t.device_label||t.device_platform||"device"}`;case"last_attempt_failed":{const n=Number(t.consecutive_failures??0);return t.last_error?.trim()||(n>0?`${n} consecutive sync ${n===1?"failure":"failures"}`:"Last sync failed")}case"overdue":return"Scheduled run overdue";case"no_trigger":return"No schedule — this feed only runs when you sync it";case"never_run":return t.execution_mode==="scheduled"?"Scheduled, not run yet":"Not synced yet";default:return null}}function ie(t){switch(t.attention){case"last_attempt_failed":case"misconfigured":return"destructive";case"needs_auth":case"setup_required":case"device_offline":case"overdue":case"no_trigger":case"never_run":return t.attention==="never_run"&&t.execution_mode!=="scheduled"?"muted":"amber";case"paused":return"muted";default:return t.status==="active"?null:t.status==="error"?"destructive":"muted"}}function ce(t){return Object.keys(t?.feeds_schema??{}).length>0}const y=new Set(["error","revoked","pending_auth"]),oe={pending_auth:"needs reconnect",revoked:"revoked",error:"error",paused:"paused",active:"active"};function _e({connections:t,connectorDef:n,organizationId:r,ownerSlug:c,connectorKey:s,isLoading:a=!1}){const d=v(),i=t.filter(m=>y.has(m.status)||!!n&&w(n)&&!m.device_worker_id).length;if(a)return e.jsx(f,{className:"h-16 w-full rounded-lg"});const l=t.length;return e.jsx(k,{title:"Connections",summary:`${l} ${l===1?"connection":"connections"}${i?` · ${i} ${i===1?"needs":"need"} attention`:""}`,onOpen:()=>d?.open({href:"",title:"Connections",connectorPanel:{section:"connections",connectorKey:s,organizationId:r,ownerSlug:c}})})}function ve({connections:t,connectorDef:n,ownerSlug:r,connectorKey:c}){if(t.length===0)return null;const s=[...t].sort((a,d)=>{const i=y.has(a.status)?0:1,l=y.has(d.status)?0:1;return i-l});return e.jsx("ul",{className:"flex flex-col gap-2",children:s.map(a=>{const d=ae({...a,connector_name:a.connector_name??n?.name??null}),i=!!n&&w(n)&&!a.device_worker_id,l=a.status==="error"||a.status==="revoked"||a.status==="pending_auth";return e.jsx("li",{children:e.jsxs(j,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:r,connectorKey:c,connectionId:String(a.id)},search:{},className:"flex items-center justify-between gap-3 rounded-lg border border-border px-3 py-2.5 transition-colors hover:bg-accent/50",children:[e.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e.jsx(V,{tone:a.status==="active"?null:a.status==="error"||a.status==="revoked"?"destructive":"amber"}),e.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:d})]}),e.jsxs("span",{className:"flex min-w-0 max-w-1/2 shrink-0 items-center gap-2",children:[i?e.jsx("span",{className:"shrink-0 text-xs text-amber-600",children:"Needs a device"}):l?e.jsx("span",{className:"min-w-0 truncate text-xs text-muted-foreground",children:a.error_message?.trim()||oe[a.status]||a.status}):null,e.jsx(H,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"})]})]})},a.id)})})}function we({connection:t,ownerSlug:n,connectorKey:r,connectorDef:c}){const{data:s=[],isLoading:a}=C(t.id),d=ce(c),i=t.facets?.chat??!1,{inspectFeed:l}=B(),m=c?.feeds_schema??{},p={owner:n,connectorKey:r,connectionId:String(t.id)};return a?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(f,{className:"h-12 w-full rounded-lg"}),e.jsx(f,{className:"h-12 w-full rounded-lg"})]}):s.length===0?e.jsx(F,{icon:O,title:i?"No channels":"No feeds",description:d?i?"Bind a channel to route conversations to this connection.":"Add a feed to start collecting data from this connection.":i?"This chat connection has no bound channels yet.":"This connector doesn't provide any feeds.",children:d?e.jsx(S,{asChild:!0,size:"sm",children:e.jsxs(j,{to:"/$owner/connectors/$connectorKey/$connectionId",params:p,search:{addFeed:!0},children:[e.jsx(D,{className:"h-3.5 w-3.5"}),i?"Add channel":"Add feed"]})}):null}):e.jsx("ul",{className:"flex flex-col gap-2",children:s.map(o=>{const h=o.display_name?.trim()||o.feed_key,b=I(o),N=m[o.feed_key],P=`/${n}/connectors/${r}/${t.id}?feedId=${o.id}`;return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>{N&&l(o.feed_key,N,P)},className:"flex w-full items-center justify-between gap-3 rounded-lg border border-border px-3 py-2.5 text-left transition-colors hover:bg-accent/50",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(V,{tone:ie(o)}),e.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:h})]}),e.jsx("span",{className:o.attention==="last_attempt_failed"||o.attention==="misconfigured"?"max-w-[50%] shrink-0 text-right text-xs text-destructive":o.attention&&o.attention!=="healthy"?"max-w-[50%] shrink-0 text-right text-xs text-amber-600 dark:text-amber-400":"shrink-0 text-xs text-muted-foreground",title:b??void 0,children:b??(o.store==="channel_messages"?"chat channel":o.operations.includes("read")&&o.operations.includes("sync")?"synced + live":o.operations.includes("read")?"live":o.last_sync_at?`synced ${T(o.last_sync_at)}`:"not synced yet")})]})},o.id)})})}function ke({connection:t,ownerSlug:n,title:r}){const c=v(),{data:s=[],isLoading:a,isError:d}=C(t.id),i=s.filter(h=>["needs_auth","setup_required","misconfigured","last_attempt_failed","device_offline","overdue"].includes(h.attention??"")),l=s.filter(h=>h.status==="paused").length,m=a?t.feed_count:s.length,p=t.facets?.chat?"channels":"feeds",o=a?`Loading ${p}…`:d?`Could not load ${p} — open to retry`:`${m} ${p}${i.length?` · ${i.length} need attention`:""}${l?` · ${l} paused`:""}`;return e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{title:r,summary:o,onOpen:()=>c?.open({href:"",title:t.facets?.chat?"Channels":"Feeds",connectorPanel:{section:"feeds",connectorKey:t.connector_key,connectionId:t.id,organizationId:t.organization_id,ownerSlug:n}})}),i.length>0&&e.jsxs("ul",{className:"space-y-1 text-xs text-destructive",children:[i.slice(0,3).map(h=>e.jsxs("li",{children:[h.display_name||h.feed_key,": ",I(h)]},h.id)),i.length>3&&e.jsxs("li",{children:[i.length-3," more sources need attention."]})]})]})}const le=$("inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors",{variants:{status:{active:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",paused:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",error:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",pending:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",rejected:"bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400",default:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"}},defaultVariants:{status:"default"}}),de=$("h-1.5 w-1.5 rounded-full",{variants:{status:{active:"bg-green-500",paused:"bg-yellow-500",error:"bg-red-500",pending:"bg-blue-500",rejected:"bg-gray-500",default:"bg-gray-500"}},defaultVariants:{status:"default"}});function ue({className:t,status:n,showDot:r=!0,children:c,...s}){return e.jsxs("span",{className:g(le({status:n}),t),...s,children:[r&&e.jsx("span",{className:de({status:n})}),c]})}function xe(t,n){switch(n.kind){case"connection":return K(t,n.id);case"feed":return W(t,n.id);case"run":return{to:"/$owner/events",params:{owner:t},search:{run_ids:String(n.id)}}}}function he({ownerSlug:t,scope:n,variant:r="outline",iconOnly:c=!1,label:s,className:a,title:d}){const i=xe(t,n),l=d??s??"View in memory",m=e.jsx(S,{asChild:!0,variant:r,size:c?"icon":"sm",className:g(c&&"h-7 w-7",a),children:e.jsxs(j,{to:i.to,params:i.params,search:i.search,children:[e.jsx(U,{className:g("h-3.5 w-3.5",!c&&"mr-1.5")}),!c&&(s??"View in memory")]})});return c?e.jsxs(q,{children:[e.jsx(z,{asChild:!0,children:m}),e.jsx(M,{children:l})]}):m}const me=new Set(["error","failed","revoked"]);function pe(t){return t==="active"?"active":t==="paused"?"paused":t==="pending"||t==="pending_auth"?"pending":me.has(t)?"error":"default"}function ge({status:t}){return t==="completed"?e.jsx(ee,{className:"h-3.5 w-3.5 text-green-500"}):t==="failed"?e.jsx(te,{className:"h-3.5 w-3.5 text-destructive"}):t==="running"?e.jsx(se,{className:"text-blue-500"}):e.jsx(ne,{className:"h-3.5 w-3.5 text-muted-foreground"})}function fe({error:t}){const[n,r]=L.useState(!1);return t.length>80?e.jsxs(R,{open:n,onOpenChange:r,children:[e.jsx(A,{asChild:!0,children:e.jsx("button",{type:"button",className:"text-left text-destructive truncate max-w-[200px] hover:underline",children:t})}),e.jsx(E,{className:"w-96 max-h-64 overflow-auto",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words text-destructive",children:t})})]}):e.jsx("span",{className:"text-destructive",children:t})}function ye({checkpoint:t}){const[n,r]=L.useState(!1);return e.jsxs(R,{open:n,onOpenChange:r,children:[e.jsx(A,{asChild:!0,children:e.jsx("button",{type:"button",className:"text-left text-muted-foreground hover:underline",children:"view"})}),e.jsx(E,{className:"w-80 max-h-64 overflow-auto",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:JSON.stringify(t,null,2)})})]})}function je(t){return t.feed_display_name??t.feed_key??"—"}function Ce({runs:t,ownerSlug:n,columns:r={}}){const c=t.some(s=>s.checkpoint);return e.jsx("div",{className:"rounded-lg border",children:e.jsxs(X,{children:[e.jsx(Y,{children:e.jsxs(_,{children:[e.jsx(u,{className:"text-xs py-1.5 px-3 w-8"}),e.jsx(u,{className:"text-xs py-1.5 px-3",children:"When"}),r.runType&&e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Type"}),r.connection&&e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Connection"}),r.feed&&e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Feed"}),e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Status"}),e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Items"}),e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Duration"}),e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Version"}),c&&e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Checkpoint"}),e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Error"}),e.jsx(u,{className:"text-xs py-1.5 px-3 w-8"})]})}),e.jsx(G,{children:t.map(s=>{const a=s.completed_at?Math.round((new Date(s.completed_at).getTime()-new Date(s.created_at).getTime())/1e3):null;return e.jsxs(_,{children:[e.jsx(x,{className:"py-1.5 px-3",children:e.jsx(ge,{status:s.status})}),e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",title:J(s.created_at),children:T(s.created_at)}),r.runType&&e.jsx(x,{className:"py-1.5 px-3 text-xs",children:e.jsx(Q,{variant:"secondary",className:"font-mono text-[10px]",children:s.run_type??"—"})}),r.connection&&e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",children:s.connection_display_name??"—"}),r.feed&&e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",children:je(s)}),e.jsx(x,{className:"py-1.5 px-3 text-xs",children:e.jsx(ue,{status:pe(s.status),children:s.status})}),e.jsx(x,{className:"py-1.5 px-3 text-xs font-mono text-muted-foreground",children:s.items_collected??"—"}),e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",children:a!=null?Z(a):"—"}),e.jsx(x,{className:"py-1.5 px-3 text-xs font-mono text-muted-foreground",children:s.connector_version??"—"}),c&&e.jsx(x,{className:"py-1.5 px-3 text-xs",children:s.checkpoint?e.jsx(ye,{checkpoint:s.checkpoint}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}),e.jsx(x,{className:"py-1.5 px-3 text-xs",children:s.error_message?e.jsx(fe,{error:s.error_message}):""}),e.jsx(x,{className:"py-1.5 px-3 text-right",children:e.jsx(he,{ownerSlug:n,scope:{kind:"run",id:s.id},variant:"ghost",iconOnly:!0,title:"View events from this run"})})]},s.id)})})]})})}export{ve as C,Ce as R,ue as S,he as V,_e as a,we as b,ce as c,ke as d,I as f,pe as g};
|
|
1
|
+
import{j as e,af as g,o as v,eM as w,S as f,eN as k,i as C,eO as B,bk as F,eP as O,B as S,L as j,P as D,x as T,dj as H,aO as $,cZ as U,cM as q,cN as z,cO as M,eQ as W,eR as K,eS as X,eT as Y,eU as _,eV as u,eW as G,eX as x,en as J,ab as Q,eY as Z,ei as ee,aw as te,n as se,bH as ne,r as L,cp as R,cq as A,ct as E}from"./index-B2AmRqYh.js";import{c as ae}from"./connection-label-BobuYiAG.js";const re={amber:"bg-amber-500",muted:"bg-muted-foreground/40",destructive:"bg-destructive"};function V({tone:t}){return e.jsx("span",{"aria-hidden":t===null,className:g("h-1.5 w-1.5 shrink-0 rounded-full",t===null?"bg-transparent":re[t])})}function I(t){switch(t.attention){case"needs_auth":return"Needs authentication";case"setup_required":return t.attention_reason?.trim()||"Setup required";case"paused":return"Paused";case"misconfigured":return"Configuration error";case"device_offline":return`Waiting for ${t.device_label||t.device_platform||"device"}`;case"last_attempt_failed":{const n=Number(t.consecutive_failures??0);return t.last_error?.trim()||(n>0?`${n} consecutive sync ${n===1?"failure":"failures"}`:"Last sync failed")}case"overdue":return"Scheduled run overdue";case"no_trigger":return"No schedule — this feed only runs when you sync it";case"never_run":return t.execution_mode==="scheduled"?"Scheduled, not run yet":"Not synced yet";default:return null}}function ie(t){switch(t.attention){case"last_attempt_failed":case"misconfigured":return"destructive";case"needs_auth":case"setup_required":case"device_offline":case"overdue":case"no_trigger":case"never_run":return t.attention==="never_run"&&t.execution_mode!=="scheduled"?"muted":"amber";case"paused":return"muted";default:return t.status==="active"?null:t.status==="error"?"destructive":"muted"}}function ce(t){return Object.keys(t?.feeds_schema??{}).length>0}const y=new Set(["error","revoked","pending_auth"]),oe={pending_auth:"needs reconnect",revoked:"revoked",error:"error",paused:"paused",active:"active"};function _e({connections:t,connectorDef:n,organizationId:r,ownerSlug:c,connectorKey:s,isLoading:a=!1}){const d=v(),i=t.filter(m=>y.has(m.status)||!!n&&w(n)&&!m.device_worker_id).length;if(a)return e.jsx(f,{className:"h-16 w-full rounded-lg"});const l=t.length;return e.jsx(k,{title:"Connections",summary:`${l} ${l===1?"connection":"connections"}${i?` · ${i} ${i===1?"needs":"need"} attention`:""}`,onOpen:()=>d?.open({href:"",title:"Connections",connectorPanel:{section:"connections",connectorKey:s,organizationId:r,ownerSlug:c}})})}function ve({connections:t,connectorDef:n,ownerSlug:r,connectorKey:c}){if(t.length===0)return null;const s=[...t].sort((a,d)=>{const i=y.has(a.status)?0:1,l=y.has(d.status)?0:1;return i-l});return e.jsx("ul",{className:"flex flex-col gap-2",children:s.map(a=>{const d=ae({...a,connector_name:a.connector_name??n?.name??null}),i=!!n&&w(n)&&!a.device_worker_id,l=a.status==="error"||a.status==="revoked"||a.status==="pending_auth";return e.jsx("li",{children:e.jsxs(j,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:r,connectorKey:c,connectionId:String(a.id)},search:{},className:"flex items-center justify-between gap-3 rounded-lg border border-border px-3 py-2.5 transition-colors hover:bg-accent/50",children:[e.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[e.jsx(V,{tone:a.status==="active"?null:a.status==="error"||a.status==="revoked"?"destructive":"amber"}),e.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:d})]}),e.jsxs("span",{className:"flex min-w-0 max-w-1/2 shrink-0 items-center gap-2",children:[i?e.jsx("span",{className:"shrink-0 text-xs text-amber-600",children:"Needs a device"}):l?e.jsx("span",{className:"min-w-0 truncate text-xs text-muted-foreground",children:a.error_message?.trim()||oe[a.status]||a.status}):null,e.jsx(H,{"aria-hidden":"true",className:"size-4 shrink-0 text-muted-foreground"})]})]})},a.id)})})}function we({connection:t,ownerSlug:n,connectorKey:r,connectorDef:c}){const{data:s=[],isLoading:a}=C(t.id),d=ce(c),i=t.facets?.chat??!1,{inspectFeed:l}=B(),m=c?.feeds_schema??{},p={owner:n,connectorKey:r,connectionId:String(t.id)};return a?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(f,{className:"h-12 w-full rounded-lg"}),e.jsx(f,{className:"h-12 w-full rounded-lg"})]}):s.length===0?e.jsx(F,{icon:O,title:i?"No channels":"No feeds",description:d?i?"Bind a channel to route conversations to this connection.":"Add a feed to start collecting data from this connection.":i?"This chat connection has no bound channels yet.":"This connector doesn't provide any feeds.",children:d?e.jsx(S,{asChild:!0,size:"sm",children:e.jsxs(j,{to:"/$owner/connectors/$connectorKey/$connectionId",params:p,search:{addFeed:!0},children:[e.jsx(D,{className:"h-3.5 w-3.5"}),i?"Add channel":"Add feed"]})}):null}):e.jsx("ul",{className:"flex flex-col gap-2",children:s.map(o=>{const h=o.display_name?.trim()||o.feed_key,b=I(o),N=m[o.feed_key],P=`/${n}/connectors/${r}/${t.id}?feedId=${o.id}`;return e.jsx("li",{children:e.jsxs("button",{type:"button",onClick:()=>{N&&l(o.feed_key,N,P)},className:"flex w-full items-center justify-between gap-3 rounded-lg border border-border px-3 py-2.5 text-left transition-colors hover:bg-accent/50",children:[e.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[e.jsx(V,{tone:ie(o)}),e.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:h})]}),e.jsx("span",{className:o.attention==="last_attempt_failed"||o.attention==="misconfigured"?"max-w-[50%] shrink-0 text-right text-xs text-destructive":o.attention&&o.attention!=="healthy"?"max-w-[50%] shrink-0 text-right text-xs text-amber-600 dark:text-amber-400":"shrink-0 text-xs text-muted-foreground",title:b??void 0,children:b??(o.store==="channel_messages"?"chat channel":o.operations.includes("read")&&o.operations.includes("sync")?"synced + live":o.operations.includes("read")?"live":o.last_sync_at?`synced ${T(o.last_sync_at)}`:"not synced yet")})]})},o.id)})})}function ke({connection:t,ownerSlug:n,title:r}){const c=v(),{data:s=[],isLoading:a,isError:d}=C(t.id),i=s.filter(h=>["needs_auth","setup_required","misconfigured","last_attempt_failed","device_offline","overdue"].includes(h.attention??"")),l=s.filter(h=>h.status==="paused").length,m=a?t.feed_count:s.length,p=t.facets?.chat?"channels":"feeds",o=a?`Loading ${p}…`:d?`Could not load ${p} — open to retry`:`${m} ${p}${i.length?` · ${i.length} need attention`:""}${l?` · ${l} paused`:""}`;return e.jsxs("div",{className:"space-y-2",children:[e.jsx(k,{title:r,summary:o,onOpen:()=>c?.open({href:"",title:t.facets?.chat?"Channels":"Feeds",connectorPanel:{section:"feeds",connectorKey:t.connector_key,connectionId:t.id,organizationId:t.organization_id,ownerSlug:n}})}),i.length>0&&e.jsxs("ul",{className:"space-y-1 text-xs text-destructive",children:[i.slice(0,3).map(h=>e.jsxs("li",{children:[h.display_name||h.feed_key,": ",I(h)]},h.id)),i.length>3&&e.jsxs("li",{children:[i.length-3," more sources need attention."]})]})]})}const le=$("inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors",{variants:{status:{active:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",paused:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-400",error:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400",pending:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",rejected:"bg-gray-100 text-gray-700 dark:bg-gray-900/30 dark:text-gray-400",default:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"}},defaultVariants:{status:"default"}}),de=$("h-1.5 w-1.5 rounded-full",{variants:{status:{active:"bg-green-500",paused:"bg-yellow-500",error:"bg-red-500",pending:"bg-blue-500",rejected:"bg-gray-500",default:"bg-gray-500"}},defaultVariants:{status:"default"}});function ue({className:t,status:n,showDot:r=!0,children:c,...s}){return e.jsxs("span",{className:g(le({status:n}),t),...s,children:[r&&e.jsx("span",{className:de({status:n})}),c]})}function xe(t,n){switch(n.kind){case"connection":return K(t,n.id);case"feed":return W(t,n.id);case"run":return{to:"/$owner/events",params:{owner:t},search:{run_ids:String(n.id)}}}}function he({ownerSlug:t,scope:n,variant:r="outline",iconOnly:c=!1,label:s,className:a,title:d}){const i=xe(t,n),l=d??s??"View in memory",m=e.jsx(S,{asChild:!0,variant:r,size:c?"icon":"sm",className:g(c&&"h-7 w-7",a),children:e.jsxs(j,{to:i.to,params:i.params,search:i.search,children:[e.jsx(U,{className:g("h-3.5 w-3.5",!c&&"mr-1.5")}),!c&&(s??"View in memory")]})});return c?e.jsxs(q,{children:[e.jsx(z,{asChild:!0,children:m}),e.jsx(M,{children:l})]}):m}const me=new Set(["error","failed","revoked"]);function pe(t){return t==="active"?"active":t==="paused"?"paused":t==="pending"||t==="pending_auth"?"pending":me.has(t)?"error":"default"}function ge({status:t}){return t==="completed"?e.jsx(ee,{className:"h-3.5 w-3.5 text-green-500"}):t==="failed"?e.jsx(te,{className:"h-3.5 w-3.5 text-destructive"}):t==="running"?e.jsx(se,{className:"text-blue-500"}):e.jsx(ne,{className:"h-3.5 w-3.5 text-muted-foreground"})}function fe({error:t}){const[n,r]=L.useState(!1);return t.length>80?e.jsxs(R,{open:n,onOpenChange:r,children:[e.jsx(A,{asChild:!0,children:e.jsx("button",{type:"button",className:"text-left text-destructive truncate max-w-[200px] hover:underline",children:t})}),e.jsx(E,{className:"w-96 max-h-64 overflow-auto",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words text-destructive",children:t})})]}):e.jsx("span",{className:"text-destructive",children:t})}function ye({checkpoint:t}){const[n,r]=L.useState(!1);return e.jsxs(R,{open:n,onOpenChange:r,children:[e.jsx(A,{asChild:!0,children:e.jsx("button",{type:"button",className:"text-left text-muted-foreground hover:underline",children:"view"})}),e.jsx(E,{className:"w-80 max-h-64 overflow-auto",children:e.jsx("pre",{className:"text-xs whitespace-pre-wrap break-words",children:JSON.stringify(t,null,2)})})]})}function je(t){return t.feed_display_name??t.feed_key??"—"}function Ce({runs:t,ownerSlug:n,columns:r={}}){const c=t.some(s=>s.checkpoint);return e.jsx("div",{className:"rounded-lg border",children:e.jsxs(X,{children:[e.jsx(Y,{children:e.jsxs(_,{children:[e.jsx(u,{className:"text-xs py-1.5 px-3 w-8"}),e.jsx(u,{className:"text-xs py-1.5 px-3",children:"When"}),r.runType&&e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Type"}),r.connection&&e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Connection"}),r.feed&&e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Feed"}),e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Status"}),e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Items"}),e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Duration"}),e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Version"}),c&&e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Checkpoint"}),e.jsx(u,{className:"text-xs py-1.5 px-3",children:"Error"}),e.jsx(u,{className:"text-xs py-1.5 px-3 w-8"})]})}),e.jsx(G,{children:t.map(s=>{const a=s.completed_at?Math.round((new Date(s.completed_at).getTime()-new Date(s.created_at).getTime())/1e3):null;return e.jsxs(_,{children:[e.jsx(x,{className:"py-1.5 px-3",children:e.jsx(ge,{status:s.status})}),e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",title:J(s.created_at),children:T(s.created_at)}),r.runType&&e.jsx(x,{className:"py-1.5 px-3 text-xs",children:e.jsx(Q,{variant:"secondary",className:"font-mono text-[10px]",children:s.run_type??"—"})}),r.connection&&e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",children:s.connection_display_name??"—"}),r.feed&&e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",children:je(s)}),e.jsx(x,{className:"py-1.5 px-3 text-xs",children:e.jsx(ue,{status:pe(s.status),children:s.status})}),e.jsx(x,{className:"py-1.5 px-3 text-xs font-mono text-muted-foreground",children:s.items_collected??"—"}),e.jsx(x,{className:"py-1.5 px-3 text-xs text-muted-foreground",children:a!=null?Z(a):"—"}),e.jsx(x,{className:"py-1.5 px-3 text-xs font-mono text-muted-foreground",children:s.connector_version??"—"}),c&&e.jsx(x,{className:"py-1.5 px-3 text-xs",children:s.checkpoint?e.jsx(ye,{checkpoint:s.checkpoint}):e.jsx("span",{className:"text-muted-foreground",children:"—"})}),e.jsx(x,{className:"py-1.5 px-3 text-xs",children:s.error_message?e.jsx(fe,{error:s.error_message}):""}),e.jsx(x,{className:"py-1.5 px-3 text-right",children:e.jsx(he,{ownerSlug:n,scope:{kind:"run",id:s.id},variant:"ghost",iconOnly:!0,title:"View events from this run"})})]},s.id)})})]})})}export{ve as C,Ce as R,ue as S,he as V,_e as a,we as b,ce as c,ke as d,I as f,pe as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as O,j as t,aB as ae,ek as ne,ag as le,a6 as V,bR as oe,bS as de,bT as ce,bU as me,bV as ue,gc as fe,gd as R,ge as G,gf as xe,gg as _,gh as he,B as I,bu as Q,P as X,eS as be,eT as je,eU as z,eV as Z,eW as ye,eX as B,a7 as q,fY as ge,gi as Ne,cB as ve,cC as W,gj as pe,aL as we,af as T,dO as Se,x as $e,cM as Oe,cN as Ie,ab as Te,gk as Le,cO as Ae,cp as Ee,cq as ke,cP as Re,ct as Pe,cQ as C,cI as Ce}from"./index-GZkujXG1.js";import{C as Fe}from"./calendar-CvEqJnKS.js";var De="Separator",K="horizontal",_e=["horizontal","vertical"],re=O.forwardRef((s,r)=>{const{decorative:e,orientation:i=K,...a}=s,m=ze(i)?i:K,b=e?{role:"none"}:{"aria-orientation":m==="vertical"?m:void 0,role:"separator"};return t.jsx(ae.div,{"data-orientation":m,...b,...a,ref:r})});re.displayName=De;function ze(s){return _e.includes(s)}var ie=re;function E(s){return String(s??"").split(/[_-]/).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}function Be(s){return s.replace(/[^a-zA-Z0-9_-]/g,"-")}const Ue=/^\d{4}-\d{2}-\d{2}$/;function J(s){if(Ue.test(s)){const[r,e,i]=s.split("-").map(Number),a=new Date(0);return a.setHours(0,0,0,0),a.setFullYear(r,e-1,i),a}return new Date(s)}function Ve(s,r=!1){if(!s)return r?"Pick a date and time":"Pick a date";const e=J(s);return Number.isNaN(e.getTime())?s:r?e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):C(e,"LLL dd, y")}function U(s){if(!s)return"";const r=J(s);if(Number.isNaN(r.getTime()))return"";const e=r.getTimezoneOffset()*6e4;return new Date(r.getTime()-e).toISOString().slice(0,16)}function ee(s){if(!s)return;const r=new Date(s);if(!Number.isNaN(r.getTime()))return r.toISOString()}function P(s,r){const e=r==="slug"?s.slug:s.metadata?.[r];return e==null?"":String(e)}function Me({control:s}){const r=[s.set_by,s.set_at?$e(s.set_at):null].filter(Boolean).join(" · ");return t.jsxs(Oe,{children:[t.jsx(Ie,{asChild:!0,children:t.jsxs(Te,{variant:"outline",className:"gap-1 border-emerald-500/30 bg-emerald-500/10 text-[10px] uppercase tracking-wide text-emerald-600 dark:text-emerald-400",children:[t.jsx(Le,{className:"h-3 w-3"}),"You"]})}),t.jsxs(Ae,{className:"max-w-xs space-y-1",children:[t.jsx("div",{className:"text-xs font-medium",children:"Human-owned field"}),s.note?t.jsx("div",{className:"text-xs text-primary-foreground/90",children:s.note}):null,r?t.jsx("div",{className:"text-[11px] text-primary-foreground/70",children:r}):null]})]})}function te({id:s,value:r,onChange:e,readonly:i,ariaLabel:a,includeTime:m=!1}){const u=r?J(r):void 0,[b,c]=O.useState(()=>U(r).slice(11));return O.useEffect(()=>{c(U(r).slice(11))},[r]),t.jsx("div",{className:"relative",children:t.jsxs(Ee,{children:[t.jsx(ke,{asChild:!0,children:t.jsxs(I,{id:s,"aria-label":a,type:"button",variant:"outline",disabled:i,className:T("w-full justify-start rounded-md bg-muted px-3 text-left font-normal",!r&&"text-muted-foreground"),children:[t.jsx(Re,{className:"mr-2 h-4 w-4 shrink-0"}),t.jsx("span",{className:"truncate",children:Ve(r,m)})]})}),t.jsxs(Pe,{className:"w-auto space-y-3 p-0",align:"start",children:[t.jsx(Fe,{mode:"single",selected:u,defaultMonth:u,onSelect:x=>{if(!x)return;if(!m){e(C(x,"yyyy-MM-dd"));return}const n=b||"00:00";e(ee(`${C(x,"yyyy-MM-dd")}T${n}`))},initialFocus:!0}),m?t.jsxs("div",{className:"border-t p-3 pt-0",children:[t.jsx(V,{htmlFor:`${s}-time`,className:"text-xs text-muted-foreground",children:"Time"}),t.jsx(q,{id:`${s}-time`,type:"time",value:b,onChange:x=>{c(x.target.value);const n=r?U(r).slice(0,10):u?C(u,"yyyy-MM-dd"):"";n&&e(ee(`${n}T${x.target.value}`))},disabled:i})]}):null]})]})})}function qe({id:s,value:r,onChange:e,readonly:i,ariaLabel:a,entityType:m,lookupField:u,numeric:b=!1,orgContext:c}){const x=f=>{if(f===void 0||f==="")return e(void 0);if(!b)return e(f);const w=Number(f);e(Number.isFinite(w)?w:f)},{data:n}=ge(m,c,{limit:Ne}),d=(n?.entities??[]).filter(f=>P(f,u)!==""),l=r==null?"":String(r),$=d.find(f=>P(f,u)===l);return c?i?t.jsx("div",{className:"flex h-9 items-center rounded-md border border-input bg-muted px-3 text-sm",children:$?.name||l||"-"}):t.jsx(ve,{contentClassName:"w-[320px]",searchPlaceholder:`Search ${E(m).toLowerCase()}...`,emptyText:`No ${m} found.`,trigger:f=>t.jsxs(I,{id:s,"aria-label":a,type:"button",variant:"outline",role:"combobox","aria-expanded":f,className:"w-full justify-between",children:[t.jsx("span",{className:T("truncate",!l&&"text-muted-foreground"),children:$?.name||l||`Select ${E(m).toLowerCase()}`}),t.jsx(Se,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:(f,w)=>{const S=w.trim(),j=S.length>0&&!d.some(v=>P(v,u)===S);return t.jsxs(t.Fragment,{children:[j?t.jsxs(W,{value:`use ${S}`,onSelect:()=>{x(S),f()},children:[t.jsx(pe,{className:"mr-2 h-3.5 w-3.5 opacity-60"}),t.jsxs("span",{className:"truncate",children:["Use ",t.jsx("span",{className:"font-medium",children:S})]})]}):null,d.map(v=>{const o=P(v,u),y=o===l;return t.jsxs(W,{value:`${v.name} ${v.slug} ${v.entity_type} ${o}`,onSelect:()=>{x(o||void 0),f()},children:[t.jsx(we,{className:T("mr-2 h-4 w-4",y?"opacity-100":"opacity-0")}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"truncate",children:v.name}),t.jsx("div",{className:"text-xs text-muted-foreground",children:v.slug})]})]},`${v.id}-${o}`)})]})}}):t.jsx(q,{id:s,"aria-label":a,type:b?"number":"text",value:l,onChange:f=>x(f.target.value||void 0),disabled:i})}function M({fieldPath:s,fieldKey:r,prop:e,value:i,onChange:a,isRequired:m,readonly:u,control:b,compact:c=!1,orgContext:x}){const n=e.description||E(r),d=Be(s),l=u||e.readOnly===!0,$=!c&&b?t.jsx(Me,{control:b}):null,f=e.type==="object"||!!e.properties,w=e.type==="array"&&!!e.items&&(e.items?.type==="object"||!!e.items?.properties),S=e.type==="array"&&!!e.items&&(e.items?.type==="string"||e.items?.type==="number"||e.items?.type==="integer"||e.items?.type==="boolean");if(e.type==="boolean")return t.jsxs("div",{className:c?"flex items-center":"flex items-center space-x-2 py-1",children:[t.jsx(le,{id:d,"aria-label":c?n:void 0,checked:i??!1,onCheckedChange:o=>a(o),disabled:l}),c?null:t.jsxs(V,{htmlFor:d,className:"flex items-center gap-1.5 font-normal",children:[n,$]})]});let j;if(e.enum&&Array.isArray(e.enum))j=t.jsxs(oe,{value:i==null?"":String(i),onValueChange:o=>a(o===""?void 0:e.type==="number"||e.type==="integer"?Number(o):o),disabled:l,children:[t.jsx(de,{id:d,"aria-label":c?n:void 0,children:t.jsx(ce,{placeholder:`Select ${n.toLowerCase()}`})}),t.jsx(me,{children:e.enum.map(o=>{const y=String(o);return t.jsx(ue,{value:y,children:E(y)},y)})})]});else if(e["x-link-entity-type"])j=t.jsx(qe,{id:d,value:i,onChange:a,readonly:l,ariaLabel:c?n:void 0,entityType:e["x-link-entity-type"],lookupField:e["x-link-lookup-field"]||"slug",numeric:e.type==="number"||e.type==="integer",orgContext:x});else if(e.type==="number"||e.type==="integer")j=t.jsx(fe,{id:d,ariaLabel:c?n:void 0,value:i,onChange:a,integer:e.type==="integer",placeholder:`Enter ${n.toLowerCase()}`,readOnly:l});else if(f){const o=Object.entries(e.properties??{}),y=new Set(e.required??[]),L=R(i)?i:{};j=o.length===0||!R(i)&&i!==void 0&&i!==null?t.jsx(G,{id:d,value:i,ariaLabel:`${n} JSON object`,readOnly:l,onChange:a}):t.jsx("fieldset",{"aria-label":c?n:void 0,"aria-labelledby":c?void 0:`${d}-label`,className:"space-y-3 rounded-md border p-3",children:o.map(([p,k])=>t.jsx(M,{fieldPath:`${s}.${p}`,fieldKey:p,prop:k,value:L[p],onChange:g=>{const h={...L};g===void 0?delete h[p]:h[p]=g,a(h)},isRequired:y.has(p),readonly:l,orgContext:x},p))})}else if(S)j=i!=null&&!xe(i)?t.jsx(_,{id:d,value:i,ariaLabel:`${n} JSON array`,readOnly:l,itemType:e.items?.type,itemEnum:e.items?.enum,minItems:e.minItems,maxItems:e.maxItems,onChange:a}):t.jsx(he,{id:d,value:i,itemType:e.items?.type,itemEnum:e.items?.enum,minItems:e.minItems,maxItems:e.maxItems,ariaLabel:c?n:void 0,readOnly:l,showHelp:!c,onChange:a});else if(w&&e.items){const o=Array.isArray(i)?i:[],y=Object.entries(e.items.properties??{}),L=new Set(e.items.required??[]),p=e.maxItems===void 0||o.length<e.maxItems,k=e.minItems===void 0||o.length>e.minItems;j=!Array.isArray(i)&&i!==void 0&&i!==null||y.length>0&&o.some(g=>!R(g))?t.jsx(_,{id:d,value:i,ariaLabel:`${n} JSON array`,readOnly:l,itemType:"object",minItems:e.minItems,maxItems:e.maxItems,onChange:a}):y.length===0?t.jsxs("fieldset",{"aria-label":c?n:void 0,"aria-labelledby":c?void 0:`${d}-label`,className:"space-y-3",children:[o.length===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No rows"}):o.map((g,h)=>t.jsxs("fieldset",{className:"space-y-2 rounded-md border p-3",children:[t.jsxs("legend",{className:"px-1 text-xs font-medium text-muted-foreground",children:["Row ",h+1]}),t.jsx(G,{id:`${d}-${h}-json`,value:g,ariaLabel:`${n} row ${h+1} JSON object`,readOnly:l,onChange:A=>{const N=[...o];N[h]=A,a(N)}}),l?null:t.jsxs(I,{type:"button",variant:"ghost",size:"sm","aria-label":`Remove row ${h+1}`,disabled:!k,onClick:()=>a(o.filter((A,N)=>N!==h)),children:[t.jsx(Q,{className:"mr-1.5 h-4 w-4"}),"Remove row"]})]},`${s}.${h}`)),l?null:t.jsxs(I,{type:"button",variant:"outline",size:"sm",disabled:!p,onClick:()=>a([...o,{}]),children:[t.jsx(X,{className:"mr-1.5 h-4 w-4"}),"Add row"]})]}):t.jsxs("fieldset",{"aria-label":c?n:void 0,"aria-labelledby":c?void 0:`${d}-label`,className:"space-y-3",children:[t.jsx("div",{className:"rounded-md border",children:t.jsxs(be,{children:[t.jsx(je,{children:t.jsxs(z,{children:[y.map(([g,h])=>t.jsxs(Z,{children:[h.description||E(g),L.has(g)?t.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]},g)),l?null:t.jsx(Z,{className:"w-12"})]})}),t.jsx(ye,{children:o.length===0?t.jsx(z,{children:t.jsx(B,{colSpan:y.length+(l?0:1),className:"text-sm text-muted-foreground",children:"No rows"})}):o.map((g,h)=>{const A=R(g)?g:{};return t.jsxs(z,{children:[y.map(([N,F])=>t.jsx(B,{className:"align-top",children:t.jsx(M,{fieldPath:`${s}.${h}.${N}`,fieldKey:N,prop:F,value:A[N],onChange:H=>{const Y=[...o],D={...A};H===void 0?delete D[N]:D[N]=H,Y[h]=D,a(Y)},isRequired:L.has(N),readonly:l,compact:!0,orgContext:x})},N)),l?null:t.jsx(B,{className:"align-top",children:t.jsx(I,{type:"button",variant:"ghost",size:"icon","aria-label":`Remove row ${h+1}`,disabled:!k,onClick:()=>a(o.filter((N,F)=>F!==h)),children:t.jsx(Q,{className:"h-4 w-4"})})})]},`${s}.${h}`)})})]})}),l?null:t.jsxs(I,{type:"button",variant:"outline",size:"sm",disabled:!p,onClick:()=>a([...o,{}]),children:[t.jsx(X,{className:"mr-1.5 h-4 w-4"}),"Add row"]})]})}else if(e.type==="array")j=t.jsx(_,{id:d,value:i,ariaLabel:`${n} JSON array`,readOnly:l,itemType:e.items?.type,itemEnum:e.items?.enum,minItems:e.minItems,maxItems:e.maxItems,onChange:a});else if(e.format==="date")j=t.jsx(te,{id:d,value:typeof i=="string"?i:void 0,onChange:a,readonly:l,ariaLabel:c?n:void 0});else if(e.format==="date-time")j=t.jsx(te,{id:d,value:typeof i=="string"?i:void 0,onChange:a,readonly:l,ariaLabel:c?n:void 0,includeTime:!0});else{const o=e.format==="uri"||e.format==="url";j=t.jsx(q,{id:d,"aria-label":c?n:void 0,type:o?"url":"text",value:i??"",onChange:y=>a(y.target.value||void 0),placeholder:o?"https://example.com":`Enter ${n.toLowerCase()}`,disabled:l})}if(c)return j;const v=f||w;return t.jsxs("div",{className:"space-y-1.5",children:[v?t.jsxs("p",{id:`${d}-label`,className:"flex items-center gap-1.5 text-sm font-medium",children:[t.jsxs("span",{children:[n,m?t.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]}),$]}):t.jsxs(V,{htmlFor:d,className:"flex items-center gap-1.5",children:[t.jsxs("span",{children:[n,m?t.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]}),$]}),j]})}function We(s){const r={};for(const[e,i]of Object.entries(s)){const a=ne(i);a==null||a===""||(r[e]=a)}return r}function Ke({schema:s,values:r,onValuesChange:e,readonly:i=!1,fieldControls:a,orgContext:m}){const u=s,b=u?.properties,c=new Set(u?.required??[]),x=(n,d)=>{e({...r,[n]:d})};return!b||Object.keys(b).length===0?t.jsx("p",{className:"text-sm text-muted-foreground py-2",children:"No additional fields required for this entity type."}):t.jsx("div",{className:"space-y-4",children:Object.entries(b).map(([n,d])=>"x-measure"in d||"x-dimension"in d?null:t.jsx(M,{fieldPath:n,fieldKey:n,prop:d,value:r[n],onChange:l=>x(n,l),isRequired:c.has(n),readonly:i,control:a?.[n],orgContext:m},n))})}const Je=O.forwardRef(({className:s,orientation:r="horizontal",decorative:e=!0,...i},a)=>t.jsx(ie,{ref:a,decorative:e,orientation:r,className:T("shrink-0 bg-border",r==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...i}));Je.displayName=ie.displayName;function se(s,r){const e=s?.properties;if(e)return Object.entries(e).find(([,i])=>i[r])?.[0]}function He(s){const r=s.trim(),e=r.split(/[\s._@/-]+/).filter(Boolean),i=e.length>=2?`${e[0][0]}${e[1][0]}`:(e[0]??r).slice(0,2);let a=0;for(let m=0;m<r.length;m++)a=a*31+r.charCodeAt(m)>>>0;return{initials:i.toUpperCase()||"?",hue:a%360}}function Ye(s){const[r,e]=O.useState();return O.useEffect(()=>{if(!s){e(void 0);return}let i=!1;const a=s.trim().toLowerCase();return crypto.subtle.digest("SHA-256",new TextEncoder().encode(a)).then(m=>{i||e(Array.from(new Uint8Array(m)).map(u=>u.toString(16).padStart(2,"0")).join(""))}),()=>{i=!0}},[s]),r?`https://www.gravatar.com/avatar/${r}?d=identicon&s=80`:void 0}function et({metadata:s,metadataSchema:r,name:e,typeIcon:i,className:a="h-6 w-6",iconClassName:m="h-5 w-5",initialsFallback:u=!1}){const b=se(r,"x-image"),c=se(r,"x-email"),x=b&&s?.[b]||void 0,n=c&&s?.[c]||void 0,d=Ye(x?void 0:n),l=x||d,[$,f]=O.useState(!1);if(O.useEffect(()=>{f(!1)},[l]),l&&!$)return t.jsx("img",{src:l,alt:e,referrerPolicy:"no-referrer",onError:()=>f(!0),className:T("rounded-full object-cover border border-border",a)});if(u){const w=e.trim()||n||Ge(s,r)||e,{initials:S,hue:j}=He(w);return t.jsx("span",{role:"img","aria-label":e,className:T("inline-grid place-items-center rounded-full border border-border font-semibold text-white select-none",a),style:{background:`oklch(0.55 0.13 ${j})`,fontSize:"0.85em"},children:S})}return t.jsx(Ce,{icon:i,className:m})}function Ge(s,r){if(!s)return;const e=r?.properties,i=["email","handle","username","login","github","x_handle","slug"],a=Object.keys(e||s);for(const m of a)if(i.includes(m.toLowerCase())){const u=s[m];if(typeof u=="string"&&u.trim())return u}}function Qe(s,r){if(typeof s!="string"||!r||r.length===0)return s;const e=s.trim();if(r.includes(e))return e;try{const i=JSON.parse(e);if(typeof i=="string"&&r.includes(i))return i}catch{}return s}function tt(s,r){if(!s)return{};const e=r?.properties;return e?Object.fromEntries(Object.entries(s).map(([i,a])=>[i,Qe(a,e[i]?.enum)])):{...s}}export{Ke as D,et as E,Je as S,tt as a,We as c,Qe as n};
|
|
1
|
+
import{r as O,j as t,aB as ae,ek as ne,ag as le,a6 as V,bR as oe,bS as de,bT as ce,bU as me,bV as ue,gc as fe,gd as R,ge as G,gf as xe,gg as _,gh as he,B as I,bu as Q,P as X,eS as be,eT as je,eU as z,eV as Z,eW as ye,eX as B,a7 as q,fY as ge,gi as Ne,cB as ve,cC as W,gj as pe,aL as we,af as T,dO as Se,x as $e,cM as Oe,cN as Ie,ab as Te,gk as Le,cO as Ae,cp as Ee,cq as ke,cP as Re,ct as Pe,cQ as C,cI as Ce}from"./index-B2AmRqYh.js";import{C as Fe}from"./calendar-DAiyi1ZL.js";var De="Separator",K="horizontal",_e=["horizontal","vertical"],re=O.forwardRef((s,r)=>{const{decorative:e,orientation:i=K,...a}=s,m=ze(i)?i:K,b=e?{role:"none"}:{"aria-orientation":m==="vertical"?m:void 0,role:"separator"};return t.jsx(ae.div,{"data-orientation":m,...b,...a,ref:r})});re.displayName=De;function ze(s){return _e.includes(s)}var ie=re;function E(s){return String(s??"").split(/[_-]/).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}function Be(s){return s.replace(/[^a-zA-Z0-9_-]/g,"-")}const Ue=/^\d{4}-\d{2}-\d{2}$/;function J(s){if(Ue.test(s)){const[r,e,i]=s.split("-").map(Number),a=new Date(0);return a.setHours(0,0,0,0),a.setFullYear(r,e-1,i),a}return new Date(s)}function Ve(s,r=!1){if(!s)return r?"Pick a date and time":"Pick a date";const e=J(s);return Number.isNaN(e.getTime())?s:r?e.toLocaleString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"}):C(e,"LLL dd, y")}function U(s){if(!s)return"";const r=J(s);if(Number.isNaN(r.getTime()))return"";const e=r.getTimezoneOffset()*6e4;return new Date(r.getTime()-e).toISOString().slice(0,16)}function ee(s){if(!s)return;const r=new Date(s);if(!Number.isNaN(r.getTime()))return r.toISOString()}function P(s,r){const e=r==="slug"?s.slug:s.metadata?.[r];return e==null?"":String(e)}function Me({control:s}){const r=[s.set_by,s.set_at?$e(s.set_at):null].filter(Boolean).join(" · ");return t.jsxs(Oe,{children:[t.jsx(Ie,{asChild:!0,children:t.jsxs(Te,{variant:"outline",className:"gap-1 border-emerald-500/30 bg-emerald-500/10 text-[10px] uppercase tracking-wide text-emerald-600 dark:text-emerald-400",children:[t.jsx(Le,{className:"h-3 w-3"}),"You"]})}),t.jsxs(Ae,{className:"max-w-xs space-y-1",children:[t.jsx("div",{className:"text-xs font-medium",children:"Human-owned field"}),s.note?t.jsx("div",{className:"text-xs text-primary-foreground/90",children:s.note}):null,r?t.jsx("div",{className:"text-[11px] text-primary-foreground/70",children:r}):null]})]})}function te({id:s,value:r,onChange:e,readonly:i,ariaLabel:a,includeTime:m=!1}){const u=r?J(r):void 0,[b,c]=O.useState(()=>U(r).slice(11));return O.useEffect(()=>{c(U(r).slice(11))},[r]),t.jsx("div",{className:"relative",children:t.jsxs(Ee,{children:[t.jsx(ke,{asChild:!0,children:t.jsxs(I,{id:s,"aria-label":a,type:"button",variant:"outline",disabled:i,className:T("w-full justify-start rounded-md bg-muted px-3 text-left font-normal",!r&&"text-muted-foreground"),children:[t.jsx(Re,{className:"mr-2 h-4 w-4 shrink-0"}),t.jsx("span",{className:"truncate",children:Ve(r,m)})]})}),t.jsxs(Pe,{className:"w-auto space-y-3 p-0",align:"start",children:[t.jsx(Fe,{mode:"single",selected:u,defaultMonth:u,onSelect:x=>{if(!x)return;if(!m){e(C(x,"yyyy-MM-dd"));return}const n=b||"00:00";e(ee(`${C(x,"yyyy-MM-dd")}T${n}`))},initialFocus:!0}),m?t.jsxs("div",{className:"border-t p-3 pt-0",children:[t.jsx(V,{htmlFor:`${s}-time`,className:"text-xs text-muted-foreground",children:"Time"}),t.jsx(q,{id:`${s}-time`,type:"time",value:b,onChange:x=>{c(x.target.value);const n=r?U(r).slice(0,10):u?C(u,"yyyy-MM-dd"):"";n&&e(ee(`${n}T${x.target.value}`))},disabled:i})]}):null]})]})})}function qe({id:s,value:r,onChange:e,readonly:i,ariaLabel:a,entityType:m,lookupField:u,numeric:b=!1,orgContext:c}){const x=f=>{if(f===void 0||f==="")return e(void 0);if(!b)return e(f);const w=Number(f);e(Number.isFinite(w)?w:f)},{data:n}=ge(m,c,{limit:Ne}),d=(n?.entities??[]).filter(f=>P(f,u)!==""),l=r==null?"":String(r),$=d.find(f=>P(f,u)===l);return c?i?t.jsx("div",{className:"flex h-9 items-center rounded-md border border-input bg-muted px-3 text-sm",children:$?.name||l||"-"}):t.jsx(ve,{contentClassName:"w-[320px]",searchPlaceholder:`Search ${E(m).toLowerCase()}...`,emptyText:`No ${m} found.`,trigger:f=>t.jsxs(I,{id:s,"aria-label":a,type:"button",variant:"outline",role:"combobox","aria-expanded":f,className:"w-full justify-between",children:[t.jsx("span",{className:T("truncate",!l&&"text-muted-foreground"),children:$?.name||l||`Select ${E(m).toLowerCase()}`}),t.jsx(Se,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]}),children:(f,w)=>{const S=w.trim(),j=S.length>0&&!d.some(v=>P(v,u)===S);return t.jsxs(t.Fragment,{children:[j?t.jsxs(W,{value:`use ${S}`,onSelect:()=>{x(S),f()},children:[t.jsx(pe,{className:"mr-2 h-3.5 w-3.5 opacity-60"}),t.jsxs("span",{className:"truncate",children:["Use ",t.jsx("span",{className:"font-medium",children:S})]})]}):null,d.map(v=>{const o=P(v,u),y=o===l;return t.jsxs(W,{value:`${v.name} ${v.slug} ${v.entity_type} ${o}`,onSelect:()=>{x(o||void 0),f()},children:[t.jsx(we,{className:T("mr-2 h-4 w-4",y?"opacity-100":"opacity-0")}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"truncate",children:v.name}),t.jsx("div",{className:"text-xs text-muted-foreground",children:v.slug})]})]},`${v.id}-${o}`)})]})}}):t.jsx(q,{id:s,"aria-label":a,type:b?"number":"text",value:l,onChange:f=>x(f.target.value||void 0),disabled:i})}function M({fieldPath:s,fieldKey:r,prop:e,value:i,onChange:a,isRequired:m,readonly:u,control:b,compact:c=!1,orgContext:x}){const n=e.description||E(r),d=Be(s),l=u||e.readOnly===!0,$=!c&&b?t.jsx(Me,{control:b}):null,f=e.type==="object"||!!e.properties,w=e.type==="array"&&!!e.items&&(e.items?.type==="object"||!!e.items?.properties),S=e.type==="array"&&!!e.items&&(e.items?.type==="string"||e.items?.type==="number"||e.items?.type==="integer"||e.items?.type==="boolean");if(e.type==="boolean")return t.jsxs("div",{className:c?"flex items-center":"flex items-center space-x-2 py-1",children:[t.jsx(le,{id:d,"aria-label":c?n:void 0,checked:i??!1,onCheckedChange:o=>a(o),disabled:l}),c?null:t.jsxs(V,{htmlFor:d,className:"flex items-center gap-1.5 font-normal",children:[n,$]})]});let j;if(e.enum&&Array.isArray(e.enum))j=t.jsxs(oe,{value:i==null?"":String(i),onValueChange:o=>a(o===""?void 0:e.type==="number"||e.type==="integer"?Number(o):o),disabled:l,children:[t.jsx(de,{id:d,"aria-label":c?n:void 0,children:t.jsx(ce,{placeholder:`Select ${n.toLowerCase()}`})}),t.jsx(me,{children:e.enum.map(o=>{const y=String(o);return t.jsx(ue,{value:y,children:E(y)},y)})})]});else if(e["x-link-entity-type"])j=t.jsx(qe,{id:d,value:i,onChange:a,readonly:l,ariaLabel:c?n:void 0,entityType:e["x-link-entity-type"],lookupField:e["x-link-lookup-field"]||"slug",numeric:e.type==="number"||e.type==="integer",orgContext:x});else if(e.type==="number"||e.type==="integer")j=t.jsx(fe,{id:d,ariaLabel:c?n:void 0,value:i,onChange:a,integer:e.type==="integer",placeholder:`Enter ${n.toLowerCase()}`,readOnly:l});else if(f){const o=Object.entries(e.properties??{}),y=new Set(e.required??[]),L=R(i)?i:{};j=o.length===0||!R(i)&&i!==void 0&&i!==null?t.jsx(G,{id:d,value:i,ariaLabel:`${n} JSON object`,readOnly:l,onChange:a}):t.jsx("fieldset",{"aria-label":c?n:void 0,"aria-labelledby":c?void 0:`${d}-label`,className:"space-y-3 rounded-md border p-3",children:o.map(([p,k])=>t.jsx(M,{fieldPath:`${s}.${p}`,fieldKey:p,prop:k,value:L[p],onChange:g=>{const h={...L};g===void 0?delete h[p]:h[p]=g,a(h)},isRequired:y.has(p),readonly:l,orgContext:x},p))})}else if(S)j=i!=null&&!xe(i)?t.jsx(_,{id:d,value:i,ariaLabel:`${n} JSON array`,readOnly:l,itemType:e.items?.type,itemEnum:e.items?.enum,minItems:e.minItems,maxItems:e.maxItems,onChange:a}):t.jsx(he,{id:d,value:i,itemType:e.items?.type,itemEnum:e.items?.enum,minItems:e.minItems,maxItems:e.maxItems,ariaLabel:c?n:void 0,readOnly:l,showHelp:!c,onChange:a});else if(w&&e.items){const o=Array.isArray(i)?i:[],y=Object.entries(e.items.properties??{}),L=new Set(e.items.required??[]),p=e.maxItems===void 0||o.length<e.maxItems,k=e.minItems===void 0||o.length>e.minItems;j=!Array.isArray(i)&&i!==void 0&&i!==null||y.length>0&&o.some(g=>!R(g))?t.jsx(_,{id:d,value:i,ariaLabel:`${n} JSON array`,readOnly:l,itemType:"object",minItems:e.minItems,maxItems:e.maxItems,onChange:a}):y.length===0?t.jsxs("fieldset",{"aria-label":c?n:void 0,"aria-labelledby":c?void 0:`${d}-label`,className:"space-y-3",children:[o.length===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No rows"}):o.map((g,h)=>t.jsxs("fieldset",{className:"space-y-2 rounded-md border p-3",children:[t.jsxs("legend",{className:"px-1 text-xs font-medium text-muted-foreground",children:["Row ",h+1]}),t.jsx(G,{id:`${d}-${h}-json`,value:g,ariaLabel:`${n} row ${h+1} JSON object`,readOnly:l,onChange:A=>{const N=[...o];N[h]=A,a(N)}}),l?null:t.jsxs(I,{type:"button",variant:"ghost",size:"sm","aria-label":`Remove row ${h+1}`,disabled:!k,onClick:()=>a(o.filter((A,N)=>N!==h)),children:[t.jsx(Q,{className:"mr-1.5 h-4 w-4"}),"Remove row"]})]},`${s}.${h}`)),l?null:t.jsxs(I,{type:"button",variant:"outline",size:"sm",disabled:!p,onClick:()=>a([...o,{}]),children:[t.jsx(X,{className:"mr-1.5 h-4 w-4"}),"Add row"]})]}):t.jsxs("fieldset",{"aria-label":c?n:void 0,"aria-labelledby":c?void 0:`${d}-label`,className:"space-y-3",children:[t.jsx("div",{className:"rounded-md border",children:t.jsxs(be,{children:[t.jsx(je,{children:t.jsxs(z,{children:[y.map(([g,h])=>t.jsxs(Z,{children:[h.description||E(g),L.has(g)?t.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]},g)),l?null:t.jsx(Z,{className:"w-12"})]})}),t.jsx(ye,{children:o.length===0?t.jsx(z,{children:t.jsx(B,{colSpan:y.length+(l?0:1),className:"text-sm text-muted-foreground",children:"No rows"})}):o.map((g,h)=>{const A=R(g)?g:{};return t.jsxs(z,{children:[y.map(([N,F])=>t.jsx(B,{className:"align-top",children:t.jsx(M,{fieldPath:`${s}.${h}.${N}`,fieldKey:N,prop:F,value:A[N],onChange:H=>{const Y=[...o],D={...A};H===void 0?delete D[N]:D[N]=H,Y[h]=D,a(Y)},isRequired:L.has(N),readonly:l,compact:!0,orgContext:x})},N)),l?null:t.jsx(B,{className:"align-top",children:t.jsx(I,{type:"button",variant:"ghost",size:"icon","aria-label":`Remove row ${h+1}`,disabled:!k,onClick:()=>a(o.filter((N,F)=>F!==h)),children:t.jsx(Q,{className:"h-4 w-4"})})})]},`${s}.${h}`)})})]})}),l?null:t.jsxs(I,{type:"button",variant:"outline",size:"sm",disabled:!p,onClick:()=>a([...o,{}]),children:[t.jsx(X,{className:"mr-1.5 h-4 w-4"}),"Add row"]})]})}else if(e.type==="array")j=t.jsx(_,{id:d,value:i,ariaLabel:`${n} JSON array`,readOnly:l,itemType:e.items?.type,itemEnum:e.items?.enum,minItems:e.minItems,maxItems:e.maxItems,onChange:a});else if(e.format==="date")j=t.jsx(te,{id:d,value:typeof i=="string"?i:void 0,onChange:a,readonly:l,ariaLabel:c?n:void 0});else if(e.format==="date-time")j=t.jsx(te,{id:d,value:typeof i=="string"?i:void 0,onChange:a,readonly:l,ariaLabel:c?n:void 0,includeTime:!0});else{const o=e.format==="uri"||e.format==="url";j=t.jsx(q,{id:d,"aria-label":c?n:void 0,type:o?"url":"text",value:i??"",onChange:y=>a(y.target.value||void 0),placeholder:o?"https://example.com":`Enter ${n.toLowerCase()}`,disabled:l})}if(c)return j;const v=f||w;return t.jsxs("div",{className:"space-y-1.5",children:[v?t.jsxs("p",{id:`${d}-label`,className:"flex items-center gap-1.5 text-sm font-medium",children:[t.jsxs("span",{children:[n,m?t.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]}),$]}):t.jsxs(V,{htmlFor:d,className:"flex items-center gap-1.5",children:[t.jsxs("span",{children:[n,m?t.jsx("span",{className:"text-destructive ml-1",children:"*"}):null]}),$]}),j]})}function We(s){const r={};for(const[e,i]of Object.entries(s)){const a=ne(i);a==null||a===""||(r[e]=a)}return r}function Ke({schema:s,values:r,onValuesChange:e,readonly:i=!1,fieldControls:a,orgContext:m}){const u=s,b=u?.properties,c=new Set(u?.required??[]),x=(n,d)=>{e({...r,[n]:d})};return!b||Object.keys(b).length===0?t.jsx("p",{className:"text-sm text-muted-foreground py-2",children:"No additional fields required for this entity type."}):t.jsx("div",{className:"space-y-4",children:Object.entries(b).map(([n,d])=>"x-measure"in d||"x-dimension"in d?null:t.jsx(M,{fieldPath:n,fieldKey:n,prop:d,value:r[n],onChange:l=>x(n,l),isRequired:c.has(n),readonly:i,control:a?.[n],orgContext:m},n))})}const Je=O.forwardRef(({className:s,orientation:r="horizontal",decorative:e=!0,...i},a)=>t.jsx(ie,{ref:a,decorative:e,orientation:r,className:T("shrink-0 bg-border",r==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",s),...i}));Je.displayName=ie.displayName;function se(s,r){const e=s?.properties;if(e)return Object.entries(e).find(([,i])=>i[r])?.[0]}function He(s){const r=s.trim(),e=r.split(/[\s._@/-]+/).filter(Boolean),i=e.length>=2?`${e[0][0]}${e[1][0]}`:(e[0]??r).slice(0,2);let a=0;for(let m=0;m<r.length;m++)a=a*31+r.charCodeAt(m)>>>0;return{initials:i.toUpperCase()||"?",hue:a%360}}function Ye(s){const[r,e]=O.useState();return O.useEffect(()=>{if(!s){e(void 0);return}let i=!1;const a=s.trim().toLowerCase();return crypto.subtle.digest("SHA-256",new TextEncoder().encode(a)).then(m=>{i||e(Array.from(new Uint8Array(m)).map(u=>u.toString(16).padStart(2,"0")).join(""))}),()=>{i=!0}},[s]),r?`https://www.gravatar.com/avatar/${r}?d=identicon&s=80`:void 0}function et({metadata:s,metadataSchema:r,name:e,typeIcon:i,className:a="h-6 w-6",iconClassName:m="h-5 w-5",initialsFallback:u=!1}){const b=se(r,"x-image"),c=se(r,"x-email"),x=b&&s?.[b]||void 0,n=c&&s?.[c]||void 0,d=Ye(x?void 0:n),l=x||d,[$,f]=O.useState(!1);if(O.useEffect(()=>{f(!1)},[l]),l&&!$)return t.jsx("img",{src:l,alt:e,referrerPolicy:"no-referrer",onError:()=>f(!0),className:T("rounded-full object-cover border border-border",a)});if(u){const w=e.trim()||n||Ge(s,r)||e,{initials:S,hue:j}=He(w);return t.jsx("span",{role:"img","aria-label":e,className:T("inline-grid place-items-center rounded-full border border-border font-semibold text-white select-none",a),style:{background:`oklch(0.55 0.13 ${j})`,fontSize:"0.85em"},children:S})}return t.jsx(Ce,{icon:i,className:m})}function Ge(s,r){if(!s)return;const e=r?.properties,i=["email","handle","username","login","github","x_handle","slug"],a=Object.keys(e||s);for(const m of a)if(i.includes(m.toLowerCase())){const u=s[m];if(typeof u=="string"&&u.trim())return u}}function Qe(s,r){if(typeof s!="string"||!r||r.length===0)return s;const e=s.trim();if(r.includes(e))return e;try{const i=JSON.parse(e);if(typeof i=="string"&&r.includes(i))return i}catch{}return s}function tt(s,r){if(!s)return{};const e=r?.properties;return e?Object.fromEntries(Object.entries(s).map(([i,a])=>[i,Qe(a,e[i]?.enum)])):{...s}}export{Ke as D,et as E,Je as S,tt as a,We as c,Qe as n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i4 as t,j as n}from"./index-B2AmRqYh.js";import{a as s}from"./agents-workbench-C2sr5h82.js";import"./agent-editor-form-BYC4uSNz.js";import"./model-selector-CapL1ARf.js";import"./proposal-review-shell-D4YNrrye.js";import"./runs-oHveuEUB.js";function c(){const{owner:o,agentId:r}=t.useParams(),e=t.useSearch();return n.jsx(s,{owner:o,agentId:r,tab:"settings",runId:e.run_id})}export{c as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as i,j as e,L as c,a1 as l,af as t,aP as a,B as m,al as d}from"./index-
|
|
1
|
+
import{p as i,j as e,L as c,a1 as l,af as t,aP as a,B as m,al as d}from"./index-B2AmRqYh.js";import{F as o}from"./full-page-spinner-Dd8eEaxq.js";function h(){const{session:s,isReady:n}=i();if(!n)return e.jsx(o,{});if(!s||!s.user)return e.jsx("div",{className:"container mx-auto py-8 px-4",children:e.jsxs("div",{className:"max-w-md mx-auto text-center space-y-4",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Not signed in"}),e.jsx("p",{className:"text-muted-foreground",children:"Please sign in to view your settings."}),e.jsx(c,{to:"/auth/login",search:l({intent:"sign-in"}),className:"inline-block px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:"Sign In"})]})});const r=async()=>{await d(),window.location.href="/"};return e.jsx("div",{className:"container mx-auto py-8 px-4",children:e.jsxs("div",{className:"max-w-2xl mx-auto space-y-8",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Settings"}),e.jsx("p",{className:"text-muted-foreground",children:"Manage your account settings"})]}),e.jsxs("div",{className:t(a,"p-6 space-y-6"),children:[e.jsx("h2",{className:"text-lg font-medium",children:"Profile"}),e.jsxs("div",{className:"flex items-center gap-4",children:[s.user.image?e.jsx("img",{src:s.user.image,alt:s.user.name||"User",referrerPolicy:"no-referrer",className:"h-16 w-16 rounded-full object-cover"}):e.jsx("div",{className:"h-16 w-16 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx("span",{className:"text-xl font-medium text-primary",children:(s.user.name||s.user.email||"U")[0].toUpperCase()})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-medium",children:s.user.name||"User"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s.user.email})]})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Name"}),e.jsx("p",{className:"mt-1",children:s.user.name||"Not set"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Email"}),e.jsx("p",{className:"mt-1",children:s.user.email})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"User ID"}),e.jsx("p",{className:"mt-1 text-xs font-mono text-muted-foreground",children:s.user.id})]})]})]}),e.jsxs("div",{className:t(a,"p-6 space-y-4"),children:[e.jsx("h2",{className:"text-lg font-medium",children:"Account"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sign out of your account on this device."}),e.jsx(m,{variant:"destructive",onClick:r,children:"Sign Out"})]})]})})}export{h as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i3 as r,j as t,Y as s}from"./index-B2AmRqYh.js";import{A as e}from"./agent-skill-context-BAr2Dw3F.js";import"./core.esm-QA7BQgiK.js";import"./skill-editor-D_W3QlRz.js";function p(){const{agentId:o}=r.useParams();return t.jsx(e,{agentId:o,children:t.jsx(s,{})})}export{p as component};
|