@lobu/runtime-server 21.1.0 → 21.2.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 +2 -35
- package/dist/component.json +1 -1
- package/dist/connectors/README.md +6 -3
- package/dist/connectors/github.ts +0 -6
- package/dist/connectors/google_calendar.ts +0 -4
- package/dist/connectors/google_drive.ts +0 -2
- package/dist/connectors/google_gmail.ts +0 -6
- package/dist/connectors/market_quotes.ts +0 -1
- package/dist/connectors/microsoft_outlook.ts +0 -2
- package/dist/connectors/postgres.ts +68 -3
- package/dist/connectors/whatsapp_web.ts +2 -8
- package/dist/connectors/x.ts +3 -9
- package/dist/connectors/youtube.ts +0 -5
- package/dist/db/migrations/20260930010000_connector_policy_scopes.sql +113 -0
- package/dist/db/migrations/20261002230000_connector_exact_policy_target.sql +36 -0
- package/dist/db/migrations/20261003120000_source_backed_entity_identity.sql +109 -0
- package/dist/db/migrations/20261003200000_drop_source_backed_entity_identity.sql +111 -0
- package/dist/db/migrations/preconditions/20261002230000_connector_exact_policy_target.sql +38 -0
- package/dist/db/migrations/preconditions/20261003200000_drop_source_backed_entity_identity.sql +21 -0
- package/dist/dependencies.bun.lock +52 -54
- package/dist/owletto/dist/assets/_-C1iPVDAS.js +2 -0
- package/dist/owletto/dist/assets/_-TlzPuBqI.js +1 -0
- package/dist/owletto/dist/assets/_agentId-DutmYPK7.js +1 -0
- package/dist/owletto/dist/assets/_agentId-DvhFYLLv.js +1 -0
- package/dist/owletto/dist/assets/_automationId-NuFSEFlw.js +1 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-D_FhMGN1.js +1 -0
- package/dist/owletto/dist/assets/_connectorKey.index-B8AZikVg.js +1 -0
- package/dist/owletto/dist/assets/{_conversationId-CpuEvflw.js → _conversationId-D1Cx42I0.js} +1 -1
- package/dist/owletto/dist/assets/{_deploymentId-BL9tnDFl.js → _deploymentId-BjtZC8Oo.js} +1 -1
- package/dist/owletto/dist/assets/_name-DTlirHDv.js +1 -0
- package/dist/owletto/dist/assets/_owner-c8L8M4FP.js +1 -0
- package/dist/owletto/dist/assets/_shape-DQaUs_O7.js +1 -0
- package/dist/owletto/dist/assets/_skillKey-CJSEeyG0.js +1 -0
- package/dist/owletto/dist/assets/_slug-Nlm2ziLr.js +1 -0
- package/dist/owletto/dist/assets/_viewKey-BK9NZs21.js +1 -0
- package/dist/owletto/dist/assets/_viewKey-D-Og614G.js +1 -0
- package/dist/owletto/dist/assets/_viewKey-DIFCFECi.js +1 -0
- package/dist/owletto/dist/assets/accept-invitation-BfqbITxp.js +1 -0
- package/dist/owletto/dist/assets/activity-route-view-CTQEg3Us.js +1 -0
- package/dist/owletto/dist/assets/{agent-card-controls-bhTMPoVi.js → agent-card-controls-49SIdmyU.js} +1 -1
- package/dist/owletto/dist/assets/{agent-client-setup-list-BBbq_2B1.js → agent-client-setup-list-ChwHMq4Q.js} +1 -1
- package/dist/owletto/dist/assets/agent-connect-pages-CJntJskO.js +1 -0
- package/dist/owletto/dist/assets/agent-editor-form-CEEFNek5.js +1 -0
- package/dist/owletto/dist/assets/agent-guardrails-route-BF_RvzHv.js +1 -0
- package/dist/owletto/dist/assets/{agent-loading-shells-BQLjzMPy.js → agent-loading-shells-Cve_XIMW.js} +1 -1
- package/dist/owletto/dist/assets/agent-permissions-matrix-DEYa123T.js +1 -0
- package/dist/owletto/dist/assets/{agent-skill-context-s42Q4Wjo.js → agent-skill-context-DuS7Ojm_.js} +1 -1
- package/dist/owletto/dist/assets/agent-skills-route-BItudd8s.js +1 -0
- package/dist/owletto/dist/assets/agent-subpage-shell-BkGzpmv5.js +1 -0
- package/dist/owletto/dist/assets/agent-thread-DhCFggHZ.js +8 -0
- package/dist/owletto/dist/assets/agents-BIA5SCAT.js +1 -0
- package/dist/owletto/dist/assets/agents-workbench-BZaoiFNY.js +1 -0
- package/dist/owletto/dist/assets/{app._appId-CqYz3AOO.js → app._appId-0fp8NC9-.js} +1 -1
- package/dist/owletto/dist/assets/automation-detail-content-C08Ef137.js +1 -0
- package/dist/owletto/dist/assets/automations-BIA5SCAT.js +1 -0
- package/dist/owletto/dist/assets/{calendar-CHXehtu0.js → calendar-CvEqJnKS.js} +1 -1
- package/dist/owletto/dist/assets/callback-BfjlxUcL.js +1 -0
- package/dist/owletto/dist/assets/{card-4Ull9W6d.js → card-MXMmjz9G.js} +1 -1
- package/dist/owletto/dist/assets/{claim-BGLCPLXq.js → claim-B5igXpyF.js} +1 -1
- package/dist/owletto/dist/assets/{clients-C7ubnFsS.js → clients-DqMOcwpO.js} +1 -1
- package/dist/owletto/dist/assets/{code-editor-BHiWR94J.js → code-editor-bpbaa7f6.js} +1 -1
- package/dist/owletto/dist/assets/connect-DpQrbviv.js +1 -0
- package/dist/owletto/dist/assets/connect._clientId-A_F-UzTr.js +1 -0
- package/dist/owletto/dist/assets/connected._clientId-BWVr-PMm.js +1 -0
- package/dist/owletto/dist/assets/connection-D-dXA43c.js +1 -0
- package/dist/owletto/dist/assets/connection-feed-detail-XYK-ubKG.js +1 -0
- package/dist/owletto/dist/assets/{connector-provenance-DRdUEmQ1.js → connector-provenance-RL_DcF2q.js} +1 -1
- package/dist/owletto/dist/assets/connectors-B2_PLuXP.js +1 -0
- package/dist/owletto/dist/assets/{consent-fmhPPlpi.js → consent-CMrkyIfi.js} +1 -1
- package/dist/owletto/dist/assets/{core.esm-C-eNiUAl.js → core.esm-BrIR85HL.js} +1 -1
- package/dist/owletto/dist/assets/create-DhxcVjNh.js +1 -0
- package/dist/owletto/dist/assets/create-UTXCruIl.js +1 -0
- package/dist/owletto/dist/assets/create-automation-form-BHir-pIp.js +2 -0
- package/dist/owletto/dist/assets/create-jVkf6V76.js +1 -0
- package/dist/owletto/dist/assets/{create._connectorKey-CHAotlsF.js → create._connectorKey-qjd3B6p5.js} +1 -1
- package/dist/owletto/dist/assets/{cronstrue-C5yTgk5z.js → cronstrue-BwvvZn_Y.js} +1 -1
- package/dist/owletto/dist/assets/deployments-CSJHFlJz.js +1 -0
- package/dist/owletto/dist/assets/{deployments-D1gbQwsy.js → deployments-DHAx8TBs.js} +1 -1
- package/dist/owletto/dist/assets/{deployments-body-DycIGlnL.js → deployments-body-B54mJoZC.js} +1 -1
- package/dist/owletto/dist/assets/{device-DyPnQkhO.js → device-Bi_9KNKQ.js} +1 -1
- package/dist/owletto/dist/assets/device-pin-tombstone-Dkmmka9d.js +1 -0
- package/dist/owletto/dist/assets/device-rows-CkTAaZ3m.js +1 -0
- package/dist/owletto/dist/assets/device._deviceId-B_WqDhY5.js +1 -0
- package/dist/owletto/dist/assets/entity-options-Bm1sbpmt.js +1 -0
- package/dist/owletto/dist/assets/entity-page-DZUGex-P.js +1 -0
- package/dist/owletto/dist/assets/entity-type-page-DSBcVv9e.js +1 -0
- package/dist/owletto/dist/assets/event-page-B837JclA.js +1 -0
- package/dist/owletto/dist/assets/events-feed-BgvLTppV.js +1 -0
- package/dist/owletto/dist/assets/{full-page-spinner-DsU-Cb3L.js → full-page-spinner-ByBsHimW.js} +1 -1
- package/dist/owletto/dist/assets/guardrails-cMGe6IIe.js +1 -0
- package/dist/owletto/dist/assets/identity-BORtpi5L.js +1 -0
- package/dist/owletto/dist/assets/index-B5lGxbbZ.js +1 -0
- package/dist/owletto/dist/assets/index-BGz-9DDG.js +1 -0
- package/dist/owletto/dist/assets/{index-DwtfHCHB.js → index-Be5BLMwZ.js} +1 -1
- package/dist/owletto/dist/assets/index-BmAuAhub.css +1 -0
- package/dist/owletto/dist/assets/{index-nOYvNROJ.js → index-BrT0gBIi.js} +1 -1
- package/dist/owletto/dist/assets/index-BrzsfXR-.js +1 -0
- package/dist/owletto/dist/assets/{index-CpWKAAGX.js → index-C1MV7ajb.js} +1 -1
- package/dist/owletto/dist/assets/index-C31QOVZH.js +1 -0
- package/dist/owletto/dist/assets/index-C6USRbY8.js +1 -0
- package/dist/owletto/dist/assets/{index-D2dcENg2.js → index-Cane2GT3.js} +1 -1
- package/dist/owletto/dist/assets/{index-1YrrvVJ4.js → index-DBs2lhwE.js} +8 -8
- package/dist/owletto/dist/assets/index-Dh8ubWqr.js +1 -0
- package/dist/owletto/dist/assets/index-DjYcFuq9.js +1 -0
- package/dist/owletto/dist/assets/index-Dpf0I2N4.js +1 -0
- package/dist/owletto/dist/assets/index-DpgsgDFc.js +1 -0
- package/dist/owletto/dist/assets/index-DqrjJ9LB.js +1 -0
- package/dist/owletto/dist/assets/{index-DtRfQcRH.js → index-GZkujXG1.js} +1595 -1595
- package/dist/owletto/dist/assets/index-pFFCzVi5.js +1 -0
- package/dist/owletto/dist/assets/{json-diff-DYeX-xLk.js → json-diff-D6sv990W.js} +3 -3
- package/dist/owletto/dist/assets/{list-skeleton-s4GPSJ8J.js → list-skeleton-B39wKVT1.js} +1 -1
- package/dist/owletto/dist/assets/login-DxnhCvKx.js +1 -0
- package/dist/owletto/dist/assets/logout-Lvib6Kk7.js +1 -0
- package/dist/owletto/dist/assets/member-scope-gate-CM-GNviT.js +1 -0
- package/dist/owletto/dist/assets/{memory-browse-page-Bibfs2sK.js → memory-browse-page-DKmyI1FJ.js} +1 -1
- package/dist/owletto/dist/assets/{missing-view-CD4DOaG8.js → missing-view-CAFqvZpi.js} +1 -1
- package/dist/owletto/dist/assets/{model-selector-XC5CI2Et.js → model-selector-BoudNhPZ.js} +1 -1
- package/dist/owletto/dist/assets/models-B8BuBmLu.js +1 -0
- package/dist/owletto/dist/assets/new-CKSjnGM9.js +1 -0
- package/dist/owletto/dist/assets/new-Jp_DtYBt.js +1 -0
- package/dist/owletto/dist/assets/new-e3C5Yokb.js +1 -0
- package/dist/owletto/dist/assets/{oauth-workspace-access-D6epOq0R.js → oauth-workspace-access-DuPiMSr2.js} +1 -1
- package/dist/owletto/dist/assets/organization-DUPBruFP.js +1 -0
- package/dist/owletto/dist/assets/{permissions-D8uJHINS.js → permissions-DqkX4mTH.js} +1 -1
- package/dist/owletto/dist/assets/{proposal-review-shell-C3K-JXjb.js → proposal-review-shell-C04RG1qM.js} +1 -1
- package/dist/owletto/dist/assets/{recent-CFcWceBl.js → recent-BmxCZQ8j.js} +1 -1
- package/dist/owletto/dist/assets/{renderer-1nRJFMGx.js → renderer-eFSU65zm.js} +1 -1
- package/dist/owletto/dist/assets/{reset-password-9RTWhBEb.js → reset-password-BinCwene.js} +1 -1
- package/dist/owletto/dist/assets/runs-DwThk2CI.js +1 -0
- package/dist/owletto/dist/assets/{runs-panel-B2852xus.js → runs-panel-DfxWCV7K.js} +1 -1
- package/dist/owletto/dist/assets/runs-table-Dh7FL3Va.js +1 -0
- package/dist/owletto/dist/assets/{schema-value-normalization-BspxVEGy.js → schema-value-normalization-CPLeOm7K.js} +1 -1
- package/dist/owletto/dist/assets/settings-CSrpSUqR.js +1 -0
- package/dist/owletto/dist/assets/{settings-9lDASETT.js → settings-DLg89oqz.js} +1 -1
- package/dist/owletto/dist/assets/skills-PQP0fNxc.js +1 -0
- package/dist/owletto/dist/assets/{switch-CxDXvPGE.js → switch-Dcx3_8kM.js} +1 -1
- package/dist/owletto/dist/assets/{use-applied-views-DvMT3wap.js → use-applied-views-BpvIIgWG.js} +1 -1
- package/dist/owletto/dist/assets/{use-mention-search-CeTEE3oE.js → use-mention-search-Vndny_Gd.js} +1 -1
- package/dist/owletto/dist/assets/{view-frame-HoBawpT2.js → view-frame-DxiuLSGA.js} +1 -1
- package/dist/owletto/dist/index.html +2 -2
- package/dist/server-main.bundle.mjs +4097 -4383
- package/npm-shrinkwrap.json +198 -207
- package/package.json +1 -1
- package/vendor/connector-sdk/dist/connector-runtime.d.ts +1 -1
- package/vendor/connector-sdk/dist/connector-runtime.js +1 -1
- package/vendor/connector-sdk/dist/connector-types.d.ts +14 -2
- package/vendor/connector-sdk/dist/define-connector.d.ts +3 -5
- package/vendor/connector-sdk/dist/define-connector.js +1 -1
- package/vendor/connector-sdk/dist/device-manifest.d.ts +0 -1
- package/vendor/connector-sdk/dist/extension-network.js +1 -2
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/contracts/agent-settings.d.ts +0 -1
- package/vendor/core/dist/contracts/agent-settings.js +0 -1
- package/vendor/core/dist/contracts/tools/manage-classifiers.d.ts +6 -6
- package/vendor/core/dist/contracts/tools/manage-classifiers.js +4 -6
- package/vendor/core/dist/contracts/tools/manage-connections.d.ts +0 -1
- package/vendor/core/dist/contracts/tools/manage-connections.js +3 -4
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +2 -2
- package/vendor/core/dist/contracts/tools/manage-entity.js +4 -2
- package/vendor/core/dist/logger.js +13 -2
- package/vendor/core/dist/worker/wire.d.ts +1 -6
- package/vendor/core/dist/worker/wire.js +1 -1
- package/vendor/core/package.json +1 -1
- package/vendor/views/package.json +6 -1
- package/dist/owletto/dist/assets/_-00GgOtdu.js +0 -1
- package/dist/owletto/dist/assets/_-XlUwOWCI.js +0 -2
- package/dist/owletto/dist/assets/_agentId-B2DrawIk.js +0 -1
- package/dist/owletto/dist/assets/_agentId-CS0AcWH2.js +0 -1
- package/dist/owletto/dist/assets/_automationId-BLnqLtUv.js +0 -1
- package/dist/owletto/dist/assets/_connectorKey._connectionId-DcUWoZ-C.js +0 -1
- package/dist/owletto/dist/assets/_connectorKey.index-C_yKycN_.js +0 -1
- package/dist/owletto/dist/assets/_name-DlxjWkKk.js +0 -1
- package/dist/owletto/dist/assets/_owner-Cg50UU6m.js +0 -1
- package/dist/owletto/dist/assets/_shape-BWZW4mj8.js +0 -1
- package/dist/owletto/dist/assets/_skillKey-B25fO0_O.js +0 -1
- package/dist/owletto/dist/assets/_slug-DbD-wv2m.js +0 -1
- package/dist/owletto/dist/assets/_viewKey-BcTEvQ3N.js +0 -1
- package/dist/owletto/dist/assets/_viewKey-W4RjiUWL.js +0 -1
- package/dist/owletto/dist/assets/_viewKey-iGPCKSda.js +0 -1
- package/dist/owletto/dist/assets/accept-invitation-BmQKbQem.js +0 -1
- package/dist/owletto/dist/assets/activity-route-view-BvtAoGVt.js +0 -1
- package/dist/owletto/dist/assets/agent-connect-pages-DkDlFVY5.js +0 -1
- package/dist/owletto/dist/assets/agent-editor-form-DwHD9j1Y.js +0 -1
- package/dist/owletto/dist/assets/agent-guardrails-route-0PsTrqMC.js +0 -1
- package/dist/owletto/dist/assets/agent-permissions-matrix-B-Q5rmuB.js +0 -1
- package/dist/owletto/dist/assets/agent-skills-route-Cwq1QrhW.js +0 -1
- package/dist/owletto/dist/assets/agent-subpage-shell-DtzoRy6N.js +0 -1
- package/dist/owletto/dist/assets/agent-thread-D7AGGjRV.js +0 -8
- package/dist/owletto/dist/assets/agents-BqCKU4CT.js +0 -1
- package/dist/owletto/dist/assets/agents-workbench-Cl7FO7b3.js +0 -1
- package/dist/owletto/dist/assets/automation-detail-content-CKSywvzE.js +0 -1
- package/dist/owletto/dist/assets/automations-BqCKU4CT.js +0 -1
- package/dist/owletto/dist/assets/callback-DZ3YyXeV.js +0 -1
- package/dist/owletto/dist/assets/connect-BNatqg6j.js +0 -1
- package/dist/owletto/dist/assets/connect._clientId-BGG2IqiQ.js +0 -1
- package/dist/owletto/dist/assets/connected._clientId-7RU89sVW.js +0 -1
- package/dist/owletto/dist/assets/connection-CTaUGXl6.js +0 -1
- package/dist/owletto/dist/assets/connection-feed-detail-B1xieiEh.js +0 -1
- package/dist/owletto/dist/assets/connectors-NBwCLuZg.js +0 -1
- package/dist/owletto/dist/assets/create-8bBbQJGY.js +0 -1
- package/dist/owletto/dist/assets/create-Cl6cfNAp.js +0 -1
- package/dist/owletto/dist/assets/create-DrVso8O7.js +0 -1
- package/dist/owletto/dist/assets/create-automation-form-De8J-JD5.js +0 -2
- package/dist/owletto/dist/assets/deployments-C7M3fV5K.js +0 -1
- package/dist/owletto/dist/assets/device-pin-tombstone-CwJitllC.js +0 -1
- package/dist/owletto/dist/assets/device-rows-BBhW1C7Y.js +0 -1
- package/dist/owletto/dist/assets/device._deviceId-XswfXHOc.js +0 -1
- package/dist/owletto/dist/assets/entity-options-utGBmFX0.js +0 -1
- package/dist/owletto/dist/assets/entity-page-BxwuqqWk.js +0 -1
- package/dist/owletto/dist/assets/entity-type-page-BrWqk6so.js +0 -1
- package/dist/owletto/dist/assets/event-page-LIm4EDmJ.js +0 -1
- package/dist/owletto/dist/assets/events-feed-C4L8mQV7.js +0 -1
- package/dist/owletto/dist/assets/guardrails-CGFWCfbQ.js +0 -1
- package/dist/owletto/dist/assets/identity-uPYpPogR.js +0 -1
- package/dist/owletto/dist/assets/index-BKMafTe4.js +0 -1
- package/dist/owletto/dist/assets/index-BsL1-C2-.js +0 -1
- package/dist/owletto/dist/assets/index-C58oW727.js +0 -1
- package/dist/owletto/dist/assets/index-C8CR2-Ck.css +0 -1
- package/dist/owletto/dist/assets/index-CQ4s6nzy.js +0 -1
- package/dist/owletto/dist/assets/index-DCK0KhMM.js +0 -1
- package/dist/owletto/dist/assets/index-DXqiRON3.js +0 -1
- package/dist/owletto/dist/assets/index-DgEc5IvT.js +0 -1
- package/dist/owletto/dist/assets/index-DvhM9tuI.js +0 -1
- package/dist/owletto/dist/assets/index-DyYFZjh-.js +0 -1
- package/dist/owletto/dist/assets/index-oDoJENMF.js +0 -1
- package/dist/owletto/dist/assets/index-rPdUEOa3.js +0 -1
- package/dist/owletto/dist/assets/login-Di5VF2F_.js +0 -1
- package/dist/owletto/dist/assets/logout-BuaQGSnw.js +0 -1
- package/dist/owletto/dist/assets/member-scope-gate-CJqJZk7T.js +0 -1
- package/dist/owletto/dist/assets/models--8mTFOLz.js +0 -1
- package/dist/owletto/dist/assets/new-BzkA1sq2.js +0 -1
- package/dist/owletto/dist/assets/new-C3f0BShb.js +0 -1
- package/dist/owletto/dist/assets/new-DA5LF6iB.js +0 -1
- package/dist/owletto/dist/assets/organization-DOtBRqDQ.js +0 -1
- package/dist/owletto/dist/assets/runs-_yVh6PPB.js +0 -1
- package/dist/owletto/dist/assets/runs-table--dnFQatY.js +0 -1
- package/dist/owletto/dist/assets/settings-DQo_ZS2P.js +0 -1
- package/dist/owletto/dist/assets/skills-a5xQ4RE9.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,I as T,u as O,a as R,S as g,r as f,C as F,B as p,L as A,P as K,b as B,c as H,d as N,f as M,e as I,g as $,h as V,i as U,k as q,l as W,A as Q,m as G,F as X,n as Y,o as k,p as J,q as Z,s as P,t as L,v as _,w as ee,x as se,y as te,z as ne,D as ae,E as re,G as ie,H as oe,J as ce,K as de,M as le,N as ue,O as me,Q as xe,R as pe,T as he,U as fe,V as ge,W as je,X as ye,Y as ve,Z as Ne,_ as ke,$ as be,a0 as we,a1 as Ce,a2 as Se}from"./index-DtRfQcRH.js";import{u as Ae,A as Ie,a as Pe}from"./automation-detail-content-CKSywvzE.js";import{C as Le,a as _e,A as ze}from"./connection-feed-detail-B1xieiEh.js";import{c as Ee}from"./connection-label-BobuYiAG.js";import{C as De,f as Te}from"./runs-table--dnFQatY.js";import{E as z,u as Oe}from"./events-feed-C4L8mQV7.js";import{T as Re,a as Fe,b as w,c as C,V as Ke}from"./view-frame-HoBawpT2.js";import"./create-automation-form-De8J-JD5.js";import"./cronstrue-C5yTgk5z.js";import"./entity-options-utGBmFX0.js";import"./switch-CxDXvPGE.js";import"./device-automation-BIjs7DZJ.js";import"./model-selector-XC5CI2Et.js";import"./skill-editor-D_W3QlRz.js";import"./code-editor-BHiWR94J.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./use-mention-search-CeTEE3oE.js";import"./proposal-review-shell-C3K-JXjb.js";import"./runs-_yVh6PPB.js";import"./json-diff-DYeX-xLk.js";import"./deployments-D1gbQwsy.js";import"./agent-loading-shells-BQLjzMPy.js";import"./agent-thread-D7AGGjRV.js";import"./app-bridge-BH3g2mKG.js";import"./pending-seed-CPbfgnLX.js";import"./use-applied-views-DvMT3wap.js";import"./clients-C7ubnFsS.js";import"./renderer-1nRJFMGx.js";import"./card-4Ull9W6d.js";function Be(s){if(!s||typeof s!="object")return[];const t=s.properties;if(!t)return[];const r=Array.isArray(s.required)?new Set(s.required.map(String)):new Set;return Object.entries(t).map(([n,a])=>({name:n,type:String(a.type??"any"),required:r.has(n),description:typeof a.description=="string"?a.description:void 0}))}function He({fields:s}){return s.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No fields."}):e.jsx("ul",{className:"space-y-2",children:s.map(t=>e.jsxs("li",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[e.jsx("code",{className:"text-xs font-medium text-foreground",children:t.name}),e.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:t.type}),t.required?e.jsx("span",{className:"text-[10px] font-medium text-amber-600 dark:text-amber-400",children:"required"}):null]}),t.description?e.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}):null]},t.name))})}function b({item:s,hideHeading:t=!1}){const r=s.schemaSections;return r?e.jsxs("article",{className:t?"space-y-4":"space-y-4 px-5 py-5",children:[!t&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(T,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("h2",{className:"text-base font-medium text-foreground",children:s.title}),r.description?e.jsx("p",{className:"text-xs text-muted-foreground",children:r.description}):null]})]}),r.sections.map(n=>{const a=Be(n.schema);return e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:n.title}),n.description?e.jsx("span",{className:"truncate text-xs text-muted-foreground",children:n.description}):null]}),e.jsx(He,{fields:a})]},n.title)})]}):null}function Me({panel:s}){const t=O(s.organizationId),r=s.section==="connections"||!!s.connectionId,n=R(s.organizationId,{connectorKey:s.connectorKey,connectionIds:s.connectionId?[s.connectionId]:void 0,enabled:r}),a=t.data?.find(o=>o.key===s.connectorKey),i=n.data?.find(o=>o.id===s.connectionId&&o.connector_key===s.connectorKey);return t.isLoading||r&&n.isLoading?e.jsx("div",{className:"p-5",children:e.jsx(g,{className:"h-28 w-full"})}):t.isError||r&&n.isError?e.jsx("p",{role:"alert",className:"p-5 text-sm",children:"Could not load this connector. Close the pane and try again."}):s.connectionId&&!i||!a&&!i&&s.section!=="connections"?e.jsx("p",{className:"p-5 text-sm",children:"This connection is no longer available."}):e.jsx("div",{className:"p-5",children:s.section==="connections"?e.jsx($e,{connections:n.data?.filter(o=>o.connector_key===s.connectorKey)??[],connector:a,connectorKey:s.connectorKey,ownerSlug:s.ownerSlug}):i?e.jsx(qe,{connection:i,connector:a,panel:s}):a?s.section==="feeds"?e.jsx(Ve,{connector:a}):a.installed===!1?e.jsx(Ue,{connector:a}):e.jsx(Qe,{connector:a,organizationId:s.organizationId}):null},`${s.connectorKey}:${s.connectionId??"connector"}:${s.section}`)}function $e({connections:s,connector:t,connectorKey:r,ownerSlug:n}){const[a,i]=f.useState(""),o=s.filter(c=>Ee({...c,connector_name:c.connector_name??t?.name??null}).toLowerCase().includes(a.trim().toLowerCase()));return e.jsxs("div",{className:"space-y-4",children:[e.jsx(F,{label:"connections",query:a,onQueryChange:i,count:o.length,action:e.jsx(p,{asChild:!0,size:"sm",variant:"outline",children:e.jsxs(A,{to:"/$owner/connectors/create/$connectorKey",params:{owner:n,connectorKey:r},children:[e.jsx(K,{className:"size-3.5"}),"Add connection"]})})}),e.jsx(De,{connections:o,connectorDef:t,ownerSlug:n,connectorKey:r}),o.length===0&&e.jsx("p",{className:"py-5 text-sm text-muted-foreground",children:a.trim()?"No matches. Try another search.":"No connections yet."})]})}function Ve({connector:s}){const t=Object.entries(s.feeds_schema??{}).map(([r,n])=>{const a=n;return{id:r,name:a.name??r,description:a.description,feed:a}});return e.jsx(N,{entries:t,label:"feed types",renderDetail:({name:r,feed:n})=>e.jsx(b,{item:{href:"",title:r,schemaSections:M(n)},hideHeading:!0})})}function Ue({connector:s}){const t=Object.entries(s.actions_schema??{}).map(([r,n])=>{const a=n;return{id:r,name:a.name??r,description:a.description,action:a}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect an account to configure action approval."}),e.jsx(N,{entries:t,label:"actions",renderDetail:({name:r,action:n})=>e.jsx(b,{hideHeading:!0,item:{href:"",title:r,schemaSections:I(n)}})})]})}function qe({connection:s,connector:t,panel:r}){const[n,a]=f.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{hidden:n,children:r.section==="feeds"?e.jsx(We,{connection:s,connector:t,ownerSlug:r.ownerSlug}):e.jsx(B,{connection:s,inPeek:!0,onReviewPermissions:t?()=>a(!0):void 0})}),n&&t&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(p,{variant:"ghost",size:"sm",onClick:()=>a(!1),children:"Back to actions"}),e.jsx("h2",{className:"text-base font-semibold",children:"Provider permissions"}),e.jsx(H,{connection:s,connectorDef:t})]})]})}function We({connection:s,connector:t,ownerSlug:r}){const{data:n=[],isLoading:a,isError:i}=Y(s.id),[o,c]=f.useState(!1),d=s.facets?.chat??!1;if(a)return e.jsx(g,{className:"h-28 w-full"});if(i)return e.jsx("p",{role:"alert",children:"Could not load sources. Close the pane and try again."});const m=n.map(l=>({id:String(l.id),name:l.display_name||l.feed_key,status:Te(l)??(l.operations.includes("sync")?"Sync enabled":"Live access"),feed:l}));return e.jsxs(e.Fragment,{children:[e.jsx("div",{hidden:o,children:e.jsx(N,{entries:m,label:d?"channels":"feeds",action:Object.keys(t?.feeds_schema??{}).length>0?e.jsx(p,{size:"sm",variant:"outline",onClick:()=>c(!0),children:d?"Add channel":"Add feed"}):void 0,renderDetail:({feed:l})=>l.store==="channel_messages"?e.jsx(Le,{feed:l,hideHeader:!0}):e.jsx(_e,{feed:l,connectorDef:t,ownerSlug:r})})}),o&&t&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-base font-semibold",children:d?"Add channel":"Add feed"}),e.jsx(ze,{organizationId:s.organization_id,connections:[s],connectorDefinitions:[t],onClose:()=>c(!1)})]})]})}function Qe({connector:s,organizationId:t}){const{isAdmin:r,isLoading:n}=$(t),{data:a=[],isLoading:i,isError:o}=V(s.key),c=U(),d=q(`${t}:${s.key}`,W(s.default_connection_config)),{values:m,setValues:l}=d;if(n)return e.jsx(g,{className:"h-28 w-full"});if(!r)return e.jsx("p",{className:"text-sm text-muted-foreground",children:"Only workspace admins can configure connector actions."});if(i)return e.jsx(g,{className:"h-28 w-full"});if(o)return e.jsx("p",{role:"alert",children:"Could not load actions. Close the pane and try again."});const h=s.actions_schema??{},j=a.map(u=>({id:u.operation_key,name:u.name??u.operation_key,description:u.description,operation:u}));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Set when Lobu asks before running each action. Click an action to inspect its inputs. Individual connections can override this policy."}),e.jsx(N,{entries:j,label:"actions",renderControl:({operation:u,name:x})=>e.jsx(Q,{value:G(u,m),"aria-label":`Mode for ${x}`,onChange:E=>{l(D=>({...D,[u.operation_key]:E}))}}),renderDetail:({operation:u,name:x})=>h[u.operation_key]?e.jsx(b,{hideHeading:!0,item:{href:"",title:x,schemaSections:I(h[u.operation_key])}}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No input fields."})}),c.isError&&e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Could not save the policy. Your changes are still here; try again."}),e.jsx(X,{visible:d.hasConflict,onReload:d.reset}),d.dirty&&e.jsxs("div",{className:"sticky bottom-0 z-10 flex justify-end gap-2 border-t bg-background py-3",children:[e.jsx(p,{variant:"outline",size:"sm",onClick:d.reset,children:"Cancel"}),e.jsx(p,{size:"sm",disabled:c.isPending||!d.canSubmit,onClick:()=>c.mutate({connector_key:s.key,default_connection_config:{...s.default_connection_config,action_modes:m}},{onSuccess:()=>d.accept(m,m)}),children:c.isPending?"Saving…":"Save default policy"})]})]})}function Ge({owner:s,path:t}){const{data:r,isLoading:n}=k(s,{slug:s}),a=r?.workspace,i=a?.type==="organization"?a.id:null,o=i?{slug:s}:void 0,{data:c,isLoading:d}=J(`/${s}/${Z(t)}`,o),m=c?.entity?.id;return n||d?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(P,{className:"mr-2"})," Loading…"]}):!i||m==null?e.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"This record no longer exists."}):e.jsx("div",{className:"px-4 py-4",children:e.jsx(z,{organizationId:i,ownerSlug:s,entityId:m,filters:{sortBy:"date",sortOrder:"desc"},dense:!0,emptyState:e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing has happened to this record yet."})})})}function v({owner:s,runId:t,runIds:r,contentIds:n}){const{data:a,isLoading:i}=k(s==="me"?null:s,{slug:s}),o=a?.workspace,c=s!=="me"&&o?.type==="organization"?o.id:null,d=f.useMemo(()=>{if(s==="me")return n?.length?{contentIds:n,sortBy:"date",sortOrder:"desc"}:void 0;const l=r??(t!=null?[t]:void 0);if(!(!l?.length&&!n?.length))return{...l?.length?{runIds:l}:{},...n?.length?{contentIds:n}:{}}},[s,n,t,r]),m=d!=null;return s!=="me"&&i?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(P,{className:"mr-2"})," Loading…"]}):s!=="me"&&c==null?e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Couldn't resolve this workspace."}):m?e.jsx("div",{className:"px-4 py-4",children:e.jsx(z,{organizationId:c,ownerSlug:s,filters:d,dense:!0,emptyState:e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No matching events yet."})})}):e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing to preview."})}const y=":event",Xe={},Ye=()=>{};function Je({owner:s,eventId:t,viewKey:r}){const n=L(),{isAuthenticated:a,isReady:i}=_(),{isMember:o}=ee(),{data:c}=k(s==="me"?null:s,{slug:s}),d=c?.workspace,m=d?.type==="organization"?d.id:null,l=s!=="me"&&i&&a&&o&&m!==null,h=Oe(l?{slug:s,organizationId:m}:null,t),j=e.jsx(v,{owner:s,contentIds:[t]});if(!l||h.views.length===0)return j;const u=h.views.find(x=>x.key===r);return e.jsxs(Re,{className:"px-4 pt-3",value:u?u.key:y,onValueChange:x=>n?.retarget(se(s,t,x===y?void 0:x)),children:[e.jsxs(Fe,{children:[e.jsx(w,{value:y,"data-testid":"peek-tab-event",children:"Event"}),h.views.map(x=>e.jsx(w,{value:x.key,"data-testid":`peek-tab-${x.key}`,children:x.name},x.key))]}),e.jsx(C,{value:y,className:"-mx-4",children:j}),u&&e.jsx(C,{value:u.key,children:e.jsx(Ke,{orgSlug:s,viewKey:u.key,scope:{event:t},params:Xe,onParamsChange:Ye,contentHash:u.content_hash,title:u.name,minHeight:240})})]})}function Ze({item:s}){if(s.connectorPanel)return e.jsx(Me,{panel:s.connectorPanel});if(s.schemaSections)return e.jsx(b,{item:s});if(typeof s.browserUrl=="string"&&s.browserUrl.length>0)return e.jsx(S,{item:s});const t=s.href?te(s.href):null;return t?t.kind==="memory"?"runId"in t?e.jsx(v,{owner:t.owner,runId:t.runId}):"runIds"in t?e.jsx(v,{owner:t.owner,runIds:t.runIds}):e.jsx(v,{owner:t.owner,contentIds:t.contentIds}):t.kind==="entity"?e.jsx(Ge,{owner:t.owner,path:t.path}):t.kind==="event"?e.jsx(Je,{owner:t.owner,eventId:t.eventId,viewKey:t.viewKey}):s.runId?e.jsx(es,{owner:t.owner,automationId:t.automationId,runId:s.runId}):e.jsx(ss,{owner:t.owner,automationId:t.automationId,initialView:t.view??"activity",runId:t.runId}):e.jsx(S,{item:s})}function S({item:s}){const t=s.body,r=s.notificationType??"generic",n=s.createdAt,a=s.browserUrl??null,i=s.browserHandoff??null;return e.jsxs("article",{className:"space-y-4 px-5 py-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(ne,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-0.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:ae(r)}),n?e.jsx("span",{children:re(n)}):null]})]}),t?e.jsx("div",{className:"text-sm leading-6 text-foreground/90",children:e.jsx(ie,{text:t,linkPolicy:r==="action_approval_needed"?"app-links":"strip"})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No additional details were provided."}),s.owner&&s.sourceAttribution?e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground/80",children:"Generated from"}),e.jsx(oe,{owner:s.owner,source:s.sourceAttribution,className:"text-xs"})]}):null,a?e.jsx("div",{className:"space-y-2",children:i?.state==="expired"?e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:i.error_message??"This draft expired before the page was opened."}):i?.state==="completed"?e.jsx("p",{className:"text-sm text-muted-foreground",children:"This handoff has already been activated in Chrome."}):e.jsxs(p,{type:"button",size:"sm",className:"h-8 text-sm",onClick:()=>{de(a)},children:[e.jsx(ce,{className:"mr-1.5 h-3.5 w-3.5"}),"Open post"]})}):null]})}function es({owner:s,automationId:t,runId:r}){const{organizationId:n}=Ae(s),a=le(t,void 0,n),i=a.data?.automation?.managed_agent_id??null;return i?e.jsx(Ie,{agentId:i,automationId:t,ownerSlug:s,runId:r}):a.isLoading?e.jsx(g,{className:"h-24 w-full rounded-lg"}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"This run has no agent transcript."})}function ss({owner:s,automationId:t,initialView:r,runId:n}){const[a,i]=f.useState(r),o=a==="definition";return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(p,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-foreground",onClick:()=>i(o?"activity":"definition"),children:o?"Done":e.jsxs(e.Fragment,{children:[e.jsx(ue,{className:"h-3.5 w-3.5"}),"Edit"]})})}),e.jsx(Pe,{owner:s,agentId:null,automationId:t,view:a,runId:n,onDone:()=>i("activity")})]})}function ts(){const s=L(),t=me();return s?.item?e.jsx(ns,{item:s.item,onClose:s.close,onBack:s.back,isNarrow:t}):null}function ns({item:s,onClose:t,onBack:r,isNarrow:n}){const a=s.href?xe(s.href):null;f.useEffect(()=>{if(n)return;const c=d=>{d.key==="Escape"&&(d.preventDefault(),t())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[t,n]);const i=c=>e.jsxs("div",{className:"flex h-11 shrink-0 items-center gap-1 border-b border-border px-3",children:[r||c?e.jsx(p,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Back",onClick:r??t,children:e.jsx(ye,{className:"h-4 w-4"})}):null,e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:s.title}),a?e.jsx(p,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Open full page",asChild:!0,children:e.jsx(A,{to:a.pathname,search:a.search??{},onClick:t,children:e.jsx(ve,{className:"h-4 w-4"})})}):null,e.jsx(p,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Close preview",onClick:t,children:e.jsx(Ne,{className:"h-4 w-4"})})]}),o=e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(Ze,{item:s})});return n?e.jsx(pe,{open:!0,onOpenChange:c=>{c||t()},children:e.jsxs(he,{children:[e.jsx(fe,{className:"fixed inset-0 z-40 bg-black/60 data-[state=open]:animate-in data-[state=open]:fade-in-0"}),e.jsxs(ge,{"aria-describedby":void 0,className:"fixed inset-y-0 right-0 z-50 flex w-full max-w-[460px] flex-col border-l border-border bg-background outline-none data-[state=open]:animate-in data-[state=open]:slide-in-from-right",children:[e.jsx(je,{className:"sr-only",children:s.title}),i(!0),o]})]})}):e.jsxs("aside",{className:"flex w-[460px] max-w-[45vw] shrink-0 flex-col border-l border-border bg-background",children:[i(!1),o]})}function Ds(){const{owner:s}=ke.useParams(),{data:t,isLoading:r,error:n}=k(s==="me"?null:s,{slug:s}),{session:a,isReady:i}=_(),o=be(n)&&!t?.workspace;return we({active:!r&&!o&&i&&!a&&!t?.workspace,owner:s})?null:e.jsx(Ce,{children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-row",children:[e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto",children:e.jsx(Se,{})}),e.jsx(ts,{})]})})}export{Ds as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{hQ as p,j as e,bV as m}from"./index-DtRfQcRH.js";import{M as i}from"./memory-browse-page-Bibfs2sK.js";import"./switch-CxDXvPGE.js";import"./entity-type-page-BrWqk6so.js";import"./json-diff-DYeX-xLk.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./code-editor-BHiWR94J.js";import"./schema-value-normalization-BspxVEGy.js";import"./calendar-CHXehtu0.js";import"./core.esm-C-eNiUAl.js";import"./renderer-1nRJFMGx.js";import"./card-4Ull9W6d.js";import"./view-frame-HoBawpT2.js";import"./app-bridge-BH3g2mKG.js";import"./missing-view-CD4DOaG8.js";import"./use-applied-views-DvMT3wap.js";import"./member-scope-gate-CJqJZk7T.js";function M(){const{owner:t,entityType:o,shape:r}=p.useParams();return e.jsx(i,{ownerSlug:t,typeScope:m(o),create:!1,shape:r})}export{M as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{hY as i,j as e}from"./index-DtRfQcRH.js";import{b as m}from"./agent-skills-route-Cwq1QrhW.js";import"./agent-subpage-shell-DtzoRy6N.js";import"./agent-skill-context-s42Q4Wjo.js";import"./core.esm-C-eNiUAl.js";import"./skill-editor-D_W3QlRz.js";import"./agent-loading-shells-BQLjzMPy.js";import"./agent-card-controls-bhTMPoVi.js";import"./switch-CxDXvPGE.js";function f(){const{owner:t,agentId:o,skillKey:r}=i.useParams();return e.jsx(m,{owner:t,agentId:o,skillKey:r})}export{f as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{dq as d,a3 as m,a4 as x,dr as y,cz as c,j as t,c1 as g}from"./index-DtRfQcRH.js";import{E as u}from"./entity-type-page-BrWqk6so.js";import"./json-diff-DYeX-xLk.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./code-editor-BHiWR94J.js";function N(){const{owner:a,slug:n}=d.useParams(),{orgContext:s}=m(),o=x(),{data:i=[],isLoading:r}=y(s),e=i.find(l=>l.slug===n)??null,p=e?c(e):!1;return t.jsx("div",{className:"flex flex-1 flex-col gap-4 px-4 py-6 lg:px-6",children:t.jsx("div",{className:"max-w-3xl",children:r?t.jsx(g,{label:"entity type",variant:"panel"}):e?t.jsx(u,{entityType:e,orgContext:s,hideDelete:p,onClose:()=>{o({to:"/$owner/data",params:{owner:a}})}}):t.jsx("div",{className:"text-sm text-muted-foreground",children:"Entity type not found."})})})}export{N as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i1 as e,j as i,bV as p}from"./index-DtRfQcRH.js";import{M as m}from"./memory-browse-page-Bibfs2sK.js";import"./switch-CxDXvPGE.js";import"./entity-type-page-BrWqk6so.js";import"./json-diff-DYeX-xLk.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./code-editor-BHiWR94J.js";import"./schema-value-normalization-BspxVEGy.js";import"./calendar-CHXehtu0.js";import"./core.esm-C-eNiUAl.js";import"./renderer-1nRJFMGx.js";import"./card-4Ull9W6d.js";import"./view-frame-HoBawpT2.js";import"./app-bridge-BH3g2mKG.js";import"./missing-view-CD4DOaG8.js";import"./use-applied-views-DvMT3wap.js";import"./member-scope-gate-CJqJZk7T.js";function S(){const{owner:t,entityType:o,viewKey:r}=e.useParams();return i.jsx(m,{ownerSlug:t,typeScope:p(o),create:!1,viewKey:r})}export{S as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{hW as t,j as m}from"./index-DtRfQcRH.js";import{M as i}from"./memory-browse-page-Bibfs2sK.js";import"./switch-CxDXvPGE.js";import"./entity-type-page-BrWqk6so.js";import"./json-diff-DYeX-xLk.js";import"./index-CDz3-ieP.js";import"./index-Vcq4gwWv.js";import"./code-editor-BHiWR94J.js";import"./schema-value-normalization-BspxVEGy.js";import"./calendar-CHXehtu0.js";import"./core.esm-C-eNiUAl.js";import"./renderer-1nRJFMGx.js";import"./card-4Ull9W6d.js";import"./view-frame-HoBawpT2.js";import"./app-bridge-BH3g2mKG.js";import"./missing-view-CD4DOaG8.js";import"./use-applied-views-DvMT3wap.js";import"./member-scope-gate-CJqJZk7T.js";function v(){const{owner:o,viewKey:r}=t.useParams();return m.jsx(i,{ownerSlug:o,create:!1,viewKey:r})}export{v as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i2 as i,gF as n,j as m}from"./index-DtRfQcRH.js";import{E as p}from"./event-page-LIm4EDmJ.js";import"./events-feed-C4L8mQV7.js";import"./use-applied-views-DvMT3wap.js";import"./clients-C7ubnFsS.js";import"./renderer-1nRJFMGx.js";import"./card-4Ull9W6d.js";import"./view-frame-HoBawpT2.js";import"./app-bridge-BH3g2mKG.js";import"./missing-view-CD4DOaG8.js";function g(){const{owner:e,eventId:o,viewKey:r}=i.useParams(),t=n(o);return t===null?null:m.jsx(p,{owner:e,eventId:t,viewKey:r})}export{g as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{v as l,aB as u,r as c,ai as m,j as e,aC as d,as as h,az as f}from"./index-DtRfQcRH.js";import{S as v,A as x,a as g}from"./index-1YrrvVJ4.js";import{F as p}from"./full-page-spinner-DsU-Cb3L.js";function j({alt:t="",...a}){return e.jsx("img",{alt:t,...a,referrerPolicy:"no-referrer"})}function w({children:t}){const a=h(),n=async i=>{await a.invalidateQueries({queryKey:["organizations"]}),i()};return e.jsx(g,{authClient:f,navigate:i=>{n(()=>{window.location.href=i})},replace:i=>{n(()=>window.location.replace(i))},Link:({href:i,children:s,className:r})=>e.jsx("a",{href:i,className:r,children:s}),basePath:"/auth",redirectTo:"/",magicLink:!0,social:{providers:[]},avatar:{Image:j},children:t})}function b(){const{session:t,sessionResult:a}=l(),{invitationId:n}=u.useSearch(),i=c.useRef(!1);return c.useEffect(()=>{a.isPending||t||!n||i.current||(i.current=!0,(async()=>{let s=null;try{const o=await fetch(`${m}/api/invitation-preview?id=${encodeURIComponent(n)}`,{credentials:"omit"});o.ok&&(s=await o.json())}catch{}const r=new URL("/auth/login",window.location.origin);r.searchParams.set("callbackUrl",`/auth/accept-invitation?invitationId=${encodeURIComponent(n)}`),s&&(r.searchParams.set("loginHint",s.email),r.searchParams.set("invitationOrg",s.organizationName)),window.location.href=r.toString()})())},[t,a.isPending,n]),t&&!n?e.jsx("div",{className:"min-h-[calc(100vh-3.5rem)] flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-md text-center",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"mx-auto mb-6 h-8 w-auto"}),e.jsx(d,{className:"mx-auto h-10 w-10 text-destructive mb-4"}),e.jsx("h1",{className:"text-xl font-semibold",children:"Invitation not found"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"This invitation link is missing its ID. Ask the person who invited you to resend it."})]})}):t?e.jsxs("div",{className:"min-h-[calc(100vh-3.5rem)] flex flex-col items-center justify-center gap-6 p-4",children:[e.jsx("img",{src:"/lobu-logo.svg",alt:"Lobu",className:"h-8 w-auto"}),e.jsx(w,{children:e.jsx(v,{children:e.jsx(x,{})})})]}):e.jsx(p,{className:"min-h-[calc(100vh-3.5rem)]"})}export{b as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a4 as me,O as Ft,bz as Be,bf as Gn,r as h,ci as Un,j as e,bR as qe,L as Y,B as U,Z as Te,al as O,cj as Pt,ck as Mt,cl as $t,bL as Rt,cm as ze,cn as Ot,co as Wn,cp as Hn,ba as Qn,a5 as st,cq as Yn,cr as Xn,cs as Zn,ct as qn,cu as Jn,J as es,cv as he,cw as q,am as Kt,cx as ts,ah as _e,a3 as Vt,cy as Bt,cz as ns,bV as Ce,cA as zt,cB as ss,aR as Ie,cC as Gt,P as Ut,cD as os,cE as as,cF as le,cf as rs,cG as is,cH as cs,cI as ls,bv as ds,n as us,cJ as ms,cK as He,cL as fs,cM as ye,aH as Ae,cN as Le,cO as ps,cP as hs,cQ as Wt,cR as xs,cS as gs,aK as vs,cT as ys,ad as bs,b$ as Qe,cU as Ht,S as Qt,cV as js,cW as Yt,cX as Xt,bX as ws,bY as Ns,bZ as Ss,b_ as ks,cY as Cs,aV as Zt,v as _s,w as qt,cZ as Jt,c_ as Ts,c$ as wt,d0 as Is,d1 as As,d2 as Ls,a as Ds,d3 as Es,d4 as Fs,d5 as en,d6 as Ps,d7 as Ms,d8 as $s,d9 as Rs,da as Os,db as Ks,c2 as Vs,dc as Bs,dd as tn,bq as Oe,I as Nt,b7 as zs,de as Gs,df as Us,dg as Ws,dh as Hs,di as Qs,dj as Ys,p as Xs,q as Zs,dk as qs,c1 as St,dl as Js,dm as eo,a_ as to,dn as no,bO as so,dp as oo,aY as ao}from"./index-DtRfQcRH.js";import{A as ro}from"./device-automation-BIjs7DZJ.js";import{n as io}from"./agent-thread-storage-U6htL3ad.js";import{s as co}from"./pending-seed-CPbfgnLX.js";import{u as lo}from"./clients-C7ubnFsS.js";import{g as uo}from"./client-rows-EJSKR6z1.js";import{c as Je}from"./connection-label-BobuYiAG.js";import{E as mo}from"./events-feed-C4L8mQV7.js";import{C as fo}from"./calendar-CHXehtu0.js";import{L as po,u as ho}from"./renderer-1nRJFMGx.js";import{E as xo}from"./agent-loading-shells-BQLjzMPy.js";import{M as go}from"./member-scope-gate-CJqJZk7T.js";function Ke(t){return t.kind==="managed"?`managed:${t.agentId}`:`device:${t.executionTarget.deviceWorkerId}:${t.executionTarget.agentKind}`}function vo({ownerSlug:t}){const n=me(),o=Ft(),{data:s=[]}=Be(),{data:a=[]}=Gn(),[r,d]=h.useState(!1),[c,u]=h.useState(null),[i,m]=h.useState(""),[f,p]=h.useState(!1),v=h.useRef(null);h.useEffect(()=>{o&&r&&v.current?.focus()},[o,r]);const g=s.find(j=>j.system)??s[0]??null,x=h.useMemo(()=>{const j=s.map(T=>({kind:"managed",agentId:T.agentId,label:T.name})),L=g?a.filter(T=>T.online&&T.organization_slug===t&&T.capabilities.includes("automations.execute")&&(T.agent_kinds?.length??0)>0).flatMap(T=>(T.agent_kinds??[]).map(w=>({kind:"device",agentId:g.agentId,label:`${Un(T)} · ${ro[w]??w}`,executionTarget:{kind:"device",deviceWorkerId:T.id,agentKind:w}}))):[];return{managed:j,deviceTargets:L}},[s,g,a,t]),y=[...x.managed,...x.deviceTargets].find(j=>Ke(j)===c)??x.managed.find(j=>j.agentId===g?.agentId)??x.managed[0]??x.deviceTargets[0]??null,S=j=>{u(Ke(j)),p(!1)},C=()=>{const j=i.trim();if(!j||!y)return;const L=io();co(L,j,y.kind==="device"?y.executionTarget:void 0),m(""),n(Hn(t,y.agentId,L))};if(o&&!r){const j="flex h-14 w-14 items-center justify-center rounded-full border bg-background text-foreground transition-colors hover:bg-accent/60";return e.jsx("div",{className:"sticky bottom-0 z-20 mt-auto flex justify-center bg-gradient-to-t from-background via-background to-transparent pt-4 pb-1",children:y?e.jsx("button",{type:"button","aria-label":"Ask Lobu",className:j,onClick:()=>d(!0),children:e.jsx(qe,{className:"h-7 w-7"})}):e.jsx(Y,{to:"/$owner/agents",params:{owner:t},"aria-label":"Create an agent to start chatting",className:j,children:e.jsx(qe,{className:"h-7 w-7"})})})}return e.jsx("div",{className:"sticky bottom-0 z-20 mt-auto bg-gradient-to-t from-background via-background to-transparent pt-5",children:e.jsxs("div",{className:"relative rounded-2xl border bg-background transition-colors focus-within:ring-1 focus-within:ring-ring",children:[o?e.jsx(U,{type:"button",variant:"ghost",size:"icon","aria-label":"Collapse composer",className:"absolute top-1.5 right-1.5 size-7 shrink-0 text-muted-foreground hover:text-foreground",onClick:()=>d(!1),children:e.jsx(Te,{className:"h-4 w-4"})}):null,y?e.jsx("textarea",{value:i,onChange:j=>m(j.target.value),onKeyDown:j=>{j.key==="Enter"&&!j.shiftKey&&(j.preventDefault(),C())},placeholder:"Ask Lobu…",rows:2,ref:v,className:O("max-h-40 min-h-16 w-full resize-none bg-transparent px-4 pt-3 text-sm outline-none placeholder:text-muted-foreground",o&&"pr-10")}):e.jsx(Y,{to:"/$owner/agents",params:{owner:t},className:O("block min-h-16 px-4 pt-3 text-sm text-muted-foreground hover:text-foreground",o&&"pr-10"),children:"Create an agent to start chatting"}),e.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 pb-2",children:[e.jsxs(Pt,{open:f,onOpenChange:p,children:[e.jsx(Mt,{asChild:!0,children:e.jsxs(U,{type:"button",variant:"ghost",size:"sm",disabled:!y,className:"h-8 max-w-[70%] gap-1.5 px-2 text-xs text-muted-foreground",children:[y?.kind==="device"?e.jsx($t,{className:"h-3.5 w-3.5"}):e.jsx(Rt,{className:"h-3.5 w-3.5"}),e.jsxs("span",{className:"truncate",children:["Run with: ",y?.label??"No agent"]}),e.jsx(ze,{className:"h-3.5 w-3.5 shrink-0"})]})}),e.jsxs(Ot,{align:"start",className:"max-h-80 w-72 overflow-y-auto p-1.5",children:[e.jsx("p",{className:"px-2 py-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Lobu agents"}),x.managed.map(j=>e.jsx(kt,{target:j,selected:y,onSelect:S},j.agentId)),x.deviceTargets.length>0?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"my-1 h-px bg-border"}),e.jsx("p",{className:"px-2 py-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:"Devices"}),x.deviceTargets.map(j=>e.jsx(kt,{target:j,selected:y,onSelect:S},`${j.executionTarget.deviceWorkerId}:${j.executionTarget.agentKind}`))]}):null]})]}),e.jsxs(U,{type:"button",size:"icon",className:"h-8 w-8 rounded-full",disabled:!y||!i.trim(),onClick:C,children:[e.jsx(Wn,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Send message"})]})]})]})})}function kt({target:t,selected:n,onSelect:o}){const s=n?Ke(n)===Ke(t):!1;return e.jsxs("button",{type:"button",className:O("flex w-full items-center gap-2 rounded-md px-2 py-2 text-left text-sm hover:bg-accent",s&&"bg-accent"),onClick:()=>o(t),children:[t.kind==="device"?e.jsx($t,{className:"h-4 w-4 shrink-0"}):e.jsx(Rt,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:t.label})]})}const ot=h.createContext(null);function yo({organizationId:t,isWorkspaceLoading:n,children:o}){const{data:s=[],isLoading:a}=Qn(t);return e.jsx(ot.Provider,{value:{groups:s,isLoading:!!n||a},children:o})}function bo(){const t=h.useContext(ot);if(!t)throw new Error("useMemoryConnectorGroups must be used within MemoryConnectorGroupsProvider");return t}function jo(){return h.useContext(ot)}function wo(t){const{parse:n,serialize:o,filterKeys:s,clearClassifications:a=!0,merge:r}=t,d=me(),c=st(),u=h.useMemo(()=>{const f=Object.entries(c.search||{}).filter(v=>v[1]!==void 0&&v[1]!==null),p=new URLSearchParams(f);return n(p)},[c.search,n]),i=h.useCallback(f=>{const p=r?r(u,f):{...u,...f},v=o(p),g={};for(const[x,k]of Object.entries(c.search||{}))k!=null&&(g[x]=k);for(const x of s)delete g[x];if(a)for(const x of Object.keys(g))x.startsWith("clf_")&&delete g[x];for(const[x,k]of Object.entries(v))k!==void 0&&(g[x]=k);d({to:c.pathname,search:g,replace:!0})},[u,o,s,a,r,d,c]),m=h.useCallback(()=>{const f={};for(const[p,v]of Object.entries(c.search||{}))v!=null&&(s.includes(p)||a&&p.startsWith("clf_")||(f[p]=v));d({to:c.pathname,search:f,replace:!0})},[d,c.pathname,c.search,s,a]);return{filters:u,updateFilters:i,clearFilters:m}}function nn(t){const{slug:n}=Yn();return Xn({queryKey:["schedules",n,t],queryFn:async()=>((await Zn("manage_schedules",{action:"list",action_type:"wake_agent",include_paused:!0})).schedules??[]).filter(s=>s.action_args?.agent_id===t),enabled:!!n&&!!t,staleTime:3e4})}function No(t,n){if(t.length===0)return"";const o=t.map(s=>{const a=n.find(r=>r.id===s);return a?Je(a):null}).filter(s=>s!=null);return o.length===0?`Filtered by connection${t.length>1?"s":""} #${t.join(", #")}`:o.length===1?`From ${o[0]}`:`From ${o.join(", ")}`}function So(t,n){if(t.length===0)return"";const s=t.map(a=>{const r=n.find(u=>u.id===a);if(!r)return null;const d=r.connection_name?.trim()||r.connector_name||r.connector_key||`connection #${r.connection_id}`,c=r.display_name?.trim()||r.feed_key||`feed #${r.id}`;return`${d} · ${c}`}).filter(a=>a!=null);return s.length===0?`Filtered by feed${t.length>1?"s":""} #${t.join(", #")}`:s.length===1?`From ${s[0]}`:`From ${s.join("; ")}`}function ko(t,n){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:t,connectorKey:n.connector_key,connectionId:String(n.connection_id)},search:{feedId:n.id}}}function Co(t,n){return{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:t,connectorKey:n.connector_key,connectionId:String(n.id)}}}function _o(t,n){return{to:"/$owner/agents/connected/$clientId",params:{owner:t,clientId:n}}}function Ct(t,n){return{to:"/$owner/events",params:{owner:t},search:{agent:n}}}function To(t,n){return{to:"/$owner/automations/$automationId",params:{owner:t,automationId:n}}}function Io(t,n,o){return{to:"/$owner/events",params:{owner:t},search:{agent:n,schedule:o}}}function Ao({text:t,sourceLink:n,details:o,onClear:s}){return e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-2 rounded-lg border border-border bg-muted/50 px-3 py-2 text-sm",children:[e.jsx(Jn,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),n?e.jsxs(Y,{to:n.to,params:n.params,search:n.search,className:"inline-flex min-w-0 items-center gap-1.5 font-medium text-foreground hover:underline",children:[e.jsx("span",{className:"truncate",children:t}),e.jsx(es,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}):e.jsx("span",{className:"min-w-0 truncate text-muted-foreground",children:t}),o,e.jsx(U,{variant:"ghost",size:"icon",className:"ml-auto h-5 w-5 shrink-0",onClick:s,"aria-label":"Clear filter",children:e.jsx(Te,{className:"h-3.5 w-3.5"})})]})}function Lo({ownerSlug:t,clientIds:n,linkedUser:o,linkedUserEntitySlug:s}){const a=t&&s?qn(t,[{entity_type:"$member",slug:s}]):null;return e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"inline-flex min-w-0 flex-wrap items-baseline gap-x-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:n.length===1?"Client ID":"Client IDs"}),n.map(r=>e.jsx("code",{className:"break-all text-foreground",children:r},r))]}),o?e.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:["Granted by",a?e.jsx(Y,{to:a,className:"font-medium text-foreground hover:underline",children:o}):e.jsx("span",{className:"font-medium text-foreground",children:o})]}):null]})}function ke(t){return t&&typeof t=="object"&&!Array.isArray(t)?t:null}function $e(t,n,o){const s=new Set;for(const[a,r]of Object.entries(t.feeds_schema??{})){if(o&&!o.has(a))continue;const d=ke(ke(r)?.eventKinds);if(d)for(const[c,u]of Object.entries(d)){if(!n){s.add(c);continue}const i=ke(u)?.attributions;Array.isArray(i)&&i.some(m=>{const f=ke(ke(m)?.target);return typeof f?.entityType=="string"&&n.has(f.entityType)})&&s.add(c)}}return s}function Do({connectors:t,entityTypes:n,selectedPlatforms:o=[],selectedFeeds:s=[],selectedEntityTypes:a=[]}){const r=new Set,d=new Set(o),c=new Set(a),u=new Map;for(const i of s){const m=u.get(i.connectorKey)??new Set;m.add(i.feedKey),u.set(i.connectorKey,m)}if(u.size>0)for(const i of t){const m=u.get(i.key);if(m)for(const f of $e(i,void 0,m))r.add(f)}else if(d.size>0){for(const i of t)if(d.has(i.key))for(const m of $e(i))r.add(m)}else if(c.size>0){for(const i of n)if(c.has(i.slug))for(const m of Object.keys(i.event_kinds??{}))r.add(m);for(const i of t)for(const m of $e(i,c))r.add(m)}else{for(const i of n)for(const m of Object.keys(i.event_kinds??{}))r.add(m);for(const i of t)for(const m of $e(i))r.add(m)}return[...r].sort((i,m)=>i.localeCompare(m))}function Eo({connectors:t,selectedKeys:n,onToggle:o,label:s="Connectors",searchPlaceholder:a="Search connectors...",emptyText:r="No connectors found"}){return e.jsx(he,{contentClassName:"w-80",searchPlaceholder:a,emptyText:r,trigger:()=>e.jsxs(U,{variant:"outline",className:"h-9",children:[s,n.length>0&&e.jsx(_e,{variant:"secondary",className:"ml-2 h-5 px-1.5",children:n.length})]}),children:()=>t.map(d=>e.jsxs(q,{onSelect:()=>o(d.key),children:[e.jsx(Kt,{checked:n.includes(d.key),className:"mr-3"}),e.jsx(ts,{connector:d,className:"flex-1"}),typeof d.count=="number"&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:d.count.toLocaleString()})]},d.key))})}function Fo(t){const{orgContext:n}=Vt(),{data:o=[],isLoading:s}=Bt(n);return{visible:h.useMemo(()=>o.filter(r=>!ns(r)&&(!r.organization_slug||r.organization_slug===t)),[o,t]),isTypesLoading:s}}function be(){return st().search??{}}function Po({ownerSlug:t,typeScope:n,agentScope:o,connectionScope:s,feedScope:a,visibility:r="all"}){const d=be(),c=typeof d.type=="string"&&d.type.trim()?d.type.trim():void 0,u=n??(c?Ce(c):void 0),i=o??zt(d),m=s??ss(d),f=a??(typeof d.feed_ids=="string"?d.feed_ids:typeof d.feed_ids=="number"?String(d.feed_ids):void 0),p=k=>r==="all"||(r==="active"?k:!k),v=p(!!u),g=p(!!i),x=p(!!(m||f));return!v&&!g&&!x?null:e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[v?e.jsx(Mo,{ownerSlug:t,typeScope:u}):null,g?e.jsx($o,{ownerSlug:t,agentScope:i}):null,x?e.jsx(Ro,{ownerSlug:t,connectionScope:m,feedScope:f}):null]})}const De=h.forwardRef(function({open:n,label:o,value:s,disabled:a,disabledReason:r,...d},c){const u=e.jsxs(U,{ref:c,variant:"outline",disabled:a,"aria-expanded":n,className:"h-9 gap-1.5 rounded-md bg-muted px-3 py-2 text-sm font-normal",...d,children:[e.jsx("span",{className:"text-muted-foreground",children:o}),s?e.jsx("span",{className:"max-w-[10rem] truncate font-medium",children:s}):e.jsx("span",{className:"text-muted-foreground",children:"Any"}),e.jsx(ze,{className:"h-3.5 w-3.5 shrink-0 opacity-60"})]});return a&&r?e.jsxs(is,{children:[e.jsx(cs,{asChild:!0,children:e.jsx("span",{className:"inline-flex",children:u})}),e.jsx(ls,{children:r})]}):u});function Mo({ownerSlug:t,typeScope:n}){const o=me(),s=be(),{visible:a}=Fo(t),r=a.find(u=>u.slug===n),d=u=>{o(le(t,s,{entity:void 0,create:void 0,type:u}))},c=()=>{o(le(t,s,{type:void 0}))};return e.jsx(he,{contentClassName:"w-72",searchPlaceholder:"Search types...",emptyText:"No entity types",trigger:u=>e.jsx(De,{open:u,label:"Type",value:r?.name}),children:u=>e.jsxs(e.Fragment,{children:[n?e.jsx(q,{onSelect:()=>{c(),u()},className:"text-muted-foreground",children:"Clear type"}):null,a.map(i=>e.jsxs(q,{onSelect:()=>{d(i.slug),u()},className:"group gap-2",children:[e.jsx(Ie,{className:Ee(i.slug===n)}),e.jsx(Gt,{icon:i.icon,className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:i.name}),typeof i.entity_count=="number"?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:i.entity_count}):null,e.jsx(at,{to:"/$owner/entity-types/$slug",params:{owner:t,slug:i.slug},label:i.name})]},i.id)),e.jsxs(q,{onSelect:()=>{o(os(t)),u()},className:"text-muted-foreground",children:[e.jsx(Ut,{className:"h-4 w-4 shrink-0"}),"Add entity type"]})]})})}function $o({ownerSlug:t,agentScope:n}){const o=me(),s=be(),{data:a=[]}=Be(),r=h.useMemo(()=>[...a].sort((i,m)=>i.name.localeCompare(m.name)),[a]),d=r.find(i=>i.agentId===n),c=i=>{o(le(t,s,_t(s,i)))},u=()=>{o(le(t,s,_t(s,void 0)))};return e.jsx(he,{contentClassName:"w-72",searchPlaceholder:"Search agents...",emptyText:"No agents",trigger:i=>e.jsx(De,{open:i,label:"Agent",value:d?.name}),children:i=>e.jsxs(e.Fragment,{children:[n?e.jsx(q,{onSelect:()=>{u(),i()},className:"text-muted-foreground",children:"Clear agent"}):null,r.map(m=>e.jsxs(q,{onSelect:()=>{c(m.agentId),i()},className:"gap-2",children:[e.jsx(Ie,{className:Ee(m.agentId===n)}),e.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded-md bg-muted text-[10px] font-medium",children:m.name.trim().charAt(0).toUpperCase()||"?"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:m.name})]},m.agentId))]})})}function _t(t,n){const o={agent:n,automation:void 0,schedule:void 0,platforms:void 0};return t.schedule!=null&&(o.run_ids=void 0),typeof t.platforms=="string"&&t.platforms.trim().length>0&&(o.connection_ids=void 0,o.feed_ids=void 0),o}function Ro({ownerSlug:t,connectionScope:n,feedScope:o}){const{groups:s}=bo(),a=h.useMemo(()=>new Set((n??"").split(",").map(u=>u.trim()).filter(Boolean)),[n]),r=as(s,a),d=s.find(u=>u.connector_key===r),c=a.size===1?Number([...a][0]):void 0;return e.jsxs(e.Fragment,{children:[e.jsx(Oo,{ownerSlug:t,groups:s,scopedGroup:d}),d?e.jsx(Ko,{ownerSlug:t,group:d,selectedIds:a}):null,c?e.jsx(Vo,{ownerSlug:t,connectionId:c,feedScope:o}):null]})}function Oo({ownerSlug:t,groups:n,scopedGroup:o}){const s=me(),a=be(),r=u=>{const i=u.connections.map(m=>String(m.id)).join(",");i&&s(le(t,a,{connection_ids:i,feed_ids:void 0}))},d=()=>{s(le(t,a,{connection_ids:void 0,feed_ids:void 0}))},c=o?.connector_name??o?.connector_key;return e.jsx(he,{contentClassName:"w-72",searchPlaceholder:"Search connectors...",emptyText:"No connectors",trigger:u=>e.jsx(De,{open:u,label:"Connector",value:c}),children:u=>e.jsxs(e.Fragment,{children:[o?e.jsx(q,{onSelect:()=>{d(),u()},className:"text-muted-foreground",children:"Clear connector"}):null,n.map(i=>{const m=i.connector_name??i.connector_key;return e.jsxs(q,{disabled:i.connections.length===0,onSelect:()=>{r(i),u()},className:"group gap-2",children:[e.jsx(Ie,{className:Ee(i.connector_key===o?.connector_key)}),e.jsx(ds,{plain:!0,name:m,faviconDomain:i.favicon_domain,className:"h-5 w-5 shrink-0 rounded-md text-[10px]"}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:m}),i.connection_count>0?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:i.connection_count}):null,e.jsx(at,{to:"/$owner/connectors/$connectorKey",params:{owner:t,connectorKey:i.connector_key},label:m})]},i.connector_key)}),e.jsx(Bo,{to:"/$owner/connectors/create",params:{owner:t},label:"Add connector",onSelect:u})]})})}function Ko({ownerSlug:t,group:n,selectedIds:o}){const s=me(),a=be(),r=o.size===1?n.connections.find(u=>o.has(String(u.id))):void 0,d=u=>{s(le(t,a,{connection_ids:String(u),feed_ids:void 0}))},c=r?Je({display_name:r.display_name,connector_name:n.connector_name,connector_key:n.connector_key}):"All connections";return e.jsx(he,{contentClassName:"w-72",searchPlaceholder:"Search connections...",emptyText:"No connections",trigger:u=>e.jsx(De,{open:u,label:"Connection",value:c}),children:u=>n.connections.map(i=>{const m=Je({display_name:i.display_name,connector_name:n.connector_name,connector_key:n.connector_key});return e.jsxs(q,{onSelect:()=>{d(i.id),u()},className:"group gap-2",children:[e.jsx(Ie,{className:Ee(o.has(String(i.id)))}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:m}),i.feed_count>0?e.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:i.feed_count}):null,e.jsx(at,{to:"/$owner/connectors/$connectorKey/$connectionId",params:{owner:t,connectorKey:n.connector_key,connectionId:String(i.id)},label:m})]},i.id)})})}function Vo({ownerSlug:t,connectionId:n,feedScope:o}){const s=me(),a=be(),{data:r=[],isLoading:d}=us(n),c=h.useMemo(()=>new Set((o??"").split(",").map(f=>f.trim()).filter(Boolean)),[o]),u=c.size===1?r.find(f=>c.has(String(f.id))):void 0,i=f=>{s(le(t,a,{connection_ids:String(n),feed_ids:String(f.id)}))},m=()=>{s(le(t,a,{connection_ids:String(n),feed_ids:void 0}))};return e.jsx(he,{contentClassName:"w-72",searchPlaceholder:"Search feeds...",emptyText:d?"Loading feeds...":"No feeds",trigger:f=>e.jsx(De,{open:f,label:"Feed",value:u?Tt(u):void 0}),children:f=>e.jsxs(e.Fragment,{children:[c.size>0?e.jsx(q,{onSelect:()=>{m(),f()},className:"text-muted-foreground",children:"Clear feed"}):null,r.map(p=>e.jsxs(q,{onSelect:()=>{i(p),f()},className:"gap-2",children:[e.jsx(Ie,{className:Ee(c.has(String(p.id)))}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:Tt(p)})]},p.id))]})})}function Tt(t){return t.display_name?.trim()||t.feed_key}function at({to:t,params:n,label:o}){return e.jsx(Y,{to:t,params:n,onClick:s=>s.stopPropagation(),onPointerDown:s=>s.stopPropagation(),className:"shrink-0 rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:text-foreground group-hover:opacity-100 focus-visible:opacity-100","aria-label":`Manage ${o}`,children:e.jsx(rs,{className:"h-3.5 w-3.5"})})}function Bo({to:t,params:n,label:o,onSelect:s}){return e.jsx(q,{asChild:!0,onSelect:s,className:"text-muted-foreground",children:e.jsxs(Y,{to:t,params:n,className:"flex items-center gap-2",children:[e.jsx(Ut,{className:"h-4 w-4 shrink-0"}),o]})})}function Ee(t){return t?"h-4 w-4 shrink-0 opacity-100":"h-4 w-4 shrink-0 opacity-0"}function zo({value:t,onChange:n,onClear:o,placeholder:s="Pick a date range",className:a,align:r="start"}){const d=t?.from!=null,c=d&&o!=null;return e.jsxs("div",{className:O("relative grid gap-2",a),children:[e.jsxs(Pt,{children:[e.jsx(Mt,{asChild:!0,children:e.jsxs(U,{id:"date",variant:"outline",className:O("relative w-full justify-start rounded-md bg-muted px-3 text-left font-normal",!d&&"text-muted-foreground",c&&"pr-8"),children:[e.jsx(ms,{className:"mr-2 h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:t?.from?t.to?e.jsxs(e.Fragment,{children:[He(t.from,"LLL dd, y")," -"," ",He(t.to,"LLL dd, y")]}):He(t.from,"LLL dd, y"):s})]})}),e.jsx(Ot,{className:"w-auto p-0",align:r,children:e.jsx(fo,{initialFocus:!0,mode:"range",defaultMonth:t?.from,selected:t,onSelect:n,numberOfMonths:2})})]}),c&&e.jsx("button",{type:"button","aria-label":"Clear date range",onClick:o,className:"absolute right-2 top-1/2 z-10 -translate-y-1/2 rounded-sm p-0.5 text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(Te,{className:"h-3.5 w-3.5"})})]})}var sn=["PageUp","PageDown"],on=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],an={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},je="Slider",[et,Go,Uo]=ps(je),[rt]=vs(je,[Uo]),[Wo,Fe]=rt(je),it=h.forwardRef((t,n)=>{const{name:o,min:s=0,max:a=100,step:r=1,orientation:d="horizontal",disabled:c=!1,minStepsBetweenThumbs:u=0,defaultValue:i=[s],value:m,onValueChange:f=()=>{},onValueCommit:p=()=>{},inverted:v=!1,form:g,...x}=t,k=h.useRef(new Set),y=h.useRef(0),S=h.useRef(!1),j=d==="horizontal"?Ho:Qo,[L=[],T]=fs({prop:m,defaultProp:i,onChange:E=>{[...k.current][y.current]?.focus({preventScroll:!0,focusVisible:S.current}),S.current=!1,f(E)}}),w=h.useRef(L);function W(E){const $=qo(L,E);J(E,$)}function ae(E){J(E,y.current)}function re(){const E=w.current[y.current];L[y.current]!==E&&p(L)}function J(E,$,{commit:H}={commit:!1}){const ie=na(r),B=sa(Math.round((E-s)/r)*r+s,ie),A=Wt(B,[s,a]);T((M=[])=>{const z=Xo(M,A,$);if(ta(z,u*r)){y.current=z.indexOf(A);const G=String(z)!==String(M);return G&&H&&p(z),G?z:M}else return M})}return e.jsx(Wo,{scope:t.__scopeSlider,name:o,disabled:c,min:s,max:a,valueIndexToChangeRef:y,thumbs:k.current,values:L,orientation:d,form:g,children:e.jsx(et.Provider,{scope:t.__scopeSlider,children:e.jsx(et.Slot,{scope:t.__scopeSlider,children:e.jsx(j,{"aria-disabled":c,"data-disabled":c?"":void 0,...x,ref:n,onPointerDown:ye(x.onPointerDown,()=>{c||(w.current=L,S.current=!1)}),min:s,max:a,inverted:v,onSlideStart:c?void 0:W,onSlideMove:c?void 0:ae,onSlideEnd:c?void 0:re,onHomeKeyDown:()=>{c||(S.current=!0,J(s,0,{commit:!0}))},onEndKeyDown:()=>{c||(S.current=!0,J(a,L.length-1,{commit:!0}))},onStepKeyDown:({event:E,direction:$})=>{if(!c){S.current=!0;const B=sn.includes(E.key)||E.shiftKey&&on.includes(E.key)?10:1,A=y.current,M=L[A],z=r*B*$;J(M+z,A,{commit:!0})}}})})})})});it.displayName=je;var[rn,cn]=rt(je,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Ho=h.forwardRef((t,n)=>{const{min:o,max:s,dir:a,inverted:r,onSlideStart:d,onSlideMove:c,onSlideEnd:u,onStepKeyDown:i,...m}=t,[f,p]=h.useState(null),v=Le(n,C=>p(C)),g=h.useRef(void 0),x=hs(a),k=x==="ltr",y=k&&!r||!k&&r;function S(C){const j=g.current||f.getBoundingClientRect(),L=[0,j.width],w=ct(L,y?[o,s]:[s,o]);return g.current=j,w(C-j.left)}return e.jsx(rn,{scope:t.__scopeSlider,startEdge:y?"left":"right",endEdge:y?"right":"left",direction:y?1:-1,size:"width",children:e.jsx(ln,{dir:x,"data-orientation":"horizontal",...m,ref:v,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:C=>{const j=S(C.clientX);d?.(j)},onSlideMove:C=>{const j=S(C.clientX);c?.(j)},onSlideEnd:()=>{g.current=void 0,u?.()},onStepKeyDown:C=>{const L=an[y?"from-left":"from-right"].includes(C.key);i?.({event:C,direction:L?-1:1})}})})}),Qo=h.forwardRef((t,n)=>{const{min:o,max:s,inverted:a,onSlideStart:r,onSlideMove:d,onSlideEnd:c,onStepKeyDown:u,...i}=t,m=h.useRef(null),f=Le(n,m),p=h.useRef(void 0),v=!a;function g(x){const k=p.current||m.current.getBoundingClientRect(),y=[0,k.height],C=ct(y,v?[s,o]:[o,s]);return p.current=k,C(x-k.top)}return e.jsx(rn,{scope:t.__scopeSlider,startEdge:v?"bottom":"top",endEdge:v?"top":"bottom",size:"height",direction:v?1:-1,children:e.jsx(ln,{"data-orientation":"vertical",...i,ref:f,style:{...i.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:x=>{const k=g(x.clientY);r?.(k)},onSlideMove:x=>{const k=g(x.clientY);d?.(k)},onSlideEnd:()=>{p.current=void 0,c?.()},onStepKeyDown:x=>{const y=an[v?"from-bottom":"from-top"].includes(x.key);u?.({event:x,direction:y?-1:1})}})})}),ln=h.forwardRef((t,n)=>{const{__scopeSlider:o,onSlideStart:s,onSlideMove:a,onSlideEnd:r,onHomeKeyDown:d,onEndKeyDown:c,onStepKeyDown:u,...i}=t,m=Fe(je,o);return e.jsx(Ae.span,{...i,ref:n,onKeyDown:ye(t.onKeyDown,f=>{f.key==="Home"?(d(f),f.preventDefault()):f.key==="End"?(c(f),f.preventDefault()):sn.concat(on).includes(f.key)&&(u(f),f.preventDefault())}),onPointerDown:ye(t.onPointerDown,f=>{const p=f.target;p.setPointerCapture(f.pointerId),f.preventDefault(),m.thumbs.has(p)?p.focus({preventScroll:!0,focusVisible:!1}):s(f)}),onPointerMove:ye(t.onPointerMove,f=>{f.target.hasPointerCapture(f.pointerId)&&a(f)}),onPointerUp:ye(t.onPointerUp,f=>{const p=f.target;p.hasPointerCapture(f.pointerId)&&(p.releasePointerCapture(f.pointerId),r(f))})})}),dn="SliderTrack",un=h.forwardRef((t,n)=>{const{__scopeSlider:o,...s}=t,a=Fe(dn,o);return e.jsx(Ae.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...s,ref:n})});un.displayName=dn;var tt="SliderRange",mn=h.forwardRef((t,n)=>{const{__scopeSlider:o,...s}=t,a=Fe(tt,o),r=cn(tt,o),d=h.useRef(null),c=Le(n,d),u=a.values.length,i=a.values.map(p=>bn(p,a.min,a.max)),m=u>1?Math.min(...i):0,f=100-Math.max(...i);return e.jsx(Ae.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...s,ref:c,style:{...t.style,[r.startEdge]:m+"%",[r.endEdge]:f+"%"}})});mn.displayName=tt;var fn="SliderThumb",[Yo,pn]=rt(fn),hn="SliderThumbProvider";function xn(t){const{__scopeSlider:n,name:o,children:s,internal_do_not_use_render:a}=t,r=Fe(hn,n),d=Go(n),[c,u]=h.useState(null),i=h.useMemo(()=>c?d().findIndex(k=>k.ref.current===c):-1,[d,c]),m=xs(c),f=c?!!r.form||!!c.closest("form"):!0,p=r.values[i],v=o??(r.name?r.name+(r.values.length>1?"[]":""):void 0),g=p===void 0?0:bn(p,r.min,r.max);h.useEffect(()=>{if(c)return r.thumbs.add(c),()=>{r.thumbs.delete(c)}},[c,r.thumbs]);const x={value:p,name:v,form:r.form,isFormControl:f,index:i,thumb:c,onThumbChange:u,percent:g,size:m};return e.jsx(Yo,{scope:n,...x,children:oa(a)?a(x):s})}xn.displayName=hn;var Re="SliderThumbTrigger",gn=h.forwardRef((t,n)=>{const{__scopeSlider:o,...s}=t,a=Fe(Re,o),r=cn(Re,o),{index:d,value:c,percent:u,size:i,onThumbChange:m}=pn(Re,o),f=Le(n,x=>m(x)),p=Zo(d,a.values.length),v=i?.[r.size],g=v?Jo(v,u,r.direction):0;return e.jsx("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[r.startEdge]:`calc(${u}% + ${g}px)`},children:e.jsx(et.ItemSlot,{scope:o,children:e.jsx(Ae.span,{role:"slider","aria-label":t["aria-label"]||p,"aria-valuemin":a.min,"aria-valuenow":c,"aria-valuemax":a.max,"aria-orientation":a.orientation,"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,tabIndex:a.disabled?void 0:0,...s,ref:f,style:c===void 0?{display:"none"}:t.style,onFocus:ye(t.onFocus,()=>{a.valueIndexToChangeRef.current=d})})})})});gn.displayName=Re;var nt=h.forwardRef((t,n)=>{const{__scopeSlider:o,name:s,...a}=t;return e.jsx(xn,{__scopeSlider:o,name:s,internal_do_not_use_render:({index:r,isFormControl:d})=>e.jsxs(e.Fragment,{children:[e.jsx(gn,{...a,ref:n,__scopeSlider:o}),d?e.jsx(yn,{__scopeSlider:o},r):null]})})});nt.displayName=fn;var vn="SliderBubbleInput",yn=h.forwardRef(({__scopeSlider:t,...n},o)=>{const{value:s,name:a,form:r}=pn(vn,t),d=h.useRef(null),c=Le(d,o),u=gs(s);return h.useEffect(()=>{const i=d.current;if(!i)return;const m=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(m,"value").set;if(u!==s&&p){const v=new Event("input",{bubbles:!0});p.call(i,s),i.dispatchEvent(v)}},[u,s]),e.jsx(Ae.input,{style:{display:"none"},name:a,form:r,...n,ref:c,defaultValue:s})});yn.displayName=vn;function Xo(t=[],n,o){const s=[...t];return s[o]=n,s.sort((a,r)=>a-r)}function bn(t,n,o){const r=100/(o-n)*(t-n);return Wt(r,[0,100])}function Zo(t,n){return n>2?`Value ${t+1} of ${n}`:n===2?["Minimum","Maximum"][t]:void 0}function qo(t,n){if(t.length===1)return 0;const o=t.map(a=>Math.abs(a-n)),s=Math.min(...o);return o.indexOf(s)}function Jo(t,n,o){const s=t/2,r=ct([0,50],[0,s]);return(s-r(n)*o)*o}function ea(t){return t.slice(0,-1).map((n,o)=>t[o+1]-n)}function ta(t,n){if(n>0){const o=ea(t);return Math.min(...o)>=n}return!0}function ct(t,n){return o=>{if(t[0]===t[1]||n[0]===n[1])return n[0];const s=(n[1]-n[0])/(t[1]-t[0]);return n[0]+s*(o-t[0])}}function na(t){if(!Number.isFinite(t))return 0;const n=t.toString();if(n.includes("e")){const[s,a]=n.split("e"),r=s.split(".")[1]||"",d=Number(a);return Math.max(0,r.length-d)}const o=n.split(".")[1];return o?o.length:0}function sa(t,n){const o=Math.pow(10,n);return Math.round(t*o)/o}function oa(t){return typeof t=="function"}const jn=h.forwardRef(({className:t,...n},o)=>e.jsxs(it,{ref:o,className:O("relative flex w-full touch-none select-none items-center",t),...n,children:[e.jsx(un,{className:"relative h-1.5 w-full grow overflow-hidden rounded-full bg-primary/20",children:e.jsx(mn,{className:"absolute h-full bg-primary"})}),e.jsx(nt,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"}),n.value&&n.value.length>1&&e.jsx(nt,{className:"block h-4 w-4 rounded-full border border-primary/50 bg-background transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50"})]}));jn.displayName=it.displayName;const aa=["notification"],ra=["note","summary","decision","observation","fact","change","preference","identity"],ia=[...aa,...ra],ca="date-desc",It=[{value:"date-desc",label:"Newest first"},{value:"date-asc",label:"Oldest first"},{value:"score-desc",label:"Highest score"},{value:"score-asc",label:"Lowest score"}],At=[{value:"all",label:"Any reviewer"},{value:"user",label:"Manual review"},{value:"system",label:"Auto-classified"},{value:"llm",label:"LLM-classified"}],Lt=[{value:"all",label:"Any status"},{value:"pending",label:"Pending approval"},{value:"approved",label:"Approved"},{value:"rejected",label:"Rejected"},{value:"completed",label:"Completed"},{value:"failed",label:"Failed"}];function Ye(t,n){return e.jsxs("span",{className:"truncate",children:[e.jsxs("span",{className:"text-muted-foreground",children:[t,": "]}),n]})}function Ve(t){const n=t.replace(/[_-]+/g," ").trim();return n.length>0?`${n.charAt(0).toUpperCase()}${n.slice(1)}`:t}function la({options:t,selected:n,onChange:o}){return e.jsx(he,{contentClassName:"w-72",searchPlaceholder:"Search event kinds...",emptyText:"No event kinds found",trigger:s=>e.jsxs(U,{variant:"outline","aria-expanded":s,className:"h-9 rounded-md bg-muted px-3 py-2 font-normal",children:["Kind",n.length>0?e.jsx(_e,{variant:"secondary",className:"h-5 px-1.5",children:n.length}):null]}),children:()=>t.map(s=>{const a=n.includes(s);return e.jsxs(q,{value:`${Ve(s)} ${s}`,onSelect:()=>o(a?n.filter(r=>r!==s):[...n,s]),children:[e.jsx(Kt,{checked:a,className:"mr-1"}),Ve(s)]},s)})})}function wn({"aria-label":t,onClick:n}){return e.jsx("button",{type:"button","aria-label":t,onClick:o=>{o.preventDefault(),o.stopPropagation(),n()},className:"rounded-sm p-0.5 text-muted-foreground transition-colors hover:text-foreground",children:e.jsx(Te,{className:"h-3.5 w-3.5"})})}function Xe({value:t,onValueChange:n,onClear:o,showClear:s,triggerClassName:a,displayValue:r,children:d}){return e.jsxs("div",{className:"relative shrink-0",children:[e.jsxs(ws,{value:t,onValueChange:n,children:[e.jsx(Ns,{className:O("px-2.5",s&&"pr-9",a),children:e.jsx(Ss,{children:r})}),e.jsx(ks,{children:d})]}),s&&e.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-8 flex items-center",children:e.jsx("div",{className:"pointer-events-auto",children:e.jsx(wn,{"aria-label":"Clear filter",onClick:o})})})]})}function da({filters:t,onFiltersChange:n,connectors:o,eventKinds:s=[],searchQuery:a,onSearchChange:r,hideSourceFilter:d=!1,ownerSlug:c,total:u,isListLoading:i=!1,hasCursorInUrl:m=!1,onGoToLatest:f,open:p,onOpenChange:v,leading:g}){const x=a.trim().length>0,[k,y]=h.useState(x),S=p??k,C=v??y,j=t.dateRange?{from:t.dateRange[0],to:t.dateRange[1]}:void 0,L=N=>{N?.from&&N?.to?n({dateRange:[N.from,N.to]}):n({dateRange:null})},T=N=>{const X=t.platforms||[],_=X.includes(N)?X.filter(ue=>ue!==N):[...X,N];n({platforms:_})},w=`${t.sortBy??"date"}-${t.sortOrder??"desc"}`,W=t.reviewStatus||"all",ae=t.interactionStatus||"all",re=!!(t.dateRange?.[0]&&t.dateRange?.[1]),J=(t.engagementRange?.[0]??0)!==0||(t.engagementRange?.[1]??100)!==100,E=(t.platforms?.length??0)>0,$=t.semanticTypes??[],H=$.length>0,ie=!!(t.reviewStatus&&t.reviewStatus!=="all"),B=!!(t.interactionStatus&&t.interactionStatus!=="all"),A=(x?1:0)+(re?1:0)+(E?1:0)+(H?1:0)+(ie?1:0)+(B?1:0)+(J?1:0),M=s.length>0?s:ia,z=[...new Set([...M,...$])].sort((N,X)=>Ve(N).localeCompare(Ve(X))),G=It.find(N=>N.value===w)?.label??"Newest first",ee=At.find(N=>N.value===W)?.label??"Any reviewer",Q=Lt.find(N=>N.value===ae)?.label??"Any status",ne=e.jsxs("div",{className:"relative w-52 shrink-0",children:[e.jsx(ys,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(bs,{placeholder:d?"Search events...":"Search...",value:a,onChange:N=>r(N.target.value),className:O("pl-9",x&&"pr-8")}),x&&e.jsx("div",{className:"absolute inset-y-0 right-2 flex items-center",children:e.jsx(wn,{"aria-label":"Clear search",onClick:()=>r("")})})]}),fe=e.jsx(Xe,{value:w,onValueChange:N=>{const[X,_]=N.split("-");n({sortBy:X,sortOrder:_})},onClear:()=>n({sortBy:void 0,sortOrder:void 0}),showClear:w!==ca,triggerClassName:"w-[168px]",displayValue:Ye("Sort",G),children:It.map(N=>e.jsx(Qe,{value:N.value,children:N.label},N.value))}),de=e.jsx(Xe,{value:W,onValueChange:N=>n({reviewStatus:N}),onClear:()=>n({reviewStatus:void 0}),showClear:W!=="all",triggerClassName:"w-[186px]",displayValue:Ye("Review",ee),children:At.map(N=>e.jsx(Qe,{value:N.value,children:N.label},N.value))}),xe=e.jsx(Xe,{value:ae,onValueChange:N=>n({interactionStatus:N==="all"?null:N}),onClear:()=>n({interactionStatus:null}),showClear:ae!=="all",triggerClassName:"w-[178px]",displayValue:Ye("Approval",Q),children:Lt.map(N=>e.jsx(Qe,{value:N.value,children:N.label},N.value))}),we=e.jsxs("div",{className:"w-72 space-y-2 px-1 py-1",children:[e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{children:"Engagement score"}),e.jsxs("span",{className:"text-muted-foreground",children:[t.engagementRange?.[0]??0," –"," ",t.engagementRange?.[1]??100]})]}),e.jsx(jn,{value:t.engagementRange||[0,100],onValueChange:N=>n({engagementRange:N}),min:0,max:100,step:5})]}),K=e.jsx(la,{options:z,selected:$,onChange:N=>n({semanticTypes:N.length>0?N:void 0})});return e.jsxs(Ht,{open:S,onOpenChange:C,className:"w-full",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2.5",children:[e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2 text-sm text-muted-foreground",children:[g,i?e.jsx(Qt,{className:"h-4 w-20"}):u!=null&&u>0?e.jsx("span",{children:`${u.toLocaleString()} items`}):e.jsx("span",{}),!i&&u!=null&&u>0&&m&&f&&e.jsxs(U,{variant:"ghost",size:"sm",className:"h-7 gap-1",onClick:f,children:[e.jsx(js,{className:"h-3.5 w-3.5"}),"Back to latest"]})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[fe,e.jsx(Yt,{asChild:!0,children:e.jsxs(U,{variant:"outline",className:"h-9 rounded-md bg-muted px-3 py-2 font-normal",children:["Filters",A>0?e.jsx(_e,{variant:"secondary",className:"ml-1.5 h-5 px-1.5 text-[11px]",children:A}):null,e.jsx(ze,{className:O("ml-1 h-4 w-4 transition-transform",S&&"rotate-180")})]})})]})]}),e.jsx(Xt,{className:"pt-2.5",children:e.jsxs("div",{className:"flex flex-wrap items-start gap-2.5 border-t pt-3",children:[ne,d&&c?e.jsx(Po,{ownerSlug:c,visibility:"all"}):null,!d&&o.length>0?e.jsx(Eo,{connectors:o,selectedKeys:t.platforms||[],onToggle:T}):null,e.jsx(zo,{value:j,onChange:L,onClear:()=>n({dateRange:null}),placeholder:"Date range",className:"w-auto shrink-0"}),K,de,xe,we,A>0&&e.jsx(U,{type:"button",variant:"ghost",size:"sm",className:"h-9 text-xs text-muted-foreground hover:text-foreground",onClick:()=>{r(""),n({dateRange:null,platforms:void 0,semanticTypes:void 0,reviewStatus:void 0,interactionStatus:null,engagementRange:void 0})},children:"Clear all"})]})})]})}function ua(t){const n=t instanceof Date?t:new Date(String(t));return Number.isNaN(n.getTime())?null:n}function Dt(t){return t.toISOString().split("T")[0]}function ma({entityId:t,organizationId:n,ownerSlug:o,selectedRange:s,onSelectRange:a}){const{data:r,isLoading:d,error:c}=Cs(n,{entityId:t},{slug:o}),u=h.useMemo(()=>{if(!r||r.length===0)return[];const p=r.map(y=>{const S=ua(y.date);return S?{date:S,count:y.count}:null}).filter(y=>y!==null).sort((y,S)=>y.date.getTime()-S.date.getTime());if(p.length===0)return[];const v=p[0].date;if((p[p.length-1].date.getTime()-v.getTime())/(1e3*60*60*24)>180){const y=new Map;for(const S of p){const C=new Date(S.date);C.setDate(S.date.getDate()-S.date.getDay());const j=Dt(C);y.set(j,(y.get(j)||0)+S.count)}return Array.from(y.entries()).map(([S,C])=>({date:S,count:C})).sort((S,C)=>new Date(S.date).getTime()-new Date(C.date).getTime())}return p.map(y=>({date:Dt(y.date),count:y.count}))},[r]),i=h.useCallback(p=>{if(p.name&&a){const v=new Date(p.name),g=new Date(v);g.setDate(g.getDate()+1),a(v,g)}},[a]),m=h.useCallback(p=>{if(a&&p.startValue!==void 0&&p.endValue!==void 0){const v=new Date(p.startValue),g=new Date(p.endValue);a(v,g)}},[a]),f=h.useMemo(()=>{if(u.length===0)return null;let p;if(s){const v=s[0].toISOString().split("T")[0],g=s[1].toISOString().split("T")[0];p=[[{xAxis:v},{xAxis:g}]]}return{tooltip:{trigger:"axis",axisPointer:{type:"line"},formatter:v=>{const g=v[0];return`${new Date(g.name).toLocaleDateString()}: ${g.value} items`}},grid:{left:50,right:20,top:20,bottom:60},xAxis:{type:"category",boundaryGap:!1,data:u.map(v=>v.date),axisLabel:{formatter:v=>{const g=new Date(v);return`${g.getMonth()+1}/${g.getDate()}`}}},yAxis:{type:"value",minInterval:1,splitLine:{lineStyle:{color:"rgba(0,0,0,0.05)"}}},dataZoom:[{type:"slider",start:0,end:100,height:20,bottom:10,borderColor:"transparent",backgroundColor:"rgba(0,0,0,0.02)",fillerColor:"rgba(99, 102, 241, 0.1)",handleStyle:{color:"#6366f1"}}],series:[{type:"line",smooth:!0,areaStyle:{opacity:.3,color:new po(0,0,0,1,[{offset:0,color:"rgba(99, 102, 241, 0.5)"},{offset:1,color:"rgba(99, 102, 241, 0.05)"}])},lineStyle:{width:2,color:"#6366f1"},itemStyle:{color:"#6366f1"},showSymbol:!1,data:u.map(v=>v.count),markLine:{silent:!0,symbol:"none",label:{position:"insideEndTop",formatter:"avg: {c}",fontSize:10,color:"#9ca3af"},lineStyle:{color:"#d1d5db",type:"dashed",width:1},data:[{type:"average",name:"Average"}]},markArea:p?{silent:!0,itemStyle:{color:"rgba(99, 102, 241, 0.1)"},data:p}:void 0}]}},[u,s]);return d||c?e.jsx("div",{className:O(Zt,"p-4"),children:e.jsx("div",{className:"flex h-48 w-full items-center justify-center",children:d?e.jsx(xo,{}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed to load timeline"})})}):!f||u.length<2?null:e.jsx(fa,{option:f,onClick:i,onDataZoom:m})}function fa({option:t,onClick:n,onDataZoom:o}){const{chartRef:s,setOption:a}=ho({onClick:n,onDataZoom:o});return h.useEffect(()=>{a(t,!0)},[t,a]),e.jsx("div",{"data-testid":"events-timeline",className:O(Zt,"p-4 relative"),children:e.jsx("div",{ref:s,className:"h-48 w-full"})})}function pa({organizationId:t,ownerSlug:n,entityId:o,hideSourceFilter:s=!1,scopedEntityTypes:a,filterBarLeading:r}){const{isAuthenticated:d,isReady:c}=_s(),{isMember:u,isLoading:i}=qt(),m=c&&d&&u,f=c&&(!d||!i&&!u),p=me(),v=st(),g=Jt(v.search??{}),{filters:x,updateFilters:k,clearFilters:y}=wo({parse:zs,serialize:Us,filterKeys:Gs,merge:Ws}),[S,C]=h.useState(x.searchQuery||""),[j,L]=h.useState((x.searchQuery||"").trim().length>0),T=Ts(S,1e3),w=h.useMemo(()=>wt({...x,searchQuery:T.length>=3?T:void 0,...a?.length?{entityTypes:a}:{}}),[x,T,a]),W=k;h.useEffect(()=>{const l=T.length>=3?T:void 0;(x.searchQuery||void 0)!==l&&k({searchQuery:l})},[T,k,x.searchQuery]);const ae=()=>{C(""),y()},re=h.useMemo(()=>Is(wt({...x,searchQuery:T.length>=3?T:void 0})),[x,T]),J=o===void 0,{data:E=[]}=As(c&&m?t:null),{data:$=[]}=Ls(f?n:null),H=m?E:$,{data:ie=[]}=Bt(m&&t?{organizationId:t}:void 0),B=jo(),A=w.connectionIds,M=(A?.length??0)>0,{data:z=[]}=Ds(c&&m?t??"":"",{connectionIds:A??void 0,enabled:!B&&c&&m&&M}),G=w.feedIds,ee=(G?.length??0)>0,{data:Q=[]}=Es(c&&m?t:null,{feedIds:G??void 0,enabled:c&&m&&ee}),ne=h.useMemo(()=>B?B.groups.flatMap(l=>l.connections.map(b=>({id:b.id,display_name:b.display_name,connector_name:l.connector_name,connector_key:l.connector_key}))):z,[z,B]),fe=h.useMemo(()=>{const l=new Set(A??[]);return[...new Set([...w.platforms??[],...ne.filter(b=>l.has(b.id)).map(b=>b.connector_key)])]},[A,ne,w.platforms]),de=h.useMemo(()=>Q.map(l=>({connectorKey:l.connector_key,feedKey:l.feed_key})),[Q]),xe=h.useMemo(()=>M&&fe.length===0||ee&&de.length===0?[]:Do({connectors:H,entityTypes:ie,selectedPlatforms:fe,selectedFeeds:de,selectedEntityTypes:w.entityTypes}),[H,w.entityTypes,M,ee,fe,de,ie]),we=h.useMemo(()=>M?No(A??[],ne):null,[A,ne,M]),K=w.clientIds,N=(K?.length??0)>0,{data:X=[]}=lo(null,{enabled:c&&m&&N}),_=h.useMemo(()=>{if(!K)return[];const l=new Set(K);return uo(X).filter(b=>b.clientIds.some(I=>l.has(I)))},[K,X]),ue=h.useMemo(()=>{if(!N||!K)return null;const l=_.map(b=>b.title);return l.length>0?`From ${l.join(", ")}`:`Filtered by client${K.length>1?" registrations":""}`},[_,K,N]),Pe=_.length===1?_[0]:null,Nn=n&&Pe?_o(n,Pe.clientId):void 0,Me=w.mcpActivityId??null,{data:lt=[]}=Fs({enabled:c&&m&&N&&!!Me,clientIds:K??[],limit:100}),Sn=h.useMemo(()=>{if(!Me)return null;const l=lt.find(I=>I.activityId===Me);if(!l)return"Selected conversation";const b=l.title?.trim();return b?`Conversation “${b}”`:l.activityKind==="session"?"MCP session":`Conversation ${l.clientId}`},[Me,lt]),kn=h.useMemo(()=>ee?So(G??[],Q):null,[G,ee,Q]),F=w.agentId,{data:dt=[]}=Be({enabled:c&&!!F}),Cn=h.useMemo(()=>{if(!F||w.automationId!=null||g||(w.platforms?.length??0)>0)return null;const l=dt.find(b=>b.agentId===F);return l?`From agent ${l.name}`:`From agent ${F}`},[F,w.platforms,w.automationId,g,dt]),se=w.automationId,{data:ut=[]}=en(F??void 0,{includeDetails:!1}),_n=h.useMemo(()=>{if(se==null)return null;const l=ut.find(b=>String(b.automation_id)===String(se));return l?`From watch “${l.name}”`:`From Automation #${se}`},[ut,se]),{data:mt=[]}=nn(F??void 0),Tn=h.useMemo(()=>{if(!g||!F)return null;const l=mt.find(b=>b.id===g);return l?.description?.trim()?`From schedule “${l.description.trim()}”`:"From scheduled task"},[F,g,mt]),Ge=h.useMemo(()=>{if(!F||se!=null||g||(w.platforms?.length??0)===0)return null;const l=w.platforms?.[0];return l?`From ${l} listen`:null},[F,w.platforms,g,se]),ge=h.useMemo(()=>{if(!n)return{};const l={};if(ee&&G?.length===1){const b=Q.find(I=>I.id===G[0]);b&&(l.feedIds=ko(n,b))}if(M&&A?.length===1){const b=ne.find(I=>I.id===A[0]);b?.connector_key&&(l.connectionIds=Co(n,{id:b.id,connector_key:b.connector_key}))}return F&&se==null&&!g&&(w.platforms?.length??0)===0&&(l.agentId=Ct(n,F)),F&&se!=null&&(l.automationId=To(n,String(se))),F&&g&&(l.schedule=Io(n,F,g)),Ge&&F&&(l.listen=Ct(n,F)),l},[F,A,ne,G,M,ee,w.platforms,Ge,n,g,se,Q]),{data:In}=Ps(c&&m?t:null,o),{data:An}=Ms(f&&!J?n:null,o),ft=m?In:An,Ue=h.useMemo(()=>{const l=new Map;for(const b of ft||[]){const I=b.automation_name??"__global__";l.has(I)||l.set(I,{automationName:b.automation_name??null,classifiers:[]});const P=l.get(I),R=b.attribute_values||{},te=Object.keys(R);let oe=null;const D={};for(const[V,ce]of Object.entries(R))if(ce.parent)for(const[ve,Se]of Object.entries(ce.parent))oe=ve,D[Se]||(D[Se]=[]),D[Se].push(V);const Z=P.classifiers.find(V=>V.slug===b.slug);if(Z){const V=new Set([...Z.values,...te]);Z.values=[...V];for(const[ce,ve]of Object.entries(D)){Z.valuesByParentValue[ce]||(Z.valuesByParentValue[ce]=[]);const Se=new Set([...Z.valuesByParentValue[ce],...ve]);Z.valuesByParentValue[ce]=[...Se]}oe&&(Z.parentSlug=oe)}else P.classifiers.push({slug:b.slug,name:b.name,values:te,parentSlug:oe,valuesByParentValue:D})}for(const b of l.values())b.classifiers.sort((I,P)=>I.parentSlug===null&&P.parentSlug!==null?-1:I.parentSlug!==null&&P.parentSlug===null?1:0);return[...l.values()]},[ft]),Ln=h.useMemo(()=>{const l=new Map(H.map(I=>[I.key,I]));return[...new Set(l.keys())].map(I=>{const P=l.get(I);return{key:I,name:P?.name||I,description:P?.description,icon:P?.icon,faviconDomain:$s(P?.auth_schema)}}).sort((I,P)=>I.name.localeCompare(P.name))},[H]),Dn=Rs(c&&m?t:null,o,w,n),En=Os(f?n:null,o,w),Fn=f?En:Dn,{data:Ne,isLoading:Pn,error:Mn}=Fn,pt=Ne?.pages[0],ht=pt?.total??0,xt=pt?.classification_stats,$n=!!(w.beforeOccurredAt||w.afterOccurredAt),gt=Ks(w),vt=Ne?.pages[Ne.pages.length-1],pe=vt?.content[vt.content.length-1];h.useEffect(()=>{!gt||!pe||Ne?.pages.length===1||x.beforeOccurredAt===pe.occurred_at&&x.beforeId===pe.id||k({beforeOccurredAt:pe.occurred_at,beforeId:pe.id})},[pe?.id,gt,k,Ne?.pages.length,pe,x.beforeOccurredAt,x.beforeId]);const Rn=h.useCallback(()=>{W({beforeOccurredAt:void 0,beforeId:void 0,afterOccurredAt:void 0,afterId:void 0}),window.scrollTo({top:0,behavior:"smooth"})},[W]),[yt,On]=h.useState(new Set),Kn=l=>{const b=new Set(yt);b.has(l)?b.delete(l):b.add(l),On(b)},Vn=(l,b)=>{W({dateRange:[l,b]})},bt=(l,b)=>{const I=w.classificationFilters||{},P=I[l]||[],R=P.includes(b)?P.filter(oe=>oe!==b):[...P,b],te={...I};if(R.length>0)te[l]=R;else{delete te[l];for(const oe of Ue)for(const D of oe.classifiers)D.parentSlug===l&&delete te[D.slug]}W({classificationFilters:te})};if(Mn)return e.jsx(Vs,{label:"knowledge"});const We=!c||d&&i||Pn,Bn=!We&&ht===0&&!re,zn=d?m?"Activity is the workspace's live feed — every message, email, file, and record a connector pulls in lands here as an event. Connect your data to start collecting.":"Activity is the workspace's live feed of connector events. Join this workspace to add connectors and collect knowledge here.":"No public knowledge items are available yet",jt=!!(m&&n);return e.jsx(Bs,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:s?"sticky top-0 z-10 -mx-4 space-y-3 bg-background px-4 pb-3 lg:-mx-6 lg:px-6":void 0,children:e.jsx(da,{leading:r,open:j,onOpenChange:L,filters:w,onFiltersChange:W,connectors:Ln,eventKinds:xe,searchQuery:S,onSearchChange:C,hideSourceFilter:s,ownerSlug:n,total:ht,isListLoading:We,hasCursorInUrl:$n,onGoToLatest:Rn})}),[{key:"contentIds",label:l=>`Showing knowledge item #${l.join(", #")}`,ids:w.contentIds,clear:{contentIds:void 0}},{key:"runId",label:l=>`Filtered by Automation run #${l}`,id:w.runId,clear:{runId:void 0}},{key:"feedIds",text:kn,sourceLink:ge.feedIds,clear:{feedIds:void 0}},{key:"connectionIds",text:we,sourceLink:ge.connectionIds,clear:{connectionIds:void 0}},{key:"mcpActivityId",text:Sn,clear:{mcpActivityId:void 0}},{key:"clientIds",text:ue,sourceLink:Nn,details:K&&K.length>0?e.jsx(Lo,{ownerSlug:n,clientIds:K,linkedUser:Pe?.linkedUser,linkedUserEntitySlug:Pe?.linkedUserEntitySlug}):void 0,clear:{clientIds:void 0}},{key:"automationId",text:_n,sourceLink:ge.automationId,clear:{automationId:void 0}},{key:"schedule",text:Tn,sourceLink:ge.schedule,clear:{schedule:void 0,runIds:void 0}},{key:"listen",text:Ge,sourceLink:ge.listen,clear:{platforms:void 0,connectionIds:void 0}},{key:"agentId",text:Cn,sourceLink:ge.agentId,clear:{agentId:void 0,automationId:void 0,schedule:void 0,platforms:void 0}},{key:"runIds",label:l=>`Filtered by run${l.length>1?"s":""} #${l.join(", #")}`,ids:w.runIds,clear:{runIds:void 0,schedule:void 0}}].map(l=>{const b="text"in l&&l.text?l.text:"ids"in l&&l.ids&&l.ids.length>0?l.label(l.ids):"id"in l&&l.id!=null?l.label(l.id):null;return b?e.jsx(Ao,{text:b,sourceLink:"sourceLink"in l?l.sourceLink:void 0,details:"details"in l?l.details:void 0,onClear:()=>W(l.clear)},l.key):null}).filter(Boolean),j&&m&&o&&t&&e.jsx(ma,{entityId:o,organizationId:t,ownerSlug:n||"",selectedRange:w.dateRange||void 0,onSelectRange:Vn}),Ue.length>0&&e.jsx("div",{className:"space-y-2",children:Ue.map(l=>{const b=l.automationName??"__global__",I=l.classifiers.some(R=>(w.classificationFilters?.[R.slug]?.length||0)>0),P=yt.has(b)||I;return e.jsxs(Ht,{open:P,onOpenChange:()=>Kn(b),children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Yt,{asChild:!0,children:e.jsx(U,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",children:P?e.jsx(ze,{className:"h-3.5 w-3.5"}):e.jsx(tn,{className:"h-3.5 w-3.5"})})}),l.automationName&&e.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:l.automationName})]}),e.jsx(Xt,{className:"space-y-1.5 mt-1.5 ml-6",children:l.classifiers.filter(R=>R.parentSlug===null).map(R=>{const te=w.classificationFilters?.[R.slug]||[],oe=l.classifiers.filter(D=>D.parentSlug===R.slug);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:R.name}),R.values.map(D=>{const Z=te.includes(D),V=xt?.[R.slug]?.[D];return e.jsxs(_e,{variant:Z?"default":"outline",className:"cursor-pointer",onClick:()=>bt(R.slug,D),children:[D,V!=null&&e.jsx("span",{className:"ml-1 opacity-60",children:V})]},D)})]}),te.length>0&&oe.map(D=>{const Z=[...new Set(te.flatMap(V=>D.valuesByParentValue[V]||[]))];return Z.length===0?null:e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 ml-4 mt-1.5",children:[e.jsx("span",{className:"text-sm font-medium text-muted-foreground shrink-0",children:D.name}),Z.map(V=>{const ce=w.classificationFilters?.[D.slug]?.includes(V),ve=xt?.[D.slug]?.[V];return e.jsxs(_e,{variant:ce?"default":"outline",className:"cursor-pointer",onClick:()=>bt(D.slug,V),children:[V,ve!=null&&e.jsx("span",{className:"ml-1 opacity-60",children:ve})]},V)})]},D.slug)})]},R.slug)})})]},b)})}),We?e.jsx("div",{className:"space-y-4",children:["skeleton-1","skeleton-2","skeleton-3","skeleton-4","skeleton-5"].map(l=>e.jsx(Qt,{className:"h-32 rounded-lg"},l))}):Bn?e.jsx(Oe,{icon:Nt,title:"No activity yet",description:zn,actionLabel:jt?"Add a connector":void 0,onAction:jt&&n?()=>void p({to:"/$owner/connectors/create",params:{owner:n}}):void 0}):e.jsx(mo,{organizationId:t,ownerSlug:n,entityId:o,filters:w,showEntityLinks:J,emptyState:e.jsx(Oe,{icon:Nt,title:"No results found",description:"Try adjusting your filters to find what you are looking for",actionLabel:re?"Clear filters":void 0,onAction:re?ae:void 0})})]})})}function ha(t){const n=Hs();return e.jsx(xa,{...t,context:n},`${t.ownerSlug}:${t.attentionLens}:${Qs(n)}`)}function xa({organizationId:t,ownerSlug:n,typeScope:o,entityScope:s,agentScope:a,automationScope:r,scheduleScope:d,attentionLens:c=!1,activityTab:u="events",context:i}){const[m,f]=h.useState(c?"relevant":"activity"),p=i?m!=="activity":c,{orgContext:v}=Vt(),{isMember:g,isLoading:x}=qt(),k=g&&!!t,y=Ft(),S=u==="sessions"&&y,{attentionItems:C}=Ys(n),j=C.length,L=i?e.jsx("fieldset",{"aria-label":"Activity view",className:O("flex min-w-0 max-w-full items-center gap-1",y&&"justify-center"),children:[["relevant","Relevant here"],["attention","Needs attention"],["activity","All activity"]].map(([_,ue])=>e.jsxs("button",{type:"button","aria-pressed":m===_,onClick:()=>f(_),className:"flex min-w-0 items-center justify-center gap-1 rounded-md px-2 py-1 text-xs font-medium text-muted-foreground transition-colors aria-pressed:bg-muted aria-pressed:text-foreground hover:text-foreground",children:[ue,_==="attention"?e.jsx(Et,{count:j}):null]},_))}):e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(Y,{to:"/$owner/events",params:{owner:n},search:_=>({..._??{}}),"aria-current":p?void 0:"page",className:O("rounded-md px-2.5 py-1 text-xs font-medium transition-colors",p?"text-muted-foreground hover:text-foreground":"bg-muted text-foreground"),children:"All activity"}),e.jsxs(Y,{to:"/$owner",params:{owner:n},search:_=>({..._??{}}),"aria-current":p?"page":void 0,className:O("flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors",p?"bg-muted text-foreground":"text-muted-foreground hover:text-foreground"),children:["Needs attention",e.jsx(Et,{count:j})]})]}),{data:T=[]}=Be(),w=a?T.find(_=>_.agentId===a)?.name??a:void 0,{data:W=[]}=en(a,{includeDetails:!1}),ae=r?W.find(_=>_.automation_id===r)?.name??`Automation ${r}`:void 0,{data:re=[]}=nn(a),J=d?re.find(_=>_.id===d)?.description??"Schedule":void 0,E=o?Ce(o):void 0,{data:$,isLoading:H,error:ie}=Xs(s?`/${n}/${Zs(s)}`:p?`/${n}`:"",v),B=s?$?.entity:void 0,A=s?B?.entity_type??Ce(s.split("/").at(-2)??""):E,M=A==="$member",z=s!=null&&!H&&(ie!=null||$?.entity==null),{data:G}=qs(A??"",v),ee=x||H,Q=$?.counts,ne=Q?Q.connections>0||Q.agents>0||Q.clients>0:!1,fe=k&&!ee&&Q!=null&&!ne,de={},xe=a?{agent:a}:{},we=A?{type:A}:{},K=s?e.jsx(Ze,{icon:B?.entity_type?e.jsx(Gt,{icon:G?.icon,className:"h-4 w-4 shrink-0"}):null,typeSegment:A?{label:G?.name??Ce(A),search:we}:void 0,label:B?.name??s.split("/").slice(-1)[0],ownerSlug:n,clearSearch:{}}):r&&a?e.jsx(Ze,{typeSegment:{label:w??"Agent",search:de},label:ae??"Automation",ownerSlug:n,clearSearch:xe}):d&&a?e.jsx(Ze,{typeSegment:{label:w??"Agent",search:de},label:J??"Schedule",ownerSlug:n,clearSearch:xe}):null,N=!y&&!S&&!z,X=s&&H?e.jsx(St,{label:"Loading record…"}):z?e.jsx(Oe,{icon:Js,title:"Record not found",description:"This record no longer exists."}):e.jsx(pa,{organizationId:t,ownerSlug:n,filterBarLeading:N?L:void 0,hideSourceFilter:!0,entityId:B?.id,scopedEntityTypes:!s&&E?[E]:void 0});if(p){const _=ee?e.jsx(St,{label:"workspace setup",variant:"panel",className:"px-6 py-8"}):fe?e.jsx("div",{className:"px-6",children:e.jsx(Oe,{icon:no,title:"Nothing to catch up on — yet",description:"No notifications here. Add a connector to bring in data, or bring your agent to Lobu and give it something to work with.",children:e.jsxs("div",{className:"mt-4 flex flex-wrap justify-center gap-2",children:[e.jsx(U,{asChild:!0,children:e.jsxs(Y,{to:"/$owner/connectors/create",params:{owner:n},children:[e.jsx(so,{className:"mr-2 h-4 w-4"}),"Add a connector"]})}),e.jsx(U,{asChild:!0,variant:"outline",children:e.jsxs(Y,{to:"/$owner/agents",params:{owner:n},children:[e.jsx(qe,{className:"mr-2 h-4 w-4"}),"Connect agent"]})})]})})}):e.jsx("p",{className:"rounded-lg border bg-muted/20 px-3 py-6 text-center text-xs text-muted-foreground",children:"Nothing needs attention right now."});return e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4",children:e.jsx(eo,{context:i,relevant:m==="relevant",owner:n,emptyState:_,tabs:L})})}return e.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col gap-4",children:[N?null:e.jsxs("div",{className:O("sticky top-0 z-20 flex min-w-0 flex-wrap items-center gap-x-4 gap-y-2 bg-background pt-1",y?"justify-center":"justify-between"),children:[L,y?e.jsxs("div",{className:"flex items-center rounded-lg bg-muted/60 p-0.5 text-xs",children:[e.jsx(Y,{to:"/$owner/events",params:{owner:n},search:_=>{const ue={..._??{}};return delete ue.tab,ue},"aria-current":S?void 0:"page",className:O("rounded-md px-2.5 py-1 text-xs font-medium transition-colors",S?"text-muted-foreground hover:text-foreground":"bg-background text-foreground "),children:"Events"}),e.jsx(Y,{to:"/$owner/events",params:{owner:n},search:_=>({..._??{},tab:"sessions"}),"aria-current":S?"page":void 0,className:O("rounded-md px-2.5 py-1 text-xs font-medium transition-colors",S?"bg-background text-foreground ":"text-muted-foreground hover:text-foreground"),children:"Sessions"})]}):null]}),K&&!S?e.jsx("div",{className:"sticky top-0 z-20 flex min-w-0 flex-col gap-3 bg-background pt-1",children:K}):null,S?e.jsx(to,{owner:n,tone:"page",empty:"message"}):M?e.jsx(go,{children:X}):X]})}function Et({count:t}){return t===0?null:e.jsx("span",{role:"img","aria-label":`${t} item${t===1?"":"s"} need attention`,className:"rounded-full bg-blue-500/15 px-1.5 py-0.5 text-[10px] font-semibold text-blue-600 dark:text-blue-400",children:t})}function Ze({icon:t,typeSegment:n,label:o,ownerSlug:s,clearSearch:a}){return e.jsxs("div",{className:"flex min-w-0 items-center gap-1.5 border-l border-border/60 pb-1 pl-3 text-sm",children:[t,n?e.jsxs(e.Fragment,{children:[e.jsx(Y,{to:"/$owner/events",params:{owner:s},search:n.search,className:"shrink-0 font-medium text-muted-foreground transition-colors hover:text-foreground hover:underline",children:n.label}),e.jsx(tn,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground/60"})]}):null,e.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",children:o}),e.jsx(U,{asChild:!0,variant:"ghost",size:"sm",className:"h-6 gap-1 px-2",children:e.jsxs(Y,{to:"/$owner/events",params:{owner:s},search:a,children:[e.jsx(Te,{className:"h-3.5 w-3.5"}),"Clear"]})})]})}function Aa({owner:t,search:n,attentionLens:o,entityScope:s}){const a=typeof n.type=="string"&&n.type.trim()?Ce(n.type.trim()):void 0,r=zt(n),d=oo(n),c=Jt(n),u=n.tab==="sessions"?"sessions":"events";return e.jsx("div",{className:"flex flex-1 flex-col gap-6 px-4 py-6 lg:px-6",children:e.jsx(ao,{owner:t,children:i=>e.jsx(yo,{organizationId:i.organizationId,isWorkspaceLoading:i.isWorkspaceLoading,children:e.jsxs("div",{className:"mx-auto flex min-h-0 w-full min-w-0 max-w-3xl flex-1 flex-col",children:[e.jsx(ha,{organizationId:i.organizationId,ownerSlug:i.ownerSlug,typeScope:a,entityScope:s,agentScope:r,automationScope:d,scheduleScope:c,attentionLens:o,activityTab:u}),e.jsx(vo,{ownerSlug:i.ownerSlug})]})})})})}export{Aa as A};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ai as x,j as e,bg as b,gg as N,aW as A,gh as w,L as p,gi as k,o as L,r as C,h0 as S,eH as m,B as y,Y as R,bS as f,aR as I,d_ as P}from"./index-DtRfQcRH.js";import{A as M,f as _,b as $}from"./agent-client-setup-list-BBbq_2B1.js";import{u as T}from"./clients-C7ubnFsS.js";import{g as B,c as U}from"./client-rows-EJSKR6z1.js";function E(t){const n=t?`/mcp/${t}`:"/mcp";if(!x)return`http://localhost:8787${n}`;try{const s=new URL(x);return s.pathname=n,s.toString()}catch{return`${x}${n}`}}const u="flex min-h-0 flex-1 flex-col gap-3 px-4 pt-4 pb-8 lg:px-6";function D(t,n){return`flex items-center gap-3 px-3 py-2.5 text-left text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground ${t===n-1?"":"border-b"}`}function v({owner:t}){return e.jsx(w,{crumbs:[e.jsx(p,{to:"/$owner/agents",params:{owner:t},className:k,children:"Agents"},"agents")]})}function H({owner:t}){return e.jsx("div",{className:u,children:e.jsxs(b,{className:"flex flex-1 flex-col gap-6",children:[e.jsx(N,{breadcrumb:e.jsx(v,{owner:t}),icon:e.jsx(A.agents.icon,{className:"h-6 w-6"}),title:"Connect an agent",caption:"Choose the agent you already use. Install directly where supported, or copy a setup prompt into the agent."}),e.jsx(M,{owner:t}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Local Automation delivery is separate and is not enabled by connecting an agent."})]})})}function j({text:t,label:n}){const[s,l]=C.useState(!1);return e.jsxs(y,{type:"button",variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{typeof navigator>"u"||!navigator.clipboard||navigator.clipboard.writeText(t).then(()=>{l(!0),setTimeout(()=>l(!1),1500)})},children:[s?e.jsx(I,{className:"mr-1.5 h-3.5 w-3.5"}):e.jsx(P,{className:"mr-1.5 h-3.5 w-3.5"}),s?"Copied":n]})}function q({owner:t,clientId:n}){const s=_(n),{data:l}=L(t,{slug:t}),{data:h=[]}=T(null,{refetchInterval:2500}),r=C.useMemo(()=>B(h).filter(a=>a.connected),[h]);if(!s)return e.jsx("div",{className:u,children:e.jsxs(b,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"There is no agent client by that name."}),e.jsx(p,{to:"/$owner/agents/connect",params:{owner:t},className:"text-sm text-primary hover:underline",children:"Back to agent clients"})]})});const o=E(t),c=$({workspaceName:l?.workspace?.name??t,owner:t,mcpUrl:o,clientLabel:s.id==="other"?void 0:s.label}),i=s.setupMode==="agent-prompt",g=i?c:s.installText?.(o)??c;return e.jsx("div",{className:u,children:e.jsxs(S,{header:e.jsx(N,{breadcrumb:e.jsx(v,{owner:t}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:e.jsx(f,{name:s.label})}),title:s.label,caption:s.description}),children:[e.jsx(m,{title:"Set up",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.installTitle}),e.jsxs("div",{className:"flex items-start gap-2 rounded-lg border bg-muted/40 p-2.5",children:[e.jsx("pre",{className:"min-w-0 flex-1 overflow-x-auto whitespace-pre-wrap font-mono text-xs leading-relaxed",children:g}),e.jsx(j,{text:g,label:i?"Copy setup prompt":"Copy"})]})]}),e.jsx("ol",{className:"space-y-1 text-xs text-muted-foreground",children:s.steps(o).map((a,d)=>e.jsxs("li",{children:[d+1,". ",a]},a))}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[i?null:e.jsx(j,{text:c,label:"Copy setup prompt"}),s.guideLinks.map(a=>e.jsx(y,{asChild:!0,variant:"ghost",size:"sm",className:"h-8 text-xs",children:e.jsxs("a",{href:a.href,target:"_blank",rel:"noreferrer",children:[a.label,e.jsx(R,{className:"ml-1.5 h-3.5 w-3.5"})]})},a.href))]})]})}),e.jsx(m,{title:"Connected agents",count:r.length>0?String(r.length):void 0,children:r.length===0?e.jsx("div",{className:"rounded-lg border border-dashed px-3 py-2.5 text-xs text-muted-foreground",children:"Nothing yet. Finish setup and make an authenticated Lobu MCP request; the agent appears here automatically."}):e.jsx("div",{className:"overflow-hidden rounded-lg border",children:r.map((a,d)=>e.jsxs(p,{to:"/$owner/agents/connected/$clientId",params:{owner:t,clientId:a.clientId},className:D(d,r.length),children:[e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:e.jsx(f,{name:a.title})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-medium",children:a.title}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:U(a)})]})]},a.key))})}),e.jsx(m,{title:"Manual MCP details",children:e.jsxs("dl",{className:"grid grid-cols-[5rem_1fr] gap-x-3 gap-y-1 rounded-lg border bg-muted/40 p-3 text-xs",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Name"}),e.jsx("dd",{className:"font-mono",children:"lobu"}),e.jsx("dt",{className:"text-muted-foreground",children:"MCP URL"}),e.jsx("dd",{className:"break-all font-mono",children:o})]})})]})})}export{H as A,q as a};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{bc as he,bd as xe,j as e,B as f,cV as pe,er as fe,bA as ve,al as be,cv as je,cw as U,aR as V,P as we,gq as ye,gr as Ne,gs as Ce,gt as Me,dQ as Se,gu as ke,k as Ae,c6 as Ie,be as Pe,r as q,aG as E,fK as G,F as Fe,ac as b,dS as $,ad as De,am as Te,bX as $e,bY as Re,bZ as _e,b_ as Ee,b$ as K}from"./index-DtRfQcRH.js";import{b as Be,s as Le}from"./model-selector-XC5CI2Et.js";function ze(t){const a=t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-");return(a?/^[a-z]/.test(a)&&a.length>=3?a:`agent-${a}`:"agent").slice(0,60).replace(/-+$/g,"")||"agent"}function Oe(t,a){const m=new Set(a),h=ze(t);let x=h,u=2;for(;m.has(x);){const g=`-${u}`;x=`${h.slice(0,Math.max(1,60-g.length)).replace(/-+$/g,"")||"agent"}${g}`,u+=1}return x}const Ue="__unresolved__";function W(t){return t.endsWith(`/${Ue}`)}function Y(t){const a=t.indexOf("/");return a===-1?{slug:t,model:""}:{slug:t.slice(0,a),model:t.slice(a+1)}}function Ve(t,a){const{slug:m,model:h}=Y(t);return{provider:a.find(g=>g.value===t)?.provider??a.find(g=>Y(g.value).slug===m)?.provider??m,model:h}}function qe({value:t,onChange:a,disabled:m}){const{data:h=[]}=he(),{data:x=[]}=xe(),u=Be(h,x),g=(s,o)=>{const n=s+o;if(n<0||n>=t.length)return;const c=[...t];[c[s],c[n]]=[c[n],c[s]],a(c)},C=s=>{a(t.filter((o,n)=>n!==s))},M=s=>{t.includes(s)||a([...t,s])},d=u.filter(s=>!t.includes(s.value)&&!W(s.value));return e.jsxs("div",{className:"grid gap-2",children:[t.length===0?e.jsx("p",{className:"rounded-lg border border-dashed bg-muted/20 px-3 py-4 text-center text-[11px] text-muted-foreground",children:"No models pinned — this agent uses the org default."}):e.jsx("ul",{className:"grid gap-1.5",children:t.map((s,o)=>{const n=W(s),{provider:c,model:i}=Ve(s,u);return e.jsxs("li",{className:be("flex items-center gap-2 rounded-lg border bg-muted/20 px-3 py-2",n&&"opacity-60"),children:[e.jsxs("div",{className:"grid min-w-0 flex-1 gap-0.5",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"truncate text-sm",children:c}),o===0?e.jsx("span",{className:"shrink-0 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary",children:"Default"}):null]}),e.jsx("span",{className:"truncate text-[11px] text-muted-foreground",children:n?"no model selected":i})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx(f,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Move up",disabled:m||o===0,onClick:()=>g(o,-1),children:e.jsx(pe,{className:"h-4 w-4"})}),e.jsx(f,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Move down",disabled:m||o===t.length-1,onClick:()=>g(o,1),children:e.jsx(fe,{className:"h-4 w-4"})}),e.jsx(f,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive","aria-label":"Remove model",disabled:m,onClick:()=>C(o),children:e.jsx(ve,{className:"h-4 w-4"})})]})]},s)})}),e.jsx(je,{contentClassName:"w-[--radix-popover-trigger-width] min-w-[280px]",searchPlaceholder:"Search or type a model ref…",emptyText:"Type a full provider/model ref to use it.",trigger:s=>e.jsxs(f,{type:"button",variant:"outline",role:"combobox","aria-expanded":s,disabled:m,className:"w-full justify-start font-normal text-muted-foreground",children:[e.jsx(we,{className:"mr-2 h-4 w-4 shrink-0"}),"Add model"]}),children:(s,o)=>{const n=o.trim(),c=Le(n,u)&&!t.includes(n);return e.jsxs(e.Fragment,{children:[d.map(i=>e.jsxs(U,{value:`${i.provider} ${i.model} ${i.value}`,onSelect:()=>{M(i.value),s()},className:"cursor-pointer",children:[e.jsx(V,{className:"mr-2 h-4 w-4 opacity-0"}),e.jsxs("span",{className:"truncate",children:[i.provider," ",e.jsx("span",{className:"text-muted-foreground text-xs",children:i.model}),i.isDefault?e.jsx("span",{className:"ml-1.5 text-muted-foreground text-xs",children:"· org default"}):null]})]},i.value)),c?e.jsxs(U,{value:`__custom__ ${n}`,onSelect:()=>{M(n),s()},className:"cursor-pointer",children:[e.jsx(V,{className:"mr-2 h-4 w-4 opacity-0"}),e.jsxs("span",{children:["Use ",e.jsx("span",{className:"font-mono text-xs",children:n})]})]}):null]})}})]})}function Ye({mode:t,section:a="identity",existingAgentIds:m=[],onCreated:h,onCancel:x,onDone:u,reviewMode:g="none",reviewProposal:C=null,reviewControlsDisabled:M=!1}){const d=t.kind==="create",s=t.kind==="edit"?t.agent:null,o=!d&&a!=="platforms"&&a!=="skills"&&!!s,n=ye(),c=Ne(s?.agentId??""),i=Ce(s?.agentId??""),S=Me(s?.agentId??""),{data:p,isLoading:B}=Se(s?.agentId,{enabled:o}),L=!d&&g==="active"?C:null,R=L?ke(L.proposal):void 0,w=p,z=s?.agentId??"create",r=Ae(z,{name:R?.name??s?.name??"",description:R?.description??s?.description??"",identityMd:R?.identityMd??p?.identityMd??"",soulMd:p?.soulMd??"",userMd:p?.userMd??"",models:w?.models??w?.settings?.models??[],showToolCalls:w?.showToolCalls??w?.settings?.showToolCalls??!1,sandboxId:w?.sandboxId??w?.settings?.sandboxId??"builtin"}),[j,H]=r.field("name"),[y,Q]=r.field("description"),[k,X]=r.field("identityMd"),[A,Z]=r.field("soulMd"),[I,J]=r.field("userMd"),[P,ee]=r.field("models"),[F,se]=r.field("showToolCalls"),[N,te]=r.field("sandboxId"),[ae,D]=Ie(z,!1),{data:ne}=Pe({enabled:a==="models"&&!d}),le=q.useCallback(async l=>{if(l.preventDefault(),!!r.canSubmit){if(d){const T=await n.mutateAsync({agentId:Oe(j,m),name:j.trim(),description:y.trim()||void 0});h?await h(T.agentId):u?.();return}if(s){if(!p){E.error("Still loading agent settings — try again in a moment");return}try{await Promise.all([c.mutateAsync({name:j.trim()||s.name,description:y.trim()||void 0}),S.mutateAsync({identityMd:k.trim(),soulMd:A.trim(),userMd:I.trim(),models:P,authProfiles:p.authProfiles??[],skillsConfig:p.skillsConfig,showToolCalls:F,sandboxId:N==="builtin"?void 0:N})]),r.accept(r.values,{name:j.trim()||s.name,description:y.trim()||s.description||"",identityMd:k.trim(),soulMd:A.trim(),userMd:I.trim(),models:P,showToolCalls:F,sandboxId:N}),E.success("Agent saved"),u?.()}catch(T){E.error(T instanceof Error?T.message:"Failed to save agent")}}}},[p,n,y,r.accept,r.values,r.canSubmit,N,m,k,d,P,j,h,u,s,F,A,c,S,I]),ie=q.useCallback(async()=>{s&&(await i.mutateAsync(),D(!1),u?.())},[i,u,s,D]),_=n.isPending||c.isPending||i.isPending||S.isPending,re=d||!!p;if(o&&B)return e.jsx(G,{rows:6});const v=_||M,de=g==="none"||g==="gone",oe=j.trim().length>0&&re,ce=d||a==="settings",me=!d&&(a==="identity"||a==="settings"),ue=!d&&a==="settings",ge=!d&&a==="settings",O=!d&&a==="models";return e.jsxs("form",{onSubmit:le,className:"flex min-h-0 flex-col",children:[e.jsx(Fe,{visible:r.hasConflict,onReload:r.reset}),e.jsxs("div",{className:"grid content-start gap-4 py-2",children:[me?B?e.jsx(G,{rows:4}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{htmlFor:"identity-md",children:"Identity"}),e.jsx($,{id:"identity-md",rows:6,value:k,onChange:l=>X(l.target.value),disabled:v,placeholder:"You are a market intelligence agent. Track competitors, analyze launches and signals, and surface concise, decision-ready insights."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{htmlFor:"soul-md",children:"Soul"}),e.jsx($,{id:"soul-md",rows:6,value:A,onChange:l=>Z(l.target.value),disabled:v,placeholder:"Be rigorous, skeptical of weak signals, and calm under ambiguity. Prefer crisp summaries, explicit evidence, and clear confidence levels."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{htmlFor:"user-md",children:"User prompt"}),e.jsx($,{id:"user-md",rows:6,value:I,onChange:l=>J(l.target.value),disabled:v,placeholder:"Monitor the market for notable competitor moves, pricing changes, launches, partnerships, and customer sentiment shifts. Summarize what changed, why it matters, and what to watch next."})]})]}):null,ce?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(b,{htmlFor:"agent-name",children:["Name ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(De,{id:"agent-name",placeholder:"Support Bot",value:j,onChange:l=>H(l.target.value),disabled:v,required:!0}),d?e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"The agent ID will be generated automatically from the name."}):null]}),d?null:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{htmlFor:"agent-description",children:"Description"}),e.jsx($,{id:"agent-description",placeholder:"Handles customer support and triage across channels.",value:y,onChange:l=>Q(l.target.value),disabled:v,rows:3})]})]}):null,ge?e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border bg-muted/20 p-3",children:[e.jsx(Te,{id:"show-tool-calls",checked:F,onCheckedChange:l=>se(l===!0),disabled:v,className:"mt-0.5"}),e.jsxs("div",{className:"grid gap-0.5",children:[e.jsx(b,{htmlFor:"show-tool-calls",className:"cursor-pointer",children:"Show tool calls in chat"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Render the agent's tool invocations (name, arguments, and result) as cards in the web chat. Off by default."})]})]}):null,O?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{children:"Models"}),e.jsx(qe,{value:P,onChange:ee,disabled:v}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Ordered list; the first is the default. Only these models may be used — a request for anything else falls back to the first available one. Leave empty to use the org default."})]}):null,O?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{htmlFor:"agent-sandbox",children:"Run in sandbox"}),e.jsxs($e,{value:N,onValueChange:te,disabled:v,children:[e.jsx(Re,{id:"agent-sandbox",className:"w-full",children:e.jsx(_e,{placeholder:"Built-in"})}),e.jsxs(Ee,{children:[e.jsx(K,{value:"builtin",children:"Built-in (default)"}),(ne?.sandboxes??[]).map(l=>e.jsxs(K,{value:l.id,children:[l.name," (",l.providerKind,")",l.connected?"":" — no credential"]},l.id))]})]}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Where this agent's commands execute. Built-in runs in-process; sandboxes run on a connected provider. Manage sandboxes under Connect › Runtime."})]}):null]}),de?e.jsxs("div",{className:"mt-6 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[ue?ae?e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(f,{type:"button",variant:"destructive",onClick:()=>void ie(),disabled:i.isPending,children:i.isPending?"Deleting...":"Delete agent"}),e.jsx(f,{type:"button",variant:"outline",onClick:()=>D(!1),disabled:i.isPending,children:"Cancel"})]}):e.jsx(f,{type:"button",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>D(!0),disabled:i.isPending,children:"Delete agent"}):e.jsx("span",{}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[x?e.jsx(f,{type:"button",variant:"outline",onClick:x,disabled:_,children:"Cancel"}):null,e.jsx(f,{type:"submit",disabled:!r.canSubmit||!oe||_,children:d?n.isPending?"Creating...":"Create agent":c.isPending||S.isPending?"Saving...":"Save changes"})]})]}):null]})}export{Ye as A};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as N,j as e,ac as w,ad as k,bX as K,bY as X,bZ as Y,b_ as ee,b$ as ae,dS as te,B as S,a4 as B,dQ as A,hU as L,hV as M,gt as F,fK as se,aG as f,es as J,c1 as ne,c2 as re,bq as D,eu as ie,eO as oe,eP as le,eQ as O,eR as E,eS as de,eT as $,ah as ue,hs as ce,c9 as q,P as me,al as R,hS as ge}from"./index-DtRfQcRH.js";import{M as he}from"./model-selector-XC5CI2Et.js";import{a as xe,A as pe}from"./agent-subpage-shell-DtzoRy6N.js";import{f as je}from"./agent-loading-shells-BQLjzMPy.js";import{A as fe}from"./agent-card-controls-bhTMPoVi.js";const be=[{value:"input",label:"Input",hint:"the user message, before the agent runs"},{value:"output",label:"Output",hint:"the agent's reply, before the user sees it"},{value:"pre-tool",label:"Pre-tool",hint:"a tool call, before it executes"},{value:"egress",label:"Egress",hint:"an outbound request to a judged domain"}];function I({initial:a,judgeModelDefault:t,submitLabel:n,submitting:s,onSubmit:o,onCancel:r}){const[i,d]=N.useState(a?.name??""),[h,b]=N.useState(a?.stage??"input"),[p,y]=N.useState(a?.policy??""),[j,C]=N.useState(a?.model??""),[x,u]=N.useState((a?.tools??[]).join(", ")),[l,m]=N.useState((a?.domains??[]).join(", ")),g=a?.kind,v=g==="require-tool",Q=c=>{c.preventDefault();const _=x.split(",").map(T=>T.trim()).filter(Boolean);o({name:i,stage:h,...g?{kind:g}:{},policy:p,model:j.trim()||void 0,tools:(v||h==="pre-tool")&&_.length>0?_:void 0,domains:h==="egress"&&l.trim()?l.split(",").map(T=>T.trim()).filter(Boolean):void 0,enabled:a?.enabled??!0})};return e.jsxs("form",{onSubmit:Q,className:"space-y-5",children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(w,{htmlFor:"guardrail-name",children:["Name ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(k,{id:"guardrail-name",value:i,onChange:c=>d(c.target.value),placeholder:"no-competitor-mentions",disabled:s}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Shown in the list and on every trip. Must be unique."})]}),v?null:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:"guardrail-stage",children:"Stage"}),e.jsxs(K,{value:h,onValueChange:c=>b(c),disabled:s,children:[e.jsx(X,{id:"guardrail-stage",children:e.jsx(Y,{})}),e.jsx(ee,{children:be.map(c=>e.jsxs(ae,{value:c.value,children:[c.label," — ",c.hint]},c.value))})]})]}),v?e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(w,{htmlFor:"guardrail-required-tools",children:["Required tools ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(k,{id:"guardrail-required-tools",value:x,onChange:c=>u(c.target.value),placeholder:"suggest_actions",disabled:s}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Comma-separated. The turn trips if the agent finishes without calling every one of these. No judge model runs — this is a lookup against the tools the turn actually used."})]}):null,v?null:e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(w,{htmlFor:"guardrail-policy",children:["Policy ",e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(te,{id:"guardrail-policy",rows:5,value:p,onChange:c=>y(c.target.value),placeholder:"Deny any response that names a competitor (Acme, Globex) or quotes their pricing.",disabled:s}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"A judge model reads this and the text at the chosen stage, then allows or denies. Write it as an instruction to a reviewer."})]}),e.jsxs("div",{className:"grid gap-2",children:[e.jsxs(w,{htmlFor:"guardrail-model",children:["Judge model",t?null:e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),e.jsx(he,{value:j,onChange:C,placeholder:t?`Default (${t})`:"Select a model",disabled:s}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:t?"Optional. Leave blank to use the gateway's default judge model.":"Required: the gateway has no default judge model (EGRESS_JUDGE_MODEL is unset)."})]})]}),!v&&h==="pre-tool"?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:"guardrail-tools",children:"Tool scope"}),e.jsx(k,{id:"guardrail-tools",value:x,onChange:c=>u(c.target.value),placeholder:"github.delete_repo, fs.delete",disabled:s}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Optional, comma-separated. Leave blank to judge every tool call."})]}):null,h==="egress"?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(w,{htmlFor:"guardrail-domains",children:"Domains"}),e.jsx(k,{id:"guardrail-domains",value:l,onChange:c=>m(c.target.value),placeholder:"api.github.com, .slack.com",disabled:s}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Comma-separated hostnames this judge gates — exact (api.github.com) or wildcard (.slack.com). Leave blank to route nothing."})]}):null,e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:justify-end",children:[r?e.jsx(S,{type:"button",variant:"outline",onClick:r,disabled:s,children:"Cancel"}):null,e.jsx(S,{type:"submit",disabled:s,children:s?"Saving…":n})]})]})}function z(a){return a.kind==="require-tool"}function H(a,t,n,s,o){const r=a.name.trim();return r?/^[a-zA-Z0-9][a-zA-Z0-9 _-]*$/.test(r)?n.includes(r)?`"${r}" is a built-in guardrail name — pick another.`:t.some(d=>d.name===r&&d.name!==o)?`A custom guardrail named "${r}" already exists.`:z(a)?a.stage!=="output"?"A required-tool guardrail only runs at the output stage.":a.tools?.some(d=>d.trim())?null:"List at least one tool that must be used.":a.policy.trim()?!s&&!a.model?.trim()?"Judge model is required — the gateway has no default (EGRESS_JUDGE_MODEL is unset).":null:"Policy is required.":"Name may use letters, numbers, spaces, hyphens, and underscores.":"Name is required."}function V(a){const t=z(a),s=(t||a.stage==="pre-tool")&&a.tools&&a.tools.length>0?a.tools.map(d=>d.trim()).filter(Boolean):void 0,o=a.stage==="egress"&&a.domains&&a.domains.length>0?a.domains.map(d=>d.trim()).filter(Boolean):void 0,r=a.model?.trim()||void 0,i=a.policy.trim();return{name:a.name.trim(),enabled:a.enabled,stage:a.stage,...t?{kind:"require-tool"}:{},...t?i?{policy:i}:{}:{policy:i},...r?{model:r}:{},...s&&s.length>0?{tools:s}:{},...o&&o.length>0?{domains:o}:{}}}function ve(a,t){return[...a,V(t)]}function Ne(a,t,n){return a.map(s=>s.name===t?V(n):s)}function ye(a,t){return a.filter(n=>n.name!==t)}function Ce(a,t,n){return a.map(s=>s.name===t?{...s,enabled:n}:s)}function we({owner:a,agentId:t}){const n=B(),{data:s,isLoading:o}=A(t),{data:r,isLoading:i}=L(t),{data:d=null,isLoading:h}=M(t),b=o||i||h,p=F(t),y=s?.guardrailsInline??[],j=(r??[]).map(u=>u.name),C=async u=>{if(!s){f.error("Still loading agent settings — try again in a moment");return}const l=H(u,y,j,d);if(l){f.error(l);return}try{await p.mutateAsync({guardrailsInline:ve(y,u)}),f.success("Guardrail created"),n({to:"/$owner/agents/$agentId/guardrails",params:{owner:a,agentId:t}})}catch(m){f.error(m instanceof Error?m.message:"Failed to create guardrail")}},x=()=>void n({to:"/$owner/agents/$agentId/guardrails",params:{owner:a,agentId:t}});return e.jsxs("div",{className:"space-y-6",children:[e.jsx(xe,{title:"New custom guardrail",description:"A custom guardrail judges text at one stage against a policy you write.",backLabel:"Guardrails",onBack:x}),b?e.jsx(se,{rows:4}):e.jsx(I,{judgeModelDefault:d,submitLabel:"Create guardrail",submitting:p.isPending,onSubmit:C,onCancel:x})]})}function P(a,t){const n=new Set(a?.guardrails??[]),s=new Set(t.map(i=>i.name)),o=t.map(i=>({name:i.name,stages:i.stages,description:i.description,enabled:n.has(i.name),unknown:!1})),r=(a?.guardrails??[]).filter(i=>!s.has(i)).map(i=>({name:i,stages:[],enabled:!0,unknown:!0}));return[...o,...r]}function Se(a){return a.filter(t=>t.enabled||t.unknown).map(t=>t.name)}function ke(a,t,n){return Se(a.map(s=>s.name===t&&!s.unknown?{...s,enabled:n}:s))}const G={input:"Input",output:"Output","pre-tool":"Pre-tool",egress:"Egress"};function Ge(a){const t=new Date(a);return Number.isNaN(t.getTime())?a:ce(t,{addSuffix:!0})}function Ae({owner:a,agentId:t,name:n}){const{data:s}=A(t),{data:o}=L(t),r=N.useMemo(()=>P(s,o??[]).find(d=>d.name===n)??null,[s,o,n]),i=(s?.guardrailsInline??[]).find(d=>d.name===n);return i?e.jsx(Te,{owner:a,agentId:t,guardrail:i}):r?e.jsx(Le,{agentId:t,name:n,row:r}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Guardrail not found."})}function Le({agentId:a,name:t,row:n}){return e.jsxs("div",{className:"space-y-8",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:n.description??(n.stages.length>0?`Built-in. Short-circuits this agent's ${n.stages.map(s=>G[s].toLowerCase()).join(", ")} stage${n.stages.length>1?"s":""} when it matches.`:"Configured out of band — toggling is managed via lobu apply.")}),e.jsx(W,{agentId:a,guardrail:t})]})}function Te({owner:a,agentId:t,guardrail:n}){const s=B(),{data:o}=A(t),{data:r}=L(t),{data:i=null}=M(t),d=F(t),[h,b]=N.useState(!1),p=o?.guardrailsInline??[],y=(r??[]).map(u=>u.name),j=async(u,l)=>{if(!o)return f.error("Still loading agent settings — try again in a moment"),!1;try{return await d.mutateAsync({guardrailsInline:u}),f.success(l),!0}catch(m){return f.error(m instanceof Error?m.message:"Failed to save guardrail"),!1}},C=async u=>{const l=H(u,p,y,i,n.name);if(l){f.error(l);return}await j(Ne(p,n.name,u),"Guardrail saved")&&u.name.trim()!==n.name&&s({to:"/$owner/agents/$agentId/guardrails/$name",params:{owner:a,agentId:t,name:encodeURIComponent(u.name.trim())}})},x=async()=>{await j(ye(p,n.name),"Guardrail deleted")&&s({to:"/$owner/agents/$agentId/guardrails",params:{owner:a,agentId:t}})};return e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium",children:n.kind==="require-tool"?"Required tools":"Policy"}),e.jsx(I,{initial:n,judgeModelDefault:i,submitLabel:"Save changes",submitting:d.isPending,onSubmit:C})]}),e.jsx("div",{className:"flex justify-end",children:h?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(S,{type:"button",variant:"destructive",onClick:()=>void x(),disabled:d.isPending,children:"Delete guardrail"}),e.jsx(S,{type:"button",variant:"outline",onClick:()=>b(!1),disabled:d.isPending,children:"Cancel"})]}):e.jsxs(S,{type:"button",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>b(!0),children:["Delete ",n.name]})}),e.jsx(W,{agentId:t,guardrail:n.name})]})}function W({agentId:a,guardrail:t}){const{data:n=[],isLoading:s,isError:o}=J(a,{guardrail:t});return e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-medium",children:"Recent catches"}),s?e.jsx(ne,{label:"catches",variant:"table",rows:4}):o?e.jsx(re,{label:"catches"}):n.length===0?e.jsx(D,{icon:ie,title:"No catches yet",description:"This guardrail hasn't short-circuited anything on this agent."}):e.jsx("div",{className:"overflow-hidden rounded-lg border",children:e.jsxs(oe,{children:[e.jsx(le,{children:e.jsxs(O,{children:[e.jsx(E,{className:"w-[180px]",children:"When"}),e.jsx(E,{className:"w-[120px]",children:"Stage"}),e.jsx(E,{children:"Reason"})]})}),e.jsx(de,{children:n.map(r=>e.jsxs(O,{children:[e.jsx($,{className:"text-xs text-muted-foreground",title:r.occurredAt,children:Ge(r.occurredAt)}),e.jsx($,{children:e.jsx(ue,{variant:"outline",className:"text-[10px]",children:G[r.stage]})}),e.jsx($,{className:"text-sm text-muted-foreground",children:r.reason??e.jsx("span",{className:"italic",children:"no reason recorded"})})]},r.id))})]})})]})}function Ee({description:a,action:t}){return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("p",{className:"min-w-0 flex-1 text-center text-sm text-muted-foreground",children:a}),t?e.jsx("div",{className:"shrink-0",children:t}):null]})}function U(a,t){return a.get(t)??0}function $e(a,t,n){const s=a.map(r=>{const i=r.stages.map(d=>G[d]);return r.unknown&&i.push("Unknown"),{id:r.name,name:r.name,kind:"builtin",description:r.description,stages:r.stages,enabled:r.enabled,unknown:r.unknown,badges:i,tripCount:U(n,r.name)}}),o=t.map(r=>{const i=[G[r.stage],"Custom"];return{id:r.name,name:r.name,kind:"custom",description:r.policy,stages:[r.stage],enabled:r.enabled,unknown:!1,badges:i,tripCount:U(n,r.name)}});return[...s,...o]}function Re({owner:a,agentId:t,expandedName:n}){const s=B(),{data:o,isLoading:r}=A(t),{data:i,isLoading:d}=L(t),{data:h=[]}=J(t),b=F(t),p=async(l,m)=>{if(!o){f.error("Still loading agent settings — try again in a moment");return}try{if(l.kind==="custom")await b.mutateAsync({guardrailsInline:Ce(o.guardrailsInline??[],l.name,m)});else{const g=P(o,i??[]);await b.mutateAsync({guardrails:ke(g,l.name,m)})}f.success(m?"Guardrail enabled":"Guardrail disabled")}catch(g){f.error(g instanceof Error?g.message:"Failed to save guardrail")}},y=i===null,j=N.useMemo(()=>{const l=P(o,i??[]),m=o?.guardrailsInline??[],g=new Map;for(const v of h)g.set(v.guardrailName,(g.get(v.guardrailName)??0)+1);return $e(l,m,g)},[o,i,h]),C=l=>{if(l===n){s({to:"/$owner/agents/$agentId/guardrails",params:{owner:a,agentId:t}});return}s({to:"/$owner/agents/$agentId/guardrails/$name",params:{owner:a,agentId:t,name:encodeURIComponent(l)}})},x=()=>{s({to:"/$owner/agents/$agentId/guardrails/create",params:{owner:a,agentId:t}})},u=r||d;return!u&&j.length===0?e.jsx("div",{className:"space-y-6",children:y?e.jsx(D,{icon:q,title:"Guardrails catalog unavailable",description:"Guardrails will appear here once the gateway publishes its catalog.",actionLabel:"New guardrail",onAction:x}):e.jsx(D,{icon:q,title:"No guardrails yet",description:"Enable a built-in in lobu.toml or write a custom policy guardrail.",actionLabel:"New guardrail",onAction:x})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(Ee,{description:"Each guardrail short-circuits this agent's input, output, or tool-call stages. Built-ins are toggle-only; add a custom guardrail to judge messages against a policy you write.",action:u?void 0:e.jsxs(S,{type:"button",onClick:x,children:[e.jsx(me,{className:"mr-1.5 h-4 w-4"}),"New guardrail"]})}),u?e.jsx(je,{rows:3}):e.jsx("div",{className:"overflow-hidden rounded-lg border",children:j.map((l,m)=>{const g=l.name===n;return e.jsx(De,{card:l,expanded:g,isLast:m===j.length-1,onToggle:()=>C(l.name),onToggleEnabled:v=>void p(l,v),toggleDisabled:l.unknown||b.isPending,children:g?e.jsx(Ae,{owner:a,agentId:t,name:l.name}):null},l.id)})})]})}function De({card:a,expanded:t,isLast:n,onToggle:s,onToggleEnabled:o,toggleDisabled:r,children:i}){return e.jsxs("div",{className:R("bg-background",!n||t?"border-b":""),children:[e.jsxs("div",{className:"flex items-stretch gap-1 pr-3",children:[e.jsxs("button",{type:"button",onClick:s,"aria-expanded":t,className:R("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",!a.enabled&&!a.unknown&&!t&&"opacity-70"),children:[e.jsx(q,{className:"ml-2 h-4 w-4 shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("span",{className:R("truncate text-sm text-foreground",a.unknown&&"font-mono text-xs"),children:a.name}),a.kind==="custom"&&a.description?e.jsx("p",{className:"line-clamp-1 text-xs text-muted-foreground",children:a.description}):e.jsx("p",{className:"text-xs text-muted-foreground",children:a.tripCount>0?`${a.tripCount} recent ${a.tripCount===1?"catch":"catches"}`:"No recent catches"}),e.jsx(ge,{badges:a.badges})]})]}),e.jsx(fe,{enabled:a.enabled,name:a.name,expanded:t,onToggleEnabled:o,toggleDisabled:r,onToggle:s})]}),t&&i?e.jsx("div",{className:"border-t border-border px-4 py-4",children:i}):null]})}function Z({owner:a,agentId:t,children:n,showBack:s}){return e.jsx(pe,{owner:a,agentId:t,showBack:s,backLabel:"Guardrails",backTo:"/$owner/agents/$agentId/guardrails",children:n})}function qe({owner:a,agentId:t,expandedName:n}){return e.jsx(Z,{owner:a,agentId:t,children:e.jsx(Re,{owner:a,agentId:t,expandedName:n})})}function Ue({owner:a,agentId:t}){return e.jsx(Z,{owner:a,agentId:t,children:e.jsx(we,{owner:a,agentId:t})})}function Me({owner:a,agentId:t,name:n}){return e.jsx(qe,{owner:a,agentId:t,expandedName:decodeURIComponent(n)})}export{qe as A,Ue as a,Me as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{cr as ae,gf as T,ap as O,aq as A,ai as ie,j as s,al as Q,cG as le,cH as ce,cI as ue,as as ye,c0 as re,aG as oe,r as S,c1 as he,c2 as je,cC as de,L as Z,cw as z,Z as ve,cv as be,P as ke}from"./index-DtRfQcRH.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 U={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"]:Ce[t]}const Ce={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"},Re={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=W(t,n,null);return e?H(e,r)!==void 0:!1}function W(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=W(t.agent,n,r,e,o),c={};if(!l?.effects)return c;for(const a of U[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?W(t.agent,n,e,o,l):void 0,j=W(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 (${Re[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 U.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 We(t,n){return t.agent.some(r=>r.resource_class==="connector_action"&&r.operation_key===n)}function Ue(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 Ge(t,n){return t.agent.some(r=>r.resource_class==="agent_config"&&r.target_agent_id===n)}function Je(t,n){let r=0;for(const e of U.agent_config){const o=h(t,"agent_config",e,null);h(t,"agent_config",e,null,null,n)!==o&&(r+=1)}return r}const Ke={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"},Xe={auto:"Auto",approval:"Ask",deny:"Deny",disabled:"Off"};function Ze({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?Xe[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(Ke[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 Ve(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=Ve(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(Ze,{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 Ye(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 V="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 Y({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 R(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:Ye(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]),G=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]),J=S.useMemo(()=>a?qe(a):[],[a]),K=S.useMemo(()=>{if(!a)return[];const u=new Set(J.map(f=>f.operation_key));return a.connector_operations.filter(f=>!u.has(f.operation_key))},[a,J]),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":G.length===0?"— all covered":null,_e=g.connector_operations.length===0?"— none installed":K.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=U[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:R(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:R(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:R(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(Z,{to:"/$owner/entity-types/$slug",params:{owner:t,slug:i.slug},className:V,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 C=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:C,pending:y,onSave:X=>P("entity",i.slug,_,X)})},_)}),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?J.map(i=>{const d=We(g,i.operation_key),N=Ue(g,i.operation_key);return s.jsxs("div",{className:"grid items-center gap-x-3 px-3 py-1.5",style:R(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(Z,{to:"/$owner/connectors/$connectorKey",params:{owner:t,connectorKey:i.connector_key},className:V,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:C=>P("connector_action",null,_,C,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=Ge(g,i.id),N=Je(g,i.id);return s.jsxs("div",{className:"grid items-center gap-x-3 px-3 py-1.5",style:R(k,!0),children:[s.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[s.jsx(Z,{to:"/$owner/agents/$agentId/settings",params:{owner:t,agentId:i.id},search:{run_id:void 0},className:V,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 C=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:C,pending:y,onSave:X=>P("agent_config",null,_,X,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(Y,{label:"Add type",disabled:y||G.length===0,hint:ge,searchPlaceholder:"Search types…",emptyText:"No matching types.",children:i=>G.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(Y,{label:"Add operation",disabled:y||K.length===0,hint:_e,searchPlaceholder:"Search ops…",emptyText:"No matching ops.",children:i=>K.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(Y,{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,Ze as P,$e as a,Te as d,Ae as e,me as o,Se as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a4 as w,r as u,j as e,P as F,ac as C,ad as K,dS as P,dT as z,B as N,al as E,aV as G,d$ as H,e0 as Q,bq as V,gA as Y,fL as q,hS as X}from"./index-DtRfQcRH.js";import{a as J,A as U}from"./agent-subpage-shell-DtzoRy6N.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-s42Q4Wjo.js";import{f as ne}from"./agent-loading-shells-BQLjzMPy.js";import{u as ie,a as I,m as oe,P as re,D as ce,n as de,C as me}from"./core.esm-C-eNiUAl.js";import{A as ue}from"./agent-card-controls-bhTMPoVi.js";const T=":";function A(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=w(),[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:A(d)}})},O=()=>{const d=b({name:r,instructions:m});d&&o({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:A(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(G,"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(z,{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(H,{}):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=w(),[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=w(),{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(I(re,{activationConstraint:{distance:8}}),I(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:A(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(V,{icon:Y,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:A(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(q,{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(X,{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 L({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(L,{owner:s,agentId:t,children:e.jsx(M,{owner:s,agentId:t})})}function Ce({owner:s,agentId:t}){const a=w();return e.jsx(L,{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 Ae({owner:s,agentId:t,skillKey:a}){return e.jsx(L,{owner:s,agentId:t,children:e.jsx(M,{owner:s,agentId:t,expandedRepo:B(a)})})}export{Ne as A,Ce as a,Ae as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a4 as m,j as e,al as h,B as n,ez as i}from"./index-DtRfQcRH.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};
|