@lobu/runtime-server 22.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 +1448 -212
- package/dist/catalogs/skills.json +1 -1
- package/dist/component.json +1 -1
- package/dist/connectors/README.md +15 -2
- package/dist/connectors/google_gmail.ts +1 -0
- package/dist/connectors/jira-helpers.ts +313 -0
- package/dist/connectors/jira.ts +29 -221
- package/dist/connectors/linkedin-browser-script.ts +13 -0
- package/dist/connectors/linkedin-draft-page.js +104 -0
- package/dist/connectors/linkedin-drafts.ts +73 -0
- package/dist/connectors/linkedin-identity.ts +32 -0
- package/dist/connectors/linkedin-inbox-adapter.js +1182 -0
- package/dist/connectors/linkedin-inbox.ts +156 -0
- package/dist/connectors/linkedin-like.ts +114 -0
- package/dist/connectors/linkedin-takeout.ts +577 -0
- package/dist/connectors/linkedin.ts +4017 -0
- package/dist/connectors/reddit.ts +92 -20
- package/dist/connectors/slack.ts +1 -0
- package/dist/connectors/takeout-utils.ts +240 -0
- package/dist/connectors/tiktok-inbox-page.js +9 -9
- package/dist/connectors/tiktok-web-page.js +21 -15
- package/dist/connectors/tiktok_web.ts +63 -30
- package/dist/connectors/whatsapp-web-adapter.js +104 -574
- package/dist/connectors/whatsapp-web-helpers.ts +30 -444
- package/dist/connectors/whatsapp-web-identity.ts +20 -6
- package/dist/connectors/whatsapp_web.ts +46 -646
- package/dist/connectors/x-dm-adapter.js +556 -0
- package/dist/connectors/x-identity.ts +33 -2
- package/dist/connectors/x.ts +266 -120
- package/dist/db/migrations/20261017120000_drop_feeds_kind_virtual.sql +26 -0
- package/dist/db/migrations/20261017130000_drop_retired_dead_code_columns.sql +46 -0
- 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 +78 -75
- package/dist/guest.bundle.js +650 -448
- 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-BQfYN1U2.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-D3OgJG4i.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-DzRs4Ix9.js → agent-card-controls-Be1Okb2C.js} +2 -2
- package/dist/owletto/dist/assets/{agent-client-setup-list-B2SvH7xD.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-BaV1VpDh.js → agent-guardrails-route-DMOjG1D4.js} +2 -2
- package/dist/owletto/dist/assets/{agent-loading-shells-CtZJM2Gc.js → agent-loading-shells-De_2d8Lr.js} +2 -2
- package/dist/owletto/dist/assets/{agent-permissions-matrix-Ds48KFK9.js → agent-permissions-matrix-gZWl6mAe.js} +2 -2
- package/dist/owletto/dist/assets/{agent-skill-context-DPk5r08w.js → agent-skill-context-JLaTamGR.js} +2 -2
- package/dist/owletto/dist/assets/{agent-skills-route-DYpB5H1J.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-DIF8SF9b.js → card-yU0TmNRH.js} +2 -2
- package/dist/owletto/dist/assets/{claim-DELEa-gH.js → claim-DJfTvlT2.js} +2 -2
- package/dist/owletto/dist/assets/client-rows--FrZfJol.js +2 -0
- package/dist/owletto/dist/assets/{clients-CpG676mg.js → clients-L4K1UT8c.js} +2 -2
- package/dist/owletto/dist/assets/{code-editor-V27Z4o3P.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-DySpRE9x.js → connection-ByvKkyFm.js} +2 -2
- package/dist/owletto/dist/assets/{connection-feed-detail-C_D68j6d.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-CNXtzYg5.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-BVzxrAO9.js → consent-DdfINrVp.js} +2 -2
- package/dist/owletto/dist/assets/{conversations-table-DfZGICl7.js → conversations-table-BSznfdYt.js} +2 -2
- package/dist/owletto/dist/assets/{core.esm-DiTpULFl.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-9T5WnoUs.js +3 -0
- package/dist/owletto/dist/assets/create._connectorKey-sNHQHNpg.js +2 -0
- package/dist/owletto/dist/assets/{cronstrue-DPXl0qA2.js → cronstrue-BWFEyy_P.js} +2 -2
- package/dist/owletto/dist/assets/deployments-DHh9dyzv.js +2 -0
- package/dist/owletto/dist/assets/{deployments-body-D6TAWs_6.js → deployments-body-2xKS8gRo.js} +2 -2
- package/dist/owletto/dist/assets/{deployments-DCQdFdwG.js → deployments-wG_8QzOF.js} +2 -2
- package/dist/owletto/dist/assets/{device-CntqYW65.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-KpV2FS2u.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-BNh2cidi.js → index-DAOyXG1X.js} +2 -2
- package/dist/owletto/dist/assets/{index-BEvyBdOU.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-DCdkwg9H.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-BJXkc60S.js → index-ZNlrDc_f.js} +2 -2
- package/dist/owletto/dist/assets/{json-diff-D_Ym3Uku.js → json-diff-DFvYINBT.js} +3 -3
- package/dist/owletto/dist/assets/{list-skeleton-Bl0OS39L.js → list-skeleton-DFsEqLU1.js} +2 -2
- package/dist/owletto/dist/assets/login-DO0j-AYr.js +2 -0
- package/dist/owletto/dist/assets/{logout-DUccApuZ.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-CB1BDvlW.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-B5UsLiy6.js → new-ByBhteWA.js} +2 -2
- package/dist/owletto/dist/assets/new-DWp3deoW.js +2 -0
- package/dist/owletto/dist/assets/{oauth-workspace-access-PGyTnW2K.js → oauth-workspace-access-D_5uESuz.js} +2 -2
- package/dist/owletto/dist/assets/{organization-BH8PYlVu.js → organization-DTFoYP4V.js} +2 -2
- package/dist/owletto/dist/assets/peek-pane-content-DF5iGC3c.js +2 -0
- package/dist/owletto/dist/assets/{permissions-CwN_YP3u.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-DqdZE_TI.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-DAvBYkiI.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-CRIPMWfN.js → source-record-panels-Cg249m1S.js} +2 -2
- package/dist/owletto/dist/assets/{use-mention-search-DqEykWl_.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 +14031 -12680
- package/npm-shrinkwrap.json +329 -313
- package/package.json +6 -5
- package/vendor/connector-sdk/dist/browser-handoff-banner.d.ts +39 -0
- package/vendor/connector-sdk/dist/browser-handoff-banner.js +175 -0
- package/vendor/connector-sdk/dist/browser-source-read.d.ts +52 -0
- package/vendor/connector-sdk/dist/browser-source-read.js +107 -0
- package/vendor/connector-sdk/dist/connector-types.d.ts +10 -0
- package/vendor/connector-sdk/dist/index.d.ts +3 -0
- package/vendor/connector-sdk/dist/index.js +2 -0
- package/vendor/connector-sdk/package.json +9 -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/capabilities.d.ts +1 -1
- package/vendor/core/dist/capabilities.js +0 -1
- package/vendor/core/dist/connector-query-errors.d.ts +32 -0
- package/vendor/core/dist/connector-query-errors.js +41 -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-conversations.js +2 -2
- package/vendor/core/dist/contracts/tools/manage-feeds.d.ts +14 -0
- package/vendor/core/dist/contracts/tools/manage-feeds.js +17 -0
- 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 +47 -133
- package/vendor/core/dist/contracts/worker/protocol.js +33 -62
- package/vendor/core/dist/device-pin-tombstones.d.ts +44 -0
- package/vendor/core/dist/device-pin-tombstones.js +57 -0
- package/vendor/core/dist/index.d.ts +3 -2
- package/vendor/core/dist/index.js +3 -1
- package/vendor/core/dist/logger.js +10 -25
- 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/dist/utils/diagnostic-scrubber.js +258 -21
- package/vendor/core/dist/worker/wire.d.ts +0 -10
- package/vendor/core/package.json +16 -10
- 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/_-CEPl6gU4.js +0 -3
- package/dist/owletto/dist/assets/_-C_zNZben.js +0 -2
- package/dist/owletto/dist/assets/_agentId-CBC_SadO.js +0 -2
- package/dist/owletto/dist/assets/_agentId-QQW91cHX.js +0 -2
- package/dist/owletto/dist/assets/_automationId-YTTNksw6.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-fK0h7RAp.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-C7TPS598.js +0 -2
- package/dist/owletto/dist/assets/_conversationId-CEhxlTIo.js +0 -2
- package/dist/owletto/dist/assets/_eventId-Cl8GSdjg.js +0 -2
- package/dist/owletto/dist/assets/_name-t3oBJ6Zf.js +0 -2
- package/dist/owletto/dist/assets/_owner-cUtGHqSw.js +0 -3
- package/dist/owletto/dist/assets/_shape-bo2lMVCu.js +0 -2
- package/dist/owletto/dist/assets/_skillKey-Dwm4Q4wI.js +0 -2
- package/dist/owletto/dist/assets/_slug-CU1PuHB9.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-Bh6E_NxA.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-D4jKl-Zf.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-DQglkhXU.js +0 -2
- package/dist/owletto/dist/assets/agent-connect-pages-B6uKvT_X.js +0 -2
- package/dist/owletto/dist/assets/agent-editor-form-oUnIYHd7.js +0 -2
- package/dist/owletto/dist/assets/agent-subpage-shell-B3K_jPYR.js +0 -2
- package/dist/owletto/dist/assets/agent-thread-C8UaUTWc.js +0 -6
- package/dist/owletto/dist/assets/agents-F4mGI2oF.js +0 -2
- package/dist/owletto/dist/assets/agents-workbench-CMyk4PI7.js +0 -2
- package/dist/owletto/dist/assets/app._appId-DH1Qutz6.js +0 -2
- package/dist/owletto/dist/assets/automation-detail-content-CEDNboId.js +0 -2
- package/dist/owletto/dist/assets/automations-F4mGI2oF.js +0 -2
- package/dist/owletto/dist/assets/callback-CU-hb8JB.js +0 -2
- package/dist/owletto/dist/assets/client-rows-EJSKR6z1.js +0 -2
- package/dist/owletto/dist/assets/connect-B2YL6qIK.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-B6LDmDRV.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId-D_HaKoI1.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.activity-DQWcUqKM.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId.index-BC3R303A.js +0 -2
- package/dist/owletto/dist/assets/connections-browser-Cnv2iBbZ.js +0 -2
- package/dist/owletto/dist/assets/connector-scope-lists-BKDetNDc.js +0 -2
- package/dist/owletto/dist/assets/connectors-BJnk1z_2.js +0 -2
- package/dist/owletto/dist/assets/create-CUqO6Kfk.js +0 -2
- package/dist/owletto/dist/assets/create-JRFM8mMf.js +0 -2
- package/dist/owletto/dist/assets/create-automation-form-_4vUkrls.js +0 -3
- package/dist/owletto/dist/assets/create-iHcxV0xd.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-CCYLEicg.js +0 -2
- package/dist/owletto/dist/assets/deployments-ihkhK1zV.js +0 -2
- package/dist/owletto/dist/assets/device-pin-tombstone-Bz4JHHMK.js +0 -2
- package/dist/owletto/dist/assets/device._deviceId-D4plO3GM.js +0 -2
- package/dist/owletto/dist/assets/entity-options-UJs64GdQ.js +0 -2
- package/dist/owletto/dist/assets/entity-page-Djz6T50J.js +0 -2
- package/dist/owletto/dist/assets/entity-type-page-OznRag6A.js +0 -2
- package/dist/owletto/dist/assets/event-detail-04qOUGIP.js +0 -2
- package/dist/owletto/dist/assets/events-feed-fucGZSJR.js +0 -2
- package/dist/owletto/dist/assets/filter-editors-DCQgGLyR.js +0 -2
- package/dist/owletto/dist/assets/guardrails-molekzAF.js +0 -2
- package/dist/owletto/dist/assets/identity-BJcaG66g.js +0 -2
- package/dist/owletto/dist/assets/index-B04ON9Jv.js +0 -2
- package/dist/owletto/dist/assets/index-BLEcy9-T.css +0 -1
- package/dist/owletto/dist/assets/index-BOsK-K-2.js +0 -2
- package/dist/owletto/dist/assets/index-BOzuAbvi.js +0 -2
- package/dist/owletto/dist/assets/index-Bk1x7A67.js +0 -2
- package/dist/owletto/dist/assets/index-CFnx5huL.js +0 -2
- package/dist/owletto/dist/assets/index-D3s8rhG9.js +0 -2
- package/dist/owletto/dist/assets/index-Dbd1jusf.js +0 -2
- package/dist/owletto/dist/assets/index-DqZuqC08.js +0 -2
- package/dist/owletto/dist/assets/index-Dr-Xg_xO.js +0 -2
- package/dist/owletto/dist/assets/index-KPOvMVa-.js +0 -2
- package/dist/owletto/dist/assets/index-_oPeVpL_.js +0 -7950
- package/dist/owletto/dist/assets/login-QHdxqX-4.js +0 -2
- package/dist/owletto/dist/assets/member-scope-gate-CFbrq1by.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-IrIXuZTF.js +0 -103
- package/dist/owletto/dist/assets/models-DnMb3n-Z.js +0 -2
- package/dist/owletto/dist/assets/new-BWo8_Pms.js +0 -2
- package/dist/owletto/dist/assets/new-DpmDXmFI.js +0 -2
- package/dist/owletto/dist/assets/peek-pane-content-B2AFNTzP.js +0 -2
- package/dist/owletto/dist/assets/proposal-review-shell-DKKGu4Ww.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-7KYnww6e.js +0 -2
- package/dist/owletto/dist/assets/record-activity-CvgZyCmw.js +0 -2
- package/dist/owletto/dist/assets/renderer-BL6VcwQH.js +0 -97
- package/dist/owletto/dist/assets/runs-BWtc5rmc.js +0 -2
- package/dist/owletto/dist/assets/runs-panel-BO3h5RkS.js +0 -2
- package/dist/owletto/dist/assets/runs-table-DxIiqrSk.js +0 -2
- package/dist/owletto/dist/assets/settings-4Ev-0iNL.js +0 -2
- package/dist/owletto/dist/assets/settings-Crxlwps-.js +0 -2
- package/dist/owletto/dist/assets/skills-D0X430X8.js +0 -2
- package/dist/owletto/dist/assets/status-dot-C5KDvvm9.js +0 -2
- package/dist/owletto/dist/assets/tabs-B4Er9hJj.js +0 -2
- package/dist/owletto/dist/assets/view-param-filters-Cylutoy1.js +0 -2
- package/vendor/core/dist/contracts/worker/device-chat.d.ts +0 -4
- package/vendor/core/dist/contracts/worker/device-chat.js +0 -26
- /package/vendor/postgres/{.bun-tag-f39dafdb2305d504 → .bun-tag-2f292c6554a8475e} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Reddit Connector (V1 runtime)
|
|
3
3
|
*
|
|
4
|
-
* Fetches posts and comments from Reddit subreddits or search queries
|
|
5
|
-
* Supports both authenticated (OAuth) and
|
|
4
|
+
* Fetches posts and comments from Reddit subreddits or search queries, and the
|
|
5
|
+
* connected user's home feed. Supports both authenticated (OAuth) and
|
|
6
|
+
* unauthenticated (public JSON API) modes.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
import {
|
|
@@ -16,6 +17,7 @@ import {
|
|
|
16
17
|
type SyncContext,
|
|
17
18
|
type SyncResult,
|
|
18
19
|
} from '@lobu/connector-sdk';
|
|
20
|
+
import addFormats from 'ajv-formats';
|
|
19
21
|
|
|
20
22
|
// ---------------------------------------------------------------------------
|
|
21
23
|
// Reddit API types
|
|
@@ -71,6 +73,16 @@ interface RedditCheckpoint {
|
|
|
71
73
|
pagination_cutoff?: string;
|
|
72
74
|
}
|
|
73
75
|
|
|
76
|
+
// Use the gateway's URI format check: WHATWG URL parsing also accepts non-URI characters.
|
|
77
|
+
const isUri = addFormats.get('uri') as (value: string) => boolean;
|
|
78
|
+
|
|
79
|
+
/** Metadata declares these fields `format: uri`; one bad value rejects the whole batch. */
|
|
80
|
+
function httpUrl(value: string | undefined): string | undefined {
|
|
81
|
+
if (!value || !isUri(value) || !URL.canParse(value)) return undefined;
|
|
82
|
+
const { protocol } = new URL(value);
|
|
83
|
+
return protocol === 'http:' || protocol === 'https:' ? value : undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
74
86
|
// ---------------------------------------------------------------------------
|
|
75
87
|
// Connector
|
|
76
88
|
// ---------------------------------------------------------------------------
|
|
@@ -79,8 +91,9 @@ export default class RedditConnector extends ConnectorRuntime {
|
|
|
79
91
|
readonly definition: RuntimeConnectorDefinition = {
|
|
80
92
|
key: 'reddit',
|
|
81
93
|
name: 'Reddit',
|
|
82
|
-
description:
|
|
83
|
-
|
|
94
|
+
description:
|
|
95
|
+
"Fetches posts and comments from Reddit subreddits or search queries, and the connected user's home feed.",
|
|
96
|
+
version: '1.2.1',
|
|
84
97
|
faviconDomain: 'reddit.com',
|
|
85
98
|
authSchema: {
|
|
86
99
|
methods: [
|
|
@@ -88,6 +101,7 @@ export default class RedditConnector extends ConnectorRuntime {
|
|
|
88
101
|
type: 'oauth',
|
|
89
102
|
provider: 'reddit',
|
|
90
103
|
requiredScopes: ['identity', 'read', 'history'],
|
|
104
|
+
loginScopes: ['identity'],
|
|
91
105
|
setupInstructions:
|
|
92
106
|
'Create a Reddit app at https://www.reddit.com/prefs/apps — choose "web app" as the type. Set the redirect URI to {{redirect_uri}}, then copy the client ID and secret below.',
|
|
93
107
|
},
|
|
@@ -238,6 +252,48 @@ export default class RedditConnector extends ConnectorRuntime {
|
|
|
238
252
|
},
|
|
239
253
|
},
|
|
240
254
|
},
|
|
255
|
+
home_feed: {
|
|
256
|
+
key: 'home_feed',
|
|
257
|
+
name: 'Home feed',
|
|
258
|
+
sync: (ctx) => this.syncFeed(ctx),
|
|
259
|
+
description:
|
|
260
|
+
"Fetch the connected user's personalized home feed (Best). Requires user OAuth.",
|
|
261
|
+
displayNameTemplate: 'Reddit home feed',
|
|
262
|
+
configSchema: {
|
|
263
|
+
type: 'object',
|
|
264
|
+
properties: {
|
|
265
|
+
lookback_days: {
|
|
266
|
+
type: 'integer',
|
|
267
|
+
minimum: 1,
|
|
268
|
+
maximum: 30,
|
|
269
|
+
default: 7,
|
|
270
|
+
description: 'Skip home feed posts older than this many days.',
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
eventKinds: {
|
|
275
|
+
post: {
|
|
276
|
+
description: "A Reddit post from the connected user's home feed",
|
|
277
|
+
metadataSchema: {
|
|
278
|
+
type: 'object',
|
|
279
|
+
properties: {
|
|
280
|
+
subreddit: { type: 'string' },
|
|
281
|
+
score: { type: 'number', description: 'Reddit score (upvotes - downvotes)' },
|
|
282
|
+
num_comments: { type: 'number' },
|
|
283
|
+
upvote_ratio: { type: 'number' },
|
|
284
|
+
is_self: { type: 'boolean' },
|
|
285
|
+
domain: { type: 'string' },
|
|
286
|
+
thumbnail: { type: 'string', format: 'uri', description: 'Preview thumbnail URL' },
|
|
287
|
+
media_url: {
|
|
288
|
+
type: 'string',
|
|
289
|
+
format: 'uri',
|
|
290
|
+
description: 'Linked content URL for non-self posts (image, video, article)',
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
},
|
|
241
297
|
},
|
|
242
298
|
};
|
|
243
299
|
|
|
@@ -253,17 +309,20 @@ export default class RedditConnector extends ConnectorRuntime {
|
|
|
253
309
|
const subreddit = ctx.config.subreddit as string | undefined;
|
|
254
310
|
const searchTerms = ctx.config.search_terms as string | undefined;
|
|
255
311
|
const isUserFeed = ctx.feedKey === 'user_activity';
|
|
256
|
-
|
|
257
|
-
|
|
312
|
+
// Best is ranked, not chronological: old posts interleave with new ones and
|
|
313
|
+
// a saved `after` anchor is meaningless once the ranking moves.
|
|
314
|
+
const isHomeFeed = ctx.feedKey === 'home_feed';
|
|
315
|
+
const contentType = isUserFeed
|
|
316
|
+
? 'overview'
|
|
317
|
+
: isHomeFeed
|
|
318
|
+
? 'home'
|
|
319
|
+
: ctx.feedKey === 'comments'
|
|
320
|
+
? 'comment'
|
|
321
|
+
: 'post';
|
|
322
|
+
const lookbackDays = (ctx.config.lookback_days as number) ?? (isHomeFeed ? 7 : 365);
|
|
258
323
|
|
|
259
324
|
// Resolve access token: user OAuth > app-only OAuth > unauthenticated
|
|
260
325
|
const userAccessToken = ctx.credentials?.accessToken ?? null;
|
|
261
|
-
let accessToken: string | undefined = userAccessToken ?? undefined;
|
|
262
|
-
if (!accessToken) {
|
|
263
|
-
accessToken = await this.getAppOnlyToken(ctx);
|
|
264
|
-
}
|
|
265
|
-
const baseUrl = accessToken ? 'https://oauth.reddit.com' : 'https://www.reddit.com';
|
|
266
|
-
|
|
267
326
|
let username: string | undefined;
|
|
268
327
|
if (isUserFeed) {
|
|
269
328
|
if (!userAccessToken) {
|
|
@@ -273,9 +332,18 @@ export default class RedditConnector extends ConnectorRuntime {
|
|
|
273
332
|
}
|
|
274
333
|
username = await this.resolveUsername(ctx, userAccessToken);
|
|
275
334
|
}
|
|
335
|
+
if (isHomeFeed && !userAccessToken) {
|
|
336
|
+
throw new Error('home_feed requires user OAuth. Connect Reddit with the read scope.');
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
let accessToken: string | undefined = userAccessToken ?? undefined;
|
|
340
|
+
if (!accessToken) {
|
|
341
|
+
accessToken = await this.getAppOnlyToken(ctx);
|
|
342
|
+
}
|
|
343
|
+
const baseUrl = accessToken ? 'https://oauth.reddit.com' : 'https://www.reddit.com';
|
|
276
344
|
|
|
277
345
|
const previous = (ctx.checkpoint ?? {}) as RedditCheckpoint;
|
|
278
|
-
const resumeAfter = previous.pagination_token ?? null;
|
|
346
|
+
const resumeAfter = isHomeFeed ? null : (previous.pagination_token ?? null);
|
|
279
347
|
let cutoffDate = new Date();
|
|
280
348
|
cutoffDate.setDate(cutoffDate.getDate() - lookbackDays);
|
|
281
349
|
// Keep items eligible for the whole bounded sweep, even across sync runs.
|
|
@@ -355,6 +423,7 @@ export default class RedditConnector extends ConnectorRuntime {
|
|
|
355
423
|
const itemDate = new Date(itemData.created_utc * 1000);
|
|
356
424
|
|
|
357
425
|
if (itemDate < cutoffDate) {
|
|
426
|
+
if (isHomeFeed) continue;
|
|
358
427
|
reachedCutoff = true;
|
|
359
428
|
break;
|
|
360
429
|
}
|
|
@@ -388,8 +457,9 @@ export default class RedditConnector extends ConnectorRuntime {
|
|
|
388
457
|
|
|
389
458
|
const checkpoint: RedditCheckpoint = {
|
|
390
459
|
last_timestamp: new Date().toISOString(),
|
|
391
|
-
pagination_token: !reachedCutoff ? (after ?? undefined) : undefined,
|
|
392
|
-
pagination_cutoff:
|
|
460
|
+
pagination_token: !reachedCutoff && !isHomeFeed ? (after ?? undefined) : undefined,
|
|
461
|
+
pagination_cutoff:
|
|
462
|
+
!reachedCutoff && !isHomeFeed && after ? cutoffDate.toISOString() : undefined,
|
|
393
463
|
};
|
|
394
464
|
|
|
395
465
|
await ctx.commit(events, checkpoint as Record<string, unknown>);
|
|
@@ -498,6 +568,10 @@ export default class RedditConnector extends ConnectorRuntime {
|
|
|
498
568
|
return `${baseUrl}/user/${encodeURIComponent(username)}/overview${jsonSuffix}?limit=100&sort=new${afterParam}`;
|
|
499
569
|
}
|
|
500
570
|
|
|
571
|
+
if (contentType === 'home') {
|
|
572
|
+
return `${baseUrl}/best${jsonSuffix}?limit=100${afterParam}`;
|
|
573
|
+
}
|
|
574
|
+
|
|
501
575
|
if (contentType === 'comment') {
|
|
502
576
|
// Comments from a subreddit
|
|
503
577
|
if (subredditPath) {
|
|
@@ -541,11 +615,9 @@ export default class RedditConnector extends ConnectorRuntime {
|
|
|
541
615
|
});
|
|
542
616
|
|
|
543
617
|
// For non-self posts, the Reddit `url` field points to the linked content (image, article, etc.)
|
|
544
|
-
const mediaUrl = !post.is_self ? post.url : undefined;
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
? post.thumbnail
|
|
548
|
-
: undefined;
|
|
618
|
+
const mediaUrl = !post.is_self ? httpUrl(post.url) : undefined;
|
|
619
|
+
// `thumbnail` also carries placeholder words ("self", "image", "nsfw", ...).
|
|
620
|
+
const thumbnail = httpUrl(post.thumbnail);
|
|
549
621
|
|
|
550
622
|
return {
|
|
551
623
|
origin_id: `reddit_post_${post.name}`,
|
package/dist/connectors/slack.ts
CHANGED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure takeout parsing/formatting helpers for the LinkedIn data-export feeds
|
|
3
|
+
* (`linkedin.ts`, `linkedin-takeout.ts`).
|
|
4
|
+
*
|
|
5
|
+
* ISOLATE-SAFE BY CONTRACT: this module must never import `node:fs`,
|
|
6
|
+
* `node:path`, or any other builtin the isolate prelude does not provide.
|
|
7
|
+
* Connector bundles run in a V8 isolate and `assertIsolateEligible` rejects the
|
|
8
|
+
* WHOLE bundle over one surviving builtin `require`, so an `fs` import here
|
|
9
|
+
* would take down the live browser feeds of every connector that shares these
|
|
10
|
+
* helpers — the LinkedIn regression in Lobu#3392.
|
|
11
|
+
*
|
|
12
|
+
* `node:crypto` is fine: the guest prelude serves it from `global.crypto`
|
|
13
|
+
* (see ISOLATE_PRELUDE_PROVIDED_BUILTINS).
|
|
14
|
+
*
|
|
15
|
+
* The CSV reader is injected into the connector (see its constructor), never
|
|
16
|
+
* imported, so no filesystem code reaches the bundle.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { createHash } from "node:crypto";
|
|
20
|
+
import type { EventEnvelope } from "@lobu/connector-sdk";
|
|
21
|
+
|
|
22
|
+
const DEFAULT_WATERMARK = "1970-01-01T00:00:00.000Z";
|
|
23
|
+
const DEFAULT_BATCH_SIZE = 1000;
|
|
24
|
+
|
|
25
|
+
export interface LocalTakeoutConfig {
|
|
26
|
+
takeout_dir?: string;
|
|
27
|
+
batch_size?: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function batchSize(config: LocalTakeoutConfig): number {
|
|
31
|
+
return Math.max(1, Math.min(config.batch_size ?? DEFAULT_BATCH_SIZE, 5000));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function takeBatch<T extends EventEnvelope>(
|
|
35
|
+
events: T[],
|
|
36
|
+
watermark: string | undefined,
|
|
37
|
+
max: number
|
|
38
|
+
): T[] {
|
|
39
|
+
const after = watermark ?? DEFAULT_WATERMARK;
|
|
40
|
+
return events
|
|
41
|
+
.filter((event) => eventCursor(event) > after)
|
|
42
|
+
.sort((a, b) => eventCursor(a).localeCompare(eventCursor(b)))
|
|
43
|
+
.slice(0, max);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function maxEventCursor(
|
|
47
|
+
events: EventEnvelope[],
|
|
48
|
+
fallback?: string
|
|
49
|
+
): string {
|
|
50
|
+
return events.reduce(
|
|
51
|
+
(max, event) => (eventCursor(event) > max ? eventCursor(event) : max),
|
|
52
|
+
fallback ?? DEFAULT_WATERMARK
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Composite watermark: ISO timestamp + origin_id so events sharing a second
|
|
57
|
+
// still order deterministically. The delimiter is persisted inside the jsonb
|
|
58
|
+
// checkpoint column, so it must NOT be NUL: Postgres rejects NUL in jsonb
|
|
59
|
+
// (unsupported Unicode escape sequence). \u0001 (SOH) sorts before every
|
|
60
|
+
// printable char (preserving timestamp-first ordering) and is jsonb-safe.
|
|
61
|
+
const CURSOR_DELIMITER = "\u0001";
|
|
62
|
+
|
|
63
|
+
function eventCursor(event: EventEnvelope): string {
|
|
64
|
+
return `${event.occurred_at.toISOString()}${CURSOR_DELIMITER}${event.origin_id}`;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function stableId(
|
|
68
|
+
prefix: string,
|
|
69
|
+
parts: Array<string | number | undefined>
|
|
70
|
+
): string {
|
|
71
|
+
const hash = createHash("sha256")
|
|
72
|
+
.update(parts.map((part) => String(part ?? "")).join("\0"))
|
|
73
|
+
.digest("hex")
|
|
74
|
+
.slice(0, 32);
|
|
75
|
+
return `${prefix}_${hash}`;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function stripHtml(html: string): string {
|
|
79
|
+
return decodeHtml(htmlToPlainText(html))
|
|
80
|
+
.replace(/\n{3,}/g, "\n\n")
|
|
81
|
+
.replace(/[ \t]{2,}/g, " ")
|
|
82
|
+
.trim();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function htmlToPlainText(html: string): string {
|
|
86
|
+
let output = "";
|
|
87
|
+
let index = 0;
|
|
88
|
+
const lowerHtml = html.toLowerCase();
|
|
89
|
+
|
|
90
|
+
while (index < html.length) {
|
|
91
|
+
const char = html[index];
|
|
92
|
+
if (char !== "<") {
|
|
93
|
+
output += char;
|
|
94
|
+
index += 1;
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const tagEnd = html.indexOf(">", index + 1);
|
|
99
|
+
if (tagEnd === -1) {
|
|
100
|
+
output += char;
|
|
101
|
+
index += 1;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const tagName = readTagName(html.slice(index + 1, tagEnd));
|
|
106
|
+
if (tagName === "script" || tagName === "style") {
|
|
107
|
+
const closeTagStart = lowerHtml.indexOf(`</${tagName}`, tagEnd + 1);
|
|
108
|
+
if (closeTagStart === -1) {
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
const closeTagEnd = html.indexOf(">", closeTagStart + tagName.length + 2);
|
|
112
|
+
index = closeTagEnd === -1 ? html.length : closeTagEnd + 1;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (tagName === "br" || isBlockBreakTag(tagName)) {
|
|
117
|
+
output += "\n";
|
|
118
|
+
}
|
|
119
|
+
index = tagEnd + 1;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return output;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function readTagName(tag: string): string {
|
|
126
|
+
let index = tag[0] === "/" ? 1 : 0;
|
|
127
|
+
while (tag[index] === " " || tag[index] === "\t" || tag[index] === "\n") {
|
|
128
|
+
index += 1;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
let name = "";
|
|
132
|
+
while (index < tag.length) {
|
|
133
|
+
const char = tag[index]?.toLowerCase();
|
|
134
|
+
if (!char || !isAsciiNameChar(char)) {
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
name += char;
|
|
138
|
+
index += 1;
|
|
139
|
+
}
|
|
140
|
+
return name;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function isAsciiNameChar(char: string): boolean {
|
|
144
|
+
return (
|
|
145
|
+
(char >= "a" && char <= "z") || (char >= "0" && char <= "9") || char === "-"
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function isBlockBreakTag(tagName: string): boolean {
|
|
150
|
+
return (
|
|
151
|
+
tagName === "p" ||
|
|
152
|
+
tagName === "div" ||
|
|
153
|
+
tagName === "li" ||
|
|
154
|
+
tagName === "h1" ||
|
|
155
|
+
tagName === "h2" ||
|
|
156
|
+
tagName === "h3" ||
|
|
157
|
+
tagName === "h4" ||
|
|
158
|
+
tagName === "h5" ||
|
|
159
|
+
tagName === "h6"
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export function decodeHtml(text: string): string {
|
|
164
|
+
return text.replace(
|
|
165
|
+
/&(nbsp|amp|quot|#039|apos|#\d+|#x[0-9a-f]+);/gi,
|
|
166
|
+
(entity, code) => {
|
|
167
|
+
const normalized = String(code).toLowerCase();
|
|
168
|
+
if (normalized === "nbsp") return " ";
|
|
169
|
+
if (normalized === "amp") return "&";
|
|
170
|
+
if (normalized === "quot") return '"';
|
|
171
|
+
if (normalized === "#039" || normalized === "apos") return "'";
|
|
172
|
+
if (normalized.startsWith("#x")) {
|
|
173
|
+
const codePoint = Number.parseInt(normalized.slice(2), 16);
|
|
174
|
+
return decodeHtmlCodePoint(codePoint, entity);
|
|
175
|
+
}
|
|
176
|
+
if (normalized.startsWith("#")) {
|
|
177
|
+
const codePoint = Number(normalized.slice(1));
|
|
178
|
+
return decodeHtmlCodePoint(codePoint, entity);
|
|
179
|
+
}
|
|
180
|
+
return entity;
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function decodeHtmlCodePoint(codePoint: number, fallback: string): string {
|
|
186
|
+
if (!Number.isInteger(codePoint) || codePoint < 0 || codePoint > 0x10ffff) {
|
|
187
|
+
return fallback;
|
|
188
|
+
}
|
|
189
|
+
if (codePoint === 60 || codePoint === 62) {
|
|
190
|
+
return fallback;
|
|
191
|
+
}
|
|
192
|
+
return String.fromCodePoint(codePoint);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export function parseCsv(text: string): Record<string, string>[] {
|
|
196
|
+
const rows: string[][] = [];
|
|
197
|
+
let row: string[] = [];
|
|
198
|
+
let cell = "";
|
|
199
|
+
let inQuotes = false;
|
|
200
|
+
|
|
201
|
+
for (let i = 0; i < text.length; i++) {
|
|
202
|
+
const char = text[i];
|
|
203
|
+
const next = text[i + 1];
|
|
204
|
+
if (char === '"') {
|
|
205
|
+
if (inQuotes && next === '"') {
|
|
206
|
+
cell += '"';
|
|
207
|
+
i++;
|
|
208
|
+
} else {
|
|
209
|
+
inQuotes = !inQuotes;
|
|
210
|
+
}
|
|
211
|
+
} else if (char === "," && !inQuotes) {
|
|
212
|
+
row.push(cell);
|
|
213
|
+
cell = "";
|
|
214
|
+
} else if ((char === "\n" || char === "\r") && !inQuotes) {
|
|
215
|
+
if (char === "\r" && next === "\n") i++;
|
|
216
|
+
row.push(cell);
|
|
217
|
+
if (row.some((value) => value.trim().length > 0)) rows.push(row);
|
|
218
|
+
row = [];
|
|
219
|
+
cell = "";
|
|
220
|
+
} else {
|
|
221
|
+
cell += char;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
row.push(cell);
|
|
225
|
+
if (row.some((value) => value.trim().length > 0)) rows.push(row);
|
|
226
|
+
|
|
227
|
+
const headerIndex = rows.findIndex((candidate) => {
|
|
228
|
+
const values = candidate.map((value) => value.trim()).filter(Boolean);
|
|
229
|
+
return values.length > 1 && !values[0]?.startsWith("Notes:");
|
|
230
|
+
});
|
|
231
|
+
if (headerIndex < 0) return [];
|
|
232
|
+
const headers = rows[headerIndex].map((value) => value.trim());
|
|
233
|
+
return rows.slice(headerIndex + 1).map((values) => {
|
|
234
|
+
const record: Record<string, string> = {};
|
|
235
|
+
headers.forEach((header, index) => {
|
|
236
|
+
record[header] = values[index]?.trim() ?? "";
|
|
237
|
+
});
|
|
238
|
+
return record;
|
|
239
|
+
});
|
|
240
|
+
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// Serialized into the paired browser. Read only the inbox's own loaded records
|
|
2
2
|
// and read loaders; never return provider clients, tickets, or arbitrary state.
|
|
3
3
|
export async function tiktokInboxPage(input) {
|
|
4
|
-
const fail = message => { throw new Error(`TikTok inbox: ${message}`); };
|
|
4
|
+
const fail = (message, reason) => { throw Object.assign(new Error(`TikTok inbox: ${message}`), reason ? { browser_interruption: reason } : {}); };
|
|
5
5
|
const visible = element => !!element?.getClientRects().length;
|
|
6
6
|
const account = () => {
|
|
7
7
|
if (location.origin !== "https://www.tiktok.com") fail("Wrong page origin");
|
|
8
|
-
if (visible(document.querySelector("#captcha-verify-container-main-page"))) fail("Verification required in the connected browser");
|
|
8
|
+
if (visible(document.querySelector("#captcha-verify-container-main-page"))) fail("Verification required in the connected browser", "challenge_required");
|
|
9
9
|
const raw = document.querySelector("#__UNIVERSAL_DATA_FOR_REHYDRATION__")?.textContent;
|
|
10
10
|
const user = raw && JSON.parse(raw).__DEFAULT_SCOPE__?.["webapp.app-context"]?.user;
|
|
11
|
-
if (typeof user?.uid !== "string" || !/^\d+$/.test(user.uid)) fail("Sign-in is required");
|
|
11
|
+
if (typeof user?.uid !== "string" || !/^\d+$/.test(user.uid)) fail("Sign-in is required", "login_required");
|
|
12
12
|
return user.uid;
|
|
13
13
|
};
|
|
14
14
|
const owner = account();
|
|
@@ -16,12 +16,12 @@ export async function tiktokInboxPage(input) {
|
|
|
16
16
|
const pause = () => new Promise(resolve => setTimeout(resolve, 100));
|
|
17
17
|
const wait = async read => {
|
|
18
18
|
while (Date.now() < deadline) {
|
|
19
|
-
if (account() !== owner) fail("Account changed during the read");
|
|
19
|
+
if (account() !== owner) fail("Account changed during the read", "account_mismatch");
|
|
20
20
|
const value = read();
|
|
21
21
|
if (value) return value;
|
|
22
22
|
await pause();
|
|
23
23
|
}
|
|
24
|
-
fail("Inbox did not finish loading; restart this page read");
|
|
24
|
+
fail("Inbox did not finish loading; restart this page read", "loading_failure");
|
|
25
25
|
};
|
|
26
26
|
const readWithinDeadline = async read => {
|
|
27
27
|
let outcome;
|
|
@@ -47,7 +47,7 @@ export async function tiktokInboxPage(input) {
|
|
|
47
47
|
const bytes = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(JSON.stringify(row)));
|
|
48
48
|
return { ...row, source_revision: [...new Uint8Array(bytes)].map(byte => byte.toString(16).padStart(2, "0")).join("") };
|
|
49
49
|
}));
|
|
50
|
-
if (account() !== owner) fail("Account changed during the read");
|
|
50
|
+
if (account() !== owner) fail("Account changed during the read", "account_mismatch");
|
|
51
51
|
return { rows: revised, hasMore: !!next, ...(next ? { nextCursor: JSON.stringify({ v: feed === "messages" ? 2 : 1, feed, account: owner, ...next }) } : {}) };
|
|
52
52
|
};
|
|
53
53
|
// React attaches the source record and loading state to these exact inbox
|
|
@@ -162,7 +162,7 @@ export async function tiktokInboxPage(input) {
|
|
|
162
162
|
return null;
|
|
163
163
|
};
|
|
164
164
|
const api = await wait(clientApi);
|
|
165
|
-
if (api.instance.ctx?.option?.userId !== owner) fail("Message client belongs to a different account");
|
|
165
|
+
if (api.instance.ctx?.option?.userId !== owner) fail("Message client belongs to a different account", "account_mismatch");
|
|
166
166
|
await wait(() => {
|
|
167
167
|
if (api.stateStore.isInitError || api.stateStore.isNotAvailable) fail("Message initialization failed");
|
|
168
168
|
return api.stateStore.isInitSucceeded && api.stateStore.isInitLoadDone;
|
|
@@ -175,7 +175,7 @@ export async function tiktokInboxPage(input) {
|
|
|
175
175
|
const snapshot = [...ids].sort();
|
|
176
176
|
const finish = async (rows, next) => {
|
|
177
177
|
const output = await result(rows, next);
|
|
178
|
-
if (api.instance.ctx?.option?.userId !== owner) fail("Message client changed accounts during the read");
|
|
178
|
+
if (api.instance.ctx?.option?.userId !== owner) fail("Message client changed accounts during the read", "account_mismatch");
|
|
179
179
|
const latest = api.instance.getConversationList();
|
|
180
180
|
if (!Array.isArray(latest) || JSON.stringify(latest.map(thread => thread.id).sort()) !== JSON.stringify(snapshot)) fail("Conversation set changed; restart the read, previous coverage is incomplete");
|
|
181
181
|
return output;
|
|
@@ -204,7 +204,7 @@ export async function tiktokInboxPage(input) {
|
|
|
204
204
|
};
|
|
205
205
|
for (let page = 0; page < 20; page++) {
|
|
206
206
|
await wait(() => !thread.isPullingMessages);
|
|
207
|
-
if (api.instance.ctx?.option?.userId !== owner) fail("Message client changed accounts during the read");
|
|
207
|
+
if (api.instance.ctx?.option?.userId !== owner) fail("Message client changed accounts during the read", "account_mismatch");
|
|
208
208
|
const messages = thread.getMessageList().map(project).sort((a,b) => b.occurred_at.localeCompare(a.occurred_at) || b.id.localeCompare(a.id));
|
|
209
209
|
const start = cursor.after ? messages.findIndex(message => message.id === cursor.after) + 1 : 0;
|
|
210
210
|
if ((cursor.after && !start) || start === messages.length && thread.hasMoreMessages) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
// Self-contained browser adapter. Serialized into the user's paired browser;
|
|
2
2
|
// keep every dependency inside this function, as in the WhatsApp page adapter.
|
|
3
3
|
export async function tiktokPage(command, args = {}) {
|
|
4
|
+
const interrupt = (reason, message) => { throw Object.assign(new Error(message), { browser_interruption: reason }); };
|
|
4
5
|
const visible = (e) => !!e && e.getClientRects().length > 0;
|
|
5
6
|
const assertNoChallenge = () => {
|
|
6
7
|
if (visible(document.querySelector("#captcha-verify-container-main-page"))) {
|
|
7
|
-
|
|
8
|
+
interrupt("challenge_required", "TikTok verification required; complete the challenge in the connected browser");
|
|
8
9
|
}
|
|
9
10
|
};
|
|
10
11
|
assertNoChallenge();
|
|
@@ -19,27 +20,36 @@ export async function tiktokPage(command, args = {}) {
|
|
|
19
20
|
};
|
|
20
21
|
const wait = async (read) => {
|
|
21
22
|
for (let i = 0; i < 40; i++) {
|
|
23
|
+
assertNoChallenge();
|
|
22
24
|
const value = read();
|
|
23
25
|
if (value) return value;
|
|
24
26
|
await new Promise(resolve => setTimeout(resolve, 250));
|
|
25
27
|
}
|
|
26
|
-
|
|
28
|
+
interrupt("loading_failure", "TikTok page did not expose the requested content");
|
|
27
29
|
};
|
|
28
30
|
if (command === "identity") {
|
|
29
|
-
try { return await wait(identity); } catch {
|
|
31
|
+
try { return await wait(identity); } catch (error) {
|
|
32
|
+
if (error.browser_interruption !== "loading_failure") throw error;
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
30
35
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
const owner = identity()?.accountId;
|
|
37
|
+
if (!owner) interrupt("login_required", "TikTok sign-in is required");
|
|
38
|
+
if (command === "read_failure") interrupt("loading_failure", "TikTok page did not finish loading the requested content");
|
|
39
|
+
const assertTimeline = (path) => {
|
|
40
|
+
if (location.origin !== "https://www.tiktok.com" || location.pathname !== path) throw new Error("TikTok timeline page changed");
|
|
34
41
|
assertNoChallenge();
|
|
35
|
-
if (!identity())
|
|
42
|
+
if (!identity()) interrupt("login_required", "TikTok sign-in is required");
|
|
43
|
+
if (identity().accountId !== owner) interrupt("account_mismatch", "TikTok account changed during the read");
|
|
36
44
|
};
|
|
37
|
-
|
|
38
|
-
|
|
45
|
+
const assertFollowing = () => assertTimeline("/following");
|
|
46
|
+
if (["following_status", "following_wait", "for_you_status", "for_you_wait"].includes(command)) {
|
|
47
|
+
const path = command.startsWith("following_") ? "/following" : "/";
|
|
48
|
+
assertTimeline(path);
|
|
39
49
|
document.querySelectorAll("video,audio").forEach(media => { media.muted = true; });
|
|
40
|
-
if (command
|
|
50
|
+
if (command.endsWith("_wait")) {
|
|
41
51
|
await new Promise(resolve => setTimeout(resolve, 250));
|
|
42
|
-
|
|
52
|
+
assertTimeline(path);
|
|
43
53
|
}
|
|
44
54
|
return { ready: true };
|
|
45
55
|
}
|
|
@@ -94,10 +104,6 @@ export async function tiktokPage(command, args = {}) {
|
|
|
94
104
|
if (seen.size < args.limit && hasMore) throw new Error(`TikTok Following read incomplete: collected ${seen.size} of ${args.limit} requested posts; retry the read`);
|
|
95
105
|
return { items: [...items.values()] };
|
|
96
106
|
}
|
|
97
|
-
if (command === "snapshot") {
|
|
98
|
-
const d = scope();
|
|
99
|
-
return { items: (d["webapp.updated-items"] || []).map(project) };
|
|
100
|
-
}
|
|
101
107
|
if (command === "post_links") {
|
|
102
108
|
// Hidden preload links appear before search results render. Their presence
|
|
103
109
|
// satisfies wait_for_selector but cannot establish readable coverage.
|