@lobu/runtime-server 20.2.0 → 21.0.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/component.json +1 -1
- package/dist/connectors/README.md +15 -16
- package/dist/connectors/github.ts +15 -9
- package/dist/connectors/google_calendar.ts +21 -31
- package/dist/connectors/google_drive.ts +106 -131
- package/dist/connectors/google_gmail.ts +53 -30
- package/dist/connectors/hackernews.ts +2 -5
- package/dist/connectors/jira.ts +62 -27
- package/dist/connectors/linear.ts +55 -21
- package/dist/connectors/microsoft_outlook.ts +151 -110
- package/dist/connectors/postgres.ts +19 -11
- package/dist/connectors/producthunt.ts +8 -6
- package/dist/connectors/reddit.ts +2 -2
- package/dist/connectors/rss.ts +2 -2
- package/dist/connectors/whatsapp_web.ts +5 -4
- package/dist/connectors/x.ts +32 -17
- package/dist/connectors/youtube.ts +18 -5
- package/dist/db/migrations/20260917000000_views.sql +271 -0
- package/dist/db/migrations/20260917000001_views_attach_index.sql +14 -0
- package/dist/db/migrations/20260918000000_runs_turn_tool_event_uniq.sql +51 -0
- package/dist/db/migrations/20260923230000_runs_connector_artifact_hash.sql +32 -0
- package/dist/db/migrations/20260924000000_resource_source_files.sql +17 -0
- package/dist/dependencies.bun.lock +109 -98
- package/dist/guest.bundle.js +78 -10
- package/dist/owletto/dist/assets/_-CwFknmeA.js +1 -0
- package/dist/owletto/dist/assets/_-DrcppoWh.js +2 -0
- package/dist/owletto/dist/assets/_agentId-Cr57JKYx.js +1 -0
- package/dist/owletto/dist/assets/_agentId-HNcmgH56.js +1 -0
- package/dist/owletto/dist/assets/_automationId-BCfrLnUS.js +1 -0
- package/dist/owletto/dist/assets/{_connectorKey._connectionId-BAJGfcy7.js → _connectorKey._connectionId-126-iG9w.js} +1 -1
- package/dist/owletto/dist/assets/{_connectorKey.index-BBF8vGJS.js → _connectorKey.index-CywE9A3N.js} +1 -1
- package/dist/owletto/dist/assets/_conversationId-CNETA_rY.js +1 -0
- package/dist/owletto/dist/assets/_deploymentId-CAVpXf8s.js +1 -0
- package/dist/owletto/dist/assets/_name-BP7OlVxL.js +1 -0
- package/dist/owletto/dist/assets/_owner-D2eh4R90.js +1 -0
- package/dist/owletto/dist/assets/_shape-BqV8tSfw.js +1 -0
- package/dist/owletto/dist/assets/_skillKey-2xTjhL_C.js +1 -0
- package/dist/owletto/dist/assets/_slug-DoIaJBbh.js +1 -0
- package/dist/owletto/dist/assets/_viewKey-8ePnWEg-.js +1 -0
- package/dist/owletto/dist/assets/_viewKey-D8rjUFLV.js +1 -0
- package/dist/owletto/dist/assets/_viewKey-DhVOkzYd.js +1 -0
- package/dist/owletto/dist/assets/accept-invitation-BWRiEUsd.js +1 -0
- package/dist/owletto/dist/assets/activity-route-view-rVdTeVXN.js +1 -0
- package/dist/owletto/dist/assets/{agent-card-controls-CZO6GI0s.js → agent-card-controls-JubkhcHt.js} +1 -1
- package/dist/owletto/dist/assets/{agent-client-setup-list-_chLOorY.js → agent-client-setup-list-Btcy4Cu1.js} +1 -1
- package/dist/owletto/dist/assets/{agent-connect-pages-DWBgSIYT.js → agent-connect-pages-Chfqn8iL.js} +1 -1
- package/dist/owletto/dist/assets/{agent-editor-form-BTNlg0kQ.js → agent-editor-form-BrOkwfg8.js} +1 -1
- package/dist/owletto/dist/assets/{agent-guardrails-route-B5uoMC6o.js → agent-guardrails-route-CHM7JbIl.js} +1 -1
- package/dist/owletto/dist/assets/{agent-loading-shells-CLoLeFcB.js → agent-loading-shells-DsiGx1fn.js} +1 -1
- package/dist/owletto/dist/assets/{agent-permissions-matrix-TP00-MYL.js → agent-permissions-matrix-L_gFvSu1.js} +1 -1
- package/dist/owletto/dist/assets/{agent-skill-context-D4a2QCoZ.js → agent-skill-context-D7tOJ8Pb.js} +1 -1
- package/dist/owletto/dist/assets/{agent-skills-route-KVDDTbJB.js → agent-skills-route-AylS-B9v.js} +1 -1
- package/dist/owletto/dist/assets/{agent-subpage-shell-DuVYZvBE.js → agent-subpage-shell-B7tCQ9zd.js} +1 -1
- package/dist/owletto/dist/assets/agent-thread-DOYh7WLW.js +8 -0
- package/dist/owletto/dist/assets/agents-0ncYwbz6.js +1 -0
- package/dist/owletto/dist/assets/agents-workbench-DOwn78eL.js +1 -0
- package/dist/owletto/dist/assets/app-bridge-BH3g2mKG.js +127 -0
- package/dist/owletto/dist/assets/{app._appId-D0_LQTJU.js → app._appId-fJ_RRn1Z.js} +1 -1
- package/dist/owletto/dist/assets/automation-detail-content-CMprQht5.js +1 -0
- package/dist/owletto/dist/assets/automations-0ncYwbz6.js +1 -0
- package/dist/owletto/dist/assets/{calendar-C0XpOHd8.js → calendar-BbD1N97u.js} +1 -1
- package/dist/owletto/dist/assets/{callback-CO_K9eR-.js → callback-PELM84Lh.js} +1 -1
- package/dist/owletto/dist/assets/{card-DeFQuU_J.js → card-DpLjEqIc.js} +1 -1
- package/dist/owletto/dist/assets/{claim-CUpWOSie.js → claim-BLLvLOBM.js} +1 -1
- package/dist/owletto/dist/assets/clients-Bd8WpHSV.js +1 -0
- package/dist/owletto/dist/assets/{code-editor-BqGUZFt6.js → code-editor-DGJQDoHD.js} +1 -1
- package/dist/owletto/dist/assets/connect-Cx49f4J0.js +1 -0
- package/dist/owletto/dist/assets/connect._clientId-BDFBqKSA.js +1 -0
- package/dist/owletto/dist/assets/connected._clientId-BYGmFRCF.js +1 -0
- package/dist/owletto/dist/assets/{connection-BgAlYjeV.js → connection-B0O8OZuK.js} +1 -1
- package/dist/owletto/dist/assets/{connection-feed-detail-B3ePAinf.js → connection-feed-detail-DZjtoEfm.js} +1 -1
- package/dist/owletto/dist/assets/{connector-provenance-DgsDg0Z9.js → connector-provenance-D_g9gGXU.js} +1 -1
- package/dist/owletto/dist/assets/{connectors-CqPQPo9U.js → connectors-BiMMm_QQ.js} +1 -1
- package/dist/owletto/dist/assets/{consent-bswcIzsf.js → consent-CIzW-960.js} +1 -1
- package/dist/owletto/dist/assets/{core.esm-DsLgjoel.js → core.esm-Ds4Nuq9d.js} +1 -1
- package/dist/owletto/dist/assets/create--fsxroj2.js +1 -0
- package/dist/owletto/dist/assets/create-BqL-ahEf.js +1 -0
- package/dist/owletto/dist/assets/{create-Dwo04oWV.js → create-BvCaqhwK.js} +1 -1
- package/dist/owletto/dist/assets/create-automation-form-DN2w080o.js +2 -0
- package/dist/owletto/dist/assets/{create._connectorKey-CCBb2pil.js → create._connectorKey--qDi1h6S.js} +1 -1
- package/dist/owletto/dist/assets/{cronstrue-ChFyC9ps.js → cronstrue-h8_zIyZD.js} +1 -1
- package/dist/owletto/dist/assets/deployments-BROg1Te8.js +1 -0
- package/dist/owletto/dist/assets/deployments-ICDss7yS.js +1 -0
- package/dist/owletto/dist/assets/deployments-body-DulCUAMt.js +1 -0
- package/dist/owletto/dist/assets/device-kTL2l_cz.js +1 -0
- package/dist/owletto/dist/assets/{device-pin-tombstone-1ikyqSdb.js → device-pin-tombstone-BmD4pv_e.js} +1 -1
- package/dist/owletto/dist/assets/device-rows-BqudjhFu.js +1 -0
- package/dist/owletto/dist/assets/{device._deviceId-DTYKGBY8.js → device._deviceId-CsLJJ6jv.js} +1 -1
- package/dist/owletto/dist/assets/entity-options-ErxYvMDH.js +1 -0
- package/dist/owletto/dist/assets/entity-page-CYRAwUGO.js +1 -0
- package/dist/owletto/dist/assets/entity-type-page-BlAizGlz.js +1 -0
- package/dist/owletto/dist/assets/event-page-DTXPxc-E.js +1 -0
- package/dist/owletto/dist/assets/events-feed-L3c-LLiJ.js +1 -0
- package/dist/owletto/dist/assets/{full-page-spinner-BN2G_YiM.js → full-page-spinner-BxcYpJXx.js} +1 -1
- package/dist/owletto/dist/assets/guardrails-Dh4adTXY.js +1 -0
- package/dist/owletto/dist/assets/identity-B8lKn0je.js +1 -0
- package/dist/owletto/dist/assets/{index-C6VAJ8Ku.js → index--lEHrFE4.js} +1 -1
- package/dist/owletto/dist/assets/{index-hSE2E46p.js → index-13rywWam.js} +1 -1
- package/dist/owletto/dist/assets/{index-C-u4yR8Z.js → index-BRvT0VV9.js} +1 -1
- package/dist/owletto/dist/assets/index-BUp24ZJr.js +1 -0
- package/dist/owletto/dist/assets/index-B_-MLsof.js +1 -0
- package/dist/owletto/dist/assets/index-Bq-q4Y7E.js +1 -0
- package/dist/owletto/dist/assets/index-C8CR2-Ck.css +1 -0
- package/dist/owletto/dist/assets/{index-OUb5Mlez.js → index-CDz3-ieP.js} +10 -10
- package/dist/owletto/dist/assets/index-CFkj9iR_.js +1 -0
- package/dist/owletto/dist/assets/index-CgBgOElA.js +1 -0
- package/dist/owletto/dist/assets/{index-C2oCgDX7.js → index-CheCJomo.js} +1 -1
- package/dist/owletto/dist/assets/index-CpiW66xK.js +1 -0
- package/dist/owletto/dist/assets/index-DAv5S2aK.js +1 -0
- package/dist/owletto/dist/assets/index-DBi2Xr3i.js +1 -0
- package/dist/owletto/dist/assets/index-DHOha5OJ.js +1 -0
- package/dist/owletto/dist/assets/index-DdGjY1Hb.js +7898 -0
- package/dist/owletto/dist/assets/index-Dkyl7l6E.js +1 -0
- package/dist/owletto/dist/assets/{index-vdqhlocx.js → index-QcHQZI87.js} +1 -1
- package/dist/owletto/dist/assets/index-kq4537-S.js +1 -0
- package/dist/owletto/dist/assets/{json-diff-DnsW7Pin.js → json-diff-BV2STDGj.js} +2 -2
- package/dist/owletto/dist/assets/{list-skeleton-CHzLN7GK.js → list-skeleton-CT5n4ND_.js} +1 -1
- package/dist/owletto/dist/assets/login-DKsgABYt.js +1 -0
- package/dist/owletto/dist/assets/logout-D_CP-emw.js +1 -0
- package/dist/owletto/dist/assets/member-scope-gate-BTgmlfFJ.js +1 -0
- package/dist/owletto/dist/assets/memory-browse-page-FHaJC3ML.js +101 -0
- package/dist/owletto/dist/assets/missing-view-Bve6pJP-.js +1 -0
- package/dist/owletto/dist/assets/{model-selector-DfbmHjLu.js → model-selector-BLCEahny.js} +1 -1
- package/dist/owletto/dist/assets/models-C4N7LQAW.js +1 -0
- package/dist/owletto/dist/assets/new-BAIGSdfp.js +1 -0
- package/dist/owletto/dist/assets/{new-Df_dY6Z5.js → new-CirOK0Sw.js} +1 -1
- package/dist/owletto/dist/assets/new-DzapH2sV.js +1 -0
- package/dist/owletto/dist/assets/{oauth-workspace-access-D9GmiMfK.js → oauth-workspace-access-BF7jaswv.js} +1 -1
- package/dist/owletto/dist/assets/{organization-uSDYkJpX.js → organization-D9RPsWG-.js} +1 -1
- package/dist/owletto/dist/assets/{permissions-Fe0DP6b8.js → permissions-BlRONw-u.js} +1 -1
- package/dist/owletto/dist/assets/{proposal-review-shell-D9HwnDda.js → proposal-review-shell-uskeFIUr.js} +1 -1
- package/dist/owletto/dist/assets/{recent-C03LhMD7.js → recent-CmJ4Is6V.js} +1 -1
- package/dist/owletto/dist/assets/{renderer-CHNejd95.js → renderer-Dyf4t8kR.js} +2 -2
- package/dist/owletto/dist/assets/{reset-password-CuISnlG_.js → reset-password-BVIeE1Zm.js} +1 -1
- package/dist/owletto/dist/assets/runs-CzBeUzlQ.js +1 -0
- package/dist/owletto/dist/assets/{runs-panel-DsdESupx.js → runs-panel-D7l1uLGm.js} +1 -1
- package/dist/owletto/dist/assets/runs-table-dATyiBg2.js +1 -0
- package/dist/owletto/dist/assets/{schema-value-normalization-B--OWDL8.js → schema-value-normalization-DgMkyVVE.js} +1 -1
- package/dist/owletto/dist/assets/settings-BK1GHmzb.js +1 -0
- package/dist/owletto/dist/assets/{settings-wGNHtsDP.js → settings-Co1wj_m6.js} +1 -1
- package/dist/owletto/dist/assets/skills-DF53JcYt.js +1 -0
- package/dist/owletto/dist/assets/{switch-Dzse_XFM.js → switch-DDkPrV3p.js} +1 -1
- package/dist/owletto/dist/assets/use-applied-views-DELwQQh7.js +1 -0
- package/dist/owletto/dist/assets/{use-mention-search-uyW1Uwf6.js → use-mention-search-CGA3AaKm.js} +1 -1
- package/dist/owletto/dist/assets/view-frame-DDr-Xtet.js +1 -0
- package/dist/owletto/dist/index.html +2 -2
- package/dist/server-main.bundle.mjs +6703 -3581
- package/npm-shrinkwrap.json +530 -472
- package/package.json +5 -2
- package/vendor/connector-sdk/dist/connector-runtime.d.ts +4 -6
- package/vendor/connector-sdk/dist/connector-runtime.js +3 -5
- package/vendor/connector-sdk/dist/connector-types.d.ts +28 -13
- package/vendor/connector-sdk/dist/define-connector.d.ts +4 -1
- package/vendor/connector-sdk/dist/define-connector.js +4 -1
- package/vendor/connector-sdk/dist/http-client.d.ts +18 -7
- package/vendor/connector-sdk/dist/http-client.js +15 -13
- package/vendor/connector-sdk/dist/index.d.ts +1 -1
- package/vendor/connector-sdk/dist/retry.d.ts +15 -3
- package/vendor/connector-sdk/dist/retry.js +40 -64
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/agent-policy.js +3 -0
- package/vendor/core/dist/connector-query-errors.d.ts +3 -3
- package/vendor/core/dist/connector-query-errors.js +8 -3
- package/vendor/core/dist/contracts/tools/manage-connections.d.ts +24 -0
- package/vendor/core/dist/contracts/tools/manage-connections.js +13 -0
- package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +15 -25
- package/vendor/core/dist/contracts/tools/manage-entity-schema.js +3 -5
- package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +11 -0
- package/vendor/core/dist/contracts/tools/manage-feeds.js +12 -1
- package/vendor/core/dist/contracts/tools/manage-operations.d.ts +47 -6
- package/vendor/core/dist/contracts/tools/manage-operations.js +36 -1
- package/vendor/core/dist/contracts/tools/manage-views.d.ts +293 -0
- package/vendor/core/dist/contracts/tools/manage-views.js +203 -0
- package/vendor/core/dist/contracts/tools/source-files-schema.d.ts +7 -0
- package/vendor/core/dist/contracts/tools/source-files-schema.js +19 -0
- package/vendor/core/dist/contracts/tools/source-files.d.ts +14 -0
- package/vendor/core/dist/contracts/tools/source-files.js +55 -0
- package/vendor/core/dist/contracts/tools/view-content-hash.d.ts +37 -0
- package/vendor/core/dist/contracts/tools/view-content-hash.js +58 -0
- package/vendor/core/dist/contracts/tools/view-path.d.ts +18 -0
- package/vendor/core/dist/contracts/tools/view-path.js +24 -0
- package/vendor/core/dist/contracts/worker/protocol.d.ts +73 -8
- package/vendor/core/dist/contracts/worker/protocol.js +58 -9
- package/vendor/core/dist/reserved.d.ts +3 -3
- package/vendor/core/dist/reserved.js +9 -1
- package/vendor/core/dist/utils/secret-redaction.js +2 -0
- package/vendor/core/package.json +25 -5
- package/vendor/views/dist/api.d.ts +179 -0
- package/vendor/views/dist/api.js +406 -0
- package/vendor/views/dist/bridge.d.ts +141 -0
- package/vendor/views/dist/bridge.js +330 -0
- package/vendor/views/dist/index.d.ts +12 -0
- package/vendor/views/dist/index.js +10 -0
- package/vendor/views/package.json +35 -0
- package/dist/owletto/dist/assets/_-Ds4DyQjj.js +0 -2
- package/dist/owletto/dist/assets/_-VmyR6aN_.js +0 -1
- package/dist/owletto/dist/assets/_agentId-BAVnp0c7.js +0 -1
- package/dist/owletto/dist/assets/_agentId-Df-3rGi5.js +0 -1
- package/dist/owletto/dist/assets/_automationId-D696vOjd.js +0 -1
- package/dist/owletto/dist/assets/_conversationId-Ci4rgrHm.js +0 -1
- package/dist/owletto/dist/assets/_deploymentId-Iy-D5PDq.js +0 -1
- package/dist/owletto/dist/assets/_name-CeGwb0oK.js +0 -1
- package/dist/owletto/dist/assets/_owner-CFR1G8OX.js +0 -1
- package/dist/owletto/dist/assets/_skillKey-DuLcQWBu.js +0 -1
- package/dist/owletto/dist/assets/_slug-CDSO20ac.js +0 -1
- package/dist/owletto/dist/assets/accept-invitation-Db5jklHT.js +0 -1
- package/dist/owletto/dist/assets/activity-route-view-DVW3DoB7.js +0 -1
- package/dist/owletto/dist/assets/agent-thread-CzCJU3-R.js +0 -134
- package/dist/owletto/dist/assets/agents-DFs57C3c.js +0 -1
- package/dist/owletto/dist/assets/agents-workbench-C2bUlJP2.js +0 -1
- package/dist/owletto/dist/assets/automation-detail-content-DWkdhnv2.js +0 -1
- package/dist/owletto/dist/assets/automations-DFs57C3c.js +0 -1
- package/dist/owletto/dist/assets/clients-DhYr4lyL.js +0 -1
- package/dist/owletto/dist/assets/connect-Dtb-E5An.js +0 -1
- package/dist/owletto/dist/assets/connect._clientId-DWtceAAw.js +0 -1
- package/dist/owletto/dist/assets/connected._clientId-CMe-wTuV.js +0 -1
- package/dist/owletto/dist/assets/create-CcXUdke7.js +0 -1
- package/dist/owletto/dist/assets/create-Cp6hMoeU.js +0 -1
- package/dist/owletto/dist/assets/create-automation-form-CJ4meayB.js +0 -1
- package/dist/owletto/dist/assets/deployments-CjfFxyDA.js +0 -1
- package/dist/owletto/dist/assets/deployments-body-Cg0KiWGr.js +0 -1
- package/dist/owletto/dist/assets/device-DpY67Jaj.js +0 -1
- package/dist/owletto/dist/assets/device-rows-Cp3yMcuV.js +0 -1
- package/dist/owletto/dist/assets/entity-options-1EaSGMX4.js +0 -1
- package/dist/owletto/dist/assets/entity-page-DJmM70dv.js +0 -1
- package/dist/owletto/dist/assets/entity-type-page-C3mT7tXn.js +0 -1
- package/dist/owletto/dist/assets/events-feed-iliGfjit.js +0 -1
- package/dist/owletto/dist/assets/guardrails-CLlnRRy9.js +0 -1
- package/dist/owletto/dist/assets/identity-MSLryUi8.js +0 -1
- package/dist/owletto/dist/assets/index-3o4Eepb4.js +0 -1
- package/dist/owletto/dist/assets/index-BUr8321-.js +0 -7898
- package/dist/owletto/dist/assets/index-Bulu5ldM.js +0 -1
- package/dist/owletto/dist/assets/index-BvbfITqH.js +0 -1
- package/dist/owletto/dist/assets/index-ChcQMdod.css +0 -1
- package/dist/owletto/dist/assets/index-Clw9ZBj-.js +0 -1
- package/dist/owletto/dist/assets/index-D2oL4Ydo.js +0 -1
- package/dist/owletto/dist/assets/index-D7wulT4y.js +0 -1
- package/dist/owletto/dist/assets/index-DOLFe19K.js +0 -1
- package/dist/owletto/dist/assets/index-DTSA0Xh1.js +0 -1
- package/dist/owletto/dist/assets/index-DxXXVPU0.js +0 -1
- package/dist/owletto/dist/assets/index-nzvsA3hT.js +0 -1
- package/dist/owletto/dist/assets/login-CCKNM0gV.js +0 -1
- package/dist/owletto/dist/assets/logout-B-N2aodZ.js +0 -1
- package/dist/owletto/dist/assets/member-scope-gate-B560Wg-t.js +0 -1
- package/dist/owletto/dist/assets/memory-browse-page-DMDqKJn7.js +0 -101
- package/dist/owletto/dist/assets/models-M51OGDRE.js +0 -1
- package/dist/owletto/dist/assets/new-BVQS9H-Y.js +0 -1
- package/dist/owletto/dist/assets/new-DxDVE9nL.js +0 -1
- package/dist/owletto/dist/assets/runs-BnYdToDc.js +0 -1
- package/dist/owletto/dist/assets/runs-table-B7jKuILd.js +0 -1
- package/dist/owletto/dist/assets/settings-Bg9yCCoN.js +0 -1
- package/dist/owletto/dist/assets/skills-CN5Ube7A.js +0 -1
- package/vendor/core/dist/contracts/tools/manage-view-templates.d.ts +0 -165
- package/vendor/core/dist/contracts/tools/manage-view-templates.js +0 -130
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-written MCP Apps guest transport for Lobu views.
|
|
3
|
+
*
|
|
4
|
+
* Zero dependencies on purpose: the spike measured zod + MCP SDK + ext-apps at
|
|
5
|
+
* 378 KB of a 577 KB view bundle, so the guest speaks the wire protocol
|
|
6
|
+
* directly instead of importing `@modelcontextprotocol/ext-apps`. The method
|
|
7
|
+
* names below mirror that SDK (protocol version `2026-01-26`): the host side
|
|
8
|
+
* (`AppBridge` in owletto, Claude, any MCP Apps host) is unchanged.
|
|
9
|
+
*
|
|
10
|
+
* Wire shape is plain JSON-RPC 2.0 over `window.postMessage` to the parent
|
|
11
|
+
* frame: requests carry `{ jsonrpc: "2.0", id, method, params }`, responses
|
|
12
|
+
* `{ jsonrpc: "2.0", id, result }` (or `error`), notifications `{ jsonrpc:
|
|
13
|
+
* "2.0", method, params }`. Anything else in the inbox is ignored, exactly
|
|
14
|
+
* like the SDK's transport.
|
|
15
|
+
*/
|
|
16
|
+
export interface ToolResult {
|
|
17
|
+
isError?: boolean;
|
|
18
|
+
structuredContent?: unknown;
|
|
19
|
+
content?: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface HostContext {
|
|
22
|
+
theme?: unknown;
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Bootstrap state the generic loader injects into the per-view document
|
|
27
|
+
* (`window.__lobuViewHandoff`) before replacing its own: the authenticated
|
|
28
|
+
* initialize result's context, the last complete tool input, event
|
|
29
|
+
* notifications that arrived after it, and the loader's request-id counter.
|
|
30
|
+
* Adopting it lets the mounted guest continue the loader's session — a host
|
|
31
|
+
* that delivers the opening input once has already fulfilled it. The
|
|
32
|
+
* readiness gate is NOT bypassed: queries still wait for a tool input, now
|
|
33
|
+
* satisfied by the authentic cached one through the normal listener path.
|
|
34
|
+
*/
|
|
35
|
+
export interface ViewHandoff {
|
|
36
|
+
v?: unknown;
|
|
37
|
+
hostContext?: unknown;
|
|
38
|
+
toolInput?: unknown;
|
|
39
|
+
queue?: unknown;
|
|
40
|
+
nextId?: unknown;
|
|
41
|
+
}
|
|
42
|
+
export interface BridgeOptions {
|
|
43
|
+
appName?: string;
|
|
44
|
+
appVersion?: string;
|
|
45
|
+
/** Parent origin. Default `*`: the frame is sandboxed opaque-origin, so the
|
|
46
|
+
* host cannot be allow-listed; the host authenticates the frame, not vice
|
|
47
|
+
* versa — same posture as the SDK's `PostMessageTransport`. */
|
|
48
|
+
targetOrigin?: string;
|
|
49
|
+
/** Milliseconds before a pending request rejects. Default 60_000. */
|
|
50
|
+
requestTimeoutMs?: number;
|
|
51
|
+
}
|
|
52
|
+
type JsonRpcId = string | number;
|
|
53
|
+
/**
|
|
54
|
+
* Minimal MCP Apps guest. Construct, register listeners, then `connect()`.
|
|
55
|
+
* Listeners registered after `connect()` resolves can miss the host's one-shot
|
|
56
|
+
* `tool-input` (the SDK warns for the same reason), so the view layer wires
|
|
57
|
+
* them synchronously at mount.
|
|
58
|
+
*/
|
|
59
|
+
export declare class ViewBridge {
|
|
60
|
+
private target;
|
|
61
|
+
private expectedSource;
|
|
62
|
+
private targetOrigin;
|
|
63
|
+
private timeoutMs;
|
|
64
|
+
private appInfo;
|
|
65
|
+
private nextId;
|
|
66
|
+
private pending;
|
|
67
|
+
private toolInputListeners;
|
|
68
|
+
private toolResultListeners;
|
|
69
|
+
private toolCancelledListeners;
|
|
70
|
+
private hostContextListeners;
|
|
71
|
+
/** Set by the first `tool-input` and never cleared: queries must not fire
|
|
72
|
+
* before it (the host seeds scope + params there; anything read earlier
|
|
73
|
+
* runs against defaults and double-fetches). */
|
|
74
|
+
private toolInputReceived;
|
|
75
|
+
private hostContext;
|
|
76
|
+
private didConnect;
|
|
77
|
+
private handoff;
|
|
78
|
+
private onMessage;
|
|
79
|
+
private listening;
|
|
80
|
+
constructor(target?: Window, expectedSource?: Window | null, opts?: BridgeOptions);
|
|
81
|
+
/**
|
|
82
|
+
* Adopt the loader's bootstrap state, if this document was mounted through
|
|
83
|
+
* the generic loader. Consumed once: a stale blob must never reseed a later
|
|
84
|
+
* navigation. Malformed blobs are ignored — the guest then waits for live
|
|
85
|
+
* host input like a directly mounted shell.
|
|
86
|
+
*/
|
|
87
|
+
private readHandoff;
|
|
88
|
+
/** Latest host context (theme, display mode, …), merged from every
|
|
89
|
+
* `host-context-changed` notification. */
|
|
90
|
+
getHostContext(): HostContext;
|
|
91
|
+
hasToolInput(): boolean;
|
|
92
|
+
onToolInput(listener: (args: Record<string, unknown>) => void): () => void;
|
|
93
|
+
onToolResult(listener: (result: ToolResult) => void): () => void;
|
|
94
|
+
onToolCancelled(listener: (reason: string | null) => void): () => void;
|
|
95
|
+
onHostContext(listener: (ctx: HostContext) => void): () => void;
|
|
96
|
+
/**
|
|
97
|
+
* Run the `ui/initialize` handshake, then announce readiness. Resolves with
|
|
98
|
+
* the host context. Rejects when the host answers with an error or stays
|
|
99
|
+
* silent past the deadline — the view renders its defaults, never a hang.
|
|
100
|
+
*/
|
|
101
|
+
connect(): Promise<HostContext>;
|
|
102
|
+
/**
|
|
103
|
+
* Continue the loader's session: seed request numbering from its counter,
|
|
104
|
+
* then deliver the cached tool input and queued event notifications through
|
|
105
|
+
* the normal listener paths — the readiness gate sees a real input, not a
|
|
106
|
+
* bypass. The fresh initialize result above keeps precedence for context.
|
|
107
|
+
*/
|
|
108
|
+
private adoptHandoff;
|
|
109
|
+
/** True once the `ui/initialize` handshake completed. */
|
|
110
|
+
isConnected(): boolean;
|
|
111
|
+
/** Proxy one `tools/call` to the host and return the FULL result (a view
|
|
112
|
+
* reads `structuredContent`; the boolean-only hook on the card path is
|
|
113
|
+
* what this deliberately does not copy). */
|
|
114
|
+
callTool(name: string, args: Record<string, unknown>): Promise<ToolResult>;
|
|
115
|
+
/** Read one `resources/read` URI and return the first text payload. The
|
|
116
|
+
* generic loader uses this to fetch `ui://lobu/views/<key>` through the
|
|
117
|
+
* host instead of a custom message. */
|
|
118
|
+
readResourceText(uri: string): Promise<string>;
|
|
119
|
+
/** Push `{ structuredContent }` into the model's context. Hosts without the
|
|
120
|
+
* capability reject; callers keep params frame-local on failure. */
|
|
121
|
+
updateModelContext(structuredContent: Record<string, unknown>): Promise<void>;
|
|
122
|
+
sendMessage(text: string): Promise<ToolResult>;
|
|
123
|
+
openLink(url: string): Promise<ToolResult>;
|
|
124
|
+
/** Report the document size so the host can fit the frame. Fire-and-forget:
|
|
125
|
+
* a host that ignores it keeps its default height. */
|
|
126
|
+
notifySize(width: number, height: number): void;
|
|
127
|
+
close(): void;
|
|
128
|
+
private startListening;
|
|
129
|
+
private request;
|
|
130
|
+
private notify;
|
|
131
|
+
private respond;
|
|
132
|
+
private respondError;
|
|
133
|
+
private handleMessage;
|
|
134
|
+
private handleResponse;
|
|
135
|
+
private handleNotification;
|
|
136
|
+
/** Answer an inbound host request (ping, teardown). Wired through the same
|
|
137
|
+
* inbox: JSON-RPC requests carry both `id` and `method`. */
|
|
138
|
+
handleRequest(id: JsonRpcId, method: string): boolean;
|
|
139
|
+
}
|
|
140
|
+
export {};
|
|
141
|
+
//# sourceMappingURL=bridge.d.ts.map
|
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-written MCP Apps guest transport for Lobu views.
|
|
3
|
+
*
|
|
4
|
+
* Zero dependencies on purpose: the spike measured zod + MCP SDK + ext-apps at
|
|
5
|
+
* 378 KB of a 577 KB view bundle, so the guest speaks the wire protocol
|
|
6
|
+
* directly instead of importing `@modelcontextprotocol/ext-apps`. The method
|
|
7
|
+
* names below mirror that SDK (protocol version `2026-01-26`): the host side
|
|
8
|
+
* (`AppBridge` in owletto, Claude, any MCP Apps host) is unchanged.
|
|
9
|
+
*
|
|
10
|
+
* Wire shape is plain JSON-RPC 2.0 over `window.postMessage` to the parent
|
|
11
|
+
* frame: requests carry `{ jsonrpc: "2.0", id, method, params }`, responses
|
|
12
|
+
* `{ jsonrpc: "2.0", id, result }` (or `error`), notifications `{ jsonrpc:
|
|
13
|
+
* "2.0", method, params }`. Anything else in the inbox is ignored, exactly
|
|
14
|
+
* like the SDK's transport.
|
|
15
|
+
*/
|
|
16
|
+
/** Event notifications worth replaying to the mounted guest (context merges
|
|
17
|
+
* into adopted state instead; anything else is ignored). */
|
|
18
|
+
const HANDOFF_NOTIFICATIONS = new Set([
|
|
19
|
+
"ui/notifications/tool-result",
|
|
20
|
+
"ui/notifications/tool-cancelled",
|
|
21
|
+
]);
|
|
22
|
+
const PROTOCOL_VERSION = "2026-01-26";
|
|
23
|
+
const DEFAULT_TIMEOUT_MS = 60_000;
|
|
24
|
+
function isRecord(value) {
|
|
25
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Minimal MCP Apps guest. Construct, register listeners, then `connect()`.
|
|
29
|
+
* Listeners registered after `connect()` resolves can miss the host's one-shot
|
|
30
|
+
* `tool-input` (the SDK warns for the same reason), so the view layer wires
|
|
31
|
+
* them synchronously at mount.
|
|
32
|
+
*/
|
|
33
|
+
export class ViewBridge {
|
|
34
|
+
target;
|
|
35
|
+
expectedSource;
|
|
36
|
+
targetOrigin;
|
|
37
|
+
timeoutMs;
|
|
38
|
+
appInfo;
|
|
39
|
+
nextId = 1;
|
|
40
|
+
pending = new Map();
|
|
41
|
+
toolInputListeners = new Set();
|
|
42
|
+
toolResultListeners = new Set();
|
|
43
|
+
toolCancelledListeners = new Set();
|
|
44
|
+
hostContextListeners = new Set();
|
|
45
|
+
/** Set by the first `tool-input` and never cleared: queries must not fire
|
|
46
|
+
* before it (the host seeds scope + params there; anything read earlier
|
|
47
|
+
* runs against defaults and double-fetches). */
|
|
48
|
+
toolInputReceived = false;
|
|
49
|
+
hostContext = {};
|
|
50
|
+
didConnect = false;
|
|
51
|
+
handoff = null;
|
|
52
|
+
onMessage = (event) => this.handleMessage(event);
|
|
53
|
+
listening = false;
|
|
54
|
+
constructor(target, expectedSource, opts) {
|
|
55
|
+
const w = globalThis;
|
|
56
|
+
this.target = target ?? w.window?.parent ?? w.parent;
|
|
57
|
+
this.expectedSource =
|
|
58
|
+
expectedSource ?? w.window?.parent ?? null;
|
|
59
|
+
this.targetOrigin = opts?.targetOrigin ?? "*";
|
|
60
|
+
this.timeoutMs = opts?.requestTimeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
61
|
+
this.appInfo = {
|
|
62
|
+
name: opts?.appName ?? "Lobu view",
|
|
63
|
+
version: opts?.appVersion ?? "0.0.1",
|
|
64
|
+
};
|
|
65
|
+
this.readHandoff();
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Adopt the loader's bootstrap state, if this document was mounted through
|
|
69
|
+
* the generic loader. Consumed once: a stale blob must never reseed a later
|
|
70
|
+
* navigation. Malformed blobs are ignored — the guest then waits for live
|
|
71
|
+
* host input like a directly mounted shell.
|
|
72
|
+
*/
|
|
73
|
+
readHandoff() {
|
|
74
|
+
const w = globalThis;
|
|
75
|
+
const win = w.window;
|
|
76
|
+
if (!win || typeof win !== "object")
|
|
77
|
+
return;
|
|
78
|
+
const raw = win.__lobuViewHandoff;
|
|
79
|
+
try {
|
|
80
|
+
delete win.__lobuViewHandoff;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
// Non-configurable property: single-run document, ignore.
|
|
84
|
+
}
|
|
85
|
+
if (!isRecord(raw))
|
|
86
|
+
return;
|
|
87
|
+
this.handoff = raw;
|
|
88
|
+
if (isRecord(this.handoff.hostContext)) {
|
|
89
|
+
this.hostContext = { ...this.handoff.hostContext };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/** Latest host context (theme, display mode, …), merged from every
|
|
93
|
+
* `host-context-changed` notification. */
|
|
94
|
+
getHostContext() {
|
|
95
|
+
return { ...this.hostContext };
|
|
96
|
+
}
|
|
97
|
+
hasToolInput() {
|
|
98
|
+
return this.toolInputReceived;
|
|
99
|
+
}
|
|
100
|
+
onToolInput(listener) {
|
|
101
|
+
this.toolInputListeners.add(listener);
|
|
102
|
+
return () => this.toolInputListeners.delete(listener);
|
|
103
|
+
}
|
|
104
|
+
onToolResult(listener) {
|
|
105
|
+
this.toolResultListeners.add(listener);
|
|
106
|
+
return () => this.toolResultListeners.delete(listener);
|
|
107
|
+
}
|
|
108
|
+
onToolCancelled(listener) {
|
|
109
|
+
this.toolCancelledListeners.add(listener);
|
|
110
|
+
return () => this.toolCancelledListeners.delete(listener);
|
|
111
|
+
}
|
|
112
|
+
onHostContext(listener) {
|
|
113
|
+
this.hostContextListeners.add(listener);
|
|
114
|
+
return () => this.hostContextListeners.delete(listener);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Run the `ui/initialize` handshake, then announce readiness. Resolves with
|
|
118
|
+
* the host context. Rejects when the host answers with an error or stays
|
|
119
|
+
* silent past the deadline — the view renders its defaults, never a hang.
|
|
120
|
+
*/
|
|
121
|
+
async connect() {
|
|
122
|
+
this.startListening();
|
|
123
|
+
const result = (await this.request("ui/initialize", {
|
|
124
|
+
appInfo: this.appInfo,
|
|
125
|
+
appCapabilities: {},
|
|
126
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
127
|
+
}));
|
|
128
|
+
const ctx = (result.hostContext ?? {});
|
|
129
|
+
this.hostContext = { ...this.hostContext, ...ctx };
|
|
130
|
+
this.didConnect = true;
|
|
131
|
+
this.notify({ method: "ui/notifications/initialized", params: {} });
|
|
132
|
+
this.adoptHandoff();
|
|
133
|
+
return this.getHostContext();
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Continue the loader's session: seed request numbering from its counter,
|
|
137
|
+
* then deliver the cached tool input and queued event notifications through
|
|
138
|
+
* the normal listener paths — the readiness gate sees a real input, not a
|
|
139
|
+
* bypass. The fresh initialize result above keeps precedence for context.
|
|
140
|
+
*/
|
|
141
|
+
adoptHandoff() {
|
|
142
|
+
const h = this.handoff;
|
|
143
|
+
this.handoff = null;
|
|
144
|
+
if (!h)
|
|
145
|
+
return;
|
|
146
|
+
if (typeof h.nextId === "number" && Number.isFinite(h.nextId)) {
|
|
147
|
+
this.nextId = Math.max(this.nextId, Math.floor(h.nextId));
|
|
148
|
+
}
|
|
149
|
+
if (isRecord(h.toolInput)) {
|
|
150
|
+
this.toolInputReceived = true;
|
|
151
|
+
const args = h.toolInput;
|
|
152
|
+
for (const listener of [...this.toolInputListeners])
|
|
153
|
+
listener(args);
|
|
154
|
+
}
|
|
155
|
+
if (Array.isArray(h.queue)) {
|
|
156
|
+
for (const item of h.queue) {
|
|
157
|
+
if (!isRecord(item) || typeof item.method !== "string")
|
|
158
|
+
continue;
|
|
159
|
+
if (!HANDOFF_NOTIFICATIONS.has(item.method))
|
|
160
|
+
continue;
|
|
161
|
+
this.handleNotification(item.method, isRecord(item.params) ? item.params : {});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/** True once the `ui/initialize` handshake completed. */
|
|
166
|
+
isConnected() {
|
|
167
|
+
return this.didConnect;
|
|
168
|
+
}
|
|
169
|
+
/** Proxy one `tools/call` to the host and return the FULL result (a view
|
|
170
|
+
* reads `structuredContent`; the boolean-only hook on the card path is
|
|
171
|
+
* what this deliberately does not copy). */
|
|
172
|
+
callTool(name, args) {
|
|
173
|
+
return this.request("tools/call", {
|
|
174
|
+
name,
|
|
175
|
+
arguments: args,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
/** Read one `resources/read` URI and return the first text payload. The
|
|
179
|
+
* generic loader uses this to fetch `ui://lobu/views/<key>` through the
|
|
180
|
+
* host instead of a custom message. */
|
|
181
|
+
async readResourceText(uri) {
|
|
182
|
+
const result = (await this.request("resources/read", { uri }));
|
|
183
|
+
const text = result.contents?.[0]?.text;
|
|
184
|
+
if (typeof text !== "string" || text.length === 0) {
|
|
185
|
+
throw new Error(`Resource ${uri} returned no text content`);
|
|
186
|
+
}
|
|
187
|
+
return text;
|
|
188
|
+
}
|
|
189
|
+
/** Push `{ structuredContent }` into the model's context. Hosts without the
|
|
190
|
+
* capability reject; callers keep params frame-local on failure. */
|
|
191
|
+
updateModelContext(structuredContent) {
|
|
192
|
+
return this.request("ui/update-model-context", { structuredContent }).then(() => undefined);
|
|
193
|
+
}
|
|
194
|
+
sendMessage(text) {
|
|
195
|
+
return this.request("ui/message", {
|
|
196
|
+
role: "user",
|
|
197
|
+
content: [{ type: "text", text }],
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
openLink(url) {
|
|
201
|
+
return this.request("ui/open-link", { url });
|
|
202
|
+
}
|
|
203
|
+
/** Report the document size so the host can fit the frame. Fire-and-forget:
|
|
204
|
+
* a host that ignores it keeps its default height. */
|
|
205
|
+
notifySize(width, height) {
|
|
206
|
+
this.notify({
|
|
207
|
+
method: "ui/notifications/size-changed",
|
|
208
|
+
params: { width, height },
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
close() {
|
|
212
|
+
if (this.listening) {
|
|
213
|
+
window.removeEventListener("message", this.onMessage);
|
|
214
|
+
this.listening = false;
|
|
215
|
+
}
|
|
216
|
+
for (const [, pending] of this.pending) {
|
|
217
|
+
clearTimeout(pending.timer);
|
|
218
|
+
pending.reject(new Error("ViewBridge closed"));
|
|
219
|
+
}
|
|
220
|
+
this.pending.clear();
|
|
221
|
+
}
|
|
222
|
+
startListening() {
|
|
223
|
+
if (this.listening)
|
|
224
|
+
return;
|
|
225
|
+
window.addEventListener("message", this.onMessage);
|
|
226
|
+
this.listening = true;
|
|
227
|
+
}
|
|
228
|
+
request(method, params) {
|
|
229
|
+
const id = this.nextId++;
|
|
230
|
+
const message = { jsonrpc: "2.0", id, method, params };
|
|
231
|
+
return new Promise((resolve, reject) => {
|
|
232
|
+
const timer = setTimeout(() => {
|
|
233
|
+
this.pending.delete(id);
|
|
234
|
+
reject(new Error(`ViewBridge request "${method}" timed out`));
|
|
235
|
+
}, this.timeoutMs);
|
|
236
|
+
this.pending.set(id, {
|
|
237
|
+
resolve: resolve,
|
|
238
|
+
reject,
|
|
239
|
+
timer,
|
|
240
|
+
});
|
|
241
|
+
this.target.postMessage(message, this.targetOrigin);
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
notify(message) {
|
|
245
|
+
this.target.postMessage({ jsonrpc: "2.0", ...message }, this.targetOrigin);
|
|
246
|
+
}
|
|
247
|
+
respond(id, result) {
|
|
248
|
+
this.target.postMessage({ jsonrpc: "2.0", id, result }, this.targetOrigin);
|
|
249
|
+
}
|
|
250
|
+
respondError(id, code, message) {
|
|
251
|
+
this.target.postMessage({ jsonrpc: "2.0", id, error: { code, message } }, this.targetOrigin);
|
|
252
|
+
}
|
|
253
|
+
handleMessage(event) {
|
|
254
|
+
if (this.expectedSource && event.source !== this.expectedSource)
|
|
255
|
+
return;
|
|
256
|
+
const data = event.data;
|
|
257
|
+
if (!isRecord(data) || data.jsonrpc !== "2.0")
|
|
258
|
+
return;
|
|
259
|
+
const hasId = ("id" in data && typeof data.id === "string") ||
|
|
260
|
+
("id" in data && typeof data.id === "number");
|
|
261
|
+
// An inbound host request carries both `id` and `method` (ping,
|
|
262
|
+
// teardown); a response to one of ours carries `id` without `method`.
|
|
263
|
+
if (hasId && typeof data.method === "string") {
|
|
264
|
+
this.handleRequest(data.id, data.method);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (hasId) {
|
|
268
|
+
this.handleResponse(data.id, data);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (typeof data.method !== "string")
|
|
272
|
+
return;
|
|
273
|
+
this.handleNotification(data.method, isRecord(data.params) ? data.params : {});
|
|
274
|
+
}
|
|
275
|
+
handleResponse(id, data) {
|
|
276
|
+
const pending = this.pending.get(id);
|
|
277
|
+
if (!pending)
|
|
278
|
+
return;
|
|
279
|
+
this.pending.delete(id);
|
|
280
|
+
clearTimeout(pending.timer);
|
|
281
|
+
if ("error" in data && isRecord(data.error)) {
|
|
282
|
+
pending.reject(new Error(String(data.error.message ?? "Host request failed")));
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
pending.resolve(data.result);
|
|
286
|
+
}
|
|
287
|
+
handleNotification(method, params) {
|
|
288
|
+
switch (method) {
|
|
289
|
+
case "ui/notifications/tool-input": {
|
|
290
|
+
this.toolInputReceived = true;
|
|
291
|
+
const args = isRecord(params.arguments) ? params.arguments : {};
|
|
292
|
+
for (const listener of [...this.toolInputListeners])
|
|
293
|
+
listener(args);
|
|
294
|
+
break;
|
|
295
|
+
}
|
|
296
|
+
case "ui/notifications/tool-result": {
|
|
297
|
+
const result = params;
|
|
298
|
+
for (const listener of [...this.toolResultListeners])
|
|
299
|
+
listener(result);
|
|
300
|
+
break;
|
|
301
|
+
}
|
|
302
|
+
case "ui/notifications/tool-cancelled": {
|
|
303
|
+
const reason = typeof params.reason === "string" ? params.reason : null;
|
|
304
|
+
for (const listener of [...this.toolCancelledListeners])
|
|
305
|
+
listener(reason);
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
case "ui/notifications/host-context-changed": {
|
|
309
|
+
this.hostContext = { ...this.hostContext, ...params };
|
|
310
|
+
const snapshot = this.getHostContext();
|
|
311
|
+
for (const listener of [...this.hostContextListeners])
|
|
312
|
+
listener(snapshot);
|
|
313
|
+
break;
|
|
314
|
+
}
|
|
315
|
+
default:
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
/** Answer an inbound host request (ping, teardown). Wired through the same
|
|
320
|
+
* inbox: JSON-RPC requests carry both `id` and `method`. */
|
|
321
|
+
handleRequest(id, method) {
|
|
322
|
+
if (method === "ping" || method === "ui/resource-teardown") {
|
|
323
|
+
this.respond(id, {});
|
|
324
|
+
return true;
|
|
325
|
+
}
|
|
326
|
+
this.respondError(id, -32601, `Method not found: ${method}`);
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
//# sourceMappingURL=bridge.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@lobu/views` — authoring runtime for Lobu views.
|
|
3
|
+
*
|
|
4
|
+
* A view is an ordinary React module rendered in the sandboxed MCP Apps
|
|
5
|
+
* frame. The module declares itself with `defineView` and mounts once with
|
|
6
|
+
* `mountView`; hooks bridge params, scope, reads and actions to the host.
|
|
7
|
+
*/
|
|
8
|
+
export { ViewBridge } from "./bridge.js";
|
|
9
|
+
export type { BridgeOptions, HostContext, ToolResult, ViewHandoff, } from "./bridge.js";
|
|
10
|
+
export { coerceParams, defaultsFor, defineView, escapeLiteral, mintInteractionId, mountView, Provider, sql, tool, useAction, useHost, useParams, useQuery, useScope, } from "./api.js";
|
|
11
|
+
export type { ActionResult, Attachment, MountOptions, ParamDef, Params, ParamValue, QueryState, Scope, SqlQuery, ToolQuery, ViewDefinition, } from "./api.js";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@lobu/views` — authoring runtime for Lobu views.
|
|
3
|
+
*
|
|
4
|
+
* A view is an ordinary React module rendered in the sandboxed MCP Apps
|
|
5
|
+
* frame. The module declares itself with `defineView` and mounts once with
|
|
6
|
+
* `mountView`; hooks bridge params, scope, reads and actions to the host.
|
|
7
|
+
*/
|
|
8
|
+
export { ViewBridge } from "./bridge.js";
|
|
9
|
+
export { coerceParams, defaultsFor, defineView, escapeLiteral, mintInteractionId, mountView, Provider, sql, tool, useAction, useHost, useParams, useQuery, useScope, } from "./api.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lobu/views",
|
|
3
|
+
"version": "21.0.0",
|
|
4
|
+
"description": "Authoring runtime for Lobu views — React modules rendered in the sandboxed MCP Apps frame",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"require": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"!**/*.map"
|
|
23
|
+
],
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": "^19.0.0",
|
|
26
|
+
"react-dom": "^19.0.0"
|
|
27
|
+
},
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=18"
|
|
30
|
+
},
|
|
31
|
+
"license": "Apache-2.0",
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/entity-page-DJmM70dv.js","assets/index-BUr8321-.js","assets/index-ChcQMdod.css","assets/schema-value-normalization-B--OWDL8.js","assets/calendar-C0XpOHd8.js","assets/renderer-CHNejd95.js","assets/card-DeFQuU_J.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as n,aY as p,aZ as l,a_ as y,p as j,Y as v,a2 as R,_,j as e,a$ as P,b0 as E,b1 as S}from"./index-BUr8321-.js";function u(){return n.useEffect(()=>{p()},[]),null}const b=E(async()=>({default:(await S(async()=>{const{EntityPage:s}=await import("./entity-page-DJmM70dv.js");return{EntityPage:s}},__vite__mapDeps([0,1,2,3,4,5,6]))).EntityPage}));function r(){return e.jsx("div",{"data-public-loading":"true",children:e.jsx(P,{})})}function N(){const{owner:s,_splat:m}=l.useParams(),a=l.useSearch(),{path:x}=y(s,m||""),{data:t,isLoading:i,error:o}=j(x,{slug:s},{includeBootstrap:!0}),{session:f,isReady:c}=v(),d=R();if(n.useEffect(()=>{t?.redirect&&d({to:t.redirect.to,replace:!0})},[t?.redirect,d]),_({active:!i&&c&&!f&&(!!o||!t),owner:s}),i||!c&&!t)return e.jsx(r,{});if(t?.redirect)return e.jsx(r,{});if(o||!t||!t.entity)return e.jsxs(e.Fragment,{children:[e.jsx(u,{}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Not Found"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"We couldn't resolve this path."})]})]});const h=typeof a.merged_from=="string"&&t.entity.merged_records?.some(g=>g.name===a.merged_from)?a.merged_from:void 0;return e.jsxs(e.Fragment,{children:[e.jsx(u,{}),e.jsx(n.Suspense,{fallback:e.jsx(r,{}),children:e.jsx(b,{namespace:t.workspace,path:t.path,entity:t.entity,mergedFrom:h})})]})}export{N as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d6 as t,j as p,d7 as e}from"./index-BUr8321-.js";import{A as m}from"./activity-route-view-DVW3DoB7.js";import"./device-automation-BIjs7DZJ.js";import"./agent-thread-storage-U6htL3ad.js";import"./pending-seed-CPbfgnLX.js";import"./clients-DhYr4lyL.js";import"./client-rows-EJSKR6z1.js";import"./connection-label-BobuYiAG.js";import"./events-feed-iliGfjit.js";import"./renderer-CHNejd95.js";import"./card-DeFQuU_J.js";import"./calendar-C0XpOHd8.js";import"./agent-loading-shells-CLoLeFcB.js";import"./member-scope-gate-B560Wg-t.js";function d(){const{owner:o,_splat:r}=t.useParams(),i=t.useSearch();return p.jsx(m,{owner:o,search:i,attentionLens:!1,entityScope:e(r||"").path})}export{d as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a2 as L,g6 as w,r as u,j as n,aj as D,db as y,Y as E,bM as M,bv as P,bm as N,bH as R,cE as O,g7 as $,g8 as B,cT as H,a7 as Q}from"./index-BUr8321-.js";import{L as z,A as F}from"./agent-thread-CzCJU3-R.js";import{n as C}from"./agent-thread-storage-U6htL3ad.js";import{A as U,C as W}from"./agent-loading-shells-CLoLeFcB.js";import"./pending-seed-CPbfgnLX.js";import"./use-mention-search-uyW1Uwf6.js";import"./index-Vcq4gwWv.js";function Y({owner:t,agent:s,threadId:e,afterMessagesContent:d,className:r,initialDraft:x,newChatRequested:m=!1,preventAutoNavigate:g}){const o=L(),i=s.agentId,{data:a=[]}=w(i,{orgSlug:t}),[l,p]=u.useState(()=>C()),[h,A]=u.useState(null);u.useEffect(()=>{!m||e||(p(C()),A(null),o({to:".",search:(f=>{const{new:b,...k}=f;return k}),replace:!0}))},[m,e,o]);const v=u.useMemo(()=>!h||a.some(f=>f.id===h.id)?a:[h,...a],[a,h]),c=e??l,T=!e||!v.some(f=>f.id===e),j=u.useCallback(()=>{if(v.some(b=>b.id===c))return;A({id:c,title:`Conversation ${v.length+1}`,createdAt:Date.now(),updatedAt:Date.now()});const f=y(t,i,c);o({...f,replace:!0})},[v,c,o,t,i]),S=u.useCallback(()=>{T&&!g&&j()},[T,j,g]);return n.jsx("div",{className:D("flex min-h-0 flex-1 flex-col",r),children:n.jsx("div",{className:"flex min-h-0 flex-1 flex-col",children:n.jsx(z,{agentId:i,workspaceSlug:t,thread:c,loadHistory:!!e,onFirstUserMessage:S,initialDraft:x,children:n.jsx(F,{afterMessagesContent:d})},`${i}:${c}`)})})}function _({owner:t,agentId:s,threadId:e,initialDraft:d,newChatRequested:r,afterMessagesContent:x,preventAutoNavigate:m}){const{isAuthenticated:g}=E(),{isMember:o,isLoading:i}=M(),a=g&&o,{data:l=[],isLoading:p}=P({enabled:a}),h=s??null,A=l.find(c=>c.agentId===h)??null;return a&&p||i?n.jsx(U,{}):A?n.jsx(Y,{owner:t,agent:A,threadId:e,initialDraft:d,newChatRequested:r,afterMessagesContent:x,preventAutoNavigate:m,className:"min-h-0 flex-1 overflow-hidden"}):n.jsx(N,{icon:R,title:"Agent not found",description:"This agent may have been removed."})}function q(t){return[...t].sort((s,e)=>e.updatedAt-s.updatedAt)[0]}function G({owner:t,agentId:s,threadId:e,initialDraft:d,forceComposer:r=!1,newChatRequested:x=!1,afterMessagesContent:m,preventAutoNavigate:g}){const o=L(),{data:i=[],isLoading:a}=O($(t,s,{strict:!1})),l=u.useMemo(()=>q(i),[i]);return u.useEffect(()=>{if(e||r||a||!l)return;const p=y(t,s,l.id);o({...p,replace:!0})},[s,a,l,o,t,e,r]),!e&&!r&&(a||l)?n.jsx(W,{}):n.jsx(_,{owner:t,agentId:s,threadId:e,initialDraft:d,newChatRequested:x,afterMessagesContent:m,preventAutoNavigate:g})}function te(){const{owner:t,agentId:s}=B.useParams(),{threadId:e}=H({strict:!1}),{new:d,prompt:r}=Q({strict:!1});return n.jsx("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4 lg:px-6 lg:py-6",children:n.jsx("div",{className:"mx-auto flex min-h-0 w-full max-w-3xl flex-1 flex-col",children:n.jsx(G,{owner:t,agentId:s,threadId:e,initialDraft:r,forceComposer:!e,newChatRequested:!!d})})})}export{te as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{gh as r,j as e}from"./index-BUr8321-.js";import{A as n}from"./agents-workbench-C2bUlJP2.js";import"./agent-editor-form-BTNlg0kQ.js";import"./model-selector-DfbmHjLu.js";import"./proposal-review-shell-D9HwnDda.js";import"./runs-BnYdToDc.js";function c(){const{owner:o,agentId:t}=r.useParams();return e.jsx(n,{owner:o,agentId:t})}export{c as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a2 as N,a1 as k,p as A,Y as L,bM as C,G as b,j as t,B as n,fa as y,bH as R,S as _,L as $,H as D,ga as p,aV as O}from"./index-BUr8321-.js";import{a as z}from"./automation-detail-content-DWkdhnv2.js";import"./create-automation-form-CJ4meayB.js";import"./cronstrue-ChFyC9ps.js";import"./entity-options-1EaSGMX4.js";import"./connection-label-BobuYiAG.js";import"./switch-Dzse_XFM.js";import"./device-automation-BIjs7DZJ.js";import"./model-selector-DfbmHjLu.js";import"./skill-editor-D_W3QlRz.js";import"./code-editor-BqGUZFt6.js";import"./index-OUb5Mlez.js";import"./index-Vcq4gwWv.js";import"./use-mention-search-uyW1Uwf6.js";import"./proposal-review-shell-D9HwnDda.js";import"./runs-BnYdToDc.js";import"./agent-loading-shells-CLoLeFcB.js";import"./agent-thread-CzCJU3-R.js";import"./pending-seed-CPbfgnLX.js";import"./events-feed-iliGfjit.js";import"./clients-DhYr4lyL.js";import"./renderer-CHNejd95.js";import"./card-DeFQuU_J.js";import"./json-diff-DnsW7Pin.js";function P({owner:a,automationId:o,view:e,runId:s}){const r=N(),{orgContext:u,hasOrgContext:x}=k(),{data:g,isLoading:m}=A(`/${a}`,u),{isAuthenticated:h}=L(),{isLoading:c}=C(),f=g?.workspace?.id??"",v=h?!x||m||c:m||c,i=b(o,void 0,f).data?.automation,j=i?.automation_name??"Automation",l=()=>void r({to:"/$owner/automations",params:{owner:a}}),d=()=>void r({to:"/$owner/automations/$automationId",params:{owner:a,automationId:o},search:{view:"activity",run_id:void 0}}),w=!s&&e==="definition";return t.jsx("div",{className:"flex flex-1 flex-col gap-6 px-4 py-6 lg:px-6",children:t.jsxs("div",{className:"mx-auto flex w-full min-w-0 max-w-3xl flex-col gap-4",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[t.jsxs(n,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-foreground",onClick:l,children:[t.jsx(y,{className:"h-3.5 w-3.5"}),"Automations"]}),t.jsxs("h1",{className:"flex min-w-0 items-center gap-2 truncate font-display text-xl font-semibold",children:[t.jsx(R,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),v&&!i?t.jsx(_,{className:"h-5 w-40"}):s?"Review change":j]})]}),s?null:w?t.jsx(n,{type:"button",variant:"ghost",size:"sm",className:"h-8 text-muted-foreground hover:text-foreground",onClick:d,children:"Done"}):t.jsx(n,{asChild:!0,variant:"ghost",size:"sm",className:"h-8 gap-1.5",children:t.jsxs($,{to:"/$owner/automations/$automationId",params:{owner:a,automationId:o},search:{view:"definition",run_id:void 0},children:[t.jsx(D,{className:"h-3.5 w-3.5"}),"Edit"]})})]}),t.jsx(z,{owner:a,agentId:i?.managed_agent_id??null,automationId:o,view:e,runId:s,onDone:s?l:d})]})})}function nt(){const{owner:a,automationId:o}=p.useParams(),e=p.useSearch();return t.jsx(O,{owner:a,children:()=>t.jsx(P,{owner:a,automationId:o,view:e.view,runId:e.run_id})})}export{nt as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,eX as M,aj as h,hD as j,r as w,bM as z,a as C,hE as b}from"./index-BUr8321-.js";import{A as k}from"./agent-loading-shells-CLoLeFcB.js";import{s as N,R as y,A as L}from"./agent-thread-CzCJU3-R.js";import"./pending-seed-CPbfgnLX.js";import"./use-mention-search-uyW1Uwf6.js";import"./index-Vcq4gwWv.js";const m={path:"M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z",hex:"5865F2"},d={path:"M1.637 0C.733 0 0 .733 0 1.637v16.5c0 .904.733 1.636 1.637 1.636h3.955v3.323c0 .804.97 1.207 1.539.638l3.963-3.96h11.27c.903 0 1.636-.733 1.636-1.637V5.592L18.408 0Zm3.955 5.592h12.816v8.59H8.455l-2.863 2.863Z",hex:"34A853"},p={path:"M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z",hex:"26A5E4"},x={path:"M17.472 14.382c-.297-.149-1.758-.867-2.03-.967-.273-.099-.471-.148-.67.15-.197.297-.767.966-.94 1.164-.173.199-.347.223-.644.075-.297-.15-1.255-.463-2.39-1.475-.883-.788-1.48-1.761-1.653-2.059-.173-.297-.018-.458.13-.606.134-.133.298-.347.446-.52.149-.174.198-.298.298-.497.099-.198.05-.371-.025-.52-.075-.149-.669-1.612-.916-2.207-.242-.579-.487-.5-.669-.51-.173-.008-.371-.01-.57-.01-.198 0-.52.074-.792.372-.272.297-1.04 1.016-1.04 2.479 0 1.462 1.065 2.875 1.213 3.074.149.198 2.096 3.2 5.077 4.487.709.306 1.262.489 1.694.625.712.227 1.36.195 1.871.118.571-.085 1.758-.719 2.006-1.413.248-.694.248-1.289.173-1.413-.074-.124-.272-.198-.57-.347m-5.421 7.403h-.004a9.87 9.87 0 01-5.031-1.378l-.361-.214-3.741.982.998-3.648-.235-.374a9.86 9.86 0 01-1.51-5.26c.001-5.45 4.436-9.884 9.888-9.884 2.64 0 5.122 1.03 6.988 2.898a9.825 9.825 0 012.893 6.994c-.003 5.45-4.437 9.884-9.885 9.884m8.413-18.297A11.815 11.815 0 0012.05 0C5.495 0 .16 5.335.157 11.892c0 2.096.547 4.142 1.588 5.945L.057 24l6.305-1.654a11.882 11.882 0 005.683 1.448h.005c6.554 0 11.89-5.335 11.893-11.893a11.821 11.821 0 00-3.48-8.413Z",hex:"25D366"},O={discord:{hex:`#${m.hex}`,path:m.path},gchat:{hex:`#${d.hex}`,path:d.path},slack:{hex:"#4A154B",path:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"},teams:{imgSrc:"https://www.google.com/s2/favicons?domain=teams.microsoft.com&sz=64"},telegram:{hex:`#${p.hex}`,path:p.path},whatsapp:{hex:`#${x.hex}`,path:x.path}};function T({platform:s,className:t}){const a=s?O[s]:null;return a?"imgSrc"in a?e.jsx("img",{src:a.imgSrc,alt:"","aria-hidden":"true",className:h("rounded-sm",t),loading:"lazy"}):e.jsx("svg",{viewBox:a.viewBox??"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:t,style:{color:a.hex},children:e.jsx("path",{d:a.path})}):e.jsx(M,{className:h("text-muted-foreground",t),"aria-hidden":"true"})}const I={slack:"Slack",telegram:"Telegram",whatsapp:"WhatsApp",discord:"Discord",web:"Web"};function R(s,t,a){return s==="slack"&&a?.teamId&&t?`https://app.slack.com/client/${a.teamId}/${t}`:null}function S({owner:s,agentId:t,conversationId:a}){const{data:n=[],isLoading:u}=j(t,a,{orgSlug:s}),c=w.useMemo(()=>n.map(r=>N(r,{showToolCalls:!0})).filter(r=>r!==null),[n]),[o,g]=a.split(":"),i=I[o]??"the source app",{org:f}=z(),{data:v=[]}=C(f?.id??"",{connectorKey:o}),A=v[0]?.config?.chatMetadata,l=R(o,g,A);return e.jsx("div",{className:"mx-auto flex min-h-0 w-full max-w-3xl flex-1 flex-col pb-6",children:u?e.jsx(k,{readOnly:!0}):c.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No messages in this conversation."}):e.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[e.jsx(y,{messages:c,children:e.jsx(L,{readOnly:!0})}),l?e.jsxs("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"mt-4 flex items-center gap-3 rounded-lg border border-border bg-muted/40 px-4 py-3 text-sm transition-colors hover:bg-muted",children:[e.jsx(T,{platform:o,className:"size-5 shrink-0"}),e.jsxs("span",{className:"text-muted-foreground",children:["This is a read-only copy. Continue the conversation with this agent in ",i,"."]}),e.jsxs("span",{className:"ml-auto shrink-0 whitespace-nowrap font-medium text-foreground",children:["Open ",i," →"]})]}):null]})})}function Z(){const{owner:s,agentId:t,conversationId:a}=b.useParams();return e.jsx(S,{owner:s,agentId:t,conversationId:a})}export{Z as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,L as h,fa as f,c7 as j,c8 as g,bm as d,go as y,gn as N,eW as m,x as o,af as b,aj as v,aS as D,eF as w,aD as S,hi as C}from"./index-BUr8321-.js";import{u as A,a as I,c as x,d as B}from"./deployments-body-Cg0KiWGr.js";import{J as L}from"./json-diff-DnsW7Pin.js";import"./index-OUb5Mlez.js";import"./index-Vcq4gwWv.js";const c="change-";function k({owner:t,deploymentId:s}){const a=s.startsWith(c),r=A(a?null:s),l=I(a?s.slice(c.length):null),i=a?l:r;return e.jsxs("div",{className:"max-w-3xl space-y-6",children:[e.jsxs(h,{to:"/$owner/connectors/deployments",params:{owner:t},className:"inline-flex items-center gap-1 text-xs text-muted-foreground transition-colors hover:text-foreground",children:[e.jsx(f,{className:"h-3 w-3"}),"All deployments"]}),i.isLoading?e.jsx(j,{label:"deployment",variant:"panel"}):i.isError?e.jsx(g,{label:"deployment"}):a?l.data?e.jsx(E,{change:l.data}):e.jsx(d,{icon:y,title:"Change not found",description:"This config change is not in the audit trail, or the server predates the deployments API."}):r.data?e.jsx($,{detail:r.data}):e.jsx(d,{icon:N,title:"Deployment not found",description:"This apply run is not in the audit trail, or the server predates the deployments API."})]})}function $({detail:t}){const{deployment:s,changes:a}=t;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("h2",{className:"text-lg font-semibold",children:["Deployment ",s.applyId?.slice(4,12)??s.id]}),B(s.status),s.gitDirty?e.jsx(b,{variant:"outline",children:"Dirty working tree"}):null]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[m(s.createdAt)," (",o(s.createdAt),")",s.createdBy?` · by ${s.createdBy}`:""]}),e.jsxs("dl",{className:"grid gap-1.5 text-xs",children:[s.applyId?e.jsx(n,{label:"Apply id",value:s.applyId,copyable:!0}):null,s.manifestHash?e.jsx(n,{label:"Manifest hash",value:s.manifestHash,copyable:!0}):null,s.gitSha?e.jsx(n,{label:"Git SHA",value:s.gitDirty?`${s.gitSha} (dirty)`:s.gitSha,copyValue:s.gitSha,copyable:!0}):null,s.cliVersion?e.jsx(n,{label:"CLI version",value:s.cliVersion,copyable:!0}):null]}),s.status==="partial_failure"&&s.error?e.jsx("div",{className:"rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive",children:s.error}):null]}),s.gitSha?e.jsxs("section",{className:v(D,"space-y-2 p-4"),children:[e.jsx("p",{className:"text-sm font-medium",children:"Rollback"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Rollback is git-first: revert the commit that produced this deployment, then re-apply."}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("code",{className:"font-mono text-xs",children:["git revert ",s.gitSha," && lobu apply"]}),e.jsx(p,{value:`git revert ${s.gitSha} && lobu apply`,label:"rollback command"})]})]}):null,e.jsxs("section",{className:"space-y-2",children:[e.jsxs("h3",{className:"text-sm font-medium",children:["Changes",e.jsx("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:a.length})]}),a.length===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No config changes in this apply run."}):e.jsx("div",{className:"overflow-hidden rounded-lg border",children:a.map((r,l)=>e.jsx(u,{change:r,isLast:l===a.length-1},r.id))})]})]})}function E({change:t}){return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("header",{className:"space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("h2",{className:"text-lg font-semibold",children:[t.resourceKind??"config",t.resourceId?e.jsxs("span",{className:"text-muted-foreground",children:[" ",t.resourceId]}):null]}),x(t.op)]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[m(t.createdAt)," (",o(t.createdAt),")",t.actorSource?` · via ${t.actorSource}`:"",t.createdBy?` · by ${t.createdBy}`:""]})]}),e.jsx("section",{className:"overflow-hidden rounded-lg border",children:e.jsx(u,{change:t,isLast:!0})})]})}function u({change:t,isLast:s}){return e.jsxs("div",{className:`px-3 py-2.5 ${s?"":"border-b"}`,children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[t.resourceKind??"config",t.resourceId?e.jsxs("span",{className:"text-muted-foreground",children:[" ",t.resourceId]}):null]}),x(t.op),e.jsx("span",{className:"ml-auto text-[11px] text-muted-foreground",children:o(t.createdAt)})]}),t.changedFields&&t.changedFields.length>0?e.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:["Changed: ",t.changedFields.join(", ")]}):null,e.jsx(L,{before:t.before,after:t.after})]})}function n({label:t,value:s,copyValue:a,copyable:r}){return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("dt",{className:"w-24 shrink-0 text-muted-foreground",children:t}),e.jsxs("dd",{className:"flex min-w-0 items-center gap-1",children:[e.jsx("span",{className:"truncate font-mono",children:s}),r?e.jsx(p,{value:a??s,label:t}):null]})]})}function p({value:t,label:s}){return e.jsx("button",{type:"button","aria-label":`Copy ${s}`,className:"shrink-0 text-muted-foreground transition-colors hover:text-foreground",onClick:()=>{navigator.clipboard.writeText(t),S.success("Copied to clipboard")},children:e.jsx(w,{className:"h-3 w-3"})})}function H(){const{owner:t,deploymentId:s}=C.useParams();return e.jsx(k,{owner:t,deploymentId:s})}export{H as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{hC as a,j as e}from"./index-BUr8321-.js";import{b as i}from"./agent-guardrails-route-B5uoMC6o.js";import"./model-selector-DfbmHjLu.js";import"./agent-subpage-shell-DuVYZvBE.js";import"./agent-loading-shells-CLoLeFcB.js";import"./agent-card-controls-CZO6GI0s.js";import"./switch-Dzse_XFM.js";function x(){const{owner:t,agentId:r,name:o}=a.useParams();return e.jsx(i,{owner:t,agentId:r,name:o})}export{x as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,I as P,u as z,a as _,S as f,r as h,C as D,B as m,L as w,P as E,b as O,c as R,d as p,f as T,e as k,g as F,h as B,i as $,k as K,l as M,A as H,m as q,F as U,n as V,o as v,p as W,q as Q,s as C,t as G,v as Y,w as J,x as X,y as Z,z as ee,E as te,D as se,G as ne,H as re,J as ie,K as ae,M as oe,N as ce,O as de,Q as le,R as ue,T as xe,U as me,V as he,X as fe,W as pe,Y as ge,Z as je,_ as ye,$ as ve,a0 as Ne}from"./index-BUr8321-.js";import{u as be,A as we,a as ke}from"./automation-detail-content-DWkdhnv2.js";import{C as Ce,a as Se,A as Ae}from"./connection-feed-detail-B3ePAinf.js";import{c as Ie}from"./connection-label-BobuYiAG.js";import{C as Le,f as Pe}from"./runs-table-B7jKuILd.js";import{E as S}from"./events-feed-iliGfjit.js";import"./create-automation-form-CJ4meayB.js";import"./cronstrue-ChFyC9ps.js";import"./entity-options-1EaSGMX4.js";import"./switch-Dzse_XFM.js";import"./device-automation-BIjs7DZJ.js";import"./model-selector-DfbmHjLu.js";import"./skill-editor-D_W3QlRz.js";import"./code-editor-BqGUZFt6.js";import"./index-OUb5Mlez.js";import"./index-Vcq4gwWv.js";import"./use-mention-search-uyW1Uwf6.js";import"./proposal-review-shell-D9HwnDda.js";import"./runs-BnYdToDc.js";import"./agent-loading-shells-CLoLeFcB.js";import"./agent-thread-CzCJU3-R.js";import"./pending-seed-CPbfgnLX.js";import"./json-diff-DnsW7Pin.js";import"./clients-DhYr4lyL.js";import"./renderer-CHNejd95.js";import"./card-DeFQuU_J.js";function ze(t){if(!t||typeof t!="object")return[];const s=t.properties;if(!s)return[];const i=Array.isArray(t.required)?new Set(t.required.map(String)):new Set;return Object.entries(s).map(([n,r])=>({name:n,type:String(r.type??"any"),required:i.has(n),description:typeof r.description=="string"?r.description:void 0}))}function _e({fields:t}){return t.length===0?e.jsx("p",{className:"text-xs text-muted-foreground",children:"No fields."}):e.jsx("ul",{className:"space-y-2",children:t.map(s=>e.jsxs("li",{className:"space-y-0.5",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2",children:[e.jsx("code",{className:"text-xs font-medium text-foreground",children:s.name}),e.jsx("span",{className:"text-[10px] uppercase tracking-wide text-muted-foreground/70",children:s.type}),s.required?e.jsx("span",{className:"text-[10px] font-medium text-amber-600 dark:text-amber-400",children:"required"}):null]}),s.description?e.jsx("p",{className:"text-xs text-muted-foreground",children:s.description}):null]},s.name))})}function g({item:t,hideHeading:s=!1}){const i=t.schemaSections;return i?e.jsxs("article",{className:s?"space-y-4":"space-y-4 px-5 py-5",children:[!s&&e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(P,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[e.jsx("h2",{className:"text-base font-medium text-foreground",children:t.title}),i.description?e.jsx("p",{className:"text-xs text-muted-foreground",children:i.description}):null]})]}),i.sections.map(n=>{const r=ze(n.schema);return e.jsxs("section",{className:"space-y-1.5",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("h3",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:n.title}),n.description?e.jsx("span",{className:"truncate text-xs text-muted-foreground",children:n.description}):null]}),e.jsx(_e,{fields:r})]},n.title)})]}):null}function De({panel:t}){const s=z(t.organizationId),i=t.section==="connections"||!!t.connectionId,n=_(t.organizationId,{connectorKey:t.connectorKey,connectionIds:t.connectionId?[t.connectionId]:void 0,enabled:i}),r=s.data?.find(o=>o.key===t.connectorKey),a=n.data?.find(o=>o.id===t.connectionId&&o.connector_key===t.connectorKey);return s.isLoading||i&&n.isLoading?e.jsx("div",{className:"p-5",children:e.jsx(f,{className:"h-28 w-full"})}):s.isError||i&&n.isError?e.jsx("p",{role:"alert",className:"p-5 text-sm",children:"Could not load this connector. Close the pane and try again."}):t.connectionId&&!a||!r&&!a&&t.section!=="connections"?e.jsx("p",{className:"p-5 text-sm",children:"This connection is no longer available."}):e.jsx("div",{className:"p-5",children:t.section==="connections"?e.jsx(Ee,{connections:n.data?.filter(o=>o.connector_key===t.connectorKey)??[],connector:r,connectorKey:t.connectorKey,ownerSlug:t.ownerSlug}):a?e.jsx(Te,{connection:a,connector:r,panel:t}):r?t.section==="feeds"?e.jsx(Oe,{connector:r}):r.installed===!1?e.jsx(Re,{connector:r}):e.jsx(Be,{connector:r,organizationId:t.organizationId}):null},`${t.connectorKey}:${t.connectionId??"connector"}:${t.section}`)}function Ee({connections:t,connector:s,connectorKey:i,ownerSlug:n}){const[r,a]=h.useState(""),o=t.filter(c=>Ie({...c,connector_name:c.connector_name??s?.name??null}).toLowerCase().includes(r.trim().toLowerCase()));return e.jsxs("div",{className:"space-y-4",children:[e.jsx(D,{label:"connections",query:r,onQueryChange:a,count:o.length,action:e.jsx(m,{asChild:!0,size:"sm",variant:"outline",children:e.jsxs(w,{to:"/$owner/connectors/create/$connectorKey",params:{owner:n,connectorKey:i},children:[e.jsx(E,{className:"size-3.5"}),"Add connection"]})})}),e.jsx(Le,{connections:o,connectorDef:s,ownerSlug:n,connectorKey:i}),o.length===0&&e.jsx("p",{className:"py-5 text-sm text-muted-foreground",children:r.trim()?"No matches. Try another search.":"No connections yet."})]})}function Oe({connector:t}){const s=Object.entries(t.feeds_schema??{}).map(([i,n])=>{const r=n;return{id:i,name:r.name??i,description:r.description,feed:r}});return e.jsx(p,{entries:s,label:"feed types",renderDetail:({name:i,feed:n})=>e.jsx(g,{item:{href:"",title:i,schemaSections:T(n)},hideHeading:!0})})}function Re({connector:t}){const s=Object.entries(t.actions_schema??{}).map(([i,n])=>{const r=n;return{id:i,name:r.name??i,description:r.description,action:r}});return e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect an account to configure action approval."}),e.jsx(p,{entries:s,label:"actions",renderDetail:({name:i,action:n})=>e.jsx(g,{hideHeading:!0,item:{href:"",title:i,schemaSections:k(n)}})})]})}function Te({connection:t,connector:s,panel:i}){const[n,r]=h.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{hidden:n,children:i.section==="feeds"?e.jsx(Fe,{connection:t,connector:s,ownerSlug:i.ownerSlug}):e.jsx(O,{connection:t,inPeek:!0,onReviewPermissions:s?()=>r(!0):void 0})}),n&&s&&e.jsxs("div",{className:"space-y-4",children:[e.jsx(m,{variant:"ghost",size:"sm",onClick:()=>r(!1),children:"Back to actions"}),e.jsx("h2",{className:"text-base font-semibold",children:"Provider permissions"}),e.jsx(R,{connection:t,connectorDef:s})]})]})}function Fe({connection:t,connector:s,ownerSlug:i}){const{data:n=[],isLoading:r,isError:a}=V(t.id),[o,c]=h.useState(!1),d=t.facets?.chat??!1;if(r)return e.jsx(f,{className:"h-28 w-full"});if(a)return e.jsx("p",{role:"alert",children:"Could not load sources. Close the pane and try again."});const u=n.map(l=>({id:String(l.id),name:l.display_name||l.feed_key,status:Pe(l)??(l.operations.includes("sync")?"Sync enabled":"Live access"),feed:l}));return e.jsxs(e.Fragment,{children:[e.jsx("div",{hidden:o,children:e.jsx(p,{entries:u,label:d?"channels":"feeds",action:Object.keys(s?.feeds_schema??{}).length>0?e.jsx(m,{size:"sm",variant:"outline",onClick:()=>c(!0),children:d?"Add channel":"Add feed"}):void 0,renderDetail:({feed:l})=>l.store==="channel_messages"?e.jsx(Ce,{feed:l,hideHeader:!0}):e.jsx(Se,{feed:l,connectorDef:s,ownerSlug:i})})}),o&&s&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h2",{className:"text-base font-semibold",children:d?"Add channel":"Add feed"}),e.jsx(Ae,{organizationId:t.organization_id,connections:[t],connectorDefinitions:[s],onClose:()=>c(!1)})]})]})}function Be({connector:t,organizationId:s}){const{isAdmin:i,isLoading:n}=F(s),{data:r=[],isLoading:a,isError:o}=B(t.key),c=$(),d=K(`${s}:${t.key}`,M(t.default_connection_config)),{values:u,setValues:l}=d;if(n)return e.jsx(f,{className:"h-28 w-full"});if(!i)return e.jsx("p",{className:"text-sm text-muted-foreground",children:"Only workspace admins can configure connector actions."});if(a)return e.jsx(f,{className:"h-28 w-full"});if(o)return e.jsx("p",{role:"alert",children:"Could not load actions. Close the pane and try again."});const N=t.actions_schema??{},A=r.map(x=>({id:x.operation_key,name:x.name??x.operation_key,description:x.description,operation:x}));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Set when Lobu asks before running each action. Click an action to inspect its inputs. Individual connections can override this policy."}),e.jsx(p,{entries:A,label:"actions",renderControl:({operation:x,name:j})=>e.jsx(H,{value:q(x,u),"aria-label":`Mode for ${j}`,onChange:I=>{l(L=>({...L,[x.operation_key]:I}))}}),renderDetail:({operation:x,name:j})=>N[x.operation_key]?e.jsx(g,{hideHeading:!0,item:{href:"",title:j,schemaSections:k(N[x.operation_key])}}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No input fields."})}),c.isError&&e.jsx("p",{role:"alert",className:"text-sm text-destructive",children:"Could not save the policy. Your changes are still here; try again."}),e.jsx(U,{visible:d.hasConflict,onReload:d.reset}),d.dirty&&e.jsxs("div",{className:"sticky bottom-0 z-10 flex justify-end gap-2 border-t bg-background py-3",children:[e.jsx(m,{variant:"outline",size:"sm",onClick:d.reset,children:"Cancel"}),e.jsx(m,{size:"sm",disabled:c.isPending||!d.canSubmit,onClick:()=>c.mutate({connector_key:t.key,default_connection_config:{...t.default_connection_config,action_modes:u}},{onSuccess:()=>d.accept(u,u)}),children:c.isPending?"Saving…":"Save default policy"})]})]})}function $e({owner:t,path:s}){const{data:i,isLoading:n}=v(t,{slug:t}),r=i?.workspace,a=r?.type==="organization"?r.id:null,o=a?{slug:t}:void 0,{data:c,isLoading:d}=W(`/${t}/${Q(s)}`,o),u=c?.entity?.id;return n||d?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(C,{className:"mr-2"})," Loading…"]}):!a||u==null?e.jsx("p",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"This record no longer exists."}):e.jsx("div",{className:"px-4 py-4",children:e.jsx(S,{organizationId:a,ownerSlug:t,entityId:u,filters:{sortBy:"date",sortOrder:"desc"},dense:!0,emptyState:e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing has happened to this record yet."})})})}function y({owner:t,runId:s,runIds:i,contentIds:n}){const{data:r,isLoading:a}=v(t==="me"?null:t,{slug:t}),o=r?.workspace,c=t!=="me"&&o?.type==="organization"?o.id:null,d=h.useMemo(()=>{if(t==="me")return n?.length?{contentIds:n,sortBy:"date",sortOrder:"desc"}:void 0;const l=i??(s!=null?[s]:void 0);if(!(!l?.length&&!n?.length))return{...l?.length?{runIds:l}:{},...n?.length?{contentIds:n}:{}}},[t,n,s,i]),u=d!=null;return t!=="me"&&a?e.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:[e.jsx(C,{className:"mr-2"})," Loading…"]}):t!=="me"&&c==null?e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Couldn't resolve this workspace."}):u?e.jsx("div",{className:"px-4 py-4",children:e.jsx(S,{organizationId:c,ownerSlug:t,filters:d,dense:!0,emptyState:e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"No matching events yet."})})}):e.jsx("div",{className:"px-4 py-8 text-center text-sm text-muted-foreground",children:"Nothing to preview."})}function Ke({item:t}){if(t.connectorPanel)return e.jsx(De,{panel:t.connectorPanel});if(t.schemaSections)return e.jsx(g,{item:t});if(typeof t.browserUrl=="string"&&t.browserUrl.length>0)return e.jsx(b,{item:t});const s=t.href?G(t.href):null;return s?s.kind==="memory"?"runId"in s?e.jsx(y,{owner:s.owner,runId:s.runId}):"runIds"in s?e.jsx(y,{owner:s.owner,runIds:s.runIds}):e.jsx(y,{owner:s.owner,contentIds:s.contentIds}):s.kind==="entity"?e.jsx($e,{owner:s.owner,path:s.path}):t.runId?e.jsx(Me,{owner:s.owner,automationId:s.automationId,runId:t.runId}):e.jsx(He,{owner:s.owner,automationId:s.automationId,initialView:s.view??"activity",runId:s.runId}):e.jsx(b,{item:t})}function b({item:t}){const s=t.body,i=t.notificationType??"generic",n=t.createdAt,r=t.browserUrl??null,a=t.browserHandoff??null;return e.jsxs("article",{className:"space-y-4 px-5 py-5",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(Y,{className:"mt-0.5 h-4 w-4 shrink-0 text-muted-foreground"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-0.5 text-xs text-muted-foreground",children:[e.jsx("span",{children:J(i)}),n?e.jsx("span",{children:X(n)}):null]})]}),s?e.jsx("div",{className:"text-sm leading-6 text-foreground/90",children:e.jsx(Z,{text:s,linkPolicy:i==="action_approval_needed"?"app-links":"strip"})}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"No additional details were provided."}),t.owner&&t.sourceAttribution?e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground/80",children:"Generated from"}),e.jsx(ee,{owner:t.owner,source:t.sourceAttribution,className:"text-xs"})]}):null,r?e.jsx("div",{className:"space-y-2",children:a?.state==="expired"?e.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-300",children:a.error_message??"This draft expired before the page was opened."}):a?.state==="completed"?e.jsx("p",{className:"text-sm text-muted-foreground",children:"This handoff has already been activated in Chrome."}):e.jsxs(m,{type:"button",size:"sm",className:"h-8 text-sm",onClick:()=>{se(r)},children:[e.jsx(te,{className:"mr-1.5 h-3.5 w-3.5"}),"Open post"]})}):null]})}function Me({owner:t,automationId:s,runId:i}){const{organizationId:n}=be(t),r=ne(s,void 0,n),a=r.data?.automation?.managed_agent_id??null;return a?e.jsx(we,{agentId:a,automationId:s,ownerSlug:t,runId:i}):r.isLoading?e.jsx(f,{className:"h-24 w-full rounded-lg"}):e.jsx("p",{className:"text-sm text-muted-foreground",children:"This run has no agent transcript."})}function He({owner:t,automationId:s,initialView:i,runId:n}){const[r,a]=h.useState(i),o=r==="definition";return e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"flex justify-end",children:e.jsx(m,{type:"button",variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-foreground",onClick:()=>a(o?"activity":"definition"),children:o?"Done":e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"h-3.5 w-3.5"}),"Edit"]})})}),e.jsx(ke,{owner:t,agentId:null,automationId:s,view:r,runId:n,onDone:()=>a("activity")})]})}function qe(){const t=ie(),s=ae();return t?.item?e.jsx(Ue,{item:t.item,onClose:t.close,onBack:t.back,isNarrow:s}):null}function Ue({item:t,onClose:s,onBack:i,isNarrow:n}){const r=t.href?oe(t.href):null;h.useEffect(()=>{if(n)return;const c=d=>{d.key==="Escape"&&(d.preventDefault(),s())};return window.addEventListener("keydown",c),()=>window.removeEventListener("keydown",c)},[s,n]);const a=c=>e.jsxs("div",{className:"flex h-11 shrink-0 items-center gap-1 border-b border-border px-3",children:[i||c?e.jsx(m,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Back",onClick:i??s,children:e.jsx(me,{className:"h-4 w-4"})}):null,e.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground",children:t.title}),r?e.jsx(m,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Open full page",asChild:!0,children:e.jsx(w,{to:r.pathname,search:r.search??{},onClick:s,children:e.jsx(he,{className:"h-4 w-4"})})}):null,e.jsx(m,{type:"button",variant:"ghost",size:"icon",className:"size-7 shrink-0 text-muted-foreground hover:text-foreground","aria-label":"Close preview",onClick:s,children:e.jsx(fe,{className:"h-4 w-4"})})]}),o=e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:e.jsx(Ke,{item:t})});return n?e.jsx(ce,{open:!0,onOpenChange:c=>{c||s()},children:e.jsxs(de,{children:[e.jsx(le,{className:"fixed inset-0 z-40 bg-black/60 data-[state=open]:animate-in data-[state=open]:fade-in-0"}),e.jsxs(ue,{"aria-describedby":void 0,className:"fixed inset-y-0 right-0 z-50 flex w-full max-w-[460px] flex-col border-l border-border bg-background outline-none data-[state=open]:animate-in data-[state=open]:slide-in-from-right",children:[e.jsx(xe,{className:"sr-only",children:t.title}),a(!0),o]})]})}):e.jsxs("aside",{className:"flex w-[460px] max-w-[45vw] shrink-0 flex-col border-l border-border bg-background",children:[a(!1),o]})}function jt(){const{owner:t}=pe.useParams(),{data:s,isLoading:i,error:n}=v(t==="me"?null:t,{slug:t}),{session:r,isReady:a}=ge(),o=je(n)&&!s?.workspace;return ye({active:!i&&!o&&a&&!r&&!s?.workspace,owner:t})?null:e.jsx(ve,{children:e.jsxs("div",{className:"flex min-h-0 flex-1 flex-row",children:[e.jsx("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col overflow-y-auto",children:e.jsx(Ne,{})}),e.jsx(qe,{})]})})}export{jt as component};
|