@lobu/runtime-server 20.0.1 → 20.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/catalogs/connectors.json +98 -1
- package/dist/component.json +1 -1
- package/dist/connectors/chat-user-identity.ts +45 -0
- package/dist/connectors/google-identity.ts +107 -0
- package/dist/connectors/google_drive.ts +36 -151
- package/dist/connectors/google_gmail.ts +149 -0
- package/dist/connectors/microsoft_outlook.ts +193 -0
- package/dist/connectors/slack-identity.ts +20 -0
- package/dist/dependencies.bun.lock +42 -42
- package/dist/owletto/dist/assets/_-CfcfHJO8.js +1 -0
- package/dist/owletto/dist/assets/{_-BTmsEMQo.js → _-DdvHIadV.js} +2 -2
- package/dist/owletto/dist/assets/_agentId-BTmFhpb6.js +1 -0
- package/dist/owletto/dist/assets/{_agentId-DON3NuNk.js → _agentId-DbTBU4KZ.js} +1 -1
- package/dist/owletto/dist/assets/{_automationId-Bprfhhg8.js → _automationId-C7dZzg6X.js} +1 -1
- package/dist/owletto/dist/assets/{_connectorKey._connectionId-75LMK1pB.js → _connectorKey._connectionId-NQf43Ew3.js} +1 -1
- package/dist/owletto/dist/assets/{_connectorKey.index-N0fJPz8N.js → _connectorKey.index-D-0ZNsgM.js} +1 -1
- package/dist/owletto/dist/assets/{_conversationId-BY5q9MHG.js → _conversationId-F5YmyLV9.js} +1 -1
- package/dist/owletto/dist/assets/{_deploymentId-DFh2d5Pm.js → _deploymentId-3LTMi0ZT.js} +1 -1
- package/dist/owletto/dist/assets/_name-BKeZbc-h.js +1 -0
- package/dist/owletto/dist/assets/{_owner-B92z-CVu.js → _owner-DglbbDEx.js} +1 -1
- package/dist/owletto/dist/assets/_skillKey-DhiGYYFq.js +1 -0
- package/dist/owletto/dist/assets/{_slug-CvHxtUEf.js → _slug-CnQDfsCE.js} +1 -1
- package/dist/owletto/dist/assets/{accept-invitation-CXSrxBJN.js → accept-invitation-Dgoyublh.js} +1 -1
- package/dist/owletto/dist/assets/{activity-route-view-C9W2Ipni.js → activity-route-view-BNzKO6aD.js} +1 -1
- package/dist/owletto/dist/assets/{agent-card-controls-CLupkefQ.js → agent-card-controls-VJgcB5-0.js} +1 -1
- package/dist/owletto/dist/assets/{agent-client-setup-list-DgFv4h0W.js → agent-client-setup-list-C5KRNRw3.js} +1 -1
- package/dist/owletto/dist/assets/{agent-connect-pages-DT8R_qnj.js → agent-connect-pages-BFSb6vmW.js} +1 -1
- package/dist/owletto/dist/assets/{agent-editor-form-ayUg3Ws1.js → agent-editor-form-CajEehVn.js} +1 -1
- package/dist/owletto/dist/assets/{agent-guardrails-route-D-b6CIt2.js → agent-guardrails-route-CZ_rXj-3.js} +1 -1
- package/dist/owletto/dist/assets/{agent-loading-shells-DjMpSoub.js → agent-loading-shells-Dczhk067.js} +1 -1
- package/dist/owletto/dist/assets/{agent-permissions-matrix-BuGatiEq.js → agent-permissions-matrix-DIVHvpZG.js} +1 -1
- package/dist/owletto/dist/assets/{agent-skill-context-DKpIFmCh.js → agent-skill-context-CxglCznW.js} +1 -1
- package/dist/owletto/dist/assets/{agent-skills-route-DqIMttMK.js → agent-skills-route-CatU8soC.js} +1 -1
- package/dist/owletto/dist/assets/{agent-subpage-shell-Bojgj1uq.js → agent-subpage-shell-DVSUdIBn.js} +1 -1
- package/dist/owletto/dist/assets/agent-thread-DnLUOzXk.js +134 -0
- package/dist/owletto/dist/assets/agents-OLmcj-qM.js +1 -0
- package/dist/owletto/dist/assets/{agents-workbench-BojDv6gX.js → agents-workbench-BOKifKIO.js} +1 -1
- package/dist/owletto/dist/assets/{app._appId-DNNB5FaI.js → app._appId-BXmITXO7.js} +1 -1
- package/dist/owletto/dist/assets/{automation-detail-content-CzqrHc4P.js → automation-detail-content-wJC9hhmA.js} +1 -1
- package/dist/owletto/dist/assets/automations-OLmcj-qM.js +1 -0
- package/dist/owletto/dist/assets/{calendar-VAaxHxss.js → calendar-taCoBmAh.js} +1 -1
- package/dist/owletto/dist/assets/{callback-0VB9tUCF.js → callback-CJxC8u_x.js} +1 -1
- package/dist/owletto/dist/assets/{card-HMQT7vU5.js → card-kpw3EaKC.js} +1 -1
- package/dist/owletto/dist/assets/{claim-C2-YTMw-.js → claim-DLHRN0bA.js} +1 -1
- package/dist/owletto/dist/assets/{clients-C0I3V7XE.js → clients-R4JsT_Fz.js} +1 -1
- package/dist/owletto/dist/assets/{code-editor-hOZHdlxM.js → code-editor-D3X0yQdI.js} +1 -1
- package/dist/owletto/dist/assets/connect-1ysEq9l0.js +1 -0
- package/dist/owletto/dist/assets/connect._clientId-BbMPs6l3.js +1 -0
- package/dist/owletto/dist/assets/{connected._clientId-BFuU4-8j.js → connected._clientId-ByH4etku.js} +1 -1
- package/dist/owletto/dist/assets/{connection-De_2AD46.js → connection-DdBkXNbX.js} +1 -1
- package/dist/owletto/dist/assets/{connection-feed-detail-Cbn85fG9.js → connection-feed-detail-DF93zx0A.js} +1 -1
- package/dist/owletto/dist/assets/{connector-provenance-B17-ze5S.js → connector-provenance-N3sc0nbo.js} +1 -1
- package/dist/owletto/dist/assets/{connectors-KnNED_-4.js → connectors-Ckn_aoNE.js} +1 -1
- package/dist/owletto/dist/assets/{consent-BOYb4pNu.js → consent-Bi6KCVtT.js} +1 -1
- package/dist/owletto/dist/assets/{core.esm-COW6Pfy6.js → core.esm-CFYXLQXH.js} +1 -1
- package/dist/owletto/dist/assets/{create-BFpUZ_mU.js → create-BiHpu2f4.js} +1 -1
- package/dist/owletto/dist/assets/create-C37QtjbJ.js +1 -0
- package/dist/owletto/dist/assets/{create-automation-form-CRenA7Ix.js → create-automation-form-Cv2RHsQ6.js} +1 -1
- package/dist/owletto/dist/assets/create-kAQa5_Q7.js +1 -0
- package/dist/owletto/dist/assets/{create._connectorKey-D4dIDQIQ.js → create._connectorKey-Qynix_hA.js} +1 -1
- package/dist/owletto/dist/assets/{cronstrue-BrlFh5Jy.js → cronstrue-D7xlYtGk.js} +1 -1
- package/dist/owletto/dist/assets/deployments-C5kSeowq.js +1 -0
- package/dist/owletto/dist/assets/{deployments-body-CXqfjLqj.js → deployments-body-BPCALbQe.js} +1 -1
- package/dist/owletto/dist/assets/{device-B0BBIdVx.js → device-DToHXxDM.js} +1 -1
- package/dist/owletto/dist/assets/{device-pin-tombstone-BBYes4en.js → device-pin-tombstone-DrTJYNKG.js} +1 -1
- package/dist/owletto/dist/assets/{device-rows-E63OZ9Cp.js → device-rows-fVm-zAiU.js} +1 -1
- package/dist/owletto/dist/assets/{device._deviceId-JN0cUCGe.js → device._deviceId-CIe7taim.js} +1 -1
- package/dist/owletto/dist/assets/{entity-options-qan9-Ycm.js → entity-options-DOGD_EyZ.js} +1 -1
- package/dist/owletto/dist/assets/{entity-page-CozUOlVP.js → entity-page-C8oDszRY.js} +1 -1
- package/dist/owletto/dist/assets/{entity-type-page-xISySjVW.js → entity-type-page-BfxIgJLq.js} +1 -1
- package/dist/owletto/dist/assets/{events-feed-DmZ3Ig3X.js → events-feed-B9OqmSBy.js} +1 -1
- package/dist/owletto/dist/assets/{full-page-spinner-Q_J5Wcop.js → full-page-spinner-DTSqneUO.js} +1 -1
- package/dist/owletto/dist/assets/guardrails-9Mr6avxk.js +1 -0
- package/dist/owletto/dist/assets/identity-DMfCjdBz.js +1 -0
- package/dist/owletto/dist/assets/{index-BKZMzuMS.js → index-Bfux0kHb.js} +34 -34
- package/dist/owletto/dist/assets/{index-pKfsEvLt.js → index-Bq4m-sK0.js} +1 -1
- package/dist/owletto/dist/assets/{index-CGx4og7r.js → index-CK2-iHcz.js} +1 -1
- package/dist/owletto/dist/assets/{index-C78ucWDF.js → index-CMOHHdFH.js} +1 -1
- package/dist/owletto/dist/assets/{index-BwVojwkg.js → index-COgBJ_ab.js} +1 -1
- package/dist/owletto/dist/assets/index-CkwwaMrx.js +1 -0
- package/dist/owletto/dist/assets/index-D0lZrXrY.js +1 -0
- package/dist/owletto/dist/assets/{index-DmB-3GhU.js → index-DYe_DVHa.js} +1 -1
- package/dist/owletto/dist/assets/index-DZadnZpq.js +1 -0
- package/dist/owletto/dist/assets/{index-DLZbFRSM.js → index-DcWyuLQS.js} +1 -1
- package/dist/owletto/dist/assets/{index-BwN9pHNs.js → index-DkKALC2l.js} +1 -1
- package/dist/owletto/dist/assets/index-DlqjyZKQ.js +1 -0
- package/dist/owletto/dist/assets/index-Dv0huHrO.js +1 -0
- package/dist/owletto/dist/assets/index-DxIDxgPJ.js +1 -0
- package/dist/owletto/dist/assets/index-bKUccXCc.js +1 -0
- package/dist/owletto/dist/assets/{index-C9Dtjaoi.js → index-jGZeANLE.js} +1 -1
- package/dist/owletto/dist/assets/{json-diff-1FNS_wGA.js → json-diff-CANZD4MQ.js} +1 -1
- package/dist/owletto/dist/assets/{list-skeleton-B6gjzr8t.js → list-skeleton-DZTUxpBx.js} +1 -1
- package/dist/owletto/dist/assets/{login-S9EGV_EA.js → login-D53geSP7.js} +1 -1
- package/dist/owletto/dist/assets/{logout-BOXPSr57.js → logout-DKQS25qd.js} +1 -1
- package/dist/owletto/dist/assets/{member-scope-gate-yGr4lrGD.js → member-scope-gate-C4QyRm2Q.js} +1 -1
- package/dist/owletto/dist/assets/{memory-browse-page-5n3MvqdS.js → memory-browse-page-DOpV3vht.js} +1 -1
- package/dist/owletto/dist/assets/{model-selector-9ZRlR7Sa.js → model-selector-CvU3VP90.js} +1 -1
- package/dist/owletto/dist/assets/models-ooBIWFuB.js +1 -0
- package/dist/owletto/dist/assets/new-B8_sRMYD.js +1 -0
- package/dist/owletto/dist/assets/{new-D4wlbvAZ.js → new-DIjOVXrQ.js} +1 -1
- package/dist/owletto/dist/assets/{new-BeZJOJgR.js → new-Df1q7GEj.js} +1 -1
- package/dist/owletto/dist/assets/{oauth-workspace-access-DoE-9F42.js → oauth-workspace-access-DWfiekRz.js} +1 -1
- package/dist/owletto/dist/assets/{organization-BezNEJK7.js → organization-DHEC7kDq.js} +1 -1
- package/dist/owletto/dist/assets/{permissions-GkKtC6a5.js → permissions-i7iwnE1a.js} +1 -1
- package/dist/owletto/dist/assets/{proposal-review-shell-Bk9D_9YN.js → proposal-review-shell-C_LcyUEF.js} +1 -1
- package/dist/owletto/dist/assets/{recent-BVvscz1V.js → recent-By19_Buq.js} +1 -1
- package/dist/owletto/dist/assets/{renderer-CAyr3B3s.js → renderer-B1UThnk2.js} +1 -1
- package/dist/owletto/dist/assets/{reset-password-atCMI5uQ.js → reset-password-Dsz5-Xeo.js} +1 -1
- package/dist/owletto/dist/assets/{runs-CftQDTkq.js → runs-BQ11PAQT.js} +1 -1
- package/dist/owletto/dist/assets/{runs-panel-BkRtr_C4.js → runs-panel-wkV1aGD9.js} +1 -1
- package/dist/owletto/dist/assets/{runs-table-CWCl38L5.js → runs-table-DzSWYkaf.js} +1 -1
- package/dist/owletto/dist/assets/{schema-value-normalization-C9Lm83-q.js → schema-value-normalization--DhnhJNf.js} +1 -1
- package/dist/owletto/dist/assets/{settings-CgTgofgd.js → settings-Bu239SXe.js} +1 -1
- package/dist/owletto/dist/assets/settings-FxbIvOhH.js +1 -0
- package/dist/owletto/dist/assets/skills-MBZ5ilDK.js +1 -0
- package/dist/owletto/dist/assets/{switch-BOGbkDQb.js → switch-CCKllS7w.js} +1 -1
- package/dist/owletto/dist/assets/{use-mention-search-C9ckRw0s.js → use-mention-search-CldNZTiT.js} +1 -1
- package/dist/owletto/dist/index.html +1 -1
- package/dist/server-main.bundle.mjs +3950 -3509
- package/npm-shrinkwrap.json +164 -160
- package/package.json +1 -1
- package/vendor/connector-sdk/dist/file-output.d.ts +97 -0
- package/vendor/connector-sdk/dist/file-output.js +176 -0
- package/vendor/connector-sdk/dist/index.d.ts +2 -0
- package/vendor/connector-sdk/dist/index.js +1 -0
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/classify-error.js +50 -2
- package/vendor/core/dist/constants.d.ts +13 -6
- package/vendor/core/dist/constants.js +22 -8
- package/vendor/core/dist/errors.d.ts +20 -0
- package/vendor/core/dist/errors.js +21 -1
- package/vendor/core/package.json +1 -1
- package/dist/owletto/dist/assets/_-ea0K1u_g.js +0 -1
- package/dist/owletto/dist/assets/_agentId-qF8hi8Cf.js +0 -1
- package/dist/owletto/dist/assets/_name-OY_X_Zm-.js +0 -1
- package/dist/owletto/dist/assets/_skillKey-CeEE23_w.js +0 -1
- package/dist/owletto/dist/assets/agent-thread-R8Pego9t.js +0 -134
- package/dist/owletto/dist/assets/agents-C9x76gSX.js +0 -1
- package/dist/owletto/dist/assets/automations-C9x76gSX.js +0 -1
- package/dist/owletto/dist/assets/connect-DSr_gD8x.js +0 -1
- package/dist/owletto/dist/assets/connect._clientId-CTamwGrw.js +0 -1
- package/dist/owletto/dist/assets/create-CblXKFGZ.js +0 -1
- package/dist/owletto/dist/assets/create-ChUbSYvl.js +0 -1
- package/dist/owletto/dist/assets/deployments-DTFrUY7p.js +0 -1
- package/dist/owletto/dist/assets/guardrails-BB9iOxE3.js +0 -1
- package/dist/owletto/dist/assets/identity-DYbfG4hU.js +0 -1
- package/dist/owletto/dist/assets/index-7d9B918E.js +0 -1
- package/dist/owletto/dist/assets/index-BsDA0XzK.js +0 -1
- package/dist/owletto/dist/assets/index-C4Lz_gB-.js +0 -1
- package/dist/owletto/dist/assets/index-CO65Rkad.js +0 -1
- package/dist/owletto/dist/assets/index-CT_kxGkR.js +0 -1
- package/dist/owletto/dist/assets/index-CrKgNtiq.js +0 -1
- package/dist/owletto/dist/assets/index-DUIbfL6x.js +0 -1
- package/dist/owletto/dist/assets/models-LOhfJ0sb.js +0 -1
- package/dist/owletto/dist/assets/new-Dxn1qrmS.js +0 -1
- package/dist/owletto/dist/assets/settings-BKMOjfYf.js +0 -1
- package/dist/owletto/dist/assets/skills-DWr8qR3U.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cE as ae,g1 as T,an as O,ao as A,ag as ie,j as s,aj as Q,dl as le,dm as ce,dn as ue,cU as ye,cV as re,aD as oe,r as S,c7 as he,c8 as je,cl as de,L as X,df as z,X as ve,de as be,P as ke}from"./index-BKZMzuMS.js";const $={auto:0,approval:1,deny:2,disabled:2};function ee(t,n){return`${ie}/api/${t}/agent/${encodeURIComponent(n)}/permissions`}function fe(t,n){return["agent-permissions",typeof t=="string"?t:t?.slug??null,n]}function Ne(t,n,r){return ae({queryKey:fe(t,n),enabled:(r?.enabled??!0)&&!!n,queryFn:async()=>{const e=T(t??void 0),o=await O(ee(e.slug,n),{credentials:"include"});if(!o.ok)throw await A(o);return await o.json()},staleTime:3e4})}async function we(t,n,r){const e=T(t),o=await O(ee(e.slug,n),{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(r)});if(!o.ok)throw await A(o);const l=await o.json();if(!l.policy)throw new Error("Agent permission update did not return a policy.");return l.policy}async function Ee(t,n,r){const e=T(t),o=new URLSearchParams;o.set("resource_class",r.resource_class),r.entity_type_slug&&o.set("entity_type_slug",r.entity_type_slug),r.operation_key&&o.set("operation_key",r.operation_key),r.target_agent_id&&o.set("target_agent_id",r.target_agent_id);const l=await O(`${ee(e.slug,n)}?${o.toString()}`,{method:"DELETE",credentials:"include"});if(!l.ok)throw await A(l);return(await l.json()).deleted===!0}function te(t){return`${ie}/api/${t}/write-permissions`}function me(t){return["write-permissions",typeof t=="string"?t:t?.slug??null]}function Se(t,n){return ae({queryKey:me(t),enabled:n?.enabled??!0,queryFn:async()=>{const r=T(t??void 0),e=await O(te(r.slug),{credentials:"include"});if(!e.ok)throw await A(e);return await e.json()},staleTime:3e4})}async function $e(t,n){const r=T(t),e=await O(te(r.slug),{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)});if(!e.ok)throw await A(e);const o=await e.json();if(!o.policy)throw new Error("Org write permission update did not return a policy.");return o.policy}async function Te(t,n){const r=T(t),e=new URLSearchParams;e.set("resource_class",n.resource_class),n.entity_type_slug&&e.set("entity_type_slug",n.entity_type_slug),n.operation_key&&e.set("operation_key",n.operation_key),n.target_agent_id&&e.set("target_agent_id",n.target_agent_id);const o=await O(`${te(r.slug)}?${e.toString()}`,{method:"DELETE",credentials:"include"});if(!o.ok)throw await A(o);return(await o.json()).deleted===!0}const W={entity:["read","create","update","delete"],agent_config:["read","create","update","delete"],connector_action:["execute"],entity_schema:["create_type","update_type","delete_type","create_relationship_type","update_relationship_type","delete_relationship_type"]},Oe={entity:{read:"auto",create:"auto",update:"auto",delete:"approval"},agent_config:{read:"auto",create:"approval",update:"approval",delete:"deny"},connector_action:{execute:"auto"},entity_schema:{create_type:"auto",update_type:"auto",delete_type:"auto",create_relationship_type:"auto",update_relationship_type:"auto",delete_relationship_type:"auto"}};function Ae(t,n){return(t==="entity"||t==="agent_config")&&n==="read"?["auto","deny"]:Re[t]}const Re={entity:["auto","approval","deny"],agent_config:["auto","approval","deny"],connector_action:["auto","approval","deny","disabled"],entity_schema:["auto","approval","deny"]},pe={auto:"Auto",approval:"Approval",deny:"Deny",disabled:"Disabled"},Ce={auto:"Auto-approve",approval:"Requires approval",deny:"Deny",disabled:"Disabled"};function H(t,n){return t.effects?.[n]}function Fe(t,n){return $[t]<$[n]}function q(t,n){return $[t]!==$[n]?$[t]>$[n]?t:n:t==="deny"||n==="deny"?"deny":t}function ne(t,n,r,e,o=null,l=null){let c=null;for(const a of t){if(a.resource_class!==n||a.field_path!==null||a.entity_id!==null||a.entity_type_slug!==null&&a.entity_type_slug!==e||a.operation_key!==null&&a.operation_key!==o||a.target_agent_id!==null&&a.target_agent_id!==l)continue;const m=H(a,r);m&&(c=c===null?m:q(c,m))}return c??Oe[n]?.[r]??"deny"}function se(t,n,r,e,o=null,l=null){return t.some(c=>c.resource_class!==n||c.field_path!==null||c.entity_id!==null||c.entity_type_slug!==null&&c.entity_type_slug!==e||c.operation_key!==null&&c.operation_key!==o||c.target_agent_id!==null&&c.target_agent_id!==l?!1:H(c,r)!==void 0)}function Le(t,n,r){const e=U(t,n,null);return e?H(e,r)!==void 0:!1}function U(t,n,r,e=null,o=null){return t.find(l=>l.resource_class===n&&(l.entity_type_slug??null)===r&&(l.operation_key??null)===e&&(l.target_agent_id??null)===o)}function Pe(t,n,r,e=null,o=null){const l=U(t.agent,n,r,e,o),c={};if(!l?.effects)return c;for(const a of W[n]){const m=l.effects[a];m&&(c[a]=m)}return c}function h(t,n,r,e,o=null,l=null){const c=ne(t.floor,n,r,e,o,l),a=se(t.floor,n,r,e,o,l),m=e!==null||o!==null||l!==null?U(t.agent,n,e,o,l):void 0,j=U(t.agent,n,null);let p=null;for(const v of[j,m]){const x=v&&H(v,r);x&&(p=p===null?x:q(p,x))}return p===null?c:a?q(p,c):p}function Me(t){const{option:n,floor:r}=t;return Fe(n,r)?{disabled:!0,reason:`Below org floor (${Ce[r]})`}:{disabled:!1}}function De(t){const n=new Set;for(const e of t.agent)e.resource_class==="entity"&&e.entity_type_slug&&n.add(e.entity_type_slug);for(const e of t.floor)e.resource_class==="entity"&&e.entity_type_slug&&e.field_path===null&&e.entity_id===null&&n.add(e.entity_type_slug);const r=new Map(t.entity_types.map(e=>[e.slug,e]));return[...n].map(e=>r.get(e)??{slug:e,name:e})}function Be(t,n){return t.agent.some(r=>r.resource_class==="entity"&&r.entity_type_slug===n)}function Qe(t,n){let r=0;for(const e of W.entity){const o=h(t,"entity",e,null);h(t,"entity",e,n)!==o&&(r+=1)}return r}function qe(t){const n=new Set;for(const e of t.agent)e.resource_class==="connector_action"&&e.operation_key&&n.add(e.operation_key);for(const e of t.floor)e.resource_class==="connector_action"&&e.operation_key&&n.add(e.operation_key);const r=new Map(t.connector_operations.map(e=>[e.operation_key,e]));return[...n].map(e=>r.get(e)??{operation_key:e,name:e,connector_key:e.split("::")[0]??e,connector_name:e.split("::")[0]??e})}function Ue(t,n){return t.agent.some(r=>r.resource_class==="connector_action"&&r.operation_key===n)}function We(t,n){const r=h(t,"connector_action","execute",null),e=h(t,"connector_action","execute",null,n);return r!==e}function He(t){const n=new Set;for(const e of t.agent)e.resource_class==="agent_config"&&e.target_agent_id&&n.add(e.target_agent_id);for(const e of t.floor)e.resource_class==="agent_config"&&e.target_agent_id&&n.add(e.target_agent_id);const r=new Map(t.agents.map(e=>[e.id,e]));return[...n].map(e=>r.get(e)??{id:e,name:e})}function Je(t,n){return t.agent.some(r=>r.resource_class==="agent_config"&&r.target_agent_id===n)}function Ke(t,n){let r=0;for(const e of W.agent_config){const o=h(t,"agent_config",e,null);h(t,"agent_config",e,null,null,n)!==o&&(r+=1)}return r}const Ge={auto:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400",approval:"bg-amber-500/15 text-amber-600 dark:text-amber-400",deny:"bg-red-500/15 text-red-600 dark:text-red-400",disabled:"bg-muted text-foreground"},Ve={auto:"Auto",approval:"Ask",deny:"Deny",disabled:"Off"};function Xe({options:t,value:n,floor:r,onChange:e,disabled:o,ariaLabel:l,compact:c}){return s.jsx("div",{role:"radiogroup","aria-label":l,className:Q("inline-flex shrink-0 items-stretch gap-0.5 rounded-lg border border-border bg-muted/40 p-0.5"),children:t.map(a=>{const m=Me({option:a,floor:r}),j=a===n,p=m.disabled&&!j,v=c?Ve[a]:pe[a],x=s.jsx("button",{type:"button",role:"radio","aria-checked":j,disabled:o||p,onClick:()=>{!j&&!p&&!o&&e(a)},className:Q("inline-flex shrink-0 items-center justify-center whitespace-nowrap font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",c?"min-w-[3rem] rounded-md px-2.5 py-1.5 text-xs leading-none":"min-w-[3.25rem] rounded-md px-3 py-1.5 text-sm leading-none",j?Q(Ge[a],""):"text-muted-foreground hover:bg-background/60 hover:text-foreground",p&&"cursor-not-allowed opacity-40",o&&!p&&"cursor-not-allowed opacity-60"),children:v},a);return p&&m.reason?s.jsxs(le,{children:[s.jsx(ce,{asChild:!0,children:s.jsx("span",{className:"inline-flex shrink-0",children:x})}),s.jsx(ue,{children:m.reason})]},a):x})})}const ze=[{resourceClass:"entity",title:"Entities",sub:"Defaults for every type · exceptions below"},{resourceClass:"connector_action",title:"Connector writes",sub:"Write ops only · reads follow the connection"},{resourceClass:"agent_config",title:"Agents",sub:"Read peers · create / edit / delete · exceptions below"}];function Ye(t,n,r,e,o=null,l=null){const c=ne(t.floor,n,r,e,o,l),a=se(t.floor,n,r,e,o,l)?c:"auto";return(e!==null||o!==null||l!==null)&&Le(t.agent,n,r)?q(a,h(t,n,r,null)):a}function B({response:t,resourceClass:n,action:r,entityTypeSlug:e,operationKey:o=null,targetAgentId:l=null,dimmed:c,pending:a,onSave:m}){const j=ne(t.floor,n,r,e,o,l),p=se(t.floor,n,r,e,o,l),v=h(t,n,r,e,o,l),x=Ye(t,n,r,e,o,l),w=Ae(n,r),y=e??o??l??"default",E=s.jsx("div",{className:Q("inline-flex shrink-0",c&&"opacity-45"),children:s.jsx(Xe,{options:w,value:v,floor:x,disabled:a,compact:!0,ariaLabel:`${y} ${r}`,onChange:m})});return p?s.jsxs(le,{children:[s.jsx(ce,{asChild:!0,children:s.jsx("span",{className:"inline-flex shrink-0",children:E})}),s.jsxs(ue,{children:["Org floor ",pe[j]," — can only go stricter"]})]}):E}function Ze(t,n){const r=o=>o.resource_class===n.resource_class&&(o.entity_type_slug??null)===(n.entity_type_slug??null)&&(o.operation_key??null)===(n.operation_key??null)&&(o.target_agent_id??null)===(n.target_agent_id??null),e=t.map(o=>r(o)?n:o);return e.some(r)?e:[...e,n]}function Ie(t,n,r,e,o,l,c){const a=Pe(t,n,r,e,o);return a[l]=c,a}const Y="font-medium text-foreground hover:text-primary hover:underline";function et({type:t}){return s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx(de,{icon:t.icon,className:"h-3.5 w-3.5 shrink-0"}),s.jsx("span",{className:"font-medium",children:t.name}),s.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:t.slug})]})}function Z({label:t,disabled:n,hint:r,searchPlaceholder:e,emptyText:o,children:l}){return n?s.jsxs("div",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:[t,r?` ${r}`:""]}):s.jsx(be,{contentClassName:"w-[min(100vw-2rem,22rem)]",searchPlaceholder:e,emptyText:o,trigger:c=>s.jsxs("button",{type:"button","aria-expanded":c,className:"flex w-full items-center gap-1.5 px-3 py-1.5 text-left text-xs text-primary hover:bg-muted/50",children:[s.jsx(ke,{className:"h-3 w-3"}),t]}),children:c=>l(c)})}function I({pending:t,onClick:n,label:r}){return s.jsx("button",{type:"button",disabled:t,onClick:n,"aria-label":r,className:"rounded p-0.5 text-muted-foreground hover:bg-red-500/10 hover:text-red-600 disabled:opacity-50 dark:hover:text-red-400",children:s.jsx(ve,{className:"h-3 w-3"})})}function C(t,n){const c=`repeat(${t}, minmax(${10.25}rem, 1fr))`;return{gridTemplateColumns:n?`minmax(${5.5}rem, 8rem) ${c} ${1.5}rem`:`minmax(${5.5}rem, 8rem) ${c}`,minWidth:`${5.5+t*10.25+1.5+2}rem`}}function nt({owner:t,agentId:n,variant:r="agent"}){const e=r==="org-floor",o=ye(),l=Ne(t,n??"",{enabled:!e&&!!n}),c=Se(t,{enabled:e}),{data:a,isLoading:m,isError:j,error:p}=e?c:l,v=e?me(t):fe(t,n??""),x=re({mutationFn:u=>e?$e(t,u):we(t,n??"",u),onSuccess:u=>{o.setQueryData(v,f=>f&&{...f,agent:Ze(f.agent,u)}),o.invalidateQueries({queryKey:v}),e&&o.invalidateQueries({queryKey:["agent-permissions"]})},onError:u=>{oe.error(u instanceof Error?u.message:"Failed to save permission")}}),w=re({mutationFn:u=>e?Te(t,u):Ee(t,n??"",u),onSuccess:()=>{o.invalidateQueries({queryKey:v}),e&&o.invalidateQueries({queryKey:["agent-permissions"]})},onError:u=>{oe.error(u instanceof Error?u.message:"Failed to remove override")}}),y=x.isPending||w.isPending,E=S.useMemo(()=>a?De(a):[],[a]),J=S.useMemo(()=>{if(!a)return[];const u=new Set(E.map(f=>f.slug));return a.entity_types.filter(f=>!u.has(f.slug))},[a,E]),K=S.useMemo(()=>a?qe(a):[],[a]),G=S.useMemo(()=>{if(!a)return[];const u=new Set(K.map(f=>f.operation_key));return a.connector_operations.filter(f=>!u.has(f.operation_key))},[a,K]),F=S.useMemo(()=>a?He(a):[],[a]),L=S.useMemo(()=>{if(!a)return[];const u=new Set(F.map(f=>f.id));return a.agents.filter(f=>(e||f.id!==n)&&!u.has(f.id))},[a,F,n,e]);if(m)return s.jsx(he,{label:"permissions",variant:"cards",cards:2});if(j||!a)return s.jsx(je,{label:p instanceof Error?p.message:"permissions"});const g=a,P=(u,f,M,D,b=null,k=null)=>{const i=Ie(g,u,f,b,k,M,D);x.mutate({resource_class:u,effects:i,entity_type_slug:f,operation_key:b,target_agent_id:k})},ge=g.entity_types.length===0?"— none yet":J.length===0?"— all covered":null,_e=g.connector_operations.length===0?"— none installed":G.length===0?"— all covered":null,xe=L.length===0&&F.length===0?"— no other agents":L.length===0?"— all covered":null;return s.jsx("div",{className:"space-y-2",children:ze.map(u=>{const f=u.resourceClass==="entity",M=u.resourceClass==="connector_action",D=u.resourceClass==="agent_config",b=W[u.resourceClass],k=b.length;return s.jsxs("section",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-baseline gap-2 px-0.5",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u.title}),s.jsx("span",{className:"text-[11px] text-muted-foreground",children:u.sub})]}),s.jsxs("div",{className:"",children:[s.jsxs("div",{className:"grid items-center gap-x-3 rounded-md bg-muted/50 px-3 py-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",style:C(k,!0),children:[s.jsx("span",{}),b.map(i=>s.jsx("span",{className:"text-center",children:i},i)),s.jsx("span",{})]}),s.jsxs("div",{className:"grid items-center gap-x-3 px-3 py-1.5",style:C(k,!0),children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Default"}),b.map(i=>s.jsx("div",{className:"flex min-w-0 justify-center overflow-visible",children:s.jsx(B,{response:g,resourceClass:u.resourceClass,action:i,entityTypeSlug:null,pending:y,onSave:d=>P(u.resourceClass,null,i,d)})},i)),s.jsx("span",{})]}),f?E.map(i=>{const d=Be(g,i.slug),N=Qe(g,i.slug);return s.jsxs("div",{className:"grid items-center gap-x-3 px-3 py-1.5",style:C(k,!0),children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx(de,{icon:i.icon,className:"h-3.5 w-3.5 shrink-0"}),s.jsx(X,{to:"/$owner/entity-types/$slug",params:{owner:t,slug:i.slug},className:Y,title:`Open ${i.name}`,children:s.jsx("span",{className:"truncate text-sm",children:i.name})}),d?N>0?s.jsxs("span",{className:"shrink-0 text-[10px] text-amber-600 dark:text-amber-400",children:[N,"≠"]}):null:s.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:"floor"})]}),b.map(_=>{const R=h(g,"entity",_,i.slug)===h(g,"entity",_,null);return s.jsx("div",{className:"flex min-w-0 justify-center",children:s.jsx(B,{response:g,resourceClass:"entity",action:_,entityTypeSlug:i.slug,dimmed:R,pending:y,onSave:V=>P("entity",i.slug,_,V)})},_)}),d?s.jsx(I,{pending:y,label:`Remove ${i.name} exception`,onClick:()=>w.mutate({resource_class:"entity",entity_type_slug:i.slug})}):s.jsx("span",{})]},i.slug)}):null,M?K.map(i=>{const d=Ue(g,i.operation_key),N=We(g,i.operation_key);return s.jsxs("div",{className:"grid items-center gap-x-3 px-3 py-1.5",style:C(k,!0),children:[s.jsxs("div",{className:"flex min-w-0 flex-col gap-0",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx(X,{to:"/$owner/connectors/$connectorKey",params:{owner:t,connectorKey:i.connector_key},className:Y,title:`Open ${i.connector_name}`,children:s.jsx("span",{className:"truncate font-mono text-sm",children:i.name})}),i.destructive?s.jsx("span",{className:"shrink-0 text-[10px] text-amber-600 dark:text-amber-400",children:"!"}):null,d?N?s.jsx("span",{className:"shrink-0 text-[10px] text-amber-600 dark:text-amber-400",children:"≠"}):null:s.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:"floor"})]}),s.jsx("span",{className:"truncate text-[10px] text-muted-foreground",children:i.connector_name})]}),b.map(_=>s.jsx("div",{className:"flex min-w-0 justify-center",children:s.jsx(B,{response:g,resourceClass:"connector_action",action:_,entityTypeSlug:null,operationKey:i.operation_key,dimmed:!N,pending:y,onSave:R=>P("connector_action",null,_,R,i.operation_key)})},_)),d?s.jsx(I,{pending:y,label:`Remove ${i.name} exception`,onClick:()=>w.mutate({resource_class:"connector_action",operation_key:i.operation_key})}):s.jsx("span",{})]},i.operation_key)}):null,D?F.map(i=>{const d=Je(g,i.id),N=Ke(g,i.id);return s.jsxs("div",{className:"grid items-center gap-x-3 px-3 py-1.5",style:C(k,!0),children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx(X,{to:"/$owner/agents/$agentId/settings",params:{owner:t,agentId:i.id},search:{run_id:void 0},className:Y,title:`Open ${i.name}`,children:s.jsx("span",{className:"truncate text-sm",children:i.name})}),d?N>0?s.jsxs("span",{className:"shrink-0 text-[10px] text-amber-600 dark:text-amber-400",children:[N,"≠"]}):null:s.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:"floor"})]}),b.map(_=>{if(_==="create")return s.jsx("div",{className:"text-center text-[10px] text-muted-foreground",children:"—"},_);const R=h(g,"agent_config",_,null,null,i.id)===h(g,"agent_config",_,null);return s.jsx("div",{className:"flex min-w-0 justify-center",children:s.jsx(B,{response:g,resourceClass:"agent_config",action:_,entityTypeSlug:null,targetAgentId:i.id,dimmed:R,pending:y,onSave:V=>P("agent_config",null,_,V,null,i.id)})},_)}),d?s.jsx(I,{pending:y,label:`Remove ${i.name} exception`,onClick:()=>w.mutate({resource_class:"agent_config",target_agent_id:i.id})}):s.jsx("span",{})]},i.id)}):null,s.jsxs("div",{className:"border-t",children:[f?s.jsx(Z,{label:"Add type",disabled:y||J.length===0,hint:ge,searchPlaceholder:"Search types…",emptyText:"No matching types.",children:i=>J.map(d=>s.jsx(z,{value:`${d.name} ${d.slug}`,onSelect:()=>{x.mutate({resource_class:"entity",effects:{},entity_type_slug:d.slug}),i()},className:"cursor-pointer",children:s.jsx(et,{type:d})},d.slug))}):null,M?s.jsx(Z,{label:"Add operation",disabled:y||G.length===0,hint:_e,searchPlaceholder:"Search ops…",emptyText:"No matching ops.",children:i=>G.map(d=>s.jsx(z,{value:`${d.name} ${d.connector_name} ${d.operation_key}`,onSelect:()=>{x.mutate({resource_class:"connector_action",effects:{},operation_key:d.operation_key}),i()},className:"cursor-pointer",children:s.jsxs("span",{className:"flex min-w-0 flex-col",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:d.name}),s.jsx("span",{className:"truncate text-[11px] text-muted-foreground",children:d.connector_name})]})},d.operation_key))}):null,D?s.jsx(Z,{label:"Add agent",disabled:y||L.length===0,hint:xe,searchPlaceholder:"Search agents…",emptyText:"No matching agents.",children:i=>L.map(d=>s.jsxs(z,{value:`${d.name} ${d.id}`,onSelect:()=>{x.mutate({resource_class:"agent_config",effects:{},target_agent_id:d.id}),i()},className:"cursor-pointer",children:[s.jsx("span",{className:"font-medium",children:d.name}),s.jsx("span",{className:"ml-1.5 font-mono text-[10px] text-muted-foreground",children:d.id})]},d.id))}):null]})]})]},u.resourceClass)})})}export{nt as A,Oe as C,Xe as P,$e as a,Te as d,Ae as e,me as o,Se as u};
|
|
1
|
+
import{cE as ae,g1 as T,an as O,ao as A,ag as ie,j as s,aj as Q,dl as le,dm as ce,dn as ue,cU as ye,cV as re,aD as oe,r as S,c7 as he,c8 as je,cl as de,L as X,df as z,X as ve,de as be,P as ke}from"./index-Bfux0kHb.js";const $={auto:0,approval:1,deny:2,disabled:2};function ee(t,n){return`${ie}/api/${t}/agent/${encodeURIComponent(n)}/permissions`}function fe(t,n){return["agent-permissions",typeof t=="string"?t:t?.slug??null,n]}function Ne(t,n,r){return ae({queryKey:fe(t,n),enabled:(r?.enabled??!0)&&!!n,queryFn:async()=>{const e=T(t??void 0),o=await O(ee(e.slug,n),{credentials:"include"});if(!o.ok)throw await A(o);return await o.json()},staleTime:3e4})}async function we(t,n,r){const e=T(t),o=await O(ee(e.slug,n),{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(r)});if(!o.ok)throw await A(o);const l=await o.json();if(!l.policy)throw new Error("Agent permission update did not return a policy.");return l.policy}async function Ee(t,n,r){const e=T(t),o=new URLSearchParams;o.set("resource_class",r.resource_class),r.entity_type_slug&&o.set("entity_type_slug",r.entity_type_slug),r.operation_key&&o.set("operation_key",r.operation_key),r.target_agent_id&&o.set("target_agent_id",r.target_agent_id);const l=await O(`${ee(e.slug,n)}?${o.toString()}`,{method:"DELETE",credentials:"include"});if(!l.ok)throw await A(l);return(await l.json()).deleted===!0}function te(t){return`${ie}/api/${t}/write-permissions`}function me(t){return["write-permissions",typeof t=="string"?t:t?.slug??null]}function Se(t,n){return ae({queryKey:me(t),enabled:n?.enabled??!0,queryFn:async()=>{const r=T(t??void 0),e=await O(te(r.slug),{credentials:"include"});if(!e.ok)throw await A(e);return await e.json()},staleTime:3e4})}async function $e(t,n){const r=T(t),e=await O(te(r.slug),{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(n)});if(!e.ok)throw await A(e);const o=await e.json();if(!o.policy)throw new Error("Org write permission update did not return a policy.");return o.policy}async function Te(t,n){const r=T(t),e=new URLSearchParams;e.set("resource_class",n.resource_class),n.entity_type_slug&&e.set("entity_type_slug",n.entity_type_slug),n.operation_key&&e.set("operation_key",n.operation_key),n.target_agent_id&&e.set("target_agent_id",n.target_agent_id);const o=await O(`${te(r.slug)}?${e.toString()}`,{method:"DELETE",credentials:"include"});if(!o.ok)throw await A(o);return(await o.json()).deleted===!0}const W={entity:["read","create","update","delete"],agent_config:["read","create","update","delete"],connector_action:["execute"],entity_schema:["create_type","update_type","delete_type","create_relationship_type","update_relationship_type","delete_relationship_type"]},Oe={entity:{read:"auto",create:"auto",update:"auto",delete:"approval"},agent_config:{read:"auto",create:"approval",update:"approval",delete:"deny"},connector_action:{execute:"auto"},entity_schema:{create_type:"auto",update_type:"auto",delete_type:"auto",create_relationship_type:"auto",update_relationship_type:"auto",delete_relationship_type:"auto"}};function Ae(t,n){return(t==="entity"||t==="agent_config")&&n==="read"?["auto","deny"]:Re[t]}const Re={entity:["auto","approval","deny"],agent_config:["auto","approval","deny"],connector_action:["auto","approval","deny","disabled"],entity_schema:["auto","approval","deny"]},pe={auto:"Auto",approval:"Approval",deny:"Deny",disabled:"Disabled"},Ce={auto:"Auto-approve",approval:"Requires approval",deny:"Deny",disabled:"Disabled"};function H(t,n){return t.effects?.[n]}function Fe(t,n){return $[t]<$[n]}function q(t,n){return $[t]!==$[n]?$[t]>$[n]?t:n:t==="deny"||n==="deny"?"deny":t}function ne(t,n,r,e,o=null,l=null){let c=null;for(const a of t){if(a.resource_class!==n||a.field_path!==null||a.entity_id!==null||a.entity_type_slug!==null&&a.entity_type_slug!==e||a.operation_key!==null&&a.operation_key!==o||a.target_agent_id!==null&&a.target_agent_id!==l)continue;const m=H(a,r);m&&(c=c===null?m:q(c,m))}return c??Oe[n]?.[r]??"deny"}function se(t,n,r,e,o=null,l=null){return t.some(c=>c.resource_class!==n||c.field_path!==null||c.entity_id!==null||c.entity_type_slug!==null&&c.entity_type_slug!==e||c.operation_key!==null&&c.operation_key!==o||c.target_agent_id!==null&&c.target_agent_id!==l?!1:H(c,r)!==void 0)}function Le(t,n,r){const e=U(t,n,null);return e?H(e,r)!==void 0:!1}function U(t,n,r,e=null,o=null){return t.find(l=>l.resource_class===n&&(l.entity_type_slug??null)===r&&(l.operation_key??null)===e&&(l.target_agent_id??null)===o)}function Pe(t,n,r,e=null,o=null){const l=U(t.agent,n,r,e,o),c={};if(!l?.effects)return c;for(const a of W[n]){const m=l.effects[a];m&&(c[a]=m)}return c}function h(t,n,r,e,o=null,l=null){const c=ne(t.floor,n,r,e,o,l),a=se(t.floor,n,r,e,o,l),m=e!==null||o!==null||l!==null?U(t.agent,n,e,o,l):void 0,j=U(t.agent,n,null);let p=null;for(const v of[j,m]){const x=v&&H(v,r);x&&(p=p===null?x:q(p,x))}return p===null?c:a?q(p,c):p}function Me(t){const{option:n,floor:r}=t;return Fe(n,r)?{disabled:!0,reason:`Below org floor (${Ce[r]})`}:{disabled:!1}}function De(t){const n=new Set;for(const e of t.agent)e.resource_class==="entity"&&e.entity_type_slug&&n.add(e.entity_type_slug);for(const e of t.floor)e.resource_class==="entity"&&e.entity_type_slug&&e.field_path===null&&e.entity_id===null&&n.add(e.entity_type_slug);const r=new Map(t.entity_types.map(e=>[e.slug,e]));return[...n].map(e=>r.get(e)??{slug:e,name:e})}function Be(t,n){return t.agent.some(r=>r.resource_class==="entity"&&r.entity_type_slug===n)}function Qe(t,n){let r=0;for(const e of W.entity){const o=h(t,"entity",e,null);h(t,"entity",e,n)!==o&&(r+=1)}return r}function qe(t){const n=new Set;for(const e of t.agent)e.resource_class==="connector_action"&&e.operation_key&&n.add(e.operation_key);for(const e of t.floor)e.resource_class==="connector_action"&&e.operation_key&&n.add(e.operation_key);const r=new Map(t.connector_operations.map(e=>[e.operation_key,e]));return[...n].map(e=>r.get(e)??{operation_key:e,name:e,connector_key:e.split("::")[0]??e,connector_name:e.split("::")[0]??e})}function Ue(t,n){return t.agent.some(r=>r.resource_class==="connector_action"&&r.operation_key===n)}function We(t,n){const r=h(t,"connector_action","execute",null),e=h(t,"connector_action","execute",null,n);return r!==e}function He(t){const n=new Set;for(const e of t.agent)e.resource_class==="agent_config"&&e.target_agent_id&&n.add(e.target_agent_id);for(const e of t.floor)e.resource_class==="agent_config"&&e.target_agent_id&&n.add(e.target_agent_id);const r=new Map(t.agents.map(e=>[e.id,e]));return[...n].map(e=>r.get(e)??{id:e,name:e})}function Je(t,n){return t.agent.some(r=>r.resource_class==="agent_config"&&r.target_agent_id===n)}function Ke(t,n){let r=0;for(const e of W.agent_config){const o=h(t,"agent_config",e,null);h(t,"agent_config",e,null,null,n)!==o&&(r+=1)}return r}const Ge={auto:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400",approval:"bg-amber-500/15 text-amber-600 dark:text-amber-400",deny:"bg-red-500/15 text-red-600 dark:text-red-400",disabled:"bg-muted text-foreground"},Ve={auto:"Auto",approval:"Ask",deny:"Deny",disabled:"Off"};function Xe({options:t,value:n,floor:r,onChange:e,disabled:o,ariaLabel:l,compact:c}){return s.jsx("div",{role:"radiogroup","aria-label":l,className:Q("inline-flex shrink-0 items-stretch gap-0.5 rounded-lg border border-border bg-muted/40 p-0.5"),children:t.map(a=>{const m=Me({option:a,floor:r}),j=a===n,p=m.disabled&&!j,v=c?Ve[a]:pe[a],x=s.jsx("button",{type:"button",role:"radio","aria-checked":j,disabled:o||p,onClick:()=>{!j&&!p&&!o&&e(a)},className:Q("inline-flex shrink-0 items-center justify-center whitespace-nowrap font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",c?"min-w-[3rem] rounded-md px-2.5 py-1.5 text-xs leading-none":"min-w-[3.25rem] rounded-md px-3 py-1.5 text-sm leading-none",j?Q(Ge[a],""):"text-muted-foreground hover:bg-background/60 hover:text-foreground",p&&"cursor-not-allowed opacity-40",o&&!p&&"cursor-not-allowed opacity-60"),children:v},a);return p&&m.reason?s.jsxs(le,{children:[s.jsx(ce,{asChild:!0,children:s.jsx("span",{className:"inline-flex shrink-0",children:x})}),s.jsx(ue,{children:m.reason})]},a):x})})}const ze=[{resourceClass:"entity",title:"Entities",sub:"Defaults for every type · exceptions below"},{resourceClass:"connector_action",title:"Connector writes",sub:"Write ops only · reads follow the connection"},{resourceClass:"agent_config",title:"Agents",sub:"Read peers · create / edit / delete · exceptions below"}];function Ye(t,n,r,e,o=null,l=null){const c=ne(t.floor,n,r,e,o,l),a=se(t.floor,n,r,e,o,l)?c:"auto";return(e!==null||o!==null||l!==null)&&Le(t.agent,n,r)?q(a,h(t,n,r,null)):a}function B({response:t,resourceClass:n,action:r,entityTypeSlug:e,operationKey:o=null,targetAgentId:l=null,dimmed:c,pending:a,onSave:m}){const j=ne(t.floor,n,r,e,o,l),p=se(t.floor,n,r,e,o,l),v=h(t,n,r,e,o,l),x=Ye(t,n,r,e,o,l),w=Ae(n,r),y=e??o??l??"default",E=s.jsx("div",{className:Q("inline-flex shrink-0",c&&"opacity-45"),children:s.jsx(Xe,{options:w,value:v,floor:x,disabled:a,compact:!0,ariaLabel:`${y} ${r}`,onChange:m})});return p?s.jsxs(le,{children:[s.jsx(ce,{asChild:!0,children:s.jsx("span",{className:"inline-flex shrink-0",children:E})}),s.jsxs(ue,{children:["Org floor ",pe[j]," — can only go stricter"]})]}):E}function Ze(t,n){const r=o=>o.resource_class===n.resource_class&&(o.entity_type_slug??null)===(n.entity_type_slug??null)&&(o.operation_key??null)===(n.operation_key??null)&&(o.target_agent_id??null)===(n.target_agent_id??null),e=t.map(o=>r(o)?n:o);return e.some(r)?e:[...e,n]}function Ie(t,n,r,e,o,l,c){const a=Pe(t,n,r,e,o);return a[l]=c,a}const Y="font-medium text-foreground hover:text-primary hover:underline";function et({type:t}){return s.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s.jsx(de,{icon:t.icon,className:"h-3.5 w-3.5 shrink-0"}),s.jsx("span",{className:"font-medium",children:t.name}),s.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:t.slug})]})}function Z({label:t,disabled:n,hint:r,searchPlaceholder:e,emptyText:o,children:l}){return n?s.jsxs("div",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:[t,r?` ${r}`:""]}):s.jsx(be,{contentClassName:"w-[min(100vw-2rem,22rem)]",searchPlaceholder:e,emptyText:o,trigger:c=>s.jsxs("button",{type:"button","aria-expanded":c,className:"flex w-full items-center gap-1.5 px-3 py-1.5 text-left text-xs text-primary hover:bg-muted/50",children:[s.jsx(ke,{className:"h-3 w-3"}),t]}),children:c=>l(c)})}function I({pending:t,onClick:n,label:r}){return s.jsx("button",{type:"button",disabled:t,onClick:n,"aria-label":r,className:"rounded p-0.5 text-muted-foreground hover:bg-red-500/10 hover:text-red-600 disabled:opacity-50 dark:hover:text-red-400",children:s.jsx(ve,{className:"h-3 w-3"})})}function C(t,n){const c=`repeat(${t}, minmax(${10.25}rem, 1fr))`;return{gridTemplateColumns:n?`minmax(${5.5}rem, 8rem) ${c} ${1.5}rem`:`minmax(${5.5}rem, 8rem) ${c}`,minWidth:`${5.5+t*10.25+1.5+2}rem`}}function nt({owner:t,agentId:n,variant:r="agent"}){const e=r==="org-floor",o=ye(),l=Ne(t,n??"",{enabled:!e&&!!n}),c=Se(t,{enabled:e}),{data:a,isLoading:m,isError:j,error:p}=e?c:l,v=e?me(t):fe(t,n??""),x=re({mutationFn:u=>e?$e(t,u):we(t,n??"",u),onSuccess:u=>{o.setQueryData(v,f=>f&&{...f,agent:Ze(f.agent,u)}),o.invalidateQueries({queryKey:v}),e&&o.invalidateQueries({queryKey:["agent-permissions"]})},onError:u=>{oe.error(u instanceof Error?u.message:"Failed to save permission")}}),w=re({mutationFn:u=>e?Te(t,u):Ee(t,n??"",u),onSuccess:()=>{o.invalidateQueries({queryKey:v}),e&&o.invalidateQueries({queryKey:["agent-permissions"]})},onError:u=>{oe.error(u instanceof Error?u.message:"Failed to remove override")}}),y=x.isPending||w.isPending,E=S.useMemo(()=>a?De(a):[],[a]),J=S.useMemo(()=>{if(!a)return[];const u=new Set(E.map(f=>f.slug));return a.entity_types.filter(f=>!u.has(f.slug))},[a,E]),K=S.useMemo(()=>a?qe(a):[],[a]),G=S.useMemo(()=>{if(!a)return[];const u=new Set(K.map(f=>f.operation_key));return a.connector_operations.filter(f=>!u.has(f.operation_key))},[a,K]),F=S.useMemo(()=>a?He(a):[],[a]),L=S.useMemo(()=>{if(!a)return[];const u=new Set(F.map(f=>f.id));return a.agents.filter(f=>(e||f.id!==n)&&!u.has(f.id))},[a,F,n,e]);if(m)return s.jsx(he,{label:"permissions",variant:"cards",cards:2});if(j||!a)return s.jsx(je,{label:p instanceof Error?p.message:"permissions"});const g=a,P=(u,f,M,D,b=null,k=null)=>{const i=Ie(g,u,f,b,k,M,D);x.mutate({resource_class:u,effects:i,entity_type_slug:f,operation_key:b,target_agent_id:k})},ge=g.entity_types.length===0?"— none yet":J.length===0?"— all covered":null,_e=g.connector_operations.length===0?"— none installed":G.length===0?"— all covered":null,xe=L.length===0&&F.length===0?"— no other agents":L.length===0?"— all covered":null;return s.jsx("div",{className:"space-y-2",children:ze.map(u=>{const f=u.resourceClass==="entity",M=u.resourceClass==="connector_action",D=u.resourceClass==="agent_config",b=W[u.resourceClass],k=b.length;return s.jsxs("section",{className:"space-y-1",children:[s.jsxs("div",{className:"flex items-baseline gap-2 px-0.5",children:[s.jsx("h3",{className:"text-sm font-semibold text-foreground",children:u.title}),s.jsx("span",{className:"text-[11px] text-muted-foreground",children:u.sub})]}),s.jsxs("div",{className:"",children:[s.jsxs("div",{className:"grid items-center gap-x-3 rounded-md bg-muted/50 px-3 py-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",style:C(k,!0),children:[s.jsx("span",{}),b.map(i=>s.jsx("span",{className:"text-center",children:i},i)),s.jsx("span",{})]}),s.jsxs("div",{className:"grid items-center gap-x-3 px-3 py-1.5",style:C(k,!0),children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Default"}),b.map(i=>s.jsx("div",{className:"flex min-w-0 justify-center overflow-visible",children:s.jsx(B,{response:g,resourceClass:u.resourceClass,action:i,entityTypeSlug:null,pending:y,onSave:d=>P(u.resourceClass,null,i,d)})},i)),s.jsx("span",{})]}),f?E.map(i=>{const d=Be(g,i.slug),N=Qe(g,i.slug);return s.jsxs("div",{className:"grid items-center gap-x-3 px-3 py-1.5",style:C(k,!0),children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx(de,{icon:i.icon,className:"h-3.5 w-3.5 shrink-0"}),s.jsx(X,{to:"/$owner/entity-types/$slug",params:{owner:t,slug:i.slug},className:Y,title:`Open ${i.name}`,children:s.jsx("span",{className:"truncate text-sm",children:i.name})}),d?N>0?s.jsxs("span",{className:"shrink-0 text-[10px] text-amber-600 dark:text-amber-400",children:[N,"≠"]}):null:s.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:"floor"})]}),b.map(_=>{const R=h(g,"entity",_,i.slug)===h(g,"entity",_,null);return s.jsx("div",{className:"flex min-w-0 justify-center",children:s.jsx(B,{response:g,resourceClass:"entity",action:_,entityTypeSlug:i.slug,dimmed:R,pending:y,onSave:V=>P("entity",i.slug,_,V)})},_)}),d?s.jsx(I,{pending:y,label:`Remove ${i.name} exception`,onClick:()=>w.mutate({resource_class:"entity",entity_type_slug:i.slug})}):s.jsx("span",{})]},i.slug)}):null,M?K.map(i=>{const d=Ue(g,i.operation_key),N=We(g,i.operation_key);return s.jsxs("div",{className:"grid items-center gap-x-3 px-3 py-1.5",style:C(k,!0),children:[s.jsxs("div",{className:"flex min-w-0 flex-col gap-0",children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx(X,{to:"/$owner/connectors/$connectorKey",params:{owner:t,connectorKey:i.connector_key},className:Y,title:`Open ${i.connector_name}`,children:s.jsx("span",{className:"truncate font-mono text-sm",children:i.name})}),i.destructive?s.jsx("span",{className:"shrink-0 text-[10px] text-amber-600 dark:text-amber-400",children:"!"}):null,d?N?s.jsx("span",{className:"shrink-0 text-[10px] text-amber-600 dark:text-amber-400",children:"≠"}):null:s.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:"floor"})]}),s.jsx("span",{className:"truncate text-[10px] text-muted-foreground",children:i.connector_name})]}),b.map(_=>s.jsx("div",{className:"flex min-w-0 justify-center",children:s.jsx(B,{response:g,resourceClass:"connector_action",action:_,entityTypeSlug:null,operationKey:i.operation_key,dimmed:!N,pending:y,onSave:R=>P("connector_action",null,_,R,i.operation_key)})},_)),d?s.jsx(I,{pending:y,label:`Remove ${i.name} exception`,onClick:()=>w.mutate({resource_class:"connector_action",operation_key:i.operation_key})}):s.jsx("span",{})]},i.operation_key)}):null,D?F.map(i=>{const d=Je(g,i.id),N=Ke(g,i.id);return s.jsxs("div",{className:"grid items-center gap-x-3 px-3 py-1.5",style:C(k,!0),children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx(X,{to:"/$owner/agents/$agentId/settings",params:{owner:t,agentId:i.id},search:{run_id:void 0},className:Y,title:`Open ${i.name}`,children:s.jsx("span",{className:"truncate text-sm",children:i.name})}),d?N>0?s.jsxs("span",{className:"shrink-0 text-[10px] text-amber-600 dark:text-amber-400",children:[N,"≠"]}):null:s.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground",children:"floor"})]}),b.map(_=>{if(_==="create")return s.jsx("div",{className:"text-center text-[10px] text-muted-foreground",children:"—"},_);const R=h(g,"agent_config",_,null,null,i.id)===h(g,"agent_config",_,null);return s.jsx("div",{className:"flex min-w-0 justify-center",children:s.jsx(B,{response:g,resourceClass:"agent_config",action:_,entityTypeSlug:null,targetAgentId:i.id,dimmed:R,pending:y,onSave:V=>P("agent_config",null,_,V,null,i.id)})},_)}),d?s.jsx(I,{pending:y,label:`Remove ${i.name} exception`,onClick:()=>w.mutate({resource_class:"agent_config",target_agent_id:i.id})}):s.jsx("span",{})]},i.id)}):null,s.jsxs("div",{className:"border-t",children:[f?s.jsx(Z,{label:"Add type",disabled:y||J.length===0,hint:ge,searchPlaceholder:"Search types…",emptyText:"No matching types.",children:i=>J.map(d=>s.jsx(z,{value:`${d.name} ${d.slug}`,onSelect:()=>{x.mutate({resource_class:"entity",effects:{},entity_type_slug:d.slug}),i()},className:"cursor-pointer",children:s.jsx(et,{type:d})},d.slug))}):null,M?s.jsx(Z,{label:"Add operation",disabled:y||G.length===0,hint:_e,searchPlaceholder:"Search ops…",emptyText:"No matching ops.",children:i=>G.map(d=>s.jsx(z,{value:`${d.name} ${d.connector_name} ${d.operation_key}`,onSelect:()=>{x.mutate({resource_class:"connector_action",effects:{},operation_key:d.operation_key}),i()},className:"cursor-pointer",children:s.jsxs("span",{className:"flex min-w-0 flex-col",children:[s.jsx("span",{className:"truncate text-sm font-medium",children:d.name}),s.jsx("span",{className:"truncate text-[11px] text-muted-foreground",children:d.connector_name})]})},d.operation_key))}):null,D?s.jsx(Z,{label:"Add agent",disabled:y||L.length===0,hint:xe,searchPlaceholder:"Search agents…",emptyText:"No matching agents.",children:i=>L.map(d=>s.jsxs(z,{value:`${d.name} ${d.id}`,onSelect:()=>{x.mutate({resource_class:"agent_config",effects:{},target_agent_id:d.id}),i()},className:"cursor-pointer",children:[s.jsx("span",{className:"font-medium",children:d.name}),s.jsx("span",{className:"ml-1.5 font-mono text-[10px] text-muted-foreground",children:d.id})]},d.id))}):null]})]})]},u.resourceClass)})})}export{nt as A,Oe as C,Xe as P,$e as a,Te as d,Ae as e,me as o,Se as u};
|
package/dist/owletto/dist/assets/{agent-skill-context-DKpIFmCh.js → agent-skill-context-CxglCznW.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as p,aL as G,ex as ge,ey as pe,gf as be,aD as F,j as ve}from"./index-
|
|
1
|
+
import{r as p,aL as G,ex as ge,ey as pe,gf as be,aD as F,j as ve}from"./index-Bfux0kHb.js";import{K as E,d as me,g as he,e as xe,s as Ce,f as Ie,h as Se,i as Y,b as ke,c as ye,j as we,k as Re,C as H,l as De}from"./core.esm-CFYXLQXH.js";import{s as Ae,b as Ee}from"./skill-editor-D_W3QlRz.js";function K(e,n,t){const r=e.slice();return r.splice(t<0?r.length+t:t,0,r.splice(n,1)[0]),r}function Le(e,n){return e.reduce((t,r,s)=>{const u=n.get(r);return u&&(t[s]=u),t},Array(e.length))}function P(e){return e!==null&&e>=0}function Te(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function Ne(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const V=e=>{let{rects:n,activeIndex:t,overIndex:r,index:s}=e;const u=K(n,r,t),o=n[s],a=u[s];return!a||!o?null:{x:a.left-o.left,y:a.top-o.top,scaleX:a.width/o.width,scaleY:a.height/o.height}},M={scaleX:1,scaleY:1},We=e=>{var n;let{activeIndex:t,activeNodeRect:r,index:s,rects:u,overIndex:o}=e;const a=(n=u[t])!=null?n:r;if(!a)return null;if(s===t){const f=u[o];return f?{x:0,y:t<o?f.top+f.height-(a.top+a.height):f.top-a.top,...M}:null}const m=Oe(u,s,t);return s>t&&s<=o?{x:0,y:-a.height-m,...M}:s<t&&s>=o?{x:0,y:a.height+m,...M}:{x:0,y:0,...M}};function Oe(e,n,t){const r=e[n],s=e[n-1],u=e[n+1];return r?t<n?s?r.top-(s.top+s.height):u?u.top-(r.top+r.height):0:u?u.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const W="Sortable",J=G.createContext({activeIndex:-1,containerId:W,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:V,disabled:{draggable:!1,droppable:!1}});function Je(e){let{children:n,id:t,items:r,strategy:s=V,disabled:u=!1}=e;const{active:o,dragOverlay:a,droppableRects:m,over:f,measureDroppableContainers:i}=Ie(),l=Se(W,t),b=a.rect!==null,h=p.useMemo(()=>r.map(d=>typeof d=="object"&&"id"in d?d.id:d),[r]),k=o!=null,w=o?h.indexOf(o.id):-1,C=f?h.indexOf(f.id):-1,R=p.useRef(h),I=!Te(h,R.current),S=C!==-1&&w===-1||I,c=Ne(u);Y(()=>{I&&k&&i(h)},[I,h,k,i]),p.useEffect(()=>{R.current=h},[h]);const g=p.useMemo(()=>({activeIndex:w,containerId:l,disabled:c,disableTransforms:S,items:h,overIndex:C,useDragOverlay:b,sortedRects:Le(h,m),strategy:s}),[w,l,c.draggable,c.droppable,S,h,C,m,b,s]);return G.createElement(J.Provider,{value:g},n)}const Pe=e=>{let{id:n,items:t,activeIndex:r,overIndex:s}=e;return K(t,r,s).indexOf(n)},Me=e=>{let{containerId:n,isSorting:t,wasDragging:r,index:s,items:u,newIndex:o,previousItems:a,previousContainerId:m,transition:f}=e;return!f||!r||a!==u&&s===o?!1:t?!0:o!==s&&n===m},je={duration:200,easing:"ease"},Q="transform",$e=H.Transition.toString({property:Q,duration:0,easing:"linear"}),ze={roleDescription:"sortable"};function Fe(e){let{disabled:n,index:t,node:r,rect:s}=e;const[u,o]=p.useState(null),a=p.useRef(t);return Y(()=>{if(!n&&t!==a.current&&r.current){const m=s.current;if(m){const f=De(r.current,{ignoreTransform:!0}),i={x:m.left-f.left,y:m.top-f.top,scaleX:m.width/f.width,scaleY:m.height/f.height};(i.x||i.y)&&o(i)}}t!==a.current&&(a.current=t)},[n,t,r,s]),p.useEffect(()=>{u&&o(null)},[u]),u}function Qe(e){let{animateLayoutChanges:n=Me,attributes:t,disabled:r,data:s,getNewIndex:u=Pe,id:o,strategy:a,resizeObserverConfig:m,transition:f=je}=e;const{items:i,containerId:l,activeIndex:b,disabled:h,disableTransforms:k,sortedRects:w,overIndex:C,useDragOverlay:R,strategy:I}=p.useContext(J),S=Ke(r,h),c=i.indexOf(o),g=p.useMemo(()=>({sortable:{containerId:l,index:c,items:i},...s}),[l,s,c,i]),d=p.useMemo(()=>i.slice(i.indexOf(o)),[i,o]),{rect:v,node:y,isOver:D,setNodeRef:L}=ke({id:o,data:g,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:d,...m}}),{active:A,activatorEvent:te,activeNodeRect:ne,attributes:re,setNodeRef:U,listeners:se,isDragging:$,over:oe,setActivatorNodeRef:ae,transform:ie}=ye({id:o,data:g,attributes:{...ze,...t},disabled:S.draggable}),le=we(L,U),T=!!A,X=T&&!k&&P(b)&&P(C),_=!R&&$,q=_&&X?ie:null,ce=X?q??(a??I)({rects:w,activeNodeRect:ne,activeIndex:b,overIndex:C,index:c}):null,O=P(b)&&P(C)?u({id:o,items:i,activeIndex:b,overIndex:C}):c,N=A?.id,x=p.useRef({activeId:N,items:i,newIndex:O,containerId:l}),ue=i!==x.current.items,B=n({active:A,containerId:l,isDragging:$,isSorting:T,id:o,index:c,items:i,newIndex:x.current.newIndex,previousItems:x.current.items,previousContainerId:x.current.containerId,transition:f,wasDragging:x.current.activeId!=null}),z=Fe({disabled:!B,index:c,node:y,rect:v});return p.useEffect(()=>{T&&x.current.newIndex!==O&&(x.current.newIndex=O),l!==x.current.containerId&&(x.current.containerId=l),i!==x.current.items&&(x.current.items=i)},[T,O,l,i]),p.useEffect(()=>{if(N===x.current.activeId)return;if(N!=null&&x.current.activeId==null){x.current.activeId=N;return}const fe=setTimeout(()=>{x.current.activeId=N},50);return()=>clearTimeout(fe)},[N]),{active:A,activeIndex:b,attributes:re,data:g,rect:v,index:c,newIndex:O,items:i,isOver:D,isSorting:T,isDragging:$,listeners:se,node:y,overIndex:C,over:oe,setNodeRef:le,setActivatorNodeRef:ae,setDroppableNodeRef:L,setDraggableNodeRef:U,transform:z??ce,transition:de()};function de(){if(z||ue&&x.current.newIndex===c)return $e;if(!(_&&!Re(te)||!f)&&(T||B))return H.Transition.toString({...f,property:Q})}}function Ke(e,n){var t,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(t=e?.draggable)!=null?t:n.draggable,droppable:(r=e?.droppable)!=null?r:n.droppable}}function j(e){if(!e)return!1;const n=e.data.current;return!!(n&&"sortable"in n&&typeof n.sortable=="object"&&"containerId"in n.sortable&&"items"in n.sortable&&"index"in n.sortable)}const Ue=[E.Down,E.Right,E.Up,E.Left],Ze=(e,n)=>{let{context:{active:t,collisionRect:r,droppableRects:s,droppableContainers:u,over:o,scrollableAncestors:a}}=n;if(Ue.includes(e.code)){if(e.preventDefault(),!t||!r)return;const m=[];u.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const b=s.get(l.id);if(b)switch(e.code){case E.Down:r.top<b.top&&m.push(l);break;case E.Up:r.top>b.top&&m.push(l);break;case E.Left:r.left>b.left&&m.push(l);break;case E.Right:r.left<b.left&&m.push(l);break}});const f=me({collisionRect:r,droppableRects:s,droppableContainers:m});let i=he(f,"id");if(i===o?.id&&f.length>1&&(i=f[1].id),i!=null){const l=u.get(t.id),b=u.get(i),h=b?s.get(b.id):null,k=b?.node.current;if(k&&h&&l&&b){const C=xe(k).some((d,v)=>a[v]!==d),R=Z(l,b),I=Xe(l,b),S=C||!R?{x:0,y:0}:{x:I?r.width-h.width:0,y:I?r.height-h.height:0},c={x:h.left,y:h.top};return S.x&&S.y?c:Ce(c,S)}}}};function Z(e,n){return!j(e)||!j(n)?!1:e.data.current.sortable.containerId===n.data.current.sortable.containerId}function Xe(e,n){return!j(e)||!j(n)||!Z(e,n)?!1:e.data.current.sortable.index<n.data.current.sortable.index}function _e(e){return{skillsConfig:Ae(e)}}function qe(e){return e.repo.startsWith("system/")?["System"]:[]}function et(e,n){return e.filter(t=>!t.hidden&&!n.has(t.repo)).map(t=>({key:t.repo,name:t.name,description:t.description||t.instructions||"Add this skill to give the agent tools and capabilities.",badges:qe(t)}))}function tt(e,n){const t=n.trim().toLowerCase();return t?e.filter(r=>r.name.toLowerCase().includes(t)||r.description.toLowerCase().includes(t)||r.key.toLowerCase().includes(t)):e}function Be(e){const n=e.instructions?.trim();return{repo:e.repo,skillId:e.skillId,name:e.name,description:e.description,instructions:n,content:n||e.name,enabled:!0,system:e.repo.startsWith("system/")}}const ee=p.createContext(null);function nt({agentId:e,children:n}){const{data:t,isLoading:r}=ge(e),{data:s,isLoading:u}=pe(e),o=be(e),a=p.useMemo(()=>t?Ee(t,s?.catalog??[]):[],[t,s]),[m,f]=p.useState(null),i=m??a,l=p.useCallback(async(c,g)=>{if(!t)return F.error("Still loading agent settings — try again in a moment"),!1;try{const d=_e(c);return await o.mutateAsync(d),F.success(g),!0}catch(d){return F.error(d instanceof Error?d.message:"Failed to save skills"),!1}},[t,o]),b=p.useCallback(c=>{const g=s?.catalog.find(d=>d.repo===c);g&&f(d=>{const v=d??a;return v.some(y=>y.repo===c)?v:[...v,Be(g)]})},[a,s?.catalog]),h=p.useCallback(c=>{const g=c.name.trim();if(!g)return null;const d=`custom/${g.toLowerCase().replace(/[^a-z0-9-]/g,"-")}`,v=c.instructions.trim();return f(y=>{const D=y??a;return D.some(L=>L.repo===d)?D:[...D,{repo:d,skillId:g,name:g,instructions:v||void 0,content:v||g,enabled:!0}]}),d},[a]),k=p.useCallback((c,g)=>{f(d=>(d??a).map(v=>v.repo===c?{...v,...g}:v))},[a]),w=p.useCallback((c,g)=>{f(d=>{const v=d??a,y=v.findIndex(A=>A.repo===c),D=v.findIndex(A=>A.repo===g);if(y<0||D<0||y===D)return v;const L=K(v,y,D);return l(L,"Skill order updated"),L})},[l,a]),C=p.useCallback(async c=>{const g=i.filter(d=>d.repo!==c);return f(g),l(g,"Skill removed")},[l,i]),R=p.useCallback(async(c,g)=>{const d=i.map(v=>v.repo===c?{...v,enabled:g}:v);return f(d),l(d,g?"Skill enabled":"Skill disabled")},[l,i]),I=p.useCallback(async()=>{await l(i,"Skills saved")},[l,i]),S=p.useMemo(()=>({agentId:e,skillRows:i,catalog:s,isLoading:r||u,isSaving:o.isPending,addSkillFromCatalog:b,addCustomSkill:h,updateSkillRow:k,reorderSkills:w,removeSkillAndSave:C,setSkillEnabledAndSave:R,saveSkills:I}),[h,b,e,u,r,w,C,R,I,i,s,o.isPending,k]);return ve.jsx(ee.Provider,{value:S,children:n})}function rt(){const e=p.useContext(ee);if(!e)throw new Error("useAgentSkillEditor must be used within AgentSkillEditorProvider");return e}export{nt as A,Je as S,Ze as a,et as b,Qe as c,tt as f,qe as s,rt as u,We as v};
|
package/dist/owletto/dist/assets/{agent-skills-route-DqIMttMK.js → agent-skills-route-CatU8soC.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a2 as A,r as u,j as e,P as F,aa as C,ab as K,ea as P,c2 as G,B as N,aj as E,aS as H,eG as z,eH as Q,bm as Y,gi as V,cu as X,hv as q}from"./index-BKZMzuMS.js";import{a as J,A as U}from"./agent-subpage-shell-Bojgj1uq.js";import{u as $,b as W,f as Z,s as ee,a as se,S as te,v as ae,c as le}from"./agent-skill-context-DKpIFmCh.js";import{f as ne}from"./agent-loading-shells-DjMpSoub.js";import{u as ie,a as L,m as oe,P as re,D as ce,n as de,C as me}from"./core.esm-COW6Pfy6.js";import{A as ue}from"./agent-card-controls-CLupkefQ.js";const T=":";function w(s){const t=s.indexOf("/");return t<0?s:`${s.slice(0,t)}${T}${s.slice(t+1)}`}function B(s){const t=s.indexOf(T);return t<0?s:`${s.slice(0,t)}/${s.slice(t+1)}`}function ge({owner:s,agentId:t,onBack:a,backLabel:n="Skills"}){const o=A(),[i,g]=u.useState(""),[k,h]=u.useState(!1),[r,p]=u.useState(""),[m,v]=u.useState(""),{skillRows:c,catalog:x,isLoading:S,addSkillFromCatalog:y,addCustomSkill:b}=$(),l=u.useMemo(()=>new Set(c.map(d=>d.repo)),[c]),f=u.useMemo(()=>W(x?.catalog??[],l),[x?.catalog,l]),j=u.useMemo(()=>Z(f,i),[f,i]),R=d=>{y(d),o({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:w(d)}})},O=()=>{const d=b({name:r,instructions:m});d&&o({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:w(d)}})},_=a?e.jsx(J,{title:"Add a skill",description:"Skills bundle instructions, tools, and knowledge an agent can reuse. Pick one from the catalog or create your own.",onBack:a,backLabel:n}):e.jsxs("div",{className:"space-y-1",children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Add a skill"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Skills bundle instructions, tools, and knowledge an agent can reuse. Pick one from the catalog or create your own."})]});return e.jsxs("div",{className:"space-y-6",children:[_,e.jsx("div",{className:E(H,"w-full"),children:k?e.jsxs("div",{className:"space-y-3 p-3",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"custom-skill-name",children:"Name"}),e.jsx(K,{id:"custom-skill-name",value:r,onChange:d=>p(d.target.value),placeholder:"my-skill"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"custom-skill-instructions",children:"Instructions"}),e.jsx(P,{id:"custom-skill-instructions",value:m,onChange:d=>v(d.target.value),placeholder:"Instructions for the agent when this skill is active...",rows:3})]})]}),e.jsx(G,{onCancel:()=>h(!1),children:e.jsx(N,{type:"button",size:"sm",onClick:O,disabled:!r.trim(),children:"Add custom skill"})})]}):e.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 p-3 text-left text-muted-foreground transition-colors hover:text-foreground",onClick:()=>h(!0),children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted",children:e.jsx(F,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Create custom skill"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define instructions and packages"})]})]})}),S?e.jsx(z,{}):e.jsx(Q,{items:j,searchQuery:i,onSearchChange:g,onSelect:d=>R(d.key),searchPlaceholder:"Search skills...",searchAriaLabel:"Search skills",emptyMessage:i.trim()?`No skills match "${i}"`:f.length===0?"All catalog skills are already configured":"No skills available"})]})}function xe({row:s}){const{isSaving:t,updateSkillRow:a}=$(),n=s.system===!0;return e.jsx("div",{className:"space-y-6",children:n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"System skill metadata is managed by Lobu. You can enable or disable it and change its position in the skill list."}):e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"skill-name",children:"Name"}),e.jsx(K,{id:"skill-name",value:s.name,onChange:o=>a(s.repo,{name:o.target.value}),disabled:t})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"skill-instructions",children:"Instructions"}),e.jsx(P,{id:"skill-instructions",value:s.instructions??"",onChange:o=>{const i=o.target.value;a(s.repo,{instructions:i,content:i.trim()||s.name})},rows:4,disabled:t})]})]})})}function he({owner:s,agentId:t,skillKey:a}){const n=A(),[o,i]=u.useState(!1),g=B(a),{skillRows:k,catalog:h,isSaving:r,saveSkills:p,removeSkillAndSave:m,addSkillFromCatalog:v}=$(),c=k.find(b=>b.repo===g)??null,x=h?.catalog.find(b=>b.repo===g);u.useEffect(()=>{!c&&x&&v(g)},[v,x,g,c]);const S=async()=>{await m(g)&&(i(!1),n({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}}))};if(!c)return x?null:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Skill not found."});const y=!c.system;return e.jsxs("div",{className:"space-y-6",children:[e.jsx(xe,{row:c}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-end",children:[y?o?e.jsxs(e.Fragment,{children:[e.jsx(N,{type:"button",variant:"destructive",onClick:()=>void S(),disabled:r,children:r?"Removing...":"Remove skill"}),e.jsx(N,{type:"button",variant:"outline",onClick:()=>i(!1),disabled:r,children:"Cancel"})]}):e.jsxs(N,{type:"button",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>i(!0),disabled:r,children:["Remove ",c.name]}):null,e.jsx(N,{type:"button",onClick:()=>void p(),disabled:r||o,children:r?"Saving...":"Save changes"})]})]})}function fe(s){return s.map(t=>{const a=ee(t).map(String);return{id:t.repo,repo:t.repo,name:t.name,description:t.description,badges:a,enabled:t.enabled}})}const D="Skills bundle instructions, tools, and knowledge an agent can reuse. Add one from the catalog or write your own; drag to set which the agent reaches for first.";function M({owner:s,agentId:t,expandedRepo:a}){const n=A(),{skillRows:o,catalog:i,isLoading:g,isSaving:k,reorderSkills:h,setSkillEnabledAndSave:r,addSkillFromCatalog:p}=$();u.useEffect(()=>{a&&(o.some(l=>l.repo===a)||i?.catalog.some(l=>l.repo===a)&&p(a))},[a,o,i,p]);const m=u.useMemo(()=>fe(o),[o]),v=u.useMemo(()=>m.map(l=>l.repo),[m]),c=ie(L(re,{activationConstraint:{distance:8}}),L(oe,{coordinateGetter:se})),x=()=>{n({to:"/$owner/agents/$agentId/skills/create",params:{owner:s,agentId:t}})},S=e.jsxs(N,{type:"button",onClick:x,children:[e.jsx(F,{className:"mr-1.5 h-4 w-4"}),"Add skill"]}),y=l=>{if(l===a){n({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}});return}n({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:w(l)}})},b=l=>{const{active:f,over:j}=l;!j||f.id===j.id||h(String(f.id),String(j.id))};return g?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:D}),e.jsx(ne,{rows:2})]}):m.length===0?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:D}),e.jsx(Y,{icon:V,title:"No skills yet",description:"Add a system skill from the catalog or create a custom skill for this agent.",actionLabel:"Add skill",onAction:x})]}):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:"min-w-0 flex-1 text-sm text-muted-foreground",children:D}),S]}),e.jsx(ce,{sensors:c,collisionDetection:de,onDragEnd:b,children:e.jsx(te,{items:v,strategy:ae,children:e.jsx("div",{className:"overflow-hidden rounded-lg border",children:m.map((l,f)=>{const j=l.repo===a;return e.jsx(ke,{card:l,rank:f+1,disabled:k,expanded:j,isLast:f===m.length-1,onToggle:()=>y(l.repo),onToggleEnabled:R=>void r(l.repo,R),toggleDisabled:k,children:j?e.jsx(he,{owner:s,agentId:t,skillKey:w(l.repo)}):null},l.id)})})})})]})}function ke({card:s,rank:t,disabled:a,expanded:n,isLast:o,onToggle:i,onToggleEnabled:g,toggleDisabled:k,children:h}){const r=a||n,{attributes:p,listeners:m,setNodeRef:v,transform:c,transition:x,isDragging:S}=le({id:s.repo,disabled:r}),y={transform:me.Transform.toString(c),transition:x};return e.jsxs("div",{ref:v,style:y,className:E("bg-background",!o||n?"border-b":"",S&&"z-10 bg-card opacity-80 "),children:[e.jsxs("div",{className:"flex items-stretch gap-1 pr-3",children:[e.jsx("button",{type:"button",className:"flex shrink-0 cursor-grab touch-none items-center px-2 text-muted-foreground hover:text-foreground active:cursor-grabbing disabled:cursor-not-allowed disabled:opacity-50","aria-label":`Reorder ${s.name}`,disabled:r,...p,...m,children:e.jsx(X,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",className:E("flex min-w-0 flex-1 items-center gap-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",!s.enabled&&!n&&"opacity-70"),onClick:i,"aria-expanded":n,children:[e.jsx("span",{className:"w-4 shrink-0 text-center text-xs tabular-nums text-muted-foreground",children:t}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:s.name}),s.description?e.jsx("p",{className:"line-clamp-1 text-xs text-muted-foreground",children:s.description}):null,e.jsx(q,{badges:s.badges})]})]}),e.jsx(ue,{enabled:s.enabled,name:s.name,expanded:n,onToggleEnabled:g,toggleDisabled:k,onToggle:i})]}),n&&h?e.jsx("div",{className:"border-t border-border px-4 py-4",children:h}):null]})}function I({owner:s,agentId:t,children:a,showBack:n}){return e.jsx(U,{owner:s,agentId:t,showBack:n,backLabel:"Skills",backTo:"/$owner/agents/$agentId/skills",children:a})}function Ne({owner:s,agentId:t}){return e.jsx(I,{owner:s,agentId:t,children:e.jsx(M,{owner:s,agentId:t})})}function Ce({owner:s,agentId:t}){const a=A();return e.jsx(I,{owner:s,agentId:t,children:e.jsx(ge,{owner:s,agentId:t,onBack:()=>{a({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}})}})})}function we({owner:s,agentId:t,skillKey:a}){return e.jsx(I,{owner:s,agentId:t,children:e.jsx(M,{owner:s,agentId:t,expandedRepo:B(a)})})}export{Ne as A,Ce as a,we as b};
|
|
1
|
+
import{a2 as A,r as u,j as e,P as F,aa as C,ab as K,ea as P,c2 as G,B as N,aj as E,aS as H,eG as z,eH as Q,bm as Y,gi as V,cu as X,hv as q}from"./index-Bfux0kHb.js";import{a as J,A as U}from"./agent-subpage-shell-DVSUdIBn.js";import{u as $,b as W,f as Z,s as ee,a as se,S as te,v as ae,c as le}from"./agent-skill-context-CxglCznW.js";import{f as ne}from"./agent-loading-shells-Dczhk067.js";import{u as ie,a as L,m as oe,P as re,D as ce,n as de,C as me}from"./core.esm-CFYXLQXH.js";import{A as ue}from"./agent-card-controls-VJgcB5-0.js";const T=":";function w(s){const t=s.indexOf("/");return t<0?s:`${s.slice(0,t)}${T}${s.slice(t+1)}`}function B(s){const t=s.indexOf(T);return t<0?s:`${s.slice(0,t)}/${s.slice(t+1)}`}function ge({owner:s,agentId:t,onBack:a,backLabel:n="Skills"}){const o=A(),[i,g]=u.useState(""),[k,h]=u.useState(!1),[r,p]=u.useState(""),[m,v]=u.useState(""),{skillRows:c,catalog:x,isLoading:S,addSkillFromCatalog:y,addCustomSkill:b}=$(),l=u.useMemo(()=>new Set(c.map(d=>d.repo)),[c]),f=u.useMemo(()=>W(x?.catalog??[],l),[x?.catalog,l]),j=u.useMemo(()=>Z(f,i),[f,i]),R=d=>{y(d),o({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:w(d)}})},O=()=>{const d=b({name:r,instructions:m});d&&o({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:w(d)}})},_=a?e.jsx(J,{title:"Add a skill",description:"Skills bundle instructions, tools, and knowledge an agent can reuse. Pick one from the catalog or create your own.",onBack:a,backLabel:n}):e.jsxs("div",{className:"space-y-1",children:[e.jsx("h1",{className:"text-xl font-semibold",children:"Add a skill"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Skills bundle instructions, tools, and knowledge an agent can reuse. Pick one from the catalog or create your own."})]});return e.jsxs("div",{className:"space-y-6",children:[_,e.jsx("div",{className:E(H,"w-full"),children:k?e.jsxs("div",{className:"space-y-3 p-3",children:[e.jsxs("div",{className:"grid gap-3",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"custom-skill-name",children:"Name"}),e.jsx(K,{id:"custom-skill-name",value:r,onChange:d=>p(d.target.value),placeholder:"my-skill"})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"custom-skill-instructions",children:"Instructions"}),e.jsx(P,{id:"custom-skill-instructions",value:m,onChange:d=>v(d.target.value),placeholder:"Instructions for the agent when this skill is active...",rows:3})]})]}),e.jsx(G,{onCancel:()=>h(!1),children:e.jsx(N,{type:"button",size:"sm",onClick:O,disabled:!r.trim(),children:"Add custom skill"})})]}):e.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 p-3 text-left text-muted-foreground transition-colors hover:text-foreground",onClick:()=>h(!0),children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted",children:e.jsx(F,{className:"h-4 w-4"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Create custom skill"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define instructions and packages"})]})]})}),S?e.jsx(z,{}):e.jsx(Q,{items:j,searchQuery:i,onSearchChange:g,onSelect:d=>R(d.key),searchPlaceholder:"Search skills...",searchAriaLabel:"Search skills",emptyMessage:i.trim()?`No skills match "${i}"`:f.length===0?"All catalog skills are already configured":"No skills available"})]})}function xe({row:s}){const{isSaving:t,updateSkillRow:a}=$(),n=s.system===!0;return e.jsx("div",{className:"space-y-6",children:n?e.jsx("p",{className:"text-sm text-muted-foreground",children:"System skill metadata is managed by Lobu. You can enable or disable it and change its position in the skill list."}):e.jsxs("div",{className:"grid gap-4",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"skill-name",children:"Name"}),e.jsx(K,{id:"skill-name",value:s.name,onChange:o=>a(s.repo,{name:o.target.value}),disabled:t})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(C,{htmlFor:"skill-instructions",children:"Instructions"}),e.jsx(P,{id:"skill-instructions",value:s.instructions??"",onChange:o=>{const i=o.target.value;a(s.repo,{instructions:i,content:i.trim()||s.name})},rows:4,disabled:t})]})]})})}function he({owner:s,agentId:t,skillKey:a}){const n=A(),[o,i]=u.useState(!1),g=B(a),{skillRows:k,catalog:h,isSaving:r,saveSkills:p,removeSkillAndSave:m,addSkillFromCatalog:v}=$(),c=k.find(b=>b.repo===g)??null,x=h?.catalog.find(b=>b.repo===g);u.useEffect(()=>{!c&&x&&v(g)},[v,x,g,c]);const S=async()=>{await m(g)&&(i(!1),n({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}}))};if(!c)return x?null:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Skill not found."});const y=!c.system;return e.jsxs("div",{className:"space-y-6",children:[e.jsx(xe,{row:c}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-end",children:[y?o?e.jsxs(e.Fragment,{children:[e.jsx(N,{type:"button",variant:"destructive",onClick:()=>void S(),disabled:r,children:r?"Removing...":"Remove skill"}),e.jsx(N,{type:"button",variant:"outline",onClick:()=>i(!1),disabled:r,children:"Cancel"})]}):e.jsxs(N,{type:"button",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>i(!0),disabled:r,children:["Remove ",c.name]}):null,e.jsx(N,{type:"button",onClick:()=>void p(),disabled:r||o,children:r?"Saving...":"Save changes"})]})]})}function fe(s){return s.map(t=>{const a=ee(t).map(String);return{id:t.repo,repo:t.repo,name:t.name,description:t.description,badges:a,enabled:t.enabled}})}const D="Skills bundle instructions, tools, and knowledge an agent can reuse. Add one from the catalog or write your own; drag to set which the agent reaches for first.";function M({owner:s,agentId:t,expandedRepo:a}){const n=A(),{skillRows:o,catalog:i,isLoading:g,isSaving:k,reorderSkills:h,setSkillEnabledAndSave:r,addSkillFromCatalog:p}=$();u.useEffect(()=>{a&&(o.some(l=>l.repo===a)||i?.catalog.some(l=>l.repo===a)&&p(a))},[a,o,i,p]);const m=u.useMemo(()=>fe(o),[o]),v=u.useMemo(()=>m.map(l=>l.repo),[m]),c=ie(L(re,{activationConstraint:{distance:8}}),L(oe,{coordinateGetter:se})),x=()=>{n({to:"/$owner/agents/$agentId/skills/create",params:{owner:s,agentId:t}})},S=e.jsxs(N,{type:"button",onClick:x,children:[e.jsx(F,{className:"mr-1.5 h-4 w-4"}),"Add skill"]}),y=l=>{if(l===a){n({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}});return}n({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:w(l)}})},b=l=>{const{active:f,over:j}=l;!j||f.id===j.id||h(String(f.id),String(j.id))};return g?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:D}),e.jsx(ne,{rows:2})]}):m.length===0?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:D}),e.jsx(Y,{icon:V,title:"No skills yet",description:"Add a system skill from the catalog or create a custom skill for this agent.",actionLabel:"Add skill",onAction:x})]}):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:"min-w-0 flex-1 text-sm text-muted-foreground",children:D}),S]}),e.jsx(ce,{sensors:c,collisionDetection:de,onDragEnd:b,children:e.jsx(te,{items:v,strategy:ae,children:e.jsx("div",{className:"overflow-hidden rounded-lg border",children:m.map((l,f)=>{const j=l.repo===a;return e.jsx(ke,{card:l,rank:f+1,disabled:k,expanded:j,isLast:f===m.length-1,onToggle:()=>y(l.repo),onToggleEnabled:R=>void r(l.repo,R),toggleDisabled:k,children:j?e.jsx(he,{owner:s,agentId:t,skillKey:w(l.repo)}):null},l.id)})})})})]})}function ke({card:s,rank:t,disabled:a,expanded:n,isLast:o,onToggle:i,onToggleEnabled:g,toggleDisabled:k,children:h}){const r=a||n,{attributes:p,listeners:m,setNodeRef:v,transform:c,transition:x,isDragging:S}=le({id:s.repo,disabled:r}),y={transform:me.Transform.toString(c),transition:x};return e.jsxs("div",{ref:v,style:y,className:E("bg-background",!o||n?"border-b":"",S&&"z-10 bg-card opacity-80 "),children:[e.jsxs("div",{className:"flex items-stretch gap-1 pr-3",children:[e.jsx("button",{type:"button",className:"flex shrink-0 cursor-grab touch-none items-center px-2 text-muted-foreground hover:text-foreground active:cursor-grabbing disabled:cursor-not-allowed disabled:opacity-50","aria-label":`Reorder ${s.name}`,disabled:r,...p,...m,children:e.jsx(X,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",className:E("flex min-w-0 flex-1 items-center gap-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",!s.enabled&&!n&&"opacity-70"),onClick:i,"aria-expanded":n,children:[e.jsx("span",{className:"w-4 shrink-0 text-center text-xs tabular-nums text-muted-foreground",children:t}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:s.name}),s.description?e.jsx("p",{className:"line-clamp-1 text-xs text-muted-foreground",children:s.description}):null,e.jsx(q,{badges:s.badges})]})]}),e.jsx(ue,{enabled:s.enabled,name:s.name,expanded:n,onToggleEnabled:g,toggleDisabled:k,onToggle:i})]}),n&&h?e.jsx("div",{className:"border-t border-border px-4 py-4",children:h}):null]})}function I({owner:s,agentId:t,children:a,showBack:n}){return e.jsx(U,{owner:s,agentId:t,showBack:n,backLabel:"Skills",backTo:"/$owner/agents/$agentId/skills",children:a})}function Ne({owner:s,agentId:t}){return e.jsx(I,{owner:s,agentId:t,children:e.jsx(M,{owner:s,agentId:t})})}function Ce({owner:s,agentId:t}){const a=A();return e.jsx(I,{owner:s,agentId:t,children:e.jsx(ge,{owner:s,agentId:t,onBack:()=>{a({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}})}})})}function we({owner:s,agentId:t,skillKey:a}){return e.jsx(I,{owner:s,agentId:t,children:e.jsx(M,{owner:s,agentId:t,expandedRepo:B(a)})})}export{Ne as A,Ce as a,we as b};
|
package/dist/owletto/dist/assets/{agent-subpage-shell-Bojgj1uq.js → agent-subpage-shell-DVSUdIBn.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a2 as m,j as e,aj as h,B as n,fa as i}from"./index-
|
|
1
|
+
import{a2 as m,j as e,aj as h,B as n,fa as i}from"./index-Bfux0kHb.js";function p({owner:t,agentId:a,children:s,showBack:r,backLabel:o,backTo:x,title:c,className:u}){const d=m(),l=()=>{d({to:x,params:{owner:t,agentId:a}})};return e.jsx("div",{className:h("mx-auto w-full max-w-3xl pb-8",u),children:c?e.jsxs(e.Fragment,{children:[e.jsx(j,{title:c,onBack:l,backLabel:o}),s]}):r?e.jsx(g,{onBack:l,backLabel:o,children:s}):s})}function g({onBack:t,backLabel:a,children:s}){return e.jsxs("div",{className:"relative",children:[e.jsx(n,{type:"button",variant:"ghost",size:"icon",className:"absolute right-full top-0 mr-1 size-8 text-muted-foreground hover:text-foreground","aria-label":`Back to ${a}`,onClick:t,children:e.jsx(i,{className:"h-4 w-4"})}),s]})}function j({title:t,onBack:a,backLabel:s,action:r}){return e.jsx("div",{className:"sticky top-0 z-10 mb-2 bg-background py-2",children:e.jsxs("div",{className:"relative flex items-center justify-center gap-1",children:[e.jsx(n,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 text-muted-foreground hover:text-foreground","aria-label":`Back to ${s}`,onClick:a,children:e.jsx(i,{className:"h-4 w-4"})}),e.jsx("span",{className:"truncate text-base font-semibold",children:t}),r?e.jsx("div",{className:"absolute right-0",children:r}):null]})})}function v({title:t,description:a,onBack:s,backLabel:r}){return e.jsxs("div",{className:"mb-2 space-y-1",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(n,{type:"button",variant:"ghost",size:"icon",className:"size-8 shrink-0 text-muted-foreground hover:text-foreground","aria-label":`Back to ${r}`,onClick:s,children:e.jsx(i,{className:"h-4 w-4"})}),e.jsx("h1",{className:"text-xl font-semibold",children:t})]}),e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:a})]})}export{p as A,v as a};
|