@lobu/runtime-server 23.0.0 → 24.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/catalogs/connectors.json +70 -6
- package/dist/catalogs/skills.json +1 -1
- package/dist/component.json +1 -1
- package/dist/connectors/README.md +1 -1
- package/dist/connectors/linkedin-inbox-adapter.js +4 -7
- package/dist/connectors/linkedin.ts +53 -34
- package/dist/connectors/reddit.ts +92 -20
- package/dist/connectors/slack.ts +1 -0
- package/dist/connectors/whatsapp-web-adapter.js +41 -11
- package/dist/connectors/whatsapp-web-helpers.ts +1 -1
- package/dist/connectors/whatsapp_web.ts +2 -2
- package/dist/connectors/x-identity.ts +5 -3
- package/dist/db/migrations/20261019120000_retire_identities_of_deleted_entities.sql +21 -0
- package/dist/db/migrations/20261020120000_entities_live_metadata_domain.sql +66 -0
- package/dist/db/migrations/20261020130000_agents_starters.sql +14 -0
- package/dist/db/migrations/20261020140000_view_attachments_by_page.sql +71 -0
- package/dist/dependencies.bun.lock +63 -60
- package/dist/guest.bundle.js +362 -300
- package/dist/owletto/dist/assets/_-CC8cTmRg.js +3 -0
- package/dist/owletto/dist/assets/_-ksFp4zVf.js +2 -0
- package/dist/owletto/dist/assets/_agentId-DWUFSrVp.js +2 -0
- package/dist/owletto/dist/assets/_agentId-MENLoohA.js +2 -0
- package/dist/owletto/dist/assets/_automationId-BnHqdXOC.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-CefXIqy2.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-C1QPGf9E.js +2 -0
- package/dist/owletto/dist/assets/_conversationId-DinuPCUp.js +2 -0
- package/dist/owletto/dist/assets/{_deploymentId-BuUzGtVL.js → _deploymentId-BeyzVjRm.js} +2 -2
- package/dist/owletto/dist/assets/_eventId-3L_qeL_l.js +2 -0
- package/dist/owletto/dist/assets/_name-Dgedji78.js +2 -0
- package/dist/owletto/dist/assets/_owner-DbrKma4e.js +3 -0
- package/dist/owletto/dist/assets/_shape-DtVfRFz_.js +2 -0
- package/dist/owletto/dist/assets/_skillKey-CqLHzm7L.js +2 -0
- package/dist/owletto/dist/assets/_slug-ndDr_CUg.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-3CH5w8mr.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-DHQY9A8u.js +2 -0
- package/dist/owletto/dist/assets/{accept-invitation-w17IFTtf.js → accept-invitation-CRKbM2Xy.js} +2 -2
- package/dist/owletto/dist/assets/activity-route-view-CFLNukhD.js +2 -0
- package/dist/owletto/dist/assets/{agent-card-controls-mnTN2AZt.js → agent-card-controls-Be1Okb2C.js} +2 -2
- package/dist/owletto/dist/assets/{agent-client-setup-list-Bg3hBfUV.js → agent-client-setup-list-BA8dU_C6.js} +2 -2
- package/dist/owletto/dist/assets/agent-connect-pages-CAV-yXus.js +2 -0
- package/dist/owletto/dist/assets/agent-editor-form-Bi6WvYX-.js +2 -0
- package/dist/owletto/dist/assets/{agent-guardrails-route-BOrCXcAl.js → agent-guardrails-route-DMOjG1D4.js} +2 -2
- package/dist/owletto/dist/assets/{agent-loading-shells-Dqcvky-k.js → agent-loading-shells-De_2d8Lr.js} +2 -2
- package/dist/owletto/dist/assets/{agent-permissions-matrix-BOo_4r_4.js → agent-permissions-matrix-gZWl6mAe.js} +2 -2
- package/dist/owletto/dist/assets/{agent-skill-context-CCdvtlmH.js → agent-skill-context-JLaTamGR.js} +2 -2
- package/dist/owletto/dist/assets/{agent-skills-route-BUxIswuq.js → agent-skills-route-DcK41PWj.js} +2 -2
- package/dist/owletto/dist/assets/agent-subpage-shell-BBJoyTuC.js +2 -0
- package/dist/owletto/dist/assets/agent-thread-Buz3naVF.js +6 -0
- package/dist/owletto/dist/assets/agents-C-ReckCa.js +2 -0
- package/dist/owletto/dist/assets/agents-workbench-CqaKGggb.js +2 -0
- package/dist/owletto/dist/assets/app._appId-Cl1fTuIt.js +2 -0
- package/dist/owletto/dist/assets/automation-detail-content-BMLL4lxO.js +2 -0
- package/dist/owletto/dist/assets/automations-C-ReckCa.js +2 -0
- package/dist/owletto/dist/assets/callback-DTKKsfkz.js +2 -0
- package/dist/owletto/dist/assets/{card-Djgp00r_.js → card-yU0TmNRH.js} +2 -2
- package/dist/owletto/dist/assets/{claim-BYUZnyMp.js → claim-DJfTvlT2.js} +2 -2
- package/dist/owletto/dist/assets/client-rows--FrZfJol.js +2 -0
- package/dist/owletto/dist/assets/{clients-D3Zbjxin.js → clients-L4K1UT8c.js} +2 -2
- package/dist/owletto/dist/assets/{code-editor-DHeyRGZI.js → code-editor-U54Gwjit.js} +2 -2
- package/dist/owletto/dist/assets/connect-4zqtnDHb.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-Dj0SqgbE.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-sgtocSvf.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.activity-DTpSW1Xy.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId.index-h9X5H1x8.js +2 -0
- package/dist/owletto/dist/assets/{connection-C3XXFEqh.js → connection-ByvKkyFm.js} +2 -2
- package/dist/owletto/dist/assets/{connection-feed-detail-CIJJLDP8.js → connection-feed-detail-DWM9lTao.js} +2 -2
- package/dist/owletto/dist/assets/connections-browser-CEwYrYqt.js +2 -0
- package/dist/owletto/dist/assets/{connector-provenance-8-d8hl10.js → connector-provenance-BocTm__v.js} +2 -2
- package/dist/owletto/dist/assets/connector-scope-lists-OYDOydtz.js +2 -0
- package/dist/owletto/dist/assets/connectors-CyZpcE5f.js +2 -0
- package/dist/owletto/dist/assets/{consent-CdSvVCgx.js → consent-DdfINrVp.js} +2 -2
- package/dist/owletto/dist/assets/{conversations-table-BdXoZAfc.js → conversations-table-BSznfdYt.js} +2 -2
- package/dist/owletto/dist/assets/{core.esm-CYvgWCuv.js → core.esm-Dr7tcIB-.js} +2 -2
- package/dist/owletto/dist/assets/create-CBGwASon.js +2 -0
- package/dist/owletto/dist/assets/create-Cf5hp6Z8.js +2 -0
- package/dist/owletto/dist/assets/create-CwThQtd3.js +2 -0
- package/dist/owletto/dist/assets/{create-automation-form-CtSSeYj3.js → create-automation-form-9T5WnoUs.js} +3 -3
- package/dist/owletto/dist/assets/create._connectorKey-sNHQHNpg.js +2 -0
- package/dist/owletto/dist/assets/{cronstrue-n4qGUraE.js → cronstrue-BWFEyy_P.js} +2 -2
- package/dist/owletto/dist/assets/deployments-DHh9dyzv.js +2 -0
- package/dist/owletto/dist/assets/{deployments-body-BMp7UsMo.js → deployments-body-2xKS8gRo.js} +2 -2
- package/dist/owletto/dist/assets/{deployments-RvUdVkj3.js → deployments-wG_8QzOF.js} +2 -2
- package/dist/owletto/dist/assets/{device-CPU6CjkJ.js → device-6z-xgsoW.js} +2 -2
- package/dist/owletto/dist/assets/device-pin-tombstone-Cwq88RMU.js +2 -0
- package/dist/owletto/dist/assets/device._deviceId-BDerBfD9.js +2 -0
- package/dist/owletto/dist/assets/entity-avatar-Cc1CuI-0.js +2 -0
- package/dist/owletto/dist/assets/entity-options-DHdMC1Lx.js +2 -0
- package/dist/owletto/dist/assets/entity-page--OkXmlNP.js +2 -0
- package/dist/owletto/dist/assets/entity-type-page-89RoK_-P.js +2 -0
- package/dist/owletto/dist/assets/event-detail-D4YZRtrA.js +2 -0
- package/dist/owletto/dist/assets/events-feed-DsrkV2ix.js +2 -0
- package/dist/owletto/dist/assets/filter-editors-B1_QUpg_.js +2 -0
- package/dist/owletto/dist/assets/{full-page-spinner-DqpH99np.js → full-page-spinner-Cqih-8IW.js} +2 -2
- package/dist/owletto/dist/assets/guardrails-B8Rs1be3.js +2 -0
- package/dist/owletto/dist/assets/identity-B0nH4yiC.js +2 -0
- package/dist/owletto/dist/assets/index-4TSkcsth.js +2 -0
- package/dist/owletto/dist/assets/index-BSH07yVD.css +1 -0
- package/dist/owletto/dist/assets/index-BgkhXElB.js +2 -0
- package/dist/owletto/dist/assets/index-CoW4Bz3w.js +2 -0
- package/dist/owletto/dist/assets/index-Codw-Qqi.js +2 -0
- package/dist/owletto/dist/assets/{index-BQVliQW1.js → index-DAOyXG1X.js} +2 -2
- package/dist/owletto/dist/assets/{index-B9uPN6FC.js → index-DKPwCasf.js} +2 -2
- package/dist/owletto/dist/assets/index-DMyXd3bJ.js +2 -0
- package/dist/owletto/dist/assets/index-DYCqXaMf.js +7950 -0
- package/dist/owletto/dist/assets/index-DYYZLcJ0.js +2 -0
- package/dist/owletto/dist/assets/index-DYzWV5_z.js +2 -0
- package/dist/owletto/dist/assets/index-Da6CrGEu.js +2 -0
- package/dist/owletto/dist/assets/{index-Hio-HRfo.js → index-DfyDUpuI.js} +2 -2
- package/dist/owletto/dist/assets/index-DneshLbf.js +2 -0
- package/dist/owletto/dist/assets/index-TgRS2v_F.js +2 -0
- package/dist/owletto/dist/assets/{index-ICgKp3YK.js → index-ZNlrDc_f.js} +2 -2
- package/dist/owletto/dist/assets/{json-diff-DBoag_OS.js → json-diff-DFvYINBT.js} +3 -3
- package/dist/owletto/dist/assets/{list-skeleton-C_GuoxAH.js → list-skeleton-DFsEqLU1.js} +2 -2
- package/dist/owletto/dist/assets/login-DO0j-AYr.js +2 -0
- package/dist/owletto/dist/assets/{logout-CLGgeZB7.js → logout-BmNwoAf7.js} +2 -2
- package/dist/owletto/dist/assets/member-scope-gate-B2LrMWBU.js +2 -0
- package/dist/owletto/dist/assets/memory-browse-page-Cjpl8EbB.js +103 -0
- package/dist/owletto/dist/assets/{model-selector-dAbDgJvx.js → model-selector-TQcA93xm.js} +2 -2
- package/dist/owletto/dist/assets/models-D7aED5Sa.js +2 -0
- package/dist/owletto/dist/assets/new-BMrFy5Qa.js +2 -0
- package/dist/owletto/dist/assets/{new-BkdULx2r.js → new-ByBhteWA.js} +2 -2
- package/dist/owletto/dist/assets/new-DWp3deoW.js +2 -0
- package/dist/owletto/dist/assets/{oauth-workspace-access-BxsjwgdH.js → oauth-workspace-access-D_5uESuz.js} +2 -2
- package/dist/owletto/dist/assets/{organization-gxGeDjIV.js → organization-DTFoYP4V.js} +2 -2
- package/dist/owletto/dist/assets/peek-pane-content-DF5iGC3c.js +2 -0
- package/dist/owletto/dist/assets/{permissions-aPHaKLec.js → permissions-C_auqxfP.js} +2 -2
- package/dist/owletto/dist/assets/proposal-review-shell-DsNiavG_.js +2 -0
- package/dist/owletto/dist/assets/public-shell-ready-B2NUI89V.js +2 -0
- package/dist/owletto/dist/assets/{recent-D-65Pgu-.js → recent-3d99S2IE.js} +2 -2
- package/dist/owletto/dist/assets/record-activity-C9KfBkXb.js +2 -0
- package/dist/owletto/dist/assets/record-field-peek-BBZcRuGT.js +2 -0
- package/dist/owletto/dist/assets/record-session-BizRugWs.js +2 -0
- package/dist/owletto/dist/assets/{reset-password-uX_V6bip.js → reset-password-DqfcSn8M.js} +2 -2
- package/dist/owletto/dist/assets/runs-panel-T1ZxTVz6.js +2 -0
- package/dist/owletto/dist/assets/runs-table-D_8QlCCN.js +2 -0
- package/dist/owletto/dist/assets/schema-value-normalization-CylKX3PK.js +97 -0
- package/dist/owletto/dist/assets/settings-B_ClYztB.js +2 -0
- package/dist/owletto/dist/assets/settings-DgX1-xo7.js +2 -0
- package/dist/owletto/dist/assets/skills-Drw5tcZw.js +2 -0
- package/dist/owletto/dist/assets/{source-record-panels-CPyzlfD1.js → source-record-panels-Cg249m1S.js} +2 -2
- package/dist/owletto/dist/assets/{use-mention-search-By8RZyKW.js → use-mention-search-BYbFvHbJ.js} +2 -2
- package/dist/owletto/dist/assets/view-param-filters-DMSqkN2J.js +2 -0
- package/dist/owletto/dist/index.html +2 -2
- package/dist/server-main.bundle.mjs +3881 -3215
- package/npm-shrinkwrap.json +277 -261
- package/package.json +6 -5
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/agent-policy.js +0 -3
- package/vendor/core/dist/agent-tooling.d.ts +1 -1
- package/vendor/core/dist/agent-tooling.js +3 -1
- package/vendor/core/dist/contracts/agent-settings.d.ts +6 -2
- package/vendor/core/dist/contracts/agent-settings.js +12 -1
- package/vendor/core/dist/contracts/tools/manage-views.d.ts +53 -234
- package/vendor/core/dist/contracts/tools/manage-views.js +50 -76
- package/vendor/core/dist/contracts/tools/view-attach.d.ts +5 -8
- package/vendor/core/dist/contracts/tools/view-attach.js +14 -31
- package/vendor/core/dist/contracts/tools/view-definition.d.ts +21 -0
- package/vendor/core/dist/contracts/tools/view-definition.js +165 -0
- package/vendor/core/dist/contracts/worker/protocol.d.ts +39 -2
- package/vendor/core/dist/contracts/worker/protocol.js +24 -1
- package/vendor/core/dist/index.d.ts +1 -1
- package/vendor/core/dist/index.js +2 -1
- package/vendor/core/dist/suggestions.d.ts +15 -2
- package/vendor/core/dist/suggestions.js +48 -3
- package/vendor/core/dist/types.d.ts +26 -0
- package/vendor/core/dist/types.js +5 -0
- package/vendor/core/package.json +11 -5
- package/vendor/postgres/cf/src/connection.js +18 -0
- package/vendor/postgres/cjs/src/connection.js +18 -0
- package/vendor/postgres/src/connection.js +18 -0
- package/vendor/views/dist/api.d.ts +71 -17
- package/vendor/views/dist/api.js +200 -35
- package/vendor/views/dist/bridge.d.ts +3 -0
- package/vendor/views/dist/bridge.js +9 -1
- package/vendor/views/dist/components.d.ts +170 -0
- package/vendor/views/dist/components.js +361 -0
- package/vendor/views/dist/index.d.ts +1 -1
- package/vendor/views/package.json +11 -1
- package/dist/owletto/dist/assets/_-3J-IrxWk.js +0 -2
- package/dist/owletto/dist/assets/_-DYUE3ix4.js +0 -3
- package/dist/owletto/dist/assets/_agentId-Bn2IAjIy.js +0 -2
- package/dist/owletto/dist/assets/_agentId-Cam7Z0N7.js +0 -2
- package/dist/owletto/dist/assets/_automationId-CXEiKVZJ.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-CS85l61t.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-clVDIyW0.js +0 -2
- package/dist/owletto/dist/assets/_conversationId-Ci2k-BuN.js +0 -2
- package/dist/owletto/dist/assets/_eventId-B0662F8h.js +0 -2
- package/dist/owletto/dist/assets/_name-CwWePlOl.js +0 -2
- package/dist/owletto/dist/assets/_owner-dTWkrKsK.js +0 -3
- package/dist/owletto/dist/assets/_shape-BtS3y4M9.js +0 -2
- package/dist/owletto/dist/assets/_skillKey-Dc9m-nlR.js +0 -2
- package/dist/owletto/dist/assets/_slug-DQHutM41.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-B30ik8ma.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-CUHypQnF.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-CMqYiiKM.js +0 -2
- package/dist/owletto/dist/assets/agent-connect-pages-B_vrqLVc.js +0 -2
- package/dist/owletto/dist/assets/agent-editor-form-hTs7eO_U.js +0 -2
- package/dist/owletto/dist/assets/agent-subpage-shell-D92imvSt.js +0 -2
- package/dist/owletto/dist/assets/agent-thread-BJOijbT0.js +0 -6
- package/dist/owletto/dist/assets/agents-9XjpDj_S.js +0 -2
- package/dist/owletto/dist/assets/agents-workbench-Bt5QCYQ7.js +0 -2
- package/dist/owletto/dist/assets/app._appId-CKv7_squ.js +0 -2
- package/dist/owletto/dist/assets/automation-detail-content-vUwVumXf.js +0 -2
- package/dist/owletto/dist/assets/automations-9XjpDj_S.js +0 -2
- package/dist/owletto/dist/assets/callback-BRgcL8gz.js +0 -2
- package/dist/owletto/dist/assets/client-rows-EJSKR6z1.js +0 -2
- package/dist/owletto/dist/assets/connect-CfsFsy9P.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-DkiC8xos.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId-CIXrGOsT.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.activity-Ckdz6I0y.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.index-CNxafNeo.js +0 -2
- package/dist/owletto/dist/assets/connections-browser-CKZjzRz6.js +0 -2
- package/dist/owletto/dist/assets/connector-scope-lists-CadPVsI3.js +0 -2
- package/dist/owletto/dist/assets/connectors-lvLJ30lo.js +0 -2
- package/dist/owletto/dist/assets/create-0xW9eXxG.js +0 -2
- package/dist/owletto/dist/assets/create-B0qhrrX4.js +0 -2
- package/dist/owletto/dist/assets/create-CAfF-yI1.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-i6xxkWKV.js +0 -2
- package/dist/owletto/dist/assets/deployments-4Itm35Xc.js +0 -2
- package/dist/owletto/dist/assets/device-pin-tombstone-CrjG7gPo.js +0 -2
- package/dist/owletto/dist/assets/device._deviceId-Cs3ZmXWo.js +0 -2
- package/dist/owletto/dist/assets/entity-options-uXjgT7y9.js +0 -2
- package/dist/owletto/dist/assets/entity-page-Dc0LGr5U.js +0 -2
- package/dist/owletto/dist/assets/entity-type-page-CwZxa0BR.js +0 -2
- package/dist/owletto/dist/assets/event-detail-ve2d6Gbb.js +0 -2
- package/dist/owletto/dist/assets/events-feed-BtvhZF1f.js +0 -2
- package/dist/owletto/dist/assets/filter-editors-Cj-v6NtH.js +0 -2
- package/dist/owletto/dist/assets/guardrails-HFo2Ut8B.js +0 -2
- package/dist/owletto/dist/assets/identity-BigVSBCl.js +0 -2
- package/dist/owletto/dist/assets/index-BLEcy9-T.css +0 -1
- package/dist/owletto/dist/assets/index-BfedB4Rc.js +0 -2
- package/dist/owletto/dist/assets/index-CUw3aKBI.js +0 -2
- package/dist/owletto/dist/assets/index-CXhxUkv3.js +0 -2
- package/dist/owletto/dist/assets/index-Cr5hwh-C.js +0 -7950
- package/dist/owletto/dist/assets/index-CzkTV4ZQ.js +0 -2
- package/dist/owletto/dist/assets/index-DKSx8JN_.js +0 -2
- package/dist/owletto/dist/assets/index-DVk7Ug0d.js +0 -2
- package/dist/owletto/dist/assets/index-DmZuKGf8.js +0 -2
- package/dist/owletto/dist/assets/index-cPcroOH0.js +0 -2
- package/dist/owletto/dist/assets/index-n7sTbNv4.js +0 -2
- package/dist/owletto/dist/assets/index-xiFpcWKv.js +0 -2
- package/dist/owletto/dist/assets/login-Ci6ixHuL.js +0 -2
- package/dist/owletto/dist/assets/member-scope-gate-B44INDPY.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-DyQiRvzl.js +0 -103
- package/dist/owletto/dist/assets/models-DpVP7ZwX.js +0 -2
- package/dist/owletto/dist/assets/new-BUb7AnEW.js +0 -2
- package/dist/owletto/dist/assets/new-CHOr-EcI.js +0 -2
- package/dist/owletto/dist/assets/peek-pane-content-CHoQHe2H.js +0 -2
- package/dist/owletto/dist/assets/proposal-review-shell-UcZr87_Q.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-DcnlADmj.js +0 -2
- package/dist/owletto/dist/assets/record-activity-CBXH6v1d.js +0 -2
- package/dist/owletto/dist/assets/renderer-mEDnVW0O.js +0 -97
- package/dist/owletto/dist/assets/runs-C0rCgGwX.js +0 -2
- package/dist/owletto/dist/assets/runs-panel-Du1JMjg5.js +0 -2
- package/dist/owletto/dist/assets/runs-table-syPJ6r6T.js +0 -2
- package/dist/owletto/dist/assets/settings-9NkNA1G1.js +0 -2
- package/dist/owletto/dist/assets/settings-E-10sLQX.js +0 -2
- package/dist/owletto/dist/assets/skills-D2Ri9b4f.js +0 -2
- package/dist/owletto/dist/assets/status-dot-B-EWMgq6.js +0 -2
- package/dist/owletto/dist/assets/tabs-DqIIkCX-.js +0 -2
- package/dist/owletto/dist/assets/view-param-filters-CqLZQrnO.js +0 -2
- /package/vendor/postgres/{.bun-tag-f39dafdb2305d504 → .bun-tag-2f292c6554a8475e} +0 -0
package/vendor/views/dist/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Component, createContext, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
3
3
|
import { createRoot } from "react-dom/client";
|
|
4
4
|
import { ViewBridge } from "./bridge.js";
|
|
5
5
|
export function defineView(def) {
|
|
@@ -27,7 +27,30 @@ export function useScope() {
|
|
|
27
27
|
}
|
|
28
28
|
export function useHost() {
|
|
29
29
|
const rt = useRuntime();
|
|
30
|
-
return {
|
|
30
|
+
return {
|
|
31
|
+
connected: rt.connected,
|
|
32
|
+
ready: rt.ready,
|
|
33
|
+
theme: rt.theme,
|
|
34
|
+
openLink: rt.openLink,
|
|
35
|
+
displayMode: rt.displayMode,
|
|
36
|
+
container: rt.container,
|
|
37
|
+
requestDisplayMode: rt.requestDisplayMode,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** The workspace root relative links resolve against: the shell's
|
|
41
|
+
* `lobu-workspace` meta, absent outside a server-rendered shell. */
|
|
42
|
+
export function resolveViewHref(href) {
|
|
43
|
+
const base = document
|
|
44
|
+
.querySelector('meta[name="lobu-workspace"]')
|
|
45
|
+
?.getAttribute("content");
|
|
46
|
+
if (!base)
|
|
47
|
+
return href;
|
|
48
|
+
try {
|
|
49
|
+
return new URL(href, base).href;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return href;
|
|
53
|
+
}
|
|
31
54
|
}
|
|
32
55
|
function resultError(result) {
|
|
33
56
|
if (result.isError !== true)
|
|
@@ -94,7 +117,8 @@ function parseTextJson(result) {
|
|
|
94
117
|
* reports a thrown script as `success: false` — both would otherwise render as
|
|
95
118
|
* "no rows". The server's typed code rides along as `errorCode`, and a capped
|
|
96
119
|
* result (`query_sql`'s `has_more`, `query_sdk`'s `return_truncated`) is
|
|
97
|
-
* flagged `truncated` instead of passing as the whole answer
|
|
120
|
+
* flagged `truncated` instead of passing as the whole answer, and a
|
|
121
|
+
* `query_sql` cell bounded by its size limits is named in `truncatedColumns`.
|
|
98
122
|
*/
|
|
99
123
|
export function queryResult(kind, result) {
|
|
100
124
|
// structuredContent when the tool declares an outputSchema (query_sql,
|
|
@@ -108,6 +132,7 @@ export function queryResult(kind, result) {
|
|
|
108
132
|
error: sc.error,
|
|
109
133
|
errorCode: typeof sc.error_code === "string" ? sc.error_code : null,
|
|
110
134
|
truncated: false,
|
|
135
|
+
truncatedColumns: [],
|
|
111
136
|
};
|
|
112
137
|
if (kind === "sdk" && sc.success === false) {
|
|
113
138
|
const e = sc.error;
|
|
@@ -120,6 +145,7 @@ export function queryResult(kind, result) {
|
|
|
120
145
|
: "Query script failed",
|
|
121
146
|
errorCode: typeof code === "string" ? code : null,
|
|
122
147
|
truncated: false,
|
|
148
|
+
truncatedColumns: [],
|
|
123
149
|
};
|
|
124
150
|
}
|
|
125
151
|
// MCP also marks resolved SQL/SDK failures isError; decode their envelopes
|
|
@@ -133,6 +159,7 @@ export function queryResult(kind, result) {
|
|
|
133
159
|
error: err,
|
|
134
160
|
errorCode: typeof code === "string" ? code : null,
|
|
135
161
|
truncated: false,
|
|
162
|
+
truncatedColumns: [],
|
|
136
163
|
};
|
|
137
164
|
}
|
|
138
165
|
// query_sdk → { success, return_value }, query_sql → { rows }, a named
|
|
@@ -141,7 +168,16 @@ export function queryResult(kind, result) {
|
|
|
141
168
|
const truncated = kind === "sql"
|
|
142
169
|
? sc.has_more === true
|
|
143
170
|
: kind === "sdk" && sc.return_truncated != null;
|
|
144
|
-
|
|
171
|
+
const truncatedColumns = kind === "sql" && Array.isArray(sc.truncated_columns)
|
|
172
|
+
? sc.truncated_columns.filter((c) => typeof c === "string")
|
|
173
|
+
: [];
|
|
174
|
+
return {
|
|
175
|
+
data: data ?? null,
|
|
176
|
+
error: null,
|
|
177
|
+
errorCode: null,
|
|
178
|
+
truncated,
|
|
179
|
+
truncatedColumns,
|
|
180
|
+
};
|
|
145
181
|
}
|
|
146
182
|
/**
|
|
147
183
|
* Run a read through the host. `sql\`…\`` → `query_sql`; a string →
|
|
@@ -149,13 +185,15 @@ export function queryResult(kind, result) {
|
|
|
149
185
|
* fetch waits for the host's first `tool-input`: reads before it run against
|
|
150
186
|
* defaults and double-fetch when the real scope lands.
|
|
151
187
|
*/
|
|
152
|
-
export function useQuery(query) {
|
|
188
|
+
export function useQuery(query, options = {}) {
|
|
189
|
+
const live = options.live ?? true;
|
|
153
190
|
const rt = useRuntime();
|
|
154
191
|
const [state, setState] = useState({
|
|
155
192
|
data: null,
|
|
156
193
|
error: null,
|
|
157
194
|
errorCode: null,
|
|
158
195
|
truncated: false,
|
|
196
|
+
truncatedColumns: [],
|
|
159
197
|
loading: query !== null,
|
|
160
198
|
});
|
|
161
199
|
const [tick, setTick] = useState(0);
|
|
@@ -187,6 +225,12 @@ export function useQuery(query) {
|
|
|
187
225
|
// Queries still wait for the host to seed scope and params.
|
|
188
226
|
if (!rt.ready)
|
|
189
227
|
return;
|
|
228
|
+
// A non-live read ignores data changes; a new key or refetch() still reads.
|
|
229
|
+
if (!live &&
|
|
230
|
+
lastRead.current?.key === key &&
|
|
231
|
+
lastRead.current.tick === tick) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
190
234
|
const seq = ++readSeq.current;
|
|
191
235
|
const show = (next) => {
|
|
192
236
|
if (lastRead.current?.key !== key || seq < shownSeq.current)
|
|
@@ -195,8 +239,9 @@ export function useQuery(query) {
|
|
|
195
239
|
setState(next);
|
|
196
240
|
};
|
|
197
241
|
const background = lastRead.current?.key === key &&
|
|
242
|
+
lastRead.current.tick === tick &&
|
|
198
243
|
lastRead.current.dataVersion !== rt.dataVersion;
|
|
199
|
-
lastRead.current = { key, dataVersion: rt.dataVersion };
|
|
244
|
+
lastRead.current = { key, dataVersion: rt.dataVersion, tick };
|
|
200
245
|
if (!background)
|
|
201
246
|
setState((s) => ({ ...s, loading: true }));
|
|
202
247
|
const q = query;
|
|
@@ -216,10 +261,11 @@ export function useQuery(query) {
|
|
|
216
261
|
error: e instanceof Error ? e.message : String(e),
|
|
217
262
|
errorCode: null,
|
|
218
263
|
truncated: false,
|
|
264
|
+
truncatedColumns: [],
|
|
219
265
|
loading: false,
|
|
220
266
|
});
|
|
221
267
|
});
|
|
222
|
-
}, [key, rt.ready, tick, rt.dataVersion]);
|
|
268
|
+
}, [key, rt.ready, tick, rt.dataVersion, live]);
|
|
223
269
|
const refetch = useCallback(() => setTick((t) => t + 1), []);
|
|
224
270
|
return { ...state, refetch };
|
|
225
271
|
}
|
|
@@ -352,10 +398,98 @@ export function coerceScope(raw) {
|
|
|
352
398
|
function themeFromContext(ctx) {
|
|
353
399
|
return ctx.theme === "dark" ? "dark" : "light";
|
|
354
400
|
}
|
|
401
|
+
/** `pip` and unknown modes render like a card; only fullscreen is the full view. */
|
|
402
|
+
function displayModeFromContext(ctx) {
|
|
403
|
+
return ctx.displayMode === "fullscreen" ? "fullscreen" : "inline";
|
|
404
|
+
}
|
|
405
|
+
function containerFromContext(ctx) {
|
|
406
|
+
const raw = ctx.containerDimensions;
|
|
407
|
+
if (!raw || typeof raw !== "object")
|
|
408
|
+
return {};
|
|
409
|
+
const out = {};
|
|
410
|
+
for (const key of ["width", "maxWidth", "height", "maxHeight"]) {
|
|
411
|
+
const value = raw[key];
|
|
412
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
413
|
+
out[key] = value;
|
|
414
|
+
}
|
|
415
|
+
return out;
|
|
416
|
+
}
|
|
355
417
|
function applyTheme(theme) {
|
|
356
418
|
document.documentElement.classList.toggle("dark", theme === "dark");
|
|
357
419
|
document.documentElement.style.colorScheme = theme;
|
|
358
420
|
}
|
|
421
|
+
/**
|
|
422
|
+
* The MCP Apps standard style variables (`McpUiStyleVariableKey`, protocol
|
|
423
|
+
* `2026-01-26`). A host sends any subset in `hostContext.styles.variables`;
|
|
424
|
+
* the shell's tokens (`--fg`, `--muted`, `--border`, `--accent`, the font and
|
|
425
|
+
* radii) derive from them, so a view takes the host's look. Built from the
|
|
426
|
+
* spec's own axes rather than imported: the guest carries no ext-apps code.
|
|
427
|
+
*/
|
|
428
|
+
const SEMANTIC = ["primary", "secondary", "tertiary", "inverse", "ghost"];
|
|
429
|
+
const STATUS = ["info", "danger", "success", "warning"];
|
|
430
|
+
const HEADINGS = ["xs", "sm", "md", "lg", "xl", "2xl", "3xl"];
|
|
431
|
+
const HOST_STYLE_KEYS = new Set([
|
|
432
|
+
...["background", "text", "border"].flatMap((part) => [...SEMANTIC, ...STATUS, "disabled"].map((v) => `--color-${part}-${v}`)),
|
|
433
|
+
...["primary", "secondary", "inverse", ...STATUS].map((v) => `--color-ring-${v}`),
|
|
434
|
+
"--font-sans",
|
|
435
|
+
"--font-mono",
|
|
436
|
+
...["normal", "medium", "semibold", "bold"].map((w) => `--font-weight-${w}`),
|
|
437
|
+
...["size", "line-height"].flatMap((m) => [
|
|
438
|
+
...["xs", "sm", "md", "lg"].map((s) => `--font-text-${s}-${m}`),
|
|
439
|
+
...HEADINGS.map((s) => `--font-heading-${s}-${m}`),
|
|
440
|
+
]),
|
|
441
|
+
...["xs", "sm", "md", "lg", "xl", "full"].map((r) => `--border-radius-${r}`),
|
|
442
|
+
"--border-width-regular",
|
|
443
|
+
...["hairline", "sm", "md", "lg"].map((s) => `--shadow-${s}`),
|
|
444
|
+
]);
|
|
445
|
+
/**
|
|
446
|
+
* Apply the host's standard style variables to the document root. Every
|
|
447
|
+
* standard key is set or cleared from the current context, so a variable a
|
|
448
|
+
* theme switch drops does not linger; anything outside the standard list is
|
|
449
|
+
* ignored, never written.
|
|
450
|
+
*/
|
|
451
|
+
function applyHostStyles(ctx) {
|
|
452
|
+
const styles = ctx.styles;
|
|
453
|
+
const variables = styles && typeof styles.variables === "object" && styles.variables
|
|
454
|
+
? styles.variables
|
|
455
|
+
: {};
|
|
456
|
+
const root = document.documentElement.style;
|
|
457
|
+
for (const key of HOST_STYLE_KEYS) {
|
|
458
|
+
const value = variables[key];
|
|
459
|
+
if (typeof value === "string" && value.trim()) {
|
|
460
|
+
root.setProperty(key, value);
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
root.removeProperty(key);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Contains a render error to the view so the Provider (which owns the host
|
|
469
|
+
* handshake) stays mounted: an uncaught error would unmount it before its
|
|
470
|
+
* effect connects, leaving the host a blank frame with no size and no error.
|
|
471
|
+
* `resetKey` changes when the host delivers scope/params or data changes, so
|
|
472
|
+
* a render that only failed for lack of scope retries once it arrives.
|
|
473
|
+
*/
|
|
474
|
+
class RenderBoundary extends Component {
|
|
475
|
+
state = { error: null, resetKey: this.props.resetKey };
|
|
476
|
+
static getDerivedStateFromError(error) {
|
|
477
|
+
return { error: error instanceof Error ? error : new Error(String(error)) };
|
|
478
|
+
}
|
|
479
|
+
static getDerivedStateFromProps(props, state) {
|
|
480
|
+
return props.resetKey === state.resetKey
|
|
481
|
+
? null
|
|
482
|
+
: { error: null, resetKey: props.resetKey };
|
|
483
|
+
}
|
|
484
|
+
componentDidCatch(error) {
|
|
485
|
+
console.error("[lobu-views] view failed to render", error);
|
|
486
|
+
}
|
|
487
|
+
render() {
|
|
488
|
+
if (!this.state.error)
|
|
489
|
+
return this.props.children;
|
|
490
|
+
return (_jsxs("div", { role: "alert", style: { padding: 12, color: "var(--fg)" }, children: ["This view failed to render: ", this.state.error.message] }));
|
|
491
|
+
}
|
|
492
|
+
}
|
|
359
493
|
/**
|
|
360
494
|
* Host bridge provider: seeds scope/params from the first tool-input,
|
|
361
495
|
* exposes reads/actions over tools/call, mirrors params through
|
|
@@ -368,6 +502,8 @@ export function Provider({ def, bridge, children, }) {
|
|
|
368
502
|
const [scope, setScope] = useState({});
|
|
369
503
|
const [params, setParamsState] = useState(() => defaultsFor(def));
|
|
370
504
|
const [theme, setTheme] = useState("light");
|
|
505
|
+
const [displayMode, setDisplayMode] = useState("inline");
|
|
506
|
+
const [container, setContainer] = useState({});
|
|
371
507
|
const [dataVersion, setDataVersion] = useState(0);
|
|
372
508
|
const bridgeRef = useRef(bridge ?? null);
|
|
373
509
|
if (bridge)
|
|
@@ -394,17 +530,19 @@ export function Provider({ def, bridge, children, }) {
|
|
|
394
530
|
setScope(coerceScope(resolved.scope));
|
|
395
531
|
}
|
|
396
532
|
});
|
|
397
|
-
const
|
|
533
|
+
const adoptContext = (ctx) => {
|
|
398
534
|
const next = themeFromContext(ctx);
|
|
399
535
|
setTheme(next);
|
|
400
536
|
applyTheme(next);
|
|
401
|
-
|
|
537
|
+
applyHostStyles(ctx);
|
|
538
|
+
setDisplayMode(displayModeFromContext(ctx));
|
|
539
|
+
setContainer(containerFromContext(ctx));
|
|
540
|
+
};
|
|
541
|
+
const offCtx = b.onHostContext(adoptContext);
|
|
402
542
|
const offData = b.onDataChanged(() => setDataVersion((v) => v + 1));
|
|
403
543
|
b.connect()
|
|
404
544
|
.then((ctx) => {
|
|
405
|
-
|
|
406
|
-
setTheme(next);
|
|
407
|
-
applyTheme(next);
|
|
545
|
+
adoptContext(ctx);
|
|
408
546
|
setConnected(true);
|
|
409
547
|
setReady(b.hasToolInput());
|
|
410
548
|
document.documentElement.setAttribute("data-ready", "true");
|
|
@@ -417,6 +555,30 @@ export function Provider({ def, bridge, children, }) {
|
|
|
417
555
|
offData();
|
|
418
556
|
};
|
|
419
557
|
}, [def]);
|
|
558
|
+
// Report the document height so the host can fit the frame. This lives in
|
|
559
|
+
// the provider, not `mountView`: the server bootstrap renders the provider
|
|
560
|
+
// directly, and a frame that never hears a size stays at its minimum height.
|
|
561
|
+
useEffect(() => {
|
|
562
|
+
const b = bridgeRef.current;
|
|
563
|
+
if (!b)
|
|
564
|
+
return;
|
|
565
|
+
const reportSize = () => {
|
|
566
|
+
const doc = document.documentElement;
|
|
567
|
+
doc.setAttribute("data-mounted", "true");
|
|
568
|
+
const prev = doc.style.height;
|
|
569
|
+
doc.style.height = "max-content";
|
|
570
|
+
const height = Math.ceil(doc.getBoundingClientRect().height);
|
|
571
|
+
doc.style.height = prev;
|
|
572
|
+
b.notifySize(Math.ceil(window.innerWidth), height);
|
|
573
|
+
};
|
|
574
|
+
reportSize();
|
|
575
|
+
if (typeof ResizeObserver === "undefined")
|
|
576
|
+
return;
|
|
577
|
+
const observer = new ResizeObserver(reportSize);
|
|
578
|
+
observer.observe(document.documentElement);
|
|
579
|
+
observer.observe(document.body);
|
|
580
|
+
return () => observer.disconnect();
|
|
581
|
+
}, []);
|
|
420
582
|
const setParams = useCallback((patch) => {
|
|
421
583
|
setParamsState((prev) => {
|
|
422
584
|
const next = coerceParams(def, { ...prev, ...patch });
|
|
@@ -437,6 +599,21 @@ export function Provider({ def, bridge, children, }) {
|
|
|
437
599
|
}
|
|
438
600
|
return b.callTool(name, args);
|
|
439
601
|
}, []);
|
|
602
|
+
const openLink = useCallback(async (url) => {
|
|
603
|
+
const b = bridgeRef.current;
|
|
604
|
+
if (!b?.isConnected())
|
|
605
|
+
throw new Error("Not connected to a host");
|
|
606
|
+
const error = resultError(await b.openLink(resolveViewHref(url)));
|
|
607
|
+
if (error)
|
|
608
|
+
throw new Error(error);
|
|
609
|
+
}, []);
|
|
610
|
+
const requestDisplayMode = useCallback(async (mode) => {
|
|
611
|
+
const b = bridgeRef.current;
|
|
612
|
+
if (!b?.isConnected())
|
|
613
|
+
throw new Error("Not connected to a host");
|
|
614
|
+
const granted = await b.requestDisplayMode(mode);
|
|
615
|
+
return granted === "fullscreen" ? "fullscreen" : "inline";
|
|
616
|
+
}, []);
|
|
440
617
|
const value = useMemo(() => ({
|
|
441
618
|
def,
|
|
442
619
|
connected,
|
|
@@ -447,6 +624,10 @@ export function Provider({ def, bridge, children, }) {
|
|
|
447
624
|
theme,
|
|
448
625
|
dataVersion,
|
|
449
626
|
callTool,
|
|
627
|
+
openLink,
|
|
628
|
+
displayMode,
|
|
629
|
+
container,
|
|
630
|
+
requestDisplayMode,
|
|
450
631
|
}), [
|
|
451
632
|
def,
|
|
452
633
|
connected,
|
|
@@ -457,10 +638,14 @@ export function Provider({ def, bridge, children, }) {
|
|
|
457
638
|
theme,
|
|
458
639
|
dataVersion,
|
|
459
640
|
callTool,
|
|
641
|
+
openLink,
|
|
642
|
+
displayMode,
|
|
643
|
+
container,
|
|
644
|
+
requestDisplayMode,
|
|
460
645
|
]);
|
|
461
646
|
// A host-resolved replacement is a new form, including in MCP hosts that
|
|
462
647
|
// keep the iframe mounted while delivering the opening result.
|
|
463
|
-
return (_jsx(Ctx.Provider, { value: value, children: children }, scope.event ?? "unbound"));
|
|
648
|
+
return (_jsx(Ctx.Provider, { value: value, children: _jsx(RenderBoundary, { resetKey: `${ready}:${JSON.stringify(scope)}:${JSON.stringify(params)}:${dataVersion}`, children: children }) }, scope.event ?? "unbound"));
|
|
464
649
|
}
|
|
465
650
|
/** Entry point the compiled bundle calls once. Mounts the component into
|
|
466
651
|
* `#root` and connects to the host. */
|
|
@@ -469,26 +654,6 @@ export function mountView(def, Component, opts) {
|
|
|
469
654
|
const el = document.getElementById("root");
|
|
470
655
|
if (!el)
|
|
471
656
|
throw new Error("#root missing in view shell");
|
|
472
|
-
|
|
473
|
-
let reported = false;
|
|
474
|
-
const reportSize = () => {
|
|
475
|
-
if (!reported) {
|
|
476
|
-
reported = true;
|
|
477
|
-
document.documentElement.setAttribute("data-mounted", "true");
|
|
478
|
-
}
|
|
479
|
-
const doc = document.documentElement;
|
|
480
|
-
const prev = doc.style.height;
|
|
481
|
-
doc.style.height = "max-content";
|
|
482
|
-
const height = Math.ceil(doc.getBoundingClientRect().height);
|
|
483
|
-
doc.style.height = prev;
|
|
484
|
-
bridge.notifySize(Math.ceil(window.innerWidth), height);
|
|
485
|
-
};
|
|
486
|
-
createRoot(el).render(_jsx(Provider, { def: valid, bridge: bridge, children: _jsx(Component, {}) }));
|
|
487
|
-
if (typeof ResizeObserver !== "undefined") {
|
|
488
|
-
const observer = new ResizeObserver(reportSize);
|
|
489
|
-
observer.observe(document.documentElement);
|
|
490
|
-
observer.observe(document.body);
|
|
491
|
-
}
|
|
492
|
-
reportSize();
|
|
657
|
+
createRoot(el).render(_jsx(Provider, { def: valid, bridge: opts?.bridge, children: _jsx(Component, {}) }));
|
|
493
658
|
}
|
|
494
659
|
//# sourceMappingURL=api.js.map
|
|
@@ -125,6 +125,9 @@ export declare class ViewBridge {
|
|
|
125
125
|
updateModelContext(structuredContent: Record<string, unknown>): Promise<void>;
|
|
126
126
|
sendMessage(text: string): Promise<ToolResult>;
|
|
127
127
|
openLink(url: string): Promise<ToolResult>;
|
|
128
|
+
/** Ask the host for `mode`; resolves with the mode it actually set, which
|
|
129
|
+
* may differ when the host does not offer the one requested. */
|
|
130
|
+
requestDisplayMode(mode: "inline" | "fullscreen"): Promise<string>;
|
|
128
131
|
/** Report the document size so the host can fit the frame. Fire-and-forget:
|
|
129
132
|
* a host that ignores it keeps its default height. */
|
|
130
133
|
notifySize(width: number, height: number): void;
|
|
@@ -132,7 +132,7 @@ export class ViewBridge {
|
|
|
132
132
|
this.startListening();
|
|
133
133
|
const result = (await this.request("ui/initialize", {
|
|
134
134
|
appInfo: this.appInfo,
|
|
135
|
-
appCapabilities: {},
|
|
135
|
+
appCapabilities: { availableDisplayModes: ["inline", "fullscreen"] },
|
|
136
136
|
protocolVersion: PROTOCOL_VERSION,
|
|
137
137
|
}));
|
|
138
138
|
const ctx = (result.hostContext ?? {});
|
|
@@ -210,6 +210,14 @@ export class ViewBridge {
|
|
|
210
210
|
openLink(url) {
|
|
211
211
|
return this.request("ui/open-link", { url });
|
|
212
212
|
}
|
|
213
|
+
/** Ask the host for `mode`; resolves with the mode it actually set, which
|
|
214
|
+
* may differ when the host does not offer the one requested. */
|
|
215
|
+
async requestDisplayMode(mode) {
|
|
216
|
+
const result = (await this.request("ui/request-display-mode", {
|
|
217
|
+
mode,
|
|
218
|
+
}));
|
|
219
|
+
return typeof result.mode === "string" ? result.mode : mode;
|
|
220
|
+
}
|
|
213
221
|
/** Report the document size so the host can fit the frame. Fire-and-forget:
|
|
214
222
|
* a host that ignores it keeps its default height. */
|
|
215
223
|
notifySize(width, height) {
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@lobu/views/components` — first-party presentational kit for Lobu views.
|
|
3
|
+
*
|
|
4
|
+
* React-only by design: inline styles, no fetch, no
|
|
5
|
+
* document access. Everything here runs inside the sandboxed MCP Apps frame,
|
|
6
|
+
* where the host (not the view) owns data access. Reads still go through
|
|
7
|
+
* `useQuery`/`tool`/`sql` from `@lobu/views`; these components only render
|
|
8
|
+
* what the host returns, plus the honest states (`QueryState.loading`,
|
|
9
|
+
* `.error`, `.errorCode`, `.truncated`) that `useQuery` reports.
|
|
10
|
+
*
|
|
11
|
+
* Styling follows the shell's theme tokens (`--fg`, `--muted`, `--border`,
|
|
12
|
+
* `--accent`, `--font`, `--radius`, `--radius-lg`), which derive from the
|
|
13
|
+
* host's MCP Apps style variables and flip with its `.dark` class, so kit
|
|
14
|
+
* output takes the host's look without configuration. Theme tokens carry
|
|
15
|
+
* light-mode fallbacks; pie series and error accents use fixed colors.
|
|
16
|
+
*
|
|
17
|
+
* Server-side compile allowlist: this module is pinned beside `react` and
|
|
18
|
+
* `@lobu/views` in the view compiler funds, so MCP/tool-path views may
|
|
19
|
+
* `import { DataTable } from "@lobu/views/components"`. Anything fancier
|
|
20
|
+
* (third-party chart/table libraries, user components in other files) ships
|
|
21
|
+
* through `lobu apply`, which bundles the project's own `node_modules`.
|
|
22
|
+
*/
|
|
23
|
+
import type { ReactNode } from "react";
|
|
24
|
+
export interface CardProps {
|
|
25
|
+
title?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
actions?: ReactNode;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
/** Section container: title row, optional description and action slot. */
|
|
31
|
+
export declare function Card({ title, description, actions, children }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export interface TableColumn<T> {
|
|
33
|
+
/** Stable key; doubles as the server sort key when `sortable`. */
|
|
34
|
+
key: string;
|
|
35
|
+
header: string;
|
|
36
|
+
align?: "left" | "center" | "right";
|
|
37
|
+
sortable?: boolean;
|
|
38
|
+
/** Custom cell. Defaults to `String(row[key] ?? "")`. */
|
|
39
|
+
render?: (row: T) => ReactNode;
|
|
40
|
+
}
|
|
41
|
+
export interface TablePagination {
|
|
42
|
+
/** 1-based current page. */
|
|
43
|
+
page: number;
|
|
44
|
+
pageSize: number;
|
|
45
|
+
/** Total rows when known; otherwise a short page disables Next. */
|
|
46
|
+
total?: number;
|
|
47
|
+
onPage: (page: number) => void;
|
|
48
|
+
}
|
|
49
|
+
export interface TableSort {
|
|
50
|
+
key: string;
|
|
51
|
+
dir: "asc" | "desc";
|
|
52
|
+
}
|
|
53
|
+
export interface DataTableProps<T> {
|
|
54
|
+
columns: TableColumn<T>[];
|
|
55
|
+
rows: T[];
|
|
56
|
+
keyOf: (row: T, index: number) => string | number;
|
|
57
|
+
loading?: boolean;
|
|
58
|
+
error?: string | null;
|
|
59
|
+
onRetry?: () => void;
|
|
60
|
+
emptyText?: string;
|
|
61
|
+
/** Controlled server-side sort; omit for unsorted data. */
|
|
62
|
+
sort?: TableSort;
|
|
63
|
+
onSort?: (key: string) => void;
|
|
64
|
+
pagination?: TablePagination;
|
|
65
|
+
caption?: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Server-driven table. The view owns state (page/sort live in `useParams`,
|
|
69
|
+
* rows come from `useQuery`); the table only renders and reports intent.
|
|
70
|
+
* Pass query loading/error state explicitly; render TruncatedNotice beside
|
|
71
|
+
* the table when the query reports partial results.
|
|
72
|
+
*/
|
|
73
|
+
export declare function DataTable<T>({ columns, rows, keyOf, loading, error, onRetry, emptyText, sort, onSort, pagination, caption, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
74
|
+
/** Layout row for filter controls; wrap `SearchField`/`SelectField`. */
|
|
75
|
+
export declare function FilterBar({ children }: {
|
|
76
|
+
children: ReactNode;
|
|
77
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
78
|
+
/**
|
|
79
|
+
* Controlled search box. The view owns the value (usually a `useParams`
|
|
80
|
+
* entry); pushing every keystroke into params re-renders the whole view, so
|
|
81
|
+
* debounce at the call site when the backing query is expensive.
|
|
82
|
+
*/
|
|
83
|
+
export declare function SearchField({ label, value, onChange, placeholder, }: {
|
|
84
|
+
label?: string;
|
|
85
|
+
value: string;
|
|
86
|
+
onChange: (value: string) => void;
|
|
87
|
+
placeholder?: string;
|
|
88
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
89
|
+
export interface SelectOption {
|
|
90
|
+
value: string;
|
|
91
|
+
label: string;
|
|
92
|
+
}
|
|
93
|
+
/** Controlled select. `value === ""` means "no filter". */
|
|
94
|
+
export declare function SelectField({ label, value, options, onChange, }: {
|
|
95
|
+
label: string;
|
|
96
|
+
value: string;
|
|
97
|
+
options: SelectOption[];
|
|
98
|
+
onChange: (value: string) => void;
|
|
99
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
100
|
+
export interface ChartDatum {
|
|
101
|
+
label: string;
|
|
102
|
+
value: number;
|
|
103
|
+
color?: string;
|
|
104
|
+
}
|
|
105
|
+
/** Vertical bars. Values must already be aggregated — views cannot aggregate history. */
|
|
106
|
+
export declare function BarChart({ data, title, height, formatValue, }: {
|
|
107
|
+
data: ChartDatum[];
|
|
108
|
+
title?: string;
|
|
109
|
+
height?: number;
|
|
110
|
+
formatValue?: (v: number) => string;
|
|
111
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
112
|
+
/** Single-series line over ordered labels. */
|
|
113
|
+
export declare function LineChart({ data, title, height, baseline, formatValue, }: {
|
|
114
|
+
data: ChartDatum[];
|
|
115
|
+
title?: string;
|
|
116
|
+
height?: number;
|
|
117
|
+
/** `zero` (default) includes 0; `auto` fits the data's range. */
|
|
118
|
+
baseline?: "zero" | "auto";
|
|
119
|
+
formatValue?: (v: number) => string;
|
|
120
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
121
|
+
/** Pie with legend. Cap slices upstream (query limit); the chart renders what it gets. */
|
|
122
|
+
export declare function PieChart({ data, title, size, formatValue, }: {
|
|
123
|
+
data: ChartDatum[];
|
|
124
|
+
title?: string;
|
|
125
|
+
size?: number;
|
|
126
|
+
formatValue?: (v: number) => string;
|
|
127
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
128
|
+
/** Single-series inline trend. Purely presentational — no axes. */
|
|
129
|
+
export declare function Sparkline({ values, width, height, label, }: {
|
|
130
|
+
values: number[];
|
|
131
|
+
width?: number;
|
|
132
|
+
height?: number;
|
|
133
|
+
label?: string;
|
|
134
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
135
|
+
/**
|
|
136
|
+
* A link the host opens: `href="deal/acme-renewal"` opens that record
|
|
137
|
+
* (relative links resolve against the workspace root, see
|
|
138
|
+
* `useHost().openLink`), a full URL opens a new tab. The sandboxed frame
|
|
139
|
+
* cannot navigate itself, so every click goes through the host, modifier
|
|
140
|
+
* clicks included; the anchor still shows the resolved address on hover.
|
|
141
|
+
*/
|
|
142
|
+
export declare function Link({ href, children, }: {
|
|
143
|
+
href: string;
|
|
144
|
+
children: ReactNode;
|
|
145
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
146
|
+
export declare function LoadingState({ text }: {
|
|
147
|
+
text?: string;
|
|
148
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
149
|
+
export declare function EmptyState({ title, hint }: {
|
|
150
|
+
title: string;
|
|
151
|
+
hint?: string;
|
|
152
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
153
|
+
export declare function ErrorState({ message, errorCode, onRetry, }: {
|
|
154
|
+
message: string;
|
|
155
|
+
/** The server's typed code (e.g. UPSTREAM_TIMEOUT). Shown, never branched on for copy. */
|
|
156
|
+
errorCode?: string | null;
|
|
157
|
+
onRetry?: () => void;
|
|
158
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
159
|
+
/**
|
|
160
|
+
* Honest cap notice: the server answered, but not wholly (`query_sql` 500-row
|
|
161
|
+
* ceiling, `query_sdk` oversized return). Rendered data is partial by
|
|
162
|
+
* construction — narrow the query instead of treating it as complete.
|
|
163
|
+
*/
|
|
164
|
+
export declare function TruncatedNotice({ shown, total, }: {
|
|
165
|
+
shown: number;
|
|
166
|
+
total?: number;
|
|
167
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
168
|
+
/** Format large counts compactly (1.2K, 3.4M). Plain numbers pass through. */
|
|
169
|
+
export declare function formatCompact(value: number): string;
|
|
170
|
+
//# sourceMappingURL=components.d.ts.map
|