@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 +1,2 @@
|
|
|
1
|
-
import{j as e,
|
|
2
|
-
//# sourceMappingURL=agent-permissions-matrix-
|
|
1
|
+
import{j as e,bR as B,i as S,a$ as D,b0 as K,b1 as R,gy as X,a6 as G,bK as Y,bJ as Z,bW as V,gz as ee,bX as P,bt as F,bY as se,bS as ne,bZ as te,bT as re,r as A,gA as ae,gB as ie,bO as le,b_ as oe,L as w,gC as de,gD as ce,d5 as W,gE as ue,gF as me,gG as ge,gH as k,cU as L,X as fe,gI as q,gJ as z,fa as xe,d6 as he,gK as be,gL as ye,c1 as pe,gM as je}from"./index-DdBTTN3y.js";const ve={auto:"bg-emerald-500/15 text-emerald-600 dark:text-emerald-400",approval:"bg-amber-500/15 text-amber-600 dark:text-amber-400",deny:"bg-red-500/15 text-red-600 dark:text-red-400"};function Ne({options:n,value:t,floor:o,onChange:a,disabled:i,ariaLabel:m,compact:u}){return e.jsx("div",{role:"radiogroup","aria-label":m,className:S("inline-flex shrink-0 items-stretch gap-0.5 rounded-lg border border-border bg-muted/40 p-0.5"),children:n.map(l=>{const b=X({option:l,floor:o}),h=l===t,g=b.disabled&&!h,y=B[l],f=e.jsx("button",{type:"button",role:"radio","aria-checked":h,disabled:i||g,onClick:()=>{!h&&!g&&!i&&a(l)},className:S("inline-flex shrink-0 items-center justify-center whitespace-nowrap font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",u?"min-w-[3rem] rounded-md px-2.5 py-1.5 text-xs leading-none":"min-w-[3.25rem] rounded-md px-3 py-1.5 text-sm leading-none",h?S(ve[l],""):"text-muted-foreground hover:bg-background/60 hover:text-foreground",g&&"cursor-not-allowed opacity-40",i&&!g&&"cursor-not-allowed opacity-60"),children:y},l);return g&&b.reason?e.jsxs(D,{children:[e.jsx(K,{asChild:!0,children:e.jsx("span",{className:"inline-flex shrink-0",children:f})}),e.jsx(R,{children:b.reason})]},l):f})})}function M({children:n,controls:t}){return e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-4 gap-y-2 px-3 py-2",children:[e.jsx("div",{className:"min-w-40 flex-1 text-sm",children:n}),e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:t})]})}const _e=[{resourceClass:"entity",title:"Entities",sub:"Defaults for every entity type."},{resourceClass:"agent_config",title:"Agents",sub:"Defaults for reading and managing agents."}];function Ae(n,t,o,a,i=null){const m=q(n.floor,t,o,a,i),u=z(n.floor,t,o,a,i)?m:"auto";return(a!==null||i!==null)&&be(n.agent,t,o)?ye(u,k(n,t,o,null)):u}function Se({label:n,response:t,resourceClass:o,action:a,entityTypeSlug:i,targetAgentId:m=null,dimmed:u,pending:l,onSave:b}){const h=q(t.floor,o,a,i,m),g=z(t.floor,o,a,i,m),y=k(t,o,a,i,m),f=Ae(t,o,a,i,m),j=pe(o,a),p=e.jsx("div",{className:S("inline-flex shrink-0",u&&"opacity-45"),children:e.jsx(Ne,{options:j,value:y,floor:f,disabled:l,compact:!0,ariaLabel:n,onChange:b})});return g?e.jsxs(D,{children:[e.jsx(K,{asChild:!0,children:e.jsx("span",{className:"inline-flex shrink-0",children:p})}),e.jsxs(R,{children:["Org floor ",B[h]," — can only go stricter"]})]}):p}function ke(n,t){const o=i=>i.resource_class===t.resource_class&&(i.entity_type_slug??null)===(t.entity_type_slug??null)&&(i.operation_key??null)===(t.operation_key??null)&&(i.target_agent_id??null)===(t.target_agent_id??null),a=n.map(i=>o(i)?t:i);return a.some(o)?a:[...a,t]}function Ce(n,t,o,a,i,m){const u=je(n,t,o,a);return u[i]=m,u}const $="font-medium text-foreground hover:text-primary hover:underline";function Ee({type:n}){return e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(W,{icon:n.icon,className:"h-3.5 w-3.5 shrink-0"}),e.jsx("span",{className:"font-medium",children:n.name}),e.jsx("span",{className:"font-mono text-[10px] text-muted-foreground",children:n.slug})]})}function Q({label:n,disabled:t,hint:o,searchPlaceholder:a,emptyText:i,children:m}){return t?e.jsxs("div",{className:"px-3 py-1.5 text-xs text-muted-foreground",children:[n,o?` ${o}`:""]}):e.jsx(xe,{contentClassName:"w-[min(100vw-2rem,22rem)]",searchPlaceholder:a,emptyText:i,trigger:u=>e.jsxs("button",{type:"button","aria-expanded":u,className:"flex w-full items-center gap-1.5 px-3 py-1.5 text-left text-xs text-primary hover:bg-muted/50",children:[e.jsx(he,{className:"h-3 w-3"}),n]}),children:u=>m(u)})}function Te({pending:n,onClick:t,label:o}){return e.jsx("button",{type:"button",disabled:n,onClick:t,"aria-label":o,className:"rounded p-0.5 text-muted-foreground hover:bg-red-500/10 hover:text-red-600 disabled:opacity-50 dark:hover:text-red-400",children:e.jsx(fe,{className:"h-3 w-3"})})}function $e({owner:n,agentId:t,variant:o="agent"}){const a=o==="org-floor",i=G(),m=Y(n,t??"",{enabled:!a&&!!t}),u=Z(n,{enabled:a}),{data:l,isLoading:b,isError:h,error:g}=a?u:m,y=a?V(n):ee(n,t??""),f=P({mutationFn:r=>a?se(n,r):ne(n,t??"",r),onSuccess:r=>{i.setQueryData(y,c=>c&&{...c,agent:ke(c.agent,r)}),i.invalidateQueries({queryKey:y}),a&&i.invalidateQueries({queryKey:["agent-permissions"]})},onError:r=>{F.error(r instanceof Error?r.message:"Failed to save permission")}}),j=P({mutationFn:r=>a?te(n,r):re(n,t??"",r),onSuccess:()=>{i.invalidateQueries({queryKey:y}),a&&i.invalidateQueries({queryKey:["agent-permissions"]})},onError:r=>{F.error(r instanceof Error?r.message:"Failed to remove override")}}),p=f.isPending||j.isPending,C=A.useMemo(()=>l?ae(l):[],[l]),E=A.useMemo(()=>{if(!l)return[];const r=new Set(C.map(c=>c.slug));return l.entity_types.filter(c=>!r.has(c.slug))},[l,C]),v=A.useMemo(()=>l?ie(l):[],[l]),N=A.useMemo(()=>{if(!l)return[];const r=new Set(v.map(c=>c.id));return l.agents.filter(c=>(a||c.id!==t)&&!r.has(c.id))},[l,v,t,a]);if(b)return e.jsx(le,{label:"permissions",variant:"cards",cards:2});if(h||!l)return e.jsx(oe,{label:g instanceof Error?g.message:"permissions"});const x=l,H=(r,c,T,_,s=null)=>{const d=Ce(x,r,c,s,T,_);f.mutate({resource_class:r,effects:d,entity_type_slug:c,target_agent_id:s})},I=x.entity_types.length===0?"— none yet":E.length===0?"— all covered":null,J=N.length===0&&v.length===0?"— no other agents":N.length===0?"— all covered":null;return e.jsxs("div",{className:"space-y-4",children:[a?null:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Manage connector rules and agent restrictions in"," ",e.jsx(w,{to:"/$owner/settings/organization",params:{owner:n},search:{agent:t},hash:"policies",className:$,children:"Organization policies"}),"."]}),_e.map(r=>{const c=r.resourceClass==="entity",T=r.resourceClass==="agent_config",_=[{key:"default",label:"Default",name:"Default",entityTypeSlug:null,targetAgentId:null,owned:!1,diffs:0},...c?C.map(s=>({key:`entity:${s.slug}`,name:s.name,label:e.jsx(w,{to:"/$owner/entity-types/$slug",params:{owner:n,slug:s.slug},className:$,title:`Open ${s.name}`,children:e.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[e.jsx(W,{icon:s.icon,className:"h-3.5 w-3.5 shrink-0"}),s.name]})}),entityTypeSlug:s.slug,targetAgentId:null,owned:ce(x,s.slug),diffs:de(x,s.slug)})):v.map(s=>({key:`agent:${s.id}`,name:s.name,label:e.jsx(w,{to:"/$owner/agents/$agentId/settings",params:{owner:n,agentId:s.id},search:{run_id:void 0},className:$,title:`Open ${s.name}`,children:s.name}),entityTypeSlug:null,targetAgentId:s.id,owned:me(x,s.id),diffs:ue(x,s.id)}))];return e.jsxs("section",{className:"space-y-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx("h3",{className:"text-sm font-medium",children:r.title}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r.sub})]}),e.jsxs("div",{className:"divide-y overflow-hidden rounded-lg border",children:[_.map(s=>e.jsxs("div",{className:"divide-y",children:[_.length>1&&e.jsx("div",{className:"bg-muted/30",children:e.jsx(M,{controls:s.owned?e.jsx(Te,{pending:p,label:`Remove ${s.name} exception`,onClick:()=>j.mutate({resource_class:r.resourceClass,entity_type_slug:s.entityTypeSlug,target_agent_id:s.targetAgentId})}):null,children:e.jsxs("div",{className:"flex items-center gap-2",children:[s.label,s.key!=="default"&&!s.owned?e.jsx("span",{className:"text-xs text-muted-foreground",children:"Organization minimum"}):s.diffs>0?e.jsxs("span",{className:"text-xs text-muted-foreground",children:[s.diffs," ",s.diffs===1?"change":"changes"]}):null]})})}),e.jsx("div",{className:"divide-y",children:ge[r.resourceClass].filter(d=>!s.targetAgentId||d!=="create").map(d=>{const O=`${d.charAt(0).toUpperCase()+d.slice(1)} ${c?"entities":"agents"}`;return e.jsx(M,{controls:e.jsx(Se,{label:`${s.name}: ${O}`,response:x,resourceClass:r.resourceClass,action:d,entityTypeSlug:s.entityTypeSlug,targetAgentId:s.targetAgentId,dimmed:s.key!=="default"&&k(x,r.resourceClass,d,s.entityTypeSlug,s.targetAgentId)===k(x,r.resourceClass,d,null),pending:p,onSave:U=>H(r.resourceClass,s.entityTypeSlug,d,U,s.targetAgentId)}),children:O},d)})})]},s.key)),e.jsxs("div",{className:"border-t",children:[c?e.jsx(Q,{label:"Add type",disabled:p||E.length===0,hint:I,searchPlaceholder:"Search types…",emptyText:"No matching types.",children:s=>E.map(d=>e.jsx(L,{value:`${d.name} ${d.slug}`,onSelect:()=>{f.mutate({resource_class:"entity",effects:{},entity_type_slug:d.slug}),s()},className:"cursor-pointer",children:e.jsx(Ee,{type:d})},d.slug))}):null,T?e.jsx(Q,{label:"Add agent",disabled:p||N.length===0,hint:J,searchPlaceholder:"Search agents…",emptyText:"No matching agents.",children:s=>N.map(d=>e.jsxs(L,{value:`${d.name} ${d.id}`,onSelect:()=>{f.mutate({resource_class:"agent_config",effects:{},target_agent_id:d.id}),s()},className:"cursor-pointer",children:[e.jsx("span",{className:"font-medium",children:d.name}),e.jsx("span",{className:"ml-1.5 font-mono text-[10px] text-muted-foreground",children:d.id})]},d.id))}):null]})]})]},r.resourceClass)})]})}export{$e as A,Ne as P,M as a};
|
|
2
|
+
//# sourceMappingURL=agent-permissions-matrix-bP1Qihv7.js.map
|
package/dist/owletto/dist/assets/{agent-skill-context-V__2i6Vl.js → agent-skill-context-BAaGpvfS.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as p,
|
|
2
|
-
//# sourceMappingURL=agent-skill-context-
|
|
1
|
+
import{r as p,bB as G,gZ as ge,hu as pe,hF as be,bt as z,j as ve}from"./index-DdBTTN3y.js";import{K as E,d as me,g as he,e as xe,s as Ce,f as Ie,h as Se,i as Y,b as ke,c as ye,j as we,k as Re,C as H,l as Ae}from"./core.esm-CQzL3ObT.js";import{s as De,b as Ee}from"./skill-editor-D_W3QlRz.js";function B(e,n,t){const r=e.slice();return r.splice(t<0?r.length+t:t,0,r.splice(n,1)[0]),r}function Le(e,n){return e.reduce((t,r,s)=>{const u=n.get(r);return u&&(t[s]=u),t},Array(e.length))}function P(e){return e!==null&&e>=0}function Te(e,n){if(e===n)return!0;if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}function Ne(e){return typeof e=="boolean"?{draggable:e,droppable:e}:e}const V=e=>{let{rects:n,activeIndex:t,overIndex:r,index:s}=e;const u=B(n,r,t),o=n[s],i=u[s];return!i||!o?null:{x:i.left-o.left,y:i.top-o.top,scaleX:i.width/o.width,scaleY:i.height/o.height}},M={scaleX:1,scaleY:1},We=e=>{var n;let{activeIndex:t,activeNodeRect:r,index:s,rects:u,overIndex:o}=e;const i=(n=u[t])!=null?n:r;if(!i)return null;if(s===t){const f=u[o];return f?{x:0,y:t<o?f.top+f.height-(i.top+i.height):f.top-i.top,...M}:null}const m=Oe(u,s,t);return s>t&&s<=o?{x:0,y:-i.height-m,...M}:s<t&&s>=o?{x:0,y:i.height+m,...M}:{x:0,y:0,...M}};function Oe(e,n,t){const r=e[n],s=e[n-1],u=e[n+1];return r?t<n?s?r.top-(s.top+s.height):u?u.top-(r.top+r.height):0:u?u.top-(r.top+r.height):s?r.top-(s.top+s.height):0:0}const W="Sortable",Z=G.createContext({activeIndex:-1,containerId:W,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:V,disabled:{draggable:!1,droppable:!1}});function Ze(e){let{children:n,id:t,items:r,strategy:s=V,disabled:u=!1}=e;const{active:o,dragOverlay:i,droppableRects:m,over:f,measureDroppableContainers:a}=Ie(),l=Se(W,t),b=i.rect!==null,h=p.useMemo(()=>r.map(d=>typeof d=="object"&&"id"in d?d.id:d),[r]),k=o!=null,w=o?h.indexOf(o.id):-1,C=f?h.indexOf(f.id):-1,R=p.useRef(h),I=!Te(h,R.current),S=C!==-1&&w===-1||I,c=Ne(u);Y(()=>{I&&k&&a(h)},[I,h,k,a]),p.useEffect(()=>{R.current=h},[h]);const g=p.useMemo(()=>({activeIndex:w,containerId:l,disabled:c,disableTransforms:S,items:h,overIndex:C,useDragOverlay:b,sortedRects:Le(h,m),strategy:s}),[w,l,c.draggable,c.droppable,S,h,C,m,b,s]);return G.createElement(Z.Provider,{value:g},n)}const Pe=e=>{let{id:n,items:t,activeIndex:r,overIndex:s}=e;return B(t,r,s).indexOf(n)},Me=e=>{let{containerId:n,isSorting:t,wasDragging:r,index:s,items:u,newIndex:o,previousItems:i,previousContainerId:m,transition:f}=e;return!f||!r||i!==u&&s===o?!1:t?!0:o!==s&&n===m},je={duration:200,easing:"ease"},J="transform",Fe=H.Transition.toString({property:J,duration:0,easing:"linear"}),$e={roleDescription:"sortable"};function ze(e){let{disabled:n,index:t,node:r,rect:s}=e;const[u,o]=p.useState(null),i=p.useRef(t);return Y(()=>{if(!n&&t!==i.current&&r.current){const m=s.current;if(m){const f=Ae(r.current,{ignoreTransform:!0}),a={x:m.left-f.left,y:m.top-f.top,scaleX:m.width/f.width,scaleY:m.height/f.height};(a.x||a.y)&&o(a)}}t!==i.current&&(i.current=t)},[n,t,r,s]),p.useEffect(()=>{u&&o(null)},[u]),u}function Je(e){let{animateLayoutChanges:n=Me,attributes:t,disabled:r,data:s,getNewIndex:u=Pe,id:o,strategy:i,resizeObserverConfig:m,transition:f=je}=e;const{items:a,containerId:l,activeIndex:b,disabled:h,disableTransforms:k,sortedRects:w,overIndex:C,useDragOverlay:R,strategy:I}=p.useContext(Z),S=Be(r,h),c=a.indexOf(o),g=p.useMemo(()=>({sortable:{containerId:l,index:c,items:a},...s}),[l,s,c,a]),d=p.useMemo(()=>a.slice(a.indexOf(o)),[a,o]),{rect:v,node:y,isOver:A,setNodeRef:L}=ke({id:o,data:g,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:d,...m}}),{active:D,activatorEvent:te,activeNodeRect:ne,attributes:re,setNodeRef:K,listeners:se,isDragging:F,over:oe,setActivatorNodeRef:ie,transform:ae}=ye({id:o,data:g,attributes:{...$e,...t},disabled:S.draggable}),le=we(L,K),T=!!D,U=T&&!k&&P(b)&&P(C),X=!R&&F,_=X&&U?ae:null,ce=U?_??(i??I)({rects:w,activeNodeRect:ne,activeIndex:b,overIndex:C,index:c}):null,O=P(b)&&P(C)?u({id:o,items:a,activeIndex:b,overIndex:C}):c,N=D?.id,x=p.useRef({activeId:N,items:a,newIndex:O,containerId:l}),ue=a!==x.current.items,q=n({active:D,containerId:l,isDragging:F,isSorting:T,id:o,index:c,items:a,newIndex:x.current.newIndex,previousItems:x.current.items,previousContainerId:x.current.containerId,transition:f,wasDragging:x.current.activeId!=null}),$=ze({disabled:!q,index:c,node:y,rect:v});return p.useEffect(()=>{T&&x.current.newIndex!==O&&(x.current.newIndex=O),l!==x.current.containerId&&(x.current.containerId=l),a!==x.current.items&&(x.current.items=a)},[T,O,l,a]),p.useEffect(()=>{if(N===x.current.activeId)return;if(N!=null&&x.current.activeId==null){x.current.activeId=N;return}const fe=setTimeout(()=>{x.current.activeId=N},50);return()=>clearTimeout(fe)},[N]),{active:D,activeIndex:b,attributes:re,data:g,rect:v,index:c,newIndex:O,items:a,isOver:A,isSorting:T,isDragging:F,listeners:se,node:y,overIndex:C,over:oe,setNodeRef:le,setActivatorNodeRef:ie,setDroppableNodeRef:L,setDraggableNodeRef:K,transform:$??ce,transition:de()};function de(){if($||ue&&x.current.newIndex===c)return Fe;if(!(X&&!Re(te)||!f)&&(T||q))return H.Transition.toString({...f,property:J})}}function Be(e,n){var t,r;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(t=e?.draggable)!=null?t:n.draggable,droppable:(r=e?.droppable)!=null?r:n.droppable}}function j(e){if(!e)return!1;const n=e.data.current;return!!(n&&"sortable"in n&&typeof n.sortable=="object"&&"containerId"in n.sortable&&"items"in n.sortable&&"index"in n.sortable)}const Ke=[E.Down,E.Right,E.Up,E.Left],Qe=(e,n)=>{let{context:{active:t,collisionRect:r,droppableRects:s,droppableContainers:u,over:o,scrollableAncestors:i}}=n;if(Ke.includes(e.code)){if(e.preventDefault(),!t||!r)return;const m=[];u.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const b=s.get(l.id);if(b)switch(e.code){case E.Down:r.top<b.top&&m.push(l);break;case E.Up:r.top>b.top&&m.push(l);break;case E.Left:r.left>b.left&&m.push(l);break;case E.Right:r.left<b.left&&m.push(l);break}});const f=me({collisionRect:r,droppableRects:s,droppableContainers:m});let a=he(f,"id");if(a===o?.id&&f.length>1&&(a=f[1].id),a!=null){const l=u.get(t.id),b=u.get(a),h=b?s.get(b.id):null,k=b?.node.current;if(k&&h&&l&&b){const C=xe(k).some((d,v)=>i[v]!==d),R=Q(l,b),I=Ue(l,b),S=C||!R?{x:0,y:0}:{x:I?r.width-h.width:0,y:I?r.height-h.height:0},c={x:h.left,y:h.top};return S.x&&S.y?c:Ce(c,S)}}}};function Q(e,n){return!j(e)||!j(n)?!1:e.data.current.sortable.containerId===n.data.current.sortable.containerId}function Ue(e,n){return!j(e)||!j(n)||!Q(e,n)?!1:e.data.current.sortable.index<n.data.current.sortable.index}function Xe(e){return{skillsConfig:De(e)}}function _e(e){return e.repo.startsWith("system/")?["System"]:[]}function et(e,n){return e.filter(t=>!t.hidden&&!n.has(t.repo)).map(t=>({key:t.repo,name:t.name,description:t.description||t.instructions||"Add this skill to give the agent tools and capabilities.",badges:_e(t)}))}function tt(e,n){const t=n.trim().toLowerCase();return t?e.filter(r=>r.name.toLowerCase().includes(t)||r.description.toLowerCase().includes(t)||r.key.toLowerCase().includes(t)):e}function qe(e){const n=e.instructions?.trim();return{repo:e.repo,skillId:e.skillId,name:e.name,description:e.description,instructions:n,content:n||e.name,enabled:!0,system:e.repo.startsWith("system/")}}const ee=p.createContext(null);function nt({agentId:e,children:n}){const{data:t,isLoading:r}=ge(e),{data:s,isLoading:u}=pe(e),o=be(e),i=p.useMemo(()=>t?Ee(t,s?.catalog??[]):[],[t,s]),[m,f]=p.useState(null),a=m??i,l=p.useCallback(async(c,g)=>{if(!t)return z.error("Still loading agent settings — try again in a moment"),!1;try{const d=Xe(c);return await o.mutateAsync(d),z.success(g),!0}catch(d){return z.error(d instanceof Error?d.message:"Failed to save skills"),!1}},[t,o]),b=p.useCallback(c=>{const g=s?.catalog.find(d=>d.repo===c);g&&f(d=>{const v=d??i;return v.some(y=>y.repo===c)?v:[...v,qe(g)]})},[i,s?.catalog]),h=p.useCallback(c=>{const g=c.name.trim();if(!g)return null;const d=`custom/${g.toLowerCase().replace(/[^a-z0-9-]/g,"-")}`,v=c.instructions.trim();return f(y=>{const A=y??i;return A.some(L=>L.repo===d)?A:[...A,{repo:d,skillId:g,name:g,instructions:v||void 0,content:v||g,enabled:!0}]}),d},[i]),k=p.useCallback((c,g)=>{f(d=>(d??i).map(v=>v.repo===c?{...v,...g}:v))},[i]),w=p.useCallback((c,g)=>{f(d=>{const v=d??i,y=v.findIndex(D=>D.repo===c),A=v.findIndex(D=>D.repo===g);if(y<0||A<0||y===A)return v;const L=B(v,y,A);return l(L,"Skill order updated"),L})},[l,i]),C=p.useCallback(async c=>{const g=a.filter(d=>d.repo!==c);return f(g),l(g,"Skill removed")},[l,a]),R=p.useCallback(async(c,g)=>{const d=a.map(v=>v.repo===c?{...v,enabled:g}:v);return f(d),l(d,g?"Skill enabled":"Skill disabled")},[l,a]),I=p.useCallback(async()=>{await l(a,"Skills saved")},[l,a]),S=p.useMemo(()=>({agentId:e,skillRows:a,catalog:s,isLoading:r||u,isSaving:o.isPending,addSkillFromCatalog:b,addCustomSkill:h,updateSkillRow:k,reorderSkills:w,removeSkillAndSave:C,setSkillEnabledAndSave:R,saveSkills:I}),[h,b,e,u,r,w,C,R,I,a,s,o.isPending,k]);return ve.jsx(ee.Provider,{value:S,children:n})}function rt(){const e=p.useContext(ee);if(!e)throw new Error("useAgentSkillEditor must be used within AgentSkillEditorProvider");return e}export{nt as A,Ze as S,Qe as a,et as b,Je as c,tt as f,_e as s,rt as u,We as v};
|
|
2
|
+
//# sourceMappingURL=agent-skill-context-BAaGpvfS.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as D,r as g,j as e,d6 as L,H as N,I as K,eS as P,bP as O,B as C,i as R,dh as _,hw as H,hx as z,b2 as G,hI as Q,f_ as Y,j8 as V}from"./index-DdBTTN3y.js";import{u as w,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-BAaGpvfS.js";import{b as se,a as te,A as E}from"./agent-tab-intro-ednTs4WF.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-CQzL3ObT.js";import{f as ce}from"./agent-loading-shells-ClY_O6lb.js";import{A as de}from"./agent-card-controls-C5jNWgfq.js";const T=":";function A(s){const t=s.indexOf("/");return t<0?s:`${s.slice(0,t)}${T}${s.slice(t+1)}`}function B(s){const t=s.indexOf(T);return t<0?s:`${s.slice(0,t)}/${s.slice(t+1)}`}function me({owner:s,agentId:t}){const a=D(),[n,i]=g.useState(""),[o,d]=g.useState(!1),[x,k]=g.useState(""),[r,b]=g.useState(""),{skillRows:m,catalog:p,isLoading:u,addSkillFromCatalog:h,addCustomSkill:S}=w(),v=g.useMemo(()=>new Set(m.map(c=>c.repo)),[m]),f=g.useMemo(()=>X(p?.catalog??[],v),[p?.catalog,v]),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:A(c)}})},j=()=>{const c=S({name:x,instructions:r});c&&a({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:A(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(N,{htmlFor:"custom-skill-name",children:"Name"}),e.jsx(K,{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(N,{htmlFor:"custom-skill-instructions",children:"Instructions"}),e.jsx(P,{id:"custom-skill-instructions",value:r,onChange:c=>b(c.target.value),placeholder:"Instructions for the agent when this skill is active...",rows:3})]})]}),e.jsx(O,{onCancel:()=>d(!1),children:e.jsx(C,{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(L,{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 ue({row:s}){const{isSaving:t,updateSkillRow:a}=w(),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(N,{htmlFor:"skill-name",children:"Name"}),e.jsx(K,{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(N,{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 ge({owner:s,agentId:t,skillKey:a}){const n=D(),[i,o]=g.useState(!1),d=B(a),{skillRows:x,catalog:k,isSaving:r,saveSkills:b,removeSkillAndSave:m,addSkillFromCatalog:p}=w(),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 v=!u.system;return e.jsxs("div",{className:"space-y-6",children:[e.jsx(ue,{row:u}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center sm:justify-end",children:[v?i?e.jsxs(e.Fragment,{children:[e.jsx(C,{type:"button",variant:"destructive",onClick:()=>void S(),disabled:r,children:r?"Removing...":"Remove skill"}),e.jsx(C,{type:"button",variant:"outline",onClick:()=>o(!1),disabled:r,children:"Cancel"})]}):e.jsxs(C,{type:"button",variant:"outline",className:"text-destructive hover:text-destructive",onClick:()=>o(!0),disabled:r,children:["Remove ",u.name]}):null,e.jsx(C,{type:"button",onClick:()=>void b(),disabled:r||i,children:r?"Saving...":"Save changes"})]})]})}function xe(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:b}=w();g.useEffect(()=>{a&&(i.some(l=>l.repo===a)||o?.catalog.some(l=>l.repo===a)&&b(a))},[a,i,o,b]);const m=g.useMemo(()=>xe(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(C,{type:"button",onClick:h,children:[e.jsx(L,{className:"mr-1.5 h-4 w-4"}),"Add skill"]}),v=l=>{if(l===a){n({to:"/$owner/agents/$agentId/skills",params:{owner:s,agentId:t}});return}n({to:"/$owner/agents/$agentId/skills/$skillKey",params:{owner:s,agentId:t,skillKey:A(l)}})},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(ce,{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.jsx(te,{description:I,action: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(he,{card:l,rank:y+1,disabled:x,expanded:j,isLast:y===m.length-1,onToggle:()=>v(l.repo),onToggleEnabled:$=>void r(l.repo,$),toggleDisabled:x,children:j?e.jsx(ge,{owner:s,agentId:t,skillKey:A(l.repo)}):null},l.id)})})})})]})}function he({card:s,rank:t,disabled:a,expanded:n,isLast:i,onToggle:o,onToggleEnabled:d,toggleDisabled:x,children:k}){const r=a||n,{attributes:b,listeners:m,setNodeRef:p,transform:u,transition:h,isDragging:S}=ee({id:s.repo,disabled:r}),v={transform:re.Transform.toString(u),transition:h};return e.jsxs("div",{ref:p,style:v,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,...b,...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(de,{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 Se({owner:s,agentId:t}){return e.jsx(E,{children:e.jsx(M,{owner:s,agentId:t})})}function ye({owner:s,agentId:t}){return e.jsx(E,{children:e.jsx(me,{owner:s,agentId:t})})}function Ce({owner:s,agentId:t,skillKey:a}){return e.jsx(E,{children:e.jsx(M,{owner:s,agentId:t,expandedRepo:B(a)})})}export{Se as A,ye as a,Ce as b};
|
|
2
|
+
//# sourceMappingURL=agent-skills-route-Bv5luNdw.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as e,al as n,i as a}from"./index-DdBTTN3y.js";function l({children:t,className:s}){return e.jsx(n,{className:a("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})]})}function c({description:t,action:s}){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-sm text-muted-foreground",children:t}),s?e.jsx("div",{className:"shrink-0",children:s}):null]})}export{l as A,c as a,x as b};
|
|
2
|
+
//# sourceMappingURL=agent-tab-intro-ednTs4WF.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{j as s,r as a,aL as Ht,a6 as zt,gY as Wt,gZ as Kt,a3 as tt,Q as Be,a4 as nt,ca as qt,g_ as rt,g$ as Gt,L as gt,i as P,eD as Yt,dS as bt,dU as Qt,h0 as Jt,cI as Xt,dY as Zt,h1 as en,az as tn,B as fe,fi as nn,h2 as rn,h3 as He,X as on,ab as sn,db as ln,dh as Ne,h4 as an,dE as cn,dG as un,h5 as dn,dF as fn,fr as pn,h6 as mn,h7 as hn,eL as gn,W as bn,h8 as xn,h9 as vn}from"./index-DdBTTN3y.js";import{D as yn,E as Rn}from"./app-bridge-C4nPtae3.js";import{A as wn,a as Sn,b as Tn,c as Ge,d as xt,e as Cn}from"./agent-loading-shells-ClY_O6lb.js";import{t as jn,P as Nn}from"./pending-seed-sml8Uf6e.js";import{h as En,t as An,R as In,i as kn,u as _n,M as On,a as Pn}from"./use-mention-search-dn3ws1WB.js";import{t as ot,c as Mn}from"./event-card-DVUB8my6.js";import{E as Ln}from"./events-feed-B9CZHI_P.js";const vt=a.createContext(null);function $n({extension:e,children:t}){return s.jsx(vt.Provider,{value:e??null,children:t})}function Ye(){return a.useContext(vt)}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 Dn={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 Un(e){if(typeof e=="string")return Object.values(Qe).includes(e)?e:void 0}const Fn=Object.freeze(Object.defineProperty({__proto__:null,AGENT_ERRORS:Dn,AgentErrorCode:Qe,toAgentErrorCode:Un},Symbol.toStringTag,{value:"Module"})),{AGENT_ERRORS:Vn,toAgentErrorCode:Bn}=Fn;function st(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 yt(e,t){const n=Bn(e);if(!n)return null;const r=Vn[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(`${Ht}${t.provider}`)}`:`/${o}/connectors`,c=st(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=st(`/${o}/agents/${encodeURIComponent(t.agentId)}/settings`,t.webOrigin);return l?{label:r.ctaLabel??"Open settings",href:l}:null}function Rt(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 lt=new Set(["localhost","127.0.0.1","::1","[::1]"]);function Hn(e){return e?.trim().toLowerCase().replace(/^\.+|\.+$/g,"")||null}function at(e,t){const n=Hn(t);if(!n)return!1;const r=e.toLowerCase().replace(/\.$/,"");return r===n||r.endsWith(`.${n}`)}function it(e,t,n){try{const r=new URL(t),o=new URL(e,t),l=lt.has(o.hostname)&<.has(r.hostname),i=o.protocol===r.protocol&&(o.protocol==="https:"||o.protocol==="http:")&&at(o.hostname,n)&&at(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 zn=/\.(png|jpe?g|gif|webp|avif|bmp|svg)$/i,wt=new Set(["suggest_actions"]),Me="Thinking…";function Wn(e){const{textOut:t,statusLine:n,errorText:r,toolCalls:o}=e,l=[];n===Me&&l.push({type:"reasoning"}),r&&l.push({type:"error",text:r});let i=t;return n&&n!==Me&&(i=t?`${t}
|
|
2
|
+
|
|
3
|
+
${n}`:n),i&&l.push({type:"text",text:i}),l.push(...o),l}const St=[];function Kn(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 Uo({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:St}),[e,t]);return s.jsx(Je.Provider,{value:r,children:n})}const Tt=/\[([^\]]*)\]\((\S*?\/api\/v1\/files\/[^)\s]+)\)/g;function ct(e){return e.replace(/<lobu_internal_context>[\s\S]*?<\/lobu_internal_context>\n*/g,"").replace(Tt,"").replace(/\n{3,}/g,`
|
|
4
|
+
|
|
5
|
+
`).trim()}function qn(e){const t=[];for(const n of e.matchAll(Tt)){const r=n[1]?.trim()||"file",o=n[2];o&&t.push({name:r,url:o})}return t}function Gn(e,t={}){if(typeof e=="string"){const r=ct(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=ct(o.text);l&&n.push({type:"text",text:l})}else t.showToolCalls&&o.type==="toolCall"&&typeof o.name=="string"&&!wt.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 Yn(e){const t=[],n=r=>{for(const{name:o,url:l}of qn(r))t.push({id:`file-${t.length}`,name:o,url:l,isImage:zn.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 Qn(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:Gn(e.content,t),attachments:Yn(e.content),createdAt:n&&!Number.isNaN(n)?n:void 0}}const Jn=[],Xn=[];function Zn(e){let t=null;for(const n of e)n.type==="suggestion"&&(t=n.prompts.length>0?n.prompts:null);return t}function er(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=yt(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 tr=3e4,nr=3*tr,rr=15e3;function ut(e){try{return JSON.parse(e.data)}catch{return{content:e.data}}}const be=e=>`${e}-${Date.now()}-${Math.random().toString(36).slice(2,6)}`;function or(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 Fo({agentId:e,workspaceSlug:t,thread:n="agent-panel",loadHistory:r=!0,ephemeralContext:o,onFirstUserMessage:l,children:i,initialDraft:c}){const u=zt(),d=a.useRef(null),m=a.useRef(null),y=a.useRef(!1),h=a.useRef(o),g=a.useRef(!1),w=a.useRef(null);h.current=o;const{data:E,isLoading:v}=Wt(e,n,{orgSlug:t,enabled:r&&!!e&&!!n}),T=E?.messages??Jn,H=E?.interactions??Xn,{data:U}=Kt(e,{enabled:!!e}),K=U?.starters??St,z=!!(U?.showToolCalls??U?.settings?.showToolCalls),[N,L]=a.useState([]),[G,le]=a.useState(!1),[$,q]=a.useState([]),[Y,R]=a.useState(null),S=a.useRef(!1);S.current=G;const C=a.useMemo(()=>T.map(I=>Qn(I,{showToolCalls:z})).filter(I=>I!==null),[T,z]),O=a.useRef(!1);a.useEffect(()=>{if(O.current||v||S.current)return;O.current=!0;const I=er(H,{workspaceSlug:t,agentId:e,webOrigin:typeof window>"u"?null:window.location.origin});L(I?[...C,I]:C),R(Zn(H))},[e,v,C,H,t]);const A=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(m.current)return m.current;if(!e)throw new Error("No agent selected");const I=(async()=>{const M=await tt(`${Be}/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 nt(M);const V=await M.json(),j=qt(),J={sessionId:V.agentId,sseUrl:it(V.sseUrl,Be,j),messagesUrl:it(V.messagesUrl,Be,j)};return d.current=J,J})();m.current=I;try{return await I}catch(M){throw d.current=null,M}finally{m.current=null}},[e,t,n]),te=a.useCallback(async(I,M,V)=>{const j=crypto.randomUUID(),J=new AbortController;w.current=J;const W=f=>{L(p=>p.map(b=>b.id===V?{...b,parts:f}:b))};let B;try{B=await Z()}catch(f){W([{type:"text",text:`Error: ${f instanceof Error?f.message:"Could not start a session."}`}]);return}let X=await rt(B.sseUrl,{throwOnFailure:!0});const pe=[];let ie=null;const Re=()=>{const f=ie;ie=null,f?.()},we=f=>{pe.push(f),Re()},Se=(f,p)=>{const k=["question","link-button","tool-approval"].includes(f)?p.turnMessageId===j:p.messageId===j||Array.isArray(p.processedMessageIds)&&p.processedMessageIds.includes(j);(f==="closed"||k)&&we({kind:f,payload:p})};let me=!1,Te=null;const Ie=new Promise(f=>{Te=f});let ce=0,he=Date.now();const ue=f=>{he=Date.now();const p=Number(f.lastEventId);Number.isFinite(p)&&p>ce&&(ce=p)},ke=["output","status","complete","closed","agent-error","question","link-button","tool-approval","tool_use"],Ce=f=>{f.addEventListener("open",()=>{me=!0,Te?.()}),f.addEventListener("connected",b=>{ue(b),me||(me=!0,Te?.())}),f.addEventListener("ping",ue);const p=b=>k=>{ue(k);const ee=k;typeof ee.data=="string"&&Se(b,ut(ee))};for(const b of ke)f.addEventListener(b,p(b));f.addEventListener("error",b=>{const k=b;if(typeof k.data=="string"&&k.data){ue(b),Se("error",ut(k));return}f.readyState===EventSource.CLOSED&&we({kind:"error",payload:{error:"Connection closed"}})})};Ce(X);const _e=async()=>{X.close();let f=B.sseUrl;if(ce){const p=new URL(B.sseUrl,window.location.origin);p.searchParams.set("since",String(ce)),f=p.toString()}X=await rt(f,{throwOnFailure:!1}),Ce(X),he=Date.now()};await Promise.race([Ie,new Promise(f=>setTimeout(f,1500))]);const Oe=()=>{X.close(),Re()};J.signal.addEventListener("abort",Oe,{once:!0});try{const f=h.current?.trim(),p=!!f&&!g.current;p&&(g.current=!0);let b;if(M.length>0){const x=new FormData;x.set("content",I),x.set("messageId",j),p&&f&&x.set("ephemeralContext",f);for(const _ of M)x.append("files",_,_.name);b={method:"POST",credentials:"include",body:x,timeoutMs:12e4}}else{const x={content:I,messageId:j};p&&f&&(x.ephemeralContext=f),b={method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(x),timeoutMs:2e4}}const k=await tt(B.messagesUrl,b);if(!k.ok)throw d.current=null,await nt(k);let ee="",D=Me,et=null;const ge=[],de=()=>Wn({textOut:ee,statusLine:D,errorText:et,toolCalls:ge});for(W(de());!J.signal.aborted;){if(pe.length===0){let _;const ne=await Promise.race([new Promise(Ve=>{ie=()=>Ve(!0)}),new Promise(Ve=>{_=setTimeout(()=>Ve(!1),rr)})]);_&&clearTimeout(_),!ne&&Date.now()-he>=nr&&(await _e(),A());continue}const x=pe.shift();if(x){if(x.kind==="output")D=null,ee+=String(x.payload.content??"");else if(x.kind==="status")D=Me;else if(x.kind==="complete"){D=null;const _=x.payload.finalText;typeof _=="string"&&_.length>0&&(ee=_);const ne=x.payload.suggestions;ne!==void 0&&R(Array.isArray(ne)?or(ne):null),A(),W(de());return}else if(x.kind==="closed"){d.current=null;const _=x.payload.reason;D=`Session ended${_?`: ${_}`:""}.`,A(),W(de());return}else if(x.kind==="error"||x.kind==="agent-error"){D=null,et=typeof x.payload.error=="string"&&x.payload.error?x.payload.error:"Agent reported an error.";const _=x.payload.errorContext&&typeof x.payload.errorContext=="object"?x.payload.errorContext:void 0,ne=yt(x.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&&ge.push({type:"tool-call",toolCallId:be("l"),toolName:"link-button",args:{label:ne.label,url:ne.href}}),A(),W(de());return}else if(x.kind==="question")ge.push({type:"tool-call",toolCallId:be("q"),toolName:"question",args:{question:x.payload.question??"",options:x.payload.options??[]}});else if(x.kind==="tool_use"){if(D=null,wt.has(x.payload.name??"")){W(de());continue}const _=x.payload.result_summary,ne=Rt(_);if(!z&&!ne){W(de());continue}ge.push({type:"tool-call",toolCallId:x.payload.toolCallId??be("t"),toolName:z?x.payload.name??"tool":"subscription-candidate",args:z?x.payload.input??{}:null,result:_,isError:x.payload.isError})}else if(x.kind==="link-button")ge.push({type:"tool-call",toolCallId:be("l"),toolName:"link-button",args:{label:x.payload.label??"Open link",url:x.payload.url??""}});else if(x.kind==="tool-approval"){const _=x.payload.runId;if(typeof _!="number")continue;ge.push({type:"tool-call",toolCallId:`run-${_}`,toolName:"tool-approval",args:{runId:_,action:x.payload.action??null,proposal:x.payload.proposal??null,current:x.payload.current??null,fields:x.payload.fields??null,attribution:x.payload.attribution??null,resourceKind:x.payload.resourceKind??null}})}W(de())}}}catch(f){W([{type:"text",text:`Error: ${f instanceof Error?f.message:"Send failed."}`}])}finally{J.signal.removeEventListener("abort",Oe),X.close()}},[e,Z,A,z,t]),re=a.useCallback(I=>{const M=I.trim(),V=$.map(B=>B.file);if(!M&&V.length===0||S.current||!e)return;y.current||(y.current=!0,l?.(M||V[0]?.name||""));const j={id:be("u"),role:"user",parts:M?[{type:"text",text:M}]:[],attachments:$.map(B=>({id:B.id,name:B.name,isImage:B.isImage,imageDataUrl:B.isImage?URL.createObjectURL(B.file):void 0})),createdAt:Date.now()},J=be("asst"),W={id:J,role:"assistant",parts:[{type:"reasoning"}],createdAt:Date.now()};L(B=>[...B,j,W]),q([]),le(!0),S.current=!0,te(M,V,J).finally(()=>{le(!1),S.current=!1,w.current=null})},[e,l,$,te]),se=a.useCallback(()=>{w.current?.abort()},[]),ye=a.useCallback(I=>{const M=Array.from(I);q(V=>[...V,...M.map(j=>({id:crypto.randomUUID(),name:j.name,file:j,isImage:j.type.startsWith("image/")}))])},[]),Q=a.useCallback(I=>{q(M=>M.filter(V=>V.id!==I))},[]),ae=a.useRef(!1);a.useEffect(()=>{if(ae.current)return;const I=jn(n);I&&(ae.current=!0,re(I))},[n,re]);const F=a.useMemo(()=>({messages:N,running:G,append:re,cancel:se,pendingAttachments:$,addAttachments:ye,removeAttachment:Q,initialDraft:c,agentId:e,conversationId:n,workspaceSlug:t,currentSuggestions:Y,starters:K}),[N,G,re,se,$,ye,Q,c,e,n,t,Y,K]);return r&&v?s.jsx(wn,{}):s.jsx(Je.Provider,{value:F,children:i})}const dt="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 sr({refItem:e}){const t=In[e.kind]??Gt;return kn(e.path)?s.jsxs("span",{className:dt,children:[s.jsx(t,{className:"h-3 w-3 shrink-0 opacity-70"}),e.label]}):s.jsxs(gt,{to:e.path,className:P(dt,"hover:bg-accent/80"),children:[s.jsx(t,{className:"h-3 w-3 shrink-0 opacity-70"}),e.label]})}const Xe=({text:e,renderText:t})=>En(e)?s.jsx(s.Fragment,{children:An(e).map((n,r)=>n.type==="ref"?s.jsx(sr,{refItem:n.ref},`r${r}`):s.jsx("span",{children:t(n.text)},`t${r}`))}):s.jsx(s.Fragment,{children:t(e)}),lr=({label:e="Thinking"})=>s.jsx("span",{className:"aui-thinking-shimmer inline-block text-sm","aria-live":"polite","aria-busy":"true",children:e}),Ct=a.createContext(null),jt=()=>{const e=a.useContext(Ct);if(!e)throw new Error("ChainOfThought components must be used within ChainOfThought");return e},Nt=a.memo(({className:e,open:t,defaultOpen:n=!1,onOpenChange:r,children:o,...l})=>{const[i,c]=Yt({prop:t,defaultProp:n,onChange:r}),u=a.useMemo(()=>({isOpen:i,setIsOpen:c}),[i,c]);return s.jsx(Ct.Provider,{value:u,children:s.jsx("div",{className:P("not-prose max-w-prose space-y-4",e),...l,children:o})})}),Et=a.memo(({className:e,children:t,...n})=>{const{isOpen:r,setIsOpen:o}=jt();return s.jsx(bt,{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(Xt,{className:P("size-4 transition-transform",r?"rotate-180":"rotate-0")})]})})}),At=a.memo(({className:e,icon:t=en,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]})]})}),It=a.memo(({className:e,children:t,...n})=>{const{isOpen:r}=jt();return s.jsx(bt,{open:r,children:s.jsx(Zt,{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})})});Nt.displayName="ChainOfThought";Et.displayName="ChainOfThoughtHeader";At.displayName="ChainOfThoughtStep";It.displayName="ChainOfThoughtContent";function ar(e){return{contentIds:e.filter(n=>Number.isSafeInteger(n)&&n>0),sortBy:"date",sortOrder:"asc"}}function ir({ownerSlug:e,eventIds:t}){const n=t.join(","),r=a.useMemo(()=>ar(n.split(",").map(Number)),[n]);return r.contentIds.length===0?null:s.jsx(tn,{owner:e,children:({organizationId:o,ownerSlug:l})=>o?s.jsx(Ln,{organizationId:o,ownerSlug:l,filters:r,hideOriginator:!0}):null})}function cr({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:o}){let l=ze(ur(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={...ze(l,i),ref:Ae(l.ref,i.ref)};return a.cloneElement(n,c)}function ze(...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):fr(o)&&typeof i=="function"&&typeof l=="function"?t[o]=dr(l,i):t[o]=l}}return t}function ur(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 dr(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function fr(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 pr=8,mr=64,hr=0,Le=.5,gr=180,br=new Set(["ArrowDown","ArrowUp","End","Home","PageDown","PageUp"," "]),kt={start:!1,end:!1},xr=[],$e={currentAnchorId:null,visibleMessageIds:xr};function vr({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return kt;let o=Ze({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:o-r.scrollTop-r.clientHeight>t}}function yr({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:o,visibleMessageIds:l}){if(!e||!o)return $e;let i=o.getBoundingClientRect(),c=i.top+t+n,u=typeof IntersectionObserver>"u",d=[],m=null;for(let y of je(e,r)){let h=y.dataset.messageId;if(!h)continue;let g=y.dataset.scrollAnchor==="true",w=g||u?y.getBoundingClientRect():null;(u&&w?w.bottom>c&&w.top<i.bottom:l.has(h))&&d.push(h),g&&w&&w.top<=c+Le&&(m=h)}return d.length===0&&m===null?$e:{currentAnchorId:m,visibleMessageIds:d}}function je(e,t){return Array.from(e.children).filter(n=>n instanceof HTMLElement&&n!==t)}function Rr(e,t){for(let n=t;n<e.length;n++){let r=e[n];if(r?.dataset.scrollAnchor==="true")return r}return null}function wr(e,t){for(let n of e)if(n.dataset.scrollAnchor==="true"&&!t.has(n))return n;return null}function Sr(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 Tr(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor==="true")return n}return null}function Cr({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 jr({align:e,element:t,scrollMargin:n,spacer:r,viewport:o}){let l=_t(t,o),i=t.getBoundingClientRect().height,c=Ar(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,m=o.scrollTop+o.clientHeight-c.end;return l>=d&&u<=m?o.scrollTop:l<d?l-c.start-n:u-o.clientHeight+c.end+n}return l-c.start-n}function _t(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function Pe(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function Nr({content:e,scrollTop:t,spacer:n,viewport:r}){let o=Ze({content:e,spacer:n,viewport:r});return t+r.clientHeight-o}function Ze({content:e,spacer:t,viewport:n}){let r=je(e,t),o=Ot(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 Er(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Ot(e){let t=window.getComputedStyle(e);return{end:We(t.paddingBlockEnd||t.paddingBottom),start:We(t.paddingBlockStart||t.paddingTop)}}function Ar(e){let t=e?.parentElement;return t?Ot(t):{end:0,start:0}}function Ir(e){if(!e)return 0;let t=window.getComputedStyle(e),n=t.rowGap==="normal"?t.gap:t.rowGap;return We(n)}function We(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function kr({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:o,autoScrollRef:l,autoscrollingRef:i,autoscrollingTimeoutRef:c,contentRef:u,defaultScrollPositionAppliedRef:d,itemCountRef:m,messageElementsRef:y,modeRef:h,pendingScrollToMessageRef:g,prependRestoreRef:w,scrollMarginRef:E,scrollPreviousItemPeekRef:v,spacerGapRef:T,spacerHeightRef:H,spacerRef:U,viewportRef:K}=e,z=a.useCallback(R=>{c.current!==null&&(window.clearTimeout(c.current),c.current=null),i.current!==R&&(i.current=R,t()),R&&(c.current=window.setTimeout(()=>{c.current=null,i.current=!1,t()},gr))},[t]),N=a.useCallback(R=>{let S=U.current;if(!S)return;let C=Math.max(0,Math.ceil(R));H.current!==C&&(H.current=C,S.hidden=C===0,S.style.height=`${C}px`,S.style.marginTop=C>0?`${-T.current}px`:"")},[]),L=a.useCallback((R,{behavior:S="auto",autoscrolling:C=!1}={})=>{let O=K.current;if(!O)return;let A=Math.max(0,R);if(Math.abs(O.scrollTop-A)<=Le){O.scrollTop=A,t();return}C&&z(!0),O.scrollTo({top:A,behavior:S}),n()},[t,n,z]),G=a.useCallback(({behavior:R="auto"}={})=>K.current?(N(0),o.current=null,h.current="free-scrolling",L(0,{behavior:R}),r(),!0):!1,[r,L,N]),le=a.useCallback(({behavior:R="auto"}={})=>{let S=K.current;return S?(N(0),o.current=null,h.current=l.current?"following-bottom":"free-scrolling",L(Er(S),{autoscrolling:!0,behavior:R}),r(),!0):!1},[r,L,N]),$=a.useCallback((R,{align:S="start",behavior:C="auto",scrollMargin:O=E.current}={},{keepPreviousPeek:A=!1}={})=>{let Z=u.current,te=K.current;if(!Z||!te||!Z.contains(R))return!1;let re=jr({align:S,element:R,scrollMargin:A?O+v.current:O,spacer:U.current,viewport:te}),se=Nr({content:Z,scrollTop:re,spacer:U.current,viewport:te});return N(se),w.current={element:R,viewportTop:Pe(R,te)},h.current=A?"anchored-to-message":"settling-jump",o.current=A?R:null,L(re,{behavior:C}),r(),!0},[r,L,N]),q=a.useCallback(()=>{let R=o.current;return!R||!R.isConnected||h.current!=="anchored-to-message"?!1:$(R,{align:"start"},{keepPreviousPeek:!0})},[$]),Y=a.useCallback((R,S)=>{let C=y.current.get(R);return C?(d.current=!0,$(C,S)?(g.current=null,!0):(g.current={messageId:R,options:S},!0)):m.current===0?(g.current={messageId:R,options:S},d.current=!0,!0):!1},[$]);return{flushPendingScrollToMessage:a.useCallback(()=>{let R=g.current;if(!R)return!1;let S=y.current.get(R.messageId);return!S||!$(S,R.options)?!1:(g.current=null,d.current=!0,!0)},[$]),reanchorToAnchoredMessage:q,scrollToElement:$,scrollToEnd:le,scrollToMessage:Y,scrollToStart:G}}function Pt(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 _r(e,t){return Pt(e,t)}function Or(){return Pt($e,Mr)}function Pr(e,t){return e.start===t.start&&e.end===t.end}function Mr(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((n,r)=>n===t.visibleMessageIds[r])}function Lr({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),m=a.useRef(null),y=a.useRef(0),h=a.useRef(e?"following-bottom":"free-scrolling"),g=a.useRef(new Map),w=a.useRef(null),E=a.useRef(null),v=a.useRef(null),T=a.useRef(r),H=a.useRef(!0),U=a.useRef(null),K=a.useRef(n),z=a.useRef(null),N=a.useRef(0),L=a.useRef(0),G=a.useRef(null),le=a.useRef(null),$=a.useRef(null),q=a.useRef(null),Y=a.useRef(null),R=a.useRef(null),S=a.useRef(null),C=a.useRef(null),O=a.useRef(new Set),A=a.useRef(new WeakSet);return $.current===null&&($.current=_r(kt,Pr)),C.current===null&&(C.current=Or()),o.current=e,u.current=t,K.current=n,T.current=r,{autoScrollRef:o,autoscrollingRef:l,autoscrollingTimeoutRef:q,streamingTurnRef:v,contentRef:i,defaultScrollPositionAppliedRef:c,firstItemRef:m,itemCountRef:d,lastScrollTopRef:y,messageElementsRef:g,modeRef:h,pendingScrollFrameRef:z,pendingScrollToMessageRef:w,prependRestoreRef:E,preserveScrollOnPrependRef:H,rootRef:U,scrollEdgeThresholdRef:u,scrollMarginRef:K,scrollPreviousItemPeekRef:T,spacerGapRef:N,spacerHeightRef:L,spacerRef:G,stateFrameRef:le,stateStore:$.current,viewportRef:Y,visibilityFrameRef:R,visibilityObserverRef:S,visibilityStore:C.current,visibleMessageIdsRef:O,handledScrollAnchorsRef:A}}function ft(e,t){return a.useCallback(n=>{e.current=n,n&&t()},[e,t])}function $r({autoScroll:e=!1,defaultScrollPosition:t="end",scrollEdgeThreshold:n=pr,scrollPreviousItemPeek:r=mr,scrollMargin:o=hr}){let l=Lr({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:o,scrollPreviousItemPeek:r}),{streamingTurnRef:i,autoScrollRef:c,autoscrollingRef:u,autoscrollingTimeoutRef:d,contentRef:m,defaultScrollPositionAppliedRef:y,firstItemRef:h,itemCountRef:g,lastScrollTopRef:w,messageElementsRef:E,modeRef:v,pendingScrollFrameRef:T,pendingScrollToMessageRef:H,prependRestoreRef:U,preserveScrollOnPrependRef:K,rootRef:z,scrollEdgeThresholdRef:N,scrollMarginRef:L,scrollPreviousItemPeekRef:G,spacerGapRef:le,spacerHeightRef:$,spacerRef:q,stateFrameRef:Y,stateStore:R,viewportRef:S,visibilityFrameRef:C,visibilityObserverRef:O,visibilityStore:A,visibleMessageIdsRef:Z,handledScrollAnchorsRef:te}=l,re=a.useRef(t);re.current!==t&&(re.current=t,y.current=!1);let se=a.useCallback(f=>{let p=z.current,b=S.current,k=[f.start&&"start",f.end&&"end"].filter(Boolean).join(" "),ee=u.current;for(let D of[p,b])D&&(k?D.setAttribute("data-scrollable",k):D.removeAttribute("data-scrollable"),D.toggleAttribute("data-autoscrolling",ee))},[]),ye=a.useCallback(f=>{let p=S.current?.scrollTop??0,b=p<w.current-Le;w.current=p,c.current&&!f.end&&v.current!=="settling-jump"&&v.current!=="anchored-to-message"?v.current="following-bottom":v.current==="following-bottom"&&f.end&&b&&!u.current&&(v.current="free-scrolling")},[]),Q=a.useCallback(()=>{let f=vr({content:m.current,scrollEdgeThreshold:N.current,spacer:q.current,viewport:S.current});ye(f);let p=v.current==="following-bottom"?{...f,end:!1}:f;se(p),R.setSnapshot(p)},[ye,R,se]),ae=a.useCallback(()=>{Y.current===null&&(Y.current=window.requestAnimationFrame(()=>{Y.current=null,Q()}))},[Q]),F=a.useCallback(()=>{A.hasListeners()&&C.current===null&&(C.current=window.requestAnimationFrame(()=>{C.current=null,A.hasListeners()&&A.setSnapshot(yr({content:m.current,scrollMargin:L.current,scrollPreviousItemPeek:G.current,spacer:q.current,viewport:S.current,visibleMessageIds:Z.current}))}))},[A]),{flushPendingScrollToMessage:I,reanchorToAnchoredMessage:M,scrollToElement:V,scrollToEnd:j,scrollToMessage:J,scrollToStart:W}=kr({refs:l,commitScrollState:Q,scheduleStateCommit:ae,scheduleVisibilitySync:F}),B=a.useCallback(()=>{let f=U.current,p=S.current;if(!f||!p||!f.element.isConnected)return!1;let b=Pe(f.element,p)-f.viewportTop;return Math.abs(b)<=Le?!1:(p.scrollTop+=b,f.viewportTop=Pe(f.element,p),ae(),F(),!0)},[ae,F]),X=a.useCallback(()=>{let f=m.current,p=S.current;if(!f||!p){U.current=null;return}let b=Cr({content:f,spacer:q.current,viewport:p});U.current=b?{element:b,viewportTop:Pe(b,p)}:null},[]),pe=a.useCallback(()=>{T.current===null&&(T.current=window.requestAnimationFrame(()=>{T.current=null,I()&&X()}))},[X,I]),ie=a.useCallback(()=>{if(!t||y.current||g.current===0)return!1;let f=!1;if(t==="last-anchor"){let p=m.current,b=S.current,k=p&&b?Tr(je(p,q.current)):null;if(!p||!b||!k)f=j({behavior:"auto"});else{let ee=_t(k,b);f=Ze({content:p,spacer:q.current,viewport:b})-ee<=b.clientHeight?j({behavior:"auto"}):V(k,{align:"start"},{keepPreviousPeek:!0})}}else f=t==="end"?j({behavior:"auto"}):W({behavior:"auto"});return f?(y.current=!0,!0):!1},[t,V,j,W]),Re=a.useCallback(()=>{let f=m.current;if(!f)return;let p=je(f,q.current),b=g.current,k=h.current;g.current=p.length,h.current=p[0]??null,(()=>{if(I())return;if(b===0){if(ie()||p.length>0&&c.current&&j({behavior:"auto"}))return;Q(),F();return}let ee=k?p.indexOf(k):-1;if(K.current&&ee>0){B();return}if(p.length>b){let D=Rr(p,b);if(D){if(c.current&&v.current==="following-bottom"&&Sr(p,b)){j({behavior:"auto"});return}V(D,{align:"start"},{keepPreviousPeek:!0}),te.current.add(D);return}}if(p.length===b){let D=wr(p,te.current);if(D){V(D,{align:"start"},{keepPreviousPeek:!0}),te.current.add(D);return}}v.current==="following-bottom"&&c.current?j({behavior:"auto"}):(Q(),F())})(),X()},[ie,X,Q,I,B,F,V,j]),we=a.useCallback(()=>{if(v.current==="following-bottom"&&c.current){j({behavior:"auto"});return}let f=$.current;if(M()){c.current&&f>0&&$.current===0&&j({behavior:"auto"});return}ae(),F()},[M,ae,F,j]),Se=a.useCallback(()=>{let f=S.current;if(!(!f||!A.hasListeners())){if(typeof IntersectionObserver>"u"){F();return}O.current||(O.current=new IntersectionObserver(p=>{for(let b of p){let k=b.target.dataset.messageId;k&&(b.isIntersecting?Z.current.add(k):Z.current.delete(k))}F()},{root:f,rootMargin:`${-(L.current+G.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]})),E.current.forEach(p=>{O.current?.observe(p)}),F()}},[F,A]),me=a.useCallback(()=>{C.current!==null&&(window.cancelAnimationFrame(C.current),C.current=null),O.current?.disconnect(),O.current=null,Z.current.clear(),A.setSnapshot($e)},[A]),Te=a.useCallback((f,p,b)=>{if(p){E.current.set(f,p),O.current?.observe(p),F(),H.current?.messageId===f&&pe();return}b&&E.current.get(f)===b&&(E.current.delete(f),Z.current.delete(f),O.current?.unobserve(b),F())},[pe,F]),Ie=a.useCallback(()=>{(v.current==="following-bottom"||v.current==="anchored-to-message"||v.current==="settling-jump")&&(i.current=null,v.current="free-scrolling")},[]),ce=a.useCallback(()=>se(R.getSnapshot()),[R,se]),he=ft(z,ce),ue=ft(S,ce),ke=a.useCallback(f=>{m.current=f},[]),Ce=a.useCallback(f=>{q.current=f,le.current=Ir(f?.parentElement??null)},[]),_e=a.useCallback(()=>{Q(),F(),X()},[X,Q,F]),Oe=a.useMemo(()=>({handleContentChange:Re,handleResize:we,observeVisibility:Se,preserveScrollOnPrependRef:K,scrollToEnd:j,scrollToMessage:J,scrollToStart:W,setContentElement:ke,setRootElement:he,setSpacerElement:Ce,setViewportElement:ue,stateStore:R,syncAfterScroll:_e,unobserveVisibility:me,userScrollIntent:Ie,viewportRef:S,visibilityStore:A}),[Re,we,Se,j,J,W,ke,he,Ce,ue,R,_e,me,Ie,A]);return a.useLayoutEffect(()=>{ie()},[ie]),a.useEffect(()=>()=>{Y.current!==null&&(window.cancelAnimationFrame(Y.current),Y.current=null),C.current!==null&&(window.cancelAnimationFrame(C.current),C.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&&v.current==="following-bottom"&&g.current>0){j({behavior:"auto"});return}Q()},[e,Q,j]),{context:Oe,registerMessage:Te}}function Dr(e){let t=a.useRef(e);return t.current=e,t}var Mt=a.createContext(null),Lt=a.createContext(null);function xe(){let e=a.useContext(Mt);if(!e)throw new Error("useMessageScroller must be used within a MessageScroller.");return e}function Ur(){let e=a.useContext(Lt);if(!e)throw new Error("MessageScrollerItem must be used within a MessageScroller.");return e}function $t(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:n}=xe();return a.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:n}),[e,t,n])}function Dt(){let{observeVisibility:e,unobserveVisibility:t,visibilityStore:n}=xe(),r=a.useCallback(o=>n.subscribe(o,e,t),[e,t,n]);return a.useSyncExternalStore(r,n.getSnapshot,n.getSnapshot)}function Fr({autoScroll:e=!1,children:t,defaultScrollPosition:n="end",scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:l}){let{context:i,registerMessage:c}=$r({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:o,scrollMargin:l});return s.jsx(Mt.Provider,{value:i,children:s.jsx(Lt.Provider,{value:c,children:t})})}function Vr({children:e,...t}){let{setRootElement:n}=xe();return s.jsx("div",{ref:n,...t,children:e})}function Br({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:o,onWheel:l,preserveScrollOnPrepend:i=!0,ref:c,role:u,tabIndex:d,...m}){let{handleResize:y,preserveScrollOnPrependRef:h,setViewportElement:g,syncAfterScroll:w,userScrollIntent:E,viewportRef:v}=xe();h.current=i;let T=a.useCallback(N=>{g(N),Ae(c)?.(N)},[c,g]);function H(N){w(),r?.(N)}function U(N){E(),l?.(N)}function K(N){E(),o?.(N)}function z(N){br.has(N.key)&&E(),n?.(N)}return a.useEffect(()=>{let N=v.current;if(!N||typeof ResizeObserver>"u")return;let L=0,G=new ResizeObserver(()=>{window.cancelAnimationFrame(L),L=window.requestAnimationFrame(y)});return G.observe(N),()=>{window.cancelAnimationFrame(L),G.disconnect()}},[y,v]),s.jsx("div",{ref:T,role:u??"region","aria-label":e??"Messages",tabIndex:d??0,onKeyDown:z,onScroll:H,onTouchMove:K,onWheel:U,...m,children:t})}function Hr({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:o,...l}){let{handleContentChange:i,handleResize:c,setContentElement:u,setSpacerElement:d}=xe(),m=a.useRef(null),y=a.useCallback(h=>{m.current=h,u(h),Ae(n)?.(h)},[n,u]);return a.useLayoutEffect(()=>{let h=m.current;if(!h||(i(),typeof MutationObserver>"u"))return;let g=new MutationObserver(()=>{i()});return g.observe(h,{childList:!0}),()=>g.disconnect()},[i]),a.useEffect(()=>{let h=m.current;if(!h||typeof ResizeObserver>"u")return;let g=0,w=new ResizeObserver(()=>{window.cancelAnimationFrame(g),g=window.requestAnimationFrame(c)});return w.observe(h),()=>{window.cancelAnimationFrame(g),w.disconnect()}},[c]),s.jsxs("div",{ref:y,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 zr({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let o=Ur(),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 Wr({behavior:e="smooth",children:t,direction:n="end",onClick:r,render:o,tabIndex:l,type:i="button",...c}){let{scrollToEnd:u,scrollToStart:d,stateStore:m}=xe(),y=Dr(r),h=a.useCallback(v=>m.subscribe(v),[m]),g=a.useCallback(()=>{let v=m.getSnapshot();return n==="start"?v.start:v.end},[n,m]),w=a.useSyncExternalStore(h,g,g),E=a.useCallback(v=>{w&&(y.current?.(v),v.defaultPrevented||(v.currentTarget.blur(),n==="start"?d({behavior:e}):u({behavior:e})))},[e,n,w,y,u,d]);return cr({defaultTagName:"button",props:ze({type:i,inert:!w,tabIndex:w?l:-1,children:t??s.jsxs("span",{children:["Scroll to ",n]}),onClick:E},c),render:o,state:{active:w,direction:n},stateAttributesMapping:{active:v=>({"data-active":v?"true":"false"})}})}var ve={Provider:Fr,Root:Vr,Viewport:Br,Content:Hr,Item:zr,Button:Wr};const Kr=ve.Provider;function qr({className:e,...t}){return s.jsx(ve.Root,{className:P("relative flex size-full min-h-0 flex-col overflow-hidden",e),...t})}function Gr({className:e,...t}){return s.jsx(ve.Viewport,{className:P("size-full min-h-0 overflow-y-auto overscroll-contain [scrollbar-gutter:stable]",e),...t})}function Yr({className:e,...t}){return s.jsx(ve.Content,{className:P("flex h-max min-h-full flex-col",e),...t})}function Qr({className:e,...t}){return s.jsx(ve.Item,{className:P("min-w-0 shrink-0",e),...t})}function Jr({className:e,...t}){return s.jsx(ve.Button,{direction:"end",behavior:"smooth",render:({active:n,...r})=>n?s.jsx(fe,{...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(nn,{})}):null,...t})}function Xr(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 Zr(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 eo="lobu-spa";function pt(e){return typeof e=="string"&&/^https?:\/\//i.test(e.trim())}function De(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 Vo=({afterMessagesContent:e,readOnly:t=!1,readerPositionMode:n="messages",interactionExtension:r,onRunSelect:o})=>{const{messages:l,agentId:i,conversationId:c}=Ee(),{data:u=[]}=rn(i,{conversationId:c});return s.jsx($n,{extension:r,children:s.jsxs("div",{"data-agent-thread":!0,className:"flex min-h-0 flex-1 flex-col",children:[s.jsx(to,{messages:l,trips:u,mode:n,afterMessagesContent:e,onRunSelect:o}),t?null:s.jsx("div",{className:Sn,children:s.jsx(Io,{})})]})})},to=({messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})=>s.jsx(Kr,{autoScroll:!0,defaultScrollPosition:n==="runs"?"last-anchor":"end",scrollPreviousItemPeek:48,children:s.jsx(ro,{messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})});function no(e){if(!e.startsWith("sep:"))return null;const t=Number(e.slice(4));return Number.isFinite(t)&&t>0?t:null}const ro=({messages:e,trips:t,mode:n,afterMessagesContent:r,onRunSelect:o})=>{const{currentAnchorId:l}=Dt(),{scrollToMessage:i}=$t(),c=a.useRef(null);a.useEffect(()=>{if(e.length===0||typeof window>"u")return;const d=Zr({messageIds:e.map(m=>m.id),scrollTarget:Xr(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(qr,{children:[s.jsx(Gr,{"aria-label":n==="runs"?"Automation run history":"Conversation",children:s.jsxs(Yr,{className:P(Ge,Tn),children:[e.map(d=>{const m=n==="runs"&&o?no(d.id):null;return s.jsx(Qr,{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:m!=null?s.jsx(xo,{message:d,onClick:()=>o?.(m)}):s.jsx(ao,{message:d})},d.id)}),t.map(d=>s.jsx(so,{trip:d},d.id)),s.jsx(lo,{}),r?s.jsx("div",{className:"mt-auto shrink-0 py-2",children:r}):null]})}),e.length>0?s.jsx(oo,{messages:e,mode:n}):null,s.jsx(Jr,{})]})},oo=({messages:e,mode:t})=>{const{scrollToMessage:n}=$t(),{currentAnchorId:r,visibleMessageIds:o}=Dt(),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(m=>m.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(fe,{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(fe,{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)})})]})]})},so=({trip:e})=>s.jsxs("div",{className:P(Ge,"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(an,{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]})]}),lo=()=>{const{currentSuggestions:e,starters:t,messages:n,running:r,append:o}=Ee(),l=Kn(e,t,n.length);return r||l.length===0?null:s.jsx(Nn,{prompts:l,className:P(Ge,n.length===0&&"mt-auto"),onPick:i=>o(i)})},ao=({message:e})=>e.role==="user"?s.jsx(io,{message:e}):e.role==="system"?s.jsx(vo,{message:e}):s.jsx(fo,{message:e}),Ut=({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(He,{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})},io=({message:e})=>{const t=e.parts.filter(n=>n.type==="bash");return t.length>0?s.jsx("div",{className:xt,children:s.jsx("div",{className:"space-y-2",children:t.map(n=>s.jsx(co,{part:n},De(e,n)))})}):s.jsx("div",{className:Cn,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(Ut,{attachment:n},n.id))}):null,e.parts.map(n=>n.type==="text"?s.jsx("div",{className:"whitespace-pre-wrap break-words",children:s.jsx(Xe,{text:n.text,renderText:r=>r})},De(e,n)):null)]})})},co=({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]})},Ft=new Set(["question","link-button","tool-approval"]),uo="subscription-candidate",fo=({message:e})=>{const t=Ye(),{agentId:n,workspaceSlug:r}=Ee(),o=u=>u.type==="tool-call"&&(Ft.has(u.toolName)||t?.toolNames.has(u.toolName)),l=e.parts.filter(u=>u.type==="tool-call"&&!o(u)&&u.toolName!==uo),i=e.parts.filter(u=>u.type!=="tool-call"||o(u)),c=e.parts.flatMap(u=>{if(u.type!=="tool-call")return[];const d=Rt(u.result);return d?[d]:[]});return s.jsx("div",{className:xt,children:s.jsxs("div",{className:"space-y-2 text-sm",children:[l.length>0?s.jsx(ho,{tools:l,workspaceSlug:r}):null,n&&r?c.map(u=>s.jsx(po,{candidate:u,agentId:n,workspaceSlug:r},`${u.connector_key}:${u.resource_ref}`)):null,i.map(u=>s.jsx(bo,{part:u},De(e,u))),e.attachments&&e.attachments.length>0?s.jsx("div",{className:"flex flex-wrap gap-2",children:e.attachments.map(u=>s.jsx(Ut,{attachment:u},u.id))}):null]})})},po=({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(fe,{asChild:!0,size:"sm",variant:"outline",className:"shrink-0",children:s.jsxs(gt,{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 mo(e){try{return JSON.parse(e)}catch{return null}}function Vt(e){if(Array.isArray(e)){const o=e.flatMap(l=>l?.type==="text"&&typeof l.text=="string"?Vt(l.text)??[]:[]);return o.length>0?[...new Set(o)]:null}const t=typeof e=="string"&&e.trimStart().startsWith("{")?mo(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 ho=({tools:e,workspaceSlug:t})=>s.jsxs(Nt,{defaultOpen:!1,children:[s.jsx(Et,{children:e.length===1?ot(e[0].args,e[0].toolName)??e[0].toolName:`${e.length} tool calls`}),s.jsx(It,{children:e.map(n=>{const r=ot(n.args,n.toolName),o=n.args!==void 0&&n.args!==null,l=n.result!==void 0&&n.result!==null,i=Vt(n.result);return s.jsxs(At,{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:Fe(n.args)}):null,l?s.jsx("pre",{className:"overflow-x-auto whitespace-pre-wrap break-words text-foreground/80 text-xs",children:Fe(n.result)}):null,i&&t?s.jsx(ir,{ownerSlug:t,eventIds:i}):null]},n.toolCallId)})})]}),go=({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})]})]})]})},bo=({part:e})=>{const t=Ye();return e.type==="reasoning"?s.jsx(lr,{}):e.type==="error"?s.jsx(go,{text:e.text}):e.type==="text"?e.text.trim()?s.jsx(Xe,{text:e.text,renderText:n=>s.jsx(gn,{text:n})}):null:e.type!=="tool-call"?null:Ft.has(e.toolName)||t?.toolNames.has(e.toolName)?s.jsx(Ao,{toolName:e.toolName,args:e.args}):null},xo=({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"})},vo=({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(Xe,{text:t.text,renderText:n=>n})},De(e,t)):null)})}),yo="/mcp-apps/interaction/index.html";function mt(e){return new Promise(t=>{e({onSettled:(n,r)=>t(!!r)})})}const Ro=({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 m=new yn(null,{name:"Lobu",version:"1.0.0"},{openLinks:{},serverTools:{}},{hostContext:{theme:document.documentElement.classList.contains("dark")?"dark":"light",displayMode:"inline",platform:"web"}});m.addEventListener("sizechange",({height:g})=>{typeof g=="number"&&c(Math.max(32,Math.ceil(g)))}),m.oncalltool=async({name:g,arguments:w})=>{const E=await u.current.onToolCall(g,w??{});return{isError:E,content:[{type:"text",text:E?"Action failed.":"Action completed."}]}},m.onopenlink=async({url:g})=>({isError:await u.current.onOpenLink(g)}),m.addEventListener("initialized",()=>{(async()=>(await m.sendToolInput({arguments:{}}),await m.sendToolResult({content:[],structuredContent:{...u.current.renderPayload,version:1,source:eo}})))()});const y=new Rn(d.contentWindow,d.contentWindow);m.connect(y).catch(g=>{console.error("[mcp-app-host] failed to initialize",g)});const h=new MutationObserver(()=>{m.setHostContext({theme:document.documentElement.classList.contains("dark")?"dark":"light",displayMode:"inline",platform:"web"})});return h.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>{h.disconnect(),y.close()}},[]),s.jsx("iframe",{ref:l,title:t,src:e,sandbox:"allow-scripts",style:{width:"100%",height:i,border:"none",display:"block"}})},wo=new Set(["action"]),So=["name","description","identity_md"];function oe(e){return e==null||e===""?"":typeof e=="string"?e:Fe(e)}function ht(e){return e===null?"(cleared)":e===void 0?"":typeof e=="string"?e===""?"":e:Fe(e)}function Ue(e){return e.length>0?e[0].toUpperCase()+e.slice(1):e}const Bt=new Set(["delete","disconnect","remove","remove_rule","reset","revoke"]);function Ke(e){return e&&Bt.has(e)?"warning":"default"}function qe(e,t){return e&&Bt.has(e)?{level:"high",reason:t}:{level:"normal"}}function To(e,t){const n=e.attribution==="automation"?"An Automation":"An agent",r=Object.keys(t),o=r.map(l=>({label:l,before:oe(e.current?.[l]),after:oe(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 Co(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=>!wo.has(i)&&o[i]!==void 0).map(i=>({label:i,...e.action==="update"&&e.current?.[i]!==void 0?{before:ht(e.current?.[i])}:{},after:ht(o[i])}));return r.push(l.length>0?{type:"diff",fields:l}:{type:"text",value:"No field changes.",muted:!0}),{title:`${Ue(t)} Automation ${n}`,icon:"automation",impact:qe(e.action,"This archives the Automation and stops future runs."),tone:Ke(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 jo(e){if(e.resourceKind==="automation")return Co(e);if(e.fields&&Object.keys(e.fields).length>0)return To(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 Mn({...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&&oe(e.proposal?.[d])!==oe(e.current?.[d])).map(d=>({label:d,...e.action==="update"?{before:oe(e.current?.[d])}:{},after:oe(e.proposal?.[d])}));c.push(u.length>0?{type:"diff",fields:u}:{type:"text",value:"No field changes.",muted:!0})}return{title:`${Ue(i)} entity ${l}`,icon:"entity",impact:qe(e.action,"This deletes the entity."),tone:Ke(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=So.filter(i=>e.proposal?.[i]!==void 0&&oe(e.proposal?.[i])!==oe(e.current?.[i])).map(i=>({label:i,...e.action==="update"?{before:oe(e.current?.[i])}:{},after:oe(e.proposal?.[i])}));o.push(l.length>0?{type:"diff",fields:l}:{type:"text",value:"No field changes.",muted:!0})}return{title:`${Ue(r)} agent ${n}`,icon:"agent",impact:qe(e.action,"This permanently deletes the agent and its configuration."),tone:Ke(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 No(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 Eo(e,t){return{tone:"bare",actions:[{id:"open",label:e.label??"Open link",variant:"outline",icon:"external",terminal:!1,href:t}]}}const Ao=({toolName:e,args:t})=>{const n=xn(),r=vn(),{append:o}=Ee(),l=Ye(),i=t??{},c=l?.resolve(e,t)??null;let u=c?.view??null;const d={...c?.handlers??{}},m=new Set;if(!c){if(e==="tool-approval"&&typeof i.runId=="number"&&Number.isSafeInteger(i.runId)&&i.runId>0){const y=i.runId,h=typeof i.status=="string"?i.status:"pending",g=h==="pending",w=jo(i),E=h==="confirmed"?"Approved":Ue(h);u=g?w:{...w,title:`${w.title??"Approval"} · ${E}`,tone:h==="failed"?"warning":"default",blocks:[...w.blocks??[],{type:"text",value:typeof i.reviewedByName=="string"?`${h==="rejected"?"Rejected":"Approved"} by ${i.reviewedByName}.`:`${E}.`,muted:!0}],actions:(w.actions??[]).filter(v=>v.terminal===!1)},g&&(d.manage_operations=v=>{if(v.action==="approve")return mt(T=>n.mutate({run_id:y},T));if(v.action==="reject"){const T=typeof v.reason=="string"?v.reason:void 0;return mt(H=>r.mutate({run_id:y,...T?{reason:T}:{}},H))}return Promise.resolve(!0)})}else if(e==="question"){const y=Array.isArray(i.options)?i.options.filter(h=>typeof h=="string"):[];u=No(i),d.answer_question=h=>{const g=typeof h.answer=="string"?h.answer:"";return y.includes(g)?(o(g),Promise.resolve(!1)):Promise.resolve(!0)}}else if(e==="link-button"){if(!pt(i.url))return null;const y=i.url;m.add(y),u=Eo(i,y)}}return u?s.jsx(Ro,{src:yo,title:u.title??"Interaction",renderPayload:u,onToolCall:(y,h)=>d[y]?d[y](h):Promise.resolve(!0),onOpenLink:y=>!m.has(y)||!pt(y)?Promise.resolve(!0):(window.open(y,"_blank","noopener,noreferrer"),Promise.resolve(!1))}):null};function Fe(e){try{return JSON.stringify(e,null,2)}catch{return String(e)}}const Io=()=>{const{running:e,append:t,cancel:n,pendingAttachments:r,addAttachments:o,removeAttachment:l,initialDraft:i,currentSuggestions:c}=Ee(),u=ko({suggestions:e?null:c}),[d,m]=a.useState(i??""),y=a.useRef(null),h=a.useRef(null),g=_n(On),w=a.useRef(i??"");a.useEffect(()=>{const T=i??"";if(T===w.current)return;const H=w.current;w.current=T,T!==""&&m(U=>U===""||U===H?T:U)},[i]);const E=a.useRef(d);E.current=d;const v=()=>{e||(t(E.current),m(""),h.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(He,{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(on,{className:"h-3 w-3"})})]},T.id))}):null,s.jsx(Pn,{value:d,onChange:m,onSubmit:v,searchRefs:g,handleRef:h,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:y,type:"file",multiple:!0,className:"hidden",onChange:T=>{T.target.files&&o(T.target.files),T.target.value=""}}),s.jsxs(fe,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 rounded-full text-muted-foreground hover:text-foreground",onClick:()=>y.current?.click(),children:[s.jsx(He,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Attach files"})]}),e?s.jsxs(fe,{type:"button",size:"icon",variant:"secondary",className:"h-8 w-8 rounded-full",onClick:n,children:[s.jsx(sn,{size:"lg"}),s.jsx("span",{className:"sr-only",children:"Cancel"})]}):s.jsxs(fe,{type:"button",size:"icon",className:"h-8 w-8 rounded-full",onClick:v,children:[s.jsx(ln,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Send message"})]})]})]})};function ko({suggestions:e}){const t=e?.find(n=>n.message.trim().length>0)?.message;return t?`Recommended: ${t.trim()}`:"Chat… (@ to mention, / for commands)"}export{Vo as A,Fo as L,Uo as R,er as h,Qn as s};
|
|
6
|
+
//# sourceMappingURL=agent-thread-WNk2HapT.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as I,w as M,q as L,at as N,bb as w,r as O,hI as R,hJ as W,c5 as E,hK as _,hL as D,j as t,ak as B,al as y,gS as F,L as f,gT as k,O as G,i as U,v as P,eP as q,aq as K}from"./index-DdBTTN3y.js";import{A as z}from"./agent-editor-form-CdA5vLr8.js";import{P as H}from"./proposal-review-shell-D6KABxah.js";import{n as J}from"./nav-pill-DrFkuyUQ.js";const b=[{key:"skills",label:"Skills",icon:R},{key:"guardrails",label:"Guardrails",icon:W},{key:"permissions",label:"Permissions",icon:E,adminOnly:!0},{key:"models",label:"Models",icon:_},{key:"settings",label:"Settings",icon:D}];function T(s){return b.filter(e=>!e.adminOnly||s)}function Q(s,e){if(e===`${s}/conversations`||e.startsWith(`${s}/conversations/`))return null;for(const{key:n}of b)if(e===`${s}/${n}`||e.startsWith(`${s}/${n}/`))return n;return e===`${s}/identity`||e===`${s}/identity/`?"settings":null}function V(s){return s.trim().charAt(0).toUpperCase()||"?"}function X({owner:s,agentId:e,agentName:n,activeDest:a}){const{orgContext:r}=P(),{isAdmin:l}=q(r.organizationId),c=T(!!l);return t.jsxs("div",{className:"flex shrink-0 flex-col items-center gap-2",children:[t.jsxs(f,{to:"/$owner/agents/$agentId/settings",params:{owner:s,agentId:e},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:[t.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:V(n)}),t.jsx("h1",{className:"min-w-0 truncate text-base font-semibold tracking-tight",children:n})]}),t.jsx("nav",{"aria-label":"Agent sections",className:"flex min-w-0 max-w-full flex-wrap items-center justify-center gap-1",children:c.map(({key:d,label:u,icon:g})=>{const o=d===a;return t.jsxs(f,{to:`/$owner/agents/$agentId/${d}`,params:{owner:s,agentId:e},"aria-current":o?"page":void 0,className:J(o,"shrink-0 gap-1.5 px-2.5 py-1 text-sm"),children:[t.jsx(g,{className:"h-3.5 w-3.5 shrink-0"}),u]},d)})})]})}function ns({owner:s,agentId:e}){const n=I(),{pathname:a}=M(),{isAuthenticated:r}=L(),{isMember:l}=N(),c=r&&l,{data:d=[],isLoading:u}=w({enabled:c}),g=d.find(A=>A.agentId===e)??null,o=!g&&!u&&c,m=`/${s}/agents/${e}`,x=`${m}/conversations`,h=a===x||a.startsWith(`${x}/`),i=Q(m,a);O.useEffect(()=>{o&&n({to:"/$owner",params:{owner:s},replace:!0})},[o,n,s]);const v=g?.name??"Agent",j=b.find(A=>A.key===i)?.label??"Conversations",p=a.slice(m.length+1).split("/")[1],C=i==="settings"&&!p,S=C?v:p?p==="create"?i==="skills"?"Add a skill":"New custom guardrail":i==="skills"?"Skill details":i==="guardrails"?"Guardrail details":"Conversation":j;return t.jsxs(B,{className:"gap-3 overflow-hidden pt-2.5 pb-8",children:[t.jsx(y,{children:t.jsx(F,{crumbs:[t.jsx(f,{to:"/$owner/agents",params:{owner:s},className:k,children:"Agents"},"agents"),...C?[]:[t.jsx(f,{to:"/$owner/agents/$agentId/settings",params:{owner:s,agentId:e},search:{run_id:void 0},className:k,children:v},"agent")],...p&&i?[t.jsx(f,{to:`/$owner/agents/$agentId/${i}`,params:{owner:s,agentId:e},className:k,children:j},"section")]:[]],current:S})}),t.jsx(X,{owner:s,agentId:e,agentName:v,activeDest:i}),t.jsx("div",{className:U("flex min-h-0 min-w-0 flex-1 flex-col",h?"overflow-hidden":"overflow-y-auto"),children:t.jsx(G,{})})]})}function Y({agent:s,tab:e,runId:n}){return t.jsx(y,{className:"pb-6",children:t.jsx(H,{resource:{kind:"agent",agentId:s.agentId},runId:n,children:({reviewMode:a,proposal:r,controlsDisabled:l})=>t.jsx(z,{mode:{kind:"edit",agent:s},section:e,reviewMode:a,reviewProposal:r,reviewControlsDisabled:l},s.agentId)})})}function as({owner:s,agentId:e,tab:n,runId:a}){const{orgContext:r,hasOrgContext:l}=P(),{isLoading:c}=K(`/${s}`,r),{isAuthenticated:d}=L(),{isMember:u,isLoading:g}=N(),o=d&&u,{data:m=[],isLoading:x}=w({enabled:o}),$=o?!l||c||x||g:c||g,h=m.find(i=>i.agentId===e)??null;return $||!h?null:t.jsx(Y,{agent:h,tab:n,runId:a})}export{ns as A,as as a};
|
|
2
|
+
//# sourceMappingURL=agents-workbench-bPTjdVS1.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as c,iE as b,aW as w,aG as y,b7 as C,aJ as u,j as e,al as k,L as i,gu as j,B as v,gt as A,iQ as P,gr as g,gR as R,gS as B,gT as D,A as $,Y as E,fo as I,iR as L,az as M}from"./index-DdBTTN3y.js";import{C as z}from"./connector-page-shell-Cs1SjrYB.js";import{C as O}from"./connections-browser-V-3td9DB.js";import"./connection-label-BobuYiAG.js";import"./status-dot-Cpq63I7p.js";function T({ownerSlug:s,appId:r}){const n=c.useMemo(()=>b(s,r,w()),[s,r]),{data:a=[],isLoading:l,isError:d,refetch:N}=y(),[m,x]=c.useMemo(()=>{const t=n?.devicePlatforms;if(!t?.length)return[[],[]];const h=a.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,a,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(z,{header:e.jsx(R,{breadcrumb:e.jsx(B,{crumbs:[e.jsx(i,{to:"/$owner/connectors",params:{owner:s},search:{},className:D,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?r==="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(_,{step:t},t.label))})})}),p?e.jsx(O,{entries:m.map(t=>({id:t.id,name:g(t),description:P(t,s),tone:t.online?null:"muted",link:A({to:"/$owner/connectors/device/$deviceId",params:{owner:s,deviceId:t.id}})})),isLoading:l,isError:d,onRetry:()=>void N(),action:e.jsx(v,{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:g(t)}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Attached to"," ",t.organization_name??"another workspace"]})]})},t.id))})]}):null]})})}function _({step:s}){const[r,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 a=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:a}),e.jsxs(v,{variant:"ghost",size:"sm",className:"h-6 shrink-0 px-1.5 text-xs",onClick:()=>{typeof navigator>"u"||!navigator.clipboard||navigator.clipboard.writeText(a).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},children:[r?e.jsx(E,{className:"h-3.5 w-3.5"}):e.jsx(I,{className:"h-3.5 w-3.5"}),e.jsx("span",{className:"sr-only",children:"Copy"})]})]})]})}function J(){const{owner:s,appId:r}=L.useParams();return e.jsx(M,{owner:s,children:({ownerSlug:n})=>e.jsx(T,{ownerSlug:n,appId:r})})}export{J as component};
|
|
2
|
+
//# sourceMappingURL=app._appId-DrL5H5lB.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as b,bb as k,r as o,jp as v,j as e,L as x,B as M,jq as P,cx as S}from"./index-DdBTTN3y.js";import{u as y,a as R,M as C}from"./use-mention-search-dn3ws1WB.js";import{P as I,s as A}from"./pending-seed-sml8Uf6e.js";import{n as E}from"./agent-thread-storage-U6htL3ad.js";import"./index-Vcq4gwWv.js";import"./use-automations-BLNjxq2K.js";function $({ownerSlug:i,starters:m,preferredMentionKinds:u,onSent:f}){const g=b(),{data:j=[]}=k(),l=y(C),n=o.useMemo(()=>new Set(u??[]),[u]),N=o.useCallback(async d=>{const t=await l(d);return n.size===0?t:[...t].sort((a,w)=>Number(n.has(w.kind))-Number(n.has(a.kind)))},[n,l]),r=v(j),[s,h]=o.useState(""),p=o.useRef(s);p.current=s;const c=d=>{const t=d.trim();if(!t||!r)return;const a=E();A(a,t),h(""),g(S(i,r.agentId,a)),f?.()};return e.jsxs("div",{className:"rounded-lg border bg-background p-4 transition-colors focus-within:ring-1 focus-within:ring-ring",children:[r?e.jsx(R,{value:s,onChange:h,onSubmit:()=>c(p.current),searchRefs:N,placeholder:"Ask Lobu…",className:"[&_.ProseMirror]:max-h-40 [&_.ProseMirror]:min-h-24 [&_.ProseMirror]:overflow-y-auto"}):e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Bring your"," ",e.jsx(x,{to:"/$owner/agents/connect",params:{owner:i},className:"text-foreground hover:underline",children:"agent"})," ","or"," ",e.jsx(x,{to:"/$owner/agents/new",params:{owner:i},search:{},className:"text-foreground hover:underline",children:"create a new agent"})," ","to get started."]}),e.jsxs("div",{className:"flex items-end justify-between gap-3 pt-2",children:[r&&m&&!s.trim()?e.jsx(I,{prompts:m,onPick:c}):e.jsx("span",{}),e.jsxs(M,{type:"button",size:"icon",className:"h-10 w-10 shrink-0 rounded-full",disabled:!r||!s.trim(),onClick:()=>c(s),children:[e.jsx(P,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Send message"})]})]})]})}export{$ as AssistComposer};
|
|
2
|
+
//# sourceMappingURL=assist-composer-ClfFEVx7.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{v as y,j as n,L as N,cp as b,aq as S,q as w,at as R,r as h,cP as O,u as T,hz as $,S as D,cQ as E,bN as F}from"./index-DdBTTN3y.js";import{C as L,A as P}from"./create-automation-form-PEmSLMD6.js";import{P as J}from"./proposal-review-shell-D6KABxah.js";import{E as q}from"./events-feed-B9CZHI_P.js";import{J as M}from"./json-diff-BaLL4Fsu.js";import{b as v}from"./use-automations-BLNjxq2K.js";import{b as B}from"./model-jL871x2J.js";function j({automationId:i}){const{currentOwner:t}=y();return t?n.jsx(N,{to:"/$owner/events",params:{owner:t},search:b({semanticTypes:["change"],eventCategory:"config",resourceKind:"automation",resourceId:i}),className:"text-sm text-primary underline underline-offset-4",children:"View definition history in Events"}):null}function k(i){const{orgContext:t,hasOrgContext:r}=y(),{data:o,isLoading:a}=S(`/${i}`,t),{isAuthenticated:d}=w(),{isMember:u,isLoading:c}=R(),m=d&&u,s=o?.workspace,f=m?!r||a||c:a||c;return{organizationId:s?.id??"",isLoading:f}}function Y(i){return k(i)}function H({owner:i,automationId:t,organizationId:r}){const o=Number(t),a=h.useMemo(()=>({producedByAutomationId:o}),[o]),d=T(),u=v(t,void 0,r),c=u.data?.automation?.automation_name?.trim()||null,m=B(u.data?.automation),{data:s}=$(m,t,{orgSlug:i}),f=h.useMemo(()=>(s?.runs??[]).map(e=>({runId:e.runId,status:e.status,completedAt:e.completedAt})),[s]),p=h.useCallback(e=>{d?.open({href:`/${i}/automations/${t}?view=activity&run_id=${e}`,title:c!=null?`${c} · Run #${e}`:`Automation run #${e}`,runId:e})},[d,i,t,c]);return Number.isFinite(o)?n.jsx(q,{organizationId:r,ownerSlug:i,filters:a,groupByRun:!0,onRunSelect:p,runs:f,hideRunAction:!0,hideAttribution:!0,emptyState:n.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 K({agentId:i,automationId:t,runId:r,organizationId:o,onDone:a}){const[d,u]=h.useState({ready:!1,triggers:[]}),c=h.useCallback(l=>{u(g=>JSON.stringify(g)===JSON.stringify(l)?g:l)},[]),m=v(t,void 0,o,{includeVersions:!0}),s=m.data?.automation,{currentOwner:f}=y(),p=O({queryKey:["automations-list",f,"editor",t,s?.status],enabled:!!f&&!!o&&!!s,queryFn:async()=>{const g=(await E("manage_automations",{action:"list",automation_id:t,status:s?.status,include_details:!0,limit:1},{slug:f})).automations.find(C=>C.automation_id===t);if(!g)throw new F("Automation not found",404);return g},staleTime:3e4}),e=p.data,x=h.useMemo(()=>s&&e?{automation_id:s.automation_id,name:e.name,slug:e.slug,description:e.description,prompt:e.prompt,sources:e.sources,reaction_script:s.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,model_config:e.model_config,tags:e.tags,keying_config:s.keying_config,reactions_guidance:e.reactions_guidance,triggers:e.triggers}:void 0,[s,e]),_=n.jsx("div",{className:"flex flex-col gap-4",children:[0,1,2].map(l=>n.jsx(D,{className:"h-16 w-full rounded-lg"},l))}),A=p.isError?n.jsxs("div",{role:"alert",className:"space-y-2 text-sm",children:[n.jsx("p",{children:"Could not load the saved Automation definition."}),n.jsx("button",{type:"button",className:"text-primary underline underline-offset-4",onClick:()=>void p.refetch(),children:"Retry"})]}):m.isLoading||s&&p.isPending?_:x?n.jsx(L,{organizationId:o,prefillAgentId:i??void 0,editingAutomation:x,createFields:{triggers:d.triggers},triggerFields:n.jsx(P,{organizationId:o,initialTriggers:x.triggers??[],onChange:c},JSON.stringify(x.triggers??[])),hideHeader:!0,hideCancel:!0,submitDisabled:!d.ready,onClose:a}):n.jsx("p",{className:"text-sm text-muted-foreground",children:"Automation not found. It may have been removed."});return i?n.jsxs("div",{className:"space-y-6",children:[n.jsx(J,{resource:{kind:"automation",agentId:i,automationId:t},runId:r,onDone:a,children:({reviewMode:l,proposal:g})=>l==="active"?n.jsx(M,{before:g?.current??null,after:{...g?.current??{},...g?.proposedAfter??{}}}):l==="loading"?_:l==="error"?null:A}),n.jsx(j,{automationId:t})]}):n.jsxs("div",{className:"space-y-6",children:[A,n.jsx(j,{automationId:t})]})}function Z({owner:i,agentId:t,automationId:r,view:o,runId:a,onDone:d}){const{organizationId:u}=k(i),c=v(r,void 0,u),m=t??c.data?.automation?.managed_agent_id??null;return a||o==="definition"?n.jsx(K,{agentId:m,automationId:r,runId:a,organizationId:u,onDone:d},`${i}/${r}`):n.jsx(H,{owner:i,automationId:r,organizationId:u})}export{Z as A,Y as u};
|
|
2
|
+
//# sourceMappingURL=automation-detail-content-dFy1Huas.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{fp as b,fq as g,cL as k,j as e,L as j,V as r,b8 as y,W as C,fr as d,fs as A,d1 as $,e5 as p,eq as M,ct as I}from"./index-DdBTTN3y.js";const m="bg-muted text-muted-foreground",R={event:{label:"Event",icon:k},schedule:{label:"Schedule",icon:g},manual:{label:"Manual",icon:b}};function S({agentName:n,deviceLabel:t,executorKind:i}){const s=i==="script"?{label:"Script",icon:d}:i==="external"?{label:"External executor",icon:d}:t?{label:t,icon:A}:n?{label:n,icon:$}:{label:"Manual · any client",icon:d},{label:l,icon:c}=s;return e.jsxs(r,{variant:"secondary",className:m,children:[e.jsx(c,{className:"h-3 w-3"}),l]})}function E({lastRunAt:n,nextRunAt:t,repliesToSource:i}){const s=n?`Ran ${p(n)}`:t?`Next run ${p(t)}`:i?"Replies to incoming messages":"Never run";return e.jsxs(r,{variant:"secondary",className:m,children:[e.jsx(M,{className:"h-3 w-3"}),s]})}function L({count:n}){return n<=0?null:e.jsxs(r,{variant:"secondary",className:m,children:[e.jsx(I,{className:"h-3 w-3"}),n," ",n===1?"client":"clients"]})}function B({automation:n,agentName:t,deviceLabel:i,connectorDisplay:s,owner:l,actions:c,rowClass:v,appearance:N="row"}){const a=n.automation,o=a.execution_config?.executor,_=o&&typeof o=="object"?o.kind:void 0,u=a.automation_id,x=R[n.kind],w=a.entity_name&&a.entity_type?`${a.entity_name} · ${a.entity_type}`:null,h=[n.when,w].filter(Boolean).join(" — "),f=a.health==="degraded"?a.health_reasons?.[0]||"Needs attention":null;return N==="inline"?e.jsxs(j,{to:"/$owner/automations/$automationId",params:{owner:l,automationId:u},search:{view:"definition",run_id:void 0},className:"inline-flex items-center gap-1.5 rounded-md bg-accent px-1.5 py-0.5 text-sm font-medium",children:[e.jsx(x.icon,{className:"h-3.5 w-3.5 shrink-0"}),n.does,a.status==="archived"?e.jsx(r,{variant:"outline",children:"Archived"}):null]}):e.jsxs("div",{className:v,children:[e.jsxs(j,{to:"/$owner/automations/$automationId",params:{owner:l,automationId:u},search:{view:"definition",run_id:void 0},className:"flex min-w-0 flex-1 items-center gap-3",children:[s?e.jsx(y,{icon:s.icon,iconUrl:s.iconUrl,name:s.name,faviconDomain:s.faviconDomain,className:"h-7 w-7 shrink-0 rounded-md text-[10px]"}):e.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md border",children:e.jsx(x.icon,{className:"h-3.5 w-3.5 text-muted-foreground"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium",children:n.does}),a.status==="archived"?e.jsx(r,{variant:"outline",children:"Archived"}):null,e.jsx(S,{agentName:t,deviceLabel:i,executorKind:_}),e.jsx(E,{lastRunAt:a.last_run_completed_at??a.last_fired_at??null,nextRunAt:a.next_run_at??null,repliesToSource:n.output.destination==="source"}),e.jsx(L,{count:a.processing_client_count??0}),f?e.jsxs(r,{variant:"secondary",className:"max-w-full whitespace-normal bg-amber-500/10 text-left text-amber-700 dark:text-amber-400",children:[e.jsx(C,{className:"h-3 w-3 shrink-0"}),f]}):null]}),h?e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:h}):null]})]}),c]})}export{B as A};
|
|
2
|
+
//# sourceMappingURL=automation-row-DCHM--aD.js.map
|