@lobu/runtime-server 24.4.0 → 24.5.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/skills.json +2 -2
- package/dist/component.json +1 -1
- package/dist/connectors/postgres.ts +77 -48
- package/dist/dependencies.bun.lock +86 -117
- package/dist/owletto/dist/assets/_-CCWuGXtQ.js +2 -0
- package/dist/owletto/dist/assets/_-DOJW1D-I.js +3 -0
- package/dist/owletto/dist/assets/_agentId-CJhQbi6k.js +2 -0
- package/dist/owletto/dist/assets/_agentId-DD4K1i6V.js +2 -0
- package/dist/owletto/dist/assets/_automationId-Cbd7B0mP.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-DFpPep9B.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-n3iSDT74.js +2 -0
- package/dist/owletto/dist/assets/_conversationId-B1yGIGA9.js +2 -0
- package/dist/owletto/dist/assets/_eventId-B1H0-vD7.js +2 -0
- package/dist/owletto/dist/assets/_name-D30_V03t.js +2 -0
- package/dist/owletto/dist/assets/_owner-Be8O41u8.js +3 -0
- package/dist/owletto/dist/assets/_shape-C6YbloRh.js +2 -0
- package/dist/owletto/dist/assets/_skillKey-BMPvvoOI.js +2 -0
- package/dist/owletto/dist/assets/_slug-Bc4YIEA2.js +2 -0
- package/dist/owletto/dist/assets/_view-aoFDwEld.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-DuNHc3cc.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-rJ7A1zNx.js +2 -0
- package/dist/owletto/dist/assets/accept-invitation-pUl-c1KQ.js +2 -0
- package/dist/owletto/dist/assets/activity-route-view-DN0ZEAzr.js +2 -0
- package/dist/owletto/dist/assets/{agent-card-controls-99mG6H5k.js → agent-card-controls-C5jNWgfq.js} +2 -2
- package/dist/owletto/dist/assets/{agent-client-setup-list-kMmqQSrf.js → agent-client-setup-list-DbXtJTsO.js} +2 -2
- package/dist/owletto/dist/assets/agent-connect-pages-DcTuiSt9.js +2 -0
- package/dist/owletto/dist/assets/agent-editor-form-CdA5vLr8.js +2 -0
- package/dist/owletto/dist/assets/agent-guardrails-route-BJyfalBY.js +2 -0
- package/dist/owletto/dist/assets/agent-list-row-rF5LH-3k.js +2 -0
- package/dist/owletto/dist/assets/{agent-loading-shells-Dnmb6W5Y.js → agent-loading-shells-ClY_O6lb.js} +2 -2
- package/dist/owletto/dist/assets/{agent-permissions-matrix-CbhXlbgY.js → agent-permissions-matrix-bP1Qihv7.js} +2 -2
- package/dist/owletto/dist/assets/{agent-skill-context-V__2i6Vl.js → agent-skill-context-BAaGpvfS.js} +2 -2
- package/dist/owletto/dist/assets/agent-skills-route-Bv5luNdw.js +2 -0
- package/dist/owletto/dist/assets/agent-tab-intro-ednTs4WF.js +2 -0
- package/dist/owletto/dist/assets/agent-thread-WNk2HapT.js +6 -0
- package/dist/owletto/dist/assets/agent-thread-storage-U6htL3ad.js +2 -0
- package/dist/owletto/dist/assets/agents-DY2S2SGE.js +2 -0
- package/dist/owletto/dist/assets/agents-workbench-bPTjdVS1.js +2 -0
- package/dist/owletto/dist/assets/app._appId-DrL5H5lB.js +2 -0
- package/dist/owletto/dist/assets/assist-composer-ClfFEVx7.js +2 -0
- package/dist/owletto/dist/assets/automation-detail-content-dFy1Huas.js +2 -0
- package/dist/owletto/dist/assets/automation-row-DCHM--aD.js +2 -0
- package/dist/owletto/dist/assets/automations-DY2S2SGE.js +2 -0
- package/dist/owletto/dist/assets/{calendar-DMq3Dtqy.js → calendar-Ck0yOLYu.js} +2 -2
- package/dist/owletto/dist/assets/{callback-B-CAz-bK.js → callback-DRABUOha.js} +2 -2
- package/dist/owletto/dist/assets/{card-SFtxv9f2.js → card-Bdi7VEwo.js} +2 -2
- package/dist/owletto/dist/assets/change-summary-PBoM6Asb.js +2 -0
- package/dist/owletto/dist/assets/{claim-DrxIRWKt.js → claim-CUIG1Oc-.js} +2 -2
- package/dist/owletto/dist/assets/{client-activity-scopes-boZOHuPW.js → client-activity-scopes-CXOWB5co.js} +2 -2
- package/dist/owletto/dist/assets/{client-rows-BJ2PxM4J.js → client-rows-36VnmgMK.js} +2 -2
- package/dist/owletto/dist/assets/{clients-C7Lnuc3S.js → clients-BJRcMk1A.js} +2 -2
- package/dist/owletto/dist/assets/code-editor-DNuRKde1.js +16 -0
- package/dist/owletto/dist/assets/connect-CMcEQWls.js +2 -0
- package/dist/owletto/dist/assets/connect-menu-C-B-1xGR.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-tGipxP5a.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-DSGU78eV.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.activity-CPLbry8R.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.index-jSnGvzYs.js +2 -0
- package/dist/owletto/dist/assets/{connection-feed-detail-D7pnWaFB.js → connection-feed-detail-BIlkK0Pd.js} +2 -2
- package/dist/owletto/dist/assets/connection-q1bdnxCN.js +2 -0
- package/dist/owletto/dist/assets/{connections-browser-DDJQh8Na.js → connections-browser-V-3td9DB.js} +2 -2
- package/dist/owletto/dist/assets/{connector-boxes-DDX7Ebc4.js → connector-boxes-lFc-WP83.js} +2 -2
- package/dist/owletto/dist/assets/connector-page-shell-Cs1SjrYB.js +2 -0
- package/dist/owletto/dist/assets/connector-provenance-aJFeeRIC.js +2 -0
- package/dist/owletto/dist/assets/{connector-scope-lists-BibdzKl1.js → connector-scope-lists--vNdbOn0.js} +2 -2
- package/dist/owletto/dist/assets/connectors-BsvDMdsQ.js +2 -0
- package/dist/owletto/dist/assets/consent-DJV78pnz.js +2 -0
- package/dist/owletto/dist/assets/copy-button-DjMWgrBf.js +2 -0
- package/dist/owletto/dist/assets/{core.esm-CHnfRiEM.js → core.esm-CQzL3ObT.js} +3 -3
- package/dist/owletto/dist/assets/create-BmKx5vq3.js +2 -0
- package/dist/owletto/dist/assets/create-Rt0RbiD4.js +2 -0
- package/dist/owletto/dist/assets/create-automation-form-PEmSLMD6.js +3 -0
- package/dist/owletto/dist/assets/create-jBEuveV1.js +2 -0
- package/dist/owletto/dist/assets/create._connectorKey-DcxhYIYC.js +2 -0
- package/dist/owletto/dist/assets/device-Ba3RsIgb.js +2 -0
- package/dist/owletto/dist/assets/device-pin-tombstone-C79KIAIK.js +2 -0
- package/dist/owletto/dist/assets/device._deviceId-CIaoq9co.js +2 -0
- package/dist/owletto/dist/assets/{entity-avatar-HloBoalJ.js → entity-avatar-TVKjZxWQ.js} +2 -2
- package/dist/owletto/dist/assets/entity-options-daOOQo7O.js +2 -0
- package/dist/owletto/dist/assets/entity-page-BfJXvbxn.js +2 -0
- package/dist/owletto/dist/assets/entity-type-page-BLwH6qa7.js +2 -0
- package/dist/owletto/dist/assets/event-card-DVUB8my6.js +2 -0
- package/dist/owletto/dist/assets/event-detail-DkY95e5b.js +2 -0
- package/dist/owletto/dist/assets/{events-feed-BysC9HgU.js → events-feed-B9CZHI_P.js} +2 -2
- package/dist/owletto/dist/assets/filter-bar-wPaR12SS.js +2 -0
- package/dist/owletto/dist/assets/{full-page-spinner-BMiXl54z.js → full-page-spinner-BqmckkOf.js} +2 -2
- package/dist/owletto/dist/assets/guardrails-Csusrok2.js +2 -0
- package/dist/owletto/dist/assets/identity-Dmg3STO8.js +2 -0
- package/dist/owletto/dist/assets/index--ZWegctR.js +2 -0
- package/dist/owletto/dist/assets/{index-CzoK57xp.js → index-B0kw2lFL.js} +2 -2
- package/dist/owletto/dist/assets/index-BKrdVwW9.js +2 -0
- package/dist/owletto/dist/assets/index-BUBcNNUY.js +2 -0
- package/dist/owletto/dist/assets/index-BUDr4-Yv.js +2 -0
- package/dist/owletto/dist/assets/index-BYPQWVwD.js +2 -0
- package/dist/owletto/dist/assets/index-BfpaPJPj.js +2 -0
- package/dist/owletto/dist/assets/index-BicNFLBW.js +2 -0
- package/dist/owletto/dist/assets/index-Bsdv5aks.js +2 -0
- package/dist/owletto/dist/assets/index-C186T2Rw.js +53 -0
- package/dist/owletto/dist/assets/index-CX0pJ9j9.js +2 -0
- package/dist/owletto/dist/assets/{index-B4wXJwQY.js → index-CsrT07TJ.js} +2 -2
- package/dist/owletto/dist/assets/index-DdBTTN3y.js +7899 -0
- package/dist/owletto/dist/assets/index-DdYWarql.css +1 -0
- package/dist/owletto/dist/assets/index-JYEIN8nM.js +2 -0
- package/dist/owletto/dist/assets/index-Vcq4gwWv.js +2 -0
- package/dist/owletto/dist/assets/{index-C-WaHj1Y.js → index-ijqrJaRB.js} +2 -2
- package/dist/owletto/dist/assets/{index-D4-uel59.js → index-ikp_mTsf.js} +2 -2
- package/dist/owletto/dist/assets/json-diff-BaLL4Fsu.js +14 -0
- package/dist/owletto/dist/assets/{list-skeleton-Bp4HNgJ9.js → list-skeleton-CXDLkYTg.js} +2 -2
- package/dist/owletto/dist/assets/login-u6LCgDYG.js +2 -0
- package/dist/owletto/dist/assets/{logout-DxmfsVKD.js → logout-JhmuWJEH.js} +2 -2
- package/dist/owletto/dist/assets/manage-gear-D8LMhehh.js +2 -0
- package/dist/owletto/dist/assets/{member-scope-gate-vp3FihBD.js → member-scope-gate-4FQ0aanZ.js} +2 -2
- package/dist/owletto/dist/assets/memory-browse-page-CNZJbCJC.js +74 -0
- package/dist/owletto/dist/assets/model-jL871x2J.js +2 -0
- package/dist/owletto/dist/assets/model-selector-CgU8SJMF.js +2 -0
- package/dist/owletto/dist/assets/models-jdemgIZk.js +2 -0
- package/dist/owletto/dist/assets/nav-pill-DrFkuyUQ.js +2 -0
- package/dist/owletto/dist/assets/new-CcJOd5aH.js +2 -0
- package/dist/owletto/dist/assets/{new-CvX8_gIb.js → new-DgE1pVV0.js} +2 -2
- package/dist/owletto/dist/assets/new-OWwrYckd.js +2 -0
- package/dist/owletto/dist/assets/organization-CKM_oFX3.js +2 -0
- package/dist/owletto/dist/assets/peek-pane-content-D68BjguQ.js +2 -0
- package/dist/owletto/dist/assets/pending-seed-sml8Uf6e.js +2 -0
- package/dist/owletto/dist/assets/permissions-BvA9SATv.js +2 -0
- package/dist/owletto/dist/assets/{proposal-review-shell-B4CSiyLB.js → proposal-review-shell-D6KABxah.js} +2 -2
- package/dist/owletto/dist/assets/public-shell-ready-BIVCHQHe.js +2 -0
- package/dist/owletto/dist/assets/record-activity-C9gVBbF0.js +2 -0
- package/dist/owletto/dist/assets/{record-session-CWXnCVln.js → record-session-R-uHNuby.js} +2 -2
- package/dist/owletto/dist/assets/{renderer-7EGgTVX0.js → renderer-DXfJaCCa.js} +23 -23
- package/dist/owletto/dist/assets/{reset-password-CFUzxH7m.js → reset-password-Mx3baeNc.js} +2 -2
- package/dist/owletto/dist/assets/run-activity-link-CaIBSRQj.js +2 -0
- package/dist/owletto/dist/assets/run-initiator-BvzQJYW9.js +2 -0
- package/dist/owletto/dist/assets/{runs-BPtQBTRN.js → runs-fFJ1lPnw.js} +2 -2
- package/dist/owletto/dist/assets/runs-panel-DEnZHTa5.js +2 -0
- package/dist/owletto/dist/assets/runs-table-XGnxJl7S.js +2 -0
- package/dist/owletto/dist/assets/{schema-type-editor-panel-CAhOB648.js → schema-type-editor-panel-C0_9VcSs.js} +2 -2
- package/dist/owletto/dist/assets/settings-CP4PjMQA.js +2 -0
- package/dist/owletto/dist/assets/settings-CgaUJMHH.js +2 -0
- package/dist/owletto/dist/assets/skills-D-e_h3a9.js +2 -0
- package/dist/owletto/dist/assets/{source-record-panels-Bh5F4C5K.js → source-record-panels-Bh0n4gGw.js} +2 -2
- package/dist/owletto/dist/assets/{status-dot-D3FoDRcc.js → status-dot-Cpq63I7p.js} +2 -2
- package/dist/owletto/dist/assets/{table-DFcJRNk7.js → table-BUqshjxa.js} +2 -2
- package/dist/owletto/dist/assets/{use-automations-BHoV0dLs.js → use-automations-BLNjxq2K.js} +2 -2
- package/dist/owletto/dist/assets/use-login-redirect-CmyQW7GT.js +2 -0
- package/dist/owletto/dist/assets/{use-mention-search-C3rWLuKm.js → use-mention-search-dn3ws1WB.js} +3 -3
- package/dist/owletto/dist/assets/use-scroll-sentinel-DRyBMueA.js +2 -0
- package/dist/owletto/dist/assets/view-param-filters-CER47Tlz.js +2 -0
- package/dist/owletto/dist/assets/{views-access-required-DHrDO333.js → views-access-required-C_b9itZ2.js} +2 -2
- package/dist/owletto/dist/index.html +2 -2
- package/dist/server-main.bundle.mjs +53989 -51632
- package/dist/server.bundle.mjs +5 -5
- package/dist/verify.mjs +1 -1
- package/npm-shrinkwrap.json +183 -217
- package/package.json +3 -4
- package/vendor/connector-sdk/dist/reaction-client-types.d.ts +8 -2
- package/vendor/connector-sdk/dist/reaction-sdk.d.ts +5 -1
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/contracts/agent-settings.d.ts +61 -6
- package/vendor/core/dist/contracts/agent-settings.js +10 -7
- package/vendor/core/dist/contracts/tools/manage-agents.d.ts +473 -98
- package/vendor/core/dist/contracts/tools/manage-agents.js +111 -2
- package/vendor/core/dist/contracts/tools/manage-automations.d.ts +21 -18
- package/vendor/core/dist/contracts/tools/manage-automations.js +15 -15
- package/vendor/core/dist/contracts/tools/manage-entity-schema.js +2 -2
- package/vendor/core/dist/contracts/tools/manage-inference-providers.d.ts +445 -0
- package/vendor/core/dist/contracts/tools/manage-inference-providers.js +133 -0
- package/vendor/core/dist/contracts/tools/manage-views.d.ts +4 -4
- package/vendor/core/dist/contracts/tools/manage-views.js +5 -3
- package/vendor/core/dist/contracts/worker/device-automation.js +4 -2
- package/vendor/core/dist/error-report.d.ts +73 -0
- package/vendor/core/dist/error-report.js +346 -0
- package/vendor/core/dist/index.d.ts +3 -1
- package/vendor/core/dist/index.js +4 -1
- package/vendor/core/dist/logger.js +7 -4
- package/vendor/core/dist/otel-fetch.d.ts +19 -0
- package/vendor/core/dist/otel-fetch.js +96 -0
- package/vendor/core/dist/otel.d.ts +9 -0
- package/vendor/core/dist/otel.js +28 -7
- package/vendor/core/dist/reserved.d.ts +1 -1
- package/vendor/core/dist/reserved.js +6 -4
- package/vendor/core/dist/tool-result.d.ts +8 -0
- package/vendor/core/dist/tool-result.js +61 -0
- package/vendor/core/dist/utils/diagnostic-scrubber.js +1 -1
- package/vendor/core/dist/worker/auth.js +4 -0
- package/vendor/core/package.json +6 -1
- package/vendor/views/package.json +1 -1
- package/dist/owletto/dist/assets/_-DIK0ae_S.js +0 -2
- package/dist/owletto/dist/assets/_-gTbcArpS.js +0 -3
- package/dist/owletto/dist/assets/_agentId-DOmcJZfk.js +0 -2
- package/dist/owletto/dist/assets/_agentId-DW6wRCVC.js +0 -2
- package/dist/owletto/dist/assets/_automationId-B9IcDYBu.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-C6PmMPTA.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-BrJ8Pzze.js +0 -2
- package/dist/owletto/dist/assets/_conversationId-BpJAeYYW.js +0 -2
- package/dist/owletto/dist/assets/_eventId-DarQJo0G.js +0 -2
- package/dist/owletto/dist/assets/_name-DtmNTcUm.js +0 -2
- package/dist/owletto/dist/assets/_owner-Db8at3hk.js +0 -3
- package/dist/owletto/dist/assets/_shape-6iFA8A86.js +0 -2
- package/dist/owletto/dist/assets/_skillKey-CXkHn3Nl.js +0 -2
- package/dist/owletto/dist/assets/_slug-DBOuBLoX.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-DC27aIN9.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-DuYDieln.js +0 -2
- package/dist/owletto/dist/assets/accept-invitation-BbDCVvur.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-V4ftmSN7.js +0 -2
- package/dist/owletto/dist/assets/agent-connect-pages-B-NPTFs6.js +0 -2
- package/dist/owletto/dist/assets/agent-editor-form-DfMTSIvj.js +0 -2
- package/dist/owletto/dist/assets/agent-guardrails-route-BvGgfd-h.js +0 -2
- package/dist/owletto/dist/assets/agent-skills-route-DFXr_bHp.js +0 -2
- package/dist/owletto/dist/assets/agent-subpage-shell-DWzljvFb.js +0 -2
- package/dist/owletto/dist/assets/agent-thread-DQIr20H-.js +0 -6
- package/dist/owletto/dist/assets/agents-CLbeiqTR.js +0 -2
- package/dist/owletto/dist/assets/agents-workbench-C8bTa2rv.js +0 -2
- package/dist/owletto/dist/assets/app._appId-Bsq40nak.js +0 -2
- package/dist/owletto/dist/assets/automation-detail-content-C9Cgr5Zj.js +0 -2
- package/dist/owletto/dist/assets/automations-CLbeiqTR.js +0 -2
- package/dist/owletto/dist/assets/code-editor-rX0t1g5C.js +0 -16
- package/dist/owletto/dist/assets/connect-BcwgytDV.js +0 -2
- package/dist/owletto/dist/assets/connect-menu-BF-AlunU.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-sDypRDeN.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId-C9OkW1tv.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.activity-Dc6HYr55.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.index-C6qbqgwF.js +0 -2
- package/dist/owletto/dist/assets/connection-88YzIBK9.js +0 -2
- package/dist/owletto/dist/assets/connector-provenance-Th8ymGec.js +0 -2
- package/dist/owletto/dist/assets/connectors-BqwgLUUK.js +0 -2
- package/dist/owletto/dist/assets/consent-BR5U7dwb.js +0 -2
- package/dist/owletto/dist/assets/copy-button-2swYh4jb.js +0 -2
- package/dist/owletto/dist/assets/create-BsPVnRpG.js +0 -2
- package/dist/owletto/dist/assets/create-CVPYVOR5.js +0 -2
- package/dist/owletto/dist/assets/create-QFjmhOEU.js +0 -2
- package/dist/owletto/dist/assets/create-automation-form-DmCOFbRT.js +0 -3
- package/dist/owletto/dist/assets/create._connectorKey-DLDDVtLS.js +0 -2
- package/dist/owletto/dist/assets/cronstrue-CKwjNYgj.js +0 -2
- package/dist/owletto/dist/assets/device-CKup7kvB.js +0 -2
- package/dist/owletto/dist/assets/device-pin-tombstone-xGhCTU5_.js +0 -2
- package/dist/owletto/dist/assets/device._deviceId-B1H_ivDT.js +0 -2
- package/dist/owletto/dist/assets/entity-options-BSW_EG0W.js +0 -2
- package/dist/owletto/dist/assets/entity-page-D-WDWrAe.js +0 -2
- package/dist/owletto/dist/assets/entity-type-page-BCBdFndu.js +0 -2
- package/dist/owletto/dist/assets/event-card-Mcxv56DG.js +0 -2
- package/dist/owletto/dist/assets/event-detail-DXifj49J.js +0 -2
- package/dist/owletto/dist/assets/filter-bar-BQm-ubB1.js +0 -2
- package/dist/owletto/dist/assets/guardrails-D7W80sJO.js +0 -2
- package/dist/owletto/dist/assets/identity-N0cAO9BR.js +0 -2
- package/dist/owletto/dist/assets/index-4gCDI7m4.js +0 -7950
- package/dist/owletto/dist/assets/index-BNaI5GpS.js +0 -2
- package/dist/owletto/dist/assets/index-BUUrHuJJ.js +0 -2
- package/dist/owletto/dist/assets/index-BqrvJmLh.js +0 -2
- package/dist/owletto/dist/assets/index-CnvQEA5V.js +0 -2
- package/dist/owletto/dist/assets/index-Cq7P2c_E.js +0 -2
- package/dist/owletto/dist/assets/index-D3omC3Us.js +0 -2
- package/dist/owletto/dist/assets/index-DDGdlQrt.css +0 -1
- package/dist/owletto/dist/assets/index-DFEW7hMg.js +0 -2
- package/dist/owletto/dist/assets/index-DVV-WWuT.js +0 -2
- package/dist/owletto/dist/assets/index-DduQ_e9q.js +0 -2
- package/dist/owletto/dist/assets/index-DutlI1d-.js +0 -2
- package/dist/owletto/dist/assets/index-wHFQv1aT.js +0 -12
- package/dist/owletto/dist/assets/json-diff-E5D-NGYT.js +0 -4
- package/dist/owletto/dist/assets/login-7F48UJGx.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-CfDmjhDl.js +0 -74
- package/dist/owletto/dist/assets/model-Dn40BUzs.js +0 -2
- package/dist/owletto/dist/assets/model-selector-88PJnyTq.js +0 -2
- package/dist/owletto/dist/assets/models-BBK_n2RP.js +0 -2
- package/dist/owletto/dist/assets/new-4ruWHLR5.js +0 -2
- package/dist/owletto/dist/assets/new-gMD1PHTL.js +0 -2
- package/dist/owletto/dist/assets/oauth-workspace-access-D9BNmyMY.js +0 -2
- package/dist/owletto/dist/assets/organization-BHcp5Pzg.js +0 -2
- package/dist/owletto/dist/assets/peek-pane-content-0sa10jER.js +0 -2
- package/dist/owletto/dist/assets/permissions-hhxosugv.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-CsenJeXa.js +0 -2
- package/dist/owletto/dist/assets/record-activity-D7bRaMk2.js +0 -2
- package/dist/owletto/dist/assets/runs-panel-Bj63_hb9.js +0 -2
- package/dist/owletto/dist/assets/settings-Dg6nxKyw.js +0 -2
- package/dist/owletto/dist/assets/settings-KJJ6WihO.js +0 -2
- package/dist/owletto/dist/assets/skills-ayt06_o2.js +0 -2
- package/dist/owletto/dist/assets/use-scroll-sentinel-Ct-jt7O0.js +0 -2
- package/dist/owletto/dist/assets/view-param-filters-mKoqDsaD.js +0 -2
- /package/vendor/@better-auth-kysely-adapter/{.bun-tag-abf95749a412716 → .bun-tag-654b3a002b271269} +0 -0
- /package/vendor/postgres/{.bun-tag-22d644c2873790db → .bun-tag-c81dacd34e959a7a} +0 -0
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{aE as ye,aF as Ne,j as e,B as j,d3 as Ce,eQ as Se,be as Me,h as Ae,eI as ke,cN as Y,du as K,c_ as Ie,h9 as Pe,ha as Te,hb as Fe,hc as De,gt as _e,hd as Ee,b_ as Re,b$ as $e,aG as Le,r as Q,bT as $,fg as J,c2 as Be,H as b,ep as L,I as U,Y as ze,bz as Oe,bA as Ue,bB as Ge,bC as Ve,bD as Z}from"./index-4gCDI7m4.js";import{b as qe,s as He}from"./model-selector-88PJnyTq.js";function We(a){const t=a.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").replace(/-{2,}/g,"-");return(t?/^[a-z]/.test(t)&&t.length>=3?t:`agent-${t}`:"agent").slice(0,60).replace(/-+$/g,"")||"agent"}function Xe(a,t){const r=new Set(t),x=We(a);let v=x,u=2;for(;r.has(v);){const g=`-${u}`;v=`${x.slice(0,Math.max(1,60-g.length)).replace(/-+$/g,"")||"agent"}${g}`,u+=1}return v}const Ye="__unresolved__";function ee(a){return a.endsWith(`/${Ye}`)}function se(a){const t=a.indexOf("/");return t===-1?{slug:a,model:""}:{slug:a.slice(0,t),model:a.slice(t+1)}}function Ke(a,t){const{slug:r,model:x}=se(a);return{provider:t.find(g=>g.value===a)?.provider??t.find(g=>se(g.value).slug===r)?.provider??r,model:x}}function Qe({value:a,onChange:t,disabled:r}){const{data:x=[]}=ye(),{data:v=[]}=Ne(),u=qe(x,v),g=(s,c)=>{const l=s+c;if(l<0||l>=a.length)return;const m=[...a];[m[s],m[l]]=[m[l],m[s]],t(m)},k=s=>{t(a.filter((c,l)=>l!==s))},I=s=>{a.includes(s)||t([...a,s])},o=u.filter(s=>!a.includes(s.value)&&!ee(s.value));return e.jsxs("div",{className:"grid gap-2",children:[a.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:a.map((s,c)=>{const l=ee(s),{provider:m,model:i}=Ke(s,u);return e.jsxs("li",{className:Ae("flex items-center gap-2 rounded-lg border bg-muted/20 px-3 py-2",l&&"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:m}),c===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:l?"no model selected":i})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-0.5",children:[e.jsx(j,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Move up",disabled:r||c===0,onClick:()=>g(c,-1),children:e.jsx(Ce,{className:"h-4 w-4"})}),e.jsx(j,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Move down",disabled:r||c===a.length-1,onClick:()=>g(c,1),children:e.jsx(Se,{className:"h-4 w-4"})}),e.jsx(j,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive","aria-label":"Remove model",disabled:r,onClick:()=>k(c),children:e.jsx(Me,{className:"h-4 w-4"})})]})]},s)})}),e.jsx(ke,{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(j,{type:"button",variant:"outline",role:"combobox","aria-expanded":s,disabled:r,className:"w-full justify-start font-normal text-muted-foreground",children:[e.jsx(Ie,{className:"mr-2 h-4 w-4 shrink-0"}),"Add model"]}),children:(s,c)=>{const l=c.trim(),m=He(l,u)&&!a.includes(l);return e.jsxs(e.Fragment,{children:[o.map(i=>e.jsxs(Y,{value:`${i.provider} ${i.model} ${i.value}`,onSelect:()=>{I(i.value),s()},className:"cursor-pointer",children:[e.jsx(K,{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)),m?e.jsxs(Y,{value:`__custom__ ${l}`,onSelect:()=>{I(l),s()},className:"cursor-pointer",children:[e.jsx(K,{className:"mr-2 h-4 w-4 opacity-0"}),e.jsxs("span",{children:["Use ",e.jsx("span",{className:"font-mono text-xs",children:l})]})]}):null]})}})]})}const Je=3,Ze=72,es=2e3;function te(a){return Array.from({length:Je},(t,r)=>a?.[r]??{title:"",message:""})}function ae(a){return a.map(({title:t,message:r})=>({title:t.trim(),message:r.trim()})).filter(({title:t,message:r})=>t&&r)}function ns({mode:a,section:t="identity",existingAgentIds:r=[],onCreated:x,onCancel:v,onDone:u,reviewMode:g="none",reviewProposal:k=null,reviewControlsDisabled:I=!1}){const o=a.kind==="create",s=a.kind==="edit"?a.agent:null,c=!o&&t!=="platforms"&&t!=="skills"&&!!s,l=Pe(),m=Te(s?.agentId??""),i=Fe(s?.agentId??""),P=De(s?.agentId??""),{data:p,isLoading:G}=_e(s?.agentId,{enabled:c}),V=!o&&g==="active"?k:null,B=V?Ee(V.proposal):void 0,N=p,q=s?.agentId??"create",d=Re(q,{name:B?.name??s?.name??"",description:B?.description??s?.description??"",identityMd:B?.identityMd??p?.identityMd??"",soulMd:p?.soulMd??"",userMd:p?.userMd??"",models:N?.models??N?.settings?.models??[],showToolCalls:N?.showToolCalls??N?.settings?.showToolCalls??!1,sandboxId:N?.sandboxId??N?.settings?.sandboxId??"builtin",starters:te(p?.starters)}),[w,ne]=d.field("name"),[C,le]=d.field("description"),[T,re]=d.field("identityMd"),[F,ie]=d.field("soulMd"),[D,de]=d.field("userMd"),[_,oe]=d.field("models"),[E,ce]=d.field("showToolCalls"),[S,me]=d.field("sandboxId"),[y,H]=d.field("starters"),[ue,R]=$e(q,!1),{data:ge}=Le({enabled:t==="models"&&!o}),he=Q.useCallback(async n=>{if(n.preventDefault(),!!d.canSubmit){if(o){const h=await l.mutateAsync({agentId:Xe(w,r),name:w.trim(),description:C.trim()||void 0});x?await x(h.agentId):u?.();return}if(s){if(!p){$.error("Still loading agent settings — try again in a moment");return}if(y.some(({title:h,message:M})=>!!h.trim()!=!!M.trim())){$.error("Add both a title and a message for each conversation starter");return}try{await Promise.all([m.mutateAsync({name:w.trim()||s.name,description:C.trim()||void 0}),P.mutateAsync({identityMd:T.trim(),soulMd:F.trim(),userMd:D.trim(),models:_,authProfiles:p.authProfiles??[],skillsConfig:p.skillsConfig,showToolCalls:E,sandboxId:S==="builtin"?void 0:S,starters:ae(y)})]),d.accept(d.values,{name:w.trim()||s.name,description:C.trim()||s.description||"",identityMd:T.trim(),soulMd:F.trim(),userMd:D.trim(),models:_,showToolCalls:E,sandboxId:S,starters:te(ae(y))}),$.success("Agent saved"),u?.()}catch(h){$.error(h instanceof Error?h.message:"Failed to save agent")}}}},[p,l,C,d.accept,d.values,d.canSubmit,S,r,T,o,_,w,x,u,s,E,F,y,m,P,D]),xe=Q.useCallback(async()=>{s&&(await i.mutateAsync(),R(!1),u?.())},[i,u,s,R]),z=l.isPending||m.isPending||i.isPending||P.isPending,pe=o||!!p;if(c&&G)return e.jsx(J,{rows:6});const f=z||I,fe=g==="none"||g==="gone",ve=w.trim().length>0&&pe,be=o||t==="settings",je=!o&&(t==="identity"||t==="settings"),we=!o&&t==="settings",W=!o&&t==="settings",X=!o&&t==="models";return e.jsxs("form",{onSubmit:he,className:"flex min-h-0 flex-col",children:[e.jsx(Be,{visible:d.hasConflict,onReload:d.reset}),e.jsxs("div",{className:"grid content-start gap-4 py-2",children:[je?G?e.jsx(J,{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(L,{id:"identity-md",rows:6,value:T,onChange:n=>re(n.target.value),disabled:f,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(L,{id:"soul-md",rows:6,value:F,onChange:n=>ie(n.target.value),disabled:f,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(L,{id:"user-md",rows:6,value:D,onChange:n=>de(n.target.value),disabled:f,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,be?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(U,{id:"agent-name",placeholder:"Support Bot",value:w,onChange:n=>ne(n.target.value),disabled:f,required:!0}),o?e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"The agent ID will be generated automatically from the name."}):null]}),o?null:e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{htmlFor:"agent-description",children:"Description"}),e.jsx(L,{id:"agent-description",placeholder:"Handles customer support and triage across channels.",value:C,onChange:n=>le(n.target.value),disabled:f,rows:3})]})]}):null,W?e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border bg-muted/20 p-3",children:[e.jsx(ze,{id:"show-tool-calls",checked:E,onCheckedChange:n=>ce(n===!0),disabled:f,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,W?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{children:"Conversation starters"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to three prompts offered on a new chat, on the web and in Slack. The message is sent as the user when tapped."}),y.map((n,h)=>e.jsxs("div",{className:"grid gap-2 sm:grid-cols-[12rem_1fr]",children:[e.jsx(U,{"aria-label":`Starter ${h+1} title`,placeholder:"Plan this week",maxLength:Ze,value:n.title,onChange:M=>H(y.map((A,O)=>O===h?{...A,title:M.target.value}:A)),disabled:f}),e.jsx(U,{"aria-label":`Starter ${h+1} message`,placeholder:"Plan this week's posts from what's trending",maxLength:es,value:n.message,onChange:M=>H(y.map((A,O)=>O===h?{...A,message:M.target.value}:A)),disabled:f})]},h))]}):null,X?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{children:"Models"}),e.jsx(Qe,{value:_,onChange:oe,disabled:f}),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,X?e.jsxs("div",{className:"grid gap-2",children:[e.jsx(b,{htmlFor:"agent-sandbox",children:"Run in sandbox"}),e.jsxs(Oe,{value:S,onValueChange:me,disabled:f,children:[e.jsx(Ue,{id:"agent-sandbox",className:"w-full",children:e.jsx(Ge,{placeholder:"Built-in"})}),e.jsxs(Ve,{children:[e.jsx(Z,{value:"builtin",children:"Built-in (default)"}),(ge?.sandboxes??[]).map(n=>e.jsxs(Z,{value:n.id,children:[n.name," (",n.providerKind,")",n.connected?"":" — no credential"]},n.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]}),fe?e.jsxs("div",{className:"mt-6 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[we?ue?e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx(j,{type:"button",variant:"destructive",onClick:()=>void xe(),disabled:i.isPending,children:i.isPending?"Deleting...":"Delete agent"}),e.jsx(j,{type:"button",variant:"outline",onClick:()=>R(!1),disabled:i.isPending,children:"Cancel"})]}):e.jsx(j,{type:"button",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>R(!0),disabled:i.isPending,children:"Delete agent"}):e.jsx("span",{}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[v?e.jsx(j,{type:"button",variant:"outline",onClick:v,disabled:z,children:"Cancel"}):null,e.jsx(j,{type:"submit",disabled:!d.canSubmit||!ve||z,children:o?l.isPending?"Creating...":"Create agent":m.isPending||P.isPending?"Saving...":"Save changes"})]})]}):null]})}export{ns as A};
|
|
2
|
-
//# sourceMappingURL=agent-editor-form-DfMTSIvj.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as N,j as e,H as w,I as k,bz as K,bA as X,bB as Y,bC as ee,bD as ae,ep as te,B as S,v as B,gt as G,iP as T,iQ as U,hc as F,fg as se,bT as j,gA as I,bJ as ne,bW as re,b4 as $,gC as ie,V as oe,ie as le,bL as q,c_ as de,h as E,iN as ue}from"./index-4gCDI7m4.js";import{M as ce}from"./model-selector-88PJnyTq.js";import{a as me,A as J}from"./agent-subpage-shell-DWzljvFb.js";import{T as ge,a as he,b as M,c as D,d as xe,e as R}from"./table-DFcJRNk7.js";import{f as pe}from"./agent-loading-shells-Dnmb6W5Y.js";import{A as fe}from"./agent-card-controls-99mG6H5k.js";const je=[{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 z({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"),[x,y]=N.useState(a?.policy??""),[p,C]=N.useState(a?.model??""),[f,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 _=f.split(",").map(L=>L.trim()).filter(Boolean);o({name:i,stage:h,...g?{kind:g}:{},policy:x,model:p.trim()||void 0,tools:(v||h==="pre-tool")&&_.length>0?_:void 0,domains:h==="egress"&&l.trim()?l.split(",").map(L=>L.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:je.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:f,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:x,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(ce,{value:p,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:f,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 H(a){return a.kind==="require-tool"}function W(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.`:H(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=H(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 be(a,t){return[...a,V(t)]}function ve(a,t,n){return a.map(s=>s.name===t?V(n):s)}function Ne(a,t){return a.filter(n=>n.name!==t)}function ye(a,t,n){return a.map(s=>s.name===t?{...s,enabled:n}:s)}function Ce({owner:a,agentId:t}){const n=B(),{data:s,isLoading:o}=G(t),{data:r,isLoading:i}=T(t),{data:d=null,isLoading:h}=U(t),b=o||i||h,x=F(t),y=s?.guardrailsInline??[],p=(r??[]).map(u=>u.name),C=async u=>{if(!s){j.error("Still loading agent settings — try again in a moment");return}const l=W(u,y,p,d);if(l){j.error(l);return}try{await x.mutateAsync({guardrailsInline:be(y,u)}),j.success("Guardrail created"),n({to:"/$owner/agents/$agentId/guardrails",params:{owner:a,agentId:t}})}catch(m){j.error(m instanceof Error?m.message:"Failed to create guardrail")}},f=()=>void n({to:"/$owner/agents/$agentId/guardrails",params:{owner:a,agentId:t}});return e.jsxs("div",{className:"space-y-6",children:[e.jsx(me,{title:"New custom guardrail",description:"A custom guardrail judges text at one stage against a policy you write."}),b?e.jsx(se,{rows:4}):e.jsx(z,{judgeModelDefault:d,submitLabel:"Create guardrail",submitting:x.isPending,onSubmit:C,onCancel:f})]})}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 we(a){return a.filter(t=>t.enabled||t.unknown).map(t=>t.name)}function Se(a,t,n){return we(a.map(s=>s.name===t&&!s.unknown?{...s,enabled:n}:s))}const A={input:"Input",output:"Output","pre-tool":"Pre-tool",egress:"Egress"};function ke(a){const t=new Date(a);return Number.isNaN(t.getTime())?a:le(t,{addSuffix:!0})}function Ae({owner:a,agentId:t,name:n}){const{data:s}=G(t),{data:o}=T(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(Ge,{agentId:t,name:n,row:r}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"Guardrail not found."})}function Ge({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=>A[s].toLowerCase()).join(", ")} stage${n.stages.length>1?"s":""} when it matches.`:"Configured out of band — toggling is managed via lobu apply.")}),e.jsx(Z,{agentId:a,guardrail:t})]})}function Te({owner:a,agentId:t,guardrail:n}){const s=B(),{data:o}=G(t),{data:r}=T(t),{data:i=null}=U(t),d=F(t),[h,b]=N.useState(!1),x=o?.guardrailsInline??[],y=(r??[]).map(u=>u.name),p=async(u,l)=>{if(!o)return j.error("Still loading agent settings — try again in a moment"),!1;try{return await d.mutateAsync({guardrailsInline:u}),j.success(l),!0}catch(m){return j.error(m instanceof Error?m.message:"Failed to save guardrail"),!1}},C=async u=>{const l=W(u,x,y,i,n.name);if(l){j.error(l);return}await p(ve(x,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())}})},f=async()=>{await p(Ne(x,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(z,{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 f(),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(Z,{agentId:t,guardrail:n.name})]})}function Z({agentId:a,guardrail:t}){const{data:n=[],isLoading:s,isError:o}=I(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($,{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(ge,{children:[e.jsx(he,{children:e.jsxs(M,{children:[e.jsx(D,{className:"w-[180px]",children:"When"}),e.jsx(D,{className:"w-[120px]",children:"Stage"}),e.jsx(D,{children:"Reason"})]})}),e.jsx(xe,{children:n.map(r=>e.jsxs(M,{children:[e.jsx(R,{className:"text-xs text-muted-foreground",title:r.occurredAt,children:ke(r.occurredAt)}),e.jsx(R,{children:e.jsx(oe,{variant:"outline",className:"text-[10px]",children:A[r.stage]})}),e.jsx(R,{className:"text-sm text-muted-foreground",children:r.reason??e.jsx("span",{className:"italic",children:"no reason recorded"})})]},r.id))})]})})]})}function Le({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 O(a,t){return a.get(t)??0}function Ee(a,t,n){const s=a.map(r=>{const i=r.stages.map(d=>A[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:O(n,r.name)}}),o=t.map(r=>{const i=[A[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:O(n,r.name)}});return[...s,...o]}function De({owner:a,agentId:t,expandedName:n}){const s=B(),{data:o,isLoading:r}=G(t),{data:i,isLoading:d}=T(t),{data:h=[]}=I(t),b=F(t),x=async(l,m)=>{if(!o){j.error("Still loading agent settings — try again in a moment");return}try{if(l.kind==="custom")await b.mutateAsync({guardrailsInline:ye(o.guardrailsInline??[],l.name,m)});else{const g=P(o,i??[]);await b.mutateAsync({guardrails:Se(g,l.name,m)})}j.success(m?"Guardrail enabled":"Guardrail disabled")}catch(g){j.error(g instanceof Error?g.message:"Failed to save guardrail")}},y=i===null,p=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 Ee(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)}})},f=()=>{s({to:"/$owner/agents/$agentId/guardrails/create",params:{owner:a,agentId:t}})},u=r||d;return!u&&p.length===0?e.jsx("div",{className:"space-y-6",children:y?e.jsx($,{icon:q,title:"Guardrails catalog unavailable",description:"Guardrails will appear here once the gateway publishes its catalog.",actionLabel:"New guardrail",onAction:f}):e.jsx($,{icon:q,title:"No guardrails yet",description:"Enable a built-in in lobu.toml or write a custom policy guardrail.",actionLabel:"New guardrail",onAction:f})}):e.jsxs("div",{className:"space-y-6",children:[e.jsx(Le,{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:f,children:[e.jsx(de,{className:"mr-1.5 h-4 w-4"}),"New guardrail"]})}),u?e.jsx(pe,{rows:3}):e.jsx("div",{className:"overflow-hidden rounded-lg border",children:p.map((l,m)=>{const g=l.name===n;return e.jsx(Re,{card:l,expanded:g,isLast:m===p.length-1,onToggle:()=>C(l.name),onToggleEnabled:v=>void x(l,v),toggleDisabled:l.unknown||b.isPending,children:g?e.jsx(Ae,{owner:a,agentId:t,name:l.name}):null},l.id)})})]})}function Re({card:a,expanded:t,isLast:n,onToggle:s,onToggleEnabled:o,toggleDisabled:r,children:i}){return e.jsxs("div",{className:E("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: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",!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:E("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(ue,{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 $e({owner:a,agentId:t,expandedName:n}){return e.jsx(J,{children:e.jsx(De,{owner:a,agentId:t,expandedName:n})})}function Oe({owner:a,agentId:t}){return e.jsx(J,{children:e.jsx(Ce,{owner:a,agentId:t})})}function Ue({owner:a,agentId:t,name:n}){return e.jsx($e,{owner:a,agentId:t,expandedName:decodeURIComponent(n)})}export{$e as A,Oe as a,Ue as b};
|
|
2
|
-
//# sourceMappingURL=agent-guardrails-route-BvGgfd-h.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{v as D,r as g,j as e,c_ as K,H as C,I as L,ep as P,bK as O,B as N,h as R,d9 as _,h3 as H,h4 as z,b4 as G,hj as Q,fv as Y,iN as V}from"./index-4gCDI7m4.js";import{u as A,b as X,f as q,s as J,a as U,S as W,v as Z,c as ee}from"./agent-skill-context-V__2i6Vl.js";import{a as se,A as E}from"./agent-subpage-shell-DWzljvFb.js";import{f as te}from"./agent-loading-shells-Dnmb6W5Y.js";import{u as ae,a as F,m as ne,P as le,D as ie,n as oe,C as re}from"./core.esm-CHnfRiEM.js";import{A as ce}from"./agent-card-controls-99mG6H5k.js";const T=":";function w(s){const t=s.indexOf("/");return t<0?s:`${s.slice(0,t)}${T}${s.slice(t+1)}`}function B(s){const t=s.indexOf(T);return t<0?s:`${s.slice(0,t)}/${s.slice(t+1)}`}function de({owner:s,agentId:t}){const a=D(),[n,i]=g.useState(""),[o,d]=g.useState(!1),[x,k]=g.useState(""),[r,v]=g.useState(""),{skillRows:m,catalog:p,isLoading:u,addSkillFromCatalog:h,addCustomSkill:S}=A(),b=g.useMemo(()=>new Set(m.map(c=>c.repo)),[m]),f=g.useMemo(()=>X(p?.catalog??[],b),[p?.catalog,b]),l=g.useMemo(()=>q(f,n),[f,n]),y=c=>{h(c),a({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:w(c)}})},j=()=>{const c=S({name:x,instructions:r});c&&a({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:w(c)}})},$=e.jsx(se,{title:"Add a skill",description:"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:R(_,"w-full"),children:o?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(L,{id:"custom-skill-name",value:x,onChange:c=>k(c.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:r,onChange:c=>v(c.target.value),placeholder:"Instructions for the agent when this skill is active...",rows:3})]})]}),e.jsx(O,{onCancel:()=>d(!1),children:e.jsx(N,{type:"button",size:"sm",onClick:j,disabled:!x.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:()=>d(!0),children:[e.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-muted",children:e.jsx(K,{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"})]})]})}),u?e.jsx(H,{}):e.jsx(z,{items:l,searchQuery:n,onSearchChange:i,onSelect:c=>y(c.key),searchPlaceholder:"Search skills...",searchAriaLabel:"Search skills",emptyMessage:n.trim()?`No skills match "${n}"`:f.length===0?"All catalog skills are already configured":"No skills available"})]})}function me({row:s}){const{isSaving:t,updateSkillRow:a}=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(L,{id:"skill-name",value:s.name,onChange:i=>a(s.repo,{name:i.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:i=>{const o=i.target.value;a(s.repo,{instructions:o,content:o.trim()||s.name})},rows:4,disabled:t})]})]})})}function ue({owner:s,agentId:t,skillKey:a}){const n=D(),[i,o]=g.useState(!1),d=B(a),{skillRows:x,catalog:k,isSaving:r,saveSkills:v,removeSkillAndSave:m,addSkillFromCatalog:p}=A(),u=x.find(f=>f.repo===d)??null,h=k?.catalog.find(f=>f.repo===d);g.useEffect(()=>{!u&&h&&p(d)},[p,h,d,u]);const S=async()=>{await m(d)&&(o(!1),n({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}}))};if(!u)return h?null:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Skill not found."});const b=!u.system;return e.jsxs("div",{className:"space-y-6",children:[e.jsx(me,{row:u}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-end",children:[b?i?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:()=>o(!1),disabled:r,children:"Cancel"})]}):e.jsxs(N,{type:"button",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>o(!0),disabled:r,children:["Remove ",u.name]}):null,e.jsx(N,{type:"button",onClick:()=>void v(),disabled:r||i,children:r?"Saving...":"Save changes"})]})]})}function ge(s){return s.map(t=>{const a=J(t).map(String);return{id:t.repo,repo:t.repo,name:t.name,description:t.description,badges:a,enabled:t.enabled}})}const I="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=D(),{skillRows:i,catalog:o,isLoading:d,isSaving:x,reorderSkills:k,setSkillEnabledAndSave:r,addSkillFromCatalog:v}=A();g.useEffect(()=>{a&&(i.some(l=>l.repo===a)||o?.catalog.some(l=>l.repo===a)&&v(a))},[a,i,o,v]);const m=g.useMemo(()=>ge(i),[i]),p=g.useMemo(()=>m.map(l=>l.repo),[m]),u=ae(F(le,{activationConstraint:{distance:8}}),F(ne,{coordinateGetter:U})),h=()=>{n({to:"/$owner/agents/$agentId/skills/create",params:{owner:s,agentId:t}})},S=e.jsxs(N,{type:"button",onClick:h,children:[e.jsx(K,{className:"mr-1.5 h-4 w-4"}),"Add skill"]}),b=l=>{if(l===a){n({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}});return}n({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:w(l)}})},f=l=>{const{active:y,over:j}=l;!j||y.id===j.id||k(String(y.id),String(j.id))};return d?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:I}),e.jsx(te,{rows:2})]}):m.length===0?e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:I}),e.jsx(G,{icon:Q,title:"No skills yet",description:"Add a system skill from the catalog or create a custom skill for this agent.",actionLabel:"Add skill",onAction:h})]}):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:I}),S]}),e.jsx(ie,{sensors:u,collisionDetection:oe,onDragEnd:f,children:e.jsx(W,{items:p,strategy:Z,children:e.jsx("div",{className:"overflow-hidden rounded-lg border",children:m.map((l,y)=>{const j=l.repo===a;return e.jsx(xe,{card:l,rank:y+1,disabled:x,expanded:j,isLast:y===m.length-1,onToggle:()=>b(l.repo),onToggleEnabled:$=>void r(l.repo,$),toggleDisabled:x,children:j?e.jsx(ue,{owner:s,agentId:t,skillKey:w(l.repo)}):null},l.id)})})})})]})}function xe({card:s,rank:t,disabled:a,expanded:n,isLast:i,onToggle:o,onToggleEnabled:d,toggleDisabled:x,children:k}){const r=a||n,{attributes:v,listeners:m,setNodeRef:p,transform:u,transition:h,isDragging:S}=ee({id:s.repo,disabled:r}),b={transform:re.Transform.toString(u),transition:h};return e.jsxs("div",{ref:p,style:b,className:R("bg-background",!i||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,...v,...m,children:e.jsx(Y,{className:"h-4 w-4"})}),e.jsxs("button",{type:"button",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",!s.enabled&&!n&&"opacity-70"),onClick:o,"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(V,{badges:s.badges})]})]}),e.jsx(ce,{enabled:s.enabled,name:s.name,expanded:n,onToggleEnabled:d,toggleDisabled:x,onToggle:o})]}),n&&k?e.jsx("div",{className:"border-t border-border px-4 py-4",children:k}):null]})}function je({owner:s,agentId:t}){return e.jsx(E,{children:e.jsx(M,{owner:s,agentId:t})})}function Se({owner:s,agentId:t}){return e.jsx(E,{children:e.jsx(de,{owner:s,agentId:t})})}function ye({owner:s,agentId:t,skillKey:a}){return e.jsx(E,{children:e.jsx(M,{owner:s,agentId:t,expandedRepo:B(a)})})}export{je as A,Se as a,ye as b};
|
|
2
|
-
//# sourceMappingURL=agent-skills-route-DFXr_bHp.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as e,h as a}from"./index-4gCDI7m4.js";function r({children:t,className:s}){return e.jsx("div",{className:a("mx-auto w-full max-w-3xl pb-8",s),children:t})}function x({title:t,description:s}){return e.jsxs("div",{className:"mb-2 space-y-1",children:[e.jsx("h1",{className:"text-center text-xl font-semibold",children:t}),e.jsx("p",{className:"text-center text-sm text-muted-foreground",children:s})]})}export{r as A,x as a};
|
|
2
|
-
//# sourceMappingURL=agent-subpage-shell-DWzljvFb.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{j as s,r as a,aN as Vt,a5 as Bt,gs as Ht,gt as zt,a2 as Ze,Q as Ve,a3 as et,c5 as Wt,gu as tt,gv as Kt,gw as qt,L as mt,h as P,gx as Gt,dH as ht,dJ as Qt,gy as Jt,cB as Yt,dN as Xt,gz as Zt,aA as en,B as pe,eQ as tn,gA as nn,gB as Be,X as rn,aa as on,d3 as sn,d9 as Ne,gC as ln,gD as an,dx as cn,dz as un,gE as dn,dy as fn,bn as pn,gF as mn,gG as hn,ei as gn,W as bn,gH as xn,gI as vn}from"./index-4gCDI7m4.js";import{D as yn,E as Rn}from"./app-bridge-C4nPtae3.js";import{A as wn,a as Sn,b as Cn,c as qe,d as gt,e as Tn}from"./agent-loading-shells-Dnmb6W5Y.js";import{h as jn,t as Nn,R as En,i as An,u as kn,M as In,a as _n}from"./use-mention-search-C3rWLuKm.js";import{t as nt,c as On}from"./event-card-Mcxv56DG.js";import{E as Pn}from"./events-feed-BysC9HgU.js";const bt=a.createContext(null);function Mn({extension:e,children:t}){return s.jsx(bt.Provider,{value:e??null,children:t})}function Ge(){return a.useContext(bt)}var Qe=(e=>(e.PROVIDER_QUOTA_EXHAUSTED="PROVIDER_QUOTA_EXHAUSTED",e.PROVIDER_AUTH="PROVIDER_AUTH",e.PROVIDER_UNKNOWN_MODEL="PROVIDER_UNKNOWN_MODEL",e.PROVIDER_BASE_URL_UNRESOLVED="PROVIDER_BASE_URL_UNRESOLVED",e.NO_MODEL_CONFIGURED="NO_MODEL_CONFIGURED",e.WORKER_UNRESPONSIVE="WORKER_UNRESPONSIVE",e.WORKER_DIED="WORKER_DIED",e.WORKER_STARTUP_FAILED="WORKER_STARTUP_FAILED",e.PROVIDER_TOOL_CALL_FAILED="PROVIDER_TOOL_CALL_FAILED",e.SESSION_TIMEOUT="SESSION_TIMEOUT",e))(Qe||{});const Ln={PROVIDER_QUOTA_EXHAUSTED:{cta:"provider-management",ctaLabel:"Manage provider"},PROVIDER_AUTH:{cta:"provider-management",ctaLabel:"Reconnect provider"},PROVIDER_UNKNOWN_MODEL:{cta:"agent-settings",ctaLabel:"Choose model"},PROVIDER_BASE_URL_UNRESOLVED:{cta:"provider-management",ctaLabel:"Manage provider"},PROVIDER_TOOL_CALL_FAILED:{message:"The model provider rejected its own tool call and ended the turn. This is usually temporary — please try again.",cta:"none"},NO_MODEL_CONFIGURED:{message:"No model is configured for this agent. Choose a model in agent settings.",cta:"agent-settings",ctaLabel:"Choose a model"},WORKER_UNRESPONSIVE:{message:"The agent didn't finish responding in time. This is usually temporary — please try again.",cta:"none"},WORKER_DIED:{message:"The agent stopped unexpectedly before it could reply. This is usually temporary — please try again.",cta:"none"},WORKER_STARTUP_FAILED:{message:"The agent couldn't start, so your request wasn't processed. Please try again in a moment.",cta:"none"},SESSION_TIMEOUT:{cta:"none",silent:!0}};function $n(e){if(typeof e=="string")return Object.values(Qe).includes(e)?e:void 0}const Dn=Object.freeze(Object.defineProperty({__proto__:null,AGENT_ERRORS:Ln,AgentErrorCode:Qe,toAgentErrorCode:$n},Symbol.toStringTag,{value:"Module"})),{AGENT_ERRORS:Un,toAgentErrorCode:Fn}=Dn;function rt(e,t){if(!t)return null;try{const n=new URL(t);return n.protocol!=="http:"&&n.protocol!=="https:"?null:new URL(e,`${n.origin}/`).toString()}catch{return null}}function xt(e,t){const n=Fn(e);if(!n)return null;const r=Un[n];if(r.cta==="none"||!t.workspaceSlug)return null;const o=encodeURIComponent(t.workspaceSlug);if(r.cta==="provider-connect"||r.cta==="provider-management"){const i=t.provider?`/${o}/connectors/${encodeURIComponent(`${Vt}${t.provider}`)}`:`/${o}/connectors`,c=rt(i,t.webOrigin);if(!c)return null;const u=new URL(c);return t.provider&&t.model&&u.searchParams.set("model",t.model),{label:r.ctaLabel??"Connect a provider",href:u.toString()}}if(!t.agentId)return null;const l=rt(`/${o}/agents/${encodeURIComponent(t.agentId)}/settings`,t.webOrigin);return l?{label:r.ctaLabel??"Open settings",href:l}:null}function vt(e){if(!e||typeof e!="object"||Array.isArray(e))return null;const t=e.subscribable;if(!t||typeof t!="object"||Array.isArray(t))return null;const n=t;if(typeof n.connector_key!="string"||!n.connector_key||typeof n.resource_type!="string"||!n.resource_type||typeof n.resource_ref!="string"||!n.resource_ref||typeof n.label!="string"||!n.label)return null;const r=Array.isArray(n.suggested_event_keys)?n.suggested_event_keys.filter(o=>typeof o=="string"&&!!o):void 0;return{connector_key:n.connector_key,resource_type:n.resource_type,resource_ref:n.resource_ref,label:n.label,...r?.length?{suggested_event_keys:r}:{}}}const ot=new Set(["localhost","127.0.0.1","::1","[::1]"]);function Vn(e){return e?.trim().toLowerCase().replace(/^\.+|\.+$/g,"")||null}function st(e,t){const n=Vn(t);if(!n)return!1;const r=e.toLowerCase().replace(/\.$/,"");return r===n||r.endsWith(`.${n}`)}function lt(e,t,n){try{const r=new URL(t),o=new URL(e,t),l=ot.has(o.hostname)&&ot.has(r.hostname),i=o.protocol===r.protocol&&(o.protocol==="https:"||o.protocol==="http:")&&st(o.hostname,n)&&st(r.hostname,n);return o.origin!==r.origin&&(l||i)&&(o.protocol=r.protocol,o.host=r.host),o.origin===r.origin&&o.pathname.startsWith("/api/v1/agents")&&(o.pathname=`/lobu${o.pathname}`),o.toString()}catch{return e}}const Bn=/\.(png|jpe?g|gif|webp|avif|bmp|svg)$/i,yt=new Set(["suggest_actions"]),Pe="Thinking…";function Hn(e){const{textOut:t,statusLine:n,errorText:r,toolCalls:o}=e,l=[];n===Pe&&l.push({type:"reasoning"}),r&&l.push({type:"error",text:r});let i=t;return n&&n!==Pe&&(i=t?`${t}
|
|
2
|
-
|
|
3
|
-
${n}`:n),i&&l.push({type:"text",text:i}),l.push(...o),l}const Rt=[];function zn(e,t,n){return e?.length?e:n===0?t:[]}const Je=a.createContext(null);function Ee(){const e=a.useContext(Je);if(!e)throw new Error("useLobuChat must be used within <LobuChatProvider>");return e}function Lo({messages:e,workspaceSlug:t=null,children:n}){const r=a.useMemo(()=>({messages:e,running:!1,append:()=>{},cancel:()=>{},pendingAttachments:[],addAttachments:()=>{},removeAttachment:()=>{},agentId:null,conversationId:"",workspaceSlug:t,currentSuggestions:null,starters:Rt}),[e,t]);return s.jsx(Je.Provider,{value:r,children:n})}const wt=/\[([^\]]*)\]\((\S*?\/api\/v1\/files\/[^)\s]+)\)/g;function at(e){return e.replace(/<lobu_internal_context>[\s\S]*?<\/lobu_internal_context>\n*/g,"").replace(wt,"").replace(/\n{3,}/g,`
|
|
4
|
-
|
|
5
|
-
`).trim()}function Wn(e){const t=[];for(const n of e.matchAll(wt)){const r=n[1]?.trim()||"file",o=n[2];o&&t.push({name:r,url:o})}return t}function Kn(e,t={}){if(typeof e=="string"){const r=at(e);return r?[{type:"text",text:r}]:[]}if(!Array.isArray(e))return[];const n=[];for(const r of e){if(!r||typeof r!="object")continue;const o=r;if(o.type==="text"&&typeof o.text=="string"){const l=at(o.text);l&&n.push({type:"text",text:l})}else t.showToolCalls&&o.type==="toolCall"&&typeof o.name=="string"&&!yt.has(o.name)?n.push({type:"tool-call",toolCallId:o.id??`tc-${n.length}`,toolName:o.name,args:o.arguments??{},...o.result!==void 0?{result:o.result}:{}}):t.showToolCalls&&o.type==="tool_use"&&typeof o.name=="string"&&n.push({type:"tool-call",toolCallId:o.id??`tc-${n.length}`,toolName:o.name,args:o.input??{},...o.result!==void 0?{result:o.result}:{}})}return n}function qn(e){const t=[],n=r=>{for(const{name:o,url:l}of Wn(r))t.push({id:`file-${t.length}`,name:o,url:l,isImage:Bn.test(o)})};if(typeof e=="string")return n(e),t.length>0?t:void 0;if(Array.isArray(e)){for(const r of e){if(!r||typeof r!="object")continue;const o=r;if(o.type==="image"&&typeof o.data=="string"){const l=o.mimeType||"image/png";t.push({id:`img-${t.length}`,name:`image-${t.length+1}`,imageDataUrl:`data:${l};base64,${o.data}`,isImage:!0})}else o.type==="text"&&typeof o.text=="string"&&n(o.text)}return t.length>0?t:void 0}}function Gn(e,t){if(e.type==="bashExecution"){const r=e.content??{},o=e.timestamp?new Date(e.timestamp).getTime():void 0;return{id:e.id,role:"user",parts:[{type:"bash",command:r.command??"",output:r.output??"",exitCode:r.exitCode,cancelled:r.cancelled??!1}],createdAt:o&&!Number.isNaN(o)?o:void 0}}if(e.type!=="message"||e.isVerbose||e.role!=="assistant"&&e.role!=="user"&&e.role!=="system")return null;const n=e.timestamp?new Date(e.timestamp).getTime():void 0;return{id:e.id,role:e.role,parts:Kn(e.content,t),attachments:qn(e.content),createdAt:n&&!Number.isNaN(n)?n:void 0}}const Qn=[],Jn=[];function Yn(e){let t=null;for(const n of e)n.type==="suggestion"&&(t=n.prompts.length>0?n.prompts:null);return t}function Xn(e,t){if(e.length===0)return null;const n=[];for(const r of e)if(r.type!=="suggestion"){if(r.type==="agent-error"){n.push({type:"error",text:String(r.error??"Agent reported an error.")});const o=xt(r.errorCode,{...t,provider:r.errorContext?.provider,model:r.errorContext?.model});o&&n.push({type:"tool-call",toolCallId:`error-run-${r.runId}`,toolName:"link-button",args:{label:o.label,url:o.href}});continue}n.push({type:"tool-call",toolCallId:`approval-event-${r.eventId}`,toolName:"tool-approval",args:{runId:r.runId,action:r.action,proposal:r.proposal,current:r.current,fields:r.fields??null,attribution:r.attribution??null,resourceKind:r.resourceKind??null,reason:r.reason??null,status:r.status??"pending",reviewedByName:r.reviewedByName??null}})}return n.length===0?null:{id:"history-interactions",role:"assistant",parts:n}}const Zn=3e4,er=3*Zn,tr=15e3;function it(e){try{return JSON.parse(e.data)}catch{return{content:e.data}}}const ye=e=>`${e}-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;function nr(e){const t=[],n=new Set;for(const r of e){if(!r||typeof r!="object")continue;const{title:o,message:l}=r;if(typeof o!="string"||typeof l!="string")continue;const i=o.trim(),c=l.trim();if(i.length===0||c.length===0)continue;const u=`${i}\0${c}`;n.has(u)||(n.add(u),t.push({title:i,message:c}))}return t.length>0?t:null}function $o({agentId:e,workspaceSlug:t,thread:n="agent-panel",loadHistory:r=!0,ephemeralContext:o,onFirstUserMessage:l,children:i,initialDraft:c}){const u=Bt(),d=a.useRef(null),p=a.useRef(null),v=a.useRef(!1),m=a.useRef(o),g=a.useRef(!1),R=a.useRef(null);m.current=o;const{data:A,isLoading:x}=Ht(e,n,{orgSlug:t,enabled:r&&!!e&&!!n}),T=A?.messages??Qn,W=A?.interactions??Jn,{data:U}=zt(e,{enabled:!!e}),G=U?.starters??Rt,K=!!(U?.showToolCalls??U?.settings?.showToolCalls),[E,$]=a.useState([]),[J,ae]=a.useState(!1),[D,Q]=a.useState([]),[Y,y]=a.useState(null),w=a.useRef(!1);w.current=J;const j=a.useMemo(()=>T.map(I=>Gn(I,{showToolCalls:K})).filter(I=>I!==null),[T,K]),O=a.useRef(!1);a.useEffect(()=>{if(O.current||x||w.current)return;O.current=!0;const I=Xn(W,{workspaceSlug:t,agentId:e,webOrigin:typeof window>"u"?null:window.location.origin});$(I?[...j,I]:j),y(Yn(W))},[e,x,j,W,t]);const k=a.useCallback(()=>{u.invalidateQueries({queryKey:["agent-thread-messages",t,e,n]}),u.invalidateQueries({queryKey:["agent-threads",t,e]})},[u,t,e,n]),Z=a.useCallback(async()=>{if(d.current)return d.current;if(p.current)return p.current;if(!e)throw new Error("No agent selected");const I=(async()=>{const M=await Ze(`${Ve}/lobu/api/v1/agents`,{method:"POST",headers:{"Content-Type":"application/json",...t?{"x-lobu-org":t}:{}},credentials:"include",body:JSON.stringify({agentId:e,thread:n}),timeoutMs:2e4});if(!M.ok)throw await et(M);const V=await M.json(),N=Wt(),z={sessionId:V.agentId,sseUrl:lt(V.sseUrl,Ve,N),messagesUrl:lt(V.messagesUrl,Ve,N)};return d.current=z,z})();p.current=I;try{return await I}catch(M){throw d.current=null,M}finally{p.current=null}},[e,t,n]),te=a.useCallback(async(I,M,V)=>{const N=new AbortController;R.current=N;const z=S=>{$(q=>q.map(f=>f.id===V?{...f,parts:S}:f))};let ee;try{ee=await Z()}catch(S){z([{type:"text",text:`Error: ${S instanceof Error?S.message:"Could not start a session."}`}]);return}let B=await tt(ee.sseUrl,{throwOnFailure:!0});const oe=[];let me=null;const ue=()=>{const S=me;me=null,S?.()},he=S=>{oe.push(S),ue()};let ge=!1,be=null;const ke=new Promise(S=>{be=S});let xe=0,ve=Date.now();const de=S=>{ve=Date.now();const q=Number(S.lastEventId);Number.isFinite(q)&&q>xe&&(xe=q)},Ie=["output","status","complete","closed","agent-error","question","link-button","tool-approval","tool_use"],Ce=S=>{S.addEventListener("open",()=>{ge=!0,be?.()}),S.addEventListener("connected",f=>{de(f),ge||(ge=!0,be?.())}),S.addEventListener("ping",de);const q=f=>h=>{de(h);const C=h;typeof C.data=="string"&&he({kind:f,payload:it(C)})};for(const f of Ie)S.addEventListener(f,q(f));S.addEventListener("error",f=>{const h=f;if(typeof h.data=="string"&&h.data){de(f),he({kind:"error",payload:it(h)});return}S.readyState===EventSource.CLOSED&&he({kind:"error",payload:{error:"Connection closed"}})})};Ce(B);const _e=async()=>{B.close();let S=ee.sseUrl;if(xe){const q=new URL(ee.sseUrl,window.location.origin);q.searchParams.set("since",String(xe)),S=q.toString()}B=await tt(S,{throwOnFailure:!1}),Ce(B),ve=Date.now()};await Promise.race([ke,new Promise(S=>setTimeout(S,1500))]);const Te=()=>{B.close(),ue()};N.signal.addEventListener("abort",Te,{once:!0});try{const S=m.current?.trim(),q=!!S&&!g.current;q&&(g.current=!0);let f;if(M.length>0){const b=new FormData;b.set("content",I),q&&S&&b.set("ephemeralContext",S);for(const _ of M)b.append("files",_,_.name);f={method:"POST",credentials:"include",body:b,timeoutMs:12e4}}else{const b={content:I};q&&S&&(b.ephemeralContext=S),f={method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(b),timeoutMs:2e4}}const h=await Ze(ee.messagesUrl,f);if(!h.ok)throw d.current=null,await et(h);let C="",L=Pe,ce=null;const H=[],fe=()=>Hn({textOut:C,statusLine:L,errorText:ce,toolCalls:H});for(z(fe());!N.signal.aborted;){if(oe.length===0){let _;const ne=await Promise.race([new Promise(Fe=>{me=()=>Fe(!0)}),new Promise(Fe=>{_=setTimeout(()=>Fe(!1),tr)})]);_&&clearTimeout(_),!ne&&Date.now()-ve>=er&&(await _e(),k());continue}const b=oe.shift();if(b){if(b.kind==="output")L=null,C+=String(b.payload.content??"");else if(b.kind==="status")L=Pe;else if(b.kind==="complete"){L=null;const _=b.payload.finalText;typeof _=="string"&&_.length>0&&(C=_);const ne=b.payload.suggestions;ne!==void 0&&y(Array.isArray(ne)?nr(ne):null),k(),z(fe());return}else if(b.kind==="closed"){d.current=null;const _=b.payload.reason;L=`Session ended${_?`: ${_}`:""}.`,k(),z(fe());return}else if(b.kind==="error"||b.kind==="agent-error"){L=null,ce=typeof b.payload.error=="string"&&b.payload.error?b.payload.error:"Agent reported an error.";const _=b.payload.errorContext&&typeof b.payload.errorContext=="object"?b.payload.errorContext:void 0,ne=xt(b.payload.errorCode,{workspaceSlug:t,agentId:e,webOrigin:typeof window>"u"?null:window.location.origin,provider:typeof _?.provider=="string"?_.provider:void 0,model:typeof _?.model=="string"?_.model:void 0});ne&&H.push({type:"tool-call",toolCallId:ye("l"),toolName:"link-button",args:{label:ne.label,url:ne.href}}),k(),z(fe());return}else if(b.kind==="question")H.push({type:"tool-call",toolCallId:ye("q"),toolName:"question",args:{question:b.payload.question??"",options:b.payload.options??[]}});else if(b.kind==="tool_use"){if(L=null,yt.has(b.payload.name??"")){z(fe());continue}const _=b.payload.result_summary,ne=vt(_);if(!K&&!ne){z(fe());continue}H.push({type:"tool-call",toolCallId:b.payload.toolCallId??ye("t"),toolName:K?b.payload.name??"tool":"subscription-candidate",args:K?b.payload.input??{}:null,result:_,isError:b.payload.isError})}else if(b.kind==="link-button")H.push({type:"tool-call",toolCallId:ye("l"),toolName:"link-button",args:{label:b.payload.label??"Open link",url:b.payload.url??""}});else if(b.kind==="tool-approval"){const _=b.payload.runId;if(typeof _!="number")continue;H.push({type:"tool-call",toolCallId:`run-${_}`,toolName:"tool-approval",args:{runId:_,action:b.payload.action??null,proposal:b.payload.proposal??null,current:b.payload.current??null,fields:b.payload.fields??null,attribution:b.payload.attribution??null,resourceKind:b.payload.resourceKind??null}})}z(fe())}}}catch(S){z([{type:"text",text:`Error: ${S instanceof Error?S.message:"Send failed."}`}])}finally{N.signal.removeEventListener("abort",Te),B.close()}},[e,Z,k,K,t]),re=a.useCallback(I=>{const M=I.trim(),V=D.map(B=>B.file);if(!M&&V.length===0||w.current||!e)return;v.current||(v.current=!0,l?.(M||V[0]?.name||""));const N={id:ye("u"),role:"user",parts:M?[{type:"text",text:M}]:[],attachments:D.map(B=>({id:B.id,name:B.name,isImage:B.isImage,imageDataUrl:B.isImage?URL.createObjectURL(B.file):void 0})),createdAt:Date.now()},z=ye("asst"),ee={id:z,role:"assistant",parts:[{type:"reasoning"}],createdAt:Date.now()};$(B=>[...B,N,ee]),Q([]),ae(!0),w.current=!0,te(M,V,z).finally(()=>{ae(!1),w.current=!1,R.current=null})},[e,l,D,te]),le=a.useCallback(()=>{R.current?.abort()},[]),Se=a.useCallback(I=>{const M=Array.from(I);Q(V=>[...V,...M.map(N=>({id:crypto.randomUUID(),name:N.name,file:N,isImage:N.type.startsWith("image/")}))])},[]),X=a.useCallback(I=>{Q(M=>M.filter(V=>V.id!==I))},[]),ie=a.useRef(!1);a.useEffect(()=>{if(ie.current)return;const I=Kt(n);I&&(ie.current=!0,re(I))},[n,re]);const F=a.useMemo(()=>({messages:E,running:J,append:re,cancel:le,pendingAttachments:D,addAttachments:Se,removeAttachment:X,initialDraft:c,agentId:e,conversationId:n,workspaceSlug:t,currentSuggestions:Y,starters:G}),[E,J,re,le,D,Se,X,c,e,n,t,Y,G]);return r&&x?s.jsx(wn,{}):s.jsx(Je.Provider,{value:F,children:i})}const ct="mx-0.5 inline-flex items-center gap-1 rounded-md bg-accent px-1.5 py-0.5 align-baseline font-medium text-[0.9em] text-accent-foreground no-underline";function rr({refItem:e}){const t=En[e.kind]??qt;return An(e.path)?s.jsxs("span",{className:ct,children:[s.jsx(t,{className:"h-3 w-3 shrink-0 opacity-70"}),e.label]}):s.jsxs(mt,{to:e.path,className:P(ct,"hover:bg-accent/80"),children:[s.jsx(t,{className:"h-3 w-3 shrink-0 opacity-70"}),e.label]})}const Ye=({text:e,renderText:t})=>jn(e)?s.jsx(s.Fragment,{children:Nn(e).map((n,r)=>n.type==="ref"?s.jsx(rr,{refItem:n.ref},`r${r}`):s.jsx("span",{children:t(n.text)},`t${r}`))}):s.jsx(s.Fragment,{children:t(e)}),or=({label:e="Thinking"})=>s.jsx("span",{className:"aui-thinking-shimmer inline-block text-sm","aria-live":"polite","aria-busy":"true",children:e}),St=a.createContext(null),Ct=()=>{const e=a.useContext(St);if(!e)throw new Error("ChainOfThought components must be used within ChainOfThought");return e},Tt=a.memo(({className:e,open:t,defaultOpen:n=!1,onOpenChange:r,children:o,...l})=>{const[i,c]=Gt({prop:t,defaultProp:n,onChange:r}),u=a.useMemo(()=>({isOpen:i,setIsOpen:c}),[i,c]);return s.jsx(St.Provider,{value:u,children:s.jsx("div",{className:P("not-prose max-w-prose space-y-4",e),...l,children:o})})}),jt=a.memo(({className:e,children:t,...n})=>{const{isOpen:r,setIsOpen:o}=Ct();return s.jsx(ht,{onOpenChange:o,open:r,children:s.jsxs(Qt,{className:P("flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",e),...n,children:[s.jsx(Jt,{className:"size-4"}),s.jsx("span",{className:"flex-1 text-left",children:t??"Chain of Thought"}),s.jsx(Yt,{className:P("size-4 transition-transform",r?"rotate-180":"rotate-0")})]})})}),Nt=a.memo(({className:e,icon:t=Zt,label:n,description:r,status:o="complete",children:l,...i})=>{const c={complete:"text-muted-foreground",active:"text-foreground",pending:"text-muted-foreground/50"};return s.jsxs("div",{className:P("flex gap-2 text-sm",c[o],"fade-in-0 slide-in-from-top-2 animate-in",e),...i,children:[s.jsxs("div",{className:"relative mt-0.5",children:[s.jsx(t,{className:"size-4"}),s.jsx("div",{className:"-mx-px absolute top-7 bottom-0 left-1/2 w-px bg-border"})]}),s.jsxs("div",{className:"flex-1 space-y-2 overflow-hidden",children:[s.jsx("div",{children:n}),r&&s.jsx("div",{className:"text-muted-foreground text-xs",children:r}),l]})]})}),Et=a.memo(({className:e,children:t,...n})=>{const{isOpen:r}=Ct();return s.jsx(ht,{open:r,children:s.jsx(Xt,{className:P("mt-2 space-y-3","data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",e),...n,children:t})})});Tt.displayName="ChainOfThought";jt.displayName="ChainOfThoughtHeader";Nt.displayName="ChainOfThoughtStep";Et.displayName="ChainOfThoughtContent";function sr(e){return{contentIds:e.filter(n=>Number.isSafeInteger(n)&&n>0),sortBy:"date",sortOrder:"asc"}}function lr({ownerSlug:e,eventIds:t}){const n=t.join(","),r=a.useMemo(()=>sr(n.split(",").map(Number)),[n]);return r.contentIds.length===0?null:s.jsx(en,{owner:e,children:({organizationId:o,ownerSlug:l})=>o?s.jsx(Pn,{organizationId:o,ownerSlug:l,filters:r,hideOriginator:!0}):null})}function ar({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:o}){let l=He(ir(r,o),t);if(!n)return a.createElement(e,l);if(typeof n=="function")return n(l,r);if(!a.isValidElement(n))return null;let i=n.props,c={...He(l,i),ref:Ae(l.ref,i.ref)};return a.cloneElement(n,c)}function He(...e){let t={};for(let n of e){if(!n)continue;let r=n;for(let o of Object.keys(r)){let l=r[o];if(l===void 0)continue;let i=t[o];o==="className"?t[o]=[i,l].filter(Boolean).join(" "):o==="style"?t[o]={...i,...l}:o==="ref"?t[o]=Ae(i,l):ur(o)&&typeof i=="function"&&typeof l=="function"?t[o]=cr(l,i):t[o]=l}}return t}function ir(e,t){let n={};for(let r of Object.keys(e)){let o=e[r],l=t?.[r]?.(o);if(l){Object.assign(n,l);continue}if(r==="slot"){n["data-slot"]=o;continue}let i=`data-${String(r).replace(/[A-Z]/g,c=>`-${c.toLowerCase()}`)}`;typeof o=="boolean"?n[i]=o?"":void 0:o!=null&&(n[i]=String(o))}return n}function cr(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function ur(e){return/^on[A-Z]/.test(e)}function Ae(...e){let t=e.filter(Boolean);if(t.length!==0)return n=>{for(let r of t)typeof r=="function"?r(n):r&&(r.current=n)}}var dr=8,fr=64,pr=0,Me=.5,mr=180,hr=new Set(["ArrowDown","ArrowUp","End","Home","PageDown","PageUp"," "]),At={start:!1,end:!1},gr=[],Le={currentAnchorId:null,visibleMessageIds:gr};function br({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return At;let o=Xe({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:o-r.scrollTop-r.clientHeight>t}}function xr({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:o,visibleMessageIds:l}){if(!e||!o)return Le;let i=o.getBoundingClientRect(),c=i.top+t+n,u=typeof IntersectionObserver>"u",d=[],p=null;for(let v of je(e,r)){let m=v.dataset.messageId;if(!m)continue;let g=v.dataset.scrollAnchor==="true",R=g||u?v.getBoundingClientRect():null;(u&&R?R.bottom>c&&R.top<i.bottom:l.has(m))&&d.push(m),g&&R&&R.top<=c+Me&&(p=m)}return d.length===0&&p===null?Le:{currentAnchorId:p,visibleMessageIds:d}}function je(e,t){return Array.from(e.children).filter(n=>n instanceof HTMLElement&&n!==t)}function vr(e,t){for(let n=t;n<e.length;n++){let r=e[n];if(r?.dataset.scrollAnchor==="true")return r}return null}function yr(e,t){for(let n of e)if(n.dataset.scrollAnchor==="true"&&!t.has(n))return n;return null}function Rr(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor==="true"&&(n+=1,n>1))return!0;return!1}function wr(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor==="true")return n}return null}function Sr({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let o of je(e,t)){if(!o.dataset.messageId)continue;let l=o.getBoundingClientRect();if(l.bottom>r.top&&l.top<r.bottom)return o}return null}function Cr({align:e,element:t,scrollMargin:n,spacer:r,viewport:o}){let l=kt(t,o),i=t.getBoundingClientRect().height,c=Nr(r);if(e==="center"){let u=Math.max(0,o.clientHeight-c.start-c.end);return l-c.start-(u-i)/2-n}if(e==="end")return l-o.clientHeight+i+c.end+n;if(e==="nearest"){let u=l+i,d=o.scrollTop+c.start,p=o.scrollTop+o.clientHeight-c.end;return l>=d&&u<=p?o.scrollTop:l<d?l-c.start-n:u-o.clientHeight+c.end+n}return l-c.start-n}function kt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function Oe(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function Tr({content:e,scrollTop:t,spacer:n,viewport:r}){let o=Xe({content:e,spacer:n,viewport:r});return t+r.clientHeight-o}function Xe({content:e,spacer:t,viewport:n}){let r=je(e,t),o=It(e),l=n.getBoundingClientRect(),i=n.scrollTop,c=o.start+o.end;for(let u of r){let d=u.getBoundingClientRect();c=Math.max(c,d.bottom-l.top+i+o.end)}return c}function jr(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function It(e){let t=window.getComputedStyle(e);return{end:ze(t.paddingBlockEnd||t.paddingBottom),start:ze(t.paddingBlockStart||t.paddingTop)}}function Nr(e){let t=e?.parentElement;return t?It(t):{end:0,start:0}}function Er(e){if(!e)return 0;let t=window.getComputedStyle(e),n=t.rowGap==="normal"?t.gap:t.rowGap;return ze(n)}function ze(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function Ar({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:o,autoScrollRef:l,autoscrollingRef:i,autoscrollingTimeoutRef:c,contentRef:u,defaultScrollPositionAppliedRef:d,itemCountRef:p,messageElementsRef:v,modeRef:m,pendingScrollToMessageRef:g,prependRestoreRef:R,scrollMarginRef:A,scrollPreviousItemPeekRef:x,spacerGapRef:T,spacerHeightRef:W,spacerRef:U,viewportRef:G}=e,K=a.useCallback(y=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null),i.current!==y&&(i.current=y,t()),y&&(c.current=window.setTimeout(()=>{c.current=null,i.current=!1,t()},mr))},[t]),E=a.useCallback(y=>{let w=U.current;if(!w)return;let j=Math.max(0,Math.ceil(y));W.current!==j&&(W.current=j,w.hidden=j===0,w.style.height=`${j}px`,w.style.marginTop=j>0?`${-T.current}px`:"")},[]),$=a.useCallback((y,{behavior:w="auto",autoscrolling:j=!1}={})=>{let O=G.current;if(!O)return;let k=Math.max(0,y);if(Math.abs(O.scrollTop-k)<=Me){O.scrollTop=k,t();return}j&&K(!0),O.scrollTo({top:k,behavior:w}),n()},[t,n,K]),J=a.useCallback(({behavior:y="auto"}={})=>G.current?(E(0),o.current=null,m.current="free-scrolling",$(0,{behavior:y}),r(),!0):!1,[r,$,E]),ae=a.useCallback(({behavior:y="auto"}={})=>{let w=G.current;return w?(E(0),o.current=null,m.current=l.current?"following-bottom":"free-scrolling",$(jr(w),{autoscrolling:!0,behavior:y}),r(),!0):!1},[r,$,E]),D=a.useCallback((y,{align:w="start",behavior:j="auto",scrollMargin:O=A.current}={},{keepPreviousPeek:k=!1}={})=>{let Z=u.current,te=G.current;if(!Z||!te||!Z.contains(y))return!1;let re=Cr({align:w,element:y,scrollMargin:k?O+x.current:O,spacer:U.current,viewport:te}),le=Tr({content:Z,scrollTop:re,spacer:U.current,viewport:te});return E(le),R.current={element:y,viewportTop:Oe(y,te)},m.current=k?"anchored-to-message":"settling-jump",o.current=k?y:null,$(re,{behavior:j}),r(),!0},[r,$,E]),Q=a.useCallback(()=>{let y=o.current;return!y||!y.isConnected||m.current!=="anchored-to-message"?!1:D(y,{align:"start"},{keepPreviousPeek:!0})},[D]),Y=a.useCallback((y,w)=>{let j=v.current.get(y);return j?(d.current=!0,D(j,w)?(g.current=null,!0):(g.current={messageId:y,options:w},!0)):p.current===0?(g.current={messageId:y,options:w},d.current=!0,!0):!1},[D]);return{flushPendingScrollToMessage:a.useCallback(()=>{let y=g.current;if(!y)return!1;let w=v.current.get(y.messageId);return!w||!D(w,y.options)?!1:(g.current=null,d.current=!0,!0)},[D]),reanchorToAnchoredMessage:Q,scrollToElement:D,scrollToEnd:ae,scrollToMessage:Y,scrollToStart:J}}function _t(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:o=>{t(n,o)||(n=o,r.forEach(l=>l()))},subscribe:(o,l,i)=>{let c=r.size===0;return r.add(o),c&&l?.(),()=>{r.delete(o),r.size===0&&i?.()}}}}function kr(e,t){return _t(e,t)}function Ir(){return _t(Le,Or)}function _r(e,t){return e.start===t.start&&e.end===t.end}function Or(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((n,r)=>n===t.visibleMessageIds[r])}function Pr({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let o=a.useRef(e),l=a.useRef(!1),i=a.useRef(null),c=a.useRef(!1),u=a.useRef(t),d=a.useRef(0),p=a.useRef(null),v=a.useRef(0),m=a.useRef(e?"following-bottom":"free-scrolling"),g=a.useRef(new Map),R=a.useRef(null),A=a.useRef(null),x=a.useRef(null),T=a.useRef(r),W=a.useRef(!0),U=a.useRef(null),G=a.useRef(n),K=a.useRef(null),E=a.useRef(0),$=a.useRef(0),J=a.useRef(null),ae=a.useRef(null),D=a.useRef(null),Q=a.useRef(null),Y=a.useRef(null),y=a.useRef(null),w=a.useRef(null),j=a.useRef(null),O=a.useRef(new Set),k=a.useRef(new WeakSet);return D.current===null&&(D.current=kr(At,_r)),j.current===null&&(j.current=Ir()),o.current=e,u.current=t,G.current=n,T.current=r,{autoScrollRef:o,autoscrollingRef:l,autoscrollingTimeoutRef:Q,streamingTurnRef:x,contentRef:i,defaultScrollPositionAppliedRef:c,firstItemRef:p,itemCountRef:d,lastScrollTopRef:v,messageElementsRef:g,modeRef:m,pendingScrollFrameRef:K,pendingScrollToMessageRef:R,prependRestoreRef:A,preserveScrollOnPrependRef:W,rootRef:U,scrollEdgeThresholdRef:u,scrollMarginRef:G,scrollPreviousItemPeekRef:T,spacerGapRef:E,spacerHeightRef:$,spacerRef:J,stateFrameRef:ae,stateStore:D.current,viewportRef:Y,visibilityFrameRef:y,visibilityObserverRef:w,visibilityStore:j.current,visibleMessageIdsRef:O,handledScrollAnchorsRef:k}}function ut(e,t){return a.useCallback(n=>{e.current=n,n&&t()},[e,t])}function Mr({autoScroll:e=!1,defaultScrollPosition:t="end",scrollEdgeThreshold:n=dr,scrollPreviousItemPeek:r=fr,scrollMargin:o=pr}){let l=Pr({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:o,scrollPreviousItemPeek:r}),{streamingTurnRef:i,autoScrollRef:c,autoscrollingRef:u,autoscrollingTimeoutRef:d,contentRef:p,defaultScrollPositionAppliedRef:v,firstItemRef:m,itemCountRef:g,lastScrollTopRef:R,messageElementsRef:A,modeRef:x,pendingScrollFrameRef:T,pendingScrollToMessageRef:W,prependRestoreRef:U,preserveScrollOnPrependRef:G,rootRef:K,scrollEdgeThresholdRef:E,scrollMarginRef:$,scrollPreviousItemPeekRef:J,spacerGapRef:ae,spacerHeightRef:D,spacerRef:Q,stateFrameRef:Y,stateStore:y,viewportRef:w,visibilityFrameRef:j,visibilityObserverRef:O,visibilityStore:k,visibleMessageIdsRef:Z,handledScrollAnchorsRef:te}=l,re=a.useRef(t);re.current!==t&&(re.current=t,v.current=!1);let le=a.useCallback(f=>{let h=K.current,C=w.current,L=[f.start&&"start",f.end&&"end"].filter(Boolean).join(" "),ce=u.current;for(let H of[h,C])H&&(L?H.setAttribute("data-scrollable",L):H.removeAttribute("data-scrollable"),H.toggleAttribute("data-autoscrolling",ce))},[]),Se=a.useCallback(f=>{let h=w.current?.scrollTop??0,C=h<R.current-Me;R.current=h,c.current&&!f.end&&x.current!=="settling-jump"&&x.current!=="anchored-to-message"?x.current="following-bottom":x.current==="following-bottom"&&f.end&&C&&!u.current&&(x.current="free-scrolling")},[]),X=a.useCallback(()=>{let f=br({content:p.current,scrollEdgeThreshold:E.current,spacer:Q.current,viewport:w.current});Se(f);let h=x.current==="following-bottom"?{...f,end:!1}:f;le(h),y.setSnapshot(h)},[Se,y,le]),ie=a.useCallback(()=>{Y.current===null&&(Y.current=window.requestAnimationFrame(()=>{Y.current=null,X()}))},[X]),F=a.useCallback(()=>{k.hasListeners()&&j.current===null&&(j.current=window.requestAnimationFrame(()=>{j.current=null,k.hasListeners()&&k.setSnapshot(xr({content:p.current,scrollMargin:$.current,scrollPreviousItemPeek:J.current,spacer:Q.current,viewport:w.current,visibleMessageIds:Z.current}))}))},[k]),{flushPendingScrollToMessage:I,reanchorToAnchoredMessage:M,scrollToElement:V,scrollToEnd:N,scrollToMessage:z,scrollToStart:ee}=Ar({refs:l,commitScrollState:X,scheduleStateCommit:ie,scheduleVisibilitySync:F}),B=a.useCallback(()=>{let f=U.current,h=w.current;if(!f||!h||!f.element.isConnected)return!1;let C=Oe(f.element,h)-f.viewportTop;return Math.abs(C)<=Me?!1:(h.scrollTop+=C,f.viewportTop=Oe(f.element,h),ie(),F(),!0)},[ie,F]),oe=a.useCallback(()=>{let f=p.current,h=w.current;if(!f||!h){U.current=null;return}let C=Sr({content:f,spacer:Q.current,viewport:h});U.current=C?{element:C,viewportTop:Oe(C,h)}:null},[]),me=a.useCallback(()=>{T.current===null&&(T.current=window.requestAnimationFrame(()=>{T.current=null,I()&&oe()}))},[oe,I]),ue=a.useCallback(()=>{if(!t||v.current||g.current===0)return!1;let f=!1;if(t==="last-anchor"){let h=p.current,C=w.current,L=h&&C?wr(je(h,Q.current)):null;if(!h||!C||!L)f=N({behavior:"auto"});else{let ce=kt(L,C);f=Xe({content:h,spacer:Q.current,viewport:C})-ce<=C.clientHeight?N({behavior:"auto"}):V(L,{align:"start"},{keepPreviousPeek:!0})}}else f=t==="end"?N({behavior:"auto"}):ee({behavior:"auto"});return f?(v.current=!0,!0):!1},[t,V,N,ee]),he=a.useCallback(()=>{let f=p.current;if(!f)return;let h=je(f,Q.current),C=g.current,L=m.current;g.current=h.length,m.current=h[0]??null,(()=>{if(I())return;if(C===0){if(ue()||h.length>0&&c.current&&N({behavior:"auto"}))return;X(),F();return}let ce=L?h.indexOf(L):-1;if(G.current&&ce>0){B();return}if(h.length>C){let H=vr(h,C);if(H){if(c.current&&x.current==="following-bottom"&&Rr(h,C)){N({behavior:"auto"});return}V(H,{align:"start"},{keepPreviousPeek:!0}),te.current.add(H);return}}if(h.length===C){let H=yr(h,te.current);if(H){V(H,{align:"start"},{keepPreviousPeek:!0}),te.current.add(H);return}}x.current==="following-bottom"&&c.current?N({behavior:"auto"}):(X(),F())})(),oe()},[ue,oe,X,I,B,F,V,N]),ge=a.useCallback(()=>{if(x.current==="following-bottom"&&c.current){N({behavior:"auto"});return}let f=D.current;if(M()){c.current&&f>0&&D.current===0&&N({behavior:"auto"});return}ie(),F()},[M,ie,F,N]),be=a.useCallback(()=>{let f=w.current;if(!(!f||!k.hasListeners())){if(typeof IntersectionObserver>"u"){F();return}O.current||(O.current=new IntersectionObserver(h=>{for(let C of h){let L=C.target.dataset.messageId;L&&(C.isIntersecting?Z.current.add(L):Z.current.delete(L))}F()},{root:f,rootMargin:`${-($.current+J.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]})),A.current.forEach(h=>{O.current?.observe(h)}),F()}},[F,k]),ke=a.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),O.current?.disconnect(),O.current=null,Z.current.clear(),k.setSnapshot(Le)},[k]),xe=a.useCallback((f,h,C)=>{if(h){A.current.set(f,h),O.current?.observe(h),F(),W.current?.messageId===f&&me();return}C&&A.current.get(f)===C&&(A.current.delete(f),Z.current.delete(f),O.current?.unobserve(C),F())},[me,F]),ve=a.useCallback(()=>{(x.current==="following-bottom"||x.current==="anchored-to-message"||x.current==="settling-jump")&&(i.current=null,x.current="free-scrolling")},[]),de=a.useCallback(()=>le(y.getSnapshot()),[y,le]),Ie=ut(K,de),Ce=ut(w,de),_e=a.useCallback(f=>{p.current=f},[]),Te=a.useCallback(f=>{Q.current=f,ae.current=Er(f?.parentElement??null)},[]),S=a.useCallback(()=>{X(),F(),oe()},[oe,X,F]),q=a.useMemo(()=>({handleContentChange:he,handleResize:ge,observeVisibility:be,preserveScrollOnPrependRef:G,scrollToEnd:N,scrollToMessage:z,scrollToStart:ee,setContentElement:_e,setRootElement:Ie,setSpacerElement:Te,setViewportElement:Ce,stateStore:y,syncAfterScroll:S,unobserveVisibility:ke,userScrollIntent:ve,viewportRef:w,visibilityStore:k}),[he,ge,be,N,z,ee,_e,Ie,Te,Ce,y,S,ke,ve,k]);return a.useLayoutEffect(()=>{ue()},[ue]),a.useEffect(()=>()=>{Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null),j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null),T.current!==null&&(window.cancelAnimationFrame(T.current),T.current=null),O.current?.disconnect(),O.current=null},[]),a.useLayoutEffect(()=>{if(e&&x.current==="following-bottom"&&g.current>0){N({behavior:"auto"});return}X()},[e,X,N]),{context:q,registerMessage:xe}}function Lr(e){let t=a.useRef(e);return t.current=e,t}var Ot=a.createContext(null),Pt=a.createContext(null);function Re(){let e=a.useContext(Ot);if(!e)throw new Error("useMessageScroller must be used within a MessageScroller.");return e}function $r(){let e=a.useContext(Pt);if(!e)throw new Error("MessageScrollerItem must be used within a MessageScroller.");return e}function Mt(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:n}=Re();return a.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:n}),[e,t,n])}function Lt(){let{observeVisibility:e,unobserveVisibility:t,visibilityStore:n}=Re(),r=a.useCallback(o=>n.subscribe(o,e,t),[e,t,n]);return a.useSyncExternalStore(r,n.getSnapshot,n.getSnapshot)}function Dr({autoScroll:e=!1,children:t,defaultScrollPosition:n="end",scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:l}){let{context:i,registerMessage:c}=Mr({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:l});return s.jsx(Ot.Provider,{value:i,children:s.jsx(Pt.Provider,{value:c,children:t})})}function Ur({children:e,...t}){let{setRootElement:n}=Re();return s.jsx("div",{ref:n,...t,children:e})}function Fr({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:o,onWheel:l,preserveScrollOnPrepend:i=!0,ref:c,role:u,tabIndex:d,...p}){let{handleResize:v,preserveScrollOnPrependRef:m,setViewportElement:g,syncAfterScroll:R,userScrollIntent:A,viewportRef:x}=Re();m.current=i;let T=a.useCallback(E=>{g(E),Ae(c)?.(E)},[c,g]);function W(E){R(),r?.(E)}function U(E){A(),l?.(E)}function G(E){A(),o?.(E)}function K(E){hr.has(E.key)&&A(),n?.(E)}return a.useEffect(()=>{let E=x.current;if(!E||typeof ResizeObserver>"u")return;let $=0,J=new ResizeObserver(()=>{window.cancelAnimationFrame($),$=window.requestAnimationFrame(v)});return J.observe(E),()=>{window.cancelAnimationFrame($),J.disconnect()}},[v,x]),s.jsx("div",{ref:T,role:u??"region","aria-label":e??"Messages",tabIndex:d??0,onKeyDown:K,onScroll:W,onTouchMove:G,onWheel:U,...p,children:t})}function Vr({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:o,...l}){let{handleContentChange:i,handleResize:c,setContentElement:u,setSpacerElement:d}=Re(),p=a.useRef(null),v=a.useCallback(m=>{p.current=m,u(m),Ae(n)?.(m)},[n,u]);return a.useLayoutEffect(()=>{let m=p.current;if(!m||(i(),typeof MutationObserver>"u"))return;let g=new MutationObserver(()=>{i()});return g.observe(m,{childList:!0}),()=>g.disconnect()},[i]),a.useEffect(()=>{let m=p.current;if(!m||typeof ResizeObserver>"u")return;let g=0,R=new ResizeObserver(()=>{window.cancelAnimationFrame(g),g=window.requestAnimationFrame(c)});return R.observe(m),()=>{window.cancelAnimationFrame(g),R.disconnect()}},[c]),s.jsxs("div",{ref:v,role:r??"log","aria-relevant":e??"additions",...l,children:[t,s.jsx("div",{ref:d,"aria-hidden":"true","data-message-scroller-spacer":"",hidden:!0,className:o})]})}function Br({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let o=$r(),l=a.useRef(null),i=a.useCallback(c=>{let u=l.current;l.current=c,e&&o(e,c,u),Ae(t)?.(c)},[e,t,o]);return s.jsx("div",{ref:i,"data-message-id":e,"data-scroll-anchor":n?"true":"false",...r})}function Hr({behavior:e="smooth",children:t,direction:n="end",onClick:r,render:o,tabIndex:l,type:i="button",...c}){let{scrollToEnd:u,scrollToStart:d,stateStore:p}=Re(),v=Lr(r),m=a.useCallback(x=>p.subscribe(x),[p]),g=a.useCallback(()=>{let x=p.getSnapshot();return n==="start"?x.start:x.end},[n,p]),R=a.useSyncExternalStore(m,g,g),A=a.useCallback(x=>{R&&(v.current?.(x),x.defaultPrevented||(x.currentTarget.blur(),n==="start"?d({behavior:e}):u({behavior:e})))},[e,n,R,v,u,d]);return ar({defaultTagName:"button",props:He({type:i,inert:!R,tabIndex:R?l:-1,children:t??s.jsxs("span",{children:["Scroll to ",n]}),onClick:A},c),render:o,state:{active:R,direction:n},stateAttributesMapping:{active:x=>({"data-active":x?"true":"false"})}})}var we={Provider:Dr,Root:Ur,Viewport:Fr,Content:Vr,Item:Br,Button:Hr};const zr=we.Provider;function Wr({className:e,...t}){return s.jsx(we.Root,{className:P("relative flex size-full min-h-0 flex-col overflow-hidden",e),...t})}function Kr({className:e,...t}){return s.jsx(we.Viewport,{className:P("size-full min-h-0 overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",e),...t})}function qr({className:e,...t}){return s.jsx(we.Content,{className:P("flex h-max min-h-full flex-col",e),...t})}function Gr({className:e,...t}){return s.jsx(we.Item,{className:P("min-w-0 shrink-0",e),...t})}function Qr({className:e,...t}){return s.jsx(we.Button,{direction:"end",behavior:"smooth",render:({active:n,...r})=>n?s.jsx(pe,{...r,type:"button",variant:"outline",size:"icon",className:P("absolute right-4 bottom-4 z-20 rounded-full bg-background ",e),"aria-label":"Scroll to latest message",children:s.jsx(tn,{})}):null,...t})}function Jr(e){if(!e)return"";const t=e.startsWith("?")?e.slice(1):e,n=new URLSearchParams(t);return n.get("message_id")?.trim()||n.get("message")?.trim()||""}function Yr(e){const t=e.scrollTarget.trim();return t?e.alreadyScrolledTo===t?{scroll:!1}:e.messageIds.includes(t)?{scroll:!0,id:t}:{scroll:!1}:{scroll:!1}}const Xr="lobu-spa";function dt(e){return typeof e=="string"&&/^https?:\/\//i.test(e.trim())}function $e(e,t){return t.type==="tool-call"?`tc-${t.toolCallId}`:t.type==="reasoning"?`${e.id}-reasoning`:t.type==="bash"?`${e.id}-bash-${t.command.slice(0,24)}`:t.type==="error"?`${e.id}-error`:`${e.id}-text-${t.text.slice(0,24)}`}const Do=({afterMessagesContent:e,readOnly:t=!1,readerPositionMode:n="messages",interactionExtension:r,onRunSelect:o})=>{const{messages:l,agentId:i,conversationId:c}=Ee(),{data:u=[]}=nn(i,{conversationId:c});return s.jsx(Mn,{extension:r,children:s.jsxs("div",{"data-agent-thread":!0,className:"flex min-h-0 flex-1 flex-col",children:[s.jsx(Zr,{messages:l,trips:u,mode:n,afterMessagesContent:e,onRunSelect:o}),t?null:s.jsx("div",{className:Sn,children:s.jsx(Eo,{})})]})})},Zr=({messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})=>s.jsx(zr,{autoScroll:!0,defaultScrollPosition:n==="runs"?"last-anchor":"end",scrollPreviousItemPeek:48,children:s.jsx(to,{messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})});function eo(e){if(!e.startsWith("sep:"))return null;const t=Number(e.slice(4));return Number.isFinite(t)&&t>0?t:null}const to=({messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})=>{const{currentAnchorId:l}=Lt(),{scrollToMessage:i}=Mt(),c=a.useRef(null);a.useEffect(()=>{if(e.length===0||typeof window>"u")return;const d=Yr({messageIds:e.map(p=>p.id),scrollTarget:Jr(window.location.search),alreadyScrolledTo:c.current});d.scroll&&(c.current=d.id,i(d.id,{align:"start",behavior:"smooth"}))},[e,i]);const u=d=>n==="runs"?d.id.startsWith("sep:"):d.role==="user";return s.jsxs(Wr,{children:[s.jsx(Kr,{"aria-label":n==="runs"?"Automation run history":"Conversation",children:s.jsxs(qr,{className:P(qe,Cn),children:[e.map(d=>{const p=n==="runs"&&o?eo(d.id):null;return s.jsx(Gr,{messageId:d.id,scrollAnchor:u(d),"aria-current":d.id===l?"location":void 0,className:P("flex flex-col",n==="runs"&&u(d)&&"border-l-2 border-transparent pl-2 transition-colors",n==="runs"&&d.id===l&&"border-primary"),children:p!=null?s.jsx(go,{message:d,onClick:()=>o?.(p)}):s.jsx(so,{message:d})},d.id)}),t.map(d=>s.jsx(ro,{trip:d},d.id)),s.jsx(oo,{}),r?s.jsx("div",{className:"mt-auto shrink-0 py-2",children:r}):null]})}),e.length>0?s.jsx(no,{messages:e,mode:n}):null,s.jsx(Qr,{})]})},no=({messages:e,mode:t})=>{const{scrollToMessage:n}=Mt(),{currentAnchorId:r,visibleMessageIds:o}=Lt(),l=t==="runs"?e.flatMap(c=>c.parts).filter(c=>c.type==="tool-call"&&c.toolName==="tool-approval"&&c.args!==null&&typeof c.args=="object"&&c.args.status==="pending").length:0,i=e.flatMap(c=>{if(!(t==="runs"?c.id.startsWith("sep:"):c.role==="user"))return[];const d=c.parts.find(p=>p.type==="text");return[{id:c.id,label:d?.type==="text"?d.text:"Automation run"}]});return i.length===0?null:s.jsxs(cn,{children:[s.jsx(un,{asChild:!0,children:s.jsxs(pe,{type:"button",variant:"outline",size:"icon",className:P("absolute top-1/2 right-4 z-20 -translate-y-1/2 rounded-full bg-background/95 ",l>0&&"w-auto px-3"),"aria-label":l>0?`Open transcript outline, ${l} ${l===1?"approval":"approvals"} waiting`:"Open transcript outline",children:[s.jsx(dn,{}),l>0?s.jsxs("span",{className:"text-xs tabular-nums",children:[l," waiting"]}):null]})}),s.jsxs(fn,{side:"left",align:"center",className:"w-80 space-y-3 p-3",children:[s.jsxs("div",{className:"px-1",children:[s.jsx("p",{className:"text-sm font-medium",children:"Transcript outline"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:t==="runs"?"Track and jump between Automation runs.":"Track and jump between your messages."})]}),s.jsx("div",{className:"max-h-80 space-y-1 overflow-y-auto",children:i.map(c=>{const u=c.id===r,d=o.includes(c.id);return s.jsxs(pe,{type:"button",variant:u?"secondary":"ghost",className:"h-auto w-full justify-start gap-2 px-2 py-2 text-left text-xs font-normal","aria-current":u?"location":void 0,onClick:()=>n(c.id,{align:"start",behavior:"smooth"}),children:[s.jsx("span",{className:P("size-1.5 shrink-0 rounded-full bg-muted-foreground/30",d&&"bg-primary/60",u&&"bg-primary")}),s.jsx("span",{className:"line-clamp-2",children:c.label})]},c.id)})})]})]})},ro=({trip:e})=>s.jsxs("div",{className:P(qe,"flex items-start gap-2 rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-sm text-destructive"),children:[s.jsx(ln,{className:"mt-0.5 size-4 shrink-0"}),s.jsxs("div",{className:"min-w-0",children:[s.jsxs("div",{className:"font-medium",children:["Guardrail blocked: ",e.guardrailName," ",s.jsxs("span",{className:"font-normal opacity-70",children:["(",e.stage,")"]})]}),e.reason?s.jsx("div",{className:"mt-0.5 break-words opacity-80",children:e.reason}):null]})]}),oo=()=>{const{currentSuggestions:e,starters:t,messages:n,running:r,append:o}=Ee(),l=zn(e,t,n.length);return r||l.length===0?null:s.jsx(an,{prompts:l,className:P(qe,n.length===0&&"mt-auto"),onPick:i=>o(i)})},so=({message:e})=>e.role==="user"?s.jsx(lo,{message:e}):e.role==="system"?s.jsx(bo,{message:e}):s.jsx(co,{message:e}),$t=({attachment:e})=>{const t=e.isImage?e.imageDataUrl??e.url:void 0;if(t)return s.jsx("a",{href:e.url??t,target:"_blank",rel:"noreferrer",children:s.jsx("img",{src:t,alt:e.name,className:"max-h-64 rounded-lg border object-contain"})});const n=s.jsxs(s.Fragment,{children:[s.jsx(Be,{className:"h-3 w-3 shrink-0"}),s.jsx("span",{className:"max-w-[14rem] truncate",children:e.name})]});return s.jsx("div",{className:"flex items-center gap-1.5 rounded-md border bg-background px-2 py-1 text-xs",children:e.url?s.jsx("a",{href:e.url,target:"_blank",rel:"noreferrer",className:"flex items-center gap-1.5 hover:underline",children:n}):n})},lo=({message:e})=>{const t=e.parts.filter(n=>n.type==="bash");return t.length>0?s.jsx("div",{className:gt,children:s.jsx("div",{className:"space-y-2",children:t.map(n=>s.jsx(ao,{part:n},$e(e,n)))})}):s.jsx("div",{className:Tn,children:s.jsxs("div",{className:P(Ne,"px-3 py-2 text-sm"),children:[e.attachments&&e.attachments.length>0?s.jsx("div",{className:"mb-1.5 flex flex-wrap gap-1.5",children:e.attachments.map(n=>s.jsx($t,{attachment:n},n.id))}):null,e.parts.map(n=>n.type==="text"?s.jsx("div",{className:"whitespace-pre-wrap break-words",children:s.jsx(Ye,{text:n.text,renderText:r=>r})},$e(e,n)):null)]})})},ao=({part:e})=>{const t=e.cancelled||e.exitCode!==void 0&&e.exitCode!==0;return s.jsxs("div",{className:P(Ne,"overflow-hidden text-xs"),children:[s.jsxs("div",{className:"flex items-center gap-1.5 border-border/60 border-b px-3 py-1.5",children:[s.jsx(pn,{className:"size-3.5 shrink-0 text-muted-foreground"}),s.jsx("code",{className:"min-w-0 flex-1 truncate font-mono text-foreground/90",children:e.command}),e.cancelled?s.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 font-medium text-[10px] text-muted-foreground",children:"cancelled"}):t?s.jsxs("span",{className:"rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-[10px] text-destructive",children:["exit ",e.exitCode]}):null]}),e.output.trim()?s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words px-3 py-2 font-mono text-foreground/80",children:e.output}):null]})},Dt=new Set(["question","link-button","tool-approval"]),io="subscription-candidate",co=({message:e})=>{const t=Ge(),{agentId:n,workspaceSlug:r}=Ee(),o=u=>u.type==="tool-call"&&(Dt.has(u.toolName)||t?.toolNames.has(u.toolName)),l=e.parts.filter(u=>u.type==="tool-call"&&!o(u)&&u.toolName!==io),i=e.parts.filter(u=>u.type!=="tool-call"||o(u)),c=e.parts.flatMap(u=>{if(u.type!=="tool-call")return[];const d=vt(u.result);return d?[d]:[]});return s.jsx("div",{className:gt,children:s.jsxs("div",{className:"space-y-2 text-sm",children:[l.length>0?s.jsx(po,{tools:l,workspaceSlug:r}):null,n&&r?c.map(u=>s.jsx(uo,{candidate:u,agentId:n,workspaceSlug:r},`${u.connector_key}:${u.resource_ref}`)):null,i.map(u=>s.jsx(ho,{part:u},$e(e,u))),e.attachments&&e.attachments.length>0?s.jsx("div",{className:"flex flex-wrap gap-2",children:e.attachments.map(u=>s.jsx($t,{attachment:u},u.id))}):null]})})},uo=({candidate:e,agentId:t,workspaceSlug:n})=>s.jsxs("div",{className:P(Ne,"flex items-center justify-between gap-3 p-3"),children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"truncate text-sm font-medium",children:e.label}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Run this agent when the resource changes."})]}),s.jsx(pe,{asChild:!0,size:"sm",variant:"outline",className:"shrink-0",children:s.jsxs(mt,{to:"/$owner/automations/new",params:{owner:n},search:{agent:t,platform:e.connector_key,resource_type:e.resource_type,resource:e.resource_ref,events:e.suggested_event_keys?.join(","),label:e.label},children:[s.jsx(hn,{className:"mr-1.5 h-4 w-4"}),"Add automation"]})})]});function fo(e){try{return JSON.parse(e)}catch{return null}}function Ut(e){if(Array.isArray(e)){const o=e.flatMap(l=>l?.type==="text"&&typeof l.text=="string"?Ut(l.text)??[]:[]);return o.length>0?[...new Set(o)]:null}const t=typeof e=="string"&&e.trimStart().startsWith("{")?fo(e):e;if(!t||typeof t!="object")return null;const n=t.events_persisted;if(!Array.isArray(n))return null;const r=n.flatMap(o=>{const l=o&&typeof o=="object"?o.id:null;return typeof l=="number"&&Number.isSafeInteger(l)&&l>0?[l]:[]});return r.length>0?r:null}const po=({tools:e,workspaceSlug:t})=>s.jsxs(Tt,{defaultOpen:!1,children:[s.jsx(jt,{children:e.length===1?nt(e[0].args,e[0].toolName)??e[0].toolName:`${e.length} tool calls`}),s.jsx(Et,{children:e.map(n=>{const r=nt(n.args,n.toolName),o=n.args!==void 0&&n.args!==null,l=n.result!==void 0&&n.result!==null,i=Ut(n.result);return s.jsxs(Nt,{icon:mn,label:s.jsxs("span",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"font-medium",children:r??n.toolName}),r?s.jsx("span",{className:"text-muted-foreground",children:n.toolName}):null,n.isError?s.jsx("span",{className:"rounded bg-destructive/15 px-1.5 py-0.5 font-medium text-[10px] text-destructive",children:"error"}):null]}),status:n.isError?"active":"complete",children:[o?s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-foreground/80 text-xs",children:Ue(n.args)}):null,l?s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-foreground/80 text-xs",children:Ue(n.result)}):null,i&&t?s.jsx(lr,{ownerSlug:t,eventIds:i}):null]},n.toolCallId)})})]}),mo=({text:e})=>{let t=e,n=null;const r=e.match(/\{[\s\S]*\}/);if(r)try{const l=JSON.parse(r[0])?.error?.message;typeof l=="string"&&l.trim()&&(t=l,n=e)}catch{}return s.jsxs("div",{className:"flex gap-2 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2.5 text-sm",children:[s.jsx(bn,{className:"mt-0.5 size-4 shrink-0 text-destructive"}),s.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[s.jsx("p",{className:"text-foreground/80",children:t}),n&&s.jsxs("details",{className:"text-xs text-muted-foreground",children:[s.jsx("summary",{className:"cursor-pointer select-none hover:text-foreground",children:"Technical details"}),s.jsx("pre",{className:"mt-1 overflow-x-auto whitespace-pre-wrap break-all font-mono",children:n})]})]})]})},ho=({part:e})=>{const t=Ge();return e.type==="reasoning"?s.jsx(or,{}):e.type==="error"?s.jsx(mo,{text:e.text}):e.type==="text"?e.text.trim()?s.jsx(Ye,{text:e.text,renderText:n=>s.jsx(gn,{text:n})}):null:e.type!=="tool-call"?null:Dt.has(e.toolName)||t?.toolNames.has(e.toolName)?s.jsx(No,{toolName:e.toolName,args:e.args}):null},go=({message:e,onClick:t})=>{const n=e.parts.find(r=>r.type==="text");return s.jsx("button",{type:"button",onClick:t,className:P(Ne,"block w-full cursor-pointer whitespace-pre-wrap break-words px-3 py-2 text-left text-xs text-muted-foreground transition-colors hover:bg-muted/50"),children:n?.type==="text"?n.text:"Automation run"})},bo=({message:e})=>s.jsx("div",{className:"self-stretch",children:s.jsx("div",{className:P(Ne,"px-3 py-2 text-xs text-muted-foreground"),children:e.parts.map(t=>t.type==="text"?s.jsx("div",{className:"whitespace-pre-wrap break-words",children:s.jsx(Ye,{text:t.text,renderText:n=>n})},$e(e,t)):null)})}),xo="/mcp-apps/interaction/index.html";function ft(e){return new Promise(t=>{e({onSettled:(n,r)=>t(!!r)})})}const vo=({src:e,title:t,renderPayload:n,onToolCall:r,onOpenLink:o})=>{const l=a.useRef(null),[i,c]=a.useState(48),u=a.useRef({renderPayload:n,onToolCall:r,onOpenLink:o});return u.current={renderPayload:n,onToolCall:r,onOpenLink:o},a.useEffect(()=>{const d=l.current;if(!d?.contentWindow)return;const p=new yn(null,{name:"Lobu",version:"1.0.0"},{openLinks:{},serverTools:{}},{hostContext:{theme:document.documentElement.classList.contains("dark")?"dark":"light",displayMode:"inline",platform:"web"}});p.addEventListener("sizechange",({height:g})=>{typeof g=="number"&&c(Math.max(32,Math.ceil(g)))}),p.oncalltool=async({name:g,arguments:R})=>{const A=await u.current.onToolCall(g,R??{});return{isError:A,content:[{type:"text",text:A?"Action failed.":"Action completed."}]}},p.onopenlink=async({url:g})=>({isError:await u.current.onOpenLink(g)}),p.addEventListener("initialized",()=>{(async()=>(await p.sendToolInput({arguments:{}}),await p.sendToolResult({content:[],structuredContent:{...u.current.renderPayload,version:1,source:Xr}})))()});const v=new Rn(d.contentWindow,d.contentWindow);p.connect(v).catch(g=>{console.error("[mcp-app-host] failed to initialize",g)});const m=new MutationObserver(()=>{p.setHostContext({theme:document.documentElement.classList.contains("dark")?"dark":"light",displayMode:"inline",platform:"web"})});return m.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>{m.disconnect(),v.close()}},[]),s.jsx("iframe",{ref:l,title:t,src:e,sandbox:"allow-scripts",style:{width:"100%",height:i,border:"none",display:"block"}})},yo=new Set(["action"]),Ro=["name","description","identity_md"];function se(e){return e==null||e===""?"":typeof e=="string"?e:Ue(e)}function pt(e){return e===null?"(cleared)":e===void 0?"":typeof e=="string"?e===""?"":e:Ue(e)}function De(e){return e.length>0?e[0].toUpperCase()+e.slice(1):e}const Ft=new Set(["delete","disconnect","remove","remove_rule","reset","revoke"]);function We(e){return e&&Ft.has(e)?"warning":"default"}function Ke(e,t){return e&&Ft.has(e)?{level:"high",reason:t}:{level:"normal"}}function wo(e,t){const n=e.attribution==="automation"?"An Automation":"An agent",r=Object.keys(t),o=r.map(l=>({label:l,before:se(e.current?.[l]),after:se(t[l])}));return{title:`${n} proposes a change`,icon:"entity",impact:{level:"normal"},tone:"default",blocks:o.length>0?[{type:"diff",fields:o}]:[{type:"text",value:"No field changes.",muted:!0}],actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",tool:"manage_operations",args:{action:"approve"},resolvedLabel:`Approved — ${r.join(", ")} is being applied.`},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:`Rejected — ${r.join(", ")} was not applied.`}]}}function So(e){const t=e.action??"change",n=e.proposal?.slug??e.proposal?.name??(e.proposal?.automation_id!=null?String(e.proposal.automation_id):void 0)??e.current?.slug??e.current?.name??"automation",r=[];e.action==="delete"&&r.push({type:"text",value:"This will archive the Automation.",muted:!0});const o=e.proposal??{},l=Object.keys(o).filter(i=>!yo.has(i)&&o[i]!==void 0).map(i=>({label:i,...e.action==="update"&&e.current?.[i]!==void 0?{before:pt(e.current?.[i])}:{},after:pt(o[i])}));return r.push(l.length>0?{type:"diff",fields:l}:{type:"text",value:"No field changes.",muted:!0}),{title:`${De(t)} Automation ${n}`,icon:"automation",impact:Ke(e.action,"This archives the Automation and stops future runs."),tone:We(e.action),blocks:r,actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",tool:"manage_operations",args:{action:"approve"},resolvedLabel:`Approved — ${t} ${n} is being applied.`},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:`Rejected — ${t} ${n} was not applied.`}]}}function Co(e){if(e.resourceKind==="automation")return So(e);if(e.fields&&Object.keys(e.fields).length>0)return wo(e,e.fields);const t=e.resourceKind==="entity"||e.proposal?.entity_id!==void 0||e.current?.entity_type!==void 0||e.proposal?.entity_type!==void 0;if(t&&(e.action==="link"||e.action==="unlink"))return On({...e,action:e.action});if(t){const l=e.proposal?.name??e.current?.name??e.proposal?.entity_id??e.current?.id??"entity",i=e.action??"change",c=[];if(e.action==="delete")c.push({type:"text",value:"This will delete the entity.",muted:!0});else{const u=Object.keys(e.proposal??{}).filter(d=>!["entity_id","id"].includes(d)&&e.proposal?.[d]!==void 0&&se(e.proposal?.[d])!==se(e.current?.[d])).map(d=>({label:d,...e.action==="update"?{before:se(e.current?.[d])}:{},after:se(e.proposal?.[d])}));c.push(u.length>0?{type:"diff",fields:u}:{type:"text",value:"No field changes.",muted:!0})}return{title:`${De(i)} entity ${l}`,icon:"entity",impact:Ke(e.action,"This deletes the entity."),tone:We(e.action),blocks:c,actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",tool:"manage_operations",args:{action:"approve"},resolvedLabel:`Approved — ${i} ${l} is being applied.`},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:`Rejected — ${i} ${l} was not applied.`}]}}const n=e.proposal?.agent_id??e.current?.id??"agent",r=e.action??"change",o=[];if(e.action==="delete")o.push({type:"text",value:"This will permanently delete the agent.",muted:!0});else{const l=Ro.filter(i=>e.proposal?.[i]!==void 0&&se(e.proposal?.[i])!==se(e.current?.[i])).map(i=>({label:i,...e.action==="update"?{before:se(e.current?.[i])}:{},after:se(e.proposal?.[i])}));o.push(l.length>0?{type:"diff",fields:l}:{type:"text",value:"No field changes.",muted:!0})}return{title:`${De(r)} agent ${n}`,icon:"agent",impact:Ke(e.action,"This permanently deletes the agent and its configuration."),tone:We(e.action),blocks:o,actions:[{id:"approve",label:"Approve",variant:"primary",icon:"check",tool:"manage_operations",args:{action:"approve"},resolvedLabel:`Approved — ${r} ${n} is being applied.`},{id:"reject",label:"Reject",variant:"outline",icon:"x",confirm:!0,confirmPrompt:"Reject this change?",tool:"manage_operations",args:{action:"reject"},resolvedLabel:`Rejected — ${r} ${n} was not applied.`}]}}function To(e){const t=Array.isArray(e.options)?e.options.filter(o=>typeof o=="string"):[],n=[{type:"text",value:e.question||"The agent has a question."}];t.length===0&&n.push({type:"text",value:"Reply below to answer.",muted:!0});const r=t.map(o=>({id:o,label:o,variant:"outline",tool:"answer_question",args:{answer:o},resolvedLabel:`Answered: ${o}`}));return{title:"Input needed",icon:"question",tone:"default",blocks:n,actions:r}}function jo(e,t){return{tone:"bare",actions:[{id:"open",label:e.label??"Open link",variant:"outline",icon:"external",terminal:!1,href:t}]}}const No=({toolName:e,args:t})=>{const n=xn(),r=vn(),{append:o}=Ee(),l=Ge(),i=t??{},c=l?.resolve(e,t)??null;let u=c?.view??null;const d={...c?.handlers??{}},p=new Set;if(!c){if(e==="tool-approval"&&typeof i.runId=="number"&&Number.isSafeInteger(i.runId)&&i.runId>0){const v=i.runId,m=typeof i.status=="string"?i.status:"pending",g=m==="pending",R=Co(i),A=m==="confirmed"?"Approved":De(m);u=g?R:{...R,title:`${R.title??"Approval"} · ${A}`,tone:m==="failed"?"warning":"default",blocks:[...R.blocks??[],{type:"text",value:typeof i.reviewedByName=="string"?`${m==="rejected"?"Rejected":"Approved"} by ${i.reviewedByName}.`:`${A}.`,muted:!0}],actions:(R.actions??[]).filter(x=>x.terminal===!1)},g&&(d.manage_operations=x=>{if(x.action==="approve")return ft(T=>n.mutate({run_id:v},T));if(x.action==="reject"){const T=typeof x.reason=="string"?x.reason:void 0;return ft(W=>r.mutate({run_id:v,...T?{reason:T}:{}},W))}return Promise.resolve(!0)})}else if(e==="question"){const v=Array.isArray(i.options)?i.options.filter(m=>typeof m=="string"):[];u=To(i),d.answer_question=m=>{const g=typeof m.answer=="string"?m.answer:"";return v.includes(g)?(o(g),Promise.resolve(!1)):Promise.resolve(!0)}}else if(e==="link-button"){if(!dt(i.url))return null;const v=i.url;p.add(v),u=jo(i,v)}}return u?s.jsx(vo,{src:xo,title:u.title??"Interaction",renderPayload:u,onToolCall:(v,m)=>d[v]?d[v](m):Promise.resolve(!0),onOpenLink:v=>!p.has(v)||!dt(v)?Promise.resolve(!0):(window.open(v,"_blank","noopener,noreferrer"),Promise.resolve(!1))}):null};function Ue(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const Eo=()=>{const{running:e,append:t,cancel:n,pendingAttachments:r,addAttachments:o,removeAttachment:l,initialDraft:i,currentSuggestions:c}=Ee(),u=Ao({suggestions:e?null:c}),[d,p]=a.useState(i??""),v=a.useRef(null),m=a.useRef(null),g=kn(_n),R=a.useRef(i??"");a.useEffect(()=>{const T=i??"";if(T===R.current)return;const W=R.current;R.current=T,T!==""&&p(U=>U===""||U===W?T:U)},[i]);const A=a.useRef(d);A.current=d;const x=()=>{e||(t(A.current),p(""),m.current?.clear())};return s.jsxs("div",{className:"rounded-2xl border bg-background transition-colors focus-within:ring-1 focus-within:ring-ring",children:[r.length>0?s.jsx("div",{className:"flex flex-wrap gap-1.5 px-3 pt-3",children:r.map(T=>s.jsxs("div",{className:"flex items-center gap-1.5 rounded-lg border bg-muted/50 px-2 py-1 text-xs",children:[s.jsx(Be,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"max-w-[12rem] truncate",children:T.name}),s.jsx("button",{type:"button",className:"text-muted-foreground transition-colors hover:text-foreground","aria-label":"Remove attachment",onClick:()=>l(T.id),children:s.jsx(rn,{className:"h-3 w-3"})})]},T.id))}):null,s.jsx(In,{value:d,onChange:p,onSubmit:x,searchRefs:g,handleRef:m,placeholder:u,className:"max-h-48 overflow-y-auto"}),s.jsxs("div",{className:"flex items-center justify-between px-3 pb-2",children:[s.jsx("input",{ref:v,type:"file",multiple:!0,className:"hidden",onChange:T=>{T.target.files&&o(T.target.files),T.target.value=""}}),s.jsxs(pe,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-full text-muted-foreground hover:text-foreground",onClick:()=>v.current?.click(),children:[s.jsx(Be,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Attach files"})]}),e?s.jsxs(pe,{type:"button",size:"icon",variant:"secondary",className:"h-8 w-8 rounded-full",onClick:n,children:[s.jsx(on,{size:"lg"}),s.jsx("span",{className:"sr-only",children:"Cancel"})]}):s.jsxs(pe,{type:"button",size:"icon",className:"h-8 w-8 rounded-full",onClick:x,children:[s.jsx(sn,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Send message"})]})]})]})};function Ao({suggestions:e}){const t=e?.find(n=>n.message.trim().length>0)?.message;return t?`Recommended: ${t.trim()}`:"Chat… (@ to mention, / for commands)"}export{Do as A,$o as L,Lo as R,Xn as h,Gn as s};
|
|
6
|
-
//# sourceMappingURL=agent-thread-DQIr20H-.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{j as n,hf as O,hg as P,cB as D,h as p,hh as R,hi as W,v as N,w as E,o as C,au as L,bd as S,r as _,hj as B,hk as F,c0 as G,hl as U,hm as H,gl as z,L as v,gm as A,O as K,t as M,em as T,ar as q}from"./index-4gCDI7m4.js";import{A as J}from"./agent-editor-form-DfMTSIvj.js";import{P as Q}from"./proposal-review-shell-B4CSiyLB.js";function V({identity:e,sections:s,activeSection:t,activeItem:a,onSectionSelect:l,sectionLabel:c,highlightSection:d=!0,className:u}){const o=a??s.find(i=>i.key===t)??s[0];if(!o)return null;const g=o.icon;return n.jsx("div",{className:p("flex shrink-0 flex-col items-center px-4 lg:px-6",u),children:n.jsxs("div",{className:"flex min-w-0 max-w-full flex-wrap items-center justify-center gap-x-3 gap-y-2",children:[e,n.jsxs(O,{children:[n.jsx(P,{asChild:!0,children:n.jsxs("button",{type:"button",className:p("inline-flex shrink-0 items-center gap-1.5 rounded-md px-2.5 py-1 text-sm transition-colors outline-none focus-visible:ring-2 focus-visible:ring-ring",d?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),"aria-label":c,children:[n.jsx(g,{className:"h-3.5 w-3.5 shrink-0"}),o.label,n.jsx(D,{className:"h-3.5 w-3.5 shrink-0 opacity-60"})]})}),n.jsx(R,{align:"center",className:"min-w-[11rem]",children:s.map(({key:i,label:m,icon:x})=>n.jsxs(W,{className:p(i===t&&"bg-accent font-medium"),onSelect:()=>l(i),children:[n.jsx(x,{className:"h-4 w-4"}),n.jsx("span",{children:m})]},i))})]})]})})}const b=[{key:"skills",label:"Skills",icon:B},{key:"guardrails",label:"Guardrails",icon:F},{key:"permissions",label:"Permissions",icon:G,adminOnly:!0},{key:"models",label:"Models",icon:U},{key:"settings",label:"Settings",icon:H}];function X(e){return b.filter(s=>!s.adminOnly||e)}function Y(e,s){if(s===`${e}/conversations`||s.startsWith(`${e}/conversations/`))return null;for(const{key:t}of b)if(s===`${e}/${t}`||s.startsWith(`${e}/${t}/`))return t;return s===`${e}/identity`||s===`${e}/identity/`?"settings":null}function Z(e){return e.trim().charAt(0).toUpperCase()||"?"}function ee({owner:e,agentId:s,agentName:t,activeDest:a}){const l=N(),{orgContext:c}=M(),{isAdmin:d}=T(c.organizationId),u=X(!!d),o=a??"settings",g=b.find(i=>i.key===o);return n.jsx(V,{identity:n.jsxs(v,{to:"/$owner/agents/$agentId/settings",params:{owner:e,agentId:s},search:{run_id:void 0},className:"flex min-w-0 items-center gap-2 rounded-md outline-none transition-colors hover:opacity-90 focus-visible:ring-2 focus-visible:ring-ring",title:"Agent settings",children:[n.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-muted text-xs font-semibold text-foreground",children:Z(t)}),n.jsx("h1",{className:"min-w-0 truncate text-base font-semibold tracking-tight",children:t})]}),sections:u,activeSection:o,activeItem:g,sectionLabel:"Agent section",highlightSection:a!==null,onSectionSelect:i=>{l({to:`/$owner/agents/$agentId/${i}`,params:{owner:e,agentId:s}})}})}function ae({owner:e,agentId:s}){const t=N(),{pathname:a}=E(),{isAuthenticated:l}=C(),{isMember:c}=L(),d=l&&c,{data:u=[],isLoading:o}=S({enabled:d}),g=u.find(k=>k.agentId===s)??null,i=!g&&!o&&d,m=`/${e}/agents/${s}`,x=`${m}/conversations`,f=a===x||a.startsWith(`${x}/`),r=Y(m,a);_.useEffect(()=>{i&&t({to:"/$owner",params:{owner:e},replace:!0})},[i,t,e]);const j=g?.name??"Agent",$=b.find(k=>k.key===r)?.label??"Conversations",h=a.slice(m.length+1).split("/")[1],y=r==="settings"&&!h,I=y?j:h?h==="create"?r==="skills"?"Add a skill":"New custom guardrail":r==="skills"?"Skill details":r==="guardrails"?"Guardrail details":"Conversation":$;return n.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3 overflow-hidden py-4 md:py-6",children:[n.jsx("div",{className:"mx-auto w-full max-w-3xl px-4 lg:px-6",children:n.jsx(z,{crumbs:[n.jsx(v,{to:"/$owner/agents",params:{owner:e},className:A,children:"Agents"},"agents"),...y?[]:[n.jsx(v,{to:"/$owner/agents/$agentId/settings",params:{owner:e,agentId:s},search:{run_id:void 0},className:A,children:j},"agent")],...h&&r?[n.jsx(v,{to:`/$owner/agents/$agentId/${r}`,params:{owner:e,agentId:s},className:A,children:$},"section")]:[]],current:I})}),n.jsx(ee,{owner:e,agentId:s,agentName:j,activeDest:r}),n.jsx("div",{className:p("flex min-h-0 min-w-0 flex-1 flex-col px-4 lg:px-6",f?"overflow-hidden":"overflow-y-auto"),children:n.jsx(K,{})})]})}function ne({agent:e,tab:s,runId:t}){return n.jsx("div",{className:"mx-auto w-full max-w-3xl pb-6",children:n.jsx(Q,{resource:{kind:"agent",agentId:e.agentId},runId:t,children:({reviewMode:a,proposal:l,controlsDisabled:c})=>n.jsx(J,{mode:{kind:"edit",agent:e},section:s,reviewMode:a,reviewProposal:l,reviewControlsDisabled:c},e.agentId)})})}function oe({owner:e,agentId:s,tab:t,runId:a}){const{orgContext:l,hasOrgContext:c}=M(),{isLoading:d}=q(`/${e}`,l),{isAuthenticated:u}=C(),{isMember:o,isLoading:g}=L(),i=u&&o,{data:m=[],isLoading:x}=S({enabled:i}),w=i?!c||d||x||g:d||g,f=m.find(r=>r.agentId===s)??null;return w||!f?null:n.jsx(ne,{agent:f,tab:t,runId:a})}export{ae as A,oe as a};
|
|
2
|
-
//# sourceMappingURL=agents-workbench-C8bTa2rv.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as c,ib as b,aY as w,aH as y,b9 as C,aK as u,j as e,aL as k,L as i,hq as A,fZ as j,B as g,fY as P,it as B,fW as v,gk as D,gl as R,gm as L,A as $,du as I,eY as M,iu as E,aA as O}from"./index-4gCDI7m4.js";import{C as Y}from"./connections-browser-DDJQh8Na.js";import"./connection-label-BobuYiAG.js";import"./status-dot-D3FoDRcc.js";function _({ownerSlug:s,appId:a}){const n=c.useMemo(()=>b(s,a,w()),[s,a]),{data:r=[],isLoading:l,isError:d,refetch:N}=y(),[m,x]=c.useMemo(()=>{const t=n?.devicePlatforms;if(!t?.length)return[[],[]];const h=r.filter(o=>{const f=C(o);return f!=null&&t.includes(f)});return[h.filter(o=>u(o,s)),h.filter(o=>!u(o,s))]},[n,r,s]);if(!n)return e.jsxs(k,{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"There is no app by that name."}),e.jsx(i,{to:"/$owner/connectors",params:{owner:s},search:{},className:"text-sm text-primary hover:underline",children:"Back to connectors"})]});const p=(n.devicePlatforms?.length??0)>0;return e.jsx("div",{className:"flex flex-1 flex-col",children:e.jsxs(A,{header:e.jsx(D,{breadcrumb:e.jsx(R,{crumbs:[e.jsx(i,{to:"/$owner/connectors",params:{owner:s},search:{},className:L,children:"Connectors"},"connectors")]}),icon:e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border text-muted-foreground",children:n.icon}),title:n.name,caption:n.description}),children:[e.jsx("div",{id:"setup",className:"scroll-mt-40",children:e.jsx(j,{title:m.length>0?a==="owletto-chrome"?"Connect another profile":"Connect another device":"Set up",children:e.jsx("div",{className:"space-y-3",children:n.steps.map(t=>e.jsx(z,{step:t},t.label))})})}),p?e.jsx(Y,{entries:m.map(t=>({id:t.id,name:v(t),description:B(t,s),tone:t.online?null:"muted",link:P({to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:t.id}})})),isLoading:l,isError:d,onRetry:()=>void N(),action:e.jsx(g,{asChild:!0,variant:"outline",size:"sm",children:e.jsx("a",{href:"#setup",children:"Add connection"})})}):null,p&&!l&&!d&&x.length>0?e.jsxs(j,{title:"Your devices in other workspaces",children:[e.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Open a device to connect its capabilities here. Moving it is confirmed first and pauses its connections where it is now."}),e.jsx("ul",{className:"divide-y border-y",children:x.map(t=>e.jsx("li",{children:e.jsxs(i,{to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:t.id},className:"flex items-center justify-between gap-3 py-2.5 text-sm hover:text-primary",children:[e.jsx("span",{className:"font-medium",children:v(t)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Attached to"," ",t.organization_name??"another workspace"]})]})},t.id))})]}):null]})})}function z({step:s}){const[a,n]=c.useState(!1);if(s.href)return e.jsxs("a",{href:s.href,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border px-2.5 py-1.5 text-xs font-medium text-primary hover:bg-accent/50",children:[s.label,e.jsx($,{className:"h-3 w-3"})]});const r=s.command??"";return e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:s.label}),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 font-mono text-xs leading-relaxed",children:r}),e.jsxs(g,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-1.5 text-xs",onClick:()=>{typeof navigator>"u"||!navigator.clipboard||navigator.clipboard.writeText(r).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},children:[a?e.jsx(I,{className:"h-3.5 w-3.5"}):e.jsx(M,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"sr-only",children:"Copy"})]})]})]})}function U(){const{owner:s,appId:a}=E.useParams();return e.jsx(O,{owner:s,children:({ownerSlug:n})=>e.jsx(_,{ownerSlug:n,appId:a})})}export{U as component};
|
|
2
|
-
//# sourceMappingURL=app._appId-Bsq40nak.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{t as _,j as s,L as v,cl as y,ar as j,o as k,au as C,r as f,u as N,h6 as S,S as b}from"./index-4gCDI7m4.js";import{C as R,A as O}from"./create-automation-form-DmCOFbRT.js";import{P as w}from"./proposal-review-shell-B4CSiyLB.js";import{E as D}from"./events-feed-BysC9HgU.js";import{J as L}from"./json-diff-E5D-NGYT.js";import{b as h}from"./use-automations-BHoV0dLs.js";function x({automationId:t}){const{currentOwner:n}=_();return n?s.jsx(v,{to:"/$owner/events",params:{owner:n},search:y({semanticTypes:["change"],eventCategory:"config",resourceKind:"automation",resourceId:t}),className:"text-sm text-primary underline underline-offset-4",children:"View definition history in Events"}):null}function A(t){const{orgContext:n,hasOrgContext:a}=_(),{data:r,isLoading:o}=j(`/${t}`,n),{isAuthenticated:d}=k(),{isMember:u,isLoading:c}=C(),g=d&&u,e=r?.workspace,l=g?!a||o||c:o||c;return{organizationId:e?.id??"",isLoading:l}}function M(t){return A(t)}function T({owner:t,automationId:n,organizationId:a}){const r=Number(n),o=f.useMemo(()=>({producedByAutomationId:r}),[r]),d=N(),u=h(n,void 0,a),c=u.data?.automation?.automation_name?.trim()||null,g=u.data?.automation?.managed_agent_id??null,{data:e}=S(g,n,{orgSlug:t}),l=f.useMemo(()=>(e?.runs??[]).map(i=>({runId:i.runId,status:i.status,completedAt:i.completedAt})),[e]),p=f.useCallback(i=>{d?.open({href:`/${t}/automations/${n}?run_id=${i}`,title:c!=null?`${c} · Run #${i}`:`Automation run #${i}`,runId:i})},[d,t,n,c]);return Number.isFinite(r)?s.jsx(D,{organizationId:a,ownerSlug:t,filters:o,groupByRun:!0,onRunSelect:p,runs:l,hideRunAction:!0,hideAttribution:!0,emptyState:s.jsx("p",{className:"py-6 text-sm text-muted-foreground",children:"This Automation hasn't written anything yet. Runs appear here with the events they created; clicking a run opens its conversation."})}):null}function $({agentId:t,automationId:n,runId:a,organizationId:r,onDone:o}){const[d,u]=f.useState({ready:!1,triggers:[]}),c=f.useCallback(i=>{u(m=>JSON.stringify(m)===JSON.stringify(i)?m:i)},[]),g=h(n,void 0,r,{includeVersions:!0}),e=g.data?.automation,l=s.jsx("div",{className:"flex flex-col gap-4",children:[0,1,2].map(i=>s.jsx(b,{className:"h-16 w-full rounded-lg"},i))}),p=g.isLoading?l:e?s.jsx(R,{organizationId:r,prefillAgentId:t??void 0,editingAutomation:{automation_id:e.automation_id,name:e.automation_name,slug:e.slug,description:e.description,prompt:e.prompt,sources:e.sources,reaction_script:e.reaction_script,managed_agent_id:e.managed_agent_id,device_worker_id:e.device_worker_id,agent_kind:e.agent_kind,delivery_target:e.delivery_target??void 0,execution_config:e.execution_config??void 0,keying_config:e.keying_config,reactions_guidance:e.reactions_guidance,triggers:e.triggers},createFields:{triggers:d.triggers},triggerFields:s.jsx(O,{organizationId:r,initialTriggers:e.triggers??[],onChange:c},JSON.stringify(e.triggers??[])),hideHeader:!0,hideCancel:!0,submitDisabled:!d.ready,onClose:o,onSuccess:o}):s.jsx("p",{className:"text-sm text-muted-foreground",children:"Automation not found. It may have been removed."});return t?s.jsxs("div",{className:"space-y-6",children:[s.jsx(w,{resource:{kind:"automation",agentId:t,automationId:n},runId:a,onDone:o,children:({reviewMode:i,proposal:m})=>i==="active"?s.jsx(L,{before:m?.current??null,after:{...m?.current??{},...m?.proposedAfter??{}}}):i==="loading"?l:i==="error"?null:p}),s.jsx(x,{automationId:n})]}):s.jsxs("div",{className:"space-y-6",children:[p,s.jsx(x,{automationId:n})]})}function V({owner:t,agentId:n,automationId:a,view:r,runId:o,onDone:d}){const{organizationId:u}=A(t),c=h(a,void 0,u),g=n??c.data?.automation?.managed_agent_id??null;return o||r==="definition"?s.jsx($,{agentId:g,automationId:a,runId:o,organizationId:u,onDone:d}):s.jsx(T,{owner:t,automationId:a,organizationId:u})}export{V as A,M as u};
|
|
2
|
-
//# sourceMappingURL=automation-detail-content-C9Cgr5Zj.js.map
|