@lobu/runtime-server 24.11.0 → 24.12.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 +1113 -107
- package/dist/catalogs/skills.json +2 -2
- package/dist/component.json +1 -1
- package/dist/connectors/README.md +2 -2
- package/dist/connectors/chat-transport-actions.ts +50 -0
- package/dist/connectors/discord.ts +2 -0
- package/dist/connectors/gchat.ts +2 -0
- package/dist/connectors/github.ts +4 -4
- package/dist/connectors/google_drive.ts +20 -0
- package/dist/connectors/google_gmail.ts +49 -8
- package/dist/connectors/herdr.ts +1 -1
- package/dist/connectors/imessage.ts +1 -0
- package/dist/connectors/linkedin-browser-script.ts +11 -0
- package/dist/connectors/linkedin-draft-page.js +24 -8
- package/dist/connectors/linkedin-inbox-adapter.js +209 -19
- package/dist/connectors/linkedin-inbox.ts +152 -4
- package/dist/connectors/linkedin-network.ts +788 -0
- package/dist/connectors/linkedin-search.ts +1284 -0
- package/dist/connectors/linkedin.ts +892 -27
- package/dist/connectors/microsoft_outlook.ts +57 -19
- package/dist/connectors/rss.ts +179 -33
- package/dist/connectors/slack.ts +2 -0
- package/dist/connectors/source-file-attachment.ts +46 -0
- package/dist/connectors/teams.ts +2 -0
- package/dist/connectors/telegram.ts +2 -0
- package/dist/connectors/tiktok_web.ts +1 -1
- package/dist/connectors/whatsapp.ts +2 -0
- package/dist/connectors/whatsapp_web.ts +3 -3
- package/dist/connectors/x-dm-adapter.js +8 -10
- package/dist/connectors/x.ts +8 -9
- package/dist/db/migrations/20261115040000_account_two_factor.sql +20 -0
- package/dist/db/migrations/20261115120000_events_unbound_tool_audit_without_bridge.sql +40 -0
- package/dist/db/migrations/20261115120001_events_unbound_tool_audit_validate.sql +19 -0
- package/dist/db/migrations/20261115120002_drop_events_linked_org_ids.sql +119 -0
- package/dist/db/migrations/20261115130000_entities_retired_type_idx.sql +34 -0
- package/dist/db/migrations/20261115140000_entity_identities_personal_owner_idx.sql +34 -0
- package/dist/db/migrations/20261117090000_write_policy_kind_note.sql +65 -0
- package/dist/db/migrations/20261117120000_app_policy_principal.sql +48 -0
- package/dist/db/migrations/20261117170000_personal_org_connector_auto_policy_backfill.sql +57 -0
- package/dist/db/migrations/20261117190000_org_slug_reserved_paths.sql +29 -0
- package/dist/db/migrations/20261118120000_workspace_view_top_level_paths.sql +69 -0
- package/dist/db/migrations/preconditions/20261117190000_org_slug_reserved_paths.sql +14 -0
- package/dist/db/migrations/preconditions/20261118120000_workspace_view_top_level_paths.sql +21 -0
- package/dist/dependencies.bun.lock +51 -46
- package/dist/guest.bundle.js +11 -2
- package/dist/owletto/dist/assets/_-BC9j6MkU.js +2 -0
- package/dist/owletto/dist/assets/_-Z1u1cIe6.js +3 -0
- package/dist/owletto/dist/assets/_agentId-B-TFq9TP.js +2 -0
- package/dist/owletto/dist/assets/{_agentId-CGScf8z_.js → _agentId-BGatZWsd.js} +2 -2
- package/dist/owletto/dist/assets/_automationId-CMUrWPvr.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey._connectionId-CUoAoP0_.js +2 -0
- package/dist/owletto/dist/assets/_connectorKey.index-Bs49QGGH.js +2 -0
- package/dist/owletto/dist/assets/_conversationId-CszP1den.js +2 -0
- package/dist/owletto/dist/assets/_eventId-C0AZUBnD.js +2 -0
- package/dist/owletto/dist/assets/_owner-B4ydA75k.js +3 -0
- package/dist/owletto/dist/assets/_shape-C4-ikE70.js +2 -0
- package/dist/owletto/dist/assets/_slug-DE5J3KVu.js +2 -0
- package/dist/owletto/dist/assets/_viewKey-Dkcd8JQC.js +2 -0
- package/dist/owletto/dist/assets/{accept-invitation-BKeIzZXE.js → accept-invitation-DmrQQu_W.js} +2 -2
- package/dist/owletto/dist/assets/{activity-route-location-sLvKaSCa.js → activity-route-location-Bec6fW-t.js} +2 -2
- package/dist/owletto/dist/assets/activity-route-view-DCSNBKZU.js +2 -0
- package/dist/owletto/dist/assets/agent-client-connections-xvabPpi6.js +4 -0
- package/dist/owletto/dist/assets/agent-connect-pages-DDPtkcmq.js +6 -0
- package/dist/owletto/dist/assets/{agent-editor-form-DVFyyMyd.js → agent-editor-form-BrhQbHZg.js} +2 -2
- package/dist/owletto/dist/assets/{agent-loading-shells-BLNHIy-r.js → agent-loading-shells-D3y98xuO.js} +2 -2
- package/dist/owletto/dist/assets/{agent-permissions-matrix-UBKRR5vs.js → agent-permissions-matrix-jQJjSa9i.js} +2 -2
- package/dist/owletto/dist/assets/{agent-skill-context-fqedKd0D.js → agent-skill-context-CCcknBYE.js} +2 -2
- package/dist/owletto/dist/assets/{agent-subpage-shell-BUCoY2Nf.js → agent-subpage-shell-6f_53cSf.js} +2 -2
- package/dist/owletto/dist/assets/agent-thread-v_lSSnJi.js +6 -0
- package/dist/owletto/dist/assets/{app._appId-ByIypCL9.js → app._appId-CKWzZ2ic.js} +2 -2
- package/dist/owletto/dist/assets/assist-composer-Q9ZJjAta.js +2 -0
- package/dist/owletto/dist/assets/automation-run-now-Dl0MKx3N.js +2 -0
- package/dist/owletto/dist/assets/{callback-Pz5uS-k7.js → callback-Bentv78L.js} +2 -2
- package/dist/owletto/dist/assets/{card-CAPpY9P5.js → card-C4oPCVh6.js} +2 -2
- package/dist/owletto/dist/assets/{claim-DgWWK0KI.js → claim-B3C4qIi2.js} +2 -2
- package/dist/owletto/dist/assets/client-activity-scopes-DqaFEyir.js +2 -0
- package/dist/owletto/dist/assets/{client-rows-Dd5YV8vn.js → client-rows-rse9thnk.js} +2 -2
- package/dist/owletto/dist/assets/{clients-Bf7ZgGro.js → clients-BhPMbxHi.js} +2 -2
- package/dist/owletto/dist/assets/{code-editor-z1Sy_hiX.js → code-editor-CTdKUDPY.js} +2 -2
- package/dist/owletto/dist/assets/connect-D8o7HBlo.js +2 -0
- package/dist/owletto/dist/assets/connect-menu-D5EZvSHb.js +2 -0
- package/dist/owletto/dist/assets/connect._clientId-Dbagcg9L.js +2 -0
- package/dist/owletto/dist/assets/connected._clientId-DALW9S2K.js +2 -0
- package/dist/owletto/dist/assets/connection-DyxzSqVE.js +2 -0
- package/dist/owletto/dist/assets/connection-feed-detail-LqpxUCdy.js +2 -0
- package/dist/owletto/dist/assets/{connector-page-shell-an3SYLim.js → connector-page-shell-DZjKv9zQ.js} +2 -2
- package/dist/owletto/dist/assets/{connector-provenance-mSZCOud-.js → connector-provenance-DtTJn1Nk.js} +2 -2
- package/dist/owletto/dist/assets/connectors-BVl-AR33.js +2 -0
- package/dist/owletto/dist/assets/{consent-1ulwyJ3k.js → consent-XCqsHLxS.js} +2 -2
- package/dist/owletto/dist/assets/{core.esm-Ctg_pXLe.js → core.esm-B1du4Zwy.js} +3 -3
- package/dist/owletto/dist/assets/create-BYKCtGL4.js +2 -0
- package/dist/owletto/dist/assets/create-D6Mmuxcq.js +2 -0
- package/dist/owletto/dist/assets/{create-CGuoqPh8.js → create-GHTb6wKX.js} +2 -2
- package/dist/owletto/dist/assets/{create-automation-form-CD6jSlWL.js → create-automation-form-CTiy_S9G.js} +3 -3
- package/dist/owletto/dist/assets/create._connectorKey-DMH97KkK.js +2 -0
- package/dist/owletto/dist/assets/custom-guardrail-edits-DZy66ucV.js +2 -0
- package/dist/owletto/dist/assets/definition-comparison-C2mPfIMD.js +2 -0
- package/dist/owletto/dist/assets/detail-page-skeleton-DNBL7nyk.js +2 -0
- package/dist/owletto/dist/assets/device-CwP1PY8q.js +2 -0
- package/dist/owletto/dist/assets/{device-pin-tombstone-Dkj7hrBE.js → device-pin-tombstone-DYTt7kU5.js} +2 -2
- package/dist/owletto/dist/assets/device._deviceId-DZ2kqI4Y.js +2 -0
- package/dist/owletto/dist/assets/{entity-options-D4t-NAcg.js → entity-options-D9K_5Lcs.js} +2 -2
- package/dist/owletto/dist/assets/entity-page-DggKXrcE.js +2 -0
- package/dist/owletto/dist/assets/entity-pages-C6M6yKFf.js +2 -0
- package/dist/owletto/dist/assets/{entity-schema-graph-Cq96SJ3c.js → entity-schema-graph-B255NKjF.js} +2 -2
- package/dist/owletto/dist/assets/entity-type-page-CGBAP2wt.js +2 -0
- package/dist/owletto/dist/assets/event-attachments-D8Z8uwv9.js +2 -0
- package/dist/owletto/dist/assets/event-detail-CgG3pDLA.js +2 -0
- package/dist/owletto/dist/assets/events-feed-ClhEywwV.js +2 -0
- package/dist/owletto/dist/assets/{filter-editors-DGVl9U4D.js → filter-editors-D_Sfn0dv.js} +3 -3
- package/dist/owletto/dist/assets/{full-page-spinner-CtVlF8GQ.js → full-page-spinner-C1clibUY.js} +2 -2
- package/dist/owletto/dist/assets/{index-CK5GDX4B.js → index-04B26s6E.js} +2 -2
- package/dist/owletto/dist/assets/index-2HrEO-nl.js +2 -0
- package/dist/owletto/dist/assets/index-BU3k9wpw.js +2 -0
- package/dist/owletto/dist/assets/{index-DvuJ_S_o.js → index-BXHqp23o.js} +2 -2
- package/dist/owletto/dist/assets/index-BdLRUDIR.js +2 -0
- package/dist/owletto/dist/assets/index-C2FrGwYN.js +2 -0
- package/dist/owletto/dist/assets/index-CB9wGfUm.js +2 -0
- package/dist/owletto/dist/assets/index-Caihaftb.js +2 -0
- package/dist/owletto/dist/assets/index-CwH59DJV.js +2 -0
- package/dist/owletto/dist/assets/index-DB2lVKuV.js +7908 -0
- package/dist/owletto/dist/assets/{index-DbjbHlDe.js → index-DTvJRjrM.js} +2 -2
- package/dist/owletto/dist/assets/index-SF2ni1Rs.css +1 -0
- package/dist/owletto/dist/assets/{index-BifR-LE9.js → index-mSrdbx3C.js} +9 -9
- package/dist/owletto/dist/assets/index-uFn-Ilrx.js +2 -0
- package/dist/owletto/dist/assets/{json-diff-OjtREegr.js → json-diff-Ce6YAXzY.js} +2 -2
- package/dist/owletto/dist/assets/{list-skeleton-CH0qQBYk.js → list-skeleton-DLPBTnbR.js} +2 -2
- package/dist/owletto/dist/assets/login-DeWlvogD.js +2 -0
- package/dist/owletto/dist/assets/{logout-DfdgOLoM.js → logout-CJY0ceN9.js} +2 -2
- package/dist/owletto/dist/assets/{member-scope-gate-Cxg2zGQT.js → member-scope-gate-CBPMprXu.js} +2 -2
- package/dist/owletto/dist/assets/memory-browse-page-D5kj1RaR.js +74 -0
- package/dist/owletto/dist/assets/{model-selector-D2OpDkwH.js → model-selector-CjkBPpjN.js} +2 -2
- package/dist/owletto/dist/assets/new-BKrNkOQD.js +2 -0
- package/dist/owletto/dist/assets/new-BetiMuDq.js +2 -0
- package/dist/owletto/dist/assets/new-dk_-eXqU.js +2 -0
- package/dist/owletto/dist/assets/new-efN--4Wx.js +2 -0
- package/dist/owletto/dist/assets/organization-C3rpwx_d.js +2 -0
- package/dist/owletto/dist/assets/pdf-document--AN-oCKj.css +1 -0
- package/dist/owletto/dist/assets/pdf-document-2W1q0sRA.js +56 -0
- package/dist/owletto/dist/assets/pdf.worker.min-CIqJB0yW.mjs +28 -0
- package/dist/owletto/dist/assets/peek-pane-content-ChsBWO0P.js +3 -0
- package/dist/owletto/dist/assets/{pending-seed-BBACroge.js → pending-seed-CTKYdA4X.js} +2 -2
- package/dist/owletto/dist/assets/proposal-review-shell-EyGWEYwQ.js +2 -0
- package/dist/owletto/dist/assets/public-shell-ready-_KWdfzEM.js +2 -0
- package/dist/owletto/dist/assets/record-session-D27VNxP_.js +2 -0
- package/dist/owletto/dist/assets/{renderer-CTKNMcXP.js → renderer-B8yZ5lql.js} +34 -33
- package/dist/owletto/dist/assets/{reset-password-DKBEneyR.js → reset-password-BGVJIh2I.js} +2 -2
- package/dist/owletto/dist/assets/run-initiator-C0sur8lU.js +2 -0
- package/dist/owletto/dist/assets/runs-list-CJOFMgpk.js +2 -0
- package/dist/owletto/dist/assets/schema-value-DDNHANGs.js +3 -0
- package/dist/owletto/dist/assets/{scoped-feed-bar-DNFL0sYX.js → scoped-feed-bar-BTv9mPcR.js} +2 -2
- package/dist/owletto/dist/assets/settings-Ponr5XbS.js +3 -0
- package/dist/owletto/dist/assets/{status-variants-SzXYYedJ.js → status-variants-mLqVhg5O.js} +2 -2
- package/dist/owletto/dist/assets/subDays-BGA_fkig.js +2 -0
- package/dist/owletto/dist/assets/two-factor-pqoxGSgL.js +2 -0
- package/dist/owletto/dist/assets/{use-automations-DfBtVzGa.js → use-automations-DcdlmVuX.js} +2 -2
- package/dist/owletto/dist/assets/{use-login-redirect-BDiS3eyl.js → use-login-redirect-D7HW5Ed6.js} +2 -2
- package/dist/owletto/dist/assets/{use-mention-search-khySpz_V.js → use-mention-search-BniE-K2d.js} +3 -3
- package/dist/owletto/dist/assets/view-card-Cg6PeEiV.js +2 -0
- package/dist/owletto/dist/assets/view-param-filters-CvrKw0mZ.js +2 -0
- package/dist/owletto/dist/index.html +2 -2
- package/dist/server-main.bundle.mjs +5766 -2999
- package/npm-shrinkwrap.json +195 -172
- package/package.json +2 -1
- package/vendor/connector-sdk/dist/connector-types.d.ts +20 -0
- package/vendor/connector-sdk/dist/define-connector.js +2 -0
- package/vendor/connector-sdk/dist/extension-dom-scrape.d.ts +2 -0
- package/vendor/connector-sdk/dist/extension-dom-scrape.js +5 -0
- package/vendor/connector-sdk/dist/reaction-client-types.d.ts +20 -0
- package/vendor/connector-sdk/package.json +1 -1
- package/vendor/core/dist/contracts/entity-reference.d.ts +2 -0
- package/vendor/core/dist/contracts/entity-reference.js +4 -3
- package/vendor/core/dist/contracts/tools/entity-list-sort.d.ts +18 -0
- package/vendor/core/dist/contracts/tools/entity-list-sort.js +64 -0
- package/vendor/core/dist/contracts/tools/manage-agents.d.ts +1 -1
- package/vendor/core/dist/contracts/tools/manage-agents.js +3 -3
- package/vendor/core/dist/contracts/tools/manage-entity-schema.d.ts +4 -0
- package/vendor/core/dist/contracts/tools/manage-entity-schema.js +4 -0
- package/vendor/core/dist/contracts/tools/manage-entity.d.ts +4 -0
- package/vendor/core/dist/contracts/tools/manage-entity.js +11 -1
- package/vendor/core/dist/contracts/tools/manage-operations.d.ts +29 -3
- package/vendor/core/dist/contracts/tools/manage-operations.js +24 -2
- package/vendor/core/dist/contracts/tools/manage-views.d.ts +36 -0
- package/vendor/core/dist/contracts/tools/manage-views.js +15 -2
- package/vendor/core/dist/contracts/tools/view-definition.js +7 -2
- package/vendor/core/dist/contracts/tools/view-host.js +5 -0
- package/vendor/core/dist/contracts/tools/view-path.d.ts +8 -1
- package/vendor/core/dist/contracts/tools/view-path.js +11 -1
- package/vendor/core/dist/reserved.d.ts +7 -1
- package/vendor/core/dist/reserved.js +17 -0
- package/vendor/core/package.json +6 -1
- package/vendor/views/dist/api.d.ts +19 -3
- package/vendor/views/dist/api.js +53 -5
- package/vendor/views/dist/components.d.ts +7 -0
- package/vendor/views/dist/components.js +223 -2
- package/vendor/views/dist/embed.js +13 -2
- package/vendor/views/dist/live-gate.d.ts +34 -0
- package/vendor/views/dist/live-gate.js +100 -0
- package/vendor/views/dist/native.d.ts +43 -1
- package/vendor/views/dist/native.js +1 -0
- package/vendor/views/package.json +1 -1
- package/dist/owletto/dist/assets/_-BDMUN9XZ.js +0 -2
- package/dist/owletto/dist/assets/_-CF5X4ANe.js +0 -3
- package/dist/owletto/dist/assets/_agentId-EQU2aUP0.js +0 -2
- package/dist/owletto/dist/assets/_automationId-PXZ33jsF.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey._connectionId-DcI29kGy.js +0 -2
- package/dist/owletto/dist/assets/_connectorKey.index-Cr2NDJWX.js +0 -2
- package/dist/owletto/dist/assets/_conversationId-CnmLYlVS.js +0 -2
- package/dist/owletto/dist/assets/_eventId-w5sDz5oa.js +0 -2
- package/dist/owletto/dist/assets/_owner-CkOZR4n0.js +0 -3
- package/dist/owletto/dist/assets/_shape-C_FmSf9G.js +0 -2
- package/dist/owletto/dist/assets/_slug-COPpRXLt.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-BVdJiilV.js +0 -2
- package/dist/owletto/dist/assets/_viewKey-mxxpqjtC.js +0 -2
- package/dist/owletto/dist/assets/activity-route-view-msesKUwn.js +0 -2
- package/dist/owletto/dist/assets/agent-connect-pages-DVq9nAR7.js +0 -4
- package/dist/owletto/dist/assets/agent-thread-Cqf9ITrT.js +0 -6
- package/dist/owletto/dist/assets/assist-composer-kG_heHXo.js +0 -2
- package/dist/owletto/dist/assets/automation-run-now-C5XTS00o.js +0 -2
- package/dist/owletto/dist/assets/client-activity-scopes-Aqdo6Pdr.js +0 -2
- package/dist/owletto/dist/assets/connect-BFNp1y_s.js +0 -2
- package/dist/owletto/dist/assets/connect-menu-BWrAhMqO.js +0 -2
- package/dist/owletto/dist/assets/connect._clientId-CSPfwYIN.js +0 -2
- package/dist/owletto/dist/assets/connected._clientId-CuOeHafK.js +0 -2
- package/dist/owletto/dist/assets/connection-CVeHmDLs.js +0 -2
- package/dist/owletto/dist/assets/connection-feed-detail-BYo7zdVD.js +0 -2
- package/dist/owletto/dist/assets/connectors-DBEM9QQz.js +0 -2
- package/dist/owletto/dist/assets/copy-button-Xhh7ZnjO.js +0 -2
- package/dist/owletto/dist/assets/create-Ccb5R-S4.js +0 -2
- package/dist/owletto/dist/assets/create-DmhbacIa.js +0 -2
- package/dist/owletto/dist/assets/create._connectorKey-CZsAqj1p.js +0 -2
- package/dist/owletto/dist/assets/custom-guardrail-edits-Ce_BwiwD.js +0 -2
- package/dist/owletto/dist/assets/definition-comparison-D_qP25jR.js +0 -2
- package/dist/owletto/dist/assets/detail-page-skeleton-CPAfZLG0.js +0 -2
- package/dist/owletto/dist/assets/device-DDl5XKvt.js +0 -2
- package/dist/owletto/dist/assets/device._deviceId-bNhTcops.js +0 -2
- package/dist/owletto/dist/assets/dynamic-schema-form-CRyUchXo.js +0 -2
- package/dist/owletto/dist/assets/entity-page-BOOL_vy3.js +0 -2
- package/dist/owletto/dist/assets/entity-pages-_nuesgnp.js +0 -2
- package/dist/owletto/dist/assets/entity-type-page-CkCSbkBx.js +0 -2
- package/dist/owletto/dist/assets/event-detail-DUvlqn9b.js +0 -2
- package/dist/owletto/dist/assets/events-feed-DcKTkJVe.js +0 -2
- package/dist/owletto/dist/assets/index-BUlkNJzX.js +0 -2
- package/dist/owletto/dist/assets/index-BoqrvLHQ.js +0 -7906
- package/dist/owletto/dist/assets/index-CA9mW_ZM.js +0 -2
- package/dist/owletto/dist/assets/index-CH0GzG4i.js +0 -2
- package/dist/owletto/dist/assets/index-CtI5Eomq.js +0 -2
- package/dist/owletto/dist/assets/index-DmtQ0bds.js +0 -2
- package/dist/owletto/dist/assets/index-Du_J8hnx.js +0 -2
- package/dist/owletto/dist/assets/index-Pae_f9LM.css +0 -1
- package/dist/owletto/dist/assets/index-XETZnN7L.js +0 -2
- package/dist/owletto/dist/assets/login-DG0b9uSC.js +0 -2
- package/dist/owletto/dist/assets/memory-browse-page-qEDQ9Z18.js +0 -74
- package/dist/owletto/dist/assets/missing-view-xT0B-f5z.js +0 -2
- package/dist/owletto/dist/assets/needs-you-list-3uMsWcDv.js +0 -2
- package/dist/owletto/dist/assets/new-AdGV6a8R.js +0 -2
- package/dist/owletto/dist/assets/new-BdtIhBpo.js +0 -2
- package/dist/owletto/dist/assets/new-BjGwX6s6.js +0 -2
- package/dist/owletto/dist/assets/new-D-iMjV74.js +0 -2
- package/dist/owletto/dist/assets/organization-qaIpEiQg.js +0 -2
- package/dist/owletto/dist/assets/peek-pane-content-CEsDVScl.js +0 -2
- package/dist/owletto/dist/assets/proposal-review-shell-C8ZfIAYn.js +0 -2
- package/dist/owletto/dist/assets/public-shell-ready-K2R8iXSI.js +0 -2
- package/dist/owletto/dist/assets/record-session-BrM9cdXu.js +0 -2
- package/dist/owletto/dist/assets/run-initiator-BKSgI1o0.js +0 -2
- package/dist/owletto/dist/assets/runs-k2NpbZm8.js +0 -2
- package/dist/owletto/dist/assets/runs-list-DUXRMkWN.js +0 -2
- package/dist/owletto/dist/assets/schema-value-wjqGxXhv.js +0 -3
- package/dist/owletto/dist/assets/settings-V0m5Om5j.js +0 -2
- package/dist/owletto/dist/assets/source-record-panels-BMut9YIA.js +0 -2
- package/dist/owletto/dist/assets/subDays-9s9OEl5t.js +0 -2
- package/dist/owletto/dist/assets/table-ZuYMOjVR.js +0 -2
- package/dist/owletto/dist/assets/view-card-DiHWlypr.js +0 -2
- package/dist/owletto/dist/assets/view-param-filters-DGKxSr7r.js +0 -2
- package/dist/owletto/dist/assets/views-access-required-HA-PiOwA.js +0 -2
package/dist/connectors/herdr.ts
CHANGED
|
@@ -303,7 +303,7 @@ export default class HerdrConnector extends ConnectorRuntime {
|
|
|
303
303
|
'write',
|
|
304
304
|
{
|
|
305
305
|
target,
|
|
306
|
-
text: { type: 'string', minLength: 1, maxLength: 10000 },
|
|
306
|
+
text: { type: 'string', minLength: 1, maxLength: 10000, 'x-multiline': true },
|
|
307
307
|
wait: { type: 'boolean', default: false },
|
|
308
308
|
timeout_ms: timeout,
|
|
309
309
|
until,
|
|
@@ -11,3 +11,14 @@ export function linkedInScriptArgument(value: unknown): string {
|
|
|
11
11
|
// Parsing also preserves JSON object keys such as __proto__ as plain data.
|
|
12
12
|
return `JSON.parse(${literal})`;
|
|
13
13
|
}
|
|
14
|
+
|
|
15
|
+
/** LinkedIn origins a scrape window or action tab is allowed to touch. */
|
|
16
|
+
export const LINKEDIN_ALLOWED_ORIGINS = ["linkedin.com", "*.linkedin.com"];
|
|
17
|
+
|
|
18
|
+
/** A landed path that means the paired Chrome is signed out. */
|
|
19
|
+
export const LINKEDIN_LOGGED_OUT_WHEN = {
|
|
20
|
+
pathRegex: "/(login|authwall|uas/login|checkpoint|signup)\\b",
|
|
21
|
+
} as const;
|
|
22
|
+
|
|
23
|
+
export const LINKEDIN_LOGGED_OUT_ERROR =
|
|
24
|
+
"Not logged into LinkedIn. Sign in to linkedin.com in the paired Chrome profile, then retry.";
|
|
@@ -12,21 +12,37 @@ export async function fillLinkedInDraft(input) {
|
|
|
12
12
|
getComputedStyle(element).visibility !== "hidden";
|
|
13
13
|
let editor;
|
|
14
14
|
if (input.kind === "prepare_message") {
|
|
15
|
+
// LinkedIn renders no thread href in the conversation list, so the exact
|
|
16
|
+
// location.href check above pins the thread, and the single selected list
|
|
17
|
+
// item must name the same counterpart as the open thread's header.
|
|
18
|
+
const name = (element) =>
|
|
19
|
+
(element?.textContent ?? "").replace(/\s+/g, " ").trim();
|
|
15
20
|
const selected = [
|
|
16
21
|
...document.querySelectorAll(
|
|
17
|
-
|
|
22
|
+
".msg-conversations-container__convo-item-link--active"
|
|
18
23
|
),
|
|
19
|
-
].filter(
|
|
20
|
-
(link) =>
|
|
21
|
-
visible(link) &&
|
|
22
|
-
new URL(link.href).pathname === new URL(input.url).pathname
|
|
23
|
-
);
|
|
24
|
-
if (selected.length !== 1)
|
|
25
|
-
fail("The selected conversation does not match the requested recipient");
|
|
24
|
+
].filter(visible);
|
|
26
25
|
const threads = [...document.querySelectorAll(".msg-thread")].filter(
|
|
27
26
|
visible
|
|
28
27
|
);
|
|
29
28
|
if (threads.length !== 1) fail("Exactly one conversation must be open");
|
|
29
|
+
const headers = [
|
|
30
|
+
...threads[0].querySelectorAll(".msg-entity-lockup__entity-title"),
|
|
31
|
+
].filter(visible);
|
|
32
|
+
const selectedName =
|
|
33
|
+
selected.length === 1
|
|
34
|
+
? name(
|
|
35
|
+
selected[0].querySelector(
|
|
36
|
+
".msg-conversation-listitem__participant-names"
|
|
37
|
+
)
|
|
38
|
+
)
|
|
39
|
+
: "";
|
|
40
|
+
if (
|
|
41
|
+
!selectedName ||
|
|
42
|
+
headers.length !== 1 ||
|
|
43
|
+
name(headers[0]) !== selectedName
|
|
44
|
+
)
|
|
45
|
+
fail("The selected conversation does not match the requested recipient");
|
|
30
46
|
const editors = [
|
|
31
47
|
...threads[0].querySelectorAll(
|
|
32
48
|
'.msg-form [contenteditable="true"][role="textbox"]'
|
|
@@ -1096,14 +1096,12 @@ export function linkedInInboxProgram() {
|
|
|
1096
1096
|
}
|
|
1097
1097
|
}
|
|
1098
1098
|
// Direct send, approved ONLY for replying to direct messages on accounts the
|
|
1099
|
-
// owner operates. One reply per
|
|
1100
|
-
// client origin token, so a retry
|
|
1101
|
-
// again. Group or unknown conversations are refused.
|
|
1099
|
+
// owner operates. One reply per operation run: the run id becomes LinkedIn's
|
|
1100
|
+
// client origin token, so a retry or re-claim of the same run finds the first
|
|
1101
|
+
// attempt instead of sending again. Group or unknown conversations are refused.
|
|
1102
1102
|
const SEND_RECONFIRM_ATTEMPTS = 5;
|
|
1103
|
-
async function originTokenOf(mailbox, conversation,
|
|
1104
|
-
const hex = await digest(
|
|
1105
|
-
JSON.stringify([mailbox, conversation, idempotencyKey])
|
|
1106
|
-
);
|
|
1103
|
+
async function originTokenOf(mailbox, conversation, runId) {
|
|
1104
|
+
const hex = await digest(JSON.stringify([mailbox, conversation, runId]));
|
|
1107
1105
|
// UUID-shaped (version 4 / variant bits set), like LinkedIn's own tokens.
|
|
1108
1106
|
return [
|
|
1109
1107
|
hex.slice(0, 8),
|
|
@@ -1121,19 +1119,18 @@ export function linkedInInboxProgram() {
|
|
|
1121
1119
|
.map((byte) => alphabet[byte & 63])
|
|
1122
1120
|
.join("");
|
|
1123
1121
|
}
|
|
1122
|
+
const THREAD_ID = /^[A-Za-z0-9_-]+=*$/;
|
|
1123
|
+
const CONVERSATION_URN =
|
|
1124
|
+
/^urn:li:msg_conversation:\((urn:li:fsd_profile:[A-Za-z0-9_-]+|urn:li:fsd_pageMailbox:[0-9]+),([A-Za-z0-9_-]+=*)\)$/;
|
|
1124
1125
|
// `conversation_id` is a thread id of the member's own inbox, or a full
|
|
1125
1126
|
// conversation URN whose mailbox names the inbox the reply leaves from: the
|
|
1126
1127
|
// member's own or a page the member administers.
|
|
1127
1128
|
async function sendTarget(given, expected) {
|
|
1128
|
-
if (typeof given === "string" &&
|
|
1129
|
+
if (typeof given === "string" && THREAD_ID.test(given)) {
|
|
1129
1130
|
const member = await boundAccount(expected);
|
|
1130
1131
|
return { inbox: { mailbox: member, member, page: false }, thread: given };
|
|
1131
1132
|
}
|
|
1132
|
-
const match =
|
|
1133
|
-
typeof given === "string" &&
|
|
1134
|
-
given.match(
|
|
1135
|
-
/^urn:li:msg_conversation:\((urn:li:fsd_profile:[A-Za-z0-9_-]+|urn:li:fsd_pageMailbox:[0-9]+),([A-Za-z0-9_-]+=*)\)$/
|
|
1136
|
-
);
|
|
1133
|
+
const match = typeof given === "string" && given.match(CONVERSATION_URN);
|
|
1137
1134
|
if (!match)
|
|
1138
1135
|
fail(
|
|
1139
1136
|
"conversation_id must be a LinkedIn conversation thread id or conversation URN"
|
|
@@ -1151,9 +1148,8 @@ export function linkedInInboxProgram() {
|
|
|
1151
1148
|
const text = typeof input.text === "string" ? input.text.trim() : "";
|
|
1152
1149
|
if (!text || text.length > 3000)
|
|
1153
1150
|
fail("text must contain 1-3000 characters");
|
|
1154
|
-
const
|
|
1155
|
-
if (typeof
|
|
1156
|
-
fail("idempotency_key is required");
|
|
1151
|
+
const runId = input.run_id;
|
|
1152
|
+
if (typeof runId !== "string" || !runId) fail("run_id is required");
|
|
1157
1153
|
const conversation = `urn:li:msg_conversation:(${mailbox},${thread})`;
|
|
1158
1154
|
const recent = await searchConversations(
|
|
1159
1155
|
mailbox,
|
|
@@ -1163,7 +1159,7 @@ export function linkedInInboxProgram() {
|
|
|
1163
1159
|
fail("The conversation is not in the inbox; not sending");
|
|
1164
1160
|
if (groupOf(recent) !== false)
|
|
1165
1161
|
fail("send_message only answers direct messages; this conversation is a group or its membership is unknown");
|
|
1166
|
-
const originToken = await originTokenOf(mailbox, conversation,
|
|
1162
|
+
const originToken = await originTokenOf(mailbox, conversation, runId);
|
|
1167
1163
|
const sent = (message) => ({
|
|
1168
1164
|
sent: true,
|
|
1169
1165
|
message_id: message.entityUrn,
|
|
@@ -1217,7 +1213,201 @@ export function linkedInInboxProgram() {
|
|
|
1217
1213
|
if (shown) return sent(shown);
|
|
1218
1214
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
1219
1215
|
}
|
|
1220
|
-
fail("LinkedIn accepted the message but it did not appear in the conversation;
|
|
1216
|
+
fail("LinkedIn accepted the message but it did not appear in the conversation; delivery is uncertain. Check the conversation before sending again");
|
|
1217
|
+
}
|
|
1218
|
+
// A lookup shows conversations as the person on the other side. A value is
|
|
1219
|
+
// a thread id of the member's own inbox or a full conversation URN of an
|
|
1220
|
+
// inbox the member reads; `query` matches that person's name among the
|
|
1221
|
+
// member inbox's recent conversations; neither lists the recent ones. Groups,
|
|
1222
|
+
// other accounts' conversations and values not found in the walked window
|
|
1223
|
+
// are left out, never guessed.
|
|
1224
|
+
const LOOKUP_PAGES = 10;
|
|
1225
|
+
const LOOKUP_ITEMS = 20;
|
|
1226
|
+
function lookupTarget(value, member) {
|
|
1227
|
+
if (typeof value !== "string") return null;
|
|
1228
|
+
if (THREAD_ID.test(value))
|
|
1229
|
+
return {
|
|
1230
|
+
mailbox: member,
|
|
1231
|
+
conversation: `urn:li:msg_conversation:(${member},${value})`,
|
|
1232
|
+
};
|
|
1233
|
+
const match = value.match(CONVERSATION_URN);
|
|
1234
|
+
if (!match || (match[1] !== member && !PAGE_MAILBOX.test(match[1])))
|
|
1235
|
+
return null;
|
|
1236
|
+
return { mailbox: match[1], conversation: value };
|
|
1237
|
+
}
|
|
1238
|
+
// LinkedIn's signed photo URL: root plus one rendition. The smallest at
|
|
1239
|
+
// least 100px wide suits a chip; otherwise the largest there is.
|
|
1240
|
+
function photoOf(picture) {
|
|
1241
|
+
const root = picture?.rootUrl;
|
|
1242
|
+
const artifacts = (
|
|
1243
|
+
Array.isArray(picture?.artifacts) ? picture.artifacts : []
|
|
1244
|
+
)
|
|
1245
|
+
.filter(
|
|
1246
|
+
(artifact) =>
|
|
1247
|
+
typeof artifact?.fileIdentifyingUrlPathSegment === "string" &&
|
|
1248
|
+
Number.isFinite(artifact.width)
|
|
1249
|
+
)
|
|
1250
|
+
.sort((a, b) => a.width - b.width);
|
|
1251
|
+
if (typeof root !== "string" || !artifacts.length) return undefined;
|
|
1252
|
+
const artifact =
|
|
1253
|
+
artifacts.find((candidate) => candidate.width >= 100) ??
|
|
1254
|
+
artifacts[artifacts.length - 1];
|
|
1255
|
+
try {
|
|
1256
|
+
const url = new URL(`${root}${artifact.fileIdentifyingUrlPathSegment}`);
|
|
1257
|
+
return url.protocol === "https:" ? url.href : undefined;
|
|
1258
|
+
} catch {
|
|
1259
|
+
return undefined;
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
// The member on the other side of a direct conversation; the inbox's own
|
|
1263
|
+
// identity and page participants are not that person.
|
|
1264
|
+
function counterpartMemberOf(conversation, mailbox) {
|
|
1265
|
+
const participants = Array.isArray(conversation?.conversationParticipants)
|
|
1266
|
+
? conversation.conversationParticipants
|
|
1267
|
+
: [];
|
|
1268
|
+
for (const participant of participants) {
|
|
1269
|
+
const member = participant?.participantType?.member;
|
|
1270
|
+
if (!member || participant.hostIdentityUrn === mailbox) continue;
|
|
1271
|
+
const label = clean(
|
|
1272
|
+
`${member.firstName?.text ?? ""} ${member.lastName?.text ?? ""}`
|
|
1273
|
+
);
|
|
1274
|
+
if (label) return { participant, member, label };
|
|
1275
|
+
}
|
|
1276
|
+
return null;
|
|
1277
|
+
}
|
|
1278
|
+
function counterpartOf(conversation, mailbox) {
|
|
1279
|
+
const counterpart = counterpartMemberOf(conversation, mailbox);
|
|
1280
|
+
if (!counterpart) return null;
|
|
1281
|
+
const { member, label } = counterpart;
|
|
1282
|
+
const description = clean(member.headline?.text);
|
|
1283
|
+
const imageUrl = photoOf(member.profilePicture);
|
|
1284
|
+
return {
|
|
1285
|
+
label,
|
|
1286
|
+
...(description ? { description } : {}),
|
|
1287
|
+
...(imageUrl ? { image_url: imageUrl } : {}),
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1290
|
+
async function lookup(input) {
|
|
1291
|
+
const member = await boundAccount(input.expected_account);
|
|
1292
|
+
const values = Array.isArray(input.values)
|
|
1293
|
+
? input.values.slice(0, LOOKUP_ITEMS)
|
|
1294
|
+
: [];
|
|
1295
|
+
const query = clean(input.query).toLowerCase();
|
|
1296
|
+
const listing = !!query || !values.length;
|
|
1297
|
+
const wanted = [];
|
|
1298
|
+
for (const value of values) {
|
|
1299
|
+
const target = lookupTarget(value, member);
|
|
1300
|
+
if (target) wanted.push({ value, ...target });
|
|
1301
|
+
}
|
|
1302
|
+
const mailboxes = new Set(wanted.map((target) => target.mailbox));
|
|
1303
|
+
if (listing) mailboxes.add(member);
|
|
1304
|
+
const found = new Map();
|
|
1305
|
+
const recent = [];
|
|
1306
|
+
for (const mailbox of mailboxes) {
|
|
1307
|
+
if (mailbox !== member) await assertAdministers(mailbox);
|
|
1308
|
+
const pending = () =>
|
|
1309
|
+
wanted.some(
|
|
1310
|
+
(target) =>
|
|
1311
|
+
target.mailbox === mailbox && !found.has(target.conversation)
|
|
1312
|
+
);
|
|
1313
|
+
let cursor;
|
|
1314
|
+
for (let page = 0; page < LOOKUP_PAGES; page++) {
|
|
1315
|
+
const source = await conversationsPage(mailbox, cursor);
|
|
1316
|
+
for (const conversation of source.elements) {
|
|
1317
|
+
if (typeof conversation?.entityUrn !== "string") continue;
|
|
1318
|
+
found.set(conversation.entityUrn, conversation);
|
|
1319
|
+
if (mailbox === member) recent.push(conversation);
|
|
1320
|
+
}
|
|
1321
|
+
const enough =
|
|
1322
|
+
mailbox !== member ||
|
|
1323
|
+
(!query && (values.length || recent.length >= LOOKUP_ITEMS));
|
|
1324
|
+
if (!pending() && enough) break;
|
|
1325
|
+
cursor = source.metadata?.nextCursor;
|
|
1326
|
+
if (typeof cursor !== "string" || !cursor || cursor.length > 4096)
|
|
1327
|
+
break;
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
const items = [];
|
|
1331
|
+
const shown = new Set();
|
|
1332
|
+
const add = (value, conversation, mailbox, filter) => {
|
|
1333
|
+
if (
|
|
1334
|
+
items.length >= LOOKUP_ITEMS ||
|
|
1335
|
+
!conversation ||
|
|
1336
|
+
shown.has(conversation.entityUrn) ||
|
|
1337
|
+
groupOf(conversation) !== false
|
|
1338
|
+
)
|
|
1339
|
+
return;
|
|
1340
|
+
const person = counterpartOf(conversation, mailbox);
|
|
1341
|
+
if (!person || (filter && !person.label.toLowerCase().includes(filter)))
|
|
1342
|
+
return;
|
|
1343
|
+
shown.add(conversation.entityUrn);
|
|
1344
|
+
items.push({ value, ...person });
|
|
1345
|
+
};
|
|
1346
|
+
for (const target of wanted)
|
|
1347
|
+
add(target.value, found.get(target.conversation), target.mailbox, "");
|
|
1348
|
+
if (listing)
|
|
1349
|
+
for (const conversation of recent) {
|
|
1350
|
+
const match = conversation.entityUrn.match(CONVERSATION_URN);
|
|
1351
|
+
if (match?.[1] === member)
|
|
1352
|
+
add(match[2], conversation, member, query);
|
|
1353
|
+
}
|
|
1354
|
+
if ((await account()) !== member)
|
|
1355
|
+
fail("LinkedIn account changed during conversation lookup");
|
|
1356
|
+
return { items };
|
|
1357
|
+
}
|
|
1358
|
+
// One page of the member inbox's direct conversations, for stored history.
|
|
1359
|
+
// Conversations whose last activity is not after `after` (ms) were stored by
|
|
1360
|
+
// an earlier walk and are skipped; LinkedIn lists the inbox by activity, so
|
|
1361
|
+
// a page that ends on one ends the walk (a pinned conversation on top does
|
|
1362
|
+
// not). Groups, and conversations whose group-ness or other member is not
|
|
1363
|
+
// shown, are never stored. Each kept conversation contributes its recent
|
|
1364
|
+
// message page, not its full history, and every row carries the member on
|
|
1365
|
+
// the other side, so a reply sent from this inbox belongs to that person too.
|
|
1366
|
+
async function history(input) {
|
|
1367
|
+
const inbox = await inboxOf(undefined, input.expected_account);
|
|
1368
|
+
const after = Number.isFinite(input.after) ? input.after : null;
|
|
1369
|
+
const page = input.page ?? undefined;
|
|
1370
|
+
if (page !== undefined && (typeof page !== "string" || !page || page.length > 4096))
|
|
1371
|
+
fail("Invalid direct message history cursor");
|
|
1372
|
+
const source = await conversationsPage(inbox.mailbox, page);
|
|
1373
|
+
const rows = [];
|
|
1374
|
+
let newest = null;
|
|
1375
|
+
let stale = false;
|
|
1376
|
+
for (const conversation of source.elements) {
|
|
1377
|
+
const activity = conversation?.lastActivityAt;
|
|
1378
|
+
if (typeof conversation?.entityUrn !== "string" || !Number.isFinite(activity))
|
|
1379
|
+
fail("Conversation identity or activity time is unavailable");
|
|
1380
|
+
newest = newest === null ? activity : Math.max(newest, activity);
|
|
1381
|
+
stale = after !== null && activity <= after;
|
|
1382
|
+
if (stale || groupOf(conversation) !== false) continue;
|
|
1383
|
+
const counterpart = counterpartMemberOf(conversation, inbox.mailbox);
|
|
1384
|
+
const counterpartId = counterpart?.participant.hostIdentityUrn;
|
|
1385
|
+
const memberId = memberIdOf(counterpartId);
|
|
1386
|
+
const slug = slugOf(counterpart?.member.profileUrl);
|
|
1387
|
+
if (!memberId && !slug) continue;
|
|
1388
|
+
for (const row of await messagesPage(conversation.entityUrn, inbox, false)) {
|
|
1389
|
+
if (row.content_kind === "system") continue;
|
|
1390
|
+
rows.push({
|
|
1391
|
+
...row,
|
|
1392
|
+
counterpart_id: counterpartId,
|
|
1393
|
+
counterpart_member_id: memberId,
|
|
1394
|
+
counterpart_slug: slug,
|
|
1395
|
+
counterpart_name: counterpart.label,
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
const next = source.metadata?.nextCursor;
|
|
1400
|
+
if ((await account()) !== inbox.member)
|
|
1401
|
+
fail("LinkedIn account changed during the history read");
|
|
1402
|
+
return {
|
|
1403
|
+
account: inbox.member,
|
|
1404
|
+
rows,
|
|
1405
|
+
newest,
|
|
1406
|
+
next:
|
|
1407
|
+
!stale && typeof next === "string" && next && next.length <= 4096
|
|
1408
|
+
? next
|
|
1409
|
+
: null,
|
|
1410
|
+
};
|
|
1221
1411
|
}
|
|
1222
1412
|
async function listen(input) {
|
|
1223
1413
|
if (!input.bridge_id || !input.token)
|
|
@@ -1259,5 +1449,5 @@ export function linkedInInboxProgram() {
|
|
|
1259
1449
|
);
|
|
1260
1450
|
return { listening: true };
|
|
1261
1451
|
}
|
|
1262
|
-
globalThis[key] = { version, read, listen, send, detach };
|
|
1452
|
+
globalThis[key] = { version, read, listen, send, lookup, history, detach };
|
|
1263
1453
|
}
|
|
@@ -8,10 +8,13 @@ import {
|
|
|
8
8
|
requireBrowser,
|
|
9
9
|
type ActionContext,
|
|
10
10
|
type ActionResult,
|
|
11
|
+
type EventEnvelope,
|
|
11
12
|
type FeedObserveContext,
|
|
12
13
|
type FeedReadContext,
|
|
13
14
|
type FeedReadResult,
|
|
14
15
|
type ChromeActionDispatcher,
|
|
16
|
+
type SyncContext,
|
|
17
|
+
type SyncResult,
|
|
15
18
|
} from "@lobu/connector-sdk";
|
|
16
19
|
import { linkedInInboxProgram } from "./linkedin-inbox-adapter.js";
|
|
17
20
|
import {
|
|
@@ -21,6 +24,21 @@ import {
|
|
|
21
24
|
|
|
22
25
|
export interface LinkedInInboxCheckpoint {
|
|
23
26
|
linkedin_inbox?: Record<string, unknown>;
|
|
27
|
+
linkedin_direct_messages?: LinkedInDirectMessagesCheckpoint;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Where stored direct-message history stands. `after` is the newest
|
|
32
|
+
* conversation activity (ms) a finished walk stored; a walk in progress
|
|
33
|
+
* carries LinkedIn's conversation cursor, the newest activity it has seen and
|
|
34
|
+
* how many pages it has read.
|
|
35
|
+
*/
|
|
36
|
+
interface LinkedInDirectMessagesCheckpoint {
|
|
37
|
+
account: string;
|
|
38
|
+
after?: number;
|
|
39
|
+
page?: string;
|
|
40
|
+
newest?: number;
|
|
41
|
+
pages?: number;
|
|
24
42
|
}
|
|
25
43
|
|
|
26
44
|
/**
|
|
@@ -59,7 +77,7 @@ async function readyTab(browser: ChromeActionDispatcher): Promise<number> {
|
|
|
59
77
|
async function invoke<T>(
|
|
60
78
|
browser: ChromeActionDispatcher,
|
|
61
79
|
tabId: number,
|
|
62
|
-
op: "read" | "listen" | "send",
|
|
80
|
+
op: "read" | "listen" | "send" | "lookup" | "history",
|
|
63
81
|
input: Record<string, unknown>
|
|
64
82
|
): Promise<T> {
|
|
65
83
|
const result = await browser.dispatch<{ value?: T; exception?: unknown }>(
|
|
@@ -81,8 +99,8 @@ async function invoke<T>(
|
|
|
81
99
|
* Send one text reply into an existing direct-message conversation from the
|
|
82
100
|
* scrape-owned tab, without opening the inbox. A full conversation URN sends
|
|
83
101
|
* from the inbox it names (a company page's, for a page feed's row). The page program refuses group
|
|
84
|
-
* or unknown conversations,
|
|
85
|
-
* the message shows in the conversation.
|
|
102
|
+
* or unknown conversations, sends at most once per operation run (`ctx.run.id`),
|
|
103
|
+
* and returns only once the message shows in the conversation.
|
|
86
104
|
*/
|
|
87
105
|
export async function sendLinkedInMessage(
|
|
88
106
|
ctx: ActionContext
|
|
@@ -98,7 +116,37 @@ export async function sendLinkedInMessage(
|
|
|
98
116
|
expected_account: expectedAccount,
|
|
99
117
|
conversation_id: ctx.input.conversation_id,
|
|
100
118
|
text: ctx.input.text,
|
|
101
|
-
|
|
119
|
+
run_id: ctx.run.id,
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
return { success: true, output };
|
|
123
|
+
} catch (error) {
|
|
124
|
+
return {
|
|
125
|
+
success: false,
|
|
126
|
+
error: error instanceof Error ? error.message : String(error),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Show direct-message conversations as the person on the other side (name,
|
|
133
|
+
* headline, photo) for `send_message.conversation_id`'s lookup. Read-only: it
|
|
134
|
+
* reads the conversation list from the scrape-owned tab, never the inbox page.
|
|
135
|
+
*/
|
|
136
|
+
export async function lookupLinkedInConversations(
|
|
137
|
+
ctx: ActionContext
|
|
138
|
+
): Promise<ActionResult> {
|
|
139
|
+
try {
|
|
140
|
+
const expectedAccount = savedAccount(ctx);
|
|
141
|
+
const browser = requireBrowser(ctx);
|
|
142
|
+
const output = await invoke<Record<string, unknown>>(
|
|
143
|
+
browser,
|
|
144
|
+
await readyTab(browser),
|
|
145
|
+
"lookup",
|
|
146
|
+
{
|
|
147
|
+
expected_account: expectedAccount,
|
|
148
|
+
values: ctx.input.values,
|
|
149
|
+
query: ctx.input.query,
|
|
102
150
|
}
|
|
103
151
|
);
|
|
104
152
|
return { success: true, output };
|
|
@@ -167,3 +215,103 @@ export async function observeLinkedInInbox<
|
|
|
167
215
|
token: binding.token,
|
|
168
216
|
});
|
|
169
217
|
}
|
|
218
|
+
|
|
219
|
+
/** One conversations page of stored history; the walk ends at five. */
|
|
220
|
+
const DIRECT_MESSAGE_WALK_PAGES = 5;
|
|
221
|
+
|
|
222
|
+
interface DirectMessageRow {
|
|
223
|
+
id: string;
|
|
224
|
+
conversation_id: string;
|
|
225
|
+
thread_id: string;
|
|
226
|
+
conversation_url: string;
|
|
227
|
+
text: string;
|
|
228
|
+
content_kind: string;
|
|
229
|
+
has_attachments: boolean;
|
|
230
|
+
sender_id: string | null;
|
|
231
|
+
sender_member_id: string | null;
|
|
232
|
+
sender_slug: string | null;
|
|
233
|
+
sender_name: string;
|
|
234
|
+
from_me: boolean | null;
|
|
235
|
+
occurred_at: string;
|
|
236
|
+
counterpart_id: string;
|
|
237
|
+
counterpart_member_id: string | null;
|
|
238
|
+
counterpart_slug: string | null;
|
|
239
|
+
counterpart_name: string;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
interface DirectMessageHistoryPage {
|
|
243
|
+
account: string;
|
|
244
|
+
rows: DirectMessageRow[];
|
|
245
|
+
newest: number | null;
|
|
246
|
+
next: string | null;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function directMessageEvent(row: DirectMessageRow): EventEnvelope {
|
|
250
|
+
const present = (value: string | null) => (value ? value : undefined);
|
|
251
|
+
return {
|
|
252
|
+
origin_id: row.id,
|
|
253
|
+
origin_type: "message",
|
|
254
|
+
origin_parent_id: row.thread_id,
|
|
255
|
+
payload_text: row.text,
|
|
256
|
+
author_name: present(row.sender_name),
|
|
257
|
+
source_url: row.conversation_url,
|
|
258
|
+
occurred_at: new Date(row.occurred_at),
|
|
259
|
+
metadata: {
|
|
260
|
+
conversation_id: row.conversation_id,
|
|
261
|
+
content_kind: row.content_kind,
|
|
262
|
+
has_attachments: row.has_attachments,
|
|
263
|
+
...(row.from_me === null ? {} : { from_me: row.from_me }),
|
|
264
|
+
sender_member_id: present(row.sender_member_id),
|
|
265
|
+
sender_slug: present(row.sender_slug),
|
|
266
|
+
sender_name: present(row.sender_name),
|
|
267
|
+
counterpart_member_id: present(row.counterpart_member_id),
|
|
268
|
+
counterpart_slug: present(row.counterpart_slug),
|
|
269
|
+
counterpart_name: row.counterpart_name,
|
|
270
|
+
},
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Store the signed-in member's 1:1 messages, one conversations page per run.
|
|
276
|
+
* A walk reads the inbox from the most recent activity down to the last
|
|
277
|
+
* finished walk's watermark, the end of the inbox, or five pages, whichever
|
|
278
|
+
* comes first, then moves the watermark. Each changed conversation stores its
|
|
279
|
+
* recent message page; re-stored messages deduplicate by message URN. Groups
|
|
280
|
+
* are skipped, and the inbox is read from the scrape-owned tab, so nothing is
|
|
281
|
+
* marked seen.
|
|
282
|
+
*/
|
|
283
|
+
export async function syncLinkedInDirectMessages(
|
|
284
|
+
ctx: SyncContext<LinkedInInboxCheckpoint, unknown>
|
|
285
|
+
): Promise<SyncResult> {
|
|
286
|
+
const expectedAccount = savedAccount(ctx);
|
|
287
|
+
const browser = requireBrowser(ctx);
|
|
288
|
+
const prior = ctx.checkpoint?.linkedin_direct_messages;
|
|
289
|
+
const page = await invoke<DirectMessageHistoryPage>(
|
|
290
|
+
browser,
|
|
291
|
+
await readyTab(browser),
|
|
292
|
+
"history",
|
|
293
|
+
{ expected_account: expectedAccount, page: prior?.page, after: prior?.after }
|
|
294
|
+
);
|
|
295
|
+
if (prior && prior.account !== page.account)
|
|
296
|
+
throw new Error(
|
|
297
|
+
"LinkedIn direct message checkpoint belongs to another account; reconnect this source"
|
|
298
|
+
);
|
|
299
|
+
const newest = Math.max(prior?.newest ?? -1, page.newest ?? -1, prior?.after ?? -1);
|
|
300
|
+
const pages = (prior?.page ? (prior.pages ?? 1) : 0) + 1;
|
|
301
|
+
const done = !page.next || pages >= DIRECT_MESSAGE_WALK_PAGES;
|
|
302
|
+
const checkpoint: LinkedInDirectMessagesCheckpoint = done
|
|
303
|
+
? { account: page.account, ...(newest >= 0 ? { after: newest } : {}) }
|
|
304
|
+
: {
|
|
305
|
+
account: page.account,
|
|
306
|
+
...(prior?.after !== undefined ? { after: prior.after } : {}),
|
|
307
|
+
page: page.next as string,
|
|
308
|
+
...(newest >= 0 ? { newest } : {}),
|
|
309
|
+
pages,
|
|
310
|
+
};
|
|
311
|
+
const events = page.rows.map(directMessageEvent);
|
|
312
|
+
await ctx.commit(events, { linkedin_direct_messages: checkpoint });
|
|
313
|
+
return {
|
|
314
|
+
status: done ? "complete" : "more",
|
|
315
|
+
metadata: { items_found: events.length },
|
|
316
|
+
};
|
|
317
|
+
}
|